CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   time steps count (https://www.cfd-online.com/Forums/fluent/123082-time-steps-count.html)

Grigor Nikolov September 4, 2013 03:01

time steps count
 
Hi everybody
im writing UDF using DEFINE_CG_MOTION
I have to make at the end of calculation low pass filter of the results and i want to include the filter in the aforementioned UDF. In these case i need to know when is the end of calculation.
So the question is is there possibility to get time step count to include it in UDF

Centurion2011 September 4, 2013 05:22

check this link

duri September 4, 2013 07:27

Quote:

Originally Posted by Grigor Nikolov (Post 449728)
Hi everybody
im writing UDF using DEFINE_CG_MOTION
I have to make at the end of calculation low pass filter of the results and i want to include the filter in the aforementioned UDF. In these case i need to know when is the end of calculation.
So the question is is there possibility to get time step count to include it in UDF

Easiest way is to use a static variable that counts number of times DEFINE_CG_MOTION is called. This works because DEFINE_CG_MOTION is called once for each time step. I would better use execute_at_end or execute_on_demand for doing this kind of operation.

Grigor Nikolov September 4, 2013 07:43

Tnx for answer but i need the final count of time steps to include it in UDF

like IF count = ..... then do the low pass filter
so i need to know the number of final count to use it in UDF

duri September 4, 2013 08:00

Quote:

Originally Posted by Grigor Nikolov (Post 449812)
Tnx for answer but i need the final count of time steps to include it in UDF

like IF count = ..... then do the low pass filter
so i need to know the number of final count to use it in UDF

follow this sample code,


DEFINE_CG_MOTION(....)
{
static int time_counter=0;
time_counter++;

if(time_counter > required_timestep)
{
.....
}

}

Grigor Nikolov September 4, 2013 08:12

When i start my calculation i insert "Number of Time Steps" in Fluent.
In my case 300000.
So i need after time step 300 000 to start filter or If count=300000 do....
But this is private case and i want to make UDF for any case
when i dont know "Number of Time Steps" is there a way to obtain this number from Fluent


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