|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
/*迭代时间不同,入口速度也不同*/
#include "udf.h"
int kount=0;
DEFINE_ADJUST(demo_calc,domain)
{
kount++;
printf("kount=%d\n",kount);
}
DEFINE_PROFILE(x_velocity,thread,nv)
{
real temp;
real temp_1;
real e,e_1;
real r=350.;
real kp=0.01;
real ki=0.01;
real x[2];
real y;
face_t f;
Thread *d;
Thread *t;
cell_t c;
if (kount<=50)
{
F_PROFILE(f,thread,nv)=1;
begin_f_loop(f,thread)
{
y=x[1];
temp_1=C_T_M1(c,t);
temp=C_T(c,t);
e_1=r-temp_1;
e=r-temp;
F_PROFILE(f,thread,nv)+=kp*(e-e_1)+ki*e;
}
end_f_loop(f,thread)
}
else if(kount<=100.&&kount>=50.)
{
F_PROFILE(f,thread,nv)=2.;
begin_f_loop(f,thread)
{
y=x[1];
temp_1=C_T_M1(c,t);
temp=C_T(c,t);
e_1=r-temp_1;
e=r-temp;
F_PROFILE(f,thread,nv)+=kp*(e-e_1)+ki*e;
}
end_f_loop(f,thread)
}
else if(kount<=150.&&kount>=100.)
{
F_PROFILE(f,thread,nv)=4.;
begin_f_loop(f,thread)
{
y=x[1];
temp_1=C_T_M1(c,t);
temp=C_T(c,t);
e_1=r-temp_1;
e=r-temp;
F_PROFILE(f,thread,nv)+=kp*(e-e_1)+ki*e;
}
end_f_loop(f,thread)
}
else
{
F_PROFILE(f,thread,nv)=6.;
begin_f_loop(f,thread)
{
y=x[1];
temp_1=C_T_M1(c,t);
temp=C_T(c,t);
e_1=r-temp_1;
e=r-temp;
F_PROFILE(f,thread,nv)+=kp*(e-e_1)+ki*e;
}
end_f_loop(f,thread)
}
}
二维,想得到某点温度,然后与期望值比较,经过一个控制器计算然后将值返回给入口 |
|