FLUENT软件中udf用的grid motion 结果网格无法动起来。。。我怀疑我的UDF编写有问题。求教
程序如下#include"udf.h"#include"dynamesh_tools.h"DEFINE_GRID_MOTION(udf,domain,dt,time,dt...
程序如下
#include "udf.h"
#include "dynamesh_tools.h"
DEFINE_GRID_MOTION(udf, domain, dt, time, dtime)
{
face_t f;
Thread *tf; /* pointer to a thread*/
real NV_VEC (omega), NV_VEC (axis), NV_VEC (dx);
real NV_VEC (origin), NV_VEC (rvec);
int n;
Node *v;
real sign,x,y,z,p;
tf=DT_THREAD(dt);
/* set deforming flags */
SET_DEFORMING_THREAD_FLAG (THREAD_T0(tf));
sign = sin (time);
Message ("time = %f, omega = %f\n", time, sign);
NV_S (omega, =, 0.0);
NV_D (axis, =, 0.0, 1.0, 0.0);
NV_D (origin, =, 0.0, 0.0, 0.152);
begin_f_loop (f, tf)
{
f_node_loop (f, tf, n)
{
v = F_NODE (f, tf, n);
y=NODE_Y(v);
x=NODE_X(v);
if(x<0.3)
{
if(NODE_POS_NEED_UPDATE(v))
{
NODE_POS_UPDATED(v);
y =sign *(0.01*x+3.8*sin(0.3768*x)+3.5+2*cos(0.5652*x));
NV_VV (rvec, =, NODE_COORD (v), -, origin);
NV_S (dx, *=, dtime);
NV_V (NODE_COORD (v), +=, dx);
}
}
}
}
end_f_loop (f, tf);
} 展开
#include "udf.h"
#include "dynamesh_tools.h"
DEFINE_GRID_MOTION(udf, domain, dt, time, dtime)
{
face_t f;
Thread *tf; /* pointer to a thread*/
real NV_VEC (omega), NV_VEC (axis), NV_VEC (dx);
real NV_VEC (origin), NV_VEC (rvec);
int n;
Node *v;
real sign,x,y,z,p;
tf=DT_THREAD(dt);
/* set deforming flags */
SET_DEFORMING_THREAD_FLAG (THREAD_T0(tf));
sign = sin (time);
Message ("time = %f, omega = %f\n", time, sign);
NV_S (omega, =, 0.0);
NV_D (axis, =, 0.0, 1.0, 0.0);
NV_D (origin, =, 0.0, 0.0, 0.152);
begin_f_loop (f, tf)
{
f_node_loop (f, tf, n)
{
v = F_NODE (f, tf, n);
y=NODE_Y(v);
x=NODE_X(v);
if(x<0.3)
{
if(NODE_POS_NEED_UPDATE(v))
{
NODE_POS_UPDATED(v);
y =sign *(0.01*x+3.8*sin(0.3768*x)+3.5+2*cos(0.5652*x));
NV_VV (rvec, =, NODE_COORD (v), -, origin);
NV_S (dx, *=, dtime);
NV_V (NODE_COORD (v), +=, dx);
}
}
}
}
end_f_loop (f, tf);
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询