You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the reaction parser works, but it's sloppy. It is done entirely with C++ string parsing by identifying specific tokens and splitting each reaction one by one for loops. Each product and reactant for every reaction is recorded by looking for an exact string match, and the stoichiometric coefficient is implemented by tallying the number of times the exact match appears on each side of the equation. Accordingly, each kernel is named for the number of reactants it includes: FirstOrderReactant, SecondOrderReactant, FirstOrderProduct, SecondOrderProduct, etc... Besides being pretty misleading, this comes with a host of obvious problems:
Stoichiometric coefficients are included by writing out the number of reactants/products; e.g. e + Ar -> 2e + Ar+ must be written as "e + Ar -> e + e + Ar+". It is cumbersome to have to write out every reactant and product; imagine having a fake "reaction" (an empirical formula meant to simulate photoionization, for example) made up of dozens of products and reactants - writing such a formula out would be both obnoxious and prone to errors.
In a related matter, the above assumes order and stoichiometry are the same. This is not always the case, though it is usually true for typical plasma systems. No fractional orders are allowed.
There is really no need to have so many kernels...one product and reactant kernel with a loop in the constructor to count the number of reactants and multiply them together should be sufficient.
SOLUTIONS:
A better parser that allows a reaction with "2e" to be read as "e + e".
Modified kernels to include stoichiometric coefficient as an exponent in std::pow.
(OPTIONAL) Better string parsing algorithm in general (possibly with Perl?).
Replacing kernels should be done with care. std::pow might incur a performance penalty.
The text was updated successfully, but these errors were encountered:
Currently the reaction parser works, but it's sloppy. It is done entirely with C++ string parsing by identifying specific tokens and splitting each reaction one by one for loops. Each product and reactant for every reaction is recorded by looking for an exact string match, and the stoichiometric coefficient is implemented by tallying the number of times the exact match appears on each side of the equation. Accordingly, each kernel is named for the number of reactants it includes: FirstOrderReactant, SecondOrderReactant, FirstOrderProduct, SecondOrderProduct, etc... Besides being pretty misleading, this comes with a host of obvious problems:
Stoichiometric coefficients are included by writing out the number of reactants/products; e.g. e + Ar -> 2e + Ar+ must be written as "e + Ar -> e + e + Ar+". It is cumbersome to have to write out every reactant and product; imagine having a fake "reaction" (an empirical formula meant to simulate photoionization, for example) made up of dozens of products and reactants - writing such a formula out would be both obnoxious and prone to errors.
In a related matter, the above assumes order and stoichiometry are the same. This is not always the case, though it is usually true for typical plasma systems. No fractional orders are allowed.
There is really no need to have so many kernels...one product and reactant kernel with a loop in the constructor to count the number of reactants and multiply them together should be sufficient.
SOLUTIONS:
Replacing kernels should be done with care. std::pow might incur a performance penalty.
The text was updated successfully, but these errors were encountered: