mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: template invariant base classes for {fa,fae,fv,fvs,point}PatchField
- simplifies construction/inheritance
ENH: add {fa,fv}PatchField::zeroGradientType() static
- can be used to avoid literal "zeroGradient" in places
STYLE: adjust naming of pointPatch runtime selection table
- simply use 'patch' as per fa/fv fields
STYLE: add zero-size guard to patch constraintType(const word&)
This commit is contained in:
@ -776,6 +776,7 @@ $(Fields)/fieldTypes.C
|
|||||||
|
|
||||||
|
|
||||||
pointPatchFields = fields/pointPatchFields
|
pointPatchFields = fields/pointPatchFields
|
||||||
|
$(pointPatchFields)/pointPatchField/pointPatchFieldBase.C
|
||||||
$(pointPatchFields)/pointPatchField/pointPatchFields.C
|
$(pointPatchFields)/pointPatchField/pointPatchFields.C
|
||||||
|
|
||||||
basicPointPatchFields = $(pointPatchFields)/basic
|
basicPointPatchFields = $(pointPatchFields)/basic
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2021 OpenCFD Ltd.
|
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -33,7 +33,7 @@ License
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
const Foam::word& Foam::pointPatchField<Type>::calculatedType()
|
const Foam::word& Foam::pointPatchField<Type>::calculatedType()
|
||||||
{
|
{
|
||||||
return calculatedPointPatchField<Type>::typeName;
|
return Foam::calculatedPointPatchField<Type>::typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ Foam::pointPatchField<Type>::NewCalculatedType
|
|||||||
const pointPatchField<Type2>& pf
|
const pointPatchField<Type2>& pf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto* patchTypeCtor = pointPatchConstructorTable(pf.patch().type());
|
auto* patchTypeCtor = patchConstructorTable(pf.patch().type());
|
||||||
|
|
||||||
if (patchTypeCtor)
|
if (patchTypeCtor)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,6 +27,15 @@ License
|
|||||||
|
|
||||||
#include "zeroGradientPointPatchField.H"
|
#include "zeroGradientPointPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const Foam::word& Foam::pointPatchField<Type>::zeroGradientType()
|
||||||
|
{
|
||||||
|
return Foam::zeroGradientPointPatchField<Type>::typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -34,8 +34,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef zeroGradientPointPatchField_H
|
#ifndef Foam_zeroGradientPointPatchField_H
|
||||||
#define zeroGradientPointPatchField_H
|
#define Foam_zeroGradientPointPatchField_H
|
||||||
|
|
||||||
#include "pointPatchField.H"
|
#include "pointPatchField.H"
|
||||||
|
|
||||||
@ -53,7 +53,6 @@ class zeroGradientPointPatchField
|
|||||||
:
|
:
|
||||||
public pointPatchField<Type>
|
public pointPatchField<Type>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,10 +39,8 @@ Foam::pointPatchField<Type>::pointPatchField
|
|||||||
const DimensionedField<Type, pointMesh>& iF
|
const DimensionedField<Type, pointMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
patch_(p),
|
pointPatchFieldBase(p),
|
||||||
internalField_(iF),
|
internalField_(iF)
|
||||||
updated_(false),
|
|
||||||
patchType_()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -54,13 +52,9 @@ Foam::pointPatchField<Type>::pointPatchField
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
patch_(p),
|
pointPatchFieldBase(p, dict),
|
||||||
internalField_(iF),
|
internalField_(iF)
|
||||||
updated_(false),
|
{}
|
||||||
patchType_()
|
|
||||||
{
|
|
||||||
dict.readIfPresent("patchType", patchType_, keyType::LITERAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -72,10 +66,8 @@ Foam::pointPatchField<Type>::pointPatchField
|
|||||||
const pointPatchFieldMapper&
|
const pointPatchFieldMapper&
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
patch_(p),
|
pointPatchFieldBase(ptf, p),
|
||||||
internalField_(iF),
|
internalField_(iF)
|
||||||
updated_(false),
|
|
||||||
patchType_(ptf.patchType_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -85,10 +77,8 @@ Foam::pointPatchField<Type>::pointPatchField
|
|||||||
const pointPatchField<Type>& ptf
|
const pointPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
patch_(ptf.patch_),
|
pointPatchFieldBase(ptf),
|
||||||
internalField_(ptf.internalField_),
|
internalField_(ptf.internalField_)
|
||||||
updated_(false),
|
|
||||||
patchType_(ptf.patchType_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -99,30 +89,21 @@ Foam::pointPatchField<Type>::pointPatchField
|
|||||||
const DimensionedField<Type, pointMesh>& iF
|
const DimensionedField<Type, pointMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
patch_(ptf.patch_),
|
pointPatchFieldBase(ptf),
|
||||||
internalField_(iF),
|
internalField_(iF)
|
||||||
updated_(false),
|
|
||||||
patchType_(ptf.patchType_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
const Foam::objectRegistry& Foam::pointPatchField<Type>::db() const
|
|
||||||
{
|
|
||||||
return patch_.boundaryMesh().mesh()();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::pointPatchField<Type>::write(Ostream& os) const
|
void Foam::pointPatchField<Type>::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
os.writeEntry("type", type());
|
os.writeEntry("type", type());
|
||||||
|
|
||||||
if (!patchType_.empty())
|
if (!patchType().empty())
|
||||||
{
|
{
|
||||||
os.writeEntry("patchType", patchType_);
|
os.writeEntry("patchType", patchType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,15 +274,22 @@ void Foam::pointPatchField<Type>::setInInternalField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::pointPatchField<Type>::updateCoeffs()
|
||||||
|
{
|
||||||
|
pointPatchFieldBase::setUpdated(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::pointPatchField<Type>::evaluate(const Pstream::commsTypes)
|
void Foam::pointPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||||
{
|
{
|
||||||
if (!updated_)
|
if (!updated())
|
||||||
{
|
{
|
||||||
updateCoeffs();
|
updateCoeffs();
|
||||||
}
|
}
|
||||||
|
|
||||||
updated_ = false;
|
pointPatchFieldBase::setUpdated(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,6 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
|
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
class pointPatchFieldMapper;
|
class pointPatchFieldMapper;
|
||||||
@ -67,6 +66,116 @@ template<class Type> class calculatedPointPatchField;
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Ostream& operator<<(Ostream&, const pointPatchField<Type>&);
|
Ostream& operator<<(Ostream&, const pointPatchField<Type>&);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class pointPatchFieldBase Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
//- Template invariant parts for pointPatchField
|
||||||
|
class pointPatchFieldBase
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Reference to patch
|
||||||
|
const pointPatch& patch_;
|
||||||
|
|
||||||
|
//- Update index used so that updateCoeffs is called only once during
|
||||||
|
//- the construction of the matrix
|
||||||
|
bool updated_;
|
||||||
|
|
||||||
|
//- Optional patch type
|
||||||
|
// Used to allow specified boundary conditions to be applied
|
||||||
|
// to constraint patches by providing the constraint
|
||||||
|
// patch type as 'patchType'
|
||||||
|
word patchType_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Read dictionary entries.
|
||||||
|
// Useful when initially constructed without a dictionary
|
||||||
|
virtual void readDict(const dictionary& dict);
|
||||||
|
|
||||||
|
//- Set updated state
|
||||||
|
void setUpdated(bool state) noexcept
|
||||||
|
{
|
||||||
|
updated_ = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Debug switch to disallow the use of generic pointPatchField
|
||||||
|
static int disallowGenericPatchField;
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("pointPatchField");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch
|
||||||
|
explicit pointPatchFieldBase(const pointPatch& p);
|
||||||
|
|
||||||
|
//- Construct from patch and patch type
|
||||||
|
pointPatchFieldBase(const pointPatch& p, const word& patchType);
|
||||||
|
|
||||||
|
//- Construct from patch and dictionary
|
||||||
|
pointPatchFieldBase(const pointPatch& p, const dictionary& dict);
|
||||||
|
|
||||||
|
//- Copy construct with new patch
|
||||||
|
pointPatchFieldBase(const pointPatchFieldBase&, const pointPatch& p);
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
pointPatchFieldBase(const pointPatchFieldBase&);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~pointPatchFieldBase() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- The associated objectRegistry
|
||||||
|
const objectRegistry& db() const;
|
||||||
|
|
||||||
|
//- Return the patch
|
||||||
|
const pointPatch& patch() const noexcept
|
||||||
|
{
|
||||||
|
return patch_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- The optional patch type
|
||||||
|
const word& patchType() const noexcept
|
||||||
|
{
|
||||||
|
return patchType_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- The optional patch type
|
||||||
|
word& patchType() noexcept
|
||||||
|
{
|
||||||
|
return patchType_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Solution
|
||||||
|
|
||||||
|
//- True if the boundary condition has already been updated
|
||||||
|
bool updated() const noexcept
|
||||||
|
{
|
||||||
|
return updated_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Check
|
||||||
|
|
||||||
|
//- Check that patches are identical
|
||||||
|
void checkPatch(const pointPatchFieldBase& rhs) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class pointPatchField Declaration
|
Class pointPatchField Declaration
|
||||||
@ -74,24 +183,14 @@ Ostream& operator<<(Ostream&, const pointPatchField<Type>&);
|
|||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
class pointPatchField
|
class pointPatchField
|
||||||
|
:
|
||||||
|
public pointPatchFieldBase
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Reference to patch
|
|
||||||
const pointPatch& patch_;
|
|
||||||
|
|
||||||
//- Reference to internal field
|
//- Reference to internal field
|
||||||
const DimensionedField<Type, pointMesh>& internalField_;
|
const DimensionedField<Type, pointMesh>& internalField_;
|
||||||
|
|
||||||
//- Update index used so that updateCoeffs is called only once during
|
|
||||||
// the construction of the matrix
|
|
||||||
bool updated_;
|
|
||||||
|
|
||||||
//- Optional patch type, used to allow specified boundary conditions
|
|
||||||
// to be applied to constraint patches by providing the constraint
|
|
||||||
// patch type as 'patchType'
|
|
||||||
word patchType_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -108,20 +207,13 @@ public:
|
|||||||
typedef calculatedPointPatchField<Type> Calculated;
|
typedef calculatedPointPatchField<Type> Calculated;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("pointPatchField");
|
|
||||||
|
|
||||||
//- Debug switch to disallow the use of genericPointPatchField
|
|
||||||
static int disallowGenericPointPatchField;
|
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection tables
|
// Declare run-time constructor selection tables
|
||||||
|
|
||||||
declareRunTimeSelectionTable
|
declareRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
autoPtr,
|
autoPtr,
|
||||||
pointPatchField,
|
pointPatchField,
|
||||||
pointPatch,
|
patch,
|
||||||
(
|
(
|
||||||
const pointPatch& p,
|
const pointPatch& p,
|
||||||
const DimensionedField<Type, pointMesh>& iF
|
const DimensionedField<Type, pointMesh>& iF
|
||||||
@ -186,9 +278,6 @@ public:
|
|||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
pointPatchField(const pointPatchField<Type>&);
|
pointPatchField(const pointPatchField<Type>&);
|
||||||
|
|
||||||
//- Construct and return a clone
|
|
||||||
virtual autoPtr<pointPatchField<Type>> clone() const = 0;
|
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
//- Construct as copy setting internal field reference
|
||||||
pointPatchField
|
pointPatchField
|
||||||
(
|
(
|
||||||
@ -196,6 +285,9 @@ public:
|
|||||||
const DimensionedField<Type, pointMesh>&
|
const DimensionedField<Type, pointMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual autoPtr<pointPatchField<Type>> clone() const = 0;
|
||||||
|
|
||||||
//- Construct and return a clone setting internal field reference
|
//- Construct and return a clone setting internal field reference
|
||||||
virtual autoPtr<pointPatchField<Type>> clone
|
virtual autoPtr<pointPatchField<Type>> clone
|
||||||
(
|
(
|
||||||
@ -257,69 +349,58 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~pointPatchField<Type>() = default;
|
virtual ~pointPatchField() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
//- The type name for calculated patch fields
|
||||||
|
static const word& calculatedType();
|
||||||
|
|
||||||
//- Return local objectRegistry
|
//- The type name for zeroGradient patch fields
|
||||||
const objectRegistry& db() const;
|
static const word& zeroGradientType();
|
||||||
|
|
||||||
//- Return size
|
|
||||||
label size() const
|
|
||||||
{
|
|
||||||
return patch().size();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return patch
|
// Attributes
|
||||||
const pointPatch& patch() const
|
|
||||||
{
|
|
||||||
return patch_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return dimensioned internal field reference
|
//- True if this patch field fixes a value
|
||||||
const DimensionedField<Type, pointMesh>&
|
|
||||||
internalField() const
|
|
||||||
{
|
|
||||||
return internalField_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return internal field reference
|
|
||||||
const Field<Type>& primitiveField() const
|
|
||||||
{
|
|
||||||
return internalField_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Optional patch type
|
|
||||||
const word& patchType() const
|
|
||||||
{
|
|
||||||
return patchType_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Optional patch type
|
|
||||||
word& patchType()
|
|
||||||
{
|
|
||||||
return patchType_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return true if this patch field fixes a value
|
|
||||||
virtual bool fixesValue() const
|
virtual bool fixesValue() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if this patch field is coupled
|
//- True if this patch field is coupled
|
||||||
virtual bool coupled() const
|
virtual bool coupled() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if the boundary condition has already been updated
|
//- The constraint type this pointPatchField implements.
|
||||||
bool updated() const
|
virtual const word& constraintType() const
|
||||||
{
|
{
|
||||||
return updated_;
|
return word::null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the patch size
|
||||||
|
label size() const
|
||||||
|
{
|
||||||
|
return patch().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return dimensioned internal field reference
|
||||||
|
const DimensionedField<Type, pointMesh>& internalField()
|
||||||
|
const noexcept
|
||||||
|
{
|
||||||
|
return internalField_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return internal field reference
|
||||||
|
const Field<Type>& primitiveField() const noexcept
|
||||||
|
{
|
||||||
|
return internalField_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return field created from appropriate internal field values
|
//- Return field created from appropriate internal field values
|
||||||
@ -380,17 +461,8 @@ public:
|
|||||||
const Field<Type1>& pF
|
const Field<Type1>& pF
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return the type of the calculated form of pointPatchField
|
|
||||||
static const word& calculatedType();
|
|
||||||
|
|
||||||
//- Return the constraint type this pointPatchField implements.
|
// Mapping Functions
|
||||||
virtual const word& constraintType() const
|
|
||||||
{
|
|
||||||
return word::null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Mapping functions
|
|
||||||
|
|
||||||
//- Map (and resize as needed) from self given a mapping object
|
//- Map (and resize as needed) from self given a mapping object
|
||||||
virtual void autoMap
|
virtual void autoMap
|
||||||
@ -408,14 +480,11 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Evaluation functions
|
// Evaluation Functions
|
||||||
|
|
||||||
//- Update the coefficients associated with the patch field
|
//- Update the coefficients associated with the patch field
|
||||||
// Sets Updated to true
|
// Sets Updated to true
|
||||||
virtual void updateCoeffs()
|
virtual void updateCoeffs();
|
||||||
{
|
|
||||||
updated_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Initialise evaluation of the patch field (do nothing)
|
//- Initialise evaluation of the patch field (do nothing)
|
||||||
virtual void initEvaluate
|
virtual void initEvaluate
|
||||||
@ -470,7 +539,7 @@ public:
|
|||||||
virtual void operator==(const Type&){}
|
virtual void operator==(const Type&){}
|
||||||
|
|
||||||
|
|
||||||
// Ostream operator
|
// Ostream Operator
|
||||||
|
|
||||||
friend Ostream& operator<< <Type>
|
friend Ostream& operator<< <Type>
|
||||||
(
|
(
|
||||||
@ -513,15 +582,19 @@ const pointPatchField<Type>& operator+
|
|||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "pointPatchField.C"
|
#include "pointPatchField.C"
|
||||||
#include "calculatedPointPatchField.H"
|
#include "calculatedPointPatchField.H"
|
||||||
|
#include "zeroGradientPointPatchField.H"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Runtime selection macros
|
||||||
|
|
||||||
#define addToPointPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \
|
#define addToPointPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \
|
||||||
addToRunTimeSelectionTable \
|
addToRunTimeSelectionTable \
|
||||||
( \
|
( \
|
||||||
PatchTypeField, \
|
PatchTypeField, \
|
||||||
typePatchTypeField, \
|
typePatchTypeField, \
|
||||||
pointPatch \
|
patch \
|
||||||
); \
|
); \
|
||||||
addToRunTimeSelectionTable \
|
addToRunTimeSelectionTable \
|
||||||
( \
|
( \
|
||||||
@ -574,7 +647,7 @@ const pointPatchField<Type>& operator+
|
|||||||
( \
|
( \
|
||||||
pointPatchTensorField, \
|
pointPatchTensorField, \
|
||||||
type##PointPatchTensorField \
|
type##PointPatchTensorField \
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
#define makePointPatchFieldsTypeName(type) \
|
#define makePointPatchFieldsTypeName(type) \
|
||||||
|
|||||||
@ -0,0 +1,123 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2022 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 "pointPatchField.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(pointPatchFieldBase, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Foam::pointPatchFieldBase::disallowGenericPatchField
|
||||||
|
(
|
||||||
|
Foam::debug::debugSwitch("disallowGenericPointPatchField", 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::pointPatchFieldBase::pointPatchFieldBase(const pointPatch& p)
|
||||||
|
:
|
||||||
|
patch_(p),
|
||||||
|
updated_(false),
|
||||||
|
patchType_()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::pointPatchFieldBase::pointPatchFieldBase
|
||||||
|
(
|
||||||
|
const pointPatch& p,
|
||||||
|
const word& patchType
|
||||||
|
)
|
||||||
|
:
|
||||||
|
pointPatchFieldBase(p)
|
||||||
|
{
|
||||||
|
patchType_ = patchType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::pointPatchFieldBase::pointPatchFieldBase
|
||||||
|
(
|
||||||
|
const pointPatch& p,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
pointPatchFieldBase(p)
|
||||||
|
{
|
||||||
|
pointPatchFieldBase::readDict(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::pointPatchFieldBase::pointPatchFieldBase
|
||||||
|
(
|
||||||
|
const pointPatchFieldBase& rhs,
|
||||||
|
const pointPatch& p
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(p),
|
||||||
|
updated_(false),
|
||||||
|
patchType_(rhs.patchType_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::pointPatchFieldBase::pointPatchFieldBase(const pointPatchFieldBase& rhs)
|
||||||
|
:
|
||||||
|
patch_(rhs.patch_),
|
||||||
|
updated_(false),
|
||||||
|
patchType_(rhs.patchType_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::pointPatchFieldBase::readDict(const dictionary& dict)
|
||||||
|
{
|
||||||
|
dict.readIfPresent("patchType", patchType_, keyType::LITERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::objectRegistry& Foam::pointPatchFieldBase::db() const
|
||||||
|
{
|
||||||
|
return patch_.boundaryMesh().mesh()();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::pointPatchFieldBase::checkPatch(const pointPatchFieldBase& rhs) const
|
||||||
|
{
|
||||||
|
if (&patch_ != &(rhs.patch_))
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Different patches for pointPatchField"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -42,28 +42,28 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
|||||||
<< " [" << actualPatchType
|
<< " [" << actualPatchType
|
||||||
<< "] : " << p.type() << " name = " << p.name() << endl;
|
<< "] : " << p.type() << " name = " << p.name() << endl;
|
||||||
|
|
||||||
auto* ctorPtr = pointPatchConstructorTable(patchFieldType);
|
auto* ctorPtr = patchConstructorTable(patchFieldType);
|
||||||
|
|
||||||
if (!ctorPtr)
|
if (!ctorPtr)
|
||||||
{
|
{
|
||||||
FatalErrorInLookup
|
FatalErrorInLookup
|
||||||
(
|
(
|
||||||
"patchFieldType",
|
"patchField",
|
||||||
patchFieldType,
|
patchFieldType,
|
||||||
*pointPatchConstructorTablePtr_
|
*patchConstructorTablePtr_
|
||||||
) << exit(FatalError);
|
) << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
autoPtr<pointPatchField<Type>> pfPtr(ctorPtr(p, iF));
|
autoPtr<pointPatchField<Type>> tpfld(ctorPtr(p, iF));
|
||||||
|
|
||||||
if (actualPatchType.empty() || actualPatchType != p.type())
|
if (actualPatchType.empty() || actualPatchType != p.type())
|
||||||
{
|
{
|
||||||
if (pfPtr().constraintType() != p.constraintType())
|
if (tpfld().constraintType() != p.constraintType())
|
||||||
{
|
{
|
||||||
// Incompatible (constraint-wise) with the patch type
|
// Incompatible (constraint-wise) with the patch type
|
||||||
// - use default constraint type
|
// - use default constraint type
|
||||||
|
|
||||||
auto* patchTypeCtor = pointPatchConstructorTable(p.type());
|
auto* patchTypeCtor = patchConstructorTable(p.type());
|
||||||
|
|
||||||
if (!patchTypeCtor)
|
if (!patchTypeCtor)
|
||||||
{
|
{
|
||||||
@ -79,13 +79,13 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pointPatchConstructorTablePtr_->found(p.type()))
|
if (patchConstructorTablePtr_->found(p.type()))
|
||||||
{
|
{
|
||||||
pfPtr().patchType() = actualPatchType;
|
tpfld.ref().patchType() = actualPatchType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pfPtr;
|
return tpfld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
|||||||
|
|
||||||
if (!ctorPtr)
|
if (!ctorPtr)
|
||||||
{
|
{
|
||||||
if (!disallowGenericPointPatchField)
|
if (!pointPatchFieldBase::disallowGenericPatchField)
|
||||||
{
|
{
|
||||||
ctorPtr = dictionaryConstructorTable("generic");
|
ctorPtr = dictionaryConstructorTable("generic");
|
||||||
}
|
}
|
||||||
@ -140,11 +140,11 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct (but not necessarily returned)
|
// Construct (but not necessarily returned)
|
||||||
autoPtr<pointPatchField<Type>> pfPtr(ctorPtr(p, iF, dict));
|
autoPtr<pointPatchField<Type>> tpfld(ctorPtr(p, iF, dict));
|
||||||
|
|
||||||
if (actualPatchType.empty() || actualPatchType != p.type())
|
if (actualPatchType.empty() || actualPatchType != p.type())
|
||||||
{
|
{
|
||||||
if (pfPtr().constraintType() != p.constraintType())
|
if (tpfld().constraintType() != p.constraintType())
|
||||||
{
|
{
|
||||||
// Incompatible (constraint-wise) with the patch type
|
// Incompatible (constraint-wise) with the patch type
|
||||||
// - use default constraint type
|
// - use default constraint type
|
||||||
@ -164,7 +164,7 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pfPtr;
|
return tpfld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -36,13 +36,7 @@ namespace Foam
|
|||||||
|
|
||||||
#define makePointPatchField(pointPatchTypeField) \
|
#define makePointPatchField(pointPatchTypeField) \
|
||||||
\
|
\
|
||||||
defineNamedTemplateTypeNameAndDebug(pointPatchTypeField, 0); \
|
defineTemplateRunTimeSelectionTable(pointPatchTypeField, patch); \
|
||||||
template<> \
|
|
||||||
int pointPatchTypeField::disallowGenericPointPatchField \
|
|
||||||
( \
|
|
||||||
debug::debugSwitch("disallowGenericPointPatchField", 0) \
|
|
||||||
); \
|
|
||||||
defineTemplateRunTimeSelectionTable(pointPatchTypeField, pointPatch); \
|
|
||||||
defineTemplateRunTimeSelectionTable(pointPatchTypeField, patchMapper); \
|
defineTemplateRunTimeSelectionTable(pointPatchTypeField, patchMapper); \
|
||||||
defineTemplateRunTimeSelectionTable(pointPatchTypeField, dictionary);
|
defineTemplateRunTimeSelectionTable(pointPatchTypeField, dictionary);
|
||||||
|
|
||||||
|
|||||||
@ -25,8 +25,8 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef pointPatchFields_H
|
#ifndef Foam_pointPatchFields_H
|
||||||
#define pointPatchFields_H
|
#define Foam_pointPatchFields_H
|
||||||
|
|
||||||
#include "pointPatchField.H"
|
#include "pointPatchField.H"
|
||||||
#include "pointPatchFieldsFwd.H"
|
#include "pointPatchFieldsFwd.H"
|
||||||
|
|||||||
@ -25,8 +25,8 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef pointPatchFieldsFwd_H
|
#ifndef Foam_pointPatchFieldsFwd_H
|
||||||
#define pointPatchFieldsFwd_H
|
#define Foam_pointPatchFieldsFwd_H
|
||||||
|
|
||||||
#include "fieldTypes.H"
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -100,7 +100,7 @@ Foam::polyPatch::polyPatch
|
|||||||
faceCellsPtr_(nullptr),
|
faceCellsPtr_(nullptr),
|
||||||
mePtr_(nullptr)
|
mePtr_(nullptr)
|
||||||
{
|
{
|
||||||
if (!patchType.empty() && constraintType(patchType))
|
if (constraintType(patchType))
|
||||||
{
|
{
|
||||||
inGroups().appendUniq(patchType);
|
inGroups().appendUniq(patchType);
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ Foam::polyPatch::polyPatch
|
|||||||
faceCellsPtr_(nullptr),
|
faceCellsPtr_(nullptr),
|
||||||
mePtr_(nullptr)
|
mePtr_(nullptr)
|
||||||
{
|
{
|
||||||
if (!patchType.empty() && constraintType(patchType))
|
if (constraintType(patchType))
|
||||||
{
|
{
|
||||||
inGroups().appendUniq(patchType);
|
inGroups().appendUniq(patchType);
|
||||||
}
|
}
|
||||||
@ -274,12 +274,13 @@ Foam::polyPatch::~polyPatch()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::polyPatch::constraintType(const word& pt)
|
bool Foam::polyPatch::constraintType(const word& patchType)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
pointPatchField<scalar>::pointPatchConstructorTablePtr_
|
!patchType.empty()
|
||||||
&& pointPatchField<scalar>::pointPatchConstructorTablePtr_->found(pt)
|
&& pointPatchField<scalar>::patchConstructorTablePtr_
|
||||||
|
&& pointPatchField<scalar>::patchConstructorTablePtr_->found(patchType)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +301,7 @@ Foam::wordList Foam::polyPatch::constraintTypes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cTypes.setSize(i);
|
cTypes.resize(i);
|
||||||
|
|
||||||
return cTypes;
|
return cTypes;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -384,7 +384,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if the given type is a constraint type
|
//- Return true if the given type is a constraint type
|
||||||
static bool constraintType(const word& pt);
|
static bool constraintType(const word& patchType);
|
||||||
|
|
||||||
//- Return a list of all the constraint patch types
|
//- Return a list of all the constraint patch types
|
||||||
static wordList constraintTypes();
|
static wordList constraintTypes();
|
||||||
|
|||||||
@ -37,6 +37,7 @@ $(faMeshMapper)/faEdgeMapper.C
|
|||||||
$(faMeshMapper)/faPatchMapper.C
|
$(faMeshMapper)/faPatchMapper.C
|
||||||
|
|
||||||
faPatchFields = fields/faPatchFields
|
faPatchFields = fields/faPatchFields
|
||||||
|
$(faPatchFields)/faPatchField/faPatchFieldBase.C
|
||||||
$(faPatchFields)/faPatchField/faPatchFields.C
|
$(faPatchFields)/faPatchField/faPatchFields.C
|
||||||
|
|
||||||
basicFaPatchFields = $(faPatchFields)/basic
|
basicFaPatchFields = $(faPatchFields)/basic
|
||||||
@ -68,6 +69,7 @@ $(derivedFaPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValu
|
|||||||
$(derivedFaPatchFields)/clampedPlate/clampedPlateFaPatchFields.C
|
$(derivedFaPatchFields)/clampedPlate/clampedPlateFaPatchFields.C
|
||||||
|
|
||||||
faePatchFields = fields/faePatchFields
|
faePatchFields = fields/faePatchFields
|
||||||
|
$(faePatchFields)/faePatchField/faePatchFieldBase.C
|
||||||
$(faePatchFields)/faePatchField/faePatchFields.C
|
$(faePatchFields)/faePatchField/faePatchFields.C
|
||||||
|
|
||||||
basicFaePatchFields = $(faePatchFields)/basic
|
basicFaePatchFields = $(faePatchFields)/basic
|
||||||
|
|||||||
@ -111,7 +111,7 @@ Foam::faPatch::faPatch
|
|||||||
pointLabelsPtr_(nullptr),
|
pointLabelsPtr_(nullptr),
|
||||||
pointEdgesPtr_(nullptr)
|
pointEdgesPtr_(nullptr)
|
||||||
{
|
{
|
||||||
if (!patchType.empty() && constraintType(patchType))
|
if (constraintType(patchType))
|
||||||
{
|
{
|
||||||
inGroups().appendUniq(patchType);
|
inGroups().appendUniq(patchType);
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ Foam::faPatch::faPatch
|
|||||||
pointLabelsPtr_(nullptr),
|
pointLabelsPtr_(nullptr),
|
||||||
pointEdgesPtr_(nullptr)
|
pointEdgesPtr_(nullptr)
|
||||||
{
|
{
|
||||||
if (!patchType.empty() && constraintType(patchType))
|
if (constraintType(patchType))
|
||||||
{
|
{
|
||||||
inGroups().appendUniq(patchType);
|
inGroups().appendUniq(patchType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -264,7 +264,7 @@ public:
|
|||||||
// Static Member Functions
|
// Static Member Functions
|
||||||
|
|
||||||
//- Return true if the given type is a constraint type
|
//- Return true if the given type is a constraint type
|
||||||
static bool constraintType(const word& pt);
|
static bool constraintType(const word& patchType);
|
||||||
|
|
||||||
//- Return a list of all the constraint patch types
|
//- Return a list of all the constraint patch types
|
||||||
static wordList constraintTypes();
|
static wordList constraintTypes();
|
||||||
|
|||||||
@ -34,7 +34,7 @@ License
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
const Foam::word& Foam::faPatchField<Type>::calculatedType()
|
const Foam::word& Foam::faPatchField<Type>::calculatedType()
|
||||||
{
|
{
|
||||||
return calculatedFaPatchField<Type>::typeName;
|
return Foam::calculatedFaPatchField<Type>::typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,15 @@ License
|
|||||||
#include "zeroGradientFaPatchField.H"
|
#include "zeroGradientFaPatchField.H"
|
||||||
#include "faPatchFieldMapper.H"
|
#include "faPatchFieldMapper.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const Foam::word& Foam::faPatchField<Type>::zeroGradientType()
|
||||||
|
{
|
||||||
|
return Foam::zeroGradientFaPatchField<Type>::typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -57,7 +57,6 @@ class zeroGradientFaPatchField
|
|||||||
:
|
:
|
||||||
public faPatchField<Type>
|
public faPatchField<Type>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -126,10 +125,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~zeroGradientFaPatchField<Type>() = default;
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
// Evaluation functions
|
// Evaluation functions
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,11 +38,9 @@ Foam::faPatchField<Type>::faPatchField
|
|||||||
const DimensionedField<Type, areaMesh>& iF
|
const DimensionedField<Type, areaMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
faPatchFieldBase(p),
|
||||||
Field<Type>(p.size()),
|
Field<Type>(p.size()),
|
||||||
patch_(p),
|
internalField_(iF)
|
||||||
internalField_(iF),
|
|
||||||
updated_(false),
|
|
||||||
patchType_()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -54,11 +52,9 @@ Foam::faPatchField<Type>::faPatchField
|
|||||||
const Field<Type>& f
|
const Field<Type>& f
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
faPatchFieldBase(p),
|
||||||
Field<Type>(f),
|
Field<Type>(f),
|
||||||
patch_(p),
|
internalField_(iF)
|
||||||
internalField_(iF),
|
|
||||||
updated_(false),
|
|
||||||
patchType_()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -71,11 +67,9 @@ Foam::faPatchField<Type>::faPatchField
|
|||||||
const faPatchFieldMapper& mapper
|
const faPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
faPatchFieldBase(ptf, p),
|
||||||
Field<Type>(ptf, mapper),
|
Field<Type>(ptf, mapper),
|
||||||
patch_(p),
|
internalField_(iF)
|
||||||
internalField_(iF),
|
|
||||||
updated_(false),
|
|
||||||
patchType_()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -88,14 +82,10 @@ Foam::faPatchField<Type>::faPatchField
|
|||||||
const bool valueRequired
|
const bool valueRequired
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
faPatchFieldBase(p, dict),
|
||||||
Field<Type>(p.size()),
|
Field<Type>(p.size()),
|
||||||
patch_(p),
|
internalField_(iF)
|
||||||
internalField_(iF),
|
|
||||||
updated_(false),
|
|
||||||
patchType_()
|
|
||||||
{
|
{
|
||||||
dict.readIfPresent("patchType", patchType_, keyType::LITERAL);
|
|
||||||
|
|
||||||
/// if (valueRequired) - not yet needed. Already a lazy evaluation
|
/// if (valueRequired) - not yet needed. Already a lazy evaluation
|
||||||
|
|
||||||
const auto* eptr = dict.findEntry("value", keyType::LITERAL);
|
const auto* eptr = dict.findEntry("value", keyType::LITERAL);
|
||||||
@ -117,11 +107,9 @@ Foam::faPatchField<Type>::faPatchField
|
|||||||
const faPatchField<Type>& ptf
|
const faPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
faPatchFieldBase(ptf),
|
||||||
Field<Type>(ptf),
|
Field<Type>(ptf),
|
||||||
patch_(ptf.patch_),
|
internalField_(ptf.internalField_)
|
||||||
internalField_(ptf.internalField_),
|
|
||||||
updated_(false),
|
|
||||||
patchType_(ptf.patchType_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -132,11 +120,9 @@ Foam::faPatchField<Type>::faPatchField
|
|||||||
const DimensionedField<Type, areaMesh>& iF
|
const DimensionedField<Type, areaMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
faPatchFieldBase(ptf),
|
||||||
Field<Type>(ptf),
|
Field<Type>(ptf),
|
||||||
patch_(ptf.patch_),
|
internalField_(iF)
|
||||||
internalField_(iF),
|
|
||||||
updated_(false),
|
|
||||||
patchType_(ptf.patchType_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -151,21 +137,16 @@ const Foam::objectRegistry& Foam::faPatchField<Type>::db() const
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::faPatchField<Type>::check(const faPatchField<Type>& ptf) const
|
void Foam::faPatchField<Type>::check(const faPatchField<Type>& rhs) const
|
||||||
{
|
{
|
||||||
if (&patch_ != &(ptf.patch_))
|
faPatchFieldBase::checkPatch(rhs);
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "different patches for faPatchField<Type>s"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type>> Foam::faPatchField<Type>::snGrad() const
|
Foam::tmp<Foam::Field<Type>> Foam::faPatchField<Type>::snGrad() const
|
||||||
{
|
{
|
||||||
return (*this - patchInternalField())*patch_.deltaCoeffs();
|
return (*this - patchInternalField())*patch().deltaCoeffs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -173,7 +154,7 @@ template<class Type>
|
|||||||
Foam::tmp<Foam::Field<Type>>
|
Foam::tmp<Foam::Field<Type>>
|
||||||
Foam::faPatchField<Type>::patchInternalField() const
|
Foam::faPatchField<Type>::patchInternalField() const
|
||||||
{
|
{
|
||||||
return patch_.patchInternalField(internalField_);
|
return patch().patchInternalField(internalField_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -195,15 +176,22 @@ void Foam::faPatchField<Type>::rmap
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::faPatchField<Type>::updateCoeffs()
|
||||||
|
{
|
||||||
|
faPatchFieldBase::setUpdated(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::faPatchField<Type>::evaluate(const Pstream::commsTypes)
|
void Foam::faPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||||
{
|
{
|
||||||
if (!updated_)
|
if (!updated())
|
||||||
{
|
{
|
||||||
updateCoeffs();
|
updateCoeffs();
|
||||||
}
|
}
|
||||||
|
|
||||||
updated_ = false;
|
faPatchFieldBase::setUpdated(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -212,9 +200,9 @@ void Foam::faPatchField<Type>::write(Ostream& os) const
|
|||||||
{
|
{
|
||||||
os.writeEntry("type", type());
|
os.writeEntry("type", type());
|
||||||
|
|
||||||
if (!patchType_.empty())
|
if (!patchType().empty())
|
||||||
{
|
{
|
||||||
os.writeEntry("patchType", patchType_);
|
os.writeEntry("patchType", patchType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +225,7 @@ void Foam::faPatchField<Type>::operator=
|
|||||||
const faPatchField<Type>& ptf
|
const faPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
check(ptf);
|
faPatchFieldBase::checkPatch(ptf);
|
||||||
Field<Type>::operator=(ptf);
|
Field<Type>::operator=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +236,7 @@ void Foam::faPatchField<Type>::operator+=
|
|||||||
const faPatchField<Type>& ptf
|
const faPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
check(ptf);
|
faPatchFieldBase::checkPatch(ptf);
|
||||||
Field<Type>::operator+=(ptf);
|
Field<Type>::operator+=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +247,7 @@ void Foam::faPatchField<Type>::operator-=
|
|||||||
const faPatchField<Type>& ptf
|
const faPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
check(ptf);
|
faPatchFieldBase::checkPatch(ptf);
|
||||||
Field<Type>::operator-=(ptf);
|
Field<Type>::operator-=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,13 +258,7 @@ void Foam::faPatchField<Type>::operator*=
|
|||||||
const faPatchField<scalar>& ptf
|
const faPatchField<scalar>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (&patch_ != &ptf.patch())
|
faPatchFieldBase::checkPatch(ptf);
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "incompatible patches for patch fields"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
Field<Type>::operator*=(ptf);
|
Field<Type>::operator*=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,13 +269,7 @@ void Foam::faPatchField<Type>::operator/=
|
|||||||
const faPatchField<scalar>& ptf
|
const faPatchField<scalar>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (&patch_ != &ptf.patch())
|
faPatchFieldBase::checkPatch(ptf);
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< " incompatible patches for patch fields"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
Field<Type>::operator/=(ptf);
|
Field<Type>::operator/=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,8 @@ Author
|
|||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faPatchField.C
|
faPatchField.C
|
||||||
newPatchField.C
|
faPatchFieldBase.C
|
||||||
|
faPatchFieldNew.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -57,21 +58,128 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
|
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
class faPatchFieldMapper;
|
class faPatchFieldMapper;
|
||||||
class areaMesh;
|
class areaMesh;
|
||||||
|
|
||||||
template<class Type>
|
template<class Type> class faPatchField;
|
||||||
class faPatchField;
|
template<class Type> class calculatedFaPatchField;
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class calculatedFaPatchField;
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Ostream& operator<<(Ostream&, const faPatchField<Type>&);
|
Ostream& operator<<(Ostream&, const faPatchField<Type>&);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class faPatchFieldBase Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
//- Template invariant parts for faPatchField
|
||||||
|
class faPatchFieldBase
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Reference to patch
|
||||||
|
const faPatch& patch_;
|
||||||
|
|
||||||
|
//- Update index used so that updateCoeffs is called only once during
|
||||||
|
//- the construction of the matrix
|
||||||
|
bool updated_;
|
||||||
|
|
||||||
|
//- Optional patch type
|
||||||
|
// Used to allow specified boundary conditions to be applied
|
||||||
|
// to constraint patches by providing the constraint
|
||||||
|
// patch type as 'patchType'
|
||||||
|
word patchType_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Read dictionary entries.
|
||||||
|
// Useful when initially constructed without a dictionary
|
||||||
|
virtual void readDict(const dictionary& dict);
|
||||||
|
|
||||||
|
//- Set updated state
|
||||||
|
void setUpdated(bool state) noexcept
|
||||||
|
{
|
||||||
|
updated_ = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Debug switch to disallow the use of generic faPatchField
|
||||||
|
static int disallowGenericPatchField;
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("faPatchField");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch
|
||||||
|
explicit faPatchFieldBase(const faPatch& p);
|
||||||
|
|
||||||
|
//- Construct from patch and patch type
|
||||||
|
explicit faPatchFieldBase(const faPatch& p, const word& patchType);
|
||||||
|
|
||||||
|
//- Construct from patch and dictionary
|
||||||
|
faPatchFieldBase(const faPatch& p, const dictionary& dict);
|
||||||
|
|
||||||
|
//- Copy construct with new patch
|
||||||
|
faPatchFieldBase(const faPatchFieldBase& rhs, const faPatch& p);
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
faPatchFieldBase(const faPatchFieldBase& rhs);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~faPatchFieldBase() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- The associated objectRegistry
|
||||||
|
/// const objectRegistry& db() const;
|
||||||
|
|
||||||
|
//- Return the patch
|
||||||
|
const faPatch& patch() const noexcept
|
||||||
|
{
|
||||||
|
return patch_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- The optional patch type
|
||||||
|
const word& patchType() const noexcept
|
||||||
|
{
|
||||||
|
return patchType_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- The optional patch type
|
||||||
|
word& patchType() noexcept
|
||||||
|
{
|
||||||
|
return patchType_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Solution
|
||||||
|
|
||||||
|
//- True if the boundary condition has already been updated
|
||||||
|
bool updated() const noexcept
|
||||||
|
{
|
||||||
|
return updated_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Check
|
||||||
|
|
||||||
|
//- Check that patches are identical
|
||||||
|
void checkPatch(const faPatchFieldBase& rhs) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class faPatchField Declaration
|
Class faPatchField Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -79,25 +187,14 @@ Ostream& operator<<(Ostream&, const faPatchField<Type>&);
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
class faPatchField
|
class faPatchField
|
||||||
:
|
:
|
||||||
|
public faPatchFieldBase,
|
||||||
public Field<Type>
|
public Field<Type>
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Reference to a patch
|
|
||||||
const faPatch& patch_;
|
|
||||||
|
|
||||||
//- Reference to internal field
|
//- Reference to internal field
|
||||||
const DimensionedField<Type, areaMesh>& internalField_;
|
const DimensionedField<Type, areaMesh>& internalField_;
|
||||||
|
|
||||||
//- Update index used so that updateCoeffs is called only once during
|
|
||||||
// the construction of the matrix
|
|
||||||
bool updated_;
|
|
||||||
|
|
||||||
//- Optional patch type, used to allow specified boundary conditions
|
|
||||||
//- to be applied to constraint patches by providing the constraint
|
|
||||||
//- patch type as 'patchType'
|
|
||||||
word patchType_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -111,13 +208,6 @@ public:
|
|||||||
typedef calculatedFaPatchField<Type> Calculated;
|
typedef calculatedFaPatchField<Type> Calculated;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("faPatchField");
|
|
||||||
|
|
||||||
//- Debug switch to disallow the use of
|
|
||||||
static int disallowGenericFaPatchField;
|
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection tables
|
// Declare run-time constructor selection tables
|
||||||
|
|
||||||
declareRunTimeSelectionTable
|
declareRunTimeSelectionTable
|
||||||
@ -198,12 +288,6 @@ public:
|
|||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
faPatchField(const faPatchField<Type>&);
|
faPatchField(const faPatchField<Type>&);
|
||||||
|
|
||||||
//- Construct and return a clone
|
|
||||||
virtual tmp<faPatchField<Type>> clone() const
|
|
||||||
{
|
|
||||||
return tmp<faPatchField<Type>>(new faPatchField<Type>(*this));
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
//- Construct as copy setting internal field reference
|
||||||
faPatchField
|
faPatchField
|
||||||
(
|
(
|
||||||
@ -211,6 +295,12 @@ public:
|
|||||||
const DimensionedField<Type, areaMesh>&
|
const DimensionedField<Type, areaMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<faPatchField<Type>> clone() const
|
||||||
|
{
|
||||||
|
return tmp<faPatchField<Type>>(new faPatchField<Type>(*this));
|
||||||
|
}
|
||||||
|
|
||||||
//- Construct and return a clone setting internal field reference
|
//- Construct and return a clone setting internal field reference
|
||||||
virtual tmp<faPatchField<Type>> clone
|
virtual tmp<faPatchField<Type>> clone
|
||||||
(
|
(
|
||||||
@ -273,50 +363,21 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~faPatchField<Type>() = default;
|
virtual ~faPatchField() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
//- The type name for calculated patch fields
|
||||||
|
static const word& calculatedType();
|
||||||
|
|
||||||
//- Return local objectRegistry
|
//- The type name for zeroGradient patch fields
|
||||||
const objectRegistry& db() const;
|
static const word& zeroGradientType();
|
||||||
|
|
||||||
//- Return patch
|
|
||||||
const faPatch& patch() const
|
|
||||||
{
|
|
||||||
return patch_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return dimensioned internal field reference
|
// Attributes
|
||||||
const DimensionedField<Type, areaMesh>& internalField() const
|
|
||||||
{
|
|
||||||
return internalField_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return internal field reference
|
//- True if this patch field fixes a value.
|
||||||
const Field<Type>& primitiveField() const
|
|
||||||
{
|
|
||||||
return internalField_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Optional patch type
|
|
||||||
const word& patchType() const
|
|
||||||
{
|
|
||||||
return patchType_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Optional patch type
|
|
||||||
word& patchType()
|
|
||||||
{
|
|
||||||
return patchType_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return the type of the calculated for of faPatchField
|
|
||||||
static const word& calculatedType();
|
|
||||||
|
|
||||||
//- Return true if this patch field fixes a value.
|
|
||||||
// Needed to check if a level has to be specified while solving
|
// Needed to check if a level has to be specified while solving
|
||||||
// Poissons equations.
|
// Poissons equations.
|
||||||
virtual bool fixesValue() const
|
virtual bool fixesValue() const
|
||||||
@ -324,16 +385,29 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if this patch field is coupled
|
//- True if this patch field is coupled
|
||||||
virtual bool coupled() const
|
virtual bool coupled() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if the boundary condition has already been updated
|
|
||||||
bool updated() const
|
// Access
|
||||||
|
|
||||||
|
//- Return local objectRegistry
|
||||||
|
const objectRegistry& db() const;
|
||||||
|
|
||||||
|
//- Return dimensioned internal field reference
|
||||||
|
const DimensionedField<Type, areaMesh>&
|
||||||
|
internalField() const noexcept
|
||||||
{
|
{
|
||||||
return updated_;
|
return internalField_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return internal field reference
|
||||||
|
const Field<Type>& primitiveField() const noexcept
|
||||||
|
{
|
||||||
|
return internalField_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -358,13 +432,6 @@ public:
|
|||||||
//- Return patch-normal gradient
|
//- Return patch-normal gradient
|
||||||
virtual tmp<Field<Type>> snGrad() const;
|
virtual tmp<Field<Type>> snGrad() const;
|
||||||
|
|
||||||
//- Update the coefficients associated with the patch field
|
|
||||||
// Sets Updated to true
|
|
||||||
virtual void updateCoeffs()
|
|
||||||
{
|
|
||||||
updated_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return internal field next to patch as patch field
|
//- Return internal field next to patch as patch field
|
||||||
virtual tmp<Field<Type>> patchInternalField() const;
|
virtual tmp<Field<Type>> patchInternalField() const;
|
||||||
|
|
||||||
@ -375,6 +442,10 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
// Sets Updated to true
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
//- Initialise the evaluation of the patch field
|
//- Initialise the evaluation of the patch field
|
||||||
virtual void initEvaluate
|
virtual void initEvaluate
|
||||||
(
|
(
|
||||||
@ -471,7 +542,7 @@ public:
|
|||||||
virtual void operator==(const Type&);
|
virtual void operator==(const Type&);
|
||||||
|
|
||||||
|
|
||||||
// Ostream operator
|
// Ostream Operator
|
||||||
|
|
||||||
friend Ostream& operator<< <Type>(Ostream&, const faPatchField<Type>&);
|
friend Ostream& operator<< <Type>(Ostream&, const faPatchField<Type>&);
|
||||||
};
|
};
|
||||||
@ -486,9 +557,13 @@ public:
|
|||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "faPatchField.C"
|
#include "faPatchField.C"
|
||||||
#include "calculatedFaPatchField.H"
|
#include "calculatedFaPatchField.H"
|
||||||
|
#include "zeroGradientFaPatchField.H"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Runtime selection macros
|
||||||
|
|
||||||
#define addToFaPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \
|
#define addToFaPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \
|
||||||
\
|
\
|
||||||
addToRunTimeSelectionTable \
|
addToRunTimeSelectionTable \
|
||||||
|
|||||||
@ -0,0 +1,123 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2022 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 "faPatchField.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(faPatchFieldBase, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Foam::faPatchFieldBase::disallowGenericPatchField
|
||||||
|
(
|
||||||
|
Foam::debug::debugSwitch("disallowGenericFaPatchField", 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::faPatchFieldBase::faPatchFieldBase(const faPatch& p)
|
||||||
|
:
|
||||||
|
patch_(p),
|
||||||
|
updated_(false),
|
||||||
|
patchType_()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::faPatchFieldBase::faPatchFieldBase
|
||||||
|
(
|
||||||
|
const faPatch& p,
|
||||||
|
const word& patchType
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faPatchFieldBase(p)
|
||||||
|
{
|
||||||
|
patchType_ = patchType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::faPatchFieldBase::faPatchFieldBase
|
||||||
|
(
|
||||||
|
const faPatch& p,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faPatchFieldBase(p)
|
||||||
|
{
|
||||||
|
faPatchFieldBase::readDict(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::faPatchFieldBase::faPatchFieldBase
|
||||||
|
(
|
||||||
|
const faPatchFieldBase& rhs,
|
||||||
|
const faPatch& p
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(p),
|
||||||
|
updated_(false),
|
||||||
|
patchType_(rhs.patchType_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::faPatchFieldBase::faPatchFieldBase(const faPatchFieldBase& rhs)
|
||||||
|
:
|
||||||
|
patch_(rhs.patch_),
|
||||||
|
updated_(false),
|
||||||
|
patchType_(rhs.patchType_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::faPatchFieldBase::readDict(const dictionary& dict)
|
||||||
|
{
|
||||||
|
dict.readIfPresent("patchType", patchType_, keyType::LITERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// const Foam::objectRegistry& Foam::faPatchFieldBase::db() const
|
||||||
|
// {
|
||||||
|
// return patch_.boundaryMesh().mesh().thisDb();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::faPatchFieldBase::checkPatch(const faPatchFieldBase& rhs) const
|
||||||
|
{
|
||||||
|
if (&patch_ != &(rhs.patch_))
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Different patches for faPatchField"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -69,14 +69,14 @@ Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tmp<faPatchField<Type>> tfap = ctorPtr(p, iF);
|
tmp<faPatchField<Type>> tpfld(ctorPtr(p, iF));
|
||||||
|
|
||||||
// Check if constraint type override and store patchType if so
|
// If constraint type: override and store patchType
|
||||||
if (patchTypeCtor)
|
if (patchTypeCtor)
|
||||||
{
|
{
|
||||||
tfap.ref().patchType() = actualPatchType;
|
tpfld.ref().patchType() = actualPatchType;
|
||||||
}
|
}
|
||||||
return tfap;
|
return tpfld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New
|
|||||||
|
|
||||||
if (!ctorPtr)
|
if (!ctorPtr)
|
||||||
{
|
{
|
||||||
if (!disallowGenericFaPatchField)
|
if (!faPatchFieldBase::disallowGenericPatchField)
|
||||||
{
|
{
|
||||||
ctorPtr = dictionaryConstructorTable("generic");
|
ctorPtr = dictionaryConstructorTable("generic");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,13 +37,6 @@ namespace Foam
|
|||||||
|
|
||||||
#define makeFaPatchField(faPatchTypeField) \
|
#define makeFaPatchField(faPatchTypeField) \
|
||||||
\
|
\
|
||||||
defineNamedTemplateTypeNameAndDebug(faPatchTypeField, 0); \
|
|
||||||
template<> \
|
|
||||||
int \
|
|
||||||
faPatchTypeField::disallowGenericFaPatchField \
|
|
||||||
( \
|
|
||||||
debug::debugSwitch("disallowGenericFaPatchField", 0) \
|
|
||||||
); \
|
|
||||||
defineTemplateRunTimeSelectionTable(faPatchTypeField, patch); \
|
defineTemplateRunTimeSelectionTable(faPatchTypeField, patch); \
|
||||||
defineTemplateRunTimeSelectionTable(faPatchTypeField, patchMapper); \
|
defineTemplateRunTimeSelectionTable(faPatchTypeField, patchMapper); \
|
||||||
defineTemplateRunTimeSelectionTable(faPatchTypeField, dictionary);
|
defineTemplateRunTimeSelectionTable(faPatchTypeField, dictionary);
|
||||||
|
|||||||
@ -25,8 +25,8 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef faPatchFields_H
|
#ifndef Foam_faPatchFields_H
|
||||||
#define faPatchFields_H
|
#define Foam_faPatchFields_H
|
||||||
|
|
||||||
#include "faPatchField.H"
|
#include "faPatchField.H"
|
||||||
#include "faPatchFieldsFwd.H"
|
#include "faPatchFieldsFwd.H"
|
||||||
|
|||||||
@ -34,7 +34,7 @@ License
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
const Foam::word& Foam::faePatchField<Type>::calculatedType()
|
const Foam::word& Foam::faePatchField<Type>::calculatedType()
|
||||||
{
|
{
|
||||||
return calculatedFaePatchField<Type>::typeName;
|
return Foam::calculatedFaePatchField<Type>::typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
|
Copyright (C) 2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,8 +38,8 @@ Foam::faePatchField<Type>::faePatchField
|
|||||||
const DimensionedField<Type, edgeMesh>& iF
|
const DimensionedField<Type, edgeMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
faePatchFieldBase(p),
|
||||||
Field<Type>(p.size()),
|
Field<Type>(p.size()),
|
||||||
patch_(p),
|
|
||||||
internalField_(iF)
|
internalField_(iF)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -51,8 +52,8 @@ Foam::faePatchField<Type>::faePatchField
|
|||||||
const Field<Type>& f
|
const Field<Type>& f
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
faePatchFieldBase(p),
|
||||||
Field<Type>(f),
|
Field<Type>(f),
|
||||||
patch_(p),
|
|
||||||
internalField_(iF)
|
internalField_(iF)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -66,8 +67,8 @@ Foam::faePatchField<Type>::faePatchField
|
|||||||
const faPatchFieldMapper& mapper
|
const faPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
faePatchFieldBase(ptf, p),
|
||||||
Field<Type>(ptf, mapper),
|
Field<Type>(ptf, mapper),
|
||||||
patch_(p),
|
|
||||||
internalField_(iF)
|
internalField_(iF)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -80,8 +81,8 @@ Foam::faePatchField<Type>::faePatchField
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
faePatchFieldBase(p, dict),
|
||||||
Field<Type>(p.size()),
|
Field<Type>(p.size()),
|
||||||
patch_(p),
|
|
||||||
internalField_(iF)
|
internalField_(iF)
|
||||||
{
|
{
|
||||||
const auto* eptr = dict.findEntry("value", keyType::LITERAL);
|
const auto* eptr = dict.findEntry("value", keyType::LITERAL);
|
||||||
@ -103,8 +104,8 @@ Foam::faePatchField<Type>::faePatchField
|
|||||||
const faePatchField<Type>& ptf
|
const faePatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
faePatchFieldBase(ptf),
|
||||||
Field<Type>(ptf),
|
Field<Type>(ptf),
|
||||||
patch_(ptf.patch_),
|
|
||||||
internalField_(ptf.internalField_)
|
internalField_(ptf.internalField_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -116,8 +117,8 @@ Foam::faePatchField<Type>::faePatchField
|
|||||||
const DimensionedField<Type, edgeMesh>& iF
|
const DimensionedField<Type, edgeMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
faePatchFieldBase(ptf),
|
||||||
Field<Type>(ptf),
|
Field<Type>(ptf),
|
||||||
patch_(ptf.patch_),
|
|
||||||
internalField_(iF)
|
internalField_(iF)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -133,14 +134,9 @@ const Foam::objectRegistry& Foam::faePatchField<Type>::db() const
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::faePatchField<Type>::check(const faePatchField<Type>& ptf) const
|
void Foam::faePatchField<Type>::check(const faePatchField<Type>& rhs) const
|
||||||
{
|
{
|
||||||
if (&patch_ != &(ptf.patch_))
|
faePatchFieldBase::checkPatch(rhs);
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "different patches for faePatchField<Type>s"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -170,9 +166,9 @@ void Foam::faePatchField<Type>::write(Ostream& os) const
|
|||||||
{
|
{
|
||||||
os.writeEntry("type", type());
|
os.writeEntry("type", type());
|
||||||
|
|
||||||
// if (!patchType_.empty())
|
// if (!patchType().empty())
|
||||||
// {
|
// {
|
||||||
// os.writeEntry("patchType", patchType_);
|
// os.writeEntry("patchType", patchType());
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +191,7 @@ void Foam::faePatchField<Type>::operator=
|
|||||||
const faePatchField<Type>& ptf
|
const faePatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
check(ptf);
|
faePatchFieldBase::checkPatch(ptf);
|
||||||
Field<Type>::operator=(ptf);
|
Field<Type>::operator=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +202,7 @@ void Foam::faePatchField<Type>::operator+=
|
|||||||
const faePatchField<Type>& ptf
|
const faePatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
check(ptf);
|
faePatchFieldBase::checkPatch(ptf);
|
||||||
Field<Type>::operator+=(ptf);
|
Field<Type>::operator+=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +213,7 @@ void Foam::faePatchField<Type>::operator-=
|
|||||||
const faePatchField<Type>& ptf
|
const faePatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
check(ptf);
|
faePatchFieldBase::checkPatch(ptf);
|
||||||
Field<Type>::operator-=(ptf);
|
Field<Type>::operator-=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,13 +224,7 @@ void Foam::faePatchField<Type>::operator*=
|
|||||||
const faePatchField<scalar>& ptf
|
const faePatchField<scalar>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (&patch_ != &ptf.patch())
|
faePatchFieldBase::checkPatch(ptf);
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "incompatible patches for patch fields"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
Field<Type>::operator*=(ptf);
|
Field<Type>::operator*=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,13 +235,7 @@ void Foam::faePatchField<Type>::operator/=
|
|||||||
const faePatchField<scalar>& ptf
|
const faePatchField<scalar>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (&patch_ != &ptf.patch())
|
faePatchFieldBase::checkPatch(ptf);
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< " incompatible patches for patch fields"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
Field<Type>::operator/=(ptf);
|
Field<Type>::operator/=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,8 @@ Author
|
|||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faePatchField.C
|
faePatchField.C
|
||||||
newPatchField.C
|
faePatchFieldBase.C
|
||||||
|
faePatchFieldNew.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -63,16 +64,86 @@ class dictionary;
|
|||||||
class faPatchFieldMapper;
|
class faPatchFieldMapper;
|
||||||
class edgeMesh;
|
class edgeMesh;
|
||||||
|
|
||||||
template<class Type>
|
template<class Type> class faePatchField;
|
||||||
class faePatchField;
|
template<class Type> class calculatedFaePatchField;
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class calculatedFaePatchField;
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Ostream& operator<<(Ostream&, const faePatchField<Type>&);
|
Ostream& operator<<(Ostream&, const faePatchField<Type>&);
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class faePatchFieldBase Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
//- Template invariant parts for faePatchField
|
||||||
|
class faePatchFieldBase
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Reference to patch
|
||||||
|
const faPatch& patch_;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Read dictionary entries.
|
||||||
|
// Useful when initially constructed without a dictionary
|
||||||
|
virtual void readDict(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Debug switch to disallow the use of generic faePatchField
|
||||||
|
static int disallowGenericPatchField;
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("faePatchField");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch
|
||||||
|
explicit faePatchFieldBase(const faPatch& p);
|
||||||
|
|
||||||
|
//- Construct from patch and patch type
|
||||||
|
explicit faePatchFieldBase(const faPatch& p, const word& patchType);
|
||||||
|
|
||||||
|
//- Construct from patch and dictionary
|
||||||
|
faePatchFieldBase(const faPatch& p, const dictionary& dict);
|
||||||
|
|
||||||
|
//- Copy construct with new patch
|
||||||
|
faePatchFieldBase(const faePatchFieldBase& rhs, const faPatch& p);
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
faePatchFieldBase(const faePatchFieldBase& rhs);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~faePatchFieldBase() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- The associated objectRegistry
|
||||||
|
/// const objectRegistry& db() const;
|
||||||
|
|
||||||
|
//- Return the patch
|
||||||
|
const faPatch& patch() const noexcept
|
||||||
|
{
|
||||||
|
return patch_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Check
|
||||||
|
|
||||||
|
//- Check that patches are identical
|
||||||
|
void checkPatch(const faePatchFieldBase& rhs) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class faePatchField Declaration
|
Class faePatchField Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -80,13 +151,11 @@ Ostream& operator<<(Ostream&, const faePatchField<Type>&);
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
class faePatchField
|
class faePatchField
|
||||||
:
|
:
|
||||||
|
public faePatchFieldBase,
|
||||||
public Field<Type>
|
public Field<Type>
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Reference to a patch
|
|
||||||
const faPatch& patch_;
|
|
||||||
|
|
||||||
//- Reference to internal field
|
//- Reference to internal field
|
||||||
const DimensionedField<Type, edgeMesh>& internalField_;
|
const DimensionedField<Type, edgeMesh>& internalField_;
|
||||||
|
|
||||||
@ -103,13 +172,6 @@ public:
|
|||||||
typedef calculatedFaePatchField<Type> Calculated;
|
typedef calculatedFaePatchField<Type> Calculated;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("faePatchField");
|
|
||||||
|
|
||||||
//- Debug switch to disallow the use of
|
|
||||||
static int disallowGenericFaePatchField;
|
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection tables
|
// Declare run-time constructor selection tables
|
||||||
|
|
||||||
declareRunTimeSelectionTable
|
declareRunTimeSelectionTable
|
||||||
@ -189,12 +251,6 @@ public:
|
|||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
faePatchField(const faePatchField<Type>&);
|
faePatchField(const faePatchField<Type>&);
|
||||||
|
|
||||||
//- Construct and return a clone
|
|
||||||
virtual tmp<faePatchField<Type>> clone() const
|
|
||||||
{
|
|
||||||
return tmp<faePatchField<Type>>(new faePatchField<Type>(*this));
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
//- Construct as copy setting internal field reference
|
||||||
faePatchField
|
faePatchField
|
||||||
(
|
(
|
||||||
@ -202,6 +258,12 @@ public:
|
|||||||
const DimensionedField<Type, edgeMesh>&
|
const DimensionedField<Type, edgeMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<faePatchField<Type>> clone() const
|
||||||
|
{
|
||||||
|
return tmp<faePatchField<Type>>(new faePatchField<Type>(*this));
|
||||||
|
}
|
||||||
|
|
||||||
//- Construct and return a clone setting internal field reference
|
//- Construct and return a clone setting internal field reference
|
||||||
virtual tmp<faePatchField<Type>> clone
|
virtual tmp<faePatchField<Type>> clone
|
||||||
(
|
(
|
||||||
@ -271,35 +333,15 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
//- The type name for calculated patch fields
|
||||||
|
static const word& calculatedType();
|
||||||
|
|
||||||
//- Return local objectRegistry
|
|
||||||
const objectRegistry& db() const;
|
|
||||||
|
|
||||||
//- Return patch
|
// Attributes
|
||||||
const faPatch& patch() const
|
|
||||||
{
|
|
||||||
return patch_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return dimensioned internal field reference
|
//- True if this patch field fixes a value.
|
||||||
const DimensionedField<Type, edgeMesh>& internalField() const
|
|
||||||
{
|
|
||||||
return internalField_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return internal field reference
|
|
||||||
const Field<Type>& primitiveField() const
|
|
||||||
{
|
|
||||||
return internalField_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return the type of the calculated for of faePatchField
|
|
||||||
static const word& calculatedType();
|
|
||||||
|
|
||||||
//- Return true if this patch field fixes a value.
|
|
||||||
// Needed to check if a level has to be specified while solving
|
// Needed to check if a level has to be specified while solving
|
||||||
// Poissons equations.
|
// Poissons equations.
|
||||||
virtual bool fixesValue() const
|
virtual bool fixesValue() const
|
||||||
@ -307,14 +349,33 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if this patch field is coupled
|
//- True if this patch field is coupled
|
||||||
virtual bool coupled() const
|
virtual bool coupled() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Mapping functions
|
// Access
|
||||||
|
|
||||||
|
//- Return local objectRegistry
|
||||||
|
const objectRegistry& db() const;
|
||||||
|
|
||||||
|
//- Return dimensioned internal field reference
|
||||||
|
const DimensionedField<Type, edgeMesh>& internalField()
|
||||||
|
const noexcept
|
||||||
|
{
|
||||||
|
return internalField_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return internal field reference
|
||||||
|
const Field<Type>& primitiveField() const noexcept
|
||||||
|
{
|
||||||
|
return internalField_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Mapping
|
||||||
|
|
||||||
//- Map (and resize as needed) from self given a mapping object
|
//- Map (and resize as needed) from self given a mapping object
|
||||||
virtual void autoMap
|
virtual void autoMap
|
||||||
@ -334,13 +395,13 @@ public:
|
|||||||
virtual void write(Ostream&) const;
|
virtual void write(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
// Check
|
// Check
|
||||||
|
|
||||||
//- Check faePatchField<Type> against given faePatchField<Type>
|
//- Check faePatchField<Type> against given faePatchField<Type>
|
||||||
void check(const faePatchField<Type>&) const;
|
void check(const faePatchField<Type>&) const;
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member Operators
|
||||||
|
|
||||||
virtual void operator=(const UList<Type>&);
|
virtual void operator=(const UList<Type>&);
|
||||||
|
|
||||||
@ -370,7 +431,7 @@ public:
|
|||||||
virtual void operator==(const Type&);
|
virtual void operator==(const Type&);
|
||||||
|
|
||||||
|
|
||||||
// Ostream operator
|
// Ostream Operator
|
||||||
|
|
||||||
friend Ostream& operator<< <Type>(Ostream&, const faePatchField<Type>&);
|
friend Ostream& operator<< <Type>(Ostream&, const faePatchField<Type>&);
|
||||||
};
|
};
|
||||||
@ -388,6 +449,9 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Runtime selection macros
|
||||||
|
|
||||||
#define makeFaePatchTypeFieldTypeName(typePatchTypeField) \
|
#define makeFaePatchTypeFieldTypeName(typePatchTypeField) \
|
||||||
\
|
\
|
||||||
defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0);
|
defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0);
|
||||||
|
|||||||
@ -0,0 +1,113 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2022 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 "faePatchField.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(faePatchFieldBase, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Foam::faePatchFieldBase::disallowGenericPatchField
|
||||||
|
(
|
||||||
|
Foam::debug::debugSwitch("disallowGenericFaePatchField", 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::faePatchFieldBase::faePatchFieldBase(const faPatch& p)
|
||||||
|
:
|
||||||
|
patch_(p)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::faePatchFieldBase::faePatchFieldBase
|
||||||
|
(
|
||||||
|
const faPatch& p,
|
||||||
|
const word& patchType
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faePatchFieldBase(p)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::faePatchFieldBase::faePatchFieldBase
|
||||||
|
(
|
||||||
|
const faPatch& p,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faePatchFieldBase(p)
|
||||||
|
{
|
||||||
|
faePatchFieldBase::readDict(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::faePatchFieldBase::faePatchFieldBase
|
||||||
|
(
|
||||||
|
const faePatchFieldBase& rhs,
|
||||||
|
const faPatch& p
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(p)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::faePatchFieldBase::faePatchFieldBase(const faePatchFieldBase& rhs)
|
||||||
|
:
|
||||||
|
patch_(rhs.patch_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::faePatchFieldBase::readDict(const dictionary& dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// const Foam::objectRegistry& Foam::faePatchFieldBase::db() const
|
||||||
|
// {
|
||||||
|
// return patch_.boundaryMesh().mesh().thisDb();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::faePatchFieldBase::checkPatch(const faePatchFieldBase& rhs) const
|
||||||
|
{
|
||||||
|
if (&patch_ != &(rhs.patch_))
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Different patches for faePatchField"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -106,7 +106,7 @@ Foam::tmp<Foam::faePatchField<Type>> Foam::faePatchField<Type>::New
|
|||||||
|
|
||||||
if (!ctorPtr)
|
if (!ctorPtr)
|
||||||
{
|
{
|
||||||
if (!disallowGenericFaePatchField)
|
if (!faePatchFieldBase::disallowGenericPatchField)
|
||||||
{
|
{
|
||||||
ctorPtr = dictionaryConstructorTable("generic");
|
ctorPtr = dictionaryConstructorTable("generic");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,13 +37,6 @@ namespace Foam
|
|||||||
|
|
||||||
#define makeFaePatchField(faePatchTypeField) \
|
#define makeFaePatchField(faePatchTypeField) \
|
||||||
\
|
\
|
||||||
defineNamedTemplateTypeNameAndDebug(faePatchTypeField, 0); \
|
|
||||||
template<> \
|
|
||||||
int \
|
|
||||||
faePatchTypeField::disallowGenericFaePatchField \
|
|
||||||
( \
|
|
||||||
debug::debugSwitch("disallowGenericFaPatchField", 0) \
|
|
||||||
); \
|
|
||||||
defineTemplateRunTimeSelectionTable(faePatchTypeField, patch); \
|
defineTemplateRunTimeSelectionTable(faePatchTypeField, patch); \
|
||||||
defineTemplateRunTimeSelectionTable(faePatchTypeField, patchMapper); \
|
defineTemplateRunTimeSelectionTable(faePatchTypeField, patchMapper); \
|
||||||
defineTemplateRunTimeSelectionTable(faePatchTypeField, dictionary);
|
defineTemplateRunTimeSelectionTable(faePatchTypeField, dictionary);
|
||||||
|
|||||||
@ -31,8 +31,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef faePatchFields_H
|
#ifndef Foam_faePatchFields_H
|
||||||
#define faePatchFields_H
|
#define Foam_faePatchFields_H
|
||||||
|
|
||||||
#include "faePatchField.H"
|
#include "faePatchField.H"
|
||||||
#include "faePatchFieldsFwd.H"
|
#include "faePatchFieldsFwd.H"
|
||||||
|
|||||||
@ -121,6 +121,7 @@ functionObjects/fieldSelections/volFieldSelection/volFieldSelection.C
|
|||||||
functionObjects/fieldSelections/solverFieldSelection/solverFieldSelection.C
|
functionObjects/fieldSelections/solverFieldSelection/solverFieldSelection.C
|
||||||
|
|
||||||
fvPatchFields = fields/fvPatchFields
|
fvPatchFields = fields/fvPatchFields
|
||||||
|
$(fvPatchFields)/fvPatchField/fvPatchFieldBase.C
|
||||||
$(fvPatchFields)/fvPatchField/fvPatchFields.C
|
$(fvPatchFields)/fvPatchField/fvPatchFields.C
|
||||||
|
|
||||||
basicFvPatchFields = $(fvPatchFields)/basic
|
basicFvPatchFields = $(fvPatchFields)/basic
|
||||||
@ -254,6 +255,7 @@ $(derivedFvPatchFields)/mappedField/Sampled/makeSampledPatchFunction1s.C
|
|||||||
$(derivedFvPatchFields)/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchFields.C
|
$(derivedFvPatchFields)/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchFields.C
|
||||||
|
|
||||||
fvsPatchFields = fields/fvsPatchFields
|
fvsPatchFields = fields/fvsPatchFields
|
||||||
|
$(fvsPatchFields)/fvsPatchField/fvsPatchFieldBase.C
|
||||||
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
|
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
|
||||||
|
|
||||||
basicFvsPatchFields = $(fvsPatchFields)/basic
|
basicFvsPatchFields = $(fvsPatchFields)/basic
|
||||||
|
|||||||
@ -34,7 +34,7 @@ License
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
const Foam::word& Foam::fvPatchField<Type>::calculatedType()
|
const Foam::word& Foam::fvPatchField<Type>::calculatedType()
|
||||||
{
|
{
|
||||||
return calculatedFvPatchField<Type>::typeName;
|
return Foam::calculatedFvPatchField<Type>::typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,16 @@ License
|
|||||||
#include "zeroGradientFvPatchField.H"
|
#include "zeroGradientFvPatchField.H"
|
||||||
#include "fvPatchFieldMapper.H"
|
#include "fvPatchFieldMapper.H"
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const Foam::word& Foam::fvPatchField<Type>::zeroGradientType()
|
||||||
|
{
|
||||||
|
return zeroGradientFvPatchField<Type>::typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -41,13 +41,9 @@ Foam::fvPatchField<Type>::fvPatchField
|
|||||||
const DimensionedField<Type, volMesh>& iF
|
const DimensionedField<Type, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvPatchFieldBase(p),
|
||||||
Field<Type>(p.size()),
|
Field<Type>(p.size()),
|
||||||
patch_(p),
|
internalField_(iF)
|
||||||
internalField_(iF),
|
|
||||||
updated_(false),
|
|
||||||
manipulatedMatrix_(false),
|
|
||||||
useImplicit_(false),
|
|
||||||
patchType_()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -59,13 +55,9 @@ Foam::fvPatchField<Type>::fvPatchField
|
|||||||
const Type& value
|
const Type& value
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvPatchFieldBase(p),
|
||||||
Field<Type>(p.size(), value),
|
Field<Type>(p.size(), value),
|
||||||
patch_(p),
|
internalField_(iF)
|
||||||
internalField_(iF),
|
|
||||||
updated_(false),
|
|
||||||
manipulatedMatrix_(false),
|
|
||||||
useImplicit_(false),
|
|
||||||
patchType_()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -77,13 +69,9 @@ Foam::fvPatchField<Type>::fvPatchField
|
|||||||
const word& patchType
|
const word& patchType
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvPatchFieldBase(p, patchType),
|
||||||
Field<Type>(p.size()),
|
Field<Type>(p.size()),
|
||||||
patch_(p),
|
internalField_(iF)
|
||||||
internalField_(iF),
|
|
||||||
updated_(false),
|
|
||||||
manipulatedMatrix_(false),
|
|
||||||
useImplicit_(false),
|
|
||||||
patchType_(patchType)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -95,13 +83,9 @@ Foam::fvPatchField<Type>::fvPatchField
|
|||||||
const Field<Type>& f
|
const Field<Type>& f
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvPatchFieldBase(p),
|
||||||
Field<Type>(f),
|
Field<Type>(f),
|
||||||
patch_(p),
|
internalField_(iF)
|
||||||
internalField_(iF),
|
|
||||||
updated_(false),
|
|
||||||
manipulatedMatrix_(false),
|
|
||||||
useImplicit_(false),
|
|
||||||
patchType_()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -114,17 +98,10 @@ Foam::fvPatchField<Type>::fvPatchField
|
|||||||
const bool valueRequired
|
const bool valueRequired
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvPatchFieldBase(p, dict),
|
||||||
Field<Type>(p.size()),
|
Field<Type>(p.size()),
|
||||||
patch_(p),
|
internalField_(iF)
|
||||||
internalField_(iF),
|
|
||||||
updated_(false),
|
|
||||||
manipulatedMatrix_(false),
|
|
||||||
useImplicit_(false),
|
|
||||||
patchType_()
|
|
||||||
{
|
{
|
||||||
dict.readIfPresent("useImplicit", useImplicit_, keyType::LITERAL);
|
|
||||||
dict.readIfPresent("patchType", patchType_, keyType::LITERAL);
|
|
||||||
|
|
||||||
if (valueRequired)
|
if (valueRequired)
|
||||||
{
|
{
|
||||||
const auto* eptr = dict.findEntry("value", keyType::LITERAL);
|
const auto* eptr = dict.findEntry("value", keyType::LITERAL);
|
||||||
@ -153,13 +130,9 @@ Foam::fvPatchField<Type>::fvPatchField
|
|||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvPatchFieldBase(ptf, p),
|
||||||
Field<Type>(p.size()),
|
Field<Type>(p.size()),
|
||||||
patch_(p),
|
internalField_(iF)
|
||||||
internalField_(iF),
|
|
||||||
updated_(false),
|
|
||||||
manipulatedMatrix_(false),
|
|
||||||
useImplicit_(ptf.useImplicit_),
|
|
||||||
patchType_(ptf.patchType_)
|
|
||||||
{
|
{
|
||||||
// For unmapped faces set to internal field value (zero-gradient)
|
// For unmapped faces set to internal field value (zero-gradient)
|
||||||
if (notNull(iF) && mapper.hasUnmapped())
|
if (notNull(iF) && mapper.hasUnmapped())
|
||||||
@ -176,13 +149,9 @@ Foam::fvPatchField<Type>::fvPatchField
|
|||||||
const fvPatchField<Type>& ptf
|
const fvPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvPatchFieldBase(ptf),
|
||||||
Field<Type>(ptf),
|
Field<Type>(ptf),
|
||||||
patch_(ptf.patch_),
|
internalField_(ptf.internalField_)
|
||||||
internalField_(ptf.internalField_),
|
|
||||||
updated_(false),
|
|
||||||
manipulatedMatrix_(false),
|
|
||||||
useImplicit_(ptf.useImplicit_),
|
|
||||||
patchType_(ptf.patchType_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -193,41 +162,25 @@ Foam::fvPatchField<Type>::fvPatchField
|
|||||||
const DimensionedField<Type, volMesh>& iF
|
const DimensionedField<Type, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvPatchFieldBase(ptf),
|
||||||
Field<Type>(ptf),
|
Field<Type>(ptf),
|
||||||
patch_(ptf.patch_),
|
internalField_(iF)
|
||||||
internalField_(iF),
|
|
||||||
updated_(false),
|
|
||||||
manipulatedMatrix_(false),
|
|
||||||
useImplicit_(ptf.useImplicit_),
|
|
||||||
patchType_(ptf.patchType_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
const Foam::objectRegistry& Foam::fvPatchField<Type>::db() const
|
void Foam::fvPatchField<Type>::check(const fvPatchField<Type>& rhs) const
|
||||||
{
|
{
|
||||||
return patch_.boundaryMesh().mesh();
|
fvPatchFieldBase::checkPatch(rhs);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::fvPatchField<Type>::check(const fvPatchField<Type>& ptf) const
|
|
||||||
{
|
|
||||||
if (&patch_ != &(ptf.patch_))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "different patches for fvPatchField<Type>s"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type>> Foam::fvPatchField<Type>::snGrad() const
|
Foam::tmp<Foam::Field<Type>> Foam::fvPatchField<Type>::snGrad() const
|
||||||
{
|
{
|
||||||
return patch_.deltaCoeffs()*(*this - patchInternalField());
|
return patch().deltaCoeffs()*(*this - patchInternalField());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -235,14 +188,14 @@ template<class Type>
|
|||||||
Foam::tmp<Foam::Field<Type>>
|
Foam::tmp<Foam::Field<Type>>
|
||||||
Foam::fvPatchField<Type>::patchInternalField() const
|
Foam::fvPatchField<Type>::patchInternalField() const
|
||||||
{
|
{
|
||||||
return patch_.patchInternalField(internalField_);
|
return patch().patchInternalField(internalField_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fvPatchField<Type>::patchInternalField(Field<Type>& pif) const
|
void Foam::fvPatchField<Type>::patchInternalField(Field<Type>& pif) const
|
||||||
{
|
{
|
||||||
patch_.patchInternalField(internalField_, pif);
|
patch().patchInternalField(internalField_, pif);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -323,7 +276,7 @@ void Foam::fvPatchField<Type>::rmap
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fvPatchField<Type>::updateCoeffs()
|
void Foam::fvPatchField<Type>::updateCoeffs()
|
||||||
{
|
{
|
||||||
updated_ = true;
|
fvPatchFieldBase::setUpdated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -331,11 +284,11 @@ template<class Type>
|
|||||||
void Foam::fvPatchField<Type>::updateWeightedCoeffs(const scalarField& weights)
|
void Foam::fvPatchField<Type>::updateWeightedCoeffs(const scalarField& weights)
|
||||||
{
|
{
|
||||||
// Default behaviour ignores the weights
|
// Default behaviour ignores the weights
|
||||||
if (!updated_)
|
if (!updated())
|
||||||
{
|
{
|
||||||
updateCoeffs();
|
updateCoeffs();
|
||||||
|
|
||||||
updated_ = true;
|
fvPatchFieldBase::setUpdated(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,20 +296,20 @@ void Foam::fvPatchField<Type>::updateWeightedCoeffs(const scalarField& weights)
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fvPatchField<Type>::evaluate(const Pstream::commsTypes)
|
void Foam::fvPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||||
{
|
{
|
||||||
if (!updated_)
|
if (!updated())
|
||||||
{
|
{
|
||||||
updateCoeffs();
|
updateCoeffs();
|
||||||
}
|
}
|
||||||
|
|
||||||
updated_ = false;
|
fvPatchFieldBase::setUpdated(false);
|
||||||
manipulatedMatrix_ = false;
|
fvPatchFieldBase::setManipulated(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fvPatchField<Type>::manipulateMatrix(fvMatrix<Type>& matrix)
|
void Foam::fvPatchField<Type>::manipulateMatrix(fvMatrix<Type>& matrix)
|
||||||
{
|
{
|
||||||
manipulatedMatrix_ = true;
|
fvPatchFieldBase::setManipulated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -367,7 +320,7 @@ void Foam::fvPatchField<Type>::manipulateMatrix
|
|||||||
const scalarField& weights
|
const scalarField& weights
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
manipulatedMatrix_ = true;
|
fvPatchFieldBase::setManipulated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -379,7 +332,7 @@ void Foam::fvPatchField<Type>::manipulateMatrix
|
|||||||
const direction cmp
|
const direction cmp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
manipulatedMatrix_ = true;
|
fvPatchFieldBase::setManipulated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -388,15 +341,14 @@ void Foam::fvPatchField<Type>::write(Ostream& os) const
|
|||||||
{
|
{
|
||||||
os.writeEntry("type", type());
|
os.writeEntry("type", type());
|
||||||
|
|
||||||
if (useImplicit_)
|
if (!patchType().empty())
|
||||||
|
{
|
||||||
|
os.writeEntry("patchType", patchType());
|
||||||
|
}
|
||||||
|
if (useImplicit())
|
||||||
{
|
{
|
||||||
os.writeEntry("useImplicit", "true");
|
os.writeEntry("useImplicit", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!patchType_.empty())
|
|
||||||
{
|
|
||||||
os.writeEntry("patchType", patchType_);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -418,7 +370,7 @@ void Foam::fvPatchField<Type>::operator=
|
|||||||
const fvPatchField<Type>& ptf
|
const fvPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
check(ptf);
|
fvPatchFieldBase::checkPatch(ptf);
|
||||||
Field<Type>::operator=(ptf);
|
Field<Type>::operator=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,7 +381,7 @@ void Foam::fvPatchField<Type>::operator+=
|
|||||||
const fvPatchField<Type>& ptf
|
const fvPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
check(ptf);
|
fvPatchFieldBase::checkPatch(ptf);
|
||||||
Field<Type>::operator+=(ptf);
|
Field<Type>::operator+=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,7 +392,7 @@ void Foam::fvPatchField<Type>::operator-=
|
|||||||
const fvPatchField<Type>& ptf
|
const fvPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
check(ptf);
|
fvPatchFieldBase::checkPatch(ptf);
|
||||||
Field<Type>::operator-=(ptf);
|
Field<Type>::operator-=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,13 +403,7 @@ void Foam::fvPatchField<Type>::operator*=
|
|||||||
const fvPatchField<scalar>& ptf
|
const fvPatchField<scalar>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (&patch_ != &ptf.patch())
|
fvPatchFieldBase::checkPatch(ptf);
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "incompatible patches for patch fields"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
Field<Type>::operator*=(ptf);
|
Field<Type>::operator*=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,12 +414,7 @@ void Foam::fvPatchField<Type>::operator/=
|
|||||||
const fvPatchField<scalar>& ptf
|
const fvPatchField<scalar>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (&patch_ != &ptf.patch())
|
fvPatchFieldBase::checkPatch(ptf);
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
Field<Type>::operator/=(ptf);
|
Field<Type>::operator/=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,7 @@ Description
|
|||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
fvPatchField.C
|
fvPatchField.C
|
||||||
|
fvPatchFieldBase.C
|
||||||
fvPatchFieldNew.C
|
fvPatchFieldNew.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -58,7 +59,6 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
|
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
class fvPatchFieldMapper;
|
class fvPatchFieldMapper;
|
||||||
@ -73,22 +73,17 @@ Ostream& operator<<(Ostream&, const fvPatchField<Type>&);
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class fvPatchField Declaration
|
Class fvPatchFieldBase Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
//- Template invariant parts for fvPatchField
|
||||||
class fvPatchField
|
class fvPatchFieldBase
|
||||||
:
|
|
||||||
public Field<Type>
|
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Reference to patch
|
//- Reference to patch
|
||||||
const fvPatch& patch_;
|
const fvPatch& patch_;
|
||||||
|
|
||||||
//- Reference to internal field
|
|
||||||
const DimensionedField<Type, volMesh>& internalField_;
|
|
||||||
|
|
||||||
//- Update index used so that updateCoeffs is called only once during
|
//- Update index used so that updateCoeffs is called only once during
|
||||||
//- the construction of the matrix
|
//- the construction of the matrix
|
||||||
bool updated_;
|
bool updated_;
|
||||||
@ -100,12 +95,143 @@ class fvPatchField
|
|||||||
//- Use implicit formulation
|
//- Use implicit formulation
|
||||||
bool useImplicit_;
|
bool useImplicit_;
|
||||||
|
|
||||||
//- Optional patch type, used to allow specified boundary conditions
|
//- Optional patch type
|
||||||
// to be applied to constraint patches by providing the constraint
|
// Used to allow specified boundary conditions to be applied
|
||||||
|
// to constraint patches by providing the constraint
|
||||||
// patch type as 'patchType'
|
// patch type as 'patchType'
|
||||||
word patchType_;
|
word patchType_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Read dictionary entries.
|
||||||
|
// Useful when initially constructed without a dictionary
|
||||||
|
virtual void readDict(const dictionary& dict);
|
||||||
|
|
||||||
|
//- Set updated state
|
||||||
|
void setUpdated(bool state) noexcept
|
||||||
|
{
|
||||||
|
updated_ = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Set matrix manipulated state
|
||||||
|
void setManipulated(bool state) noexcept
|
||||||
|
{
|
||||||
|
manipulatedMatrix_ = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Debug switch to disallow the use of generic fvPatchField
|
||||||
|
static int disallowGenericPatchField;
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("fvPatchField");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch
|
||||||
|
explicit fvPatchFieldBase(const fvPatch& p);
|
||||||
|
|
||||||
|
//- Construct from patch and patch type
|
||||||
|
explicit fvPatchFieldBase(const fvPatch& p, const word& patchType);
|
||||||
|
|
||||||
|
//- Construct from patch and dictionary
|
||||||
|
fvPatchFieldBase(const fvPatch& p, const dictionary& dict);
|
||||||
|
|
||||||
|
//- Copy construct with new patch
|
||||||
|
fvPatchFieldBase(const fvPatchFieldBase& rhs, const fvPatch& p);
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
fvPatchFieldBase(const fvPatchFieldBase& rhs);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~fvPatchFieldBase() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- The associated objectRegistry
|
||||||
|
const objectRegistry& db() const;
|
||||||
|
|
||||||
|
//- Return the patch
|
||||||
|
const fvPatch& patch() const noexcept
|
||||||
|
{
|
||||||
|
return patch_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- The optional patch type
|
||||||
|
const word& patchType() const noexcept
|
||||||
|
{
|
||||||
|
return patchType_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- The optional patch type
|
||||||
|
word& patchType() noexcept
|
||||||
|
{
|
||||||
|
return patchType_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Solution
|
||||||
|
|
||||||
|
//- True if the boundary condition has already been updated
|
||||||
|
bool updated() const noexcept
|
||||||
|
{
|
||||||
|
return updated_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- True if the matrix has already been manipulated
|
||||||
|
bool manipulatedMatrix() const noexcept
|
||||||
|
{
|
||||||
|
return manipulatedMatrix_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Use implicit formulation for coupled patches only
|
||||||
|
bool useImplicit() const noexcept
|
||||||
|
{
|
||||||
|
return useImplicit_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Set useImplicit on/off
|
||||||
|
// \return old value
|
||||||
|
bool useImplicit(bool on) noexcept
|
||||||
|
{
|
||||||
|
bool old(useImplicit_);
|
||||||
|
useImplicit_ = on;
|
||||||
|
return old;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Check
|
||||||
|
|
||||||
|
//- Check that patches are identical
|
||||||
|
void checkPatch(const fvPatchFieldBase& rhs) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class fvPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class fvPatchField
|
||||||
|
:
|
||||||
|
public fvPatchFieldBase,
|
||||||
|
public Field<Type>
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Reference to internal field
|
||||||
|
const DimensionedField<Type, volMesh>& internalField_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- The internal field type associated with the patch field
|
//- The internal field type associated with the patch field
|
||||||
@ -118,13 +244,6 @@ public:
|
|||||||
typedef calculatedFvPatchField<Type> Calculated;
|
typedef calculatedFvPatchField<Type> Calculated;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("fvPatchField");
|
|
||||||
|
|
||||||
//- Debug switch to disallow the use of genericFvPatchField
|
|
||||||
static int disallowGenericFvPatchField;
|
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection tables
|
// Declare run-time constructor selection tables
|
||||||
|
|
||||||
declareRunTimeSelectionTable
|
declareRunTimeSelectionTable
|
||||||
@ -221,12 +340,6 @@ public:
|
|||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
fvPatchField(const fvPatchField<Type>&);
|
fvPatchField(const fvPatchField<Type>&);
|
||||||
|
|
||||||
//- Construct and return a clone
|
|
||||||
virtual tmp<fvPatchField<Type>> clone() const
|
|
||||||
{
|
|
||||||
return tmp<fvPatchField<Type>>::New(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
//- Construct as copy setting internal field reference
|
||||||
fvPatchField
|
fvPatchField
|
||||||
(
|
(
|
||||||
@ -234,6 +347,12 @@ public:
|
|||||||
const DimensionedField<Type, volMesh>&
|
const DimensionedField<Type, volMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type>> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type>>::New(*this);
|
||||||
|
}
|
||||||
|
|
||||||
//- Construct and return a clone setting internal field reference
|
//- Construct and return a clone setting internal field reference
|
||||||
virtual tmp<fvPatchField<Type>> clone
|
virtual tmp<fvPatchField<Type>> clone
|
||||||
(
|
(
|
||||||
@ -304,35 +423,21 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~fvPatchField<Type>() = default;
|
virtual ~fvPatchField() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Implicit Functions
|
//- The type name for calculated patch fields
|
||||||
|
static const word& calculatedType();
|
||||||
|
|
||||||
//- Use implicit formulation for coupled patches only
|
//- The type name for zeroGradient patch fields
|
||||||
bool useImplicit() const noexcept
|
static const word& zeroGradientType();
|
||||||
{
|
|
||||||
return useImplicit_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Set useImplicit on/off
|
|
||||||
// \return old value
|
|
||||||
bool useImplicit(bool on) noexcept
|
|
||||||
{
|
|
||||||
bool old(useImplicit_);
|
|
||||||
useImplicit_ = on;
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
|
|
||||||
//- Return the type of the calculated for of fvPatchField
|
//- True if this patch field fixes a value.
|
||||||
static const word& calculatedType();
|
|
||||||
|
|
||||||
//- Return true if this patch field fixes a value.
|
|
||||||
// Needed to check if a level has to be specified while solving
|
// Needed to check if a level has to be specified while solving
|
||||||
// Poissons equations.
|
// Poissons equations.
|
||||||
virtual bool fixesValue() const
|
virtual bool fixesValue() const
|
||||||
@ -340,14 +445,14 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if the value of the patch field
|
//- True if the value of the patch field
|
||||||
// is altered by assignment (the default)
|
//- is altered by assignment (the default)
|
||||||
virtual bool assignable() const
|
virtual bool assignable() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if this patch field is coupled
|
//- True if this patch field is coupled
|
||||||
virtual bool coupled() const
|
virtual bool coupled() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -356,51 +461,19 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return local objectRegistry
|
|
||||||
const objectRegistry& db() const;
|
|
||||||
|
|
||||||
//- Return patch
|
|
||||||
const fvPatch& patch() const
|
|
||||||
{
|
|
||||||
return patch_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return dimensioned internal field reference
|
//- Return dimensioned internal field reference
|
||||||
const DimensionedField<Type, volMesh>& internalField() const
|
const DimensionedField<Type, volMesh>& internalField()
|
||||||
|
const noexcept
|
||||||
{
|
{
|
||||||
return internalField_;
|
return internalField_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return internal field reference
|
//- Return internal field reference
|
||||||
const Field<Type>& primitiveField() const
|
const Field<Type>& primitiveField() const noexcept
|
||||||
{
|
{
|
||||||
return internalField_;
|
return internalField_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Optional patch type
|
|
||||||
const word& patchType() const
|
|
||||||
{
|
|
||||||
return patchType_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Optional patch type
|
|
||||||
word& patchType()
|
|
||||||
{
|
|
||||||
return patchType_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return true if the boundary condition has already been updated
|
|
||||||
bool updated() const
|
|
||||||
{
|
|
||||||
return updated_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return true if the matrix has already been manipulated
|
|
||||||
bool manipulatedMatrix() const
|
|
||||||
{
|
|
||||||
return manipulatedMatrix_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Mapping Functions
|
// Mapping Functions
|
||||||
|
|
||||||
@ -597,7 +670,7 @@ public:
|
|||||||
virtual void operator==(const Type&);
|
virtual void operator==(const Type&);
|
||||||
|
|
||||||
|
|
||||||
// Ostream operator
|
// Ostream Operator
|
||||||
|
|
||||||
friend Ostream& operator<< <Type>(Ostream&, const fvPatchField<Type>&);
|
friend Ostream& operator<< <Type>(Ostream&, const fvPatchField<Type>&);
|
||||||
};
|
};
|
||||||
@ -612,22 +685,21 @@ public:
|
|||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "fvPatchField.C"
|
#include "fvPatchField.C"
|
||||||
#include "calculatedFvPatchField.H"
|
#include "calculatedFvPatchField.H"
|
||||||
|
#include "zeroGradientFvPatchField.H"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Runtime selection macros
|
||||||
|
|
||||||
#define makeFvPatchField(fvPatchTypeField) \
|
#define makeFvPatchField(fvPatchTypeField) \
|
||||||
\
|
\
|
||||||
defineNamedTemplateTypeNameAndDebug(fvPatchTypeField, 0); \
|
|
||||||
template<> \
|
|
||||||
int fvPatchTypeField::disallowGenericFvPatchField \
|
|
||||||
( \
|
|
||||||
debug::debugSwitch("disallowGenericFvPatchField", 0) \
|
|
||||||
); \
|
|
||||||
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patch); \
|
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patch); \
|
||||||
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patchMapper); \
|
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patchMapper); \
|
||||||
defineTemplateRunTimeSelectionTable(fvPatchTypeField, dictionary);
|
defineTemplateRunTimeSelectionTable(fvPatchTypeField, dictionary);
|
||||||
|
|
||||||
|
|
||||||
|
#undef addToPatchFieldRunTimeSelection
|
||||||
#define addToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \
|
#define addToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \
|
||||||
addToRunTimeSelectionTable \
|
addToRunTimeSelectionTable \
|
||||||
( \
|
( \
|
||||||
@ -650,6 +722,7 @@ defineTemplateRunTimeSelectionTable(fvPatchTypeField, dictionary);
|
|||||||
|
|
||||||
|
|
||||||
// Use with caution
|
// Use with caution
|
||||||
|
#undef addRemovableToPatchFieldRunTimeSelection
|
||||||
#define addRemovableToPatchFieldRunTimeSelection\
|
#define addRemovableToPatchFieldRunTimeSelection\
|
||||||
(PatchTypeField, typePatchTypeField) \
|
(PatchTypeField, typePatchTypeField) \
|
||||||
\
|
\
|
||||||
|
|||||||
@ -0,0 +1,130 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2022 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 "fvPatchField.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(fvPatchFieldBase, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Foam::fvPatchFieldBase::disallowGenericPatchField
|
||||||
|
(
|
||||||
|
Foam::debug::debugSwitch("disallowGenericFvPatchField", 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fvPatchFieldBase::fvPatchFieldBase(const fvPatch& p)
|
||||||
|
:
|
||||||
|
patch_(p),
|
||||||
|
updated_(false),
|
||||||
|
manipulatedMatrix_(false),
|
||||||
|
useImplicit_(false),
|
||||||
|
patchType_()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fvPatchFieldBase::fvPatchFieldBase
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const word& patchType
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fvPatchFieldBase(p)
|
||||||
|
{
|
||||||
|
patchType_ = patchType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fvPatchFieldBase::fvPatchFieldBase
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fvPatchFieldBase(p)
|
||||||
|
{
|
||||||
|
fvPatchFieldBase::readDict(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fvPatchFieldBase::fvPatchFieldBase
|
||||||
|
(
|
||||||
|
const fvPatchFieldBase& rhs,
|
||||||
|
const fvPatch& p
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(p),
|
||||||
|
updated_(false),
|
||||||
|
manipulatedMatrix_(false),
|
||||||
|
useImplicit_(rhs.useImplicit_),
|
||||||
|
patchType_(rhs.patchType_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fvPatchFieldBase::fvPatchFieldBase(const fvPatchFieldBase& rhs)
|
||||||
|
:
|
||||||
|
patch_(rhs.patch_),
|
||||||
|
updated_(false),
|
||||||
|
manipulatedMatrix_(false),
|
||||||
|
useImplicit_(rhs.useImplicit_),
|
||||||
|
patchType_(rhs.patchType_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fvPatchFieldBase::readDict(const dictionary& dict)
|
||||||
|
{
|
||||||
|
dict.readIfPresent("patchType", patchType_, keyType::LITERAL);
|
||||||
|
dict.readIfPresent("useImplicit", useImplicit_, keyType::LITERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::objectRegistry& Foam::fvPatchFieldBase::db() const
|
||||||
|
{
|
||||||
|
return patch_.boundaryMesh().mesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fvPatchFieldBase::checkPatch(const fvPatchFieldBase& rhs) const
|
||||||
|
{
|
||||||
|
if (&patch_ != &(rhs.patch_))
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Different patches for fvPatchField"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -69,14 +69,14 @@ Foam::tmp<Foam::fvPatchField<Type>> Foam::fvPatchField<Type>::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tmp<fvPatchField<Type>> tfvp = ctorPtr(p, iF);
|
tmp<fvPatchField<Type>> tpfld(ctorPtr(p, iF));
|
||||||
|
|
||||||
// Check if constraint type override and store patchType if so
|
// If constraint type: override and store patchType
|
||||||
if (patchTypeCtor)
|
if (patchTypeCtor)
|
||||||
{
|
{
|
||||||
tfvp.ref().patchType() = actualPatchType;
|
tpfld.ref().patchType() = actualPatchType;
|
||||||
}
|
}
|
||||||
return tfvp;
|
return tpfld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ Foam::tmp<Foam::fvPatchField<Type>> Foam::fvPatchField<Type>::New
|
|||||||
|
|
||||||
if (!ctorPtr)
|
if (!ctorPtr)
|
||||||
{
|
{
|
||||||
if (!disallowGenericFvPatchField)
|
if (!fvPatchFieldBase::disallowGenericPatchField)
|
||||||
{
|
{
|
||||||
ctorPtr = dictionaryConstructorTable("generic");
|
ctorPtr = dictionaryConstructorTable("generic");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,8 +25,8 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef fvPatchFields_H
|
#ifndef Foam_fvPatchFields_H
|
||||||
#define fvPatchFields_H
|
#define Foam_fvPatchFields_H
|
||||||
|
|
||||||
#include "fvPatchField.H"
|
#include "fvPatchField.H"
|
||||||
#include "fvPatchFieldsFwd.H"
|
#include "fvPatchFieldsFwd.H"
|
||||||
|
|||||||
@ -25,8 +25,8 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef fvPatchFieldsFwd_H
|
#ifndef Foam_fvPatchFieldsFwd_H
|
||||||
#define fvPatchFieldsFwd_H
|
#define Foam_fvPatchFieldsFwd_H
|
||||||
|
|
||||||
#include "fieldTypes.H"
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ License
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
const Foam::word& Foam::fvsPatchField<Type>::calculatedType()
|
const Foam::word& Foam::fvsPatchField<Type>::calculatedType()
|
||||||
{
|
{
|
||||||
return calculatedFvsPatchField<Type>::typeName;
|
return Foam::calculatedFvsPatchField<Type>::typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -41,8 +41,8 @@ Foam::fvsPatchField<Type>::fvsPatchField
|
|||||||
const DimensionedField<Type, surfaceMesh>& iF
|
const DimensionedField<Type, surfaceMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvsPatchFieldBase(p),
|
||||||
Field<Type>(p.size()),
|
Field<Type>(p.size()),
|
||||||
patch_(p),
|
|
||||||
internalField_(iF)
|
internalField_(iF)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -55,8 +55,8 @@ Foam::fvsPatchField<Type>::fvsPatchField
|
|||||||
const Field<Type>& f
|
const Field<Type>& f
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvsPatchFieldBase(p),
|
||||||
Field<Type>(f),
|
Field<Type>(f),
|
||||||
patch_(p),
|
|
||||||
internalField_(iF)
|
internalField_(iF)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -70,8 +70,8 @@ Foam::fvsPatchField<Type>::fvsPatchField
|
|||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvsPatchFieldBase(ptf, p),
|
||||||
Field<Type>(ptf, mapper),
|
Field<Type>(ptf, mapper),
|
||||||
patch_(p),
|
|
||||||
internalField_(iF)
|
internalField_(iF)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -85,8 +85,8 @@ Foam::fvsPatchField<Type>::fvsPatchField
|
|||||||
const bool valueRequired
|
const bool valueRequired
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvsPatchFieldBase(p, dict),
|
||||||
Field<Type>(p.size()),
|
Field<Type>(p.size()),
|
||||||
patch_(p),
|
|
||||||
internalField_(iF)
|
internalField_(iF)
|
||||||
{
|
{
|
||||||
if (valueRequired)
|
if (valueRequired)
|
||||||
@ -111,8 +111,8 @@ Foam::fvsPatchField<Type>::fvsPatchField
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::fvsPatchField<Type>::fvsPatchField(const fvsPatchField<Type>& ptf)
|
Foam::fvsPatchField<Type>::fvsPatchField(const fvsPatchField<Type>& ptf)
|
||||||
:
|
:
|
||||||
|
fvsPatchFieldBase(ptf),
|
||||||
Field<Type>(ptf),
|
Field<Type>(ptf),
|
||||||
patch_(ptf.patch_),
|
|
||||||
internalField_(ptf.internalField_)
|
internalField_(ptf.internalField_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -124,30 +124,18 @@ Foam::fvsPatchField<Type>::fvsPatchField
|
|||||||
const DimensionedField<Type, surfaceMesh>& iF
|
const DimensionedField<Type, surfaceMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fvsPatchFieldBase(ptf),
|
||||||
Field<Type>(ptf),
|
Field<Type>(ptf),
|
||||||
patch_(ptf.patch_),
|
|
||||||
internalField_(iF)
|
internalField_(iF)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
const Foam::objectRegistry& Foam::fvsPatchField<Type>::db() const
|
|
||||||
{
|
|
||||||
return patch_.boundaryMesh().mesh();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fvsPatchField<Type>::check(const fvsPatchField<Type>& ptf) const
|
void Foam::fvsPatchField<Type>::check(const fvsPatchField<Type>& ptf) const
|
||||||
{
|
{
|
||||||
if (&patch_ != &(ptf.patch_))
|
fvsPatchFieldBase::checkPatch(ptf);
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "different patches for fvsPatchField<Type>s"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -196,7 +184,7 @@ void Foam::fvsPatchField<Type>::operator=
|
|||||||
const fvsPatchField<Type>& ptf
|
const fvsPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
check(ptf);
|
fvsPatchFieldBase::checkPatch(ptf);
|
||||||
Field<Type>::operator=(ptf);
|
Field<Type>::operator=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +195,7 @@ void Foam::fvsPatchField<Type>::operator+=
|
|||||||
const fvsPatchField<Type>& ptf
|
const fvsPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
check(ptf);
|
fvsPatchFieldBase::checkPatch(ptf);
|
||||||
Field<Type>::operator+=(ptf);
|
Field<Type>::operator+=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +206,7 @@ void Foam::fvsPatchField<Type>::operator-=
|
|||||||
const fvsPatchField<Type>& ptf
|
const fvsPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
check(ptf);
|
fvsPatchFieldBase::checkPatch(ptf);
|
||||||
Field<Type>::operator-=(ptf);
|
Field<Type>::operator-=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,13 +217,7 @@ void Foam::fvsPatchField<Type>::operator*=
|
|||||||
const fvsPatchField<scalar>& ptf
|
const fvsPatchField<scalar>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (&patch_ != &ptf.patch())
|
fvsPatchFieldBase::checkPatch(ptf);
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "incompatible patches for patch fields"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
Field<Type>::operator*=(ptf);
|
Field<Type>::operator*=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,12 +228,7 @@ void Foam::fvsPatchField<Type>::operator/=
|
|||||||
const fvsPatchField<scalar>& ptf
|
const fvsPatchField<scalar>& ptf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (&patch_ != &ptf.patch())
|
fvsPatchFieldBase::checkPatch(ptf);
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
Field<Type>::operator/=(ptf);
|
Field<Type>::operator/=(ptf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,6 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
|
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
class fvPatchFieldMapper;
|
class fvPatchFieldMapper;
|
||||||
@ -70,19 +69,87 @@ Ostream& operator<<(Ostream&, const fvsPatchField<Type>&);
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class patch Declaration
|
Class fvsPatchFieldBase Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
//- Template invariant parts for fvsPatchField
|
||||||
class fvsPatchField
|
class fvsPatchFieldBase
|
||||||
:
|
|
||||||
public Field<Type>
|
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Reference to patch
|
//- Reference to patch
|
||||||
const fvPatch& patch_;
|
const fvPatch& patch_;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Read dictionary entries.
|
||||||
|
// Useful when initially constructed without a dictionary
|
||||||
|
virtual void readDict(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Debug switch to disallow the use of generic fvsPatchField
|
||||||
|
static int disallowGenericPatchField;
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("fvsPatchField");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch
|
||||||
|
explicit fvsPatchFieldBase(const fvPatch& p);
|
||||||
|
|
||||||
|
//- Construct from patch and dictionary (unused)
|
||||||
|
fvsPatchFieldBase(const fvPatch& p, const dictionary& dict);
|
||||||
|
|
||||||
|
//- Copy construct with new patch
|
||||||
|
fvsPatchFieldBase(const fvsPatchFieldBase& rhs, const fvPatch& p);
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
fvsPatchFieldBase(const fvsPatchFieldBase& rhs);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~fvsPatchFieldBase() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- The associated objectRegistry
|
||||||
|
const objectRegistry& db() const;
|
||||||
|
|
||||||
|
//- Return the patch
|
||||||
|
const fvPatch& patch() const noexcept
|
||||||
|
{
|
||||||
|
return patch_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Check
|
||||||
|
|
||||||
|
//- Check that patches are identical
|
||||||
|
void checkPatch(const fvsPatchFieldBase& rhs) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class fvsPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class fvsPatchField
|
||||||
|
:
|
||||||
|
public fvsPatchFieldBase,
|
||||||
|
public Field<Type>
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
//- Reference to internal field
|
//- Reference to internal field
|
||||||
const DimensionedField<Type, surfaceMesh>& internalField_;
|
const DimensionedField<Type, surfaceMesh>& internalField_;
|
||||||
|
|
||||||
@ -99,13 +166,6 @@ public:
|
|||||||
typedef calculatedFvsPatchField<Type> Calculated;
|
typedef calculatedFvsPatchField<Type> Calculated;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("fvsPatchField");
|
|
||||||
|
|
||||||
//- Debug switch to disallow the use of genericFvsPatchField
|
|
||||||
static int disallowGenericFvsPatchField;
|
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection tables
|
// Declare run-time constructor selection tables
|
||||||
|
|
||||||
declareRunTimeSelectionTable
|
declareRunTimeSelectionTable
|
||||||
@ -186,12 +246,6 @@ public:
|
|||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
fvsPatchField(const fvsPatchField<Type>&);
|
fvsPatchField(const fvsPatchField<Type>&);
|
||||||
|
|
||||||
//- Construct and return a clone
|
|
||||||
virtual tmp<fvsPatchField<Type>> clone() const
|
|
||||||
{
|
|
||||||
return tmp<fvsPatchField<Type>>::New(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
//- Construct as copy setting internal field reference
|
||||||
fvsPatchField
|
fvsPatchField
|
||||||
(
|
(
|
||||||
@ -199,6 +253,12 @@ public:
|
|||||||
const DimensionedField<Type, surfaceMesh>&
|
const DimensionedField<Type, surfaceMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvsPatchField<Type>> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvsPatchField<Type>>::New(*this);
|
||||||
|
}
|
||||||
|
|
||||||
//- Construct and return a clone setting internal field reference
|
//- Construct and return a clone setting internal field reference
|
||||||
virtual tmp<fvsPatchField<Type>> clone
|
virtual tmp<fvsPatchField<Type>> clone
|
||||||
(
|
(
|
||||||
@ -269,38 +329,18 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~fvsPatchField<Type>() = default;
|
virtual ~fvsPatchField() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
//- The type name for calculated patch fields
|
||||||
|
static const word& calculatedType();
|
||||||
|
|
||||||
//- Return local objectRegistry
|
|
||||||
const objectRegistry& db() const;
|
|
||||||
|
|
||||||
//- Return patch
|
// Attributes
|
||||||
const fvPatch& patch() const
|
|
||||||
{
|
|
||||||
return patch_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return dimensioned internal field reference
|
//- True if this patch field fixes a value.
|
||||||
const DimensionedField<Type, surfaceMesh>& internalField() const
|
|
||||||
{
|
|
||||||
return internalField_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return internal field reference
|
|
||||||
const Field<Type>& primitiveField() const
|
|
||||||
{
|
|
||||||
return internalField_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return the type of the calculated for of fvsPatchField
|
|
||||||
static const word& calculatedType();
|
|
||||||
|
|
||||||
//- Return true if this patch field fixes a value.
|
|
||||||
// Needed to check if a level has to be specified while solving
|
// Needed to check if a level has to be specified while solving
|
||||||
// Poissons equations.
|
// Poissons equations.
|
||||||
virtual bool fixesValue() const
|
virtual bool fixesValue() const
|
||||||
@ -308,14 +348,30 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if this patch field is coupled
|
//- True if this patch field is coupled
|
||||||
virtual bool coupled() const
|
virtual bool coupled() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Mapping functions
|
// Access
|
||||||
|
|
||||||
|
//- Return dimensioned internal field reference
|
||||||
|
const DimensionedField<Type, surfaceMesh>& internalField()
|
||||||
|
const noexcept
|
||||||
|
{
|
||||||
|
return internalField_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return internal field reference
|
||||||
|
const Field<Type>& primitiveField() const noexcept
|
||||||
|
{
|
||||||
|
return internalField_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Mapping Functions
|
||||||
|
|
||||||
//- Map (and resize as needed) from self given a mapping object
|
//- Map (and resize as needed) from self given a mapping object
|
||||||
virtual void autoMap
|
virtual void autoMap
|
||||||
@ -341,7 +397,7 @@ public:
|
|||||||
void check(const fvsPatchField<Type>&) const;
|
void check(const fvsPatchField<Type>&) const;
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member Operators
|
||||||
|
|
||||||
virtual void operator=(const UList<Type>&);
|
virtual void operator=(const UList<Type>&);
|
||||||
|
|
||||||
@ -371,7 +427,7 @@ public:
|
|||||||
virtual void operator==(const Type&);
|
virtual void operator==(const Type&);
|
||||||
|
|
||||||
|
|
||||||
// Ostream operator
|
// Ostream Operator
|
||||||
|
|
||||||
friend Ostream& operator<< <Type>(Ostream&, const fvsPatchField<Type>&);
|
friend Ostream& operator<< <Type>(Ostream&, const fvsPatchField<Type>&);
|
||||||
};
|
};
|
||||||
@ -389,6 +445,9 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Runtime selection macros
|
||||||
|
|
||||||
#define makeFvsPatchTypeFieldTypeName(type) \
|
#define makeFvsPatchTypeFieldTypeName(type) \
|
||||||
\
|
\
|
||||||
defineNamedTemplateTypeNameAndDebug(type, 0);
|
defineNamedTemplateTypeNameAndDebug(type, 0);
|
||||||
|
|||||||
@ -0,0 +1,101 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2022 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 "fvsPatchField.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(fvsPatchFieldBase, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Foam::fvsPatchFieldBase::disallowGenericPatchField
|
||||||
|
(
|
||||||
|
Foam::debug::debugSwitch("disallowGenericFvsPatchField", 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fvsPatchFieldBase::fvsPatchFieldBase(const fvPatch& p)
|
||||||
|
:
|
||||||
|
patch_(p)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fvsPatchFieldBase::fvsPatchFieldBase
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(p)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fvsPatchFieldBase::fvsPatchFieldBase
|
||||||
|
(
|
||||||
|
const fvsPatchFieldBase& rhs,
|
||||||
|
const fvPatch& p
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(p)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fvsPatchFieldBase::fvsPatchFieldBase(const fvsPatchFieldBase& rhs)
|
||||||
|
:
|
||||||
|
patch_(rhs.patch_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fvsPatchFieldBase::readDict(const dictionary& dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::objectRegistry& Foam::fvsPatchFieldBase::db() const
|
||||||
|
{
|
||||||
|
return patch_.boundaryMesh().mesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fvsPatchFieldBase::checkPatch(const fvsPatchFieldBase& rhs) const
|
||||||
|
{
|
||||||
|
if (&patch_ != &(rhs.patch_))
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Different patches for fvsPatchField"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -102,7 +102,7 @@ Foam::tmp<Foam::fvsPatchField<Type>> Foam::fvsPatchField<Type>::New
|
|||||||
|
|
||||||
if (!ctorPtr)
|
if (!ctorPtr)
|
||||||
{
|
{
|
||||||
if (!disallowGenericFvsPatchField)
|
if (!fvsPatchFieldBase::disallowGenericPatchField)
|
||||||
{
|
{
|
||||||
ctorPtr = dictionaryConstructorTable("generic");
|
ctorPtr = dictionaryConstructorTable("generic");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,12 +36,6 @@ namespace Foam
|
|||||||
|
|
||||||
#define makeFvsPatchField(fvsPatchTypeField) \
|
#define makeFvsPatchField(fvsPatchTypeField) \
|
||||||
\
|
\
|
||||||
defineNamedTemplateTypeNameAndDebug(fvsPatchTypeField, 0); \
|
|
||||||
template<> \
|
|
||||||
int fvsPatchTypeField::disallowGenericFvsPatchField \
|
|
||||||
( \
|
|
||||||
debug::debugSwitch("disallowGenericFvsPatchField", 0) \
|
|
||||||
); \
|
|
||||||
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patch); \
|
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patch); \
|
||||||
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patchMapper); \
|
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patchMapper); \
|
||||||
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, dictionary);
|
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, dictionary);
|
||||||
|
|||||||
@ -30,8 +30,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef fvsPatchFields_H
|
#ifndef Foam_fvsPatchFields_H
|
||||||
#define fvsPatchFields_H
|
#define Foam_fvsPatchFields_H
|
||||||
|
|
||||||
#include "fvsPatchField.H"
|
#include "fvsPatchField.H"
|
||||||
#include "fvsPatchFieldsFwd.H"
|
#include "fvsPatchFieldsFwd.H"
|
||||||
|
|||||||
@ -30,8 +30,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef fvsPatchFieldsFwd_H
|
#ifndef Foam_fvsPatchFieldsFwd_H
|
||||||
#define fvsPatchFieldsFwd_H
|
#define Foam_fvsPatchFieldsFwd_H
|
||||||
|
|
||||||
#include "fieldTypes.H"
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -78,12 +78,13 @@ Foam::fvPatch::~fvPatch()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::fvPatch::constraintType(const word& pt)
|
bool Foam::fvPatch::constraintType(const word& patchType)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
fvPatchField<scalar>::patchConstructorTablePtr_
|
!patchType.empty()
|
||||||
&& fvPatchField<scalar>::patchConstructorTablePtr_->found(pt)
|
&& fvPatchField<scalar>::patchConstructorTablePtr_
|
||||||
|
&& fvPatchField<scalar>::patchConstructorTablePtr_->found(patchType)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +105,7 @@ Foam::wordList Foam::fvPatch::constraintTypes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cTypes.setSize(i);
|
cTypes.resize(i);
|
||||||
|
|
||||||
return cTypes;
|
return cTypes;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -195,7 +195,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if the given type is a constraint type
|
//- Return true if the given type is a constraint type
|
||||||
static bool constraintType(const word& pt);
|
static bool constraintType(const word& patchType);
|
||||||
|
|
||||||
//- Return a list of all the constraint patch types
|
//- Return a list of all the constraint patch types
|
||||||
static wordList constraintTypes();
|
static wordList constraintTypes();
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,35 +40,35 @@ addNamedToRunTimeSelectionTable
|
|||||||
(
|
(
|
||||||
pointPatchScalarField,
|
pointPatchScalarField,
|
||||||
slipPointPatchScalarField,
|
slipPointPatchScalarField,
|
||||||
pointPatch,
|
patch,
|
||||||
overset
|
overset
|
||||||
);
|
);
|
||||||
addNamedToRunTimeSelectionTable
|
addNamedToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
pointPatchVectorField,
|
pointPatchVectorField,
|
||||||
slipPointPatchVectorField,
|
slipPointPatchVectorField,
|
||||||
pointPatch,
|
patch,
|
||||||
overset
|
overset
|
||||||
);
|
);
|
||||||
addNamedToRunTimeSelectionTable
|
addNamedToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
pointPatchSphericalTensorField,
|
pointPatchSphericalTensorField,
|
||||||
slipPointPatchSphericalTensorField,
|
slipPointPatchSphericalTensorField,
|
||||||
pointPatch,
|
patch,
|
||||||
overset
|
overset
|
||||||
);
|
);
|
||||||
addNamedToRunTimeSelectionTable
|
addNamedToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
pointPatchSymmTensorField,
|
pointPatchSymmTensorField,
|
||||||
slipPointPatchSymmTensorField,
|
slipPointPatchSymmTensorField,
|
||||||
pointPatch,
|
patch,
|
||||||
overset
|
overset
|
||||||
);
|
);
|
||||||
addNamedToRunTimeSelectionTable
|
addNamedToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
pointPatchTensorField,
|
pointPatchTensorField,
|
||||||
slipPointPatchTensorField,
|
slipPointPatchTensorField,
|
||||||
pointPatch,
|
patch,
|
||||||
overset
|
overset
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ cellZoneID
|
|||||||
fieldName,
|
fieldName,
|
||||||
mesh,
|
mesh,
|
||||||
dimless,
|
dimless,
|
||||||
zeroGradientFvPatchField<scalar>::typeName
|
fvPatchScalarField::zeroGradientType()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,7 @@ relVelocity
|
|||||||
"relVelocity",
|
"relVelocity",
|
||||||
mesh(),
|
mesh(),
|
||||||
dimensionedVector(dimVelocity, Zero),
|
dimensionedVector(dimVelocity, Zero),
|
||||||
"zeroGradient"
|
fvPatchVectorField::zeroGradientType()
|
||||||
);
|
);
|
||||||
auto& relVel = trelVel.ref();
|
auto& relVel = trelVel.ref();
|
||||||
auto& relVelField = relVel.primitiveFieldRef();
|
auto& relVelField = relVel.primitiveFieldRef();
|
||||||
|
|||||||
Reference in New Issue
Block a user