Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Co-Authored-By: Bryan Weber <bryan.w.weber@gmail.com>
Co-Authored-By: Ray Speth <speth@mit.edu>
  • Loading branch information
3 people committed Jul 12, 2022
1 parent 5a50238 commit 89f2c7c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/cantera/kinetics/Arrhenius.h
Expand Up @@ -170,7 +170,7 @@ class ArrheniusBase : public ReactionRate
std::string m_b_str = "b"; //!< The string for temperature exponent
std::string m_Ea_str = "Ea"; //!< The string for activation energy
std::string m_E4_str = ""; //!< The string for an optional 4th parameter
Units m_rate_units {0.}; //!< Reaction rate units
Units m_rate_units{0.}; //!< Reaction rate units
};

//! Arrhenius reaction rate type depends only on temperature
Expand Down
6 changes: 4 additions & 2 deletions interfaces/cython/cantera/test/test_kinetics.py
Expand Up @@ -485,9 +485,11 @@ def check_raises(yaml, err_msg, line):
err_msg = [err_msg]
err_msg.append("InputFileError thrown by ")
err_msg.append(f"Error on line {line} of ")
with pytest.raises(ct.CanteraError) as ex:
ct.Solution(yaml=yaml)
msg = str(ex.value)
for err in err_msg:
with pytest.raises(ct.CanteraError, match=err):
ct.Solution(yaml=yaml)
assert err in msg


class TestUndeclared(utilities.CanteraTest):
Expand Down
4 changes: 2 additions & 2 deletions src/kinetics/ChebyshevRate.cpp
Expand Up @@ -84,7 +84,7 @@ void ChebyshevRate::setParameters(const AnyMap& node, const UnitStack& rate_unit
unit_system.convert(P_range[1], "Pa")
);
} else {
setLimits(290., 3000., 1.e-7, 1.e14);
setLimits(290., 3000., Tiny, 1. / Tiny);
}
setData(coeffs);
}
Expand All @@ -109,7 +109,7 @@ void ChebyshevRate::setLimits(double Tmin, double Tmax, double Pmin, double Pmax

void ChebyshevRate::setData(const Array2D& coeffs)
{
m_valid = coeffs.data().size();
m_valid = !coeffs.data().empty();
if (m_valid) {
m_coeffs = coeffs;
} else {
Expand Down
8 changes: 3 additions & 5 deletions src/kinetics/PlogRate.cpp
Expand Up @@ -100,7 +100,7 @@ void PlogRate::setRates(const std::multimap<double, ArrheniusRate>& rates)
size_t j = 0;
rates_.clear();
pressures_.clear();
m_valid = rates.size();
m_valid = !rates.empty();
rates_.reserve(rates.size());
// Insert intermediate pressures
for (const auto& rate : rates) {
Expand All @@ -118,10 +118,8 @@ void PlogRate::setRates(const std::multimap<double, ArrheniusRate>& rates)
}
if (!m_valid) {
// ensure that reaction rate can be evaluated (but returns NaN)
rates_.reserve(2);
pressures_[std::log(1.e-7)] = {0, 1};
rates_.push_back(ArrheniusRate());
pressures_[std::log(1.e14)] = {1, 2};
rates_.reserve(1);
pressures_[std::log(OneBar)] = {0, 0};
rates_.push_back(ArrheniusRate());
}

Expand Down

0 comments on commit 89f2c7c

Please sign in to comment.