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),
77 directSolveCoarsest_(
false),
80 matrixLevels_(agglomeration_.size()),
81 primitiveInterfaceLevels_(agglomeration_.size()),
82 interfaceLevels_(agglomeration_.size()),
83 interfaceLevelsBouCoeffs_(agglomeration_.size()),
84 interfaceLevelsIntCoeffs_(agglomeration_.size())
88 if (agglomeration_.processorAgglomerate())
90 forAll(agglomeration_, fineLevelIndex)
92 if (agglomeration_.hasMeshLevel(fineLevelIndex))
96 (fineLevelIndex+1) < agglomeration_.size()
97 && agglomeration_.hasProcMesh(fineLevelIndex+1)
107 agglomeration_.interfaceLevel(fineLevelIndex);
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),
166 agglomeration_.procAgglomMap(fineLevelIndex+1);
168 agglomeration_.agglomProcIDs(fineLevelIndex+1);
170 procAgglomerateMatrix
182 agglomeration_.meshLevel(fineLevelIndex + 1),
183 agglomeration_.interfaceLevel(fineLevelIndex + 1)
195 forAll(agglomeration_, fineLevelIndex)
201 agglomeration_.meshLevel(fineLevelIndex + 1),
202 agglomeration_.interfaceLevel(fineLevelIndex + 1)
212 label fineLevelIndex = 0;
213 fineLevelIndex <= matrixLevels_.size();
217 if (fineLevelIndex == 0 || matrixLevels_.set(fineLevelIndex-1))
219 const lduMatrix& matrix = matrixLevel(fineLevelIndex);
221 interfaceLevel(fineLevelIndex);
223 Pout<<
"level:" << fineLevelIndex <<
nl 226 <<
" nInterfaces:" << interfaces.
size()
231 if (interfaces.
set(i))
234 <<
"\ttype:" << interfaces[i].type()
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.
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Class to perform the LU decomposition on a symmetric matrix.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const GAMGAgglomeration & New(const lduMesh &mesh, const dictionary &controlDict)
Return the selected geometric agglomerator.
A class for handling words, derived from string.
Abstract base-class for lduMatrix solvers.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
lduMatrix::solver::addsymMatrixConstructorToTable< GAMGSolver > addGAMGSolverMatrixConstructorToTable_
bool set(const label) const
Is element set.
defineTypeNameAndDebug(combustionModel, 0)
virtual ~GAMGSolver()
Destructor.
label size() const
Return the number of elements in the UPtrList.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Input from memory buffer stream.
lduMatrix::solver::addasymMatrixConstructorToTable< GAMGSolver > addGAMGAsymSolverMatrixConstructorToTable_
prefixOSstream Pout(cout, "Pout")
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
string str() const
Return the string.
Output to memory buffer stream.
virtual void readControls()
Read the control parameters from the controlDict_.