CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   about eddy viscosity :UDF (https://www.cfd-online.com/Forums/fluent/35341-about-eddy-viscosity-udf.html)

sagga December 23, 2004 02:17

about eddy viscosity :UDF
 
i 'd like to define new eddy viscosity in Fluent by UDF i have C code but when it compile it was error somebody help me please thank my code #include "udf.h" // T.B. Model constants//

#define C_MU 0.09

#define C1_D 1.44

#define C2_D 1.92

// UDS //

enum {

TKE,

TDR,

N_REQUIRED_UDS };

// RE NUM DEFINE //

real Re_y(cell_t c, Thread *t) { float A ;

A =sqrt(C_UDSI(c,t,TKE));

return C_R(c,t)*A*C_WALL_DIST(c,t)/C_MU_L(c,t);}

real Re_t(cell_t c, Thread *t)

{ return C_R(c,t)*SQR(C_UDSI(c,t,TKE))/C_MU_L(c,t)/C_UDSI(c,t,TDR);}

// DAMPING FUNCTION //

real f_mu(cell_t c, Thread *t)

{ float B ,C;

B=tanh(0.008*Re_y(c,t));

C=pow(Re_t(c,t),0.75);

return B*(1.+4/C) ;}

real f_1(cell_t c, Thread*t)

{ return 1.;}

real f_2(cell_t c, Thread*t)

{ float D ,E;

D=(1.-2./9.*exp(-Re_t(c,t)*Re_t(c,t)/36.));

E=(1.-exp(-Re_t(c,t)/12.));

return D*E ;}

DEFINE_ADJUST(turb_adjust, domain)

{

Thread *t;

cell_t c;

// set turbulent viscoscity //

thread_loop_c(t,domain)

if (FLUID_THREAD_P(t))

{

begin_c_loop(c,t)

{

C_MU_T(c,t) = C_R(c,t)*C_MU*f_mu(c,t)*SQR(C_UDSI(c,t,TKE))/C_UDSI(c,t,TDR)

}

end_c_loop(c,t)

}

}


Michael January 10, 2005 12:51

Re: about eddy viscosity :UDF
 
I have a similar problem. The compiler error happened for the following line:

C_MU_T(c,t) = C_R(c,t)*C_MU*f_mu(c,t)*SQR(C_UDSI(c,t,TKE))/C_UDSI(c,t,TDR)

error C2106: '=' : left operand must be l-value. Basically it would not let me to assign any value to C_MU_T(c,t).

Anyone knows a solution? Thanks

sagga January 10, 2005 21:07

Re: about eddy viscosity :UDF
 
thank Michael


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