Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: monir <monirg@xxxxxxxxxxxx>
- Date: Fri, 3 Apr 2009 21:26:13 -0700 (PDT)
On Apr 2, 7:07 pm, nos...@xxxxxxxxxxxxx (Richard Maine) wrote:
glen herrmannsfeldt <g...@xxxxxxxxxxxxxxxx> wrote:
Louis Krupp <lkrupp_nos...@xxxxxxxxxxxxxxxx> wrote:
Hello;
Thank you all for your helpful replies.
1) Ron Shepard's suggestion is a good one:
"The easiest way to make sure all of your dimensions match up is to
allocate the array at the beginning of the program to the correct
size, put your subroutines in a module (so they will get an explicit
interface), and declare all of the dummy arrays as assumed shape.
real :: dummy(:,:,:) "
Unfortunately, I know very little about F95 modules, dynamic arrays,
arrays operations, etc.
2) Louis Krupp's suggestion (which sounds the easiest to implement!) :
"You could declare VxGrid dimensioned (maxR, maxTH) in another
subroutine and then call DCpZeros passing VxGrid, nRdim, and nTHdim.
Then DCpZeros can dimension VxGrid (nRdim, nTHdim). As long as the
only code that touches VxGrid sees it dimensioned (nRdim, nTHdim), you
should be OK."
I have given it a try, and here's what I did.
(PS. I'm not concerned or worried about the array bounds exceeded!
There're sufficient built-in red flags in the program.)
3) First, with F77 code and g95 compiler, one definitely cannot use
common block variables to dimension a local array as some of you have
already advised.
Compilation Error:
"Variables '.....' cannot appear in a specification expression in a
PROGRAM"
Richard Maine and glen herrmannsfeldt correctly predicted that in
their replis.
4) Basically, forget about the maximum anticipated values maxR, maxTH
and maxPln. Dimension the arrays based on the computed nRdim, nTdim
and nPlanes, by including them as arguments in the call to the various
routines. Hence, don't need the Common block /DIM/ (which wouldn't
have worked anyway based on Item 3 above).
5) Algorithmically, the entire "earlier" program is treated now as a
subroutine called by a "new" main program.
(It's quite confusing trying to describe the changes. They will
become pretty obvious as you'll see. Here's the latest relevant parts
of the code.)
C ****************************************************************
PROGRAM MainPRSCAV8
C ****************************************************************
!....myCode1.........
nT = !integer numerical value....
nR = !integer numerical value....
nP = !integer numerical value....
Call PRSCAV8e (nP, nR, nT)
End
C
****************************************************************
Subroutine PRSCAV8e (nPlanes, nRdim, nTdim)
C
****************************************************************
Dimension xbys (nPlanes,nRdim,nTdim), rbys(nPlanes,nRdim,nTdim) !
Compiler error
!...myCode2..................
Call DCpZeros (nRdim, nTdim, nPlanes)
!...myCode3..................
Return
End
C
****************************************************************
SUBROUTINE DCpZeros (nP,nR,nT)
C
****************************************************************
C This subroutine determines the abscissas of a potential minimum of
Cp
C on a given R-TH (T*=const) plane.
...................................
dimension Rgrid(nR), Tgrid(nT)
dimension VxGrid(nR,nT)
! ...myCode4.................
Call Polin2 (Rgrid,Tgrid,VxGrid,nR,nT,Rp,THp,VxCentre,accx)
! ...myCode5.................
Return
End
6) The following Compiler Error message is displayed (reference to the
1st arg in the 1st dim statement in sub PRSCAV8e):
"Error: Array bound at (nPlanes) must be constant"
What ?? It's a constant equals 10
I'm trying to fix this latest problem (or even make sense of it!) with
no luck!
Any suggestion ??
Thank you.
Monir
.
- Follow-Ups:
- Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: James Van Buskirk
- Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: Louis Krupp
- Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- References:
- Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: monir
- Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: dpb
- Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: monir
- Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: ken . fairfield
- Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: monir
- Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: Louis Krupp
- Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: monir
- Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: Louis Krupp
- Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: glen herrmannsfeldt
- Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- From: Richard Maine
- Program Fails When Parameter Fixed Constants are Changed (F77) ??
- Prev by Date: Re: .net why not
- Next by Date: Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- Previous by thread: Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- Next by thread: Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
- Index(es):
Relevant Pages
|