|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
#include "udf.h"
DEFINE_GRID_MOTION(BEAM,domain,dt,time,dtime)
{
Thread *tf = DT_THREAD(dt);
face_t f;
Node *v;
real NV_VEC(omega), NV_VEC(axis), NV_VEC(dx);
real NV_VEC(origin), NV_VEC(rvec);
real sign;
int n;
/* set deforming flag on adjacent cell zone */
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));
sign = -10.0 * sin (8* M_PI * time);
Message ("time = %f, omega = %f\n", time, sign);
NV_S(omega, =, 0.0);
NV_D(axis, =, 0.0, 0.0, 1.0);
NV_D(origin, =, 0.0, 0.0, 0.0);
begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
v = F_NODE(f,tf,n);
/* update node if x position is greater than 0.02
and that the current node has not been previously
visited when looping through previous faces */
if (NODE_Y(v) > 0.020 && NODE_POS_NEED_UPDATE (v))
{
/* indicate that node position has been update
so that it';s not updated more than once */
NODE_POS_UPDATED(v);
omega[2] = sign * pow (NODE_Y(v), 0.5);
NV_VV(rvec, =, NODE_COORD(v), -, origin);
NV_CROSS(dx, omega, rvec);
NV_S(dx, *=, dtime);
NV_V(NODE_COORD(v), +=, dx);
}
}
}
end_f_loop(f,tf);
}
这个UDF和帮助中给的基本一样,只是我将角速度定义为OMGAE[2],悬臂梁在Y轴上,网格建立在XoY平面,见图所示。计算的过程中发现网格没有动,请帮忙!
计算域:x[-0.2m,0.8m] y[0,0.5m]
梁的尺寸:宽8mm,高0.1m,宽度中点位于坐标原点 |
|