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))
257 matrixLevels_[coarsestLevel].mesh();
263 coarsestLUMatrixPtr_.set
267 matrixLevels_[coarsestLevel],
268 interfaceLevelsBouCoeffs_[coarsestLevel],
269 interfaceLevels_[coarsestLevel]
280 <<
"No coarse levels created, either matrix too small for GAMG" 281 " or nCellsInCoarsestLevel too large.\n" 282 " Either choose another solver of reduce " 283 "nCellsInCoarsestLevel." 293 if (!cacheAgglomeration_)
295 delete &agglomeration_;
302 void Foam::GAMGSolver::readControls()
306 controlDict_.readIfPresent(
"cacheAgglomeration", cacheAgglomeration_);
307 controlDict_.readIfPresent(
"nPreSweeps", nPreSweeps_);
308 controlDict_.readIfPresent
310 "preSweepsLevelMultiplier",
311 preSweepsLevelMultiplier_
313 controlDict_.readIfPresent(
"maxPreSweeps", maxPreSweeps_);
314 controlDict_.readIfPresent(
"nPostSweeps", nPostSweeps_);
315 controlDict_.readIfPresent
317 "postSweepsLevelMultiplier",
318 postSweepsLevelMultiplier_
320 controlDict_.readIfPresent(
"maxPostSweeps", maxPostSweeps_);
321 controlDict_.readIfPresent(
"nFinestSweeps", nFinestSweeps_);
322 controlDict_.readIfPresent(
"interpolateCorrection", interpolateCorrection_);
323 controlDict_.readIfPresent(
"scaleCorrection", scaleCorrection_);
324 controlDict_.readIfPresent(
"directSolveCoarsest", directSolveCoarsest_);
328 Pout<<
"GAMGSolver settings :" 329 <<
" cacheAgglomeration:" << cacheAgglomeration_
330 <<
" nPreSweeps:" << nPreSweeps_
331 <<
" preSweepsLevelMultiplier:" << preSweepsLevelMultiplier_
332 <<
" maxPreSweeps:" << maxPreSweeps_
333 <<
" nPostSweeps:" << nPostSweeps_
334 <<
" postSweepsLevelMultiplier:" << postSweepsLevelMultiplier_
335 <<
" maxPostSweeps:" << maxPostSweeps_
336 <<
" nFinestSweeps:" << nFinestSweeps_
337 <<
" interpolateCorrection:" << interpolateCorrection_
338 <<
" scaleCorrection:" << scaleCorrection_
339 <<
" directSolveCoarsest:" << directSolveCoarsest_
353 return matrixLevels_[i - 1];
369 return interfaceLevels_[i - 1];
375 Foam::GAMGSolver::interfaceBouCoeffsLevel
382 return interfaceBouCoeffs_;
386 return interfaceLevelsBouCoeffs_[i - 1];
392 Foam::GAMGSolver::interfaceIntCoeffsLevel
399 return interfaceIntCoeffs_;
403 return interfaceLevelsIntCoeffs_[i - 1];
string str() const
Return the string.
#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.
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
static const GAMGAgglomeration & New(const lduMesh &mesh, const dictionary &controlDict)
Return the selected geometric agglomerator.
virtual label comm() const =0
Return communicator used for parallel communication.
bool set(const label) const
Is element set.
A class for handling words, derived from string.
Abstract base-class for lduMatrix solvers.
static label warnComm
Debugging: warn for use of any communicator differing from warnComm.
lduMatrix::solver::addsymMatrixConstructorToTable< GAMGSolver > addGAMGSolverMatrixConstructorToTable_
prefixOSstream Pout(cout,"Pout")
defineTypeNameAndDebug(combustionModel, 0)
virtual ~GAMGSolver()
Destructor.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
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_
Output to memory buffer stream.
label size() const
Return the number of elements in the UPtrList.
virtual void readControls()
Read the control parameters from the controlDict_.