C C There are a total of 2 entries in the algebraic variable array. C There are a total of 3 entries in each of the rate and state variable arrays. C There are a total of 13 entries in the constant variable array. C C C VOI is time in component environment (day). C STATES(1) is x1 in component x1 (cell). C CONSTS(1) is alpha1 in component model_parameters (flux). C CONSTS(2) is beta1 in component model_parameters (first_order_rate_constant). C CONSTS(3) is g11 in component model_parameters (dimensionless). C CONSTS(4) is g21 in component model_parameters (dimensionless). C STATES(2) is x2 in component x2 (cell). C CONSTS(5) is alpha2 in component model_parameters (first_order_rate_constant). C CONSTS(6) is beta2 in component model_parameters (first_order_rate_constant). C CONSTS(7) is g12 in component model_parameters (dimensionless). C CONSTS(8) is g22 in component model_parameters (dimensionless). C STATES(3) is z in component z (percent). C CONSTS(9) is k1 in component model_parameters (percent_per_cell_per_day). C CONSTS(10) is k2 in component model_parameters (percent_per_cell_per_day). C ALGBRC(1) is y1 in component y1 (cell). C ALGBRC(2) is y2 in component y2 (cell). C CONSTS(12) is x1_bar in component x1_bar (cell). C CONSTS(13) is x2_bar in component x2_bar (cell). C CONSTS(11) is gamma in component model_parameters (dimensionless). C RATES(1) is d/dt x1 in component x1 (cell). C RATES(2) is d/dt x2 in component x2 (cell). C RATES(3) is d/dt z in component z (percent). C SUBROUTINE initConsts(CONSTS, RATES, STATES) REAL CONSTS(*), RATES(*), STATES(*) STATES(1) = 10.06066 CONSTS(1) = 3 CONSTS(2) = 0.2 CONSTS(3) = 0.5 CONSTS(4) = -0.5 STATES(2) = 212.132 CONSTS(5) = 4 CONSTS(6) = 0.02 CONSTS(7) = 1 CONSTS(8) = 0 STATES(3) = 100.0 CONSTS(9) = 0.24 CONSTS(10) = 0.0017 CONSTS(11) = CONSTS(7)*CONSTS(4) - (1.00000 - CONSTS(3))*(1.00000 - CONSTS(8)) CONSTS(12) = CONSTS(2)/CONSTS(1) ** (1.00000 - CONSTS(8))/CONSTS(11)*CONSTS(6)/CONSTS(5) ** CONSTS(4)/CONSTS(11) CONSTS(13) = CONSTS(2)/CONSTS(1) ** CONSTS(7)/CONSTS(11)*CONSTS(6)/CONSTS(5) ** (1.00000 - CONSTS(3))/CONSTS(11) RETURN END SUBROUTINE computeRates(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) RATES(1) = CONSTS(1)*STATES(1) ** CONSTS(3)*STATES(2) ** CONSTS(4) - CONSTS(2)*STATES(1) RATES(2) = CONSTS(5)*STATES(1) ** CONSTS(7)*STATES(2) ** CONSTS(8) - CONSTS(6)*STATES(2) ALGBRC(1) = TERNRY(STATES(1).GT.CONSTS(12), STATES(1) - CONSTS(12), 0.00000) ALGBRC(2) = TERNRY(STATES(2).GT.CONSTS(13), STATES(2) - CONSTS(13), 0.00000) RATES(3) = CONSTS(10)*ALGBRC(2) - CONSTS(9)*ALGBRC(1) RETURN END SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) ALGBRC(1) = TERNRY(STATES(1).GT.CONSTS(12), STATES(1) - CONSTS(12), 0.00000) ALGBRC(2) = TERNRY(STATES(2).GT.CONSTS(13), STATES(2) - CONSTS(13), 0.00000) RETURN END REAL FUNCTION TERNRY(TEST, VALA, VALB) LOGICAL TEST REAL VALA, VALB IF (TEST) THEN TERNRY = VALA ELSE TERNRY = VALB ENDIF RETURN END