68 procInterface_(ptf.procInterface_),
103 <<
"Outstanding request on patch of size "
104 << procInterface_.faceCells().size()
105 <<
" between proc " << procInterface_.myProcNo()
106 <<
" and " << procInterface_.neighbProcNo()
122 <<
"Outstanding request on patch of size "
123 << procInterface_.faceCells().size()
124 <<
" between proc " << procInterface_.myProcNo()
125 <<
" and " << procInterface_.neighbProcNo()
135 const Pstream::commsTypes commsType
138 if (UPstream::parRun())
140 if constexpr (!is_contiguous_v<Type>)
143 <<
"Invalid for non-contiguous data types"
144 << abort(FatalError);
149 Field<Type>& self = *
this;
152 const Field<Type>& psiInternal = this->internalField();
153 const labelUList& faceCells = procInterface_.faceCells();
155 sendBuf_.resize_nocopy(faceCells.size());
156 self.resize_nocopy(faceCells.size());
160 sendBuf_[i] = psiInternal[faceCells[i]];
164 recvRequest_ = UPstream::nRequests();
167 UPstream::commsTypes::nonBlocking,
168 procInterface_.neighbProcNo(),
170 procInterface_.tag(),
171 procInterface_.comm()
174 sendRequest_ = UPstream::nRequests();
177 UPstream::commsTypes::nonBlocking,
178 procInterface_.neighbProcNo(),
180 procInterface_.tag(),
190 const Pstream::commsTypes commsType
193 if (UPstream::parRun())
206 solveScalarField& result,
208 const lduAddressing& lduAddr,
210 const solveScalarField& psiInternal,
211 const scalarField& coeffs,
212 const direction cmpt,
213 const Pstream::commsTypes commsType
216 if (!this->all_ready())
219 <<
"Outstanding request(s) on interface "
221 << abort(FatalError);
228 scalarSendBuf_.resize_nocopy(faceCells.size());
229 scalarRecvBuf_.resize_nocopy(faceCells.size());
233 scalarSendBuf_[i] = psiInternal[faceCells[i]];
237 recvRequest_ = UPstream::nRequests();
240 UPstream::commsTypes::nonBlocking,
241 procInterface_.neighbProcNo(),
243 procInterface_.tag(),
244 procInterface_.comm()
247 sendRequest_ = UPstream::nRequests();
250 UPstream::commsTypes::nonBlocking,
251 procInterface_.neighbProcNo(),
253 procInterface_.tag(),
254 procInterface_.comm()
276 result[
faceCells[elemI]] += coeffs[elemI]*vals[elemI];
292 solveScalarField& result,
294 const lduAddressing& lduAddr,
296 const solveScalarField& psiInternal,
297 const scalarField& coeffs,
298 const direction cmpt,
299 const Pstream::commsTypes commsType
302 if (this->updatedMatrix())
307 if (UPstream::parRun())
311 UPstream::waitRequest(recvRequest_); recvRequest_ = -1;
312 if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1;
318 addToInternalField(result, !
add, coeffs, scalarRecvBuf_);
320 this->updatedMatrix(
true);
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...
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
static std::streamsize read(const UPstream::commsTypes commsType, const int fromProcNo, Type *buffer, std::streamsize count, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm, UPstream::Request *req=nullptr)
Receive buffer contents (contiguous types) from given processor.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void deepCopy(const UList< T > &list)
Copy elements of the given UList. Sizes must match!
static bool write(const UPstream::commsTypes commsType, const int toProcNo, const Type *buffer, std::streamsize count, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm, UPstream::Request *req=nullptr, const UPstream::sendModes sendMode=UPstream::sendModes::normal)
Write buffer contents (contiguous types only) to given processor.
static label nRequests() noexcept
Number of outstanding requests (on the internal list of requests).
commsTypes
Communications types.
@ nonBlocking
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static bool finishedRequestPair(label &req0, label &req1)
Non-blocking comms: have both requests finished? Corresponds to pair of MPI_Test().
static bool finishedRequest(const label i)
Non-blocking comms: has request i finished? Corresponds to MPI_Test().
static void waitRequest(const label i)
Wait until request i has finished. Corresponds to MPI_Wait().
A processorFvPatchField type bypassing fvPatch.
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 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.
Field< Type > sendBuf_
Send buffer.
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 initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
solveScalarField scalarSendBuf_
Scalar send buffer.
virtual bool all_ready() const
Receive and send requests have both completed.
label recvRequest_
Current (non-blocking) recv request.
solveScalarField scalarRecvBuf_
Scalar recv buffer.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
label sendRequest_
Current (non-blocking) send request.
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.
Abstract base class for coupled patches.
coupledFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Smooth ATC in cells next to a set of patches supplied by type.
const DimensionedField< Type, volMesh > & internalField() const noexcept
Return const-reference to the dimensioned internal field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
virtual const labelUList & patchAddr(const label patchNo) const =0
Return patch to internal addressing given patch number.
bool updatedMatrix() const noexcept
Whether matrix has been updated.
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.
A class for managing temporary objects.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
errorManip< error > abort(error &err)
Field< solveScalar > solveScalarField
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr bool is_contiguous_v
The is_contiguous value of Type (after stripping of qualifiers).
UList< label > labelUList
A UList of labels.
dict add("bounds", meshBb)
#define forAll(list, i)
Loop across all elements in list.