CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Transient analysis with turbFoam very high Courant nr (https://www.cfd-online.com/Forums/openfoam-solving/58315-transient-analysis-turbfoam-very-high-courant-nr.html)

hardy August 7, 2007 05:33

Hello! I am using turbFoam
 
Hello!

I am using turbFoam to do a transient analysis. First I made a steady state analysis to get a start solution for the transient case. After changing to transient, whith Euler scheme, the Courant number becomes very high within a couple of time steps and the simulation crashes.

This happens even when I lower the time step to a small value. Am I perhaps doing something wrong when going to transient? I simply set the start time, in controlDict, as the number of the latest iteration from the steady state case in whose folder all variables are saved. Will my boundary conditions be preserved now? Is this the right way to do it or am i missing something here....or somewhere else...

Any ideas appreciated!!

hardy August 13, 2007 09:01

Hello again! Just to compl
 
Hello again!

Just to complement myself, the steady state start solution is made with simpleFoam before taking the results to turbFoam.

And after doing some more investigation I think I can rule out the concerns about preservation of the boundary conditions. They are stored in the result files under boundaryField, right?

Thank You!!
/H

rolando August 13, 2007 11:33

Hello Hardy, this may happen,
 
Hello Hardy,
this may happen, if the pressure equation isnīt solved accurately enough.
Make sure, that your initial Co is small enough, take a value of 0.2 or 0.3 for that.
Increment the number of correctors and non-orthogonal correctors (how much is problem dependend).
If your simulation runs stable, after a while you can change that parameters to improve efficiency.

Experiment with that.

Rolando

philippose August 13, 2007 11:43

Hello Hardy, A Good day to
 
Hello Hardy,

A Good day to you :-)!

I have a couple (ok..more :-)!) of questions regarding the problem you are facing.....

You mentioned that the Courant number becomes "high" after a few iterations, and that happens even when you make the time steps "small".

Could you quantify these terms? How high does the Courant number go and after how many iterations, and what was the smallest time step you tried ?

Also... how big is your mesh, what kind of cells does your mesh contain, and how well did the solution converge during the steady state run using simpleFOAM, after how many iterations?

I know that is a lot of stuff to ask for :-)! But it would help figure out why your Courant number is shooting up.

One other thing.... did you try the Automatic Time Step adjust feature in OpenFOAM? You can set a maximum courant number, and the time step is automatically adjusted to maintain this courant number.

Have a nice day!

Philippose

hardy August 14, 2007 02:52

Thank You for your kind answer
 
Thank You for your kind answers and ideas!

I have now set the time step to give a Courant nr = 0.3 I also set the number of correctors and nonorthogonal correctors up to 5 and it really seems to work now!! :-)

Philippose, you made me interested in the Automatic Time Step adjust feature. How do you use it, is there perhaps some kind of tutorial to look into?

Thanks!

/H

paka August 14, 2007 14:24

Hi Hardy, The Automatic Tim
 
Hi Hardy,

The Automatic Time Step function is defined in the same dictionary file as maximum Courant number. It is a controlDict file in system/ folder.

There is writeControl option. Change it to adjustableRunTime. Also there is runTimeModifiable option, set it to yes. Remember the automatic time step is dependent on maxCo value, so it is adjusted to fit it.

Hope that helps.

Cheers!
Krystian

philippose August 14, 2007 15:55

Hello, Oops.... Krystian, t
 
Hello,

Oops.... Krystian, there is an oversight in the suggestion you have provided.... the changes to be made to enable Automatic Time stepping in OpenFOAM are the following:

As you mentioned, these changes have to be made to the controlDict file within the system folder of a case... but the changes themselves are:

maxCo [the maximum Courant number you want];

adjustTimeStep [yes/no];

For example, you could add the following two lines to the end of your controlDict file to enable automatic time stepping, where the maximum courant number is limited to 0.5:

maxCo 0.5;
adjustTimeStep yes;

The other two options...

writeControl adjustableRunTime - This basically tells the system, to adjust the time step (if the time step is variable) so that at the point in time when an output needs to be written to disk, the simulation time exactly equals the write time.....

For example, if you had a simulation time of 0.0018, and the time at which the next write happens is 0.002, and you had variable time step step which at that instance was 0.00025... then, the time step would be adjusted to 0.0002, so that the solution can be written to disk at the next step.

runTimeModifiable [yes/no>] - This option tells the system, that even when a simulation has been started, and is running, if there is a change in any of the files for example, controlDict, fvSolution, fvSchemes, etc...etc... these changes should be accounted for, from the next simulation step onwards.

Using this option, you can change, for example, the write interval, or the solver tolerances, etc... while the simulation is running.

Anyway.... now... there is one more problem... :-)!

turbFoam by default, does not support adjustable time stepping. So, even if you do put these two options into the controlDict file, you will still not see any changes in the time step.

I have made the small modifications required to turbFoam to enable variable time-stepping, and created another solver called turbFoamVarDt (Couldnt think of a better name :-)!), which you could compile and try out...

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif turbFoamVarDt.tar.gz

Enjoy!

Philippose

hardy August 15, 2007 05:34

Thank You all once again!
 
Thank You all once again!

I managed to get the turbFoamVarDt solver to run and am now exploring its capabilities :-)

To switch subject a bit, does anyone know how to get values of lift and drag force from each time step? I have seen other threads on this subject on the forum but donīt realy get it??

Regards!

/H

louisgag August 1, 2008 16:39

Thanks Philippose for sharing
 
Thanks Philippose for sharing this variable delta T turbFoam, I have adapted it to OF 1.5 and also made it read the maxCo value at every loop in order to be able to change it while the program is running.

(I simply moved the # include "readTimeControls.H" within the while loop)

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif turbFoam.tar.gz

It is also interesting to note that the writeInterval for this represents the time interval in seconds and not in timesteps.

emilianyassenov November 12, 2008 03:33

Time = 0.0038 Courant Numbe
 
Time = 0.0038

Courant Number mean: 2.09671 max: 1060.3
DILUPBiCG: Solving for Ux, Initial residual = 0.919624, Final residual = 1.67874e-06, No Iterations 37
DILUPBiCG: Solving for Uy, Initial residual = 0.901699, Final residual = 2.47234e-06, No Iterations 36
DILUPBiCG: Solving for Uz, Initial residual = 0.938489, Final residual = 4.1829e-06, No Iterations 36
DICPCG: Solving for p, Initial residual = 0.879601, Final residual = 0.00364827, No Iterations 1001
time step continuity errors : sum local = 0.0259577, global = 9.6956e-08, cumulative = 3.94409e-06
DICPCG: Solving for p, Initial residual = 0.666183, Final residual = 0.000557632, No Iterations 1001
time step continuity errors : sum local = 0.0113467, global = 8.28394e-06, cumulative = 1.2228e-05
DILUPBiCG: Solving for T, Initial residual = 0.64382, Final residual = 6.68318e-08, No Iterations 59
ExecutionTime = 378.29 s ClockTime = 381 s

Time = 0.0039

Courant Number mean: 9.857 max: 30723.2
DILUPBiCG: Solving for Ux, Initial residual = 0.992898, Final residual = 7.52633e-06, No Iterations 52
DILUPBiCG: Solving for Uy, Initial residual = 0.990041, Final residual = 4.81015e-06, No Iterations 55
DILUPBiCG: Solving for Uz, Initial residual = 0.995945, Final residual = 7.08196e-06, No Iterations 51
DICPCG: Solving for p, Initial residual = 0.943505, Final residual = 0.00279098, No Iterations 1001
time step continuity errors : sum local = 0.133287, global = 0.000834918, cumulative = 0.000847146
DICPCG: Solving for p, Initial residual = 0.511564, Final residual = 0.000185419, No Iterations 1001
time step continuity errors : sum local = 0.0590576, global = -0.0111944, cumulative = -0.0103473
DILUPBiCG: Solving for T, Initial residual = 0.906877, Final residual = 6.47856e-08, No Iterations 76
ExecutionTime = 392.06 s ClockTime = 395 s

Time = 0.004

Courant Number mean: 114.419 max: 474556
DILUPBiCG: Solving for Ux, Initial residual = 0.997831, Final residual = 5.29673e-06, No Iterations 199
DILUPBiCG: Solving for Uy, Initial residual = 0.995946, Final residual = 2.97571e-06, No Iterations 208
DILUPBiCG: Solving for Uz, Initial residual = 0.997078, Final residual = 7.97488e-06, No Iterations 198
DICPCG: Solving for p, Initial residual = 0.967972, Final residual = 0.244505, No Iterations 1001
time step continuity errors : sum local = 357.75, global = -0.0473633, cumulative = -0.0577106
DICPCG: Solving for p, Initial residual = 0.43629, Final residual = 0.000865386, No Iterations 1001
time step continuity errors : sum local = 78.2216, global = -0.0380752, cumulative = -0.0957858
DILUPBiCG: Solving for T, Initial residual = 0.96816, Final residual = 8.15618e-08, No Iterations 88
ExecutionTime = 411.14 s ClockTime = 414 s

Time = 0.0041

I have such a problem that courant number increasing after a while...I can t find out the problem...I have decrease time steps and it is working longer but again crash...
can someone help me?

best regards

emo

emilianyassenov November 12, 2008 08:02

can anyone help me? please
 
can anyone help me?

please
thanks

Emo

ngj November 12, 2008 09:42

If I recall correctly, turbFoa
 
If I recall correctly, turbFoam is already equiped with a variable timestepping routine based on a Courant number.

If you are in doubt with respect to how to apply it, look into the controlDict in the interFoam/damBreak case.

Besst regards,

Niels

wolle1982 November 18, 2008 04:55

Hi Emilian, I see your delt
 
Hi Emilian,

I see your deltaT is 1e-4...? try a smaller deltaT. when I calculate my grids. I'm startting with a deltaT of 1e-8. after 1000 timesteps calculated I turn it up to 1e-7. 1000 later to 1-e6. and finally to 5e-6. this works fine.

wolle1982 November 19, 2008 13:36

Hi again, here are some fac
 
Hi again,

here are some facts to look after for a better running (anyone please correct me if I'm wrong)

- alternatively you can use adjustable timestepcontrol (see under http://www.cfd-online.com/OpenFOAM_D...tml?1227012935 )

- the non-horthogonality mustn't be to great

- using a more aggressive solver/schema

- increasing the solution precision (make smaller!)

- maybe start simulation with turbulence OFF. after good advice turn on and go on simulating

- turn down turbulence a little

- does your mesh look "smooth"??

- all BC correct?

hope that helps a little


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