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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::coupledFvPatchField
29 
30 Group
31  grpCoupledBoundaryConditions
32 
33 Description
34  Abstract base class for coupled patches.
35 
36  The "value" entry is usually MUST_READ and always WRITE.
37 
38 SourceFiles
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 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class coupledFvPatch Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class Type>
61 :
62  public LduInterfaceField<Type>,
63  public fvPatchField<Type>
64 {
65 public:
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  }
154 
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;
175  }
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  )
196  {
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;
223 
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
233  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
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
244  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
245 
246 
247  // Coupled interface functionality
248 
249  //- Update result field based on interface functionality
250  virtual void updateInterfaceMatrix
251  (
252  solveScalarField& result,
253  const bool add,
254  const lduAddressing& lduAddr,
255  const label patchId,
256  const solveScalarField& psiInternal,
257  const scalarField& coeffs,
258  const direction,
259  const Pstream::commsTypes commsType
260  ) const = 0;
261 
262  //- Update result field based on interface functionality
263  virtual void updateInterfaceMatrix
264  (
265  Field<Type>&,
266  const bool add,
267  const lduAddressing& lduAddr,
268  const label patchId,
269  const Field<Type>&,
270  const scalarField&,
271  const Pstream::commsTypes commsType
272  ) const = 0;
273 
274 
275  //- Write includes "value" entry
276  virtual void write(Ostream&) const;
277 };
278 
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 } // End namespace Foam
283 
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 
286 #ifdef NoRepository
287  #include "coupledFvPatchField.C"
288 #endif
289 
290 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
291 
292 #endif
293 
294 // ************************************************************************* //
label patchId(-1)
virtual tmp< fvPatchField< Type > > clone() const =0
Return a clone.
dictionary dict
uint8_t direction
Definition: direction.H:46
commsTypes
Communications types.
Definition: UPstream.H:77
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
virtual void initEvaluateLocal(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Initialise the evaluation of the patch field after a local.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
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.
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual bool coupled() const
True if this patch field is derived from coupledFvPatchField.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual void write(Ostream &) const
Write includes "value" entry.
Generic templated field type.
Definition: Field.H:63
A FieldMapper for finite-volume patch fields.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
virtual void evaluateLocal(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field after a local operation (e.g. *=)
virtual tmp< Field< Type > > patchNeighbourField() const =0
Return neighbour field of internal field.
Abstract base class for coupled patches.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
TypeName(coupledFvPatch::typeName_())
Runtime type information.
coupledFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
The class contains the addressing required by the lduMatrix: upper, lower and losort.
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50
"buffered" : (MPI_Bsend, MPI_Recv)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:688
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Namespace for OpenFOAM.
readOption
Enumeration defining read preferences.