Fluent关于UDF实现速度入口随时间变化](这里写自定义目录标题)
fluent编译过程
小编也是第一次实现UDF在fluent中实现控制速度入口条件随时间变化,主要的学习过程还是网上的一些资料,编译之前需要设置fluent(我用的是19.1)与VS2013的环境配置,只有正确的环境配置才能通过编译。
编程语言
编程语言用的C,代码可以自己在TXT文件中写好,喜欢用IDE编写 的话也可去VS中或则其他编译器。
- 代码如下
#include “udf.h”
DEFINE_PROFILE(inlet_velocity_O2, thread, position)
{
real t,v;
face_t f;
begin_f_loop(f, thread)
{
t=RP_Get_Real(“flow-time”);
v =1.736exp(-((t- 29.69)/3.18)((t- 29.69)/3.18)) +31.14exp(-((t-42.86)/22.89)((t-42.86)/22.89));
F_PROFILE(f,thread,position)=v;
}
end_f_loop(f,thread)
}
DEFINE_PROFILE(inlet_velocity_CO, thread, position)
{
real t,v;
face_t f;
begin_f_loop(f, thread)
{
t=RP_Get_Real(“flow-time”);
v=1.034exp(-((t- 29.69)/2.872)((t- 29.69)/2.872)) + 18.59exp(-((t-40.59)/21.4)((t-40.59)/21.4));
F_PROFILE(f,thread,position)=v;
}
end_f_loop(f,thread)
}
DEFINE_PROFILE(inlet_velocity_Air, thread, position)
{
real t,v;
face_t f;
begin_f_loop(f, thread)
{
t=RP_Get_Real(“flow-time”);
v =3.539exp(-((t-29.69)/2.842)((t-29.69)/2.842)) + 63.67exp(-((t-40.37)/21.26)((t-40.37)/21.26));
F_PROFILE(f,thread,position)=v;
}
end_f_loop(f,thread)
}
DEFINE_PROFILE(inlet_velocity_CO2, thread, position)
{
real t,v;
face_t f;
begin_f_loop(f, thread)
{
t=RP_Get_Real(“flow-time”);
v=11.45exp(-((t-33.63)/ 14)((t-33.63)/ 14)) + 10.83exp(-((t-23.19)/30.45)*((t-23.19)/30.45));
F_PROFILE(f,thread,position)=v;
}
end_f_loop(f,thread)
}
这样就okl!!!