CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Parameters for multigrid solver (http://www.cfd-online.com/Forums/openfoam-solving/96572-parameters-multigrid-solver.html)

HaZe January 26, 2012 05:40

Parameters for multigrid solver
 
Hello!

I'm working with OpenFOAM-1.6-ext since last October. My task is to study the numerical methods like the ode solvers and matrix solvers. I've already finished to learn the theory about all methods and now I have to test them. For the tests I'm solving a steady state flame with reactingFoam.

Now I tried to solve the matrices with the xxAMG solvers and I'm wondering what all the parameters are saying. I got them with some debugging voodoo and I'm also wondering if there are any more parameters which are not necessary, but maybe useful.

For the GAMG solver I already got the parameters from this thread. And of course I read the linked two papers.

On that basis I tried to get the MPEAMG, RREAMG and FPEAMG solvers running. I managed them to get started, but I don't know what most parameters are doing.

Can anybody explain the following parameters where a question or no comment is posted. And maybe give some rule of thumb for their values?
The not indented parameters are from GAMG, the fist block of indented parameters is from MPEAMG and the second indented block is additional necessary for FPEAMG.

Code:

U xxEAMG
        {
        minIter 0; //tells you how many solver sweeps will be forced without checking the convergence tolerance: usually zero
        maxIter 500; // is this the max number of V-/W-/F- cylces in one time step?
        tolerance 1e-6; // evident
        relTol 1e-1; //evident

              cycle V-cycle; //evident, possible: V/W/F
              nMaxLevels 5; //
              scale 5; //
            policy AAMG; //possible: AAMG PAMG SAMG, but what do they do?
              groupSize 2; //
            minCoarseEqns 5; //
              kDimension 5; //
       
        nSmoothingSteps 2; //
            mFactor 2; //

        smoother GaussSeidel; //evident
        nPreSweeps 0; //
        nPostSweeps 2; //
        nFinestSweeps 2; //

        scaleCorrection true; //
        directSolveCoarsest false; //evident

        cacheAgglomeration true; //
        nCellsInCoarsestLevel 10; //
        agglomerator faceAreaPair; //
        mergeLevels 1; //evident
        };

Thanks,
HaZe

arjun January 26, 2012 05:51

Quote:

Originally Posted by HaZe (Post 341245)



Code:

U xxEAMG
        {
        minIter 0; //tells you how many solver sweeps will be forced without checking the convergence tolerance: usually zero
        maxIter 500; // is this the max number of V-/W-/F- cylces in one time step?
        tolerance 1e-6; // evident
        relTol 1e-1; //evident

              cycle V-cycle; //evident, possible: V/W/F
              nMaxLevels 5; // Maximum coarse levels to be produced. Sounds too small for group size of 2 .
              scale 5; //
            policy AAMG; //possible: AAMG PAMG SAMG, but what do they do?

AAMG = Agglomoration based additive corrective. Should be default.
PAMG = I am not sure, I never used openFOAM.
SAMG = selective AMG like classical AMG or AMG based on Stuben's work. Look for Stuben and AMG for it.

              groupSize 2; //  Two equations will be merged
            minCoarseEqns 5; // When coarse level equations are less than this direct solver will be used.

              kDimension 5; //
       
        nSmoothingSteps 2; //
            mFactor 2; //

        smoother GaussSeidel; //evident
        nPreSweeps 0; //
        nPostSweeps 2; //
        nFinestSweeps 2; //

        scaleCorrection true; // Corrections are sometimes scaled to increase convergence.  phi_new = phi_old + alpha * corr
        directSolveCoarsest false; //evident

        cacheAgglomeration true; // save the aggomoration information
        nCellsInCoarsestLevel 10; // should be same as minCoarseEqns ???
        agglomerator faceAreaPair; // Apply aggomoration based of face area rather than matrix coefficients. If done this way one can save the agglomoration and weights.

        mergeLevels 1; //evident
        };

Thanks,
HaZe

Note i have never used openfoam so if i am wrong at any place feel free to correct.

HaZe January 27, 2012 06:56

I found some comments in older source code (blue) from OF1.5-dev on the net, but there are still some questions left (green).
Any suggestions for the numeric values, especially in view of their dependencies?

Code:

U xxEAMG       
{
        minIter 0; //tells you how many solver sweeps will be forced without checking the convergence tolerance: usually zero
        maxIter 500; // is this the max number of V-/W-/F- cylces in one time step?
        tolerance 1e-6; // evident
        relTol 1e-1; //evident

                cycle V-cycle; //evident, possible: V/W/F
                nMaxLevels 5; // Maximum coarse levels to be produced. Sounds too small for group size of 2 .
                scale 5; //what is scaled?
              policy AAMG; //possible: AAMG PAMG SAMG, but what do they do?
AAMG = Agglomoration based additive corrective. Should be default.
 PAMG = I am not sure, I never used openFOAM.
 SAMG = selective AMG like classical AMG or AMG based on Stuben's work. Look for Stuben and AMG for it.

              groupSize 2; //  Two equations will be merged                         
              minCoarseEqns 5; // When coarse level equations are less than this direct solver will be used. Minimum number of coarse level equations.
              kDimension 5; //Krylov space dimension (are the equations on the coarsest level solved by Krylov-Methods? Is it possible to choose the method?)
                 
          nSmoothingSteps 2; //number of smoothing steps before projection
          mFactor 2; //magnification factor (what's that?)
         
smoother GaussSeidel; //evident
nPreSweeps 0; //number of pre-sweeps (but what is meant by sweep?)
nPostSweeps 2; //number of post-sweeps
nFinestSweeps 2; //

scaleCorrection true; // Corrections are sometimes scaled to increase convergence.  phi_new = phi_old + alpha * corr
directSolveCoarsest false; //evident

cacheAgglomeration true; // save the aggomoration information     
nCellsInCoarsestLevel 10; // should be same as minCoarseEqns ???       
agglomerator faceAreaPair; // Apply aggomoration based of face area rather than matrix coefficients. If done this way one can save the agglomoration and weights.
mergeLevels 1; //(evident) (what's the difference to groupeSize?)       
};


arjun January 28, 2012 03:05

Quote:

Originally Posted by HaZe (Post 341472)
I found some comments in older source code (blue) from OF1.5-dev on the net, but there are still some questions left (green).
Any suggestions for the numeric values, especially in view of their dependencies?

Code:

U xxEAMG       
{
        minIter 0; //tells you how many solver sweeps will be forced without checking the convergence tolerance: usually zero
        maxIter 500; // is this the max number of V-/W-/F- cylces in one time step?   

I think so.


        tolerance 1e-6; // evident
        relTol 1e-1; //evident

                cycle V-cycle; //evident, possible: V/W/F
                nMaxLevels 5; // Maximum coarse levels to be produced. Sounds too small for group size of 2 .
                scale 5; //what is scaled?

I do not have an idea. Usually corrections are scaled but it does not look like that parameter.


              policy AAMG; //possible: AAMG PAMG SAMG, but what do they do?
AAMG = Agglomoration based additive corrective. Should be default.
 PAMG = I am not sure, I never used openFOAM.
 SAMG = selective AMG like classical AMG or AMG based on Stuben's work. Look for Stuben and AMG for it.

              groupSize 2; //  Two equations will be merged                         
              minCoarseEqns 5; // When coarse level equations are less than this direct solver will be used. Minimum number of coarse level equations.

Yes. Number of equations at coarsest level.

              kDimension 5; //Krylov space dimension (are the equations on the coarsest level solved by Krylov-Methods? Is it possible to choose the method?)
 
GMRES might need this parameter.
About your question 'are the equations solved by Krylov method' ,  usually they are solved by LU factorization. But it all depends on who  implemented it.
 
But if multigrid is used as preconditioner then it might be parameter  that is used.  The PAMG is my guess where multigrid shall be used as  preconditioner.  Note I said it is my guess so someone need to confirm  or deny it to correct it.



               
          nSmoothingSteps 2; //number of smoothing steps before projection
          mFactor 2; //magnification factor (what's that?)
         
Usually corrections are scaled by factor 2. As I  mentioned above, so this might be that factor.  Phi_new = Phi_old + 2 *  ProlongMat * phi_at_coarse_level.
   
Note: This parameter is usually taken as 2 but there is a way to  estimate this. I do not remember exactly which paper or book I read it,  but i definitely remember reading a procedure to calculate this  parameter.
   
The value 2 comes from coarsening of Poisson problem where coarse level  size is roughly 2 times of fine. For unstructured meshes it has to be  calculated.
 

  In practice: I have never used this parameter. I use Phi_new = Phi_old +  ProlongMat * phi_at_coarse_level.
   
Works just fine.


Edited to add:
Look for 'A review of algebraic multigrid' by Stuben. There is some discussion about scaling and a method to calculate it.




smoother GaussSeidel; //evident
nPreSweeps 0; //number of pre-sweeps (but what is meant by sweep?)

By sweep , usually means : one forward iteration of Gauss Seidel and 1 backward.
   
That is
Forward : for (i = 0; i < N; i++) {    }
Backward : for (i = N-1;  i >= 0; i--) {  }
   
This is what fluent means by sweep and it is generally understood as.
 


nPostSweeps 2; //number of post-sweeps
nFinestSweeps 2; //

scaleCorrection true; // Corrections are sometimes scaled to increase convergence.  phi_new = phi_old + alpha * corr
directSolveCoarsest false; //evident

cacheAgglomeration true; // save the aggomoration information     
nCellsInCoarsestLevel 10; // should be same as minCoarseEqns ???       
agglomerator faceAreaPair; // Apply aggomoration based  of face area rather than matrix coefficients. If done this way one can  save the agglomoration and weights.
mergeLevels 1; //(evident) (what's the difference to groupeSize?)       
};

I am not sure what this parameter means but it is not groupsize. This is between levels but I do not know how openFOAM uses it.




I am thinking that since various multigrids are implemented by various people there might be overlap of some parameters.

About this:

maxIter 500; // is this the max number of V-/W-/F- cylces in one time step?  

This value look to be ridiculously high. Fluent's default value is 30 and perhaps straccm+ default is 50 or also 30. It does not take this many cycles to reach there.

Today i finished implementing coupled multigrid for pressure based coupled solver. It normally takes around 10 cycles to drop error to 1E-5 levels using V cycle. And this problem is supposed to be very difficult to converge.


All times are GMT -4. The time now is 01:12.