lduCalculatedProcessorField.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) 2022 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::lduCalculatedProcessorField
28
29Group
30 grpGenericBoundaryConditions
31
32Description
33 A lduProcessorField type bypassing coupledFvPatchField and holding
34 a reference to the Field<Type>.
35
36 Used to add updateInterfaceMatrix capabilities to a lduMatrix
37 which is fully uncoupled from the fvMesh.
38
39 Its functionality is purely to init and update the processor interfaces.
40
41SourceFiles
42 lduCalculatedProcessorField.C
43
44\*---------------------------------------------------------------------------*/
45
46#ifndef lduCalculatedProcessorField_H
47#define lduCalculatedProcessorField_H
48
51#include "LduInterfaceField.H"
52
53// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54
55namespace Foam
56{
57
58/*---------------------------------------------------------------------------*\
59 Class lduCalculatedProcessorField Declaration
60\*---------------------------------------------------------------------------*/
61
62template<class Type>
64:
65 public LduInterfaceField<Type>,
67{
68protected:
69
70 // Protected Data
71
72 //- Local reference cast into the interface
74
75 //- Local Field
76 const Field<Type>& field_;
77
78 // Sending and receiving
79
80 //- Send buffer
81 mutable Field<Type> sendBuf_;
82
83 //- Receive buffer
85
86 //- Scalar send buffer
88
89 //- Scalar receive buffer
91
92 //- Outstanding request
93 mutable label outstandingSendRequest_;
94
95 //- Outstanding request
96 mutable label outstandingRecvRequest_;
97
98
99 // Protected Member Functions
100
102 (
103 solveScalarField& result,
104 const bool add,
105 const scalarField& coeffs,
106 const solveScalarField& vals
107 ) const;
108
109
110public:
111
112 //- Runtime type information
113 ClassName("lduCalculatedProcessorField");
114
115
116 // Constructors
117
118 //- Construct from patch and internal field
120 (
121 const lduInterface& interface,
122 const Field<Type>&
123 );
124
125 //- Construct as copy
127 (
129 );
130
131
132 //- Destructor
133 virtual ~lduCalculatedProcessorField() = default;
134
135
136 // Member Functions
137
138 // Access
139
140 //- Return communicator used for comms
141 virtual label comm() const
142 {
143 return procInterface_.comm();
144 }
145
146 //- Return processor number
147 virtual int myProcNo() const
148 {
149 return procInterface_.myProcNo();
150 }
151
152 //- Return neighbour processor number
153 virtual int neighbProcNo() const
154 {
155 return procInterface_.myProcNo();
156 }
157
158 //- Is the transform required
159 virtual bool doTransform() const
160 {
161 return false;
162 }
163
164 //- Return face transformation tensor
165 virtual const tensorField& forwardT() const
166 {
167 return procInterface_.forwardT();
168 }
169
170 //- Return rank of component for transform
171 virtual int rank() const
172 {
173 return pTraits<Type>::rank;
174 }
175
176
177 // Evaluation
178
179 //- Is all data available
180 virtual bool ready() const;
181
182 //- Initialise neighbour matrix update
183 virtual void initInterfaceMatrixUpdate
184 (
185 solveScalarField& result,
186 const bool add,
187 const lduAddressing& lduAddr,
188 const label patchId,
189 const solveScalarField& psiInternal,
190 const scalarField& coeffs,
191 const direction cmpt,
192 const Pstream::commsTypes commsType
193 ) const;
194
195 //- Update result field based on interface functionality
196 virtual void updateInterfaceMatrix
197 (
198 solveScalarField& result,
199 const bool add,
200 const lduAddressing& lduAddr,
201 const label patchId,
202 const solveScalarField& psiInternal,
203 const scalarField& coeffs,
204 const direction cmpt,
205 const Pstream::commsTypes commsType
206 ) const;
207
208 //- Initialise neighbour matrix update
209 virtual void initInterfaceMatrixUpdate
210 (
211 Field<scalar>& result,
212 const bool add,
213 const lduAddressing& lduAddr,
214 const label patchId,
215 const Field<scalar>& psiInternal,
216 const scalarField& coeffs,
217 const Pstream::commsTypes commsType
218 ) const
219 {
221 }
222
223 //- Update result field based on interface functionality
224 virtual void updateInterfaceMatrix
225 (
226 Field<scalar>& result,
227 const bool add,
228 const lduAddressing& lduAddr,
229 const label patchId,
230 const Field<scalar>& psiInternal,
231 const scalarField& coeffs,
232 const Pstream::commsTypes commsType
233 ) const
234 {
236 }
237};
238
239
240// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241
242} // End namespace Foam
243
244// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245
246#ifdef NoRepository
248#endif
249
250// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251
252#endif
253
254// ************************************************************************* //
Generic templated field type.
Definition: Field.H:82
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
commsTypes
Types of communications.
Definition: UPstream.H:67
The class contains the addressing required by the lduMatrix: upper, lower and losort.
A lduProcessorField type bypassing coupledFvPatchField and holding a reference to the Field<Type>.
Field< Type > receiveBuf_
Receive buffer.
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 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 initInterfaceMatrixUpdate(Field< scalar > &result, const bool add, const lduAddressing &lduAddr, const label patchId, const Field< scalar > &psiInternal, const scalarField &coeffs, const Pstream::commsTypes commsType) const
Initialise neighbour matrix update.
solveScalarField scalarReceiveBuf_
Scalar receive buffer.
const Field< Type > & field_
Local Field.
ClassName("lduCalculatedProcessorField")
Runtime type information.
solveScalarField scalarSendBuf_
Scalar send buffer.
virtual int myProcNo() const
Return processor number.
virtual label comm() const
Return communicator used for comms.
virtual void updateInterfaceMatrix(Field< scalar > &result, const bool add, const lduAddressing &lduAddr, const label patchId, const Field< scalar > &psiInternal, const scalarField &coeffs, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
label outstandingSendRequest_
Outstanding request.
label outstandingRecvRequest_
Outstanding request.
virtual ~lduCalculatedProcessorField()=default
Destructor.
void addToInternalField(solveScalarField &result, const bool add, const scalarField &coeffs, const solveScalarField &vals) const
virtual bool ready() const
Is all data available.
virtual int neighbProcNo() const
Return neighbour processor number.
virtual const tensorField & forwardT() const
Return face transformation tensor.
const lduInterface & interface() const
Return the interface.
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:58
Concrete implementation of processor interface. Used to temporarily store settings.
virtual int myProcNo() const
Return processor number (rank in communicator)
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.
Definition: pTraits.H:59
Abstract base class for processor coupled interfaces.
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:67
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
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