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/)
-   -   turbulence model modification - low Re CHC model (https://www.cfd-online.com/Forums/fluent-udf/121131-turbulence-model-modification-low-re-chc-model.html)

C.C July 22, 2013 10:57

turbulence model modification - low Re CHC model
 
Hi all,

I want implement the CHC low Reynolds turbulence model using an UDF. The main objective is modify the damping function in the CHC model.
In this model the boundary condition for epsilon is equal to:
fluid kinematic viscosity * second derivative of k in space (d^2(k)/dy^2)
Also, there are the parameter Rey defined as:
fluid density*sqrt(k)*y/epsilon in which y is the distance to the wall.

In my UDF i wrote this part as:

DEFINE_ADJUST(userdefinedadj_func,d)
{
Thread *t;
cell_t c;
thread_loop_c(t,d)
{
begin_c_loop(c,t)
/* r=k[1];*/
{
real r,k[ND_ND];
C_CENTROID(k,c,t);
C_UDMI(c,t,MUT)=C_R(c,t)*C_MU*f_mu(c,t)*SQR(C_UDSI (c,t,TE))/C_UDSI(c,t,ED);
C_UDMI(c,t,RET)=C_R(c,t)*SQR(C_UDSI(c,t,TE))/(C_MU_L(c,t)*C_UDSI(c,t,ED));
C_UDMI(c,t,REY)=C_R(c,t)*sqrt(C_UDSI(c,t,TE))*(0.0 381-k[1])/C_UDSI(c,t,ED);
}
end_c_loop(c,t)
}
}



/* Wall B.C. for ED */
DEFINE_PROFILE(e_wallBC,t,i)
{
double prof;
real D2KDX2,D2KDY2;
cell_t c;
begin_c_loop(c,t)
{
C_UDSI(c,t,DKX)=(C_K_G(c,t)[0]);
C_UDSI(c,t,DKY)=(C_K_G(c,t)[1]);
D2KDX2=(C_UDSI_G(c,t,DKX)[0]);
D2KDY2=(C_UDSI_G(c,t,DKY)[1]);
prof=C_MU_L(c,t)*(D2KDX2+D2KDY2)/C_R(c,t);
F_PROFILE(c,t,i)=prof;
}
end_c_loop(c,t)
}


The error that I obtained is that:
Error: Divergence detected in AMG solver: x-momentum
Error Object: #f

I'm new in programming UDF. Please, anyone can check if that part of my UDF is ok?
Also, i have another doubt... how can i choose the right boundary condition once the B.C. for these model includes a second derivative?

C.C August 1, 2013 06:48

Can i modify the damping function f_mu in the low Reynolds CHC turbulence model existent by default in Fluent without solve a scalar user-defined equation implemented in an UDF?


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