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);
178 label nProcConsistencyIter
207 magSb[own[facei]] +=
mag(Sf[facei]);
215 label nCreatedLevels = 0;
219 label nCoarseCells = -1;
233 for (
int i=0; i<nProcConsistencyIter; i++)
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
291 nCells_[nCreatedLevels] = nCoarseCells;
337 magSfPtr = aggMagSfPtr;
348 restrictField(*aggMagSbPtr, *magSbPtr, nCreatedLevels,
false);
351 magSbPtr = aggMagSbPtr;
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Macros for easy insertion into run-time selection tables.
const lduMesh & mesh() const
Geometric agglomerated algebraic multigrid agglomeration class.
void restrictField(Field< Type > &cf, const Field< Type > &ff, const label fineLevelIndex, const bool procAgglom) const
Restrict (integrate by summation) cell field.
void agglomerateLduAddressing(const label fineLevelIndex)
Assemble coarse mesh addressing.
const label maxLevels_
Max number of levels.
void compactLevels(const label nCreatedLevels)
Shrink the number of levels to that specified.
PtrList< lduPrimitiveMesh > meshLevels_
Hierarchy of mesh addressing.
bool continueAgglomerating(const label nCells, const label nCoarseCells) const
Check the need for further agglomeration.
labelList nCells_
The number of cells in each level.
void restrictFaceField(Field< Type > &cf, const Field< Type > &ff, const label fineLevelIndex) const
Restrict (integrate by summation) face field.
PtrList< labelField > restrictAddressing_
Cell restriction addressing array.
const lduMesh & meshLevel(const label leveli) const
Return LDU mesh of given level.
Agglomerate using the MGridGen algorithm.
MGridGenGAMGAgglomeration(const lduMesh &mesh, const dictionary &controlDict)
Construct given mesh and controls.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Pre-declare related SubField type.
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
static bool & parRun()
Is this a parallel run?
A list of keyword definitions, which are a keyword followed by any number of values (e....
Mesh data needed to do the Finite Volume discretisation.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label toGlobal(const label i) const
From local to global.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
label size() const
Return number of equations.
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
virtual lduInterfacePtrsList interfaces() const =0
Return a list of pointers for each patch.
virtual const lduAddressing & lduAddr() const =0
Return ldu addressing.
virtual const labelList & faceOwner() const
Return face owner.
const scalarField & cellVolumes() const
label nInternalFaces() const
const scalarField & magFaceAreas() const
const vectorField & faceAreas() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
A class for managing temporary objects.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
To & refCast(From &r)
Reference type cast template function.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< scalar > mag(const dimensioned< Type > &)
UPtrList< const lduInterface > lduInterfacePtrsList
List of coupled interface fields to be used in coupling.
defineTypeNameAndDebug(combustionModel, 0)
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
UList< label > labelUList
runTime controlDict().lookup("adjustTimeStep") >> adjustTimeStep