46 label newFacesProc(0);
49 const label nMeshes(meshes_.size());
51 for (label i=0; i < nMeshes; ++i)
55 const polyPatch&
pp = psis[i].mesh().boundaryMesh()[patchI];
60 if (
pp.masterImplicit())
62 label newFacesPatch(0);
63 label newFacesProcPatch(0);
65 pp.newInternalProcFaces(newFacesPatch, newFacesProcPatch);
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);
86 const label nbrId =
pp.neighbPolyPatchID();
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);
173 patchAddr_[globalPatchId].setSize(
faceCells.size(), -1);
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))
203 psis[i].mesh().boundaryMesh()[patchI];
212 interfacesLst[patchI]
215 label globalNbr =
patchMap()[i][nbrId];
224 patchAddr_[globalNbr],
225 patchAddr_[globalPatchId],
245 >(
pp).neighbPatchID();
247 label globalNbr =
patchMap()[i][nbrId];
256 patchAddr_[globalNbr],
257 patchAddr_[globalPatchId],
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();
339 meshes_[i].lduAddr().lowerAddr();
342 meshes_[i].lduAddr().upperAddr();
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)
370 const polyPatch&
pp = psis[i].mesh().boundaryMesh()[patchI];
378 if (
pp.masterImplicit())
381 const label nbrPatchId =
pp.neighbPolyPatchID();
383 pp.mapCollocatedFaces();
395 pp.faceCells()[faceI] + cellOffsets_[i];
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];
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
An assembly of lduMatrix that is specific inter-region coupling through mapped patches.
Generic GeometricField class.
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
A non-owning sub-view of a List (allocated or unallocated storage).
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
void setSize(const label n)
Alias for resize().
const T * get(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI).
Cyclic patch for Arbitrary Mesh Interface (AMI).
An abstract base class for cyclic coupled interfaces.
Smooth ATC in cells next to a set of patches supplied by type.
A fvBoundaryMesh is a fvPatch list with a reference to the associated fvMesh, with additional search ...
const fvMesh & mesh() const noexcept
Return the mesh reference.
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
bool useImplicit() const noexcept
Use implicit formulation for coupled patches only.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
label size() const noexcept
Return number of equations.
label findNbrMeshId(const polyPatch &pp, const label iMesh) const
Find nrb mesh Id for mapped patches.
const labelListList & patchMap() const
Return patchMap.
const labelListList & faceMap() const
Return faceMap.
void update(UPtrList< GeometricField< Type, fvPatchField, volMesh > > &psis)
Update mappings.
virtual const labelUList & upperAddr() const
Return Upper addressing.
static void checkUpperTriangular(const label size, const labelUList &l, const labelUList &u)
Check if in upper-triangular ordering.
PtrList< const lduInterface > & primitiveInterfaces()
Return a non-const list of primitive interfaces.
static labelList upperTriOrder(const label nCells, const labelUList &lower, const labelUList &upper)
Calculate upper-triangular order.
virtual lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch with only those pointing to interfaces being set.
virtual const lduAddressing & lduAddr() const
Return ldu addressing.
virtual const labelUList & lowerAddr() const
Return Lower addressing.
A patch is a list of labels that address the faces in the global face list.
A class for managing references or pointers (no reference counting).
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInfo
Report an information message using Foam::Info.
#define DebugVar(var)
Report a variable name and value.
Namespace for handling debugging switches.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
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.
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.