fluent UDF好像沒有抓取到最大溫度,請幫忙指正? 50
瀏覽:1661 回答: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)
}
}




















