74
4 Development of a Mathematical Model for an Aerobic Fixed-Bed …
PROGRAMME 2 ANALYSIS FOR HYBRID BIORECTOR
WRITE(*,*)'INPUT THE VALUES OF S0,BK,AK,THETA,BT'
READ(*,*)S0,BK,AK,THETA,BT
THETA=THETA/24
WRITE(*,*)'INPUT THE VALUES OF D,DF,AL,XF,A,Y,Y2'
READ(*,*)D,DF,AL,XF,A,Y,Y2
EPSI=10.**(-3)
SMIN=(AK*BT)/(Y*BK-BT)
SW=SW
STEP=0.0001
05 STEP=STEP
WRITE(*,*)'SW=',SW,'STEP=',STEP
KOUNT=100000
DO I=1,KOUNT
TEMP1=2.*BK*XF*DF
TEMP2=AK*ALOG((AK+SMIN)/(AK+SW))
TEMP5=(TEMP1*(SW-SMIN+TEMP2))
AJ1=SQRT(TEMP5)
TEMP6=(BK*XF)/DF
Y1=SMIN
AK1=Y2
AL1=(TEMP6*Y1)/(AK+Y1)
AK2=Y2+0.5*AL1*STEP
AL2=TEMP6*((Y1+0.5*AK1*STEP)/(AK+Y1+0.5*AK1*STEP))
AK3=Y2+0.5*AL2*STEP
AL3=TEMP6*((Y1+0.5*AK2*STEP)/(AK+Y1+0.5*AK2*STEP))
AK4=Y2+AL3*STEP
AL4=TEMP6*((Y1+AK3*STEP)/(AK+Y1+AK3*STEP))
AK5=(STEP/6)*(AK1+2.*AK2+2.*AK3+AK4)
AL5=(STEP/6)*(AL1+2.*AL2+2.*AL3+AL4)
S1=Y1+AK5
AJ2=DF*(Y2+AL5)
IF(ABS(SW-S1).LT.EPSI)THEN
WRITE(*,*)'ITERATION CONVERGES'
WRITE(*,*) 'STEP=',STEP
STOP 'NORMAL END'
ELSE
STEP=STEP+0.0001
GO TO 5
END IF
KOUNTC=MOD(I,100)
IF (KOUNTC.EQ.1)THEN
WRITE(*,*)'ITERATION DOES NOT CONVERGE'
WRITE(*,*)'I=',I,'STEP=',STEP
END IF
IF(I.GE.KOUNT)THEN
EXIT
END IF
END DO
STOP'ABNORMAL END'
END
4.2.3 Essence of Flowcharts Constructed
Two flowcharts for computer programming in FORTRAN have been prepared
approaching the iteration processes, with a view to calculate unknown exiting
substrate concentration S w , average substrate flux J avg (Fig. 4.4) and effective biofilm
thickness L e . In the first flowchart (Fig. 4.5), equation numbers (4.7), (4.16) and (4.17)
as stated earlier are simultaneously iterated to calculate the unknown exiting, i.e.,
bulk liquid substrate concentration S w and unknown flux J. The initial iteration value
S w was assumed in this flowchart as any value higher than S min (which is required to
4 Development of a Mathematical Model for an Aerobic Fixed-Bed …
PROGRAMME 2 ANALYSIS FOR HYBRID BIORECTOR
WRITE(*,*)'INPUT THE VALUES OF S0,BK,AK,THETA,BT'
READ(*,*)S0,BK,AK,THETA,BT
THETA=THETA/24
WRITE(*,*)'INPUT THE VALUES OF D,DF,AL,XF,A,Y,Y2'
READ(*,*)D,DF,AL,XF,A,Y,Y2
EPSI=10.**(-3)
SMIN=(AK*BT)/(Y*BK-BT)
SW=SW
STEP=0.0001
05 STEP=STEP
WRITE(*,*)'SW=',SW,'STEP=',STEP
KOUNT=100000
DO I=1,KOUNT
TEMP1=2.*BK*XF*DF
TEMP2=AK*ALOG((AK+SMIN)/(AK+SW))
TEMP5=(TEMP1*(SW-SMIN+TEMP2))
AJ1=SQRT(TEMP5)
TEMP6=(BK*XF)/DF
Y1=SMIN
AK1=Y2
AL1=(TEMP6*Y1)/(AK+Y1)
AK2=Y2+0.5*AL1*STEP
AL2=TEMP6*((Y1+0.5*AK1*STEP)/(AK+Y1+0.5*AK1*STEP))
AK3=Y2+0.5*AL2*STEP
AL3=TEMP6*((Y1+0.5*AK2*STEP)/(AK+Y1+0.5*AK2*STEP))
AK4=Y2+AL3*STEP
AL4=TEMP6*((Y1+AK3*STEP)/(AK+Y1+AK3*STEP))
AK5=(STEP/6)*(AK1+2.*AK2+2.*AK3+AK4)
AL5=(STEP/6)*(AL1+2.*AL2+2.*AL3+AL4)
S1=Y1+AK5
AJ2=DF*(Y2+AL5)
IF(ABS(SW-S1).LT.EPSI)THEN
WRITE(*,*)'ITERATION CONVERGES'
WRITE(*,*) 'STEP=',STEP
STOP 'NORMAL END'
ELSE
STEP=STEP+0.0001
GO TO 5
END IF
KOUNTC=MOD(I,100)
IF (KOUNTC.EQ.1)THEN
WRITE(*,*)'ITERATION DOES NOT CONVERGE'
WRITE(*,*)'I=',I,'STEP=',STEP
END IF
IF(I.GE.KOUNT)THEN
EXIT
END IF
END DO
STOP'ABNORMAL END'
END
4.2.3 Essence of Flowcharts Constructed
Two flowcharts for computer programming in FORTRAN have been prepared
approaching the iteration processes, with a view to calculate unknown exiting
substrate concentration S w , average substrate flux J avg (Fig. 4.4) and effective biofilm
thickness L e . In the first flowchart (Fig. 4.5), equation numbers (4.7), (4.16) and (4.17)
as stated earlier are simultaneously iterated to calculate the unknown exiting, i.e.,
bulk liquid substrate concentration S w and unknown flux J. The initial iteration value
S w was assumed in this flowchart as any value higher than S min (which is required to
