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-2023 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 
159  // Evaluation functions
160 
161  //- Return patch-normal gradient
162  virtual tmp<Field<Type>> snGrad
163  (
164  const scalarField& deltaCoeffs
165  ) const;
166 
167  //- Return patch-normal gradient
168  virtual tmp<Field<Type>> snGrad() const
169  {
171  return *this;
172  }
173 
174  //- Initialise the evaluation of the patch field
175  virtual void initEvaluate
176  (
177  const Pstream::commsTypes commsType
178  );
179 
180  //- Evaluate the patch field
181  virtual void evaluate
182  (
183  const Pstream::commsTypes commsType
184  );
185 
186  //- Initialise the evaluation of the patch field after a local
187  // operation
188  virtual void initEvaluateLocal
189  (
190  const Pstream::commsTypes commsType =
192  )
193  {
194  initEvaluate(commsType);
195  }
196 
197  //- Evaluate the patch field after a local operation (e.g. *=)
198  virtual void evaluateLocal
199  (
200  const Pstream::commsTypes commsType =
202  )
203  {
204  evaluate(commsType);
205  }
206 
207  //- Return the matrix diagonal coefficients corresponding to the
208  // evaluation of the value of this patchField with given weights
209  virtual tmp<Field<Type>> valueInternalCoeffs
210  (
211  const tmp<scalarField>&
212  ) const;
213 
214  //- Return the matrix source coefficients corresponding to the
215  // evaluation of the value of this patchField with given weights
216  virtual tmp<Field<Type>> valueBoundaryCoeffs
217  (
218  const tmp<scalarField>&
219  ) const;
220 
221  //- Return the matrix diagonal coefficients corresponding to the
222  // evaluation of the gradient of this patchField
224  (
225  const scalarField& deltaCoeffs
226  ) const;
227 
228  //- Return the matrix diagonal coefficients corresponding to the
229  // evaluation of the gradient of this patchField
230  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
232  //- Return the matrix source coefficients corresponding to the
233  // evaluation of the gradient of this patchField
235  (
236  const scalarField& deltaCoeffs
237  ) const;
238 
239  //- Return the matrix source coefficients corresponding to the
240  // evaluation of the gradient of this patchField
241  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
242 
243 
244  // Coupled interface functionality
245 
246  //- Update result field based on interface functionality
247  virtual void updateInterfaceMatrix
248  (
249  solveScalarField& result,
250  const bool add,
251  const lduAddressing& lduAddr,
252  const label patchId,
253  const solveScalarField& psiInternal,
254  const scalarField& coeffs,
255  const direction,
256  const Pstream::commsTypes commsType
257  ) const = 0;
258 
259  //- Update result field based on interface functionality
260  virtual void updateInterfaceMatrix
261  (
262  Field<Type>&,
263  const bool add,
264  const lduAddressing& lduAddr,
265  const label patchId,
266  const Field<Type>&,
267  const scalarField&,
268  const Pstream::commsTypes commsType
269  ) const = 0;
270 
271 
272  //- Write includes "value" entry
273  virtual void write(Ostream&) const;
274 };
275 
276 
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
278 
279 } // End namespace Foam
280 
281 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 
283 #ifdef NoRepository
284  #include "coupledFvPatchField.C"
285 #endif
286 
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 
289 #endif
290 
291 // ************************************************************************* //
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:62
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
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:696
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Namespace for OpenFOAM.
readOption
Enumeration defining read preferences.