In section 33 we have studied numerous two-dimensional parallel flows where we only had to consider one velocity component, i.e., vx. All of these flow problems were based on very simple geometries in the form of straight channels without changes in diameter, width, or height. Obviously, not all fluid mechanics problems are so simple and cases where only one velocity component must be considered are rare.
In this section, we will extend the numerical solvers we have written so far such that we are able to solve three–dimensional fluid mechanical problems. As we will see, the changes we need to implement are not significant, and we have studied all the mathematics required to implement them. It is surprisingly simple to implement a solver that can be used to solve a wide range of fluid mechanics problems.
In contrast to the solvers we implemented in section 33 we are now faced with the problem of the pressure drop not being a constant, so it must therefore be determined numerically.
In order to be able to solve three–dimensional flow problems, we will need to solve the three–dimensional Navier–Stokes equations. As we have done in section 33 we will implement the solver for Cartesian coordinates. In the following we will limit ourselves to Newtonian fluids, thereby also restricting the solutions to incompressible fluids. As we will see in a moment, this actually causes a problem that we would not have if we considered the fluid to be compressible.
Navier–Stokes Equation: Conservation of Momentum. The first three equations are the momentum equations, i.e., the Navier–Stokes equation (see section 11 for details on the derivation):
Continuity Equation: Conservation of Mass. In addition to the three equations from the Navier–Stokes equation we also require the incompressible continuity equation (see Eq. 10.17) given by
Dependent Variable. The three Navier–Stokes equations and the continuity equation make up a total of four equations to solve for the four unknowns, vx, vy, vz, and p. As stated, we restrict ourselves to incompressible fluids, which means that the density is not a dependent variable but a constant. If the density was not constant, we would require a thermodynamic equation of state as described in section 12.8. The last (potential) dependent variable we may require would be the temperature T. If we also wanted to include the temperature, we would need to add the energy equation (see section 12).
At this point, we have all the equations required in a mathematical sense. We have a total of four equations (see Eq. 34.1, Eq. 34.2, Eq. 34.3, and Eq. 34.4) for a total of four dependent variables, vx, vy, vz, and p. However, at this point, we run into a problem that we have worked around nicely so far. Until now, we considered the pressure to be applied from the outside, i.e., to be an imposed value which was left constant. In fact, in Poiseuille flow (see section 15.4) the pressure is the driving force of the flow. It occurs as a source term on the right-hand side of the Navier–Stokes equation (see Eq. 11.40) and was constant. If the pressure is not applied from the outside, e.g., because the flow is not pressure driven but volume driven by a volume-controlled pump such as a syringe or piston pump, there is no means for us to determine the pressure term. In addition to that we must assume the pressure to change across the domain. We know from the incompressible Bernoulli equation (see Eq. 14.11) that the pressure changes with changing velocity. However, we do not know the velocity distribution because this is the variable we are actually seeking.
Obviously, in a mathematical sense, it should be possible to determine four unknowns from four equations. However, if you look at Eq. 34.1, Eq. 34.2, and Eq. 34.3 you see that we actually only have the gradient, i.e., the derivative of the pressure in the equation. We cannot simply solve the equations for the value of the pressure at a given point as we can for the velocities. These occur both as a variable and derivatives on the left-hand sides of Eq. 34.1, Eq. 34.2, and Eq. 34.3. In addition to this Eq. 34.4 does not even have a distinct variable to solve for. It would be really convenient to rewrite Eq. 34.4 such that it depends on p. Then all four equations would have unknowns for which we could solve them.
Interestingly, we would have a significantly easier time if the fluid in question was compressible. In this case, the density would not be constant and we could bring in an additional equation, e.g., the ideal gas equation (see Eq. 6.8) we discussed in section 6.4 and section 12.8. Such an equation would link the pressure to the density and we would have equations which we could solve for them.
For incompressible fluids, we have to find a way around this problem. All of these approaches will try to rewrite the continuity equation, Eq. 34.4, such that it becomes a function of the pressure p. These approaches are therefore generally referred to as pressure term recovery approaches because this is what they do.
The most simple means of reintroducing the pressure into the continuity equation is by simply assuming that the fluid is pseudo-compressible. We introduce an artificial compressibility factor β given by
which simply states that a change in the pressure will lead to a change in density. This effect is assumed to be linear and β is assumed to be small, i.e., large changes in the pressure only lead to small changes in the density. Pressure changes will result in (very small) changes of the density. We therefore obtain a weak coupling between p and
We now add a time-dependent term on the left-hand side of the continuity equation, Eq. 34.4, which we also find in the incompressible continuity equation (see Eq. 10.16). We find
This equation simply states that if we allow a certain compressibility, the pseudo-density should change as a consequence of mass in- and outflux into and out of our control volume. We can now insert Eq. 34.5 into Eq. 34.6 to rewrite the pseudo-density as a function of the pressure to find
where we now have a function of the pressure. We can rewrite Eq. 34.7 to solve for the pressure, which we can then insert into the momentum equations thereby recovering the pressure.
Choosing the Value β. There are certain restrictions for the value β. If the value is chosen too small, the equation becomes numerically stiff, i.e., there will be only very small contributions from the artificial compressibility and we only obtain very small increments in our iteration scheme. Therefore it takes a high number of iterations to come up with a value of p, which actually solves the momentum equation and the modified continuity equation (Eq. 34.7). For higher values of β we obtain fast convergence but increase the risk of obtaining physically meaningless results. This is due to the fact that at a certain point changes in the pressure (which occur due to the artificial compressibility) propagate faster through the domain than the momentum. The speed at which pressure changes propagate cannot be faster than the speed of sound. In general, β should be chosen such that the Mach number (see section 9.9.1) M < 1 [1]. It is therefore important to choose β based on the medium. In general, choosing smaller values may lead to a longer calculation time, but it ensures the results are physically meaningful.
The SIMPLE algorithm was originally described by Patankar and Spalding [2]. The acronym stands for “semiimplicit method for pressure-linked equations.” As the name suggests, this algorithm gives a semi-implicit correlation for the pressure dependency of the momentum equations and the continuity equation. There have been numerous improvements to the algorithm, all of which make use of one concept: Linking up changes in the pressure as the source terms of the momentum equation with changes of the velocity. If we solve Eq. 34.1, Eq. 34.2, and Eq. 34.3 for the values
We will come to the overline notation in a moment.
Solving the Equations One By One. Mathematically speaking, Eq. 34.8, Eq. 34.9, and Eq. 34.10 are obviously not very useful forms of the momentum equations because we solve for the (unknown) values
Satisfying the Momentum Equations:
Satisfying the Continuity Equation: ṽx, ṽy, and ṽz. In the next step, we need to solve the continuity equation (see Eq. 34.4) using the values
where the values
Pressure Correction. Now the obvious question is the following: Where does the “pressure-linked” concept come into play? In fact, we cannot simply add velocity correction terms without a source term in the momentum equation. The additional velocity must originate from some physical source. We define this source to be the pressure, thereby achieving a semi-implicit link between the velocity and the pressure. If you consider Eq. 34.8, Eq. 34.9, and Eq. 34.10 you can see that we can rewrite the function of velocities
where we write the pressure as
from which we learn that
This means that the velocity corrections are only dependent on the pressure corrections we make. This gives the semi-implicit link between changes in the pressure and the change in the local velocity fields.
Modified Continuity Equations. We can now rewrite the continuity equation (Eq. 34.4) as
where we use Eq. 34.11, Eq. 34.12, and Eq. 34.13 for rewriting
Eq. 34.20 is an equation that contains the second derivative of the pressure. As we know from the most common numerical scheme for the second-order partial derivative (see Eq. 4.10) we will be able to calculate the pressure at the current cell or node in our domain using the second derivative.
Scheme. In general, the SIMPLE algorithm proceeds in these steps:
1. Solve
2. Calculate the new pressure using Eq. 34.20.
3. Update the velocities
4. Check for convergence, i.e., check if the change in velocities of the current iteration is below a given threshold.
The SIMPLE algorithm is known for bad convergence and the pressure value usually has to be under-relaxed in order to obtain a stable scheme. This means that the updated value p(i + 1) must be calculated as
with 0 ≤ u < 1.
Improvements to the Algorithm. As you can see, we do not even calculate the corrected velocity terms ṽx, ṽy, and ṽz in the SIMPLE algorithm, which is the main reason why we need to apply under-relaxation for the pressure correction. If we were able to calculate these values, we could update them alongside the pressure, thereby balancing the momentum equations and obtaining faster convergence. There are several optimizations of the SIMPLE algorithm, e.g., the semi-implicit method for pressure-linked equations revised (SIMPLER), the semi-implicit method for pressure-linked equations-consistent (SIMPLEC), and the pressure-implicit with splitting of operator (PISO), which establish a correlation between ṽ{x,y,z} and
Another common method for pressure term recovery can be done by a small trick. Instead of taking the continuity equation that essentially states that the divergence of the velocity field must be zero, we demand that the divergence of the momentum field must be zero. We can obtain this by simply forming the divergent Navier–Stokes equation. For this we simply take the divergence of the left- and the right-hand side of the Navier–Stokes equation.
We will perform this operation first strictly mathematically and look at the interpretation once we have obtained the result. The divergent Navier–Stokes equation is found by applying the nabla operator to the left-and right-hand side of the Navier–Stokes equation (Eq. 11.40). We find
We will look at two cases of this equation: the stationary and the instationary flows.
Stationary Flows. In stationary flows, the time derivative on the left-hand side of Eq. 34.21 is zero, in which case we simplify Eq. 34.21 to
The right-hand side of Eq. 34.22 can be simplified by noting that
where we have used the fact that the order of the nabla and Laplace operators can be switched. This allows us to use the continuity equation again as we have another term
Combining Eq. 34.22 and Eq. 34.23 yields the divergence Navier–Stokes equation:
We can rearrange Eq. 34.24 slightly, yielding
Eq. 34.25 is commonly referred to as the pressure-Poisson equation.
Interpretation. We will now look into what exactly the physical implications of this introduction of divergence actually are. If you look at Eq. 34.25 you see that it looks as if we had just applied the nabla operator to an equation that was rearranged such that the pressure gradient was on the left-hand side. Now, the pressure is prepended by the Laplace operator, which usually describes diffusion effects. This is not a bad interpretation. In fact, one can think of the incompressibility as being a constraint for the pressure. However, the pressure is not a dependent variable. By taking the gradient of the Navier–Stokes equation we generate an artificial pressure field. As this field is derived from the Navier–Stokes equation it satisfies this equation implicitly. If you look carefully at Eq. 34.25 you can see that the right-hand side contains the divergence of the volume forces and the convection term. These are the terms that would contribute to the generation of pressure. Volume forces obviously create pressure, as does in- and outflowing mass due to the incompressibility of the fluid. The other terms of the Navier–Stokes equation canceled during the derivation because they do not contribute to the change of pressure. The generated pressure field thus ensures that the Navier–Stokes and the continuity equation are satisfied.
Usage. Using Eq. 34.25 instead of the continuity equation (Eq. 34.4) to recover the pressure term is a very common implementation. In the following we will also make use of this equation to recover the pressure.
Instationary Flows. Having derived the divergent Navier–Stokes equation for stationary flows, we now turn to instationary flows. For these cases, we know that
As you can see, we have implemented an index variable t in time and stepped the velocity forward from t to t + 1 by a forward Euler scheme. Rearranging the Navier–Stokes equation (see Eq. 11.40) we find the first-order time derivative to be
which we insert into Eq. 34.26 to find
As we have done in case of the stationary flows, we now apply the divergence operator to both sides of the equations, in which case we find
As before, we want to isolate the pressure term on the left-hand side, in which case we find
Obviously, Eq. 34.30 looks significantly more complicated than the respective equation we found for the stationary case (see Eq. 34.25). However, there are two small modifications we will make to this equation later, which will make it slightly less complicated to work with. For the moment we leave it as it is.
We are now ready to implement the solver. We require Eq. 34.1, Eq. 34.2, Eq. 34.3, and Eq. 34.25 and suitable numerical schemes for them. We will use a stepwidth hxyz in space and a stepwidth ht in time. There are two flow cases for which we could implement our solver: stationary and instationary. We will start with the stationary flows first.
Momentum Equations. For stationary flows, the time derivatives in Eq. 34.1, Eq. 34.2, and Eq. 34.3 are zero and we can directly solve the equations for the unknown velocities vx, vy, and vz. Similar to the approach taken in section 33.3.3.2 we will choose suitable numerical schemes for the first-order partial derivatives and implement an iterative scheme in order to avoid making the left-hand sides of our solutions nonlinear. We will use the following numerical schemes for the pressure terms:
as well as the following schemes for the first-order differentials:
and the following schemes for the second-order differentials
As you can see, we have used a central finite difference scheme (see section 4.2.4.3) for the first-order partial differentials. Until now, we have preferably used backward or forward finite difference schemes (see section 4.2.4.4). The central finite difference scheme has two main advantages, which makes it the more suitable scheme in this application. First, it has no directional bias. Until now, we have primarily discussed flow scenarios where we started from a given end of the domain and “calculated our way forward” toward the end. For these scenarios forward finite difference schemes are most commonly used. We have done the same in section 33.3.3.1. The second advantage of the central difference scheme is the fact that it is numerically more stable due to the fact that it is a second-order scheme. This is advantageous since it is very likely that the solver we are about to implement will be used in cases where numerical stability may become a problem. Therefore, choosing a numerically more stable scheme makes the solver more robust to use. However, the central finite difference scheme comes at a disadvantage, which we will discuss in a moment.
Using the given equations, Eq. 34.1, Eq. 34.2, and Eq. 34.3 can be rewritten as
which we rewrite to
As you can see, we implemented an iteration variable i. The respective dependent variables to solve for are
Eq. 34.34, Eq. 34.35, and Eq. 34.36 are the required momentum equations.
Pressure-Poisson Equation. The last equation we require is the pressure-Poisson equation (Eq. 34.25), which we rewrite to
where we can exploit the fact that
which is the form we will use. In addition to the numerical schemes we required for the momentum equation, we need the second-order partial differential of the pressure, for which we will use
as well as the first-order differentials of the volume forces, for which we find
which allows us to write the numerical scheme for Eq. 34.37 as
Eq. 34.38 is the last of the four equations we need to implement.
Disadvantage of the Central Finite Difference Scheme. Here you can see the major drawback of the central finite difference scheme for the velocities: The pressure value p(i + 1,x,y,z) of the next iteration i + 1 does not depend on the values, vx(i + 1,x,y,z), vy(i + 1,x,y,z)and vz(i + 1,x,y,z) we updated when solving the momentum equation. This means that the pressure we are calculating is merely taking into account the velocity gradient of the iteration i. This is a disadvantage compared to, e.g., the SIMPLE algorithm that updates the velocity and the pressure values alternatingly until the momentum and the continuity equations are fulfilled. This allows “internal iteration,”, i.e., we can iterate the values of a single cell until we reach local convergence. At this point we can move on to the next cell, update its values, and iterate locally again until we obtain local convergence in this cell. Continuing this procedure throughout the complete domain, we can obtain approximate solutions significantly quicker than we can using the central finite difference scheme. In this scheme, we cannot perform local iteration because the pressure and the velocity values are not interdependent. This means that we will have to iterate over the whole domain. In practical applications, this means that the computational effort of this scheme is higher. This is the main disadvantage we have to accept for the added numerical stability.
Procedure. We have now derived the required numerical schemes for stationary flow cases in three dimensions. In general, we would iterate through all cells(x, y, z) in our domain. For each cell, we would use Eq. 34.34, Eq. 34.35, and Eq. 34.36 to update the velocities vx(x,y,z), vy(x,y,z)and vz(x,y,z) Having these values, we correct the velocities at the cell (x, y, z) and then apply Eq. 34.38 to calculate the pressure p(x, y, z). We then correct the pressure with the new value obtained. During the updating we keep track of whether or not the updated values of iteration i + 1 are sufficiently close to the values of iteration i. If the changes remain below a certain threshold we consider the solution for this cell to be sufficiently exact. We then proceed onwards to the next cell and repeat this process. The calculation finishes once we find all cells to be converged, i.e., we did not require a significant velocity or pressure correction for any cell in the domain.