Fortran 77 to VBA Excel

Need help with this question or any other Environmental Sciences assignment help task?

I have a Fortran Source Code, and I want to convert it into VBA.
Additional Instructions:
1 Fortran 77 is not a free-format language, but has a very strict set of rules for how the source code should be formatted. The most important rules are the column position rules: Col. 1 : Blank, or a "c" or "*" for comments Col. 1-5 : Statement label (optional) Col. 6 : Continuation of previous line (optional) Col. 7-72 : Statements Col. 73-80: Sequence number (optional, rarely used today) Most lines in a Fortran 77 program starts with 6 blanks and ends before column 72, i.e. only the statement field is used. HILAKES FORTRAN SOURCE CODE C Program Hilakes C C SIMULATION OF PHOSPHORUS CONCENTRATION IN A SERIES OF RESERVOIRS C SYSTEM EQUATION SOLVED NUMERICALLY W/4TH ORDER RUNGE-KUTTA TECHNIQUE C C INPUT IS IN THE FORM OF ANNUAL PHOSPHORUS LOADS C VARIABLES ARE AS FOLLOWS: C C NSETS = NUMBER OF YEARS OF DATA SETS C NREACT = NUMBER OF LAKES C H = TIME STEP (YEARS) C N = NUMBER OF TIME STEPS PER DATA SET (E.G. /YEAR) C VOL(IRES) = RESERVOIR VOLUME (M3) C QOUT(IRES)= RESERVOIR RELEASES (M3/YEAR) C QWD(IRES) = RESERVOIR WITHDRAWALS (M3/YEAR) C DK(IRES) = MASS KINETIC COEFFICIENT (1/YEAR) C WLPS(IRES)= POINT SOURCE MASS LOAD (GM/YEAR) C WLAD(IRES)= MASS LOAD FROM ADJACENT WATERSHEDS (GM/YEAR) C WLUP(IRES)= MASS LOAD FROM UPSTREAM RESERVOIR (GM/YEAR) C WLTR(IRES)= MASS LOAD FROM TRIBUTAIRES (GM/YEAR) C WLPR(IRES)= PRECIPITATION MASS LOAD (GM/YEAR) C CONC(IRES)= CONSTITUENT CONCENTRATION (MG/L) C JJ = CALCULATION CALENDAR YEAR C JSTEP = TIME STEP, YEAR C IRES = RESERVOIR NUMBER C DIMENSION CONC(10), VOL(10), DK(10), AL(10), CONCUP(10), 1 QOUT(10), QWD(10), WLUP(10), WLAD(10), WLTR(10), WLPS(10), 2 WLPR(10), TOTWL(10) C C FUNCTION STATEMENT C 2 F(Y) = TERM1 – Y * ALPHA C C PRINT HEADING C WRITE(6,21) C C READ NUMBER OF REACTORS, NO. OF DATA SETS, STEP SIZE, YEAR1 C READ(5,2) NREACT, NSETS, H, JJ C C READ INITIAL VALUES FOR EACH REACTOR C READ(5,3) (CONC(IRES), IRES=1,NREACT) C C LOOP THROUGH SOLUTIONS FOR ALL DATA SETS C DO 20 NDATS = 1, NSETS C C LOOP THROUGH INPUT DATA SETS FOR ALL LAKES (REACTORS) C READ(5,4)NHEAD DO 8 IRES = 1,NREACT READ(5,11) VOL(IRES),QOUT(IRES),QWD(IRES),DK(IRES) READ(5,109) WLPS(IRES),WLAD(IRES),WLTR(IRES),WLPR(IRES) 8 CONTINUE C C READ NUMBER OF TIME STEPS FOR THIS DATA SET C READ(5,4) N C C PRINT HEADINGS C WRITE(6,122) JJ, H, N WRITE(6,123) WRITE(6,124) (VOL(I),I=1,NREACT) WRITE(6,127) (QOUT(I),I=1,NREACT) WRITE(6,128) (DK(I),I=1,NREACT) WRITE(6,131) (WLTR(I),I=1,NREACT) WRITE(6,132) (WLAD(I),I=1,NREACT) WRITE(6,133) (WLPS(I),I=1,NREACT) WRITE(6,134) (WLPR(I),I=1,NREACT) WRITE(6,112) C IF(NDATS.GT.1) GO TO 34 WRITE(6,101) JSTEP,(CONC(I),I=1,NREACT) 34 CONTINUE JSTEP = 0 3 JPRINT = 100 C C LOOP THROUGH SOLUTIONS FOR N STEPS OF SIZE H FOR A DATA SET C DO 10 NSTEP = 1,N JSTEP = JSTEP + 1 C C Loop through all reactors for a time step C DO 9 IRES = 1, NREACT WLUP(IRES)=0.0 IF (IRES.EQ.1) GO TO 26 WLUP(IRES)=CONCUP(IRES-1)*QOUT(IRES-1) 26 CONTINUE ALPHA=QOUT(IRES)/VOL(IRES)+DK(IRES) TOTWL(IRES)= WLUP(IRES)+WLAD(IRES)+WLPS(IRES)+WLPR(IRES)+ 1 WLTR(IRES) TERM1=TOTWL(IRES)/VOL(IRES) Y=CONC(IRES) DEL1=H*F(Y) DEL2=H*F(Y+0.5*DEL1) DEL3=H*F(Y+0.5*DEL2) DEL4=H*F(Y+DEL3) CONCUP(IRES)=CONC(IRES) CONC(IRES)=CONC(IRES)+0.16667*(DEL1+2.*DEL2+2.*DEL3+DEL4) 9 CONTINUE IF(JSTEP.NE.JPRINT) GO TO 157 WRITE(6,102) JSTEP,(CONC(IRES),IRES=1,NREACT) JPRINT=JPRINT+100 157 CONTINUE 10 CONTINUE WRITE(6,129) (WLUP(IRES),IRES=1,NREACT) JJ = JJ + 1 20 CONTINUE 40 CONTINUE C C FORMAT STATEMENTS C 2 FORMAT(2I10,1F10.0,I10) 3 FORMAT(7F10.5) 4 FORMAT(5X,I10) 11 FORMAT(5X,3E10.6,10X,E10.6) 21 FORMAT(20X,’SIMULATION OF RESERVOIR PHOSPHORUS LEVELS’,/) 101 FORMAT(14X,I3,1X,7(2X,E10.3)) 102 FORMAT(13X,I4,1X,7(2X,E10.3)) 109 FORMAT(5X,4E10.6) 112 FORMAT(//,13X’TIME’,5X,’CONC(1)’,5X,’CONC(2)’,5X,’CONC(3)’,5X, 4 1 ‘CONC(5)’,5X,’CONC(6)’,5X,’CONC(7)’,/) 122 FORMAT(/,40X,’INPUT CONDITIONS ‘,I4,/,1X,’TIME STEPS(YR)’, 1 F10.5,/,1X,’NO. OF STEPS’,I9) 123 FORMAT(1X,’REACTION’,17X,’1’,10X,’2’,12X,’3’,10X,’4’,11X,’5’, 1 10X,’6’,12X,’7’) 124 FORMAT(1X,’VOL(M3)’,10X,7(2X,F10.3)) 127 FORMAT(1X,’OUTFLOW(M3/YR)’,3X,7(2X,E10.3)) 128 FORMAT(1X,’RXN RATE (1/YR)’,3X,7(2X,E10.3)) 129 FORMAT(/,1X,’UPSTR LOAD(G/YR)’,1X,7(2X,E10.3),//) 131 FORMAT(1X,’TRIB LOAD (G/YR)’,2X,7(2X,E10.3)) 132 FORMAT(1X,’BASIN LOAD (G/YR)’,1X,7(2X,F10.3)) 133 FORMAT(1X,’PT SRC LOAD (G/YR)’,7(2X,E10.3)) 134 FORMAT(1X,’PRECIP LOAD (G/YR)’,7(2X,E10.3)) C CALL EXIT END
There are no answers to this question.
Login to buy an answer or post yours. You can also vote on other others

Get Help With a similar task to - Fortran 77 to VBA Excel

Popular Services
Tutlance Experts offer help in a wide range of topics. Here are some of our top services: