Consider the same governing equations as in 2.2 but now for general multicomponent kinetics (non first-order). When the convection term is taken explicitly in time values of can be computed from the concentration values of the previous time step, . With the reaction term implicit, we have in each cell the implicit equation
So, for the new concentrations in each cell, a root-seeking problem needs to be solved:
To solve the root-seeking problem, you can use the SciPy method optimize.root, or the newton method from pymrm. For the newton function you need to supply the Jacobian (by means of a function argument that returns and its Jacobian). You can use the function numjac_local from pymrm to compute the Jacobian. (For optimize.root the Jacobian is optional and needs to be full, while in pymrm we use mostly sparse matrices.)
Questions:
Repeat the case of exercise 2.2 with this general method. Does it give the same results?
Implement a system non-linear reactions. For example:
This is the famous Brusselator (see Wikipedia). Here components and are present in access and thus constant. The kinetics is usually written down in a dimensionless form with all reaction coefficient equal to 1. Suggested inlet concentrations are: , , , and for case two: , , , .