
[Sponsors] 
February 28, 2008, 16:20 
Hi,
I'm thinking of using t

#1 
Member
Ola Widlund
Join Date: Mar 2009
Location: Sweden
Posts: 87
Rep Power: 9 
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 

February 29, 2008, 11:34 
Hi Ola,
Time step criterion

#2 
Member
Elisabet Mas de les Valls
Join Date: Mar 2009
Location: Barcelona, Spain
Posts: 63
Rep Power: 9 
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 

March 8, 2008, 13:19 
Hi Elisabet,
Thanks for you

#3 
Member
Ola Widlund
Join Date: Mar 2009
Location: Sweden
Posts: 87
Rep Power: 9 
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 timestepping (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 timestep 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 nonlinear coupling between the equations is properly converged in each time step. In that loop, I apply the OF underrelaxation 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 nonlinear iterations in each timestep to stabilize the nonlinear coupling... Best regards, Ola 

March 13, 2008, 15:09 
Hi Ola,
Does your simulatio

#4 
Member
Elisabet Mas de les Valls
Join Date: Mar 2009
Location: Barcelona, Spain
Posts: 63
Rep Power: 9 
Hi Ola,
Does your simulation reach the steady state at the same time when using different Courant numbers? elisabet 

February 13, 2009, 05:56 
Hello,
I am not able to fig

#5 
Senior Member
Rishi .
Join Date: Mar 2009
Posts: 141
Rep Power: 9 
Hello,
I am not able to figure out, how to use adaptive time stepping in my solver. I extended turbFoam solver from OF1.5, with two scalar transport(say red water and blue water) to see the mixing of two inlet flows in a Tsection. Currently I using a timestep of 0.001 and getting max Co number of the order of ~0.001. If I increase the timestep to 0.01 or 0.005 the Co number increases drastically and solver aborts (in 34 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 ../OpenFoam1.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 

February 13, 2009, 09:32 
Hi Rishi,
The procedure is

#6 
Member
Elisabet Mas de les Valls
Join Date: Mar 2009
Location: Barcelona, Spain
Posts: 63
Rep Power: 9 
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 

August 3, 2010, 08:52 

#7 
New Member
Jochem
Join Date: May 2010
Posts: 28
Rep Power: 8 
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 OpenFoam1.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 

August 3, 2010, 09:51 

#8 
New Member
Jochem
Join Date: May 2010
Posts: 28
Rep Power: 8 
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(); // Pressurevelocity 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 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Q. Adaptive mesh help  Emad  FLUENT  0  January 29, 2009 07:42 
Adaptive mesh help please  Emad  FLUENT  0  January 18, 2009 19:09 
Dual timestepping  harly  OpenFOAM Running, Solving & CFD  0  January 9, 2009 17:48 
How to switch of Timestepping Information  TobiasZ  CFX  5  December 12, 2005 09:47 
adaptive timestepping techniques  Sharks  Main CFD Forum  0  April 21, 2003 09:25 