CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   A variable expressing time steps in UDF? (https://www.cfd-online.com/Forums/fluent/39230-variable-expressing-time-steps-udf.html)

 lcw January 13, 2006 06:01

A variable expressing time steps in UDF?

N_TIME is the all time steps starting from beginning of unsteady computation. But, we usually choose data sampling by specifing number of time steps after many time steps. What's the variable expressing time steps starting from 1 in the specific number of time steps during the unsteady compution?

Thank you very nuch!

LCW

 Frank January 13, 2006 08:37

Re: A variable expressing time steps in UDF?

CURRENT_TIME real current flow time (in seconds)

CURRENT_TIMESTEP real current physical time step size (in seconds)

PREVIOUS_TIME real previous flow time (in seconds)

PREVIOUS_2_TIME real flow time two steps back in time (in seconds)

PREVIOUS_TIMESTEP real previous physical time step size (in seconds)

N_TIME integer number of time steps

N_ITER integer number of iterations

Frank

 lcw January 13, 2006 09:35

Re: A variable expressing time steps in UDF?

Thanks, Frank, Above macros you mentioned are not what I want. N_TIME can give all time steps from the beginning of unsteady computation, but it can not give the numbered time steps from the beginning (named as 1)of the specified time steps used for unsteady statistics. For example, after many time steps, we specify 20 time steps for unsteady statistics, the first timestep is 1, then N=1, the next timestep is 2, then N=2, and so on. I want to find this macro N that can express the number of timesteps from the beginning of these 20 timesteps computation.

 Frank January 16, 2006 09:32

Re: A variable expressing time steps in UDF?

Hello Icw,

why don't you define a variable at the beginning of your simulation and add 1 each timestep?

Frank

 LCW January 16, 2006 13:19

Re: A variable expressing time steps in UDF?

Hi, Frank: I am doing the simulation of cyclone separator using FLUENT, the flow field in cyclones is quasi-periodical. When iterating at the beginning of simulation, the residuals will decrease in a whole and keep many time steps. In general, we specify requested time steps when residuals reach stability in a whole, certainly the residuals decrease in each time step. So if we do the statistics of requested time steps by UDF code, the beginning time step should be assigned to 1 and add 1 each timestep.

 All times are GMT -4. The time now is 20:35.