ENH: place more patch field attributes under template invariant Base

- attributes such as assignable(), coupled() etc

- common patchField types: calculatedType(), zeroGradientType() etc.
  This simplifies reference to these types without actually needing a
  typed patchField version.

ENH: add some basic patchField types to fieldTypes namespace

- allows more general use of the names

ENH: set extrapolated/calculated from patchInternalField directly

- avoids intermediate tmp
This commit is contained in:
Mark Olesen 2023-03-23 16:27:32 +01:00
parent bd1e1ec9c7
commit 87eed5e3b8
88 changed files with 462 additions and 586 deletions

View File

@ -105,7 +105,8 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::operator=(patchInternalField());
// Fallback: set to the internal field
fvPatchField<scalar>::patchInternalField(*this);
}
refValue() = *this;

View File

@ -47,7 +47,7 @@ tractionDisplacementFvPatchVectorField
traction_(p.size(), Zero),
pressure_(p.size(), Zero)
{
fvPatchVectorField::operator=(patchInternalField());
fvPatchField<vector>::patchInternalField(*this);
gradient() = Zero;
}
@ -79,7 +79,7 @@ tractionDisplacementFvPatchVectorField
traction_("traction", dict, p.size()),
pressure_("pressure", dict, p.size())
{
fvPatchVectorField::operator=(patchInternalField());
fvPatchField<vector>::patchInternalField(*this);
gradient() = Zero;
}

View File

@ -47,7 +47,7 @@ tractionDisplacementCorrectionFvPatchVectorField
traction_(p.size(), Zero),
pressure_(p.size(), Zero)
{
fvPatchVectorField::operator=(patchInternalField());
fvPatchField<vector>::patchInternalField(*this);
gradient() = Zero;
}
@ -79,7 +79,7 @@ tractionDisplacementCorrectionFvPatchVectorField
traction_("traction", dict, p.size()),
pressure_("pressure", dict, p.size())
{
fvPatchVectorField::operator=(patchInternalField());
fvPatchField<vector>::patchInternalField(*this);
gradient() = Zero;
}

View File

@ -53,13 +53,13 @@ int main(int argc, char *argv[])
(
"U",
runTime.timeName(),
mesh,
pMesh.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
IOobject::NO_WRITE
),
pMesh,
dimensionedVector(dimLength, Zero),
pointPatchVectorField::calculatedType()
dimensionedVector(dimLength, Zero)
// pointPatchFieldBase::calculatedType()
);
pointVectorField V(U + 2*U);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -42,4 +42,27 @@ const Foam::wordList Foam::fieldTypes::basic
});
// Commonly used patch field types
const Foam::word Foam::fieldTypes::emptyType
(
Foam::fieldTypes::emptyTypeName_()
);
const Foam::word Foam::fieldTypes::calculatedType
(
Foam::fieldTypes::calculatedTypeName_()
);
const Foam::word Foam::fieldTypes::extrapolatedCalculatedType
(
Foam::fieldTypes::extrapolatedCalculatedTypeName_()
);
const Foam::word Foam::fieldTypes::zeroGradientType
(
Foam::fieldTypes::zeroGradientTypeName_()
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -24,8 +24,15 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::fieldTypes
Description
Header files for all the primitive types that Fields are instantiated for.
Collection of common field types
Note
The fieldTypes header contains macros for primitive types
that Fields are instantiated for.
\*---------------------------------------------------------------------------*/
@ -69,9 +76,40 @@ namespace Foam
{
namespace fieldTypes
{
//- Standard basic field types (label, scalar, vector, tensor, etc)
// These also correspond to cloud output fields.
extern const wordList basic;
//- Standard basic field types (label, scalar, vector, tensor, etc)
// These also correspond to cloud output fields.
extern const wordList basic;
// Commonly used patch field types
//- An \c empty patch field type
inline const char* emptyTypeName_() noexcept { return "empty"; }
//- An \c empty patch field type
extern const word emptyType;
//- A \c calculated patch field type
inline const char* calculatedTypeName_() noexcept { return "calculated"; }
//- A \c calculated patch field type
extern const word calculatedType;
//- A combined \c zero-gradient and \c calculated patch field type
inline const char* extrapolatedCalculatedTypeName_() noexcept
{
return "extrapolatedCalculated";
}
//- A combined \c zero-gradient and \c calculated patch field type
extern const word extrapolatedCalculatedType;
//- A \c zeroGradient patch field type
inline const char* zeroGradientTypeName_() noexcept { return "zeroGradient"; }
//- A \c zeroGradient patch field type
extern const word zeroGradientType;
} // End namespace fieldTypes
} // End namespace Foam

View File

@ -28,15 +28,6 @@ License
#include "calculatedPointPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
const Foam::word& Foam::pointPatchField<Type>::calculatedType()
{
return Foam::calculatedPointPatchField<Type>::typeName;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>

View File

@ -53,11 +53,10 @@ class calculatedPointPatchField
:
public pointPatchField<Type>
{
public:
//- Runtime type information
TypeName("calculated");
TypeName("calculated"); // fieldTypes::calculatedTypeName_()
// Constructors

View File

@ -139,18 +139,13 @@ public:
}
// Member functions
// Member Functions
// Access
//- Return true if this patch field fixes a value
virtual bool fixesValue() const
{
return true;
}
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
// Member operators
// Member Operators
// Disable assignment operators

View File

@ -27,15 +27,6 @@ License
#include "zeroGradientPointPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
const Foam::word& Foam::pointPatchField<Type>::zeroGradientType()
{
return Foam::zeroGradientPointPatchField<Type>::typeName;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>

View File

@ -56,7 +56,7 @@ class zeroGradientPointPatchField
public:
//- Runtime type information
TypeName("zeroGradient");
TypeName("zeroGradient"); // fieldTypes::zeroGradientTypeName_()
// Constructors

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef emptyPointPatchField_H
#define emptyPointPatchField_H
#ifndef Foam_emptyPointPatchField_H
#define Foam_emptyPointPatchField_H
#include "pointPatchField.H"
#include "emptyPointPatch.H"
@ -54,11 +54,10 @@ class emptyPointPatchField
:
public pointPatchField<Type>
{
public:
//- Runtime type information
TypeName(emptyPointPatch::typeName_());
TypeName(emptyPointPatch::typeName_()); // fieldTypes::emptyTypeName_()
// Constructors

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2022 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -140,8 +140,50 @@ public:
virtual ~pointPatchFieldBase() = default;
// Static Member Functions
//- The type name for \c empty patch fields
static const word& emptyType() noexcept
{
return Foam::fieldTypes::emptyType;
}
//- The type name for \c calculated patch fields
static const word& calculatedType() noexcept
{
return Foam::fieldTypes::calculatedType;
}
//- The type name for \c zeroGradient patch fields
static const word& zeroGradientType() noexcept
{
return Foam::fieldTypes::zeroGradientType;
}
// Member Functions
// Attributes
//- True if the patch field fixes a value
virtual bool fixesValue() const
{
return false;
}
//- True if the patch field is coupled
virtual bool coupled() const
{
return false;
}
//- The constraint type the pointPatchField implements
virtual const word& constraintType() const
{
return word::null;
}
// Access
//- The associated objectRegistry
@ -366,34 +408,6 @@ public:
// Member Functions
//- The type name for calculated patch fields
static const word& calculatedType();
//- The type name for zeroGradient patch fields
static const word& zeroGradientType();
// Attributes
//- True if this patch field fixes a value
virtual bool fixesValue() const
{
return false;
}
//- True if this patch field is coupled
virtual bool coupled() const
{
return false;
}
//- The constraint type this pointPatchField implements.
virtual const word& constraintType() const
{
return word::null;
}
// Access
//- Return the patch size

View File

@ -56,7 +56,7 @@ Foam::fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ),
tau0_(dict.getOrDefault<vector>("tau", Zero))
{
fvPatchField<vector>::operator=(patchInternalField());
fvPatchField<vector>::patchInternalField(*this);
}

View File

@ -366,7 +366,7 @@ epsilonWallFunctionFvPatchScalarField
cornerWeights_()
{
// Apply zero-gradient condition on start-up
this->operator==(patchInternalField());
fvPatchField<scalar>::patchInternalField(*this);
}

View File

@ -359,7 +359,7 @@ Foam::omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
cornerWeights_()
{
// apply zero-gradient condition on start-up
this->operator==(patchInternalField());
fvPatchField<scalar>::patchInternalField(*this);
}

View File

@ -114,8 +114,8 @@ atmTurbulentHeatFluxTemperatureFvPatchScalarField
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
gradient() = 0.0;
fvPatchField<scalar>::patchInternalField(*this);
gradient() = Zero;
}
}

View File

@ -70,7 +70,7 @@ freeSurfaceVelocityFvPatchVectorField
fixedGradientFvPatchVectorField(p, iF)
{
fvPatchFieldBase::readDict(dict);
fvPatchVectorField::operator=(patchInternalField());
fvPatchField<vector>::patchInternalField(*this);
}

View File

@ -29,15 +29,6 @@ License
#include "calculatedFaPatchField.H"
#include "faPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
const Foam::word& Foam::faPatchField<Type>::calculatedType()
{
return Foam::calculatedFaPatchField<Type>::typeName;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>

View File

@ -60,7 +60,7 @@ class calculatedFaPatchField
public:
//- Runtime type information
TypeName("calculated");
TypeName("calculated"); // fieldTypes::calculatedTypeName_()
// Constructors
@ -126,17 +126,10 @@ public:
}
// Member functions
// Member Functions
// Access
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
// Evaluation functions

View File

@ -54,7 +54,8 @@ extrapolatedCalculatedFaPatchField
:
calculatedFaPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{
calculatedFaPatchField<Type>::operator==(this->patchInternalField());
// Set to the internal field
faPatchField<Type>::patchInternalField(*this);
}

View File

@ -73,6 +73,7 @@ public:
//- Runtime type information
TypeName("extrapolatedCalculated");
// fieldTypes::extrapolatedCalculatedTypeName_()
// Constructors

View File

@ -127,17 +127,10 @@ public:
}
// Member functions
// Member Functions
// Access
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
// Evaluation functions

View File

@ -164,17 +164,10 @@ public:
}
// Member functions
// Member Functions
// Access
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
//- True: the patch field fixes a value.
virtual bool fixesValue() const { return true; }
// Return defining fields

View File

@ -139,12 +139,10 @@ public:
// Member Functions
// Attributes
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
//- False: this patch field is not altered by assignment
//- False: this patch field is not altered by assignment.
virtual bool assignable() const { return false; }

View File

@ -28,15 +28,6 @@ License
#include "zeroGradientFaPatchField.H"
#include "faPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
const Foam::word& Foam::faPatchField<Type>::zeroGradientType()
{
return Foam::zeroGradientFaPatchField<Type>::typeName;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
@ -109,7 +100,8 @@ void Foam::zeroGradientFaPatchField<Type>::evaluate(const Pstream::commsTypes)
this->updateCoeffs();
}
this->operator==(this->patchInternalField());
// Set to the internal field
faPatchField<Type>::patchInternalField(*this);
faPatchField<Type>::evaluate();
}

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef zeroGradientFaPatchField_H
#define zeroGradientFaPatchField_H
#ifndef Foam_zeroGradientFaPatchField_H
#define Foam_zeroGradientFaPatchField_H
#include "faPatchField.H"
@ -60,7 +60,7 @@ class zeroGradientFaPatchField
public:
//- Runtime type information
TypeName("zeroGradient");
TypeName("zeroGradient"); // fieldTypes::zeroGradientTypeName_()
// Constructors
@ -132,16 +132,14 @@ public:
//- Return gradient at boundary
virtual tmp<Field<Type>> snGrad() const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), Zero)
);
return tmp<Field<Type>>::New(this->size(), Zero);
}
//- Evaluate the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType = Pstream::commsTypes::blocking
const Pstream::commsTypes commsType =
Pstream::commsTypes::blocking
);
//- Return the matrix diagonal coefficients corresponding to the

View File

@ -58,7 +58,8 @@ clampedPlateFaPatchField<Type>::clampedPlateFaPatchField
:
faPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{
faPatchField<Type>::operator=(this->patchInternalField());
// Set to the internal field
faPatchField<Type>::patchInternalField(*this);
}

View File

@ -125,17 +125,10 @@ public:
}
// Member functions
// Member Functions
// Access
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
//- True: the patch field fixes a value.
virtual bool fixesValue() const { return true; }
// Evaluation functions

View File

@ -145,8 +145,53 @@ public:
virtual ~faPatchFieldBase() = default;
// Static Member Functions
//- The type name for \c empty patch fields
static const word& emptyType() noexcept
{
return Foam::fieldTypes::emptyType;
}
//- The type name for \c calculated patch fields
static const word& calculatedType() noexcept
{
return Foam::fieldTypes::calculatedType;
}
//- The type name for \c extrapolatedCalculated patch fields
//- combines \c zero-gradient and \c calculated
static const word& extrapolatedCalculatedType() noexcept
{
return Foam::fieldTypes::extrapolatedCalculatedType;
}
//- The type name for \c zeroGradient patch fields
static const word& zeroGradientType() noexcept
{
return Foam::fieldTypes::zeroGradientType;
}
// Member Functions
// Attributes
//- True if the patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return false;
}
//- True if the patch field is coupled
virtual bool coupled() const
{
return false;
}
// Access
//- The associated objectRegistry
@ -411,30 +456,6 @@ public:
// Member Functions
//- The type name for calculated patch fields
static const word& calculatedType();
//- The type name for zeroGradient patch fields
static const word& zeroGradientType();
// Attributes
//- True if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return false;
}
//- True if this patch field is coupled
virtual bool coupled() const
{
return false;
}
// Access
//- Return const-reference to the dimensioned internal field

View File

@ -29,15 +29,6 @@ License
#include "calculatedFaePatchField.H"
#include "faPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
const Foam::word& Foam::faePatchField<Type>::calculatedType()
{
return Foam::calculatedFaePatchField<Type>::typeName;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>

View File

@ -60,7 +60,7 @@ class calculatedFaePatchField
public:
//- Runtime type information
TypeName("calculated");
TypeName("calculated"); // fieldTypes::calculatedTypeName_()
// Constructors
@ -128,16 +128,11 @@ public:
// Member Functions
// Access
//- True: the patch field fixes a value.
virtual bool fixesValue() const { return true; }
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
// Other
//- Write
virtual void write(Ostream&) const;

View File

@ -130,24 +130,19 @@ public:
virtual ~fixedValueFaePatchField() = default;
// Member functions
// Member Functions
// Access
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
// Other
//- Write
virtual void write(Ostream&) const;
// Member operators
// Member Operators
virtual void operator=(const UList<Type>&) {}

View File

@ -132,8 +132,6 @@ public:
// Member Functions
// Attributes
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }

View File

@ -61,7 +61,7 @@ class emptyFaePatchField
public:
//- Runtime type information
TypeName("empty");
TypeName(emptyFaPatch::typeName_()); // fieldTypes::emptyTypeName_()
// Constructors

View File

@ -131,8 +131,40 @@ public:
virtual ~faePatchFieldBase() = default;
// Static Member Functions
//- The type name for \c empty patch fields
static const word& emptyType() noexcept
{
return Foam::fieldTypes::emptyType;
}
//- The type name for \c calculated patch fields
static const word& calculatedType() noexcept
{
return Foam::fieldTypes::calculatedType;
}
// Member Functions
// Attributes
//- True if the patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return false;
}
//- True if the patch field is coupled
virtual bool coupled() const
{
return false;
}
// Access
//- The associated objectRegistry
@ -390,27 +422,6 @@ public:
// Member Functions
//- The type name for calculated patch fields
static const word& calculatedType();
// Attributes
//- True if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return false;
}
//- True if this patch field is coupled
virtual bool coupled() const
{
return false;
}
// Access
//- Return const-reference to the dimensioned internal field

View File

@ -29,15 +29,6 @@ License
#include "calculatedFvPatchField.H"
#include "fvPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
const Foam::word& Foam::fvPatchField<Type>::calculatedType()
{
return Foam::calculatedFvPatchField<Type>::typeName;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>

View File

@ -69,11 +69,10 @@ class calculatedFvPatchField
:
public fvPatchField<Type>
{
public:
//- Runtime type information
TypeName("calculated");
TypeName("calculated"); // fieldTypes::calculatedTypeName_()
// Constructors
@ -154,17 +153,10 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
// Evaluation functions

View File

@ -130,23 +130,13 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
//- Return true: this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
//- Return false: this patch field is not altered by assignment
virtual bool assignable() const
{
return false;
}
//- False: this patch field is not altered by assignment.
virtual bool assignable() const { return false; }
// Mapping functions

View File

@ -54,7 +54,8 @@ extrapolatedCalculatedFvPatchField
:
calculatedFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{
calculatedFvPatchField<Type>::operator==(this->patchInternalField());
// Set to the internal field
fvPatchField<Type>::patchInternalField(*this);
}
@ -108,7 +109,8 @@ void Foam::extrapolatedCalculatedFvPatchField<Type>::evaluate
this->updateCoeffs();
}
calculatedFvPatchField<Type>::operator==(this->patchInternalField());
// Set to the internal field
fvPatchField<Type>::patchInternalField(*this);
calculatedFvPatchField<Type>::evaluate();
}

View File

@ -72,6 +72,7 @@ public:
//- Runtime type information
TypeName("extrapolatedCalculated");
// fieldTypes::extrapolatedCalculatedTypeName_()
// Constructors

View File

@ -166,23 +166,13 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
//- Return false: this patch field is not altered by assignment
virtual bool assignable() const
{
return false;
}
//- False: this patch field is not altered by assignment.
virtual bool assignable() const { return false; }
// Evaluation functions

View File

@ -188,23 +188,13 @@ public:
}
// Member functions
// Member Functions
// Access
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
//- Return false: this patch field is not altered by assignment
virtual bool assignable() const
{
return false;
}
//- False: this patch field is not altered by assignment.
virtual bool assignable() const { return false; }
// Return defining fields

View File

@ -136,23 +136,13 @@ public:
virtual ~slicedFvPatchField<Type>();
// Member functions
// Member Functions
// Attributes
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
//- Return false: this patch field is not altered by assignment
virtual bool assignable() const
{
return false;
}
//- False: this patch field is not altered by assignment.
virtual bool assignable() const { return false; }
// Evaluation functions

View File

@ -113,16 +113,10 @@ public:
) const = 0;
// Member functions
// Member Functions
// Attributes
//- Return true if the value of the patch field
// is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment.
virtual bool assignable() const { return true; }
// Evaluation functions

View File

@ -28,16 +28,6 @@ License
#include "zeroGradientFvPatchField.H"
#include "fvPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
const Foam::word& Foam::fvPatchField<Type>::zeroGradientType()
{
return zeroGradientFvPatchField<Type>::typeName;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
@ -61,7 +51,8 @@ Foam::zeroGradientFvPatchField<Type>::zeroGradientFvPatchField
:
fvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{
fvPatchField<Type>::operator=(this->patchInternalField());
// Set to the internal field
fvPatchField<Type>::patchInternalField(*this);
}
@ -109,7 +100,8 @@ void Foam::zeroGradientFvPatchField<Type>::evaluate(const Pstream::commsTypes)
this->updateCoeffs();
}
fvPatchField<Type>::operator==(this->patchInternalField());
// Set to the internal field
fvPatchField<Type>::patchInternalField(*this);
fvPatchField<Type>::evaluate();
}

View File

@ -47,8 +47,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef zeroGradientFvPatchField_H
#define zeroGradientFvPatchField_H
#ifndef Foam_zeroGradientFvPatchField_H
#define Foam_zeroGradientFvPatchField_H
#include "fvPatchField.H"
@ -66,11 +66,10 @@ class zeroGradientFvPatchField
:
public fvPatchField<Type>
{
public:
//- Runtime type information
TypeName("zeroGradient");
TypeName("zeroGradient"); // fieldTypes::zeroGradientTypeName_()
// Constructors
@ -142,10 +141,7 @@ public:
//- Return gradient at boundary
virtual tmp<Field<Type>> snGrad() const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), Zero)
);
return tmp<Field<Type>>::New(this->size(), Zero);
}
//- Evaluate the patch field

View File

@ -77,7 +77,7 @@ Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField
}
else
{
fvPatchField<Type>::operator=(this->patchInternalField());
fvPatchField<Type>::patchInternalField(*this);
}
}
}

View File

@ -49,8 +49,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef emptyFvPatchField_H
#define emptyFvPatchField_H
#ifndef Foam_emptyFvPatchField_H
#define Foam_emptyFvPatchField_H
#include "fvPatchField.H"
#include "emptyFvPatch.H"
@ -69,11 +69,10 @@ class emptyFvPatchField
:
public fvPatchField<Type>
{
public:
//- Runtime type information
TypeName(emptyFvPatch::typeName_());
TypeName(emptyFvPatch::typeName_()); // fieldTypes::emptyTypeName_()
// Constructors

View File

@ -89,7 +89,7 @@ Foam::processorFvPatchField<Type>::processorFvPatchField
// Use 'value' supplied, or set to internal field
if (!this->readValueEntry(dict))
{
fvPatchField<Type>::operator=(this->patchInternalField());
fvPatchField<Type>::patchInternalField(*this);
}
}

View File

@ -91,7 +91,7 @@ Foam::advectiveFvPatchField<Type>::advectiveFvPatchField
// Use 'value' supplied, or set to internal field
if (!this->readValueEntry(dict))
{
fvPatchField<Type>::operator=(this->patchInternalField());
fvPatchField<Type>::patchInternalField(*this);
}
this->refValue() = *this;

View File

@ -189,7 +189,7 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
if (!this->readValueEntry(dict))
{
// Assign dummy value to get redirectPatchField not fail
this->operator==(this->patchInternalField());
fvPatchField<Type>::patchInternalField(*this);
this->evaluate(Pstream::commsTypes::blocking);
}

View File

@ -208,7 +208,7 @@ electrostaticDepositionFvPatchScalarField
{
if (!this->readValueEntry(dict))
{
fvPatchScalarField::operator=(patchInternalField());
fvPatchField<scalar>::patchInternalField(*this);
}
// If flow is multiphase

View File

@ -65,7 +65,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
fvPatchField<scalar>::patchInternalField(*this);
gradient() = Zero;
}
}

View File

@ -188,15 +188,10 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment.
virtual bool assignable() const { return true; }
// Access

View File

@ -178,13 +178,11 @@ public:
// Member Functions
// Access
//- False: this patch field is not altered by assignment.
virtual bool assignable() const { return false; }
//- This patch field is not altered by assignment
virtual bool assignable() const
{
return false;
}
// Access
//- User-defined input field (modifiable field)
virtual Field<Type>& fixedValue()

View File

@ -75,7 +75,7 @@ fluxCorrectedVelocityFvPatchVectorField
rhoName_(dict.getOrDefault<word>("rho", "rho"))
{
fvPatchFieldBase::readDict(dict);
fvPatchVectorField::operator=(patchInternalField());
fvPatchField<vector>::patchInternalField(*this);
}

View File

@ -166,13 +166,8 @@ public:
// Member functions
// Attributes
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment.
virtual bool assignable() const { return true; }
//- Update the coefficients associated with the patch field

View File

@ -170,7 +170,8 @@ outletMappedUniformInletFvPatchField
if (!this->readValueEntry(dict))
{
fvPatchField<Type>::operator=(this->patchInternalField());
// Fallback: set to the internal field
fvPatchField<Type>::patchInternalField(*this);
}
}
@ -203,7 +204,8 @@ outletMappedUniformInletFvPatchField
}
else
{
fvPatchField<Type>::operator=(this->patchInternalField());
// Fallback: set to the internal field
fvPatchField<Type>::patchInternalField(*this);
}
}

View File

@ -86,7 +86,7 @@ Foam::outletPhaseMeanVelocityFvPatchVectorField
if (!this->readValueEntry(dict))
{
fvPatchVectorField::operator=(patchInternalField());
fvPatchField<vector>::patchInternalField(*this);
}
}

View File

@ -166,13 +166,10 @@ public:
// Member Functions
// Access/attributes
//- False: this patch field is not altered by assignment
virtual bool assignable() const { return false; }
//- This patch field is not altered by assignment
virtual bool assignable() const
{
return false;
}
// Access
virtual Field<Type>& refValue()
{

View File

@ -184,15 +184,10 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment
virtual bool assignable() const { return true; }
// Access

View File

@ -176,15 +176,10 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment
virtual bool assignable() const { return true; }
// Access

View File

@ -172,15 +172,11 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- True: this patch field is altered by assignment
virtual bool assignable() const { return true; }
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
// Access

View File

@ -172,15 +172,10 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment
virtual bool assignable() const { return true; }
// Access

View File

@ -162,15 +162,10 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment
virtual bool assignable() const { return true; }
// Access

View File

@ -137,15 +137,10 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment
virtual bool assignable() const { return true; }
//- Update the coefficients associated with the patch field

View File

@ -155,15 +155,10 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment
virtual bool assignable() const { return true; }
// Access

View File

@ -171,15 +171,10 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment
virtual bool assignable() const { return true; }
// Access

View File

@ -194,13 +194,8 @@ public:
// Member Functions
// Attributes
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment
virtual bool assignable() const { return true; }
// Access

View File

@ -76,7 +76,7 @@ supersonicFreestreamFvPatchVectorField
if (!this->readValueEntry(dict))
{
fvPatchField<vector>::operator=(patchInternalField());
fvPatchField<vector>::patchInternalField(*this);
}
refValue() = *this;

View File

@ -169,13 +169,8 @@ public:
// Member functions
// Attributes
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment
virtual bool assignable() const { return true; }
// Mapping functions

View File

@ -82,13 +82,14 @@ Foam::variableHeightFlowRateFvPatchScalarField
upperBound_(dict.get<scalar>("upperBound"))
{
fvPatchFieldBase::readDict(dict);
this->refValue() = 0.0;
if (!this->readValueEntry(dict))
{
fvPatchScalarField::operator=(this->patchInternalField());
// Fallback: set to the internal field
fvPatchField<scalar>::patchInternalField(*this);
}
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}

View File

@ -169,7 +169,7 @@ Foam::fvPatchField<Type>::fvPatchField
// For unmapped faces set to internal field value (zero-gradient)
if (notNull(iF) && mapper.hasUnmapped())
{
fvPatchField<Type>::operator=(this->patchInternalField());
fvPatchField<Type>::patchInternalField(*this);
}
this->map(ptf, mapper);
}
@ -241,7 +241,7 @@ void Foam::fvPatchField<Type>::autoMap
if (!this->size() && !mapper.distributed())
{
f.setSize(mapper.size());
f.resize_nocopy(mapper.size());
if (f.size())
{
f = this->patchInternalField();

View File

@ -154,8 +154,59 @@ public:
virtual ~fvPatchFieldBase() = default;
// Static Member Functions
//- The type name for \c empty patch fields
static const word& emptyType() noexcept
{
return Foam::fieldTypes::emptyType;
}
//- The type name for \c calculated patch fields
static const word& calculatedType() noexcept
{
return Foam::fieldTypes::calculatedType;
}
//- The type name for \c extrapolatedCalculated patch fields
//- combines \c zero-gradient and \c calculated
static const word& extrapolatedCalculatedType() noexcept
{
return Foam::fieldTypes::extrapolatedCalculatedType;
}
//- The type name for \c zeroGradient patch fields
static const word& zeroGradientType() noexcept
{
return Foam::fieldTypes::zeroGradientType;
}
// Member Functions
// Attributes
//- True if the value of the patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True if the patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return false;
}
//- True if the patch field is coupled
virtual bool coupled() const
{
return false;
}
// Access
//- The associated objectRegistry
@ -473,37 +524,6 @@ public:
// Member Functions
//- The type name for calculated patch fields
static const word& calculatedType();
//- The type name for zeroGradient patch fields
static const word& zeroGradientType();
// Attributes
//- True if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return false;
}
//- True if the value of the patch field
//- is altered by assignment (the default)
virtual bool assignable() const
{
return true;
}
//- True if this patch field is coupled
virtual bool coupled() const
{
return false;
}
// Access
//- Return const-reference to the dimensioned internal field

View File

@ -29,14 +29,6 @@ License
#include "calculatedFvsPatchField.H"
#include "fvPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
const Foam::word& Foam::fvsPatchField<Type>::calculatedType()
{
return Foam::calculatedFvsPatchField<Type>::typeName;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef calculatedFvsPatchField_H
#define calculatedFvsPatchField_H
#ifndef Foam_calculatedFvsPatchField_H
#define Foam_calculatedFvsPatchField_H
#include "fvsPatchField.H"
@ -53,11 +53,10 @@ class calculatedFvsPatchField
:
public fvsPatchField<Type>
{
public:
//- Runtime type information
TypeName("calculated");
TypeName("calculated"); // fieldTypes::calculatedTypeName_()
// Constructors
@ -121,17 +120,10 @@ public:
}
// Member functions
// Member Functions
// Access
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
};

View File

@ -122,17 +122,10 @@ public:
}
// Member functions
// Member Functions
// Access
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
// Evaluation functions

View File

@ -130,20 +130,13 @@ public:
virtual ~slicedFvsPatchField<Type>();
// Member functions
// Member Functions
// Access
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return true;
}
//- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; }
// Member operators
// Member Operators
virtual void operator=(const UList<Type>&) {}

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef emptyFvsPatchField_H
#define emptyFvsPatchField_H
#ifndef Foam_emptyFvsPatchField_H
#define Foam_emptyFvsPatchField_H
#include "fvsPatchField.H"
#include "emptyFvPatch.H"
@ -54,11 +54,10 @@ class emptyFvsPatchField
:
public fvsPatchField<Type>
{
public:
//- Runtime type information
TypeName(emptyFvPatch::typeName_());
TypeName(emptyFvPatch::typeName_()); // fieldTypes::emptyTypeName_()
// Constructors

View File

@ -126,8 +126,40 @@ public:
virtual ~fvsPatchFieldBase() = default;
// Static Member Functions
//- The type name for \c empty patch fields
static const word& emptyType() noexcept
{
return Foam::fieldTypes::emptyType;
}
//- The type name for \c calculated patch fields
static const word& calculatedType() noexcept
{
return Foam::fieldTypes::calculatedType;
}
// Member Functions
// Attributes
//- True if the patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return false;
}
//- True if the patch field is coupled
virtual bool coupled() const
{
return false;
}
// Access
//- The associated objectRegistry
@ -403,27 +435,6 @@ public:
// Member Functions
//- The type name for calculated patch fields
static const word& calculatedType();
// Attributes
//- True if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return false;
}
//- True if this patch field is coupled
virtual bool coupled() const
{
return false;
}
// Access
//- Return const-reference to the dimensioned internal field

View File

@ -24,11 +24,8 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::fieldTypes
Description
Collection of common field types
Forwards and collection of common volume field types
SourceFiles
volFields.C

View File

@ -160,7 +160,7 @@ externalCoupledTemperatureMixedFvPatchScalarField
// or extrapolated value
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::operator=(this->patchInternalField());
fvPatchField<scalar>::patchInternalField(*this);
}
// Initialise as a fixed value

View File

@ -113,7 +113,7 @@ Foam::oversetFvPatchField<Type>::oversetFvPatchField
// Use 'value' supplied, or set to internal field
if (!this->readValueEntry(dict))
{
Field<Type>::operator=(this->patchInternalField());
fvPatchField<Type>::patchInternalField(*this);
}
}

View File

@ -176,15 +176,10 @@ public:
}
// Member functions
// Member Functions
// Attributes
//- Return true: this patch field is altered by assignment
virtual bool assignable() const
{
return true;
}
//- True: this patch field is altered by assignment
virtual bool assignable() const { return true; }
// Access

View File

@ -86,8 +86,8 @@ fixedIncidentRadiationFvPatchScalarField
else
{
// Still reading so cannot yet evaluate. Make up a value.
fvPatchField<scalar>::operator=(patchInternalField());
gradient() = 0.0;
fvPatchField<scalar>::patchInternalField(*this);
gradient() = Zero;
}
}

View File

@ -311,8 +311,9 @@ sorptionWallFunctionFvPatchScalarField::sorptionWallFunctionFvPatchScalarField
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
gradient() = 0.0;
// Fallback: set to zero-gradient
fvPatchField<scalar>::patchInternalField(*this);
gradient() = Zero;
}
}

View File

@ -80,7 +80,8 @@ alphaContactAngleTwoPhaseFvPatchScalarField
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
// Fallback: set to zero-gradient
fvPatchField<scalar>::patchInternalField(*this);
gradient() = Zero;
}
}