mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[Thermo] Allow species without thermo data
In some models, SpeciesThermoInterpType objects on individual species are not used. Instead of requiring the specification of placeholder thermo data, this allows the base SpeciesThermoInterpType class to be used, which will throw an exception if it is inadvertently used.
This commit is contained in:
@@ -151,7 +151,7 @@ public:
|
||||
virtual void validate(const std::string& name) {}
|
||||
|
||||
//! Returns an integer representing the type of parameterization
|
||||
virtual int reportType() const = 0;
|
||||
virtual int reportType() const { return 0; };
|
||||
|
||||
//! Number of terms in the temperature polynomial for this parameterization
|
||||
virtual size_t temperaturePolySize() const { return 1; }
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
virtual void updatePropertiesTemp(const doublereal temp,
|
||||
doublereal* cp_R,
|
||||
doublereal* h_RT,
|
||||
doublereal* s_R) const = 0;
|
||||
doublereal* s_R) const;
|
||||
|
||||
//! This utility function reports back the type of parameterization and all
|
||||
//! of the parameters for the species.
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
virtual void reportParameters(size_t& index, int& type,
|
||||
doublereal& minTemp, doublereal& maxTemp,
|
||||
doublereal& refPressure,
|
||||
doublereal* const coeffs) const = 0;
|
||||
doublereal* const coeffs) const;
|
||||
|
||||
//! Report the 298 K Heat of Formation of the standard state of one species
|
||||
//! (J kmol-1)
|
||||
|
||||
@@ -43,7 +43,11 @@ shared_ptr<Species> newSpecies(const XML_Node& species_node)
|
||||
if (species_node.hasChild("size")) {
|
||||
s->size = getFloat(species_node, "size");
|
||||
}
|
||||
s->thermo.reset(newSpeciesThermoInterpType(species_node.child("thermo")));
|
||||
if (species_node.hasChild("thermo")) {
|
||||
s->thermo.reset(newSpeciesThermoInterpType(species_node.child("thermo")));
|
||||
} else {
|
||||
s->thermo.reset(new SpeciesThermoInterpType());
|
||||
}
|
||||
|
||||
// Read transport data, if provided
|
||||
if (species_node.hasChild("transport")) {
|
||||
|
||||
@@ -34,6 +34,21 @@ void SpeciesThermoInterpType::updateProperties(const doublereal* tempPoly,
|
||||
updatePropertiesTemp(T, cp_R, h_RT, s_R);
|
||||
}
|
||||
|
||||
void SpeciesThermoInterpType::updatePropertiesTemp(const double temp,
|
||||
double* cp_R, double* h_RT, double* s_R) const
|
||||
{
|
||||
throw CanteraError("SpeciesThermoInterpType::updatePropertiesTemp",
|
||||
"Not implemented");
|
||||
}
|
||||
|
||||
void SpeciesThermoInterpType::reportParameters(size_t& index, int& type,
|
||||
double& minTemp, double& maxTemp, double& refPressure,
|
||||
double* const coeffs) const
|
||||
{
|
||||
throw CanteraError("SpeciesThermoInterpType::reportParameters",
|
||||
"Not implemented");
|
||||
}
|
||||
|
||||
doublereal SpeciesThermoInterpType::reportHf298(doublereal* const h298) const
|
||||
{
|
||||
throw CanteraError("SpeciesThermoInterpType::reportHf298",
|
||||
|
||||
@@ -16,34 +16,11 @@
|
||||
<kinetics model="none"/>
|
||||
</phase>
|
||||
|
||||
<phase dim="3" id="mismatch">
|
||||
<elementArray datasrc="elements.xml">
|
||||
Li
|
||||
</elementArray>
|
||||
<speciesArray datasrc="#species_Li(Fixed)">
|
||||
LiFixed
|
||||
</speciesArray>
|
||||
<thermo model="StoichSubstance">
|
||||
<chemicalPotential units="J/kmol"> -2.3E7 </chemicalPotential>
|
||||
</thermo>
|
||||
<transport model="None"/>
|
||||
<kinetics model="none"/>
|
||||
</phase>
|
||||
|
||||
<!-- species definitions -->
|
||||
<speciesData id="species_Li(Fixed)">
|
||||
|
||||
<species name="LiFixed">
|
||||
<atomArray> Li:1 </atomArray>
|
||||
<thermo>
|
||||
<Shomate Pref="1 bar" Tmax="1075.0" Tmin="250.0">
|
||||
<floatArray size="7">
|
||||
50.72389, 6.672267, -2.517167,
|
||||
10.15934, -0.200675, -427.2115,
|
||||
130.3973
|
||||
</floatArray>
|
||||
</Shomate>
|
||||
</thermo>
|
||||
</species>
|
||||
</speciesData>
|
||||
</ctml>
|
||||
|
||||
@@ -23,18 +23,6 @@
|
||||
<!-- species H2O -->
|
||||
<species name="H2O">
|
||||
<atomArray>H:2 O:1 </atomArray>
|
||||
<thermo>
|
||||
<NASA Tmax="1000.0" Tmin="273.16000000000003" P0="100000.0">
|
||||
<floatArray name="coeffs" size="7">
|
||||
4.198640560E+00, -2.036434100E-03, 6.520402110E-06, -5.487970620E-09,
|
||||
1.771978170E-12, -3.029372670E+04, -8.490322080E-01</floatArray>
|
||||
</NASA>
|
||||
<NASA Tmax="1600.0" Tmin="1000.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="7">
|
||||
3.033992490E+00, 2.176918040E-03, -1.640725180E-07, -9.704198700E-11,
|
||||
1.682009920E-14, -3.000429710E+04, 4.966770100E+00</floatArray>
|
||||
</NASA>
|
||||
</thermo>
|
||||
</species>
|
||||
</speciesData>
|
||||
</ctml>
|
||||
|
||||
Reference in New Issue
Block a user