大神们,有段fluent的udf,但是看不懂,有没有大神能给解答一下是什么意思
研一萌新没啥金币,直接分享,大家有需要就拿去用
#include "udf.h"
#define U 18
#define I 200
#define PI 3.1415928
#define R 0.003
#define n 0.8
#define v 0.003
#define L 0.005
#define u0 1.26e-6
DEFINE_SOURCE(S_X,cell,thread,dS,eqn)
{
real xc[ND_ND];
real t;
real source;
real x,y,z;
real r;
C_CENTROID(xc,cell,thread);
x=xc[0];
y=xc[1];
z=xc[2];
t=RP_Get_Real("flow-time"
r=sqrt((x-v*t)*(x-v*t)+y*y);
if(r<R)
{
source=-1*u0*I*I/(4*PI*PI*R*R*r)*exp(-1*r*r/(2*R*R))
*(1-exp(-1*r*r/(2*R*R)))*(1-z/L)*(1-z/L)*x/L;
dS[eqn]=0;
}
else
source=dS[eqn]=0;
return source;
}
DEFINE_SOURCE(S_Y,cell,thread,dS,eqn)
{
real xc[ND_ND];
real t;
real source;
real x,y,z;
real r;
C_CENTROID(xc,cell,thread);
x=xc[0];
y=xc[1];
z=xc[2];
t=RP_Get_Real("flow-time"
r=sqrt((x-v*t)*(x-v*t)+y*y);
if(r<R)
{
source=-1*u0*I*I/(4*PI*PI*R*R*r)*exp(-1*r*r/(2*R*R))
*(1-exp(-1*r*r/(2*R*R)))*(1-z/L)*(1-z/L)*y/L;
dS[eqn]=0;
}
else
source=dS[eqn]=0;
return source;
}
DEFINE_SOURCE(S_Z,cell,thread,dS,eqn)
{
real xc[ND_ND];
real t;
real source;
real x,y,z;
real r;
C_CENTROID(xc,cell,thread);
x=xc[0];
y=xc[1];
z=xc[2];
t=RP_Get_Real("flow-time"
r=sqrt((x-v*t)*(x-v*t)+y*y);
if(r<R)
{
source=-1*u0*I*I/(4*PI*PI*L*r*r)
*(1-exp(-1*r*r/(2*R*R)))*(1-z/L)*(1-z/L);
dS[eqn]=0;
}
else
source=dS[eqn]=0;
return source;
}
DEFINE_PROFILE(heat_flux,thread,index)
{
real xc[ND_ND];
face_t f;
real t;
real heat,T0=300;
real x,y,z;
real r;
real hc = 80, sigmab = 5.67e-8, epsilon = 0.06;
t=RP_Get_Real("flow-time"
begin_f_loop(f,thread)
{
F_CENTROID(xc,f,thread);
x=xc[0];
y=xc[1];
z=xc[2];
r=sqrt((x-v*t)*(x-v*t)+y*y);
if(r<sqrt(6)*R)
heat=n*I*U/(2*PI*R*R)*exp(-1*r*r/(2*R*R));
else
heat=0;
F_PROFILE(f, thread, index) = heat - hc*(F_T(f,thread), - T0) - sigmab*epsilon*(pow(F_T(f,thread), 4.) - pow(T0, 4.));
}
end_f_loop(f,thread)
} |