mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add GeometricBoundaryField evaluateCoupled method (#2436)
- allows restricted evaluation to specific coupled patch types. Code relocated/refactored from redistributePar. STYLE: ensure use of waitRequests() also corresponds to nonBlocking ENH: additional copy/move construct GeometricField from DimensionedField STYLE: processorPointPatch owner()/neighbour() as per processorPolyPatch STYLE: orientedType with bool cast operator and noexcept
This commit is contained in:
@ -948,84 +948,10 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
|
||||
mesh.objectRegistry::lookupClass<GeoField>()
|
||||
);
|
||||
|
||||
forAllIters(flds, iter)
|
||||
for (const word& fldName : flds.sortedToc())
|
||||
{
|
||||
GeoField& fld = *iter();
|
||||
|
||||
typename GeoField::Boundary& bfld = fld.boundaryFieldRef();
|
||||
if
|
||||
(
|
||||
Pstream::defaultCommsType == Pstream::commsTypes::blocking
|
||||
|| Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
|
||||
)
|
||||
{
|
||||
const label nReq = Pstream::nRequests();
|
||||
|
||||
forAll(bfld, patchi)
|
||||
{
|
||||
auto& pfld = bfld[patchi];
|
||||
const auto& fvp = mesh.boundary()[patchi];
|
||||
|
||||
const auto* ppPtr = isA<CoupledPatchType>(fvp);
|
||||
if (ppPtr && ppPtr->coupled())
|
||||
{
|
||||
pfld.initEvaluate(Pstream::defaultCommsType);
|
||||
}
|
||||
}
|
||||
|
||||
// Block for any outstanding requests
|
||||
if
|
||||
(
|
||||
Pstream::parRun()
|
||||
&& Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
|
||||
)
|
||||
{
|
||||
Pstream::waitRequests(nReq);
|
||||
}
|
||||
|
||||
for (auto& pfld : bfld)
|
||||
{
|
||||
const auto& fvp = pfld.patch();
|
||||
|
||||
const auto* ppPtr = isA<CoupledPatchType>(fvp);
|
||||
if (ppPtr && ppPtr->coupled())
|
||||
{
|
||||
pfld.evaluate(Pstream::defaultCommsType);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
|
||||
{
|
||||
const lduSchedule& patchSchedule =
|
||||
fld.mesh().globalData().patchSchedule();
|
||||
|
||||
for (const auto& schedEval : patchSchedule)
|
||||
{
|
||||
const label patchi = schedEval.patch;
|
||||
const auto& fvp = mesh.boundary()[patchi];
|
||||
auto& pfld = bfld[patchi];
|
||||
|
||||
const auto* ppPtr = isA<CoupledPatchType>(fvp);
|
||||
if (ppPtr && ppPtr->coupled())
|
||||
{
|
||||
if (schedEval.init)
|
||||
{
|
||||
pfld.initEvaluate(Pstream::commsTypes::scheduled);
|
||||
}
|
||||
else
|
||||
{
|
||||
pfld.evaluate(Pstream::commsTypes::scheduled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unsupported communications type "
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
GeoField& fld = *(flds[fldName]);
|
||||
fld.boundaryFieldRef().template evaluateCoupled<CoupledPatchType>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user