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

When should i stop simulation!?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By val46

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 28, 2011, 09:33
Question When should i stop simulation!?
  #1
Member
 
David
Join Date: Aug 2010
Location: North Ossetia, Vladikavkaz
Posts: 30
Rep Power: 16
davidmd is on a distinguished road
Send a message via ICQ to davidmd
Good day, All!

I use MRFSimpleFoam based solver, and I have a questions: When do I need to stop the simulation?

How do I know that the solution persisted?

How to write a condition in the solver, so that when it reach a certain level of accuracy a decision to stop. (of course if it's possible )

I would be very grateful to all who answer me!!!
__________________
davidmd
davidmd is offline   Reply With Quote

Old   March 28, 2011, 09:51
Default
  #2
Member
 
Samuel ARNAUD
Join Date: Feb 2011
Location: Grenoble, FRANCE
Posts: 39
Rep Power: 15
sixwp is on a distinguished road
Hi David,

use:
Code:
pyFoamPlotRunner.py MRFSimpleFoam
you'll have residuals and continuity graphs.

Regards
__________________
Sam
sixwp is offline   Reply With Quote

Old   March 28, 2011, 10:26
Default
  #3
Member
 
David
Join Date: Aug 2010
Location: North Ossetia, Vladikavkaz
Posts: 30
Rep Power: 16
davidmd is on a distinguished road
Send a message via ICQ to davidmd
Quote:
Originally Posted by sixwp View Post
Hi David,

use:
Code:
pyFoamPlotRunner.py MRFSimpleFoam
you'll have residuals and continuity graphs.

Regards
sixwp, thanks for responding!

But I do not know what is pyFoamPlotRunner.py :-( Where can I find itself, and manual for it? And what is the functionality of pyFoamPlotRunner.py?
will this help me to stop the solver on the condition of achievement a given accuracy?

I would really appreciate if you answer!
__________________
davidmd

Last edited by davidmd; March 28, 2011 at 10:30. Reason: forgot one question :)
davidmd is offline   Reply With Quote

Old   March 28, 2011, 11:55
Default
  #4
Member
 
Join Date: Nov 2010
Posts: 41
Rep Power: 15
grjmell is on a distinguished road
http://openfoamwiki.net/index.php/Contrib_PyFoam
grjmell is offline   Reply With Quote

Old   March 28, 2011, 17:05
Default
  #5
Member
 
David
Join Date: Aug 2010
Location: North Ossetia, Vladikavkaz
Posts: 30
Rep Power: 16
davidmd is on a distinguished road
Send a message via ICQ to davidmd
So I install it, and now try to start solving my case with this:

Code:
python '/home/davidmd/src/PyFoam-0.5.4/bin/pyFoamPlotRunner.py' ReMRFSimpleFoam '/home/davidmd/OpenFOAM/davidmd-1.7.0/work/' NF2
"ReMRFSimpleFoam" - is my solver "NF2" - is my case

and got this:
Code:
Traceback (most recent call last):
  File "/home/davidmd/src/PyFoam-0.5.4/bin/pyFoamPlotRunner.py", line 3, in <module>
    from PyFoam.Applications.PlotRunner import PlotRunner
  File "/usr/local/lib/python2.6/dist-packages/PyFoam/Applications/PlotRunner.py", line 7, in <module>
    from PyFoam.Execution.GnuplotRunner import GnuplotRunner
  File "/usr/local/lib/python2.6/dist-packages/PyFoam/Execution/GnuplotRunner.py", line 49
    self.plotIter=GnuplotTimelines(self.getAnalyzer("PlotIterations").lines,persist=persist,with="steps")
                                                                                               ^
SyntaxError: invalid syntax
Where is my mistake?


Now I try to rename variable "with" in GnuplotRunnr.py and now i have this:


Code:
davidmd@rootpc ~/OpenFOAM/davidmd-1.7.0/work/NF2 $ python '/home/davidmd/src/PyFoam-0.5.4/bin/pyFoamPlotRunner.py' 'ReMRFSimpleFoam' '/home/davidmd/OpenFOAM/davidmd-1.7.0/work/' 'NF2'
/usr/local/lib/python2.6/dist-packages/PyFoam/Execution/FoamThread.py:3: DeprecationWarning: The popen2 module is deprecated.  Use the subprocess module.
  from popen2 import Popen4

Usage: ReMRFSimpleFoam [-parallel] [-case dir]  [-help] [-doc] [-srcDoc]



--> FOAM FATAL ERROR:
Wrong number of arguments, expected 0 found 2


FOAM exiting
What am I doing wrong?
__________________
davidmd

Last edited by davidmd; March 28, 2011 at 18:30.
davidmd is offline   Reply With Quote

Old   March 29, 2011, 04:32
Default
  #6
Member
 
Join Date: Nov 2010
Posts: 41
Rep Power: 15
grjmell is on a distinguished road
Make sure you have done the required under points 3.2 adn 3.5 of the above link. Copy paste the PATHs into your ~/.bashrc file. then test the installation (point 3.5), then you dont have to give the entire path to the py-utility you are using.
if your installation test is negative, then it wont work...

the correct syntax to run a case is (from inside your case directory)

pyFoamPlotRunner.py nameOfSolver, e.g. pyFoamPlotRunner.py pisoFoam
grjmell is offline   Reply With Quote

Old   March 29, 2011, 05:29
Default
  #7
Member
 
Join Date: Nov 2009
Location: Germany
Posts: 96
Rep Power: 17
val46 is on a distinguished road
Hi David,

there are different (and easier) ways...
1. You can use gnuplot to plot the residuals (look here)
2. You should monitor important points in your modell. (easily done in controlDict --> you will find an example in the pimpleFoam/t-junction tutorial)
3. You can also monitor the pressure force on specific patches/walls --> also done in controlDict --> example in tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_simpleFoam)


I for myself use all 3 of them to make sure my solution is converged

Regards,
Toni
Gowe1234 likes this.
val46 is offline   Reply With Quote

Old   March 29, 2011, 06:48
Default
  #8
Member
 
David
Join Date: Aug 2010
Location: North Ossetia, Vladikavkaz
Posts: 30
Rep Power: 16
davidmd is on a distinguished road
Send a message via ICQ to davidmd
Thank you, grjmell! I really found PyFoam was setup wrong. Now I got the graphics! Something like these:

But how can I now determine when to stop the calculation? I see that it is converges.
I should just independently decide when I'm quitting?
Oh, and can someone tell me what I have to deal with pressure? Why is it jumping?

val46, thank you very much for your reply! However, I have tried so far only the first way and I have something wrong in the chart with the pressure. Perhaps the fact that I use 3 nonOrthogonalCorrectors and I get something like this


And once again thank you, that you answered!
__________________
davidmd
davidmd is offline   Reply With Quote

Old   March 29, 2011, 08:14
Default
  #9
Member
 
David
Join Date: Aug 2010
Location: North Ossetia, Vladikavkaz
Posts: 30
Rep Power: 16
davidmd is on a distinguished road
Send a message via ICQ to davidmd
Quote:
Originally Posted by davidmd View Post
val46, thank you very much for your reply! However, I have tried so far only the first way and I have something wrong in the chart with the pressure.

I figured, just a little rewrote solver! Thank you!

But how to make the solver stopped himself when a certain accuracy reached? Which is the best parameter to determine the convergence of the solution inside of the solver?
__________________
davidmd
davidmd is offline   Reply With Quote

Old   March 30, 2011, 05:52
Default
  #10
Member
 
Join Date: Nov 2009
Location: Germany
Posts: 96
Rep Power: 17
val46 is on a distinguished road
Quote:
But how to make the solver stopped himself when a certain accuracy reached? Which is the best parameter to determine the convergence of the solution inside of the solver?
Hi David,

as I said, I would recommend you to monitor points. The reason is sometimes you have a good solution when all residuals reach 10^-3 and sometimes its not even converged when you reach 10^-6.

So to answer your question:
The best parameter to determine the convergence of the solution is NOT the residual, its the velocity, pressure or temperature of certain points within your domain.

Regards,
Toni
val46 is offline   Reply With Quote

Old   March 30, 2011, 08:56
Default
  #11
Member
 
longamon's Avatar
 
David Aljure
Join Date: Mar 2011
Location: CTTC Universidad Politécnica de Catalunya. Spain
Posts: 38
Rep Power: 15
longamon is on a distinguished road
My opinion in this subject, hope it helps:

If its a laminar case with a steady state solution, then residual is a good way to know when to stop. You could also check that stady state has been reached by checking that velocity isn't changing in time.

There's also laminar cases that don't reach a stady state (such as flow over bodies past a critical Re), instead they reach a periodic state. For this its usefull to use averages and check to see if the averaged solution reach a steady state.

Turbulent cases are a bit different, if you're using RANS models, then the average steady state may be reached. Usually you have to check several conditions, for this what val46 is very usefull. Plot a map of velocity over time at certain points, then, you'll see the behaviour of the velocity. There'll be a first transition period and a statistically stationary period. When you're in the statistically stationary period you should choose an integration time long enough so that your parameters are satisfactory.

If your case is turbulent I recomend you check a turbulent flow book. Turbulent Flows by Stephen B. Pope is quite good.

I have used 2 tools in OF to check the behaviour of my case, probes and fieldAverages. They are configured in the controlDict:

functions
{
probes
{
type probes;
functionObjectLibs ("libsampling.so");
enabled true;
outputControl timeStep;
outputInterval 10;
probeLocations
(
( 8.55 0.5 3 )
);

fields
(
U
);
}
fieldAverage1
{
type fieldAverage;
functionObjectLibs ( "libfieldFunctionObjects.so" );
enabled true;
outputControl outputTime;
outputInterval 100;
fields
(
U
{
mean on;
prime2Mean on;
base time;
}

p
{
mean on;
prime2Mean off;
base time;
}
);
}
}

Remember that averages should be enabled (for turbulent flows) once a statistically stationary state has been reached.
longamon is offline   Reply With Quote

Old   April 2, 2011, 06:22
Default
  #12
Member
 
David
Join Date: Aug 2010
Location: North Ossetia, Vladikavkaz
Posts: 30
Rep Power: 16
davidmd is on a distinguished road
Send a message via ICQ to davidmd
Many thanks to all who replied. I have no more questions!
__________________
davidmd
davidmd is offline   Reply With Quote

Old   May 16, 2017, 19:22
Default
  #13
New Member
 
Raquel Faria
Join Date: Sep 2011
Posts: 2
Rep Power: 0
Kelly is on a distinguished road
Quote:
Originally Posted by davidmd View Post
I figured, just a little rewrote solver! Thank you!

But how to make the solver stopped himself when a certain accuracy reached? Which is the best parameter to determine the convergence of the solution inside of the solver?
Sorry davidmd, i'm starting using transient solver and I had the same problem with the residuals. Can you please tell me what did you do to solve the pressure jumping.

Best regards,
Kelly
Kelly is offline   Reply With Quote

Reply

Tags
condition, steady-state, stop simulation


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
Solar Radiation in OpenFOAM plainstyle OpenFOAM Running, Solving & CFD 15 July 8, 2014 05:43
velocity profile export from a simulation onto another sudhirlv STAR-CCM+ 1 September 12, 2010 19:57
Solver STOP with a variable Roland R CFX 3 March 10, 2010 19:38
How stop simulation if convergence is not reached? Andreas FLUENT 0 October 16, 2007 13:35
strange simulation error Ralf Schmidt FLUENT 2 May 4, 2007 14:02


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