CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   DEFINE_ADJUST udf problem (https://www.cfd-online.com/Forums/fluent/83952-define_adjust-udf-problem.html)

mateus January 16, 2011 16:44

DEFINE_ADJUST udf problem
 
Hi,

I'm writing an udf where I first store temperature at the end of each time step. This part work fine - I do it like this:

DEFINE_EXECUTE_AT_END(execute_at_end)
{

Domain *d;
Thread *t;
cell_t c;
d = Get_Domain(1);

thread_loop_c (t,d)
{
if (FLUID_THREAD_P(t))
{
begin_c_loop (c,t)
C_UDMI(c,t,0) = C_T(c,t);
end_c_loop (c,t)
}
}
}


Then in the second part I want to divide current (not converged) temperature with the converged one from the last time step (this one is stored under C_UDMI(c,t,0)).

C_UDMI(c,t,1) = C_UDMI(c,t,0)/C_T(c,t);

To check if it works fluent should give a value of 1 all over domain if I calculate this part in the last (converged) iteration of the new time step, right? - that's because also DEFINE_EXECUTE_AT_END macro will calculate C_UDMI(c,t,0) at this point. I hope I'm making some sense and that it's clear what I'm doing.

If I use DEFINE_ADJUST macro it doesn't give the correct result (1 all over domain at the end of the time step). But if I use DEFINE_EXECUTE_ON_DEMAND it does. It also gives the correct result if I use custom field function tool in Fluent GUI - but this way is not useful for me because I need this variable to define material property further on...

Thanks for any comments and ideas!
Mateus


All times are GMT -4. The time now is 02:52.