I'm trying to do discretization to 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]$

with the boundary conditions:

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

For the first equation everything is good:

$\frac{{\rho _i^{n + 1} - \rho _i^n}}{{\Delta t}} = - \frac{{\rho _{i + 1}^n - \rho _i^n}}{{\Delta x}}u_i^n - \rho _i^n\frac{{u_{i + 1}^n - u_i^n}}{{\Delta x}}$

And I can explicitly solve for $\rho _i^{n + 1}$.

But for the second equation. i'm struggling with the term:

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

So my questions are as follows:

  1. Should I use the chain rule in a straight forward manner like this:

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

and afterwards discretize the derivatives using forward Euler like in the first equation ?

  1. If I'm using the approach above, how should I calculate the third derivative ?

  2. Should I use some other clever way to discretize the term ? maybe calculating the square root of $\rho$ before hand ? I don't know if it's more efficient that way

  • 2
    $\begingroup$ Regarding the third order derivative, if you're using finite differences you can check [Wikipedia]( en.m.wikipedia.org/wiki/Finite_difference_coefficient). $\endgroup$
    – nicoguaro
    Mar 26 '17 at 2:27
  • $\begingroup$ Thank you ! But my other questions remains standing $\endgroup$ Mar 26 '17 at 8:26
  • 1
    $\begingroup$ For your first question, why not use a change of variable? Let $$\alpha = \rho^{0.5}$$ and then write an equation for $$ \frac{\partial (\alpha)}{\partial t}$$ I think this would be the easiest way to proceed. Otherwise, using the chain rule straightforwardly like you did is indeed appropriate. Finally, regarding your last point, it might indeed better to have an other field which is defined as $\sqrt(\rho)$ and then do the approximation of this field. This will be good if you have an explicit scheme, in implicit this might be more problems than anything. $\endgroup$
    – BlaB
    Mar 29 '17 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.