Go to the documentation of this file.
81 Info<<
"GAMGAgglomeration:" <<
nl
82 <<
" local agglomerator : " <<
type() <<
nl;
85 Info<<
" processor agglomerator : "
91 <<
setw(20) <<
"nFaces/nCells"
92 <<
setw(20) <<
"nInterfaces"
93 <<
setw(20) <<
"nIntFaces/nCells"
94 <<
setw(12) <<
"profile"
97 <<
setw(8) <<
"nProcs"
113 <<
setw(8) <<
"-----"
114 <<
setw(8) <<
"------"
132 for (label levelI = 0; levelI <=
size(); levelI++)
136 scalar faceCellRatio = 0;
137 label nInterfaces = 0;
140 scalar profile = 0.0;
146 const lduMesh& fineMesh =
meshLevel(levelI);
147 nCells = fineMesh.lduAddr().size();
149 scalar(fineMesh.lduAddr().lowerAddr().size())/
nCells;
152 fineMesh.interfaces();
155 if (interfaces.set(i))
158 nIntFaces += interfaces[i].faceCells().size();
161 ratio = scalar(nIntFaces)/
nCells;
163 profile = fineMesh.lduAddr().band().second();
171 scalar maxFaceCellRatio =
173 scalar totFaceCellRatio =
176 label maxNInt =
returnReduce(nInterfaces, maxOp<label>());
177 label totNInt =
returnReduce(nInterfaces, sumOp<label>());
182 scalar totProfile =
returnReduce(profile, sumOp<scalar>());
187 <<
setw(8) << totNprocs
189 <<
setw(8) << totNCells/totNprocs
190 <<
setw(8) << maxNCells
192 <<
setw(8) << totFaceCellRatio/totNprocs
193 <<
setw(8) << maxFaceCellRatio
195 <<
setw(8) << scalar(totNInt)/totNprocs
196 <<
setw(8) << maxNInt
198 <<
setw(8) << totRatio/totNprocs
199 <<
setw(8) << maxRatio
200 <<
setw(12) << totProfile/totNprocs
212 const label nFineCells,
213 const label nCoarseCells
216 const label nTotalCoarseCells =
returnReduce(nCoarseCells, sumOp<label>());
223 const label nTotalFineCells =
returnReduce(nFineCells, sumOp<label>());
224 return nTotalCoarseCells < nTotalFineCells;
237 MeshObject<lduMesh,
Foam::GeometricMeshObject, GAMGAgglomeration>(
mesh),
241 nCellsInCoarsestLevel_
243 controlDict.getOrDefault<label>(
"nCellsInCoarsestLevel", 10)
245 meshInterfaces_(
mesh.interfaces()),
249 (UPstream::nProcs(
mesh.comm()) > 1)
252 ? GAMGProcAgglomeration::
New
258 : autoPtr<GAMGProcAgglomeration>()
262 restrictAddressing_(maxLevels_),
264 faceRestrictAddressing_(maxLevels_),
265 faceFlipMap_(maxLevels_),
266 nPatchFaces_(maxLevels_),
267 patchFaceRestrictAddressing_(maxLevels_),
269 meshLevels_(maxLevels_)
298 const GAMGAgglomeration* agglomPtr =
301 GAMGAgglomeration::typeName
310 const word agglomeratorType
312 controlDict.getOrDefault<word>(
"agglomerator",
"faceAreaPair")
318 "geometricGAMGAgglomerationLibs",
319 lduMeshConstructorTablePtr_
322 auto* ctorPtr = lduMeshConstructorTable(agglomeratorType);
327 <<
"Unknown GAMGAgglomeration type "
328 << agglomeratorType <<
".\n"
329 <<
"Valid matrix GAMGAgglomeration types :"
330 << lduMatrixConstructorTablePtr_->sortedToc() <<
endl
331 <<
"Valid geometric GAMGAgglomeration types :"
332 << lduMeshConstructorTablePtr_->sortedToc()
343 const lduMatrix& matrix,
347 const lduMesh&
mesh = matrix.mesh();
349 const GAMGAgglomeration* agglomPtr =
352 GAMGAgglomeration::typeName
361 const word agglomeratorType
363 controlDict.getOrDefault<word>(
"agglomerator",
"faceAreaPair")
369 "algebraicGAMGAgglomerationLibs",
370 lduMatrixConstructorTablePtr_
373 auto* ctorPtr = lduMatrixConstructorTable(agglomeratorType);
396 const GAMGAgglomeration* agglomPtr =
399 GAMGAgglomeration::typeName
408 const word agglomeratorType
410 controlDict.lookupOrDefault<word>(
"agglomerator",
"faceAreaPair")
416 "geometricGAMGAgglomerationLibs",
417 geometryConstructorTablePtr_
420 auto* ctorPtr = geometryConstructorTable(agglomeratorType);
425 <<
"Unknown GAMGAgglomeration type "
426 << agglomeratorType <<
".\n"
427 <<
"Valid geometric GAMGAgglomeration types :"
428 << geometryConstructorTablePtr_->sortedToc()
465 return meshLevels_[i - 1];
478 return meshLevels_.set(i - 1);
490 return meshInterfaces_;
494 return meshLevels_[i - 1].rawInterfaces();
503 meshLevels_.set(i - 1,
nullptr);
505 if (i < nCells_.size())
508 restrictAddressing_.set(i,
nullptr);
510 faceRestrictAddressing_.set(i,
nullptr);
511 faceFlipMap_.set(i,
nullptr);
512 nPatchFaces_.set(i,
nullptr);
513 patchFaceRestrictAddressing_.set(i,
nullptr);
524 return procAgglomMap_[leveli];
533 return agglomProcIDs_[leveli];
539 return procCommunicator_[leveli] != -1;
545 return procCommunicator_[leveli];
554 return procCellOffsets_[leveli];
563 return procFaceMap_[leveli];
572 return procBoundaryMap_[leveli];
581 return procBoundaryFaceMap_[leveli];
594 if (fineAddressing.
size() != restriction.
size())
597 <<
"nCells:" << fineAddressing.
size()
598 <<
" agglom:" << restriction.
size()
615 const label own =
lower[facei];
616 const label nei =
upper[facei];
618 if (restriction[own] == restriction[nei])
622 if (master[own] < master[nei])
624 master[nei] = master[own];
627 else if (master[own] > master[nei])
629 master[own] = master[nei];
635 reduce(nChanged, sumOp<label>());
647 forAll(restriction, celli)
649 labelList& masters = coarseToMasters[restriction[celli]];
651 if (!masters.found(master[celli]))
653 masters.
append(master[celli]);
658 if (nNewCoarse > nCoarse)
669 nNewCoarse = nCoarse;
671 forAll(coarseToMasters, coarseI)
673 const labelList& masters = coarseToMasters[coarseI];
675 labelList& newCoarse = coarseToNewCoarse[coarseI];
676 newCoarse.
setSize(masters.size());
677 newCoarse[0] = coarseI;
678 for (label i=1; i<newCoarse.size(); i++)
680 newCoarse[i] = nNewCoarse++;
685 forAll(restriction, celli)
687 const label coarseI = restriction[celli];
689 const label index = coarseToMasters[coarseI].find(master[celli]);
690 newRestrict[celli] = coarseToNewCoarse[coarseI][index];
The class contains the addressing required by the lduMatrix: upper, lower and losort.
List< label > labelList
A List of labels.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
PtrList< labelListList > procFaceMap_
autoPtr< GAMGProcAgglomeration > procAgglomeratorPtr_
label size() const noexcept
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Geometric agglomerated algebraic multigrid agglomeration class.
virtual const objectRegistry & thisDb() const
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
const lduMesh & meshLevel(const label leveli) const
const labelListList & faceMap(const label fineLeveli) const
void append(const T &val)
Ostream & endl(Ostream &os)
PtrList< labelList > faceRestrictAddressing_
bool hasMeshLevel(const label leveli) const
PtrList< lduPrimitiveMesh > meshLevels_
virtual const labelUList & upperAddr() const =0
PtrList< labelField > restrictAddressing_
label min(const labelHashSet &set, label minValue=labelMax)
const labelList & cellOffsets(const label fineLeveli) const
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual lduInterfacePtrsList interfaces() const =0
const labelList & agglomProcIDs(const label fineLeveli) const
virtual label comm() const
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const labelListList & boundaryMap(const label fineLeveli) const
label nCellsInCoarsestLevel_
string lower(const std::string &s)
Generic templated field type.
GAMGAgglomeration(const GAMGAgglomeration &)=delete
OSstream & stream(OSstream *alternative=nullptr)
const lduMesh & mesh() const
virtual lduInterfacePtrsList interfaces() const
virtual const lduAddressing & lduAddr() const
void setSize(const label n)
runTime controlDict().readEntry("adjustTimeStep"
void clearLevel(const label leveli)
Istream and Ostream manipulators taking arguments.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
static autoPtr< GAMGProcAgglomeration > New(const word &type, GAMGAgglomeration &agglom, const dictionary &controlDict)
static bool checkRestriction(labelList &newRestrict, label &nNewCoarse, const lduAddressing &fineAddressing, const labelUList &restriction, const label nCoarse)
PtrList< labelList > nPatchFaces_
label max(const labelHashSet &set, label maxValue=labelMin)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dlLibraryTable & libs() const
PtrList< labelList > procAgglomMap_
errorManip< error > abort(error &err)
Omanip< int > setw(const int i)
static const GAMGAgglomeration & New(const lduMesh &mesh, const dictionary &controlDict)
bool open(bool verbose=true)
errorManipArg< error, int > exit(error &err, const int errNo=1)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
virtual int precision() const
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
List< labelList > labelListList
A List of labelList.
#define FatalErrorInFunction
const T * set(const label i) const
const labelList & procAgglomMap(const label fineLeveli) const
const Type * cfindObject(const word &name, const bool recursive=false) const
const lduInterfacePtrsList & interfaceLevel(const label leveli) const
virtual const labelUList & lowerAddr() const =0
PtrList< labelListList > procBoundaryMap_
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void compactLevels(const label nCreatedLevels)
fileName::Type type(const fileName &name, const bool followLink=true)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
labelList identity(const label len, label start=0)
const lduMesh & mesh() const
const labelListListList & boundaryFaceMap(const label fineLeveli) const
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
bool hasProcMesh(const label fineLeveli) const
label procCommunicator(const label fineLeveli) const
string upper(const std::string &s)
UList< label > labelUList
A UList of labels.
label nCells(const label leveli) const
PtrList< boolList > faceFlipMap_
PtrList< labelListListList > procBoundaryFaceMap_
defineTypeNameAndDebug(combustionModel, 0)
PtrList< labelListList > patchFaceRestrictAddressing_
PtrList< labelList > procCellOffsets_
virtual const lduAddressing & lduAddr() const =0
bool processorAgglomerate() const
const Time & time() const noexcept
PtrList< labelList > agglomProcIDs_
static label nProcs(const label communicator=worldComm)
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
UPtrList< const lduInterface > lduInterfacePtrsList
List of coupled interface fields to be used in coupling.
Tuple2< label, scalar > band() const
bool continueAgglomerating(const label nCells, const label nCoarseCells) const
labelList procCommunicator_