SLIDE 1
Linear Solvers in OpenFOAM 1
OpenFOAM’s basic solvers for linear systems of equations
Tim Behrens
Solvers, preconditioners, smoothers
SLIDE 2 Linear Solvers in OpenFOAM 2
What are we going to do?
Tim Behrens
- Look at the structure of lduMatrix
- Compare DIC/FDIC preconditioner
- Set up a multi grid solver
SLIDE 3 Linear Solvers in OpenFOAM 3
$FOAM SRC/OpenFOAM/matrices/lduMatrix/
Tim Behrens
- lduAddressing/
- lduMatrix/
- preconditioners/
- smoothers/
- solvers/
SLIDE 4 Linear Solvers in OpenFOAM 4
$FOAM SRC/OpenFOAM/matrices/lduMatrix/solvers
Tim Behrens
- diagonalSolver - diagonal solver for both symmetric and asymmetric problems
- GAMG - Geometric agglomerated algebraic multigrid solver
- PBiCG - Preconditioned bi-conjugate gradient solver for asymmetric lduMatrices using a
run-time selectable preconditioner
- PCG - Preconditioned conjugate gradient solver for symmetric lduMatrices using a run-
time selectable preconditiioner
- smoothSolver - Iterative solver using smoother for symmetric and asymmetric matrices
which uses a run-time selected smoother BICCG, ICCG obsolete
SLIDE 5
Linear Solvers in OpenFOAM 5
$FOAM SRC/OpenFOAM/matrices/lduMatrix/solvers
Tim Behrens
For description of the other folders and more information see the report. There is also an example of implementing your own version of the PBiCG solver myPBiCG.
SLIDE 6
Linear Solvers in OpenFOAM 6
Preconditioner test
Tim Behrens
Copy cavity test case and change directory: cp -r $FOAM_TUTORIALS/icoFoam/cavity $FOAM_RUN/cavity cd $FOAM_RUN/cavity
SLIDE 7
Linear Solvers in OpenFOAM 7
Preconditioner test
Tim Behrens
Change blockMeshDict: blocks ( hex (0 1 2 3 4 5 6 7) (150 150 1) simpleGrading (1 1 1) ); Generate mesh blockMesh
SLIDE 8
Linear Solvers in OpenFOAM 8
Preconditioner test
Tim Behrens
Change the controlDict to: endTime 0.4; deltaT 0.005; writeControl timeStep; writeInterval 20; and run icoFoam icoFoam > logDIC &
SLIDE 9
Linear Solvers in OpenFOAM 9
Preconditioner test
Tim Behrens
Now changing DIC to FDIC in fvSolution file preconditioner FDIC; and running icoFoam icoFoam > logFDIC & Compare run-time (Execution time in log files), difference in percentage?
SLIDE 10 Linear Solvers in OpenFOAM 10
Generalised geometric-algebraic multi-grid
Tim Behrens
Look at some GAMG options
preconditioner select preconditioner mergeLevels 1/2/3, coarsen levels faster, for simple geometric grids; smoother select smoother (GaussSeidel recommended) agglomerator faceAreaPair (recommended) or algebraicPair; nCellsInCoarsestLevel number of cells the coarse level solver has to calculate (important!) Table 1: GAMG options
SLIDE 11
Linear Solvers in OpenFOAM 11
Generalised geometric-algebraic multi-grid
Tim Behrens
Change the fvSolution to: p GAMG { preconditioner FDIC; mergeLevels 1; smoother GaussSeidel; agglomerator faceAreaPair; nCellsInCoarsestLevel 100; tolerance 1e-05; relTol 0; };
SLIDE 12
Linear Solvers in OpenFOAM 12
Generalised geometric-algebraic multi-grid
Tim Behrens
Change the fvSolution to: U GAMG { preconditioner DILU; mergeLevels 1; smoother GaussSeidel; agglomerator faceAreaPair; nCellsInCoarsestLevel 100; tolerance 1e-05; relTol 0; };
SLIDE 13
Linear Solvers in OpenFOAM 13
Generalised geometric-algebraic multi-grid
Tim Behrens
and running icoFoam icoFoam > logGAMG & Speed-up compared to same calculation with PCG/PBiCG: about 3 times faster
SLIDE 14
Linear Solvers in OpenFOAM 14
Thank you for your attention
Tim Behrens
Questions?