CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Siemens (https://www.cfd-online.com/Forums/siemens/)
-   -   Using the T array in posdat.f, sigsegv, debugger (https://www.cfd-online.com/Forums/siemens/56462-using-t-array-posdat-f-sigsegv-debugger.html)

Daniel February 21, 2008 12:11

Using the T array in posdat.f, sigsegv, debugger
 
I have a transient model which uses several scalars (7 active, 15 passive). The active scalars use sorsca.f to change the concentrations, one of the passive scalars uses scalfn.f, but the rest require reading and changing the values at the end of the time step. To accomplish this, I have been using the T array in posdat.f. However, after a certain number of time steps (depending on the size of the time step and whether it is single or double precision, but around 30 steps), the solution fails with a segmentation fault ("Received signal sigsegv - exiting"). However, when I use the "-g -devtool='gdb'" options to debug, the segmentation fault disappears and the solution runs!? Does anyone have an idea why this might be, or what to change so that it will run without the debugger? I am at a loss for ideas, so anything would be helpful. Thanks so much!

Richard February 22, 2008 04:42

Re: Using the T array in posdat.f, sigsegv, debugg
 
It's probably memory corruption - you're writing beyond the range of an array somewhere, or you are using dynamic memory (i.e. a Cray pointer) which you have not allocated. Sometimes the corruption gets "moved" when you compile "-g", making it appear that the problem has been fixed.

If the run fails with "-g" (no -devtool) then you could try a memory checker like valgrind. Otherwise you will probably have to use print statements in your coding. Check that you are allocating memory, and check that array indices are always within bounds.

Daniel February 22, 2008 12:54

Re: Using the T array in posdat.f, sigsegv, debugg
 
I'm pretty sure you are right. The run still works when I only use the -g option and leave out -devtool. I'm actually not using any user defined arrays; the only array I use is the T array in posdat.f. I've checked all of my indices, etc., when I read from and write to the T array and there doesn't seem to be a problem there. I think it's just that I have so many scalars (22) and computational cells (45,000 for now, but that will be increasing significantly), that I'm using memory not allocated to the T array by Star-CD. Do you know how to allocate more memory to the T array, since it is a built-in Star-CD variable? Thanks so much!


All times are GMT -4. The time now is 03:43.