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

Segmentation Fault on F_C0, F_AREA, etc

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 24, 2012, 15:24
Default Segmentation Fault on F_C0, F_AREA, etc
  #1
New Member
 
Salvador Ortiz
Join Date: Oct 2012
Posts: 1
Rep Power: 0
salvadortiz is on a distinguished road
Hi,

I'm trying to write a simple code for computing gradients, but cannot get past a SIGSEGV signal at the " c1 = F_C1(f,t);" line. I also get this when trying to use F_AREA (but I can compute F_CENTROID).

Can anybody tell what is wrong here?

Thanks in advance

DEFINE_ON_DEMAND(gradientes)
{
real gx, gy;
Thread *t, *t1;
cell_t c, c1;
face_t f;
int n=0;
real NV_VEC(A), NV_VEC(xxx), surf;
FILE *fout;

Domain *d; /* declare domain pointer since it is not passed as an
argument to the DEFINE macro */
d = Get_Domain(1); /* Get the domain using ANSYS FLUENT utility */
/* fout = fopen("faces.dat", "w"); */
fout = fopen("pressgrad.dat", "w");

thread_loop_c(t,d) /* Loop over all cell threads in the domain */
{
begin_c_loop(c,t) /* Loop over all cells */
{
gx = gy =0.;
c_face_loop(c,t,n) /*loopsoverallfacesofacell*/
{
f=C_FACE(c,t,n);
/* if (f) F_CENTROID(xxx, f,t); /\* AREA(A, f, t); *\/ */
/* fprintf(fout, "Cell %ld\tFace %d: %ld\t %g %g\n", c, n, f, xxx[0], xxx[1]); */
c1 = F_C1(f,t);
if (c1==c) c1 = F_C0(f,t);
F_AREA(A, f, t);
t1 = C_FACE_THREAD(c1,t,n);
if (t1==NULL) {
gx += (C_P(c,t))*A[0]/2.;
gy += (C_P(c,t))*A[1]/2.;
} else {
gx += (C_P(c,t)+C_P(c1,t1))*A[0]/2.;
gy += (C_P(c,t)+C_P(c1,t1))*A[1]/2.;
}
}

surf = C_VOLUME(c,t);
C_CENTROID(xxx,c,t);
fprintf(fout, "%g %g %g %g %g %g %g\n", xxx[0], xxx[1], C_P(c,t), C_P_G(c,t)[0], C_P_G(c,t)[1], gx/surf, gy/surf);
}
end_c_loop(c,t);
}
fclose(fout);
}
salvadortiz is offline   Reply With Quote

Reply

Tags
fluent, f_area, f_c0, sigsegv, udf

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
segmentation fault when installing OF-2.1.1 on a cluster Rebecca513 OpenFOAM Installation 9 July 31, 2012 15:06
Segmentation Fault Shawn_A OpenFOAM Running, Solving & CFD 6 October 31, 2011 15:38
Segmentation fault when running dieselFoam or dieselEngineFoam in parallel francesco OpenFOAM Bugs 3 June 10, 2011 09:30
forrtl: severe (174): SIGSEGV, segmentation fault occurred therockyy FLOW-3D 7 January 19, 2011 23:52
ParaView segmentation fault only for multiphase gwierink OpenFOAM 9 March 25, 2010 08:23


All times are GMT -4. The time now is 10:15.