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

Time in OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 16, 2009, 21:37
Red face Time in OpenFOAM
  #1
Senior Member
 
Eric Nutsch
Join Date: Sep 2009
Location: Eugene, Oregon USA
Posts: 113
Rep Power: 16
ericnutsch is on a distinguished road
Send a message via Skype™ to ericnutsch
In steady state simulations the time really isnt important. Basicaly your best solution is the most recent time stamp.

But when you get into time dependent simulations how do you get all of your time steps to be of equal accuracy?


Fluent would let you define the accptable amount of error per time step and would itterate that timestep until it was within range then moved on to the next one.

How does OpenFOAM go about this? Is it different for each solver?

Thanks!
ericnutsch is offline   Reply With Quote

Old   December 17, 2009, 00:00
Default
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by ericnutsch View Post
In steady state simulations the time really isnt important. Basicaly your best solution is the most recent time stamp.

But when you get into time dependent simulations how do you get all of your time steps to be of equal accuracy?


Fluent would let you define the accptable amount of error per time step and would itterate that timestep until it was within range then moved on to the next one.

How does OpenFOAM go about this? Is it different for each solver?

Thanks!
In unsteady solvers based on the PISO algorithm you do not have such an approach. If you use an adaptive time step, the step size is controlled by the CFL condition. You assume implicitly that the time step is small enough to ensure convergence and accuracy.

In transient solvers using the PIMPLE/unsteady SIMPLE approach you can specify a number of sub-iterations per time step.

In all the cases, there is no explicit control on the residuals, which however can be easily added. Residuals can be retrieved easily defining a "solverPerformance" object
Code:
lduMatrix::solverPerformance sp;
then when you solve the equation just write
Code:
sp = solve ( /* Your equation here */);
and you will be able to retrieve the initial (you want the initial, not the final residual of the linear solver for your purpose) residual of each iteration with
Code:
sp.initialResidual()
Repeating this for all the equations you solve, and with some modification to the code you want to use, you can reproduce what is done in commercial codes

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   December 17, 2009, 12:48
Default
  #3
Senior Member
 
Eric Nutsch
Join Date: Sep 2009
Location: Eugene, Oregon USA
Posts: 113
Rep Power: 16
ericnutsch is on a distinguished road
Send a message via Skype™ to ericnutsch
Using the CFL condition to set the delta T seems like a good approach.

(U * deltaT)/deltaX < Courant <1

So for 10m/s and 1mm resolution, the time step must be less than 0.0001. Simple enough. So if i am going to solve a transient problem, do i have to initialize with a steady state solution? or do i just disregard the first 50 or so time steps?

Wikipedia also presents a two-dimensional equation. Does this equation need to be used for 2D problems or can I just use the magnitude (a^2 + b^2 = c^2) of the vectorial flow in the 1D equation?


I will try out your residual control code as I get further along in my project. Why do i want to view the initial residuals instead of the final ones?


Thanks for your post Alberto, it was most helpful!
ericnutsch is offline   Reply With Quote

Old   December 18, 2009, 07:12
Default
  #4
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by ericnutsch View Post
Using the CFL condition to set the delta T seems like a good approach.

(U * deltaT)/deltaX < Courant <1

So for 10m/s and 1mm resolution, the time step must be less than 0.0001. Simple enough. So if i am going to solve a transient problem, do i have to initialize with a steady state solution? or do i just disregard the first 50 or so time steps?
An unsteady simulation is, after a sufficient time, independent from the initial condition, so you can use what you prefer. If your case admits a steady state, you should probably use a steady solver, if it doesn't, start from a physically sound initial condition, and start averaging when the flow is completely developed if you need averaged profiles.

Quote:
Wikipedia also presents a two-dimensional equation. Does this equation need to be used for 2D problems or can I just use the magnitude (a^2 + b^2 = c^2) of the vectorial flow in the 1D equation?
Just set the maximum Courant number you want to use, and turn the adaptive time step on

Quote:
I will try out your residual control code as I get further along in my project. Why do i want to view the initial residuals instead of the final ones?
Because you want the initial residual to become smaller in each time step, since if this happens, it means you are getting closer to your solution.
The "final" residual returned by solverPerformance is very small anyway, since it is the residual the linear solver returns after solving the linear system.

Quote:
Thanks for your post Alberto, it was most helpful!
You're welcome

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   December 18, 2009, 18:52
Default using adaptive time step?
  #5
Senior Member
 
Eric Nutsch
Join Date: Sep 2009
Location: Eugene, Oregon USA
Posts: 113
Rep Power: 16
ericnutsch is on a distinguished road
Send a message via Skype™ to ericnutsch
How do i "turn the adaptive time step on "?


I read this forum: http://www.cfd-online.com/Forums/ope...estepping.html

It said to include readTimeControls.H, CourantNo.H and setDeltaT.H, but it was a little brief. Turning it "on" sounds a lot more friendly. Could you please explain.


Thanks again for your help Alberto!
ericnutsch is offline   Reply With Quote

Old   December 18, 2009, 19:02
Default
  #6
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
What solver are you using?

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   December 18, 2009, 22:52
Default
  #7
Senior Member
 
Eric Nutsch
Join Date: Sep 2009
Location: Eugene, Oregon USA
Posts: 113
Rep Power: 16
ericnutsch is on a distinguished road
Send a message via Skype™ to ericnutsch
Though i have not started this simulation yet, i currently plan to use pisoFoam.

I am planning on using a rotating reference frame so my solver may change in order to accommodated that aspect.

Lots of variables to consider when your getting started

Thanks again Alberto!
ericnutsch is offline   Reply With Quote

Old   December 18, 2009, 23:30
Default
  #8
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
To "turn" the adaptive time step on in pisoFoam add

Code:
adjustTimeStep  yes;

maxCo           1;

maxDeltaT       1e-03;
in controlDict.

Of course the values of Co (Courant number) and the maximum time step are examples.

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   December 18, 2009, 23:39
Default
  #9
Senior Member
 
Eric Nutsch
Join Date: Sep 2009
Location: Eugene, Oregon USA
Posts: 113
Rep Power: 16
ericnutsch is on a distinguished road
Send a message via Skype™ to ericnutsch
Thanks for all the excellent help Alberto!

I will give your code a try
ericnutsch is offline   Reply With Quote

Old   August 24, 2016, 08:19
Default
  #10
New Member
 
larmes
Join Date: Aug 2016
Posts: 26
Rep Power: 9
yeya is on a distinguished road
Quote:
Originally Posted by ericnutsch View Post
In steady state simulations the time really isnt important. Basicaly your best solution is the most recent time stamp.
why is the most recent the best solution in steady states?
yeya is offline   Reply With Quote

Old   August 25, 2016, 03:16
Default
  #11
Senior Member
 
Eric Nutsch
Join Date: Sep 2009
Location: Eugene, Oregon USA
Posts: 113
Rep Power: 16
ericnutsch is on a distinguished road
Send a message via Skype™ to ericnutsch
By definition, a steady state solution does not consider time. If said conditions exist for infinite time I will arrive at an unchanging "steady state".

A better phrasing would be: "your solution is the most recent iteration as it has undergone the most iterations and will be most accurate." Many solvers use a timestep variable to track iterations to get to steady state.
ericnutsch is offline   Reply With Quote

Old   June 21, 2017, 22:29
Default Bug in openfoam simulation
  #12
New Member
 
Golden
Join Date: Jun 2017
Posts: 4
Rep Power: 8
goldersantu is on a distinguished road
Hello everyone, I am doing a simple jet combustion with the following boundary. The mesh was converted to FOAM. The simulation runs. But it is showing, Pimple iteration 1: and it is not converged. The system directory was same to basic tutorial. Do i need to change fvscheme directory and solution directory or anything?
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.4.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
4
(
outlet
{
type patch;
nFaces 6416;
startFace 7736555;
}
sides
{
type wall;
inGroups 1(wall);
nFaces 64638;
startFace 7742971;
}
base
{
type patch;
inGroups 1(patch);
nFaces 6292;
startFace 7807609;
}
inlet
{
type patch;
nFaces 6;
startFace 7813901;
}
)
// ************************************************** *********************** //




goldersantu is offline   Reply With Quote

Old   September 25, 2017, 18:02
Default
  #13
New Member
 
Patrick
Join Date: Apr 2016
Posts: 10
Rep Power: 9
linox is on a distinguished road
Quote:
Originally Posted by ericnutsch View Post
By definition, a steady state solution does not consider time. If said conditions exist for infinite time I will arrive at an unchanging "steady state".

A better phrasing would be: "your solution is the most recent iteration as it has undergone the most iterations and will be most accurate." Many solvers use a timestep variable to track iterations to get to steady state.
Hi Eric,

I just stumbled onto this thread you posted last year. I am relatively new with OpenFoam. I use steady state solver for channel flow simulation. Normally I will expect the computation to complete after convergence (depending on the residual control value, usually in the order of 10^-5) or when i dont notice reasonable changes in flow distribution from one time step to the next.

But from your statement, am i right to deduce that convergence is not necessary? In which case, what could be a reasonable iteration time for steady state computation if one is not aiming for convergence?

Thanks for time
Patrick
linox 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
Time step size and max iterations per time step pUl| FLUENT 33 October 23, 2020 22:50
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 05:36
air bubble is disappear increasing time using vof xujjun CFX 9 June 9, 2009 07:59
DPM UDF particle position using the macro P_POS(p)[i] dm2747 FLUENT 0 April 17, 2009 01:29
The OpenFOAM extensions project mbeaudoin OpenFOAM 16 October 9, 2007 09:33


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