# Can we simulate incompressible flows using the (slight) density changes to give pressure?

A common approach says an incompressible flow has velocity divergence of 0; use this to solve for pressure in the Navier Stokes momentum equation. Or, using the Helmholtz Decomposition "project" the zero divergence component of the velocity field.

Instead, can we treat the positive/negative divergence as expansion/compression, and obtain pressure from the gas equation? This seems straightforward, copying how nature does it. (Similar to the shallow water equations, where the depth of water gives hydrostatic pressure directly).

Is it simply naive? And worse than solving in terms of efficiency/accuracy/stability? But I haven't seen it discussed at all - and it might work well for some cases (though not the engineering/heliophysics applications where much of cfd seems to originate). I'm curious.

My understanding so far: an incompressible flow doesn't require that the fluid is incompressible. e.g. air is compressible, yet can be treated as an incompressible flow. This requires velocities in the fluid to have a magnitude much less than the speed of sound (pressure waves) in the fluid. The speed of sound doesn't directly cause the incompressibility, but indicates how stiff the fluid is; the strength of the elastic reaction to pressure. The ratio of fluid velocity to speed of sound is the Mach number $M$; the Cauchy number is $M^2$, and is the "ratio between inertial and the compressibility force (elastic force) in a flow". So I think that: if the pressure is transmitted more quickly than the fluid itself, we get an "incompressible flow".

BTW: I've mainly looked at cfd for computer animation, so I'm probably missing a lot.

• Look up numerical methods for the "Compressible Navier Stokes" equations. In essence, the answer is that yes, you do get pressure from density, and density is transported around using the usual advection equation. A full tutorial on doing this is too big for an answer here, but you'll find a ton of information out there. I'd suggest starting with the Euler equations, which are the invicid form of the compressible NS equations, and then baking in the viscosity second. – Tyler Olsen Apr 28 '17 at 11:24
• @TylerOlsen Thanks, that makes sense now you say it. I've heard compressible flow is more difficult (in some way...?) to simulate, so that's probably why it's not used. I was on the mobile site, now on desktop version, and suggestions are visible, some seem relevant, especially Can compressible flow solvers be used to solve incompressible flow? – hyperpallium Apr 28 '17 at 11:47
• It's not that compressible flow isn't used, it simply isn't common in certain contexts. It is ubiquitous in aerodynamics, where flow speeds approach (or exceed) the speed of sound in the fluid, which is a rule of thumb for when compressibility is important. Obviously, you have to use compressibility if you're interested in acoustics as well. – Tyler Olsen Apr 28 '17 at 12:24
• @TylerOlsen That's my limited computer animation context showing through. :) A different issue: I was thinking of small density variation that could be ignored in terms of density itself (true for air and water), but just use it to directly calculate the pressure (instead of expensive iterative solvers). Analogous to shallow water eq using depth as a kind of density (per 2d area). Probably, a very small timestep is needed for accuracy/stability. I'll edit my question. – hyperpallium Apr 28 '17 at 12:37
• The core issue when you have the density as a function of the pressure (+ other variables) is that this induces an equation of state. As soon as you have an equation of state, you will have a propagation of acoustic waves (and a speed of sound $c^2=\frac{\partial \rho }{\partial p}_{s}$ at constant entropy). If you have a accoustic waves, then your CFL conditions requires you to use (max (u+c,u-c)) and this can greatly decrease the time step. For this reason (among many others) compressible solvers generally perform poorly in the low Mach number limit. – BlaB Apr 28 '17 at 13:34

Water (and other fluids that are considered incompressible) are of course in reality compressible -- just not very much, at the pressures and speeds involved in the flow we are modeling. Within the ranges of pressures we consider, a good approximation is that $$\rho = \rho_0 (1+\alpha p)$$ where $\rho_0$ is the reference density at reference pressure, $p$ the dynamic pressure induces by the flow, and $\alpha$ the compressibility.

When we say that a fluid is incompressible, what we mean in practice is that $\alpha p$ (for typical pressures) is just much smaller than one, and so can be neglected. In other words, the mass conservation equation $$\partial_t \rho + \nabla \cdot (\rho \mathbf u) = 0$$ is well approximated by $$\nabla \cdot \mathbf u = 0.$$ But, because within the range we consider, $\rho$ and $p$ are linearly related, we can choose one or the other in the equations. In other words, if you really wanted to, you could write the Navier-Stokes equations as $$\partial_t \mathbf u + \mathbf u \cdot \nabla \mathbf u - \nu \Delta \mathbf u + \frac{1}{\alpha\rho_0} \nabla \rho = 0, \\ \nabla \cdot \mathbf u = 0,$$ and so work with velocity and density as primary variables. That would be uncommon, but equally valid. You would then compute the pressure from the density, rather than the other way around. We just choose the pressure in the usual formulation of the Navier-Stokes equation for convenience, and because it makes it clear that the pressure -- not a multiple of the density -- is a Lagrange multiplier for the incompressibility. But both formulations are reasonable.

• Thanks, that confirms I'm (at least partly) on track. Using that mass conservation equation, could I directly calculate the rate of change of density as $\partial_t \rho = - \nabla \cdot (\rho \mathbf u)$? (This is analogous to how the Shallow Water equations calculate water depth using (advection and) divergence: $\partial_t d + \mathbf u \cdot \nabla d + \nabla \cdot (d \mathbf u) = 0$.) My goal is to use this to avoid applying a constraint, because solving it iteratively takes time. But maybe I'll have to apply an internal energy constraint, anyway? – hyperpallium May 1 '17 at 7:28
• I don't think I understand what you want to do. Do you want to compute the flow field based on the incompressible NS equation, and then compute a change of density based on $\partial_t\rho=-\nabla\cdot(\rho\mathbf u)$? You can of course do this, but it's easier than that because you have made the assumption of linearity (by virtue of assuming that the density variations are small), so you have $\rho=\rho_0(1+\alpha p)$, and $\partial_t\rho=\alpha\rho_0\partial_t p$. – Wolfgang Bangerth May 1 '17 at 14:28
• What you describe is known as a "splitting scheme", though that's not how it's usually derived. Take a look at the survey papers by Jean-Luc Guermond -- he gives a good overview of how they work, and you can then try to work backward and see if they match your physical intuition. – Wolfgang Bangerth May 2 '17 at 13:28
• I doubt your idea of using density will work. Since $\alpha$ is very small you will have a very stiff problem, with lots of numerical difficulties. Have you looked at Lattice-Boltzmann methods, whether they suit your needs ? They are very simple to implement as they are explicit schemes. Also if you can use periodic bc, spectral methods can be used. Solving pressure is easier there I believe. – cfdlab May 8 '17 at 8:02
• @PraveenChandrashekar is exactly right. If the medium is "almost incompressible", then that's in saying that the wave speed is very large. So you have two options: (i) You use a scheme where you alternate between updating the velocity based on the pressure, and then the pressure based on the velocity; but for this you need to resolve the relevant time scales which, due to the high wave speed, are very short -- so you need lots of time steps. (ii) You assume that the wave speed is in fact infinite, in which case the pressure is globally coupled, i.e. there's a pressure Laplace equation. – Wolfgang Bangerth May 9 '17 at 2:00