/* There are a total of 5 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). * ALGEBRAIC[4] is KP 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[2] is gamma in component reaction_constants (dimensionless). * CONSTANTS[3] is L in component reaction_constants (dimensionless). * CONSTANTS[14] is C_2 in component reaction_constants (molar). * CONSTANTS[4] is k2 in component reaction_constants (per_second). * CONSTANTS[5] is k3 in component reaction_constants (per_second). * CONSTANTS[6] is k6 in component reaction_constants (per_second). * CONSTANTS[7] is k7 in component reaction_constants (per_second). * CONSTANTS[8] is k0 in component reaction_constants (molar_per_second). * CONSTANTS[9] is k4 in component reaction_constants (per_molar2_per_second). * CONSTANTS[10] is km in component reaction_constants (molar_per_second). * CONSTANTS[11] is K in component reaction_constants (dimensionless). * ALGEBRAIC[3] is P in component reaction_constants (dimensionless). * RATES[0] is d/dt a in component a (dimensionless). * RATES[1] is d/dt g in component g (dimensionless). * There are a total of 0 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 4.39927; CONSTANTS[0] = 0.008; CONSTANTS[1] = 1.485; STATES[1] = 1.96477; CONSTANTS[2] = 11.385; CONSTANTS[3] = 0.1; CONSTANTS[4] = 6e-4; CONSTANTS[5] = 0.0000048; CONSTANTS[6] = 0.000891; CONSTANTS[7] = 0.006831; CONSTANTS[8] = 8.7831e-11; CONSTANTS[9] = 2.1e12; CONSTANTS[10] = 6.9001e-14; CONSTANTS[11] = 30; CONSTANTS[12] = CONSTANTS[4]; CONSTANTS[13] = pow((CONSTANTS[4]/CONSTANTS[9]), 1.0 / 2); CONSTANTS[14] = pow((CONSTANTS[4]/CONSTANTS[9]), 1.0 / 2); RATES[0] = 0.1001; RATES[1] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[0] - ALGEBRAIC[4] - ( (1.00000+CONSTANTS[0]+CONSTANTS[1])*STATES[0]+ STATES[0]*pow(STATES[1], 2.00000)); resid[1] = RATES[1] - ( (1.00000 - CONSTANTS[0])*STATES[0]+ STATES[0]*pow(STATES[1], 2.00000)) - (CONSTANTS[3]+ CONSTANTS[2]*STATES[1]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = CONSTANTS[13]*STATES[0]; ALGEBRAIC[2] = CONSTANTS[14]*STATES[1]; } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = VOI/CONSTANTS[12]; ALGEBRAIC[3] = 0.735000+ 0.156300* sin(( 2.00000*3.14159*ALGEBRAIC[0])/( 24.0000*3600.00))+ 0.312700*fabs( sin(( 3.14159*ALGEBRAIC[0])/( 24.0000*3600.00))); ALGEBRAIC[4] = CONSTANTS[11]*ALGEBRAIC[3]; } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { }