/** * @internal Initialize. This method is provided to allow * subclasses to perform any initialization required after all * species have been added. For example, it might be used to * resize internal work arrays that must have an entry for * each species. The base class implementation does nothing, * and subclasses that do not require initialization do not * need to overload this method. When importing a CTML phase * description, this method is called just prior to returning * from function importPhase. * * @see importCTML.cpp */ void StoichSubstanceSSTP::initThermo() { /* * Make sure there is one and only one species in this phase. */ m_kk = nSpecies(); if (m_kk != 1) { throw CanteraError("initThermo", "stoichiometric substances may only contain one species."); } doublereal tmin = m_spthermo->minTemp(); doublereal tmax = m_spthermo->maxTemp(); if (tmin > 0.0) m_tmin = tmin; if (tmax > 0.0) m_tmax = tmax; /* * Store the reference pressure in the variables for the class. */ m_p0 = refPressure(); /* * Resize temporary arrays. */ int leng = 1; m_h0_RT.resize(leng); m_cp0_R.resize(leng); m_s0_R.resize(leng); /* * Call the base class thermo initializer */ SingleSpeciesTP::initThermo(); }
void MixtureFugacityTP::getStandardVolumes_ref(doublereal* vol) const { _updateReferenceStateThermo(); doublereal v0 = _RT() / refPressure(); for (size_t i = 0; i < m_kk; i++) { vol[i]= v0; } }
void IdealGasPhase::initThermo() { ThermoPhase::initThermo(); m_p0 = refPressure(); m_h0_RT.resize(m_kk); m_g0_RT.resize(m_kk); m_expg0_RT.resize(m_kk); m_cp0_R.resize(m_kk); m_s0_R.resize(m_kk); m_pp.resize(m_kk); }
void LatticePhase::initThermo() { m_Pref = refPressure(); m_h0_RT.resize(m_kk); m_g0_RT.resize(m_kk); m_cp0_R.resize(m_kk); m_s0_R.resize(m_kk); m_speciesMolarVolume.resize(m_kk, 0.0); ThermoPhase::initThermo(); }
void StoichSubstance::initThermo() { // Make sure there is one and only one species in this phase. if (m_kk != 1) { throw CanteraError("initThermo", "stoichiometric substances may only contain one species."); } // Store the reference pressure in the variables for the class. m_p0 = refPressure(); // Call the base class thermo initializer SingleSpeciesTP::initThermo(); }
void LatticePhase::initThermo() { m_kk = nSpecies(); m_mm = nElements(); doublereal tmin = m_spthermo->minTemp(); doublereal tmax = m_spthermo->maxTemp(); if (tmin > 0.0) m_tmin = tmin; if (tmax > 0.0) m_tmax = tmax; m_p0 = refPressure(); m_h0_RT.resize(m_kk); m_g0_RT.resize(m_kk); m_cp0_R.resize(m_kk); m_s0_R.resize(m_kk); setMolarDensity(m_molar_density); }
void ConstDensityThermo::initThermo() { m_kk = nSpecies(); m_mm = nElements(); doublereal tmin = m_spthermo->minTemp(); doublereal tmax = m_spthermo->maxTemp(); if (tmin > 0.0) m_tmin = tmin; if (tmax > 0.0) m_tmax = tmax; m_p0 = refPressure(); m_h0_RT.resize(m_kk); m_g0_RT.resize(m_kk); m_expg0_RT.resize(m_kk); m_cp0_R.resize(m_kk); m_s0_R.resize(m_kk); m_pe.resize(m_kk, 0.0); m_pp.resize(m_kk); }
void PecosGasPhase::initThermo() { m_mm = nElements(); doublereal tmin = m_spthermo->minTemp(); doublereal tmax = m_spthermo->maxTemp(); if (tmin > 0.0) m_tmin = tmin; if (tmax > 0.0) m_tmax = tmax; m_p0 = refPressure(); int leng = m_kk; m_h0_RT.resize(leng); m_g0_RT.resize(leng); m_expg0_RT.resize(leng); m_cp0_R.resize(leng); m_s0_R.resize(leng); m_pe.resize(leng, 0.0); m_pp.resize(leng); }
void IdealSolidSolnPhase::initLengths() { /* * Obtain the reference pressure by calling the ThermoPhase * function refPressure, which in turn calls the * species thermo reference pressure function of the * same name. */ m_Pref = refPressure(); m_h0_RT.resize(m_kk); m_g0_RT.resize(m_kk); m_expg0_RT.resize(m_kk); m_cp0_R.resize(m_kk); m_s0_R.resize(m_kk); m_pe.resize(m_kk, 0.0); m_pp.resize(m_kk); m_speciesMolarVolume.resize(m_kk); }
void MixtureFugacityTP::_updateReferenceStateThermo() const { double Tnow = temperature(); // If the temperature has changed since the last time these // properties were computed, recompute them. if (m_Tlast_ref != Tnow) { m_spthermo->update(Tnow, &m_cp0_R[0], &m_h0_RT[0], &m_s0_R[0]); m_Tlast_ref = Tnow; // update the species Gibbs functions for (size_t k = 0; k < m_kk; k++) { m_g0_RT[k] = m_h0_RT[k] - m_s0_R[k]; } doublereal pref = refPressure(); if (pref <= 0.0) { throw CanteraError("MixtureFugacityTP::_updateReferenceStateThermo()", "neg ref pressure"); } m_logc0 = log(pref/(GasConstant * Tnow)); } }
void StoichSubstance::initThermo() { ThermoPhase::initThermo(); if (m_kk > 1) { throw CanteraError("initThermo", "stoichiometric substances may only contain one species."); } doublereal tmin = m_spthermo->minTemp(); doublereal tmax = m_spthermo->maxTemp(); m_p0 = refPressure(); m_h0_RT.resize(m_kk); m_cp0_R.resize(m_kk); m_s0_R.resize(m_kk); // Put the object on a valid temperature point. double tnow = 300.; if (tnow > tmin && tnow < tmax) { } else { tnow = 0.1 * (9 * tmin + tmax); } setState_TP(tnow, m_p0); }