CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Time step UDF for help (https://www.cfd-online.com/Forums/fluent-udf/94689-time-step-udf-help.html)

peaker007 November 22, 2011 21:41

Time step UDF for help
 
The CFD calculation is so time-consuming, so I want to define the timestep size by udf, and then expect that the calculation can be done automatically, i.e, after a certain steps, timestep size can be changed and go on calculating without taking care manually. I have used the following UDF, but when used it in practice, it does not work well. After calculate for 100 steps, the iteration will stop, then I have to restart the calculate, but it stopped after another 100 steps. Plese help me, thanks in advance.

DEFINE_DELTAT(my_timestep,d)
{
real time_step;
real flow_time = CURRENT_TIME;

if (flow_time < 0.005)
time_step = 0.00005; /*0.00005 100 steps */
else if(flow_time < 0.025)
time_step = 0.0001; /*0.0001 200 steps */
else if(flow_time<0.175)
time_step=0.0005; /*0.0005 300 steps */
else if(flow_time<1.175)
time_step=0.001; /*0.001 1000 steps */
else if(flow_time<5.675)
time_step=0.003; /*0.003 1500 steps */
else if(flow_time<10.675)
time_step=0.005; /*0.005 1000 steps */
else
time_step=0.01;
return time_step;
}

laurentb November 23, 2011 04:15

What do you choose for the "Number of Time Steps" under "Run Calculation" ?
you must put a number higher than 4600 (total number of steps)

peaker007 November 23, 2011 20:43

Quote:

Originally Posted by laurentb (Post 333233)
What do you choose for the "Number of Time Steps" under "Run Calculation" ?
you must put a number higher than 4600 (total number of steps)

Thank youvery much. I think you are right and I have accept your suggestion. Wish to success.


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