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

Fluent Access Violation error after a specific iteration number

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Chris D
  • 1 Post By Evil Teyen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 20, 2010, 12:47
Default Fluent Access Violation error after a specific iteration number
  #1
New Member
 
willyCEP
Join Date: Apr 2010
Posts: 4
Rep Power: 16
willyCEP is on a distinguished road
Hello everyone,

I am getting problems while iterating in Fluent. Before posting here, I tried to search in the forum for any similar cases, but never figured out any useful thread. So here is my problem : I have in my case 2 velocity-inlet surfaces, with a given velocity profile for each surface. The velocity components at the boundary cells must be imported from an external file.
For that, I wrote a library of 6 udf functions, 3 udfs that reads the x,y and z velocity components for the first surface cells from 3 files, and 3 udfs for the other surface. The library is compiled and loaded in Fluent without any error. For each velocity inlet component on the 2 surfaces, the corresponding udf is attributed.
The iterations start normally but after 83 exact iterations, I get the error :
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()
I tried to write the case and data files before getting the error, exit Fluent and then reopen the saved case and data files. The simulation continues normally for other 83 iterations. So I must always save the case and data files before 83 successive iterations, reopen Fluent and continue iterations till the convergence. I tried with other similar cases, I got the same problem but with a different successive iterations number. Desperately trying to solve out these "magic numbers" problem, I decided to share it with you.
For any idea or suggestion, I'm ready to hear from you.
Thanks for the assistance
willyCEP is offline   Reply With Quote

Old   April 20, 2010, 15:48
Default
  #2
Senior Member
 
Chris
Join Date: Jul 2009
Location: Ohio, USA
Posts: 169
Rep Power: 17
Chris D is on a distinguished road
There are some generic threads about this on the FLUENT University boards:

http://university.fluent.com/forum/v...00549a58d0c280
http://university.fluent.com/forum/v...9eaf9650f7564c

You can't post there anymore, but it's still a good reference.
Chris D is offline   Reply With Quote

Old   April 21, 2010, 04:15
Default
  #3
New Member
 
willyCEP
Join Date: Apr 2010
Posts: 4
Rep Power: 16
willyCEP is on a distinguished road
I have already checked these threads. The difference with my case is that the error messages reported in these threads are gotten while activating the udf or while initialization, both working nicely in my case. The error I get is displayed while iterating and for a given number of successive iterations, and I can't figure out if the problem is generated from my udf or from Fluent because the simulation continues normally after exiting and starting calculation from where it crashes before.
willyCEP is offline   Reply With Quote

Old   April 21, 2010, 09:49
Default
  #4
Senior Member
 
Chris
Join Date: Jul 2009
Location: Ohio, USA
Posts: 169
Rep Power: 17
Chris D is on a distinguished road
Have you tried printing something in the command window to keep track of where you are in the UDF in order to debug? Add some statements to your code that prints "point 1", "point 2", etc, throughout your UDF to see exactly where it is crashing. It sounds like your counting something in your UDF, and when you get to 83 iterations, the execution switched to a different part of the code where you have a problem. (I have no clue if this is actually the problem, this is only what I would try. I hope it helps in at least some small way.)
Chris D is offline   Reply With Quote

Old   April 22, 2010, 10:09
Default
  #5
New Member
 
willyCEP
Join Date: Apr 2010
Posts: 4
Rep Power: 16
willyCEP is on a distinguished road
Thanks for your idea and the support.
That's what I tried to do : I printed message at the beginning and the end of each udf, then I executed the same simulation several times. After 83 iterations, simulation crashed inside one UDF, but surprisingly each time it is crashed randomly in one of the 6 UDFs, meaning that if it crashed the first time in UDF n°2, the next same simulation it can pass this UDF but will crash as example in UDF n°4 !! There are no tricks in my UDFs, just open a file, read values inside in the order and attribute them to the mesh faces (just three code lines for each UDF), this is repeated every iteration.
I also checked that the mesh faces number is the same as the values number in the 6 files, to insure that all the mesh faces are initialized correctly with the specified boundary while iterating. This avoids the memory stack that can accumulate over iterations and can possibly lead to the error.
I know it is a strange problem, but I manage to autosave my data after 80 successive iterations, then run again the calculations. At the convergence, the boundary conditions are the same as defined in my files, and I get logical results. The problem is that I must keep up manually this procedure from the beginning till the convergence.
willyCEP is offline   Reply With Quote

Old   April 22, 2010, 11:34
Default
  #6
Senior Member
 
Chris
Join Date: Jul 2009
Location: Ohio, USA
Posts: 169
Rep Power: 17
Chris D is on a distinguished road
I think the ACCESS_VIOLATION error is thrown when your code is looking for something that isn't there. Since your UDF involves file input/output, you might be trying to open a file that hasn't been created yet. You should add a line in your code before you try to open a file that checks to see if the file actually exists. If it doesn't, then have your code print a message that tells you where the failure occurred. This way, you can see what file your code was looking for when it crashed, and then you can try to figure out why it wasn't there.
yashganatra likes this.
Chris D is offline   Reply With Quote

Old   April 23, 2010, 10:23
Default
  #7
New Member
 
willyCEP
Join Date: Apr 2010
Posts: 4
Rep Power: 16
willyCEP is on a distinguished road
Bug fixed !!
Accidentally I put the file pointer destructor "fclose" inside an if statement loop which is not always true. The memory leaks cause the ACCESS_VIOLATION error after 83 iterations.
Thank you Chris for the help.
willyCEP is offline   Reply With Quote

Old   April 23, 2010, 11:52
Default
  #8
Senior Member
 
Chris
Join Date: Jul 2009
Location: Ohio, USA
Posts: 169
Rep Power: 17
Chris D is on a distinguished road
Awesome! I'm glad it works for you!
Chris D is offline   Reply With Quote

Old   September 25, 2010, 02:53
Angry Very urgent- FLUENT FATAL SIGNAL(Access Violation)
  #9
New Member
 
S. Mano Theja
Join Date: Sep 2010
Posts: 4
Rep Power: 16
hari10 is on a distinguished road
Hiii the following UDF gives access violation fatal error during execution in FLUENT while running in interpreted mode.

I'm trying to simulate a 2D fluidised bed and I have used this UDF to update mass fractions of two species(Oxygen and Ozone(Ozone decomposition)) ie. for the volumetric rate, in two phases according to an equation of mass balance using finite difference method. I have tried a lot and I'm running out of time. Kindly help me in this regard.

Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()



#include "udf.h"
#include "threads.h"
#define C_NFACES(c,t)(cell_type_nfaces[(int)(C_TYPE((c),(t)))])
real deltaT = 0.0002;
real uX = 0.01;
real uY = 0.02;
int h = 200;
real dAM = 0.00001;
real epsilon = 0.95;
real kG = 1;
real epsilonS = 0.97;
real kR = 5.4;
real dCell = 0.01;
real dP = 1;
int l = 20;

DEFINE_EXECUTE_ON_LOADING(inst_cValues, libname)
{
Thread *t;
cell_t c;
Domain *d;
Thread **pt; /* initialize pt */


thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
if(Data_Valid_P())
{
pt = THREAD_SUB_THREADS(t);
C_YI(c, pt[0], 0) = 0.2097;
C_YI(c, pt[1], 0) = 0;
C_YI(c, pt[0], 1) = 0.1;
C_YI(c, pt[1], 1) = 0;
}


}
end_c_loop(c,t)
}
}

DEFINE_ADJUST(adjustRate, d)
{
Thread* t;
cell_t c, c1, c2;
Thread *newT;
face_t f;
cell_t leftCell, rightCell, aboveCell, belowCell;
int count = 0, temp1, temp2, temp3, temp4;

int n = 0;
int nz;
cell_t adjC;
real x1[ND_ND], x2[ND_ND];

Thread **pt;
Thread *ft;
int boundThread = 1;
int x_coord,y_coord, x;

d = Get_Domain(1);
thread_loop_c(t, d)
{
begin_c_loop(c, t)
{
count = 0;
C_CENTROID( x1, c, t);
x_coord = x1[0]/dCell;
y_coord = x1[1]/dCell;

c_face_loop( c, t, nz)
{
f = C_FACE(c, t, nz);
ft = C_FACE_THREAD(c,t,nz);

c1 = c;
c2 = c;
if(!(x_coord == 0 || x_coord == l-1 || y_coord == 0 || y_coord == h-1))
c1 = F_C0(f, t);
if(!(x_coord == 0 || x_coord == l-1 || y_coord == 0 || y_coord == h-1))
c2 = F_C1(f, t);


if(c1 == c)
{
C_CENTROID( x2, c2, t);
adjC = c2;
}
else
{
C_CENTROID(x2, c1, t);
adjC = c1;
}

if(x1[0] > x2[0])
{
leftCell = adjC;
count++;
}
else if(x1[0] < x2[0])
{
rightCell = adjC;
count++;
}
else if(x1[1] > x2[1])
{
belowCell = adjC;
count++;
}
else if(x1[1] < x2[1])
{
aboveCell = adjC;
count++;
}





}

if(count >= 4 && Data_Valid_P())
{
x = (int)x1[0]/dCell;
pt = THREAD_SUB_THREADS(t);



temp1 = dAM/x*( C_YI_M1(rightCell, pt[0], 0) - C_YI_M1(leftCell, pt[0], 0) )/2/h + dAM *( C_YI_M1(rightCell, pt[0], 0)-2*C_YI_M1(c, pt[0], 0)+C_YI_M1(leftCell, pt[0], 0) )/h/h + dAM*( C_YI_M1(aboveCell, pt[0], 0)-2*C_YI_M1(c, pt[0], 0)+C_YI_M1(belowCell, pt[0], 0) )/h/h + 6*(1-epsilon)/dP*kG*( C_YI_M1(c, pt[0], 0)-C_YI_M1(c, pt[1], 0) )// + (1-epsilon)*epsilonS*kR*C_YI_M1(c, t, 1)
+ C_YI_M1(c, pt[0], 0)/deltaT - uX*( C_YI_M1(rightCell, pt[0], 0)-C_YI_M1(leftCell, pt[0], 0) )/2/h - uX*C_YI_M1(c, pt[0], 0)/x - uY*( C_YI_M1(aboveCell, pt[0], 0)-C_YI_M1(belowCell, pt[0], 0) )/2/h;
temp1 *= deltaT;
if(temp1 > 0 && temp1 < 1)
C_YI(c, pt[0], 0) = temp1;
else
C_YI(c, pt[0], 0) = 0;

temp2 = 6/dP*kG*( C_YI_M1(c, pt[0], 0)-C_YI_M1(c, pt[1], 0) ) + epsilonS*kR*C_YI_M1(c, pt[1], 0) + C_YI_M1(c, pt[1], 0)/deltaT;
temp2 *= deltaT;
if(temp2 > 0 && temp2 < 1)
C_YI(c, pt[1], 0) = temp2;
else
C_YI(c, pt[1], 0) = 0;


temp3 = dAM/x*( C_YI_M1(rightCell, pt[0], 1) - C_YI_M1(leftCell, pt[0], 1) )/2/h + dAM *( C_YI_M1(rightCell, pt[0], 1)-2*C_YI_M1(c, pt[0], 1)+C_YI_M1(leftCell, pt[0], 1) )/h/h + dAM*( C_YI_M1(aboveCell, pt[0], 1)-2*C_YI_M1(c, pt[0], 1)+C_YI_M1(belowCell, pt[0], 1) )/h/h + 6*(1-epsilon)/dP*kG*( C_YI_M1(c, pt[0], 1)-C_YI_M1(c, pt[1], 1) )// + (1-epsilon)*epsilonS*kR*C_YI_M1(c, t, 1)
+ C_YI_M1(c, pt[0], 1)/deltaT - uX*( C_YI_M1(rightCell, pt[0], 1)-C_YI_M1(leftCell, pt[0], 1) )/2/h - uX*C_YI_M1(c, pt[0], 1)/x - uY*( C_YI_M1(aboveCell, pt[0], 1)-C_YI_M1(belowCell, pt[0], 1) )/2/h;
temp3 *= deltaT;
if(temp1 > 0 && temp1 < 1)
C_YI(c, pt[0], 1) = temp3;
else
C_YI(c, pt[0], 1) = 0;

temp4 = 6/dP*kG*( C_YI_M1(c, pt[0], 1)-C_YI_M1(c, pt[1], 1) ) + epsilonS*kR*C_YI_M1(c, pt[1], 1) + C_YI_M1(c, pt[1], 1)/deltaT;
temp3 *= deltaT;
if(temp1 > 0 && temp1 < 1)
C_YI(c, pt[1], 1) = temp4;
else
C_YI(c, pt[1], 1) = 0;

}

}
end_c_loop(c, t)
}
}

DEFINE_VR_RATE(user_rate, c, t, r, mole_weight, species_mf, rate, rr_t)
{
if(Data_Valid_P() )
{
Thread **pt = THREAD_SUB_THREADS(t);
*rate = kR * epsilonS * C_YI(c, pt[1], 1);

}
else
*rate = 0;
*rr_t = *rate;
}

Even if I remove all the functions and just keep the DEFINE_VR_RATE function, an error occured in 81st loop..

Thanks in advance
hari10 is offline   Reply With Quote

Old   November 23, 2010, 16:54
Default A question!
  #10
New Member
 
gholam
Join Date: Nov 2010
Posts: 2
Rep Power: 0
gholoomi is on a distinguished road
Dear all,

I have defined a DEFINE_EXECUTE_AT_END to calculate species mass fraction near the wall and I save it in a file.

after 101 iterations, Fluent quits with no warning or errors!

I was wondering if anybody has observed the same problem.

Thanks,
Gholam
gholoomi is offline   Reply With Quote

Old   March 4, 2011, 09:24
Default segmentation violation
  #11
New Member
 
sutthinan
Join Date: Feb 2011
Posts: 9
Rep Power: 15
sutthinan is on a distinguished road
Hi everyone,

I have a same your problem. I found that the main reason is the array that we declare by our self, such as xx[100]. This problem may be fixed by using the function as following

xx=(real *)malloc(size * sizeof(real));
sutthinan is offline   Reply With Quote

Old   August 29, 2012, 13:10
Default Thread necromancy..
  #12
New Member
 
Teyen Widdicombe
Join Date: Jul 2012
Location: UK
Posts: 5
Rep Power: 14
Evil Teyen is on a distinguished road
I am getting the access violation error on initialisation- unfortunately the links above to university.fluent.com no longer work, they redirect to a useless ANSYS page
What can I do to my case or mesh to prevent this happening?

Cheers.
abhinayiyer2408 likes this.
Evil Teyen is offline   Reply With Quote

Reply

Tags
access_violation, compile, iterations, udf


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
Implementing low Re number k-e models in Fluent. kiran FLUENT 1 July 3, 2017 18:04
Injection of specific number of particles in DPM DH FLUENT 12 March 16, 2016 22:04
air bubble is disappear increasing time using vof xujjun CFX 9 June 9, 2009 08:59
udf - iteration number within one time step?! Mira FLUENT 1 January 23, 2008 04:16
Two-Phase Buoyant Flow Issue Miguel Baritto CFX 4 August 31, 2006 13:02


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