Re: Please help me understand my code
- From: "J.F. Cornwall" <JCornwall@xxxxxxx>
- Date: Fri, 29 Jun 2007 19:10:20 -0600
Wade Ward wrote:
"J. F. Cornwall" <JCornwall@xxxxxxx> wrote in message news:Lu_gi.654740$2Q1.121574@xxxxxxxxxxxxxxxI guess the "II" doesn't bother me - our database applicatiosn with embedded SQL call lots of routines and use lots of variables that start with "II" (an Ingres Rdbms, that is how they do things internally).
Wade Ward wrote:
"www" <www@xxxxxxxxxx> wrote in message news:f617ak$j49$1@xxxxxxxxxxxxxxxxxxxxx
Hi,
I know a little about Fortran. I am reading a program. I have several questions.
SUBROUTINE XYZ
...
DO II = FGPM(7), 1, -1
IF (TSOIL(II) .LE. 0.) GOTO 6543
ENDDO
FRZD = 0.
IF (fgco(1) .LT. 0.) frzd = tsoil(8)
GOTO 6542
6543 IF (II .EQ. 1) THEN
DZ1 = - 0.5*FGPM(8)
ELSE
DZ1 = 0.5*(FGPM(7+II-1)-FGPM(7+II))
ENDIF
IF (TSOIL(II) .EQ. 0.) THEN
FRZD = - (DZ1+FGPM(7+II))*100.
ELSE
DZ2 = FGPM(7+II) - FGPM(7+II+1)
IF (II .NE. FGPM(7)) DZ2 = 0.5*DZ2
FRZD = (-TSOIL(II)*(DZ1+DZ2)/(TSOIL(II+1)-TSOIL(II))-
& (DZ1+FGPM(7+II)))*100.
ENDIF
6542 CONTINUE
IF (II .LT. IIPREV .AND. FGCO(1) .LE. FRSTPREV) FRZD =
& FRZPREV
IIPREV = II
FRSTPREV = FGCO(1)
FRZPREV = FRZD
...
END
My questions are:
1)What the "CONTINUE" at 6542 is doing? I have basic knowledge about looping and the keyword "CONTINUE". But here I cannot figure out what it is doing.
2)frzd only show up once and only once in the whole subroutine. It is not in common block, it is not a subroutine parameter. Suppose, frzd gets the value of tsoil(8) here, what is this for? since no where else frzd is mentioned or used.
3)Same question with tsoil array. It is not in common block. It is not a parameter. It is used once and only once here in the whole subroutine. I am wondering where tsoil(8) gets its value.
Thank you very much.
This source is hard to read. This looks like cyrillic:
DZ2 = FGPM(7+II) - FGPM(7+II+1)
Without knowing what a dizzy2 is, it's hard to make sense of it. I'd recommend renaming variables to reflect a kinder, gentler fortran. Do you have a caller?
--
Wade Ward
Worse than Cyrillic, I am guessing it is part of a model involving soil properties (temps, freezing point/depths maybe, moisture paramters)...
But yeah, it's hard to read. I hate it when authors write code and forget the existence of a space bar on their keyboard.
But it's darn near abusive to use II where people with middle-aged eyes and Russian responsibilities lurk. And then there's (7+II+1); is the third term incrementing or adding el?
--
WW
Jim
.
- References:
- Please help me understand my code
- From: www
- Re: Please help me understand my code
- From: Wade Ward
- Re: Please help me understand my code
- From: J. F. Cornwall
- Re: Please help me understand my code
- From: Wade Ward
- Please help me understand my code
- Prev by Date: Using fortran code with VBA
- Next by Date: Re: Using fortran code with VBA
- Previous by thread: Re: Please help me understand my code
- Next by thread: Re: Please help me understand my code
- Index(es):
Relevant Pages
|