[SpeciesThermo] address review comments
This commit is contained in:
parent
650db397b2
commit
ee41824b1e
6 changed files with 35 additions and 39 deletions
|
|
@ -57,11 +57,18 @@ public:
|
|||
* @param thigh Maximum temperature
|
||||
* @param pref reference pressure (Pa).
|
||||
* @param coeffs Vector of coefficients used to set the parameters for the
|
||||
* standard state.
|
||||
* standard state. The vector has 1 + 11*`nzones` elements
|
||||
* in the following order:
|
||||
* - `coeffs[0]`: Number of zones (`nzones`)
|
||||
* - `coeffs[1 + 11*zone]`: minimum temperature within zone
|
||||
* - `coeffs[2 + 11*zone]`: maximum temperature within zone
|
||||
* - `coeffs[3:11 + 11*zone]`: 9 coefficient parameterization
|
||||
* where `zone` runs from zero to `nzones`-1.
|
||||
*/
|
||||
Nasa9PolyMultiTempRegion(double tlow, double thigh, double pref, const double* coeffs);
|
||||
Nasa9PolyMultiTempRegion(double tlow, double thigh, double pref,
|
||||
const double* coeffs);
|
||||
|
||||
//! Set the array of polynomial coefficients for each temperature region
|
||||
//! Set the array of polynomial coefficients for each temperature region
|
||||
/*!
|
||||
* @param regions Map where each key is the minimum temperature for a
|
||||
* region and each value is the array of 9 polynomial
|
||||
|
|
|
|||
|
|
@ -206,11 +206,11 @@ public:
|
|||
doublereal* h_RT,
|
||||
doublereal* s_R) const;
|
||||
|
||||
//! This utility function reports back the number of coefficients
|
||||
//! This utility function returns the number of coefficients
|
||||
//! for a given type of species parameterization
|
||||
virtual size_t nCoeffs() const;
|
||||
|
||||
//! This utility function reports back the type of parameterization and all
|
||||
//! This utility function returns the type of parameterization and all
|
||||
//! of the parameters for the species.
|
||||
/*!
|
||||
* All parameters are output variables
|
||||
|
|
|
|||
|
|
@ -80,6 +80,10 @@ cdef class SpeciesThermo:
|
|||
return data
|
||||
|
||||
def _check_n_coeffs(self, n):
|
||||
"""
|
||||
Check whether number of coefficients is compatible with a given
|
||||
parameterization prior to instantiation of the underlying C++ object.
|
||||
"""
|
||||
raise NotImplementedError('Needs to be overloaded')
|
||||
|
||||
def cp(self, T):
|
||||
|
|
@ -177,17 +181,14 @@ cdef class Nasa9PolyMultiTempRegion(SpeciesThermo):
|
|||
This is a wrapper for the C++ class :ct:`Nasa9PolyMultiTempRegion`.
|
||||
|
||||
:param coeffs:
|
||||
An array of 1 + 11*nzones elements, in the following order:
|
||||
An array of 1 + 11*`nzones` elements, in the following order:
|
||||
|
||||
- `coeffs[0]`: Number of zones (nzones)
|
||||
- within each zone
|
||||
- `coeffs[zone][0]`: minimum temperature
|
||||
- `coeffs[zone][1]`: maximum temperature
|
||||
- `coeffs[zone][2:10]`: The 9 coefficients of the parameterization
|
||||
- `coeffs[0]`: Number of zones (`nzones`)
|
||||
- `coeffs[1 + 11*zone]`: minimum temperature within zone
|
||||
- `coeffs[2 + 11*zone]`: maximum temperature within zone
|
||||
- `coeffs[3:11 + 11*zone]`: 9 coefficients of the parameterization
|
||||
|
||||
These coefficients should be provided in their customary units (i.e.
|
||||
such that :math:`c_p^o` is in J/gmol-K and :math:`H^o` is in kJ/gmol,
|
||||
as in the NIST Chemistry WebBook).
|
||||
where `zone` runs from zero to `nzones`-1.
|
||||
"""
|
||||
derived_type = SPECIES_THERMO_NASA9MULTITEMP
|
||||
|
||||
|
|
|
|||
|
|
@ -1236,7 +1236,8 @@ class TestSpeciesThermo(utilities.CanteraTest):
|
|||
self.assertNear(st.s(T), st2.s(T))
|
||||
|
||||
def test_piecewise_gibbs_load(self):
|
||||
sol = ct.Solution('thermo-models.yaml', 'HMW-NaCl-electrolyte')
|
||||
# @todo: replace by ct.Solution once issue #595 is resolved
|
||||
sol = ct.ThermoPhase('thermo-models.yaml', 'HMW-NaCl-electrolyte')
|
||||
st = sol.species(1).thermo
|
||||
self.assertIsInstance(st, ct.Mu0Poly)
|
||||
self.assertEqual(st.n_coeffs, len(st.coeffs))
|
||||
|
|
@ -1257,7 +1258,8 @@ class TestSpeciesThermo(utilities.CanteraTest):
|
|||
self.assertEqual(st2.n_coeffs, len(st2.coeffs))
|
||||
|
||||
def test_piecewise_gibbs_create2(self):
|
||||
sol = ct.Solution('thermo-models.yaml', 'HMW-NaCl-electrolyte')
|
||||
# @todo: replace by ct.Solution once issue #595 is resolved
|
||||
sol = ct.ThermoPhase('thermo-models.yaml', 'HMW-NaCl-electrolyte')
|
||||
st = sol.species(1).thermo
|
||||
t_min = st.min_temp
|
||||
t_max = st.max_temp
|
||||
|
|
|
|||
|
|
@ -59,26 +59,17 @@ Nasa9PolyMultiTempRegion::Nasa9PolyMultiTempRegion(vector<Nasa9Poly1*>& regionPt
|
|||
|
||||
Nasa9PolyMultiTempRegion::Nasa9PolyMultiTempRegion(double tlow, double thigh, double pref,
|
||||
const double* coeffs)
|
||||
: SpeciesThermoInterpType(tlow, thigh, pref)
|
||||
{
|
||||
size_t regions = (size_t)coeffs[0];
|
||||
size_t regions = static_cast<size_t>(coeffs[0]);
|
||||
|
||||
for (size_t i=0; i<regions; i++) {
|
||||
Nasa9Poly1* poly = new Nasa9Poly1;
|
||||
vector_fp cs;
|
||||
poly->setRefPressure(pref);
|
||||
poly->setMinTemp(coeffs[11*i+1]);
|
||||
poly->setMaxTemp(coeffs[11*i+2]);
|
||||
for (size_t j=11*i+3; j<=11*(i+1); j++) {
|
||||
cs.push_back(coeffs[j]);
|
||||
}
|
||||
poly->setParameters(cs);
|
||||
Nasa9Poly1* poly = new Nasa9Poly1(coeffs[11*i+1], coeffs[11*i+2],
|
||||
pref, coeffs + 11*i + 3);
|
||||
m_regionPts.emplace_back(poly);
|
||||
}
|
||||
|
||||
m_lowerTempBounds.resize(regions);
|
||||
m_lowT = tlow;
|
||||
m_highT = thigh;
|
||||
m_Pref = pref;
|
||||
for (size_t i = 0; i < m_regionPts.size(); i++) {
|
||||
m_lowerTempBounds[i] = m_regionPts[i]->minTemp();
|
||||
if (i > 0) {
|
||||
|
|
|
|||
|
|
@ -37,35 +37,30 @@ void SpeciesThermoInterpType::updateProperties(const doublereal* tempPoly,
|
|||
void SpeciesThermoInterpType::updatePropertiesTemp(const double temp,
|
||||
double* cp_R, double* h_RT, double* s_R) const
|
||||
{
|
||||
throw CanteraError("SpeciesThermoInterpType::updatePropertiesTemp",
|
||||
"Not implemented");
|
||||
throw NotImplementedError("SpeciesThermoInterpType::updatePropertiesTemp");
|
||||
}
|
||||
|
||||
size_t SpeciesThermoInterpType::nCoeffs() const
|
||||
{
|
||||
throw CanteraError("SpeciesThermoInterpType::nCoeffs",
|
||||
"Not implemented");
|
||||
throw NotImplementedError("SpeciesThermoInterpType::nCoeffs");
|
||||
}
|
||||
|
||||
void SpeciesThermoInterpType::reportParameters(size_t& index, int& type,
|
||||
double& minTemp, double& maxTemp, double& refPressure,
|
||||
double* const coeffs) const
|
||||
{
|
||||
throw CanteraError("SpeciesThermoInterpType::reportParameters",
|
||||
"Not implemented");
|
||||
throw NotImplementedError("SpeciesThermoInterpType::reportParameters");
|
||||
}
|
||||
|
||||
doublereal SpeciesThermoInterpType::reportHf298(doublereal* const h298) const
|
||||
{
|
||||
throw CanteraError("SpeciesThermoInterpType::reportHf298",
|
||||
"Not implemented");
|
||||
throw NotImplementedError("SpeciesThermoInterpType::reportHf298");
|
||||
}
|
||||
|
||||
void SpeciesThermoInterpType::modifyOneHf298(const size_t k,
|
||||
const doublereal Hf298New)
|
||||
{
|
||||
throw CanteraError("SpeciesThermoInterpType::modifyOneHf298",
|
||||
"Not implemented");
|
||||
throw NotImplementedError("SpeciesThermoInterpType::modifyOneHf298");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue