void IdealGasReactor::getState(double* y) { if (m_thermo == 0) { throw CanteraError("getState", "Error: reactor is empty."); } m_thermo->restoreState(m_state); // set the first component to the total mass m_mass = m_thermo->density() * m_vol; y[0] = m_mass; // set the second component to the total volume y[1] = m_vol; // Set the third component to the temperature y[2] = m_thermo->temperature(); // set components y+3 ... y+K+2 to the mass fractions of each species m_thermo->getMassFractions(y+3); // set the remaining components to the surface species // coverages on the walls getSurfaceInitialConditions(y + m_nsp + 3); }
void Reactor::getInitialConditions(double t0, size_t leny, double* y) { if (m_thermo == 0) { cout << "Error: reactor is empty." << endl; return; } m_thermo->restoreState(m_state); // set the first component to the total mass m_mass = m_thermo->density() * m_vol; y[0] = m_mass; // set the second component to the total volume y[1] = m_vol; // set the third component to the total internal energy y[2] = m_thermo->intEnergy_mass() * m_mass; // set components y+3 ... y+K+2 to the mass fractions of each species m_thermo->getMassFractions(y+3); // set the remaining components to the surface species // coverages on the walls getSurfaceInitialConditions(y + m_nsp + 3); }
void ConstPressureReactor::getState(double* y) { if (m_thermo == 0) { throw CanteraError("getState", "Error: reactor is empty."); } m_thermo->restoreState(m_state); // set the first component to the total mass y[0] = m_thermo->density() * m_vol; // set the second component to the total enthalpy y[1] = m_thermo->enthalpy_mass() * m_thermo->density() * m_vol; // set components y+2 ... y+K+1 to the mass fractions Y_k of each species m_thermo->getMassFractions(y+2); // set the remaining components to the surface species // coverages on the walls getSurfaceInitialConditions(y + m_nsp + 2); }