CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > CD-adapco

Subroutine and cell number

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 27, 2003, 15:11
Default Subroutine and cell number
  #1
Celia
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
  Reply With Quote

Old   November 28, 2003, 05:04
Default Re: Subroutine and cell number
  #2
Richard
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.
  Reply With Quote

Old   November 28, 2003, 12:38
Default Re: Subroutine and cell number
  #3
Celia
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.
  Reply With Quote

Old   November 29, 2003, 07:14
Default Re: Subroutine and cell number
  #4
Ulf
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

  Reply With Quote

Old   December 1, 2003, 09:16
Default Re: Subroutine and cell number
  #5
alex
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
  Reply With Quote

Old   December 1, 2003, 09:19
Default Re: Subroutine and cell number
  #6
alex
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.
  Reply With Quote

Old   December 1, 2003, 10:14
Default Re: Subroutine and cell number
  #7
Steve
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.
  Reply With Quote

Old   December 1, 2003, 10:19
Default Re: Subroutine and cell number
  #8
Celia
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
  Reply With Quote

Reply

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
How to use the other cell in subroutine? Rich CD-adapco 1 October 2, 2004 05: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 CD-adapco 5 October 21, 2002 06:29
May I use global coordinate of cell centers in subroutine Posdat H. Shen CD-adapco 4 March 29, 2000 09:20


All times are GMT -4. The time now is 12:15.