|
楼主 |
发表于 2011-11-23 22:42:29
|
显示全部楼层
代码如下应该没问题
#include "udf.h"
real avg_temp=300.0;
DEFINE_ADJUST(outlet_avg_temp, domain)
{
real NV_VEC(A);
real sum_T_A=0.0;
real sum_A=0.0;
Thread *thread_out;
face_t f;
Domain *domain;
domain=Get_Domain(1);
thread_out=Lookup_Thread(domain,z);z是流体ID
begin_f_loop(f,thread_out)
{
F_AREA(A,f,thread_out);
sum_A+=NV_MAG(A);
sum_T_A+=NV_MAG(A)*F_T(f, thread_out); }
end_f_loop(f,thread_out)
avg_temp=sum_T_A/sum_A;} |
|