/* There are a total of 2 entries in the algebraic variable array. There are a total of 3 entries in each of the rate and state variable arrays. There are a total of 13 entries in the constant variable array. */ /* * VOI is time in component environment (day). * STATES[0] is x1 in component x1 (cell). * CONSTANTS[0] is alpha1 in component model_parameters (flux). * CONSTANTS[1] is beta1 in component model_parameters (first_order_rate_constant). * CONSTANTS[2] is g11 in component model_parameters (dimensionless). * CONSTANTS[3] is g21 in component model_parameters (dimensionless). * STATES[1] is x2 in component x2 (cell). * CONSTANTS[4] is alpha2 in component model_parameters (first_order_rate_constant). * CONSTANTS[5] is beta2 in component model_parameters (first_order_rate_constant). * CONSTANTS[6] is g12 in component model_parameters (dimensionless). * CONSTANTS[7] is g22 in component model_parameters (dimensionless). * STATES[2] is z in component z (percent). * CONSTANTS[8] is k1 in component model_parameters (percent_per_cell_per_day). * CONSTANTS[9] is k2 in component model_parameters (percent_per_cell_per_day). * ALGEBRAIC[0] is y1 in component y1 (cell). * ALGEBRAIC[1] is y2 in component y2 (cell). * CONSTANTS[11] is x1_bar in component x1_bar (cell). * CONSTANTS[12] is x2_bar in component x2_bar (cell). * CONSTANTS[10] is gamma in component model_parameters (dimensionless). * RATES[0] is d/dt x1 in component x1 (cell). * RATES[1] is d/dt x2 in component x2 (cell). * RATES[2] is d/dt z in component z (percent). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 10.06066; CONSTANTS[0] = 3; CONSTANTS[1] = 0.2; CONSTANTS[2] = 0.5; CONSTANTS[3] = -0.5; STATES[1] = 212.132; CONSTANTS[4] = 4; CONSTANTS[5] = 0.02; CONSTANTS[6] = 1; CONSTANTS[7] = 0; STATES[2] = 100.0; CONSTANTS[8] = 0.24; CONSTANTS[9] = 0.0017; CONSTANTS[10] = CONSTANTS[6]*CONSTANTS[3] - (1.00000 - CONSTANTS[2])*(1.00000 - CONSTANTS[7]); CONSTANTS[11] = pow(CONSTANTS[1]/CONSTANTS[0], (1.00000 - CONSTANTS[7])/CONSTANTS[10])*pow(CONSTANTS[5]/CONSTANTS[4], CONSTANTS[3]/CONSTANTS[10]); CONSTANTS[12] = pow(CONSTANTS[1]/CONSTANTS[0], CONSTANTS[6]/CONSTANTS[10])*pow(CONSTANTS[5]/CONSTANTS[4], (1.00000 - CONSTANTS[2])/CONSTANTS[10]); } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[0] = CONSTANTS[0]*pow(STATES[0], CONSTANTS[2])*pow(STATES[1], CONSTANTS[3]) - CONSTANTS[1]*STATES[0]; RATES[1] = CONSTANTS[4]*pow(STATES[0], CONSTANTS[6])*pow(STATES[1], CONSTANTS[7]) - CONSTANTS[5]*STATES[1]; ALGEBRAIC[0] = (STATES[0]>CONSTANTS[11] ? STATES[0] - CONSTANTS[11] : 0.00000); ALGEBRAIC[1] = (STATES[1]>CONSTANTS[12] ? STATES[1] - CONSTANTS[12] : 0.00000); RATES[2] = CONSTANTS[9]*ALGEBRAIC[1] - CONSTANTS[8]*ALGEBRAIC[0]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (STATES[0]>CONSTANTS[11] ? STATES[0] - CONSTANTS[11] : 0.00000); ALGEBRAIC[1] = (STATES[1]>CONSTANTS[12] ? STATES[1] - CONSTANTS[12] : 0.00000); }