CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

segmentation error(again)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 13, 2016, 14:54
Default segmentation error(again)
  #1
Boh
Member
 
Join Date: Sep 2016
Posts: 33
Rep Power: 10
Boh is on a distinguished road
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 is offline   Reply With Quote

Old   November 14, 2016, 05:06
Default
  #2
Boh
Member
 
Join Date: Sep 2016
Posts: 33
Rep Power: 10
Boh is on a distinguished road
The error appears when I try to hook the function to the boundary
Boh is offline   Reply With Quote

Old   November 14, 2016, 20:15
Default
  #3
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
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);
    ...
`e` is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sigSegv error, segmentation error? ollebapur OpenFOAM Running, Solving & CFD 1 June 11, 2018 08:54
Segmentation fault when running dieselFoam or dieselEngineFoam in parallel francesco OpenFOAM Bugs 4 May 2, 2017 22:59
Segmentation Fault w/ compiled OF 2.2.0 - motorBike example sudo OpenFOAM Running, Solving & CFD 3 April 2, 2013 18:27
segmentation fault when installing OF-2.1.1 on a cluster Rebecca513 OpenFOAM Installation 9 July 31, 2012 16:06
Segmentation Violation Corentin FLUENT 1 February 13, 2011 02:07


All times are GMT -4. The time now is 18:56.