|
[Sponsors] |
November 27, 2003, 15:11 |
Subroutine and cell number
|
#1 |
Guest
Posts: n/a
|
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 |
|
November 28, 2003, 05:04 |
Re: Subroutine and cell number
|
#2 |
Guest
Posts: n/a
|
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. |
|
November 28, 2003, 12:38 |
Re: Subroutine and cell number
|
#3 |
Guest
Posts: n/a
|
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.
|
|
November 29, 2003, 07:14 |
Re: Subroutine and cell number
|
#4 |
Guest
Posts: n/a
|
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 |
|
December 1, 2003, 09:16 |
Re: Subroutine and cell number
|
#5 |
Guest
Posts: n/a
|
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 |
|
December 1, 2003, 09:19 |
Re: Subroutine and cell number
|
#6 |
Guest
Posts: n/a
|
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. |
|
December 1, 2003, 10:14 |
Re: Subroutine and cell number
|
#7 |
Guest
Posts: n/a
|
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.
|
|
December 1, 2003, 10:19 |
Re: Subroutine and cell number
|
#8 |
Guest
Posts: n/a
|
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to use the other cell in subroutine? | Rich | Siemens | 1 | October 2, 2004 06:44 |
How to get index of a cell by user subroutine? | windhair | CFX | 1 | November 19, 2003 11:30 |
Cell Reynouds Number | MissNancy | FLUENT | 0 | December 1, 2002 18:50 |
Adjacent cell number | Jing | Siemens | 5 | October 21, 2002 07:29 |
May I use global coordinate of cell centers in subroutine Posdat | H. Shen | Siemens | 4 | March 29, 2000 10:20 |