49 neighbPointsPtr_.clear();
50 nonGlobalPatchPointsPtr_.clear();
62 const label nbrPolyPatchi,
64 const label neighbProcNo,
70 neighbProcNo_(neighbProcNo),
73 neighbEdgeFaceCentres_(),
74 neighbPointsPtr_(nullptr),
75 nonGlobalPatchPointsPtr_(nullptr)
84 const label nbrPolyPatchi,
86 const label neighbProcNo,
110 const word& patchType
114 myProcNo_(
dict.
get<label>(
"myProcNo")),
115 neighbProcNo_(
dict.
get<label>(
"neighbProcNo")),
116 neighbEdgeCentres_(),
117 neighbEdgeLengths_(),
118 neighbEdgeFaceCentres_(),
119 neighbPointsPtr_(nullptr),
120 nonGlobalPatchPointsPtr_(nullptr)
150 labelList& ngpp = *nonGlobalPatchPointsPtr_;
153 const labelList& sharedPoints = pMeshGlobalData.sharedPointLabels();
158 boundaryMesh().mesh().patch().meshPoints();
160 label nNonShared = 0;
162 forAll(faMeshPatchPoints, pointi)
164 const label mpi = meshPoints[faMeshPatchPoints[pointi]];
165 if (!sharedPoints.found(mpi))
167 ngpp[nNonShared] = pointi;
172 ngpp.resize(nNonShared);
181 if (neighbProcNo() >= pBufs.nProcs())
184 <<
"On patch " <<
name()
185 <<
" trying to access out of range neighbour processor " 186 << neighbProcNo() <<
". This can happen if" <<
nl 187 <<
" trying to run on an incorrect number of processors" 191 UOPstream toNeighbProc(neighbProcNo(), pBufs);
196 << edgeFaceCentres();
206 UIPstream fromNeighbProc(neighbProcNo(), pBufs);
209 >> neighbEdgeCentres_
210 >> neighbEdgeLengths_
211 >> neighbEdgeFaceCentres_;
219 scalar nmagEl =
mag(neighbEdgeLengths_[edgei]);
220 scalar avEl = (magEl[edgei] + nmagEl)/2.0;
222 if (
mag(magEl[edgei] - nmagEl)/avEl > 1
e-6)
226 <<
" length does not match neighbour by " 227 << 100*
mag(magEl[edgei] - nmagEl)/avEl
228 <<
"% -- possible edge ordering problem" <<
nl;
246 PstreamBuffers& pBufs,
270 neighbPointsPtr_.clear();
274 if (neighbProcNo() >= pBufs.
nProcs())
277 <<
"On patch " <<
name()
278 <<
" trying to access out of range neighbour processor " 279 << neighbProcNo() <<
". This can happen if" <<
nl 280 <<
" trying to run on an incorrect number of processors" 289 patchSlice(boundaryMesh().
mesh().edges());
293 for (label patchPointI = 0; patchPointI <
nPoints(); ++patchPointI)
295 label edgeI = ptEdges[patchPointI][0];
297 patchEdge[patchPointI] = edgeI;
299 const edge&
e = patchEdges[edgeI];
301 indexInEdge[patchPointI] =
e.find(
pointLabels()[patchPointI]);
304 UOPstream toNeighbProc(neighbProcNo(), pBufs);
318 neighbPointsPtr_.clear();
329 UIPstream fromNeighbProc(neighbProcNo(), pBufs);
336 if (nbrPatchEdge.size() ==
nPoints())
341 labelList& neighbPoints = *neighbPointsPtr_;
344 patchSlice(boundaryMesh().
mesh().edges());
346 forAll(nbrPatchEdge, nbrPointI)
349 const edge&
e = patchEdges[nbrPatchEdge[nbrPointI]];
351 const label index = 1 - nbrIndexInEdge[nbrPointI];
355 neighbPoints[patchPointI] = nbrPointI;
370 tresult.ref().normalise();
377 if (!neighbPointsPtr_)
385 <<
"No extended addressing calculated for patch " <<
name()
387 <<
"This can happen if the number of points on both" 388 <<
" sides of the two coupled patches differ." <<
nl 389 <<
"This happens if the processorPatch was constructed from" 390 <<
" part of a cyclic patch." 394 return *neighbPointsPtr_;
406 & (neighbEdgeCentres() - neighbEdgeFaceCentres())
409 w = neighbEdgeCentresCn/
412 + neighbEdgeCentresCn + VSMALL
426 dc = (1.0 - weights())
448 - neighbEdgeFaceCentres()
460 - neighbEdgeFaceCentres()
474 if (!nonGlobalPatchPointsPtr_)
476 makeNonGlobalPatchPoints();
479 return *nonGlobalPatchPointsPtr_;
488 return patchInternalField(internalData);
499 patchInternalField(internalData, edgeFaces, tpfld.ref());
510 send(commsType, interfaceData);
520 return receive<label>(commsType, this->size());
530 send(commsType, patchInternalField(iF)());
540 return receive<label>(commsType, this->size());
551 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.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
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 INVALID.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
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)
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).
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
#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.
virtual ~processorFaPatch()
Destructor.