35 lduMatrix::solver::addsymMatrixConstructorToTable<GAMGSolver>
38 lduMatrix::solver::addasymMatrixConstructorToTable<GAMGSolver>
47 const word& fieldName,
67 cacheAgglomeration_(true),
69 preSweepsLevelMultiplier_(1),
72 postSweepsLevelMultiplier_(1),
75 interpolateCorrection_(false),
76 scaleCorrection_(matrix.symmetric()),
77 directSolveCoarsest_(false),
80 matrixLevels_(agglomeration_.size()),
81 primitiveInterfaceLevels_(agglomeration_.size()),
82 interfaceLevels_(agglomeration_.size()),
83 interfaceLevelsBouCoeffs_(agglomeration_.size()),
84 interfaceLevelsIntCoeffs_(agglomeration_.size())
90 forAll(agglomeration_, fineLevelIndex)
96 (fineLevelIndex+1) < agglomeration_.
size()
111 fineMeshInterfaces.
size()
115 dummyPrimMeshInterfaces.
size()
117 forAll(fineMeshInterfaces, intI)
119 if (fineMeshInterfaces.
set(intI))
122 refCast<const GAMGInterface>
124 fineMeshInterfaces[intI]
128 dummyPrimMeshInterfaces.
set
133 fineMeshInterfaces[intI].
type(),
142 forAll(dummyPrimMeshInterfaces, intI)
144 if (dummyPrimMeshInterfaces.
set(intI))
146 dummyMeshInterfaces.
set
149 &dummyPrimMeshInterfaces[intI]
160 agglomeration_.
meshLevel(fineLevelIndex),
170 procAgglomerateMatrix
182 agglomeration_.
meshLevel(fineLevelIndex + 1),
195 forAll(agglomeration_, fineLevelIndex)
201 agglomeration_.
meshLevel(fineLevelIndex + 1),
212 label fineLevelIndex = 0;
213 fineLevelIndex <= matrixLevels_.size();
217 if (fineLevelIndex == 0 || matrixLevels_.set(fineLevelIndex-1))
221 interfaceLevel(fineLevelIndex);
223 Pout<<
"level:" << fineLevelIndex <<
nl
241 Pout<<
"level:" << fineLevelIndex <<
" : no matrix" <<
endl;
248 if (matrixLevels_.size())
250 if (directSolveCoarsest_)
252 const label coarsestLevel = matrixLevels_.size() - 1;
254 if (matrixLevels_.set(coarsestLevel))
256 coarsestLUMatrixPtr_.set
260 matrixLevels_[coarsestLevel],
261 interfaceLevelsBouCoeffs_[coarsestLevel],
262 interfaceLevels_[coarsestLevel]
271 <<
"No coarse levels created, either matrix too small for GAMG"
272 " or nCellsInCoarsestLevel too large.\n"
273 " Either choose another solver of reduce "
274 "nCellsInCoarsestLevel."
284 if (!cacheAgglomeration_)
286 delete &agglomeration_;
293 void Foam::GAMGSolver::readControls()
297 controlDict_.readIfPresent(
"cacheAgglomeration", cacheAgglomeration_);
298 controlDict_.readIfPresent(
"nPreSweeps", nPreSweeps_);
299 controlDict_.readIfPresent
301 "preSweepsLevelMultiplier",
302 preSweepsLevelMultiplier_
304 controlDict_.readIfPresent(
"maxPreSweeps", maxPreSweeps_);
305 controlDict_.readIfPresent(
"nPostSweeps", nPostSweeps_);
306 controlDict_.readIfPresent
308 "postSweepsLevelMultiplier",
309 postSweepsLevelMultiplier_
311 controlDict_.readIfPresent(
"maxPostSweeps", maxPostSweeps_);
312 controlDict_.readIfPresent(
"nFinestSweeps", nFinestSweeps_);
313 controlDict_.readIfPresent(
"interpolateCorrection", interpolateCorrection_);
314 controlDict_.readIfPresent(
"scaleCorrection", scaleCorrection_);
315 controlDict_.readIfPresent(
"directSolveCoarsest", directSolveCoarsest_);
319 Pout<<
"GAMGSolver settings :"
320 <<
" cacheAgglomeration:" << cacheAgglomeration_
321 <<
" nPreSweeps:" << nPreSweeps_
322 <<
" preSweepsLevelMultiplier:" << preSweepsLevelMultiplier_
323 <<
" maxPreSweeps:" << maxPreSweeps_
324 <<
" nPostSweeps:" << nPostSweeps_
325 <<
" postSweepsLevelMultiplier:" << postSweepsLevelMultiplier_
326 <<
" maxPostSweeps:" << maxPostSweeps_
327 <<
" nFinestSweeps:" << nFinestSweeps_
328 <<
" interpolateCorrection:" << interpolateCorrection_
329 <<
" scaleCorrection:" << scaleCorrection_
330 <<
" directSolveCoarsest:" << directSolveCoarsest_
344 return matrixLevels_[i - 1];
360 return interfaceLevels_[i - 1];
366 Foam::GAMGSolver::interfaceBouCoeffsLevel
373 return interfaceBouCoeffs_;
377 return interfaceLevelsBouCoeffs_[i - 1];
383 Foam::GAMGSolver::interfaceIntCoeffsLevel
390 return interfaceIntCoeffs_;
394 return interfaceLevelsIntCoeffs_[i - 1];
#define forAll(list, i)
Loop across all elements in list.
Geometric agglomerated algebraic multigrid agglomeration class.
bool processorAgglomerate() const
Whether to agglomerate across processors.
const labelList & procAgglomMap(const label fineLeveli) const
Mapping from processor to agglomerated processor (global, all.
bool hasProcMesh(const label fineLeveli) const
Check that level has combined mesh.
const labelList & agglomProcIDs(const label fineLeveli) const
Set of processors to agglomerate. Element 0 is the.
const lduInterfacePtrsList & interfaceLevel(const label leveli) const
Return LDU interface addressing of given level.
bool hasMeshLevel(const label leveli) const
Do we have mesh for given level?
const lduMesh & meshLevel(const label leveli) const
Return LDU mesh of given level.
static autoPtr< GAMGInterface > New(const label index, const lduInterfacePtrsList &coarseInterfaces, const lduInterface &fineInterface, const labelField &localRestrictAddressing, const labelField &neighbourRestrictAddressing, const label fineLevelIndex, const label coarseComm)
Return a pointer to a new interface created on freestore given.
Geometric agglomerated algebraic multigrid solver.
GAMGSolver(const word &fieldName, const lduMatrix &matrix, const FieldField< Field, scalar > &interfaceBouCoeffs, const FieldField< Field, scalar > &interfaceIntCoeffs, const lduInterfaceFieldPtrsList &interfaces, const dictionary &solverControls)
Construct from lduMatrix and solver controls.
virtual ~GAMGSolver()
Destructor.
Input from memory buffer stream.
Class to perform the LU decomposition on a symmetric matrix.
void size(const label)
Override size to be inconsistent with allocated storage.
virtual Ostream & write(const char)
Write character.
Output to memory buffer stream.
string str() const
Return the string.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool set(const label) const
Is element set.
bool set(const label) const
Is element set.
label size() const
Return the number of elements in the UPtrList.
A list of keyword definitions, which are a keyword followed by any number of values (e....
virtual const word & type() const =0
Runtime type information.
const lduInterfaceFieldPtrsList & interfaces() const
virtual void readControls()
Read the control parameters from the controlDict_.
const lduMatrix & matrix() const
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Abstract base class for run-time selectable region solvers.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
defineTypeNameAndDebug(combustionModel, 0)
lduMatrix::solver::addasymMatrixConstructorToTable< GAMGSolver > addGAMGAsymSolverMatrixConstructorToTable_
prefixOSstream Pout(cout, "Pout")
lduMatrix::solver::addsymMatrixConstructorToTable< GAMGSolver > addGAMGSolverMatrixConstructorToTable_