13 gas = cantSol->thermo();
14 kin = cantSol->kinetics();
20 integrator.reset(Cantera::newIntegrator(
"CVODE"));
37 gas->setMassFractions(&y[0]);
38 gas->setState_HP(h,
gas->pressure());
52 for (
int k = 0; k <
nvar; k++)
67 gas->setMassFractions_NoNorm(vars);
71 double rho =
gas->density();
72 std::vector<double> rr(
gas->nSpecies());
73 kin->getNetProductionRates(&rr[0]);
74 for (
size_t k = 0; k <
gas->nSpecies(); k++)
75 dvarsdt[k] = rr[k] *
gas->molecularWeight(k) /
rho;
batchReactor_cantera(std::shared_ptr< Cantera::Solution > cantSol)
Constructor for batchReactor_cantera.
std::unique_ptr< Cantera::Integrator > integrator
Cantera cvode wrapper.
virtual void react(double &h, std::vector< double > &y, const double tRun)
Simulates a reaction in the batch reactor.
void eval(double t, double *vars, double *dvarsdt, double *not_used)
Evaluates the reaction rates.
int nvar
number of variables/equations solved
double rho
density during integrate
std::shared_ptr< Cantera::Kinetics > kin
Cantera kinetics object.
double P_fixed
pressure during integrate
std::shared_ptr< Cantera::ThermoPhase > gas
Cantera thermo object.
double h_fixed
adiabatic h during integrate