fluent UDF好像没有抓取到最大温度,请帮忙指正? 50
浏览:1462 回答:6
程序是想抓取一个域内体网格的最大温度tmax,然后用tmax和设定的温度313.15比较大小,然后来判定执行哪个加热功率,但是程序一直执行define profile语句中else的功率,虽然tmax已经大于我设定的313.15。实在看不出哪里有错,还请各位大神帮忙指点一下,感谢!感谢!
程序如下:
#include "udf.h"
real tmax;
real thermosensor_temperature;
real heat_change_temperature = 313.15; /*40 du*/
real heater_change = 26400000; /*100W*/
real heater_unchange = 79600000;/*300W*/
DEFINE_EXECUTE_AT_END(tsensor)
{
cell_t c;
Domain *d;
Thread *t;
d = Get_Domain(1);
t = Lookup_Thread(d,6);
tmax=253.15; /*-20du*/
begin_c_loop(c,t)
{
thermosensor_temperature = C_T(c,t); /* get thermocouple temperature */
if(thermosensor_temperature > tmax)
{
tmax = thermosensor_temperature;
}
else
{
tmax=253.15;/*-20du*/
}
}
end_c_loop(c,t)
}
DEFINE_PROFILE(heat_bc,t,i)
{
face_t f;
if (tmax >= heat_change_temperature)
{
begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = heater_change;
/*Message("The heater_change is '%f'\n", heater_change);*/
}
end_f_loop(f,t)
}
else
{
begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = heater_unchange;
/*Message("The heater_unchange is '%f'\n", heater_unchange);*/
}
end_f_loop(f,t)
}
}




















