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

Adaptive timestepping

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 28, 2008, 15:20
Default Hi, I'm thinking of using t
  #1
Member
 
Ola Widlund
Join Date: Mar 2009
Location: Sweden
Posts: 87
Rep Power: 17
olwi is on a distinguished road
Hi,

I'm thinking of using the standard features for adaptive timestepping (found in finiteVolume library, an used in some standard solvers) in one of my own solvers.

These standard features are based on keeping a certain max Courant number. Is the Courant number the only sensible criterion?

If my transient solution is approching a steady state, the Courant number does not necessarily decrease (?), but with an implicit time scheme it should still be possible to increase the timestep dramatically, without much loss of accuracy. Or?

Thanks in advance for any comments,

Ola
olwi is offline   Reply With Quote

Old   February 29, 2008, 10:34
Default Hi Ola, Time step criterion
  #2
Member
 
Elisabet Mas de les Valls
Join Date: Mar 2009
Location: Barcelona, Spain
Posts: 64
Rep Power: 17
elisabet is on a distinguished road
Hi Ola,

Time step criterion is a key aspect, despite the fact that not always is deeply considered. If you are using an implicit time scheme you would not have stability problems, however, if you are interested in an accurate transient simulation, time step is crucial (your time step should allow you to observe main details of fluid evolution).
The criterion depends on the equation you are solving, that is, on the characteristic flow evolution (inertia, diffusion, Lorentz, etc.). The Courant number (CFL) is obtained from stability analysis considering only inertial effects. In general this criterion is enough. If you are using RANS models, your effective viscosity might be considerable, thus, the diffusive criterion should also be considered. If you have any other phenomenon included in your fluid, as for example, electromagnetics, it might also be necessary to consider it.

You might also take care on considering which is the maximum Courant number (or other criterion) you take. It depends on the numerical schemes you work with. To obtain a more detailed overview about it, I would suggest you to reed 'Joe D. Hoffman. Numerical Methods for Engineers and Scientists'.

Finally, when you are arriving at the steady state, you will see that, for a fixed Courant number the time step obtained is constant (due to no changes in fluid variables along the time).

Hope it helps!

Regards,

elisabet
elisabet is offline   Reply With Quote

Old   March 8, 2008, 12:19
Default Hi Elisabet, Thanks for you
  #3
Member
 
Ola Widlund
Join Date: Mar 2009
Location: Sweden
Posts: 87
Rep Power: 17
olwi is on a distinguished road
Hi Elisabet,

Thanks for your reply. You have a really good point in considering WHICH courant number to focus on, when there's many physical mechanisms in play. I'll look for Hoffman's book, too.

I have now implemented the OF features for adjustable time-stepping (used in some of the standard OF solvers), which adjusts the timestep to keep constant Courant number. Based on your suggestion, I computed a Courant number for the "fastest" of the physical mechanisms in my problem (transport of free electrons in this case). The time-step adjustment works really well.

I also implemented an inner iteration loop within the time step loop (see separate post), so I can make sure the non-linear coupling between the equations is properly converged in each time step. In that loop, I apply the OF under-relaxation features for one of the source terms. It works wonders...

I've varied my Courant number between 0.2 and 2. I see that it does not necessarily pay to have large Co and advance faster in time, because it just means I need to do more non-linear iterations in each time-step to stabilize the non-linear coupling...

Best regards,

Ola
olwi is offline   Reply With Quote

Old   March 13, 2008, 14:09
Default Hi Ola, Does your simulatio
  #4
Member
 
Elisabet Mas de les Valls
Join Date: Mar 2009
Location: Barcelona, Spain
Posts: 64
Rep Power: 17
elisabet is on a distinguished road
Hi Ola,

Does your simulation reach the steady state at the same time when using different Courant numbers?

elisabet
elisabet is offline   Reply With Quote

Old   February 13, 2009, 04:56
Default Hello, I am not able to fig
  #5
Senior Member
 
Rishi .
Join Date: Mar 2009
Posts: 149
Rep Power: 17
hellorishi is on a distinguished road
Hello,

I am not able to figure out, how to use adaptive time stepping in my solver. I extended turbFoam solver from OF-1.5, with two scalar transport(say red water and blue water) to see the mixing of two inlet flows in a T-section.

Currently I using a time-step of 0.001 and getting max Co number of the order of ~0.001. If I increase the time-step to 0.01 or 0.005 the Co number increases drastically and solver aborts (in 3-4 time steps). Hence I was considering the use of adaptive time stepping scheme. However I could not find anything explaining this in UserGuide or ProgGuide or wiki. The closest I came with google is this thread...

There is one file in ../OpenFoam-1.5/src/finiteVolume/cfdtools/incompressible/CourantNo.H
I could not figure out much from that... Please shed some light on adaptive time stepping.

Thanks
Rishi
hellorishi is offline   Reply With Quote

Old   February 13, 2009, 08:32
Default Hi Rishi, The procedure is
  #6
Member
 
Elisabet Mas de les Valls
Join Date: Mar 2009
Location: Barcelona, Spain
Posts: 64
Rep Power: 17
elisabet is on a distinguished road
Hi Rishi,

The procedure is always the same. You need 3 include files: readTimeControls.H, CourantNo.H and setDeltaT.H. The latest two include files must be located inside your time loop in order to first evaluate the actual Courant and, from this result, define the new time step.

The include setInitialDeltaT.H is optional.

See for example icoDyMFoam (in .dep file you will find the location of the included files and read what they do)

Good luck!

elisabet
elisabet is offline   Reply With Quote

Old   August 3, 2010, 08:52
Default
  #7
New Member
 
Jochem
Join Date: May 2010
Posts: 28
Rep Power: 15
Jochem is on a distinguished road
Hi,

I also want to use an adaptive timestepping. I've read the discussion above and I've tried to do this but it doesn't work.

I am not sure where you have to change this. I've included the 3 files in OpenFoam-1.6x/applications/solvers/incompressible/simpleFoam/simpleFoam.C because I'm using the simpleFoam solver. After this i've included 2 files (CourantNo.H and setDeltaT.H) in the time loop.

Is this correct or do i have to include the files somewhere else?

Regards,

Jochem
Jochem is offline   Reply With Quote

Old   August 3, 2010, 09:51
Default
  #8
New Member
 
Jochem
Join Date: May 2010
Posts: 28
Rep Power: 15
Jochem is on a distinguished road
Hi,

I found out that you still have to do a command to "load" the "new" solver using the "wmake" command. When i do this i get the following error :

cpp: Internal error: Floating point exception (program cc1)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [linux64GccDPOpt/options] Error 1
cpp: Internal error: Floating point exception (program cc1)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [linux64GccDPOpt/files] Error 1
wmake error: file 'Make/linux64GccDPOpt/objectFiles' could not be created

For clarity I also post the simpleFoam.C file. It looks like this :

#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "RASModel.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "initContinuityErrs.H"
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;


while (runTime.run())
{
Info<< "Time = " << runTime.timeName() << nl << endl;

#include "readSIMPLEControls.H"
#include "initConvergenceCheck.H"
#include "CourantNo.H"
#include "setDeltaT.H"

runTime++;

p.storePrevIter();

// Pressure-velocity SIMPLE corrector
{
#include "UEqn.H"
#include "pEqn.H"
}

turbulence->correct();

runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;

#include "convergenceCheck.H"
}

Info<< "End\n" << endl;

return 0;
}


Can someone tell my what i am doing wrong?

Regards,

Jochem
Jochem 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
Q. Adaptive mesh help Emad FLUENT 0 January 29, 2009 06:42
Adaptive mesh help please Emad FLUENT 0 January 18, 2009 18:09
Dual timestepping harly OpenFOAM Running, Solving & CFD 0 January 9, 2009 16:48
How to switch of Timestepping Information TobiasZ CFX 5 December 12, 2005 08:47
adaptive timestepping techniques Sharks Main CFD Forum 0 April 21, 2003 09:25


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