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;
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);
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_;
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_;
411 if (
mag(PN[i]) > SMALL)
434 for (scalar& lpn: lPN)
436 if (
mag(lpn) < SMALL)
455 const edgeList& edges = boundaryMesh().mesh().edges();
468 unitDelta[i].removeCollinear(edgeNormal);
469 unitDelta[i].normalise();
473 const scalar
alpha = PN[i]*(edgeNormal & unitDelta[i]);
476 dc[i] = scalar(1)/
max(
alpha, 0.05*PN[i]);
492 const edgeList& edges = boundaryMesh().mesh().edges();
504 unitDelta[i].removeCollinear(edgeNormal);
505 unitDelta.normalise();
509 const scalar
alpha = unitDelta[i] & edgeNormal;
513 dc = scalar(1)/
alpha;
516 cv[i] = edgeNormal - dc*unitDelta[i];
537 - neighbEdgeFaceCentres()
549 - neighbEdgeFaceCentres()
563 if (!nonGlobalPatchPointsPtr_)
568 return *nonGlobalPatchPointsPtr_;
599 send(commsType, interfaceData);
647 os.writeEntry(
"myProcNo", myProcNo_);
648 os.writeEntry(
"neighbProcNo", neighbProcNo_);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Info<< " "<< writer.output().name()<< nl;}{ const Field< vector > edgeCentres(faMeshTools::flattenEdgeField(aMesh.edgeCentres(), true))
void normalise()
Inplace normalise this field. Generally a no-op except for vector fields.
void resize(const label len)
Adjust allocated size of list.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
const Field< point_type > & points() const noexcept
Return reference to global points.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
int nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
Input inter-processor communications stream using MPI send/recv etc. - operating on external buffer.
bool found(const T &val, label pos=0) const
Same as contains().
bool get(const label i) const
void size(const label n)
Older name for setAddressableSize.
label find(const T &val) const
Find index of the first occurrence of the value.
Output inter-processor communications stream using MPI send/recv etc. - operating on external buffer.
commsTypes
Communications types.
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static bool & parRun() noexcept
Test if this a parallel run.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
const bMesh & mesh() const
coupledFaPatch is an abstract base class for patches that couple regions of the computational domain ...
bool parallel() const
Are the cyclic planes parallel.
coupledFaPatch(const word &name, const labelUList &edgeLabels, const label index, const faBoundaryMesh &bm, const label nbrPolyPatchIndex, const word &patchType)
Construct from components.
void calcTransformTensors(const vector &Cf, const vector &Cr, const vector &nf, const vector &nr) const
Calculate the uniform transformation tensors.
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
Finite area boundary mesh, which is a faPatch list with registered IO, a reference to the associated ...
Finite area patch class. Used for 2-D non-Euclidian finite area method.
virtual label size() const
Patch size is the number of edge labels, but can be overloaded.
label nPoints() const
Number of patch points.
const labelListList & pointEdges() const
Return patch point-edge addressing.
virtual void write(Ostream &) const
Write.
const labelList & edgeLabels() const noexcept
Return the list of edges.
const scalarField & magEdgeLengths() const
Return edge length magnitudes, like the faMesh::magLe() method.
const scalarField & lPN() const
Return patch geodesic distance between P and N.
const vectorField & edgeLengths() const
Return edge length vectors, like the faMesh::Le() method.
tmp< vectorField > edgeFaceCentres() const
Return neighbour face centres.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
const labelUList & edgeFaces() const
Return edge-face addressing.
virtual void movePoints(PstreamBuffers &, const pointField &)
Correct patch after moving points.
const List< T >::subList patchSlice(const UList< T > &values) const
This patch slice from the complete list of values, which has size mesh::nEdges(), using the virtual p...
tmp< vectorField > edgeNormals() const
Return edge unit normals, like the faMesh::unitLe() method.
void patchInternalField(const UList< Type > &internalData, const labelUList &addressing, UList< Type > &pfld) const
Extract internal field next to patch using specified addressing.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
label start() const
Patch start in edge list.
label index() const noexcept
The index of this patch in the boundaryMesh.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
virtual void initTransfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const
Initialise interface data transfer.
virtual ~processorFaPatch()
Destructor.
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.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
void makeWeights(scalarField &) const
Make patch weighting factors.
void makeLPN(scalarField &) const
Make patch geodesic distance between P and N.
void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
const labelList & neighbPoints() const
Return neighbour point labels. This is for my local point the.
void makeNonGlobalPatchPoints() const
Find non-globa patch points.
void makeDeltaCoeffs(scalarField &) const
Make patch face - neighbour cell distances.
int neighbProcNo() const noexcept
Return neighbour processor number.
virtual tmp< labelField > transfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const
Transfer and return neighbour field.
void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
virtual void write(Ostream &os) const
Write the patch data as a dictionary.
tmp< vectorField > neighbEdgeNormals() const
Return processor-neighbour patch edge unit normals.
virtual label comm() const
Return communicator used for communication.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
const vectorField & neighbEdgeCentres() const noexcept
Return processor-neighbour patch edge centres.
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Initialise neighbour field transfer.
int myProcNo() const noexcept
Return processor number.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to the interface as a field.
void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
const vectorField & neighbEdgeFaceCentres() const noexcept
Return processor-neighbour patch neighbour face centres.
const labelList & nonGlobalPatchPoints() const
Return the set of labels of the processor patch points which are.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
void makeCorrectionVectors(vectorField &) const
Make non-orthogonality correction vectors.
virtual const tensorField & forwardT() const
Return face transformation tensor.
void receive(const UPstream::commsTypes commsType, UList< Type > &f) const
Raw receive function.
void send(const UPstream::commsTypes commsType, const UList< Type > &f) const
Raw send function.
Neighbour processor patch.
Skew-correction vectors for the skewness-corrected interpolation scheme.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
List< edge > edgeList
List of edge.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
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...
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
dimensionedTensor skew(const dimensionedTensor &dt)
constexpr char nl
The newline '\n' character (0x0a).
labelList pointLabels(nPoints, -1)
#define forAll(list, i)
Loop across all elements in list.