编译三个文件 fortran 77 "Line too long"
Compiling three files fortran 77 "Line too long"
我正在尝试用 g77 编译三个文件。
其中一个文件,主文件的子程序,returns
Jades-MacBook-Pro:Jade jadecheclair$ g77 -c atmsetup.for
Line too long as of (?) [info -f g77 M LEX]
我对 Fortran 还很陌生,在网上找不到任何解释。其他两个文件工作并创建 .o 文件,其中一个(也是一个子例程)看起来与这个完全一样。
有人知道这是什么意思以及如何解决吗?
因为它不会让我知道是哪一行引起了问题,所以我在这里附上代码:
SUBROUTINE ATMSETUP(NLEVEL,Z,RHCH4,FH2,FARGON,TEMP,PRESS,DEN,XMU,
& CH4,H2,XN2,AR,IPRINT)
C THIS IS THE NEW ONE WITH THE BWC EQ OF STATE
PARAMETER (NMAX=201)
C THIS SUBROUTINE SETS UP THE INTITAL ATMOSPHERIC PROFILE FOR TITAN
C BASED ON THE LINDAL ET AL DATA. THE ROUTINE STARTS WITH INPUTS
C INPUTS:
C NLEVEL: NUMBER OF ALTITUDE LEVELS, J=1 IS AT THE TOP
C Z ALTITUDE GRID IN KM
C RHCH4 RELATIVE HUMIDITY OF METHANE AT Z=0.
C FH2 MIXING RATIO BY NUMBER OF H2
C FARGON ARGON FLAG 0 = NO ARGON IN ATMSOPHERE
C -Y = ADJUST AR TO GIVE MEAN WEIGHT=Y
C +X = MIXING RATIO OF ARGON = X
C OUTPUTS: AT EACH LEVEL (NOT LAYER AVERAGES)
C TEMP (K), PRESS(BARS), DEN(CM-3), XMU = MEAN MOLECUALR WEIGHT
C CH4, H2, XN2, AR ARE THE NUMBER MIXING RATIOS OF THE GASES
C INTERNAL VARIABLES
C TLINAL, DLINAL, PLINAL : THE LINDAL INGRESS VALUES ON THE Z GRID
C
C NOTES: METHANE FOLLOWS CONSTANT MIXING RATIO UNLESS SATUARTION
C VALUE IS LOWER.
C
DIMENSION Z(NLEVEL),TEMP(NLEVEL),PRESS(NLEVEL),DEN(1),XMU(1)
DIMENSION CH4(1),H2(1),XN2(1),AR(1)
DIMENSION TLINAL(NMAX),DLINAL(NMAX),PLINAL(NMAX)
C
C FIRST SET UP THE LINDAL PURE N2 VALUES
CALL LINDAL(NLEVEL,Z,TLINAL,DLINAL,PLINAL)
C LOAD THE LINDAL VALUES INTO THE ARRAYS
DO J=1,NLEVEL
TEMP(J)= TLINAL(J)
DEN(J)= DLINAL(J)
PRESS(J)=PLINAL(J)
ENDDO
C
DO 1000 ITS =1,20
C
C NOW COMPUTE THE MEAN MOLECULAR WEIGHT AT EACH LEVEL
C NOW SET UP THE MIXING RATIOS OF THE GASSES BASED ON SATURATION
C CURVE OF CH4 AND SPECIFIED MEAN MOLECULAR WEIGHT AND H2 CONSTANT
CH4(NLEVEL)=PCH4(TEMP(NLEVEL))*RHCH4/PRESS(NLEVEL)
DO 134 J=NLEVEL-1,1,-1
CH4SAT=PCH4(TEMP(J))/PRESS(J)
CH4(J)=AMIN1(CH4SAT,CH4(NLEVEL),CH4(J+1))
134 CONTINUE
DO 20 J=1,NLEVEL
H2(J)=FH2
IF (FARGON .LT. 0.) THEN
C WE DECIDED TO KEEP CONSTANT MIXING RATIO = -FARGON
AR(J)=(-FARGON-28.0134+25.8554*H2(J)+11.9708*CH4(J))/11.9346
ELSE
IF (FARGON .EQ. 0.) THEN
C WE DECIDED TO DROP THE ARGON...
AR(J)=0.0
ELSE
C ARGON GIVEN BY A CONSTANT MIXING RATIO
AR(J)=FARGON
ENDIF
ENDIF
XN2(J)=1.0 - H2(J) - CH4(J) -AR(J)
XMU(J)=28.0134*XN2(J)+2.158*H2(J)+16.0426*CH4(J)+39.948*AR(J)
20 CONTINUE
C AT THIS POINT WE HAVE THE TEMP, PRESS, DEN AND XMU VALUES.
C ADJUST THE DEN BY THE FACTOR DUE TO THE MEAN REFRACTIVITY
C NOW LETS INTERGRATE THE DENSITY WITH ALTITUDE TO GET THE PRESS
SUMT=PLINAL(1)*6.02E23/10.
SUMB=SUMT
TLAST=TEMP(NLEVEL)
DO J=2,NLEVEL
C DENSITY ADJUSTMENT BASED ON REFRACTIVITIES ... SEE NOTES
DENF=294.1/(XN2(J)*294.1 + CH4(J)*410. + H2(J)*136. + AR(J)*277.8)
DEN(J) = DLINAL(J)*DENF
C PERFORM THE INTEGRALS LISTED IN NOTES
C SUMT IS ACTUAL PRESSURE
ADEN=(DEN(J)-DEN(J-1))/ALOG(DEN(J)/DEN(J-1))
SUMT=SUMT+(EFFG(Z(J))*ADEN)*( Z(J-1)-Z(J))*XMU(J)
ADEN=(DLINAL(J)-DLINAL(J-1))/ALOG(DLINAL(J)/DLINAL(J-1))
SUMB=SUMB+(EFFG(Z(J))*ADEN)*( Z(J-1)-Z(J))*28.01340
C
C NON IDEAL GAS CORRECTION IS 3.5% TIMES DT = 0.03% :NEGLECTED
PRESS(J)=PLINAL(J)*SUMT/SUMB
TEMP(J) =TLINAL(J)*(SUMT/SUMB)*(1./DENF)
C
ENDDO
30 CONTINUE
C
C HOW WELL WE DO ON CONVERGENCE
DT= ABS(TEMP(NLEVEL)-TLAST)
IF (DT .LT. 0.001) GO TO 1001
1000 CONTINUE
1001 IF (IPRINT .LT. 0) RETURN
WRITE (6,139)RHCH4,FH2,FARGON,DT
DO 135 J=1,NLEVEL-1
WRITE(6,140)J,Z(J),PRESS(J),DEN(J),TEMP(J),
& CH4(J)*PRESS(J)/PCH4(TEMP(J))
& ,CH4(J)*100.,XN2(J)*100.,H2(J)*100.,AR(J)*100.,XMU(J)
& ,(TEMP(J+1)-TEMP(J))/(Z(J+1)-Z(J))
135 CONTINUE
J=NLEVEL
WRITE(6,140)J,Z(J),PRESS(J),DEN(J),TEMP(J),
& CH4(J)*PRESS(J)/PCH4(TEMP(J))
& ,CH4(J)*100.,XN2(J)*100.,H2(J)*100.,AR(J)*100.,XMU(J)
139 FORMAT(///' BACKGROUNG ATMOSPHERE AT LEVELS'/
& ' SURFACE HUMIDITY OF CH4:',F5.3,' H2 MIXING RATIO:',F6.4,
& ' ARGON SETTING:',F8.4/' FINAL CONVERGENCE ON TEMP:',F10.5
& ' LINDAL ET AL SCALING'/
&' LVL ALTITUDE P(BARS) DEN(CM-3) TEMP RH-CH4'
& , ' %CH4 %N2 %H2 %AR MU DT/DZ' )
140 FORMAT(1X,I3,F8.3,1P2E10.3,0PF7.2,F5.2,2F6.2,2F5.2,4F6.2)
C END INTITAL BACKGROUND ATMOSPHERE SETUP FOR TITAN
RETURN
END
我将您的代码复制并粘贴到文本编辑器中并进行了查看。您的第二行,第 1 行 SUBROUTINE 语句的延续,似乎在错误的列中有它的行延续。它应该是第 6 列。
-埃里克
打开 vim 中的文件可以看到该问题。尽管程序在 Xcode 中看起来不错,但所有行都在一起。
刚刚在 textedit 中打开文件并重新格式化。然后成功了!
我正在尝试用 g77 编译三个文件。 其中一个文件,主文件的子程序,returns
Jades-MacBook-Pro:Jade jadecheclair$ g77 -c atmsetup.for
Line too long as of (?) [info -f g77 M LEX]
我对 Fortran 还很陌生,在网上找不到任何解释。其他两个文件工作并创建 .o 文件,其中一个(也是一个子例程)看起来与这个完全一样。
有人知道这是什么意思以及如何解决吗?
因为它不会让我知道是哪一行引起了问题,所以我在这里附上代码:
SUBROUTINE ATMSETUP(NLEVEL,Z,RHCH4,FH2,FARGON,TEMP,PRESS,DEN,XMU,
& CH4,H2,XN2,AR,IPRINT)
C THIS IS THE NEW ONE WITH THE BWC EQ OF STATE
PARAMETER (NMAX=201)
C THIS SUBROUTINE SETS UP THE INTITAL ATMOSPHERIC PROFILE FOR TITAN
C BASED ON THE LINDAL ET AL DATA. THE ROUTINE STARTS WITH INPUTS
C INPUTS:
C NLEVEL: NUMBER OF ALTITUDE LEVELS, J=1 IS AT THE TOP
C Z ALTITUDE GRID IN KM
C RHCH4 RELATIVE HUMIDITY OF METHANE AT Z=0.
C FH2 MIXING RATIO BY NUMBER OF H2
C FARGON ARGON FLAG 0 = NO ARGON IN ATMSOPHERE
C -Y = ADJUST AR TO GIVE MEAN WEIGHT=Y
C +X = MIXING RATIO OF ARGON = X
C OUTPUTS: AT EACH LEVEL (NOT LAYER AVERAGES)
C TEMP (K), PRESS(BARS), DEN(CM-3), XMU = MEAN MOLECUALR WEIGHT
C CH4, H2, XN2, AR ARE THE NUMBER MIXING RATIOS OF THE GASES
C INTERNAL VARIABLES
C TLINAL, DLINAL, PLINAL : THE LINDAL INGRESS VALUES ON THE Z GRID
C
C NOTES: METHANE FOLLOWS CONSTANT MIXING RATIO UNLESS SATUARTION
C VALUE IS LOWER.
C
DIMENSION Z(NLEVEL),TEMP(NLEVEL),PRESS(NLEVEL),DEN(1),XMU(1)
DIMENSION CH4(1),H2(1),XN2(1),AR(1)
DIMENSION TLINAL(NMAX),DLINAL(NMAX),PLINAL(NMAX)
C
C FIRST SET UP THE LINDAL PURE N2 VALUES
CALL LINDAL(NLEVEL,Z,TLINAL,DLINAL,PLINAL)
C LOAD THE LINDAL VALUES INTO THE ARRAYS
DO J=1,NLEVEL
TEMP(J)= TLINAL(J)
DEN(J)= DLINAL(J)
PRESS(J)=PLINAL(J)
ENDDO
C
DO 1000 ITS =1,20
C
C NOW COMPUTE THE MEAN MOLECULAR WEIGHT AT EACH LEVEL
C NOW SET UP THE MIXING RATIOS OF THE GASSES BASED ON SATURATION
C CURVE OF CH4 AND SPECIFIED MEAN MOLECULAR WEIGHT AND H2 CONSTANT
CH4(NLEVEL)=PCH4(TEMP(NLEVEL))*RHCH4/PRESS(NLEVEL)
DO 134 J=NLEVEL-1,1,-1
CH4SAT=PCH4(TEMP(J))/PRESS(J)
CH4(J)=AMIN1(CH4SAT,CH4(NLEVEL),CH4(J+1))
134 CONTINUE
DO 20 J=1,NLEVEL
H2(J)=FH2
IF (FARGON .LT. 0.) THEN
C WE DECIDED TO KEEP CONSTANT MIXING RATIO = -FARGON
AR(J)=(-FARGON-28.0134+25.8554*H2(J)+11.9708*CH4(J))/11.9346
ELSE
IF (FARGON .EQ. 0.) THEN
C WE DECIDED TO DROP THE ARGON...
AR(J)=0.0
ELSE
C ARGON GIVEN BY A CONSTANT MIXING RATIO
AR(J)=FARGON
ENDIF
ENDIF
XN2(J)=1.0 - H2(J) - CH4(J) -AR(J)
XMU(J)=28.0134*XN2(J)+2.158*H2(J)+16.0426*CH4(J)+39.948*AR(J)
20 CONTINUE
C AT THIS POINT WE HAVE THE TEMP, PRESS, DEN AND XMU VALUES.
C ADJUST THE DEN BY THE FACTOR DUE TO THE MEAN REFRACTIVITY
C NOW LETS INTERGRATE THE DENSITY WITH ALTITUDE TO GET THE PRESS
SUMT=PLINAL(1)*6.02E23/10.
SUMB=SUMT
TLAST=TEMP(NLEVEL)
DO J=2,NLEVEL
C DENSITY ADJUSTMENT BASED ON REFRACTIVITIES ... SEE NOTES
DENF=294.1/(XN2(J)*294.1 + CH4(J)*410. + H2(J)*136. + AR(J)*277.8)
DEN(J) = DLINAL(J)*DENF
C PERFORM THE INTEGRALS LISTED IN NOTES
C SUMT IS ACTUAL PRESSURE
ADEN=(DEN(J)-DEN(J-1))/ALOG(DEN(J)/DEN(J-1))
SUMT=SUMT+(EFFG(Z(J))*ADEN)*( Z(J-1)-Z(J))*XMU(J)
ADEN=(DLINAL(J)-DLINAL(J-1))/ALOG(DLINAL(J)/DLINAL(J-1))
SUMB=SUMB+(EFFG(Z(J))*ADEN)*( Z(J-1)-Z(J))*28.01340
C
C NON IDEAL GAS CORRECTION IS 3.5% TIMES DT = 0.03% :NEGLECTED
PRESS(J)=PLINAL(J)*SUMT/SUMB
TEMP(J) =TLINAL(J)*(SUMT/SUMB)*(1./DENF)
C
ENDDO
30 CONTINUE
C
C HOW WELL WE DO ON CONVERGENCE
DT= ABS(TEMP(NLEVEL)-TLAST)
IF (DT .LT. 0.001) GO TO 1001
1000 CONTINUE
1001 IF (IPRINT .LT. 0) RETURN
WRITE (6,139)RHCH4,FH2,FARGON,DT
DO 135 J=1,NLEVEL-1
WRITE(6,140)J,Z(J),PRESS(J),DEN(J),TEMP(J),
& CH4(J)*PRESS(J)/PCH4(TEMP(J))
& ,CH4(J)*100.,XN2(J)*100.,H2(J)*100.,AR(J)*100.,XMU(J)
& ,(TEMP(J+1)-TEMP(J))/(Z(J+1)-Z(J))
135 CONTINUE
J=NLEVEL
WRITE(6,140)J,Z(J),PRESS(J),DEN(J),TEMP(J),
& CH4(J)*PRESS(J)/PCH4(TEMP(J))
& ,CH4(J)*100.,XN2(J)*100.,H2(J)*100.,AR(J)*100.,XMU(J)
139 FORMAT(///' BACKGROUNG ATMOSPHERE AT LEVELS'/
& ' SURFACE HUMIDITY OF CH4:',F5.3,' H2 MIXING RATIO:',F6.4,
& ' ARGON SETTING:',F8.4/' FINAL CONVERGENCE ON TEMP:',F10.5
& ' LINDAL ET AL SCALING'/
&' LVL ALTITUDE P(BARS) DEN(CM-3) TEMP RH-CH4'
& , ' %CH4 %N2 %H2 %AR MU DT/DZ' )
140 FORMAT(1X,I3,F8.3,1P2E10.3,0PF7.2,F5.2,2F6.2,2F5.2,4F6.2)
C END INTITAL BACKGROUND ATMOSPHERE SETUP FOR TITAN
RETURN
END
我将您的代码复制并粘贴到文本编辑器中并进行了查看。您的第二行,第 1 行 SUBROUTINE 语句的延续,似乎在错误的列中有它的行延续。它应该是第 6 列。
-埃里克
打开 vim 中的文件可以看到该问题。尽管程序在 Xcode 中看起来不错,但所有行都在一起。
刚刚在 textedit 中打开文件并重新格式化。然后成功了!