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 3d model to give heat flux profile around the wall surface (https://www.cfd-online.com/Forums/fluent-udf/106718-udf-3d-model-give-heat-flux-profile-around-wall-surface.html)

n7310889 September 6, 2012 06:21

udf for 3d model to give heat flux profile around the wall surface
 
Hi, could any of you can tell me whats wrong with this macro? Its for 3d to provide input heat-flux profile around a semi circular cylinder of 33mm radius and 1.5m long.The heat profile varies along the verticle y direction and translates the same along the horizontal z axis.

#include "udf.h"

DEFINE_PROFILE(heat_profile,thread,index)
{
real x[ND_ND];
real x,y,z,r,angle;

face_t f;

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

x =x[0];
y =x[1];
z =x[2];
r =sqrt(pow(x,2)+pow(y,2));
angle =acos(-y/r);

if ((z>=0.0) && (z<=1.4))
{

if ((angle>=0.0) && (angle<=60.0))
{
F_PROFILE(f,thread,index) =6500.0;
}

if ((angle>50.0) && (angle<=180.0))
{
F_PROFILE(f,thread,index) =0.0;
}

}

else
{
F_PROFILE(f,thread,index) =0.0;
}
}

end_f_loop(f,thread)
}

KAA April 20, 2018 02:47

Dear n7310889
 
Can u please tell the meaning of 6500 in your program.

AlexanderZ April 20, 2018 03:30

Quote:

Originally Posted by KAA (Post 689603)
Can u please tell the meaning of 6500 in your program.

6500 is a value, which will be applied as a boundary condition

best regards

farhanjaved May 8, 2018 06:45

@AlexanderZ, is your UDF looping over all the faces? try printing the value of the face centroid and seeing if the UDF is going over all the faces.
I am also trying to create a radially varying heat flux for a circular surface. But my UDF surprisingly does not loop over all the faces. This is my udf.

We could both help each other out.

# include "udf.h"
DEFINE_PROFILE(heatfluxshoulder,thread,position)
{ face_t f;
cell_t c;
float x[ND_ND];
float xx,z,r,omega,w,sigma, uf,qs1,ql1,hflux,taustick, tauslide, rshoulder, rpin, pressure, yield, qtotal;
begin_f_loop(f,thread)
{
pressure=17700;
yield=35000000;
omega=800;
rshoulder=0.014;
rpin=0.003;
w=2*3.14*omega/60;
F_CENTROID(x,f,thread);
xx=x[0];
z=x[2];
r=sqrt((xx*xx+z*z));
sigma=0.31*exp(w*r/1.87)-0.026;
uf=0.5*exp(-sigma*w*r);
taustick=yield/1.73;
tauslide=uf*pressure;
qs1=0.67*3.14*w*taustick*(rshoulder*rshoulder*rsho ulder-
rpin*rpin*rpin);
ql1=0.67*3.14*w*tauslide*(rshoulder*rshoulder*rsho ulder-
rpin*rpin*rpin);
qtotal=sigma*(qs1)+(1-sigma)*(ql1);
hflux=(qtotal/4847)*1.7e+010;
F_PROFILE(f,thread,position) = hflux;
}
end_f_loop(f,thread)
}


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