CFD Online Logo CFD Online URL
Home > Forums > Main CFD Forum

Stack Overflow

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

LinkBack Thread Tools Display Modes
Old   June 4, 2011, 09:58
Default Stack Overflow
New Member
Join Date: Jun 2010
Posts: 10
Rep Power: 7
imrannazir is on a distinguished road
I am doing Coal Gasification using DPM and Finite Rate chemistry. (2D)
When i use coarse grid (about 700~1200 cells)then my iterations run but solution could not be converged.
But when i use fine grid (More than 3000 cells) then I get STACK OVERFLOW error.
Can any body help in this regard.
imrannazir is offline   Reply With Quote

Old   June 13, 2011, 10:09
Default Help
New Member
Join Date: Jun 2010
Posts: 10
Rep Power: 7
imrannazir is on a distinguished road
I m still waiting for HELP to get understand why I m getting STACK OVERFLOW problem

Plz help me
imrannazir is offline   Reply With Quote

Old   June 13, 2011, 12:09
Senior Member
Join Date: Mar 2010
Posts: 557
Rep Power: 11
cfdnewbie is on a distinguished road
Well, it might be easier to help you if you explained your problem in more details....what OS are you working on? Linux? Check the stack sizes of your system, check your memory consumption....
cfdnewbie is offline   Reply With Quote

Old   June 13, 2011, 15:27
Senior Member
Join Date: Jul 2009
Posts: 195
Rep Power: 8
agd is on a distinguished road
You are getting a stack overflow because your code is allocating variables using stack memory and by upping the size of the problem you exceeded the size of the stack. It may or may not be connected to your convergence problem, since (as pointed out above) you really didn't provide a lot of information. If this is your own code, you can avoid future problems by learning how to allocate your variables from the heap space. If it is a canned code, then as noted above you may need to explore how to increase the stack size on your machine and OS. Compile and link options can also be used to increase the stacksize available if you have the source code and are compiling it. Details depend on the particular language and compiler. Googling "Stack overflow" will bring up more information.
agd is offline   Reply With Quote

Old   June 14, 2011, 00:26
Default OK More Information
New Member
Join Date: Jun 2010
Posts: 10
Rep Power: 7
imrannazir is on a distinguished road
Thnx for your kind replies. I am giving some details as under:
OS: Windows XP (32 bit)
Fluent: Version 6.3.26
Hardware: Dual Core Processor With 2.0 GHz each processor (Intel). 3 GB RAM.

I am developing my own problem.
Aim: To develop the Coal Gasification using finite rate chemistry model with DPM.
Model Setting:
Solver: Pressure Based, Steady State, Implicit
Turbulence Model: K-E model
Reactions: Total 7 reactions: 3 Heterogeneous reactions (Solid Carbon+Gas)
4 Homogenous reactions
Mesh size (where problem arise): more than 3000 cells
Number of continuous iterations per DPM iteration: 25~50
Boundary Conditions:
I have one Velocity Inlet and One Pressure Outlet.
At velocity inlet i use 10 to 50 m/sec velocity with O2 and N2 composition (like air): use temperature at 400K
At pressure outlet i use normal atmospheric pressure as defined by some literature.
At injection, i use 200 micron size of carbon particles with uniform size. I inject 2 Kg/sec coal. I use combustion laws (like inert heating, vaporization, devolatization, inert heating, combustion).

I have total 320 GB hard disk, with four partitions [C, D, E, F] (with almose 75 GB each)
My Fluent is installed on C drive (where more than 50 GB is free) where is my case is placed in F drive where more than 52 GB is free.

Is that enough information about case or some thing else is required.
Kindly help me because my time is almost gone.

imrannazir is offline   Reply With Quote

Old   June 14, 2011, 05:07
Senior Member
Join Date: Mar 2010
Posts: 557
Rep Power: 11
cfdnewbie is on a distinguished road
Just to clarify: Your hard disk space is NOT the problem, it is your RAM...
Since you are using Fluent, you will have to find a way to manipulate your stack size under Win32.... I don't use MS products, so sorry, I can't help you with that. Try google "win 32 stack size" or sth like that, or maybe ask the guys over at fluent...
cfdnewbie is offline   Reply With Quote

Old   July 8, 2011, 14:42
Join Date: Jul 2011
Location: US
Posts: 39
Rep Power: 6
Docfreezzzz is on a distinguished road
The stack is a small area of memory where temporary (local scope) variables are placed.
This is MUCH smaller than the total RAM on your computer. Allocations (C/C++) like this get put on the stack:

int a, b;
double a[10,000];

The heap is an area of memory which resides in free space on RAM. By this I mean that you have access to all the RAM of the machine when you store on the heap. These allocations look like this in C

double* a;
a = (double*) malloc(10,000 * sizeof(double));

heap allocations are not automatically free'd so you must do this after you are finished to let the computer know it can use the memory again


In C++ things are a little simpler and look like this

double* a;
a = new double[10,000];

and the free'ing is done as

delete [] a;

Hope this was helpful.
CFD engineering resource
Docfreezzzz is offline   Reply With Quote

Old   July 9, 2011, 01:53
Hector Redal
Join Date: Aug 2010
Location: Madrid, Spain
Posts: 67
Rep Power: 7
HectorRedal is on a distinguished road
I will try to clarify this issue a bit more.

As Docfreezzz has stated correctly, in any language programming there are two kind of memory variables.
Variables allocated in the stack
Variables allocated in the heap.

Stack size is much smaller than heap stack.
So, using heap is better in some circunstances.

Stack size could be ran out because too much calls to a rutine.
For example, if you have a rutine that is recursive, and it calls itself in a recursive manner.

If there is an error on the conditions that specified when the problem should be resolved by the rutine itself, or should be divided and another call to the rutine should be performed, you could happen to be in loop with no end, making to consume all the size of the stack.
The rutine is called again an again with no end.
This is a common error when defining recursive functions.

I don't know if you are using some kind of recursive definition in your model, but if it is the case, you can start by revising the modeling at this point.

Hope this will be helpful.
HectorRedal is offline   Reply With Quote


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
Incineration Stack model MLeong CFX 4 September 3, 2009 06:26
Phase locked average in run time panara OpenFOAM 2 February 20, 2008 15:37
Stack overflow MING Main CFD Forum 10 October 20, 2004 14:02
Stack Exhaust modelling Bob CFX 0 June 27, 2002 13:37
Stack frame size, Origin 2000, fortran, a question. Sergei Chernyshenko Main CFD Forum 4 February 22, 1999 15:24

All times are GMT -4. The time now is 05:54.