Generated Code

The following is f77 code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

C
C There are a total of 9 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 13 entries in the constant variable array.
C
C
C VOI is t in component main (second).
C CONSTS(1) is V_m in component main (J_per_C).
C CONSTS(2) is RTF in component main (J_per_C).
C CONSTS(11) is epsilon in component main (dimensionless).
C STATES(1) is TA_i in component main (mol_per_m3).
C ALGBRC(1) is CO2_o in component main (mol_per_m3).
C ALGBRC(6) is CO2_i in component main (mol_per_m3).
C ALGBRC(8) is HCO3_i in component main (mol_per_m3).
C ALGBRC(2) is HCO3_o in component main (mol_per_m3).
C STATES(2) is H_i in component main (mol_per_m3).
C CONSTS(3) is H_o in component main (mol_per_m3).
C CONSTS(4) is H_Lim in component main (mol_per_m3).
C ALGBRC(7) is M_CO2 in component main (mol_per_m2_s).
C ALGBRC(9) is M_HCO3 in component main (mol_per_m2_s).
C ALGBRC(4) is M_H in component main (mol_per_m2_s).
C ALGBRC(3) is pH_i in component main (dimensionless).
C CONSTS(12) is pH_o in component main (dimensionless).
C CONSTS(13) is pH_Lim in component main (dimensionless).
C CONSTS(5) is P_CO2 in component main (m_per_s).
C CONSTS(6) is P_HCO3 in component main (m_per_s).
C CONSTS(7) is k in component main (m_per_s).
C CONSTS(8) is K_A in component main (mol_per_m3).
C CONSTS(9) is rho in component main (per_m).
C ALGBRC(5) is alpha_i in component main (dimensionless).
C CONSTS(10) is beta in component main (mol_per_m3).
C RATES(1) is d/dt TA_i in component main (mol_per_m3).
C RATES(2) is d/dt H_i in component main (mol_per_m3).
C
      SUBROUTINE initConsts(CONSTS, RATES, STATES)
      REAL CONSTS(*), RATES(*), STATES(*)
      CONSTS(1) = -0.057
      CONSTS(2) = 0.0256796
      STATES(1) = 0.0
      STATES(2) = 3.981071705534970e-05
      CONSTS(3) = 1.995262314968879e-05
      CONSTS(4) = 3.981071705534970e-05
      CONSTS(5) = 6e-5
      CONSTS(6) = 5e-9
      CONSTS(7) = 0.0375
      CONSTS(8) = 1e-3
      CONSTS(9) = 8000
      CONSTS(10) = -26
      CONSTS(11) = EXP(- CONSTS(1)/CONSTS(2))
      CONSTS(12) = - arbitrary_log( 0.00100000*CONSTS(3), 10)
      CONSTS(13) = - arbitrary_log( 0.00100000*CONSTS(4), 10)
      RETURN
      END
      SUBROUTINE computeRates(VOI, CONSTS,  RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(1) = TERNRY(VOI.LT.100.000, 0.00000, TERNRY(VOI.LT.2800.00, 1.18770, 0.00000)
      ALGBRC(5) = STATES(2)/(STATES(2)+CONSTS(8))
      ALGBRC(6) =  ALGBRC(5)*STATES(1)
      ALGBRC(7) =  CONSTS(5)*(ALGBRC(1) - ALGBRC(6))
      ALGBRC(8) =  (1.00000 - ALGBRC(5))*STATES(1)
      ALGBRC(2) = ( CONSTS(8)*ALGBRC(1))/CONSTS(3)
      ALGBRC(9) = ( (( CONSTS(6)*CONSTS(1))/CONSTS(2))*(ALGBRC(2) -  ALGBRC(8)*CONSTS(11)))/(1.00000 - CONSTS(11))
      RATES(1) =  CONSTS(9)*(ALGBRC(7)+ALGBRC(9))
      ALGBRC(3) = - arbitrary_log( 0.00100000*STATES(2), 10)
      ALGBRC(4) = TERNRY(ALGBRC(3).LT.CONSTS(13),  CONSTS(7)*(STATES(2) - CONSTS(4)), 0.00000)
      RATES(2) =  (( - 2.30300*STATES(2))/CONSTS(10))*CONSTS(9)*(( (1.00000 - ALGBRC(5))*ALGBRC(7) -  ALGBRC(5)*ALGBRC(9)) - ALGBRC(4))
      RETURN
      END
      SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(1) = TERNRY(VOI.LT.100.000, 0.00000, TERNRY(VOI.LT.2800.00, 1.18770, 0.00000)
      ALGBRC(5) = STATES(2)/(STATES(2)+CONSTS(8))
      ALGBRC(6) =  ALGBRC(5)*STATES(1)
      ALGBRC(7) =  CONSTS(5)*(ALGBRC(1) - ALGBRC(6))
      ALGBRC(8) =  (1.00000 - ALGBRC(5))*STATES(1)
      ALGBRC(2) = ( CONSTS(8)*ALGBRC(1))/CONSTS(3)
      ALGBRC(9) = ( (( CONSTS(6)*CONSTS(1))/CONSTS(2))*(ALGBRC(2) -  ALGBRC(8)*CONSTS(11)))/(1.00000 - CONSTS(11))
      ALGBRC(3) = - arbitrary_log( 0.00100000*STATES(2), 10)
      ALGBRC(4) = TERNRY(ALGBRC(3).LT.CONSTS(13),  CONSTS(7)*(STATES(2) - CONSTS(4)), 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