40 MGridGenGAMGAgglomeration,
48 void Foam::MGridGenGAMGAgglomeration::swap
52 PtrList<labelList>& nbrValues
58 if (interfaces.set(inti))
60 interfaces[inti].initInternalFieldTransfer
74 nbrValues.setSize(interfaces.size());
77 if (interfaces.set(inti))
84 interfaces[inti].internalFieldTransfer
96 void Foam::MGridGenGAMGAgglomeration::getNbrAgglom
98 const lduAddressing& addr,
100 const PtrList<labelList>& nbrGlobalAgglom,
104 cellToNbrAgglom.setSize(addr.size());
105 cellToNbrAgglom = -1;
109 if (interfaces.set(inti))
111 if (isA<processorLduInterface>(interfaces[inti]))
113 const processorLduInterface& pldui =
114 refCast<const processorLduInterface>(interfaces[inti]);
116 if (pldui.myProcNo() > pldui.neighbProcNo())
119 interfaces[inti].faceCells();
120 const labelList& nbrData = nbrGlobalAgglom[inti];
124 cellToNbrAgglom[faceCells[i]] = nbrData[i];
133 void Foam::MGridGenGAMGAgglomeration::detectSharedFaces
140 const lduAddressing& addr = mesh.lduAddr();
145 sharedFaces.resize(addr.lowerAddr().size()/100);
150 label lowerData = value[lower[facei]];
151 label upperData = value[upper[facei]];
153 if (lowerData != -1 && lowerData == upperData)
155 sharedFaces.insert(facei);
170 fvMesh_(refCast<const fvMesh>(mesh))
178 label nProcConsistencyIter
200 const labelList& own = fvMesh_.faceOwner();
205 if (!fvMesh_.isInternalFace(facei))
207 magSb[own[facei]] +=
mag(Sf[facei]);
215 label nCreatedLevels = 0;
217 while (nCreatedLevels < maxLevels_ - 1)
219 label nCoarseCells = -1;
226 meshLevel(nCreatedLevels).lduAddr(),
233 for (
int i=0; i<nProcConsistencyIter; i++)
235 const lduMesh& mesh = meshLevel(nCreatedLevels);
247 globalAgglom[celli] = globalNumbering.
toGlobal(agglom[celli]);
252 swap(interfaces, globalAgglom, nbrGlobalAgglom);
258 getNbrAgglom(addr, interfaces, nbrGlobalAgglom, cellToNbrAgglom);
263 detectSharedFaces(mesh, cellToNbrAgglom, sharedFaces);
272 label facei= iter.key();
273 weights[facei] *= 2.0;
277 finalAgglomPtr = agglomerate
282 meshLevel(nCreatedLevels).lduAddr(),
289 if (continueAgglomerating(finalAgglomPtr().size(), nCoarseCells))
291 nCells_[nCreatedLevels] = nCoarseCells;
292 restrictAddressing_.set(nCreatedLevels, finalAgglomPtr);
299 agglomerateLduAddressing(nCreatedLevels);
305 new scalarField(meshLevels_[nCreatedLevels].size())
309 restrictField(*aggVPtr, *VPtr, nCreatedLevels,
false);
325 meshLevels_[nCreatedLevels].upperAddr().size(),
330 restrictFaceField(*aggMagSfPtr, *magSfPtr, nCreatedLevels);
337 magSfPtr = aggMagSfPtr;
344 new scalarField(meshLevels_[nCreatedLevels].size())
348 restrictField(*aggMagSbPtr, *magSbPtr, nCreatedLevels,
false);
351 magSbPtr = aggMagSbPtr;
358 compactLevels(nCreatedLevels);
virtual lduInterfacePtrsList interfaces() const =0
Return a list of pointers for each patch.
MGridGenGAMGAgglomeration(const lduMesh &mesh, const dictionary &controlDict)
Construct given mesh and controls.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensionedScalar sqrt(const dimensionedScalar &ds)
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Pre-declare related SubField type.
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
UPtrList< const lduInterface > lduInterfacePtrsList
List of coupled interface fields to be used in coupling.
virtual const lduAddressing & lduAddr() const =0
Return ldu addressing.
List< label > labelList
A List of labels.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
label toGlobal(const label i) const
From local to global.
static bool & parRun()
Is this a parallel run?
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
dimensioned< scalar > mag(const dimensioned< Type > &)
The class contains the addressing required by the lduMatrix: upper, lower and losort.
A class for managing temporary objects.
Geometric agglomerated algebraic multigrid agglomeration class.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
label size() const
Return number of equations.