Loading...
Searching...
No Matches
coupledFvPatchField.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2019-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::coupledFvPatchField
29
30Group
31 grpCoupledBoundaryConditions
32
33Description
34 Abstract base class for coupled patches.
35
36 The "value" entry is usually MUST_READ and always WRITE.
37
38SourceFiles
39 coupledFvPatchField.C
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef Foam_coupledFvPatchField_H
44#define Foam_coupledFvPatchField_H
45
46#include "LduInterfaceField.H"
47#include "fvPatchField.H"
48#include "coupledFvPatch.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55/*---------------------------------------------------------------------------*\
56 Class coupledFvPatch Declaration
57\*---------------------------------------------------------------------------*/
58
59template<class Type>
61:
62 public LduInterfaceField<Type>,
63 public fvPatchField<Type>
64{
65public:
66
67 //- Runtime type information
68 TypeName(coupledFvPatch::typeName_());
69
70
71 // Constructors
72
73 //- Construct from patch and internal field
75 (
76 const fvPatch&,
78 );
79
80 //- Construct from patch and internal field and patch field
82 (
83 const fvPatch&,
85 const Field<Type>&
86 );
87
88 //- Construct from patch, internal field and dictionary
90 (
91 const fvPatch&,
93 const dictionary&,
95 );
96
97 //- Compatibility (prefer with readOption)
99 (
100 const fvPatch& p,
102 const dictionary& dict,
103 const bool needValue
104 )
105 :
107 (
108 p, iF, dict,
109 (needValue? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
110 )
111 {}
112
113 //- Construct by mapping the given coupledFvPatchField onto a new patch
115 (
117 const fvPatch&,
119 const fvPatchFieldMapper&
120 );
121
122 //- Construct as copy
124 (
126 );
127
128 //- Construct as copy setting internal field reference
130 (
133 );
134
135 //- Return a clone
136 virtual tmp<fvPatchField<Type>> clone() const = 0;
137
138 //- Construct and return a clone
140 (
142 ) const = 0;
143
144
145 // Member Functions
146
147 // Access
148
149 //- True if this patch field is derived from coupledFvPatchField.
150 virtual bool coupled() const
151 {
152 return true;
153 }
155 //- Return neighbour field of internal field
156 virtual tmp<Field<Type>> patchNeighbourField() const = 0;
157
158 //- Retrieve neighbour coupled data
159 virtual void patchNeighbourField(UList<Type>&) const = 0;
160
161
162 // Evaluation Functions
163
164 //- Return patch-normal gradient
165 virtual tmp<Field<Type>> snGrad
166 (
167 const scalarField& deltaCoeffs
168 ) const;
169
170 //- Return patch-normal gradient
171 virtual tmp<Field<Type>> snGrad() const
172 {
174 return *this;
176
177 //- Initialise the evaluation of the patch field
178 virtual void initEvaluate
179 (
180 const Pstream::commsTypes commsType
181 );
182
183 //- Evaluate the patch field
184 virtual void evaluate
185 (
186 const Pstream::commsTypes commsType
187 );
188
189 //- Initialise the evaluation of the patch field after a local
190 // operation
191 virtual void initEvaluateLocal
192 (
193 const Pstream::commsTypes commsType =
195 )
197 initEvaluate(commsType);
198 }
199
200 //- Evaluate the patch field after a local operation (e.g. *=)
201 virtual void evaluateLocal
202 (
203 const Pstream::commsTypes commsType =
205 )
206 {
207 evaluate(commsType);
208 }
209
210 //- Return the matrix diagonal coefficients corresponding to the
211 //- evaluation of the value of this patchField with given weights
212 virtual tmp<Field<Type>> valueInternalCoeffs
213 (
214 const tmp<scalarField>&
215 ) const;
216
217 //- Return the matrix source coefficients corresponding to the
218 //- evaluation of the value of this patchField with given weights
219 virtual tmp<Field<Type>> valueBoundaryCoeffs
220 (
221 const tmp<scalarField>&
222 ) const;
224 //- Return the matrix diagonal coefficients corresponding to the
225 //- evaluation of the gradient of this patchField
227 (
228 const scalarField& deltaCoeffs
229 ) const;
230
231 //- Return the matrix diagonal coefficients corresponding to the
232 //- evaluation of the gradient of this patchField
234
235 //- Return the matrix source coefficients corresponding to the
236 //- evaluation of the gradient of this patchField
238 (
239 const scalarField& deltaCoeffs
240 ) const;
241
242 //- Return the matrix source coefficients corresponding to the
243 // evaluation of the gradient of this patchField
245
246
247 // Contiguous storage
248
249 //- Retrieve patch-normal gradient.
250 //- Assumes faceCells is an indirection into internal field
251 virtual void snGrad
252 (
253 const scalarField& deltaCoeffs,
255 ) const;
256
257 //- Retrieve patch-normal gradient
258 virtual void snGrad(UList<Type>&) const
259 {
261 }
262
263 //- Return the matrix diagonal coefficients corresponding to the
264 // evaluation of the value of this patchField with given weights
265 virtual void valueInternalCoeffs
266 (
267 const tmp<scalarField>&,
269 ) const;
270
271 //- Return the matrix source coefficients corresponding to the
272 // evaluation of the value of this patchField with given weights
273 virtual void valueBoundaryCoeffs
274 (
275 const tmp<scalarField>&,
277 ) const;
278
279 //- Return the matrix diagonal coefficients corresponding to the
280 // evaluation of the gradient of this patchField
281 virtual void gradientInternalCoeffs(UList<Type>&) const;
282
283 //- Return the matrix diagonal coefficients corresponding to the
284 // evaluation of the gradient of this coupled patchField
285 // using the deltaCoeffs provided
286 virtual void gradientInternalCoeffs
287 (
288 const scalarField& deltaCoeffs,
290 ) const;
291
292 //- Return the matrix source coefficients corresponding to the
293 // evaluation of the gradient of this patchField
294 virtual void gradientBoundaryCoeffs(UList<Type>&) const;
295
296 //- Return the matrix source coefficients corresponding to the
297 // evaluation of the gradient of this coupled patchField
298 // using the deltaCoeffs provided
299 virtual void gradientBoundaryCoeffs
300 (
301 const scalarField& deltaCoeffs,
303 ) const;
304
305
306 // Coupled interface functionality
307
308 //- Update result field based on interface functionality
310 (
311 solveScalarField& result,
312 const bool add,
313 const lduAddressing& lduAddr,
314 const label patchId,
315 const solveScalarField& psiInternal,
316 const scalarField& coeffs,
317 const direction,
318 const Pstream::commsTypes commsType
319 ) const = 0;
320
321 //- Update result field based on interface functionality
322 virtual void updateInterfaceMatrix
323 (
325 const bool add,
326 const lduAddressing& lduAddr,
327 const label patchId,
328 const Field<Type>&,
329 const scalarField&,
330 const Pstream::commsTypes commsType
331 ) const = 0;
332
333
334 //- Write includes "value" entry
335 virtual void write(Ostream&) const;
336};
337
338
339// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
340
341} // End namespace Foam
342
343// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
344
345#ifdef NoRepository
346 #include "coupledFvPatchField.C"
347#endif
348
349// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
350
351#endif
352
353// ************************************************************************* //
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
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
readOption
Enumeration defining read preferences.
@ MUST_READ
Reading required.
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
commsTypes
Communications types.
Definition UPstream.H:81
@ buffered
"buffered" : (MPI_Bsend, MPI_Recv)
Definition UPstream.H:82
Abstract base class for coupled patches.
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 =0
Update result field based on interface functionality.
virtual void updateInterfaceMatrix(Field< Type > &, const bool add, const lduAddressing &lduAddr, const label patchId, const Field< Type > &, const scalarField &, const Pstream::commsTypes commsType) const =0
Update result field based on interface functionality.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the evaluation of the gradient of this patch...
virtual bool coupled() const
True if this patch field is derived from coupledFvPatchField.
coupledFvPatchField(const fvPatch &p, const DimensionedField< Type, volMesh > &iF, const dictionary &dict, const bool needValue)
Compatibility (prefer with readOption).
TypeName(coupledFvPatch::typeName_())
Runtime type information.
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 initEvaluateLocal(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Initialise the evaluation of the patch field after a local.
virtual tmp< fvPatchField< Type > > clone(const DimensionedField< Type, volMesh > &) const =0
Construct and return a clone.
virtual void evaluateLocal(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field after a local operation (e.g. *=).
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
coupledFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the evaluation of the value of this patchField...
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
virtual void snGrad(UList< Type > &) const
Retrieve patch-normal gradient.
virtual tmp< fvPatchField< Type > > clone() const =0
Return a clone.
virtual tmp< Field< Type > > patchNeighbourField() const =0
Return neighbour field of internal field.
virtual void patchNeighbourField(UList< Type > &) const =0
Retrieve neighbour coupled data.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A FieldMapper for finite-volume patch fields.
fvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
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.
A class for managing temporary objects.
Definition tmp.H:75
volScalarField & p
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
label patchId(-1)
Namespace for OpenFOAM.
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
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68