|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
模拟一个弹簧壁面的运动,compiled的时候出现如下错误:
> Copied D:\VS2010\VC\spring\cg_motion.c to libudf\src
Creating user_nt.udf file for 3d_host ...
(system "copy "D:\ANSYSI~1\v145\fluent"\fluent14.5.0\src\makefile_nt.udf "libudf\win64\3d_host\makefile" ")
已复制 1 个文件。
(chdir "libudf")()
(chdir "win64\3d_host")()
# Generating ud_io1.h
cg_motion.c
# Generating udf_names.c because of makefile cg_motion.obj
udf_names.c
udf_names.c(7) : error C2059: 语法错误:“}”
udf_names.c(8) : warning C4034: sizeof 返回 0
Creating user_nt.udf file for 3d_node ...
(system "copy "D:\ANSYSI~1\v145\fluent"\fluent14.5.0\src\makefile_nt.udf "libudf\win64\3d_node\makefile" ")
已复制 1 个文件。
(chdir "libudf")()
(chdir "win64\3d_node")()
# Generating ud_io1.h
cg_motion.c
# Generating udf_names.c because of makefile cg_motion.obj
udf_names.c
udf_names.c(7) : error C2059: 语法错误:“}”
udf_names.c(8) : warning C4034: sizeof 返回 0
UDF程序如下
#include "udf.h"
static real v_prev = 0.0;
static real f = 120.211498;
static real k = 53.0022;
static real vector[3] = {0,1,0};
DEFINE_CG_MOTION(spring,dt,vel,omega,time,dtime)
{
Thread *t;
face_t f;
real NV_VEC(A);
real force, dv;
real x[ND_ND];
real y = 0.0;
real z = 0.0;
/* 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_DOT(A,vector);
F_CENTROID(x,f,t);
if (x[1] > z ) z = x[1];
}
end_f_loop(f,t)
/* compute change in velocity, that is, dv = F * dt / mass velocity update using explicit Euler formula */
y = 0.0161 - z;
dv = dtime * ( force + y * k + f ) / 0.0025;
v_prev += dv;
Message ("time = %f, y_vel = %f, force = %f\n", time, v_prev,
force);
/* set y-component of velocity */
vel[1] = v_prev;
} |
|