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

A fatal signal (segmentation violation)

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

Like Tree1Likes
  • 1 Post By sutthinan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 18, 2011, 10:17
Smile A fatal signal (segmentation violation)
  #1
New Member
 
sutthinan
Join Date: Feb 2011
Posts: 9
Rep Power: 15
sutthinan is on a distinguished road
Hi everyone,

I need to control the geometry of boundary in function of pressure in fluent by using the UDF in deform function, but fluent show massage that "A fatal signal (segmentation violation)", I really don't know about this error, this is my UDF

#include "udf.h"
DEFINE_GEOM(deform, domain, dt, position)
{
Thread *t;
face_t f;
real x[ND_ND];
real NV_VEC (A);
real ho=0.000001, hc, def;
real presur[1000],xx[1000];
int max;
int i,j;
if (!Data_Valid_P ())
return;
i=0.;
begin_f_loop (f, t)
{
F_CENTROID(x,f,t);
xx[i]=x[0];
presur[i]=F_P(f, t);
i=i+1;
max=i;
}
end_f_loop (f, t)
i=0.;
j=0.;
begin_f_loop (f, t)
{
for(i = 0; i < max;i++)
{
def=(xx[j+1]-xx[j])*presur[j]*ln(fabs((xx[i+1]+xx[i])/2.-xx[j]*fabs((xx[i-1]+xx[i])/2.-xx[j]));
}
hc=def/(2.*3.14);
position[1]=ho+xx[j]*xx[j]/2.+hc;
j=j+1;
}
end_f_loop (f, t)
return position[1];
}



Many thanks
seucj likes this.
sutthinan is offline   Reply With Quote

Old   February 18, 2011, 11:07
Default
  #2
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 20
DoHander is on a distinguished road
Probably your vectors are smaller than the total number of faces from your mesh. Do a grid->check to see how many faces do you have and let me know.

Do
DoHander is offline   Reply With Quote

Old   February 18, 2011, 18:57
Smile
  #3
New Member
 
sutthinan
Join Date: Feb 2011
Posts: 9
Rep Power: 15
sutthinan is on a distinguished road
Hi Dohander,

My gird has the data as following;
Level Cells Faces Nodes Partitions
0 64902 98278 33377 1
1 cell zone, 6 face zones.


Thanks you so much for your suggestion.

Sutthinan
sutthinan is offline   Reply With Quote

Old   February 18, 2011, 20:45
Default
  #4
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 20
DoHander is on a distinguished road
OK,
Check if the total numbers of faces (not zones) is less than 1000. I think this is why you have the memory error, specifically here:

real presur[1000],xx[1000];
DoHander is offline   Reply With Quote

Old   February 19, 2011, 02:57
Default
  #5
New Member
 
sutthinan
Join Date: Feb 2011
Posts: 9
Rep Power: 15
sutthinan is on a distinguished road
Thank you for your advices, and I wonder that if I need to use the presure for calculating. Does which one appropriate between C_P(c,t) and F_P(f, t) ? (because both of them, I can get the same pressure)

sutthinan is offline   Reply With Quote

Old   February 19, 2011, 11:23
Default
  #6
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 20
DoHander is on a distinguished road
One is for the pressure at the center of a cell and one for the pressure at a face of a cell.
Try changing this line:

real presur[1000],xx[1000];

to

real presur[98280],xx[98280];

It should get rid of the memory violation error, at least I hope so.

Do
DoHander is offline   Reply With Quote

Old   March 16, 2011, 19:35
Thumbs down
  #7
New Member
 
Chun-Liang Wu
Join Date: May 2010
Posts: 2
Rep Power: 0
richardwu is on a distinguished road
what is the face thread t in the face loop? The pointer t is not initialized or assigned a valid value, which absolutely returns you a "segmentation fault" error.


Quote:
Originally Posted by sutthinan View Post
Hi everyone,

I need to control the geometry of boundary in function of pressure in fluent by using the UDF in deform function, but fluent show massage that "A fatal signal (segmentation violation)", I really don't know about this error, this is my UDF

#include "udf.h"
DEFINE_GEOM(deform, domain, dt, position)
{
Thread *t;
face_t f;
real x[ND_ND];
real NV_VEC (A);
real ho=0.000001, hc, def;
real presur[1000],xx[1000];
int max;
int i,j;
if (!Data_Valid_P ())
return;
i=0.;
begin_f_loop (f, t)
{
F_CENTROID(x,f,t);
xx[i]=x[0];
presur[i]=F_P(f, t);
i=i+1;
max=i;
}
end_f_loop (f, t)
i=0.;
j=0.;
begin_f_loop (f, t)
{
for(i = 0; i < max;i++)
{
def=(xx[j+1]-xx[j])*presur[j]*ln(fabs((xx[i+1]+xx[i])/2.-xx[j]*fabs((xx[i-1]+xx[i])/2.-xx[j]));
}
hc=def/(2.*3.14);
position[1]=ho+xx[j]*xx[j]/2.+hc;
j=j+1;
}
end_f_loop (f, t)
return position[1];
}



Many thanks
richardwu is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove the error:FLUENT received a fatal signal (SEGMENTATION VIOLATION). Conan FLUENT 9 December 20, 2019 13:31
signal 11 was caught: segmentation violation Ahlo CFX 1 August 3, 2009 12:05
segmentation violation wasan FLUENT 0 December 23, 2008 12:37
Fluent.6.2.received a fatal signal (SEGMENTATION ) Jungfeng FLUENT 0 October 8, 2007 12:05
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 16:16


All times are GMT -4. The time now is 11:01.