CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

Segmentation violation error

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 21, 2012, 04:14
Default Segmentation violation error
  #1
Member
 
Indrajit
Join Date: Nov 2012
Posts: 33
Rep Power: 4
IndrajitW is on a distinguished road
Hi all,
I am using the user defined scalar equation in my case and I have written UDF for defining the specified flux boundary condition. The UDF compiles well and I am able to load the library and hook the boundary condition.But when I try to initialize it gives me a "fatal error:SEGMENTATION VIOLATION " error!!! Please let me know why could this happen.
Regards,
Indrajit
IndrajitW is offline   Reply With Quote

Old   December 22, 2012, 03:30
Default
  #2
Senior Member
 
Lucky Tran
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 594
Rep Power: 11
LuckyTran is on a distinguished road
Have you tried running in Serial mode? Segmentation errors can happen when initializing in parallel mode. See if initializing in serial fixes the error. After the initialization you can then switch back to parallel.

Just my guess.
LuckyTran is offline   Reply With Quote

Old   December 23, 2012, 01:41
Default
  #3
Member
 
Indrajit
Join Date: Nov 2012
Posts: 33
Rep Power: 4
IndrajitW is on a distinguished road
Hi LuckyTran,
I am already running it in serial mode.In fact when I hook the UDF on the wall boundary and then I try to initialize ,it gives me this error.Although my UDF compiles just fine, what could be the problem??
Regards,
Indrajit
IndrajitW is offline   Reply With Quote

Old   December 23, 2012, 01:56
Default
  #4
Senior Member
 
Lucky Tran
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 594
Rep Power: 11
LuckyTran is on a distinguished road
I believe the segmentation violation is also part of the greater class of access errors. Something is wrong with your UDF, and it is impossible to debug it without getting into the details. It may compile,which means that your syntax is correct, but it may not perform any meaningful actions. Anyway, anything could be wrong.

My next guess:

You may be hooking the UDF too early and your UDF is unable to do whatever it is you are telling it to do. This may mean that the UDF does not have all the data it needs to perform its task. Try running a few iterations without the UDF and then hooking it after to make sure there is data for the UDF.
LuckyTran is offline   Reply With Quote

Old   December 23, 2012, 06:23
Default
  #5
Member
 
Indrajit
Join Date: Nov 2012
Posts: 33
Rep Power: 4
IndrajitW is on a distinguished road
Hi Lucky Tran,
I am attaching the problematic part of my UDF the areas highlighted in red are my concern since w/o those the segmentation violation error is avoided, however i need to included these for my problem:
begin_f_loop(f,t)
{ c= F_C0(f,t);
t0=THREAD_T0(t);
pt=THREAD_SUB_THREAD(t0,1);
if(C_VOF(c,pt)==1)
{ a=1;
T=acos((LAMBDA*(x-1))-psg);
Ang[0]=cos(T);
Ang[1]=sin(T);
flux=NV_DOT(vel_val,Ang);
flux=2*flux;
if(m>0)
{ F_PROFILE(f,t,pos)=-((BETA*vel_val[0])+(SIGMA*z))*r/13;
r=r-1;
p=2;
}
else
{ F_PROFILE(f,t,pos)=((BETA*vel_val[0])+(SIGMA*z))*r/13;
r=r-1;
p=1;
}
}
parameter a is initialised before this f loop to 0 and x,y,z are also initialized to 0. After this "if" loop x,z,m and vel_val are calculated based on local values of velocity scalar, and gradient of scalar. The idea is for the first iteration C_VOF won't be 1 and so it won't enter if loop, instead it would go ahead to calculate x,m,z values for the cell (c,t0). When C_VOF =1 , these values would be of previous cell and would help calculation for the current cell.
Is the problem because my calculation is taking values from previous cell stored into x,z?? But m value is working fine.Also I tried C_UDMI to store and retrieve values for previous cell ,still got the same error.
Regards,
Indrajit
IndrajitW is offline   Reply With Quote

Reply

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
Compile calcMassFlowC aurore OpenFOAM Programming & Development 12 March 18, 2014 05:22
Ansys Fluent 13.0 UDF compilation problem in Window XP (32 bit) Yogini Fluent UDF and Scheme Programming 7 October 3, 2012 07:24
CGNS lib and Fortran compiler manaliac Main CFD Forum 2 November 29, 2010 07:25
attach/detach (valve opening/closing) phsieh2005 OpenFOAM Running, Solving & CFD 2 March 21, 2009 06:18
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50


All times are GMT -4. The time now is 19:32.