Loading...
Searching...
No Matches
processorFvPatchField.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::processorFvPatchField
29
30Group
31 grpCoupledBoundaryConditions
32
33Description
34 This boundary condition enables processor communication across patches.
35
36Usage
37 Example of the boundary condition specification:
38 \verbatim
39 <patchName>
40 {
41 type processor;
42 }
43 \endverbatim
44
45SourceFiles
46 processorFvPatchField.C
47
48\*---------------------------------------------------------------------------*/
49
50#ifndef Foam_processorFvPatchField_H
51#define Foam_processorFvPatchField_H
52
53#include "coupledFvPatchField.H"
55#include "processorFvPatch.H"
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58
59namespace Foam
60{
61
62/*---------------------------------------------------------------------------*\
63 Class processorFvPatchField Declaration
64\*---------------------------------------------------------------------------*/
65
66template<class Type>
68:
70 public coupledFvPatchField<Type>
71{
72 // Private Data
73
74 //- Local reference cast into the processor patch
75 const processorFvPatch& procPatch_;
76
77
78 // Sending and receiving
79
80 //- Current (non-blocking) send request
81 mutable label sendRequest_;
82
83 //- Current (non-blocking) recv request
84 mutable label recvRequest_;
85
86 //- Send buffer.
87 mutable Field<Type> sendBuf_;
88
89 //- Receive buffer.
90 mutable Field<Type> recvBuf_;
91
92 //- Scalar send buffer
93 mutable solveScalarField scalarSendBuf_;
94
95 //- Scalar recv buffer
96 mutable solveScalarField scalarRecvBuf_;
97
98
99 // Private Member Functions
100
101 //- Receive and send requests have both completed
102 virtual bool all_ready() const;
103
104
105public:
106
107 //- Runtime type information
108 TypeName(processorFvPatch::typeName_());
109
110
111 // Constructors
112
113 //- Construct from patch and internal field
115 (
116 const fvPatch&,
118 );
119
120 //- Construct from patch and internal field and patch field
122 (
123 const fvPatch&,
125 const Field<Type>&
126 );
127
128 //- Construct from patch, internal field and dictionary
130 (
131 const fvPatch&,
133 const dictionary&
134 );
135
136 //- Construct by mapping given processorFvPatchField onto a new patch
138 (
140 const fvPatch&,
142 const fvPatchFieldMapper&
143 );
144
145 //- Construct as copy
147
148 //- Construct as copy setting internal field reference
150 (
153 );
154
155 //- Return a clone
156 virtual tmp<fvPatchField<Type>> clone() const
157 {
158 return fvPatchField<Type>::Clone(*this);
159 }
160
161 //- Clone with an internal field reference
163 (
165 ) const
166 {
167 return fvPatchField<Type>::Clone(*this, iF);
168 }
169
170
171 //- Destructor
172 ~processorFvPatchField() = default;
173
174
175 // Member Functions
176
177 // Coupling
178
179 //- The patch field is coupled if running in parallel
180 virtual bool coupled() const { return UPstream::parRun(); }
181
182 //- Are all (receive) data available?
183 virtual bool ready() const;
184
185 //- Return neighbour field
186 virtual tmp<Field<Type>> patchNeighbourField() const;
187
188 //- Retrieve neighbour field
189 virtual void patchNeighbourField(UList<Type>& pnf) const;
190
192 // Evaluation
193
194 //- Initialise the evaluation of the patch field
195 virtual void initEvaluate(const Pstream::commsTypes commsType);
196
197 //- Evaluate the patch field
198 virtual void evaluate(const Pstream::commsTypes commsType);
199
200 //- Initialise the evaluation of the patch field after a local
201 // operation. Dummy since operating on a copy
202 virtual void initEvaluateLocal
204 const Pstream::commsTypes commsType =
206 )
207 {}
208
209 //- Evaluate the patch field after a local operation (e.g. *=).
210 // Dummy since operating on a copy
211 virtual void evaluateLocal
212 (
213 const Pstream::commsTypes commsType =
215 )
216 {}
217
218 //- Return patch-normal gradient
219 virtual tmp<Field<Type>> snGrad
220 (
221 const scalarField& deltaCoeffs
222 ) const;
223
224 //- Retrieve patch-normal gradient
225 virtual void snGrad
226 (
227 const scalarField& deltaCoeffs,
228 UList<Type>& result
229 ) const;
230
231
232 // Coupled interface functionality
233
234 //- Initialise neighbour matrix update
235 virtual void initInterfaceMatrixUpdate
236 (
237 solveScalarField& result,
238 const bool add,
239 const lduAddressing& lduAddr,
240 const label patchId,
241 const solveScalarField& psiInternal,
242 const scalarField& coeffs,
243 const direction cmpt,
244 const Pstream::commsTypes commsType
245 ) const;
246
247 //- Update result field based on interface functionality
249 (
250 solveScalarField& result,
251 const bool add,
252 const lduAddressing& lduAddr,
253 const label patchId,
254 const solveScalarField& psiInternal,
255 const scalarField& coeffs,
256 const direction cmpt,
257 const Pstream::commsTypes commsType
258 ) const;
259
260 //- Initialise neighbour matrix update
261 virtual void initInterfaceMatrixUpdate
262 (
263 Field<Type>& result,
264 const bool add,
265 const lduAddressing& lduAddr,
266 const label patchId,
267 const Field<Type>& psiInternal,
268 const scalarField& coeffs,
269 const Pstream::commsTypes commsType
270 ) const;
271
272 //- Update result field based on interface functionality
273 virtual void updateInterfaceMatrix
274 (
275 Field<Type>& result,
276 const bool add,
277 const lduAddressing& lduAddr,
278 const label patchId,
279 const Field<Type>& psiInternal,
280 const scalarField& coeffs,
281 const Pstream::commsTypes commsType
282 ) const;
283
284
285 // Processor coupled interface functions
286
287 //- Return communicator used for communication
288 virtual label comm() const
289 {
290 return procPatch_.comm();
291 }
292
293 //- Return processor number
294 virtual int myProcNo() const
295 {
296 return procPatch_.myProcNo();
297 }
298
299 //- Return neighbour processor number
300 virtual int neighbProcNo() const
301 {
302 return procPatch_.neighbProcNo();
303 }
304
305 //- Does the patch field perform the transformation
306 virtual bool doTransform() const
307 {
308 return
309 (
311 && !procPatch_.parallel()
312 );
313 }
314
315 //- Return face transformation tensor
316 virtual const tensorField& forwardT() const
317 {
318 return procPatch_.forwardT();
319 }
320
321 //- Return rank of component for transform
322 virtual int rank() const
323 {
324 return pTraits<Type>::rank;
325 }
326};
327
328
329// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
330
331} // End namespace Foam
332
333// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
334
335#ifdef NoRepository
336 #include "processorFvPatchField.C"
337#endif
338
339// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
340
341#endif
342
343// ************************************************************************* //
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 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
static bool & parRun() noexcept
Test if this a parallel run.
Definition UPstream.H:1681
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
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 FieldMapper for finite-volume patch fields.
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.
A traits class, which is primarily used for primitives and vector-space.
Definition pTraits.H:64
virtual bool doTransform() const
Does the patch field perform the transformation.
virtual void initInterfaceMatrixUpdate(solveScalarField &result, const bool add, const lduAddressing &lduAddr, const label patchId, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Initialise neighbour matrix update.
virtual int rank() const
Return rank of component for transform.
virtual bool coupled() const
The patch field is coupled if running in parallel.
virtual void updateInterfaceMatrix(solveScalarField &result, const bool add, const lduAddressing &lduAddr, const label patchId, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
TypeName(processorFvPatch::typeName_())
Runtime type information.
virtual void initEvaluateLocal(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Initialise the evaluation of the patch field after a local.
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 int myProcNo() const
Return processor number.
processorFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual label comm() const
Return communicator used for communication.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
virtual tmp< fvPatchField< Type > > clone() const
Return a clone.
virtual bool ready() const
Are all (receive) data available?
virtual tmp< Field< Type > > patchNeighbourField() const
Return neighbour field.
virtual int neighbProcNo() const
Return neighbour processor number.
~processorFvPatchField()=default
Destructor.
virtual tmp< fvPatchField< Type > > clone(const DimensionedField< Type, volMesh > &iF) const
Clone with an internal field reference.
virtual const tensorField & forwardT() const
Return face transformation tensor.
virtual int myProcNo() const
Return processor number.
virtual int neighbProcNo() const
Return neighbour processor number.
processorLduInterfaceField()=default
Default construct.
A class for managing temporary objects.
Definition tmp.H:75
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
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
constexpr bool is_rotational_vectorspace_v
The is_rotational_vectorspace value of Type.
Definition pTraits.H:251
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68