CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Running a UDF only once per timestep (

flotus1 July 5, 2012 06:00

Running a UDF only once per timestep
Is there any possibility to tun a UDF (like DEFINE_SOURCE for example) only ONCE every timestep and not on every iteration?

Daniel Tanner July 6, 2012 04:03

Try this:

if ( first_iteration )
enter your calculations here

I got this from:

Let me know how it goes.

akm July 6, 2012 07:57

Either what Daniel suggested or you can use the macro EXECUTE_AT_END. Depends on your need, whether you want to execute at beginning or at the end of a time-step.


DEFINE_EXECUTE_AT_END is a general-purpose macro that is executed at the end of an iteration in a steady state run, or at the end of a time step in a transient run.

All times are GMT -4. The time now is 15:00.