I'm trying to compile three files with g77. One of the files, a subroutine for the main file, returns
Jades-MacBook-Pro:Jade jadecheclair$ g77 -c atmsetup.for
Line too long as of (?) [info -f g77 M LEX]
I'm very new to fortran and couldn't find any explanation to this online. The other two files work and create .o files, and one of them (also a subroutine) looks exactly the same as this one.
Anyone knows what this means and how to fix it?
Since it doesn't let me know what line is causing trouble, I attach the code here:
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
The issue was visible by opening the file in vim. All the lines were together even though the program looked fine in Xcode.
Just opened the file in textedit and reformatted it. Then it worked!