/* There are a total of 3 entries in the algebraic variable array. There are a total of 4 entries in each of the rate and state variable arrays. There are a total of 9 entries in the constant variable array. */ /* * VOI is time in component environment (day). * STATES[0] is x in component x (per_mm3). * CONSTANTS[0] is lamda in component x (per_mm3_per_day). * CONSTANTS[1] is d in component x (per_day). * CONSTANTS[2] is beta in component kinetic_parameters (mm3_per_day). * ALGEBRAIC[2] is s in component kinetic_parameters (dimensionless). * STATES[1] is y in component y (per_mm3). * CONSTANTS[3] is a in component y (per_day). * CONSTANTS[4] is p in component kinetic_parameters (mm3_per_day). * STATES[2] is z in component z (per_mm3). * ALGEBRAIC[0] is log_y in component y (dimensionless). * STATES[3] is w in component w (per_mm3). * CONSTANTS[5] is b in component w (per_day). * CONSTANTS[6] is c in component kinetic_parameters (mm3_mm3_per_day). * CONSTANTS[7] is q in component kinetic_parameters (per_mm3). * ALGEBRAIC[1] is log_w in component w (dimensionless). * CONSTANTS[8] is h in component z (per_day). * RATES[0] is d/dt x in component x (per_mm3). * RATES[1] is d/dt y in component y (per_mm3). * RATES[3] is d/dt w in component w (per_mm3). * RATES[2] is d/dt z in component z (per_mm3). * There are a total of 2 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 10; CONSTANTS[0] = 1; CONSTANTS[1] = 0.1; CONSTANTS[2] = 0.5; STATES[1] = 0.1; CONSTANTS[3] = 0.2; CONSTANTS[4] = 1; STATES[2] = 0; STATES[3] = 0.001; CONSTANTS[5] = 0.01; CONSTANTS[6] = 0.1; CONSTANTS[7] = 0.5; CONSTANTS[8] = 0.1; RATES[0] = 0.1001; RATES[1] = 0.1001; RATES[3] = 0.1001; RATES[2] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[0] - CONSTANTS[0] - ( CONSTANTS[1]*STATES[0]+ ALGEBRAIC[2]*CONSTANTS[2]*STATES[0]*STATES[1]); resid[1] = RATES[1] - ALGEBRAIC[2]*CONSTANTS[2]*STATES[0]*STATES[1] - ( CONSTANTS[3]*STATES[1]+ CONSTANTS[4]*STATES[1]*STATES[2]); resid[2] = RATES[3] - CONSTANTS[6]*STATES[0]*STATES[1]*STATES[3] - ( CONSTANTS[6]*CONSTANTS[7]*STATES[1]*STATES[3]+ CONSTANTS[5]*STATES[3]); resid[3] = RATES[2] - CONSTANTS[6]*CONSTANTS[7]*STATES[1]*STATES[3] - CONSTANTS[8]*STATES[2]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = arbitrary_log( STATES[1]*1.00000, 10); ALGEBRAIC[1] = arbitrary_log( STATES[3]*1.00000, 10); } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[2] = (CONDVAR[0]<=0.00000 ? 1.00000 : CONDVAR[1]>=0.00000 ? 1.00000 : 0.00420000); } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; SI[2] = 1.0; SI[3] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { CONDVAR[0] = VOI - 15.0000; CONDVAR[1] = VOI - 40.0000; }