/* 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 4 entries in the constant variable array. */ /* * VOI is t in component main (second). * CONSTANTS[0] is RT in component main (J_per_mol). * STATES[0] is q_1 in component main (mole). * STATES[1] is q_2 in component main (mole). * ALGEBRAIC[4] is v_r in component main (mol_per_s). * ALGEBRAIC[0] is u_1 in component main (J_per_mol). * ALGEBRAIC[1] is u_2 in component main (J_per_mol). * ALGEBRAIC[2] is u_f in component main (J_per_mol). * ALGEBRAIC[3] is u_r in component main (J_per_mol). * CONSTANTS[1] is K_q_1 in component main (per_mol). * CONSTANTS[2] is K_q_2 in component main (per_mol). * CONSTANTS[3] is kappa_r in component main (mol_per_s). * RATES[0] is d/dt q_1 in component main (mole). * RATES[1] is d/dt q_2 in component main (mole). * There are a total of 0 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { CONSTANTS[0] = 2578.73058; STATES[0] = 1; STATES[1] = 0; CONSTANTS[1] = 1; CONSTANTS[2] = 1; CONSTANTS[3] = 0.1; 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]; resid[1] = RATES[1] - ALGEBRAIC[4]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = CONSTANTS[0]*log( CONSTANTS[1]*STATES[0]); ALGEBRAIC[2] = ALGEBRAIC[0]; ALGEBRAIC[1] = CONSTANTS[0]*log( CONSTANTS[2]*STATES[1]); ALGEBRAIC[3] = ALGEBRAIC[1]; ALGEBRAIC[4] = CONSTANTS[3]*(exp(ALGEBRAIC[2]/CONSTANTS[0]) - exp(ALGEBRAIC[3]/CONSTANTS[0])); } 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) { }