Skip to content

Commit

Permalink
[Kinetics] Fix use of "unconvertible" flag
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Mar 21, 2022
1 parent 3967bff commit e81aea3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/kinetics/Falloff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,6 @@ void TroeRate::getParameters(AnyMap& node) const
if (std::abs(m_t2) > SmallNumber) {
params["T2"] = m_t2;
}
// This can't be converted to a different unit system because the dimensions of
// the rate constant were not set. Can occur if the reaction was created outside
// the context of a Kinetics object and never added to a Kinetics object.
node["__unconvertible__"] = true;
}
params.setFlowStyle();
node["Troe"] = std::move(params);
Expand Down Expand Up @@ -440,10 +436,6 @@ void SriRate::getParameters(AnyMap& node) const
params["D"] = m_d;
params["E"] = m_e;
}
// This can't be converted to a different unit system because the dimensions of
// the rate constant were not set. Can occur if the reaction was created outside
// the context of a Kinetics object and never added to a Kinetics object.
node["__unconvertible__"] = true;
}
params.setFlowStyle();
node["SRI"] = std::move(params);
Expand Down
14 changes: 14 additions & 0 deletions test/kinetics/kineticsFromYaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,20 @@ TEST_F(ReactionToYaml, unconvertible2)
EXPECT_THROW(params.applyUnits(), CanteraError);
}

TEST_F(ReactionToYaml, unconvertible3)
{
FalloffReaction3 R(
{{"H2", 1}, {"OH", 1}}, {{"H2O", 1}, {"H", 1}},
TroeRate(
ArrheniusRate(1e5, -1.0, 12.5), ArrheniusRate(1e5, -1.0, 12.5),
{0.562, 91.0, 5836.0, 8552.0}),
ThirdBody());
AnyMap params = R.parameters();
UnitSystem U{"g", "cm", "mol"};
params.setUnits(U);
EXPECT_THROW(params.applyUnits(), CanteraError);
}

TEST_F(ReactionToYaml, BlowersMaselRate)
{
soln = newSolution("blowers-masel.yaml", "gas");
Expand Down

0 comments on commit e81aea3

Please sign in to comment.