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 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 processorFaPatchField_H
42#define 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
70public:
71
72 //- Runtime type information
73 TypeName(processorFaPatch::typeName_());
74
75
76 // Constructors
77
78 //- Construct from patch and internal field
80 (
81 const faPatch&,
83 );
84
85 //- Construct from patch and internal field and patch field
87 (
88 const faPatch&,
90 const Field<Type>&
91 );
92
93 //- Construct from patch, internal field and dictionary
95 (
96 const faPatch&,
98 const dictionary&
99 );
100
101 //- Construct by mapping given processorFaPatchField onto a new patch
103 (
105 const faPatch&,
107 const faPatchFieldMapper&
108 );
109
110 //- Construct as copy
112
113 //- Construct and return a clone
114 virtual tmp<faPatchField<Type>> clone() const
115 {
117 (
119 );
120 }
121
122 //- Construct as copy setting internal field reference
124 (
127 );
128
129 //- Construct and return a clone setting internal field reference
131 (
133 ) const
134 {
136 (
137 new processorFaPatchField<Type>(*this, iF)
138 );
139 }
140
141
142 // Destructor
143
145
146
147 // Member functions
148
149 // Access
150
151 //- Return true if running parallel
152 virtual bool coupled() const
153 {
154 return Pstream::parRun();
155 }
156
157 //- Return neighbour field given internal field
159
160
161 // Evaluation functions
162
163 //- Initialise the evaluation of the patch field
164 virtual void initEvaluate(const Pstream::commsTypes commsType);
165
166 //- Evaluate the patch field
167 virtual void evaluate(const Pstream::commsTypes commsType);
168
169 //- Return patch-normal gradient
170 virtual tmp<Field<Type>> snGrad() const;
171
172 // Coupled interface functionality
173
174 //- Transform neighbour field
175 virtual void transformCoupleField
176 (
178 const direction cmpt
179 ) const
180 {
182 }
183
184 //- Initialise neighbour matrix update
185 virtual void initInterfaceMatrixUpdate
186 (
187 solveScalarField& result,
188 const bool add,
189 const lduAddressing& lduAddr,
190 const label patchId,
191 const solveScalarField& psiInternal,
192 const scalarField& coeffs,
193 const direction cmpt,
194 const Pstream::commsTypes commsType
195 ) const;
196
197 //- Update result field based on interface functionality
198 virtual void updateInterfaceMatrix
199 (
200 solveScalarField& result,
201 const bool add,
202 const lduAddressing& lduAddr,
203 const label patchId,
204 const solveScalarField& psiInternal,
205 const scalarField& coeffs,
206 const direction cmpt,
207 const Pstream::commsTypes commsType
208 ) const;
209
210 //- Initialise neighbour matrix update
211 virtual void initInterfaceMatrixUpdate
212 (
213 Field<Type>& result,
214 const bool add,
215 const lduAddressing& lduAddr,
216 const label patchId,
217 const Field<Type>&,
218 const scalarField& coeffs,
219 const Pstream::commsTypes commsType
220 ) const;
221
222 //- Update result field based on interface functionality
223 virtual void updateInterfaceMatrix
224 (
225 Field<Type>& result,
226 const bool add,
227 const lduAddressing& lduAddr,
228 const label patchId,
229 const Field<Type>&,
230 const scalarField& coeffs,
231 const Pstream::commsTypes commsType
232 ) const;
233
234 //- Processor coupled interface functions
235
236 //- Return communicator used for comms
237 virtual label comm() const
238 {
239 return UPstream::worldComm;
240 }
241
242 //- Return processor number
243 virtual int myProcNo() const
244 {
245 return procPatch_.myProcNo();
246 }
247
248 //- Return neighbour processor number
249 virtual int neighbProcNo() const
250 {
251 return procPatch_.neighbProcNo();
252 }
253
254 //- Does the patch field perform the transformation
255 virtual bool doTransform() const
256 {
257 return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
258 }
259
260 //- Return face transformation tensor
261 virtual const tensorField& forwardT() const
262 {
263 return procPatch_.forwardT();
264 }
265
266 //- Return rank of component for transform
267 virtual int rank() const
268 {
269 return pTraits<Type>::rank;
270 }
271};
272
273
274// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275
276} // End namespace Foam
277
278// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
279
280#ifdef NoRepository
281 #include "processorFaPatchField.C"
282#endif
283
284// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285
286#endif
287
288// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type.
Definition: Field.H:82
commsTypes
Types of communications.
Definition: UPstream.H:67
static label worldComm
Default communicator (all processors)
Definition: UPstream.H:293
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
bool parallel() const
Are the cyclic planes parallel.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A FieldMapper for finite-area patch fields.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:78
The class contains the addressing required by the lduMatrix: upper, lower and losort.
A traits class, which is primarily used for primitives.
Definition: pTraits.H:59
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
virtual tmp< faPatchField< Type > > clone() const
Construct and return a 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
Return true if running 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 tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
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
Processor coupled interface functions.
virtual void transformCoupleField(solveScalarField &f, const direction cmpt) const
Transform neighbour field.
virtual tmp< faPatchField< Type > > clone(const DimensionedField< Type, areaMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
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.
virtual const tensorField & forwardT() const
Return face transformation tensor.
Abstract base class for processor coupled interfaces.
void transformCoupleField(Field< Type > &f) const
Transform given patch field.
A class for managing temporary objects.
Definition: tmp.H:65
label patchId(-1)
Namespace for OpenFOAM.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
uint8_t direction
Definition: direction.H:56
labelList f(nPoints)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73