Skip to content

Commit

Permalink
[Kinetics] Deprecate single-parameter ReactionRate::validate
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed May 29, 2022
1 parent cc11bcc commit d9c4246
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
5 changes: 2 additions & 3 deletions include/cantera/kinetics/PlogRate.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,9 @@ class PlogRate final : public ReactionRate
//! temperatures at each interpolation pressure. This is potentially an
//! issue when one of the Arrhenius expressions at a particular pressure
//! has a negative pre-exponential factor.
void validate(const std::string& equation, const Kinetics& kin) {
validate(equation);
}
void validate(const std::string& equation, const Kinetics& kin);

//! @deprecated To be removed after Cantera 3.0; superseded by setFalloffCoeffs()
void validate(const std::string& equation);

//! Return the pressures and Arrhenius expressions which comprise this
Expand Down
9 changes: 7 additions & 2 deletions include/cantera/kinetics/ReactionRate.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "MultiRateBase.h"
#include "cantera/base/AnyMap.h"
#include "cantera/base/Units.h"
#include "cantera/base/global.h"
#include "cantera/base/ctexceptions.h"

namespace Cantera
Expand Down Expand Up @@ -105,8 +106,12 @@ class ReactionRate
virtual void validate(const std::string& equation, const Kinetics& kin) {}

//! Validate the reaction rate expression (legacy call)
//! @todo deprecate in favor of two-parameter version
virtual void validate(const std::string& equation) {}
//! @deprecated To be removed after Cantera 3.0.
//! Superseded by two-parameter version
virtual void validate(const std::string& equation) {
warn_deprecated("ReactionRate::validate",
"To be removed after Cantera 3.0; superseded by two-parameter version.");
}

//! Reaction rate index within kinetics evaluator
size_t rateIndex() const {
Expand Down
11 changes: 10 additions & 1 deletion src/kinetics/PlogRate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#include "cantera/kinetics/PlogRate.h"
#include "cantera/thermo/ThermoPhase.h"

//! @todo remove after Cantera 3.0 (only used for deprecation)
#include "cantera/kinetics/Kinetics.h"

namespace Cantera
{

Expand Down Expand Up @@ -123,7 +126,7 @@ void PlogRate::setRates(const std::multimap<double, ArrheniusRate>& rates)
pressures_.insert({1000.0, pressures_.rbegin()->second});
}

void PlogRate::validate(const std::string& equation)
void PlogRate::validate(const std::string& equation, const Kinetics& kin)
{
fmt::memory_buffer err_reactions;
double T[] = {200.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0};
Expand All @@ -150,6 +153,12 @@ void PlogRate::validate(const std::string& equation)
}
}

void PlogRate::validate(const std::string& equation) {
warn_deprecated("PlogRate::validate",
"To be removed after Cantera 3.0; superseded by two-parameter version.");
validate(equation, Kinetics());
}

std::multimap<double, ArrheniusRate> PlogRate::getRates() const
{
std::multimap<double, ArrheniusRate> rateMap;
Expand Down
1 change: 0 additions & 1 deletion src/kinetics/Reaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ void Reaction::validate()

// Call validation of reaction rate evaluator
m_rate->check(equation(), input);
m_rate->validate(equation());
}

AnyMap Reaction::parameters(bool withInput) const
Expand Down

0 comments on commit d9c4246

Please sign in to comment.