/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . Class Foam::GAMGSolver Description Geometric agglomerated algebraic multigrid solver. Characteristics: - Requires positive definite, diagonally dominant matrix. - Agglomeration algorithm: selectable and optionally cached. - Restriction operator: summation. - Prolongation operator: injection. - Smoother: Gauss-Seidel. - Coarse matrix creation: central coefficient: summation of fine grid central coefficients with the removal of intra-cluster face; off-diagonal coefficient: summation of off-diagonal faces. - Coarse matrix scaling: performed by correction scaling, using steepest descent optimisation. - Type of cycle: V-cycle with optional pre-smoothing. - Coarsest-level matrix solved using PCG or PBiCGStab. SourceFiles GAMGSolver.C GAMGSolverAgglomerateMatrix.C GAMGSolverInterpolate.C GAMGSolverScale.C GAMGSolverSolve.C \*---------------------------------------------------------------------------*/ #ifndef GAMGSolver_H #define GAMGSolver_H #include "GAMGAgglomeration.H" #include "lduMatrix.H" #include "labelField.H" #include "primitiveFields.H" #include "LUscalarMatrix.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ Class GAMGSolver Declaration \*---------------------------------------------------------------------------*/ class GAMGSolver : public lduMatrix::solver { // Private Data bool cacheAgglomeration_; //- Number of pre-smoothing sweeps label nPreSweeps_; //- Lever multiplier for the number of pre-smoothing sweeps label preSweepsLevelMultiplier_; //- Maximum number of pre-smoothing sweeps label maxPreSweeps_; //- Number of post-smoothing sweeps label nPostSweeps_; //- Lever multiplier for the number of post-smoothing sweeps label postSweepsLevelMultiplier_; //- Maximum number of post-smoothing sweeps label maxPostSweeps_; //- Number of smoothing sweeps on finest mesh label nFinestSweeps_; //- Choose if the corrections should be interpolated after injection. // By default corrections are not interpolated. bool interpolateCorrection_; //- Choose if the corrections should be scaled. // By default corrections for symmetric matrices are scaled // but not for asymmetric matrices. bool scaleCorrection_; //- Direct or iteratively solve the coarsest level bool directSolveCoarsest_; //- The agglomeration const GAMGAgglomeration& agglomeration_; //- Hierarchy of matrix levels PtrList matrixLevels_; //- Hierarchy of interfaces. PtrList> primitiveInterfaceLevels_; //- Hierarchy of interfaces in lduInterfaceFieldPtrs form PtrList interfaceLevels_; //- Hierarchy of interface boundary coefficients PtrList>> interfaceLevelsBouCoeffs_; //- Hierarchy of interface internal coefficients PtrList>> interfaceLevelsIntCoeffs_; //- LU decomposed coarsest matrix for direct solution on the master autoPtr coarsestLUMatrixPtr_; //- Coarsest matrix solver for iterative solution autoPtr coarsestSolverPtr_; // Private Member Functions //- Read control parameters from the control dictionary virtual void readControls(); //- Simplified access to interface level const lduInterfaceFieldPtrsList& interfaceLevel ( const label i ) const; //- Simplified access to matrix level const lduMatrix& matrixLevel(const label i) const; //- Simplified access to interface boundary coeffs level const Field>& interfaceBouCoeffsLevel ( const label i ) const; //- Simplified access to interface internal coeffs level const Field>& interfaceIntCoeffsLevel ( const label i ) const; //- Agglomerate coarse matrix. Supply mesh to use - so we can // construct temporary matrix on the fine mesh (instead of the coarse // mesh) void agglomerateMatrix ( const label fineLevelIndex, const lduMesh& coarseMesh, const lduInterfacePtrsList& coarseMeshInterfaces ); //- Agglomerate coarse interface coefficients void agglomerateInterfaceCoefficients ( const label fineLevelIndex, const lduInterfacePtrsList& coarseMeshInterfaces, PtrList& coarsePrimInterfaces, lduInterfaceFieldPtrsList& coarseInterfaces, Field>& coarseInterfaceBouCoeffs, Field>& coarseInterfaceIntCoeffs ) const; //- Collect matrices from other processors void gatherMatrices ( const labelList& procIDs, const lduMesh& dummyMesh, const label meshComm, const lduMatrix& mat, const Field>& interfaceBouCoeffs, const Field>& interfaceIntCoeffs, const lduInterfaceFieldPtrsList& interfaces, PtrList& otherMats, PtrList>>& otherBouCoeffs, PtrList>>& otherIntCoeffs, List& otherTransforms, List>& otherRanks ) const; //- Agglomerate processor matrices void procAgglomerateMatrix ( // Agglomeration information const labelList& procAgglomMap, const List