CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Previous time macro in UDF (https://www.cfd-online.com/Forums/fluent/47509-previous-time-macro-udf.html)

Paolo Lampitella March 4, 2008 12:35

Previous time macro in UDF
 
Hello,

i'm trying to write an UDF to initialize the field and i'm trying to also assigning the field at time level n-1, that is t = -dt.

The UDF is correctly compiled but, when i try to initialize i get the well known FATAL ERROR (ACCESS VIOLATION).

This is the file:

DEFINE_INIT(init_func,d)

{

cell_t c;

Thread *t;

real x[ND_ND];

thread_loop_c(t,d)

{

begin_c_loop_all(c,t)

{

C_CENTROID(x,c,t);

C_U(c,t) = -cos(x[0])*sin(x[1]);

C_V(c,t) = cos(x[1])*sin(x[0]);

C_P(c,t) = -0.25*(cos(2.0*x[0])+cos(2.0*x[1]));

C_U_M1(c,t) = -cos(x[0])*sin(x[1])*exp(2.0*(CURRENT_TIMESTEP));

C_V_M1(c,t) = cos(x[1])*sin(x[0])*exp(2.0*(CURRENT_TIMESTEP));

C_P_M1(c,t) = -0.25*(cos(2.0*x[0])+cos(2.0*x[1]))*exp(4.0*(CURRENT_TIMESTEP));

}

end_c_loop_all(c,t)

}

}

It correctly works without assigning the M1 variables; does this mean that i just can't assign them when initializing or what?

Thanks


All times are GMT -4. The time now is 05:22.