Loading...
Searching...
No Matches
processorFaPatchField.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) 2016-2017 Wikki Ltd
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::processorFaPatchField
29
30Description
31
32Author
33 Zeljko Tukovic, FMENA
34 Hrvoje Jasak, Wikki Ltd.
35
36SourceFiles
37 processorFaPatchField.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef Foam_processorFaPatchField_H
42#define Foam_processorFaPatchField_H
43
44#include "coupledFaPatchField.H"
46#include "processorFaPatch.H"
47#include "areaFaMesh.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54/*---------------------------------------------------------------------------*\
55 Class processorFaPatchField Declaration
56\*---------------------------------------------------------------------------*/
57
58template<class Type>
60:
62 public coupledFaPatchField<Type>
63{
64 // Private Data
65
66 //- Local reference cast into the processor patch
67 const processorFaPatch& procPatch_;
68
69
70 // Sending and receiving
71
72 //- Current (non-blocking) send request
73 mutable label sendRequest_;
74
75 //- Current (non-blocking) recv request
76 mutable label recvRequest_;
77
78 //- Send buffer.
79 mutable Field<Type> sendBuf_;
80
81 //- Receive buffer.
82 mutable Field<Type> recvBuf_;
83
84 //- Scalar send buffer
85 mutable solveScalarField scalarSendBuf_;
86
87 //- Scalar recv buffer
88 mutable solveScalarField scalarRecvBuf_;
89
90
91 // Private Member Functions
92
93 //- Receive and send requests have both completed
94 virtual bool all_ready() const;
95
96
97public:
98
99 //- Runtime type information
100 TypeName(processorFaPatch::typeName_());
101
102
103 // Constructors
104
105 //- Construct from patch and internal field
107 (
108 const faPatch&,
110 );
111
112 //- Construct from patch and internal field and patch field
114 (
115 const faPatch&,
117 const Field<Type>&
118 );
119
120 //- Construct from patch, internal field and dictionary
122 (
123 const faPatch&,
125 const dictionary&
126 );
127
128 //- Construct by mapping given processorFaPatchField onto a new patch
130 (
132 const faPatch&,
134 const faPatchFieldMapper&
135 );
136
137 //- Construct as copy
139
140 //- Construct as copy setting internal field reference
142 (
145 );
146
147 //- Return clone
148 virtual tmp<faPatchField<Type>> clone() const
149 {
150 return faPatchField<Type>::Clone(*this);
151 }
152
153 //- Clone with an internal field reference
155 (
157 ) const
158 {
159 return faPatchField<Type>::Clone(*this, iF);
160 }
161
162
163 //- Destructor
164 ~processorFaPatchField() = default;
165
166
167 // Member Functions
168
169 // Coupling
170
171 //- The patch field is coupled if running in parallel
172 virtual bool coupled() const { return UPstream::parRun(); }
173
174 //- Are all (receive) data available?
175 virtual bool ready() const;
176
177 //- Return neighbour field given internal field
178 virtual tmp<Field<Type>> patchNeighbourField() const;
179
180 //- Retrieve neighbour field
181 virtual void patchNeighbourField(UList<Type>& pnf) const;
182
184 // Evaluation
185
186 //- Initialise the evaluation of the patch field
187 virtual void initEvaluate(const Pstream::commsTypes commsType);
188
189 //- Evaluate the patch field
190 virtual void evaluate(const Pstream::commsTypes commsType);
191
192 //- Initialise the evaluation of the patch field after a local
193 // operation. Dummy since operating on a copy
194 virtual void initEvaluateLocal
196 const Pstream::commsTypes commsType =
198 )
199 {}
200
201 //- Evaluate the patch field after a local operation (e.g. *=).
202 // Dummy since operating on a copy
203 virtual void evaluateLocal
204 (
205 const Pstream::commsTypes commsType =
207 )
208 {}
209
210 //- Return patch-normal gradient
211 virtual tmp<Field<Type>> snGrad() const;
212
213 //- Retrieve patch-normal gradient
214 virtual void snGrad(UList<Type>& result) const;
215
216
217 // Coupled interface functionality
218
219 //- Initialise neighbour matrix update
220 virtual void initInterfaceMatrixUpdate
221 (
222 solveScalarField& result,
223 const bool add,
224 const lduAddressing& lduAddr,
225 const label patchId,
226 const solveScalarField& psiInternal,
227 const scalarField& coeffs,
228 const direction cmpt,
229 const Pstream::commsTypes commsType
230 ) const;
231
232 //- Update result field based on interface functionality
233 virtual void updateInterfaceMatrix
234 (
235 solveScalarField& result,
236 const bool add,
237 const lduAddressing& lduAddr,
238 const label patchId,
239 const solveScalarField& psiInternal,
240 const scalarField& coeffs,
241 const direction cmpt,
242 const Pstream::commsTypes commsType
243 ) const;
244
245 //- Initialise neighbour matrix update
246 virtual void initInterfaceMatrixUpdate
247 (
248 Field<Type>& result,
249 const bool add,
250 const lduAddressing& lduAddr,
251 const label patchId,
253 const scalarField& coeffs,
254 const Pstream::commsTypes commsType
255 ) const;
256
257 //- Update result field based on interface functionality
258 virtual void updateInterfaceMatrix
259 (
260 Field<Type>& result,
261 const bool add,
262 const lduAddressing& lduAddr,
263 const label patchId,
264 const Field<Type>&,
265 const scalarField& coeffs,
266 const Pstream::commsTypes commsType
267 ) const;
268
269
270 // Processor coupled interface functions
271
272 //- Return communicator used for communication
273 virtual label comm() const
274 {
275 return procPatch_.comm();
276 }
277
278 //- Return processor number
279 virtual int myProcNo() const
280 {
281 return procPatch_.myProcNo();
282 }
283
284 //- Return neighbour processor number
285 virtual int neighbProcNo() const
286 {
287 return procPatch_.neighbProcNo();
288 }
289
290 //- Does the patch field perform the transformation
291 virtual bool doTransform() const
292 {
293 return
294 (
296 && !procPatch_.parallel()
297 );
298 }
299
300 //- Return face transformation tensor
301 virtual const tensorField& forwardT() const
302 {
303 return procPatch_.forwardT();
304 }
305
306 //- Return rank of component for transform
307 virtual int rank() const
308 {
309 return pTraits<Type>::rank;
310 }
311};
312
313
314// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
315
316} // End namespace Foam
317
318// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
319
320#ifdef NoRepository
321 #include "processorFaPatchField.C"
322#endif
323
324// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
325
326#endif
327
328// ************************************************************************* //
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
coupledFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
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-area patch fields.
static tmp< faPatchField< Type > > Clone(const DerivedPatchField &pf)
Clone a patch field with its own internal field reference.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition faPatch.H:76
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 tmp< faPatchField< Type > > clone() const
Return clone.
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.
~processorFaPatchField()=default
Destructor.
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.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
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.
TypeName(processorFaPatch::typeName_())
Runtime type information.
virtual label comm() const
Return communicator used for communication.
processorFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
virtual tmp< faPatchField< Type > > clone(const DimensionedField< Type, areaMesh > &iF) const
Clone with an internal field reference.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
virtual bool ready() const
Are all (receive) data available?
virtual tmp< Field< Type > > patchNeighbourField() const
Return neighbour field given internal field.
virtual int neighbProcNo() const
Return neighbour processor number.
virtual const tensorField & forwardT() const
Return face transformation tensor.
int neighbProcNo() const noexcept
Return neighbour processor number.
int myProcNo() const noexcept
Return 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