/* There are a total of 3 entries in the algebraic variable array. There are a total of 5 entries in each of the rate and state variable arrays. There are a total of 14 entries in the constant variable array. */ /* * VOI is time in component environment (day). * STATES[0] is X in component X (dimensionless). * CONSTANTS[0] is mu0 in component X (first_order_rate_constant). * CONSTANTS[1] is lamda in component X (first_order_rate_constant). * STATES[1] is K in component K (first_order_rate_constant). * STATES[2] is V in component V (dimensionless). * STATES[3] is Y in component Y (dimensionless). * CONSTANTS[2] is mu1 in component Y (first_order_rate_constant). * CONSTANTS[3] is a in component Y (dimensionless). * STATES[4] is Z in component Z (dimensionless). * ALGEBRAIC[0] is CD4 in component CD4 (dimensionless). * CONSTANTS[4] is mu2 in component V (first_order_rate_constant). * CONSTANTS[5] is beta in component V (first_order_rate_constant). * CONSTANTS[6] is b in component V (dimensionless). * CONSTANTS[7] is theta in component Z (first_order_rate_constant). * CONSTANTS[8] is rho in component Z (first_order_rate_constant). * ALGEBRAIC[1] is f_X in component Z (dimensionless). * ALGEBRAIC[2] is g_V in component Z (dimensionless). * CONSTANTS[9] is C1 in component Z (dimensionless). * CONSTANTS[10] is C2 in component Z (dimensionless). * CONSTANTS[11] is X0 in component Z (dimensionless). * CONSTANTS[12] is omega in component K (first_order_rate_constant). * CONSTANTS[13] is Kmax in component K (first_order_rate_constant). * RATES[0] is d/dt X in component X (dimensionless). * RATES[3] is d/dt Y in component Y (dimensionless). * RATES[2] is d/dt V in component V (dimensionless). * RATES[4] is d/dt Z in component Z (dimensionless). * RATES[1] is d/dt K in component K (first_order_rate_constant). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 1.0E11; CONSTANTS[0] = 4.0E-3; CONSTANTS[1] = 4.0E8; STATES[1] = 1.35E-14; STATES[2] = 1.0; STATES[3] = 1.0; CONSTANTS[2] = 0.30; CONSTANTS[3] = 1.0; STATES[4] = 0.0; CONSTANTS[4] = 1.0; CONSTANTS[5] = 1.0E3; CONSTANTS[6] = 1.0; CONSTANTS[7] = 1.0E-6; CONSTANTS[8] = 0.50; CONSTANTS[9] = 0.04; CONSTANTS[10] = 1.0E3; CONSTANTS[11] = 1.0E11; CONSTANTS[12] = 1.0E-16; CONSTANTS[13] = 20.0; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[0] = CONSTANTS[1] - ( CONSTANTS[0]*STATES[0]+ STATES[1]*STATES[2]*STATES[0]); RATES[3] = STATES[1]*STATES[2]*STATES[3] - CONSTANTS[2]*(1.00000+ CONSTANTS[3]*STATES[4])*STATES[3]; RATES[2] = CONSTANTS[5]*STATES[3] - CONSTANTS[4]*(1.00000+ CONSTANTS[6]*STATES[4])*STATES[2]; RATES[1] = CONSTANTS[12]*STATES[2]*(CONSTANTS[13] - STATES[1]); ALGEBRAIC[1] = ( (1.00000+CONSTANTS[9])*pow(STATES[0]/CONSTANTS[11], 2.00000))/(CONSTANTS[9]+pow(STATES[0]/CONSTANTS[11], 2.00000)); ALGEBRAIC[2] = STATES[2]/(CONSTANTS[10]+STATES[2]); RATES[4] = CONSTANTS[7]*ALGEBRAIC[2]+ CONSTANTS[8]*(ALGEBRAIC[1] - STATES[4])*STATES[4]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = ( (1.00000+CONSTANTS[9])*pow(STATES[0]/CONSTANTS[11], 2.00000))/(CONSTANTS[9]+pow(STATES[0]/CONSTANTS[11], 2.00000)); ALGEBRAIC[2] = STATES[2]/(CONSTANTS[10]+STATES[2]); ALGEBRAIC[0] = (STATES[0]+STATES[3])/1.00000e+11; }