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/)
-   -   A udf question~ (https://www.cfd-online.com/Forums/fluent-udf/151218-udf-question.html)

potatoning April 6, 2015 23:10

A udf question~
 
Hi~

I have defined the global variations in the udf, and I want to reset the value of variations to zero after every fluent step.
how to achieve this?

tks a lot~

`e` April 7, 2015 19:04

Could you include the UDF code you're asking about?

potatoning April 7, 2015 21:20

Quote:

Originally Posted by `e` (Post 540413)
Could you include the UDF code you're asking about?

I set 2 global variables in udf, and they are used to accumulate the results of source.
After each iteration of fluent step, the new results are added to the old one.
so I want to reset the global variables to zero for the new step.
simple code as:

static real Sesum=0.;

DEFINE_SOURCE(engergy,c,t,dS,eqn)
{
real se=0.;
se=C_T(c,t);
Sesum+=se;
return se;
}

`e` April 7, 2015 21:45

The User-defined ADJUST hook is executed at the start of each iteration before the transport equations are solved. For example, to reset a variable to zero at each iteration:

Code:

DEFINE_ADJUST(my_adjust,d)
{
    a_global_variable=0.;
}


potatoning April 7, 2015 21:52

Quote:

Originally Posted by `e` (Post 540437)
The User-defined ADJUST hook is executed at the start of each iteration before the transport equations are solved. For example, to reset a variable to zero at each iteration:

Code:

DEFINE_ADJUST(my_adjust,d)
{
    a_global_variable=0.;
}


tks a lot~
I'll try~


All times are GMT -4. The time now is 04:19.