[Thermo] Always use PDSS_ConstVol for constant volume standard state
Remove the redundant (and questionable) implementation of this from the PDSS_SSVol class. Also fix some values in PDSS_SSVol that were not updated except in the constant volume case.
This commit is contained in:
parent
4c630fc592
commit
822cdc7d38
4 changed files with 14 additions and 59 deletions
|
|
@ -67,14 +67,13 @@ namespace Cantera
|
|||
* pressure dependencies to the thermo functions.
|
||||
*
|
||||
* - PDSS_ConstVol
|
||||
* - standardState model = "ConstVol"
|
||||
* - standardState model = "ConstVol" or "constant_incompressible"
|
||||
* - This model assumes that the species in the phase obeys the constant
|
||||
* partial molar volume pressure dependence. The manager uses a
|
||||
* SimpleThermo object to handle the calculation of the reference state.
|
||||
* This object adds the pressure dependencies to these thermo functions.
|
||||
*
|
||||
* - PDSS_SSVol
|
||||
* - standardState model = "constant_incompressible" || model == "constant"
|
||||
* - standardState model = "temperature_polynomial"
|
||||
* - standardState model = "density_temperature_polynomial"
|
||||
* - This model assumes that the species in the phase obey a fairly general
|
||||
|
|
|
|||
|
|
@ -42,13 +42,6 @@ namespace Cantera
|
|||
* The class includes the following models for the representation of the
|
||||
* standard state volume:
|
||||
*
|
||||
* - Constant Volume
|
||||
* - This standard state model is invoked with the keyword "constant_incompressible"
|
||||
* or "constant". The standard state volume is considered constant.
|
||||
* \f[
|
||||
* V^o_k(T,P) = a_0
|
||||
* \f]
|
||||
*
|
||||
* - Temperature polynomial for the standard state volume
|
||||
* - This standard state model is invoked with the keyword "temperature_polynomial".
|
||||
* The standard state volume is considered a function of temperature only.
|
||||
|
|
@ -111,29 +104,6 @@ namespace Cantera
|
|||
* ## XML Example
|
||||
*
|
||||
* An example of the specification of a standard state for the LiCl molten salt
|
||||
* which employs a constant molar volume expression.
|
||||
*
|
||||
* @code
|
||||
* <speciesData id="species_MoltenSalt">
|
||||
* <species name="LiCl(L)">
|
||||
* <atomArray> Li:1 Cl:1 </atomArray>
|
||||
* <standardState model="constant_incompressible">
|
||||
* <molarVolume> 0.02048004 </molarVolume>
|
||||
* </standardState>
|
||||
* <thermo>
|
||||
* <Shomate Pref="1 bar" Tmax="2000.0" Tmin="700.0">
|
||||
* <floatArray size="7">
|
||||
* 73.18025, -9.047232, -0.316390,
|
||||
* 0.079587, 0.013594, -417.1314,
|
||||
* 157.6711
|
||||
* </floatArray>
|
||||
* </Shomate>
|
||||
* </thermo>
|
||||
* </species>
|
||||
* </speciesData>
|
||||
* @endcode
|
||||
*
|
||||
* An example of the specification of a standard state for the LiCl molten salt
|
||||
* which has a temperature dependent standard state volume.
|
||||
*
|
||||
* @code
|
||||
|
|
@ -206,8 +176,6 @@ private:
|
|||
//! Types of general formulations for the specification of the standard
|
||||
//! state volume
|
||||
enum class SSVolume_Model {
|
||||
//! This approximation is for a constant volume
|
||||
constant = 0,
|
||||
//! This approximation is for a species with a quadratic polynomial in
|
||||
//! temperature
|
||||
/*!
|
||||
|
|
@ -226,12 +194,6 @@ private:
|
|||
//! used to calculate the standard state volume of the species
|
||||
SSVolume_Model volumeModel_;
|
||||
|
||||
//! Value of the constant molar volume for the species
|
||||
/*!
|
||||
* m3 / kmol
|
||||
*/
|
||||
doublereal m_constMolarVolume;
|
||||
|
||||
//! coefficients for the temperature representation
|
||||
vector_fp TCoeff_;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,11 +26,10 @@ PDSSFactory::PDSSFactory()
|
|||
m_synonyms["waterPDSS"] = m_synonyms["waterIAPWS"] = "water";
|
||||
reg("ions-from-neutral", []() { return new PDSS_IonsFromNeutral(); });
|
||||
m_synonyms["IonFromNeutral"] = "ions-from-neutral";
|
||||
reg("constant", []() { return new PDSS_SSVol(); });
|
||||
m_synonyms["temperature_polynomial"] = "constant";
|
||||
m_synonyms["temperature-polynomial"] = "constant";
|
||||
m_synonyms["density_temperature_polynomial"] = "constant";
|
||||
m_synonyms["density-temperature-polynomial"] = "constant";
|
||||
reg("temperature_polynomial", []() { return new PDSS_SSVol(); });
|
||||
m_synonyms["temperature-polynomial"] = "temperature_polynomial";
|
||||
m_synonyms["density_temperature_polynomial"] = "temperature_polynomial";
|
||||
m_synonyms["density-temperature-polynomial"] = "temperature_polynomial";
|
||||
reg("HKFT", []() { return new PDSS_HKFT(); });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@ namespace Cantera
|
|||
{
|
||||
|
||||
PDSS_SSVol::PDSS_SSVol()
|
||||
: volumeModel_(SSVolume_Model::constant)
|
||||
, m_constMolarVolume(-1.0)
|
||||
: volumeModel_(SSVolume_Model::tpoly)
|
||||
{
|
||||
TCoeff_[0] = 0.0;
|
||||
TCoeff_[1] = 0.0;
|
||||
|
|
@ -35,10 +34,7 @@ void PDSS_SSVol::setParametersFromXML(const XML_Node& speciesNode)
|
|||
"no standardState Node for species " + speciesNode.name());
|
||||
}
|
||||
std::string model = ss->attrib("model");
|
||||
if (model == "constant_incompressible" || model == "constant") {
|
||||
volumeModel_ = SSVolume_Model::constant;
|
||||
m_constMolarVolume = getFloat(*ss, "molarVolume", "toSI");
|
||||
} else if (model == "temperature_polynomial") {
|
||||
if (model == "temperature_polynomial") {
|
||||
volumeModel_ = SSVolume_Model::tpoly;
|
||||
size_t num = getFloatArray(*ss, TCoeff_, true, "toSI", "volumeTemperaturePolynomial");
|
||||
if (num != 4) {
|
||||
|
|
@ -54,7 +50,8 @@ void PDSS_SSVol::setParametersFromXML(const XML_Node& speciesNode)
|
|||
}
|
||||
} else {
|
||||
throw CanteraError("PDSS_SSVol::constructPDSSXML",
|
||||
"standardState model for species isn't constant_incompressible: " + speciesNode.name());
|
||||
"Unknown standardState model '{}'' for species '{}'",
|
||||
model, speciesNode.name());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -64,8 +61,6 @@ void PDSS_SSVol::initThermo()
|
|||
m_minTemp = m_spthermo->minTemp();
|
||||
m_maxTemp = m_spthermo->maxTemp();
|
||||
m_p0 = m_spthermo->refPressure();
|
||||
m_V0 = m_constMolarVolume;
|
||||
m_Vss = m_constMolarVolume;
|
||||
}
|
||||
|
||||
doublereal PDSS_SSVol::intEnergy_mole() const
|
||||
|
|
@ -81,15 +76,15 @@ doublereal PDSS_SSVol::cv_mole() const
|
|||
|
||||
void PDSS_SSVol::calcMolarVolume()
|
||||
{
|
||||
if (volumeModel_ == SSVolume_Model::constant) {
|
||||
m_Vss = m_constMolarVolume;
|
||||
} else if (volumeModel_ == SSVolume_Model::tpoly) {
|
||||
if (volumeModel_ == SSVolume_Model::tpoly) {
|
||||
m_Vss = TCoeff_[0] + m_temp * (TCoeff_[1] + m_temp * (TCoeff_[2] + m_temp * TCoeff_[3]));
|
||||
m_V0 = m_Vss;
|
||||
dVdT_ = TCoeff_[1] + 2.0 * m_temp * TCoeff_[2] + 3.0 * m_temp * m_temp * TCoeff_[3];
|
||||
d2VdT2_ = 2.0 * TCoeff_[2] + 6.0 * m_temp * TCoeff_[3];
|
||||
} else if (volumeModel_ == SSVolume_Model::density_tpoly) {
|
||||
doublereal dens = TCoeff_[0] + m_temp * (TCoeff_[1] + m_temp * (TCoeff_[2] + m_temp * TCoeff_[3]));
|
||||
m_Vss = m_mw / dens;
|
||||
m_V0 = m_Vss;
|
||||
doublereal dens2 = dens * dens;
|
||||
doublereal ddensdT = TCoeff_[1] + 2.0 * m_temp * TCoeff_[2] + 3.0 * m_temp * m_temp * TCoeff_[3];
|
||||
doublereal d2densdT2 = 2.0 * TCoeff_[2] + 6.0 * m_temp * TCoeff_[3];
|
||||
|
|
@ -149,12 +144,12 @@ void PDSS_SSVol::setState_TP(doublereal temp, doublereal pres)
|
|||
|
||||
void PDSS_SSVol::setState_TR(doublereal temp, doublereal rho)
|
||||
{
|
||||
doublereal rhoStored = m_mw / m_constMolarVolume;
|
||||
setTemperature(temp);
|
||||
doublereal rhoStored = m_mw / m_Vss;
|
||||
if (fabs(rhoStored - rho) / (rhoStored + rho) > 1.0E-4) {
|
||||
throw CanteraError("PDSS_SSVol::setState_TR",
|
||||
"Inconsistent supplied rho");
|
||||
}
|
||||
setTemperature(temp);
|
||||
}
|
||||
|
||||
doublereal PDSS_SSVol::satPressure(doublereal t)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue