/* There are a total of 16 entries in the algebraic variable array. There are a total of 9 entries in each of the rate and state variable arrays. There are a total of 16 entries in the constant variable array. */ /* * VOI is time in component environment (hour). * STATES[0] is A in component A (molecules). * ALGEBRAIC[0] is RXN1 in component RXN1 (flux). * ALGEBRAIC[1] is RXN2 in component RXN2 (flux). * ALGEBRAIC[4] is RXN5 in component RXN5 (flux). * ALGEBRAIC[10] is RXN11 in component RXN11 (flux). * ALGEBRAIC[5] is RXN6 in component RXN6 (flux). * ALGEBRAIC[9] is RXN10 in component RXN10 (flux). * ALGEBRAIC[11] is RXN12 in component RXN12 (flux). * STATES[1] is C in component C (molecules). * ALGEBRAIC[2] is RXN3 in component RXN3 (flux). * STATES[2] is DA in component DA (molecules). * ALGEBRAIC[6] is RXN7 in component RXN7 (flux). * STATES[3] is DAp in component DAp (molecules). * ALGEBRAIC[7] is RXN8 in component RXN8 (flux). * STATES[4] is DR in component DR (molecules). * ALGEBRAIC[12] is RXN13 in component RXN13 (flux). * STATES[5] is DRP in component DRP (molecules). * ALGEBRAIC[13] is RXN14 in component RXN14 (flux). * STATES[6] is MA in component MA (molecules). * ALGEBRAIC[8] is RXN9 in component RXN9 (flux). * STATES[7] is MR in component MR (molecules). * ALGEBRAIC[14] is RXN15 in component RXN15 (flux). * ALGEBRAIC[15] is RXN16 in component RXN16 (flux). * STATES[8] is R in component R (molecules). * ALGEBRAIC[3] is RXN4 in component RXN4 (flux). * CONSTANTS[0] is Gamma_1 in component RXN1 (second_order_rate). * CONSTANTS[1] is Delta_1 in component RXN2 (first_order_rate). * CONSTANTS[2] is Delta_2 in component RXN3 (first_order_rate). * CONSTANTS[3] is Delta_3 in component RXN4 (first_order_rate). * CONSTANTS[4] is Gamma_2 in component RXN5 (second_order_rate). * CONSTANTS[5] is Thetha_1 in component RXN6 (first_order_rate). * CONSTANTS[6] is Alpha_1 in component RXN7 (first_order_rate). * CONSTANTS[7] is Alpha_2 in component RXN8 (first_order_rate). * CONSTANTS[8] is Delta_4 in component RXN9 (first_order_rate). * CONSTANTS[9] is BetaA_1 in component RXN10 (first_order_rate). * CONSTANTS[10] is Gamma_3 in component RXN11 (second_order_rate). * CONSTANTS[11] is Theta_2 in component RXN12 (first_order_rate). * CONSTANTS[12] is Alpha_3 in component RXN13 (first_order_rate). * CONSTANTS[13] is Alpha_4 in component RXN14 (first_order_rate). * CONSTANTS[14] is Delta_5 in component RXN15 (first_order_rate). * CONSTANTS[15] is BetaR_1 in component RXN16 (first_order_rate). * RATES[0] is d/dt A in component A (molecules). * RATES[1] is d/dt C in component C (molecules). * RATES[2] is d/dt DA in component DA (molecules). * RATES[3] is d/dt DAp in component DAp (molecules). * RATES[4] is d/dt DR in component DR (molecules). * RATES[5] is d/dt DRP in component DRP (molecules). * RATES[6] is d/dt MA in component MA (molecules). * RATES[7] is d/dt MR in component MR (molecules). * RATES[8] is d/dt R in component R (molecules). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 0.0; STATES[1] = 0.0; STATES[2] = 1; STATES[3] = 0.0; STATES[4] = 1; STATES[5] = 1; STATES[6] = 0.0; STATES[7] = 0.0; STATES[8] = 0.0; CONSTANTS[0] = 2; CONSTANTS[1] = 1; CONSTANTS[2] = 1; CONSTANTS[3] = 0.2; CONSTANTS[4] = 1; CONSTANTS[5] = 50; CONSTANTS[6] = 50; CONSTANTS[7] = 500; CONSTANTS[8] = 10; CONSTANTS[9] = 50; CONSTANTS[10] = 1; CONSTANTS[11] = 100; CONSTANTS[12] = 0.01; CONSTANTS[13] = 50; CONSTANTS[14] = 0.5; CONSTANTS[15] = 5; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = STATES[0]*STATES[8]*CONSTANTS[0]; ALGEBRAIC[2] = STATES[1]*CONSTANTS[2]; RATES[1] = (1.00000/1.00000)*( - 1.00000*ALGEBRAIC[2]+ALGEBRAIC[0]); ALGEBRAIC[4] = STATES[0]*STATES[2]*CONSTANTS[4]; ALGEBRAIC[5] = STATES[3]*CONSTANTS[5]; ALGEBRAIC[6] = STATES[2]*CONSTANTS[6]; RATES[2] = (1.00000/1.00000)*( -1.00000*ALGEBRAIC[4]+ -1.00000*ALGEBRAIC[6]+ALGEBRAIC[5]+ALGEBRAIC[6]); ALGEBRAIC[7] = STATES[3]*CONSTANTS[7]; RATES[3] = (1.00000/1.00000)*( -1.00000*ALGEBRAIC[5]+ -1.00000*ALGEBRAIC[7]+ALGEBRAIC[4]+ALGEBRAIC[7]); ALGEBRAIC[9] = STATES[6]*CONSTANTS[9]; ALGEBRAIC[8] = STATES[6]*CONSTANTS[8]; RATES[6] = (1.00000/1.00000)*( -1.00000*ALGEBRAIC[8]+ -1.00000*ALGEBRAIC[9]+ALGEBRAIC[6]+ALGEBRAIC[7]+ALGEBRAIC[9]); ALGEBRAIC[1] = STATES[0]*CONSTANTS[1]; ALGEBRAIC[10] = STATES[0]*STATES[4]*CONSTANTS[10]; ALGEBRAIC[11] = STATES[5]*CONSTANTS[11]; RATES[0] = (1.00000/1.00000)*( - 1.00000*ALGEBRAIC[0]+ - 1.00000*ALGEBRAIC[1]+ - 1.00000*ALGEBRAIC[4]+ - 1.00000*ALGEBRAIC[10]+ALGEBRAIC[5]+ALGEBRAIC[9]+ALGEBRAIC[11]); ALGEBRAIC[12] = STATES[4]*CONSTANTS[12]; RATES[4] = (1.00000/1.00000)*( -1.00000*ALGEBRAIC[10]+ -1.00000*ALGEBRAIC[12]+ALGEBRAIC[11]+ALGEBRAIC[12]); ALGEBRAIC[13] = STATES[5]*CONSTANTS[13]; RATES[5] = (1.00000/1.00000)*( -1.00000*ALGEBRAIC[11]+ -1.00000*ALGEBRAIC[13]+ALGEBRAIC[10]+ALGEBRAIC[13]); ALGEBRAIC[14] = STATES[7]*CONSTANTS[14]; ALGEBRAIC[15] = STATES[7]*CONSTANTS[15]; RATES[7] = (1.00000/1.00000)*( -1.00000*ALGEBRAIC[14]+ -1.00000*ALGEBRAIC[15]+ALGEBRAIC[12]+ALGEBRAIC[13]+ALGEBRAIC[15]); ALGEBRAIC[3] = STATES[8]*CONSTANTS[3]; RATES[8] = (1.00000/1.00000)*( -1.00000*ALGEBRAIC[0]+ -1.00000*ALGEBRAIC[3]+ALGEBRAIC[2]+ALGEBRAIC[15]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = STATES[0]*STATES[8]*CONSTANTS[0]; ALGEBRAIC[2] = STATES[1]*CONSTANTS[2]; ALGEBRAIC[4] = STATES[0]*STATES[2]*CONSTANTS[4]; ALGEBRAIC[5] = STATES[3]*CONSTANTS[5]; ALGEBRAIC[6] = STATES[2]*CONSTANTS[6]; ALGEBRAIC[7] = STATES[3]*CONSTANTS[7]; ALGEBRAIC[9] = STATES[6]*CONSTANTS[9]; ALGEBRAIC[8] = STATES[6]*CONSTANTS[8]; ALGEBRAIC[1] = STATES[0]*CONSTANTS[1]; ALGEBRAIC[10] = STATES[0]*STATES[4]*CONSTANTS[10]; ALGEBRAIC[11] = STATES[5]*CONSTANTS[11]; ALGEBRAIC[12] = STATES[4]*CONSTANTS[12]; ALGEBRAIC[13] = STATES[5]*CONSTANTS[13]; ALGEBRAIC[14] = STATES[7]*CONSTANTS[14]; ALGEBRAIC[15] = STATES[7]*CONSTANTS[15]; ALGEBRAIC[3] = STATES[8]*CONSTANTS[3]; }