可能你想法错了。边界条件部分不应该跟累加传热量的循环放在一起,这样的实际效果跟你想的是不一样的。
还有边界条件设定时应该用begin-f-loop
建议修改成如下形式试试
#include "udf.h"
real Q_tot=0;
DEFINE_PROFILE (unsteady_heatflux, thread, position)
{
Domain *d;
real cp=880;
real density=2180;
real tempn, templ, volume, Q;
Thread *t;
cell_t c;
d= Get_Domain(1); /*Get the domain using Fluent utility *//*Loop over all cell threads in the domain*/
real time= RP_Get_Real("flow-time";
real b=(int)(time/3600)+1;
int i=(int)((b-1)/24);
real Heat[3]={278.5, 280.7, 278.5};
thread_loop_c(t,d) /*Compute Q */ /*Loop over all cells */
begin_c_loop(c,t)
{