CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Segmentation violation error (

IndrajitW December 21, 2012 04:14

Segmentation violation error
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.

LuckyTran December 22, 2012 03:30

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.

IndrajitW December 23, 2012 01:41

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??

LuckyTran December 23, 2012 01:56

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.

IndrajitW December 23, 2012 06:23

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:
{ c= F_C0(f,t);
{ a=1;
{ F_PROFILE(f,t,pos)=-((BETA*vel_val[0])+(SIGMA*z))*r/13;
{ F_PROFILE(f,t,pos)=((BETA*vel_val[0])+(SIGMA*z))*r/13;
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.

All times are GMT -4. The time now is 17:14.