C C There are a total of 3 entries in the algebraic variable array. C There are a total of 2 entries in each of the rate and state variable arrays. C There are a total of 14 entries in the constant variable array. C C C VOI is time in component environment (day). C CONSTS(1) is s in component uninfected (per_day_mm3). C CONSTS(2) is p in component uninfected (per_day). C CONSTS(3) is gamma in component uninfected (per_day). C CONSTS(14) is beta in component uninfected (dimensionless). C CONSTS(4) is N in component free_virus_particle (dimensionless). C CONSTS(5) is k_1 in component latently_infected (mm3_per_day). C CONSTS(6) is k_2 in component actively_infected (per_day). C CONSTS(7) is k_3 in component latently_infected (per_day). C CONSTS(8) is mu_V in component free_virus_particle (per_day). C STATES(1) is T_1 in component latently_infected (per_mm3). C CONSTS(9) is mu_b in component actively_infected (per_day). C STATES(2) is T in component uninfected (per_mm3). C CONSTS(10) is k_4 in component latently_infected (per_day). C CONSTS(11) is T_0 in component latently_infected (per_mm3). C CONSTS(12) is V_0 in component latently_infected (per_mm3). C CONSTS(13) is t_min in component latently_infected (day). C ALGBRC(1) is T_1_t in component latently_infected (per_mm3). C ALGBRC(2) is T_2 in component actively_infected (per_mm3). C ALGBRC(3) is V in component free_virus_particle (per_mm3). C RATES(2) is d/dt T in component uninfected (per_mm3). C RATES(1) is d/dt T_1 in component latently_infected (per_mm3). C SUBROUTINE initConsts(CONSTS, RATES, STATES) REAL CONSTS(*), RATES(*), STATES(*) CONSTS(1) = 10 CONSTS(2) = 0.01 CONSTS(3) = 2E-5 CONSTS(4) = 1000 CONSTS(5) = 2.4E-5 CONSTS(6) = 3E-3 CONSTS(7) = 0.023 CONSTS(8) = 2.4 STATES(1) = 0 CONSTS(9) = 0.24 STATES(2) = 1000 CONSTS(10) = 2.424 CONSTS(11) = 1000 CONSTS(12) = 1E-3 CONSTS(13) = 2 CONSTS(14) = (CONSTS(3)/CONSTS(7))*(1.00000+CONSTS(6)/CONSTS(9)) RETURN END SUBROUTINE computeRates(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) RATES(2) = ((CONSTS(1)+ CONSTS(2)*STATES(2)) - CONSTS(3)*STATES(2) ** 2.00000) - ( CONSTS(7)*CONSTS(14)+( CONSTS(4)*CONSTS(5)*CONSTS(6))/( CONSTS(5)*STATES(2)+CONSTS(8)))*STATES(2)*STATES(1) ALGBRC(1) = (( CONSTS(5)*CONSTS(11)*CONSTS(12))/(CONSTS(10) - CONSTS(7)))*(EXP( - CONSTS(7)*VOI) - EXP( - CONSTS(10)*VOI)) RATES(1) = TERNRY(VOI.LE.CONSTS(13), ALGBRC(1), (( CONSTS(4)*CONSTS(5)*CONSTS(6))/( CONSTS(5)*STATES(2)+CONSTS(8)))*STATES(2)*STATES(1) - CONSTS(7)*STATES(1)) RETURN END SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) ALGBRC(1) = (( CONSTS(5)*CONSTS(11)*CONSTS(12))/(CONSTS(10) - CONSTS(7)))*(EXP( - CONSTS(7)*VOI) - EXP( - CONSTS(10)*VOI)) ALGBRC(2) = ( CONSTS(6)*STATES(1))/CONSTS(9) ALGBRC(3) = ( CONSTS(4)*CONSTS(6)*STATES(1))/( CONSTS(5)*STATES(2)+CONSTS(8)) RETURN END REAL FUNCTION TERNRY(TEST, VALA, VALB) LOGICAL TEST REAL VALA, VALB IF (TEST) THEN TERNRY = VALA ELSE TERNRY = VALB ENDIF RETURN END