|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
基于边界造波法模拟波浪,二维流场,坐标系为x(0到20),y(-5到5),VOF模型,初始水位x=0处,左边界UDF定义入口速度,上边界压力入口,右边界压力出口,下边界WALL,可是一直模拟不出波浪,请大家指点,UDF如下
#include "udf.h"
real AA=1.0;
real TT=2.0;
real LL=6.2;
real kk=2.0*3.1415925/6.2;
real ww=2.0*3.1415925/2.0;
real h=5.0;
DEFINE_PROFILE(x_velocity,thread,index)
{
real x[ND_ND];
real xx;
real y;
face_t f;
real u = 0;
real t = RP_Get_Real("flow-time");
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
xx = x[0];
y = x[1];
if(y<(AA*cos(kk*xx-ww*t)))
u=3.14*2.0*AA*cosh(kk*(y+h))*cos(kk*xx-ww*t)/TT/sin(kk*h);
else u = 0.0;
F_PROFILE(f,thread,index) = u;
}
end_f_loop(f,thread)
}
DEFINE_PROFILE(y_velocity,thread,index)
{
real x[ND_ND];
real xx;
real y;
face_t f;
real v = 0;
real t = RP_Get_Real("flow-time");
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
xx = x[0];
y = x[1];
if(y<(AA*cos(kk*xx-ww*t)))
v=3.14*2.0*AA*sinh(kk*(y+h))*sin(kk*xx-ww*t)/TT/sinh(kk*h);
else v = 0.0;
F_PROFILE(f,thread,index) = v;
}
end_f_loop(f,thread)
}
DEFINE_PROFILE(voffactor,thread,index)
{
real x[ND_ND];
real xx;
real y;
face_t f;
real t = RP_Get_Real("flow-time");
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
xx=x[0];
y = x[1];
if(y<(AA*cos(kk*xx-ww*t)))
F_PROFILE(f,thread,index) = 1.0;
else F_PROFILE(f,thread,index) = 0.0;
}
end_f_loop(f,thread)
} |
|