#include<math.h>
#include "udf.h"
/*土壤梯度边界*/
DEFINE_PROFILE(bianjieturang_temp,thread,i)
{
real x[ND_ND];
real y;
face_t f;
begin_f_loop(f,thread)
{
real t=RP_Get_Real("flow-time");
F_CENTROID(x,f,thread);
y=x[1];
F_PROFILE(f,thread,i)=0.4*y+5.2*sin(2.0*3.14*t/360.0+3.14/3.0)-0.5+273;
}
end_f_loop(f,thread)
}
/*土壤上部下部边界*/
DEFINE_PROFILE(bottomturang,thread,i)
{
face_t f;
begin_f_loop(f,thread)
{
real t=RP_Get_Real("flow-time");
F_PROFILE(f,thread,i)=5.2*sin(2.0*3.14*t/360.0+3.14/3.0)-0.5+273;
}
end_f_loop(f,thread)
}
DEFINE_PROFILE(topturang_temp,thread,i)
{
face_t f;
begin_f_loop(f,thread)
{
real t=RP_Get_Real("flow-time");
F_PROFILE(f,thread,i)=5.2*sin(2.0*3.14*t/360.0+3.14/3.0)-4.5+273;
}
end_f_loop(f,thread)
}
/*xmom*/
DEFINE_SOURCE(mom_x,c,t,dS,eqn)
{
real u,b;
real temp;
real source;
u=C_U(c,t);
temp=C_T(c,t);
if(temp<=273.45)
{
b=0;
source=(1/(pow(2,b)+0.267))*100*fabs(u);
}
else
{
if(temp>273.45&&temp<273.85)
{
b=0.267*(temp-0.3)/(0.75-temp);
source=(1-pow(2,b))/(pow(2,b)+0.267)*100*fabs(u);
}
else
if(temp>=273.85)
{
b=0.267;
source=(1-pow(2,b))/(pow(2,b)+0.267)*100*fabs(u);
}
}
return source;
}
/*ymom*/
DEFINE_SOURCE(mom_y1,c,t,dS,eqn)
{
real v,b;
real temp;
real source;
v=C_V(c,t);
temp=C_T(c,t);
if(temp<=273.45)
{
b=0;
source=(1/(pow(2,b)+0.267))*100*fabs(v);
}
else
{
if(temp>273.45&&temp<273.85)
{
b=0.267*(temp-0.3)/(0.75-temp);
source=(1-pow(2,b))/(pow(2,b)+0.267)*100*fabs(v);
}
else
if(temp>=273.85)
{
b=0.267;
source=(1-pow(2,b))/(pow(2,b)+0.267)*100*fabs(v);
}
}
return source;
}
/*ymom2*/
DEFINE_SOURCE(mom_y2,c,t,dS,eqn)
{
real temp;
real source;
temp=C_T(c,t);
source=1600*9.8*0.0001*(temp-300);
return source;
}
评论1