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 SourceFiles
37  coupledFvPatchField.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef Foam_coupledFvPatchField_H
42 #define Foam_coupledFvPatchField_H
43 
44 #include "LduInterfaceField.H"
45 #include "fvPatchField.H"
46 #include "coupledFvPatch.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class coupledFvPatch Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Type>
59 :
60  public LduInterfaceField<Type>,
61  public fvPatchField<Type>
62 {
63 public:
64 
65  //- Runtime type information
66  TypeName(coupledFvPatch::typeName_());
67 
68 
69  // Constructors
70 
71  //- Construct from patch and internal field
73  (
74  const fvPatch&,
76  );
77 
78  //- Construct from patch and internal field and patch field
80  (
81  const fvPatch&,
83  const Field<Type>&
84  );
85 
86  //- Construct from patch, internal field and dictionary
88  (
89  const fvPatch&,
91  const dictionary&,
93  );
94 
95  //- Compatibility (prefer with readOption)
97  (
98  const fvPatch& p,
100  const dictionary& dict,
101  const bool valueReqd
102  )
103  :
105  (
106  p, iF, dict,
107  (valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
108  )
109  {}
110 
111  //- Construct by mapping the given coupledFvPatchField onto a new patch
113  (
115  const fvPatch&,
117  const fvPatchFieldMapper&
118  );
119 
120  //- Construct as copy
122  (
124  );
125 
126  //- Construct and return a clone
127  virtual tmp<fvPatchField<Type>> clone() const = 0;
128 
129  //- Construct as copy setting internal field reference
131  (
134  );
135 
136  //- Construct and return a clone
138  (
140  ) const = 0;
141 
142 
143  // Member functions
144 
145  // Access
146 
147  //- Return true if this patch field is derived from
148  // coupledFvPatchField<Type>.
149  virtual bool coupled() const
150  {
151  return true;
152  }
153 
154  //- Return neighbour field of internal field
155  virtual tmp<Field<Type>> patchNeighbourField() const = 0;
156 
157 
158  // Evaluation functions
159 
160  //- Return patch-normal gradient
161  virtual tmp<Field<Type>> snGrad
162  (
163  const scalarField& deltaCoeffs
164  ) const;
165 
166  //- Return patch-normal gradient
167  virtual tmp<Field<Type>> snGrad() const
168  {
170  return *this;
171  }
172 
173  //- Initialise the evaluation of the patch field
174  virtual void initEvaluate
175  (
176  const Pstream::commsTypes commsType
177  );
178 
179  //- Evaluate the patch field
180  virtual void evaluate
181  (
182  const Pstream::commsTypes commsType
183  );
184 
185  //- Initialise the evaluation of the patch field after a local
186  // operation
187  virtual void initEvaluateLocal
188  (
189  const Pstream::commsTypes commsType =
191  )
192  {
193  initEvaluate(commsType);
194  }
195 
196  //- Evaluate the patch field after a local operation (e.g. *=)
197  virtual void evaluateLocal
198  (
199  const Pstream::commsTypes commsType =
201  )
202  {
203  evaluate(commsType);
204  }
205 
206  //- Return the matrix diagonal coefficients corresponding to the
207  // evaluation of the value of this patchField with given weights
208  virtual tmp<Field<Type>> valueInternalCoeffs
209  (
210  const tmp<scalarField>&
211  ) const;
212 
213  //- Return the matrix source coefficients corresponding to the
214  // evaluation of the value of this patchField with given weights
215  virtual tmp<Field<Type>> valueBoundaryCoeffs
216  (
217  const tmp<scalarField>&
218  ) const;
220  //- Return the matrix diagonal coefficients corresponding to the
221  // evaluation of the gradient of this patchField
223  (
224  const scalarField& deltaCoeffs
225  ) const;
226 
227  //- Return the matrix diagonal coefficients corresponding to the
228  // evaluation of the gradient of this patchField
229  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
230 
231  //- Return the matrix source coefficients corresponding to the
232  // evaluation of the gradient of this patchField
234  (
235  const scalarField& deltaCoeffs
236  ) const;
237 
238  //- Return the matrix source coefficients corresponding to the
239  // evaluation of the gradient of this patchField
240  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
241 
242 
243  // Coupled interface functionality
244 
245  //- Update result field based on interface functionality
246  virtual void updateInterfaceMatrix
247  (
248  solveScalarField& result,
249  const bool add,
250  const lduAddressing& lduAddr,
251  const label patchId,
252  const solveScalarField& psiInternal,
253  const scalarField& coeffs,
254  const direction,
255  const Pstream::commsTypes commsType
256  ) const = 0;
257 
258  //- Update result field based on interface functionality
259  virtual void updateInterfaceMatrix
260  (
261  Field<Type>&,
262  const bool add,
263  const lduAddressing& lduAddr,
264  const label patchId,
265  const Field<Type>&,
266  const scalarField&,
267  const Pstream::commsTypes commsType
268  ) const = 0;
269 
270 
271  //- Write
272  virtual void write(Ostream&) const;
273 };
274 
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 } // End namespace Foam
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 #ifdef NoRepository
283  #include "coupledFvPatchField.C"
284 #endif
285 
286 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287 
288 #endif
289 
290 // ************************************************************************* //
label patchId(-1)
virtual tmp< fvPatchField< Type > > clone() const =0
Construct and return a clone.
dictionary dict
"blocking" : (MPI_Bsend, MPI_Recv)
uint8_t direction
Definition: direction.H:46
commsTypes
Communications types.
Definition: UPstream.H:72
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 initEvaluateLocal(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Initialise the evaluation of the patch field after a local.
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
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
Return true if this patch field is derived from.
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.
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 evaluateLocal(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field after a local operation (e.g. *=)
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
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...
Definition: areaFieldsFwd.H:42
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
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:686
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Namespace for OpenFOAM.
readOption
Enumeration defining read preferences.