Skip to content

Commit

Permalink
[Kinetics] Remove legacy Reaction objects
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl authored and bryanwweber committed May 28, 2022
1 parent 31a98d0 commit 2b6d882
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 998 deletions.
2 changes: 0 additions & 2 deletions include/cantera/kinetics/Arrhenius.h
Expand Up @@ -183,8 +183,6 @@ class ArrheniusBase : public ReactionRate
* \f]
*
* @ingroup arrheniusGroup
*
* @todo supersedes Arrhenius2 and will replace Arrhenius after Cantera 2.6.
*/
class ArrheniusRate : public ArrheniusBase
{
Expand Down
9 changes: 0 additions & 9 deletions include/cantera/kinetics/Kinetics.h
Expand Up @@ -1264,15 +1264,6 @@ class Kinetics
double checkDuplicateStoich(std::map<int, double>& r1,
std::map<int, double>& r2) const;

//! Check that the specified reaction is balanced (same number of atoms for
//! each element in the reactants and products). Raises an exception if the
//! reaction is not balanced.
/*!
* @deprecated To be removed in Cantera 2.6.
* Replaceable by Reaction::checkBalance.
*/
void checkReactionBalance(const Reaction& R);

//! @name Stoichiometry management
//!
//! These objects and functions handle turning reaction extents into species
Expand Down
263 changes: 1 addition & 262 deletions include/cantera/kinetics/Reaction.h
Expand Up @@ -60,12 +60,7 @@ class Reaction
//! Calculate the units of the rate constant. These are determined by the units
//! of the standard concentration of the reactant species' phases and the phase
//! where the reaction occurs. Sets the value of #rate_units.
virtual void calculateRateCoeffUnits(const Kinetics& kin);

//! Calculate the units of the rate constant. These are determined by the units
//! of the standard concentration of the reactant species' phases and the phase
//! where the reaction occurs. Sets the value of #rate_units.
UnitStack calculateRateCoeffUnits3(const Kinetics& kin);
UnitStack calculateRateCoeffUnits(const Kinetics& kin);

//! Ensure that the rate constant and other parameters for this reaction are
//! valid.
Expand Down Expand Up @@ -205,28 +200,6 @@ class Reaction
};


//! A reaction which follows mass-action kinetics with a modified Arrhenius
//! reaction rate.
class ElementaryReaction2 : public Reaction
{
public:
ElementaryReaction2();
ElementaryReaction2(const Composition& reactants, const Composition products,
const Arrhenius2& rate);

virtual void validate();
using Reaction::validate;
virtual void getParameters(AnyMap& reactionNode) const;

virtual std::string type() const {
return "elementary-legacy";
}

Arrhenius2 rate;
bool allow_negative_pre_exponential_factor;
};


//! A class for managing third-body efficiencies, including default values
class ThirdBody
{
Expand Down Expand Up @@ -257,212 +230,6 @@ class ThirdBody
};


//! A reaction with a non-reacting third body "M" that acts to add or remove
//! energy from the reacting species
class ThreeBodyReaction2 : public ElementaryReaction2
{
public:
ThreeBodyReaction2();
ThreeBodyReaction2(const Composition& reactants, const Composition& products,
const Arrhenius2& rate, const ThirdBody& tbody);

virtual std::string type() const {
return "three-body-legacy";
}

virtual std::string reactantString() const;
virtual std::string productString() const;
virtual void calculateRateCoeffUnits(const Kinetics& kin);
virtual void getParameters(AnyMap& reactionNode) const;

//! Relative efficiencies of third-body species in enhancing the reaction
//! rate.
ThirdBody third_body;

protected:
virtual std::pair<std::vector<std::string>, bool>
undeclaredThirdBodies(const Kinetics& kin) const;
};


//! A reaction that is first-order in [M] at low pressure, like a third-body
//! reaction, but zeroth-order in [M] as pressure increases.
class FalloffReaction2 : public Reaction
{
public:
FalloffReaction2();
FalloffReaction2(const Composition& reactants, const Composition& products,
const Arrhenius2& low_rate, const Arrhenius2& high_rate,
const ThirdBody& tbody);

virtual std::string type() const {
return "falloff-legacy";
}

virtual std::string reactantString() const;
virtual std::string productString() const;

virtual void validate();
using Reaction::validate;
virtual void calculateRateCoeffUnits(const Kinetics& kin);
virtual void getParameters(AnyMap& reactionNode) const;

//! The rate constant in the low-pressure limit
Arrhenius2 low_rate;

//! The rate constant in the high-pressure limit
Arrhenius2 high_rate;

//! Relative efficiencies of third-body species in enhancing the reaction rate
ThirdBody third_body;

//! Falloff function which determines how low_rate and high_rate are
//! combined to determine the rate constant for the reaction.
shared_ptr<FalloffRate> falloff;

bool allow_negative_pre_exponential_factor;

//! The units of the low-pressure rate constant. The units of the
//! high-pressure rate constant are stored in #rate_units.
Units low_rate_units;

protected:
virtual std::pair<std::vector<std::string>, bool> undeclaredThirdBodies(
const Kinetics& kin) const;
};


//! A reaction where the rate decreases as pressure increases due to collisional
//! stabilization of a reaction intermediate. Like a FalloffReaction2, except
//! that the forward rate constant is written as being proportional to the low-
//! pressure rate constant.
class ChemicallyActivatedReaction2 : public FalloffReaction2
{
public:
ChemicallyActivatedReaction2();
ChemicallyActivatedReaction2(const Composition& reactants,
const Composition& products, const Arrhenius2& low_rate,
const Arrhenius2& high_rate, const ThirdBody& tbody);

virtual std::string type() const {
return "chemically-activated-legacy";
}

virtual void calculateRateCoeffUnits(const Kinetics& kin);
virtual void getParameters(AnyMap& reactionNode) const;
};


//! A pressure-dependent reaction parameterized by logarithmically interpolating
//! between Arrhenius rate expressions at various pressures.
class PlogReaction2 : public Reaction
{
public:
PlogReaction2();
PlogReaction2(const Composition& reactants, const Composition& products,
const Plog& rate);

virtual std::string type() const {
return "pressure-dependent-Arrhenius-legacy";
}

virtual void validate();
using Reaction::validate;
virtual void getParameters(AnyMap& reactionNode) const;

Plog rate;
};


//! A pressure-dependent reaction parameterized by a bi-variate Chebyshev
//! polynomial in temperature and pressure
class ChebyshevReaction2 : public Reaction
{
public:
ChebyshevReaction2();
ChebyshevReaction2(const Composition& reactants, const Composition& products,
const ChebyshevRate& rate);
virtual void getParameters(AnyMap& reactionNode) const;

virtual std::string type() const {
return "Chebyshev-legacy";
}

ChebyshevRate rate;
};


//! Modifications to an InterfaceReaction2 rate based on a surface species
//! coverage.
struct CoverageDependency
{
//! Constructor
//! @param a_ coefficient for exponential dependence on coverage [dimensionless]
//! @param E_ modification to the activation energy [K]
//! @param m_ exponent for power law dependence on coverage [dimensionless]
CoverageDependency(double a_, double E_, double m_) : a(a_), E(E_), m(m_) {}
CoverageDependency() {}
double a; //!< coefficient for exponential dependence on coverage [dimensionless]
double E; //!< modification to the activation energy [K]
double m; //!< exponent for power law dependence on coverage [dimensionless]
};


//! A reaction occurring on an interface (for example, a SurfPhase or an EdgePhase)
class InterfaceReaction2 : public ElementaryReaction2
{
public:
InterfaceReaction2();
InterfaceReaction2(const Composition& reactants, const Composition& products,
const Arrhenius2& rate, bool isStick=false);
virtual void calculateRateCoeffUnits(const Kinetics& kin);
virtual void getParameters(AnyMap& reactionNode) const;

virtual void validate(Kinetics& kin);
using Reaction::validate;

virtual std::string type() const {
return "interface-legacy";
}

//! Adjustments to the Arrhenius rate expression dependent on surface
//! species coverages. Three coverage parameters (a, E, m) are used for each
//! species on which the rate depends. See SurfaceArrhenius for details on
//! the parameterization.
std::map<std::string, CoverageDependency> coverage_deps;

//! Set to true if `rate` is a parameterization of the sticking coefficient
//! rather than the forward rate constant
bool is_sticking_coefficient;

//! Set to true if `rate` is a sticking coefficient which should be
//! translated into a rate coefficient using the correction factor developed
//! by Motz & Wise for reactions with high (near-unity) sticking
//! coefficients. Defaults to 'false'.
bool use_motz_wise_correction;

//! For reactions with multiple non-surface species, the sticking species
//! needs to be explicitly identified.
std::string sticking_species;
};


//! An interface reaction which involves charged species
class ElectrochemicalReaction2 : public InterfaceReaction2
{
public:
ElectrochemicalReaction2();
ElectrochemicalReaction2(const Composition& reactants,
const Composition& products, const Arrhenius2& rate);
virtual void getParameters(AnyMap& reactionNode) const;

//! Forward value of the apparent Electrochemical transfer coefficient
doublereal beta;

bool exchange_current_density_formulation;
};


//! A reaction with a non-reacting third body "M" that acts to add or remove
//! energy from the reacting species
class ThreeBodyReaction : public Reaction
Expand Down Expand Up @@ -560,33 +327,5 @@ std::vector<shared_ptr<Reaction>> getReactions(const AnyValue& items,
void parseReactionEquation(Reaction& R, const std::string& equation,
const AnyBase& reactionNode, const Kinetics* kin);

// declarations of setup functions

//! @internal May be changed without notice in future versions
void setupElementaryReaction(ElementaryReaction2&, const AnyMap&,
const Kinetics&);

//! @deprecated Cantera 2.6 (replaced by setParameters)
void setupThreeBodyReaction(ThreeBodyReaction2&, const AnyMap&,
const Kinetics&);

//! @deprecated Cantera 2.6 (replaced by setParameters)
void setupFalloffReaction(FalloffReaction2&, const AnyMap&,
const Kinetics&);

//! @deprecated Cantera 2.6 (replaced by setParameters)
void setupPlogReaction(PlogReaction2&, const AnyMap&, const Kinetics&);

//! @deprecated Cantera 2.6 (replaced by setParameters)
void setupChebyshevReaction(ChebyshevReaction2&, const AnyMap&,
const Kinetics&);

//! @internal May be changed without notice in future versions
void setupInterfaceReaction(InterfaceReaction2&, const AnyMap&,
const Kinetics&);

//! @internal May be changed without notice in future versions
void setupElectrochemicalReaction(ElectrochemicalReaction2&,
const AnyMap&, const Kinetics&);
}
#endif
7 changes: 0 additions & 7 deletions src/kinetics/Kinetics.cpp
Expand Up @@ -253,13 +253,6 @@ double Kinetics::checkDuplicateStoich(std::map<int, double>& r1,
return ratio;
}

void Kinetics::checkReactionBalance(const Reaction& R)
{
R.checkBalance(*this);
warn_deprecated("Kinetics::checkReactionBalance",
"To be removed after Cantera 2.6. Replacable by Reaction::checkBalance.");
}

void Kinetics::selectPhase(const double* data, const ThermoPhase* phase,
double* phase_data)
{
Expand Down

0 comments on commit 2b6d882

Please sign in to comment.