1
$\begingroup$

I am trying to build a Python code that solves a set of coupled differential equations which will be spatially discretized by the method of lines advancing in time. I am planning to use solve_ivp. In my problem, the conservation of species includes the product of gas density and mass fraction of species in the time derivative. My question is how do I handle multiple time-dependent variables in a single equation in solve_ivp?

one of the equations looks like

$$ \frac{\partial}{\partial t}\left(\varepsilon\rho_gY_i\right)+\mathrm{div}\left(\varepsilon\rho_gu_gY_i\right) = \mathrm{div}\left(D_\text{eff}\rho_g\overrightarrow{\mathrm{grad}}\left(Y_i\right)\right)+\dot{\omega_i} $$

$\endgroup$
1
  • 1
    $\begingroup$ See example Lotka-Volterra. It works in the same way. Stack them together in the output vector. Beware, that solve_ivp does not allow a matrix before the time derivative, such as $M \frac{d}{dt}f$ . $\endgroup$
    – Bort
    Commented Aug 1, 2023 at 6:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.