[Input] Store additional reaction data in 'input' map

This commit is contained in:
Ray Speth 2019-01-30 21:16:39 -05:00
parent 26bd71af53
commit b0209bdf37
3 changed files with 10 additions and 2 deletions

View file

@ -9,6 +9,7 @@
#define CT_REACTION_H
#include "cantera/base/utilities.h"
#include "cantera/base/AnyMap.h"
#include "cantera/kinetics/RxnRates.h"
#include "cantera/kinetics/Falloff.h"
@ -16,7 +17,6 @@ namespace Cantera
{
class Kinetics;
class AnyMap;
//! Intermediate class which stores data about a reaction and its rate
//! parameterization so that it can be added to a Kinetics object.
@ -72,6 +72,9 @@ public:
//! True if negative reaction orders are allowed. Default is `false`.
bool allow_negative_orders;
//! Input data used for specific models
AnyMap input;
};

View file

@ -12,6 +12,7 @@
#include "cantera/base/Array.h"
#include "cantera/base/AnyMap.h"
#include <sstream>
#include <set>
#include <boost/algorithm/string.hpp>
@ -509,6 +510,8 @@ void setupReaction(Reaction& R, const AnyMap& node)
R.duplicate = node.getBool("duplicate", false);
R.allow_negative_orders = node.getBool("negative-orders", false);
R.allow_nonreactant_orders = node.getBool("nonreactant-orders", false);
R.input = node;
}
void setupElementaryReaction(ElementaryReaction& R, const XML_Node& rxn_node)

View file

@ -82,7 +82,8 @@ TEST(Reaction, FalloffFromYaml2)
" type: falloff,"
" high-P-rate-constant: [6.00000E+14 cm^3/mol/s, 0, 0],"
" low-P-rate-constant: {A: 1.04000E+26 cm^6/mol^2/s, b: -2.76, Ea: 1600},"
" Troe: {A: 0.562, T3: 91, T1: 5836}}");
" Troe: {A: 0.562, T3: 91, T1: 5836},"
" source: somewhere}");
auto R = newReaction(rxn, gas);
auto FR = dynamic_cast<FalloffReaction&>(*R);
@ -96,6 +97,7 @@ TEST(Reaction, FalloffFromYaml2)
EXPECT_DOUBLE_EQ(params[0], 0.562);
EXPECT_DOUBLE_EQ(params[1], 91.0);
EXPECT_DOUBLE_EQ(params[3], 0.0);
EXPECT_EQ(R->input["source"].asString(), "somewhere");
}
TEST(Reaction, ChemicallyActivatedFromYaml)