46 label newFacesProc(0);
49 const label nMeshes(meshes_.size());
51 for (label i=0; i < nMeshes; ++i)
62 label newFacesPatch(0);
63 label newFacesProcPatch(0);
67 newFaces += newFacesPatch;
68 newFacesProc += newFacesProcPatch;
73 <<
"The number of faces on either side of the " 74 <<
"coupled patch " << patchI <<
" are not " 76 <<
"This might be due to the decomposition used. " 77 <<
"Please use decomposition preserving implicit " 78 <<
"patches on a single processor." 82 cellBoundMap_[i][patchI].
setSize(newFacesPatch, -1);
83 facePatchFaceMap_[i][patchI].
setSize(newFacesPatch, -1);
84 faceBoundMap_[i][patchI].
setSize(newFacesPatch, -1);
89 cellBoundMap_[meshNrbId][nbrId].
setSize 94 facePatchFaceMap_[meshNrbId][nbrId].
setSize 99 faceBoundMap_[meshNrbId][nbrId].
setSize 108 patchMap_[i][patchI] = newPatches;
109 patchLocalToGlobalMap_[i][patchI] = newPatches;
115 label virtualPatches = newPatches;
119 for (label i=0; i < nMeshes; ++i)
123 if (patchLocalToGlobalMap_[i][patchI] == -1)
125 patchLocalToGlobalMap_[i][patchI] = virtualPatches++;
135 for (label i=0; i < nMeshes; ++i)
137 newFaces += meshes_[i].lduAddr().upperAddr().size();
138 oldFaces += meshes_[i].lduAddr().upperAddr().size();
143 Info<<
" old total faces : " << oldFaces
144 <<
" new total faces (internal) : " << newFaces
145 <<
" new faces (remote) : " << newFacesProc
146 <<
" new Faces : " << newFaces - oldFaces <<
endl;
148 Info<<
" new patches : " << newPatches <<
endl;
150 Info<<
"Local to Global patch Map : " 151 << patchLocalToGlobalMap_ <<
endl;
155 patchAddr_.
setSize(newPatches);
157 for (label i=0; i < nMeshes; ++i)
161 forAll(interfacesLst, patchI)
163 label globalPatchId = patchMap_[i][patchI];
165 if (globalPatchId != -1)
168 meshes_[i].lduAddr().patchAddr(patchI);
175 for (label celli = 0; celli <
faceCells.size(); ++celli)
177 patchAddr_[globalPatchId][celli] =
191 for (label i=0; i < nMeshes; ++i)
195 forAll(interfacesLst, patchI)
197 label globalPatchId = patchMap_[i][patchI];
198 if (globalPatchId != -1)
200 if (interfacesLst.
set(patchI))
207 if (isA<cyclicLduInterface>(interfacesLst[patchI]))
212 interfacesLst[patchI]
215 label globalNbr =
patchMap()[i][nbrId];
224 patchAddr_[globalNbr],
225 patchAddr_[globalPatchId],
238 isA<cyclicAMILduInterface>(interfacesLst[patchI])
245 >(pp).neighbPatchID();
247 label globalNbr =
patchMap()[i][nbrId];
256 patchAddr_[globalNbr],
257 patchAddr_[globalPatchId],
269 isA<cyclicACMILduInterface>(interfacesLst[patchI])
276 >(pp).neighbPatchID();
278 label globalNbr =
patchMap()[i][nbrId];
284 >(pp).nonOverlapPatchID();
286 label globalnonOverlId =
patchMap()[i][nonOverlId];
295 patchAddr_[globalNbr],
296 patchAddr_[globalPatchId],
317 interfacesLst.
get(patchI)
329 label startIndex = 0;
331 for (label i=0; i < nMeshes; ++i)
335 const label nFaces = meshes_[i].lduAddr().upperAddr().size();
345 label localFacei = 0;
347 for (label facei=startIndex; facei < startIndex + nFaces; ++facei)
352 faceMap_[i][localFacei++] = facei;
355 startIndex += nFaces;
362 label nFaces = startIndex;
364 for (label i=0; i < nMeshes; ++i)
368 forAll(interfacesLst, patchI)
397 const labelList& facesIds = localFaceToFace[faceI];
401 label nbrFaceId = facesIds[j];
404 const label nbrCellI =
405 nbrFaceCells[nbrFaceId]
406 + cellOffsets_[meshNrbId];
411 cellBoundMap_[i][patchI][subFaceI] = nbrCellI;
412 cellBoundMap_[meshNrbId][nbrPatchId][subFaceI] =
415 facePatchFaceMap_[i][patchI][subFaceI] = faceI;
416 facePatchFaceMap_[meshNrbId][nbrPatchId][subFaceI]
419 faceBoundMap_[i][patchI][subFaceI] = nFaces;
420 faceBoundMap_[meshNrbId][nbrPatchId][subFaceI] =
433 if (newFaces != nFaces)
436 <<
"Incorrrect total number of faces in the assembled lduMatrix: " 437 << newFaces <<
" != " << nFaces <<
nl 459 facei = oldToNew[facei];
471 facei = oldToNew[facei];
void update(UPtrList< GeometricField< Type, fvPatchField, volMesh >> &psis)
Update mappings.
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI).
const labelListList & faceMap() const
Return faceMap.
virtual void newInternalProcFaces(label &, label &) const
Return number of new internal of this polyPatch faces.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool masterImplicit() const
Return implicit master.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
label findNbrMeshId(const polyPatch &pp, const label iMesh) const
Find nrb mesh Id for mapped patches.
constexpr char nl
The newline '\n' character (0x0a)
Type & refCast(U &obj)
A dynamic_cast (for references) that generates FatalError on failed casts, uses the virtual type() me...
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
const fvMesh & mesh() const noexcept
Return the mesh reference.
Ostream & endl(Ostream &os)
Add newline and flush stream.
An abstract base class for cyclic coupled interfaces.
virtual const labelUList & lowerAddr() const
Return Lower addressing.
virtual const labelUList & upperAddr() const
Return Upper addressing.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
PtrList< const lduInterface > & primitiveInterfaces()
Return a non-const list of primitive interfaces.
Generic GeometricField class.
const T * get(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
Smooth ATC in cells next to a set of patches supplied by type.
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
virtual const labelUList & nbrCells() const
Return nbrCells.
const labelListList & patchMap() const
Return patchMap.
A class for managing references or pointers (no reference counting)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
bool useImplicit() const noexcept
Use implicit formulation for coupled patches only.
#define forAll(list, i)
Loop across all elements in list.
A List obtained as a section of another List.
void setSize(const label n)
Alias for resize()
const labelUList & faceCells() const
Return face-cell addressing.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
virtual const lduAddressing & lduAddr() const
Return ldu addressing.
Cyclic patch for Arbitrary Mesh Interface (AMI)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
#define DebugInfo
Report an information message using Foam::Info.
virtual label neighbPolyPatchID() const
Return nbr patchID.
int debug
Static debugging option.
virtual refPtr< labelListList > mapCollocatedFaces() const
Return mapped collocated faces.
static void checkUpperTriangular(const label size, const labelUList &l, const labelUList &u)
Check if in upper-triangular ordering.
An assembly of lduMatrix that is specific inter-region coupling through mapped patches.
messageStream Info
Information stream (stdout output on master, null elsewhere)
#define DebugVar(var)
Report a variable name and value.
void setSize(const label n)
Alias for resize()
A patch is a list of labels that address the faces in the global face list.
virtual lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch with only those pointing to interfaces being set...
static labelList upperTriOrder(const label nCells, const labelUList &lower, const labelUList &upper)
Calculate upper-triangular order.
label size() const
Return number of equations.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.