34
Chapter 6 Solution of Navier-Stokes Equations for Incompressible Flows Using SIMPLE and MAC Algorithms 6.1 Introduction In Cartesian coordinates, the governing equations for incompressible three- dimensional flows are ∂u ∂x + ∂v ∂y + ∂w ∂z =0 (6.1) ∂u ∂t + (u 2 ) ∂x + (uv) ∂y + (uw) ∂z = ∂p ∂x + 1 Re 2 u ∂x 2 + 2 u ∂y 2 + 2 u ∂z 2 (6.2) ∂v ∂t + (uv) ∂x + (v 2 ) ∂y + (vw) ∂z = ∂p ∂y + 1 Re 2 v ∂x 2 + 2 v ∂y 2 + 2 v ∂z 2 (6.3) ∂w ∂t + (uw) ∂x + (vw) ∂y + (w 2 ) ∂z = ∂p ∂z + 1 Re 2 w ∂x 2 + 2 w ∂y 2 + 2 w ∂z 2 (6.4) In this chapter no assumption is made about the relative magnitude of the velocity components, consequently the full forms of the Navier-Stokes equations are solved. Methods described in this section will be based, basically, on finite- volume and finite-difference discretizations and on the solution of a Poisson 1

Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Chapter 6

Solution of Navier-StokesEquations forIncompressible Flows UsingSIMPLE and MACAlgorithms

6.1 Introduction

In Cartesian coordinates, the governing equations for incompressible three-dimensional flows are

∂u

∂x+

∂v

∂y+

∂w

∂z= 0 (6.1)

∂u

∂t+

∂(u2)∂x

+∂(uv)

∂y+

∂(uw)∂z

= − ∂p

∂x+

1Re

[∂2u

∂x2+

∂2u

∂y2+

∂2u

∂z2

](6.2)

∂v

∂t+

∂(uv)∂x

+∂(v2)∂y

+∂(vw)

∂z= −∂p

∂y+

1Re

[∂2v

∂x2+

∂2v

∂y2+

∂2v

∂z2

](6.3)

∂w

∂t+

∂(uw)∂x

+∂(vw)

∂y+

∂(w2)∂z

= −∂p

∂z+

1Re

[∂2w

∂x2+

∂2w

∂y2+

∂2w

∂z2

](6.4)

In this chapter no assumption is made about the relative magnitude of thevelocity components, consequently the full forms of the Navier-Stokes equationsare solved. Methods described in this section will be based, basically, on finite-volume and finite-difference discretizations and on the solution of a Poisson

1

Page 2: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.2 Computational Fluid Dynamics

equation to determine the pressure. It may be mentioned that these methodsuse primitive variables u, v, w and p as function of x, y, z, t and Re which arepreferable in flow calculations.

6.2 Staggered Grid

As it has been seen, the major difficulty encountered during solution of in-compressible flow is the non-availability of any obvious equation for the pres-sure. This difficulty can be resolved in the stream- function-vorticity approach.This approach loses its advantage when three-dimensional flow is computedbecause of the fact that a single scalar stream-function does not exist in three-dimensional space. A three-dimensional problem demands a primitive-variableapproach. Efforts have been made so that two-dimensional as well as three-dimensional problems could be computed following a primitive variable ap-proach without encountering non-physical wiggles in the pressure distribution.As a remedy, it has been suggested to employ a different grid for each of thedependent variables.

Such a staggered grid for the dependant variables in a flow field was firstused by Harlow and Welch (1965), in their very well known MAC (Markerand Cell) method. Since then, it has been used by many researchers. Specif-ically, SIMPLE (Semi Implicit Method for Pressure Linked Equations) proce-dure of Patankar and Spalding (1972) has become popular. Figure 6.1 shows atwo-dimensional staggered where independent variables (ui,j ,vi,j and pi,j) withthe same indices staggered to one another. Extension to three-dimensions isstraight-forward. The computational domain is divided into a number of cells,which are shown as “main control volume” in Fig. 6.1. The location of the ve-locity components are at the center of the cell faces to which they are normal.If a uniform grid is used, the locations are exactly at the midway between thegrid points. In such cases the pressure difference between the two adjacent cellsis the driving force for the velocity component located at the interface of thesecells. The finite-difference approximation is now physically meaningful and thepressure field will accept a reasonable pressure distribution for a correct velocityfield.

Another important advantage is that transport rates across the faces of thecontrol volumes can be computed without interpolation of velocity components.The detailed outline of the two different solution procedures for the full Navier-Stokes equations with primitive variables using staggered grid will be discussedin subsequent sections. First we shall discuss the SIMPLE algorithm and thenthe MAC method will be described.

Page 3: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.3

����������������

����������������

x

Y

main control volume

indices staggeredvariables with same

u

= p pressure= v velocity

= u velocity

v velocity controlvolumes

����������������

����������������

��������������������

��������������������

Figure 6.1: Staggered grid.

6.3 Semi Implicit Method for Pressure Linked

Equations (SIMPLE)

SIMPLE algorithm is based on finite-volume discretization of the Navier-Stokesequations. The method was introduced by Patankar and Spalding (1972). Thediscretization indicated below corresponds to a uniform grid. The more generalcase of a non-uniform grid can be obtained from Patankar (1980). Consider thecontinuity equation

∂u

∂x+

∂v

∂y= 0

For the control volume shown in Fig. 6.2. The application of the finite-volumemethod to the continuity equation produes the following discretized form of theequation (

un+1i,j − un+1

i−1,j

)Δy +

(vn+1

i,j − vn+1i,j−1

)Δx = 0 (6.5)

6.3.1 x - momentum equation

The Navier-Stokes equation in x-direction in conservative form (using continuityequation) is given as

∂u

∂t+

∂(u)2

∂x+

∂(uv)∂y

+∂p

∂x=

1Re

[∂2u

∂x2+

∂2u

∂y2

]

Page 4: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.4 Computational Fluid Dynamics

������������������������������������

������������������������������������

v, j, y

u, i, x

U

i−1,j−1U

i−1,j+1 i,j+1U

i+1,j−1U

i+1,jU

i+1,j+1U

U i+1,j

i,j−1U

i+1,j−1V

i+1,j+1Vi,j+1Vi−1,j+1V

i,jVi−1,j i+1,jV

i,j

V

φi−1,j

Vi,j

φ Ui−1,j i,j

Vi,j−1Vi−1,j−1

φ

i,j−1φ

i,j+1φ

Figure 6.2: Control volume for continuity equation.

Integrating over the u-control volume (Fig. 6.3), we can write

ΔxΔy

Δt

(un+1

i,j − uni,j

)+∫∫ [

∂x

{u2 − 1

Re

∂u

∂x

}+

∂y

{uv − 1

Re

∂u

∂y

}]dxdy

+∫∫ (

∂p

∂x

)dxdy = 0

Application of Green’s theorem to the above expression leads to

ΔxΔy

Δt

(un+1

i,j − uni,j

)+(E1

i+ 12 ,j − E1

i− 12 ,j

)Δy +

(F 1

i,j+ 12− F 1

i,j− 12

)Δx

+(pn+1

i+1,j − pn+1i,j

)Δy = 0 (6.6)

where E1 and F 1 are defined as

E1 = u2 − 1Re

∂u

∂x

and

F 1 = uv − 1Re

∂u

∂y

E1 and F 1 are axial and transverse fluxes of x-momentum.Thus

E1i+ 1

2 ,j = 0.25 (ui,j + ui+1,j)2 − 1

Re

(ui+1,j − ui,j)Δx

Page 5: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.5

E1i− 1

2 ,j = 0.25 (ui−1,j + ui,j)2 − 1

Re

(ui,j − ui−1,j)Δx

F 1i,j+ 1

2= 0.25 (vi,j + vi+1,j) (ui,j + ui,j+1) − 1

Re

(ui,j+1 − ui,j

Δy

)

F 1i,j− 1

2= 0.25 (vi,j−1 + vi+1,j−1) (ui,j−1 + ui,j) − 1

Re

(ui,j − ui,j−1

Δy

)

The linearized form of these equations are

E1i+ 1

2 ,j = 0.25(un

i,j + uni+1,j

) (un+1

i,j + un+1i+1,j

)− 1Re

(un+1

i+1,j − un+1i,j

)Δx

E1i− 1

2 ,j = 0.25(un

i−1,j + uni,j

) (un+1

i−1,j + un+1i,j

)− 1Re

(un+1

i,j − un+1i−1,j

)Δx

F 1i,j+ 1

2= 0.25

(vn

i,j + vni+1,j

) (un+1

i,j + un+1i,j+1

)− 1Re

(un+1

i,j+1 − un+1i,j

)Δy

F 1i,j− 1

2= 0.25

(vn

i,j−1 + vni+1,j−1

) (un+1

i,j−1 + un+1i,j

)− 1Re

(un+1

i,j − un+1i,j−1

)Δy

u

i+1,j

i+1,ji+1,ju

i,ji,jp p

i,j−1

y

x

u i−1,j

i,jv v

v v i+1,j−1

Figure 6.3: Control volume for x-momentum equation.

Consequently, eq. (6.6) can be written as(ΔxΔy

Δt+ au

i,j

)un+1

i,j +∑

aunbu

n+1nb + bu + Δy

(pn+1

i+1,j − pn+1i,j

)= 0 (6.7)

Page 6: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.6 Computational Fluid Dynamics

In the above equation,∑

aunb un+1

nb signifies all the convective and diffusive

contributions from the neighboring nodes (un+1i+1,j , u

n+1i−1,j, u

n+1i,j+1, u

n+1i,j−1 and their

coefficients). The coefficients aui,j and au

nb contain grid sizes, and the solution ofu and v at nth time level. The term bu equals −ΔxΔy un

i,j/Δt. In the followingsub-section, equation (6.6) has been written term by term so that au

i,j , aunb and

bu in equation (6.7) can be clearly determined.Equation (6.6) can be expanded as(

ΔxΔy

Δtun+1

i,j − ΔxΔy

Δtun

i,j

)+

un+1i,j

{0.25(un

i,j + uni+1,j)Δy +

Δy

ReΔx

}+ un+1

i+1,j

{0.25(un

i,j + uni+1,j)Δy − Δy

ReΔx

}

−un+1i,j

{0.25(un

i−1,j + uni,j)Δy − Δy

ReΔx

}− un+1

i−1,j

{0.25(un

i−1,j + uni,j)Δy +

Δy

ReΔx

}

+un+1i,j

{0.25(vn

i,j + vni+1,j)Δx +

Δx

ReΔy

}+ un+1

i,j+1

{0.25(vn

i,j + vni+1,j)Δx − Δx

ReΔy

}

−un+1i,j

{0.25(vn

i,j−1 + vni+1,j−1)Δx − Δx

ReΔy

}− un+1

i,j−1

{0.25(vn

i,j−1 + vni+1,j−1)Δx

+Δx

ReΔy

}+(pn+1

i+1,j − pn+1i,j

)Δy = 0

or,

[ΔxΔy

Δt+ 0.25(un

i,j + uni+1,j)Δy − 0.25(un

i−1,j + uni,j)Δy + 0.25(vn

i,j + vni+1,j)Δx

−0.25(vni,j−1 + vn

i+1,j−1)Δx +Δy

ReΔx+

Δy

ReΔx+

Δx

ReΔy+

Δx

ReΔy

]un+1

i,j

+un+1i+1,j

{0.25(un

i,j + uni+1,j)Δy − Δy

ReΔx

}+ un+1

i−1,j

{0.25(un

i−1,j + uni,j)Δy − Δy

ReΔx

}

+un+1i,j+1

{0.25(vn

i,j + vni+1,j)Δx − Δx

ReΔy

}+ un+1

i,j−1

{−0.25(vn

i,j−1 + vni+1,j−1)Δx

− Δx

ReΔy

}− ΔxΔy

Δtun

i,j + Δy(pn+1

i+1,j − pn+1i,j

)= 0

Page 7: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.7

6.3.2 y- momentum equation

∂v

∂t+

∂x(uv) +

∂(v)2

∂y+

∂p

∂y=

1Re

{∂2v

∂x2+

∂2v

∂y2

}

Using the control volume shown in Fig. 6.4, the y momentum equation can beintegrated over v-control volume as

ΔxΔy

Δt

(vn+1

i,j − vni,j

)+∫∫ [

∂x

{uv − 1

Re

∂v

∂x

}+

∂y

{v2 − 1

Re

∂v

∂y

}]dxdy

+∫∫ (

∂p

∂y

)dxdy = 0

Application of Green’s theorem to the above expression leads to

Figure 6.4: Control volume for y-momentum equation.

ΔxΔy

Δt(vn+1

i,j − vni,j) + (E2

i+1/2,j − E2i−1/2,j)Δy + (F 2

i,j+1/2 − F 2i,j−1/2)Δx

+(pn+1i,j+1 − pn+1

i,j )Δx = 0 (6.8)

E2 = uv − 1Re

∂v

∂x, F 2 = v2 − 1

Re

∂v

∂y

Page 8: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.8 Computational Fluid Dynamics

Here E2 and F 2 are the axial and transverse fluxes of y-momentum

E2i+1/2,j = 0.25(ui,j + ui,j+1)(vi,j + vi+1,j) − 1

Re

(vi+1,j − vi,j)Δx

E2i−1/2,j = 0.25(ui−1,j + ui−1,j+1)(vi−1,j + vi,j) − 1

Re

(vi,j − vi−1,j)Δx

F 2i,j+1/2 = 0.25(vi,j + vi,j+1)2 − 1

Re

(vi,j+1 − vi,j)Δy

F 2i,j−1/2 = 0.25(vi,j−1 + vi,j)2 − 1

Re

(vi,j − vi,j−1)Δy

The linearized form of these equations are

E2i+ 1

2 ,j = 0.25(un

i,j + uni,j+1

) (vn+1

i,j + vn+1i+1,j

)− 1Re

(vn+1

i+1,j − vn+1i,j

)Δx

E2i− 1

2 ,j = 0.25(un

i−1,j + uni−1,j+1

) (vn+1

i−1,j + vn+1i,j

)− 1Re

(vn+1

i,j − vn+1i−1,j

)Δx

F 2i,j+ 1

2= 0.25

(vn

i,j + vni,j+1

) (vn+1

i,j + vn+1i,j+1

)− 1Re

(vn+1

i,j+1 − vn+1i,j

)Δy

F 2i,j− 1

2= 0.25

(vn

i,j−1 + vni,j

) (vn+1

i,j−1 + vn+1i,j

)− 1Re

(vn+1

i,j − vn+1i,j−1

)Δy

Substituting E2 and F 2 in Eq. (6.8) yields(ΔxΔy

Δt+ av

i,j

)vn+1

i,j +∑

avnbv

n+1nb + bv + Δx

(pn+1

i,j+1 − pn+1i,j

)= 0 (6.9)

At any intermediate stage, the solution is to be advanced from nth time levelto (n + 1)th time level. The term bv equals −ΔxΔyvn

i,j/Δt. The velocity isadvanced in two steps. First, the momentum equations (6.7) and (6.9) aresolved to obtain the provisional values of u∗, and v∗. It is not possible toobtain un+1 and vn+1 directly since the provisional velocities have not satisfiedthe continuity equation as yet.

Making use of the approximate velocity solution u∗, a pressure correctionδp will evolve which will give pn+1 = pn + δp and also a velocity correctionuc will be obtainable. As such, uc will correct u∗ in such a manner thatun+1 = u∗ + uc and un+1 will satisfy the continuity Eq. (6.5).In order to obtain u∗, Eqns. (6.7) and (6.9) are approximated as(

ΔxΔy

Δt+ au

i,j

)u∗

i,j +∑

aunbu

∗nb = −bu − Δy

(pn

i+1,j − pni,j

)(6.10)

(ΔxΔy

Δt+ av

i,j

)v∗i,j +

∑av

nbv∗nb = −bv − Δx

(pn

i,j+1 − pni,j

)(6.11)

Page 9: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.9

6.3.3 Solution Procedure

The Eqns. (6.10) and (6.11) can be evaluated in an implicit manner. For exam-ple, in Eq. (6.10) u∗

i,j and all the neighbors, u∗i+1,j, u∗

i−1,j, u∗i,j+1, and u∗

i,j−1 areunknowns and they can be expressed as a system of equations by substitutionof i = 2 to (imax - 1) and j = 2 to (jmax - 1). This will involve, solution of apenta-diagonal matrix. Patankar (1980) splits the evaluation procedure. At thefirst place, he writes Eqns. (6.10) and (6.11) as tridiagonal systems along eachx-grid line (j constant) and solves them using Thomas algorithm. In a sub-sequent step, Eqns. (6.10) and (6.11) are written as tridiagonal systems alongeach y-grid line (i constant) and solves them using Thomas algorithm. Thisis equivalent to implicit evaluation using ADI scheme. Now, if we substractEq. (6.10) from Eq. (6.7), we shall obtain(

ΔxΔy

Δt+ au

i,j

)uc

i,j =∑

aunb uc

nb − Δy (δpi+1,j − δpi,j) (6.12)

In a similar manner, Eq. (6.11) is substracted from Eq. (6.9) to produce acorrection equation for vc.(

ΔxΔy

Δt+ av

i,j

)vc

i,j =∑

avnb vc

nb − Δx (δpi,j+1 − δpi,j) (6.13)

In order to make the link between uc and δp explicit, Eq. (6.12) can be reducedto

uci,j =

E1 Δy (δpi,j − δpi+1,j)(1 + E1) au

i,j

(6.14)

where E1 = Δt aui,j/ΔxΔy

An equivalent expression can be obtained for vcj,k as

vci,j =

E2 Δx (δpi,j − δpi,j+1)(1 + E2) av

i,j

(6.15)

where E2 = Δt avi,j/ΔxΔy

Now, substitution of un+1i,j = u∗

i,j + uci,j and vn+1

i,j = v∗i,j + vci,j into (6.5) and

use of (6.14) and (6.15) produces

api,j δpi,j =

∑ap

nb δpnb + bp (6.16)

where, bp = − (u∗i,j − u∗

i−1,j

)Δy − (v∗i,j − v∗i,j−1

)Δx. Eq. (6.16) is basically a

discrete form of Poisson equation that is equivalent to

∇2(δp) =1

Δt∇.u∗ (6.17)

Eq. (6.14)and (6.15) can also be represented as

uc = − 1Δt

∇(δp) (6.18)

The algorithm may be summarized as

Page 10: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.10 Computational Fluid Dynamics

1. u∗ is obtained from equations (6.10) and (6.11).

2. δp is obtained from equation (6.16).

3. uc is obtained from equations (6.14) and (6.15).

4. pnew is obtained from pnew = pn+ α δp, where α is a relaxation parameter.

5. Calculate updated ui,j , vi,j from their starred values using velocity cor-rection formulae unew

i,j = u∗i,j + uc

i,j and vnewi,j = v∗i,j + vc

i,j

6. Treat the corrected pressure pnew as new initial pressure pn. Use unewi,j

and vnewi,j as un

i,j and vni,j . Calculate new u∗ from equations (6.10) and

(6.11). Repeat (2-5), the entire procedure until a converged solution isobtained. It may be noted that the solution converges as bp = 0.

Patankar (1980) introduced a revised algorithm, SIMPLER to improve the sit-uation. The SIMPLER algorithm has the following steps.

1. A velocity field u is computed from equations (6.10) and (6.11).

2. equation (6.16) then becomes a Poisson equation for pn+1 rather than δpwith u replacing the u∗ terms in b.

3. The pn+1 (obtained from step 2) replaces pn in equations (6.10) and (6.11),which are solved for u∗ (as it was done in SIMPLE).

4. Equation (6.16) is solved for δp and it is used to provide un+1 = u∗ + uc

but no further adjustment is made to pn+1.

Van Doormal and Raithby (1984) proposed SIMPLEC which is another modi-fied version of SIMPLE algorithm and gives faster convergence.

6.3.4 Two-dimensional System of Equations and Line-by-line TDMA

Whether the discretized momentum Eqns. (6.10) and (6.11) or the pressurecorrection Eq. (6.16) the final outcome is a system of algebraic equation givenby aP φP = aEφE + aW φW + aNφN + aSφS + b. The current values of thedependent variables (φ′s) are to be evaluated from the known values of thecoefficients (a’s). The evaluation algorithm will be same for the momentumequations and the pressure correction equation. On a rectangular grid, thedependent variables at one point (i, j) may be expressed in terms of its neighbors(Fig. 6.5) as

ai,jui,j = bi,jui+1,j + ci,jui−1,j + di,jui,j+1 + ei,jui,j−1 + fi,j

Page 11: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.11

where bi,j is equivalent to aE , ci,j to aW , di,j to aN , ei,j to aS and fi,j to b. Theevaluation of u can be accomplished in the following ways:(a) Vertical Sweep Upwards may be written in a pseudo FORTRAN code as

DO 10 J = 2, M - 1DO 10 I = 2, L - 1

10 ai,jui,j = bi,jui+1,j + ci,jui−1,j + (di,j ui,j+1 + ei,j ui,j−1 + fi,j)

Here u is the currently available value in storage and all the coefficients includingfi,j are known. for each j, we shall get a system of equations if we susbtitutei = 2......L − 1. In other words, for each j, a tridiagonal matrix is availablewhich can be solved for all i row of points at that j. Once one complete row isevaluated for any particular j, the next j will be taken up, and so on.(b) Horizontal Sweep Forward may be written in pseudo FORTRAN code as

DO 20 I = 2, L - 1DO 20 J = 2, M - 1

20 ai,jui,j = di,jui,j+1 + ei,jui,j−1 + (bi,j ui+1,j + ci,j ui−1,j + fi,j)

Again u is the currently available value in storage from previous calculations.

i

j

i,j

i+1,j

i,j+1

i,j−1

i−1,j

M

2

11 2

N

W P E

S

L−1 L

M−1

Figure 6.5: Dependent variable at (i, j) is expressed in terms of neigh-boring points.

For each i, we get a system of equation if we substitute j = 2....M − 1. Atridiagonal matrix is available for each i. Once one complete column of points

Page 12: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.12 Computational Fluid Dynamics

are evaluated for any particular i, the next i will be taken up and so on. Thevertical sweep upward and downward are repeated. Similarly the horizontalsweep forward and rearward are also repeated until convergence is achieved.For solving tridiagonal system, the tridiagonal matrix algorithm (TDMA) dueto Thomas (1949) is deployed. The above mentioned evaluation procedure isknown as line-by-line TDMA.

6.4 Solution of the Unsteady Navier-Stokes Equa-

tions

6.4.1 Introduction to the MAC method

The MAC method of Harlow and Welch is one of the earliest and most usefulmethods for solving the Navier-Stokes equations. This method necessarily dealswith a Poisson equation for the pressure and momentum equations for thecomputation of velocity. It was basically developed to solve problems withfree surfaces, but can be applied to any incompressible fluid flow problem. Amodified version of the original MAC method due to Hirt and Cook (1972) hasbeen used by researchers to solve a variety of flow problems.

The text discusses the modified MAC method and highlights the salientfeatures of the solution algorithm so that the reader is able to write a com-puter program with some confidence. The important ideas on which the MACalgorithm is based are:

1. Unsteady Navier-Stokes equations for incompressible flows in weak con-servative form and the continuity equation are the governing equations.

2. Description of the problem is elliptic in space and parabolic in time. Solu-tion will be marched in the time direction. At each time step, a convergedsolution in space is obtained but this converged solution at any time stepmay not be the solution of the physical problem.

3. If the problem is steady, in its physical sense, then after a finite numberof steps in time direction, two consecutive time steps will show identicalsolutions. However, in a machine-computation this is not possible hencea very small upper bound, say, “STAT” is predefined. Typically, STATmay be chosen between 10−3 and 10−5. If the maximum discrepency ofany of the velocity components for two consecutive time steps for anylocation over the entire space does not exceed STAT, then it can be saidthat the steady solution has been evolved.

4. If the physical problem is basically unsteady in nature, the aforesaid maxi-mum discrepancy of any dependant variable for two consecutive time stepswill never be less than STAT. However, for such a situation, a specifiedvelocity component can be stored over a long duration of time and plot of

Page 13: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.13

the velocity component against time (often called as signal) depicts thecharacter of the flow. Such a flow may be labelled simply as “unsteady”.

5. With the help of the momentum equations, we compute explicitly a pro-visional value of the velocity components for the next time step.

Consider the weak conservative form of the nondimensional momentumequation in the x-direction:

∂u

∂t+

∂(u2)∂x

+∂(uv)

∂y+

∂(uw)∂z

= − ∂p

∂x+

1Re

∇2u

It is assumed that at t = nth level, we have a converged solution. Thenfor the next time step

un+1i,j,k − un

i,j,k

Δt= [CONDIFU − DPDX ]ni,j,k

or

un+1i,j,k = un

i,j,k + Δt [CONDIFU − DPDX ]ni,j,k (6.19)

[CONDIFU − DPDX ]ni,j,k consists of convective and diffusive terms,and the pressure gradient. Similarly, the provisional values for vn+1

i,j,k andwn+1

i,j,k can be explicitly computed. These explicitly advanced velocity com-ponents may not constitute a realistic flow field. A divergence-free velocityfield has to exist in order to describe a plausible incompressible flow situa-tion. Now, with these provisional un+1

i,j,k, vn+1i,j,k and wn+1

i,j,k values, continuityequation is evaluated in each cell. If (∇ · V ) produces a nonzero value,there must be some amount of mass accumulation or annihilation in eachcell which is not physically possible. Therefore the pressure at any cell isdirectly linked with the value of the (∇·V ) of that cell. Now, on one handthe pressure has to be calculated with the help of the nonzero divergencevalue and on the other, the velocity components have to be adjusted.The correction procedure continues through an iterative cycle untill thedivergence-free velocity field is ensured. Details of the procedure will bediscussed in the subsequent section.

6. Boundary conditions are to be applied after each explicit evaluation forthe time step is accomplished. Since the governing equations are elliptic inspace, boundary conditions on all confining surfaces are required. More-over, the boundary conditions are also to be applied after every pressure-velocity iteration. The five types of boundary conditions to be consideredare rigid no-slip walls, free-slip walls, inflow and outflow boundaries, andperiodic (repeating) boundaries.

Page 14: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.14 Computational Fluid Dynamics

6.4.2 MAC Formulation

The region in which computations are to be performed is divided into a setof small cells having edge lengths δx, δy and δz (Fig. 6.6). With respect tothis set of computational cells, velocity components are located at the centreof the cell faces to which they are normal and pressure and temperature aredefined at the centre of the cells. Cells are labeled with an index (i,j,k) whichdenotes the cell number as counted from the origin in the x, y and z directionsrespectively. Also pi,j,k is the pressure at the centre of the cell (i,j,k), whileui,j,k is the x-direction velocity at the centre of the face between cells (i,j,k) and(i + 1, j, k) and so on (Fig. 6.7). Because of the staggered grid arrangements,the velocities are not defined at the nodal points, but whenever required, theyare to be found by interpolation. For example, with uniform grids, we can write

ui−1/2,j,k =12[ui−1,j,k + ui,j,k]. Where a product or square of such a quantity

appears, it is to be averaged first and then the product to be formed.

i

k

j

i=1

x

i=iim i=ire

k=krek=kim

j=jre

j=jim

z

B

L

y

j=1

δ

δ

δ

H

k=1

Figure 6.6: Discretization of a three-dimensional domain.

Convective terms are discretized using a weighted averaged of second upwindand space centered scheme (Hirt et al., 1975). Diffusive terms are discretizedby a central differencing scheme. Let us consider the discretized terms of thex-momentum equation (Figure 6.7):

Page 15: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.15

δy

δz

δx

u

u

u

u

v

v

v

vi+1,j.k

i,j.k

i,j+1,k

i,j,ki,j+1,k

i+1,j−1,k

i,j−1,k

i+1,j,kp

wi,j.k−1vi,j−1,k

u i−1,j,k

θi,j.k

i,j.k

Figure 6.7: Three-dimensional staggered grid showing the locationsof the discretized variables.

∂(u2)∂x

=1

4δx[(ui,j,k + ui+1,j,k)(ui,j,k + ui+1,j,k)

+ α|(ui,j,k + ui+1,j,k)|(ui,j,k − ui+1,j,k)− (ui−1,j,k + ui,j,k)(ui−1,j,k + ui,j,k)− α|(ui−1,j,k + ui,j,k)|(ui−1,j,k − ui,j,k)

≡ DUUDX

∂(uv)∂y

=1

4δy[(vi,j,k + vi+1,j,k)(ui,j,k + ui,j+1,k)

+ α|(vi,j,k + vi+1,j,k)|(ui,j,k − ui,j+1,k)− (vi,j−1,k + vi+1,j−1,k)(ui,j−1,k + ui,j,k)− α|(vi,j−1,k + vi+1,j−1,k)|(ui,j−1,k − ui,j,k)

≡ DUV DY

∂(uw)∂z

=1

4δz[(wi,j,k + wi+1,j,k)(ui,j,k + ui,j,k+1)

+ α|(wi,j,k + wi+1,j,k)|(ui,j,k − ui,j,k+1)− (wi,j,k−1 + wi+1,j,k−1)(ui,j,k−1 + ui,j,k)− α|(wi,j,k−1 + wi+1,j,k−1)|(ui,j,k−1 − ui,j,k)

≡ DUWDZ

Page 16: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.16 Computational Fluid Dynamics

∂p

∂x=

pi+1,j,k − pi,j,k

δx≡ DPDX

∂2u

∂x2=

ui+1,j,k − 2ui,j,k + ui−1,j,k

(δx)2≡ D2UDX2

∂2u

∂y2=

ui,j+1,k − 2ui,j,k + ui,j−1,k

(δy)2≡ D2UDY 2

∂2u

∂z2=

ui,j,k+1 − 2ui,j,k + ui,j,k−1

(δz)2≡ D2UDZ2

with

α −→ 1 Scheme −→ Second Upwindα −→ 0 Scheme −→ Space centred

Factor α is chosen in such a way that the differencing scheme retains “some-thing” of second-order accuracy and the required upwinding is done for thesake of stability. A typical value of α is between 0.2 and 0.3. As mentionedearlier, the quantity un+1

i,j,k is now evaluated explicitly from the discretized formof Equation (6.2) as

un+1i,j,k = un

i,j,k+δt [CONDIFU − DPDX ]ni,j,k

where

[CONDIFU − DPDX ]ni,j,k = [(−DUUDX − DUV DY − DUWDZ)

− DPDX + (1/Re)(D2UDX2+ D2UDY 2 + D2UDZ2)]

Similarly, we evaluate

vn+1i,j,k = vn

i,j,k+δt [CONDIFV − DPDY ]ni,j,k (6.20)

wn+1i,j,k = wn

i,j,k+δt [CONDIFW − DPDZ]ni,j,k (6.21)

As discussed earlier, the explicitly advanced tilde velocities may not necessarilylead to a flow field with zero mass divergence in each cell. This implies that, atthis stage the pressure distribution is not correct, the pressure in each cell willbe corrected in such a way that there is no net mass flow in or out of the cell.In the original MAC method, the corrected pressures were obtained from thesolution of a Poisson equation for pressure. A related technique developed byChorin (1967) involved a simultaneous iteration on pressure and velocity com-ponents. Vieceli (1971) showed that the two methods as applied to MAC areequivalent. We shall make use of the iterative correction procedure of Chorin

Page 17: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.17

(1967) in order to obtain a divergence-free velocity field. The mathematicalmethodology of this iterative pressure-velocity correction procedure will be dis-cussed herein.

The relationship between the explicitly advanced velocity component and ve-locity at the previous time step may be written as

un+1i,j,k = un

i,j,k + δt[pn

i,j,k − pni+1,j,k]

Δx+ δt [CONDIFU ]ni,j,k (6.22)

where [CONDIFU ]ni,j,k is only the contribution from convection and diffusionterms. On the other hand, the corrected velocity component (unknown) will berelated to the corrected pressure (also unknown) in the following way:

un+1i,j,k = un

i,j,k + δt[pn+1

i,j,k − pn+1i+1,j,k]

Δx+ δt [CONDIFU ]ni,j,k (6.23)

From Equations (6.22) and (6.23)

un+1i,j,k − un+1

i,j,k = δt[p

′i,j,k − p

′i+1,j,k]

δx

where the pressure correction may be defined as

p′i,j,k = pn+1

i,j,k − pni,j,k

Neither the pressure correction nor is the quantity un+1i,j,k explicitly known at

this stage. Hence, one cannot be calculated without the help of the other.Calculations are done in an iterative cycle and we write

corrected Estimated Correction

un+1i,j,k −→ un+1

i,j,k + δt[p

′i,j,k − p

′i+1,j,k]

δx

In a similar way, we can formulate the following array:

un+1i,j,k −→ un+1

i,j,k + δt[p

′i,j,k − p

′i+1,j,k]

δx(6.24)

un+1i−1,j,k −→ un+1

i−1,j,k − δt[p

′i,j,k − p

′i−1,j,k]

δx(6.25)

vn+1i,j,k −→ vn+1

i,j,k + δt[p

′i,j,k − p

′i,j+1,k]

δy(6.26)

vn+1i,j−1,k −→ vn+1

i,j−1,k − δt[p

′i,j,k − p

′i,j−1,k]

δy(6.27)

wn+1i,j,k −→ wn+1

i,j,k + δt[p

′i,j,k − p

′i,j,k+1]

δz(6.28)

wn+1i,j,k−1 −→ wn+1

i,j,k−1 − δt[p

′i,j,k − p

′i,j,k−1]

δz(6.29)

Page 18: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.18 Computational Fluid Dynamics

The correction is done through the continuity equation. Plugging-in the aboverelationship into the continuity equation (6.1) yields[

un+1i,j,k − un+1

i−1,j,k

δx+

vn+1i,j,k − vn+1

i,j−1,k

δy+

wn+1i,j,k − wn+1

i,j,k−1

δz

]

=

[un+1

i,j,k − un+1i−1,j,k

δx+

vn+1i,j,k − vn+1

i,j−1,k

δy+

wn+1i,j,k − wn+1

i,j,k−1

δz

]

−δt

[p

′i+1,j,k − 2p

′i,j,k + p

′i−1,j,k

(δx)2+

p′i,j+1,k − 2p

′i,j,k + p

′i,j−1,k

(δy)2

+p

′i,j,k+1 − 2p

′i,j,k + p

′i,j,k−1

(δz)2

](6.30)

or [un+1

i,j,k − un+1i−1,j,k

δx+

vn+1i,j,k − vn+1

i,j−1,k

δy+

wn+1i,j,k − wn+1

i,j,k−1

δz

]

=

[un+1

i,j,k − un+1i−1,j,k

δx+

vn+1i,j,k − vn+1

i,j−1,k

δy+

wn+1i,j,k − wn+1

i,j,k−1

δz

]

+2 δt (p

′i,j,k)

δx2 +2 δt (p

′i,j,k)

δy2 +2 δt (p

′i,j,k)

δz2 (6.31)

In deriving the above expression, it is assumed that the pressure corrections inthe neighboring cells are zero. Back to the calculations, we can write

0 = (Div)i,j,k + p′i,j,k

[2δt

(1

δx2 +1

δy2 +1

δz2

)]

or

p′i,j,k =

−(Div)i,j,k[2δt(

1δx2 + 1

δy2 + 1δz2

)] (6.32)

In order to accelerate the calculation, the pressure correction equation is mod-ified as

p′i,j,k =

−ω0(Div)i,j,k[2δt(

1δx2 + 1

δy2 + 1δz2

)] (6.33)

where ω0 is the overrelaxation factor. A value of ω0 = 1.7 is commonly used.The value of ω0 giving most rapid convergence, should be determined by nu-merical experimentation. After calculating p

′i,j,k, the pressure in the cell (i, j, k)

is adjusted aspn+1

i,j,k −→ pni,j,k + p

′i,j,k (6.34)

Page 19: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.19

Now the pressure and velocity components for each cell are corrected throughan iterative procedure in such a way that for the final pressure field, the velocitydivergence in each cell vanishes. The process is continued till a divergence-freevelocity is reached with a prescribed upper bound; here a value of 0.0001 isrecommended.

Finally, we discuss another important observation. If the velocity bound-ary conditions are correct and a divergence-free converged velocity field hasbeen obtained, eventually correct pressure will be determined in all the cells atthe boundary. Thus, this method avoids the application of pressure boundaryconditions. This typical feature of modified MAC method has been discussedin more detail by Peyret and Taylor (1983). However, it was also shown byBrandt, Dendy and Ruppel (1980) that the aforesaid pressure-velocity itera-tion procedure of correcting pressure is equivalent to the solution of Poissonequation for pressure. As such from Eqn. (6.30) we can directly write as

∇2(p′i,j,k) =

(Div)i,j,k

δt(6.35)

The Eqn. (6.35) can be solved implicitly using appropriate boundary condi-tions for p

′at the confining boundaries.

6.4.3 Boundary Conditions

So far we have not discussed the boundary conditions. However, they areimposed by setting appropriate velocities in the fictitious cells surrounding thephysical domain (Figure 6.8).Consider, for example, the bottom boundary of the computational (physical)mesh. If this boundary is to be a rigid no-slip wall, the normal velocity on thewall must be zero and the tangential velocity components should also be zero.Here we consider a stationary wall. With reference to the Figure 6.8, we have

vi,1,k = 0ui,1,k = −ui,2,k

wi,1,k = −wi,2,k

⎫⎬⎭ for i = 2 to ire

and k = 2 to kre

If the right side of the wall is a free-slip (vanishing shear) boundary, the nor-mal velocity must be zero and the tangential velocities should have no normalgradient.

wi,j,1 = 0ui,j,1 = ui,j,2

vi,j,1 = vi,j,2

⎫⎬⎭ for i = 2 to ire

and j = 2 to jre

If the front plane is provided with inflow boundary conditions, it should be spec-ified properly. Any desired functional relationship may be recommended. Gen-erally, normal velocity components are set to zero and a uniform or parabolic

Page 20: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.20 Computational Fluid Dynamics

axial velocity may be deployed. Hence with reference to Fig. 6.8, we can write

v1,j,k = −v2,j,k

w1,j,k = −w2,j,k

u1,j,k = 1.0 oru1,j,k = 1.5

[1 − ((jm − j)/jm)2

]⎫⎪⎪⎬⎪⎪⎭

for j = 2 to jreand k = 2 to kre

where jm is the horizontal midplane.Continuative or outflow boundaries always pose a problem for low-speed

�����

�����

����

i

k

j

i=1

x

i=iim i=ire

k=kim

j=jre

j=jim

z

B

y

j=1

δ

δ

δ

H

k=1k=kre

Right side wall

Front inflow plane

Bottom boundary

Outflow boundary

L

Fictitious orImaginaryCell

Figure 6.8: Boundary conditions and fictitious boundary cells.

calculations, because whatever prescription is chosen it can affect the entireflow upstream. What is needed is a prescription that permits fluid to flow outof the mesh with a minimum of upstream influence. Commonly used conditionsfor such a boundary is ∇V · n = 0, where n is the unit normal vector.

The boundary condition that has more generality at the outflow is describedby Orlanski (1971). This condition allows changes inside the flow field to betransmitted outward, but not vice-versa:

∂Ψ∂t

+ Uav∂Ψ∂x

= 0

where Uav is the average velocity at the outflow plane and Ψ represents u, v, wor any dependent variable.

Page 21: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.21

6.4.4 Numerical Stability Considerations

For accuracy, the mesh size must be chosen small enough to resolve the expectedspatial variations in all dependent variables. Once a mesh has been chosen,the choice of the time increment is governed by two restrictions, namely, theCourant-Fredrichs-Lewy (CFL) condition and the restriction on the basis ofgrid-Fourier numbers. According to the CFL condition, material cannot movethrough more than one cell in one time step, because the difference equationsassume fluxes only between the adjacent cells. Therefore, the time incrementmust satisfy the inequality.

δt < min{

δx

|u| ,δy

|v| ,δz

|w|}

(6.36)

where the minimum is with respect to every cell in the mesh. Typically, δtis chosen equal to one-fourth to one-third of the minimum cell transit time.When the viscous diffusion terms are more important, the condition necessaryto ensure stability is dictated by the restriction on the Grid-Fourier numbers,which results in

νδt <12· (δx2δy2δz2)(δx2 + δy2 + δz2)

(6.37)

in dimensional form. After non-dimensionilization, this leads to

δt <12· (δx2δy2δz2)(δx2 + δy2 + δz2)

Re (6.38)

The final δt for each time increment is the minimum of the δt’s obtained fromEquations (6.36) and (6.38)

The last quantity needed to ensure numerical stability is the upwind pa-rameter α. In general, α should be slightly larger than the maximum value of|uδt/δx] or |vδt/δy] occurring in the mesh, that is,

max{∣∣∣∣uδt

δx

∣∣∣∣ ,∣∣∣∣vδt

δy

∣∣∣∣ ,∣∣∣∣wδt

δz

∣∣∣∣}

≤ α < 1 (6.39)

As a ready prescription, a value between 0.2 and 0.4 can be used for α. If αis too large, an unnecessary amount of numerical diffusion (artificial viscosity)will be introduced.

6.4.5 Higher-Order Upwind Differencing

More accurate solutions are obtained if the convective terms are discretized byhigher-order schemes. Davis and Moore (1982) use the MAC method with amultidimensional third-order upwinding scheme. Needless to mention that theirmarching algorithm for the momentum equation is explicit and the stability re-striction concerning the CFL condition [uδt/δx ≤ 1 and vδt/δy ≤ 1] is satisfied.

Page 22: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.22 Computational Fluid Dynamics

������������������������������������

������������������������������������

v, j, y

u, i, x

U

i−1,j−1U

i−1,j+1 i,j+1U

i+1,j−1U

i+1,jU

i+1,j+1U

U i+1,j

i,j−1U

i+1,j−1V

i+1,j+1Vi,j+1Vi−1,j+1V

i,jVi−1,j i+1,jV

i,j

V

φi−1,j

Vi,j

φ Ui−1,j i,j

Vi,j−1Vi−1,j−1

φ

i,j−1φ

i,j+1φ

Figure 6.9: Dependent variables(u, v and φ) on a rectangular grid.

The multidimensional third-order upwinding is in principle similar to one di-mensional quadratic upstream interpolation scheme introduced by Leonard(1979). Consider Fig. 6.9. Let φ be any property which can be convected

and diffused. The convective term∂(uφ)

∂xmay be represented as

∂(uφ)∂x

=(uφ)i+ 1

2 ,j − (uφ)i− 12 ,j

δx(6.40)

where the variables φi+ 12 ,j and φi− 1

2 ,j are defined as

φi+ 12 ,j = 0.5(φi,j + φi+1,j) − ξ

3(φi−1,j − 2φi,j + φi+1,j) for ui,j ≤ 0 (6.41)

and

φi− 12 ,j = 0.5(φi,j + φi−1,j) − ξ

3(φi−2,j − 2φi−1,j + φi,j) for ui,j > 0 (6.42)

The parameter ξ can be chosen to increase the accuracy or to alter the diffusion-like characteristics. It may be pointed out ξ = 3/8 corresponds to the QUICKscheme of Leonard(1979).Let us consider two-dimensional momentum equation in weak conservative formwhich is given by

∂u

∂t+

∂(u2)∂x

+∂(uv)

∂y= − ∂p

∂x+

1Re

[∂2u

∂x2+

∂2u

∂y2

](6.43)

Page 23: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.23

In non-conservative form this may be written as

∂u

∂t+ u

∂u

∂x+ v

∂u

∂y= − ∂p

∂x+

1Re

[∂2u

∂x2+

∂2u

∂y2

](6.44)

Here we introduce a term transport-velocity. The transport velocities for thesecond and third terms on the left hand side are u and v respectively. Whiledealing with the equations in the conservative form, we shall keep this in mind.For example, during discretization of the term ∂(uv)/∂y of Eq. (6.43) we shouldremember that v is the transport-velocity associated with this term. It is cus-tomary to define the transport-velocity at the nodal point where the equationis being defined. In case of the term ∂(uv)/∂y we have to refer to Fig. 6.10 andwrite down the product term uv as

(uv)i,j = 0.25ui,j(vi,j + vi+1,j + vi,j−1 + vi+1,j−1) (6.45)

Finally the discretization of the term ∂(uv)/∂y for the x-momentum equationwill be accomplished in the following way:

∂(uv)∂y

=0.251

8δy

[3ui,j+1(vi,j+1 + vi,j + vi+1,j+1 + vi+1,j)+ 3ui,j(vi,j + vi,j−1 + vi+1,j + vi+1,j−1)− 7ui,j−1(vi,j−1 + vi,j−2 + vi+1,j−1 + vi+1,j−2)+ ui,j−2(vi,j−2 + vi,j−3 + vi+1,j−2 + vi+1,j−3)] for V > 0 (6.46)

∂(uv)∂y

=0.251

8δy

[−ui,j+2(vi,j+2 + vi,j+1 + vi+1,j+2 + vi+1,j+1)+ 7ui,j+1(vi,j+1 + vi,j + vi+1,j+1 + vi+1,j)− 3ui,j(vi,j + vi,j−1 + vi+1,j + vi+1,j−1)− 3ui,j−1(vi,j−1 + vi,j−2 + vi+1,j−1 + vi+1,j−2)] for V < 0 (6.47)

whereV = vi,j + vi+1,j + vi,j−1 + vi+1,j+1

6.4.6 Sample Results

For unsteady laminar flow past a rectangular obstacle in a channel, Mukhopad-hyay, Biswas and Sundararajan (1992) use the MAC algorithm to explicitlymarch in time. Their results corroborated with the experimental observationof Okajima (1982). A typical example of numerical flow visualization depictingthe development of von Karman vortex street is illustrated in Fig. 6.11. Thecross-stream vorticity contours vectors behind a delta-winglet placed inside a

Page 24: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.24 Computational Fluid Dynamics

v,j,y

v v

u

vv

i,j i+1,j

i,j

i+1,j−1i,j−1

u,i,x

Figure 6.10: Definition of the transport velocity at a point where themomentum equation is being discretized.

channel are shown in Fig. 6.12. These results were obtained by Biswas, Torii etal. (1996) who used MAC to solve for a three-dimensional flow field in a chan-nel containing delta-winglet as a vortex generator. The MAC algorithm hasbeen extensively used by the researchers to solve flows in complex geometry.Braza, Chassaing and Ha-Minh (1986) investigated the dynamic characteris-tics of the pressure and velocity fields of the unsteady wake behind a circularcylinder using MAC algorithm. Robichaux, Tafti and Vanka (1992) deployedMAC algorithm for Large Eddy Simulation (LES) of turbulent channel flows.Of course, they performed the time integration of the discretized equations byusing a fractional step method (Kim and Moin, 1985). Another investigation byKim and Benson (1992) suggests that the MAC method is significantly accurateand at the same time the computational effort is reasonable.

6.5 Solution of Energy Equation

The energy equation for incompressible flows, neglecting mechanical work andgas radiation, may be written as

ρcp

[∂T

∂t∗+ u∗ ∂T

∂x∗ + v∗∂T

∂y∗ + w∗ ∂T

∂z∗

]= k∇2T + μφ∗ (6.48)

Page 25: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.25

Figure 6.11: Streamlines crossing the cylinder in the duct: ReB =162

Figure 6.12: (a) & (b) Vorticity contours behind a cross-plane Xc =2.5 behind the winglet at β = 15◦ (a) experiment, (b) computation

where φ∗ is the viscous dissipation given as

φ∗ = 2

[(∂u∗

∂x∗

)2

+(

∂v∗

∂y∗

)2

+(

∂w∗

∂x∗

)2]

+{

∂u∗

∂x∗ +∂v∗

∂y∗

}2

+{

∂w∗

∂y∗ +∂v∗

∂z∗

}2

+{

∂w∗

∂x∗ +∂u∗

∂z∗

}2

Page 26: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.26 Computational Fluid Dynamics

Figure 6.12(c) Formation of complex vortex system due to the winglet

Equation (6.48) may be non-dimensionalized in the following way:

u =u∗

U∞, v =

v∗

U∞, w =

w∗

U∞, θ =

T − T∞Tw − T∞

x =x∗

L, v =

y∗

L, z =

z∗

L, t =

t∗

L/U∞

Substituting the above variables in equation (6.48) we obtain

ρcpU∞(Tw − T∞)L

[∂θ

∂t+ u

∂θ

∂x+ v

∂θ

∂y+ w

∂θ

∂z

]

=(Tw − T∞)k

L2

[∂2θ

∂x2+

∂2θ

∂y2+

∂2θ

∂z2

]+

μU2∞L2

φ (6.49)

where φ is the nondimensional form of φ∗. Finally, the normalized energyequation becomes

∂θ

∂t+ u

∂θ

∂x+ v

∂θ

∂y+ w

∂θ

∂z=

1Pe

[∂2θ

∂x2+

∂2θ

∂y2+

∂2θ

∂z2

]+

Ec

Reφ (6.50)

where Pe, the Peclet number is given as

1Pe

=(Tw − T∞)k

L2· L

ρcpU∞(Tw − T∞)

or1

Pe=

k

LρcpU∞=

k

μcp· μ

ρLU∞=

1Pr

· 1Re

Further, Ec, the Eckert number is

Ec

Re=

μU2∞L2

· L

ρcpU∞(Tw − T∞)=

U2∞cp(Tw − T∞)

· 1ρU∞L/μ

Page 27: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.27

6.5.1 Retention of Dissipation

The dissipation term φ is frequently neglected while solving the energy equationfor incompressible flows. As the Mach number M → 0, Ec → 0. However, evenat a low Mach number, φ can be important if (Tw − T∞) is very small. Let uslook at these aspects. Since

Ec =U2∞

cp(Tw − T∞),

1Ec

=cpT∞U2∞

[Tw

T∞− 1]

and

cpT∞U2∞

=cpγRT∞γRU2∞

where R is the gas constant = cp − cv, and γ = cp/cv.Let the local acoustic velocity C =

√γRT∞, and Mach number M∞ = U∞/C

Then,

cpT∞U2∞

=cp

γ(cp − cv)

[1

M2∞

]=

cp

γcp

(1 − 1

γ

) [ 1M2∞

]=

1(γ − 1)

1M2∞

Hence,

1Ec

=1

(γ − 1)M2∞

(Tw

T∞− 1)

or

Ec =(γ − 1)M2

∞((Tw/T∞) − 1)

In general for incompressible flows M∞ < 0.3 and γ ≥ 1. Hence Ec is small.But for very small temperature difference, i.e., if Tw/T∞ is slightly larger than1, Ec might assume a large value and importance of dissipation arises.However, for computing incompressible convective flows, the viscous dissipa-tion is neglected in this chapter and we continue with the steady state energyequation.

6.6 Solution Procedure

The steady state energy equation, neglecting the dissipation term, may be writ-ten in the following conservative form as

∂(uθ)∂x

+∂(vθ)∂y

+∂(wθ)

∂z=

1Pe

[∂2θ

∂x2+

∂2θ

∂y2+

∂2θ

∂z2

](6.51)

Page 28: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.28 Computational Fluid Dynamics

Equation (6.51) may be written as

∇2θ = Pe [CONV T ]mi,j,k (6.52)

where [CONV T ]mi,j,k is the discretized convective terms on the left-hand side ofEquation (6.51) and m stands for the iterative counter. To start with, we canassume any guess value of θ throughout the flow field. Since u, v, w are knownfrom the solution of momentum equation hence Equation 6.51 is now a linearequation. However, from the guess value of θ and known correct values of u,v and w the left-hand side of Equation 6.51 is evaluated. A weighted averagescheme or QUICK scheme may be adapted for discretization of the convectiveterms. After discretizing and evaluating right-hand side of Equation (6.52) weobtain a Poisson equation for the temperature with a source term on the righthand side. Now, we shall follow SOR technique for solving Equation (6.52).Consider a discretized equation as

θi+1,j,k − 2θi,j,k + θi−1,j,k

(δx)2+

θi,j+1,k − 2θi,j,k + θi,j−1,k

(δy)2

+θi,j,k+1 − 2θi,j,k + θi,j,k−1

(δz)2= S∗m

where

S∗m ≡ Pe [CONV T ]mi,j,k

or

A∗m − θi,j,k

[(2

δx2 +2

δy2 +2

δz2

)]= S∗m

or

θi,j,k =A∗m − S∗m[(

2δx2 + 2

δy2 + 2δz2

)] (6.53)

where

A∗m =θm

i+1,j,k + θmi−1,j,k

(δx)2+

θmi,j+1,k + θm

i,j−1,k

(δy)2+

θmi,j,k+1 + θm

i,j,k−1

(δz)2

θi,j,k in Equation (6.53) may be assumed to be the most recent value and itmay be written as θm′

i,j,k. In order to accelerate the speed of computation weintroduce an overrelaxation factor ω. Thus

θm+1i,j,k = θm

i,j,k + ω[θm′

i,j,k − θmi,j,k

](6.54)

where θmi,j,k is the previous value, θm′

i,j,k the most recent value and θm+1i,j,k the cal-

culated better guess. The procedure will continue till the required convergenceis achieved. This is equivalent to Gauss-Seidel procedure for solving a systemof linear equations.

Page 29: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.29

References

1. Biswas, G., Torii, K., Fujii, D., and Nishino, K., Numerical and Exper-imental Determination of Flow Structure and Heat Transfer Effects ofLongitudinal Vortices in a Channel Flow, Int. J. Heat Mass Transfer,Vol. 39, pp. 3441-3451, 1996.

2. Biswas, G., Breuer, M. and Durst, M., Backward-Facing Step Flows forVarious Expansion Ratios at Low and Moderate Reynolds Numbers, Jour-nal of Fluids Engineering (ASME), Vol. 126, pp. 362-374, 2004.

3. Brandt, A., Dendy, J.E and Rupppel, H., The Multigrid Method for Semi-Implicity Hydrodynamics Codes, J. Comput. Phys, Vol. 34, pp. 348-370,1980.

4. Braza, M., Chassaing P. and Ha Minh, H., Numerical Study and Phys-ical Analysis of the Pressure and Velocity Fields in the Near-Wake of aCircular Cylinder, J. Fluid Mech., Vol. 165, pp. 79-130, 1986.

5. Chorin, A.J., Numerical Method for Solving Incompressible Viscous FlowProblems, J. Comput. Phys., Vol. 2, pp. 12-26, 1967.

6. Davis, R.W. and Moore, E. F., A Numerical Study of Vortex Sheddingfrom Rectangles, J. Fluid Mech., 116: 475-506, 1982.

7. Harlow, F.H. and Welch, J.E., Numerical Calculation of Three-dependentViscous Incompressible Flow of Fluid with Free Surfaces, Phys. of Fluids,Vol. 8, pp. 2182-2188, 1965.

8. Hirt, C.W. and Cook, J.L., Calculating Three-Dimensional Flows AroundStructures and Over Rough Terrain, J. Comput. Phys., Vol. 10, pp. 324-340, 1972.

9. Hirt, C.W., Nicholas, B.D. and Romera,N.C., Numerical Solution Algo-rithm for Transient Fluid Flows, LA-5852, Los Alamos Scientific Labora-tory Report, 1975.

10. Kim, J. and Moin, P., Application of Fractional Step Method to Incom-pressible Navier-Stokes Equation, J. Comput. Phys., Vol. 59, pp. 308-323, 1985.

11. Kim, S.W. and Benson, T.J., Comparison of the SMAC, PISO and Itera-tive Time Advancing Schemes for Unsteady Flows, Computers & Fluids,Vol. 21, pp. 435-454, 1992.

12. Leonard, B.P., A Stable and accurate Convective Modelling ProcedureBased on Quadratic Upstream Interpolation, Comp. Methods Appl. Mech.Engr., Vol. 19, pp. 59-98, 1979.

Page 30: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.30 Computational Fluid Dynamics

13. Mukhopadhyay, A., Biswas, G., and Sundararajan, T., Numerical Inves-tigation of Confined Wakes behind a Square Cylinder in a Channel, Int.J. Numer. Methods Fluids, Vol. 14, pp. 1473-1484, 1992.

14. Okajima, A., Strouhal Numbers of Rectangular Cylinders, J. Fluid Mech.,Vol. 123, pp. 379-398, 1982.

15. Patankar, S.V., A Calculation Procedure for Two-Dimensional EllipticSituations, J. Numer. Heat Transfer, Vol. 4, pp. 409-425, 1981.

16. Patankar, S.V., Numerical Heat Transfer and Fluid Flow, HemispherePublishing Co., 1980.

17. Patankar, S.V. and Spalding, D.B., A Calculation Procedure for the Heat,Mass and Momentum Transfer in Three-Dimensional Parabolic Flows,Int. J. Heat and Mass Transfer, Vol. 15, pp. 1787-1805, 1972.

18. Peyret, R. and Taylor, T.D., Computational Methods for Fluid Flow,Springer Verlag, 1983.

19. Robichaux,J., Tafti, D.K. and Vanka, S.P., Large Eddy Simulation ofTurbulence on the CM-2, J. Numer. Heat Transfer, Part-B, Vol. 21, pp.367-388, 1992.

20. Thomas, L.H., Elliptic Problems in Linear Difference Equation Over ANetwork, Waston Sci. Compt. Lab. Report, Columbia University, NewYork, 1949.

21. Van Doormal, J.P. and G. D. Raithby, G.D., Enhancement of the SIM-PLE Methods for Predicting Incompressible Fluid Flows, J. Numer. HeatTransfer, Vol. 7, pp. 147-163, 1984.

22. Vanka, S.P., Chen, B. C. J. and Sha, W.T., A Semi-Implicit Calcula-tion Procedure for Flows Described in Body-Fitted Coordinate System,J. Numer. Heat Transfer, Vol. 3, pp. 1-19, 1980.

23. Viecelli, J.A., Computing Method for Incompressible flows Bounded byMoving Walls, J. Comput. Phys., Vol. 8, pp. 119-143, 1971.

Problems

1. Develop the MAC and SIMPLE algorithms describes in this chapter fora steady one dimensional flow field u(y), driven by a constant (but as yetundetermined) pressure gradient. For definiteness, flow in a parallel platechannel can be considered.

2. For a two-dimensional flow, show that the MAC type iterative correc-tion of pressure and velocity field through the implicit continuity equa-tion is equivalent to the solution of Poisson equation for pressure. How

Page 31: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.31

does the procedure avoid the need of directly applying pressure-boundary-conditions?

3. Compare the solutions obtained by the stream function-vorticity methodwith those presented in this chapter for the following problems:

(a) Developing flow in a parallel plates channel;(b) Flow past a square cylinder (Re < 200);(c) Flow past a periodic array of square cylinders.

4. Apply MAC method to solve the shear driven cavity flow problem shownin Figure 6.13. Take a grid size of 51 × 51 and solve the flow equationsfor Re = 400.

Figure 6.13: Shear driven Cavity

5. The Navier-Stokes equations in three-dimensional spherical-polar coordi-

Page 32: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.32 Computational Fluid Dynamics

nate system in θ direction may be written as

ρ

(∂Vθ

∂t+ Vr

∂Vθ

∂r+

r

∂Vθ

∂θ+

rsinθ· ∂Vθ

∂φ+

VrVθ

r− V 2

φ cotθr

)

= − ∂p

r∂θ+ μ

[∂2Vθ

∂r2+

2r

∂Vθ

∂r+

1r2

∂Vθ

∂θ2+

cotθr2

∂Vθ

∂θ

+1

r2sin2θ· ∂2Vθ

∂φ2+

2r2

∂Vr

∂θ− Vθ

r2sin2θ− 2cotθ cscθ

r2

∂Vθ

∂φ

]

The continuity equation is given by

∂(ρVr)∂r

+2r(ρVr) +

1r

∂θ(ρVθ) +

cotθr

ρVθ +1

rsinθ

∂θ(ρVθ) = 0

Discretize the weak conservative form of the θ-momentum equation on agrid (in spherical polar coordinate) using a weighted-average scheme.

6. Obtain the exact solution of the equation given by

d

dx

(ρuT − Γ

∂T

∂x

)= 0

where, ρu is the convective flux at the point uij has been defined (Figure6.3) diffusion coefficient. Both ρu and Γ are constant over the controlvolume. The boundary conditions are: at x = 0, T = TP and at x =δxe, T = TE

����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

u

x

h

S

L L1

d

5

maxU

4xx

z

y

x

W/2

H = h+S

symmetry plane

side wall

Figure 6.14: Flow over a Backward Facing Step

7. Solve three-dimensional Navier-Stokes equations for the flow over a back-ward facing step as illustrated in Figure 6.14. Find out the reattachment

Page 33: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

Solution of Navier-Stokes.. 6.33

length x1 for the Reynolds numbers of 200, 300 and 400. The Reynoldsnumber is given by Re = ρu(2h)/ν. Compare the results with that areavailable in Biswas et al. (2004)

8. Consider the channel flow and backward-facing-step configurations onceagain. Combine the flow and thermal energy equations and determinethe local and global heat transfer rates when one of the solid surfaces isheated, the incoming fluid is cold and all other solid surfaces are thermallyinsulated.

9. Consider a square cylinder in a channel as shown in Figure 6.15.

Figure 6.15: A square cylinder in a channel

For this assignment consider a 2D flow and neglect the dimensions in thez –direction.

Following are the relevant dimensions:

B = 1.0, H = 10.0, La= 7.5, L = 22.0.

The velocity profile is uniform at the inflow plane. Use 178 X 82 gridsand solve complete Navier-Stokes equations on the 2D domain using SIM-PLE/ MAC algorithm. The Reynolds number of interest is 40. Draw thestreamlines and velocity vectors in the domain.

Having computed the velocity field, compute the temperature field usingSuccessive Over Relaxation (SOR) scheme. The upper wall, lower wall

Page 34: Solution of Navier-Stokes Equations for …Solution of Navier-Stokes.. 6.3 x Y main control volume indices staggered variables with same u = p pressure = v velocity = u velocity v

6.34 Computational Fluid Dynamics

and the obstacles are at temperature TW . The incoming fluid is at atemperature T∞. Use smooth outflow boundary condition at the outflowplane. The Prandtl number of the fluid is 6.5. The temperature TW maybe assumed as 1.3 times T∞; T∞ being 300K.