Chapter 34

Numerical Solutions to Three-Dimensional Flow Problems

34.1 Introduction

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.

34.2 Derivation

34.2.1 Four Equations

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):

ρ(vxt+vxvxx+vyvxy+vzvxz)=px+η(2vxx2+2vxy2+2vxz2)+kx

si3_e  (Eq. 34.1)

ρ(vyt+vxvyx+vyvyy+vzvyz)=py+η(2vyx2+2vyy2+2vyz2)+ky

si4_e  (Eq. 34.2)

ρ(vzt+vxvzx+vyvzy+vzvzz)=pz+η(2vzx2+2vzy2+2vzz2)+kz

si5_e  (Eq. 34.3)

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

vxx+vyy+vzz=0

si6_e  (Eq. 34.4)

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).

34.2.2 Pressure Recovery

34.2.2.1 The Problem With Incompressible Fluids

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.

34.2.2.2 Artificial Compressibility Method

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

β=dρ˜dpdρ˜=βdp

si7_e  (Eq. 34.5)

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 ρ˜ si8_e. As you can see, the density has been written as ρ˜ si8_e and is often referred to as the pseudo-density. This is an artificial value which has no further meaning. This value is not required for the momentum equations; we only require it for a small trick in the continuity equation.

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

ρ˜t+vxx+vyy+vzz=0

si10_e  (Eq. 34.6)

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

βpt+vxx+vyy+vzz=0

si11_e  (Eq. 34.7)

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.

34.2.2.3 SIMPLE Algorithm

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 v¯x si12_e, v¯y si13_e, and v¯z si14_e, respectively, we end up with

v¯x=1vxx(1ρ(px+η(2vxx2+2vxy2+2vxz2)+kx)(vxt+vyvxy+vzvxx))

si15_e  (Eq. 34.8)

v¯y=1vyx(1ρ(py+η(2vyx2+2vyy2+2vyz2)+ky)(vyt+vxvyx+vyvyy))

si16_e  Eq. 34.9

v¯z=1vzx(1ρ(pz+η(2vzx2+2vzy2+2vzz2)+kz)(vzt+vxvzx+vyvzy))

si17_e  Eq. 34.10

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 v¯x si12_e, v¯y si13_e, and v¯z si14_e, using equations which contain gradients and derivatives of these unknown values on the right-hand side. However, in numerical solvers, we usually have to iterate the solution anyway. It therefore seems plausible to use the values from the previous iteration i on the right-hand side of the equations to calculate the values of the iteration i + 1, which are the values on the left-hand side of the equation. In order to make the scheme numerically even less expensive, we do not even solve these equations as a linear system of equations. However, mathematically speaking, this is what we should do as, e.g.,Eq. 34.8 requires the value v¯y si13_e and v¯z si14_e whereas Eq. 34.9 requires the values v¯x si12_e and v¯z si14_e, etc. However, as we iterate the solution it seems perfectly plausible to work with “old” values instead of solving linear systems of equations, which is definitely slower. This is why, we usually solve Eq. 34.8, Eq. 34.9, and Eq. 34.10 in a one-by-one fashion.

Satisfying the Momentum Equations:v¯x si25_e,v¯y si26_e, andv¯z si27_e. Let us assume for a moment that we solved Eq. 34.8, Eq. 34.9, and Eq. 34.10 such that we obtain velocity values v¯x si12_e, v¯y si13_e, and v¯z si14_e,. These velocity values fulfill the momentum equations, i.e., satisfy the Navier–Stokes equation. This is why we label them with the overline. Obviously, as we have just learned, we will solve these equations one by one, which will yield values that are slightly off, but we ignore this for a moment.

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 v¯x si12_e, v¯y si13_e, and v¯z si14_e. We will most likely find that these values do not satisfy the continuity equation. This is why we need to correct them, adding small terms x, ṽy, and z, which changes our solution to

vx=v¯x+v˜xvy=v¯y+v˜yvz=v¯z+v˜z

si34_e

where the values v¯{x,y,z} si35_e satisfy the momentum equations and the terms {x,y,z} are added to make sure the continuity equation is fulfilled. Having added these small correction terms {x,y,z} will most likely lead to the problem that the velocity values vx, vy, and vz will (most likely) not fulfill the momentum equations anymore. We can correct this by adding (again) small correction terms. As you can see, this becomes an iterative problem. We have to continue the process until we reach a certain problem-dependent precision upon which we assume the values to be sufficiently refined to satisfy both momentum and continuity equations.

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 v¯x si12_e, v¯y si13_e, and v¯z si14_e sas a function of the pressure as

v¯x=cx+cx,pp¯x

si39_e  (Eq. 34.11)

v¯y=cy+cy,pp¯y

si40_e  (Eq. 34.12)

v¯z=cz+cz,pp¯z

si41_e  (Eq. 34.13)

where we write the pressure as p¯ si42_e, indicating that this is the pressure that satisfies the momentum equations. In analogy to the velocities, we now add a small pressure p˜ si43_e, which gives rise to the velocities x, ṽy, and z, which we need to satisfy the continuity equation. We therefore find

v¯x=cx+cx,pp¯+p˜x=cx+cx,p(p¯x+p˜x)=v¯x+v˜x

si44_e  (Eq. 34.14)

v¯y=cy+cy,pp¯+p˜y=cy+cy,p(p¯y+p˜y)=v¯y+v˜y

si45_e  (Eq. 34.15)

v¯z=cz+cz,pp¯+p˜z=cz+cz,p(p¯z+p˜z)=v¯z+v˜z

si46_e  (Eq. 34.16)

from which we learn that

v˜x=cx,pp˜x

si47_e  (Eq. 34.17)

v˜y=cy,pp˜y

si48_e  (Eq. 34.18)

v˜z=cz,pp˜z

si49_e  (Eq. 34.19)

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

vxx+vyy+vzz=0(v¯x+v˜x)x+(v¯y+v˜y)y+(v¯z+v˜z)z=0

si50_e

where we use Eq. 34.11, Eq. 34.12, and Eq. 34.13 for rewriting v¯x si12_e, v¯y si13_e, and v¯z si14_e and Eq. 34.17, Eq. 34.18, and Eq. 34.19 for rewriting x, ṽy, and z, in which case we find

v¯xx+cx,p2p˜x2+v¯yy+cy,p2p˜y2+v¯zz+cz,p2p˜z2=0

si54_e  (Eq. 34.20)

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 v¯x si12_e, v¯y si13_e, and v¯z si14_e using Eq. 34.14, Eq. 34.15, and Eq. 34.16.

2. Calculate the new pressure using Eq. 34.20.

3. Update the velocities v¯x si12_e, v¯y si13_e, and v¯z si14_e with the new pressure term.

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

p(i+1)=p(i)+ωp˜

si61_e

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 p˜ si43_e thereby achieving numerical schemes that do not require under-relaxation.

34.2.2.4 Divergent Navier–Stokes Equation

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

(ρ(vt+(v)v))=(kp+ηΔv)

si63_e  (Eq. 34.21)

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

ρ(v)v=(kp+ηΔv)

si64_e  (Eq. 34.22)

The right-hand side of Eq. 34.22 can be simplified by noting that

(kp+ηΔv)=kΔp+(ηΔv)=kΔp+η(Δv)=kΔp+ηΔ(v)

si65_e

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 v=0 si66_e on the right-hand side of the equation. Also, we can move the viscosity η out of the differentials as we restrict ourselves to Newtonian media for which the viscosity is a constant (see section 9.5.2). This allows us to write the right-hand side as

(kp+ηΔv)=kΔp

si67_e  (Eq. 34.23)

Combining Eq. 34.22 and Eq. 34.23 yields the divergence Navier–Stokes equation:

ρ(v)v=kΔp

si68_e  (Eq. 34.24)

We can rearrange Eq. 34.24 slightly, yielding

Δp=kρ(v)v=(kρ(v)v)

si69_e  (Eq. 34.25)

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 vt=0 si70_e, in which case we cannot apply the simplification made in Eq. 34.22. Instead, we need a numerical scheme for replacing the time derivative. We can choose any suitable method discussed in section 27.2 for doing so. For the sake of simplicity, we will use a forward Euler scheme (see section 27.2.2). For this we find

v(t+1)=v(t)+htv(t)t

si71_e  (Eq. 34.26)

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

vt=(v)v+1ρk1ρp+ηρΔv

si72_e  (Eq. 34.27)

which we insert into Eq. 34.26 to find

v(t+1)=v(t)+ht((v(t))v(t)+1ρk(i)1ρp(t)+ηρΔv(t))

si73_e  (Eq. 34.28)

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

v(t+1)=v(t)+ht(((v(t))v(t))+1ρk(t)1ρΔp(t)+ηρΔv(t))

si74_e  (Eq. 34.29)

As before, we want to isolate the pressure term on the left-hand side, in which case we find

Δp(t)=ρht(v(t)v(t+1))ρ((v(t))v(t))+k(t)+ηΔv(t)

si75_e  (Eq. 34.30)

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.

34.2.3 Schemes for Stationary and Instationary Flows

34.2.3.1 Numerical Schemes

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.

34.2.3.2 Stationary Flows

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:

px=p(x+1,y,z)p(x1,y,z)2hxyz

si76_e

py=p(x,y+1,z)p(x,y1,z)2hxyz

si77_e

pz=p(x,y,z+1)p(x,y,z1)2hxyz

si78_e

as well as the following schemes for the first-order differentials:

vxx=vx(x+1,y,z)vx(x1,y,z)2hxyz

si79_e

vxy=vx(x,y+1,z)vx(x,y1,z)2hxyz

si80_e

vxz=vx(x,y,z+1)vx(x,y,z1)2hxyz

si81_e

vyx=vy(x+1,y,z)vy(x1,y,z)2hxyz

si82_e

vyy=vy(x,y+1,z)vy(x,y1,z)2hxyz

si83_e

vyz=vy(x,y,z+1)vy(x,y,z1)2hxyz

si84_e

vzx=vz(x+1,y,z)vz(x1,y,z)2hxyz

si85_e

vzy=vz(x,y+1,z)vz(x,y1,z)2hxyz

si86_e

vzz=vz(x,y,z+1)vz(x,y,z1)2hxyz

si87_e

and the following schemes for the second-order differentials

2vxx2=vx(x+1,y,z)+vx(x1,y,z)2vx(x,y,z)h2xyz

si88_e

2vxy2=vx(x,y+1,z)+vx(x,y1,z)2vx(x,y,z)h2xyz

si89_e

2vxz2=vx(x,y,z+1)+vx(x,y,z1)2vx(x,y,z)h2xyz

si90_e

2vyx2=vy(x+1,y,z)+vy(x1,y,z)2vy(x,y,z)h2xyz

si91_e

2vyy2=vy(x,y+1,z)+vy(x,y1,z)2vy(x,y,z)h2xyz

si92_e

2vyz2=vy(x,y,z+1)+vy(x,y,z1)2vy(x,y,z)h2xyz

si93_e

2vzx2=vz(x+1,y,z)+vz(x1,y,z)2vz(x,y,z)h2xyz

si94_e

2vzy2=vz(x,y+1,z)+vz(x,y1,z)2vz(x,y,z)h2xyz

si95_e

2vzz2=vz(x,y,z+1)+vz(x,y,z1)2vz(x,y,z)h2xyz

si96_e

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

v(i+1,x,y,z)xv(i,x+1,y,z)xv(i,x1,y,z)x2+v(i,x,y,z)yv(i,x,y+1,z)xv(i,x,y1,z)x2+v(i,x,y,z)zv(i,x,y,z+1)xv(i,x,y,z1)x2=1ρp(x+1,y,z)p(x1,y,z)2+ηρhxyz(v(i,x+1,y,z)x+v(i,x1,y,z)x+v(i,x,y+1,z)x+v(i,x,y1,z)x+v(i,x,y,z+1)x+v(i,x,y,z1)x6v(i+1,x,y,z)x)+hxyzρk(x,y,z)x

si97_e

v(i,x,y,z)xv(i,x+1,y,z)yv(i,x1,y,z)y2+v(i+1,x,y,z)yv(i,x,y+1,z)yv(i,x,y1,z)y2+v(i,x,y,z)zv(i,x,y,z+1)yv(i,x,y,z1)y2=1ρp(x,y+1,z)p(x,y1,z)2+ηρhxyz(v(i,x+1,y,z)y+v(i,x1,y,z)y+v(i,x,y+1,z)y+v(i,x,y1,z)y+v(i,x,y,z+1)y+v(i,x,y,z1)y6v(i+1,x,y,z)y)+hxyzρk(x,y,z)y

si98_e

v(i,x,y,z)xv(i,x+1,y,z)zv(i,x1,y,z)z2+v(i,x,y,z)yv(i,x,y+1,z)zv(i,x,y1,z)z2+v(i+1,x,y,z)zv(i,x,y,z+1)zv(i,x,y,z1)z2=1ρp(x,y,z+1)p(x,y,z1)2+ηρhxyz(v(i,x+1,y,z)z+v(i,x1,y,z)z+v(i,x,y+1,z)z+v(i,x,y1,z)z+v(i,x,y,z+1)z+v(i,x,y,z1)z6v(i+1,x,y,z)z)+hxyzρk(x,y,z)z

si99_e

which we rewrite to

v(i+1,x,y,z)x(v(i,x+1,y,z)xv(i,x1,y,z)x2+6ηρhxyz)+v(i,x,y,z)yv(i,x,y+1,z)xv(i,x,y1,z)x2+v(i,x,y,z)zv(i,x,y,z+1)xv(i,x,y,z1)x2=1ρp(x+1,y,z)p(x1,y,z)2+ηρhxyz(v(i,x+1,y,z)x+v(i,x1,y,z)x+v(i,x,y+1,z)x+v(i,x,y1,z)x+v(i,x,y,z+1)x+v(i,x,y,z1)x)+hxyzρk(x,y,z)x

si100_e  (Eq. 34.31)

v(i,x,y,z)xv(i,x+1,y,z)yv(i,x1,y,z)x2+v(i+1,x,y,z)y(v(i,x,y+1,z)yv(i,x,y1,z)y2+6ηρhxyz)+v(i,x,y,z)zv(i,x,y,z+1)yv(i,x,y,z1)y2=1ρp(x,y+1,z)p(x,y1,z)2+ηρhxyz(v(i,x+1,y,z)y+v(i,x1,y,z)y+v(i,x,y+1,z)y+v(i,x,y1,z)y+v(i,x,y,z+1)y+v(i,x,y,z1)y)+hxyzρk(x,y,z)y

si101_e  (Eq. 34.32)

v(i,x,y,z)xv(i,x+1,y,z)zv(i,x1,y,z)z2+v(i,x,y,z)yv(i,x,y+1,z)zv(i,x,y1,z)z2+v(i+1,x,y,z)z(v(i,x,y,z+1)zv(i,x,y,z1)z2+6ηρhxyz)=1ρp(x,y,z+1)p(x,y,z1)2+ηρhxyz(v(i,x+1,y,z)z+v(i,x1,y,z)z+v(i,x,y+1,z)z+v(i,x,y1,z)z+v(i,x,y,z+1)z+v(i,x,y,z1)z)+hxyzρk(x,y,z)z

si102_e  (Eq. 34.33)

As you can see, we implemented an iteration variable i. The respective dependent variables to solve for are v(i+1,x,y,z)x si103_e, v(i+1,x,y,z)y si104_e, and v(i+1,x,y,z)z si105_e. We avoided making the equations nonlinear by choosing the central finite difference scheme for the first-order partial derivatives, which only depends on the neighboring values of the iteration i; we use this to update the value of the iteration i + 1 of the convection terms on the left-hand side. As you can see, we implemented the simplification that we already introduced during the discussion of the SIMPLE algorithm, i.e., we do not treat Eq. 34.31, Eq. 34.32, and Eq. 34.33 as a linear system of equations but simply solve them sequentially. Obviously, the equations are interdependent and the left-hand sides should be written (for all three equations) using v(i+1,x,y,z)x si103_e, v(i+1,x,y,z)y si104_e, and v(i+1,x,y,z)z si105_e instead of only containing the respective variable of iteration i + 1. However, we need to iterate the solution anyways and it therefore is fine to solve the equations one by one simply updating the values. Solving Eq. 34.31, Eq. 34.32, and Eq. 34.33 yields

v(i+1,x,y,z)x=1v(i,x+1,y,z)xv(i,x1,y,z)x2+6ηρhxyzv(i,x,y,z)yv(i,x,y+1,z)xv(i,x,y1,z)x2+v(i,x,y,z)zv(i,x,y,z+1)xv(i,x,y,z1)x21ρp(x+1,y,z)p(x1,y,z)2+ηρhxyzv(i,x+1,y,z)x+v(i,x1,y,z)x+v(i,x,y+1,z)x+v(i,x,y1,z)x+v(i,x,y,z+1)x+v(i,x,y,z1)x+hxyzρk(x,y,z)x

si109_e  (Eq. 34.34)

v(i+1,x,y,z)y=1v(i,x,y+1,z)yv(i,x,y1,z)y2+6ηρhxyzv(i,x,y,z)xv(i,x+1,y,z)yv(i,x1,y,z)y2+v(i,x,y,z)zv(i,x,y,z+1)yv(i,x,y,z1)y21ρp(x,y+1,z)p(x,y1,z)2+ηρhxyzv(i,x+1,y,z)y+v(i,x1,y,z)y+v(i,x,y+1,z)y+v(i,x,y1,z)y+v(i,x,y,z+1)y+v(i,x,y,z1)y+hxyzρk(x,y,z)y

si110_e  (Eq. 34.35)

v(i+1,x,y,z)z=1v(i,x,y,z+1)zv(i,x,y,z1)z2+6ηρhxyzv(i,x,y,z)xv(i,x+1,y,z)zv(i,x1,y,z)z2+v(i,x,y,z)yv(i,x,y+1,z)zv(i,x,y1,z)y21ρp(x,y,z+1)p(x,y,z1)2+ηρhxyzv(i,x+1,y,z)z+v(i,x1,y,z)z+v(i,x,y+1,z)z+v(i,x,y1,z)z+v(i,x,y,z+1)z+v(i,x,y,z1)z+hxyzρk(x,y,z)z

si111_e  (Eq. 34.36)

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

Δp=kρ(v)v=kxx+kyy+kzzρ(vxx+vyy+vzz)v=kxx+kyy+kzzρvx2xx+vxxx+vy2yx+vyxy+vz2zx+vzxzvx2xy+vxyx+vy2yy+vyyy+vz2zy+vzyzvx2xz+vxzx+vy2yy+vyzy+vz2zz+vzzzvxvyvz=kxx+kyy+kzzρvx2vxxx+vxxvxx+vy2vxyx+vyxvxy+vz2vxzx+vzxvxz+vx2vyxy+vxyvyx+vy2vyyy+vyyvyy+vz2vyzy+vzyvyz+vx2vzxz+vxzvzx+vy2vzyz+vyzvzy+vz2vzzx+vzyvzz=kxx+kyy+kzzρvx(2vxxx+2vyxx+2vzxz)+vy(2vxyx+2vyyy+2vzyz)+vz(2vxzx+2vyzy+2vzzz)+(vxx)2+(vyy)2+(vzz)2+2(vyxvxy+vxzvzx+vyzvzy)

si112_e

=kxx+kyy+kzzρvxx(vxx+vyy+vzz)+vyy(vxx+vyy+vzz)+vzz(vxx+vyy+vzz)+(vxx)2+(vyy)2+(vzz)2+2(vyxvxy+vxzvzx+vyzvzy)

si113_e

where we can exploit the fact that vxx+vyy+vzz=0 si6_e due to the continuity equation (see Eq.10.17). This simplifies our equation to

Δp=kxx+kyy+kzzρ(vxx)2+(vyy)2+(vzz)2+2(vyxvxy+vxzvzx+vyzvzy)

si115_e  (Eq. 34.37)

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

2px2=p(x+1,y,z)+p(x1,y,z)2p(x,y,z)h2xyz2py2=p(x,y+1,z)+p(x,y1,z)2p(x,y,z)h2xyz2pz2=p(x,y,z+1)+p(x,y,z1)2p(x,y,z)h2xyz

si116_e

as well as the first-order differentials of the volume forces, for which we find

kxx=k(x+1,y,z)xk(x1,y,z)x2hxyzkxy=k(x,y+1,z)yk(x,y1,z)y2hxyzkzz=k(x,y,z+1)zk(x,y,z1)z2hxyz

si117_e

which allows us to write the numerical scheme for Eq. 34.37 as

p(i,x+1,y,z)+p(i,x1,y,z)+p(i,x,y+1,z)+p(i,x,y1,z)+p(i,x,y,z+1)+p(i,x,y,z1)6p(i+1,x,y,z)h2xyz

si118_e

=k(x+1,y,z)xk(x1,y,z)x+k(x,y+1,z)yk(x,y1,z)y+k(x,y,z+1)zk(x,y,z1)zh2xyzρh2xyz(v(i,x+1,y,z)xv(i,x1,y,z)x2)2+(v(i,x,y,z)yv(i,x,y1,z)y2)2+(v(i,x,y,z+1)zv(i,x,y,z1)z2)2+2(v(i,x+1,y,z)yv(i,x1,y,z)y2)(v(i,x,y+1,z)xv(i,x,y1,z)x2)+(v(i,x,y,z+1)xv(i,x,y,z1)x2)(v(i,x+1,y,z)zv(i,x1,y,z)z2)+(v(i,x,y,z+1)yv(i,x,y,z1)y2)(v(i,x,y+1,z)zv(i,x,y1,z)z2)

si119_e

p(i+1,x,y,z)=hxyz6k(x+1,y,z)xk(x1,y,z)x+k(x,y+1,z)yk(x,y1,z)y+k(x,y,z+1)zk(x,y,z1)z2+ρ6(v(i,x+1,y,z)xv(i,x1,y,z)x2)2+(v(i,x,y+1,z)yv(i,x,y1,z)y2)2+(v(i,x,y,z+1)zv(i,x,y,z1)z2)2+2(v(i,x+1,y,z)yv(i,x1,y,z)y2)(v(i,x,y+1,z)xv(i,x,y1,z)x2)+(v(i,x,y,z+1)xv(i,x,y,z1)x2)(v(i,x+1,y,z)zv(i,x1,y,z)z2)+(v(i,x,y,z+1)yv(i,x,y,z1)y2)(v(i,x,y+1,z)zv(i,x,y1,z)z2)+16(p(i,x+1,y,z)+p(i,x1,y,z)+p(i,x,y+1,z)+p(i,x,y1,z)+p(i,x,y,z+1)+p(i,x,y,z1))

si120_e  (Eq. 34.38)

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset