CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   segmentation error(again) (https://www.cfd-online.com/Forums/fluent-udf/179971-segmentation-error-again.html)

Boh November 13, 2016 13:54

segmentation error(again)
 
Hi! I have again a problem with the segmentation error....the function works fine until the 3° face loop...but when there is also the third loop the segmentation error appears...does anyone have any idea?



#include "udf.h"
#define Diff 2.82e-05
#define k 0.0264
#define cp 1005
#define Dh 11.85e-3
#define ht 16.8
#define s 1e-3
#define Cads 0.001

DEFINE_PROFILE(Conc_boundary, t, i)
{
real Tin = 0;
real Tout = 0;
real Tm;
real Cinter;
real Cinf;
real xy[ND_ND];
Domain *d;
real Le;
real rho;
real a = 0;
real b = 0;
real hm;
Thread *t_interface;
Thread *t_air_symmetry;
Thread *t_inlet;
Thread *t_outlet;
Thread *t0_air;
cell_t c0;
Thread *t0;
cell_t c0_air;
Thread *t0_inter;
cell_t c0_inter;
face_t f;
t_interface = Lookup_Thread(d, 8);
t_air_symmetry = Lookup_Thread(d, 18);
t_inlet = Lookup_Thread(d, 15);
t_outlet = Lookup_Thread(d, 22);
begin_f_loop(f, t_inlet)
{
c0 = F_C0(f, t_inlet);
t0 = THREAD_T0(t_inlet);
F_CENTROID(xy, c0, t0);
Tin+= F_T(c0,t0);
a++;
}
end_f_loop(f,t_inlet)
begin_f_loop(f, t_outlet)
{

c0 = F_C0(f, t_outlet);
t0 = THREAD_T0(t_outlet);
F_CENTROID(xy, c0, t0);
Tout+= F_T(c0, t0);
b++;
}
end_f_loop(f, t_outlet)
Tin = Tin / a;
Tout = Tout / b;
Tm = 0.5*(Tout + Tin);
rho = pow(10, 5) / (287 * Tm);
Le = k / (rho*cp*Diff);
hm = ht / (pow(Le, 2 / 3)*rho*cp);
begin_f_loop(f, t)
{

c0_air = F_C0(f, t_air_symmetry);
t0_air = THREAD_T0(t_air_symmetry);
F_CENTROID(xy, c0_air, t0_air);
Cinf = F_YI(c0_air, t0_air, i);
c0_inter = F_C0(f, t_interface);
t0_inter = THREAD_T0(t_interface);
F_CENTROID(xy, c0_inter, t0_inter);
Cinter = F_YI(c0_inter, t0_inter,i);
F_PROFILE(f, t, i) = Cinter - s*hm / Diff*(Cinf - Cinter);
}
end_f_loop(f, t)

}

Boh November 14, 2016 04:06

The error appears when I try to hook the function to the boundary

`e` November 14, 2016 19:15

The third face loop is using 't' instead of 't_air_symmetry'.

Code:

begin_f_loop(f, t)
{
    c0_air = F_C0(f, t_air_symmetry);
    ...



All times are GMT -4. The time now is 13:54.