Loading...
Searching...
No Matches
oversetFvPatchField.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2016-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::oversetFvPatchField
28
29Group
30 grpCoupledBoundaryConditions
31
32Description
33 Boundary condition for use on overset patches. To be run in combination
34 with special dynamicFvMesh type that inserts interpolation into the matrix.
35
36SourceFiles
37 oversetFvPatchField.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef Foam_oversetFvPatchField_H
42#define Foam_oversetFvPatchField_H
43
44#include "oversetFvPatch.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53/*---------------------------------------------------------------------------*\
54 Class oversetFvPatchField Declaration
55\*---------------------------------------------------------------------------*/
56
57template<class Type>
59:
61 public coupledFvPatchField<Type>
62{
63protected:
64
65 // Protected Data
66
67 //- Local reference cast into the overset patch
69
70 //- Master patch ID
71 mutable label masterPatchID_;
72
73 // Hole cell controls
74
75 //- Flag to set hole cell values
76 const bool setHoleCellValue_;
78 //- Flag to correct fluxes
79 const bool fluxCorrection_;
80
81 //- Flag to interpolate hole cell values (from nearby non-hole cell)
83
84 //- Hole cell value
85 const Type holeCellValue_;
86
87 //- Fringe upper coefficients
89
90 //- Fringe lower coefficients
93 //- Fringe faces
95
96 //- Zone to sum flux for mass conservation
97 label zoneId_;
98
99
100public:
101
102 //- Runtime type information
103 TypeName(oversetFvPatch::typeName_());
104
105
106 // Constructors
108 //- Construct from patch and internal field
110 (
111 const fvPatch&,
113 );
114
115 //- Construct from patch, internal field and dictionary
117 (
118 const fvPatch&,
121 );
122
123 //- Construct by mapping given oversetFvPatchField onto a new patch
125 (
127 const fvPatch&,
129 const fvPatchFieldMapper&
130 );
131
132 //- Construct as copy
134
135 //- Construct as copy setting internal field reference
137 (
140 );
141
142 //- Return a clone
143 virtual tmp<fvPatchField<Type>> clone() const
144 {
145 return fvPatchField<Type>::Clone(*this);
146 }
147
148 //- Clone with an internal field reference
150 (
152 ) const
153 {
154 return fvPatchField<Type>::Clone(*this, iF);
155 }
156
157
158 // Member Functions
159
160 // Coupled and adjust flux
161
162 //- Return neighbour field. Dummy value
163 virtual tmp<Field<Type>> patchNeighbourField() const
164 {
165 return tmp<Field<Type>>::New(this->size(), Foam::zero{});
166 }
167
168 //- Retrieve neighbour field. Dummy value
169 virtual void patchNeighbourField(UList<Type>& pnf) const
170 {
171 pnf = Foam::zero{};
173
174 //- Adjust psi for mass correction. Requires storeFringeCoefficients
175 // to have been called before
176 void adjustPsi
177 (
179 const lduAddressing& lduAddr,
181 ) const;
182
183 //- Store fringe coefficients and faces
184 void storeFringeCoefficients(const fvMatrix<Type>& matrix);
185
186 //- Calculate patch flux (helper function). Requires
187 // storeFringeCoefficients to have been called before
188 void fringeFlux
189 (
190 const fvMatrix<Type>& m,
192 ) const;
193
194
195 // Evaluation
197 //- Initialise the evaluation of the patch field
198 virtual void initEvaluate(const Pstream::commsTypes commsType);
199
200 //- Return the matrix diagonal coefficients corresponding to the
201 //- evaluation of the value of this patchField with given weights
203 (
205 ) const
206 {
207 return tmp<Field<Type>>::New(this->size(), Foam::zero{});
208 }
209
210 //- Return the matrix source coefficients corresponding to the
211 //- evaluation of the value of this patchField with given weights
213 (
214 const tmp<scalarField>&
215 ) const
216 {
217 return tmp<Field<Type>>::New(this->size(), Foam::zero{});
218 }
219
220 //- Return the matrix diagonal coefficients corresponding to the
221 //- evaluation of the gradient of this patchField
222 tmp<Field<Type>> gradientInternalCoeffs() const
223 {
224 return tmp<Field<Type>>::New(this->size(), Foam::zero{});
225 }
226
227 //- Return the matrix source coefficients corresponding to the
228 //- evaluation of the gradient of this patchField
229 tmp<Field<Type>> gradientBoundaryCoeffs() const
230 {
231 return tmp<Field<Type>>::New(this->size(), Foam::zero{});
232 }
233
234 //- Manipulate matrix
235 virtual void manipulateMatrix(fvMatrix<Type>& matrix);
236
237
238 // Coupled interface functionality
239
240 //- Update result field based on interface functionality
241 virtual void updateInterfaceMatrix
242 (
243 solveScalarField& result,
244 const bool add,
245 const lduAddressing& lduAddr,
246 const label patchId,
247 const solveScalarField& psiInternal,
248 const scalarField& coeffs,
250 const Pstream::commsTypes commsType
251 ) const;
252
253 //- Update result field based on interface functionality
254 virtual void updateInterfaceMatrix
255 (
257 const bool add,
258 const lduAddressing& lduAddr,
259 const label patchId,
260 const Field<Type>&,
262 const Pstream::commsTypes commsType
263 ) const
264 {
266 }
267
268 //- Initialise neighbour matrix update
269 virtual void initInterfaceMatrixUpdate
270 (
272 const bool add,
274 const label interfacei,
275 const Field<Type>&,
276 const scalarField&,
277 const Pstream::commsTypes commsType
278 ) const
279 {
281 }
283 virtual void initInterfaceMatrixUpdate
284 (
285 solveScalarField& result,
286 const bool add,
287 const lduAddressing&,
288 const label interfacei,
289 const solveScalarField& psiInternal,
290 const scalarField& coeffs,
291 const direction cmpt,
292 const Pstream::commsTypes commsType
293 ) const;
294
295
296 // I-O
297
298 //- Write
299 virtual void write(Ostream& os) const;
300};
301
302
303// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
304
305} // End namespace Foam
306
307// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
308
309#ifdef NoRepository
310# include "oversetFvPatchField.C"
311#endif
312
313// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
314
315#endif
316
317// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
UList(const UList< Type > &) noexcept=default
void size(const label n)
Definition UList.H:118
commsTypes
Communications types.
Definition UPstream.H:81
coupledFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition fvMatrix.H:118
A FieldMapper for finite-volume patch fields.
static tmp< fvPatchField< Type > > New(const word &patchFieldType, const fvPatch &, const DimensionedField< Type, volMesh > &)
Return a pointer to a new patchField created on freestore given.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition fvPatch.H:71
The class contains the addressing required by the lduMatrix: upper, lower and losort.
const bool setHoleCellValue_
Flag to set hole cell values.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the evaluation of the value of this patchField...
void storeFringeCoefficients(const fvMatrix< Type > &matrix)
Store fringe coefficients and faces.
virtual tmp< Field< Type > > patchNeighbourField() const
Return neighbour field. Dummy value.
const oversetFvPatch & oversetPatch_
Local reference cast into the overset patch.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the evaluation of the value of this patchFie...
virtual void updateInterfaceMatrix(solveScalarField &result, const bool add, const lduAddressing &lduAddr, const label patchId, const solveScalarField &psiInternal, const scalarField &coeffs, const direction, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
const bool fluxCorrection_
Flag to correct fluxes.
oversetFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
virtual void patchNeighbourField(UList< Type > &pnf) const
Retrieve neighbour field. Dummy value.
scalarField fringeUpperCoeffs_
Fringe upper coefficients.
void adjustPsi(solveScalarField &psi, const lduAddressing &lduAddr, solveScalarField &result) const
Adjust psi for mass correction. Requires storeFringeCoefficients.
label masterPatchID_
Master patch ID.
const Type holeCellValue_
Hole cell value.
void fringeFlux(const fvMatrix< Type > &m, const surfaceScalarField &phi) const
Calculate patch flux (helper function). Requires.
TypeName(oversetFvPatch::typeName_())
Runtime type information.
virtual void manipulateMatrix(fvMatrix< Type > &matrix)
Manipulate matrix.
labelField fringeFaces_
Fringe faces.
tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the evaluation of the gradient of this patchFi...
const bool interpolateHoleCellValue_
Flag to interpolate hole cell values (from nearby non-hole cell).
virtual void initInterfaceMatrixUpdate(Field< Type > &, const bool add, const lduAddressing &, const label interfacei, const Field< Type > &, const scalarField &, const Pstream::commsTypes commsType) const
Initialise neighbour matrix update.
label zoneId_
Zone to sum flux for mass conservation.
virtual tmp< fvPatchField< Type > > clone() const
Return a clone.
tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the evaluation of the gradient of this patch...
virtual void updateInterfaceMatrix(Field< Type > &, const bool add, const lduAddressing &lduAddr, const label patchId, const Field< Type > &, const scalarField &, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
scalarField fringeLowerCoeffs_
Fringe lower coefficients.
virtual tmp< fvPatchField< Type > > clone(const DimensionedField< Type, volMesh > &iF) const
Clone with an internal field reference.
Patch for indicating interpolated boundaries (in overset meshes).
oversetLduInterfaceField()
Construct given coupled patch.
A class for managing temporary objects.
Definition tmp.H:75
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
const volScalarField & psi
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
OBJstream os(runTime.globalPath()/outputName)
label patchId(-1)
Namespace for OpenFOAM.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
Field< solveScalar > solveScalarField
uint8_t direction
Definition direction.H:49
Field< label > labelField
Specialisation of Field<T> for label.
Definition labelField.H:48
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68