CfdOF default maxCo/maxAlphaCo in controlDict
Moderator: oliveroxtoby
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
CfdOF default maxCo/maxAlphaCo in controlDict
For transient analysis, it is useful to be able to change the fields in controlDict for maxCo and maxAlphaCo. Documentation recommends < 0.7 but the default seems to be 5 which seems very high and there doesn't seem to be a way to change it other than manually editing controlDict. Am I missing something?
Also, Convergence Tol does not allow for small residuals (e.g. 1e-4). The toggle up/down steps in integer values which is much too large for residuals.
Also, Convergence Tol does not allow for small residuals (e.g. 1e-4). The toggle up/down steps in integer values which is much too large for residuals.
- oliveroxtoby
- Posts: 812
- Joined: Fri Dec 23, 2016 9:43 am
- Location: South Africa
Re: CfdOF default maxCo/maxAlphaCo in controlDict
There are various settings which can be changed in combination and the idea is to have a default which gives decent computational time as well as being robust and sufficintly accurate. The philosophy is not to expose potentially baffling settings to the user unless it's really necessary. Are you finding that the defaults don't work for your use case?markinca wrote: ↑Mon May 01, 2023 7:57 pm For transient analysis, it is useful to be able to change the fields in controlDict for maxCo and maxAlphaCo. Documentation recommends < 0.7 but the default seems to be 5 which seems very high and there doesn't seem to be a way to change it other than manually editing controlDict. Am I missing something?
You can use the 'expression editor' at the far right when changing the value to input smaller values than the FreeCAD number of decimal places. I think we're limited here by how FreeCAD format numbers in the data panel, and I'm not actually sure if that can be changed.Also, Convergence Tol does not allow for small residuals (e.g. 1e-4). The toggle up/down steps in integer values which is much too large for residuals.
Re: CfdOF default maxCo/maxAlphaCo in controlDict
Thanks for the response.
The simulation appears to be stable but I am more concerned about accuracy. From what I have read, large current numbers can result in inaccurate results especially in highly turbulent flow multiphase transient analyses.
https://www.simscale.com/knowledge-base ... nt-number/
The simulation appears to be stable but I am more concerned about accuracy. From what I have read, large current numbers can result in inaccurate results especially in highly turbulent flow multiphase transient analyses.
https://www.simscale.com/knowledge-base ... nt-number/
So when the maxCo value is set to 5, was this calculated from the simulation inputs or is it always set 5 no matter what?For transient multiphase runs, keep the maximum Courant number smaller than 1. For other analysis types, using a maximum Courant number larger than 1 is possible/desired, as long as the best practices for accuracy and stability (above) are observed
Re: CfdOF default maxCo/maxAlphaCo in controlDict
If anyone is interested, you can change the default templates of CfdOF for any of the openfoam input files from this folder:
C:\Users\user\AppData\Roaming\FreeCAD\Mod\CfdOF\Data\Templates\case\system
I set maxCO and maxAlphaCo to default to 0.7 instead of 5.
C:\Users\user\AppData\Roaming\FreeCAD\Mod\CfdOF\Data\Templates\case\system
I set maxCO and maxAlphaCo to default to 0.7 instead of 5.
Re: CfdOF default maxCo/maxAlphaCo in controlDict
So I just wanted to show you what the impact is for courant number. These two pictures of flow mixture (water and air) are for the same time period but one has a courant of 5 and the other 1. If you will notice that the 5 version has air inside the venturi nozzle which should not be there. So the high courant number is creating a lot of error. The type of simulation is very critical when choosing courant number so courant should really be an explicit input.
Courant=5 Courant=1
Courant=5 Courant=1
- oliveroxtoby
- Posts: 812
- Joined: Fri Dec 23, 2016 9:43 am
- Location: South Africa
Re: CfdOF default maxCo/maxAlphaCo in controlDict
Fair enough. I have added them as settings in the solver object.markinca wrote: ↑Wed May 10, 2023 2:11 pm So I just wanted to show you what the impact is for courant number. These two pictures of flow mixture (water and air) are for the same time period but one has a courant of 5 and the other 1. If you will notice that the 5 version has air inside the venturi nozzle which should not be there. So the high courant number is creating a lot of error. The type of simulation is very critical when choosing courant number so courant should really be an explicit input.
Would you perhaps be willing to share this case setup? It would be a helpful example to use in improving the default settings.
Re: CfdOF default maxCo/maxAlphaCo in controlDict
Attached is the project.
Note that I have another thread regarding this project here:
viewtopic.php?style=5&t=78096&sid=81099 ... c1d9db4866
The problem is that CFDof or FreeCad stops responding after several minutes of run time so you may need to kill FreeCAD at some point. If you don't, then memory is quickly consumed and the PC will run out of memory. I have 32GB of RAM. I believe there is a memory leak somewhere.
Thanks
Note that I have another thread regarding this project here:
viewtopic.php?style=5&t=78096&sid=81099 ... c1d9db4866
The problem is that CFDof or FreeCad stops responding after several minutes of run time so you may need to kill FreeCAD at some point. If you don't, then memory is quickly consumed and the PC will run out of memory. I have 32GB of RAM. I believe there is a memory leak somewhere.
Thanks
- Attachments
-
- Spa_Jet_TR.FCStd
- (59.32 KiB) Downloaded 34 times
- oliveroxtoby
- Posts: 812
- Joined: Fri Dec 23, 2016 9:43 am
- Location: South Africa
Re: CfdOF default maxCo/maxAlphaCo in controlDict
I have one follow up question regarding this topic.
One thing that I noticed is that in the fvSolution file, nOuterCorrectors is always set to 1. From what I understand, when performing transient analysis, this means that PISO is always used instead of the PIMPLE algorithm. According to the following documentation, if you use a courant higher than 1 (default=5), you should be using the PIMPLE algorithm with nOuterCorrectors > 1:
https://openfoamwiki.net/index.php/Open ... OAM#Case_C
PIMPLE is useful in that it basically turns an explicit solution into an implicit solution and significantly reduces processing time.
Is my understanding correct?
One thing that I noticed is that in the fvSolution file, nOuterCorrectors is always set to 1. From what I understand, when performing transient analysis, this means that PISO is always used instead of the PIMPLE algorithm. According to the following documentation, if you use a courant higher than 1 (default=5), you should be using the PIMPLE algorithm with nOuterCorrectors > 1:
https://openfoamwiki.net/index.php/Open ... OAM#Case_C
PIMPLE is useful in that it basically turns an explicit solution into an implicit solution and significantly reduces processing time.
Is my understanding correct?
- oliveroxtoby
- Posts: 812
- Joined: Fri Dec 23, 2016 9:43 am
- Location: South Africa
Re: CfdOF default maxCo/maxAlphaCo in controlDict
Yesmarkinca wrote: ↑Sun May 14, 2023 2:26 pm I have one follow up question regarding this topic.
One thing that I noticed is that in the fvSolution file, nOuterCorrectors is always set to 1. From what I understand, when performing transient analysis, this means that PISO is always used instead of the PIMPLE algorithm.
I'm not sure I agree that there is a hard-and-fast Co < 1 limit for PISO. That is the stability limit for an entirely explicit scheme, but PISO has implicit aspects to it. The same applies to the implicit MULES scheme use for the alpha advection - Co < 1 isn't required as a stability limit, although it does improve accuracy.According to the following documentation, if you use a courant higher than 1 (default=5), you should be using the PIMPLE algorithm with nOuterCorrectors > 1:
https://openfoamwiki.net/index.php/Open ... OAM#Case_C
You are only likely to see a gain in processing time if taking much larger time steps. (5 correctors with Co = 5 costs the same as a PISO solution with Co = 1, so no great advantage there.)PIMPLE is useful in that it basically turns an explicit solution into an implicit solution and significantly reduces processing time.
I tried to select the current defaults to give decent accuracy and processing time while being as hands-off as possible for the user, but this was an initial estimate that I'm sure can be improved upon. It's not an easy task though as there are tradeoffs.