48 neighbPointsPtr_.clear();
49 nonGlobalPatchPointsPtr_.clear();
61 const label nbrPolyPatchi,
63 const label neighbProcNo,
69 neighbProcNo_(neighbProcNo),
72 neighbEdgeFaceCentres_(),
73 neighbPointsPtr_(nullptr),
74 nonGlobalPatchPointsPtr_(nullptr)
83 const label nbrPolyPatchi,
85 const label neighbProcNo,
109 const word& patchType
113 myProcNo_(
dict.
get<label>(
"myProcNo")),
114 neighbProcNo_(
dict.
get<label>(
"neighbProcNo")),
115 neighbEdgeCentres_(),
116 neighbEdgeLengths_(),
117 neighbEdgeFaceCentres_(),
118 neighbPointsPtr_(nullptr),
119 nonGlobalPatchPointsPtr_(nullptr)
149 labelList& ngpp = *nonGlobalPatchPointsPtr_;
152 const labelList& sharedPoints = pMeshGlobalData.sharedPointLabels();
157 boundaryMesh().mesh().patch().meshPoints();
159 label nNonShared = 0;
161 forAll(faMeshPatchPoints, pointi)
163 const label mpi = meshPoints[faMeshPatchPoints[pointi]];
164 if (!sharedPoints.found(mpi))
166 ngpp[nNonShared] = pointi;
171 ngpp.resize(nNonShared);
180 if (neighbProcNo() >= pBufs.nProcs())
183 <<
"On patch " <<
name()
184 <<
" trying to access out of range neighbour processor " 185 << neighbProcNo() <<
". This can happen if" <<
nl 186 <<
" trying to run on an incorrect number of processors" 190 UOPstream toNeighbProc(neighbProcNo(), pBufs);
195 << edgeFaceCentres();
205 UIPstream fromNeighbProc(neighbProcNo(), pBufs);
208 >> neighbEdgeCentres_
209 >> neighbEdgeLengths_
210 >> neighbEdgeFaceCentres_;
218 scalar nmagEl =
mag(neighbEdgeLengths_[edgei]);
219 scalar avEl = (magEl[edgei] + nmagEl)/2.0;
221 if (
mag(magEl[edgei] - nmagEl)/avEl > 1
e-6)
225 <<
" length does not match neighbour by " 226 << 100*
mag(magEl[edgei] - nmagEl)/avEl
227 <<
"% -- possible edge ordering problem" <<
nl;
245 PstreamBuffers& pBufs,
269 neighbPointsPtr_.clear();
273 if (neighbProcNo() >= pBufs.
nProcs())
276 <<
"On patch " <<
name()
277 <<
" trying to access out of range neighbour processor " 278 << neighbProcNo() <<
". This can happen if" <<
nl 279 <<
" trying to run on an incorrect number of processors" 288 patchSlice(boundaryMesh().
mesh().edges());
292 for (label patchPointI = 0; patchPointI <
nPoints(); ++patchPointI)
294 label edgeI = ptEdges[patchPointI][0];
296 patchEdge[patchPointI] = edgeI;
298 const edge&
e = patchEdges[edgeI];
300 indexInEdge[patchPointI] =
e.find(
pointLabels()[patchPointI]);
303 UOPstream toNeighbProc(neighbProcNo(), pBufs);
317 neighbPointsPtr_.clear();
328 UIPstream fromNeighbProc(neighbProcNo(), pBufs);
335 if (nbrPatchEdge.size() ==
nPoints())
340 labelList& neighbPoints = *neighbPointsPtr_;
343 patchSlice(boundaryMesh().
mesh().edges());
345 forAll(nbrPatchEdge, nbrPointI)
348 const edge&
e = patchEdges[nbrPatchEdge[nbrPointI]];
350 const label index = 1 - nbrIndexInEdge[nbrPointI];
354 neighbPoints[patchPointI] = nbrPointI;
369 tresult.ref().normalise();
376 if (!neighbPointsPtr_)
384 <<
"No extended addressing calculated for patch " <<
name()
386 <<
"This can happen if the number of points on both" 387 <<
" sides of the two coupled patches differ." <<
nl 388 <<
"This happens if the processorPatch was constructed from" 389 <<
" part of a cyclic patch." 393 return *neighbPointsPtr_;
405 & (neighbEdgeCentres() - neighbEdgeFaceCentres())
408 w = neighbEdgeCentresCn/
411 + neighbEdgeCentresCn + VSMALL
425 dc = (1.0 - weights())
447 - neighbEdgeFaceCentres()
459 - neighbEdgeFaceCentres()
473 if (!nonGlobalPatchPointsPtr_)
475 makeNonGlobalPatchPoints();
478 return *nonGlobalPatchPointsPtr_;
487 return patchInternalField(internalData);
498 patchInternalField(internalData, edgeFaces, tpfld.ref());
509 send(commsType, interfaceData);
519 return receive<label>(commsType, this->size());
529 send(commsType, patchInternalField(iF)());
539 return receive<label>(commsType, this->size());
550 return receive<label>(commsType, this->size());
processorFaPatch(const word &name, const labelUList &edgeLabels, const label index, const faBoundaryMesh &bm, const label nbrPolyPatchi, const label myProcNo, const label neighbProcNo, const word &patchType=typeName)
Construct from components with specified name.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
labelList pointLabels(nPoints, -1)
commsTypes
Communications types.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
const labelList & nonGlobalPatchPoints() const
Return the set of labels of the processor patch points which are.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
constexpr char nl
The newline '\n' character (0x0a)
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
static bool & parRun() noexcept
Test if this a parallel run.
const labelList & neighbPoints() const
Return neighbour point labels. This is for my local point the.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
SubList< edge > subList
Declare type of subList.
virtual label comm() const
Return communicator used for communication.
List< labelList > labelListList
List of labelList.
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
Neighbour processor patch.
#define forAll(list, i)
Loop across all elements in list.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to the interface as a field.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ const Field< vector > edgeCentres(faMeshTools::flattenEdgeField(aMesh.edgeCentres(), true))
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual void write(Ostream &) const
Write.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
tmp< vectorField > neighbEdgeNormals() const
Return processor-neighbour patch edge unit normals.
errorManip< error > abort(error &err)
label find(const T &val) const
Find index of the first occurrence of the value.
void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
void makeDeltaCoeffs(scalarField &) const
Make patch face - neighbour cell distances.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual void write(Ostream &os) const
Write the patch data as a dictionary.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
OBJstream os(runTime.globalPath()/outputName)
void makeNonGlobalPatchPoints() const
Find non-globa patch points.
defineTypeNameAndDebug(combustionModel, 0)
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
#define WarningInFunction
Report a warning using Foam::Warning.
void makeWeights(scalarField &) const
Make patch weighting factors.
coupledFaPatch is an abstract base class for patches that couple regions of the computational domain ...
Finite area boundary mesh.
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Initialise neighbour field transfer.
void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
virtual void initTransfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const
Initialise interface data transfer.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
virtual tmp< labelField > transfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const
Transfer and return neighbour field.
const bMesh & mesh() const
List< label > labelList
A List of labels.
A class for managing temporary objects.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
virtual void movePoints(PstreamBuffers &, const pointField &)
Correct patch after moving points.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
virtual ~processorFaPatch()
Destructor.