Calculate massflow rate and maximum temperature at an interior face

For post-processing purposes, it is often needed to determine the mass flow rate at an interior zone (that already has an ID). This information can be used to calculate mass flow average quantities.
The fact is that at interior faces the face variables F_U, F_V and F_W are not available for the segregated solver and the coupled solver.

/* This UDF will give a problem if the zoneID for a wall is given */
/* The zone ID should be for a interior face */

#include "udf.h"
#define zoneID 9 /*ID number to be specified */
#define axi 0 /* the Flag for an axisymmetric case */

cell_t c0,c1;
Thread *tc0,*tc1,*tf;
face_t f;
float MFR,sumMFR,area,temp0,temp,rho;
float face_area[ND_ND],temp_max;
float uvel,vvel,wvel;
Domain *domain=Get_Domain(1);

tf = Lookup_Thread(domain,zoneID);

sumMFR = 0.0;
temp_max =0.0;

c0 = F_C0(f,tf);
tc0 = F_C0_THREAD(f,tf);

c1 = F_C1(f,tf);
tc1 = F_C1_THREAD(f,tf);

area = NV_MAG(face_area);

temp = 0.5*( C_T(c0,tc0) + C_T(c1,tc1));

if (temp > temp_max) temp_max = temp;

/* check for SOLVER */
if (rp_seg)
MFR = F_FLUX(f,tf);
uvel = 0.5*( C_U(c0,tc0) + C_U(c1,tc1));
vvel = 0.5*( C_V(c0,tc0) + C_V(c1,tc1));
wvel = 0.5*( C_W(c0,tc0) + C_W(c1,tc1));
rho = 0.5*(C_R(c0,tc0) + C_R(c1,tc1));

MFR = C_R(c0,tc0)*( uvel*face_area[0] + vvel*face_area[1]
+ wvel*face_area[2]);

if (axi==1)

sumMFR += MFR;

MFR = sumMFR;

Message(" The mass flow rate through the face=%lfn",MFR);
Message(" The maximum temp on the face is =%lfn",temp_max);


Show Form
No comments yet. Be the first to add a comment!