CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

best values for GAMG solver (nCellsInCoarsestLevel , nPreSweeps 0, nPostSweeps)

Register Blogs Community New Posts Updated Threads Search

Like Tree11Likes
  • 2 Post By chegdan
  • 2 Post By KateEisenhower
  • 5 Post By Geon-Hong
  • 2 Post By makaveli_lcf

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 5, 2013, 13:52
Default best values for GAMG solver (nCellsInCoarsestLevel , nPreSweeps 0, nPostSweeps)
  #1
Senior Member
 
Join Date: Jun 2011
Posts: 163
Rep Power: 14
mechy is on a distinguished road
what is the best values for GAMG parameters specially for
nCellsInCoarsestLevel , nPreSweeps 0, nPostSweeps

is there a formula to calculate those based on the number of cells ?

Regards
mechy is offline   Reply With Quote

Old   May 9, 2013, 11:17
Default
  #2
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
Try this

http://www.cfd-online.com/Forums/ope...on-meshes.html

There are several other threads, but the settings and concepts from this thread I use with my own simulations.
songwukong and rajibroy like this.
chegdan is offline   Reply With Quote

Old   May 10, 2013, 12:09
Default
  #3
Senior Member
 
Join Date: Jun 2011
Posts: 163
Rep Power: 14
mechy is on a distinguished road
Dear Daniel
thanks so much for your answer.
in most of OF tutorials the value of nCellsInCoarsestLevel is set to 10 (or 20)
but in your link it is set to 500 (or sqrt(#cell))
do you know why OF used the 10 or 20 values ?

Regards
mechy is offline   Reply With Quote

Old   May 10, 2013, 12:23
Default
  #4
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
This is one of those situations where something has been tested and found to work for a particular situation. You can always try the sqrt(ncells), 10, 20, 50 or 100 and then see which one is the best for your case.

I have read that 10 or 20 for larger cases is too low and can be inefficient. Hence why I stay a bit higher with sqrt(nCells). However, its a case by case change.
chegdan is offline   Reply With Quote

Old   May 11, 2013, 12:24
Default
  #5
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 17
kmooney is on a distinguished road
I've seen similar changes in convergence speed by altering the nCellsInCoarsestLevel setting. In once case I had pressure converge twice as fast for a relatively large case @ 600k cells on about 50 processors. I don't have the solver settings on hand unfortunately.

It is definitely worth investigating before starting big parametric or large parallel cases.
kmooney is offline   Reply With Quote

Old   May 12, 2013, 01:09
Default
  #6
Senior Member
 
Join Date: Jun 2011
Posts: 163
Rep Power: 14
mechy is on a distinguished road
Quote:
Originally Posted by chegdan View Post
This is one of those situations where something has been tested and found to work for a particular situation. You can always try the sqrt(ncells), 10, 20, 50 or 100 and then see which one is the best for your case.

I have read that 10 or 20 for larger cases is too low and can be inefficient. Hence why I stay a bit higher with sqrt(nCells). However, its a case by case change.

Hi Daniel

by increasing the nCellsInCoarsestLevel value, the convergency increased but the high value of nCellsInCoarsestLevel may be increase the cpu time for solution
in other word by the high value of nCellsInCoarsestLevel solution converged, certainly
am I right ?

Regards
mechy is offline   Reply With Quote

Old   February 9, 2017, 07:42
Default
  #7
Senior Member
 
Join Date: Mar 2015
Posts: 250
Rep Power: 12
KateEisenhower is on a distinguished road
Quote:
Originally Posted by chegdan View Post
This is one of those situations where something has been tested and found to work for a particular situation. You can always try the sqrt(ncells), 10, 20, 50 or 100 and then see which one is the best for your case.
Does anyone know where this recommendation (nCellsInCoarsestLevel = sqrt(ncells) comes from?

Best regards,

Kate
Artur.Ant and kishore96 like this.
KateEisenhower is offline   Reply With Quote

Old   October 5, 2019, 09:46
Default
  #8
Member
 
Arthur
Join Date: Aug 2014
Location: Italy
Posts: 47
Rep Power: 11
Artur.Ant is on a distinguished road
Remember that the OF tutorials are only demo tutorials. In openFoam there is no default options like in Fluent or any other commercial software; don't take the tutorial options as the one that work for sure!
Artur.Ant is offline   Reply With Quote

Old   October 7, 2019, 05:34
Default
  #9
New Member
 
Trevor Kahan
Join Date: Oct 2019
Posts: 1
Rep Power: 0
trevorkahan is on a distinguished road
In most of OF tutorials the value of nCellsInCoarsestLevel is set to 10 (or 20).
basketball legends
trevorkahan is offline   Reply With Quote

Old   December 10, 2019, 19:26
Default Test on the nCellsInCoarsestLevel value
  #10
Member
 
Geon-Hong Kim
Join Date: Feb 2010
Location: Ulsan, Republic of Korea
Posts: 36
Rep Power: 16
Geon-Hong is on a distinguished road
I tested the parameter nCellsInCoarsestLevel and would like to share it here:

First of all, I tested using a ship simulation case with 5 Mil. Cells., which is a moderately large case. The GAMG solver was used to solve the pressure poisson equation. The test has been conducted three times for each case to measure the elapsed time for the first 100 iterations and then averaged. The domain was decomposed into 64, 128, and 256 subdomains. All the rest parameters, such as nPresweeps, nPostsweeps, etc., remained as the default values. Additionally, I also run the simulation by using a PCG solver with the DIC preconditioner to compare the results.


Code:
Elapsed Time(in seconds):

Solver      256      128        64
-------   -------   -------   -------
PCG        177.88    425.11    987.52
10         953.95   1102.91   1421.36
100       1426.52   1441.30   1592.25
200       1721.87   1657.35   1706.38
400       2043.28   1976.25   1901.76
800       2603.98   2530.56   2274.23
1600      3235.37   3445.93   2897.09
3200      4751.91   4750.79   3962.82
The numbers 10, 100, 200... in the first column are the nCellsInCoarsestLevel. As you can see, the computation took longer as the nCellsInCoarsestLevel increased.

Before I started this test, I expected that there should be an optimum point of the nCellsInCoarsestLevel parameter, but it wasn't. Rather the computational time gradually increased with the parameter. So I doubt if the sqrt(#Cells) is the optimum setup for the nCellsInCoarsestLevel (where does this recommendation come from?)

Even the GAMG solver showed worse performance relative to the DICPCG solver. (So I do not use the GAMG solver any longer)

Interestingly, the GAMG showed less degrade in speed performance than the DICPCG though the number of subdomains increased. Even lower subdomains showed faster performances in cases nCellsInCoarsestLevel>=200.

I hope to discuss this result with you and hear your opinion on it. If you have any suggestions or things to test, please let me know.

Regards,
Geon-Hong
Geon-Hong is offline   Reply With Quote

Old   February 5, 2021, 05:21
Default
  #11
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 250
Blog Entries: 1
Rep Power: 19
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
Nice test Geon-Hong!


I have extended that for my self, and can report you that the optimum here will be which level of tolerance you get.


For my case (some MHD flow) the CG stopped converging and with 400 iterations remained at 1e-07.

Despite faster CG iterations, the GAMG allowed easily to get the convergence to 1e-14 in 15-20 iterations.


So, when comparing GAMG with CG solvers, you should check what you actually get for the solution of your problem.


Cheers,
Alexander





Quote:
Originally Posted by Geon-Hong View Post
I tested the parameter nCellsInCoarsestLevel and would like to share it here:

First of all, I tested using a ship simulation case with 5 Mil. Cells., which is a moderately large case. The GAMG solver was used to solve the pressure poisson equation. The test has been conducted three times for each case to measure the elapsed time for the first 100 iterations and then averaged. The domain was decomposed into 64, 128, and 256 subdomains. All the rest parameters, such as nPresweeps, nPostsweeps, etc., remained as the default values. Additionally, I also run the simulation by using a PCG solver with the DIC preconditioner to compare the results.


Code:
Elapsed Time(in seconds):

Solver      256      128        64
-------   -------   -------   -------
PCG        177.88    425.11    987.52
10         953.95   1102.91   1421.36
100       1426.52   1441.30   1592.25
200       1721.87   1657.35   1706.38
400       2043.28   1976.25   1901.76
800       2603.98   2530.56   2274.23
1600      3235.37   3445.93   2897.09
3200      4751.91   4750.79   3962.82
The numbers 10, 100, 200... in the first column are the nCellsInCoarsestLevel. As you can see, the computation took longer as the nCellsInCoarsestLevel increased.

Before I started this test, I expected that there should be an optimum point of the nCellsInCoarsestLevel parameter, but it wasn't. Rather the computational time gradually increased with the parameter. So I doubt if the sqrt(#Cells) is the optimum setup for the nCellsInCoarsestLevel (where does this recommendation come from?)

Even the GAMG solver showed worse performance relative to the DICPCG solver. (So I do not use the GAMG solver any longer)

Interestingly, the GAMG showed less degrade in speed performance than the DICPCG though the number of subdomains increased. Even lower subdomains showed faster performances in cases nCellsInCoarsestLevel>=200.

I hope to discuss this result with you and hear your opinion on it. If you have any suggestions or things to test, please let me know.

Regards,
Geon-Hong
Geon-Hong and Tobi like this.
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Metallurgical Applications of Magnetohydrodynamics"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[waves2Foam] Waves2Foam Related Topics ngj OpenFOAM Community Contributions 660 August 20, 2018 12:39
Using a user-defined solver in OF ozzythewise OpenFOAM Running, Solving & CFD 3 February 8, 2011 15:28
CFX 5.5 Roued CFX 1 October 2, 2001 16:49
Setting a B.C using UserFortran in 4.3 tokai CFX 10 July 17, 2001 16:25
Error during Solver cfd guy CFX 4 May 8, 2001 06:04


All times are GMT -4. The time now is 08:13.