/* There are a total of 3 entries in the algebraic variable array. There are a total of 2 entries in each of the rate and state variable arrays. There are a total of 15 entries in the constant variable array. */ /* * ALGEBRAIC[0] is time in component environment (second). * VOI is tau in component environment (dimensionless). * CONSTANTS[12] is C_0 in component reaction_constants (per_second). * ALGEBRAIC[1] is A in component a (molar). * STATES[0] is a in component a (dimensionless). * CONSTANTS[0] is alpha in component reaction_constants (dimensionless). * CONSTANTS[1] is beta in component reaction_constants (dimensionless). * CONSTANTS[2] is K in component reaction_constants (dimensionless). * CONSTANTS[13] is C_1 in component reaction_constants (molar). * STATES[1] is g in component g (dimensionless). * ALGEBRAIC[2] is G in component g (molar). * CONSTANTS[3] is gamma in component reaction_constants (dimensionless). * CONSTANTS[4] is L in component reaction_constants (dimensionless). * CONSTANTS[14] is C_2 in component reaction_constants (molar). * CONSTANTS[5] is k2 in component reaction_constants (per_second). * CONSTANTS[6] is k3 in component reaction_constants (per_second). * CONSTANTS[7] is k6 in component reaction_constants (per_second). * CONSTANTS[8] is k7 in component reaction_constants (per_second). * CONSTANTS[9] is k0 in component reaction_constants (molar_per_second). * CONSTANTS[10] is k4 in component reaction_constants (per_molar2_per_second). * CONSTANTS[11] is km in component reaction_constants (molar_per_second). * RATES[0] is d/dt a in component a (dimensionless). * RATES[1] is d/dt g in component g (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 4.39927; CONSTANTS[0] = 0.008; CONSTANTS[1] = 1.485; CONSTANTS[2] = 30; STATES[1] = 1.96477; CONSTANTS[3] = 11.385; CONSTANTS[4] = 0.1; CONSTANTS[5] = 6e-4; CONSTANTS[6] = 0.0000048; CONSTANTS[7] = 0.000891; CONSTANTS[8] = 0.006831; CONSTANTS[9] = 8.7831e-11; CONSTANTS[10] = 2.1e12; CONSTANTS[11] = 6.9001e-14; CONSTANTS[12] = CONSTANTS[5]; CONSTANTS[13] = pow((CONSTANTS[5]/CONSTANTS[10]), 1.0 / 2); CONSTANTS[14] = pow((CONSTANTS[5]/CONSTANTS[10]), 1.0 / 2); } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[0] = CONSTANTS[2] - ( (1.00000+CONSTANTS[0]+CONSTANTS[1])*STATES[0]+ STATES[0]*pow(STATES[1], 2.00000)); RATES[1] = ( (1.00000 - CONSTANTS[0])*STATES[0]+ STATES[0]*pow(STATES[1], 2.00000)) - (CONSTANTS[4]+ CONSTANTS[3]*STATES[1]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = VOI/CONSTANTS[12]; ALGEBRAIC[1] = CONSTANTS[13]*STATES[0]; ALGEBRAIC[2] = CONSTANTS[14]*STATES[1]; }