Loading...
Searching...
No Matches
calculatedProcessorFvPatchField.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) 2019-2023 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::calculatedProcessorFvPatchField
28
29Group
30 grpGenericBoundaryConditions
31
32Description
33 A processorFvPatchField type bypassing fvPatch
34
35 Used to temporarily add updateInterfaceMatrix capabilities to a matrix
36 during overset solving. Supplies:
37 - patchNeighbourField functionality (cached in *this as per
38 processorFvPatchField)
39 - initEvaluate/evaluate: caching of patchNeighbourField (see above)
40 - initInterfaceMatrixUpdate etc: adding of neighbouring data
41
42SourceFiles
43 calculatedProcessorFvPatchField.C
44
45\*---------------------------------------------------------------------------*/
46
47#ifndef Foam_calculatedProcessorFvPatchField_H
48#define Foam_calculatedProcessorFvPatchField_H
49
51#include "coupledFvPatchField.H"
53
54// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55
56namespace Foam
57{
58
59/*---------------------------------------------------------------------------*\
60 Class calculatedProcessorFvPatchField Declaration
61\*---------------------------------------------------------------------------*/
62
63template<class Type>
65:
67 public coupledFvPatchField<Type>
68{
69protected:
70
71 // Protected Data
72
73 //- Local reference cast into the interface
75
76
77 // Sending and receiving
78
79 //- Current (non-blocking) send request
80 mutable label sendRequest_;
81
82 //- Current (non-blocking) recv request
83 mutable label recvRequest_;
85 //- Send buffer
86 mutable Field<Type> sendBuf_;
87
88 //- Receive buffer
90
91 //- Scalar send buffer
93
94 //- Scalar recv buffer
96
97
98 // Protected Member Functions
101 (
102 solveScalarField& result,
103 const bool add,
104 const scalarField& coeffs,
105 const solveScalarField& vals
106 ) const;
107
108
109 //- Receive and send requests have both completed
110 virtual bool all_ready() const;
111
112
113public:
114
115 //- Runtime type information
116 TypeName("calculatedProcessor");
117
118
119 // Constructors
120
121 //- Construct from patch and internal field
123 (
124 const lduInterface& interface,
125 const fvPatch&,
127 );
128
129 //- Construct as copy
131 (
133 );
134
135 //- Construct as copy setting internal field reference
137 (
140 );
141
142 //- Return a clone
143 virtual tmp<fvPatchField<Type>> clone() const
144 {
145 return fvPatchField<Type>::Clone(*this);
146 }
147
148 //- Clone with an internal field reference
150 (
152 ) const
153 {
154 return fvPatchField<Type>::Clone(*this, iF);
155 }
156
157
158 //- Destructor
159 virtual ~calculatedProcessorFvPatchField() = default;
160
161
162 // Member Functions
163
164 // Coupling
165
166 //- The patch field is coupled if running in parallel
167 virtual bool coupled() const { return UPstream::parRun(); }
168
169 //- Are all (receive) data available?
170 virtual bool ready() const;
171
172 //- Return neighbour field
173 virtual tmp<Field<Type>> patchNeighbourField() const;
174
175 //- Retrieve neighbour field
176 virtual void patchNeighbourField(UList<Type>& result) const;
177
178
179 // Evaluation
180
181 //- Initialise the evaluation of the patch field
182 virtual void initEvaluate(const Pstream::commsTypes commsType);
183
184 //- Evaluate the patch field
185 virtual void evaluate(const Pstream::commsTypes commsType);
186
187
188 // Coupled interface functionality
189
190 //- Initialise neighbour matrix update
191 virtual void initInterfaceMatrixUpdate
192 (
193 solveScalarField& result,
194 const bool add,
195 const lduAddressing& lduAddr,
196 const label patchId,
197 const solveScalarField& psiInternal,
198 const scalarField& coeffs,
199 const direction cmpt,
200 const Pstream::commsTypes commsType
201 ) const;
202
203 //- Update result field based on interface functionality
204 virtual void updateInterfaceMatrix
205 (
206 solveScalarField& result,
207 const bool add,
208 const lduAddressing& lduAddr,
209 const label patchId,
210 const solveScalarField& psiInternal,
211 const scalarField& coeffs,
212 const direction cmpt,
213 const Pstream::commsTypes commsType
214 ) const;
215
216 //- Initialise neighbour matrix update
217 virtual void initInterfaceMatrixUpdate
218 (
219 Field<Type>& result,
220 const bool add,
221 const lduAddressing& lduAddr,
222 const label patchId,
223 const Field<Type>& psiInternal,
224 const scalarField& coeffs,
225 const Pstream::commsTypes commsType
226 ) const
227 {
229 }
230
231 //- Update result field based on interface functionality
232 virtual void updateInterfaceMatrix
233 (
234 Field<Type>& result,
235 const bool add,
236 const lduAddressing& lduAddr,
237 const label patchId,
238 const Field<Type>& psiInternal,
239 const scalarField& coeffs,
240 const Pstream::commsTypes commsType
241 ) const
242 {
244 }
245
246
247 // Processor coupled interface functions
248
249 //- Return communicator used for communication
250 virtual label comm() const
251 {
252 return procInterface_.comm();
253 }
254
255 //- Return processor number
256 virtual int myProcNo() const
257 {
258 return procInterface_.myProcNo();
259 }
261 //- Return neighbour processor number
262 virtual int neighbProcNo() const
263 {
264 return procInterface_.myProcNo();
265 }
266
267 //- Is the transform required
268 virtual bool doTransform() const
269 {
270 return false;
271 }
272
273 //- Return face transformation tensor
274 virtual const tensorField& forwardT() const
275 {
276 return procInterface_.forwardT();
278
279 //- Return rank of component for transform
280 virtual int rank() const
281 {
282 return pTraits<Type>::rank;
283 }
284};
285
286
287// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288
289} // End namespace Foam
290
291// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
292
293#ifdef NoRepository
295#endif
296
297// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
298
299#endif
300
301// ************************************************************************* //
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
static bool & parRun() noexcept
Test if this a parallel run.
Definition UPstream.H:1681
calculatedProcessorFvPatchField(const lduInterface &interface, const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
const lduPrimitiveProcessorInterface & procInterface_
Local reference cast into the interface.
virtual bool doTransform() const
Is the transform required.
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 void initInterfaceMatrixUpdate(Field< Type > &result, const bool add, const lduAddressing &lduAddr, const label patchId, const Field< Type > &psiInternal, const scalarField &coeffs, const Pstream::commsTypes commsType) const
Initialise neighbour matrix update.
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.
virtual void updateInterfaceMatrix(Field< Type > &result, const bool add, const lduAddressing &lduAddr, const label patchId, const Field< Type > &psiInternal, const scalarField &coeffs, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
virtual ~calculatedProcessorFvPatchField()=default
Destructor.
solveScalarField scalarSendBuf_
Scalar send buffer.
virtual int myProcNo() const
Return processor number.
virtual bool all_ready() const
Receive and send requests have both completed.
virtual label comm() const
Return communicator used for communication.
label recvRequest_
Current (non-blocking) recv request.
solveScalarField scalarRecvBuf_
Scalar recv buffer.
TypeName("calculatedProcessor")
Runtime type information.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
label sendRequest_
Current (non-blocking) send request.
virtual tmp< fvPatchField< Type > > clone() const
Return a clone.
void addToInternalField(solveScalarField &result, const bool add, const scalarField &coeffs, const solveScalarField &vals) const
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.
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.
coupledFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
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.
const lduInterface & interface() const noexcept
Return the interface.
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Concrete implementation of processor interface. Used to temporarily store settings.
virtual label comm() const
Return communicator used for sending.
virtual const tensorField & forwardT() const
Return face transformation tensor.
A traits class, which is primarily used for primitives and vector-space.
Definition pTraits.H:64
processorLduInterfaceField()=default
Default construct.
A class for managing temporary objects.
Definition tmp.H:75
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
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.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68