Download data/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H from introvoyz042/OpenFOAM-dev: direct link, hf CLI and curl.
- Browser
- Download file 26.5 kB
-
https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H
- Command line
-
hf download hf://datasets/introvoyz042/OpenFOAM-dev/data/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H
-
curl -L -o fvPatchField.H https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H
26.5 kB
| /*---------------------------------------------------------------------------*\ | |
| ========= | | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | |
| \\ / O peration | Website: https://openfoam.org | |
| \\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation | |
| \\/ M anipulation | | |
| ------------------------------------------------------------------------------- | |
| 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/>. | |
| Class | |
| Foam::fvPatchField | |
| Description | |
| Abstract base class with a fat-interface to all derived classes | |
| covering all possible ways in which they might be used. | |
| The first level of derivation is to basic patchFields which cover | |
| zero-gradient, fixed-gradient, fixed-value and mixed conditions. | |
| The next level of derivation covers all the specialised types with | |
| specific evaluation procedures, particularly with respect to specific | |
| fields. | |
| SourceFiles | |
| fvPatchField.C | |
| fvPatchFieldNew.C | |
| \*---------------------------------------------------------------------------*/ | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| namespace Foam | |
| { | |
| // Forward declaration of classes | |
| class objectRegistry; | |
| class dictionary; | |
| class fieldMapper; | |
| class fvMesh; | |
| // Forward declaration of friend functions and operators | |
| template<class Type> | |
| class fvPatchField; | |
| template<class Type> | |
| class calculatedFvPatchField; | |
| template<class Type> | |
| class slicedFvPatchField; | |
| template<class Type> | |
| class fvMatrix; | |
| template<class Type> | |
| Ostream& operator<<(Ostream&, const fvPatchField<Type>&); | |
| /*---------------------------------------------------------------------------*\ | |
| Class fvPatchField Declaration | |
| \*---------------------------------------------------------------------------*/ | |
| template<class Type> | |
| class fvPatchField | |
| : | |
| public Field<Type> | |
| { | |
| // Private Data | |
| //- Optional list of libraries required for this boundary condition | |
| fileNameList libs_; | |
| //- Reference to patch | |
| const fvPatch& patch_; | |
| //- Reference to internal field | |
| const DimensionedField<Type, fvMesh>& internalField_; | |
| //- Update index used so that updateCoeffs is called only once during | |
| // the construction of the matrix | |
| bool updated_; | |
| //- Update index used so that manipulateMatrix is called only once | |
| // during the construction of the matrix | |
| bool manipulatedMatrix_; | |
| public: | |
| // Public Types | |
| //- Declare primitive type | |
| using pType = typename FieldTraits<Type>::pType; | |
| //- Declare component type | |
| using cmptType = typename FieldTraits<Type>::cmptType; | |
| //- Declare component primitive type | |
| using pCmptType = typename FieldTraits<Type>::pCmptType; | |
| //- Declare patch type | |
| using Patch = fvPatch; | |
| //- Declare calculated patch field type | |
| using Calculated = calculatedFvPatchField<Type>; | |
| //- Declare sliced patch field type | |
| using Sliced = slicedFvPatchField<Type>; | |
| //- Declare component Field type | |
| using cmptField = fvPatchField<cmptType>; | |
| //- Runtime type information | |
| TypeName("fvPatchField"); | |
| //- Debug switch to disallow the use of genericFvPatchField | |
| static int disallowGenericFvPatchField; | |
| // Declare run-time constructor selection tables | |
| declareRunTimeSelectionTable | |
| ( | |
| tmp, | |
| fvPatchField, | |
| patch, | |
| ( | |
| const fvPatch& p, | |
| const DimensionedField<Type, fvMesh>& iF | |
| ), | |
| (p, iF) | |
| ); | |
| declareRunTimeSelectionTable | |
| ( | |
| tmp, | |
| fvPatchField, | |
| patchMapper, | |
| ( | |
| const fvPatchField<Type>& ptf, | |
| const fvPatch& p, | |
| const DimensionedField<Type, fvMesh>& iF, | |
| const fieldMapper& m | |
| ), | |
| (dynamic_cast<const fvPatchFieldType&>(ptf), p, iF, m) | |
| ); | |
| declareRunTimeSelectionTable | |
| ( | |
| tmp, | |
| fvPatchField, | |
| dictionary, | |
| ( | |
| const fvPatch& p, | |
| const DimensionedField<Type, fvMesh>& iF, | |
| const dictionary& dict | |
| ), | |
| (p, iF, dict) | |
| ); | |
| // Constructors | |
| //- Construct from patch and internal field | |
| fvPatchField | |
| ( | |
| const fvPatch&, | |
| const DimensionedField<Type, fvMesh>& | |
| ); | |
| //- Construct from patch and internal field and patch field | |
| fvPatchField | |
| ( | |
| const fvPatch&, | |
| const DimensionedField<Type, fvMesh>&, | |
| const Field<Type>& | |
| ); | |
| //- Construct from patch, internal field and dictionary | |
| fvPatchField | |
| ( | |
| const fvPatch&, | |
| const DimensionedField<Type, fvMesh>&, | |
| const dictionary&, | |
| const bool valueRequired=true | |
| ); | |
| //- Construct by mapping the given fvPatchField onto a new patch | |
| fvPatchField | |
| ( | |
| const fvPatchField<Type>&, | |
| const fvPatch&, | |
| const DimensionedField<Type, fvMesh>&, | |
| const fieldMapper&, | |
| const bool mappingRequired=true | |
| ); | |
| //- Disallow copy without setting internal field reference | |
| fvPatchField(const fvPatchField<Type>&) = delete; | |
| //- Disallow clone without setting internal field reference | |
| tmp<fvPatchField<Type>> clone() const | |
| { | |
| NotImplemented; | |
| return tmp<fvPatchField<Type>>(nullptr); | |
| } | |
| //- Copy constructor setting internal field reference | |
| fvPatchField | |
| ( | |
| const fvPatchField<Type>&, | |
| const DimensionedField<Type, fvMesh>& | |
| ); | |
| //- Construct and return a clone setting internal field reference | |
| virtual tmp<fvPatchField<Type>> clone | |
| ( | |
| const DimensionedField<Type, fvMesh>& iF | |
| ) const | |
| { | |
| return tmp<fvPatchField<Type>>(new fvPatchField<Type>(*this, iF)); | |
| } | |
| //- Construct and return a clone onto a new patch | |
| // setting internal field reference | |
| virtual tmp<fvPatchField<Type>> clone | |
| ( | |
| const fvPatch& patch, | |
| const DimensionedField<Type, fvMesh>& iF | |
| ) const | |
| { | |
| return tmp<fvPatchField<Type>> | |
| ( | |
| new fvPatchField<Type>(patch, iF, *this) | |
| ); | |
| } | |
| // Selectors | |
| //- Return a pointer to a new patchField created on freestore given | |
| // patch and internal field | |
| // (does not set the patch field values) | |
| static tmp<fvPatchField<Type>> New | |
| ( | |
| const word&, | |
| const fvPatch&, | |
| const DimensionedField<Type, fvMesh>& | |
| ); | |
| //- Return a pointer to a new patchField created on freestore given | |
| // patch and internal field | |
| // (does not set the patch field values). | |
| // Allows override of constraint type | |
| static tmp<fvPatchField<Type>> New | |
| ( | |
| const word&, | |
| const word& actualPatchType, | |
| const fvPatch&, | |
| const DimensionedField<Type, fvMesh>& | |
| ); | |
| //- Return a pointer to a new patchField created on freestore from | |
| // a given fvPatchField mapped onto a new patch | |
| static tmp<fvPatchField<Type>> New | |
| ( | |
| const fvPatchField<Type>&, | |
| const fvPatch&, | |
| const DimensionedField<Type, fvMesh>&, | |
| const fieldMapper& | |
| ); | |
| //- Return a pointer to a new patchField created on freestore | |
| // from dictionary | |
| static tmp<fvPatchField<Type>> New | |
| ( | |
| const fvPatch&, | |
| const DimensionedField<Type, fvMesh>&, | |
| const dictionary& | |
| ); | |
| //- Destructor | |
| virtual ~fvPatchField() | |
| {} | |
| // Member Functions | |
| // Attributes | |
| //- Return the type of the calculated for of fvPatchField | |
| 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 | |
| // Poissons equations. | |
| virtual bool fixesValue() const | |
| { | |
| return false; | |
| } | |
| //- Return true if the value of the patch field | |
| // is altered by assignment (the default) | |
| virtual bool assignable() const | |
| { | |
| return true; | |
| } | |
| //- Return true if this patch field is coupled | |
| virtual bool coupled() const | |
| { | |
| return false; | |
| } | |
| //- Return true if this overrides the underlying constraint type | |
| bool overridesConstraint() const | |
| { | |
| if (type() == patch_.type()) | |
| { | |
| return false; | |
| } | |
| typename patchConstructorTable::iterator patchTypeCstrIter | |
| = patchConstructorTablePtr_->find(patch_.type()); | |
| return | |
| patchTypeCstrIter | |
| != patchConstructorTablePtr_->end(); | |
| } | |
| // Access | |
| //- Return local objectRegistry | |
| const objectRegistry& db() const; | |
| //- Return time | |
| const Time& time() const; | |
| //- Return patch | |
| const fvPatch& patch() const | |
| { | |
| return patch_; | |
| } | |
| //- Return reference to the base patch field | |
| const Field<Type>& field() const | |
| { | |
| return *this; | |
| } | |
| //- Return dimensioned internal field reference | |
| const DimensionedField<Type, fvMesh>& internalField() const | |
| { | |
| return internalField_; | |
| } | |
| //- Return internal field reference | |
| const Field<Type>& primitiveField() const | |
| { | |
| return internalField_; | |
| } | |
| //- 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 | |
| //- Map the given fvPatchField onto this fvPatchField | |
| virtual void map(const fvPatchField<Type>&, const fieldMapper&); | |
| //- Reset the fvPatchField to the given fvPatchField | |
| // Used for mesh to mesh mapping | |
| virtual void reset(const fvPatchField<Type>&); | |
| // Evaluation functions | |
| //- Return patch-normal gradient | |
| virtual tmp<Field<Type>> snGrad() const; | |
| //- Return patch-normal gradient for coupled-patches | |
| // using the deltaCoeffs provided | |
| virtual tmp<Field<Type>> snGrad | |
| ( | |
| const scalarField& deltaCoeffs | |
| ) const | |
| { | |
| NotImplemented; | |
| return *this; | |
| } | |
| //- Update the coefficients associated with the patch field | |
| // Sets Updated to true | |
| virtual void updateCoeffs(); | |
| //- Return internal field next to patch as patch field | |
| virtual tmp<Field<Type>> patchInternalField() const; | |
| //- Return internal field next to patch as patch field | |
| virtual void patchInternalField(Field<Type>&) const; | |
| //- Initialise return of the patchField on the opposite patch of a | |
| // coupled patch | |
| virtual void initPatchNeighbourField | |
| ( | |
| const Pstream::commsTypes commsType = | |
| Pstream::commsTypes::blocking | |
| ) const | |
| {} | |
| //- Return patchField on the opposite patch of a coupled patch | |
| virtual tmp<Field<Type>> patchNeighbourField | |
| ( | |
| const Pstream::commsTypes commsType = | |
| Pstream::commsTypes::blocking | |
| ) const | |
| { | |
| NotImplemented; | |
| return *this; | |
| } | |
| //- Initialise the evaluation of the patch field | |
| virtual void initEvaluate | |
| ( | |
| const Pstream::commsTypes commsType = | |
| Pstream::commsTypes::blocking | |
| ) | |
| {} | |
| //- Evaluate the patch field, sets Updated to false | |
| virtual void evaluate | |
| ( | |
| const Pstream::commsTypes commsType = | |
| Pstream::commsTypes::blocking | |
| ); | |
| //- Return the matrix diagonal coefficients corresponding to the | |
| // evaluation of the value of this patchField with given weights | |
| virtual tmp<Field<Type>> valueInternalCoeffs | |
| ( | |
| const tmp<Field<scalar>>& | |
| ) const | |
| { | |
| NotImplemented; | |
| return *this; | |
| } | |
| //- Return the matrix source coefficients corresponding to the | |
| // evaluation of the value of this patchField with given weights | |
| virtual tmp<Field<Type>> valueBoundaryCoeffs | |
| ( | |
| const tmp<Field<scalar>>& | |
| ) const | |
| { | |
| NotImplemented; | |
| return *this; | |
| } | |
| //- Return the matrix diagonal coefficients corresponding to the | |
| // evaluation of the gradient of this patchField | |
| virtual tmp<Field<Type>> gradientInternalCoeffs() const | |
| { | |
| NotImplemented; | |
| return *this; | |
| } | |
| //- Return the matrix diagonal coefficients corresponding to the | |
| // evaluation of the gradient of this coupled patchField | |
| // using the deltaCoeffs provided | |
| virtual tmp<Field<Type>> gradientInternalCoeffs | |
| ( | |
| const scalarField& deltaCoeffs | |
| ) const | |
| { | |
| NotImplemented; | |
| return *this; | |
| } | |
| //- Return the matrix source coefficients corresponding to the | |
| // evaluation of the gradient of this patchField | |
| virtual tmp<Field<Type>> gradientBoundaryCoeffs() const | |
| { | |
| NotImplemented; | |
| return *this; | |
| } | |
| //- Return the matrix source coefficients corresponding to the | |
| // evaluation of the gradient of this coupled patchField | |
| // using the deltaCoeffs provided | |
| virtual tmp<Field<Type>> gradientBoundaryCoeffs | |
| ( | |
| const scalarField& deltaCoeffs | |
| ) const | |
| { | |
| NotImplemented; | |
| return *this; | |
| } | |
| //- Manipulate matrix | |
| virtual void manipulateMatrix(fvMatrix<Type>& matrix); | |
| // I-O | |
| //- Write | |
| virtual void write(Ostream&) const; | |
| // Check | |
| //- Check fvPatchField<Type> against given fvPatchField<Type> | |
| void check(const fvPatchField<Type>&) const; | |
| // Member Operators | |
| virtual void operator=(const UList<Type>&); | |
| virtual void operator=(const Field<Type>&); | |
| virtual void operator=(const fvPatchField<Type>&); | |
| //- Virtual assign to an expression | |
| virtual void operator=(const expression::Assignment<Field<Type>>& a); | |
| //- Templated assign to an expression | |
| template<class Expression, class = EnableIfExpressionable<Expression>> | |
| void operator=(const Expression& e); | |
| virtual void operator+=(const fvPatchField<Type>&); | |
| virtual void operator-=(const fvPatchField<Type>&); | |
| virtual void operator*=(const fvPatchField<scalar>&); | |
| virtual void operator/=(const fvPatchField<scalar>&); | |
| virtual void operator+=(const Field<Type>&); | |
| virtual void operator-=(const Field<Type>&); | |
| virtual void operator*=(const Field<scalar>&); | |
| virtual void operator/=(const Field<scalar>&); | |
| virtual void operator=(const Type&); | |
| virtual void operator+=(const Type&); | |
| virtual void operator-=(const Type&); | |
| virtual void operator*=(const scalar); | |
| virtual void operator/=(const scalar); | |
| // Force an assignment irrespective of form of patch | |
| virtual void operator==(const fvPatchField<Type>&); | |
| virtual void operator==(const Field<Type>&); | |
| virtual void operator==(const Type&); | |
| //- Virtual force-assign to an expression | |
| virtual void operator==(const expression::Assignment<Field<Type>>&); | |
| //- Templated force-assign | |
| template<class Expression, class = EnableIfExpressionable<Expression>> | |
| void operator==(const Expression& e); | |
| // Ostream operator | |
| friend Ostream& operator<< <Type>(Ostream&, const fvPatchField<Type>&); | |
| }; | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| } // End namespace Foam | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| // Use with caution | |
| // For non-templated patch fields | |
| // For null-constructable non-templated patch fields | |
| // For non-templated patch fields - use with caution | |
| // For templated patch fields | |
| // For null-constructable templated patch fields | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| // ************************************************************************* // | |