Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporating the LMR-R mixture rule into Cantera for the first time #1710

Open
wants to merge 92 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
a9c300b
synced branch to upstream/main and then added in LMRR files
pjsingal Jun 11, 2024
b6f39ea
objs are now declared in setParameters. The code builds, but it doesn…
pjsingal Jun 12, 2024
677204d
Added LmrRate.h ReactionRateFactory.cpp
pjsingal Jun 12, 2024
7b203f3
added setContext. Scope issue remains w/ colliderIndices
pjsingal Jun 13, 2024
8bb6b6b
commented out a test line for colliderIndices left by mistake
pjsingal Jun 13, 2024
4dc14c5
bug fixed, code now builds
pjsingal Jun 13, 2024
47157b7
cleanups and minor debugs
pjsingal Jun 13, 2024
56f5687
Added my local test file dir to the gitignore
pjsingal Jun 14, 2024
a2aeecf
add bklab files to gitignore
pjsingal Jun 14, 2024
07ca746
add bklab test yamls to gitignore
pjsingal Jun 14, 2024
3771c70
updated gitignore again
pjsingal Jun 14, 2024
a16ac2f
removed kineticsfromscratch_LMRtest.yaml from remote tracking
pjsingal Jun 14, 2024
cbcaf98
tried to fix k_i_plog returning nan, but could not yet find solution
pjsingal Jun 14, 2024
9e259d3
added node_M to eig0 only case in setParams
pjsingal Jun 17, 2024
2f340a8
debugging
pjsingal Jun 17, 2024
94c9b28
rate units are not being calc properly for all rxns
pjsingal Jun 17, 2024
a11bca8
added "LMR_R" to ReactionPath.cpp
pjsingal Jun 17, 2024
b2ac4f9
Added LMR_R to Reaction.cpp
pjsingal Jun 17, 2024
8d1a9e4
didn't fix rate_units problem, but dramatically improved computationa…
pjsingal Jun 17, 2024
694e654
partial code cleanup
pjsingal Jun 17, 2024
0e5d184
attempt to reduce data obj definitions (doesn't yet work)
pjsingal Jun 17, 2024
f8811cc
reorganized data obj definition and updates
pjsingal Jun 18, 2024
aed0da2
found very inelegant solution to rate_unit problem
pjsingal Jun 18, 2024
61a8f57
fixed eig0 units (now dimless), made sigmaXM subtractive not additive
pjsingal Jun 18, 2024
b94273b
commented out unused member vars
pjsingal Jun 18, 2024
3d15f19
deleted redundant sigmaX_M calc
pjsingal Jun 18, 2024
0a7f891
Revert "Added LMR_R to Reaction.cpp"
pjsingal Jun 18, 2024
146d255
Revert "added "LMR_R" to ReactionPath.cpp"
pjsingal Jun 18, 2024
b3f8c51
runs, but the simulations look bad
pjsingal Jun 18, 2024
ea9bec1
very minor updates
pjsingal Jun 20, 2024
29ed38c
restructured k_Plog, K_troe, etc calc procedure, reorganized variable…
pjsingal Jun 24, 2024
7a9469b
added simulation scripts and test input
pjsingal Jun 25, 2024
e92f22b
incomplete attempt to fix unit problem for bimolec rxns
pjsingal Jun 25, 2024
0fd2802
fixed unit conv issue, but plots still incorrect
pjsingal Jun 26, 2024
f175464
logPeff now calc wrt eig0M, and sims now look great
pjsingal Jun 27, 2024
c0b6271
renamed eig0 to 'eps', representing 3-body collision eff and not ME e…
pjsingal Jun 28, 2024
0188c43
renamed eig0 to eps in test yamls
pjsingal Jun 28, 2024
4a4a105
Code now successfully accepts either eig0 or eps input. eig0 then con…
pjsingal Jun 28, 2024
3a1fbd2
added validation code, improved eig0/eps robustness
pjsingal Jun 28, 2024
72729ea
big syntax simplification for eig0/eps feature
pjsingal Jun 28, 2024
82323ec
Latest and greatest version of code. Troe doesn't yet run though
pjsingal Jun 28, 2024
55d0e07
fixed node["type"] issue for LMRR-Troe rxns
pjsingal Jul 1, 2024
b7cdf46
added troe params and fxns like conc_3b and molar_density
pjsingal Jul 1, 2024
9b5bfca
added conc3b_eff and changed kTP type selection
pjsingal Jul 1, 2024
858cc5a
undid edit to falloff.cpp
pjsingal Jul 1, 2024
e3b0224
some debugs
pjsingal Jul 1, 2024
0e38a13
troe still doesn't work yet
pjsingal Jul 1, 2024
eb89fcb
started trying to manually implement troe evalfromstruct
pjsingal Jul 1, 2024
b2af8c0
fixed effective concentration issue for troe
pjsingal Jul 2, 2024
476983c
reinstated duck typing
pjsingal Jul 2, 2024
57d3103
LmrRate code now complete, validated, and formatted
pjsingal Sep 4, 2024
627f01e
added LMRR cantera examples
pjsingal Sep 4, 2024
d235df6
added Alzueta and Alzueta-LMRR example data
pjsingal Sep 4, 2024
de21cc4
Added LMR-R description to rate-constants.md
pjsingal Sep 4, 2024
01c0f6a
deleted irrelevant scripts specific to Burke Lab
pjsingal Sep 4, 2024
54cf13e
deleted yamls used internally for validation
pjsingal Sep 4, 2024
5416f7c
changed "LmrRate" to "LinearBurkeRate", "LMR_R" to "linear-burke"
pjsingal Sep 4, 2024
d603793
added linear burke rate to LMRR description
pjsingal Sep 4, 2024
ce1433d
added alzueta LMRR example data
pjsingal Sep 4, 2024
a66e85e
updated jet-stirred reactor example
pjsingal Sep 4, 2024
1e8c1f7
more syntax updates to JSR example
pjsingal Sep 4, 2024
d4d287b
fixed syntax error in JSR
pjsingal Sep 4, 2024
7d6f94a
Reset googletest folder to upstream main
pjsingal Sep 4, 2024
a91dc57
reset example_data to upstream main
pjsingal Sep 4, 2024
9f2d582
removed time-history functions from JSR example
pjsingal Sep 4, 2024
7fceded
added newlines to ends of examples, fixed whitespace
pjsingal Sep 4, 2024
069c504
added newlines to ends of lmrr scripts
pjsingal Sep 4, 2024
c159659
fixed flame speed example indentation
pjsingal Sep 4, 2024
3e9d52c
shortened alzueta_LMRR by importing alzueta.yaml
pjsingal Sep 4, 2024
ba12286
added newline to end of gitignore
pjsingal Sep 5, 2024
780c996
added description to alzueta_LMRR.yaml
pjsingal Sep 5, 2024
1db9b11
added description to alzueta.yaml
pjsingal Sep 5, 2024
2d861e9
fixed whitespace errors in examples
pjsingal Sep 5, 2024
c513999
fixed keyword errors in examples
pjsingal Sep 5, 2024
d441a43
added titles to each example
pjsingal Sep 5, 2024
27ec8dd
removed sys.path.append from examples
pjsingal Sep 5, 2024
3f76be8
replaced NH3/H2 with pure NH3 to simplify fspeed example
pjsingal Sep 5, 2024
4b50e65
updated keywords of IDT and JSR example
pjsingal Sep 5, 2024
cd26c9a
changed sec header to "linear-burke" in rate-constants.md
pjsingal Sep 5, 2024
25a6a05
removed junk comments from alzueta_LMRR.yaml
pjsingal Sep 5, 2024
b702e3f
Added description of linear-burke YAML format
pjsingal Sep 5, 2024
4fb48ed
Added link to linear-burke YAML guide in rate-constants.md
pjsingal Sep 5, 2024
632ecca
updated YAML description examples
pjsingal Sep 5, 2024
cae5721
fixed formatting of yaml examples
pjsingal Sep 5, 2024
044cb2b
Added citation to Eq8 of paper
pjsingal Sep 5, 2024
3e57ba9
fixed formatting issues
pjsingal Sep 5, 2024
d355c9e
reordered yaml description
pjsingal Sep 5, 2024
b000624
Revert "reordered yaml description"
pjsingal Sep 5, 2024
d4373af
removed whitespace errors
pjsingal Sep 6, 2024
bf1e7b3
added to example-keywords.txt
pjsingal Sep 6, 2024
bd6f480
updated keywords in examples
pjsingal Sep 6, 2024
0eb6e58
added singal2024 placeholder to cantera.bib and updated citation in L…
pjsingal Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,700 changes: 1,700 additions & 0 deletions data/alzueta.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mechanism is a good candidate for moving to the separate example_data repository (https://github.com/Cantera/cantera-example-data).

I appreciate the effort to at least share the species data between the two versions of the mechanism, but I'd like to suggest going a step further, and sharing the reactions that they have in common as well. To do this, you would need to divide the reactions into three sections in the input file: one for the shared reactions (named for example common), one for the baseline mechanism's pressure-dependent reactions (named for example baseline-pdep), and one for the reactions implemented using the linear-Burke rate model (named linear-Burke). Then, you can put two phase definitions in the file, one which specifies the reactions as reactions: [common, baseline-pdep] and the other that specifies the reactions as reactions: [common, linear-Burke].

Large diffs are not rendered by default.

899 changes: 899 additions & 0 deletions data/alzueta_LMRR.yaml

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions doc/doxygen/cantera.bib
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,17 @@ @online{smith1999
and W.~C.~Gardiner, Jr. and V.~V.~Lissianski and Z.~Qin},
url = {http://combustion.berkeley.edu/gri-mech/version30/text30.html},
year = {1999}}
@article{singal2024,
author = {P.~J.~Singal and J.~Lee and L.~Lei and R.~L.~Speth and M.~P.~Burke},
journal = {Proceedings of the Combustion Institute},
number = {40},
pages = {TBD},
title = {Implementation of New Mixture Rules Has a Substantial Impact on
Combustion Predictions for H2 and NH3},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Combustion Predictions for H2 and NH3},
Combustion Predictions for {H2} and {NH3}},

doi = {TBD},
url = {TBD},
volume = {TBD},
year = {2024}}
Comment on lines +437 to +447
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the usual publication schedule, I assume this should be 2025, which will also match your @cite annotations in the code.

@article{stewart1989,
author = {P.~H.~Stewart and C.~W.~Larson and D.~Golden},
journal = {Combustion and Flame},
Expand Down
5 changes: 5 additions & 0 deletions doc/example-keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ fuel cell
heat transfer
ignition delay
internal combustion engine
jet-stirred reactor
kinetics
Matlab
mixture
mixture rule
multicomponent transport
Comment on lines +25 to 26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is going to be a well-understood keyword to most users, and I'd recommend just leaving it out.

multiphase
non-ideal fluid
Expand All @@ -41,6 +43,9 @@ saving output
sensitivity analysis
strained flame
surface chemistry
shock tube
species profile
temperature profile
Comment on lines +47 to +48
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend dropping these two keywords as well

thermodynamic cycle
thermodynamics
transport
Expand Down
55 changes: 55 additions & 0 deletions doc/sphinx/reference/kinetics/rate-constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,61 @@ Chebyshev reactions can be defined in the YAML format using the
[`Chebyshev`](sec-yaml-Chebyshev) reaction `type`.
```

(sec-linear-burke)=
## Linear Burke Rate Expressions

Linear Burke rate expressions employ the reduced-pressure linear mixture rule (LMR-R). This mixture rule is used to evaluate the rate constants of complex-forming reactions, and is a mole-fraction-weighted sum of the bath gas rate constants (when pure) evaluated at the reduced pressure ($R$) and temperature ($T$) of the mixture.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line wrap to 88 characters everywhere.


$$
k_{\text{LMR-R}}(T,P,\textit{\textbf{X}}) = \sum_{i} k_{i}(T,R_{\text{LMR}})\tilde{X}_{i,\text{LMR}}
$$

Comment on lines +243 to +246
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look at the rendered HTML -- MathJax does not like this approach for getting a bold, italic symbol. I think you might want to try \boldsymbol.

where the reduced pressure, $R$, in its most general form

$$
R_{\text{LMR}}(T,P,\textit{\textbf{X}}) = \frac{\sum_{i} \Lambda_{0,i}(T)X_i[M]}{\Lambda_{\infty}(T)}
$$

and the fractional contribution of each component to the reduced pressure, $\tilde{X}_{i}$

$$
\tilde{X}_{i,\text{LMR}}(T,P,\textit{\textbf{X}})=\frac{\Lambda_{0,i}(T)X_i}{\sum_{j} \Lambda_{0,j}(T)X_j}
$$

can be cast in terms of the absolute value of the least negative chemically significant eigenvalue of the master equation for the $i^{th}$ collider (when pure) in the low-pressure limit, $\Lambda_{0,i}(T)[M]$, and high-pressure limit, $\Lambda_{\infty}(T)$, and $[M]$ is the total concentration.

Evaluating all rate constants at the reduced pressure ($R$)---instead of the pressure ($P$)---of the mixture takes advantage of the fact that rate constants (and their chemically significant eigenvectors) for different colliders are usually far more similar at the same $R$ than the same $P$. In practice, since rate constants are usually expressed with respect to pressure $P$ (which has units of Pa, Torr, bar, atm, etc.) rather than reduced pressure $R$ (which is dimensionless), one needs to find the effective pressure for the $i^{th}$ collider, $P_{i}^{\text{ eff}}$ (with units of $P$), such that the reduced pressure of pure collider $i$ is equal to the reduced pressure of the mixture, which can be shown to be
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the rates where you need an effective pressure (PLog and Chebyshev), there is also the Troe case where what you need is an effective third body concentration. Might also be worth explaining how this is handled.


$$
P_{i,\text{LMR}}^{\text{ eff}}(T,P,\textit{\textbf{X}}) = \frac{\sum_{j} \Lambda_{0,j}(T)X_j}{\Lambda_{0,i}(T)}P
$$

such that an alternate version of the generalized LMR-R equation can be written as

\begin{equation}
k_{\text{LMR-R}}(T,P,\textit{\textbf{X}}) = \sum_{i} k_{i}(T,P_{i,\text{LMR}}^{\text{ eff}})\tilde{X}_{i,\text{LMR}}
\label{eq:LMRR_k_P_i_eff}
\end{equation}

The user can either specify $k_i(T,P)$ and $\Lambda_{0,i}(T)$ for each collider, or specify the third-body efficiency, $\epsilon_{0,i}(T)$, for each non-M collider and assign $\epsilon_{0,\text{M}}(T)=1$. The pressure-dependent aspect of each i-th collider ($k_i(T,P)$) can be specified in any combination of Troe, PLOG, or Chebyshev formats for colliders for which data are available and $\Lambda_{0,i}(T)$ for each collider (or $\epsilon_{0,i}(T)$ for each non-M collider) can be specified in modified Arrhenius format for colliders for which data are available.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This discussion of $\epsilon$ is somewhat confusing, as there's no indication of how a value for $\epsilon$ is used in place of $k_i(T,P)$ and $\Lambda_{0,i}(T)$.

Is it necessary for the user to assign $\epsilon_{0,\text{M}}(T)=1$, or is that simply true by definition?


In fact, if $\Lambda_{0,i}(T)$ (or $\epsilon_{0,i}(T)$) for any colliders have available data or can be estimated using typical values (as is typically done in kinetic models for reactions in modified Lindemann expressions) but no data for $k_i(T,P)$ are available, this implementation also allows some colliders to be specified with unique $\Lambda_{0,i}(T)$ (or $\epsilon_{0,i}(T)$) without $k_i(T,P)$, by assuming the same reduced-pressure dependence as M (i.e. $k_{i}(T,R)=k_{M}(T,R)$). Cantera employs the following derived form of the generalized LMR-R equation, where the sum over $n$ is only for the colliders for which unique $k_n(T,P)$ are available. If unique $k_i(T,P)$ data are available for all colliders, then the second term in the above equation effectively disappears.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What "second term" in the above equation?


$$
k_{\text{LMR-R}}(T,P,\textit{\textbf{X}}) &= \sum_{n} k_{n}(T,P_{n,\text{LMR}}^{\text{ eff}})\tilde{X}_{n,\text{LMR}} + k_{M}(T,P_{M,\text{LMR}}^{\text{ eff}}) \left(1-\sum_{n}\tilde{X}_{n,\text{LMR}}\right)
$$

Comment on lines +278 to +281
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This equation does not render -- there is some syntax error.

If the user has limited or incomplete access to parameter inputs (a likely scenario, given the scarcity of puplished third-body efficiencies and master equation eigenvalues), this computational implementation allowes them much greater flexibility and power to make educated assumptions. Further description of the LMR-R theory and computational method is available in {cite:t}`singal2024`.

```{admonition} YAML Usage
:class: tip
Linear Burke rate expressions can be defined in the YAML format using the
[`linear-burke`](sec-yaml-linear-burke) reaction `type`.
```

```{versionadded} 3.1
```

(sec-blowers-masel)=
## Blowers-Masel Reactions

Expand Down
112 changes: 112 additions & 0 deletions doc/sphinx/yaml/reactions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,118 @@ Example::
[-1.43220e-01, 7.71110e-02, 1.27080e-02, -6.41540e-04]]


.. _sec-yaml-linear-burke:

``linear-burke``
-------------

A complex-forming reaction (one that depends on both P and X) parameterized
according to the reduced-pressure linear mixture rule as
:ref:`described here <sec-linear-burke>`.

Additional fields are:

``collider-list``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest naming this just colliders.

A list of dictionaries, where each entry contains parameters corresponding
to individual colliders (species in the bath gas).

``collider``
The name of the collider species, which must be entered inside quotations (e.g.,
``"H2O"``). The first collider defined must be ``"M"``, which represents the generic
Comment on lines +415 to +417
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest name instead of collider here. Also, I don't think there is any requirement to use quotes on the species name.

reference collider (often ``Ar`` or ``N2``) that represents all species lacking their
own explicit parameterization.

``eps`` or ``eig0``
The fractional contribution of each bath gas component (collider) to the reduced
pressure. ``eps`` represents the third-body efficiency of the collider relative
Comment on lines +421 to +423
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit confusing, and I think there's some room for simplification.

In the case of providing "eps" values, I think this should simply be named "efficiency" if this value is indeed interpretable as an efficiency.

Since eig0 is not a "fractional" contribution, I'd list it as a separate option, though that will require adjusting where you explain the need for all species to use the same choice of providing either eig0 or a relative efficiency.

to that of the reference collider ``"M"`` (``eps: {A:1, b:0, Ea: 0}`` must be provided for
``"M"`` by necessity). ``eig0`` represents the absolute value of the least negative chemically
significant eigenvalue of the master equation, evaluated for a collider at its low-pressure
limit. All explicitly defined colliders must include either ``eps`` or ``eig0``, but the choice
must remain consistent throughout a single reaction (either all colliders are defined with ``eps``,
or all are defined with ``eig0``). In both cases, the parameters are entered in Arrhenius format to
enable representation of their temperature-dependence.

The pressure-dependent aspect of the rate constant can be parameterized in the user's choice of
:ref:`Troe <sec-yaml-falloff>`,
:ref:`pressure-dependent-arrhenius <sec-yaml-pressure-dependent-Arrhenius>`, or
:ref:`Chebyshev <sec-yaml-Chebyshev>` representations. The same parameters used for a standalone
Troe, PLOG, or Chebyshev reaction are then inserted directly below ``eps`` or ``eig0`` for a given collider
(note: Troe cannot be given its own ``efficiencies`` key). At minimum, this treatment must be applied to ``"M"``.
However, additional colliders may also be given their own Troe, PLOG, or Chebyshev
parameterization if so desired. Mixing and matching of types within the same reaction is allowed (e.g., a PLOG
table for ``"M"``, Troe parameters for ``"H2"``, and Chebyshev data for ``"NH3"``).

A mathematical description of this YAML implementation can be found in Eq. 8 of
:cite:t:`singal2024`.

Examples::

equation: H + OH <=> H2O
type: linear-burke
collider-list:
- collider: 'M' # N2 is reference collider (Troe format)
eps: {A: 1, b: 0, Ea: 0}
low-P-rate-constant: {A: 4.530000e+21, b: -1.820309e+00, Ea: 4.987000e+02}
high-P-rate-constant: {A: 2.510000e+13, b: 2.329303e-01, Ea: -1.142000e+02}
Troe: {A: 9.995044e-01, T3: 1.0e-30, T1: 1.0e+30}
- collider: 'AR'
eps: {A: 2.20621e-02, b: 4.74036e-01, Ea: -1.13148e+02}
- collider: 'H2O'
eps: {A: 1.04529e-01, b: 5.50787e-01, Ea: -2.32675e+02}

equation: H + O2 (+M) <=> HO2 (+M) # Including "(+M)" is optional
type: linear-burke
collider-list:
- collider: "M" # Argon is reference collider (PLOG format)
eps: {A: 1, b: 0, Ea: 0}
rate-constants:
- {P: 1.316e-02 atm, A: 9.39968e+14, b: -2.14348e+00, Ea: 7.72730e+01}
- {P: 1.316e-01 atm, A: 1.07254e+16, b: -2.15999e+00, Ea: 1.30239e+02}
- {P: 3.947e-01 atm, A: 3.17830e+16, b: -2.15813e+00, Ea: 1.66994e+02}
- {P: 1.000e+00 atm, A: 7.72584e+16, b: -2.15195e+00, Ea: 2.13473e+02}
- {P: 3.000e+00 atm, A: 2.11688e+17, b: -2.14062e+00, Ea: 2.79031e+02}
- {P: 1.000e+01 atm, A: 6.53093e+17, b: -2.13213e+00, Ea: 3.87493e+02}
- {P: 3.000e+01 atm, A: 1.49784e+18, b: -2.10026e+00, Ea: 4.87579e+02}
- {P: 1.000e+02 atm, A: 3.82218e+18, b: -2.07057e+00, Ea: 6.65984e+02}
- collider: "HE"
eps: {A: 3.37601e-01, b: 1.82568e-01, Ea: 3.62408e+01}
- collider: "N2"
eps: {A: 1.24932e+02, b: -5.93263e-01, Ea: 5.40921e+02}
- collider: "H2"
eps: {A: 3.13717e+04, b: -1.25419e+00, Ea: 1.12924e+03}
- collider: "CO2"
eps: {A: 1.62413e+08, b: -2.27622e+00, Ea: 1.97023e+03}
- collider: "NH3"
eps: {A: 4.97750e+00, b: 1.64855e-01, Ea: -2.80351e+02}
- collider: "H2O"
eps: {A: 3.69146e+01, b: -7.12902e-02, Ea: 3.19087e+01}

equation: H2O2 <=> 2 OH
type: linear-burke
collider-list:
- collider: 'M' # Argon is reference collider (Chebyshev format)
eps: {A: 1, b: 0, Ea: 0}
temperature-range: [200.0, 2000.0]
pressure-range: [1.000e-01 atm, 1.000e+02 atm]
data:
- [-1.5843e+01, 8.7088e-01, -9.4364e-02, -2.8099e-03, -4.4803e-04, 1.5809e-03, -2.5088e-04]
- [2.3154e+01, 5.2739e-01, 2.8862e-02, -5.4601e-03, 7.0783e-04, -3.0282e-03, 7.8121e-04]
- [-3.8008e-01, 8.6349e-02, 4.0292e-02, -7.2269e-03, 5.7570e-04, 2.7944e-03, -1.4912e-03]
- [-1.4800e-01, -7.1798e-03, 2.2052e-02, 6.2269e-03, -5.9801e-03, -8.2205e-06, 1.9243e-03]
- [-6.0604e-02, -1.4203e-02, 1.3414e-03, 9.6228e-03, 1.7002e-03, -3.6506e-03, -4.3168e-04]
- [-2.4557e-02, -9.7102e-03, -5.8753e-03, 3.0456e-03, 5.8666e-03, 1.5037e-03, -2.0073e-03]
- [-1.5400e-02, -5.2427e-03, -6.9148e-03, -5.9440e-03, -1.2183e-03, 2.1694e-03, 1.5925e-03]
- collider: 'N2'
eps: {A: 1.14813e+00, b: 4.60090e-02, Ea: -2.92413e+00}
- collider: 'CO2'
eps: {A: 8.98839e+01, b: -4.27974e-01, Ea: 2.41392e+02}
- collider: 'H2O2'
eps: {A: 6.45295e-01, b: 4.26266e-01, Ea: 4.28932e+01}
- collider: 'H2O'
eps: {A: 1.36377e+00, b: 3.06592e-01, Ea: 2.10079e+02}


.. _sec-yaml-interface-Arrhenius:

``interface-Arrhenius``
Expand Down
140 changes: 140 additions & 0 deletions include/cantera/kinetics/LinearBurkeRate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
//! @file LINEARBURKERATE.h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The capitalization here should match the capitalization of the file name -- otherwise, Doxygen issues a warning.

// This file is part of Cantera. See License.txt in the top-level directory or
// at https://cantera.org/license.txt for license and copyright information.

#ifndef CT_LINEARBURKERATE_H
#define CT_LINEARBURKERATE_H
#include "cantera/kinetics/Arrhenius.h"
#include <boost/variant.hpp>
#include "cantera/kinetics/Falloff.h"
#include "cantera/kinetics/ChebyshevRate.h"
#include "cantera/kinetics/PlogRate.h"

namespace Cantera
{

//! Data container holding shared data specific to LinearBurkeRate
/**
* The data container `LmrData` holds precalculated data common to
* all `LinearBurkeRate` objects.
*/
struct LmrData : public ReactionData
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of this class should also be changed to something less obscure -- LinearBurkeData would be consistent with the pattern that we use with the other rates and their corresponding data classes.

{
LmrData();

void update(double T, double P) override

Check warning on line 25 in include/cantera/kinetics/LinearBurkeRate.h

View check run for this annotation

Codecov / codecov/patch

include/cantera/kinetics/LinearBurkeRate.h#L25

Added line #L25 was not covered by tests
{
ReactionData::update(T);
pressure = P;
logP = std::log(P);

Check warning on line 29 in include/cantera/kinetics/LinearBurkeRate.h

View check run for this annotation

Codecov / codecov/patch

include/cantera/kinetics/LinearBurkeRate.h#L27-L29

Added lines #L27 - L29 were not covered by tests
}

bool update(const ThermoPhase& phase, const Kinetics& kin) override;

using ReactionData::update;

//! Perturb pressure of data container
/**
* The method is used for the evaluation of numerical derivatives.
* @param deltaP relative pressure perturbation
*/
void perturbPressure(double deltaP);

void restore() override;

virtual void resize(size_t nSpecies, size_t nReactions, size_t nPhases) override

Check warning on line 45 in include/cantera/kinetics/LinearBurkeRate.h

View check run for this annotation

Codecov / codecov/patch

include/cantera/kinetics/LinearBurkeRate.h#L45

Added line #L45 was not covered by tests
{
moleFractions.resize(nSpecies, NAN);
ready = true;

Check warning on line 48 in include/cantera/kinetics/LinearBurkeRate.h

View check run for this annotation

Codecov / codecov/patch

include/cantera/kinetics/LinearBurkeRate.h#L47-L48

Added lines #L47 - L48 were not covered by tests
}

void invalidateCache() override

Check warning on line 51 in include/cantera/kinetics/LinearBurkeRate.h

View check run for this annotation

Codecov / codecov/patch

include/cantera/kinetics/LinearBurkeRate.h#L51

Added line #L51 was not covered by tests
{
ReactionData::invalidateCache();
pressure = NAN;

Check warning on line 54 in include/cantera/kinetics/LinearBurkeRate.h

View check run for this annotation

Codecov / codecov/patch

include/cantera/kinetics/LinearBurkeRate.h#L53-L54

Added lines #L53 - L54 were not covered by tests
}

double pressure = NAN; //!< Pressure
double logP = 0.0; //!< Logarithm of pressure
bool ready = false; //!< Boolean indicating whether vectors are accessible
vector<double> moleFractions;
int mf_number;

protected:
double m_pressure_buf = -1.0;
};


//! Pressure-dependent and composition-dependent reaction rate calculated
//! according to the reduced-pressure linear mixture rule (LMR-R) developed
//! at Columbia University. @cite singal2025 [CITATION NOT YET ACTIVE]
/*!
* [ADD IN THE MATHEMATICAL FORMULA]
*/
class LinearBurkeRate final : public ReactionRate
{
public:
//! Default constructor.
LinearBurkeRate() = default;

//! Constructor from Arrhenius rate expressions at a set of pressures
explicit LinearBurkeRate(const std::multimap<double, ArrheniusRate>& rates);
Comment on lines +80 to +81
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constructor is declared, but not defined -- I think this is just copypasta from PlogRate and can be deleted.


LinearBurkeRate(const AnyMap& node, const UnitStack& rate_units={});

unique_ptr<MultiRateBase> newMultiRate() const override {
return make_unique<MultiRate<LinearBurkeRate, LmrData>>();

Check warning on line 86 in include/cantera/kinetics/LinearBurkeRate.h

View check run for this annotation

Codecov / codecov/patch

include/cantera/kinetics/LinearBurkeRate.h#L85-L86

Added lines #L85 - L86 were not covered by tests
}

//! Identifier of reaction rate type
const string type() const override { return "linear-burke"; }

Check warning on line 90 in include/cantera/kinetics/LinearBurkeRate.h

View check run for this annotation

Codecov / codecov/patch

include/cantera/kinetics/LinearBurkeRate.h#L90

Added line #L90 was not covered by tests

//! Perform object setup based on AnyMap node information
/*!
* @param node AnyMap containing rate information
* @param rate_units Unit definitions specific to rate information
*/
void setParameters(const AnyMap& node, const UnitStack& rate_units) override;

void getParameters(AnyMap& rateNode, const Units& rate_units) const;
void getParameters(AnyMap& rateNode) const override {
return getParameters(rateNode, Units(0));

Check warning on line 101 in include/cantera/kinetics/LinearBurkeRate.h

View check run for this annotation

Codecov / codecov/patch

include/cantera/kinetics/LinearBurkeRate.h#L100-L101

Added lines #L100 - L101 were not covered by tests
}
Comment on lines +99 to +102
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just implement the version that doesn't take a Units object directly and skip providing this other overload of getParameters.


//! Evaluate overall reaction rate, using Troe/PLOG/Chebyshev to evaluate
//! pressure-dependent aspect of the reaction
/*!
* @param shared_data data shared by all reactions of a given type
*/
using RateTypes = boost::variant<PlogRate, TroeRate, ChebyshevRate>;
using DataTypes = boost::variant<PlogData, FalloffData, ChebyshevData>;
double evalPlogRate(const LmrData& shared_data, DataTypes& dataObj, RateTypes& rateObj);
double evalTroeRate(const LmrData& shared_data, DataTypes& dataObj, RateTypes& rateObj);
double evalChebyshevRate(const LmrData& shared_data, DataTypes& dataObj, RateTypes& rateObj);
double evalFromStruct(const LmrData& shared_data);

void setContext(const Reaction& rxn, const Kinetics& kin) override;

void validate(const string& equation, const Kinetics& kin) override;

vector<size_t> colliderIndices;
map<string, AnyMap> colliderInfo;
Comment on lines +120 to +121
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every member variable should have a Doxygen docstring (//! ... on the line before, or //!< ... at the end of the line if the description is short enough to fit in the 88 character line width).

// Third-body collision efficiency objects (eps = eig0_i/eig0_M)
// epsObjs1 used for k(T,P,X) and eig0_mix calculation
// epsObjs2 used for logPeff calculation
vector<ArrheniusRate> epsObjs1;
vector<ArrheniusRate> epsObjs2;
vector<string> colliderNames;
vector<RateTypes> rateObjs;
vector<DataTypes> dataObjs;
RateTypes rateObj_M;
DataTypes dataObj_M;
// Third-body collision efficiency object for M (eig0_M/eig0_M = 1)
ArrheniusRate epsObj_M;
size_t nSpecies;
double logPeff_;
double eps_mix;
};

}
#endif
4 changes: 4 additions & 0 deletions interfaces/cython/cantera/reaction.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ cdef extern from "cantera/kinetics/PlogRate.h" namespace "Cantera":
CxxPlogRate(multimap[double, CxxArrheniusRate])
multimap[double, CxxArrheniusRate] getRates()

cdef extern from "cantera/kinetics/LinearBurkeRate.h" namespace "Cantera":
cdef cppclass CxxLinearBurkeRate "Cantera::LinearBurkeRate" (CxxReactionRate):
CxxLinearBurkeRate()
CxxLinearBurkeRate(CxxAnyMap) except +translate_exception

cdef extern from "cantera/kinetics/ChebyshevRate.h" namespace "Cantera":
cdef cppclass CxxChebyshevRate "Cantera::ChebyshevRate" (CxxReactionRate):
Expand Down
Loading
Loading