Description
Problem description
Both 'legacy' and 'new' frameworks copy reaction rate objects into contiguous arrays of objects that are evaluated by Kinetics
specializations (as all objects are in consecutive memory, access is efficient). As a result, it is necessary to use a modifyReaction
route to change parameters, etc.. In addition, it is also not possible to query internal states of the rate object from a Reaction
that was used to originally create the rate.
Behavior
The new framework being introduced in 2.6 allows for a more uniform access to Reaction
and ReactionRate
objects, but currently does not synchronize parameters and internal states once a Reaction
is added to a Kinetics
object. A user attempting to query any information will always access internal states of the original copy owned by Reaction
, and is unable to access the copy used for evaluation (see, e.g. discussion in #1181).
System information
- Cantera version: 2.6.0a4
- OS: any
- Python/MATLAB/other software versions: N/A
Additional context
Potential solutions.
- Use a single copy of a
ReactionRate
object - Keep copies synchronized (see proof-of-concept in Proof-of-concept: Modify reaction rates in memory #1051)
As long as performance is comparable, solution (1) is preferable. Notably, the Python API requires shared_ptr
s for access, which may create additional overhead. Also see blog post, which indicates that (2) is likely to outperform (1).