ReactionMechanismGenerator / ReactionMechanismSimulator.jl

The amazing Reaction Mechanism Simulator for simulating large chemical kinetic mechanisms
https://reactionmechanismgenerator.github.io/ReactionMechanismSimulator.jl
MIT License
74 stars 33 forks source link

Using ModelingToolkit.jl to get Optimized Symbolic Jacobians #69

Open mjohnson541 opened 4 years ago

mjohnson541 commented 4 years ago

ModelingToolkit.jl has the capability to take some julia derivative functions, extract the symbolic equations and symbolically generate an optimized and potentially multi-threaded version of the function. My guess is that given the size of the systems of equations we manipulate the symbolic manipulations are going to be time consuming enough it will be too clunky to use in most cases. However, if one is running a long enough calculation or a ton of calculations on the same system (uncertainty analysis or sensitivity analysis) the difference may be worth it.

We first need to explore if modeltoolkitize works on our derivative function, if not what it would take to make it work and second how long do the symbolic optimizations take and how much speed up does RMS get out of the optimizations.

If we get it working effectively the implementation itself should be relatively simple.

See: https://www.youtube.com/watch?v=UNkXNZZ3hSw and https://github.com/SciML/ModelingToolkit.jl

ChrisRackauckas commented 4 years ago

However, if one is running a long enough calculation or a ton of calculations on the same system (uncertainty analysis or sensitivity analysis) the difference may be worth it.

Also for sparsity. Color differentiation reduces the complexity a ton but with sparsity it'll never match analytical Jacobians.