|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
下面的UDF,我是想把一个出口边界的温度值,增加一个常数,然后给入口边界,这段在串行计算可以计算正确,但是放到并行里面,加边界就出错了
#include "udf.h"
DEFINE_PROFILE(tem_profile,t,i)
{
real T_Total=0.0;
real T_average_indutor_out=0.0;
real current_time=CURRENT_TIME;
real n=0;
real T_WALL;
real T_inductorinlet=0.0;
real T_inlet;
real x[ND_ND];
real m=0.0;
#if !RP_HOST
face_t f;
cell_t c;
Thread *tc;
Thread *t0;
Domain *domain=Get_Domain(1);
#endif
#if !RP_NODE
FILE *fout;
FILE *fout123;
#endif
#if !RP_NODE
fout=fopen("inductor_outlet_aveT.txt","a+");
fout123=fopen("inductor_inlet.txt","a+");
Message("\n openfile \n");
#endif
#if !RP_HOST
tc=Lookup_Thread(domain,16);
begin_f_loop_int(f,tc)
{
T_WALL=F_T(f,tc);
T_Total+=T_WALL;
n++;
}
end_f_loop_int(f,tc)
# if RP_NODE
T_Total=PRF_GRSUM1(T_Total);
n=PRF_GRSUM1(n);
#endif
#endif
node_to_host_real_2(T_Total,n);
#if !RP_NODE
T_average_indutor_out=T_Total/n;
fprintf(fout," %lg %lg \n ",current_time,T_average_indutor_out);
fclose(fout);
#endif
#if !RP_HOST
begin_f_loop_int(f,t)
{
F_PROFILE(f,t,i)=T_average_indutor_out+8;
T_inductorinlet+=F_T(f,t);
m++;
}
end_f_loop_int(f,t)
# if RP_NODE
T_Total=PRF_GRSUM1(T_inductorinlet);
m=PRF_GRSUM1(m);
#endif
#endif
node_to_host_real_2(T_inductorinlet,m);
#if !RP_NODE
T_inlet=T_inductorinlet/m;
fprintf(fout123," %lg %lg \n ",current_time,T_inlet);
fclose(fout123);
#endif
} |
|