I'm trying to use finite difference to explicitly discretisize the following system:

$\frac{{\partial \rho }}{{\partial t}} = - \frac{{\partial \rho }}{{\partial x}}u - \rho \frac{{\partial u}}{{\partial x}}$

$\frac{{\partial u}}{{\partial t}} = - u\frac{{\partial u}}{{\partial x}} - \frac{\partial }{{\partial x}}\left[ {\frac{1}{{\sqrt \rho }}\frac{{{\partial ^2}(\sqrt \rho )}}{{\partial {x^2}}}} \right]$


$\rho (x,t)\,\,\,,\,\,\,u(x,t)$

But i'm having difficulties since the $\rho$ time derivative is dependent on $u$ as well! I don't know which time step of $u$ to insert (or vice-versa for the $u$ time derivative).

Can it be done with finite differences ?

Thanks !

  • $\begingroup$ Yes it can be done with finite differenes. A better way might be to use the method of lines and use an inbuilt ODE solver like the Matlabs ODE45 solver to do the time integration. $\endgroup$ Mar 23, 2017 at 23:44
  • $\begingroup$ I'm not familiar with the methods of lines. Can you indicate how to use the finite differences here ? $\endgroup$ Mar 24, 2017 at 7:51


You must log in to answer this question.