找回密码
 注册
查看: 1911|回复: 8

udf如何实现平板转动

[复制链接]
发表于 2012-8-20 11:09:06 | 显示全部楼层 |阅读模式

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

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

x
本人初学Fluent,而且UDF的编写基本一窍不通。有没有相类似的例子。请高手指导一下。有的话给我发一个。万分感谢啊。shang1989@hotmail.com
未命名.jpg
发表于 2012-8-20 13:54:43 | 显示全部楼层
You can use DEFINE_CG_MOTION to specify the motion of a particular dynamic zone in FLUENT by providing FLUENT with the linear and angular velocities at every time step. FLUENT uses these velocities to update the node positions on the dynamic zone based on solid-body motion. Note that UDFs that are defined using DEFINE_CG_MOTION can only be executed as compiled UDFs.
 楼主| 发表于 2012-8-20 15:03:20 | 显示全部楼层

回复 2# gearboy78 的帖子

有没有相类似的例子啊。
 楼主| 发表于 2012-8-21 14:38:59 | 显示全部楼层
#include "udf.h"
#include <mem.h>
static real omega_calc = 0.0;
static real theta=0.697777777;
/*extern real omega_out=0.0; */
DEFINE_CG_MOTION(move_flapper,dt,vel,omega,time,dtime)
{
NV_S(omega, =, 0.0);
real torque, torque_w, torque_p,domega, omega_prev, omega_dot, omega_out;
const real inertia = 0.1875;
/* Compute the torque due to pressure P and weight W */
/*-----------------------------------------------------------------------*/
torque_w= -10.06506 * sin(theta); /* -g*L*W*sin(theta) */
torque_p= 81.61488* cos(theta);
torque= torque_p + torque_w;
domega = dtime * torque / inertia;
omega_dot= torque / inertia;
/* Calculate the angular velocity */
/*-----------------------------------------------------------------------*/
omega_prev = omega_calc;
omega_calc = omega_calc + domega;
omega_out = omega_calc;
/* Calculate the angle theta (Taylor expansion) */
/*-----------------------------------------------------------------------*/
theta=theta + 0.5*dtime*(omega_prev+omega_calc);
#if !RP_NODE
Message ("\ntorque_p = %f, torque_W = %f, torque = %f, domega = %f, omega_calc=%f\n", torque_p, torque_W, torque, domega, omega_calc);
Message ("\n---------------------------------------");
Message ("\ntheta: %f\n", theta);
#endif
/* Resitrictions, make it stop at the end points*/
/*-----------------------------------------------------------------------*/
if (theta < 0.0872664626*1.1) /* Corresponds to 5.5 degrees */
{
omega_out=0;
omega_calc=0;
domega=0;
theta=0.0872664626*1.1;
Message("\nSTOP - Almost closed!");
}
if (theta >0.697777777)
{
omega_out=0;
omega_calc=0;
domega=0;
theta=0.697777777;
Message("\nSTOP - Fully open!");
}
#if !RP_NODE
/* Saving the values*/
/*-----------------------------------------------------------------------*/
FILE *fd_time;
FILE *fd_torque;
FILE *fd_omega;
FILE *fd_theta;

fd_time = fopen("data_time.txt","a");
fd_torque = fopen("data_torque.txt","a");
fd_omega = fopen("data_omega.txt","a");
fd_theta = fopen("data_theta.txt","a");

fprintf(fd_time, "%f \n", time);
fprintf(fd_torque, "%f \n", torque);
fprintf(fd_omega, "%f \n", omega_out);
fprintf(fd_theta, "%f \n", theta);

fclose(fd_time);
fclose(fd_torque);
fclose(fd_omega);
fclose(fd_theta);

Message ("\nomega: %f\n ", omega_out) ;
Message ("\n---------------------------------------\n");
#endif
omega[1]=omega_out;
}
 楼主| 发表于 2012-8-21 14:39:55 | 显示全部楼层
大家看看我编的那段程序里面有什么问题。。。求高手帮忙啊。往fluent软件里编译的时候总是说第三行出错。不知道是什么错误。line 3: parse error。高手帮帮忙。教教我啊。。。
 楼主| 发表于 2012-8-21 14:40:03 | 显示全部楼层
大家看看我编的那段程序里面有什么问题。。。求高手帮忙啊。往fluent软件里编译的时候总是说第三行出错。不知道是什么错误。line 3: parse error。高手帮帮忙。教教我啊。。。
 楼主| 发表于 2012-8-22 14:19:21 | 显示全部楼层
大家帮帮忙啊。。。
 楼主| 发表于 2012-8-24 15:44:26 | 显示全部楼层
)(system "move user_nt.udf libudf\ntx86\2d"0
(system "copy C:\Fluent.Inc\fluent6.1.22\src\makefile_nt.udf libudf\ntx86\2d\makefile"已复制 1 个文件。
0
(chdir "libudf"()
(chdir "ntx86\2d"()
'nmake' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
'nmake' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Done.
 楼主| 发表于 2012-8-24 15:45:07 | 显示全部楼层
出现这个问题具体的解决办法是什么啊。。。网上都说是环境变量的问题。可是我改了之后还是不行啊。。。求帮助啊。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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