How to choose the right courant number?
How to choose the right Courant number in complexes simulations (3D, with a great number of cells) and what are its implications?
Thanks. 
Hi Vitor.
The Courant/CFL number (wiki here) depends, as you probably know, on velocity, cellsize and time step and is typically calculated for each cell. The Courant number will accordingly change a bit with velocity when you have a static mesh and a constant time step. Now, assuming here that your mesh is static (nonmoving/morphing) and that the velocity field is more or less fully developed, changing the time step is a good way of controlling the Courant number. A physical explanation, for a CFD simulation, of the Courant number could be that it tells you something about how fluid is moving through your computational cells. If the Courant number is <=1 fluid particles move from one cell to another within one time step (at most). If it is >1 a fluid particles moves through two or more cells at each time step and this can affect convergence negatively. Robust systems and fine solvers, as OpenFOAM, easily deals with large Courant numbers way into the houndreds, but it's a good place to look if you have Convergence problems and it also can effect accuracy of a transient simulation. Diffusion dominated problems should typically be run with low Courant numbers, if I remember correctly. Hope it helps you a bit, I didn't mean to lecture you if you already knew this. Short answer is: lower time step to lower Courant number, raise time step to increase Courant number. Cheers Mads 
For complex simulations with changing velocities it can help to use automatic time step adjustment. See how it's implemented in the interFoam solver (http://www.opencfd.co.uk/openfoam/doc/damBreak.html), or also threads in the forum (e.g. Problems with adjustable timestep control and maxCo Number).

Quote:
Thanks; Vitor 
Unfortunately I don't think there is a general recipe for that. You will have to play around a little and see what works for you. As Mads already lined out, maxCo will usually have to be smaller than 1, and I think you will rarely have to make it smaller than 0.5.

I think that the best approach is to make different simulations with decreasing values of the time step until the final solution becomes independent of this value. I have already made some simulations where the maximum Courant was of the order of hundreds and, nevertheless, the solution was already converged.

Actually, in compressible flow (if you are interested in acoustic waves or shocks) the courant number should not be based on velocity U, but on U+a (sound speed).
Does anybody know if this is implemented in OpenFOAM? Seems to be trickier than I thought at first, because U is a volVectorField and a is a volScalarField (thus it should always be added in the positive Udirection). 
adjustable time step doesn't limit Courant?
I'm using sonicDyMFoam with a solid object moving through a confined space (a fast gas valve). I'm getting lots of trouble with "max number of iterations exceeded" in the calculation of e and "time step continuity errors". I've tried setting maxCo=0.2 and maxAlphaCo=0.2 in system/controlDict, yet the text output shows the max Courant number is still sometimes 1 or larger... sometimes the mean is >1 as well.
Is this normal? my controlDict is as follows: Code:
/** C++ **\ 
I have this problem too.
I can't use max courant setting for pisoFoam and simpleFoam. Any suggestion? Best, 
CFL in steady solvers
Hi maysmech,
There's no CFL Number in such steady solvers. In OF, steady solver means "d/dt=0". Thus, there is no more time step and so no more Courant Number. I do agree with you: how to control stability in such cases? The answer is: relaxation factors. Minh 
You right, I meant pisoFoam only. It is an unsteady solver.

details of crash
A couple of updates  I tried increasing the spatial and temporal resolution to get y+ to about 63, following the BestPractices for TurboMachinery page on the CFD Wiki, but the sim crashed _faster_... which seems odd. I'm dealing with a fastopening gas valve. (40 psi Argon on one side, vacuum on the other; device spatial scales are on the order of 1 cm, and opening time is measured in several tens of microseconds.) I also found a web tutorial with info on revising OpenFoam codes to do adaptive timesteps, but it seemed fairly outofdate and led to me reinstalling OpenFoam. (I'm missing some library; compilation fails unless I'm in the midst of the install.)
I've learned a couple other things: 1) Strong pressure differences (or maybe just strong gradients?) cause crashiness, but I'm not sure _why_ or if there's a workaround. I changed the "vacuum" to 10 psi to avoid the problem, but the motion of the valve's poppet still generates a nearvacuum for some time. (The mechanical parts move slower than Mach 1, but the gas still has to flow supersonically to fill in the gaps through narrow channels.) 2) nonconvergence seems to show up at calculation of either e or T. This makes me think my problem's in the choice of thermodynamic model (currently Code:
thermoType ePsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>; 3) The message from the last timestep is Code:
Time = 5.68e06 Thanks for answering the newB questions. This isn't my first simulation, but I'm much more used to wiring up hardware than to trying to simulate its operation. 
Hello Sarah,
I do not think that adjustTimeStep works for sonicDyMFoam  my experience has shown that regardless of what I set maxCo to, the timestep will revert to what I set in the deltaT field in controlDict. Granted, I am using sonicFoam vice sonicDyMFoam, however they probably have that limitation in common. I suggest that you may have to try reducing your deltaT until you compute a Co that is where you want it to be. I find ~0.5 to be the maximum that will converge. Please post the results / let me know if you were able to resolve your issue, since I am still struggling with this too. Regards, Dan 
dear Mads,
i have very low courant numb 1e5, and my solution does not acheive convergence.. can you please tell me what may be the problem? i am using incompresible flow in laminar regime with very low velocity.. thanks zaynah 
Dear Zaynah,
troubleshooting convergence problems can be easy or very, very hard, especially through a forum :) You don't reveal enough information for anyone to help you out I think. I think that a Courant number of 1e5 is surprisingly low (actually I would bluntly call it: way too low) but it could depend on some strange :) simulation that you are trying to perform. Tell us more, but my intuition says that it is not your Courant number which is the problem. It seems that you have tried to lower the time step much to achieve convergence? Is it some explosion simulation or what? best regards Mads 
Hi Mads,
User zaynah's has found the solution which was I think related to the problem setup as we were discussing in another thread. If you don't mind, I have a question regarding what you said above. You mentioned relatively lower courant number/time step size required for explosion problems? Or do I understand it differently? I am working on explosions and my simulations sometimes result in very low courant numbers (lower upto 0.01 and time steps upto 1e15s) when adjustTimeStep is enabled with maxCo typically around 0.2. The problem that I often face is the courant number calculated using the typical velocity, timestep and cell size, which is of order 1e8s, does not always apply infact sometimes the time step size required is 10 or higher times than calculated for stable calculations. I am not sure my explanation is clear enough but any information would be helpful regarding the treatments required in such problems. 
Hi Mads,
i will come back to you later with this..I am currently stuck somewhere else..:( I have successfully iterated around 6 case and achieved convergence... Suddenly for all the 6 cases i get this same error!! can anyone tell me what is wrong ? Quote:

Traib,
I am not sure I understand your question. I don't think explosions, per say, needs low Courant numbers, as it of course also depends on your mesh, but they sure needs low timesteps (relative to more "normal" simulations). I would expect, being completely ignorant of explosion simulations, however, that you would run at a very low minCourant number as I would expect that your cells are quite large in certain (most) areas because of the development of an explosionplume (or what you call it) into the surroundings...I am just guessing here though. Mads 
Thanks for your reply Mads. Yes, the cells are of quite varied sizes, larger at regions far from core combustion region. I just realized I was using max time step as the limiting parameter with low courant number calculated using smallest mesh size, instead of using an appropriate courant number to control the time step, which resulted in significantly decreased time step sizes in densely meshed areas where temperature also increase significantly. This strangely enough seems to be the cause of the error and with a limit on courant number time step sizes are adjusted to about the calculated values. I suppose I just had to try this different approach for stable results.

Dear Mads,
lets come back to the low courant number..;) My velocity is 0.0001m/s courant is 2.4 e6. i am simulating some simple case for comparison with other softwares.. I have to decide which software is best suited for my project. I have not modify the time step. Quote:
Regards zaynah. ps: for good convergence what must be display in terminal? i mean for me to know that the solution has converged?? 
All times are GMT 4. The time now is 16:22. 