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/)
-   -   Same value for C_U and C_U_M1 (https://www.cfd-online.com/Forums/fluent-udf/109528-same-value-c_u-c_u_m1.html)

Dorit November 20, 2012 01:59

Same value for C_U and C_U_M1
 
Hi everyone,

I'm trying to calculate the acceleration of air during an unsteady simulation. To do so I'm using C_U and C_U_M1 to access the x velocity at the current and previous time step and then store it in a UDM. My problem is just that C_U and C_U_M1 always return the same value within a cell at any given iteration.

Below is my UDF. I used a DEFINE_CG_MOTION macro as I'll later also have to change the rotational speed of one of my volumes, but that is not an issue.
Does anyone have an idea where I've gone wrong or that I should change?

DEFINE_CG_MOTION(start_up, pointer, velocity, omega, time,dt)
{
cell c;
Domain *d = Get_Domain(1);
Thread *t = Lookup_Thread(d,10); /* 10 is the volume ID for the block that I'm interested in*/
Thread *ct = THREAD_T0(t);
thread_loop_c(ct,d)
{
begin_c_loop(c,ct)
{
C_UDMI(c,ct,0) =C_U(c,ct);
Message0 (“current time step %f , last time step %f \n”, C_U(c,ct), C_U_M1(c,ct));
}
end_c_loop(c,ct)
}
}

I also tried defining my thread using these below 2 methods, but the problem is the same.
Thread *ct = DT_THREAD((Dynamic_Thread *)pointer);
Thread *ct = DT_THREAD(pointer);

Thanks for any thoughts,
Dorit

nasser March 9, 2013 15:06

hi
I think you have to use define_adjust for calculating your UDF in every iteration. read udf manual.


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