How to make it work on parallel mode
This UDF works perfectly in serial mode,
/************************************************** ******************** UDF to calculate temperature at outlet and use it as a inlet temperature (for closed loop ) ************************************************** *********************/ #include "udf.h" #include "prf.h" #include "para.h" real tavg, Tavg; DEFINE_EXECUTE_AT_END(average_temp) { #if !RP_HOST real temper = 0.0; real area = 0.0; real area_tot = 0.0; Domain *d; face_t f; real A[ND_ND]; int zone_ID; int ID = 7; /*outlet boundary wall*/ Thread *t; d = Get_Domain(1); t = Lookup_Thread(d,ID); tavg = 0.0; Tavg = 0.0; begin_f_loop(f,t) { F_AREA(A,f,t); area = NV_MAG(A); area_tot += area; temper = F_T(f,t); tavg += temper*area; } end_f_loop(f,t) Tavg = tavg/=area_tot; printf("Tavg = %g Total_area = %g\n",Tavg,area_tot); #endif } #include "udf.h" DEFINE_PROFILE(inlet_temp,t,i) { #if !RP_HOST face_t f; begin_f_loop(f,t) { F_PROFILE(f,t,i) = tavg; } end_f_loop(f,t) /* printf("Inlet_temperature = %g\n",tavg); */ #endif } But when i try to compile it, I am getting an error Tavg = -nan(ind) Total_area = 0 Tavg = -nan(ind) Total_area = 0 Tavg = -nan(ind) Total_area = 0 Tavg = 295 Total_area = 7.83488e-05 Tavg = -nan(ind) Total_area = 0 Tavg = -nan(ind) Total_area = 0 I need help on how to use PRF_GSUM1(....) |
Can you not use periodic BC to couple inlet and outlet?
|
Code:
/************************************************** ******************** |
Dear Tkachenko,
Yes, Periodic BC works perfectly but I also have to use outlet temperature to calculate thermal properties. |
All times are GMT -4. The time now is 12:01. |