[Kinetics] Use the name 'ThreeBodyReaction' consistently
This commit is contained in:
parent
946b7abfc5
commit
ba9c9c768f
10 changed files with 33 additions and 33 deletions
|
|
@ -17,7 +17,7 @@ rate expression, indepenent of a specific `Kinetics` object.
|
|||
.. autoclass:: ElementaryReaction(reactants='', products='')
|
||||
:no-undoc-members:
|
||||
|
||||
.. autoclass:: ThirdBodyReaction(reactants='', products='')
|
||||
.. autoclass:: ThreeBodyReaction(reactants='', products='')
|
||||
:no-undoc-members:
|
||||
|
||||
.. autoclass:: FalloffReaction(reactants='', products='')
|
||||
|
|
|
|||
|
|
@ -113,12 +113,12 @@ protected:
|
|||
void addPlogReaction(ReactionData& r);
|
||||
void addChebyshevReaction(ReactionData& r);
|
||||
|
||||
void addThreeBodyReaction(ThirdBodyReaction& r);
|
||||
void addThreeBodyReaction(ThreeBodyReaction& r);
|
||||
void addFalloffReaction(FalloffReaction& r);
|
||||
void addPlogReaction(PlogReaction& r);
|
||||
void addChebyshevReaction(ChebyshevReaction& r);
|
||||
|
||||
void modifyThreeBodyReaction(size_t i, ThirdBodyReaction& r);
|
||||
void modifyThreeBodyReaction(size_t i, ThreeBodyReaction& r);
|
||||
void modifyFalloffReaction(size_t i, FalloffReaction& r);
|
||||
void modifyPlogReaction(size_t i, PlogReaction& r);
|
||||
void modifyChebyshevReaction(size_t i, ChebyshevReaction& r);
|
||||
|
|
|
|||
|
|
@ -107,11 +107,11 @@ public:
|
|||
|
||||
//! A reaction with a non-reacting third body "M" that acts to add or remove
|
||||
//! energy from the reacting species
|
||||
class ThirdBodyReaction : public ElementaryReaction
|
||||
class ThreeBodyReaction : public ElementaryReaction
|
||||
{
|
||||
public:
|
||||
ThirdBodyReaction();
|
||||
ThirdBodyReaction(const Composition& reactants, const Composition& products,
|
||||
ThreeBodyReaction();
|
||||
ThreeBodyReaction(const Composition& reactants, const Composition& products,
|
||||
const Arrhenius& rate, const ThirdBody& tbody);
|
||||
virtual std::string reactantString() const;
|
||||
virtual std::string productString() const;
|
||||
|
|
|
|||
|
|
@ -264,8 +264,8 @@ cdef extern from "cantera/kinetics/Reaction.h" namespace "Cantera":
|
|||
Composition efficiencies
|
||||
double default_efficiency
|
||||
|
||||
cdef cppclass CxxThirdBodyReaction "Cantera::ThirdBodyReaction" (CxxElementaryReaction):
|
||||
CxxThirdBodyReaction()
|
||||
cdef cppclass CxxThreeBodyReaction "Cantera::ThreeBodyReaction" (CxxElementaryReaction):
|
||||
CxxThreeBodyReaction()
|
||||
CxxThirdBody third_body
|
||||
|
||||
cdef cppclass CxxFalloff "Cantera::Falloff":
|
||||
|
|
|
|||
|
|
@ -310,15 +310,15 @@ cdef class ElementaryReaction(Reaction):
|
|||
r.allow_negative_pre_exponential_factor = allow
|
||||
|
||||
|
||||
cdef class ThirdBodyReaction(ElementaryReaction):
|
||||
cdef class ThreeBodyReaction(ElementaryReaction):
|
||||
"""
|
||||
A reaction with a non-reacting third body "M" that acts to add or remove
|
||||
energy from the reacting species.
|
||||
"""
|
||||
reaction_type = THREE_BODY_RXN
|
||||
|
||||
cdef CxxThirdBodyReaction* tbr(self):
|
||||
return <CxxThirdBodyReaction*>self.reaction
|
||||
cdef CxxThreeBodyReaction* tbr(self):
|
||||
return <CxxThreeBodyReaction*>self.reaction
|
||||
|
||||
property efficiencies:
|
||||
"""
|
||||
|
|
@ -690,7 +690,7 @@ cdef Reaction wrapReaction(shared_ptr[CxxReaction] reaction):
|
|||
if reaction_type == ELEMENTARY_RXN:
|
||||
R = ElementaryReaction(init=False)
|
||||
elif reaction_type == THREE_BODY_RXN:
|
||||
R = ThirdBodyReaction(init=False)
|
||||
R = ThreeBodyReaction(init=False)
|
||||
elif reaction_type == FALLOFF_RXN:
|
||||
R = FalloffReaction(init=False)
|
||||
elif reaction_type == CHEMACT_RXN:
|
||||
|
|
@ -714,7 +714,7 @@ cdef CxxReaction* newReaction(int reaction_type):
|
|||
if reaction_type == ELEMENTARY_RXN:
|
||||
return new CxxElementaryReaction()
|
||||
elif reaction_type == THREE_BODY_RXN:
|
||||
return new CxxThirdBodyReaction()
|
||||
return new CxxThreeBodyReaction()
|
||||
elif reaction_type == FALLOFF_RXN:
|
||||
return new CxxFalloffReaction()
|
||||
elif reaction_type == CHEMACT_RXN:
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ class TestReaction(utilities.CanteraTest):
|
|||
r = ct.Reaction.fromCti('''three_body_reaction('2 O + M <=> O2 + M',
|
||||
[1.200000e+11, -1.0, 0.0], efficiencies='AR:0.83 H2:2.4 H2O:15.4')''')
|
||||
|
||||
self.assertTrue(isinstance(r, ct.ThirdBodyReaction))
|
||||
self.assertTrue(isinstance(r, ct.ThreeBodyReaction))
|
||||
self.assertEqual(r.reactants['O'], 2)
|
||||
self.assertEqual(r.products['O2'], 1)
|
||||
self.assertEqual(r.efficiencies['H2O'], 15.4)
|
||||
|
|
@ -617,7 +617,7 @@ class TestReaction(utilities.CanteraTest):
|
|||
rxn_node = root.find('.//reaction[@id="0001"]')
|
||||
r = ct.Reaction.fromXml(ET.tostring(rxn_node))
|
||||
|
||||
self.assertTrue(isinstance(r, ct.ThirdBodyReaction))
|
||||
self.assertTrue(isinstance(r, ct.ThreeBodyReaction))
|
||||
self.assertEqual(r.reactants['O'], 2)
|
||||
self.assertEqual(r.products['O2'], 1)
|
||||
self.assertEqual(r.efficiencies['H2O'], 15.4)
|
||||
|
|
@ -673,8 +673,8 @@ class TestReaction(utilities.CanteraTest):
|
|||
species=species, reactions=[r])
|
||||
|
||||
|
||||
def test_thirdbody(self):
|
||||
r = ct.ThirdBodyReaction()
|
||||
def test_threebody(self):
|
||||
r = ct.ThreeBodyReaction()
|
||||
r.reactants = {'O':1, 'H':1}
|
||||
r.products = {'OH':1}
|
||||
r.rate = ct.Arrhenius(5e11, -1.0, 0.0)
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ bool GasKinetics::addReaction(shared_ptr<Reaction> r)
|
|||
addElementaryReaction(dynamic_cast<ElementaryReaction&>(*r));
|
||||
break;
|
||||
case THREE_BODY_RXN:
|
||||
addThreeBodyReaction(dynamic_cast<ThirdBodyReaction&>(*r));
|
||||
addThreeBodyReaction(dynamic_cast<ThreeBodyReaction&>(*r));
|
||||
break;
|
||||
case FALLOFF_RXN:
|
||||
case CHEMACT_RXN:
|
||||
|
|
@ -380,7 +380,7 @@ void GasKinetics::addFalloffReaction(FalloffReaction& r)
|
|||
++m_nfall;
|
||||
}
|
||||
|
||||
void GasKinetics::addThreeBodyReaction(ThirdBodyReaction& r)
|
||||
void GasKinetics::addThreeBodyReaction(ThreeBodyReaction& r)
|
||||
{
|
||||
m_rates.install(nReactions()-1, r.rate);
|
||||
map<size_t, double> efficiencies;
|
||||
|
|
@ -420,7 +420,7 @@ void GasKinetics::modifyReaction(size_t i, shared_ptr<Reaction> rNew)
|
|||
modifyElementaryReaction(i, dynamic_cast<ElementaryReaction&>(*rNew));
|
||||
break;
|
||||
case THREE_BODY_RXN:
|
||||
modifyThreeBodyReaction(i, dynamic_cast<ThirdBodyReaction&>(*rNew));
|
||||
modifyThreeBodyReaction(i, dynamic_cast<ThreeBodyReaction&>(*rNew));
|
||||
break;
|
||||
case FALLOFF_RXN:
|
||||
case CHEMACT_RXN:
|
||||
|
|
@ -443,7 +443,7 @@ void GasKinetics::modifyReaction(size_t i, shared_ptr<Reaction> rNew)
|
|||
m_pres += 0.1234;
|
||||
}
|
||||
|
||||
void GasKinetics::modifyThreeBodyReaction(size_t i, ThirdBodyReaction& r)
|
||||
void GasKinetics::modifyThreeBodyReaction(size_t i, ThreeBodyReaction& r)
|
||||
{
|
||||
m_rates.replace(i, r.rate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,8 +225,8 @@ std::pair<size_t, size_t> Kinetics::checkDuplicates(bool throw_err) const
|
|||
continue; // No overlap in third body efficiencies
|
||||
}
|
||||
} else if (R.reaction_type == THREE_BODY_RXN) {
|
||||
ThirdBody& tb1 = dynamic_cast<ThirdBodyReaction&>(R).third_body;
|
||||
ThirdBody& tb2 = dynamic_cast<ThirdBodyReaction&>(other).third_body;
|
||||
ThirdBody& tb1 = dynamic_cast<ThreeBodyReaction&>(R).third_body;
|
||||
ThirdBody& tb2 = dynamic_cast<ThreeBodyReaction&>(other).third_body;
|
||||
bool thirdBodyOk = true;
|
||||
for (size_t k = 0; k < nTotalSpecies(); k++) {
|
||||
string s = kineticsSpeciesName(k);
|
||||
|
|
|
|||
|
|
@ -133,12 +133,12 @@ ThirdBody::ThirdBody(double default_eff)
|
|||
{
|
||||
}
|
||||
|
||||
ThirdBodyReaction::ThirdBodyReaction()
|
||||
ThreeBodyReaction::ThreeBodyReaction()
|
||||
{
|
||||
reaction_type = THREE_BODY_RXN;
|
||||
}
|
||||
|
||||
ThirdBodyReaction::ThirdBodyReaction(const Composition& reactants_,
|
||||
ThreeBodyReaction::ThreeBodyReaction(const Composition& reactants_,
|
||||
const Composition& products_,
|
||||
const Arrhenius& rate_,
|
||||
const ThirdBody& tbody)
|
||||
|
|
@ -148,11 +148,11 @@ ThirdBodyReaction::ThirdBodyReaction(const Composition& reactants_,
|
|||
reaction_type = THREE_BODY_RXN;
|
||||
}
|
||||
|
||||
std::string ThirdBodyReaction::reactantString() const {
|
||||
std::string ThreeBodyReaction::reactantString() const {
|
||||
return ElementaryReaction::reactantString() + " + M";
|
||||
}
|
||||
|
||||
std::string ThirdBodyReaction::productString() const {
|
||||
std::string ThreeBodyReaction::productString() const {
|
||||
return ElementaryReaction::productString() + " + M";
|
||||
}
|
||||
|
||||
|
|
@ -377,7 +377,7 @@ void setupElementaryReaction(ElementaryReaction& R, const XML_Node& rxn_node)
|
|||
setupReaction(R, rxn_node);
|
||||
}
|
||||
|
||||
void setupThirdBodyReaction(ThirdBodyReaction& R, const XML_Node& rxn_node)
|
||||
void setupThreeBodyReaction(ThreeBodyReaction& R, const XML_Node& rxn_node)
|
||||
{
|
||||
readEfficiencies(R.third_body, rxn_node.child("rateCoeff"));
|
||||
setupElementaryReaction(R, rxn_node);
|
||||
|
|
@ -629,8 +629,8 @@ shared_ptr<Reaction> newReaction(const XML_Node& rxn_node)
|
|||
return R;
|
||||
|
||||
} else if (type == "threebody" || type == "three_body") {
|
||||
shared_ptr<ThirdBodyReaction> R(new ThirdBodyReaction());
|
||||
setupThirdBodyReaction(*R, rxn_node);
|
||||
shared_ptr<ThreeBodyReaction> R(new ThreeBodyReaction());
|
||||
setupThreeBodyReaction(*R, rxn_node);
|
||||
return R;
|
||||
|
||||
} else if (type == "falloff") {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ TEST_F(KineticsFromScratch, add_three_body_reaction)
|
|||
Arrhenius rate(1.2e11, -1.0, 0.0);
|
||||
ThirdBody tbody;
|
||||
tbody.efficiencies = parseCompString("AR:0.83 H2:2.4 H2O:15.4");
|
||||
shared_ptr<ThirdBodyReaction> R(new ThirdBodyReaction(reac, prod, rate, tbody));
|
||||
shared_ptr<ThreeBodyReaction> R(new ThreeBodyReaction(reac, prod, rate, tbody));
|
||||
|
||||
kin.addReaction(R);
|
||||
kin.finalize();
|
||||
|
|
@ -85,7 +85,7 @@ TEST_F(KineticsFromScratch, undefined_third_body)
|
|||
Arrhenius rate(1.2e11, -1.0, 0.0);
|
||||
ThirdBody tbody;
|
||||
tbody.efficiencies = parseCompString("H2:0.1 CO2:0.83");
|
||||
shared_ptr<ThirdBodyReaction> R(new ThirdBodyReaction(reac, prod, rate, tbody));
|
||||
shared_ptr<ThreeBodyReaction> R(new ThreeBodyReaction(reac, prod, rate, tbody));
|
||||
|
||||
ASSERT_THROW(kin.addReaction(R), CanteraError);
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ TEST_F(KineticsFromScratch, skip_undefined_third_body)
|
|||
Arrhenius rate(1.2e11, -1.0, 0.0);
|
||||
ThirdBody tbody;
|
||||
tbody.efficiencies = parseCompString("H2:0.1 CO2:0.83");
|
||||
shared_ptr<ThirdBodyReaction> R(new ThirdBodyReaction(reac, prod, rate, tbody));
|
||||
shared_ptr<ThreeBodyReaction> R(new ThreeBodyReaction(reac, prod, rate, tbody));
|
||||
|
||||
kin.skipUndeclaredThirdBodies(true);
|
||||
kin.addReaction(R);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue