Loading...
Searching...
No Matches
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-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::lduCalculatedProcessorField
28
29Group
30 grpGenericBoundaryConditions
31
32Description
33 A lduProcessorField type bypassing coupledFvPatchField
34
35 Used to add updateInterfaceMatrix capabilities to a lduMatrix
36 which is fully uncoupled from the fvMesh.
37
38 Its functionality is purely to init and update the processor interfaces.
39
40SourceFiles
41 lduCalculatedProcessorField.C
42
43\*---------------------------------------------------------------------------*/
44
45#ifndef Foam_lduCalculatedProcessorField_H
46#define Foam_lduCalculatedProcessorField_H
47
50#include "LduInterfaceField.H"
51
52// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54namespace Foam
55{
56
57/*---------------------------------------------------------------------------*\
58 Class lduCalculatedProcessorField Declaration
59\*---------------------------------------------------------------------------*/
60
61template<class Type>
63:
64 public LduInterfaceField<Type>,
66{
67protected:
68
69 // Protected Data
70
71 //- Local reference cast into the interface
73
74
75 // Sending and receiving
76
77 //- Current (non-blocking) send request
78 mutable label sendRequest_;
79
80 //- Current (non-blocking) recv request
81 mutable label recvRequest_;
83 //- Send buffer
84 mutable Field<Type> sendBuf_;
85
86 //- Receive buffer
88
89 //- Scalar send buffer
91
92 //- Scalar recv buffer
94
95
96 // Protected Member Functions
99 (
100 solveScalarField& result,
101 const bool add,
102 const scalarField& coeffs,
103 const solveScalarField& vals
104 ) const;
105
106 //- Receive and send requests have both completed
107 virtual bool all_ready() const;
108
109
110public:
111
112 //- Runtime type information
113 ClassName("lduCalculatedProcessorField");
114
115
116 // Constructors
117
118 //- Construct from ldu interface
120 (
122 );
123
124 //- Copy construct
128 );
129
130
131 //- Destructor
132 virtual ~lduCalculatedProcessorField() = default;
133
134
135 // Member Functions
136
137 // Evaluation
138
139 //- Are all (receive) data available?
140 virtual bool ready() const;
141
142 //- Initialise neighbour matrix update
143 virtual void initInterfaceMatrixUpdate
144 (
145 solveScalarField& result,
146 const bool add,
147 const lduAddressing& lduAddr,
148 const label patchId,
149 const solveScalarField& psiInternal,
150 const scalarField& coeffs,
151 const direction cmpt,
152 const Pstream::commsTypes commsType
153 ) const;
154
155 //- Update result field based on interface functionality
156 virtual void updateInterfaceMatrix
157 (
158 solveScalarField& result,
159 const bool add,
160 const lduAddressing& lduAddr,
161 const label patchId,
162 const solveScalarField& psiInternal,
163 const scalarField& coeffs,
164 const direction cmpt,
165 const Pstream::commsTypes commsType
166 ) const;
167
168 //- Initialise neighbour matrix update
169 virtual void initInterfaceMatrixUpdate
170 (
171 Field<scalar>& result,
172 const bool add,
173 const lduAddressing& lduAddr,
174 const label patchId,
175 const Field<scalar>& psiInternal,
176 const scalarField& coeffs,
177 const Pstream::commsTypes commsType
178 ) const
179 {
181 }
182
183 //- Update result field based on interface functionality
184 virtual void updateInterfaceMatrix
185 (
186 Field<scalar>& result,
187 const bool add,
188 const lduAddressing& lduAddr,
189 const label patchId,
190 const Field<scalar>& psiInternal,
191 const scalarField& coeffs,
192 const Pstream::commsTypes commsType
193 ) const
194 {
197
198
199 // Processor coupled interface functions
200
201 //- Return communicator used for communication
202 virtual label comm() const
203 {
204 return procInterface_.comm();
205 }
206
207 //- Return processor number
208 virtual int myProcNo() const
209 {
210 return procInterface_.myProcNo();
211 }
212
213 //- Return neighbour processor number
214 virtual int neighbProcNo() const
215 {
216 return procInterface_.myProcNo();
217 }
218
219 //- Is the transform required
220 virtual bool doTransform() const
221 {
222 return false;
223 }
224
225 //- Return face transformation tensor
226 virtual const tensorField& forwardT() const
227 {
228 return procInterface_.forwardT();
229 }
230
231 //- Return rank of component for transform
232 virtual int rank() const
234 return pTraits<Type>::rank;
235 }
236};
237
238
239// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240
241} // End namespace Foam
242
243// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244
245#ifdef NoRepository
247#endif
248
249// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250
251#endif
252
253// ************************************************************************* //
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
commsTypes
Communications types.
Definition UPstream.H:81
The class contains the addressing required by the lduMatrix: upper, lower and losort.
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.
lduCalculatedProcessorField(const lduInterface &interface)
Construct from ldu interface.
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.
ClassName("lduCalculatedProcessorField")
Runtime type information.
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.
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 sendRequest_
Current (non-blocking) send request.
virtual ~lduCalculatedProcessorField()=default
Destructor.
void addToInternalField(solveScalarField &result, const bool add, const scalarField &coeffs, const solveScalarField &vals) const
virtual bool ready() const
Are all (receive) data available?
virtual int neighbProcNo() const
Return neighbour processor number.
virtual const tensorField & forwardT() const
Return face transformation tensor.
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 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 and vector-space.
Definition pTraits.H:64
processorLduInterfaceField()=default
Default construct.
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition className.H:74
#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.