3

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.

hyperpallium
  • 364
  • 3
  • 11
  • 1
    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
  • 1
    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
  • 1
    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
  • @BlaisB Thanks! I'm OK with pressure wave propagation requiring a small $\Delta t$, due to CFL (actually I'm also thinking of a huge $\Delta x$, $\approx 10m$). What are some of the other reasons that compressible solvers perform poorly for incompressible flows? BTW I'm not seeking physical accuracy, just interesting life-like behaviour for a game simulation. So speed is important. – hyperpallium May 01 '17 at 07:00
  • @TylerOlsen I did find a ton of information out there - mostly over my head. The wikipedia entry on Euler compressible flows has an "internal energy" constraint. Is that something I can ignore? I think it's the potential energy of compressed fluid, and plays the same role as $\nabla \cdot \mathbf u = 0$ in incompressible flows... and causes the interesting vortices. Would I have to solve for that constraint, iteratively, as for incompressible flows? That's what I hoped to avoid... – hyperpallium May 01 '17 at 07:10

1 Answers1

3

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.

Wolfgang Bangerth
  • 55,373
  • 59
  • 119
  • 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 01 '17 at 07:28
  • 1
    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 01 '17 at 14:28
  • My goal is a simulation that requires much less computation per timestep, by not having to apply the incompressibility constraint of $ \nabla \cdot \mathbf u = 0$ (solving for a constraint seems to require a computationally expensive solver). Instead, I want to advect the velocity, use divergence to compute the change in density and thus pressure, and use the pressue gradient to accelerate the velocity. Hopefully, that acceleration will tend to keep the velocity field incompressible, though there'll be pressure waves. So I can't compute density from pressure, but the other way around. – hyperpallium May 01 '17 at 22:06
  • Re-reading my questtion, it's not clear at all that that's my goal. I focussed on the physics of why I thought it might work - not what I thought might work. I need to rewrite it. – hyperpallium May 01 '17 at 22:09
  • 1
    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 02 '17 at 13:28
  • Is this the paper you're thinking of? "An overview of projection methods for incompressible flows" He's published a lot, but that's the only survey-like one I could see, and it also mentions splitting schemes. Unfortunately, from the title, they are "projection" methods, which is what I'm trying to avoid. I'll have a look though, maybe I'm wrong - worst case is I learn something! – hyperpallium May 04 '17 at 08:04
  • Yes, I think that's the paper I had in mind. – Wolfgang Bangerth May 04 '17 at 13:35
  • I looked at that paper (and 3 other similar-sounding ones by him I found), and all methods involve projecting onto a solenoidal vector field by solving a system of equations, which is what I was hoping to avoid. I wonder if it's the wrong paper, because it's focussed on assessing, with only 2-3 sentence description/explanation...? Another paper describes a variable density approach, but I can't tell what it actually is except that it involves solving a Poisson equation. – hyperpallium May 08 '17 at 05:07
  • The first paper is "An overview of projection methods for incompressible flows" J.L. Guermond, P. Minev, Jie Shen, Comput. Methods Appl. Mech. Engrg. 195 (2006) 6011–6045 The other paper is "A splitting method for incompressible flows with variable density based on a pressure Poisson equation" J.-L.Guermond, A.Salgado, J.Comput.Phys.(2009) ,doi:10.1016/j.jcp.2008.12.036 – hyperpallium May 08 '17 at 05:11
  • I'm interested in using density as an alternative to solving for the incompressibility constraint, but that wasn't clear in this question. I've started a separate question for that numerical aspect. Your answer addresses the question as asked, so I'll just accept it as the answer. – hyperpallium May 08 '17 at 06:12
  • 1
    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 08 '17 at 08:02
  • 1
    @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 09 '17 at 02:00
  • @PraveenChandrashekar Sorry, I somehow missed the notification for these last two comments, and only just noticed them yesterday. I've now looked at Lattice-Boltzmann. I like the idea of a statistical particle technique, but it seems much more computationally demanding than NS (unless you doing sophisticated simulations e.g. mutliphase). I'm aiming at explicit methods as a way to help me understand, but my eventual target is smartphones, so computational efficiency is important. – hyperpallium May 22 '17 at 04:27
  • @PraveenChandrashekar Does "small" $/alpha$ means $<<1$? So a large pressure $p$ change corresponds to a small change in density $\rho$? I think so: that, to look like "incompressible", the slightest actual compression (increase in density) must provoke a very strong opposing force (pressure), to counter it with a decrease in pressure. And vice versa: expansion causes a strong counter pressure. This is a form mechanical stiffness (it's difficult to make it move in terms of density, in that there's an opposing force). [I'm detailing my reasoning, so you can check if it's on track.] – hyperpallium May 22 '17 at 04:39
  • @PraveenChandrashekar But I'm not sure how this translates to "numerical" stiffness. BUT I do see a problem like in solid mechanics: an object goes too far into another object, creating a disproportionate counter-pressure, and flies off. I.e. an explicit forward Euler advection step could compress the fluid much further than would be possible in reality, because it doesn't encounter any resisting pressure as it travels over that distance. A real fluid's velocity would be fully countered before it was compressed that much. Even tiny timesteps/slow velocities mightn't be enough to prevent this. – hyperpallium May 22 '17 at 04:48
  • Is there a Lattice-Boltzmann method, with comparable efficiency to NS? Silly typo above: compression provokes an increase in pressure. – hyperpallium May 22 '17 at 04:51
  • @WolfgangBangerth Sorry, I didn't see your comment til yesterday. I'd use option (i), high wave speed. But I'd use a very coarse grid - something like $\Delta x \sim 10m$ - so that, at 30fps $\Delta t = 1/30s$, I could handle a wave speed of $\sim 300ms^{-1}$, i.e. pretty much the speed of sound in air (and because it's for a simulation game, I can adjust the speed of sound to suit). I think that's all I need for CFL/domain of dependence. Also, incompressible flow eg in air $300ms^{-1}$ doesn't require as high a pressure wave speed as in an incompressible medium eg water $1500ms^{-1}$ – hyperpallium May 22 '17 at 05:06
  • @WolfgangBangerth $\Delta x=10m$ and $\Delta t=1/30$ mightn't be enough; Maybe I need a margin of error, and also, must add the max velocity of the fluid itself to the wave speed. I'm using this partly to understand what's happening in the equations without the extra complexity of a solver, but maybe this way is actually more complex! I hope it's a practical scheme for my specific application, but I'm OK with eventually having to move to a conventional approach, with solvers, for efficiency/stability/accuracy. – hyperpallium May 22 '17 at 05:21
  • @hyperpallium: Using $\Delta x=10m$ is of course entirely fine if you don't try to resolve things that are smaller. Typically, you would choose $\Delta x$ so that you can resolve the geometry of the domain -- e.g., if you want to resolve how sound refracts around a house that's 20 m long, you'd need to use a mesh size that is significantly smaller. If you want to resolve how sound refracts in the ear channel, you'd need $\Delta x < 1mm$. – Wolfgang Bangerth May 22 '17 at 14:35
  • @WolfgangBangerth Thanks! I'm wanting it for weather, over a height-map landscape of the same grid-size, so the same feature-size. The lines between height would be straight lines (not curves) so the boundary condition would just be planes. Looking for effects like fog flowing through a pass, uplift generated by a wind rising over a ridge, and convective clouds - whose vortex features would also be limited by the grid-size. I've considered having an even coarser grid-size further away from the ground for efficiency (as weather simulations do), though the clouds would suffer. – hyperpallium May 22 '17 at 16:15