Compare commits

...

13 Commits

Author SHA1 Message Date
mattijs
8b319324b6 COMP: g++11: suppress optimisation. See #3024 2024-01-19 20:29:44 +01:00
Kutalmis Bercin
9f40e04cc1 BUG: ThermoSurfaceFilm: reintroduce energy to film sources (fixes #2996) 2023-10-11 11:31:51 +01:00
mattijs
927b06a19d BUG: mapFields: incorrect patches. Fixes #2944. 2023-08-30 16:37:41 +02:00
Mark Olesen
e6a27e0a67 BUG: expressions rand() ignores objectRegistry timeIndex (fixes #2923) 2023-06-26 17:58:31 +02:00
Mark Olesen
50b44dbfe2 BUG: UPstream::shutdown misbehaves with external initialisation (fixes #2808)
- freeCommmunicatorComponents needs an additional bounds check.
  When MPI is initialized outside of OpenFOAM, there are no
  UPstream communicator equivalents
2023-06-20 09:27:35 +02:00
Kutalmis Bercin
54567be3c6 Revert "BUG: Fixing ray dAve and omega for 1D and 2D cases"
This reverts commit 5848b0afd5.
2023-05-22 09:39:53 +01:00
Mark Olesen
8c20e769ba BUG: VTK write pointSet fails in parallel (fixes #2773)
- de-referenced autoPtr with () instead of ref() will fail on
  non-master ranks.
2023-05-05 16:05:25 +02:00
Mark Olesen
d1264955e8 COMP: code adjustments for gcc-13 (#2714) 2023-02-28 16:03:54 +01:00
Mark Olesen
2c6fc15734 BUG: globalIndex gather/scatter fails with multi-world (fixes #2706)
- was using UPstream::procIDs(), which returns the sub-ranks with
  respect to the parent communicator. This is normally just an
  identity list (single-world) but with multi-world the indexing
  is incorrect.  Use UPstream::allProcs() instead.
2023-02-22 10:01:48 +01:00
Mark Olesen
ffde9c2c6f COMP: backslash instead of slash in Make/options 2023-02-22 09:41:49 +01:00
Mark Olesen
0081eca87d BUG: expression field functionObject 'store' keyword ignored 2023-02-22 09:41:27 +01:00
Mark Olesen
a3f173e937 BUG: inconsistent finiteArea proc-boundary contributions (fixes #2672) 2023-02-22 09:37:02 +01:00
Mark Olesen
06a60286d2 BUG: incorrect order for output scaling (transformPoints, ...)
- the output write scaling should be applied *after* undoing the
  effects of the specified rotation centre. Fixes #2566

ENH: update option names for transformPoints and surfaceTransformPoints

- prefer  '-auto-centre' and '-centre', but also accept the previous
  options '-auto-origin' and '-origin' as aliases.

  Changing to '-centre' avoids possible confusion with
  coordinate system origin().
2022-08-18 12:29:57 +02:00
34 changed files with 232 additions and 494 deletions

View File

@ -9,7 +9,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \

View File

@ -7,7 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \

View File

@ -10,7 +10,7 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \

View File

@ -7,7 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \

View File

@ -19,7 +19,7 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \

View File

@ -8,7 +8,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \

View File

@ -53,8 +53,8 @@ Usage
-rotate-angle (vector angle)
Rotate angle degrees about vector axis.
or -yawPitchRoll (yawdegrees pitchdegrees rolldegrees)
or -rollPitchYaw (rolldegrees pitchdegrees yawdegrees)
or -yawPitchRoll : (yaw pitch roll) degrees
or -rollPitchYaw : (roll pitch yaw) degrees
-scale scalar|vector
Scale the points by the given scalar or vector on output.
@ -259,15 +259,18 @@ int main(int argc, char *argv[])
);
argList::addBoolOption
(
"auto-origin",
"Use bounding box centre as origin for rotations"
"auto-centre",
"Use bounding box centre as centre for rotations"
);
argList::addOption
(
"origin",
"centre",
"point",
"Use specified <point> as origin for rotations"
"Use specified <point> as centre for rotations"
);
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
argList::addOptionCompat("centre", {"origin", 2206});
argList::addOption
(
"rotate",
@ -411,18 +414,18 @@ int main(int argc, char *argv[])
points += v;
}
vector origin;
bool useOrigin = args.readIfPresent("origin", origin);
if (args.found("auto-origin") && !useOrigin)
vector rotationCentre;
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
if (args.found("auto-centre") && !useRotationCentre)
{
useOrigin = true;
origin = boundBox(points).centre();
useRotationCentre = true;
rotationCentre = boundBox(points).centre();
}
if (useOrigin)
if (useRotationCentre)
{
Info<< "Set origin for rotations to " << origin << endl;
points -= origin;
Info<< "Set centre of rotation to " << rotationCentre << endl;
points -= rotationCentre;
}
if (args.found("rotate"))
@ -503,15 +506,15 @@ int main(int argc, char *argv[])
}
}
if (useRotationCentre)
{
Info<< "Unset centre of rotation from " << rotationCentre << endl;
points += rotationCentre;
}
// Output scaling
applyScaling(points, getScalingOpt("scale", args));
if (useOrigin)
{
Info<< "Unset origin for rotations from " << origin << endl;
points += origin;
}
// Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));

View File

@ -188,15 +188,18 @@ int main(int argc, char *argv[])
);
argList::addBoolOption
(
"auto-origin",
"Use bounding box centre as origin for rotations"
"auto-centre",
"Use bounding box centre as centre for rotations"
);
argList::addOption
(
"origin",
"centre",
"point",
"Use specified <point> as origin for rotations"
"Use specified <point> as centre for rotations"
);
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
argList::addOptionCompat("centre", {"origin", 2206});
argList::addOption
(
"rotate",
@ -334,18 +337,18 @@ int main(int argc, char *argv[])
points += v;
}
vector origin;
bool useOrigin = args.readIfPresent("origin", origin);
if (args.found("auto-origin") && !useOrigin)
vector rotationCentre;
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
if (args.found("auto-centre") && !useRotationCentre)
{
useOrigin = true;
origin = boundBox(points).centre();
useRotationCentre = true;
rotationCentre = boundBox(points).centre();
}
if (useOrigin)
if (useRotationCentre)
{
Info<< "Set origin for rotations to " << origin << endl;
points -= origin;
Info<< "Set centre of rotation to " << rotationCentre << endl;
points -= rotationCentre;
}
if (args.found("rotate"))
@ -406,15 +409,15 @@ int main(int argc, char *argv[])
points = transform(rot, points);
}
if (useRotationCentre)
{
Info<< "Unset centre of rotation from " << rotationCentre << endl;
points += rotationCentre;
}
// Output scaling
applyScaling(points, getScalingOpt("write-scale", args));
if (useOrigin)
{
Info<< "Unset origin for rotations from " << origin << endl;
points += origin;
}
surf1.movePoints(points);
surf1.write(exportName, writeFileType);

View File

@ -174,7 +174,7 @@ Foam::tokenList Foam::functionEntries::evalEntry::evaluate
result.writeField(toks);
}
return std::move(toks);
return tokenList(std::move(toks.tokens()));
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,9 +41,11 @@ void Foam::expressions::exprDriver::fill_random
{
if (seed <= 0)
{
if (timeStatePtr_)
const TimeState* ts = this->timeState();
if (ts)
{
seed = (timeStatePtr_->timeIndex() - seed);
seed = (ts->timeIndex() - seed);
}
else
{

View File

@ -202,7 +202,8 @@ inline Foam::Matrix<Form, Type>::Matrix
)
:
mRows_(Mb.m()),
nCols_(Mb.n())
nCols_(Mb.n()),
v_(nullptr)
{
doAlloc();
@ -224,7 +225,8 @@ inline Foam::Matrix<Form, Type>::Matrix
)
:
mRows_(Mb.m()),
nCols_(Mb.n())
nCols_(Mb.n()),
v_(nullptr)
{
doAlloc();

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -395,12 +395,12 @@ public:
//- Collect indirect data in processor order on master
// Offsets needed on master only.
template<class Type, class Addr>
template<class ProcIDsContainer, class Type, class Addr>
static void gather
(
const labelUList& offsets,
const label comm, //!< communicator
const UList<int>& procIDs,
const ProcIDsContainer& procIDs,
const IndirectListBase<Type, Addr>& fld,
List<Type>& allFld,
const int tag = UPstream::msgType(),

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -225,12 +225,12 @@ void Foam::globalIndex::gather
}
template<class Type, class Addr>
template<class ProcIDsContainer, class Type, class Addr>
void Foam::globalIndex::gather
(
const labelUList& off,
const label comm,
const UList<int>& procIDs,
const ProcIDsContainer& procIDs,
const IndirectListBase<Type, Addr>& fld,
List<Type>& allFld,
const int tag,
@ -302,7 +302,7 @@ void Foam::globalIndex::gather
gather
(
comm,
UPstream::procID(comm),
UPstream::allProcs(comm), // All communicator ranks
fld,
allFld,
tag,
@ -325,7 +325,7 @@ void Foam::globalIndex::gather
(
offsets_,
comm,
UPstream::procID(comm),
UPstream::allProcs(comm), // All communicator ranks
fld,
allFld,
tag,
@ -370,7 +370,7 @@ void Foam::globalIndex::gather
gather
(
comm,
UPstream::procID(comm),
UPstream::allProcs(comm), // All communicator ranks
fld,
allFld,
tag,
@ -658,7 +658,7 @@ void Foam::globalIndex::scatter
(
offsets_,
comm,
UPstream::procID(comm),
UPstream::allProcs(comm), // All communicator ranks
allFld,
fld,
tag,

View File

@ -513,6 +513,10 @@ inline Foam::Tensor<Cmpt> Foam::Tensor<Cmpt>::T() const
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Tensor<Cmpt>
Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
{
@ -536,6 +540,10 @@ Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Tensor<Cmpt>
Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const
{
@ -971,6 +979,10 @@ operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
//- Inner-product of a SphericalTensor and a Tensor
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt>
operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
{
@ -985,6 +997,10 @@ operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
//- Inner-product of a Tensor and a SphericalTensor
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt>
operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
{
@ -999,6 +1015,10 @@ operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
//- Inner-product of a SymmTensor and a Tensor
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt>
operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
{
@ -1021,6 +1041,10 @@ operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
//- Inner-product of a Tensor and a SymmTensor
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt>
operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
{
@ -1047,7 +1071,7 @@ template<class Cmpt>
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt>>::type
inline Vector<Cmpt>
operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
{
return Vector<Cmpt>
@ -1061,7 +1085,11 @@ operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
//- Inner-product of a Vector and a Tensor
template<class Cmpt>
inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt>>::type
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Vector<Cmpt>
operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
{
return Vector<Cmpt>

View File

@ -29,6 +29,7 @@ License
#include "word.H"
#include "debug.H"
#include <cctype>
#include <cstdint>
#include <sstream>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -1265,7 +1265,17 @@ void Foam::UPstream::allocatePstreamCommunicator
void Foam::UPstream::freePstreamCommunicator(const label communicator)
{
if (communicator != 0)
// Not touching the first communicator (WORLD)
// or anything out-of bounds.
//
// No UPstream communicator indices when MPI is initialized outside
// of OpenFOAM - thus needs a bounds check too!
if
(
communicator > 0
&& (communicator < PstreamGlobals::MPICommunicators_.size())
)
{
if (PstreamGlobals::MPICommunicators_[communicator] != MPI_COMM_NULL)
{

View File

@ -44,7 +44,6 @@ $(basicFaPatchFields)/transform/transformFaPatchScalarField.C
constraintFaPatchFields = $(faPatchFields)/constraint
$(constraintFaPatchFields)/empty/emptyFaPatchFields.C
$(constraintFaPatchFields)/processor/processorFaPatchFields.C
$(constraintFaPatchFields)/processor/processorFaPatchScalarField.C
$(constraintFaPatchFields)/wedge/wedgeFaPatchFields.C
$(constraintFaPatchFields)/wedge/wedgeFaPatchScalarField.C
$(constraintFaPatchFields)/cyclic/cyclicFaPatchFields.C

View File

@ -181,13 +181,6 @@ public:
// Coupled interface functionality
//- Transform given patch component field
virtual void transformCoupleField
(
solveScalarField& f,
const direction cmpt
) const = 0;
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(

View File

@ -1,58 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef transformFaPatchFieldsFwd_H
#define transformFaPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class transformFaPatchField;
// typedef transformFaPatchField<scalar> transformFaPatchScalarField;
// typedef transformFaPatchField<vector> transformFaPatchVectorField;
// typedef transformFaPatchField<tensor> transformFaPatchTensorField;
// template<class Type> class transformFaPatchField;
makeFaPatchTypeFieldTypedefs(transform)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -187,20 +187,7 @@ void Foam::cyclicFaPatchField<Type>::updateInterfaceMatrix
transformCoupleField(pnf, cmpt);
// Multiply the field by coefficients and add into the result
if (add)
{
forAll(faceCells, elemI)
{
result[faceCells[elemI]] += coeffs[elemI]*pnf[elemI];
}
}
else
{
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
this->addToInternalField(result, !add, faceCells, coeffs, pnf);
}
@ -227,21 +214,11 @@ void Foam::cyclicFaPatchField<Type>::updateInterfaceMatrix
pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
}
// Transform according to the transformation tensors
transformCoupleField(pnf);
// Multiply the field by coefficients and add into the result
if (add)
{
forAll(faceCells, elemI)
{
result[faceCells[elemI]] += coeffs[elemI]*pnf[elemI];
}
}
else
{
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
this->addToInternalField(result, !add, faceCells, coeffs, pnf);
}

View File

@ -164,16 +164,6 @@ public:
// Coupled interface functionality
//- Transform neighbour field
virtual void transformCoupleField
(
solveScalarField& f,
const direction cmpt
) const
{
cyclicLduInterfaceField::transformCoupleField(f, cmpt);
}
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(

View File

@ -132,13 +132,6 @@ Foam::processorFaPatchField<Type>::processorFaPatchField
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
Foam::processorFaPatchField<Type>::~processorFaPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
@ -205,6 +198,8 @@ void Foam::processorFaPatchField<Type>::initInterfaceMatrixUpdate
commsType,
this->patch().patchInternalField(psiInternal)()
);
const_cast<processorFaPatchField<Type>&>(*this).updatedMatrix() = false;
}
@ -221,32 +216,28 @@ void Foam::processorFaPatchField<Type>::updateInterfaceMatrix
const Pstream::commsTypes commsType
) const
{
if (this->updatedMatrix())
{
return;
}
const labelUList& faceCells = this->patch().edgeFaces();
solveScalarField pnf
(
procPatch_.receive<solveScalar>(commsType, this->size())()
procPatch_.receive<solveScalar>(commsType, this->size())
);
// Transform according to the transformation tensor
transformCoupleField(pnf, cmpt);
if (!std::is_arithmetic<Type>::value)
{
// Transform non-scalar data according to the transformation tensor
transformCoupleField(pnf, cmpt);
}
// Multiply the field by coefficients and add into the result
this->addToInternalField(result, !add, faceCells, coeffs, pnf);
const labelUList& edgeFaces = this->patch().edgeFaces();
if (add)
{
forAll(edgeFaces, elemI)
{
result[edgeFaces[elemI]] += coeffs[elemI]*pnf[elemI];
}
}
else
{
forAll(edgeFaces, elemI)
{
result[edgeFaces[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
const_cast<processorFaPatchField<Type>&>(*this).updatedMatrix() = true;
}
@ -267,6 +258,8 @@ void Foam::processorFaPatchField<Type>::initInterfaceMatrixUpdate
commsType,
this->patch().patchInternalField(psiInternal)()
);
const_cast<processorFaPatchField<Type>&>(*this).updatedMatrix() = false;
}
@ -282,29 +275,25 @@ void Foam::processorFaPatchField<Type>::updateInterfaceMatrix
const Pstream::commsTypes commsType
) const
{
if (this->updatedMatrix())
{
return;
}
const labelUList& faceCells = this->patch().edgeFaces();
Field<Type> pnf
(
procPatch_.receive<Type>(commsType, this->size())()
procPatch_.receive<Type>(commsType, this->size())
);
// Transform according to the transformation tensor
transformCoupleField(pnf);
// Multiply the field by coefficients and add into the result
this->addToInternalField(result, !add, faceCells, coeffs, pnf);
const labelUList& edgeFaces = this->patch().edgeFaces();
if (add)
{
forAll(edgeFaces, elemI)
{
result[edgeFaces[elemI]] += coeffs[elemI]*pnf[elemI];
}
}
else
{
forAll(edgeFaces, elemI)
{
result[edgeFaces[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
const_cast<processorFaPatchField<Type>&>(*this).updatedMatrix() = true;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef processorFaPatchField_H
#define processorFaPatchField_H
#ifndef Foam_processorFaPatchField_H
#define Foam_processorFaPatchField_H
#include "coupledFaPatchField.H"
#include "processorLduInterfaceField.H"
@ -139,9 +139,8 @@ public:
}
// Destructor
~processorFaPatchField();
//- Destructor
~processorFaPatchField() = default;
// Member functions
@ -176,17 +175,8 @@ public:
//- Return patch-normal gradient
virtual tmp<Field<Type>> snGrad() const;
// Coupled interface functionality
//- Transform neighbour field
virtual void transformCoupleField
(
solveScalarField& f,
const direction cmpt
) const
{
processorLduInterfaceField::transformCoupleField(f, cmpt);
}
// Coupled interface functionality
//- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate

View File

@ -25,10 +25,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef processorFaPatchFields_H
#define processorFaPatchFields_H
#ifndef Foam_processorFaPatchFields_H
#define Foam_processorFaPatchFields_H
#include "processorFaPatchScalarField.H"
#include "processorFaPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,52 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef processorFaPatchFieldsFwd_H
#define processorFaPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class processorFaPatchField;
makeFaPatchTypeFieldTypedefs(processor)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,100 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "processorFaPatchScalarField.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<>
void Foam::processorFaPatchField<Foam::scalar>::transformCoupleField
(
solveScalarField& f,
const direction cmpt
) const
{}
template<>
void Foam::processorFaPatchField<Foam::scalar>::initInterfaceMatrixUpdate
(
solveScalarField& result,
const bool add,
const lduAddressing& lduAddr,
const label patchId,
const solveScalarField& psiInternal,
const scalarField& coeffs,
const direction,
const Pstream::commsTypes commsType
) const
{
procPatch_.send
(
commsType,
patch().patchInternalField(psiInternal)()
);
}
template<>
void Foam::processorFaPatchField<Foam::scalar>::updateInterfaceMatrix
(
solveScalarField& result,
const bool add,
const lduAddressing& lduAddr,
const label patchId,
const solveScalarField&,
const scalarField& coeffs,
const direction,
const Pstream::commsTypes commsType
) const
{
solveScalarField pnf
(
procPatch_.receive<solveScalar>(commsType, this->size())()
);
const labelUList& edgeFaces = patch().edgeFaces();
if (add)
{
forAll(edgeFaces, facei)
{
result[edgeFaces[facei]] -= coeffs[facei]*pnf[facei];
}
}
else
{
forAll(edgeFaces, facei)
{
result[edgeFaces[facei]] -= coeffs[facei]*pnf[facei];
}
}
}
// ************************************************************************* //

View File

@ -1,86 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef processorFaPatchScalarField_H
#define processorFaPatchScalarField_H
#include "processorFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<>
void processorFaPatchField<scalar>::transformCoupleField
(
solveScalarField& f,
const direction cmpt
) const;
template<>
void processorFaPatchField<scalar>::initInterfaceMatrixUpdate
(
solveScalarField& result,
const bool add,
const lduAddressing& lduAddr,
const label patchId,
const solveScalarField&,
const scalarField& coeffs,
const direction,
const Pstream::commsTypes commsType
) const;
template<>
void processorFaPatchField<scalar>::updateInterfaceMatrix
(
solveScalarField& result,
const bool add,
const lduAddressing& lduAddr,
const label patchId,
const solveScalarField&,
const scalarField& coeffs,
const direction,
const Pstream::commsTypes commsType
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -393,7 +393,7 @@ bool Foam::functionObjects::fvExpressionField::read(const dictionary& dict)
}
autowrite_ = dict.getOrDefault("autowrite", false);
store_ = dict.getOrDefault("autowrite", true);
store_ = dict.getOrDefault("store", true);
// "dimensions" is optional
dimensions_.clear();

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -62,6 +62,53 @@ Foam::ThermoSurfaceFilm<CloudType>::ThermoSurfaceFilm
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
template<class filmType>
void Foam::ThermoSurfaceFilm<CloudType>::absorbInteraction
(
filmType& film,
const parcelType& p,
const polyPatch& pp,
const label facei,
const scalar mass,
bool& keepParticle
)
{
DebugInfo<< "Parcel " << p.origId() << " absorbInteraction" << endl;
// Patch face normal
const vector& nf = pp.faceNormals()[facei];
// Patch velocity
const vector& Up = this->owner().U().boundaryField()[pp.index()][facei];
// Relative parcel velocity
const vector Urel(p.U() - Up);
// Parcel normal velocity
const vector Un(nf*(Urel & nf));
// Parcel tangential velocity
const vector Ut(Urel - Un);
film.addSources
(
pp.index(),
facei,
mass, // mass
mass*Ut, // tangential momentum
mass*mag(Un), // impingement pressure
mass*p.hs() // energy
);
this->nParcelsTransferred()++;
this->totalMassTransferred() += mass;
keepParticle = false;
}
template<class CloudType>
bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel
(

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -141,6 +141,21 @@ public:
// Member Functions
// Interaction models
//- Absorb parcel into film
template<class filmType>
void absorbInteraction
(
filmType&,
const parcelType& p,
const polyPatch& pp,
const label facei,
const scalar mass,
bool& keepParticle
);
// Evaluation
//- Transfer parcel from cloud to surface film

View File

@ -155,7 +155,7 @@ bool Foam::vtk::writePointSet
if (parallel)
{
vtk::writeListParallel(format(), mesh.points(), pointLabels);
vtk::writeListParallel(format.ref(), mesh.points(), pointLabels);
}
else
{

View File

@ -1845,7 +1845,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
// //globalBorderTris.gather
// //(
// // UPstream::worldComm,
// // UPstream::procID(Pstream::worldComm),
// // UPstream::allProcs(UPstream::worldComm),
// // globalBorderCentres
// //);
// pointField globalBorderCentres(allCentres);
@ -1893,7 +1893,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
// //globalBorderTris.scatter
// //(
// // UPstream::worldComm,
// // UPstream::procID(Pstream::worldComm),
// // UPstream::allProcs(UPstream::worldComm),
// // isMasterPoint
// //);
// //boolList isMasterBorder(s.size(), false);
@ -1990,7 +1990,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
globalTris().gather
(
UPstream::worldComm,
UPstream::procID(Pstream::worldComm),
UPstream::allProcs(UPstream::worldComm),
allCentres
);
}
@ -2040,7 +2040,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
globalTris().scatter
(
UPstream::worldComm,
UPstream::procID(Pstream::worldComm),
UPstream::allProcs(UPstream::worldComm),
allDistribution,
distribution
);

View File

@ -843,15 +843,15 @@ Foam::meshToMesh::mapTgtToSrc
label srcPatchi = srcPatchID_[i];
label tgtPatchi = tgtPatchID_[i];
if (!srcPatchFields.set(tgtPatchi))
if (!srcPatchFields.set(srcPatchi))
{
srcPatchFields.set
(
srcPatchi,
fvPatchField<Type>::New
(
tgtBfld[srcPatchi],
srcMesh.boundary()[tgtPatchi],
tgtBfld[tgtPatchi],
srcMesh.boundary()[srcPatchi],
DimensionedField<Type, volMesh>::null(),
directFvPatchFieldMapper
(

View File

@ -140,17 +140,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
if (mesh_.nSolutionD() == 2)
{
// Omega for 2D
omega_ = deltaPhi;
// dAve for 2D
dAve_ = vector
(
2*sinPhi*Foam::sin(0.5*deltaPhi),
2*cosPhi*Foam::sin(0.5*deltaPhi),
0
);
vector meshDir(Zero);
if (dom_.meshOrientation() != vector::zero)
{
@ -172,7 +161,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
dAve_ = coordRot & dAve_;
d_ = coordRot & d_;
}
else if (mesh_.nSolutionD() == 1)
{
@ -195,9 +183,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
dAve_ = (dAve_ & normal)*meshDir;
d_ = (d_ & normal)*meshDir;
// Omega normalization for 1D
omega_ /= 2;
}
autoPtr<volScalarField> IDefaultPtr;