|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
最近用Compute_Force_And_Moment函数实现物体根据受力进行运动下面是我下载的udf:
include "udf.h"
#include "mem.h"
#include "dynamesh_tools.h"
static real v_x = 0.0,v_y=0.0,omega_z=0.0;
DEFINE_CG_MOTION(piston,dt,vel,omega,time,dtime)
{
face_t f;
cell_t c;
real f_glob[ND_ND],m_glob[ND_ND],x_cg[ND_ND],dv_x,dv_y,domega_z;
Domain *domain= Get_Domain (1);
Thread *tf1 = Lookup_Thread (domain, 3);
int i;
/* reset velocities */
NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
if (!Data_Valid_P())
return;
for(i=0;i<=ND_ND;i++)
{
f_glob=0;
m_glob=0;
}
/* get the thread pointer for which this motion is defined */
for(i=0;i<ND_ND;i++)
x_cg=DT_CG(dt);
if(time<=0.001)
{
vel[1]=3.5;
Message ("ntime=%f ,x=%.10lf ,y=%.10lf , force_x=%.1f ,force_y=%.1f ,moment_x=%f,moment_y=%f,moment_z=%f ,Vx=%f ,Vy=%f ,omega_z=%fn", time,x_cg[0],x_cg[1],f_glob[0],f_glob[1],m_glob[0],m_glob[1],m_glob[2],v_x,v_y,omega_z);
return;
}
/* compute pressure force , viscosity force and moment on body by looping through all faces */
Compute_Force_And_Moment (domain, tf1, x_cg, f_glob, m_glob, TRUE);
/* compute change in velocity and angle velocity, i.e., dv = F * dt / mass
velocity update using explicit Euler formula */
dv_x = dtime * f_glob[0] / 39;
v_x += dv_x;
dv_y = dtime * f_glob[1] / 39;
v_y += dv_y;
domega_z=dtime*m_glob[2]/390;
omega_z+=domega_z;
Message ("ntime=%f ,x=%.10lf ,y=%.10lf , force_x=%.1f ,force_y=%.1f ,moment_x=%f,moment_y=%f,moment_z=%f ,Vx=%f ,Vy=%f ,omega_z=%fn", time,x_cg[0],x_cg[1],f_glob[0],f_glob[1],m_glob[0],m_glob[1],m_glob[2],v_x,v_y,omega_z);
/* set components of velocity */
vel[0] = v_x,vel[1]=v_y,omega[2]=omega_z;
}
可以编译但一运行Fluent就出现The FLUENT process could not be started
见下图,希望大侠帮忙解决,先谢谢了! |
|