|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
大家好,我想要计算一个水流推动水车转动的问题,根据牛顿而定律:角加速度=力矩/转动惯量,这是我用的UDF:
#include "udf.h"
#include"math.h"
#include <stdio.h>
#define body_mass 0.01
static real body_inertial[3]={0.000001,0.0000001,0.0000001};
static real body_vel_prev[3]={0.0,0.0,0.0};
static real body_omega_prev[3]={0.0,0.0,0.0};
static real body_centroid[3]={0.5,0.45,0.0};
DEFINE_CG_MOTION(che,dt,vel,omega,time,dtime)
{
Thread *tread;
Domain *domin;
face_t f;
real moment[ND_ND];
real d_vel[ND_ND];
real d_omega[ND_ND];
tread=DT_THREAD(dt);
domin=THREAD_DOMAIN(tread);
NV_S(vel,=,0.0);
NV_S(omega,=,0.0);
d_omega[2]=dtime*moment[2]/body_inertial[2];
body_omega_prev[2]=body_omega_prev[2]+d_omega[2];
omega[2]=body_omega_prev[2];
}
在编译时显示
e:\shuiche\libudf\src\omega.c(21) : warning C4700: 使用了未初始化的局部变量“moment”
进入计算时,水流并不能推动水车转动。我想是不是水车所受力矩并没有被正确表达?我应该怎样做?请诸位教我!!! |
|