CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Stack Overflow (https://www.cfd-online.com/Forums/main/89101-stack-overflow.html)

imrannazir June 4, 2011 09:58

Stack Overflow
 
Hi
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 June 13, 2011 10:09

Help
 
I m still waiting for HELP to get understand why I m getting STACK OVERFLOW problem

Plz help me

cfdnewbie June 13, 2011 12:09

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

agd June 13, 2011 15:27

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.

imrannazir June 14, 2011 00:26

OK More Information
 
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.

Thanx

cfdnewbie June 14, 2011 05:07

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

Docfreezzzz July 8, 2011 14:42

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

free(a);

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.

HectorRedal July 9, 2011 01:53

Hi,
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.


All times are GMT -4. The time now is 06:52.