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