马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
UDF文件如下,是FLUENT软件中的English Tutorial材料中英文UDF指导材料FLUENT 6.1 UDF Manual(Fluent Inc. January 22, 2003)中的一个例子,是关于在一个时间微段中物体受力加速的问题,完全拷贝下来,居然解释时出错.
先是"static real v_prev = 0.0;"有错,Error: D:\UDF-test\UDF\colmove-udf-1.c: line 9: parse error.
后来我改为"real v_prev = 0.0;"。接着又是"t=DT_THREAD(dt);"有错.Error: D:\UDF-test\UDF\colmove-udf-1.c: line 26: structure reference not implemented
我的Fluent软件的版本是6.2.16.
有高手可以帮忙改错吗?
/************************************************************
*
* 1-degree of freedom equation of motion (x-direction)
* compiled UDF
*
************************************************************/
#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;
/* reset velocities */
NV_S (vel, =, 0.0);
NV_S (omega, =, 0.0);
if (!Data_Valid_P ())
return;
/* get the thread pointer for which this motion is defined */
t=DT_THREAD(dt);
/* compute pressure force on body by looping through all faces */
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)
/* compute change in velocity, i.e., dv = F * dt / mass
velocity update using explicit Euler formula */
dv = dtime * force / 50.0;
v_prev += dv;
Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev, force);
/* set x-component of velocity */
vel[0] = v_prev;
} |