C C There are a total of 3 entries in the algebraic variable array. C There are a total of 4 entries in each of the rate and state variable arrays. C There are a total of 9 entries in the constant variable array. C C C VOI is time in component environment (day). C STATES(1) is x in component x (per_mm3). C CONSTS(1) is lamda in component x (per_mm3_per_day). C CONSTS(2) is d in component x (per_day). C CONSTS(3) is beta in component kinetic_parameters (mm3_per_day). C ALGBRC(1) is s in component kinetic_parameters (dimensionless). C STATES(2) is y in component y (per_mm3). C CONSTS(4) is a in component y (per_day). C CONSTS(5) is p in component kinetic_parameters (mm3_per_day). C STATES(3) is z in component z (per_mm3). C ALGBRC(2) is log_y in component y (dimensionless). C STATES(4) is w in component w (per_mm3). C CONSTS(6) is b in component w (per_day). C CONSTS(7) is c in component kinetic_parameters (mm3_mm3_per_day). C CONSTS(8) is q in component kinetic_parameters (per_mm3). C ALGBRC(3) is log_w in component w (dimensionless). C CONSTS(9) is h in component z (per_day). C RATES(1) is d/dt x in component x (per_mm3). C RATES(2) is d/dt y in component y (per_mm3). C RATES(4) is d/dt w in component w (per_mm3). C RATES(3) is d/dt z in component z (per_mm3). C SUBROUTINE initConsts(CONSTS, RATES, STATES) REAL CONSTS(*), RATES(*), STATES(*) STATES(1) = 10 CONSTS(1) = 1 CONSTS(2) = 0.1 CONSTS(3) = 0.5 STATES(2) = 0.1 CONSTS(4) = 0.2 CONSTS(5) = 1 STATES(3) = 0 STATES(4) = 0.001 CONSTS(6) = 0.01 CONSTS(7) = 0.1 CONSTS(8) = 0.5 CONSTS(9) = 0.1 RETURN END SUBROUTINE computeRates(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) RATES(4) = CONSTS(7)*STATES(1)*STATES(2)*STATES(4) - ( CONSTS(7)*CONSTS(8)*STATES(2)*STATES(4)+ CONSTS(6)*STATES(4)) RATES(3) = CONSTS(7)*CONSTS(8)*STATES(2)*STATES(4) - CONSTS(9)*STATES(3) ALGBRC(1) = TERNRY(VOI.LE.15.0000, 1.00000, TERNRY(VOI.GE.40.0000, 1.00000, 0.00420000) RATES(1) = CONSTS(1) - ( CONSTS(2)*STATES(1)+ ALGBRC(1)*CONSTS(3)*STATES(1)*STATES(2)) RATES(2) = ALGBRC(1)*CONSTS(3)*STATES(1)*STATES(2) - ( CONSTS(4)*STATES(2)+ CONSTS(5)*STATES(2)*STATES(3)) RETURN END SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) ALGBRC(1) = TERNRY(VOI.LE.15.0000, 1.00000, TERNRY(VOI.GE.40.0000, 1.00000, 0.00420000) ALGBRC(2) = arbitrary_log( STATES(2)*1.00000, 10) ALGBRC(3) = arbitrary_log( STATES(4)*1.00000, 10) RETURN END REAL FUNCTION TERNRY(TEST, VALA, VALB) LOGICAL TEST REAL VALA, VALB IF (TEST) THEN TERNRY = VALA ELSE TERNRY = VALB ENDIF RETURN END