CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Siemens (https://www.cfd-online.com/Forums/siemens/)
-   -   Subroutine and cell number (https://www.cfd-online.com/Forums/siemens/53569-subroutine-cell-number.html)

Celia November 27, 2003 14:11

Subroutine and cell number
 
Hi all,

I am using some subroutines to solve for a scalar transport equation. I am using NCMAX, -NBMAX kind of namings to dimension my paramaters. The program works fine when the cells numbers are relatively small but if I have a lot of cells, ie 125000 then I get "segmentation faults"...? Does anyone have any idea why is this?

Best regards

Richard November 28, 2003 04:04

Re: Subroutine and cell number
 
Are you defining your own arrays which are dimensioned using the parameters NCMAX and NBMAX? If so, you need to include the line

include '../parm.inc'

in the header of your subroutine, as this is where those parameters come from.

Celia November 28, 2003 11:38

Re: Subroutine and cell number
 
I have defined the above, without the parm.inc you cannot define any parameter. As I mentioned the program works for small mesh size, the problem only occurs when I refine the mesh.

Ulf November 29, 2003 06:14

Re: Subroutine and cell number
 
Hi, I have experienced similar problems as you. I got the tip to put my variables into common blocks, e.g.

COMMON/ULFSCOMMON/var1(NCMAX),var2(NCMAX)

Have you tried this?

Regards, ulf


alex December 1, 2003 08:16

Re: Subroutine and cell number
 
If you are getting a segmentation fault that means there is something wrong with your array declarations. I wouldn't move them into common blocks, because chances are they will still be wrong. The reason why you only get the problem with large cases is because you are writing lots of information to the wrong place, as opposed to little information to the wrong place, which fortran lets you get away with.

Try: Using a debugger

alex December 1, 2003 08:19

Re: Subroutine and cell number
 
or compiling on different platforms failing that, you are left deleting bits of code until you work out which one causes the problem.

Good luck! Declaration errors can often be hard to find.

Steve December 1, 2003 09:14

Re: Subroutine and cell number
 
I have to disagree with Alex. Large local Fortran arrays may blow the available stack memory. The answer is to force static storage and Fortran's way to do this is to use either COMMON storage or the SAVE keyword.

Celia December 1, 2003 09:19

Re: Subroutine and cell number
 
I actually tried the elimination process and have managed to find a particular area of the code which is causing the trouble. I have been using common blocks to declare my arrays which I have dimensioned using NCMAX etc etc :)

Thanks for all the helps :)


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