CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   How to determine time step size and Max. iterations per time step. (https://www.cfd-online.com/Forums/fluent/98249-how-determine-time-step-size-max-iterations-per-time-step.html)

pratik c March 6, 2012 14:41

How to determine time step size and Max. iterations per time step.
 
I am trying to simulate airflow through a room and am performing a transient calculation. Could someone please tell me how to determine time step size and max iterations per time step?

ghost82 March 7, 2012 03:47

Hi,
A rule of thumb is to set time step< deltax/u
where deltax is the smallest cell size and u is the velocity.

Usually I set max iteration per time step equal to 50 or 100, depending on residual values (if I want convergence at 10^-3 ^-4 I set near 50, if I want 10^-7 closest to 100).

Daniele

pratik c March 7, 2012 04:38

Sorry I am quite new to this. Could you please tell me how to determine the smallest cell size?. And also what number of time steps would I need?

ghost82 March 7, 2012 04:52

Pratick,
the smallest cell size can be determined from your grid.
If you have done your grid with your pre processor, gambit for example, you know what is the cell size, and where your domain is more refined.
If you have for example one of the smallest quad cell measuring 0.001x0.005, then your smallest cell size will be 0.001.
If you have tri cell then take the smallest side of the cell.

The total number of time steps depends on your simulation: it can be 1 s or 20 s (i.e. total number of time step=1s/timestep or 20s/time step), it depends on your system and on what you are looking for.
If this is your case, you can estimate and take into account a transient period and a period in which your system reaches a pseudo-steady state.

Daniele

pratik c March 7, 2012 05:28

Thank You Danielle.

duri March 9, 2012 15:20

Quote:

Originally Posted by ghost82 (Post 348068)
A rule of thumb is to set time step< deltax/u
where deltax is the smallest cell size and u is the velocity.

This is correct for explicit schemes but solver take cares of it. In case of implicit solver we can go for higher time steps (>100 times). This results in faster solution.
Start with some characteristic length to characteristic velocity ratio. Reduce or increase the time step by an order based on the no. of iterations it takes to converge.

sudhir.iisc March 11, 2012 04:59

Hi Daniele,

It would be better to adjust the time step such that maximum iteration/time step not more then 20. If Solution is not converging within this pseudo time step (iteration) then prefer to decrease physical time step.


Quote:

Originally Posted by ghost82 (Post 348068)
Hi,
A rule of thumb is to set time step< deltax/u
where deltax is the smallest cell size and u is the velocity.

Usually I set max iteration per time step equal to 50 or 100, depending on residual values (if I want convergence at 10^-3 ^-4 I set near 50, if I want 10^-7 closest to 100).

Daniele


cfd seeker March 12, 2012 10:42

I want to ask what is the role of Courant No. in determining the time step size??
As we know Courant No. = velocity*delta(t)/delta(x), by this equation time step size is directly proportional to Courant No, so can we use bigger time step size by increasing the Courant No. ???

banty March 13, 2012 13:02

But in case of wave tracking, even with the implicit solver time step should be taken such that wave should be not move more then one cell in single time step.

Quote:

Originally Posted by duri (Post 348632)
This is correct for explicit schemes but solver take cares of it. In case of implicit solver we can go for higher time steps (>100 times). This results in faster solution.
Start with some characteristic length to characteristic velocity ratio. Reduce or increase the time step by an order based on the no. of iterations it takes to converge.


banty March 13, 2012 13:25

Role of Courant no depends upon the solvers setng.

In case of pressure based and density based (both explicit and implicit) solver with backward euler (1st and 2nd order), time step(physical time step) is entered by the user based on physics involved and CFL no & no of sub iteration decides the speed of convergence.

But in case of explicit-explicit density based solver, time step (physical time step) is decided by the CFL no (User Input) and based on Courant No. = velocity*delta(t)/delta(x).





Quote:

Originally Posted by cfd seeker (Post 348970)
I want to ask what is the role of Courant No. in determining the time step size??
As we know Courant No. = velocity*delta(t)/delta(x), by this equation time step size is directly proportional to Courant No, so can we use bigger time step size by increasing the Courant No. ???


duri March 13, 2012 14:52

Quote:

Originally Posted by cfd seeker (Post 348970)
I want to ask what is the role of Courant No. in determining the time step size??
As we know Courant No. = velocity*delta(t)/delta(x), by this equation time step size is directly proportional to Courant No, so can we use bigger time step size by increasing the Courant No. ???

Yes you can use but it can only control the time step size of inner iterations. It will help in faster convergence of inner iteration but remember there is a restriction on this value due to numerical stability (even for implicit). In unsteady problem physical time steps are more important that numerical time steps to capture a phenomenon.

mahi007 March 18, 2012 22:34

Hello

I am doing analysis of flow past circular cylinder. Can anyone suggest me what are the solver settings?

And how to calculate time step?

Regards
Mahindra

yashganatra June 19, 2013 07:10

Is it steady state or transient?

Tanjina June 19, 2013 11:09

time step
 
Hi,

I have also similar question, but couldn't find any definite answer. i am trying to model a flow through a circular pipe from a rectangular reservoir. I used workbench for meshing. It's triangular mesh. element size is 6e-3m. How can I determine time step. I modeled 3D. I couldn't find any option called iteration/time step, but in may tutorial I saw it.

yashganatra June 20, 2013 02:31

Post some more details. Attach photos of the mesh.
1. Is it steady state or transient?
2. Laminar or turbulent?
You can find the option in FLUENT in the Run Calculation settings in the Problem Setup tab on the left

Tanjina June 20, 2013 10:03

2 Attachment(s)
Hi,

This is 3-D transient time, turbulent two phase flow problem . I have attached two photo with this reply. please have a look on calculation setting photo.

More details : I want to let the water flow from the reservoir to circular pipe and let air fill up the empty place of reservoir which will be created after water going to reservoir.

yashganatra June 20, 2013 12:15

I see that divergence is being detected? For which quantity (momentum,energy etc) it is getting detected? Are you using VOF Model?Can't this be done in 2D also?Give snaps of Solution Methods and control ; from what I make out by referring to various threads, if the solution is not converging better to reduce time step.
See literature - a similar problem, what was the time stepping used ;

Tanjina June 20, 2013 17:16

2 Attachment(s)
I see that divergence is being detected? For which quantity (momentum,energy etc) it is getting detected? Are you using VOF Model?Can't this be done in 2D also?Give snaps of Solution Methods and control ; from what I make out by referring to various threads, if the solution is not converging better to reduce time step.
See literature - a similar problem, what was the time stepping used ;

At First, it showed AMG divergence: x-momentum. then I reduce momentum in relaxation factor from 1 to 0.7, 0.1. then model completed its run. But residual is not decreasing. its increasing with saw tooth shape.

yea I have used VOF model. Actually pipe is circular and tank is rectangular, so I didn't understand how can I model it in 2D.

Please find the screenshot of solution method and control.

yashganatra June 21, 2013 01:34

Hi,
What I meant was that you can model the cross section. Why have you used Non Iterative Time Advancement? I have never worked with it so I have no idea about this. Check if your boundary conditions are correct.
Are those the default solution methods?
I did a quick search and found this thread. Hopefully it will help you.
http://www.cfd-online.com/Forums/flu...-momentum.html

Tanjina June 21, 2013 14:15

I just followed the step described in Tutorial 20, ink jet problem. My problem was little bit similar to that. That's why I used non -iterative time advancement.

I reduced under relaxation factor, after doing that model run its full time step I specified, but result was not expected.

I think I make some mistake in inlet BC. Can you suggest me anything about BC?

I can describe what I want to model and what I used in BC if you are interested.

Tanjina June 21, 2013 14:16

And yes, when I select non-iterative time , these are the default solution method.

yashganatra June 23, 2013 05:13

I will try to help. You can post more details

Far June 23, 2013 06:44

Quote:

Originally Posted by Tanjina (Post 434855)
Hi,

I have also similar question, but couldn't find any definite answer. i am trying to model a flow through a circular pipe from a rectangular reservoir. I used workbench for meshing. It's triangular mesh. element size is 6e-3m. How can I determine time step. I modeled 3D. I couldn't find any option called iteration/time step, but in may tutorial I saw it.

Quote:

Originally Posted by cfd seeker (Post 348970)
I want to ask what is the role of Courant No. in determining the time step size??
As we know Courant No. = velocity*delta(t)/delta(x), by this equation time step size is directly proportional to Courant No, so can we use bigger time step size by increasing the Courant No. ???

There is no definite answer !!!!! Why?

Because for each situation you will have different flow physics/solver requirment and which dictates the time step size and no of time steps.

First few general rules:

1. It is better to lower the time step instead of increasing the no of iterations

2. Lowering the time step will enhance convergence.

3. Use better initial conditions (get from steady state solution)

4. If you experience difficulty in getting convergence for desired time step, use lower time step for initial transients. once you get good convergence gradually increase time step to required value.

5. Adaptive time stepping will give you faster and automatic transient simulation to desired time step.

6. Use 2nd order implicit scheme.


Now few situations:

1. LES, explicit and implicit schemes.

For LES, the condition for time step selection is based on cournt number and CLF < 0.2. For explicit scheme, used when you have advantage of faster convergence for flows where flow delta T is of same order as dictated by CFL otherwise use implicit scheme.

For explicit scheme delta T is determined by CFL < 1 by stability constraint.

For implicit scheme delta T is determined by the flow feature you are interested in.

2. General time step calculation for arbitrary flows

Delta T = (1/3) * (L/V) or lower value

3. Turbo-machinery : (1/10) * ( number of blades/rotational velocity)

I typically use this time step calculation method for sliding mesh problems:

total time to pass one blade pitch (if you have equal no of stator and rotor blades) = pitch in meters / velocity in m/s

Now If you want to resolve it in 20 steps, time step would be total time / 20. For better resolution if you want to use 100 steps per wake passing, time step would be total time/100.

4. Vortex shedding: Time step can be found from strouhal number in indirect manner. From strouhal number (fix the density, viscosity and velocity and known value of diameter of chord length) find out the frequency of vortex shedding. Inverse of it is the total time of vortex shedding period. Lets we have f = 0.2 therefore total time is 5s. Now if use at-least 25 time steps to represent vortex shedding sequence we will have the 5/25 = 0.2 sec for each time step. That is delta T = 0.2 seconds

Judging the convergence, time step dependence
You can judge convergence by plotting surface monitor of variable of interest at particular boundary, line or point. If solution starts to have periodic behaviour, then you have reached convergence.


What should come first : Mesh independence or time step independence study?

My vote goes for mesh independence for sample flow conditions. then go for time step dependence study.

Post precessing of unsteady flows:

Post processing can be done in Fluent, CFD-post and tecplot. For nicer pics, I prefer tecplot.

For post processing of some variable, you need to turn-on data sampling for time statistics . If you want some additional variable you should make the custom field function and enable it in sampling option panel for "custom field function"

For post processing you should run simulation for long enough time and when you start to observe the periodic solution, then turn on data sampling. And take data sample for alteast 5-8 cycles.

Far June 23, 2013 06:46

Quote:

Originally Posted by Tanjina (Post 435335)
And yes, when I select non-iterative time , these are the default solution method.

Is this a default option for your settings?

Tanjina June 23, 2013 22:20

1 Attachment(s)
@ Far,

Yup, when I select Non -iterative time advancement, these are the default settings except "scheme" where default setting is PISO, I made it fractional step manually.

"4. If you experience difficulty in getting convergence for desired time step, use lower time step for initial transients. once you get good convergence gradually increase time step to required value."

how can I do it ?

@Yashganatra,

I am trying to model a flow through a circular pipe from a rectangular reservoir. I used pressure inlet.At first reservoir is full of water. I want that water level will be down with time since no water will enter into reservoir and air will replace the place of water. I used workbench for meshing. It's triangular mesh. Element size is 6e-3m. attached image is showing the result after 1400 run ( when I used water volume fraction 0 in inlet). result was almost same for 2000 run, 500 run...

Far June 24, 2013 04:56

Quote:

"4. If you experience difficulty in getting convergence for desired time step, use lower time step for initial transients. once you get good convergence gradually increase time step to required value."

how can I do it ?
for example if your required time step is 0.001 and you have convergence problems in beginning of solution, then just reduce time step to 0.0001 or 0.00001 and once solution is stabilized, change time step to 0.001 gradually.


Quote:

I am trying to model a flow through a circular pipe from a rectangular reservoir. I used pressure inlet.At first reservoir is full of water. I want that water level will be down with time since no water will enter into reservoir and air will replace the place of water. I used workbench for meshing. It's triangular mesh. Element size is 6e-3m. attached image is showing the result after 1400 run ( when I used water volume fraction 0 in inlet). result was almost same for 2000 run, 500 run..
Maybe you need a UDF or multiphase model, so that the empty area is replaced with Air. I have never tried it, but I am interested to see how this can be done in Fluent

yashganatra June 24, 2013 07:01

Hi Tanjina
Due to the pressure difference water will flow down, the outlet is open to atmosphere? From the image, time elapsed is 1.4e-3, it's very less. Maybe you will need multiphase or a UDF needs to be written as was said above.

Tanjina June 24, 2013 09:45

@Yash ganatra,

Since I am using workbench and mesh shape is triangular , I don't understand what will be the mesh size. From body sizing, I use element size 6e-3 m and I used it as del x. using courant number , I found del t=0.001, but when I use this time step, it says divergence in X-momentum , then I reduce relaxation factor for momentum from 1 to 0.1, 0.7 , 0.3 etc. after some run, it showed some other problem ... so I use very small time step.


for this small time step, it takes lots of time to complete 2000-3000 run. Should I use 5000-10000 run with this time step ?


@ Far,

I am using VOF multiphase model. I don't know how to write UDF . It will be great if you suggest any site from where I can learn writing UDF. And simultaneously I am searching for UDF learning site.

" for example if your required time step is 0.001 and you have convergence problems in beginning of solution, then just reduce time step to 0.0001 or 0.00001 and once solution is stabilized, change time step to 0.001 gradually. "

I still don't understand this part :( . After starting the "run calculation" how can I change the time step without stopping the run ? And it is possible with 0.00001 time step I run 1000 run, then next 1000 run I will continue with large time step ?

@Yashganatra and Far, I am a very new user of Fluent, may be I am bothering you so much..... I am sorry for that.

Tanjina June 24, 2013 13:30

Should I use "open channel flow" option here ? But it's not a open channel flow, is it ?

Far June 24, 2013 16:46

i sent you some material on multiphase through pm

yashganatra June 25, 2013 01:30

Tanjina,
Even I am a beginner so not a problem. For writing UDF, download FLUENT UDF Manual. It is comprehensive. Also it has a section on basics of C Programming

Yash

Tanjina June 25, 2013 17:16

2 Attachment(s)
@ Far and Yashganatra,

Thanks you guys a lot. My model is working now ( in 2D) without any UDF. Trying to run in 3D. Attached is the image of residual of my model . Shouldn't it be converged ? Please enlighten me.

Far June 25, 2013 18:45

also try time step = 0.001

yashganatra June 26, 2013 01:29

That's great. What changes did you make?

Tanjina July 3, 2013 09:54

@ yashganatra, I didn't check the "implicit body force" and "operating density condition" , after checking this two point, model gave the expected results. Thank you all for your kind help.

Tanjina July 15, 2013 17:11

perforated pipe time step.
 
2 Attachment(s)
Hi all,

I tried to model a perforated pipe in 2D, thats why I make some opening and flow was okay at the beginning, when I make time step 0.0001, though the residual was like attached image. then I increase time step time gradually, when I make it 0.01, after some iteration, it just hanged up. What can I do? Before hang up, the image was like the attached image 2. Any help will be really appreciated.

mhd.abdo January 7, 2014 00:33

water hammer simulation
 
Hi all
am on my last step on my master degree and iwoud like to simulate water hammer in pipe in cfx line coud any one give me more datails about that
itray before but ididn't get good reslt ....
plz

.Thomas. August 28, 2014 05:49

Dear All,
I have the same problem of DIVERGENCE DETECTED IN AMG SOLVER: y-momentum.
I am simulating a constant flow profile but I would like to analyze it in transient mode.
My mass flow inlet is of 0.000001 kg/s, I thought that using an adaptive time step that change from 0.001 for the first second to something bigger for the rest of the simulation (for instance 10 seconds) because the fluid flow will be developed.

Solution Method (in order): PISO (Skewness Correction & Neighbor Correction = 1), Least Squares Cell Based, Second Order, Second Order Upwind, First Order Implicit.
Run Calculation: Adaptive Time Stepping Method (deltat); Time Step Size (s)=0.001 (because I have to select the initial time step); Number of Time Step=1000, Max Iterations/Time Step=200.

My code for the adaptive time stepping is:

#include "udf.h"
DEFINE_DELTAT(deltat,d){
real time_step;
real tx=CURRENT_TIME;
if ( tx<=1 ) {
time_step=0.001;
}
else{
time_step=10;
return time_step;
}
}


I don`t get very well what is wrong in what I am doing, anybody has suggestions?
Thank you so much.

Thomas

enass massoud February 11, 2015 06:44

If i have a case file how can i know the smallest cell size?

cleoo September 27, 2016 04:58

Quote:

Originally Posted by ghost82 (Post 348068)
Hi,
A rule of thumb is to set time step< deltax/u
where deltax is the smallest cell size and u is the velocity.

what if you don't know the velocity?


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