Fluent UDF to compute radiation heat rate on an interior surface

A need to compute radiation heat transfer at an interior surface has arised. A UDF has been generated.
The UDF loops through all DO directions for each face on the surface, and depending on the s dot n sign it picks up the radiative intensity "upstream" of the surface so that only incoming radiation on either side is considered. For each DO direction there is incoming radiation from both sides so that in the end the integral computes a net quantity.


#include "udf.h"


#define TARGET_THREAD_ID 18 /* rad. heat rate computed on this thread */


#define C_DO_I(c,t,i) C_STORAGE_R_XV(c,t,SV_DO_I,i)


DEFINE_ON_DEMAND(my_demand)
{
Domain *d;
face_t f;
Thread* t0;
Thread* t1;
real Q = 0.;
Thread* t = Lookup_Thread(root_domain, TARGET_THREAD_ID);
if (t == NULL) Error("can't lookup thread in my_adjust!n");

t0 = THREAD_T0(t);
t1 = THREAD_T1(t);
begin_f_loop (f,t)
{
int j;
real A[ND_ND];
cell_t c0 = F_C0(f,t);
cell_t c1 = F_C1(f,t);

F_AREA(A,f,t);

/*
* Calculate Q = integral_4pi I s.A dOmega
* ~ sum_j=1,n I s.A w_j
*/
for (j = 0; j < sg_disco; j++)
{
real dp = NV_DOT(A,disco_ords[j]);
real I = (dp > 0 ? C_DO_I(c0,t0,j) : C_DO_I(c1,t1,j)); /* upwinded */
Q += disco_weights[j]*dp*I;
}
}
end_f_loop (f,t)
Message("# Rad. Heat Rate (thread %d->%d) = %15.2f (W)n",
THREAD_ID(t0), THREAD_ID(t1), Q);
}





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