I wrote a udf file to calculate temperature gradient, But I recieved a fatal error....
I wrote this:
.
.
.
#include"udf.h"
#include"sg.h"
DEFINE_ADJUST(Direct, d)
{
int ID=10;
float T_i=300.0,T_f=500.0;
float ds, A_by_es, flux = 0.0;
float H_flux[1],A[ND_ND], es[ND_ND], dr0[ND_ND],GR[ND_ND];
face_t f;
cell_t c0,c;
Thread *t0, *t;
t = Lookup_Thread(d, ID);
begin_f_loop(f, t)
{
BOUNDARY_FACE_GEOMETRY(f, t, A, ds, es, A_by_es, dr0);
c0 = F_C0(f, t);
t0 = THREAD_T0(t);
GR[0]= C_T_RG(c0, t0)[0];
GR[1]= C_T_RG(c0, t0)[1];
flux += NV_DOT(GR, es);
}
end_f_loop(f, t)
H_flux[0] = (202.4*flux)/(T_f - T_i);
}