# Why $\log \rho$ in the continuity equation?

I just saw the continuity equation, in a manuscript, written as $$\frac{\partial \log \rho }{\partial t} + \vec v \cdot \nabla \log \rho= - \nabla \cdot \vec v.$$ Now, just calculating the derivatives of $\log$, and multiplying by $\rho$, this comes back to the familiar $$\frac{\partial \rho }{\partial t} + \nabla \cdot (\rho \vec v)= 0.$$ But I am curious: what would be the reason to write it in that log-form?

The log-form also appears on page 53 (pdf page 69) in this manual. And page 2 here explains about the same as tpg2114's answer.

• It would probably be easier to determine if we saw the context in which this was written. – kleingordon Oct 5 '12 at 6:23

Without seeing the manuscript in question, the most obvious reason why is when extremely large ranges of density are expected. If the density varies by orders of magnitude, say in an astrophysics setting, then the log form would keep the numbers in similar scale making it more numerically tractable.

Similar treatment is done for the partial density equations in chemically reacting flows.

I) The first equation in the question(v1) shows that the material derivative of $\ln\rho$ satisfies

$$\frac{D \ln\rho }{D t} ~=~ - \nabla \cdot \vec v.$$

In particular, in an incompressible fluid, the velocity field is divergence-free $$\nabla \cdot \vec v~=~0.$$

Why the variable $\ln\rho$ as opposed to $\rho$?

II) In addition to tpg2114's correct argument that the density may vary over several decades, there is also the argument that in numerical calculations, it is preferred to work with a real variable $\ln\rho\in \mathbb{R}$ (as opposed to a positive variable $\rho>0$), because if one uses $\rho$ as a variable in a computer code, then small numerical errors may accidentally conspires to yield a faulty negative density $\rho<0$, while working with the variable $\ln\rho$ in a computer code would automatically guarantee a manifestly positive density.

• I updated the answer. – Qmechanic Oct 5 '12 at 16:52

In addition to the two great answers above, there's one more context I've encountered in which the log representation is useful.

Often in self-similar problems, some analytical solutions may be obtained by guessing a solution that has the form of a power law in some self-similar variable. The log representation makes it possible to manipulate the equations with ease, allowing one to find the exponents and thus the solution.

If you're interested, have a look at the following, http://en.wikipedia.org/wiki/Similarity_solution There are several analytic solutions for the case of the point explosion with density profile $\rho=\kappa r^{-\omega}$ for specific values of $\omega$ (Can't find the reference to the textbooks it shows up in, sorry)