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/)
-   -   UDF for source term at wall (https://www.cfd-online.com/Forums/fluent-udf/191787-udf-source-term-wall.html)

y.suri August 19, 2017 18:44

UDF for source term at wall
 
Hi CFD Experts,

I am a beginner in ANSYS FLUENT. I want to write a UDF for source term at wall in order to include the water leakoff rate from wall.

I have written following code, but I am not sure if it is correctly written.
Please can you check and guide me?

# include "udf.h"

DEFINE_SOURCE(leakoffrate,cell,thread,dS,eqn)
{
real x[ND_ND];
real leak;
real length;
Domain *domain = Get_Domain(1);
face_t f;
cell_t c;
Thread *tb = Lookup_Thread(domain,2); /* Get boundary thread, wall zone id is 2 */

begin_f_loop (f,thread)
{ F_CENTROID (x,f,thread)

if(c = F_C0(f,tb)) /* if cell is wall boundary cell */
{
if (length > 0 and length < 0.25)
leak = 17-22*length;
elseif (length > 0.25 and length < 0.45)
leak = 13.0625-6.25*length;
elseif (length > 0.45 and length < 0.85)
leak = 10;
else
leak=7.17+3.33*length;
}
dS[eqn]=0;

else
{
leak = 0;
dS[eqn]=0;
}
return leak;
}

end_f_loop (f,thread)
}

Many thanks and regards,
Yatin


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