20#include <boost/algorithm/string/predicate.hpp>
24#include <boost/algorithm/string.hpp>
26namespace ba = boost::algorithm;
35 , allow_nonreactant_orders(false)
36 , allow_negative_orders(false)
44 shared_ptr<ReactionRate> rate_)
46 , reactants(reactants_)
50 , allow_nonreactant_orders(false)
51 , allow_negative_orders(false)
68 if (!rateNode.
hasKey(
"type")) {
70 rateNode[
"type"] =
"Arrhenius";
72 std::string
type = rateNode[
"type"].asString();
73 if (rateNode.
hasKey(
"rate-constant")) {
74 if (!boost::algorithm::starts_with(
type,
"interface-")) {
75 rateNode[
"type"] =
"interface-" +
type;
77 }
else if (node.
hasKey(
"sticking-coefficient")) {
78 if (!boost::algorithm::starts_with(
type,
"sticking-")) {
79 rateNode[
"type"] =
"sticking-" +
type;
82 throw InputFileError(
"Reaction::Reaction",
input,
83 "Unable to infer interface reaction type.");
93Reaction::Reaction(
int type)
97 , allow_nonreactant_orders(false)
98 , allow_negative_orders(false)
103 "To be removed after Cantera 2.6. Use constructor without parameter "
109 : reaction_type(type)
110 , reactants(reactants_)
111 , products(products_)
114 , allow_nonreactant_orders(false)
115 , allow_negative_orders(false)
120 "To be removed after Cantera 2.6. Use constructor without parameter "
127 for (
const auto& order :
orders) {
130 "Reaction order specified for non-reactant species '{}'",
137 for (
const auto& order :
orders) {
138 if (order.second < 0.0) {
140 "Negative reaction order specified for species '{}'",
152 "Reaction orders may only be given for irreversible reactions");
172 {
"head",
"equation"},
173 {
"tail",
"duplicate"},
175 {
"tail",
"negative-orders"},
176 {
"tail",
"nonreactant-orders"}
179 out[
"__type__"] =
"Reaction";
186 reactionNode[
"equation"] =
equation();
189 reactionNode[
"duplicate"] =
true;
192 reactionNode[
"orders"] =
orders;
195 reactionNode[
"negative-orders"] =
true;
198 reactionNode[
"nonreactant-orders"] =
true;
205 if (reactionNode.
hasKey(
"type")) {
206 std::string
type = reactionNode[
"type"].asString();
207 if (boost::algorithm::starts_with(
type,
"Arrhenius")) {
208 reactionNode.
erase(
"type");
209 }
else if (boost::algorithm::starts_with(
type,
"Blowers-Masel")) {
210 reactionNode[
"type"] =
"Blowers-Masel";
227 if (node.
hasKey(
"orders")) {
228 for (
const auto& order : node[
"orders"].asMap<double>()) {
229 orders[order.first] = order.second;
252 if (
reactants.count(
"(+M)") && std::dynamic_pointer_cast<ChebyshevRate>(
m_rate)) {
254 "in the reaction equation for Chebyshev reactions is deprecated.");
260 if (
reactants.count(
"M") && std::dynamic_pointer_cast<PlogRate>(
m_rate)) {
262 "pressure-dependent-Arrhenius reaction.");
268 std::ostringstream result;
273 if (iter->second != 1.0) {
274 result << iter->second <<
" ";
276 result << iter->first;
283 std::ostringstream result;
288 if (iter->second != 1.0) {
289 result << iter->second <<
" ";
291 result << iter->first;
327 for (
const auto& order :
orders) {
329 rate_units *= phase.standardConcentrationUnits().
pow(-order.second);
334 if (stoich.first ==
"M" || ba::starts_with(stoich.first,
"(+")) {
340 rate_units *= phase.standardConcentrationUnits().
pow(-stoich.second);
361 for (
const auto& order :
orders) {
364 rate_units.update(phase.standardConcentrationUnits(), -order.second);
369 if (stoich.first ==
"M" || ba::starts_with(stoich.first,
"(+")) {
376 rate_units.update(phase.standardConcentrationUnits(), -stoich.second);
388void updateUndeclared(std::vector<std::string>& undeclared,
391 for (
const auto& sp: comp) {
393 undeclared.emplace_back(sp.first);
401 std::vector<std::string> undeclared;
403 updateUndeclared(undeclared,
m_third_body->efficiencies, kin);
404 return std::make_pair(undeclared,
m_third_body->specified_collision_partner);
406 return std::make_pair(undeclared,
false);
417 double stoich = sp.second;
418 for (
size_t m = 0; m < ph.
nElements(); m++) {
426 double stoich = sp.second;
427 for (
size_t m = 0; m < ph.
nElements(); m++) {
434 for (
const auto& el : balr) {
435 const std::string& elem = el.first;
436 double elemsum = balr[elem] + balp[elem];
437 double elemdiff = fabs(balp[elem] - balr[elem]);
438 if (elemsum > 0.0 && elemdiff / elemsum > 1e-4) {
440 msg += fmt::format(
" {} {} {}\n",
441 elem, balr[elem], balp[elem]);
446 "The following reaction is unbalanced: {}\n"
447 " Element Reactants Products\n{}",
456 double reac_sites = 0.0;
457 double prod_sites = 0.0;
462 reac_sites += reactant.second * surf.size(k);
465 for (
const auto& product :
products) {
466 size_t k = surf.speciesIndex(product.first);
468 prod_sites += product.second * surf.size(k);
471 if (fabs(reac_sites - prod_sites) > 1e-5 * (reac_sites + prod_sites)) {
473 "Number of surface sites not balanced in reaction {}.\n"
474 "Reactant sites: {}\nProduct sites: {}",
475 equation(), reac_sites, prod_sites);
482 std::vector<std::string> undeclared;
483 updateUndeclared(undeclared,
reactants, kin);
484 updateUndeclared(undeclared,
products, kin);
485 if (!undeclared.empty()) {
490 "contains undeclared species: '{}'",
491 equation(), boost::algorithm::join(undeclared,
"', '"));
496 updateUndeclared(undeclared,
orders, kin);
497 if (!undeclared.empty()) {
504 "defines reaction orders for undeclared species: '{}'",
505 equation(), boost::algorithm::join(undeclared,
"', '"));
509 "defines reaction orders for undeclared species: '{}'",
510 equation(), boost::algorithm::join(undeclared,
"', '"));
516 undeclared = third.first;
517 bool specified_collision_partner_ = third.second;
518 if (!undeclared.empty()) {
523 "defines third-body efficiencies for undeclared species: '{}'",
524 equation(), boost::algorithm::join(undeclared,
"', '"));
528 "is a three-body reaction with undeclared species: '{}'",
529 equation(), boost::algorithm::join(undeclared,
"', '"));
550 e_counter[i] += sp.second * kin.
thermo(i).
charge(kphase);
558 e_counter[i] -= sp.second * kin.
thermo(i).
charge(kphase);
562 for (
double delta_e : e_counter) {
563 if (std::abs(delta_e) > 1e-4) {
571ElementaryReaction2::ElementaryReaction2(
const Composition& reactants_,
576 , allow_negative_pre_exponential_factor(false)
581ElementaryReaction2::ElementaryReaction2()
583 , allow_negative_pre_exponential_factor(false)
591 if (!allow_negative_pre_exponential_factor &&
594 "Undeclared negative pre-exponential factor found in reaction '"
602 if (allow_negative_pre_exponential_factor) {
603 reactionNode[
"negative-A"] =
true;
607 reactionNode[
"rate-constant"] = std::move(rateNode);
610ThirdBody::ThirdBody(
double default_eff)
611 : default_efficiency(default_eff)
612 , specified_collision_partner(false)
617ThirdBody::ThirdBody(
const AnyMap& node)
618 : specified_collision_partner(false)
621 setEfficiencies(node);
627 if (node.
hasKey(
"efficiencies")) {
637ThreeBodyReaction2::ThreeBodyReaction2()
642ThreeBodyReaction2::ThreeBodyReaction2(
const Composition& reactants_,
644 const Arrhenius2& rate_,
645 const ThirdBody& tbody)
646 : ElementaryReaction2(reactants_, products_, rate_)
675 bool specified_collision_partner_ =
false;
682 if (reac.first !=
"M" &&
products.count(reac.first)) {
684 specified_collision_partner_ =
true;
687 if (!specified_collision_partner_) {
697 reactionNode[
"type"] =
"three-body";
709 std::vector<std::string> undeclared;
714FalloffReaction2::FalloffReaction2()
717 , allow_negative_pre_exponential_factor(false)
718 , low_rate_units(0.0)
723FalloffReaction2::FalloffReaction2(
725 const Arrhenius2& low_rate_,
const Arrhenius2& high_rate_,
726 const ThirdBody& tbody)
727 : Reaction(reactants_, products_)
728 , low_rate(low_rate_)
729 , high_rate(high_rate_)
731 , falloff(new Lindemann())
732 , allow_negative_pre_exponential_factor(false)
733 , low_rate_units(0.0)
763 if (!allow_negative_pre_exponential_factor &&
767 "pre-exponential factor found for reaction '" +
equation() +
"'");
771 "low rate pre-exponential factors must have the same sign."
787 reactionNode[
"type"] =
"falloff-legacy";
790 reactionNode[
"low-P-rate-constant"] = std::move(lowRateNode);
793 reactionNode[
"high-P-rate-constant"] = std::move(highRateNode);
794 falloff->getParameters(reactionNode);
806 std::vector<std::string> undeclared;
808 return std::make_pair(undeclared,
false);
811ChemicallyActivatedReaction2::ChemicallyActivatedReaction2()
816ChemicallyActivatedReaction2::ChemicallyActivatedReaction2(
818 const Arrhenius2& low_rate_,
const Arrhenius2& high_rate_,
819 const ThirdBody& tbody)
820 : FalloffReaction2(reactants_, products_, low_rate_, high_rate_, tbody)
836 reactionNode[
"type"] =
"chemically-activated";
839PlogReaction2::PlogReaction2()
845PlogReaction2::PlogReaction2(
const Composition& reactants_,
847 : Reaction(reactants_, products_)
856 reactionNode[
"type"] =
"pressure-dependent-Arrhenius";
860ChebyshevReaction2::ChebyshevReaction2()
866ChebyshevReaction2::ChebyshevReaction2(
const Composition& reactants_,
868 const ChebyshevRate& rate_)
869 : Reaction(reactants_, products_)
878 reactionNode[
"type"] =
"Chebyshev";
882InterfaceReaction2::InterfaceReaction2()
883 : is_sticking_coefficient(false)
884 , use_motz_wise_correction(false)
889InterfaceReaction2::InterfaceReaction2(
const Composition& reactants_,
891 const Arrhenius2& rate_,
893 : ElementaryReaction2(reactants_, products_, rate_)
894 , is_sticking_coefficient(isStick)
895 , use_motz_wise_correction(false)
912 reactionNode[
"sticking-coefficient"] = std::move(reactionNode[
"rate-constant"]);
913 reactionNode.
erase(
"rate-constant");
916 reactionNode[
"Motz-Wise"] =
true;
925 dep[
"a"] = d.second.a;
926 dep[
"m"] = d.second.m;
927 dep[
"E"].setQuantity(d.second.E,
"K",
true);
928 deps[d.first] = std::move(dep);
930 reactionNode[
"coverage-dependencies"] = std::move(deps);
937 fmt::memory_buffer err_reactions;
938 double T[] = {200.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0};
939 for (
size_t i=0; i < 6; i++) {
940 double k = rate.
updateRC(log(T[i]), 1/T[i]);
942 fmt_append(err_reactions,
943 "\n Sticking coefficient is greater than 1 for reaction '{}'\n"
948 if (err_reactions.size()) {
949 warn_user(
"InterfaceReaction2::validate", to_string(err_reactions));
954ElectrochemicalReaction2::ElectrochemicalReaction2()
956 , exchange_current_density_formulation(false)
960ElectrochemicalReaction2::ElectrochemicalReaction2(
const Composition& reactants_,
962 const Arrhenius2& rate_)
963 : InterfaceReaction2(reactants_, products_, rate_)
965 , exchange_current_density_formulation(false)
973 reactionNode[
"beta"] =
beta;
975 if (exchange_current_density_formulation) {
976 reactionNode[
"exchange-current-density-formulation"] =
true;
980ThreeBodyReaction3::ThreeBodyReaction3()
986ThreeBodyReaction3::ThreeBodyReaction3(
const Composition& reactants,
988 const ArrheniusRate& rate,
989 const ThirdBody& tbody)
990 : Reaction(reactants, products, make_shared<ArrheniusRate>(rate))
995ThreeBodyReaction3::ThreeBodyReaction3(
const AnyMap& node,
const Kinetics& kin)
1006bool ThreeBodyReaction3::detectEfficiencies()
1018 throw CanteraError(
"ThreeBodyReaction3::detectEfficiencies",
1019 "Found more than one explicitly specified collision partner\n"
1029 if (trunc(reac->second) != 1) {
1036 auto prod =
products.find(sp->first);
1037 if (trunc(prod->second) != 1) {
1050 if (!detectEfficiencies()) {
1052 "Reaction equation '{}' does not contain third body 'M'",
1078 reactionNode[
"type"] =
"three-body";
1079 reactionNode[
"efficiencies"] =
m_third_body->efficiencies;
1082 reactionNode[
"default-efficiency"] =
m_third_body->default_efficiency;
1107FalloffReaction3::FalloffReaction3()
1115FalloffReaction3::FalloffReaction3(
const Composition& reactants,
1117 const ReactionRate& rate,
1118 const ThirdBody& tbody)
1119 : Reaction(reactants, products)
1123 AnyMap node =
rate.parameters();
1125 std::string rate_type = node[
"type"].asString();
1126 if (rate_type !=
"falloff" && rate_type !=
"chemically-activated") {
1128 throw CanteraError(
"FalloffReaction3::FalloffReaction3",
1129 "Incompatible types: '{}' is not a falloff rate object.",
rate.type());
1134FalloffReaction3::FalloffReaction3(
const AnyMap& node,
const Kinetics& kin)
1138 if (!node.empty()) {
1149 std::dynamic_pointer_cast<FalloffRate>(
m_rate)->chemicallyActivated())
1151 return "chemically-activated";
1196 std::string third_body_str;
1197 std::string third_body;
1199 if (reactant.second == -1 && ba::starts_with(reactant.first,
"(+")) {
1200 third_body_str = reactant.first;
1201 third_body = third_body_str.substr(2, third_body_str.size() - 3);
1207 if (third_body_str ==
"") {
1209 "Reactants for reaction '{}' do not contain a pressure-dependent "
1212 if (
products.count(third_body_str) == 0) {
1214 "Unable to match third body '{}' in reactants and products of "
1215 "reaction '{}'", third_body,
equation);
1222 if (third_body ==
"M") {
1238 reactionNode[
"efficiencies"] =
m_third_body->efficiencies;
1241 reactionNode[
"default-efficiency"] =
m_third_body->default_efficiency;
1246CustomFunc1Reaction::CustomFunc1Reaction()
1251CustomFunc1Reaction::CustomFunc1Reaction(
const Composition& reactants,
1253 const CustomFunc1Rate& rate)
1254 : Reaction(reactants, products)
1259CustomFunc1Reaction::CustomFunc1Reaction(
const AnyMap& node,
const Kinetics& kin)
1261 if (!node.empty()) {
1269bool isThreeBody(
const Reaction& R)
1273 for (
const auto& reac : R.reactants) {
1274 auto prod = R.products.find(reac.first);
1275 if (prod != R.products.end() &&
1276 trunc(reac.second) == reac.second && trunc(prod->second) == prod->second) {
1287 for (
const auto& reac : R.reactants) {
1288 if (trunc(reac.second) != reac.second) {
1291 nreac +=
static_cast<size_t>(reac.second);
1296 for (
const auto& prod : R.products) {
1297 if (trunc(prod.second) != prod.second) {
1300 nprod +=
static_cast<size_t>(prod.second);
1304 return (nreac == 3) || (nprod == 3);
1322 && (type ==
"edge" || type ==
"surface")) {
1323 type =
"electrochemical";
1326 if (!(ReactionFactoryXML::factory()->exists(type))) {
1328 "Unknown reaction type '" + rxn_node[
"type"] +
"'");
1334 setupReaction(testReaction, rxn_node);
1335 if (isThreeBody(testReaction)) {
1336 type =
"three-body";
1339 Reaction* R = ReactionFactoryXML::factory()->create(type, rxn_node);
1340 return unique_ptr<Reaction>(R);
1345 std::string type =
"elementary";
1347 if (rxn_node.
hasKey(
"type")) {
1348 type = rxn_node[
"type"].asString();
1349 }
else if (nDim == 3) {
1355 if (isThreeBody(testReaction)) {
1356 type =
"three-body";
1361 throw InputFileError(
"ReactionFactory::newReaction", rxn_node[
"type"],
1362 "Unknown reaction type '{}'", type);
1365 return unique_ptr<Reaction>(R);
1368Arrhenius2 readArrhenius(
const XML_Node& arrhenius_node)
1370 return Arrhenius2(
getFloat(arrhenius_node,
"A",
"toSI"),
1375Arrhenius2 readArrhenius(
const Reaction& R,
const AnyValue& rate,
1376 const Kinetics& kin,
const UnitSystem& units,
1377 int pressure_dependence=0)
1380 Units rc_units = R.rate_units;
1381 if (pressure_dependence) {
1382 Units rxn_phase_units = kin.thermo(kin.reactionPhaseIndex()).standardConcentrationUnits();
1383 rc_units *= rxn_phase_units.pow(-pressure_dependence);
1385 if (rate.is<AnyMap>()) {
1386 auto& rate_map = rate.as<AnyMap>();
1387 A = units.convert(rate_map[
"A"], rc_units);
1388 b = rate_map[
"b"].asDouble();
1389 Ta = units.convertActivationEnergy(rate_map[
"Ea"],
"K");
1391 auto& rate_vec = rate.asVector<AnyValue>(3);
1392 A = units.convert(rate_vec[0], rc_units);
1393 b = rate_vec[1].asDouble();
1394 Ta = units.convertActivationEnergy(rate_vec[2],
"K");
1396 return Arrhenius2(A, b, Ta);
1408 std::vector<std::string> p;
1411 size_t np = p.size();
1412 for (
size_t n = 0; n < np; n++) {
1418 throw CanteraError(
"readFalloff",
"Lindemann parameterization "
1419 "takes no parameters, but {} were given", np);
1423 if (np != 3 && np != 4) {
1424 throw CanteraError(
"readFalloff",
"Troe parameterization takes "
1425 "3 or 4 parameters, but {} were given", np);
1429 if (np != 3 && np != 5) {
1430 throw CanteraError(
"readFalloff",
"SRI parameterization takes "
1431 "3 or 5 parameters, but {} were given", np);
1436 throw CanteraError(
"readFalloff",
"Tsang parameterization takes "
1437 "2 parameters, but {} were given", np);
1441 throw CanteraError(
"readFalloff",
"Unrecognized falloff type: '{}'",
1446void readFalloff(FalloffReaction2& R,
const AnyMap& node)
1448 if (node.hasKey(
"Troe")) {
1449 auto& f = node[
"Troe"].as<AnyMap>();
1455 if (f.hasKey(
"T2")) {
1456 params.push_back(f[
"T2"].asDouble());
1459 }
else if (node.hasKey(
"SRI")) {
1460 auto& f = node[
"SRI"].as<AnyMap>();
1466 if (f.hasKey(
"D")) {
1467 params.push_back(f[
"D"].asDouble());
1469 if (f.hasKey(
"E")) {
1470 params.push_back(f[
"E"].asDouble());
1473 }
else if (node.hasKey(
"Tsang")) {
1474 auto& f = node[
"Tsang"].as<AnyMap>();
1485void readEfficiencies(ThirdBody& tbody,
const XML_Node& rc_node)
1487 if (!rc_node.hasChild(
"efficiencies")) {
1488 tbody.default_efficiency = 1.0;
1491 const XML_Node& eff_node = rc_node.child(
"efficiencies");
1492 tbody.default_efficiency =
fpValue(eff_node[
"default"]);
1496void readEfficiencies(ThirdBody& tbody,
const AnyMap& node)
1498 tbody.setEfficiencies(node);
1501bool detectEfficiencies(ThreeBodyReaction2& R)
1503 for (
const auto& reac : R.reactants) {
1505 if (R.products.count(reac.first)) {
1506 R.third_body.efficiencies[reac.first] = 1.;
1510 if (R.third_body.efficiencies.size() == 0) {
1512 }
else if (R.third_body.efficiencies.size() > 1) {
1513 throw CanteraError(
"detectEfficiencies",
1514 "Found more than one explicitly specified collision partner\n"
1515 "in reaction '{}'.", R.equation());
1518 R.third_body.default_efficiency = 0.;
1519 R.third_body.specified_collision_partner =
true;
1520 auto sp = R.third_body.efficiencies.begin();
1523 auto reac = R.reactants.find(sp->first);
1524 if (trunc(reac->second) != 1) {
1527 R.reactants.erase(reac);
1531 auto prod = R.products.find(sp->first);
1532 if (trunc(prod->second) != 1) {
1535 R.products.erase(prod);
1541void setupReaction(Reaction& R,
const XML_Node& rxn_node)
1548 std::vector<XML_Node*> orders = rxn_node.getChildren(
"order");
1549 for (
size_t i = 0; i < orders.size(); i++) {
1550 R.orders[orders[i]->attrib(
"species")] = orders[i]->fp_value();
1554 R.id = rxn_node.attrib(
"id");
1555 R.duplicate = rxn_node.hasAttrib(
"duplicate");
1556 const std::string& rev = rxn_node[
"reversible"];
1557 R.reversible = (rev ==
"true" || rev ==
"yes");
1565 std::vector<std::string> tokens;
1567 tokens.push_back(
"+");
1569 size_t last_used =
npos;
1570 bool reactants =
true;
1571 for (
size_t i = 1; i < tokens.size(); i++) {
1572 if (tokens[i] ==
"+" || ba::starts_with(tokens[i],
"(+") ||
1573 tokens[i] ==
"<=>" || tokens[i] ==
"=" || tokens[i] ==
"=>") {
1574 std::string species = tokens[i-1];
1577 if (last_used !=
npos && tokens[last_used] ==
"(+") {
1579 species =
"(+" + species;
1581 }
else if (last_used == i-1 && ba::starts_with(species,
"(+")
1582 && ba::ends_with(species,
")")) {
1585 }
else if (last_used == i-2) {
1587 }
else if (last_used == i-3) {
1596 "Error parsing reaction string '{}'.\n"
1597 "Current token: '{}'\nlast_used: '{}'",
1598 equation, tokens[i],
1599 (last_used ==
npos) ?
"n/a" : tokens[last_used]);
1602 && stoich != -1 && species !=
"M"))
1617 if (tokens[i] ==
"<=>" || tokens[i] ==
"=") {
1620 }
else if (tokens[i] ==
"=>") {
1627void setupReaction(Reaction& R,
const AnyMap& node,
const Kinetics& kin)
1631 if (node.hasKey(
"orders")) {
1632 for (
const auto& order : node[
"orders"].asMap<double>()) {
1633 R.orders[order.first] = order.second;
1634 if (kin.kineticsSpeciesIndex(order.first) ==
npos) {
1641 R.id = node.getString(
"id",
"");
1642 R.duplicate = node.getBool(
"duplicate",
false);
1643 R.allow_negative_orders = node.getBool(
"negative-orders",
false);
1644 R.allow_nonreactant_orders = node.getBool(
"nonreactant-orders",
false);
1647 R.calculateRateCoeffUnits(kin);
1650void setupElementaryReaction(ElementaryReaction2& R,
const XML_Node& rxn_node)
1652 const XML_Node& rc_node = rxn_node.child(
"rateCoeff");
1653 if (rc_node.hasChild(
"Arrhenius")) {
1654 R.rate = readArrhenius(rc_node.child(
"Arrhenius"));
1655 }
else if (rc_node.hasChild(
"Arrhenius_ExchangeCurrentDensity")) {
1656 R.rate = readArrhenius(rc_node.child(
"Arrhenius_ExchangeCurrentDensity"));
1658 throw CanteraError(
"setupElementaryReaction",
"Couldn't find Arrhenius node");
1660 if (rxn_node[
"negative_A"] ==
"yes") {
1661 R.allow_negative_pre_exponential_factor =
true;
1663 if (rxn_node[
"negative_orders"] ==
"yes") {
1664 R.allow_negative_orders =
true;
1666 if (rxn_node[
"nonreactant_orders"] ==
"yes") {
1667 R.allow_nonreactant_orders =
true;
1669 setupReaction(R, rxn_node);
1675 setupReaction(R, node, kin);
1676 R.allow_negative_pre_exponential_factor = node.
getBool(
"negative-A",
false);
1677 R.rate = readArrhenius(R, node[
"rate-constant"], kin, node.
units());
1680void setupThreeBodyReaction(ThreeBodyReaction2& R,
const XML_Node& rxn_node)
1682 readEfficiencies(R.third_body, rxn_node.child(
"rateCoeff"));
1683 setupElementaryReaction(R, rxn_node);
1684 if (R.third_body.efficiencies.size() == 0) {
1685 detectEfficiencies(R);
1692 setupElementaryReaction(R, node, kin);
1694 if (!detectEfficiencies(R)) {
1696 "Reaction equation '{}' does not contain third body 'M'",
1697 node[
"equation"].asString());
1706void setupFalloffReaction(FalloffReaction2& R,
const XML_Node& rxn_node)
1708 XML_Node& rc_node = rxn_node.child(
"rateCoeff");
1709 std::vector<XML_Node*> rates = rc_node.getChildren(
"Arrhenius");
1712 for (
size_t i = 0; i < rates.size(); i++) {
1713 XML_Node& node = *rates[i];
1714 if (node[
"name"] ==
"") {
1715 R.high_rate = readArrhenius(node);
1717 }
else if (node[
"name"] ==
"k0") {
1718 R.low_rate = readArrhenius(node);
1721 throw CanteraError(
"setupFalloffReaction",
"Found an Arrhenius XML "
1722 "node with an unexpected type '" + node[
"name"] +
"'");
1725 if (nLow != 1 || nHigh != 1) {
1726 throw CanteraError(
"setupFalloffReaction",
"Did not find the correct "
1727 "number of Arrhenius rate expressions");
1729 if (rxn_node[
"negative_A"] ==
"yes") {
1730 R.allow_negative_pre_exponential_factor =
true;
1733 readEfficiencies(R.third_body, rc_node);
1734 setupReaction(R, rxn_node);
1740 setupReaction(R, node, kin);
1743 std::string third_body;
1745 if (reactant.second == -1 && ba::starts_with(reactant.first,
"(+")) {
1746 third_body = reactant.first;
1752 if (third_body ==
"") {
1754 "Reactants for reaction '{}' do not contain a pressure-dependent "
1755 "third body", node[
"equation"].asString());
1756 }
else if (R.
products.count(third_body) == 0) {
1758 "Unable to match third body '{}' in reactants and products of "
1759 "reaction '{}'", third_body, node[
"equation"].asString());
1766 R.allow_negative_pre_exponential_factor = node.
getBool(
"negative-A",
false);
1767 if (third_body ==
"(+M)") {
1775 R.
low_rate = readArrhenius(R, node[
"low-P-rate-constant"], kin,
1777 R.
high_rate = readArrhenius(R, node[
"high-P-rate-constant"], kin,
1787 std::vector<XML_Node*> rates = rc_node.
getChildren(
"Arrhenius");
1790 for (
size_t i = 0; i < rates.size(); i++) {
1792 if (node[
"name"] ==
"kHigh") {
1795 }
else if (node[
"name"] ==
"") {
1799 throw CanteraError(
"setupChemicallyActivatedReaction",
"Found an "
1800 "Arrhenius XML node with an unexpected type '" + node[
"name"] +
"'");
1803 if (nLow != 1 || nHigh != 1) {
1804 throw CanteraError(
"setupChemicallyActivatedReaction",
"Did not find "
1805 "the correct number of Arrhenius rate expressions");
1809 setupReaction(R, rxn_node);
1812void setupPlogReaction(PlogReaction2& R,
const XML_Node& rxn_node)
1814 XML_Node& rc = rxn_node.child(
"rateCoeff");
1815 std::multimap<double, Arrhenius2> rates;
1816 for (
size_t m = 0; m < rc.nChildren(); m++) {
1817 const XML_Node& node = rc.child(m);
1818 rates.insert({
getFloat(node,
"P",
"toSI"), readArrhenius(node)});
1820 R.rate = Plog(rates);
1821 setupReaction(R, rxn_node);
1826 setupReaction(R, node, kin);
1827 std::multimap<double, Arrhenius2> rates;
1829 rates.insert({rate.convert(
"P",
"Pa"),
1832 R.rate =
Plog(rates);
1845 size_t nP = atoi(coeff_node[
"degreeP"].c_str());
1846 size_t nT = atoi(coeff_node[
"degreeT"].c_str());
1851 for (
size_t t = 0; t < nT; t++) {
1852 for (
size_t p = 0; p < nP; p++) {
1853 coeffs(t,p) = coeffs_flat[nP*t + p];
1856 R.rate = ChebyshevRate(
getFloat(rc,
"Tmin",
"toSI"),
1861 setupReaction(R, rxn_node);
1867 setupReaction(R, node, kin);
1870 const auto& T_range = node[
"temperature-range"].asVector<
AnyValue>(2);
1871 const auto& P_range = node[
"pressure-range"].asVector<
AnyValue>(2);
1872 auto& vcoeffs = node[
"data"].asVector<
vector_fp>();
1873 Array2D coeffs(vcoeffs.size(), vcoeffs[0].size());
1874 for (
size_t i = 0; i < coeffs.nRows(); i++) {
1875 if (vcoeffs[i].size() != vcoeffs[0].size()) {
1877 "Inconsistent number of coefficients in row {} of matrix", i + 1);
1879 for (
size_t j = 0; j < coeffs.nColumns(); j++) {
1880 coeffs(i, j) = vcoeffs[i][j];
1886 units.
convert(T_range[1],
"K"),
1887 units.
convert(P_range[0],
"Pa"),
1888 units.
convert(P_range[1],
"Pa"),
1892void setupInterfaceReaction(InterfaceReaction2& R,
const XML_Node& rxn_node)
1894 XML_Node& arr = rxn_node.child(
"rateCoeff").child(
"Arrhenius");
1896 R.is_sticking_coefficient =
true;
1897 R.sticking_species = arr[
"species"];
1900 R.use_motz_wise_correction =
true;
1902 R.use_motz_wise_correction =
false;
1905 XML_Node* parent = rxn_node.parent();
1906 if (parent && parent->name() ==
"reactionData"
1908 R.use_motz_wise_correction =
true;
1912 std::vector<XML_Node*> cov = arr.getChildren(
"coverage");
1913 for (
const auto& node : cov) {
1914 CoverageDependency& cdep = R.coverage_deps[node->attrib(
"species")];
1915 cdep.a =
getFloat(*node,
"a",
"toSI");
1919 setupElementaryReaction(R, rxn_node);
1925 setupReaction(R, node, kin);
1926 R.allow_negative_pre_exponential_factor = node.
getBool(
"negative-A",
false);
1928 if (node.
hasKey(
"rate-constant")) {
1929 R.rate = readArrhenius(R, node[
"rate-constant"], kin, node.
units());
1930 }
else if (node.
hasKey(
"sticking-coefficient")) {
1932 R.rate = readArrhenius(R, node[
"sticking-coefficient"], kin, node.
units());
1938 "Reaction must include either a 'rate-constant' or"
1939 " 'sticking-coefficient' node.");
1942 if (node.
hasKey(
"coverage-dependencies")) {
1943 for (
const auto& item : node[
"coverage-dependencies"].as<AnyMap>()) {
1945 if (item.second.is<
AnyMap>()) {
1946 auto& cov_map = item.second.as<
AnyMap>();
1947 a = cov_map[
"a"].asDouble();
1948 m = cov_map[
"m"].asDouble();
1951 auto& cov_vec = item.second.asVector<
AnyValue>(3);
1953 m = cov_vec[1].asDouble();
1961void setupElectrochemicalReaction(ElectrochemicalReaction2& R,
1962 const XML_Node& rxn_node)
1964 XML_Node& rc = rxn_node.
child(
"rateCoeff");
1966 if (rc_type ==
"exchangecurrentdensity") {
1967 R.exchange_current_density_formulation =
true;
1968 }
else if (rc_type !=
"" && rc_type !=
"arrhenius") {
1969 throw CanteraError(
"setupElectrochemicalReaction",
1970 "Unknown rate coefficient type: '" + rc_type +
"'");
1972 if (rc.hasChild(
"Arrhenius_ExchangeCurrentDensity")) {
1973 R.exchange_current_density_formulation =
true;
1976 if (rc.hasChild(
"electrochem") && rc.child(
"electrochem").hasAttrib(
"beta")) {
1977 R.beta =
fpValueCheck(rc.child(
"electrochem")[
"beta"]);
1980 setupInterfaceReaction(R, rxn_node);
1983 if (rxn_node.hasChild(
"orders")) {
1985 for (
const auto& order : orders) {
1986 R.orders[order.first] = order.second;
1994 setupInterfaceReaction(R, node, kin);
1996 R.exchange_current_density_formulation = node.
getBool(
1997 "exchange-current-density-formulation",
false);
2002 std::vector<shared_ptr<Reaction> > all_reactions;
2003 for (
const auto& rxnnode : node.
child(
"reactionData").
getChildren(
"reaction")) {
2006 return all_reactions;
2012 std::vector<shared_ptr<Reaction>> all_reactions;
2014 shared_ptr<Reaction> R(
newReaction(node, kinetics));
2016 R->validate(kinetics);
2017 if (R->valid() && R->checkSpecies(kinetics)) {
2018 all_reactions.emplace_back(R);
2021 return all_reactions;
Header file for class Cantera::Array2D.
Parameterizations for reaction falloff functions.
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
Factory class for reaction functions.
Factory class for reaction rate objects.
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase,...
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
Base class defining common data possessed by both AnyMap and AnyValue objects.
A map of string keys to values whose type can vary at runtime.
const AnyValue & at(const std::string &key) const
Get the value of the item stored in key.
void copyMetadata(const AnyMap &other)
Copy metadata including input line/column from an existing AnyMap.
const UnitSystem & units() const
Return the default units that should be used to convert stored values.
bool empty() const
Return boolean indicating whether AnyMap is empty.
const std::string & getString(const std::string &key, const std::string &default_) const
If key exists, return it as a string, otherwise return default_.
bool getBool(const std::string &key, bool default_) const
If key exists, return it as a bool, otherwise return default_.
void erase(const std::string &key)
Erase the value held by key.
double getDouble(const std::string &key, double default_) const
If key exists, return it as a double, otherwise return default_.
static bool addOrderingRules(const std::string &objectType, const std::vector< std::vector< std::string > > &specs)
Add global rules for setting the order of elements when outputting AnyMap objects to YAML.
void setFlowStyle(bool flow=true)
Use "flow" style when outputting this AnyMap to YAML.
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
void update(const AnyMap &other, bool keepExisting=true)
Add items from other to this AnyMap.
A wrapper for a variable whose type is determined at runtime.
const std::vector< T > & asVector(size_t nMin=npos, size_t nMax=npos) const
Return the held value, if it is a vector of type T.
double & asDouble()
Return the held value as a double, if it is a double or a long int.
A class for 2D arrays stored in column-major (Fortran-compatible) form.
Arrhenius reaction rate type depends only on temperature.
doublereal updateRC(doublereal logT, doublereal recipT) const
Update the value the rate constant.
void getParameters(AnyMap &node, const Units &rate_units) const
Return parameters - two-parameter version.
virtual double preExponentialFactor() const
Return the pre-exponential factor A (in m, kmol, s to powers depending on the reaction order)
Base class for exceptions thrown by Cantera classes.
virtual std::string getMessage() const
Method overridden by derived classes to format the error message.
Pressure-dependent rate expression where the rate coefficient is expressed as a bivariate Chebyshev p...
A pressure-dependent reaction parameterized by a bi-variate Chebyshev polynomial in temperature and p...
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
A reaction where the rate decreases as pressure increases due to collisional stabilization of a react...
virtual void calculateRateCoeffUnits(const Kinetics &kin)
Calculate the units of the rate constant.
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
virtual std::string type() const
The type of reaction.
An interface reaction which involves charged species.
doublereal beta
Forward value of the apparent Electrochemical transfer coefficient.
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
A reaction which follows mass-action kinetics with a modified Arrhenius reaction rate.
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
T * create(const std::string &name, Args... args)
Create an object using the object construction function corresponding to "name" and the provided cons...
A reaction that is first-order in [M] at low pressure, like a third-body reaction,...
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
virtual void calculateRateCoeffUnits(const Kinetics &kin)
Calculate the units of the rate constant.
shared_ptr< FalloffRate > falloff
Falloff function which determines how low_rate and high_rate are combined to determine the rate const...
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
virtual std::string productString() const
The product side of the chemical equation for this reaction.
Units low_rate_units
The units of the low-pressure rate constant.
Arrhenius2 high_rate
The rate constant in the high-pressure limit.
ThirdBody third_body
Relative efficiencies of third-body species in enhancing the reaction rate.
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Arrhenius2 low_rate
The rate constant in the low-pressure limit.
virtual std::pair< std::vector< std::string >, bool > undeclaredThirdBodies(const Kinetics &kin) const
virtual void setParameters(const AnyMap &node, const Kinetics &kin)
Set up reaction based on AnyMap node
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
virtual std::string productString() const
The product side of the chemical equation for this reaction.
virtual std::string type() const
The type of reaction.
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
virtual void setEquation(const std::string &equation, const Kinetics *kin)
Set the reactants and products based on the reaction equation.
A reaction occurring on an interface (for example, a SurfPhase or an EdgePhase)
bool is_sticking_coefficient
Set to true if rate is a parameterization of the sticking coefficient rather than the forward rate co...
std::map< std::string, CoverageDependency > coverage_deps
Adjustments to the Arrhenius rate expression dependent on surface species coverages.
virtual void calculateRateCoeffUnits(const Kinetics &kin)
Calculate the units of the rate constant.
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
std::string sticking_species
For reactions with multiple non-surface species, the sticking species needs to be explicitly identifi...
bool use_motz_wise_correction
Set to true if rate is a sticking coefficient which should be translated into a rate coefficient usin...
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Public interface for kinetics managers.
size_t reactionPhaseIndex() const
Phase where the reactions occur.
ThermoPhase & thermo(size_t n=0)
This method returns a reference to the nth ThermoPhase object defined in this kinetics mechanism.
ThermoPhase & speciesPhase(const std::string &nm)
This function looks up the name of a species and returns a reference to the ThermoPhase object of the...
size_t nPhases() const
The number of phases participating in the reaction mechanism.
void skipUndeclaredSpecies(bool skip)
Determine behavior when adding a new reaction that contains species not defined in any of the phases ...
void skipUndeclaredThirdBodies(bool skip)
Determine behavior when adding a new reaction that contains third-body efficiencies for species not d...
size_t kineticsSpeciesIndex(size_t k, size_t n) const
The location of species k of phase n in species arrays.
size_t surfacePhaseIndex() const
This returns the integer index of the phase which has ThermoPhase type cSurf.
size_t speciesPhaseIndex(size_t k) const
This function takes as an argument the kineticsSpecies index (that is, the list index in the list of ...
The Lindemann falloff parameterization.
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
doublereal nAtoms(size_t k, size_t m) const
Number of atoms of element m in species k.
size_t nElements() const
Number of elements.
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
std::string elementName(size_t m) const
Name of the element with index m.
Pressure-dependent reaction rate expressed by logarithmically interpolating between Arrhenius rate ex...
A pressure-dependent reaction parameterized by logarithmically interpolating between Arrhenius rate e...
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
static ReactionFactory * factory()
Return a pointer to the factory.
Abstract base class which stores data about a reaction and its rate parameterization so that it can b...
virtual void setParameters(const AnyMap &node, const Kinetics &kin)
Set up reaction based on AnyMap node
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
void checkBalance(const Kinetics &kin) const
Check that the specified reaction is balanced (same number of atoms for each element in the reactants...
Units rate_units
The units of the rate constant.
bool valid() const
Get validity flag of reaction.
virtual void calculateRateCoeffUnits(const Kinetics &kin)
Calculate the units of the rate constant.
shared_ptr< ReactionRate > rate()
Get reaction rate pointer.
Composition orders
Forward reaction order with respect to specific species.
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
bool checkSpecies(const Kinetics &kin) const
Verify that all species involved in the reaction are defined in the Kinetics object.
void setRate(shared_ptr< ReactionRate > rate)
Set reaction rate pointer.
shared_ptr< ThirdBody > m_third_body
Relative efficiencies of third-body species in enhancing the reaction rate (if applicable)
AnyMap parameters(bool withInput=true) const
Return the parameters such that an identical Reaction could be reconstructed using the newReaction() ...
virtual void setEquation(const std::string &equation, const Kinetics *kin=0)
Set the reactants and products based on the reaction equation.
virtual std::string productString() const
The product side of the chemical equation for this reaction.
bool reversible
True if the current reaction is reversible. False otherwise.
bool allow_nonreactant_orders
True if reaction orders can be specified for non-reactant species.
virtual std::string type() const
The type of reaction.
shared_ptr< ReactionRate > m_rate
Reaction rate used by generic reactions.
bool usesLegacy() const
Indicate whether object uses legacy framework.
bool usesElectrochemistry(const Kinetics &kin) const
Check whether reaction uses electrochemistry.
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
bool allow_negative_orders
True if negative reaction orders are allowed. Default is false.
Composition products
Product species and stoichiometric coefficients.
Composition reactants
Reactant species and stoichiometric coefficients.
AnyMap input
Input data used for specific models.
bool duplicate
True if the current reaction is marked as duplicate.
UnitStack calculateRateCoeffUnits3(const Kinetics &kin)
Calculate the units of the rate constant.
int reaction_type
Type of the reaction.
std::string equation() const
The chemical equation for this reaction.
virtual std::pair< std::vector< std::string >, bool > undeclaredThirdBodies(const Kinetics &kin) const
void setValid(bool valid)
Set validity flag of reaction.
A simple thermodynamic model for a surface phase, assuming an ideal solution model.
Base class for a phase with thermodynamic properties.
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
const AnyMap & input() const
Access input data associated with the phase description.
A class for managing third-body efficiencies, including default values.
bool specified_collision_partner
Input explicitly specifies collision partner.
void setEfficiencies(const AnyMap &node)
Set third-body efficiencies from AnyMap node
double default_efficiency
The default third body efficiency for species not listed in efficiencies.
double efficiency(const std::string &k) const
Get the third-body efficiency for species k
Composition efficiencies
Map of species to third body efficiency.
A reaction with a non-reacting third body "M" that acts to add or remove energy from the reacting spe...
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
virtual void calculateRateCoeffUnits(const Kinetics &kin)
Calculate the units of the rate constant.
virtual std::string productString() const
The product side of the chemical equation for this reaction.
ThirdBody third_body
Relative efficiencies of third-body species in enhancing the reaction rate.
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
virtual std::pair< std::vector< std::string >, bool > undeclaredThirdBodies(const Kinetics &kin) const
virtual void setParameters(const AnyMap &node, const Kinetics &kin)
Set up reaction based on AnyMap node
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
virtual void setEquation(const std::string &equation, const Kinetics *kin=0)
Set the reactants and products based on the reaction equation.
virtual std::string productString() const
The product side of the chemical equation for this reaction.
virtual std::string type() const
The type of reaction.
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
double convert(double value, const std::string &src, const std::string &dest) const
Convert value from the units of src to the units of dest.
double convertActivationEnergy(double value, const std::string &src, const std::string &dest) const
Convert value from the units of src to the units of dest, allowing for the different dimensions that ...
double convertTo(double value, const std::string &dest) const
Convert value to the specified dest units from the appropriate units for this unit system (defined by...
A representation of the units associated with a dimensional quantity.
Units pow(double exponent) const
Raise these Units to a power, changing both the conversion factor and the dimensions of these Units.
Class XML_Node is a tree-based representation of the contents of an XML file.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
std::vector< XML_Node * > getChildren(const std::string &name) const
Get a vector of pointers to XML_Node containing all of the children of the current node which match t...
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
void getStringArray(const XML_Node &node, std::vector< std::string > &v)
This function interprets the value portion of an XML element as a string.
const int CHEBYSHEV_RXN
A general gas-phase pressure-dependent reaction where k(T,P) is defined in terms of a bivariate Cheby...
void parseReactionEquation(Reaction &R, const std::string &equation, const AnyBase &reactionNode, const Kinetics *kin)
Parse reaction equation.
std::vector< shared_ptr< Reaction > > getReactions(const XML_Node &node)
Create Reaction objects for all <reaction> nodes in an XML document.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type="")
Get a floating-point value from a child element.
const int PLOG_RXN
A pressure-dependent rate expression consisting of several Arrhenius rate expressions evaluated at di...
doublereal fpValue(const std::string &val)
Translate a string into one doublereal value.
bool caseInsensitiveEquals(const std::string &input, const std::string &test)
Case insensitive equality predicate.
std::map< std::string, double > Composition
Map from string names to doubles.
shared_ptr< Falloff > newFalloff(const std::string &type, const vector_fp &c)
Return a pointer to a new falloff function calculator.
void warn_deprecated(const std::string &source, const AnyBase &node, const std::string &message)
A deprecation warning for syntax in an input file.
const int THREE_BODY_RXN
A gas-phase reaction that requires a third-body collision partner.
std::string toLowerCopy(const std::string &input)
Convert to lower case.
shared_ptr< ReactionRate > newReactionRate(const std::string &type)
Create a new empty ReactionRate object.
void readFalloff(FalloffReaction2 &R, const XML_Node &rc_node)
Parse falloff parameters, given a rateCoeff node.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
const int ELEMENTARY_RXN
A reaction with a rate coefficient that depends only on temperature and voltage that also obeys mass-...
const double GasConstant
Universal Gas Constant [J/kmol/K].
const int INTERFACE_RXN
A reaction occurring on an interface, e.g a surface or edge.
void setupChemicallyActivatedReaction(ChemicallyActivatedReaction2 &, const XML_Node &)
size_t getFloatArray(const XML_Node &node, vector_fp &v, const bool convert=true, const std::string &unitsString="", const std::string &nodeName="floatArray")
This function reads the current node or a child node of the current node with the default name,...
void warn_user(const std::string &method, const std::string &msg, const Args &... args)
Print a user warning raised from method as CanteraWarning.
const int CHEMACT_RXN
A chemical activation reaction.
unique_ptr< Reaction > newReaction(const std::string &type)
Create a new empty Reaction object.
doublereal fpValueCheck(const std::string &val)
Translate a string into one doublereal value, with error checking.
const int FALLOFF_RXN
The general form for a gas-phase association or dissociation reaction, with a pressure-dependent rate...
void tokenizeString(const std::string &oval, std::vector< std::string > &v)
This function separates a string up into tokens according to the location of white space.
const U & getValue(const std::map< T, U > &m, const T &key, const U &default_val)
Const accessor for a value in a std::map.
compositionMap parseCompString(const std::string &ss, const std::vector< std::string > &names=std::vector< std::string >())
Parse a composition string into a map consisting of individual key:composition pairs.
Contains declarations for string manipulation functions within Cantera.
Modifications to an InterfaceReaction2 rate based on a surface species coverage.
Unit aggregation utility.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...