|
发表于 2015-9-5 09:15:24
|
显示全部楼层
#include "udf.h"
static real v_prev = 0.0;
DEFINE_CG_MOTION(piston,dt,vel,omega,time,dtime)
{
Thread *t;
face_t f;
real NV_VEC(A);
real force, dv;
NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
if (!Data_Valid_P())
return;
t = DT_THREAD(dt);
force = 0.0;
begin_f_loop(f,t)
{
F_AREA(A,f,t);
force += F_P(f,t) * NV_MAG(A);
}
end_f_loop(f,t)
dv = dtime * force / 50.0;
v_prev += dv;
Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev,
force);
vel[0] = v_prev;
}
|
评分
-
1
查看全部评分
-
|