找回密码
 注册
查看: 2462|回复: 2

[求助]UDF错在哪,麻烦大家帮我改一下!

[复制链接]
发表于 2008-5-28 10:36:45 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
= 1.49*y2*sqrt(1-y2);
}
错误如下:
slidevel.c
..\..\src\slidevel.c(8) : error C2065: ';thread'; : undeclared identifier
..\..\src\slidevel.c(8) : error C2223: left of ';->nelements'; must point to struct/union
..\..\src\slidevel.c(16) : error C2223: left of ';->storage'; must point to struct/union
..\..\src\slidevel.c(16) : error C2223: left of ';->storage'; must point to struct/union
..\..\src\slidevel.c(23) : error C2065: ';y2'; : undeclared identifier
Done.
"h:/fluent/exam_scollel"
Opening library "libudf"...
Error: open_udf_library: 系统找不到指定的文件。
Error Object: ()
 楼主| 发表于 2008-5-28 10:42:21 | 显示全部楼层

[求助]UDF错在哪,麻烦大家帮我改一下!

补充一下,小块体是竖直下落的,
发表于 2008-5-28 18:14:25 | 显示全部楼层

[求助]UDF错在哪,麻烦大家帮我改一下!

自己看吧,这是6.3help doc上的例子。
Consider the following example where the linear velocity is computed from a simple force
balance on the body in the x-direction。
where v is velocity, F is the force and m is the mass of the body. The velocity at time t
is calculated using an explicit Euler formula。

/************************************************************
* 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;
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表