CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Same value for C_U and C_U_M1 (

Dorit November 20, 2012 02: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);
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));

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,

nasser March 9, 2013 16:06

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 14:26.