Application - Pressure Poisson Equation
The momentum equation for the velocity field in a fluid is
where is the pressure, is the fluid viscosity and is the fluid density. With three velocity components, plus the pressure, we have four unknowns but only three equations. For compressible fluids, we have an equation of state to complete the system. In the incompressible case, we don't have an equation of state and we need an additional constraint from somewhere else.
This is what we do: take the divergence of the momentum equation, apply the incompressibility constraint to cancel some terms, and get an equation for the pressure. It's a pretty cool trick.
Conservation of mass for an incompressible fluid requires that the divergence of must be zero:
Writing out the momentum equation in and components (for two-dimensional flow), we get
We take the divergence of the momentum equation and then apply the incompressibility constraint. After some wrangling and cancellations, this leaves us with the pressure Poisson equation:
Which is an equation of the form
Imagine we discretize a domain using a uniform mesh of points in each spatial direction, as in the figure below:
Then the left-hand side of the Poisson equation, i.e., the Laplacian differential operator applied to , is discretized using 2nd-order central differences as follows
where subscripts denote the spatial location on a Cartesian coordinate system and superscripts denote a point in time.
We apply an appropriate finite-difference discretization to the momentum equation (forward-time, backward-space for the 1st-order terms) and also assume a uniform mesh, so .
Using this discretized form in the Poisson equation, we will leave only the terms in the left-hand side, and move the other terms to the right. Then we say that we can update all the values of using the values at the neighboring points for both and . This update, repeated many times, happens to converge to the solution of Poisson's equation.
Solution procedure
Initial velocity field
We start with a velocity field in and at some timestep .
Calculate pressure
Then, we iteratively solve the Poisson equation for pressure, as described above. Starting with an initial guess, the values are updated using the neighboring values of , and at and . The updates can be written as follows, where the superscript denotes an iteration in 'pseudo-time':
In other words, we repeatedly apply the Poisson equation until the pressure reaches a quasi-steady state.
Update the velocity
Once the pressure field reaches its quasi-steady state via the Poisson equation, we use that field for the current time step, , to solve for the velocity components and at the next timestep, .
The momentum equation in the direction:
The momentum equation in the direction:
Then, rinse and repeat.
What we left out
There are various subtleties that we left out here, to get quickly to the equations we need in the code. First, there are some variations on the form of the pressure Poisson equation, depending on what terms involving one chooses to cancel (this has caused long arguments in the literature!). Second, we say nothing about the boundary conditions, which can cause some trouble (and more arguments!). And third, we show only the simplest iterative method for solving the Poisson equation, which also happens to be the slowest to converge. This is just meant to be a pedagogical example and discussion of these subtleties would be part of a full-fledged CFD course.