## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

MMAE 517

Illinois Institute of Technology

c ( 2010 K. W. Cassel

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 1 / 454

Introduction to CFD

CFD Advertisements...

“CFD is a modern and rather special expression

of ﬂuid mechanics. It is an endlessly fascinating,

interdisciplinary blend of basic numerical methods,

a solid understanding of both experimental

and anayltical ﬂuid dynamics, software engineering

and pragmatism.”

W.N. Dawes (JFM 1996)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 2 / 454

Introduction to CFD

Advantages and disadvantages of analytical, computational and experimental

approaches to ﬂuid mechanics:

Analytical:

+ Provides exact solutions to governing equations.

+ Gives physical insight, e.g. relative importance of diﬀerent eﬀects.

+ Can consider hypothetical problems (e.g. inviscid, incompressible,

zero-gravity, etc.).

− Exact solutions only available for simple problems and geometries.

− Of limited direct value in design.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 3 / 454

Introduction to CFD

Computational:

+ Address more complex problems (physics and geometries).

+ Can consider hypothetical ﬂows ⇒ test theoretical models.

+ Provides detailed solutions ⇒ good understanding of ﬂow, e.g. does

separation occur?

+ Perform parametric studies.

+ Can easily try diﬀerent conﬁgurations, e.g. geometry, boundary conditions,

etc... ⇒ important in design.

+ Computers becoming faster and cheaper ⇒ range of CFD expanding.

+ Increased potential using parallel processing.

+ More cost eﬀective and faster than experimental prototyping.

− Requires accurate governing equations (don’t have for turbulence,

combustion, etc..., which require modeling).

− Boundary conditions sometimes diﬃcult to implement, e.g. outlet.

− Diﬃcult to do in certain parameter regimes, e.g. high Reynolds numbers, and

complex geometries.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 4 / 454

Introduction to CFD

Experimental:

+ Easier to get overall quantities for problem (e.g. lift and drag on an airfoil).

+ No “modeling” necessary.

− Often requires intrusive measurement probes.

− Limited measurement accuracy.

− Limited measurement resolution.

− Eﬀects of support apparatus, end walls, etc... must be considered.

− Some quantities diﬃcult to obtain, e.g. streamfunction, vorticity, etc....

− Experimental equipment often expensive and takes up space.

− Diﬃcult and costly to test full-scale models.

Note: Computational approaches do not replace analytical or experimental

approaches, but complement them.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 5 / 454

Numerical Methods: General Considerations and Approaches Components and Properties of a Numerical Solution

Outline

2

Numerical Methods: General Considerations and Approaches

Components and Properties of a Numerical Solution

Numerical Solution Approaches

Finite Diﬀerence

Boundary-Value Problems

Finite Element

Spectral Methods

Vortex Methods

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 6 / 454

Numerical Methods: General Considerations and Approaches Components and Properties of a Numerical Solution

Numerical Solution Procedure:

Numerical Solution

System of Linear Equations

Mathematical Model

i.e. Governing Equations

(odes or pdes)

Physical System

i.e. Reality

1 Physical Laws + Models

2 Discretization

3 Matrix Solver

Analytical

Solution

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 7 / 454

Numerical Methods: General Considerations and Approaches Components and Properties of a Numerical Solution

Steps:

1

Mass, momentum and energy conservation + models, idealizations, etc...

2

Discretization – approximation of the continuous diﬀerential equation(s) by a

system of algebraic equations for the dependent variables at discrete locations

in the independent variables (space and time). For example, using ﬁnite

diﬀerences

3

Numerical solutions of linear systems of equations.

⇒ Method of discretization often produces certain structure: e.g. second-order

centered diﬀerences lead to a tridiagonal system of equations.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 8 / 454

Numerical Methods: General Considerations and Approaches Components and Properties of a Numerical Solution

Sources of errors in numerical solutions arise due to each step of the Numerical

Solution Procedure:

1

Modeling errors – diﬀerence between actual ﬂow and exact solution of

mathematical model.

2

Discretization errors – diﬀerence between exact solution of governing

equations and exact solution of algebraic equations.

i) Method of discretization → inherent error of method, i.e. truncation error.

ii) Computational grid → can be reﬁned.

3

Iterative convergence errors – diﬀerence between numerical solution, i.e.

iterative, and exact solution to algebraic equations.

This is where the “pragmatism” mentioned by Dawes is an important element of

CFD.

e.g. DNS of turbulence in other than elementary ﬂows is currently impossible.

⇒ Compromises must often be made at each stage of the procedure.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 9 / 454

Numerical Methods: General Considerations and Approaches Components and Properties of a Numerical Solution

Properties of successful numerical solution methods:

1

Consistency – discretized equations must become governing equations as grid

size goes to zero

truncation error = discretized equations – exact equations

e.g.:

du

dx

=

u

i+1

−u

i−1

2∆x

+O(∆x

2

),

where O(∆x

2

) is the truncation error. Therefore, from the deﬁnition of the

derivative, as ∆x →0,

u

i+1

−u

i−1

2∆x

→

du

dx

for consistency.

2

Stability – numerical procedure must not magnify errors produced in the

numerical solution.

Unstable method ⇒ diverge from exact solution.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 10 / 454

Numerical Methods: General Considerations and Approaches Components and Properties of a Numerical Solution

3

Convergence – numerical solution of discretized equations approaches exact

solution of governing equations as grid size goes to zero (cf. iterative

convergence).

Generally don’t have exact solution; therefore, reﬁne grid until

grid-independent solution is obtained.

Truncation error gives the rate of convergence to the exact solution as grid is

reduced, e.g. for O(∆x

2

) ⇒∆x →e, where e is the error. Then halving the

grid size reduces the error by a factor of four.

4

“Correctness” – numerical solution should compare favorably with available

analytical solutions, experimental results or other computational solutions

within the limitations of each.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 11 / 454

Numerical Methods: General Considerations and Approaches Numerical Solution Approaches

Outline

2

Numerical Methods: General Considerations and Approaches

Components and Properties of a Numerical Solution

Numerical Solution Approaches

Finite Diﬀerence

Boundary-Value Problems

Finite Element

Spectral Methods

Vortex Methods

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 12 / 454

Numerical Methods: General Considerations and Approaches Numerical Solution Approaches

The discretization step (step 2 in the Numerical Solution Procedure) may be

accomplished using diﬀerent methods. The most common approaches used in

CFD are brieﬂy described below.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 13 / 454

Numerical Methods: General Considerations and Approaches Numerical Solution Approaches

Finite Diﬀerence

Basic approach:

Discretize the governing equations in diﬀerential form using

Taylor-series-based ﬁnite-diﬀerence approximations at each grid point.

Produces algebraic equations involving each grid point and surrounding

points.

Local approximation method.

Popular in ﬂuid dynamics research.

Advantages:

Relatively straightforward to understand and implement (based on Taylor

series).

Utilizes familiar diﬀerential form of governing equations.

Very general ⇒ Apply to a wide variety of problems (including complex

physics, e.g. ﬂuids plus heat transfer plus combustion).

Can extend to higher-order approximations.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 14 / 454

Numerical Methods: General Considerations and Approaches Numerical Solution Approaches

Disadvantages:

More diﬃcult to implement for complex geometries.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 15 / 454

Numerical Methods: General Considerations and Approaches Numerical Solution Approaches

Finite Volume

Basic approach:

Apply conservation equations in integral form to a set of control volumes.

Produces algebraic equations for each control volume involving surrounding

control volumes.

Local approximation method.

Popular for commercial CFD codes (e.g. FLUENT).

Advantages:

Easier to treat complex geometries than ﬁnite-diﬀerence approach.

“Ensures” conservation of necessary quantities (i.e. mass, momentum,

energy, etc.), i.e. even if solution in inaccurate.

Disadvantages:

More diﬃcult to construct higher-order schemes.

Uses less familiar integral formulation of governing equations.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 16 / 454

Numerical Methods: General Considerations and Approaches Numerical Solution Approaches

Finite Element

Basic approach:

Apply conservation equations in variational form with weighting function to

set of ﬁnite elements.

Produces set of linear or nonlinear algebraic equations.

Local approximation method.

Popular in commercial codes (particularly for solid mechanics and heat

transfer).

Advantages:

Easy to treat complex geometries.

Disadvantages:

Results in unstructured grids.

Solution methods are ineﬃcient for the types of matrices resulting from

ﬁnite-element discretizations (cf. ﬁnite diﬀerence ⇒ sparse, highly structured

matrices).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 17 / 454

Numerical Methods: General Considerations and Approaches Numerical Solution Approaches

Spectral Methods

Basic approach:

Solution of governing equations in diﬀerential form are approximated using

truncated (usually orthogonal) eigenfunction expansions.

Produces system of algebraic equations (steady) or system of ordinary

diﬀerential equations (unsteady) involving the coeﬃcients in the

eigenfunction expansion.

Global approximation method.

Popular for direct numerical simulation (DNS) of turbulence.

Advantages:

Obtain highly accurate solutions when underlying solution is smooth.

Can achieve rapid convergence.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 18 / 454

Numerical Methods: General Considerations and Approaches Numerical Solution Approaches

Disadvantages:

Less straightforward to implement than ﬁnite diﬀerence.

More diﬃcult to treat complicated boundary conditions (e.g. Neumann).

Small changes in problem can cause large changes in algorithm.

Not well suited for solutions having large gradients.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 19 / 454

Numerical Methods: General Considerations and Approaches Numerical Solution Approaches

Vortex Methods

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 20 / 454

Finite-Diﬀerence Methods Extended Fin Example

Outline

3

Finite-Diﬀerence Methods

Extended Fin Example

Formal Basis for Finite Diﬀerences

Application to Extended Fin Example

Properties of Tridiagonal Matrices

Thomas Algorithm

Extended Fin Example – Convection Boundary Condition

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 21 / 454

Finite-Diﬀerence Methods Extended Fin Example

As an example, consider the 1-D heat conduction in an extended surface with

convection to the ambient air.

The heat transfer within the extended ﬁn is governed by the 1-D

ordinary-diﬀerential equation (see, for example, Incropera & DeWitt):

d

2

T

dx

2

+

1

A

c

dA

c

dx

dT

dx

−

1

A

c

h

k

dA

s

dx

(T −T

∞

) = 0, (3.1)

where

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 22 / 454

Finite-Diﬀerence Methods Extended Fin Example

T(x) = temperature distribution,

A

c

(x) = cross-sectional area,

A

s

(x) = surface area from base,

h = convective heat transfer coeﬃcient,

k = thermal conductivity.

Note that equation (3.1) is a second-order ordinary diﬀerential equation with

variable coeﬃcients, and it is a boundary-value problem requiring boundary

conditions at both ends of the domain.

Letting θ(x) = T(x) −T

∞

, rewrite equation (3.1) as

d

2

θ

dx

2

+f(x)

dθ

dx

+g(x)θ = 0, (3.2)

where

f(x) =

1

A

c

dA

c

dx

,

g(x) = −

1

A

c

h

k

dA

s

dx

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 23 / 454

Finite-Diﬀerence Methods Extended Fin Example

For now, consider Dirichlet boundary conditions

θ = θ

b

= T

b

−T

∞

at x = 0,

θ = θ

L

= T

L

−T

∞

at x = L.

(3.3)

Equation (3.2) with boundary conditions (3.3) represents the mathematical model

(step 1 in the Numerical Solution Procedure).

Step 2 → Discretization:

Divide the interval 0 ≤ x ≤ L into I equal subintervals of length ∆x =

L

I

:

Here, f

i

= f(x

i

) and g

i

= g(x

i

) are known, and the solution θ

i

= θ(x

i

) is to be

determined for i = 2, . . . , I.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 24 / 454

Finite-Diﬀerence Methods Extended Fin Example

In order to discretize the diﬀerential equation, consider the deﬁnition of the

derivative

dθ

dx

x=x

i

= lim

∆x→0

θ(x

i

+ ∆x) −θ(x

i

)

∆x

.

This may be interpreted as a forward diﬀerence if ∆x is small, but not going to

zero, i.e. ﬁnite diﬀerence.

Graphical interpretation:

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 25 / 454

Finite-Diﬀerence Methods Extended Fin Example

Forward Diﬀerence:

dθ

dx

x

i

≈

θ

i+1

−θ

i

∆x

Backward Diﬀerence:

dθ

dx

x

i

≈

θ

i

−θ

i−1

∆x

Central Diﬀerence:

dθ

dx

x

i

≈

θ

i+1

−θ

i−1

2∆x

Which approximation is better?

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 26 / 454

Finite-Diﬀerence Methods Formal Basis for Finite Diﬀerences

Outline

3

Finite-Diﬀerence Methods

Extended Fin Example

Formal Basis for Finite Diﬀerences

Application to Extended Fin Example

Properties of Tridiagonal Matrices

Thomas Algorithm

Extended Fin Example – Convection Boundary Condition

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 27 / 454

Finite-Diﬀerence Methods Formal Basis for Finite Diﬀerences

Consider the Taylor series expansion of a function θ(x) in the vicinity of the point

x

i

θ(x) = θ(x

i

) + (x −x

i

)

dθ

dx

i

+

(x −x

i

)

2

2!

d

2

θ

dx

2

i

+

(x −x

i

)

3

3!

d

3

θ

dx

3

i

+ +

(x −x

i

)

n

n!

d

n

θ

dx

n

i

+ .

(3.4)

Apply the Taylor series at x = x

i+1

: (x

i+1

−x

i

= ∆x)

θ

i+1

= θ

i

+∆x

dθ

dx

i

+

∆x

2

2

d

2

θ

dx

2

i

+

∆x

3

6

d

3

θ

dx

3

i

+ +

∆x

n

n!

d

n

θ

dx

n

i

+ .

(3.5)

Solving for (dθ/dx)

i

gives

dθ

dx

i

=

θ

i+1

−θ

i

∆x

−

∆x

2

d

2

θ

dx

2

i

− −

∆x

n−1

n!

d

n

θ

dx

n

i

+ . (3.6)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 28 / 454

Finite-Diﬀerence Methods Formal Basis for Finite Diﬀerences

Similarly, apply the Taylor series at x = x

i−1

: (x

i−1

−x

i

= −∆x)

θ

i−1

= θ

i

−∆x

dθ

dx

i

+

∆x

2

2

d

2

θ

dx

2

i

−

∆x

3

6

d

3

θ

dx

3

i

+ +

(−1)

n

∆x

n

n!

d

n

θ

dx

n

i

+ .

(3.7)

Solving again for (dθ/dx)

i

gives

dθ

dx

i

=

θ

i

−θ

i−1

∆x

+

∆x

2

d

2

θ

dx

2

i

−

∆x

2

6

d

3

θ

dx

3

i

+ +

(−1)

n

∆x

n−1

n!

d

n

θ

dx

n

i

+ .

(3.8)

Alternatively, subtract equation (3.7) from (3.5) to obtain

θ

i+1

−θ

i−1

= 2∆x

dθ

dx

i

+

∆x

3

3

d

3

θ

dx

3

i

+ +

2∆x

2n+1

(2n + 1)!

d

2n+1

θ

dx

2n+1

i

+ ,

(3.9)

and solve for (dθ/dx)

i

to obtain

dθ

dx

i

=

θ

i+1

−θ

i−1

2∆x

−

∆x

2

6

d

3

θ

dx

3

i

− −

∆x

2n

(2n + 1)!

d

2n+1

θ

dx

2n+1

i

− . (3.10)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 29 / 454

Finite-Diﬀerence Methods Formal Basis for Finite Diﬀerences

Equations (3.6), (3.8) and (3.10) are exact expressions for the ﬁrst derivative

(dθ/dx)

i

, i.e. if all of the terms are retained in the expansions.

Approximate ﬁnite diﬀerence expressions for the ﬁrst derivative may then be

obtained by truncating the series after the ﬁrst term:

dθ

dx

i

≈

θ

i+1

−θ

i

∆x

+O(∆x) → Forward diﬀerence

dθ

dx

i

≈

θ

i

−θ

i−1

∆x

+O(∆x) → Backward diﬀerence

dθ

dx

i

≈

θ

i+1

−θ

i−1

2∆x

+O(∆x

2

) → Central diﬀerence

The truncation error is the sum of all the truncated terms.

⇒ For small ∆x, successive terms get smaller and the order of the truncation

error is given by the ﬁrst truncated term.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 30 / 454

Finite-Diﬀerence Methods Formal Basis for Finite Diﬀerences

Higher-order approximations may be obtained by various manipulations of the

Taylor series at additional points. For example, to obtain a second-order acccurate

forward-diﬀerence approximation to the ﬁrst derivative, apply the Taylor series at

x

i+2

as follows

θ

i+2

= θ

i

+ 2∆x

dθ

dx

i

+

(2∆x)

2

2!

d

2

θ

dx

2

i

+

(2∆x)

3

3!

d

3

θ

dx

3

i

+ . (3.11)

We eliminate the (d

2

θ/dx

2

)

i

term by taking 4(3.5) − (3.11) to obtain

4θ

i+1

−θ

i+2

= 3θ

i

+ 2∆x

dθ

dx

i

−

2∆x

3

3

d

3

θ

dx

3

i

+ .

Solving for (dθ/dx)

i

gives

dθ

dx

i

=

−3θ

i

+ 4θ

i+1

−θ

i+2

2∆x

+

∆x

2

3

d

3

θ

dx

3

i

+ , (3.12)

which is second-order accurate and involves the point of interest and the two

previous points.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 31 / 454

Finite-Diﬀerence Methods Formal Basis for Finite Diﬀerences

For a second-order accurate central-diﬀerence approximation to the second

derivative add equation (3.5) and (3.7) for θ

i+1

and θ

i−1

, respectively, to

eliminate the (dθ/dx)

i

term. This gives

θ

i+1

+θ

i−1

= 2θ

i

+ ∆x

2

d

2

θ

dx

2

i

+

∆x

4

12

d

4

θ

dx

4

i

+ .

Solving for (d

2

θ/dx

2

)

i

leads to

d

2

θ

dx

2

i

=

θ

i+1

−2θ

i

+θ

i−1

∆x

2

−

∆x

2

12

d

4

θ

dx

4

i

+ . (3.13)

Note that the second-order accurate central-diﬀerence approximations for both

the ﬁrst and second derivatives involve the point of interest and its two neighbors.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 32 / 454

Finite-Diﬀerence Methods Application to Extended Fin Example

Outline

3

Finite-Diﬀerence Methods

Extended Fin Example

Formal Basis for Finite Diﬀerences

Application to Extended Fin Example

Properties of Tridiagonal Matrices

Thomas Algorithm

Extended Fin Example – Convection Boundary Condition

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 33 / 454

Finite-Diﬀerence Methods Application to Extended Fin Example

Returning to the ﬁn equation (3.2)

d

2

θ

dx

2

+f(x)

dθ

dx

+g(x)θ = 0,

and approximating the derivatives using second-order accurate ﬁnite diﬀerences

gives

θ

i+1

−2θ

i

+θ

i−1

(∆x)

2

+f

i

θ

i+1

−θ

i−1

2∆x

+g

i

θ

i

= 0,

for the point x

i

. Multiplying by (∆x)

2

and collecting terms leads to

a

i

θ

i−1

+b

i

θ

i

+c

i

θ

i+1

= d

i

, i = 2, . . . , I, (3.14)

where the diﬀerence equation is applied at each interior point of the domain, and

a

i

= 1 −

∆x

2

f

i

,

b

i

= −2 + (∆x)

2

g

i

,

c

i

= 1 +

∆x

2

f

i

,

d

i

= 0.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 34 / 454

Finite-Diﬀerence Methods Application to Extended Fin Example

Note that because we have discretized the diﬀerential equation at each interior

grid point, we obtain a set of (I −1) algebraic equations for the (I −1) unknown

values of the temperature θ

i

, i = 2, . . . , I at each interior grid point.

The coeﬃcient matrix for the diﬀerence equation (3.14) is tridiagonal

b

2

c

2

0 0 0 0 0

a

3

b

3

c

3

0 0 0 0

0 a

4

b

4

c

4

0 0 0

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

0 0 0 0 a

I−1

b

I−1

c

I−1

0 0 0 0 0 a

I

b

I

¸

¸

¸

¸

¸

¸

¸

¸

¸

θ

2

θ

3

θ

4

.

.

.

θ

I−1

θ

I

¸

¸

¸

¸

¸

¸

¸

¸

¸

=

d

2

−a

2

θ

1

d

3

d

4

.

.

.

d

I−1

d

I

−c

I

θ

I+1

¸

¸

¸

¸

¸

¸

¸

¸

¸

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 35 / 454

Finite-Diﬀerence Methods Properties of Tridiagonal Matrices

Outline

3

Finite-Diﬀerence Methods

Extended Fin Example

Formal Basis for Finite Diﬀerences

Application to Extended Fin Example

Properties of Tridiagonal Matrices

Thomas Algorithm

Extended Fin Example – Convection Boundary Condition

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 36 / 454

Finite-Diﬀerence Methods Properties of Tridiagonal Matrices

Consider a N N tridiagonal matrix with constant a

i

, b

i

, and c

i

A =

b c 0 0 0

a b c 0 0

0 a b 0 0

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

0 0 0 b c

0 0 0 a b

¸

¸

¸

¸

¸

¸

¸

¸

¸

.

It can be shown that the eigenvalues of a tridiagonal matrix are

λ

j

= b + 2

√

ac cos

jπ

N + 1

, j = 1, . . . , N. (3.15)

The eigenvalues with the largest and smallest magnitudes are (which is largest or

smallest depends upon a, b and c)

[λ

1

[ =

b + 2

√

ac cos

π

N + 1

,

[λ

N

[ =

b + 2

√

ac cos

Nπ

N + 1

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 37 / 454

Finite-Diﬀerence Methods Properties of Tridiagonal Matrices

Then the condition number of A using an L

2

norm is deﬁned by

cond

2

(A) =

[λ[

max

[λ[

min

.

Let us consider N large. Thus, expanding cosine in a Taylor series (the ﬁrst is

expanded about π/(N + 1) →0 and the second about Nπ/(N + 1) →π

cos

π

N + 1

= 1 −

1

2!

π

N + 1

2

+

1

4!

π

N + 1

4

+ ,

cos

Nπ

N + 1

= −1 +

1

2!

Nπ

N + 1

−π

2

− = −1 +

1

2

π

N + 1

2

− .

Consider the common case that may result from the use of central diﬀerences for

a second-order derivative:

a = 1, b = −2, c = 1,

which is weakly diagonally dominant.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 38 / 454

Finite-Diﬀerence Methods Properties of Tridiagonal Matrices

Then with the large N expansions from above

[λ

1

[ =

−2 + 2

(1)(1)

¸

1 −

1

2

π

N + 1

2

+

¸

=

π

N + 1

2

+ ,

[λ

N

[ =

−2 + 2

(1)(1)

¸

−1 +

1

2

π

N + 1

2

−

¸

= 4 + .

(3.16)

Thus, the condition number for large N is approximately

cond

2

(A) ≈

4

(π/(N + 1))

2

=

4(N + 1)

2

π

2

, for large N.

⇒ Increases proportional to N

2

with increasing N.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 39 / 454

Finite-Diﬀerence Methods Properties of Tridiagonal Matrices

Now consider the case with

a = 1, b = −4, c = 1,

which is strictly, or strongly, diagonally dominant. Then from equation (3.16), the

condition number for large N is approximately

cond

2

(A) ≈

6

2

= 3, for large N.

⇒ Constant with increasing N.

It can be proven that for any strictly diagonally dominant matrix A, i.e.

[a

ii

[ >

¸

N

j=1,j=i

[a

ij

[:

1) A is nonsingular; therefore, it is invertible.

2) Gauss elimination does not require row interchanges for conditioning.

3) Computations are stable with respect to round-oﬀ errors.

To see the inﬂuence of condition number on round-oﬀ error, see the Mathematica

notebook “Ill-Conditioned Matrices and Round-Oﬀ Error.”

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 40 / 454

Finite-Diﬀerence Methods Thomas Algorithm

Outline

3

Finite-Diﬀerence Methods

Extended Fin Example

Formal Basis for Finite Diﬀerences

Application to Extended Fin Example

Properties of Tridiagonal Matrices

Thomas Algorithm

Extended Fin Example – Convection Boundary Condition

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 41 / 454

Finite-Diﬀerence Methods Thomas Algorithm

Tridiagonal systems of equations may be solved directly using the Thomas

algorithm, which is essentially application of Gauss elimination and consists of two

stages (shown here for Dirichlet boundary conditions):

1) Forward Elimination:

F

1

= 0, δ

1

= θ

1

= θ

b

= boundary condition

F

i

=

c

i

b

i

−a

i

F

i−1

, δ

i

=

d

i

−a

i

δ

i−1

b

i

−a

i

F

i−1

, i = 2, . . . , I.

2) Back Substitution:

θ

I+1

= θ

L

= boundary condition

θ

i

= δ

i

−F

i

θ

i+1

, i = I, . . . , 2.

Note the order of evaluation for the back substitution.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 42 / 454

Finite-Diﬀerence Methods Thomas Algorithm

Notes:

1

See Anderson, Appendix A for a derivation.

2

The Thomas algorithm only requires O(I) operations, which is as good a

scaling as one could hope for. Gauss elimination of a full (dense) matrix, for

example, requires O(I

3

) operations.

3

To prevent ill-conditioning the system of equations should be diagonally

dominant. For our tridiagonal system, this means

[b

i

[ ≥ [a

i

[ +[c

i

[,

where if the greater than sign applies we say that the matrix is strictly

diagonally dominant, or weakly diagonally dominant if the equal sign applies.

Performing operations with ill-conditioned matrices can result in the growth

of small round-oﬀ errors that then contaminate the solution. For example,

note how errors could accumulate in the F

i

, δ

i

coeﬃcients in the Thomas

algorithm.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 43 / 454

Finite-Diﬀerence Methods Extended Fin Example – Convection Boundary Condition

Outline

3

Finite-Diﬀerence Methods

Extended Fin Example

Formal Basis for Finite Diﬀerences

Application to Extended Fin Example

Properties of Tridiagonal Matrices

Thomas Algorithm

Extended Fin Example – Convection Boundary Condition

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 44 / 454

Finite-Diﬀerence Methods Extended Fin Example – Convection Boundary Condition

Rather than a Dirichlet boundary condition at the tip of the ﬁn, which assumes

that we know the temperature there, let us consider a more realistic convection

condition at the tip

−k

dT

dx

= h(T −T

∞

) at x = L,

or with θ(x) = T(x) −T

∞

−k

dθ

dx

x=L

= hθ(L)

Note that the convection condition results in specifying a linear combination of

the temperature and its derivative at the tip. This is known as a Robin boundary

condition and is of the form

pθ +q

dθ

dx

= r at x = L,

where p = h, q = k, r = 0, which are inputs to the Thomas algorithm.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 45 / 454

Finite-Diﬀerence Methods Extended Fin Example – Convection Boundary Condition

Now let us consider evaluation of the heat ﬂux at the base of the ﬁn

q

b

= −kA

c

(0)

dT

dx

x=0

= −kA

c

(0)

dθ

dx

x=0

.

In order to evaluate dθ/dx at the base x = 0, we must use a forward diﬀerence.

From equation (3.6) applied at i = 1, we have the ﬁrst-order accurate

forward-diﬀerence approximation

dθ

dx

x=0

≈

θ

2

−θ

1

∆x

+O(∆x).

For a more accurate approximation, we may use the second-order accurate

approximation from equation (3.12) applied at i = 1

dθ

dx

x=0

≈

−3θ

1

+ 4θ

2

−θ

3

2∆x

+O(∆x

2

).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 46 / 454

Finite-Diﬀerence Methods Extended Fin Example – Convection Boundary Condition

Even higher-order ﬁnite-diﬀerence approximations may be formed. For example,

the third-order, forward-diﬀerence approximation is

dθ

dx

x=0

≈

−11θ

1

+ 18θ

2

−9θ

3

+ 2θ

4

6∆x

+O(∆x

3

).

Observe that each successive approximation requires one additional point in the

interior of the domain.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 47 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation

Outline

4

Classiﬁcation of Second-Order Partial Diﬀerential Equations

Mathematical Classiﬁcation

Hyperbolic Equations

Parabolic Equations

Elliptic Equations

Mixed Equations

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 48 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation

Consider the general second-order partial diﬀerential equation for u(x, y)

au

xx

+bu

xy

+cu

yy

+du

x

+eu

y

+fu = g. (4.1)

Linear ⇒ a, b, c, d, e and f are only functions of (x, y).

Quasi-linear ⇒ a, b and c may be functions of (x, y, u, u

x

, u

y

), i.e. equation is

linear in highest derivative (e.g. no u

2

xx

terms).

Let us determine the criteria necessary for the existence of a smooth

(diﬀerentiable) and unique (single-valued) solution along a curve C:

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 49 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation

Along C, let

φ

1

(τ) = u

xx

, φ

2

(τ) = u

xy

, φ

3

(τ) = u

yy

,

ψ

1

(τ) = u

x

, ψ

2

(τ) = u

y

.

(4.2)

Substituting into equation (4.1) gives

aφ

1

+bφ

2

+cφ

3

= g −dψ

1

−eψ

2

−fu = H. (4.3)

Transforming from (x, y) →τ, we have

d

dτ

=

dx

dτ

∂

∂x

+

dy

dτ

∂

∂y

.

Thus, from (4.2)

dψ

1

dτ

=

d

dτ

u

x

=

dx

dτ

u

xx

+

dy

dτ

u

xy

=

dx

dτ

φ

1

+

dy

dτ

φ

2

, (4.4)

dψ

2

dτ

=

d

dτ

u

y

=

dx

dτ

u

xy

+

dy

dτ

u

yy

=

dx

dτ

φ

2

+

dy

dτ

φ

3

. (4.5)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 50 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation

Equations (4.3)–(4.5) are three equations for three unknowns, i.e. the

second-order derivatives φ

1

, φ

2

and φ

3

. Written in matrix form, they are

a b c

dx/dτ dy/dτ 0

0 dx/dτ dy/dτ

¸

¸

φ

1

φ

2

φ

3

¸

¸

=

H

dψ

1

/dτ

dψ

2

/dτ

¸

¸

If the determinant of the coeﬃcient matrix is not equal to zero, a unique solution

exists for the second derivatives along the curve C. It can be shown that if the

second-order derivatives exist, then derivatives of all orders exist along C as well.

On the other hand, if the determinant of the coeﬃcient matrix is equal to zero,

the solution is not unique, i.e. the second derivatives are discontinuous along C.

Setting the determinant equal to zero gives

a

dy

dτ

2

+c

dx

dτ

2

−b

dx

dτ

dy

dτ

= 0,

or multiplying by (dτ/dx)

2

a

dy

dx

2

−b

dy

dx

+c = 0.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 51 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation

This is a quadratic equation for dy/dx, which is the slope of the curve C.

Thus,

dy

dx

=

b ±

√

b

2

−4ac

2a

. (4.6)

→ The curves C for which y(x) satisfy (4.6) are called characteristic curves of

equation (4.1), and they are curves along which the second-order derivatives

are discontinuous.

Because the characteristics must be real, their behavior is determined by the sign

of b

2

−4ac:

b

2

−4ac > 0 ⇒ 2 real roots ⇒ 2 characteristics ⇒ hyperbolic p.d.e.

b

2

−4ac = 0 ⇒ 1 real root ⇒ 1 characteristic ⇒ parabolic p.d.e.

b

2

−4ac < 0 ⇒ no real roots ⇒ no characteristics ⇒ elliptic p.d.e.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 52 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation

The terminology arises from classiﬁcation of the second-degree algebraic equation

ax

2

+bxy +cy

2

+dx +ey +f = 0, i.e. conic sections.

Note that if from equation (4.1), we write (let x = x

1

, y = x

2

, then

au

11

+

b

2

u

12

+

b

2

u

21

+cu

22

= H)

A =

¸

a b/2

b/2 c

**(analogous to quadratic forms in MMAE 501). Then
**

det[A] = ac −b

2

/4

or

−4 det[A] = b

2

−4ac

> 0, hyperbolic

= 0, parabolic

< 0, elliptic

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 53 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation

Notes:

1

Physically, characteristics are curves along which information propagates in

the solution.

2

For the case of elliptic equations, the matrix A is positive deﬁnite.

3

The classiﬁcation depends on the coeﬃcients of the highest-order derivatives,

i.e. a, b and c.

4

It can be shown that the classiﬁcation of a partial diﬀerential equation is

independent of the coordinate system (see, for example, Tannehill et al.).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 54 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Hyperbolic Equations

Outline

4

Classiﬁcation of Second-Order Partial Diﬀerential Equations

Mathematical Classiﬁcation

Hyperbolic Equations

Parabolic Equations

Elliptic Equations

Mixed Equations

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 55 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Hyperbolic Equations

From equation (4.6), for a hyperbolic equation there are two real roots, say

dy

dx

= λ

1

,

dy

dx

= λ

2

. (4.7)

If a, b and c are constant (λ

1

, λ

2

constant), then we may integrate to obtain

y = λ

1

x +x

1

, y = λ

2

x +x

2

,

which are straight lines. Therefore, the solution propagates along two linear

characteristic curves.

For example, consider the wave equation

∂

2

u

∂t

2

= σ

2

∂

2

u

∂x

2

, (y →t : a = σ

2

, b = 0, c = −1)

where u(x, t) is the amplitude of the wave, and σ is the wave speed. Therefore,

from equations (4.6) and (4.7),

λ

1

=

1

σ

, λ

2

= −

1

σ

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 56 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Hyperbolic Equations

Therefore, the characteristics of the wave equation with a, b, and c constant are

straight lines with slopes 1/σ and −1/σ.

The solution to the wave equation is of the form

u(x, t) = F

1

(x +σt) +F

2

(x −σt),

and initial conditions are required at say t = 0, such as

u(x, 0) = f(x), u

t

(x, 0) = g(x).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 57 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Hyperbolic Equations

Note that no boundary conditions are necessary at speciﬁed values of x, i.e. the

solution (F

1

, F

2

) only depends upon the initial conditions.

Hyperbolic equations in ﬂuid dynamics:

Unsteady inviscid ﬂow

Steady supersonic inviscid ﬂow

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 58 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Parabolic Equations

Outline

4

Classiﬁcation of Second-Order Partial Diﬀerential Equations

Mathematical Classiﬁcation

Hyperbolic Equations

Parabolic Equations

Elliptic Equations

Mixed Equations

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 59 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Parabolic Equations

From equation (4.6), for a parabolic equation there is only one real root, which is

dy

dx

=

b

2a

. (4.8)

If a and b are constant, then we may integrate to obtain

y =

b

2a

x +γ

1

,

which is a straight line. Therefore, the solution propagates along one linear

characteristic direction (usually time).

For example, consider the one-dimensional, unsteady diﬀusion equation (e.g. heat

conduction)

∂u

∂t

= α

∂

2

u

∂x

2

, (y →t : a = α, b = c = 0)

where u(x, t) is the quantity undergoing diﬀusion (e.g. temperature), and α is the

diﬀusivity.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 60 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Parabolic Equations

The solution marches forward in time, i.e. the characteristics (with b = 0) are lines

of constant t.

Initial and boundary conditions are required, such as

u(x, 0) = u

0

(x), u(x

1

, t) = f(t), u(x

2

, t) = g(t).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 61 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Parabolic Equations

Parabolic equations in ﬂuid dynamics:

Unsteady Navier-Stokes

Steady boundary-layer ﬂow (no separation):

u

∂u

∂x

+v

∂u

∂y

= −

∂p

∂x

+

∂

2

u

∂y

2

, (a = 0, b = 0, c = 1).

In this case the solution marches forward in the x−direction from an initial

velocity proﬁle.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 62 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Elliptic Equations

Outline

4

Classiﬁcation of Second-Order Partial Diﬀerential Equations

Mathematical Classiﬁcation

Hyperbolic Equations

Parabolic Equations

Elliptic Equations

Mixed Equations

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 63 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Elliptic Equations

Disturbances have inﬁnite speed of propagation in all directions, i.e. no

characteristics ⇒ A disturbance anywhere aﬀects the solution everywhere

instantaneously.

For example, consider the Laplace equation (e.g. two-dimensional steady heat

conduction, potential ﬂow, etc.)

∂

2

u

∂x

2

+

∂

2

u

∂y

2

= 0, (a = 1, b = 0, c = 1)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 64 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Elliptic Equations

Requires a global solution strategy, and boundary conditions (typically u or

∂u/∂n) must be speciﬁed on a closed contour bounding the domain.

Elliptic equations in ﬂuid dynamics:

Steady Navier-Stokes (also steady energy equation)

Potential (inviscid, incompressible, irrotational) ﬂow

Poisson equation for pressure or streamfunction

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 65 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Mixed Equations

Outline

4

Classiﬁcation of Second-Order Partial Diﬀerential Equations

Mathematical Classiﬁcation

Hyperbolic Equations

Parabolic Equations

Elliptic Equations

Mixed Equations

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 66 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Mixed Equations

If a, b and c are variable coeﬃcients, then b

2

−4ac may change sign with space

and/or time.

⇒ Character of equations may be diﬀerent in certain regions.

For example, consider transonic ﬂow (Mach ∼ 1). The governing equation for

two-dimensional, steady, compressible, potential ﬂow about a slender body is

(1 −M

2

)

∂

2

φ

∂s

2

+

∂

2

φ

∂n

2

= 0, (x →s, y →n : a = 1 −M

2

, b = 0, c = 1),

where φ(s, n) is the velocity potential, M is the local Mach number, and s and n

are streamline coordinates with s locally being tangent to the streamline and n

being normal to the streamline.

To determine the nature of the equation, observe that

b

2

−4ac = 0 −4(1 −M

2

)(1) = −4(1 −M

2

);

therefore,

M < 1 ⇒ b

2

−4ac < 0 ⇒ Elliptic

M = 1 ⇒ b

2

−4ac = 0 ⇒ Parabolic

M > 1 ⇒ b

2

−4ac > 0 ⇒ Hyperbolic

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 67 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Mixed Equations

In the above example, we have the same equation, but diﬀerent behavior in

various regions. In the following example, we have diﬀerent equations in diﬀerent

regions of the ﬂow.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 68 / 454

Classiﬁcation of Second-Order Partial Diﬀerential Equations Mixed Equations

Consider the steady, incompressible viscous ﬂow past a surface.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 69 / 454

Numerical Solutions of Elliptic Problems Introduction

Outline

5

Numerical Solutions of Elliptic Problems

Introduction

Finite-Diﬀerence Methods for the Poisson Equation

Direct Methods for Linear Systems

Fourier Transform Methods

Cyclic Reduction

Iterative (Relaxation) Methods

Jacobi Iteration

Gauss-Seidel Iteration

Successive Overrelaxation (SOR)

Boundary Conditions

Dirichlet Boundary Conditions

Neumann (Derivative) Boundary Conditions

Alternating-Direction-Implicit (ADI) Method

Compact Finite Diﬀerences

Multigrid Methods

Motivation

Multigrid Methodology

Speed Comparisons

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 70 / 454

Numerical Solutions of Elliptic Problems Introduction

Outline (cont’d)

Treatment of Nonlinear Convective Terms

Upwind-Downwind Diﬀerencing

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 71 / 454

Numerical Solutions of Elliptic Problems Introduction

Recall that elliptic problems have no preferred direction of propagation; therefore,

they require:

1

Boundary conditions on a closed contour surrounding the domain, i.e.

boundary-value problem.

2

Global solution method.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 72 / 454

Numerical Solutions of Elliptic Problems Introduction

Types of boundary conditions:

1

Dirichlet – φ speciﬁed.

2

Neumann –

∂φ

∂n

speciﬁed (n is normal to boundary).

3

Robin (mixed) –

∂φ

∂n

+aφ = b speciﬁed

Notes:

1

Combinations of the above boundary conditions may be applied on diﬀerent

portions of the boundary as long as some boundary condition is applied at

every point along the boundary contour.

2

Solutions to the Laplace and Poisson equations with Neumann boundary

conditions on the entire boundary can only be determined relative to an

unknown constant, i.e. φ(x, y) +c is a solution.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 73 / 454

Numerical Solutions of Elliptic Problems Introduction

Linear vs. Non-Linear Elliptic Problems:

Linear – Linear equation and boundary conditions

e.g. Laplace (f = 0) or Poisson equations

∂

2

φ

∂x

2

+

∂

2

φ

∂y

2

= f(x, y),

with Dirichlet, Neumann or Robin boundary conditions.

Non-Linear:

1

Linear equation with non-linear boundary conditions; e.g. heat conduction with

radiation condition

∂

2

T

∂x

2

+

∂

2

T

∂y

2

= 0,

∂T

∂n

= D(T

4

−T

4

sur

).

2

Non-linear equation; e.g.: Navier-Stokes equations

u

∂u

∂x

+ v

∂u

∂y

= −

∂p

∂x

+

1

Re

„

∂

2

u

∂x

2

+

∂

2

u

∂y

2

«

.

Note that as Reynolds number, Re, increases, the non-linearity increases.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 74 / 454

Numerical Solutions of Elliptic Problems Finite-Diﬀerence Methods for the Poisson Equation

Outline

5

Numerical Solutions of Elliptic Problems

Introduction

Finite-Diﬀerence Methods for the Poisson Equation

Direct Methods for Linear Systems

Fourier Transform Methods

Cyclic Reduction

Iterative (Relaxation) Methods

Jacobi Iteration

Gauss-Seidel Iteration

Successive Overrelaxation (SOR)

Boundary Conditions

Dirichlet Boundary Conditions

Neumann (Derivative) Boundary Conditions

Alternating-Direction-Implicit (ADI) Method

Compact Finite Diﬀerences

Multigrid Methods

Motivation

Multigrid Methodology

Speed Comparisons

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 75 / 454

Numerical Solutions of Elliptic Problems Finite-Diﬀerence Methods for the Poisson Equation

Outline (cont’d)

Treatment of Nonlinear Convective Terms

Upwind-Downwind Diﬀerencing

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 76 / 454

Numerical Solutions of Elliptic Problems Finite-Diﬀerence Methods for the Poisson Equation

As a representative elliptic equation, which is important in its own right, consider

the two-dimensional Poisson equation

∂

2

φ

∂x

2

+

∂

2

φ

∂y

2

= f(x, y), (5.1)

where if f(x, y) = 0 we have the Laplace equation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 77 / 454

Numerical Solutions of Elliptic Problems Finite-Diﬀerence Methods for the Poisson Equation

In order to deﬁne the grid:

Divide the x interval, 0 ≤ x ≤ a, into I equal subintervals of length ∆x, with

x

i

= ∆x(i −1).

Divide the y interval, 0 ≤ y ≤ b, into J equal subintervals of length ∆y, with

y

j

= ∆y(j −1).

⇒ 2-D grid intersecting in (I + 1) ×(J + 1) points.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 78 / 454

Numerical Solutions of Elliptic Problems Finite-Diﬀerence Methods for the Poisson Equation

Consider an approximation to equation (5.1) at a typical point (i, j); the ﬁve

point ﬁnite-diﬀerence stencil is

Using second-order accurate, central diﬀerences (with φ

i,j

= φ(x

i

, y

j

)):

∂

2

φ

∂x

2

≈

φ

i+1,j

−2φ

i,j

+φ

i−1,j

(∆x)

2

+O(∆x

2

),

∂

2

φ

∂y

2

≈

φ

i,j+1

−2φ

i,j

+φ

i,j−1

(∆y)

2

+O(∆y

2

).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 79 / 454

Numerical Solutions of Elliptic Problems Finite-Diﬀerence Methods for the Poisson Equation

Substituting into (5.1) and multiplying by (∆x)

2

gives the ﬁnal form of the

ﬁnite-diﬀerence equation

φ

i+1,j

−2

¸

1 +

∆x

∆y

2

¸

φ

i,j

+φ

i−1,j

+

∆x

∆y

2

(φ

i,j+1

+φ

i,j−1

) = (∆x)

2

f

i,j

,

(5.2)

which results in a system of (I + 1) (J + 1) equations for (I + 1) (J + 1)

unknowns.

There are two options for solving such systems of equations:

1

Direct Methods:

i) No iterative convergence errors.

ii) Eﬃcient for certain types of linear systems, e.g. tridiagonal, block-tridiagonal.

iii) Become less eﬃcient for large systems of equations.

iv) Typically cannot adapt to non-linear problems.

2

Iterative Methods:

i) Iterative convergence errors.

ii) Generally more eﬃcient for large systems of equations.

iii) Apply to non-linear problems.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 80 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

Outline

5

Numerical Solutions of Elliptic Problems

Introduction

Finite-Diﬀerence Methods for the Poisson Equation

Direct Methods for Linear Systems

Fourier Transform Methods

Cyclic Reduction

Iterative (Relaxation) Methods

Jacobi Iteration

Gauss-Seidel Iteration

Successive Overrelaxation (SOR)

Boundary Conditions

Dirichlet Boundary Conditions

Neumann (Derivative) Boundary Conditions

Alternating-Direction-Implicit (ADI) Method

Compact Finite Diﬀerences

Multigrid Methods

Motivation

Multigrid Methodology

Speed Comparisons

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 81 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

Outline (cont’d)

Treatment of Nonlinear Convective Terms

Upwind-Downwind Diﬀerencing

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 82 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

We wish to consider direct methods for solving the discretized Poisson equation.

Repeating the diﬀerence equation (5.2) for the Poisson equation, we have

φ

i+1,j

−2(1 +

¯

∆)φ

i,j

+φ

i−1,j

+

¯

∆(φ

i,j+1

+φ

i,j−1

) = (∆x)

2

f

i,j

, (5.3)

where

¯

∆ = (∆x/∆y)

2

, and i = 1, . . . , I + 1; j = 1, . . . , J + 1.

In order to write the system of diﬀerence equations in matrix form, let us renumber

the two-dimensional mesh (i, j) into a one-dimensional array (n) as follows

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 83 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

Thus, the relationship between the one-dimensional and two-dimensional indices is

n = (i −1)(J + 1) +j, n = 1, . . . , (I + 1)(J + 1),

where i = 1, . . . , I + 1 and j = 1, . . . , J + 1.

Therefore, our ﬁve-point ﬁnite diﬀerence stencil becomes

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 84 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

And the ﬁnite-diﬀerence equation (5.4) for the Poisson equation becomes (with

∆ = ∆x = ∆y ⇒

¯

∆ = 1)

φ

n+J+1

+φ

n−(J+1)

+φ

n+1

+φ

n−1

−4φ

n

= ∆

2

f

n

, (5.4)

where n = 1, . . . , (I + 1)(J + 1).

Thus, the system of equations Aφ = d is of the form

D I 0 0 0

I D I 0 0

0 I D 0 0

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

0 0 0 D I

0 0 0 I D

¸

¸

¸

¸

¸

¸

¸

¸

¸

φ

1

φ

2

φ

3

.

.

.

φ

(I+1)(J+1)−1

φ

(I+1)(J+1)

¸

¸

¸

¸

¸

¸

¸

¸

¸

=

d

1

d

2

d

3

.

.

.

d

(I+1)(J+1)−1

d

(I+1)(J+1)

¸

¸

¸

¸

¸

¸

¸

¸

¸

.

A is a block tridiagonal matrix with (I + 1) blocks in both directions, where each

block is a (J + 1) (J + 1) matrix, and d contains all known information from

the boundary conditions.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 85 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

0 is a zero matrix block, I is an identity matrix block, and the tridiagonal blocks

are

D =

−4 1 0 0 0

1 −4 1 0 0

0 1 −4 0 0

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

0 0 0 −4 1

0 0 0 1 −4

¸

¸

¸

¸

¸

¸

¸

¸

¸

.

In general, the method for solving the system Aφ = d depends upon the form of

the coeﬃcient matrix A:

Full or dense ⇒ Gauss elimination, LU decomposition, etc. (very expensive

computationally).

Sparse and banded → Result from discretizations of certain classes of

problems (e.g. separable elliptic partial diﬀerential equations, such as the

Poisson equation):

→ Tridiagonal ⇒ Thomas algorithm

→ Fast Fourier Transform (FFT) and/or cyclic reduction, which generally are the

fastest methods for problems in which they apply.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 86 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

Fourier Transform Methods

The Fourier transform of a continuous function h(t) is deﬁned by

H(f) =

∞

−∞

h(t)e

2πift

dt,

where f is the frequency, and i is the imaginary number. The inverse transform is

h(t) =

∞

−∞

H(f)e

−2πift

df.

Consider the discrete form of the Fourier transform in which we have N values of

h(t) at discrete points deﬁned by

h

k

= h(t

k

), t

k

= k∆, k = 0, 1, 2, . . . , N −1,

where ∆ is the step size in the data.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 87 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

After taking the Fourier transform, we will have N discrete points in the

frequency domain deﬁned by

f

n

=

n

N∆

, n = −

N

2

, . . . ,

N

2

,

corresponding to the Nyquist critical frequency range. Thus, the discrete Fourier

transform is

H(f

n

) =

∞

−∞

h(t)e

2πif

n

t

dt,

or approximating the integral by summing over each ∆ interval

H(f

n

) ≈

N−1

¸

k=0

h

k

e

2πif

n

t

k

∆.

Using the fact that f

n

t

k

= (n/N∆)k∆ = nk/N gives

H(f

n

) ≈ ∆

N−1

¸

k=0

h

k

e

2πikn/N

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 88 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

Denoting the summation in the previous expression by

ˆ

h

n

, we write

∴ H(f

n

) ≈ ∆

ˆ

h

n

,

ˆ

h

n

=

N−1

¸

k=0

h

k

e

2πikn/N

. (5.5)

The discrete inverse Fourier transform is then

h

k

=

1

N

N/2

¸

n=−N/2

ˆ

h

n

e

−2πikn/N

. (5.6)

The above expressions are all for a one-dimensional domain.

For a two-dimensional grid, we deﬁne:

k = 0, . . . , K −1, l = 0, . . . , L −1 → Physical grid

m = −

K

2

, . . . ,

K

2

, n = −

L

2

, . . . ,

L

2

→ Transform space (frequency)

The two-dimensional discrete Fourier transform of φ is (analogous to (5.5)

Φ(f

m,n

) ≈ ∆

2

ˆ

φ

m,n

,

ˆ

φ

m,n

=

K−1

¸

k=0

L−1

¸

l=0

φ

k,l

e

2πimk/K

e

2πinl/L

. (5.7)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 89 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

This is equivalent to taking the Fourier transform in each direction. The inverse

Fourier transform is (analogous to (5.6))

φ

k,l

=

1

KL

K/2

¸

m=−K/2

L/2

¸

n=−L/2

ˆ

φ

m,n

e

−2πikm/K

e

−2πiln/L

. (5.8)

Now let us apply this to the discretized Poisson equation (5.2). For simplicity, set

∆ = ∆x = ∆y giving (with i →k, j →l)

φ

k+1,l

+φ

k−1,l

+φ

k,l+1

+φ

k,l−1

−4φ

k,l

= ∆

2

f

k,l

, (5.9)

where now f

k,l

is the right-hand-side of the Poisson equation (not frequency).

Substituting equation (5.8) into equation (5.9) leads to

ˆ

φ

m,n

e

−2πi(k+1)m/K

e

−2πiln/L

+e

−2πi(k−1)m/K

e

−2πiln/L

+e

−2πikm/K

e

−2πi(l+1)n/L

+e

−2πikm/K

e

−2πi(l−1)n/L

−4e

−2πikm/K

e

−2πiln/L

= ∆

2

ˆ

f

m,n

e

−2πikm/K

e

−2πiln/L

,

where

ˆ

f

m,n

is the Fourier transform of the right-hand-side f

k,l

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 90 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

Canceling the common factor e

−2πikm/K

e

−2πiln/L

, we have

ˆ

φ

m,n

e

−2πim/K

+e

2πim/K

+e

−2πin/L

+e

2πin/L

−4

= ∆

2

ˆ

f

m,n

.

Recalling that cos(ax) =

e

iax

+e

−iax

/2 gives

ˆ

φ

m,n

¸

2 cos

2πm

K

+ 2 cos

2πn

L

−4

= ∆

2

ˆ

f

m,n

.

Solving for

ˆ

φ

m,n

leads to

ˆ

φ

m,n

=

∆

2

ˆ

f

m,n

2

cos

2πm

K

+ cos

2πn

L

−2

, (5.10)

for m = 1, . . . , K −1; n = 1, . . . , L −1.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 91 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

Therefore, to solve the diﬀerence equation (5.9) using Fourier transform methods:

1) Compute the Fourier transform

ˆ

f

m,n

of the right-hand-side f

k,l

using (similar

to (5.7))

ˆ

f

m,n

=

K−1

¸

k=0

L−1

¸

l=0

f

k,l

e

2πimk/K

e

2πinl/L

. (5.11)

2) Compute

ˆ

φ

m,n

from equation (5.10).

3) Compute φ

k,l

using the inverse Fourier transform (5.8).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 92 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

Notes:

1) The above procedure works for periodic boundary conditions, i.e. the solution

satisﬁes

φ

k,l

= φ

k+K,l

= φ

k,l+L

.

For Dirichlet boundary conditions ⇒ Use sine transform.

For Neumann boundary conditions ⇒ Use cosine transform.

2) In practice, the Fourier (and inverse) transforms are computed using a Fast

Fourier Transform (FFT) technique (see, for example, Numerical Recipes).

3) Fourier transform methods can only be applied to partial diﬀerential

equations with constant coeﬃcients in the direction(s) for which the Fourier

transform is applied.

4) We use Fourier transforms to solve the diﬀerence equation, not the

diﬀerential equation; therefore, this is not a spectral method.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 93 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

Cyclic Reduction

Again, consider the Poisson equation

∂

2

φ

∂x

2

+

∂

2

φ

∂y

2

= f(x, y),

discretized on a two-dimensional grid with ∆ = ∆x = ∆y and

i = 0, . . . , I; j = 0, . . . , J, where I = 2

n

with integer n ((I +1) (J +1) points):

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 94 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

Applying central diﬀerences to the Poisson equation, the diﬀerence equation for

constant x-lines becomes

u

i−1

−2u

i

+u

i+1

+B

u

i

= ∆

2

f

i

, i = 0, . . . , I, (5.12)

where

u

i

=

φ

i,0

φ

i,1

φ

i,2

.

.

.

φ

i,J−1

φ

i,J

¸

¸

¸

¸

¸

¸

¸

¸

¸

, f

i

=

f

i,0

f

i,1

f

i,2

.

.

.

f

i,J−1

f

i,J

¸

¸

¸

¸

¸

¸

¸

¸

¸

, B

=

−2 1 0 0 0

1 −2 1 0 0

0 1 −2 0 0

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

0 0 0 −2 1

0 0 0 1 −2

¸

¸

¸

¸

¸

¸

¸

¸

¸

.

The ﬁrst three terms in equation (5.12) correspond to the central diﬀerence in the

x-direction, and the fourth term corresponds to the central diﬀerence in the

y-direction (see B

).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 95 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

Taking B = −2I +B

**, where I is the identity matrix, equation (5.12) becomes
**

u

i−1

+Bu

i

+u

i+1

= ∆

2

f

i

, i = 0, . . . , I, (5.13)

where the (J + 1) (J + 1) matrix B is

B =

−4 1 0 0 0

1 −4 1 0 0

0 1 −4 0 0

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

0 0 0 −4 1

0 0 0 1 −4

¸

¸

¸

¸

¸

¸

¸

¸

¸

.

Note that equation (5.13) corresponds to the block-tridiagonal matrix for equation

(5.4), where B is the tridiagonal portion and u

i−1

and u

u+1

are the ’fringes.’

Writing three successive equations of (5.13) for i −1, i and i + 1:

u

i−2

+Bu

i−1

+u

i

= ∆

2

f

i−1

,

u

i−1

+Bu

i

+u

i+1

= ∆

2

f

i

,

u

i

+Bu

i+1

+u

i+2

= ∆

2

f

i+1

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 96 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

Multiplying −B times the middle equation and adding all three gives

u

i−2

+B

∗

u

i

+u

i+2

= ∆

2

f

∗

i

, (5.14)

where

B

∗

= 2I −B

2

,

f

∗

i

= f

i−1

−Bf

i

+f

i+1

.

This is an equation of the same form as (5.13); therefore, applying this procedure

to all even numbered i equations in (5.13) reduces the number of equations by a

factor of two.

This cyclic reduction procedure can be repeated until a single equation remains for

the middle line of variables, u

I/2

(I = 2

n

, with integer n), which is tridiagonal.

Thus, using the solution for u

I/2

, solutions for all other i are obtained by

successively solving the tridiagonal problems at each level in reverse:

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 97 / 454

Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems

This results in a total of I tridiagonal problems to obtain u

i

, i = 0, . . . , I.

Notes:

1) Speed of FFT and cyclic reduction methods are comparable.

2) Cyclic reduction may be applied to somewhat more general equations, such

as those with variable coeﬃcients.

3) Can accelerate by taking FFT in one direction (with constant coeﬃcients)

and using cyclic reduction in the other.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 98 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

Outline

5

Numerical Solutions of Elliptic Problems

Introduction

Finite-Diﬀerence Methods for the Poisson Equation

Direct Methods for Linear Systems

Fourier Transform Methods

Cyclic Reduction

Iterative (Relaxation) Methods

Jacobi Iteration

Gauss-Seidel Iteration

Successive Overrelaxation (SOR)

Boundary Conditions

Dirichlet Boundary Conditions

Neumann (Derivative) Boundary Conditions

Alternating-Direction-Implicit (ADI) Method

Compact Finite Diﬀerences

Multigrid Methods

Motivation

Multigrid Methodology

Speed Comparisons

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 99 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

Outline (cont’d)

Treatment of Nonlinear Convective Terms

Upwind-Downwind Diﬀerencing

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 100 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

Returning to the diﬀerence equation (5.2) for the Poisson equation (5.1)

φ

i+1,j

−2(1 +

¯

∆)φ

i,j

+φ

i−1,j

+

¯

∆(φ

i,j+1

+φ

i,j−1

) = (∆x)

2

f

i,j

, (5.15)

where

¯

∆ = (∆x/∆y)

2

.

This may be written in general form as

Lφ = f, (5.16)

where L is the ﬁnite-diﬀerence operator for the particular problem.

Iterative methods consist of beginning with an initial guess and iteratively

“relaxing” equation (5.16) until convergence.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 101 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

Jacobi Iteration

Solving equation (5.15) for φ

i,j

and indicating the iteration number using a

superscript

φ

n+1

i,j

=

1

2(1 +

¯

∆)

φ

n

i+1,j

+φ

n

i−1,j

+

¯

∆

φ

n

i,j+1

+φ

n

i,j−1

−(∆x)

2

f

i,j

. (5.17)

Procedure:

1

Provide an initial guess φ

1

i,j

for φ

i,j

at each point

i = 1, . . . , I + 1, j = 1, . . . , J + 1.

2

Relax (iterate) by applying (5.17) at each grid point to produce successive

approximations:

φ

2

i,j

, φ

3

i,j

, . . . , φ

n

i,j

, . . .

3

Continue until convergence, determined by

max

[φ

n+1

i,j

−φ

n

i,j

[

max

[φ

n

i,j

[

< ,

where, for example, = 10

−4

⇒ convergence to ∼ 4 signiﬁcant ﬁgures.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 102 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

Notes:

1

Convergence is too slow ⇒ not used in practice.

2

Requires φ

n+1

i,j

and φ

n

i,j

to be stored for all i = 1, . . . , I + 1, j = 1, . . . , J + 1.

3

Used as a basis for comparison with other methods to follow.

4

Although not necessary, it is instructive to view iterative methods in matrix

form Ax = c.

→ See MMAE 501, section 2.2.2 notes.

We write A = M

1

−M

2

; thus, an iterative scheme may be devised by

writing Ax = c in the form

M

1

x

(n+1)

= M

2

x

(n)

+c,

where we put the iteration number in parentheses in order to distinguish it

from powers. Multiplying by M

−1

1

gives

x

(n+1)

= M

−1

1

M

2

x

(n)

+M

−1

1

c,

or

x

(n+1)

= Mx

(n)

+M

−1

1

c,

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 103 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

where M = M

−1

1

M

2

is the iteration matrix.

Let

D = diagonal elements of A

−L = lower triangular elements of A

−U = upper triangular elements of A

Therefore,

Ax = (D−L −U)x = c.

Then for Jacobi iteration (M

1

= D, M

2

= L +U):

Dx

(n+1)

= (L +U)x

(n)

+c

x

(n+1)

= D

−1

(L +U)x

(n)

+D

−1

c

∴ M = M

−1

1

M

2

= D

−1

(L +U)

Then we check to be sure that the spectral radius of M satisﬁes ρ < 1 to

ensure convergence of the iterative scheme.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 104 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

In addition, a smaller spectral radius results in more rapid convergence. It

can be shown that for equation (5.17) with

¯

∆ = 1 (∆x = ∆y) and Dirichlet

boundary conditions that

ρ

Jac

(I, J) =

1

2

¸

cos

π

I + 1

+ cos

π

J + 1

.

If I = J and I is large, then

ρ

Jac

(I) = cos

π

I + 1

= 1 −

1

2

π

I + 1

2

+ ; (5.18)

therefore, as I →∞, ρ

Jac

(I) →1. As a result, we observe slower

convergence as I is increased, i.e. there is a disproportionate increase in

computational time as I is increased.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 105 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

Gauss-Seidel Iteration

There are two problems with Jacobi iteration:

1

Slow convergence.

2

Must store current and previous iterations for entire grid.

The Gauss-Seidel method addresses both problems by using the most recently

updated information. For example, if sweeping along lines of constant y

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 106 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

Therefore, when updating φ

i,j

, the points φ

i,j−1

and φ

i−1,j

have already been

updated, and using these updated values, equation (5.17) is changed to

φ

n+1

i,j

=

1

2(1 +

¯

∆)

φ

n

i+1,j

+φ

n+1

i−1,j

+

¯

∆

φ

n

i,j+1

+φ

n+1

i,j−1

−(∆x)

2

f

i,j

. (5.19)

Observe that now it is not necessary to store φ

n

i,j

at the previous iteration. The

values of φ

i,j

are all stored in the same array, and it is not necessary to distinguish

between the (n) or (n + 1)

st

iterates. We simply use the most recently updated

information.

In matrix form, the Gauss-Seidel method is (M

1

= D−L, M

2

= U):

(D−L)x

(n+1)

= Ux

(n)

+c

x

(n+1)

= (D−L)

−1

Ux

(n)

+ (D−L)

−1

c

∴ M = M

−1

1

M

2

= (D−L)

−1

U

It can be shown that

ρ

GS

= ρ

2

Jac

;

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 107 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

therefore, for our model problem

ρ

GS

(I) = ρ

2

Jac

(I) =

¸

1 −

1

2

π

I + 1

2

+

¸

2

= 1 −

π

I + 1

2

+ . (5.20)

Thus, the rate of convergence is twice as fast as for Jacobi, i.e. the Gauss-Seidel

method requires one-half the iterations for the same level of accuracy.

Note: It can be shown that diagonal dominance of A is a suﬃcient (but not

necessary) condition for convergence of the Jacobi and Gauss-Seidel iteration

methods, i.e. ρ < 1, where ρ is the spectral radius of M = M

−1

1

M

2

(see Morton

and Mayers, p. 205 for proof).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 108 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

Successive Overrelaxation (SOR)

In Gauss-Seidel iteration, the sign of the error typically does not change from

iteration to iteration; therefore, the iterative solution normally approaches the

exact solution very slowly. Convergence can often be accelerated by

“over-relaxing,” or magnifying, the change at each iteration.

This is accomplished by taking a weighted average of the previous iterate φ

n

i,j

and

the Gauss-Seidel iterate φ

n+1

i,j

. So if we denote the Gauss-Seidel iterate (5.19) by

φ

∗

i,j

, the new SOR iterate is given by

φ

n+1

i,j

= (1 −ω)φ

n

i,j

+ωφ

∗

i,j

, (5.21)

where ω is the relaxation parameter and 0 < ω < 2 for convergence (Morton &

Mayers, p. 206).

ω = 1 ⇒ Gauss-Seidel

1 < ω < 2 ⇒ Overrelaxation

0 < ω < 1 ⇒ Underrelaxation

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 109 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

Overrelaxation typically accelerates convergence of linear problems, while

underrelaxation is often required for convergence when dealing with non-linear

problems.

In matrix form, the SOR method is (M

1

= D−ωL, M

2

= (1 −ω)D+ωU):

(D−ωL)x

(n+1)

= [(1 −ω)D+ωU] x

(n)

+ωc

x

(n+1)

= (D−ωL)

−1

[(1 −ω)D+ωU] x

(n)

+ω(D−ωL)

−1

c

∴ M = M

−1

1

M

2

= (D−ωL)

−1

[(1 −ω)D+ωU]

It can be shown that for the Poisson equation, the optimal value of ω is

ω

opt

=

2

1 +

1 −ρ

2

Jac

, (5.22)

and for this ω

opt

, the spectral radius for SOR is

ρ

SOR

=

ρ

Jac

1 +

1 −ρ

2

Jac

2

. (5.23)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 110 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

Recall that for our model problem, ρ

Jac

= 1 −

1

2

π

I+1

2

+ ; thus,

ω

opt

=

2

1 +

1 −ρ

2

Jac

=

2

1 +

1 −

¸

1 −

1

2

π

I+1

2

+

2

=

2

1 +

1 −

¸

1 −

π

I+1

2

+

ω

opt

≈

2

1 +

π

I+1

.

(5.24)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 111 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

Then for large I

ρ

SOR

≈

1 −

1

2

π

I+1

2

1 +

π

I+1

¸

¸

¸

2

≈

¸

1 −

1

2

π

I + 1

2

¸

¸

1 −

π

I + 1

+

¸

2

≈

1 −

π

I + 1

+

2

ρ

SOR

≈ 1 −

2π

I + 1

.

(5.25)

Thus, as I →∞, ω

opt

→2, and ρ

SOR

→1.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 112 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

However, from a comparison of equations (5.25) and (5.20), we see that

ρ

SOR

< ρ

GS

,

such that SOR converges at a rate

2(I+1)

π

times faster than Gauss-Seidel if the

optimal value of the relaxation parameter is used for the model problem under

consideration. Therefore, the relative convergence rate improves linearly with

increasing I.

This analysis assumes that we know ω

opt

. Typically, we do not, and the rate of

convergence depends signiﬁcantly on the choice of ω, e.g. the typical behavior for

linear problems is as follows (for given I):

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 113 / 454

Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods

Notes:

1

Although ω

opt

does not depend on the right-hand-side, it does depend upon:

i) diﬀerential equation

ii) method of discretization

iii) boundary conditions

iv) shape of domain

2

For a given problem, ω

opt

must be estimated from a similar problem and/or

trial and error.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 114 / 454

Numerical Solutions of Elliptic Problems Boundary Conditions

Outline

5

Numerical Solutions of Elliptic Problems

Introduction

Finite-Diﬀerence Methods for the Poisson Equation

Direct Methods for Linear Systems

Fourier Transform Methods

Cyclic Reduction

Iterative (Relaxation) Methods

Jacobi Iteration

Gauss-Seidel Iteration

Successive Overrelaxation (SOR)

Boundary Conditions

Dirichlet Boundary Conditions

Neumann (Derivative) Boundary Conditions

Alternating-Direction-Implicit (ADI) Method

Compact Finite Diﬀerences

Multigrid Methods

Motivation

Multigrid Methodology

Speed Comparisons

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 115 / 454

Numerical Solutions of Elliptic Problems Boundary Conditions

Outline (cont’d)

Treatment of Nonlinear Convective Terms

Upwind-Downwind Diﬀerencing

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 116 / 454

Numerical Solutions of Elliptic Problems Boundary Conditions

Dirichlet Boundary Conditions

Simply apply the speciﬁed values at the boundaries to φ

1,j

, φ

I+1,j

, φ

i,1

, and

φ

i,J+1

and iterate on the Jacobi (5.17), Gauss-Seidel (5.19), or SOR (5.21)

equation in the interior, i = 2, . . . , I, j = 2, . . . , J.

For example, Jacobi or Gauss-Seidel iterate at i = 2, j = 2:

φ

n+1

2,2

=

1

2(1 +

¯

∆)

φ

n

3,2

+φ

1,2

+

¯

∆

φ

n

2,3

+φ

2,1

−(∆x)

2

f

2,2

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 117 / 454

Numerical Solutions of Elliptic Problems Boundary Conditions

Neumann (Derivative) Boundary Conditions

Consider the following boundary condition

∂φ

∂x

= c at x = 0. (5.26)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 118 / 454

Numerical Solutions of Elliptic Problems Boundary Conditions

The simplest treatment would be to use the Jacobi (5.17), Gauss-Seidel (5.19), or

SOR (5.21) equation to update φ

i,j

in the interior for i = 2, . . . , I, and then to

approximate the boundary condition (5.26) by a forward diﬀerence applied at i = 1

φ

2,j

−φ

1,j

∆x

+O(∆x) = c. (5.27)

This could then be used to update φ

1,j

, j = 2, . . . , J using

φ

1,j

= φ

2,j

−c∆x.

This is unacceptable, however, because (5.27) is only ﬁrst-order accurate.

A better alternative is to update the interior points as before, but now apply the

diﬀerence equation at the boundary. For example, we could apply Jacobi (5.17) at

i = 1

φ

n+1

1,j

=

1

2(1 +

¯

∆)

φ

n

2,j

+φ

n

0,j

+

¯

∆

φ

n

1,j+1

+φ

n

1,j−1

−(∆x)

2

f

1,j

. (5.28)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 119 / 454

Numerical Solutions of Elliptic Problems Boundary Conditions

However, this involves a value φ

n

0,j

that is outside the domain. A second-order

accurate central-diﬀerence approximation for the boundary condition (5.26) is

φ

n

2,j

−φ

n

0,j

2∆x

+O(∆x

2

) = c, (5.29)

which also involves the value φ

n

0,j

. Therefore, solving (5.29) for φ

n

0,j

gives

φ

n

0,j

= φ

n

2,j

−2c∆x,

and substituting into the diﬀerence equation (5.28) to eliminate φ

n

0,j

leads to

φ

n+1

1,j

=

1

2(1 +

¯

∆)

2

φ

n

2,j

−c∆x

+

¯

∆

φ

n

1,j+1

+φ

n

1,j−1

−(∆x)

2

f

1,j

. (5.30)

Thus, we use (5.30) to update φ

n+1

1,j

, j = 2, . . . , J.

Notes:

1

This is the same procedure used for a Dirichlet condition but with an

additional sweep along the left boundary using (5.30) for φ

n+1

1,j

, j = 2, . . . , J.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 120 / 454

Numerical Solutions of Elliptic Problems Boundary Conditions

2

This approach requires special treatment at corners depending upon the

boundary condition along the adjacent boundary. For example, consider if in

addition to (5.26) we have

∂φ

∂y

= d at y = b. (5.31)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 121 / 454

Numerical Solutions of Elliptic Problems Boundary Conditions

Applying (5.30) at the corner i = 1, j = J + 1

φ

n+1

1,J+1

=

1

2(1 +

¯

∆)

2

φ

n

2,J+1

−c∆x

+

¯

∆

φ

n

1,J+2

+φ

n

1,J

−(∆x)

2

f

1,J+1

,

(5.32)

where φ

n

1,J+2

is outside the domain. Approximating (5.31) using a central

diﬀerence in the same manner as (5.29) gives

φ

n

1,J+2

−φ

=

d,

which leads to

φ

n

1,J+2

= φ

n

1,J

+ 2d∆y.

Substituting into (5.32) to eliminate φ

n

1,J+2

gives

φ

n+1

1,J+1

=

1

2(1 +

¯

∆)

2

φ

n

2,J+1

−c∆x

+ 2

¯

∆

φ

n

1,J

+d∆y

−(∆x)

2

f

1,J+1

,

which is used to update the corner value i = 1, j = J + 1.

3

If a lower-order approximation, such as (5.27), is used at a boundary, its

truncation error generally dominates the convergence rate.

4

The above approach is used in thomas.f, etc.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 122 / 454

Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method

Outline

5

Numerical Solutions of Elliptic Problems

Introduction

Finite-Diﬀerence Methods for the Poisson Equation

Direct Methods for Linear Systems

Fourier Transform Methods

Cyclic Reduction

Iterative (Relaxation) Methods

Jacobi Iteration

Gauss-Seidel Iteration

Successive Overrelaxation (SOR)

Boundary Conditions

Dirichlet Boundary Conditions

Neumann (Derivative) Boundary Conditions

Alternating-Direction-Implicit (ADI) Method

Compact Finite Diﬀerences

Multigrid Methods

Motivation

Multigrid Methodology

Speed Comparisons

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 123 / 454

Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method

Outline (cont’d)

Treatment of Nonlinear Convective Terms

Upwind-Downwind Diﬀerencing

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 124 / 454

Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method

Recall that in elliptic problems, the solution anywhere depends on the solution

everywhere, i.e. it has an inﬁnite speed of propagation in all directions.

However, in Jacobi, Gauss-Seidel, and SOR, information only propagates through

the mesh one point at a time. For example, if sweeping along lines of constant y

with 0 ≤ x ≤ a, it takes I iterations before the boundary condition at x = a is

“felt” at x = 0.

⇒ These techniques are not very “elliptic like.”

A more “elliptic-like” method could be obtained by solving entire lines in the grid

in an implicit manner. For example, sweeping along lines of constant y and

solving each constant y-line implicitly, i.e. all at once, would allow for the

boundary condition at x = a to inﬂuence the solution in the entire domain after

only one sweep through the grid.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 125 / 454

Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method

Returning to the diﬀerence equation (5.15) for the Poisson equation

φ

i+1,j

−2(1 +

¯

∆)φ

i,j

+φ

i−1,j

+

¯

∆(φ

i,j+1

+φ

i,j−1

) = (∆x)

2

f

i,j

. (5.33)

Consider the j

th

line and assume that values along the j + 1

st

and j −1

st

lines

are taken from the previous iterate.

Rewriting (5.33) as an implicit equation for the values of φ

i,j

along the j

th

line

gives

φ

n+1

i+1,j

−2(1+

¯

∆)φ

n+1

i,j

+φ

n+1

i−1,j

= (∆x)

2

f

i,j

−

¯

∆

φ

n

i,j+1

+φ

n

i,j−1

, i = 2, . . . , I.

(5.34)

Therefore, we have a tridiagonal problem for φ

i,j

along the j

th

line, which can be

solved using the Thomas algorithm.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 126 / 454

Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method

Notes:

1

If sweeping through j-lines, j = 2, . . . , J, then φ

n

i,j−1

becomes φ

n+1

i,j−1

in

(5.34), i.e. it has already been updated. Therefore, we use updated values as

in Gauss-Seidel.

2

Can also incorporate SOR.

3

More eﬃcient at spreading information throughout the domain; therefore, it

reduces the number of iterations required for convergence, but there is more

computation per iteration.

4

This provides motivation for the ADI method.

ADI Method

In the ADI method we sweep along lines but in alternating directions.

In the ﬁrst half of the iteration we perform a sweep along constant y-lines by

solving the series of tridiagonal problems for j = 2, . . . , J:

φ

n+1/2

i+1,j

−(2 +σ)φ

n+1/2

i,j

+φ

n+1/2

i−1,j

= (∆x)

2

f

i,j

−

¯

∆

φ

n

i,j+1

−

2 −

σ

¯

∆

φ

n

i,j

+φ

n+1/2

i,j−1

, i = 2, . . . , I.

(5.35)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 127 / 454

Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method

Notes:

1

The φ

n+1/2

i,j−1

term on the right-hand-side has been updated from the previous

line.

2

Unlike in equation (5.34), diﬀerencing in the x- and y-directions are kept

separate to mimic diﬀusion in each direction. This is called a splitting

method.

3

σ is an acceleration parameter to enhance diagonal dominance (σ > 0).

σ = 0 corresponds to no acceleration. Note that the σ terms on each side of

the equation cancel.

In the second half of the iteration we sweep along constant x-lines by solving the

series of tridiagonal problems for i = 2, . . . , I:

¯

∆φ

n+1

i,j+1

−(2

¯

∆ +σ)φ

n+1

i,j

+

¯

∆φ

n+1

i,j−1

= (∆x)

2

f

i,j

−

φ

n+1/2

i+1,j

−(2 −σ) φ

n+1/2

i,j

+φ

n+1

i−1,j

, j = 2, . . . , J,

(5.36)

where φ

n+1

i−1,j

has been updated from the previous line.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 128 / 454

Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method

Notes:

1

Involves (I −1) + (J −1) tridiagonal solves for each iteration (for Dirichlet

boundary conditions).

2

For ∆x = ∆y (

¯

∆ = 1), it can be shown that for the Poisson (or Laplace)

equation with Dirichlet boundary conditions that the acceleration parameter

that gives the best speedup is

σ = 2 sin (π/R) ,

where R = max(I + 1, J + 1).

3

The ADI method with splitting is typically faster than Gauss-Seidel or SOR

for equations in which the terms are easily factored into x and y directions,

but it is more diﬃcult if have derivative mixed terms such as ∂

2

φ/∂x∂y.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 129 / 454

Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences

Outline

5

Numerical Solutions of Elliptic Problems

Introduction

Finite-Diﬀerence Methods for the Poisson Equation

Direct Methods for Linear Systems

Fourier Transform Methods

Cyclic Reduction

Iterative (Relaxation) Methods

Jacobi Iteration

Gauss-Seidel Iteration

Successive Overrelaxation (SOR)

Boundary Conditions

Dirichlet Boundary Conditions

Neumann (Derivative) Boundary Conditions

Alternating-Direction-Implicit (ADI) Method

Compact Finite Diﬀerences

Multigrid Methods

Motivation

Multigrid Methodology

Speed Comparisons

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 130 / 454

Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences

Outline (cont’d)

Treatment of Nonlinear Convective Terms

Upwind-Downwind Diﬀerencing

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 131 / 454

Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences

As we have seen before, in order to obtain higher-order ﬁnite-diﬀerence

approximations it is necessary to incorporate more points in the ﬁnite-diﬀerence

stencil. However, it is advantageous to maintain the compact nature of

second-order accurate central diﬀerences because they produce systems of

equations, e.g. tridiagonal, that may be solved eﬃciently. Here we derive a

compact fourth-order accurate central-diﬀerence approximation for the

second-order derivatives in the Poisson equation.

For convenience, we deﬁne the following second-order accurate central-diﬀerence

operators

δ

2

x

φ

i,j

=

φ

i−1,j

−2φ

i,j

+φ

i+1,j

∆x

2

,

δ

2

y

φ

i,j

=

φ

i,j−1

−2φ

i,j

+φ

i,j+1

∆y

2

.

Recall from equation (3.13) in section 3.2 that from the Taylor series, we have

∂

2

φ

∂x

2

= δ

2

x

φ −

∆x

2

12

∂

4

φ

∂x

4

+O(∆x

4

). (5.37)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 132 / 454

Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences

Therefore,

δ

2

x

φ =

∂

2

φ

∂x

2

+

∆x

2

12

∂

4

φ

∂x

4

+O(∆x

4

).

δ

2

x

φ =

¸

1 +

∆x

2

12

∂

2

∂x

2

∂

2

φ

∂x

2

+O(∆x

4

).

(5.38)

But from equation (5.37)

∂

2

∂x

2

= δ

2

x

+O(∆x

2

).

Substituting into (5.38) gives

δ

2

x

φ =

¸

1 +

∆x

2

12

δ

2

x

+O(∆x

2

)

∂

2

φ

∂x

2

+O(∆x

4

),

δ

2

x

φ =

¸

1 +

∆x

2

12

δ

2

x

∂

2

φ

∂x

2

+O(∆x

4

).

Solving for ∂

2

φ/∂x

2

∂

2

φ

∂x

2

=

1 +

∆x

2

12

δ

2

x

−1

δ

2

x

φ +

1 +

∆x

2

12

δ

2

x

−1

O(∆x

4

) (5.39)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 133 / 454

Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences

From a binomial expansion (with ∆x suﬃciently small)

1 +

∆x

2

12

δ

2

x

−1

= 1 −

∆x

2

12

δ

2

x

+O(∆x

4

). (5.40)

Because the last term in equation (5.39) is still O(∆x

4

), we can write equation

(5.39) as

∂

2

φ

∂x

2

=

1 +

∆x

2

12

δ

2

x

−1

δ

2

x

φ +O(∆x

4

). (5.41)

Substituting the expression (5.40) into equation (5.41) leads to a O(∆x

4

)

accurate central-diﬀerence approximation for the second derivative

∂

2

φ

∂x

2

=

1 −

∆x

2

12

δ

2

x

δ

2

x

φ +O(∆x

4

).

Due to the δ

2

x

(δ

2

x

φ) operator, however, this approximation involves the ﬁve points

φ

i−2

, φ

i−1

, φ

i

, φ

i+1

and φ

i+2

; therefore, it is not compact.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 134 / 454

Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences

In order to obtain a compact scheme, we also consider the derivative in the

y-direction. Similar to equation (5.41), we have in the y-direction

∂

2

φ

∂y

2

=

1 +

∆y

2

12

δ

2

y

−1

δ

2

y

φ +O(∆y

4

). (5.42)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 135 / 454

Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences

Now consider the Poisson equation

∂

2

φ

∂x

2

+

∂

2

φ

∂y

2

= f(x, y).

Substituting equations (5.41) and (5.42) into the Poisson equation leads to

1 +

∆x

2

12

δ

2

x

−1

δ

2

x

φ +

1 +

∆y

2

12

δ

2

y

−1

δ

2

y

φ +O(∆

4

) = f(x, y),

where ∆ = max(∆x, ∆y). Multiplying by

1 +

∆x

2

12

δ

2

x

1 +

∆y

2

12

δ

2

y

gives

1 +

∆y

2

12

δ

2

y

δ

2

x

φ +

1 +

∆x

2

12

δ

2

x

δ

2

y

φ +O(∆

4

)

=

¸

1 +

∆x

2

12

δ

2

x

+

∆y

2

12

δ

2

y

+O(∆

4

)

f(x, y),

(5.43)

which is a fourth-order accurate ﬁnite-diﬀerence approximation to the Poisson

equation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 136 / 454

Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences

Expand the ﬁrst term in equation (5.43) as follows

1 +

∆y

2

12

δ

2

y

δ

2

x

φ =

1 +

∆y

2

12

δ

2

y

φ

i−1,j

−2φ

i,j

+φ

i+1,j

∆x

2

=

1

∆x

2

(φ

i−1,j

−2φ

i,j

+φ

i+1,j

)

+

1

12∆x

2

[(φ

i−1,j−1

−2φ

i−1,j

+φ

i−1,j+1

)

−2 (φ

i,j−1

−2φ

i,j

+φ

i,j+1

)

+(φ

i+1,j−1

−2φ

i+1,j

+φ

i+1,j+1

)]

=

1

12∆x

2

[−20φ

i,j

+ 10 (φ

i−1,j

+φ

i+1,j

)

−2 (φ

i,j−1

+φ

i,j+1

)

+φ

i−1,j−1

+φ

i−1,j+1

+φ

i+1,j−1

+φ

i+1,j+1

] .

Therefore, we have a nine-point stencil, but the approximation only requires three

points in each direction and thus it is compact.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 137 / 454

Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences

Similarly, expanding the second term in equation (5.43) yields

1 +

∆x

2

12

δ

2

x

δ

2

y

φ =

1

12∆y

2

[−20φ

i,j

+ 10 (φ

i,j−1

+φ

i,j+1

)

−2 (φ

i−1,j

+φ

i+1,j

) +φ

i−1,j−1

+φ

i−1,j+1

+φ

i+1,j−1

+φ

i+1,j+1

] ,

and the right-hand-side of equation (5.43) is

¸

1 +

∆x

2

12

δ

2

x

+

∆y

2

12

δ

2

y

f(x, y) = f

i,j

+

1

12

[f

i−1,j

−2f

i,j

+f

i+1,j

+f

i,j−1

−2f

i,j

+f

i,j+1

]

=

1

12

[8f

i,j

+f

i−1,j

+f

i+1,j

+f

i,j−1

+f

i,j+1

] .

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 138 / 454

Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences

Thus, the coeﬃcients in the ﬁnite-diﬀerence stencil for φ(x, y) are as follows:

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 139 / 454

Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences

and for f(x, y) they are

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 140 / 454

Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences

Notes:

1

Observe that in equation (5.43) the two-dimensionality of the equation has

been taken advantage of to obtain the compact ﬁnite-diﬀerence stencil, i.e.

see the δ

2

x

δ

2

y

φ and δ

2

y

δ

2

x

φ diﬀerence operators.

2

Because the ﬁnite-diﬀerence stencil is compact, i.e. only involving three

points in each direction, application of the ADI method as in the previous

section results in a set of tridiagonal problems to solve. Therefore, this

fourth-order, compact ﬁnite-diﬀerence approach is no less eﬃcient then that

for the second-order scheme used in the previous section (there are simply

additional terms on the right-hand-side of the equations).

3

The primary disadvantage of using higher-order schemes is that it is generally

necessary to use lower-order approximations for derivative boundary

conditions. This is not a problem, however, for Dirichlet boundary conditions.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 141 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Outline

5

Numerical Solutions of Elliptic Problems

Introduction

Finite-Diﬀerence Methods for the Poisson Equation

Direct Methods for Linear Systems

Fourier Transform Methods

Cyclic Reduction

Iterative (Relaxation) Methods

Jacobi Iteration

Gauss-Seidel Iteration

Successive Overrelaxation (SOR)

Boundary Conditions

Dirichlet Boundary Conditions

Neumann (Derivative) Boundary Conditions

Alternating-Direction-Implicit (ADI) Method

Compact Finite Diﬀerences

Multigrid Methods

Motivation

Multigrid Methodology

Speed Comparisons

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 142 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Outline (cont’d)

Treatment of Nonlinear Convective Terms

Upwind-Downwind Diﬀerencing

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 143 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Motivation

The iterative techniques we have discussed all have the following property:

High-frequency components of error ⇒ fast convergence.

Low-frequency components of error ⇒ slow convergence.

To illustrate this, consider the simple one-dimensional problem

d

2

φ

dx

2

= 0, 0 ≤ x ≤ 1, (5.44)

with φ(0) = φ(1) = 0, which has the exact solution φ(x) = 0. Therefore, all plots

of the numerical solution are also plots of the error.

Discretizing equation (5.44) at I + 1 points using central diﬀerences gives

φ

i+1

−2φ

i

+φ

i−1

= 0, i = 1, . . . , I −1

φ

0

= φ

I

= 0.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 144 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

To show how the nature of the error aﬀects convergence, consider an initial guess

consisting of the Fourier mode φ(x) = sin(kπx), where k is the wavenumber and

indicates the number of half sine waves on the interval 0 ≤ x ≤ 1. In discretized

form, with x

i

= i∆x = i/I, this is

φ

i

= sin

kπi

I

, i = 0, . . . , I,

with the wavenumber 1 ≤ k ≤ I −1. Thus,

Small k ⇒ long, smooth waves (low frequency).

Large k ⇒ highly oscillatory waves (high frequency).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 145 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Consider initial guesses with k = 1, 3, 6 (the ﬁgures are from Briggs et al.):

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 146 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Applying Jacobi and Gauss-Seidel iteration with I = 64, the solution converges

more rapidly for the higher frequency initial guess.

Jacobi:

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 147 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Gauss-Seidel:

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 148 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

A more realistic situation is one in which the initial guess contains multiple modes,

for example

φ

i

=

1

3

¸

sin

πi

I

+ sin

6πi

I

+ sin

32πi

I

.

The k = 1, 6, and 32 terms represent low-, medium- and high-frequency modes,

respectively.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 149 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Applying Jacobi iteration with I = 64, the error is reduced rapidly during the early

iterations but more slowly thereafter.

Thus, there is rapid convergence until the high-frequency modes are smoothed

out, then slow convergence for the lower frequency modes.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 150 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

See, for example, the following sequence using Jacobi iteration:

k = 3 after 1 iteration (left) and 10 iterations (right):

k = 16 after 1 iteration (left) and 10 iterations (right):

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 151 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

k = 2 and k = 16 after 1 iteration (left) and 10 iterations (right):

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 152 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Multigrid methods take advantage of this property of relaxation techniques by

recognizing that smooth components of the error become more oscillatory with

respect to the grid size on a coarse grid.

Thus, relaxation is more eﬀective on a coarse grid representation of the error (it is

also faster).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 153 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Notes:

1) Multigrid methods are not so much a speciﬁc set of techniques as they are a

framework for accelerating relaxation (iterative) methods.

2) Multigrid methods are comparable in speed with fast direct methods, such as

Fourier methods and cyclic reduction, but can be used to solve general

elliptic equations with variable coeﬃcients and even nonlinear equations.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 154 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Multigrid Methodology

Consider the general second-order linear elliptic partial diﬀerential equation of the

form

A(x, y)

∂

2

φ

∂x

2

+B(x, y)

∂φ

∂x

+C(x, y)

∂

2

φ

∂y

2

+D(x, y)

∂φ

∂y

+E(x, y)φ = F(x, y). (5.45)

To be elliptic, A(x, y)C(x, y) > 0 for all (x, y). Approximating this diﬀerential

equation using second-order accurate central diﬀerences gives

A

i,j

φ

i+1,j

−2φ

i,j

+φ

i−1,j

∆x

2

+B

i,j

φ

i+1,j

−φ

i−1,j

2∆x

C

i,j

φ

i,j+1

−2φ

i,j

+φ

i,j−1

∆y

2

+D

i,j

φ

i,j+1

−φ

i,j−1

2∆y

+E

i,j

φ

i,j

= F

i,j

,

where A

i,j

= A(x

i

, y

j

), etc. We rewrite this equation in the form

a

i,j

φ

i+1,j

+b

i,j

φ

i−1,j

+c

i,j

φ

i,j+1

+d

i,j

φ

i,j−1

+e

i,j

φ

i,j

= F

i,j

, (5.46)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 155 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

where

a

i,j

=

A

i,j

∆x

2

+

B

i,j

2∆x

, b

i,j

=

A

i,j

∆x

2

−

B

i,j

2∆x

,

c

i,j

=

C

i,j

∆y

2

+

D

i,j

2∆y

, d

i,j

=

C

i,j

∆y

2

−

D

i,j

2∆y

,

e

i,j

= E

i,j

−

2A

i,j

∆x

2

−

2C

i,j

∆y

2

.

For convenience, write (5.46) (or some other diﬀerence equation) as

Lφ = f, (5.47)

where L represents the diﬀerence operator. If φ is the exact solution to equation

(5.46), then the error is deﬁned by

e = φ −

¯

φ, (5.48)

where

¯

φ is an approximation to φ. The residual is deﬁned by

r = f −L

¯

φ. (5.49)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 156 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Observe from (5.47) that if

¯

φ = φ, then the residual is zero; therefore, the residual

is a measure of how “wrong” the approximate solution is.

Substituting (5.48) into equation (5.47) gives the error equation

Le = r = f −L

¯

φ. (5.50)

From these deﬁnitions, we can devise a scheme with which to correct the solution

on a ﬁne grid by solving for the error on a coarse grid.

⇒ Coarse-Grid Correction (CGC)

Deﬁnitions:

Fine grid →Ω

h

; Coarse grid →Ω

2h

→ Grids are typically reduced by a factor of two in each direction.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 157 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Restriction operator: I

2h

h

→ Move information from ﬁne grid to coarse grid.

Interpolation (Prolongation) operator: I

h

2h

→ Move information from coarse grid to ﬁne grid.

Coarse-Grid Correction Sequence:

1) Relax L

h

¯

φ

h

= f

h

using Gauss-Seidel, ADI, etc. ν

1

times on the ﬁne grid Ω

h

with an initial guess

¯

φ

h

.

2) Compute the residual on Ω

h

and restrict it to the coarse grid Ω

2h

:

r

2h

= I

2h

h

r

h

= I

2h

h

(f

h

−L

h

¯

φ

h

).

3) Using the residual as the right-hand-side, ’solve’ the error equation

L

2h

e

2h

= r

2h

on the coarse grid Ω

2h

.

4) Interpolate the error to the ﬁne grid and correct the ﬁne-grid approximation

according to

¯

φ

h

←

¯

φ

h

+I

h

2h

e

2h

.

5) Relax L

h

¯

φ

h

= f

h

ν

2

times on the ﬁne grid Ω

h

with corrected approximation

¯

φ

h

as the initial guess.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 158 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Note: In practice, ν

1

and ν

2

are small (1, 2, or 3).

This CGC scheme is the primary component of all the many multigrid algorithms.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 159 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

To illustrate consider the CGC sequence for equation (5.44), i.e. φ

= 0

(I = 64, ν

1

= 3):

Initial guess:

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 160 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Step 1 after one relaxation sweep on ﬁne grid:

→ The high-frequency mode is eliminated after only one relaxation step.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 161 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Step 1 after three relaxation sweeps on ﬁne grid:

→ The low-frequency mode is reduced very little after three relaxation step.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 162 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Step 3 after one relaxation sweep on coarser grid:

→ ... and not much more after three.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 163 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Step 3 after three relaxation sweeps on coarser grid:

→ Restriction to the coarser grid accelerates convergence of the

low-frequency mode, which has higher frequency relative to the coarser grid.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 164 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Step 5 after three relaxation sweeps on ﬁne grid:

→ Low-frequency mode is nearly eliminated after CGC.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 165 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

How do we obtain the coarse grid solution for e

2h

in step 3?

→ Recursively replace step 3 by additional CGCs on progressively coarser grids.

⇒ V-Cycle

For example, a four-grid V-cycle is illustrated by

The V-cycles are repeated until convergence.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 166 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Note: The error being solved for on successively coarser grids is the error of the

error on the next ﬁner grid, i.e. on grid...

Ω

h

→ relaxation on original equation for φ.

Ω

2h

→ relaxation on equation for error on Ω

h

.

Ω

4h

→ relaxation on equation for error on Ω

2h

.

.

.

.

This simple V-cycle scheme is appropriate when a good initial guess is available.

For example, when considering a solution to equation (5.45) in the context of an

unsteady calculation in which case the solution for φ

h

from the previous time step

is a good initial guess for the current time step.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 167 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

If no good initial guess is available, then Full Multigrid V-Cycle (FMV) may be

applied according to the following procedure:

1) Solve Lφ = f on the coarset grid (Note: φ not e)

2) Interpolate to next ﬁner grid.

3) Perform V-cycle to correct φ.

4) Interpolate to next ﬁner grid.

5) Repeat (3) and (4) until ﬁnest grid is reached.

6) Perform V-cycles until convergence.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 168 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Grid Deﬁnitions:

Because each successive grid diﬀers by a factor of two, the ﬁnest grid size is often

taken as 2

n

+ 1, where n is an integer. Somewhat more general grids may be

obtained using the following grid deﬁnitions.

The diﬀerential equation (5.45) is discretized on a uniform grid having N

x

N

y

points which are deﬁned by

N

x

= m

x

2

(n

x

−1)

+ 1, N

y

= m

y

2

(n

y

−1)

+ 1, (5.51)

where n

x

and n

y

determine the number of grid levels, and m

x

and m

y

determine

the size of the coarsest grid, which is (m

x

+ 1) (m

y

+ 1).

For a given grid, n

x

and n

y

should be as large as possible, and m

x

and m

y

should

be as small as possible for maximum eﬃciency (typically m

x

and m

y

are 2, 3 or

5). For example:

N

x

= 65 ⇒ m

x

= 2, n

x

= 6

N

x

= 129 ⇒ m

x

= 2, n

x

= 7

N

x

= 49 ⇒ m

x

= 3, n

x

= 5

N

x

= 81 ⇒ m

x

= 5, n

x

= 5

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 169 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

The number of grid levels is given by

N = max(n

x

, n

y

) (5.52)

resulting in the series of grids

G(1) < . . . < G(L) < . . . < G(N), (5.53)

where G(1) is the coarsest grid, G(N) is the ﬁnest grid and L = 1, . . . , N. Each

grid G(L) has M

x

(L) M

y

(L) grid points, where

M

x

(L) = m

x

2

[max(n

x

+L−N,1)−1]

+ 1,

M

y

(L) = m

y

2

[max(n

y

+L−N,1)−1]

+ 1.

(5.54)

For example,

N

x

= 65, N

y

= 49 ⇒ m

x

= 2, n

x

= 6 and m

y

= 3, n

y

= 5.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 170 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Thus, N = max(n

x

, n

y

) = 6 and

G(6) : M

x

(6) = 65, M

y

(6) = 49

G(5) : M

x

(5) = 33, M

y

(5) = 25

G(4) : M

x

(4) = 17, M

y

(4) = 13

G(3) : M

x

(3) = 9, M

y

(3) = 7

G(2) : M

x

(2) = 5, M

y

(2) = 4

G(1) : M

x

(1) = 3, M

y

(1) = 4

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 171 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Boundary Conditions

At each boundary the general form of the boundary condition is

pφ +q

∂φ

∂n

= s, (5.55)

where n is the direction normal to the surface. This boundary condition is applied

directly on the ﬁnest grid Ω

h

, i.e.

p

h

φ

h

+q

h

∂φ

h

∂n

= s

h

. (5.56)

But on the coarser grids, we need the boundary condition for the error. In order to

obtain such a condition, consider the following. On the coarse grid Ω

2h

, equation

(5.55) applies to the solution φ; thus,

p

2h

φ

2h

+q

2h

∂φ

2h

∂n

= s

2h

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 172 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

If we enforce the error to be zero on the boundaries, then from

e

2h

= φ

2h

−

¯

φ

2h

= 0, i.e. φ

2h

=

¯

φ

2h

, we also have

p

2h

¯

φ

2h

+q

2h

∂

¯

φ

2h

∂n

= s

2h

.

Therefore, to obtain a boundary condition for the error on Ω

2h

p

2h

e

2h

+q

2h

∂e

2h

∂n

= p

2h

φ

2h

+q

2h

∂φ

2h

∂n

−

p

2h

¯

φ

2h

+q

2h

∂

¯

φ

2h

∂n

= s

2h

−s

2h

p

2h

e

2h

+q

2h

∂e

2h

∂n

= 0.

(5.57)

Thus, the boundary conditions are homogeneous on all but the ﬁnest grid, where

the original condition on φ is applied. For example,

Dirichlet ⇒e = 0 on boundary.

Neumann ⇒

∂e

∂n

= 0 on boundary.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 173 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

That is, the type of boundary condition (Dirichlet, Neumann, or Robin) does not

change, i.e. the p and q coeﬃcients are the same, but they become homogeneous,

i.e. s = 0.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 174 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Relaxation

Typically, red-black Gauss-Seidel iteration is used to relax the diﬀerence equation:

By performing the relaxation on all of the red and black points separately, it

eliminates data dependencies such that it is easily implemented on parallel

computers (see section 10). Note that when Gauss-Seidel is used, SOR should not

be implemented because it destroys the high-frequency smoothing.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 175 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

The point-by-point relaxation of Gauss-Seidel does not work well, however, if

there are large gradients in the solution or rapid variations in the coeﬃcients in

the diﬀerential equation (5.45). In such cases it is better to use line relaxation for

the same reason that ADI is better than Gauss-Seidel.

In general, we may have such behavior in both directions; therefore, we could use

alternating-direction-line (ADL) relaxation. When sweeping along lines of

constant y, the following tridiagonal problem is solved for each j = 1, . . . , M

y

(L)

(see equation (5.46))

a

i,j

φ

i+1,j

+e

i,j

φ

i,j

+b

i,j

φ

i−1,j

= f

i,j

−c

i,j

φ

∗

i,j+1

−d

i,j

φ

∗

i,j−1

, (5.58)

for i = 1, . . . , M

x

(L). Here φ

∗

denotes the most recent approximation. Similar to

red-black Gauss-Seidel, we could sweep all lines with j even and j odd separately.

We will refer to this as zebra relaxation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 176 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Then lines of constant x are swept by solving the tridiagonal problem for each

i = 1, . . . , M

x

(L) given by

c

i,j

φ

i,j+1

+e

i,j

φ

i,j

+d

i,j

φ

i,j−1

= f

i,j

−a

i,j

φ

∗

i+1,j

−b

i,j

φ

∗

i−1,j

, (5.59)

for j = 1, . . . , M

y

(L). Again we could sweep all lines with i even and i odd

separately.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 177 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Restriction Operator: I

2h

h

The restriction operator is required for moving information from the ﬁner grid to

the coarser grid.

Notation:

Grid Indices Range

Coarser (i, j) 1 ≤ i ≤ NXC, 1 ≤ j ≤ NY C

Finer (i

∗

, j

∗

) 1 ≤ i

∗

≤ NXF, 1 ≤ j

∗

≤ NY F

Applying restriction in both directions:

NXC =

1

2

(NXF −1) + 1, NY C =

1

2

(NY F −1) + 1

i

∗

= 2i −1, j

∗

= 2j −1

The easiest restriction operator is straight injection for which

φ

2h

i,j

= φ

h

i

∗

,j

∗,

i.e. we simply drop the points that are not common to both grids. The matrix

symbol for straight injection is [1].

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 178 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

A better operator is full weighting. The matrix symbol is

Thus,

φ

2h

i,j

=

1

16

φ

h

i

∗

−1,j

∗

−1

+φ

h

i

∗

−1,j

∗

+1

+φ

h

i

∗

+1,j

∗

−1

+φ

h

i

∗

+1,j

∗

+1

+

1

8

φ

h

i

∗

,j

∗

−1

+φ

h

i

∗

,j

∗

+1

+φ

h

i

∗

−1,j

∗ +φ

h

i

∗

+1,j

∗

+

1

4

φ

h

i

∗

,j

∗

(5.60)

This represents a weighted average of surrounding points in the ﬁne mesh.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 179 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

We then use straight injection on the boundaries, i.e. φ

2h

i,j

= φ

h

i

∗

,j

∗,

i = 1, NXC, j = 1, . . . , NY C and j = 1, NY C, i = 1, . . . , NXC.

If, for example, restriction is applied only in the x-direction, then NY C = NY F

and j

∗

= j in equation (5.60).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 180 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Interpolation (Prolongation) Operator: I

h

2h

The interpolation operator is required for moving information from the coarser to

ﬁner grid. The most commonly used interpolation operator is based on bilinear

interpolation.

φ

h

i

∗

,j

∗ = φ

2h

i,j

←copy common points

φ

h

i

∗

+1,j

∗ =

1

2

φ

2h

i,j

+φ

2h

i+1,j

φ

h

i

∗

,j

∗

+1

=

1

2

φ

2h

i,j

+φ

2h

i,j+1

φ

h

i

∗

+1,j

∗

+1

=

1

4

φ

2h

i,j

+φ

2h

i+1,j

+φ

2h

i,j+1

+φ

2h

i+1,j+1

**MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 181 / 454
**

Numerical Solutions of Elliptic Problems Multigrid Methods

Speed Comparisons

Consider the test problem

A(x)

∂

2

φ

∂x

2

+B(x)

∂φ

∂x

+C(y)

∂

2

φ

∂y

2

+D(y)

∂φ

∂y

= F(x, y),

with Neumann boundary conditions. The following times are for an SGI Indy

R5000-150MHz. The grid is N N.

ADI:

= 10

−4

= 10

−5

N Iterations Time (sec) Iterations Time (sec)

65 673 22.35 821 27.22

129 2, 408 366.06 2, 995 456.03

Note that in both cases, the total time required for the N = 129 case is

approximately 16 that with N = 65 (∼ 4 increase in points and ∼ 4 increase

in iterations).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 182 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

Multigrid:

V-cycle with ADL relaxation (no FMV to get improved initial guess). Here the

convergence criterion is evaluated between V-cycles.

= 10

−4

= 10

−5

N Iterations Time (sec) Iterations Time (sec)

65 18 1.78 23 2.28

129 23 10.10 29 12.68

Notes:

1) In both cases, the total time required for the N = 129 case is approximately

6 that with N = 65 (the minimum is 4).

⇒ The multigrid method scales to larger grid sizes more eﬀectively than ADI

alone, i.e. note the small increase in the number of V-cycles with increasing N.

2) The case with N = 65 is approximately 13 faster than ADI, and the case

with N = 129 is approximately 36 faster!

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 183 / 454

Numerical Solutions of Elliptic Problems Multigrid Methods

3) References:

1

Briggs, W.C., Henson, V.E. and McCormick, S.F., “A Multigrid Tutorial,”

(2nd Edition) SIAM (2000).

2

Thomas, J.L., Diskin, B. and Brandt, A.T., “Textbook Multigrid Eﬃciency for

Fluid Simulations,” Ann. Rev. Fluid Mech. (2003), 35, pp. 317–340.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 184 / 454

Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms

Outline

5

Numerical Solutions of Elliptic Problems

Introduction

Finite-Diﬀerence Methods for the Poisson Equation

Direct Methods for Linear Systems

Fourier Transform Methods

Cyclic Reduction

Iterative (Relaxation) Methods

Jacobi Iteration

Gauss-Seidel Iteration

Successive Overrelaxation (SOR)

Boundary Conditions

Dirichlet Boundary Conditions

Neumann (Derivative) Boundary Conditions

Alternating-Direction-Implicit (ADI) Method

Compact Finite Diﬀerences

Multigrid Methods

Motivation

Multigrid Methodology

Speed Comparisons

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 185 / 454

Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms

Outline (cont’d)

Treatment of Nonlinear Convective Terms

Upwind-Downwind Diﬀerencing

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 186 / 454

Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms

Consider the 2-D, steady Burger’s equations

Re

¸

u

∂u

∂x

+v

∂u

∂y

=

∂

2

u

∂x

2

+

∂

2

u

∂y

2

, (5.61)

Re

¸

u

∂v

∂x

+v

∂v

∂y

=

∂

2

v

∂x

2

+

∂

2

v

∂y

2

, (5.62)

which represent a simpliﬁed version of the Navier-Stokes equations as there are no

pressure terms. The terms on the left-hand-side are the convection terms, and

those on the right-hand-side are the viscous or diﬀusion terms.

The Burger’s equations are elliptic due to the nature of the second-order viscous

terms, but the convection terms make the equations non-linear.

A simple approach to linearizing the equations is known as Picard iteration in

which we take the coeﬃcients of the non-linear (ﬁrst derivative) terms to be

known from the previous iteration denoted by

u

∗

i,j

, v

∗

i,j

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 187 / 454

Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms

Let us begin by approximating (5.61) using central diﬀerences for all derivatives as

follows

Re

¸

u

∗

i,j

u

i+1,j

−u

i−1,j

2∆x

+v

∗

i,j

u

i,j+1

−u

i,j−1

2∆y

=

u

i+1,j

−2u

i,j

+u

i−1,j

(∆x)

2

+

u

i,j+1

−2u

i,j

+u

i,j−1

(∆y)

2

.

Multiplying by (∆x)

2

and rearranging leads to

1 −

1

2

Re ∆xu

∗

i,j

u

i+1,j

+

1 +

1

2

Re ∆xu

∗

i,j

u

i−1,j

+

¯

∆−

1

2

Re ∆x

¯

∆

1/2

v

∗

i,j

u

i,j+1

+

¯

∆ +

1

2

Re ∆x

¯

∆

1/2

v

∗

i,j

u

i,j−1

−2(1 +

¯

∆)u

i,j

= 0,

(5.63)

where

¯

∆ = (∆x/∆y)

2

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 188 / 454

Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms

We can solve (5.63) using any of the iterative methods discussed except SOR

(generally need under-relaxation for non-linear problems). However, is (5.63)

diagonally dominant? To be diagonally dominant we must have

[1 −p[ +[1 +p[ +

¯

∆−q

+

¯

∆ +q

≤

2(1 +

¯

∆)

,

where

p =

1

2

Re ∆xu

∗

i,j

, q =

1

2

Re ∆x

¯

∆

1/2

v

∗

i,j

.

Suppose, for example, that p > 1 and q >

¯

∆, then this requires that

(p −1) + (1 +p) + (q −

¯

∆) + (

¯

∆ +q) ≤ 2(1 +

¯

∆)

2(p +q) ≤ 2(1 +

¯

∆),

but with p > 1 and q >

¯

∆ this condition cannot be satisﬁed, and equation (5.63)

is not diagonally dominant. The same result holds for p < −1 and q < −

¯

∆.

Therefore, we must have [p[ ≤ 1 and [q[ ≤

¯

∆ or

1

2

Re ∆xu

∗

i,j

≤ 1, and

1

2

Re ∆xv

∗

i,j

≤

¯

∆

1/2

,

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 189 / 454

Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms

which is a restriction on mesh size for given Re and velocity ﬁeld.

Three diﬃculties:

1

As the Reynolds number Re increases, the grid sizes ∆x and ∆y must

decrease.

2

The velocities u

∗

i,j

and v

∗

i,j

vary throughout the domain and are unknown.

3

The central diﬀerence approximations for the ﬁrst-order derivatives contribute

to the oﬀ-diagonal terms but not the main diagonal terms thereby adversely

aﬀecting diagonal dominance.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 190 / 454

Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms

Upwind-Downwind Diﬀerencing

In order to restore diagonal dominance, we use forward or backward diﬀerences for

the ﬁrst-derivative terms depending upon the signs of the coeﬃcients of the ﬁrst

derivative terms, i.e. the velocities. For example, consider the u

∗

∂u/∂x term:

1

If u

∗

i,j

> 0, then using a backward diﬀerence

u

∗

∂u

∂x

= u

∗

i,j

u

i,j

−u

i−1,j

∆x

+O(∆x),

which gives a positive addition to the u

i,j

term to promote diagonal

dominance.

2

If u

∗

i,j

< 0, then using a forward diﬀerence

u

∗

∂u

∂x

= u

∗

i,j

u

i+1,j

−u

i,j

∆x

+O(∆x),

which again gives a positive addition to the u

i,j

term to promote diagonal

dominance.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 191 / 454

Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms

Similarly for the v

∗

∂u/∂y term:

1

If v

∗

i,j

> 0, then using a backward diﬀerence

v

∗

∂u

∂y

= v

∗

i,j

u

i,j

−u

i,j−1

∆y

+O(∆y).

2

If v

∗

i,j

< 0, then using a forward diﬀerence

v

∗

∂u

∂y

= v

∗

i,j

u

i,j+1

−u

i,j

∆y

+O(∆y).

Let us consider diagonal dominance of the approximations to the x-derivative

terms in Burger’s equation (5.61) in the x-direction

T

x

=

∂

2

u

∂x

2

−Re u

∂u

∂x

=

u

i+1,j

−2u

i,j

+u

i−1,j

(∆x)

2

−

Re u

∗

i,j

∆x

u

i,j

−u

i−1,j

, u

∗

i,j

> 0

u

i+1,j

−u

i,j

, u

∗

i,j

< 0

;

therefore,

(∆x)

2

T

x

=

u

i+1,j

+ (1 +Re ∆xu

∗

i,j

)u

i−1,j

−(2 +Re ∆xu

∗

i,j

)u

i,j

, u

∗

i,j

> 0

(1 −Re ∆xu

∗

i,j

)u

i+1,j

+u

i−1,j

−(2 −Re ∆xu

∗

i,j

)u

i,j

, u

∗

i,j

< 0

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 192 / 454

Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms

Therefore, if using ADI with splitting of x- and y-derivative terms, diagonal

dominance of the tridiagonal problems along lines of constant y requires that:

1

For u

∗

i,j

> 0 (Re ∆xu

∗

i,j

> 0):

[1[ +[1 +Re ∆xu

∗

i,j

[ ≤ [ −(2 +Re ∆xu

∗

i,j

)[

1 + 1 +Re ∆xu

∗

i,j

= 2 +Re ∆xu

∗

i,j

,

which is weakly diagonally dominant.

2

For u

∗

i,j

< 0 (Re ∆xu

∗

i,j

< 0):

[1[ +[1 −Re ∆xu

∗

i,j

[ ≤ [ −(2 −Re ∆xu

∗

i,j

)[

1 + 1 −Re ∆xu

∗

i,j

= 2 −Re ∆xu

∗

i,j

,

which is also weakly diagonally dominant.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 193 / 454

Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms

Notes:

1

The same is true for the y-derivative terms when sweeping along lines of

constant x.

2

Updwind-downwind diﬀerencing forces diagonal dominance; therefore, the

iteration will always converge with no mesh restrictions.

3

The forward and backward diﬀerences used for the ﬁrst-order derivatives are

only ﬁrst-order accurate, i.e. the method is O(∆x, ∆y) accurate. To see the

potential aﬀects of this error, consider the 1-D Burger’s equation

Re u

du

dx

=

d

2

u

dx

2

. (5.64)

Recall from section 3.2 that, for example, the ﬁrst-order, backward-diﬀerence

approximation to the ﬁrst-order derivative is

du

dx

i

=

u

i

−u

i−1

∆x

+

∆x

2

d

2

u

dx

2

i

+. . . ,

where we have included the truncation error.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 194 / 454

Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms

Substituting into (5.64) gives

Re u

∗

i

¸

u

i

−u

i−1

∆x

+

∆x

2

d

2

u

dx

2

i

+. . .

=

d

2

u

dx

2

i

,

or

Re u

i

u

i

−u

i−1

∆x

=

¸

1 −

Re

2

∆xu

∗

i

d

2

u

dx

2

i

.

Therefore, depending upon the values of Re, ∆x, and u

∗

, the truncation

error from the ﬁrst-derivative terms, which is not included in the numerical

solution, may be of the same order, or even larger than, the physical diﬀusion

term. This is often referred to as artiﬁcial or numerical diﬀusion, the eﬀects

of which increase with increasing Reynolds number.

4

Remedies:

i) Can return to O(∆x

2

, ∆y

2

) accuracy using deferred correction in which we

use the approximate solution to evaluate the leading term of the truncation

error which is then added to the original discretized equation as a source term.

ii) Alternatively, we could use second-order accurate forward and backward

diﬀerences, but the resulting system of equations would no longer be

tridiagonal.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 195 / 454

Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms

5

Note that we have linearized the diﬀerence equation, not the diﬀerential

equation, in order to obtain a linear system of algebraic equations

⇒ The physical nonlinearity is still being solved for.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 196 / 454

Numerical Solutions of Parabolic Problems Introduction

Outline

6

Numerical Solutions of Parabolic Problems

Introduction

Explicit Methods

Euler Method (First-Order Explicit)

Richardson Method

DuFort-Frankel Method

Stability Analysis

Introduction

Numerical Stability Analysis

Implicit Methods

First-Order Implicit

Crank-Nicolson

Non-Linear Convective Problems

First-Order Explicit

Crank-Nicolson

Upwind-Downwind Diﬀerencing

Multidimensional Problems

First-Order Explicit Method

First-Order Implicit Method

ADI Method with Time Splitting

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 197 / 454

Numerical Solutions of Parabolic Problems Introduction

Outline (cont’d)

Factored ADI Method

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 198 / 454

Numerical Solutions of Parabolic Problems Introduction

Parabolic ⇒ preferred direction of propagation of solution:

1

time (unsteady problems)

2

spatial (some steady problems), e.g. steady duct ﬂows and boundary-layer

ﬂows.

Properties:

1

Initial-value problems, e.g. 1-D, unsteady, heat conduction (cf. elliptic ⇒

BVP)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 199 / 454

Numerical Solutions of Parabolic Problems Introduction

2

Numerical algorithm “marches” in preferred direction in step-by-step manner,

i.e. it is not necessary to keep solution at every time step (just previous

step(s)).

Consider the general linear, 1-D, unsteady equation

∂φ

∂t

= a(x, t)

∂

2

φ

∂x

2

+b(x, t)

∂φ

∂x

+c(x, t)φ +d(x, t). (6.1)

A simple model problem for this is the unsteady, 1-D diﬀusion equation

∂φ

∂t

= α

∂

2

φ

∂x

2

, (6.2)

where

φ = T ⇒ heat conduction

φ = u ⇒ momentum diﬀusion (due to viscosity)

φ = ω ⇒ vorticity diﬀusion

φ = c ⇒ mass diﬀusion (c = concentration)

Techniques developed for equation (6.2) can be used for equation (6.1).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 200 / 454

Numerical Solutions of Parabolic Problems Introduction

Methods of Solution:

1

Reduce partial diﬀerential equation to a set of ordinary diﬀerential equations

and solve, e.g. method of lines, predictor-corrector, Runge-Kutta, etc...

2

Finite-diﬀerence methods:

a) Explicit methods – obtain equation for φ at each mesh point.

b) Implicit methods – obtain set of algebraic equations for φ at all mesh points at

each ∆t.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 201 / 454

Numerical Solutions of Parabolic Problems Explicit Methods

Outline

6

Numerical Solutions of Parabolic Problems

Introduction

Explicit Methods

Euler Method (First-Order Explicit)

Richardson Method

DuFort-Frankel Method

Stability Analysis

Introduction

Numerical Stability Analysis

Implicit Methods

First-Order Implicit

Crank-Nicolson

Non-Linear Convective Problems

First-Order Explicit

Crank-Nicolson

Upwind-Downwind Diﬀerencing

Multidimensional Problems

First-Order Explicit Method

First-Order Implicit Method

ADI Method with Time Splitting

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 202 / 454

Numerical Solutions of Parabolic Problems Explicit Methods

Outline (cont’d)

Factored ADI Method

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 203 / 454

Numerical Solutions of Parabolic Problems Explicit Methods

Explicit Methods ⇒ Spatial derivatives are all evaluated at previous time level(s),

i.e. single unknown φ

n+1

i

on left-hand-side.

Note that now the superscript n denotes the time step rather than the iteration

number.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 204 / 454

Numerical Solutions of Parabolic Problems Explicit Methods

Euler Method (First-Order Explicit)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 205 / 454

Numerical Solutions of Parabolic Problems Explicit Methods

First-order, forward diﬀerence for time derivative

∂φ

∂t

=

φ

n+1

i

−φ

n

i

∆t

+O(∆t).

Second-order, central diﬀerence for spatial derivatives at n

th

time level (known)

∂

2

φ

∂x

2

=

φ

n

i+1

−2φ

n

i

+φ

n

i−1

(∆x)

2

+O(∆x

2

).

Substituting into (6.2)

φ

n+1

i

−φ

n

i

∆t

= α

φ

n

i+1

−2φ

n

i

+φ

n

i−1

(∆x)

2

,

and solving for φ

n+1

i

φ

n+1

i

= φ

n

i

+

α∆t

(∆x)

2

φ

n

i+1

−2φ

n

i

+φ

n

i−1

φ

n+1

i

= (1 −2s)φ

n

i

+s

φ

n

i+1

+φ

n

i−1

, i = 2, . . . , I,

(6.3)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 206 / 454

Numerical Solutions of Parabolic Problems Explicit Methods

where s = α∆t/(∆x)

2

.

Notes:

1

Equation (6.3) is an explicit equation for φ

n+1

i

at the (n + 1)

st

time step.

2

Method is second-order accurate in space and ﬁrst-order accurate in time.

3

Time steps ∆t may be varied from step-to-step.

4

Restrictions on ∆t and ∆x for Euler method applied to 1-D diﬀusion

equation to remain stable (see section 6.3):

s =

α∆t

(∆x)

2

≤

1

2

⇒ stable (very restrictive).

s =

α∆t

(∆x)

2

>

1

2

⇒ unstable.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 207 / 454

Numerical Solutions of Parabolic Problems Explicit Methods

Richardson Method

We want to improve on the temporal accuracy of the Euler method; therefore, we

use a central diﬀerence for the time derivative.

φ

n+1

i

−φ

n−1

i

2∆t

= α

φ

n

i+1

−2φ

n

i

+φ

n

i−1

(∆x)

2

φ

n+1

i

= φ

n−1

i

+ 2s

φ

n

i+1

−2φ

n

i

+φ

n

i−1

, i = 2, . . . , I. (6.4)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 208 / 454

Numerical Solutions of Parabolic Problems Explicit Methods

Notes:

1

Second-order accurate in space and time.

2

Must keep ∆t constant and requires starting method (need φ

i

at two time

steps).

3

Unconditionally unstable for s > 0 ⇒ Do not use.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 209 / 454

Numerical Solutions of Parabolic Problems Explicit Methods

DuFort-Frankel Method

In order to maintain second-order accuracy, but improve stability, let us modify the

Richardson method by taking an average between time levels for φ

n

i

. To devise

such an approximation, consider the Taylor series approximation at t

n+1

about t

n

φ

n+1

i

= φ

n

i

+ ∆t

∂φ

∂t

n

i

+

∆t

2

2

∂

2

φ

∂t

2

n

i

+ .

Similarly, consider the Taylor series approximation at t

n−1

about t

n

φ

n−1

i

= φ

n

i

−∆t

∂φ

∂t

n

i

+

∆t

2

2

∂

2

φ

∂t

2

n

i

+ .

Adding these Taylor series together gives

φ

n+1

i

+φ

n−1

i

= 2φ

n

i

+ ∆t

2

∂

2

φ

∂t

2

n

i

+ ,

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 210 / 454

Numerical Solutions of Parabolic Problems Explicit Methods

and solving for φ

n

i

leads to

φ

n

i

=

1

2

φ

n+1

i

+φ

n−1

i

−

1

2

∆t

2

∂

2

φ

∂t

2

n

i

+ . (6.5)

Therefore, averaging between time levels in this manner is O(∆t

2

) accurate.

Substituting into the diﬀerence equation (6.4) from Richardson’s method gives

φ

n+1

i

= φ

n−1

i

+ 2s

φ

n

i+1

−

φ

n+1

i

+φ

n−1

i

+φ

n

i−1

(1 + 2s)φ

n+1

i

= (1 −2s)φ

n−1

i

+ 2s

φ

n

i+1

+φ

n

i−1

φ

n+1

i

=

1 −2s

1 + 2s

φ

n−1

i

+

2s

1 + 2s

φ

n

i+1

+φ

n

i−1

, i = 2, . . . , I. (6.6)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 211 / 454

Numerical Solutions of Parabolic Problems Explicit Methods

However, let us consider the consistency of this approximation. Including the

truncation errors of each approximation, the 1-D, unsteady diﬀusion equation is

approximated as in the Richardson method (with central diﬀerences for the

temporal and spacial derivatives)

∂φ

∂t

−α

∂

2

φ

∂x

2

=

φ

n+1

i

−φ

n−1

i

2∆t

−

∆t

2

6

∂

3

φ

∂t

3

n

i

+

−α

φ

n

i+1

−2φ

n

i

+φ

n

i−1

∆x

2

+

α∆x

2

12

∂

4

φ

∂x

4

n

i

+ .

Substituting the time-averaging equation (6.5) for φ

n

i

to implement the

DuFort-Frankel method leads to

∂φ

∂t

−α

∂

2

φ

∂x

2

=

φ

n+1

i

−φ

n−1

i

2∆t

−

α

∆x

2

φ

n

i+1

+φ

n

i−1

−

φ

n+1

i

+φ

n−1

i

−

α∆t

2

∆x

2

∂

2

φ

∂t

2

n

i

−

∆t

2

6

∂

3

φ

∂t

3

n

i

+

α∆x

2

12

∂

4

φ

∂x

4

n

i

+ .

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 212 / 454

Numerical Solutions of Parabolic Problems Explicit Methods

For consistency, all of the truncation error terms must go to zero as

∆t →0, ∆x →0. That is, the diﬀerence equation must reduce to the diﬀerential

equation as ∆x, ∆t →0. The second and third truncation error terms do so;

however, the ﬁrst term requires that ∆t →0 faster than ∆x →0, i.e. ∆t << ∆x,

for consistency. Because this is not the case in general, the DuFort-Frankel

method is considered inconsistent.

Notes:

1

Second-order accurate in space.

2

Must keep ∆t constant and starting method necessary.

3

Method is unconditionally stable for any s = α∆t/(∆x)

2

.

4

The method is inconsistent ⇒ Do not use.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 213 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

Outline

6

Numerical Solutions of Parabolic Problems

Introduction

Explicit Methods

Euler Method (First-Order Explicit)

Richardson Method

DuFort-Frankel Method

Stability Analysis

Introduction

Numerical Stability Analysis

Implicit Methods

First-Order Implicit

Crank-Nicolson

Non-Linear Convective Problems

First-Order Explicit

Crank-Nicolson

Upwind-Downwind Diﬀerencing

Multidimensional Problems

First-Order Explicit Method

First-Order Implicit Method

ADI Method with Time Splitting

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 214 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

Outline (cont’d)

Factored ADI Method

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 215 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

Introduction

Real ﬂows ⇒ small disturbances, e.g. imperfections, vibrations, etc...

Numerical solutions ⇒ small errors, e.g. truncation, round-oﬀ, etc...

Issue → What happens to small disturbances/errors as ﬂow and/or solution

evolves in time?

Decay ⇒ stable (disturbances/errors are damped out).

Grow ⇒ unstable (disturbances/errors are ampliﬁed).

Two possible sources of instability in CFD:

1

Hydrodynamic instability – the ﬂow itself is inherently unstable (see, for

example, Drazin & Reid)

→ This is real, i.e. physical

2

Numerical instability – the numerical algorithm magniﬁes small errors

→ This is not physical ⇒ Need a new method.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 216 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

Diﬃculty → In CFD both are manifest in similar ways, i.e. oscillatory solutions;

therefore, it is often diﬃcult to determine whether oscillatory numerical solutions

are a result of a numerical or hydrodynamic instability.

→ For an example of this, see “Supersonic Boundary-Layer Flow Over a

Compression Ramp,” Cassel, Ruban & Walker, JFM 1995, 1996.

Hydrodynamic vs. Numerical Instability:

1

Hydrodynamic stability analysis (Section 9 and MMAE 514):

Often diﬃcult to perform.

Assumptions must often be made, e.g. parallel ﬂow.

Can provide conclusive evidence for hydrodynamic instability (particularly if

conﬁrmed by analytical or numerical results). For example, in supersonic ﬂow

over a ramp, the Rayleigh Fjørtoft’s theorems are necessary conditions that

can be tested for.

2

Numerical stability analysis:

Often gives guidance, but not always conclusive for complex problems.

Note: Just because a numerical solution does not become oscillatory does not

mean that no physical instabilities are present! There may not be suﬃcient

resolution.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 217 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

Numerical Stability Analysis

Two methods:

1) Matrix Method:

More rigorous → evaluates stability of entire scheme, including treatment of

boundary conditions.

More diﬃcult → involves determining eigenvalues of a large matrix.

2) von Neumann (Fourier Series) Method:

For linear initial-value problems with constant coeﬃcients.

⇒ More restrictive, i.e. nonlinear problems must be linearized.

Does not account for boundary conditions.

Most commonly used.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 218 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

Matrix Method

Denote the exact solution of the diﬀerence equation at t = t

n

by

˜

φ

n

i

; then the

error is

e

n

i

= φ

n

i

−

˜

φ

n

i

, i = 2, . . . , I, (6.7)

where φ

n

i

is the approximate solution at t = t

n

. Consider the

ﬁrst-order explicit (Euler) method given by equation (6.3), which is repeated here

φ

n+1

i

= (1 −2s)φ

n

i

+s(φ

n

i+1

+φ

n

i−1

), (6.8)

where s = α∆t/∆x

2

. Both φ

n

i

and

˜

φ

n

i

satisfy this equation; thus, the error

satisﬁes the same equation

e

n+1

i

= (1 −2s)e

n

i

+s(e

n

i+1

+e

n

i−1

), i = 2, . . . , I. (6.9)

This may be written in matrix form as

e

n+1

= Ae

n

, n = 0, 1, 2, . . . . (6.10)

Thus, we perform a matrix multiply to advance each time step (cf. matrix form for

iterative methods).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 219 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

The (I −1) (I −1) matrix A and the vector e

n

are

A =

1 −2s s 0 0 0

s 1 −2s s 0 0

0 s 1 −2s 0 0

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

0 0 0 1 −2s s

0 0 0 s 1 −2s

¸

¸

¸

¸

¸

¸

¸

¸

¸

, e

n

=

e

n

2

e

n

3

e

n

4

.

.

.

e

n

I−1

e

n

I

¸

¸

¸

¸

¸

¸

¸

¸

¸

.

Note that if φ is speciﬁed at the boundaries, then the error is zero there, i.e.

e

n

1

= e

n

I+1

= 0.

The method is stable if the eigenvalues λ

j

of the matrix A are such that

[λ

j

[ ≤ 1 for all λ

j

, (6.11)

i.e. ρ ≤ 1, in which case the error will not grow.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 220 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

Because A is tridiagonal with constant elements along each diagonal, the

eigenvalues are (see section 3.5)

λ

j

= 1 −(4s) sin

2

jπ

2I

, j = 1, . . . , I −1. (6.12)

Note that there are (I −1) eigenvalues of the (I −1) (I −1) matrix A. For

equation (6.11) to hold,

−1 ≤ 1 −(4s) sin

2

jπ

2I

≤ 1.

The right inequality is true for all j (s > 0 and sin

2

() > 0). The left inequality is

true if

1 −(4s) sin

2

jπ

2I

≥ −1

−(4s) sin

2

jπ

2I

≥ −2

s sin

2

jπ

2I

≤

1

2

∴ true for all j if s ≤

1

2

.

¸

0 < sin

2

jπ

2I

< 1

**MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 221 / 454
**

Numerical Solutions of Parabolic Problems Stability Analysis

Thus, the Euler method is stable for s ≤ 1/2.

Notes:

Whereas here we only needed eigenvalues for a tridiagonal matrix, in general

we need to ﬁnd the eigenvalues of a (I + 1) (I + 1) matrix.

The eﬀect of diﬀerent boundary conditions are reﬂected in A and, therefore,

the resulting eigenvalues.

This is the same method used to obtain convergence properties of iterative

methods for elliptic problems. Recall that the spectral radius ρ(I, J) is the

modulus of the largest eigenvalue of the iteration matrix

φ

n+1

= Aφ

n

,

where here n indicates successive iterates rather than time steps. If ρ ≤ 1,

then the iterative procedure converges. In iterative methods, however, we are

concerned not only with whether they will converge or not, but the rate at

which they converge, e.g. Gauss-Seidel vs. Jacobi.

⇒ Minimize ρ for maximum convergence rate.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 222 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

Parabolic problems ⇒ We only require eigenvalues to be less than or equal to

one for stability (it is not necessary to minimize).

⇒ It is often advantageous to use a time-marching (parabolic) scheme for solving

steady (elliptic) problems due to the less restrictive stability criterion. This is

sometimes referred to as the pseudo-transient method, e.g.

∇

2

φ = 0 →

∂φ

∂t

+∇

2

φ = 0.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 223 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

von Neumann Method (Fourier Analysis)

We expand the errors along grid lines at one time level as a Fourier series. Then

we determine if the Fourier modes decay or amplify in time.

Expanding the error at t = 0 (n = 0)

e(x, 0) =

I−1

¸

m=1

e

m

(x, 0) =

I−1

¸

m=1

a

m

(0)e

iθ

m

x

, (6.13)

where a

m

(0) are the amplitudes of the Fourier modes, θ

m

= mπ, and here

i =

√

−1. At a later time t

e(x, t) =

I−1

¸

m=1

e

m

(x, t) =

I−1

¸

m=1

a

m

(t)e

iθ

m

x

. (6.14)

We want to determine how a

m

(t) behaves with time.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 224 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

To do this, deﬁne the gain of mode m, G

m

(x, t), as

G

m

(x, t) =

e

m

(x, t)

e

m

(x, t −∆t)

=

a

m

(t)

a

m

(t −∆t)

,

which is the ampliﬁcation factor for the m

th

mode during one time step.

Therefore, the error will not grow if [G

m

[ ≤ 1 for all m, i.e. the method is stable.

If it takes n time steps to get to time t, then the ampliﬁcation after n time steps is

(G

m

)

n

=

a

m

(t)

a

m

(t −∆t)

a

m

(t −∆t)

a

m

(t −2∆t)

. . .

a

m

(∆t)

a

m

(0)

=

a

m

(t)

a

m

(0)

,

where (G

m

)

n

is the n

th

power of G

m

.

The von Neumann method consists of seeking a solution of the form (6.14), with

a

m

(t) = (G

m

)

n

a

m

(0), of the error equation corresponding to the diﬀerence

equation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 225 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

For the ﬁrst-order explicit (Euler) method, the error equation (4.8) is (use index j

instead of i)

e

n+1

j

= (1 −2s)e

n

j

+s(e

n

j+1

+e

n

j−1

), j = 2, . . . , I. (6.15)

This equation is linear; therefore, each mode m must satisfy the equation

independently. Thus, substituting (6.14) with a

m

(t) = (G

m

)

n

a

m

(0) into equation

(6.15) gives (canceling a

m

(0) in each term)

(G

m

)

n+1

e

iθ

m

x

= (1 −2s)(G

m

)

n

e

iθ

m

x

+s(G

m

)

n

e

iθ

m

(x+∆x)

+e

iθ

m

(x−∆x)

.

Dividing by (G

m

)

n

e

iθ

m

x

we have

G

m

= (1 −2s) +s

e

iθ

m

∆x

+e

−iθ

m

∆x

= 1 −2s [1 −cos(θ

m

∆x)] [cos(ax) = (e

iax

+e

−iax

)/2]

G

m

= 1 −(4s) sin

2

θ

m

∆x

2

[sin

2

x = [1 −cos(2x)]/2]

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 226 / 454

Numerical Solutions of Parabolic Problems Stability Analysis

For stability, [G

m

[ ≤ 1; therefore,

−1 ≤ 1 −(4s) sin

2

θ

m

∆x

2

≤ 1 for all θ

m

= mπ.

The right inequality holds for all m and s > 0, i.e.

0 ≤ sin

2

θ

m

∆x

2

≤ 1.

The left inequality holds if s ≤ 1/2 (see matrix method). Thus, for this case we

obtain the same stability criterion as from the matrix method.

Note that [G

m

[ is the modulus; thus, if we have a complex number, [G

m

[ equals

the square root of the sum of the squares of the real and imaginary parts.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 227 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

Outline

6

Numerical Solutions of Parabolic Problems

Introduction

Explicit Methods

Euler Method (First-Order Explicit)

Richardson Method

DuFort-Frankel Method

Stability Analysis

Introduction

Numerical Stability Analysis

Implicit Methods

First-Order Implicit

Crank-Nicolson

Non-Linear Convective Problems

First-Order Explicit

Crank-Nicolson

Upwind-Downwind Diﬀerencing

Multidimensional Problems

First-Order Explicit Method

First-Order Implicit Method

ADI Method with Time Splitting

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 228 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

Outline (cont’d)

Factored ADI Method

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 229 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

We can improve on the stability properties of explicit methods by solving implicitly

for more information at the new time level.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 230 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

First-Order Implicit

Recall the ﬁrst-order explicit method:

Central diﬀerence for spatial derivatives on the n

th

(previous) time level.

First-order forward diﬀerence for time derivative.

First-order implicit:

Central diﬀerence for spatial derivatives on the (n + 1)

st

(current) time level.

First-order backward diﬀerence for time derivative.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 231 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

For the unsteady, 1-D diﬀusion equation, this gives

φ

n+1

j

−φ

n

j

∆t

= α

φ

n+1

j+1

−2φ

n+1

j

+φ

n+1

j−1

∆x

2

+O(∆t, ∆x

2

).

Thus,

sφ

n+1

j+1

−(1 + 2s)φ

n+1

j

+sφ

n+1

j−1

= −φ

n

j

, j = 2, . . . , I, (6.16)

which is a tridiagonal problem for φ

n+1

j

at the current time level. Note that it is

strongly diagonally dominant.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 232 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

von Neumann Stability Analysis:

Error satisﬁes equation (6.16)

se

n+1

j+1

−(1 + 2s)e

n+1

j

+se

n+1

j−1

= −e

n

j

, (6.17)

We expand the error at time t as

e(x, t) =

I−1

¸

m=1

(G

m

)

n

a

m

(0)e

iθ

m

x

, θ

m

= mπ. (6.18)

Substituting into (6.17) gives (canceling a

m

(0) in each term)

s(G

m

)

n+1

e

iθ

m

(x+∆x)

−(1 + 2s)(G

m

)

n+1

e

iθ

m

x

+s(G

m

)

n+1

e

iθ

m

(x−∆x)

= −(G

m

)

n

e

iθ

m

x

s

e

iθ

m

∆x

+e

−iθ

m

∆x

−(1 + 2s)

G

m

= −1

[(2s) cos(θ

m

∆x) −(1 + 2s)] G

m

= −1

¦1 + 2s [1 −cos(θ

m

∆x)]¦ G

m

= 1

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 233 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

∴ G

m

=

¸

1 + (4s) sin

2

θ

m

∆x

2

−1

.

Thus, the method is stable if [G

m

[ ≤ 1. Note that

1 + (4s) sin

2

θ

m

∆x

2

> 1

for all θ

m

and s > 0. Therefore, G

m

< 1, and the method is

unconditionally stable.

Notes:

1) The ﬁrst-order implicit method is only O(∆t) accurate.

2) There are more computations required per time step than for explicit

methods. However, one can typically use larger time steps (only limited by

temporal resolution required, not stability).

⇒ For explicit methods, we must choose the time step ∆t for both accuracy and

stability, whereas for implicit methods, we must only be concerned with

accuracy.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 234 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

Crank-Nicolson

We prefer second-order accuracy in time; therefore, consider approximating the

equation midway between time levels.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 235 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

For the unsteady, 1-D diﬀusion equation, this is accomplished as follows

φ

n+1

i

−φ

n

i

∆t

+O(∆t

2

) =

α

2

¸

∂

2

φ

n+1

∂x

2

+

∂

2

φ

n

∂x

2

+O(∆t

2

)

φ

n+1

i

−φ

n

i

∆t

=

α

2

¸

φ

n+1

i+1

−2φ

n+1

i

+φ

n+1

i−1

∆x

2

+

φ

n

i+1

−2φ

n

i

+φ

n

i−1

∆x

2

¸

.

Later we will show that averaging the diﬀusion terms across time levels in this

manner is second-order accurate in time. Writing the diﬀerence equation in

tridiagonal form, we have

sφ

n+1

i+1

−2(1 +s)φ

n+1

i

+sφ

n+1

i−1

= −sφ

n

i+1

−2(1 −s)φ

n

i

−sφ

n

i−1

, i = 2, . . . , I,

(6.19)

which we solve for φ

n+1

i

at the current time level.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 236 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

Notes:

1) Second-order accurate in space and time.

2) Unconditionally stable for all s.

3) Apply derivative boundary conditions at current time level.

4) Very popular scheme for parabolic problems.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 237 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

Averaging Across Time Levels:

Here we will again show that averaging across time levels as in the Crank-Nicolson

method is second-order accurate in time. In doing so, we will illustrate a method

to determine the accuracy of a speciﬁed approximation (cf. Taylor series

expansions in section 4).

Consider averaging a quantity φ

i

midway between time levels as follows

φ

n+1/2

i

=

1

2

(φ

n+1

i

+φ

n

i

) +T.E. (6.20)

We seek an expression of the form φ

n+1/2

i

=

˜

φ +T.E.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 238 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

Let us expand each term as a Taylor series about (x

i

, t

n+1/2

):

φ

n+1

i

=

∞

¸

k=0

1

k!

∆t

2

D

t

k

˜

φ,

φ

n

i

=

∞

¸

k=0

1

k!

−

∆t

2

D

t

k

˜

φ =

∞

¸

k=0

(−1)

k

k!

∆t

2

D

t

k

˜

φ,

where D

t

= ∂/∂t, and

˜

φ is the exact value of φ

n+1/2

i

midway between time levels,

i.e. φ

n+1/2

i

=

˜

φ +T.E.. Substituting these expansions into (6.20) gives

φ

n+1/2

i

=

1

2

∞

¸

k=0

1

k!

1 + (−1)

k

∆t

2

D

t

k

˜

φ.

Note that

1 + (−1)

k

=

0, k = 1, 3, 5, . . .

2, k = 0, 2, 4, . . .

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 239 / 454

Numerical Solutions of Parabolic Problems Implicit Methods

Let k = 2m; thus,

φ

n+1/2

i

=

∞

¸

m=0

1

(2m)!

∆t

2

D

t

2m

˜

φ

φ

n+1/2

i

=

˜

φ +

1

2!

∆t

2

D

t

2

˜

φ +

1

4!

∆t

2

D

t

4

˜

φ +. . .

.

The ﬁrst term in the expansion (m = 0) is the exact value and the second term

(m = 1) gives the truncation error of the approximation. This truncation error

term is

1

8

∆t

2

∂

2

˜

φ

∂t

2

;

therefore, the approximation (6.20) is second-order accurate, i.e.

φ

n+1/2

i

=

1

2

(φ

n+1

i

+φ

n

i

) +O(∆t

2

).

This shows that averaging across time levels gives an O(∆t

2

) approximation of φ

i

at the mid-time level t

n+1/2

. Note that this agrees with the result (6.5) except for

the constant factor (we averaged across two time levels for the DuFort-Frankel

method).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 240 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Outline

6

Numerical Solutions of Parabolic Problems

Introduction

Explicit Methods

Euler Method (First-Order Explicit)

Richardson Method

DuFort-Frankel Method

Stability Analysis

Introduction

Numerical Stability Analysis

Implicit Methods

First-Order Implicit

Crank-Nicolson

Non-Linear Convective Problems

First-Order Explicit

Crank-Nicolson

Upwind-Downwind Diﬀerencing

Multidimensional Problems

First-Order Explicit Method

First-Order Implicit Method

ADI Method with Time Splitting

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 241 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Outline (cont’d)

Factored ADI Method

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 242 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Consider the unsteady, 1-D Burger’s equation (1-D, unsteady diﬀusion equation

with convection terms)

∂u

∂t

= ν

∂

2

u

∂x

2

−u

∂u

∂x

, (6.21)

where ν is the viscosity. We want to consider how the nonlinear convection term

is treated in the various schemes.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 243 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

First-Order Explicit

Approximating spatial derivatives at the previous time level, and using a forward

diﬀerence in time, we have

u

n+1

i

−u

n

i

∆t

= ν

u

n

i+1

−2u

n

i

+u

n

i−1

∆x

2

−u

n

i

u

n

i+1

−u

n

i−1

2∆x

+O(∆x

2

, ∆t),

where the u

n

i

in the convection term is known from the previous time level.

Writing in explicit form leads to

u

n+1

i

=

s −

C

i

2

u

n

i+1

+ (1 −2s)u

n

i

+

s +

C

i

2

u

n

i−1

,

where s =

ν∆t

∆x

2

and C

i

=

u

n

i

∆t

∆x

= Courant number. For stability, this method

requires that 2 ≤ Re

∆x

≤ 2/C

i

, where Re

∆x

= u

n

i

∆x/ν = mesh Reynolds

number. This is very restrictive.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 244 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Crank-Nicolson

u

n+1

i

−u

n

i

∆t

=

ν

2

¸

∂

2

u

n+1

∂x

2

+

∂

2

u

n

∂x

2

−

1

2

u

n+1/2

¸

∂u

n+1

∂x

+

∂u

n

∂x

=

ν

2∆x

2

u

n+1

i+1

−2u

n+1

i

+u

n+1

i−1

+u

n

i+1

−2u

n

i

+u

n

i−1

−

u

n+1/2

i

4∆x

u

n+1

i+1

−u

n+1

i−1

+u

n

i+1

−u

n

i−1

+O(∆x

2

, ∆t

2

),

(6.22)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 245 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

where

u

n+1/2

i

=

1

2

(u

n+1

i

+u

n

i

) +O(∆t

2

). (6.23)

Thus, this results in the implicit ﬁnite diﬀerence equation

−

s −

C

i

2

u

n+1

i+1

+ 2(1 +s)u

n+1

i

−

s +

C

i

2

u

n+1

i−1

=

s −

C

i

2

u

n

i+1

+ 2(1 −s)u

n

i

+

s +

C

i

2

u

n

i−1

,

(6.24)

where here C

i

=

u

n+1/2

i

∆t

∆x

, but we do not know u

n+1/2

i

yet, i.e. it is nonlinear.

Therefore, this procedure requires iteration at each time step:

1) Begin with u

n+1/2

i

= u

n

i

, i.e. use u

i

from previous time step as initial guess

at current time step.

2) Compute update for u

n+1

i

, i = 1, . . . , I + 1, using equation (6.24).

3) Update u

n+1/2

i

=

1

2

(u

n+1

i

+u

n

i

).

4) Repeat until u

n+1

i

converges for all i.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 246 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Notes:

1) It typically requires less than ten iterations to converge at each time step; if

more are required, then the time step ∆t is too large.

2) In elliptic problems we use Picard iteration because we only care about the

ﬁnal converged solution, whereas here we want an accurate solution at each

time step.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 247 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Upwind-Downwind Diﬀerencing

Consider the ﬁrst-order convective terms in the Crank-Nicolson approximation, i.e.

u

n+1/2

∂u

n+1/2

∂x

.

If u

n+1/2

> 0, then approximate ∂u

n+1/2

/∂x as follows:

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 248 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Then

∂u

∂x

=

1

2

¸

∂u

n+1

∂x

i−1/2

+

∂u

n

∂x

i+1/2

¸

+O(∆t

2

)

∂u

∂x

=

1

2

¸

u

n+1

i

−u

n+1

i−1

∆x

+

u

n

i+1

−u

n

i

∆x

¸

+O(∆x

2

, ∆t

2

),

(6.25)

Notes:

1) Although the ﬁnite-diﬀerence approximation at the current time level appears

to be a backward diﬀerence and that at the previous time level appears to be

a forward diﬀerence, they are really central diﬀerences evaluated at

half-points in the grid.

2) The fact that this approximation is O(∆x

2

, ∆t

2

) accurate will be shown at

the end of this section.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 249 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

If u

n+1/2

< 0, then approximate ∂u

n+1/2

/∂x as follows:

Now we have

∂u

∂x

=

1

2

¸

∂u

n+1

∂x

i+1/2

+

∂u

n

∂x

i−1/2

¸

+O(∆t

2

)

∂u

∂x

=

1

2

¸

u

n+1

i+1

−u

n+1

i

∆x

+

u

n

i

−u

n

i−1

∆x

¸

+O(∆x

2

, ∆t

2

).

(6.26)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 250 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Use (6.25) and (6.26) in equation (6.22) rather than central diﬀerences

u

n+1

i

−u

n

i

=

1

2

s

u

n+1

i+1

−2u

n+1

i

+u

n+1

i−1

+u

n

i+1

−2u

n

i

+u

n

i−1

−

1

2

C

i

u

n+1

i

−u

n+1

i−1

+u

n

i+1

−u

n

i

, u

n+1/2

i

> 0

u

n+1

i+1

−u

n+1

i

+u

n

i

−u

n

i−1

, u

n+1/2

i

< 0

.

This gives the tridiagonal problem

−su

n+1

i+1

+ 2(1 +s)u

n+1

i

−su

n+1

i−1

+C

i

u

n+1

i

−u

n+1

i−1

u

n+1

i+1

−u

n+1

i

¸

= su

n

i+1

+ 2(1 −s)u

n

i

+su

n

i−1

−C

i

u

n

i+1

−u

n

i

u

n

i

−u

n

i−1

¸

, u

n+1/2

i

> 0

, u

n+1/2

i

< 0

.

(6.27)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 251 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Notes:

1) Equation (6.27) is diagonally dominant for all s and C

i

(note that C

i

may be

positive or negative). Be sure to check this for diﬀerent equations, i.e. for

other than the one-dimensional Burger’s equation.

2) Iteration at each time step may require under-relaxation on u

i

; therefore,

u

k+1

i

= ωu

k+1/2

i

+ (1 −ω)u

k

i

, k = 0, 1, 2, . . . ,

where 0 < ω < 1.

3) As shown below, this method is (almost) O(∆x

2

, ∆t

2

) accurate.

Truncation Error of Crank-Nicolson with Upwind-Downwind Diﬀerencing:

We have used second-order accurate central diﬀerences for the ∂u/∂t and

∂

2

u/∂x

2

terms. Therefore, consider the u

n+1/2

∂u

n+1/2

∂x term with u

n+1/2

< 0

from (6.26)

∂u

∂x

=

1

2∆x

(u

n+1

i+1

−u

n+1

i

+u

n

i

−u

n

i−1

) +T.E. (6.28)

We would like to determine the order of accuracy, i.e. the truncation error T.E.,

of this approximation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 252 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Here, D

t

= ∂/∂t, D

x

= ∂/∂x, and ˜ u is the exact value of u

n+1/2

i

midway

between time levels.

We seek an expression of the form

∂u

∂x

=

∂˜ u

∂x

+T.E.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 253 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Expanding each term in equation (6.28) as a 2-D Taylor series about (x

i

, t

n+1/2

):

u

n+1

i+1

=

∞

¸

k=0

1

k!

∆t

2

D

t

+ ∆xD

x

k

˜ u,

u

n+1

i

=

∞

¸

k=0

1

k!

∆t

2

D

t

k

˜ u,

u

n

i

=

∞

¸

k=0

1

k!

−

∆t

2

D

t

k

˜ u =

∞

¸

k=0

(−1)

k

k!

∆t

2

D

t

k

˜ u,

u

n

i−1

=

∞

¸

k=0

1

k!

−

∆t

2

D

t

−∆xD

x

k

˜ u =

∞

¸

k=0

(−1)

k

k!

∆t

2

D

t

+ ∆xD

x

k

˜ u,

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 254 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Substituting these expansions into (6.28) gives

∂u

∂x

=

1

2∆x

∞

¸

k=0

1

k!

1 −(−1)

k

∆t

2

D

t

+ ∆xD

x

k

+

−1 + (−1)

k

∆t

2

D

t

k

¸

˜ u

∂u

∂x

=

1

2∆x

∞

¸

k=0

1 + (−1)

k+1

k!

¸

∆t

2

D

t

+ ∆xD

x

k

−

∆t

2

D

t

k

¸

˜ u

Note that

1 + (−1)

k+1

=

0, k = 0, 2, 4, . . .

2, k = 1, 3, 5, . . .

.

Therefore, let k = 2l + 1; thus,

∂u

∂x

=

1

∆x

∞

¸

l=0

1

(2l + 1)!

¸

∆t

2

D

t

+ ∆xD

x

2l+1

−

∆t

2

D

t

2l+1

¸

˜ u.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 255 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Recall the binomial theorem

(a +b)

k

=

k

¸

m=0

k

m

a

k−m

b

m

,

where

k

m

are the binomial coeﬃcients

k

m

=

k!

m!(k −m)!

(0! = 1).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 256 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

Thus,

∂u

∂x

=

1

∆x

∞

¸

l=0

1

(2l + 1)!

¸

2l+1

¸

m=0

2l + 1

m

∆t

2

D

t

2l+1−m

(∆xD

x

)

m

−

∆t

2

D

t

2l+1

¸

˜ u,

=

1

∆x

∞

¸

l=0

1

(2l + 1)!

¸

2l+1

¸

m=1

2l + 1

m

∆t

2

D

t

2l−m+1

(∆xD

x

)

m

+

2l + 1

0

∆t

2

D

t

2l+1

−

∆t

2

D

t

2l+1

¸

˜ u,

=

∞

¸

l=0

1

(2l + 1)!

2l+1

¸

m=1

(2l + 1)!

m!(2l −m+ 1)!

∆t

2

D

t

2l−m+1

(∆x)

m−1

(D

x

)

m

˜ u,

∂u

∂x

=

∂˜ u

∂x

+

∞

¸

l=1

2l+1

¸

m=1

1

m!(2l −m+ 1)!

∆t

2

D

t

2l−m+1

(∆x)

m−1

(D

x

)

m

˜ u.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 257 / 454

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems

To obtain the truncation error, consider the l = 1 term (m = 1, 2, 3)

1

1!2!

∆t

2

2

D

2

t

D

x

˜ u +

1

2!1!

∆t

2

∆xD

t

D

2

x

˜ u +

1

3!1!

∆x

2

D

3

x

˜ u.

Therefore, the truncation error is

O(∆t

2

, ∆t∆x, ∆x

2

).

Thus, if ∆t < ∆x then the approximation is O(∆x

2

) accurate, and if ∆t > ∆x

then the approximation is O(∆t

2

) accurate. This is better than O(∆x) or O(∆t),

but strictly speaking it is not O(∆t

2

, ∆x

2

).

Similarly, the v∂u/∂y term has truncation error

O(∆t

2

, ∆t∆y, ∆y

2

).

The loss of accuracy is due to the diagonal averaging across time levels.

Note:

1

Method is unconditionally stable.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 258 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

Outline

6

Numerical Solutions of Parabolic Problems

Introduction

Explicit Methods

Euler Method (First-Order Explicit)

Richardson Method

DuFort-Frankel Method

Stability Analysis

Introduction

Numerical Stability Analysis

Implicit Methods

First-Order Implicit

Crank-Nicolson

Non-Linear Convective Problems

First-Order Explicit

Crank-Nicolson

Upwind-Downwind Diﬀerencing

Multidimensional Problems

First-Order Explicit Method

First-Order Implicit Method

ADI Method with Time Splitting

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 259 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

Outline (cont’d)

Factored ADI Method

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 260 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

Consider the unsteady, 2-D diﬀusion equation

∂φ

∂t

= α

¸

∂

2

φ

∂x

2

+

∂

2

φ

∂y

2

, φ = φ(x, y, t), (6.29)

with initial condition

φ(x, y, 0) = φ

0

(x, y) at t = 0, (6.30)

and boundary conditions (Dirichlet, Neumann or mixed) on a closed contour C

enclosing the domain. We discretize as follows (t is normal to x −y plane):

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 261 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

First-Order Explicit Method

Approximating equation (6.29) using a forward diﬀerence in time and central

diﬀerences in space at the previous time level gives

φ

n+1

i,j

−φ

n

i,j

∆t

= α

¸

φ

n

i+1,j

−2φ

n

i,j

+φ

n

i−1,j

(∆x)

2

+

φ

n

i,j+1

−2φ

n

i,j

+φ

n

i,j−1

(∆y)

2

+O(∆t, ∆x

2

, ∆y

2

).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 262 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

Therefore, solving for the only unknown gives the explicit expression

φ

n+1

i,j

= (1 −2s

x

−2s

y

)φ

n

i,j

+s

x

(φ

n

i+1,j

+φ

n

i−1,j

) +s

y

(φ

n

i,j+1

+φ

n

i,j−1

), (6.31)

where s

x

= α∆t/(∆x)

2

and s

y

= α∆t/(∆y)

2

.

For numerical stability, a von Neumann stability analysis requires that

s

x

+s

y

≤

1

2

.

Thus, for example if ∆x = ∆y, i.e. s

x

= s

y

= s, we must have

s ≤

1

4

,

which is even more restrictive than for the 1-D diﬀusion equation where s ≤

1

2

for

stability.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 263 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

First-Order Implicit Method

Applying a backward diﬀerence in time and central diﬀerences in space at the

current time level leads to the implicit expression

(1 + 2s

x

+ 2s

y

)φ

n+1

i,j

−s

x

(φ

n+1

i+1,j

+φ

n+1

i−1,j

) −s

y

(φ

n+1

i,j+1

+φ

n+1

i,j−1

) = φ

n

i,j

. (6.32)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 264 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

Notes:

1

Unconditionally stable for all s

x

and s

y

.

2

Crank-Nicolson could be used to obtain second-order accuracy in time. It

produces a similar implicit equation, but with more terms on the

right-hand-side, i.e. evaluated at the previous time step.

3

Produces a banded matrix (with ﬁve unknowns) that is diﬃcult to solve

eﬃciently.

4

Alternatively, we could split each time step into two half steps, called ADI

with time splitting, resulting in two sets of tridiagonal problems per time step:

Step 1: Solve implicitly for terms associated with one coordinate direction.

Step 2: Solve implicitly for terms associated with other coordinate direction.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 265 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

ADI Method with Time Splitting (Fractional-Step Method)

As mentioned above, we split each time step into two half-time steps as follows:

1

Sweep along lines of constant y during the ﬁrst half step.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 266 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

φ

n+1/2

i,j

−φ

n

i,j

∆t/2

= α

¸

φ

n+1/2

i+1,j

−2φ

n+1/2

i,j

+φ

n+1/2

i−1,j

(∆x)

2

+

φ

n

i,j+1

−2φ

n

i,j

+φ

n

i,j−1

(∆y)

2

¸

.

(6.33)

Therefore,

1

2

s

x

φ

n+1/2

i+1,j

−(1+s

x

)φ

n+1/2

i,j

+

1

2

s

x

φ

n+1/2

i−1,j

= −

1

2

s

y

φ

n

i,j+1

−(1−s

y

)φ

n

i,j

−

1

2

s

y

φ

n

i,j−1

.

(6.34)

The tridiagonal problems (6.34) are solved for φ

n+1/2

i,j

, i = 1, . . . , I + 1,

j = 1, . . . , J + 1, at the intermediate time level.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 267 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

2

Sweep along lines of constant x during the second half step.

φ

n+1

i,j

−φ

n+1/2

i,j

∆t/2

= α

¸

φ

n+1/2

i+1,j

−2φ

n+1/2

i,j

+φ

n+1/2

i−1,j

(∆x)

2

+

φ

n+1

i,j+1

−2φ

n+1

i,j

+φ

n+1

i,j−1

(∆y)

2

¸

.

(6.35)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 268 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

Therefore,

1

2

s

y

φ

n+1

i,j+1

−(1+s

y

)φ

n+1

i,j

+

1

2

s

y

φ

n+1

i,j−1

= −

1

2

s

x

φ

n+1/2

i+1,j

−(1−s

x

)φ

n+1/2

i,j

−

1

2

s

x

φ

n+1/2

i−1,j

.

(6.36)

The tridiagonal problems (6.36) are solved for φ

n+1

i,j

, i = 1, . . . , I + 1,

j = 1, . . . , J + 1, at the current time level.

Notes:

1

Method is O(∆t

2

, ∆x

2

, ∆y

2

).

2

Requires boundary conditions at the intermediate time level n + 1/2 for

equation (6.34).

For example, if the boundary condition at x = 0 is Dirichlet as follows

φ(0, y, t) = a(y, t),

then

φ

n

1,j

= a

n

j

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 269 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

Subtracting equation (6.35) from (6.33) gives

φ

n+1/2

i,j

−φ

n

i,j

∆t/2

−

φ

n+1

i,j

−φ

n+1/2

i,j

∆t/2

= α

¸

φ

n

i,j+1

−2φ

n

i,j

+φ

n

i,j−1

(∆y)

2

−

φ

n+1

i,j+1

−2φ

n+1

i,j

+φ

n+1

i,j−1

(∆y)

2

¸

,

or solving for the unknown at the intermediate time level results in

φ

n+1/2

i,j

=

1

2

φ

n

i,j

+φ

n+1

i,j

+

1

4

s

y

φ

n

i,j+1

−2φ

n

i,j

+φ

n

i,j−1

−

φ

n+1

i,j+1

−2φ

n+1

i,j

+φ

n+1

i,j−1

.

Applying this equation at the boundary x = 0, leads to

φ

n+1/2

1,j

=

1

2

a

n

j

+a

n+1

j

+

1

4

s

y

a

n

j+1

−2a

n

j

+a

n

j−1

−

a

n+1

j+1

−2a

n+1

j

+a

n+1

j−1

.

This provides the boundary condition for φ

1,j

at the intermediate (n + 1/2)

time level. Note that the ﬁrst term on the right-hand-side is the average of a

at the n and n + 1 time levels, the second term is ∂

2

a

n

/∂y

2

, and the third

term is ∂

2

a

n+1

/∂y

2

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 270 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

3

For stability, apply von Neumann analysis at each half step and take the

product of the resulting ampliﬁcation factors, G

1

and G

2

, to obtain G for the

full time step.

⇒ Method is unconditionally stable for all s

x

and s

y

.

4

In 3-D, we require three fractional steps (∆t/3) for each time step, and the

method is only conditionally stable, where

s

x

, s

y

, s

z

≤ 1.5,

for stability (s

z

= α∆t/(∆z)

2

).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 271 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

Factored ADI Method

Let us reconsider the unsteady, 2-D diﬀusion equation

∂φ

∂t

= α

¸

∂

2

φ

∂x

2

+

∂

2

φ

∂y

2

, (6.37)

and apply the Crank-Nicolson approximation

φ

n+1

i,j

−φ

n

i,j

∆t

=

α

2

δ

2

x

φ

n+1

i,j

+δ

2

x

φ

n

i,j

+δ

2

y

φ

n+1

i,j

+δ

2

y

φ

n

i,j

,

where δ represents second-order central diﬀerence operators (as in section 5.7)

δ

2

x

φ

i,j

=

φ

i+1,j

−2φ

i,j

+φ

i−1,j

(∆x)

2

,

δ

2

y

φ

i,j

=

φ

i,j+1

−2φ

i,j

+φ

i,j−1

(∆y)

2

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 272 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

Rewriting the diﬀerence equation with the unknowns on the left-hand-side and the

knowns on the right leads to

¸

1 −

1

2

α∆t

δ

2

x

+δ

2

y

φ

n+1

i,j

=

¸

1 +

1

2

α∆t

δ

2

x

+δ

2

y

φ

n

i,j

. (6.38)

We “factor” the diﬀerence operator on the left-hand-side as follows

¸

1 −

1

2

α∆t

δ

2

x

+δ

2

y

≈

¸

1 −

1

2

α∆tδ

2

x

¸

1 −

1

2

α∆tδ

2

y

, (6.39)

where the ﬁrst factor only involves the diﬀerence operator in the x-direction, and

the second factor only involves the diﬀerence operator in the y-direction. The

factored operator produces an extra term as compared to the unfactored operator

1

4

α

2

∆t

2

δ

2

x

δ

2

y

= O(∆t

2

),

which is O(∆t

2

). Therefore, the factorization (6.39) is consistent with the

second-order accuracy in time of the Crank-Nicolson approximation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 273 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

The factored form of (6.38) is

¸

1 −

1

2

α∆tδ

2

x

¸

1 −

1

2

α∆tδ

2

y

φ

n+1

i,j

=

¸

1 +

1

2

α∆t

δ

2

x

+δ

2

y

φ

n

i,j

,

which can be solved in two steps by deﬁning the intermediate variable

ˆ

φ

i,j

=

¸

1 −

1

2

α∆tδ

2

y

φ

n+1

i,j

. (6.40)

Note that

ˆ

φ

i,j

is not the same as φ

n+1/2

i,j

, which is an intermediate approximation

to φ

i,j

at the half time step.

The two stage solution process is:

1

Sweep along constant y-lines solving

¸

1 −

1

2

α∆tδ

2

x

ˆ

φ

i,j

=

¸

1 +

1

2

α∆t

δ

2

x

+δ

2

y

φ

n

i,j

, (6.41)

which produces a tridiagonal problem at each j for

ˆ

φ

i,j

, i = 1, . . . , I + 1.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 274 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

2

Sweep along constant x-lines solving (from (6.40))

¸

1 −

1

2

α∆tδ

2

y

φ

n+1

i,j

=

ˆ

φ

i,j

, (6.42)

which produces a tridiagonal problem at each i for φ

n+1

i,j

, j = 1, . . . , J + 1 at

the current time step. Note that the right-hand-side of this equation is the

solution of (6.41).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 275 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

Notes:

1

Similar to the ADI method with time splitting, but have an intermediate

variable

ˆ

φ

i,j

rather than half time step φ

n+1/2

i,j

.

Factored ADI is somewhat faster; it only requires one evaluation of the spatial

derivatives on the right-hand-side per time step (for equation (6.41)) rather

than two for the ADI method (see equations (6.34) and (6.36)).

2

Method is O(∆t

2

, ∆x

2

, ∆y

2

) accurate and is unconditionally stable (even for

3-D implementation of unsteady diﬀusion equation).

3

Requires boundary conditions for the intermediate variable

ˆ

φ

i,j

to solve

(6.41). These are obtained from equation (6.40) applied at the boundaries

(see Fletcher, section 8.4.1).

4

The order of solution can be reversed, i.e. we could deﬁne

ˆ

φ

i,j

=

¸

1 −

1

2

α∆tδ

2

x

φ

n+1

i,j

.

instead of (6.40).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 276 / 454

Numerical Solutions of Parabolic Problems Multidimensional Problems

5

If we have non-linear convective terms, i.e. unsteady Navier-Stokes or

transport equation, use upwind-downwind diﬀerencing as in section 6.5.3. See

Peridier, Smith & Walker, JFM, Vol. 232, pp. 99–131 (1991), which shows

factored ADI with upwind-downwind diﬀerencing applied to the the unsteady

boundary-layer equations (but method applies to more general equations).

6

Observe that numerical methods for parabolic problems do not require

relaxation or acceleration parameters as is often the case for elliptic solvers.

Recall that the issue is numerical stability, not iterative convergence.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 277 / 454

Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation

Outline

7

Numerical Solutions of Navier-Stokes Equations

Primitive-Variables Formulation

Vorticity-Streamfunction Formulation

Boundary Conditions for Vorticity-Streamfunction Formulation

Thom’s Method

Jensen’s Method

Numerical Solutions of Coupled Systems of Equations

Sequential Method

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 278 / 454

Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation

Incompressible ﬂow of a Newtonian ﬂuid is governed by the Navier-Stokes

equations, given by the momentum equation

ρ

¸

∂V

∗

∂t

∗

+V

∗

∇V

∗

= −∇p

∗

+µ∇

2

V

∗

,

and the continuity equation

∇ V

∗

= 0.

The density is ρ, the viscosity is µ, the pressure is p

∗

(x

∗

, y

∗

, z

∗

, t

∗

), and the

velocity vector in Cartesian coordinates, for example, is V

∗

= u

∗

i +v

∗

j +w

∗

k.

It is convenient to nondimensionalize using a characteristic length scale L and

velocity U according to

(x, y, z) =

(x

∗

, y

∗

, z

∗

)

L

, t =

t

∗

L/U

V =

V

∗

U

, p =

p

∗

ρU

2

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 279 / 454

Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation

Applying to the Navier-Stokes equations gives

∂V

∂t

+V ∇V = −∇p +

1

Re

∇

2

V,

and

∇ V = 0,

where Re = ρUL/µ is the nondimensional Reynolds number.

In 2-D, Cartesian coordinates, the incompressible Navier-Stokes equations are:

x-momentum:

∂u

∂t

+u

∂u

∂x

+v

∂u

∂y

= −

∂p

∂x

+

1

Re

¸

∂

2

u

∂x

2

+

∂

2

u

∂y

2

, (7.1)

y-momentum:

∂v

∂t

+u

∂v

∂x

+v

∂v

∂y

= −

∂p

∂y

+

1

Re

¸

∂

2

v

∂x

2

+

∂

2

v

∂y

2

, (7.2)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 280 / 454

Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation

Continuity:

∂u

∂x

+

∂v

∂y

= 0. (7.3)

Thus, we have three coupled equations for three dependent variables

u(x, y, t), v(x, y, t) and p(x, y, t), which we refer to as primitive variables.

Therefore, the system is closed mathematically:

Given v(x, y, t) and p(x, y, t), we can determine u(x, y, t) from equation

(7.1).

Given u(x, y, t) and p(x, y, t), we can determine v(x, y, t) from equation

(7.2).

But how do we determine p(x, y, t) given that p does not appear in equation

(7.3)?

⇒ Need equation for p(x, y) in terms of u(x, y) and v(x, y) at time t.

To obtain such an equation, take the divergence of the momentum equation in

vector form, i.e. ∇ (NS), which in 2-D is equivalent to taking ∂/∂x of equation

(7.1), ∂/∂y of equation (7.2) and adding.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 281 / 454

Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation

Doing so gives

∂

2

p

∂x

2

+

∂

2

p

∂y

2

= −

¸

∂

2

u

∂t∂x

+

∂u

∂x

2

+u

∂

2

u

∂x

2

+

∂v

∂x

∂u

∂y

+v

∂

2

u

∂x∂y

+

∂

2

v

∂t∂y

+

∂u

∂y

∂v

∂x

+u

∂

2

v

∂x∂y

+

∂v

∂y

2

+v

∂

2

v

∂y

2

¸

+

1

Re

¸

∂

3

u

∂x

3

+

∂

3

u

∂x∂y

2

+

∂

3

v

∂x

2

∂y

+

∂

3

v

∂y

3

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 282 / 454

Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation

Doing so gives

∂

2

p

∂x

2

+

∂

2

p

∂y

2

= −

¸

∂

2

u

∂t∂x

+

∂u

∂x

2

+u

∂

2

u

∂x

2

+

∂v

∂x

∂u

∂y

+v

∂

2

u

∂x∂y

+

∂

2

v

∂t∂y

+

∂u

∂y

∂v

∂x

+u

∂

2

v

∂x∂y

+

∂v

∂y

2

+v

∂

2

v

∂y

2

¸

+

1

Re

¸

∂

3

u

∂x

3

+

∂

3

u

∂x∂y

2

+

∂

3

v

∂x

2

∂y

+

∂

3

v

∂y

3

.

Or

∂

2

p

∂x

2

+

∂

2

p

∂y

2

= −

¸

∂

∂t

∂u

∂x

+

∂v

∂y

+u

∂

∂x

∂u

∂x

+

∂v

∂y

+v

∂

∂y

∂u

∂x

+

∂v

∂y

+

∂u

∂x

2

+

∂v

∂y

2

+ 2

∂v

∂x

∂u

∂y

¸

+

1

Re

¸

∂

2

∂x

2

∂u

∂x

+

∂v

∂y

+

∂

2

∂y

2

∂u

∂x

+

∂v

∂y

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 283 / 454

Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation

But from the continuity equation (7.3)

∂

2

p

∂x

2

+

∂

2

p

∂y

2

= −

∂

∂t

¨

¨

¨

¨

¨

¨B

0

∂u

∂x

+

∂v

∂y

+u

∂

∂x

¨

¨

¨

¨

¨

¨ B

0

∂u

∂x

+

∂v

∂y

+v

∂

∂y

¨

¨

¨

¨

¨

¨B

0

∂u

∂x

+

∂v

∂y

+

∂u

∂x

2

+

∂v

∂y

2

+ 2

∂v

∂x

∂u

∂y

¸

+

1

Re

∂

2

∂x

2

¨

¨

¨

¨

¨

¨B

0

∂u

∂x

+

∂v

∂y

+

∂

2

∂y

2

¨

¨

¨

¨

¨

¨B

0

∂u

∂x

+

∂v

∂y

¸

¸

¸

.

We also have from continuity that

∂u

∂x

2

=

∂v

∂y

2

= −

∂u

∂x

∂v

∂y

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 284 / 454

Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation

Substituting gives

∂

2

p

∂x

2

+

∂

2

p

∂y

2

= 2

¸

∂u

∂x

∂v

∂y

−

∂v

∂x

∂u

∂y

, (7.4)

which is a Poisson equation for pressure with u(x, y) and v(x, y) known from

solutions of equations (7.1) and (7.2), respectively.

Notes:

1

The unsteady momentum equations (7.1) and (7.2) are parabolic in time.

⇒ May be solved using Crank-Nicolson, ADI, Factored-ADI, etc....

2

The pressure equation (7.4) and steady forms of (7.1) and (7.2) are elliptic.

⇒ Can be solved using cyclic reduction, Gauss-Seidel, ADI, multigrid, etc....

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 285 / 454

Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation

Velocity Boundary Conditions (u

s

and u

n

are velocity components tangential and

normal to the surface, respectively):

Surface: u

s

= u

n

= 0 (no slip and impermeability)

Inﬂow: u

s

and u

n

speciﬁed

Outﬂow:

∂u

s

∂n

=

∂u

n

∂n

= 0 (fully-developed ﬂow)

Symmetry:

∂u

s

∂n

= 0, u

n

= 0 (no ﬂow through symmetry plane)

Note that the domain must be suﬃciently long for the fully-developed outﬂow

boundary condition to be valid.

Pressure Boundary Conditions at a Surface:

From the momentum equations (7.1) and (7.2) with u = v = 0:

n = x ⇒

∂p

∂x

=

1

Re

∂

2

u

∂x

2

n = y ⇒

∂p

∂y

=

1

Re

∂

2

v

∂x

2

Other boundary conditions for pressure obtained similarly.

Observe that we have Neumann boundary conditions on pressure at solid surfaces.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 286 / 454

Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation

Outline

7

Numerical Solutions of Navier-Stokes Equations

Primitive-Variables Formulation

Vorticity-Streamfunction Formulation

Boundary Conditions for Vorticity-Streamfunction Formulation

Thom’s Method

Jensen’s Method

Numerical Solutions of Coupled Systems of Equations

Sequential Method

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 287 / 454

Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation

The streamfunction ψ(x, y, t) is deﬁned for 2-D, incompressible ﬂow by

u =

∂ψ

∂y

, v = −

∂ψ

∂x

, (7.5)

such that the continuity equation (7.3) is identically satisﬁed. Lines of constant ψ

are called streamlines and are everywhere tangent to the local velocity vectors.

The vorticity ω(x, y, t) in 2-D is deﬁned by

ω =

∂v

∂x

−

∂u

∂y

, (7.6)

and measures the local rate of rotation of ﬂuid particles, with the sign

corresponding to the right-hand-rule. Note that in general 3-D ﬂows vorticity is a

vector

− →

ω = ∇V.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 288 / 454

Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation

Note that vorticity = vortex:

vorticity – spatial distribution of rotation rates of individual ﬂuid particles.

vortex – a spatially coherent region of ﬂuid rotating as a unit, i.e. an “eddy.”

Example of a ﬂow with vorticity, but no vortex?

Example of a ﬂow with vortex, but no vorticity?

To obtain the vorticity-transport equation, take the curl of the momentum

equation in vector form, i.e. ∇(NS), which in 2-D is equivalent to taking ∂/∂x

of equation (7.2) minus ∂/∂y of equation (7.1):

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 289 / 454

Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation

Doing so gives

∂

2

v

∂x∂t

+

∂u

∂x

∂v

∂x

+u

∂

2

v

∂x

2

+

∂v

∂x

∂v

∂y

+v

∂

2

v

∂x∂y

−

∂

2

u

∂y∂t

−

∂u

∂y

∂u

∂x

−u

∂

2

u

∂x∂y

−

∂v

∂y

∂u

∂y

−v

∂

2

u

∂y

2

= −

∂

2

p

∂x∂y

+

∂

2

p

∂x∂y

+

1

Re

¸

∂

3

v

∂x

3

+

∂

3

v

∂x∂y

2

−

∂

3

u

∂x

2

∂y

−

∂

3

u

∂y

3

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 290 / 454

Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation

Doing so gives

∂

2

v

∂x∂t

+

∂u

∂x

∂v

∂x

+u

∂

2

v

∂x

2

+

∂v

∂x

∂v

∂y

+v

∂

2

v

∂x∂y

−

∂

2

u

∂y∂t

−

∂u

∂y

∂u

∂x

−u

∂

2

u

∂x∂y

−

∂v

∂y

∂u

∂y

−v

∂

2

u

∂y

2

= −

∂

2

p

∂x∂y

+

∂

2

p

∂x∂y

+

1

Re

¸

∂

3

v

∂x

3

+

∂

3

v

∂x∂y

2

−

∂

3

u

∂x

2

∂y

−

∂

3

u

∂y

3

.

Or

∂

∂t

∂v

∂x

−

∂u

∂y

+u

∂

∂x

∂v

∂x

−

∂u

∂y

+v

∂

∂y

∂v

∂x

−

∂u

∂y

+

∂v

∂x

∂u

∂x

+

∂v

∂y

−

∂u

∂y

∂u

∂x

+

∂v

∂y

=

1

Re

¸

∂

2

∂x

2

∂v

∂x

−

∂u

∂y

+

∂

2

∂y

2

∂v

∂x

−

∂u

∂y

**MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 291 / 454
**

Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation

But from the continuity equation (7.3) and the deﬁnition of vorticity (7.6)

∂

∂t

¨

¨

¨

¨

¨

¨B

ω

∂v

∂x

−

∂u

∂y

+u

∂

∂x

¨

¨

¨

¨

¨

¨B

ω

∂v

∂x

−

∂u

∂y

+v

∂

∂y

¨

¨

¨

¨

¨

¨B

ω

∂v

∂x

−

∂u

∂y

+

∂v

∂x

¨

¨

¨

¨

¨

¨B

0

∂u

∂x

+

∂v

∂y

−

∂u

∂y

¨

¨

¨

¨

¨

¨B

0

∂u

∂x

+

∂v

∂y

=

1

Re

∂

2

∂x

2

¨

¨

¨

¨

¨

¨B

ω

∂v

∂x

−

∂u

∂y

+

∂

2

∂y

2

¨

¨

¨

¨

¨

¨B

ω

∂v

∂x

−

∂u

∂y

¸

¸

Therefore, the vorticity-transport equation in 2-D is

∂ω

∂t

+u

∂ω

∂x

+v

∂ω

∂y

=

1

Re

¸

∂

2

ω

∂x

2

+

∂

2

ω

∂y

2

, (7.7)

which is a convection-diﬀusion equation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 292 / 454

Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation

The vorticity and streamfunction may be related by substituting (7.5) into (7.6)

to obtain

∂

2

ψ

∂x

2

+

∂

2

ψ

∂y

2

= −ω, (7.8)

which is a Poisson equation for ψ(x, y, t) if ω(x, y, t) is known.

Notes:

1

Equations (7.7) and (7.8) are coupled equations for ω and ψ (with

u = ∂ψ/∂y, v = −∂ψ/∂x in (7.7)).

2

The vorticity-transport equation (7.7) is parabolic when unsteady and elliptic

when steady. The streamfunction equation (7.8) is elliptic.

3

The pressure terms have been eliminated, i.e. there is no need to calculate

the pressure in order to advance the solution in time.

→ Can compute p(x, y, t) from equation (7.4) if desired.

4

The vorticity-streamfunction formulation consists of two equations for the

two unknowns ω(x, y, t) and ψ(x, y, t) (cf. primitive variables formulation

with three equations for three unknowns in 2-D).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 293 / 454

Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation

5

Unlike the primitive variables formulation, the ω–ψ formulation does not

easily extend to 3-D:

Three components of vorticity ⇒ Three vorticity equations.

Stretching and tilting terms in 3-D vorticity equations.

Cannot deﬁne streamfunction in 3-D ⇒ Vorticity-velocity potential

formulation.

6

We do not have straightforward boundary conditions for vorticity (see next

section).

⇒ Because of notes (3) and (4) (notwithstanding (6)), this is the preferred

formulation for 2-D, incompressible ﬂows.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 294 / 454

Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation

Outline

7

Numerical Solutions of Navier-Stokes Equations

Primitive-Variables Formulation

Vorticity-Streamfunction Formulation

Boundary Conditions for Vorticity-Streamfunction Formulation

Thom’s Method

Jensen’s Method

Numerical Solutions of Coupled Systems of Equations

Sequential Method

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 295 / 454

Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation

Consider the driven cavity ﬂow:

Recall that the streamfunction is deﬁned by

u =

∂ψ

∂y

, v = −

∂ψ

∂x

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 296 / 454

Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation

Thus, on AD and BC:

u = 0 ⇒

∂ψ

∂y

= 0 ⇒ψ = const. = 0

v = 0 ⇒

∂ψ

∂x

= 0

∴ ψ and

∂ψ

∂n

speciﬁed (n = x).

Similarly, on AB:

v = 0 ⇒

∂ψ

∂x

= 0 ⇒ψ = 0

u = 0 ⇒

∂ψ

∂y

= 0

∴ ψ and

∂ψ

∂n

speciﬁed (n = y).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 297 / 454

Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation

On CD:

v = 0 ⇒

∂ψ

∂x

= 0 ⇒ψ = 0

u = 1 ⇒

∂ψ

∂y

= 1

∴ ψ and

∂ψ

∂n

speciﬁed (n = y).

At solid boundaries, therefore, the streamfunction and its normal derivative are

speciﬁed. Note that we have two boundary conditions on the streamfunction,

where only one is needed.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 298 / 454

Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation

In order to consider boundary conditions on vorticity, recall its deﬁnition

ω =

∂v

∂x

−

∂u

∂y

.

Thus, for example, on AB:

v = 0 ⇒

∂v

∂x

= 0 ⇒ω = −

∂u

∂y

= −

τ

w

µ

,

where τ

w

is the wall shear stress. However, τ

w

is unknown and must be

determined from the solution.

⇒ Don’t have boundary condition for ω.

Strategy:

Use ψ = const. as boundary condition for streamfunction equation (7.8).

Use “extra” boundary condition ∂ψ/∂n = const. to obtain a condition for ω

at the surface.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 299 / 454

Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation

Thom’s Method

Consider, for example, the lower boundary AB (y = 0). Throughout the domain

we have

∂

2

ψ

∂x

2

+

∂

2

ψ

∂y

2

= −ω.

However, along AB ψ = 0; therefore,

∂

2

ψ

∂x

2

= 0, and

ω

w

= −

∂

2

ψ

∂y

2

y=0

. (7.9)

We also have

u =

∂ψ

∂y

= 0 on y = 0.

For generality, consider a moving wall with

∂ψ

∂y

y=0

= u

w

(x) = g(x), (7.10)

where the tangential wall velocity u

w

(x) = g(x) is speciﬁed.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 300 / 454

Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation

Applying a central diﬀerence to (7.10) gives

ψ

i,2

−ψ

i,0

2∆y

= g

i

+O(∆y

2

);

therefore,

ψ

i,0

= ψ

i,2

−2∆y g

i

+O(∆y

3

). (7.11)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 301 / 454

Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation

A central diﬀerence for (7.9) gives

ω

i,1

= −

ψ

i,2

−2ψ

i,1

+ψ

i,0

(∆y)

2

+O(∆y

2

). (7.12)

Substituting (7.11) for ψ

i,0

in the previous equation leads to

ω

i,1

= −

2

(∆y)

2

[ψ

i,2

−ψ

i,1

−∆y g

i

] +O(∆y). (7.13)

We then use the most recent iterate for streamfunction ψ to obtain a Dirichlet

boundary condition for vorticity ω.

Note: The truncation error for Thom’s method is only O(∆y). However, it

exhibits second-order convergence (Huang & Wetton 1996).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 302 / 454

Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation

Jensen’s Method

We would like a method that is O(∆y

2

) overall; therefore, consider using an

O(∆y

3

) approximation for (7.10)

−2ψ

i,0

−3ψ

i,1

+ 6ψ

i,2

−ψ

i,3

6∆y

= g

i

+O(∆y

3

);

therefore,

ψ

i,0

= −

3

2

ψ

i,1

+ 3ψ

i,2

−

1

2

ψ

i,3

−3∆y g

i

+O(∆y

4

).

Substituting into (7.12) results in

ω

i,1

= −

1

2(∆y)

2

[7ψ

i,1

−8ψ

i,2

+ψ

i,3

+ 6∆y g

i

] +O(∆y

2

). (7.14)

We then use (7.14) in place of (7.13) to obtain a Dirichlet boundary condition for

vorticity.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 303 / 454

Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation

Notes:

1

For discussion of boundary conditions on vorticity and streamfunction at

inlets and outlets, see Fletcher, Vol. II, pp. 380–381.

2

Treatment of vorticity (and pressure) boundary conditions is still an active

area of research and debate (see, for example, Rempfer 2003).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 304 / 454

Numerical Solutions of Navier-Stokes Equations Numerical Solutions of Coupled Systems of Equations

Outline

7

Numerical Solutions of Navier-Stokes Equations

Primitive-Variables Formulation

Vorticity-Streamfunction Formulation

Boundary Conditions for Vorticity-Streamfunction Formulation

Thom’s Method

Jensen’s Method

Numerical Solutions of Coupled Systems of Equations

Sequential Method

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 305 / 454

Numerical Solutions of Navier-Stokes Equations Numerical Solutions of Coupled Systems of Equations

Until now, we have considered methods for solving single equations; but in ﬂuid

dynamics we must solve systems of coupled equations, such as the Navier-Stokes

equations in the primitive-variables or vorticity-streamfunction formulations.

Two methods for treating coupled equations numerically:

1

Sequential Solution:

Solve, i.e. iterate on, each equation for its dominant variable, treating the

other variables as known, i.e. use most recent values.

Requires one pass through mesh for each equation at each iteration.

⇒ Most common and easiest to implement.

2

Simultaneous (or Coupled) Solution:

Combine coupled equations into a single system of algebraic equations.

⇒ If have n dependent variables (e.g. 2-D primitive variables ⇒ n = 3 (u, v, p)),

produces an n ×n block tridiagonal system of equations that is solved for all

the dependent variables simultaneously.

See, for example, S. P. Vanka, J. Comput. Phys., Vol. 65, pp. 138–158 (1986).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 306 / 454

Numerical Solutions of Navier-Stokes Equations Numerical Solutions of Coupled Systems of Equations

For example, if solving using Gauss-Seidel:

1

Sequential ⇒ One Gauss-Seidel expression for each dependent variable

updated in succession.

2

Simultaneous ⇒ Solve n equations for n unknown dependent variables

directly at each grid point.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 307 / 454

Numerical Solutions of Navier-Stokes Equations Numerical Solutions of Coupled Systems of Equations

Sequential Method

Consider for example the primitive-variables formulation.

Steady Problems:

Note:

May require underrelaxation for convergence due to nonlinearity.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 308 / 454

Numerical Solutions of Navier-Stokes Equations Numerical Solutions of Coupled Systems of Equations

Unsteady Problems:

Notes:

Outer loop for time marching.

Inner loop to obtain solution of coupled equations at current time step.

⇒ Trade-oﬀ: Generally, reducing ∆t reduces number of inner loop iterations. (If

∆t small enough, no iteration is necessary).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 309 / 454

Grids and Grid Generation Introduction

Outline

8

Grids and Grid Generation

Introduction

Staggered vs. Collocated Grids

Uniform vs. Non-Uniform Grids

Grid Generation

Algebraic Grid Generation

Elliptic Grid Generation

Variational Grid Generation

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 310 / 454

Grids and Grid Generation Introduction

Thus far we have used what are called “uniform, collocated grids.”

Uniform ⇒ Grid spacings in each direction ∆x and ∆y are uniform.

Collocated ⇒ All dependent variables are approximated at the same point.

In the following two sections we consider alternatives to uniform and collocated

grids.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 311 / 454

Grids and Grid Generation Staggered vs. Collocated Grids

Outline

8

Grids and Grid Generation

Introduction

Staggered vs. Collocated Grids

Uniform vs. Non-Uniform Grids

Grid Generation

Algebraic Grid Generation

Elliptic Grid Generation

Variational Grid Generation

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 312 / 454

Grids and Grid Generation Staggered vs. Collocated Grids

Recall the 2-D, incompressible Navier-Stokes equations in the primitive variables

formulation

∂u

∂t

+u

∂u

∂x

+v

∂u

∂y

= −

∂p

∂x

+

1

Re

¸

∂

2

u

∂x

2

+

∂

2

u

∂y

2

, (8.1)

∂v

∂t

+u

∂v

∂x

+v

∂v

∂y

= −

∂p

∂y

+

1

Re

¸

∂

2

v

∂x

2

+

∂

2

v

∂y

2

, (8.2)

∂

2

p

∂x

2

+

∂

2

p

∂y

2

= 2

¸

∂u

∂x

∂v

∂y

−

∂v

∂x

∂u

∂y

. (8.3)

When using collocated grids, all three equations are approximated at the same

points in the grid for their respective dependent variables u(x, y), v(x, y), and

p(x, y).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 313 / 454

Grids and Grid Generation Staggered vs. Collocated Grids

Alternatively, using a staggered grid we approximate each primitive variable and

its associated equation as follows.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 314 / 454

Grids and Grid Generation Staggered vs. Collocated Grids

For example, let us consider how each of the terms in the x-momentum equation

(8.1) are approximated (using central diﬀerences) on a staggered grid

u

∂u

∂x

= u

i,j

u

i+1,j

−u

i−1,j

2∆x

+O(∆x

2

),

v

∂u

∂y

=

1

4

(v

i,j

+v

i+1,j

+v

i,j−1

+v

i+1,j−1

)

u

i,j+1

−u

i,j−1

2∆y

+O(∆y

2

),

∂p

∂x

=

p

i+1,j

−p

i,j

∆x

+O(∆x

2

),

∂

2

u

∂x

2

=

u

i+1,j

−2u

i,j

+u

i−1,j

∆x

2

+O(∆x

2

),

∂

2

u

∂y

2

=

u

i,j+1

−2u

i,j

+u

i,j−1

∆y

2

+O(∆y

2

).

The terms in equations (8.2) and (8.3) are treated in a similar manner at their

respective points while being approximated at their respective locations in the grid.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 315 / 454

Grids and Grid Generation Staggered vs. Collocated Grids

Note that special treatment is required at the boundaries.

Therefore, either grid points at which u or v are computed or speciﬁed do not

coincide with the boundary. Speciﬁcally, the points where u are taken do not

coincide with the y = 0 boundary, and v points do not coincide with the x = 0

boundary in the above example.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 316 / 454

Grids and Grid Generation Staggered vs. Collocated Grids

Advantages of staggered grid:

1

Helps avoid oscillations in pressure that can occur in some methods applied

to incompressible Navier-Stokes.

2

“Ensures” conservation of kinetic energy.

Advantages of collocated grid:

1

Easier to understand and program, i.e. u

i,j

, v

i,j

and p

i,j

are all approximated

at the same location.

2

Easier to implement boundary conditions, particularly for complex boundaries.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 317 / 454

Grids and Grid Generation Uniform vs. Non-Uniform Grids

Outline

8

Grids and Grid Generation

Introduction

Staggered vs. Collocated Grids

Uniform vs. Non-Uniform Grids

Grid Generation

Algebraic Grid Generation

Elliptic Grid Generation

Variational Grid Generation

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 318 / 454

Grids and Grid Generation Uniform vs. Non-Uniform Grids

In many ﬂows, e.g. those involving boundary layers, the solution has local regions

of intense gradients.

Therefore, a ﬁne grid is necessary to resolve the ﬂow near boundaries, but the

same resolution is not necessary in the remainder of the domain. As a result, a

uniform grid would waste computational resources where they are not needed.

Alternatively, a non-uniform grid would allow us to reﬁne the grid where it is

needed.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 319 / 454

Grids and Grid Generation Uniform vs. Non-Uniform Grids

Let us obtain the ﬁnite-diﬀerence approximations using Taylor series as before, but

without assuming all ∆x’s are equal. For example, consider the ﬁrst-derivative

term ∂φ/∂x.

Applying Taylor series at x

i−1

and x

i+1

with ∆x

i

= ∆x

i+1

and solving for ∂φ/∂x

leads to

∂φ

∂x

=

φ

i+1

−φ

i−1

∆x

i

+ ∆x

i+1

−

∆x

2

i+1

−∆x

2

i

2(∆x

i

+ ∆x

i+1

)

∂

2

φ

∂x

2

i

−

∆x

3

i+1

+ ∆x

3

i

6(∆x

i

+ ∆x

i+1

)

∂

3

φ

∂x

3

i

+ .

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 320 / 454

Grids and Grid Generation Uniform vs. Non-Uniform Grids

If the grid is uniform, i.e. ∆x

i

= ∆x

i+1

, then the second term vanishes, and the

approximation reduces to the usual O(∆x

2

)-accurate central diﬀerence

approximation for the ﬁrst derivative. However, for a non-uniform grid, the

truncation error is only O(∆x).

We could restore second-order accuracy by using an appropriate approximation to

∂

2

φ/∂x

2

i

in the second term, which results in

∂φ

∂x

=

φ

i+1

∆x

2

i

−φ

i−1

∆x

2

i+1

+φ

i

(∆x

2

i+1

−∆x

2

i

)

∆x

i+1

∆x

i

(∆x

i

+ ∆x

i+1

)

+O(∆x

2

).

As one can imagine, this gets very complicated, and it is diﬃcult to ensure

consistent accuracy for all approximations.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 321 / 454

Grids and Grid Generation Grid Generation

Outline

8

Grids and Grid Generation

Introduction

Staggered vs. Collocated Grids

Uniform vs. Non-Uniform Grids

Grid Generation

Algebraic Grid Generation

Elliptic Grid Generation

Variational Grid Generation

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 322 / 454

Grids and Grid Generation Grid Generation

Rather than using non-uniform grids, it is often advantageous to transform the

problem to a computational domain on which a uniform mesh may be used. Such

a transformation generally has one or both of the following objectives:

1

Transform a complex physical domain into a simple, e.g. rectangular or

circular, computational domain.

2

Cluster grid points in regions of the physical domain where the solution varies

rapidly, i.e. large gradients occur.

We consider transformations of the form

(x, y) ⇐⇒(ξ, η),

where (x, y) are the variables in the physical domain, and (ξ, η) are the variables

in the computational domain such that ξ = ξ(x, y) and η = η(x, y). To transform

back to the physical domain, we regard x = x(ξ, η) and y = y(ξ, η).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 323 / 454

Grids and Grid Generation Grid Generation

From the chain rule, the transformation laws are

∂

∂x

=

∂ξ

∂x

∂

∂ξ

+

∂η

∂x

∂

∂η

, (8.4)

∂

∂y

=

∂ξ

∂y

∂

∂ξ

+

∂η

∂y

∂

∂η

, (8.5)

where ξ

x

= ∂ξ/∂x, ξ

y

= ∂ξ/∂y, η

x

= ∂η/∂x, and η

y

= ∂η/∂y are called the

metrics of the transformation.

The Jacobian of the transformation is

J =

ξ

x

η

x

ξ

y

η

y

=

ξ

x

ξ

y

η

x

η

y

= ξ

x

η

y

−ξ

y

η

x

. (8.6)

Properties of the transformation:

1

Mapping must be one-to-one, which requires that J = 0.

2

We desire a smooth grid distribution; therefore, the metrics should be

smoothly varying throughout the domain.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 324 / 454

Grids and Grid Generation Grid Generation

3

We may want to enforce orthogonality of the grid (see Fletcher pp. 97-100).

Methods of obtaining the mapping:

1

Conformal mapping

See ﬁgure 1 for an example of a Schwarz-Christoﬀel transformation.

Diﬃcult to extend to 3-D.

For details, recall MMAE 501.

2

Algebraic transformation.

3

Elliptic grid generation, i.e. solution of partial diﬀerential equation.

4

Variational methods.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 325 / 454

Grids and Grid Generation Grid Generation

Algebraic Grid Generation

Consider, for example, the ﬂow in a diﬀuser:

The equation for the upper (sloped) boundary is

y

b

= f(x) = H

1

+

H

2

−H

1

L

x.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 326 / 454

Grids and Grid Generation Grid Generation

We seek to transform this physical domain into a rectangular computational

domain through the algebraic tranformation

ξ = x, η =

y

f(x)

. (8.7)

We then utilize a uniform grid in the computational domain (ξ, η).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 327 / 454

Grids and Grid Generation Grid Generation

The inverse transformation is then

x = ξ, y = f(x)η =

¸

H

1

+

H

2

−H

1

L

ξ

η, (8.8)

which produces a stretched grid in the physical domain.

Let us check the metrics of this transformation

∂ξ

∂x

= 1,

∂ξ

∂y

= 0,

∂η

∂x

= −y

f

(x)

f

2

(x)

= −

f

(ξ)

f(ξ)

η = −

H

2

−H

1

L

η

H

1

+

H

2

−H

1

L

ξ

,

∂η

∂y

=

1

f(x)

=

1

H

1

+

H

2

−H

1

L

ξ

.

See ﬁgure 2 for plots of these metrics, which show that they are smooth.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 328 / 454

Grids and Grid Generation Grid Generation

Let us transform the governing equations using the transformation laws (8.4) and

(8.5)

∂

∂x

=

∂ξ

∂x

∂

∂ξ

+

∂η

∂x

∂

∂η

=

∂

∂ξ

−η

f

(ξ)

f(ξ)

∂

∂η

,

∂

∂y

=

∂ξ

∂y

∂

∂ξ

+

∂η

∂y

∂

∂η

=

1

f(ξ)

∂

∂η

.

For example, consider the convection term

u(x, y)

∂u

∂x

= u(ξ, η)

¸

∂u

∂ξ

−η

f

(ξ)

f(ξ)

∂u

∂η

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 329 / 454

Grids and Grid Generation Grid Generation

Let us now consider another scenario in which we have a semi-inﬁnite

boundary-layer ﬂow above a surface.

We have introduced the boundary-layer variable Y such that

y = Re

−1/2

Y, 0 ≤ Y ≤ ∞.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 330 / 454

Grids and Grid Generation Grid Generation

We want a transformation that maps the semi-inﬁnite domain into a ﬁnite one

and clusters points near the surface. One possibility is

ξ = x, η =

2

π

tan

−1

Y

a

. (8.9)

This maps Y = 0 to η = 0 and Y = ∞ to η = 1, and reducing a concentrates

more grid points near the surface at y = 0 in the physical domain when using a

uniform grid in the computational (ξ, η) domain.

For an illustration, see ﬁgure 3 in which transformation (8.9) is used in the

x-direction and a stretching transformation similar to that for the diﬀuser is used

in the y-direction.

The transformation laws for the transformation (8.9) are

∂

∂x

=

∂

∂ξ

,

∂

∂Y

=

∂ξ

∂Y

∂

∂ξ

+

∂η

∂Y

∂

∂η

= Γ(η)

∂

∂η

,

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 331 / 454

Grids and Grid Generation Grid Generation

where

Γ(η) =

1

πa

[1 + cos(πη)] .

Then

∂

2

∂Y

2

= Γ(η)

∂

∂η

¸

Γ(η)

∂

∂η

= Γ

2

(η)

∂

2

∂η

2

+ Γ(η)Γ

(η)

∂

∂η

.

Notes:

1

Algebraic methods move the complexity, i.e. complex boundaries and/or

non-uniform grids, to the equations themselves.

Physical domain ⇒ “simple” equations; complex geometry and grid.

Computational domain ⇒ simple geometry and grid; “complex” equations.

2

Computational overhead is typically relatively small for algebraic methods, i.e.

there are no additional equations to solve.

3

It is easy to cluster grid points in the desired regions of the domain; however,

it is necessary to know where to cluster the grid points a priori.

4

Must choose the algebraic transformation ahead of time, i.e. before solving

the problem (cf. variational grid generation).

5

It is diﬃcult to handle complex geometries.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 332 / 454

Grids and Grid Generation Grid Generation

Elliptic Grid Generation

Consider the potential ﬂow past a cylinder:

The velocity potential and streamfunction both satisfy the Laplace equation

∂

2

φ

∂x

2

+

∂

2

φ

∂y

2

= 0,

∂

2

ψ

∂x

2

+

∂

2

ψ

∂y

2

= 0. (8.10)

Observe that the streamlines and isopotential lines would make a good grid on

which to obtain a numerical solution, i.e. φ →ξ, ψ →η.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 333 / 454

Grids and Grid Generation Grid Generation

Thus, an appropriate solution to

∂

2

ξ

∂x

2

+

∂

2

ξ

∂y

2

= 0,

∂

2

η

∂x

2

+

∂

2

η

∂y

2

= 0, (8.11)

would provide a good mapping on which to base the computational grid, i.e. a

uniform grid in (ξ, η) produces the above grid in physical space.

There are two approaches to obtaining the solution to (8.11):

1) Grid parameters are governed by the Laplace equation, i.e. they are harmonic;

therefore, we could utilize complex variables:

z = x +iy, ζ = ξ +iη.

This approach uses conformal mapping (see Fletcher, vol. II, pp. 89-96) and

is good for two-dimensional ﬂows in certain types of geometries.

2) Solve a boundary-value problem to generate the grid, i.e. elliptic grid

generation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 334 / 454

Grids and Grid Generation Grid Generation

In order to control grid clustering, known functions involving sources and sinks

may be added to the right-hand-side of equations (8.11)

∂

2

ξ

∂x

2

+

∂

2

ξ

∂y

2

= P(x, y),

∂

2

η

∂x

2

+

∂

2

η

∂y

2

= Q(x, y), (8.12)

where P and Q contain exponential functions. Note that equations (8.12) are for

ξ = ξ(x, y) and η = η(x, y).

We want to solve (8.12) in the computational domain (ξ, η) to obtain the grid

transformations x = x(ξ, η) and y = y(ξ, η). In addition, we must transform the

governing equation(s), e.g. Navier-Stokes, to the computational domain.

Therefore, we seek the transformation laws for (x, y) →(ξ, η).

For

ξ = ξ(x, y), η = η(x, y),

the total diﬀerentials are

dξ =

∂ξ

∂x

dx +

∂ξ

∂y

dy, dη =

∂η

∂x

dx +

∂η

∂y

dy,

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 335 / 454

Grids and Grid Generation Grid Generation

or in matrix form

¸

dξ

dη

=

¸

ξ

x

ξ

y

η

x

η

y

¸

dx

dy

. (8.13)

Similarly, for the inverse transformation from (ξ, η) to (x, y), we have that

¸

dx

dy

=

¸

x

ξ

x

η

y

ξ

y

η

¸

dξ

dη

.

We can solve the latter expression for [dξ dη]

T

by multiplying by the inverse

¸

dξ

dη

=

¸

x

ξ

x

η

y

ξ

y

η

−1

¸

dx

dy

=

¸

y

η

−x

η

−y

ξ

x

ξ

x

ξ

x

η

y

ξ

y

η

¸

dx

dy

¸

dξ

dη

=

1

J

¸

y

η

−x

η

−y

ξ

x

ξ

¸

dx

dy

**MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 336 / 454
**

Grids and Grid Generation Grid Generation

Comparing with equation (8.13), we see that

¸

ξ

x

ξ

y

η

x

η

y

=

1

J

¸

y

η

−x

η

−y

ξ

x

ξ

.

Thus, the transformation metrics are

∂ξ

∂x

=

1

J

∂y

∂η

,

∂ξ

∂y

= −

1

J

∂x

∂η

,

∂η

∂x

= −

1

J

∂y

∂ξ

,

∂η

∂y

=

1

J

∂x

∂ξ

.

Substituting into the transformation laws (8.4) and (8.5) give

∂

∂x

=

∂ξ

∂x

∂

∂ξ

+

∂η

∂x

∂

∂η

=

1

J

¸

∂y

∂η

∂

∂ξ

−

∂y

∂ξ

∂

∂η

,

∂

∂y

=

∂η

∂y

∂

∂η

+

∂ξ

∂y

∂

∂ξ

=

1

J

¸

∂x

∂ξ

∂

∂η

−

∂x

∂η

∂

∂ξ

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 337 / 454

Grids and Grid Generation Grid Generation

From these we obtain the second derivative transformation laws as follows

∂

2

∂x

2

=

∂

2

ξ

∂x

2

∂

∂ξ

+

∂

2

η

∂x

2

∂

∂η

+

∂ξ

∂x

2

∂

2

∂ξ

2

+

∂η

∂x

2

∂

2

∂η

2

+2

∂η

∂x

∂ξ

∂x

∂

2

∂η∂ξ

, (8.14)

and

∂

2

∂y

2

=

∂

2

ξ

∂y

2

∂

∂ξ

+

∂

2

η

∂y

2

∂

∂η

+

∂ξ

∂y

2

∂

2

∂ξ

2

+

∂η

∂y

2

∂

2

∂η

2

+ 2

∂η

∂y

∂ξ

∂y

∂

2

∂η∂ξ

, (8.15)

Application of equations (8.14) and (8.15) to equations (8.12) gives

g

22

∂

2

x

∂ξ

2

−2g

12

∂

2

x

∂ξ∂η

+g

11

∂

2

x

∂η

2

= −

1

J

2

¸

P

∂x

∂ξ

+Q

∂x

∂η

,

g

22

∂

2

y

∂ξ

2

−2g

12

∂

2

y

∂ξ∂η

+g

11

∂

2

y

∂η

2

= −

1

J

2

¸

P

∂y

∂ξ

+Q

∂y

∂η

,

(8.16)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 338 / 454

Grids and Grid Generation Grid Generation

where

g

11

=

∂x

∂ξ

2

+

∂y

∂ξ

2

,

g

12

=

∂x

∂ξ

∂x

∂η

+

∂y

∂ξ

∂y

∂η

,

g

22

=

∂x

∂η

2

+

∂y

∂η

2

.

Note that the coeﬃcients in the equations are deﬁned such that

g =

g

11

g

12

g

21

g

22

= J

2

, (g

12

= g

21

).

For boundary conditions to apply to equations (8.16), specify either:

1) Grid point locations (x, y) on boundaries.

2) Grid line slopes at the boundaries.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 339 / 454

Grids and Grid Generation Grid Generation

Therefore, we have a coupled set of nonlinear elliptic equations with Dirichlet or

Neumann boundary conditions. We solve (GS, SOR, ADI, multigrid, etc...)

equations (8.16) on a uniform grid in (ξ, η) to obtain the inverse transformation

x = x(ξ, η), y = y(ξ, η).

Notes:

1) Provides smoother grids than algebraic transformations due to use of

diﬀusion-type equations to generate grid.

→ Eﬀects of discontinuities at boundaries are smoothed out in interior.

2) Can enforce grid orthogonality.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 340 / 454

Grids and Grid Generation Grid Generation

3) Can treat multiply-connected regions (see ﬁgure 5).

4) Can extend to three-dimensional geometries (cf. conformal mapping).

5) Diﬃcult to choose P(ξ, η) and Q(ξ, η) for desired clustering. Generally, one

must use trial-and-error until something that “looks good” is obtained.

6) Large computational times are required to produce the grid, i.e. on the same

order as the time required to solve the governing equations.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 341 / 454

Grids and Grid Generation Grid Generation

7) References:

For more elliptic grid generation options, see Knupp, P. and Steinberg, S.,

“Fundamentals of Grid Generation,” CRC Press (1994), who consider

smoothness, Winslow and TTM methods.

Thompson, J. F., Warsi, Z. U. A. and Mastin, C. W., “Numerical Grid

Generation - Foundation and Applications,” North Holland (1985).

8) The ultimate in grid generation is adaptive grid methods, in which the grid

“adapts” to local features of the solution as it is computed; see, for example,

variational grid generation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 342 / 454

Grids and Grid Generation Grid Generation

Variational Grid Generation

Advantages:

Provides a more intuitive and mathematically formal basis for grid generation.

Generally formulated to produce the optimal, i.e. ”best,” grid in a least

squares sense; therefore, it eliminates the trial-and-error necessary in elliptic

grid generation.

One-Dimensional:

We determine functionals for which the stationary function(s) gives a

transformation in which the grid spacing ∆x

i

is proportional to a weight function

φ(ξ

i+1/2

).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 343 / 454

Grids and Grid Generation Grid Generation

Physical domain: a ≤ x ≤ b

Computational domain: 0 ≤ ξ ≤ 1

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 344 / 454

Grids and Grid Generation Grid Generation

Consider the following discrete functional

S =

I

¸

i=1

(x

i+1

−x

i

)

2

2φ

i+1/2

=

I

¸

i=1

∆x

2

i

2φ

i+1/2

,

where x

i

= x(ξ

i

), x

i+1

= x(ξ

i+1

) and φ

i+1/2

= (φ(ξ

i

) +φ(ξ

i+1

))/2. For a given

weight function φ(ξ), we want to minimize S subject to the end conditions

x

1

= a, x

I+1

= b.

Dividing the above expression by ∆ξ (= constant) gives

S

∆ξ

=

I

¸

i=1

∆x

i

∆ξ

2

∆ξ

2φ

i+1/2

.

Taking ∆ξ →0 gives the continuous functional

I[x(ξ)] =

1

2

1

0

(∂x/∂ξ)

2

φ(ξ)

dξ =

1

2

1

0

x

2

ξ

φ

dξ, (8.17)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 345 / 454

Grids and Grid Generation Grid Generation

with the end conditions

x(0) = a, x(1) = b.

This is known as the weighted length functional. We seek the grid distribution

x(ξ) that minimizes the functional I[x(ξ)].

With the integrand of the functional being

F = F(ξ, x, x

ξ

) =

1

2

x

2

ξ

φ

,

Euler’s equation is given by

∂F

∂x

−

d

dξ

∂F

∂x

ξ

= 0

−

d

dξ

x

ξ

φ

= 0 (8.18)

∴ x

ξξ

−

φ

ξ

φ

x

ξ

= 0, (φ > 0), (8.19)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 346 / 454

Grids and Grid Generation Grid Generation

with boundary conditions

x(0) = a, x(1) = b.

In order to see what this means for the grid spacing, let us consider equation

(8.18), which is

x

ξ

φ

ξ

= 0.

Integrating (with integration constant C) and multiplying by φ(ξ) gives

dx

dξ

= Cφ(ξ).

Writing this expression in discrete form yields

∆x

i

∆ξ

= C φ

ξ

i+1

+ξ

i

2

.

Therefore, we see that this requires that ∆x

i

be proportional to φ

i+1/2

, where the

proportionality constant is C∆ξ.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 347 / 454

Grids and Grid Generation Grid Generation

Note that the weight function φ(ξ) has been expressed in the computational

domain, and it is not necessarily clear how it should be chosen. Conceptually, we

prefer to think in terms of physical weight functions, say w(x). In that case, the

grid spacing is determined by a physical variable or one of its derivatives giving

rise to feature-adaptive grid generation.

Let us set the grid spacing to be proportional to [w(x)]

2

, i.e.

∆x

i

= K

¸

w

x

i+1

+x

i

2

2

.

Therefore, we take φ = w

2

> 0 in equation (8.17) giving the physical weight

length functional

I[x(ξ)] =

1

2

1

0

x

2

ξ

w

2

(x)

dξ, (8.20)

with x(0) = a, x(1) = b.

In this case, the integrand of the functional is

F = F(ξ, x, x

ξ

) =

1

2

x

2

ξ

w

2

(x)

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 348 / 454

Grids and Grid Generation Grid Generation

Therefore,

∂F

∂x

= −

w

x

w

3

x

2

ξ

,

∂F

∂x

ξ

=

x

ξ

w

2

,

and Euler’s equation gives

−

w

x

w

3

x

2

ξ

−

d

dξ

x

ξ

w

2

= 0

w

x

w

3

x

2

ξ

+

x

ξξ

w

2

−2

w

x

x

ξ

w

3

x

ξ

= 0

x

ξξ

−

w

x

w

x

2

ξ

= 0.

By the chain rule

d

dx

=

dξ

dx

d

dξ

=

1

x

ξ

d

dξ

⇒ w

x

=

1

x

ξ

w

ξ

.

Thus, the Euler equation is

x

ξξ

−

w

ξ

w

x

ξ

= 0, (w > 0), (8.21)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 349 / 454

Grids and Grid Generation Grid Generation

which is of the same form as (8.19) (this is why we set φ = w

2

), except that now

w(x) is a physical weight function. The boundary conditions are

x(0) = a, x(1) = b.

One-Dimensional Illustration:

Consider the one-dimensional, steady convection-diﬀusion equation

u

xx

−cu

x

= 0, a ≤ x ≤ b,

u(a) = 0, u(b) = 1,

(8.22)

where c is the convection speed. Increasing c produces an increasingly thin

boundary layer near x = b. The exact solution to (8.22) is

u(x) =

e

c(x−a)

−1

e

c(b−a)

−1

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 350 / 454

Grids and Grid Generation Grid Generation

The governing equation (8.22) and the grid equation must be transformed into

the computational domain. In one dimension, the transformation laws are

d

dx

=

dξ

dx

d

dξ

=

1

x

ξ

d

dξ

,

d

2

dx

2

=

1

x

ξ

d

dξ

¸

1

x

ξ

d

dξ

=

1

x

2

ξ

d

2

dξ

2

−

x

ξξ

x

3

ξ

d

dξ

.

Transforming the governing equation (8.22) to computational coordinates gives

1

x

2

ξ

d

2

u

dξ

2

−

x

ξξ

x

3

ξ

du

dξ

−c

1

x

ξ

du

dξ

= 0,

or

u

ξξ

−

x

ξξ

x

ξ

+cx

ξ

u

ξ

= 0, (8.23)

with boundary conditions

u(0) = 0, u(1) = 1.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 351 / 454

Grids and Grid Generation Grid Generation

To solve (8.23) for the velocity u(ξ) requires the grid x(ξ). Here we will use the

grid equation (8.21) (corresponding to the physical weighted-length functional

(8.20))

x

ξξ

−

w

ξ

w

x

ξ

= 0, (8.24)

with the boundary conditions x(0) = a, x(1) = b.

→ How to choose w(x)?

A common choice for a feature-adaptive weight function is based on the gradient

of the dependent variable of the form

w(x) =

1

1 +

2

u

2

x

, 0 < w ≤ 1, (8.25)

where is a parameter to be chosen. Observe that

u

x

small ⇒ w ≈ 1,

u

x

large ⇒ w ≈

1

[u

x

[

, ([u

x

[ ↑ ⇒w ↓ ⇒∆x ↓).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 352 / 454

Grids and Grid Generation Grid Generation

For use in the grid equation (8.24), we need the weight function (8.25) in terms of

the computational coordinate ξ:

w(x(ξ)) =

1

1 +

2

x

2

ξ

u

2

ξ

. (8.26)

Taking the derivative

w

ξ

= −

2

2

2

x

2

ξ

u

ξ

u

ξξ

−2

x

ξξ

x

3

ξ

u

2

ξ

1 +

2

x

2

ξ

u

2

ξ

3/2

=

2

x

2

ξ

u

ξ

x

ξξ

x

ξ

u

ξ

−u

ξξ

1 +

2

x

2

ξ

u

2

ξ

3/2

.

Therefore, the coeﬃcient in equation (8.24) is

w

ξ

w

=

2

u

ξ

x

ξξ

x

ξ

u

ξ

−u

ξξ

x

2

ξ

+

2

u

2

ξ

. (8.27)

Note: A uniform grid in the physical domain results if = 0 (w = 1, w

ξ

= 0), i.e.

x(ξ) = (b −a)ξ +a. Thus, increasing increases the inﬂuence of the

transformation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 353 / 454

Grids and Grid Generation Grid Generation

Numerical Procedure:

The governing equation (8.23) and the grid equation (8.24) (with (8.27)

expressed in the computational ξ-plane are

u

ξξ

−X(ξ)u

ξ

= 0, u(0) = 0, u(1) = 1, (8.28)

x

ξξ

−W(ξ)x

ξ

= 0, x(0) = a, x(1) = b, (8.29)

respectively, where

X(ξ) =

x

ξξ

x

ξ

+cx

ξ

,

W(ξ) =

w

ξ

w

.

Recall that the last expression is given by equation (8.27). Thus, we have

two coupled second-order linear ordinary diﬀerential equations. Note that all

of the grid transformation information is encapsulated in the X(ξ) coeﬃcient

in the governing equation, and all the weight function information is

contained in the W(ξ) coeﬃcient in the grid equation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 354 / 454

Grids and Grid Generation Grid Generation

Consider equation (8.28) approximated on the computational grid using

central diﬀerences

u

i+1

−2u

i

+u

i−1

∆ξ

2

−X

i

u

i+1

−u

i−1

2∆ξ

= 0.

Thus, we have the tridiagonal problem

A

i

u

i−1

+B

i

u

i

+C

i

u

i+1

= D

i

, i = 2, . . . , I,

where

A

i

= 1 +

∆ξ

2

X

i

,

B

i

= −2,

C

i

= 1 −

∆ξ

2

X

i

,

D

i

= 0.

We obtain a similar tridiagional problem for the grid equation (8.29).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 355 / 454

Grids and Grid Generation Grid Generation

See the Mathematica notebook ’GridGen.nb’

Two-Dimensional:

The two-dimensional analog to the one-dimensional weighted-length functional

(8.17) is

I[x, y] =

1

2

1

0

1

0

¸

x

2

ξ

+y

2

ξ

φ(ξ, η)

+

x

2

η

+y

2

η

ψ(ξ, η)

¸

dξdη,

where we now have two weight functions φ(ξ, η) > 0 and ψ(ξ, η) > 0. This

produces a grid for which the lengths of the coordinate lines are proportional to

the weight functions, i.e.

√

g

11

=

x

2

ξ

+y

2

ξ

= K

1

φ(ξ, η),

√

g

22

=

x

2

η

+y

2

η

= K

2

ψ(ξ, η).

Recall that g

11

and g

22

are deﬁned in section 8.4.2.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 356 / 454

Grids and Grid Generation Grid Generation

The Euler equations are then

x

ξ

φ

ξ

+

x

η

ψ

η

= 0,

y

ξ

φ

ξ

+

y

η

ψ

η

= 0.

Notes:

1) If φ = ψ = c, then the Euler equations are Laplace equations

x

ξξ

+x

ηη

= 0, y

ξξ

+y

ηη

= 0;

cf. elliptic grid generation.

2) The weight functions control the interior grid locations in a much more

formal manner than the P and Q forcing functions in elliptic grid generation.

That is, the local grid spacing is directly proportional to the speciﬁed weight

functions, which may be related directly to the physical solution.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 357 / 454

Grids and Grid Generation Grid Generation

Other functionals are also possible:

Area Functional:

The area of each cell, which is related to the Jacobian J, is proportional to a

weight function φ(ξ, η) > 0, i.e.

∴ I

A

[x, y] =

1

2

1

0

1

0

J

2

φ

dξdη.

Euler equations:

Jx

η

φ

ξ

−

Jx

ξ

φ

η

= 0,

Jy

η

φ

ξ

−

Jy

ξ

φ

η

= 0.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 358 / 454

Grids and Grid Generation Grid Generation

Orthogonality Functional:

The grid is orthogonal if g

12

= x

ξ

x

η

+y

ξ

y

η

= 0; therefore, the orthogonality

functional is

∴ I

O

[x, y] =

1

2

1

0

1

0

g

2

12

dξdη,

such that g

12

is minimized in a least squares sense (without a weight

function).

Euler equations:

(g

12

x

η

)

ξ

+ (g

12

x

ξ

)

η

= 0,

(g

12

y

η

)

ξ

+ (g

12

y

ξ

)

η

= 0.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 359 / 454

Grids and Grid Generation Grid Generation

Combination Functionals:

We can form combinations of the above functionals. For example, consider

the area-orthogonality functional

I

AO

[x, y] =

1

2

1

0

1

0

J

2

+g

2

12

φ

dξdη, =

1

2

1

0

1

0

g

11

g

22

φ

dξdη,

where again the fact that J

2

= g = g

11

g

22

−g

2

12

has been used.

This results in a grid such that the average of the area and orthogonality

functionals are minimized. One criteria could be emphasized over the other

by including weight coeﬃcients in the respective terms in the functional.

Euler equations:

g

22

x

ξ

φ

ξ

+

g

11

x

η

φ

η

= 0,

g

22

y

ξ

φ

ξ

+

g

11

y

η

φ

η

= 0.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 360 / 454

Grids and Grid Generation Grid Generation

Notes:

1) Just as in the one-dimensional case, it is generally preferable to deﬁne weight

functions in the physical domain, i.e. w(x, y), rather than in the

computational domain, i.e. φ(ξ, η).

2) The grid x(ξ, η), y(ξ, η) can be obtained by solving the Euler equations (most

common) or the variational form directly.

3) All of the two-dimensional functionals above have been written in the form

I[x, y] =

1

2

1

0

1

0

F(ξ, η, x, y, x

ξ

, y

ξ

, x

η

, y

η

)dξdη,

in order to determine the mappings x(ξ, η) and y(ξ, η). Alternatively,

functionals may be written to determine ξ(x, y) and η(x, y), i.e.

I[ξ, η] =

1

2

1

0

1

0

F(x, y, ξ, η, ξ

x

, η

x

, ξ

y

, η

y

)dxdy.

These are called contravariant functionals (see Knupps and Steinberg section

8.5 and chapter 11).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 361 / 454

Grids and Grid Generation Grid Generation

4) For unsteady problems additional terms are required in the governing

equations due to movement of the grid in the physical domain (the

computational grid (ξ, η) remains ﬁxed and uniform), i.e.

ξ = ξ(x, y, t), η = η(x, y, t).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 362 / 454

Hydrodynamic Stability and the Eigenproblem 1-D, Unsteady Diﬀusion Illustration

Outline

9

Hydrodynamic Stability and the Eigenproblem

1-D, Unsteady Diﬀusion Illustration

Exact Solution

Numerical Solution

Numerical Solution of the Eigenproblem

Similarity Transformation

QR Method to Obtain Eigenvalues and Eigenvectors

Plane Rotations

Arnoldi Method

Hydrodynamic Stability

Linearized Navier-Stokes Equations

Local Normal Mode Analysis

Numerical Solution of the Orr-Sommerfeld Equation

Example: Plane-Poiseuille Flow

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 363 / 454

Hydrodynamic Stability and the Eigenproblem 1-D, Unsteady Diﬀusion Illustration

Consider the one-dimensional, unsteady diﬀusion equation

∂u

∂t

= α

∂

2

u

∂x

2

, 0 ≤ x ≤ , (9.1)

with the boundary conditions

u(0, t) = 0, u(, t) = 0, (9.2)

and the initial condition

u(x, 0) = f(x). (9.3)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 364 / 454

Hydrodynamic Stability and the Eigenproblem 1-D, Unsteady Diﬀusion Illustration

Exact Solution

Let us begin by using the method of separation of variables to obtain an exact

solution for equation (9.1). We separate the variables according to

u(x, t) = φ(x)ψ(t). (9.4)

Substituting into equation (9.1) gives

φ

dψ

dt

= αψ

d

2

φ

dx

2

.

Moving everything depending upon t to the left-hand-side and everything

depending upon x to the right-hand-side, this becomes

1

αψ

dψ

dt

=

1

φ

d

2

φ

dx

2

= λ = −µ

2

.

Because the x and t dependence can be separated in this way, both sides of the

equation must be equal to a constant, say λ. Positive and zero λ produce only the

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 365 / 454

Hydrodynamic Stability and the Eigenproblem 1-D, Unsteady Diﬀusion Illustration

trivial solution for the boundary conditions given, so we consider the case where

λ = −µ

2

< 0.

Therefore, the partial diﬀerential equation (9.1) is converted into two ordinary

diﬀerential equations

d

2

φ

dx

2

+µ

2

φ = 0, (9.5)

dψ

dt

+αµ

2

ψ = 0, (9.6)

each of which are diﬀerential eigenproblems. The solution to equation (9.5) is

φ(x) = c

1

cos(µx) +c

2

sin(µx). (9.7)

The boundary condition u(0, t) = 0 requires that φ(0) = 0, which requires that

c

1

= 0. From the boundary condition u(, t) = 0, we must have φ() = 0, which

requires that sin(µ

n

) = 0. Therefore,

µ

n

=

nπ

, n = 1, 2, 3, . . . ,

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 366 / 454

Hydrodynamic Stability and the Eigenproblem 1-D, Unsteady Diﬀusion Illustration

and the eigenvalues are

λ

n

= −µ

2

n

= −

n

2

π

2

2

.

Letting c

2

= 1, we have the spatial eigenfunction

φ

n

(x) = sin

nπ

x

, n = 1, 2, 3, . . . (9.8)

The solution to (9.6) is

ψ

n

(t) = c

n

e

−αµ

2

n

t

, n = 1, 2, 3, . . . (9.9)

Then the eigenfunctions are

u(x, t) =

∞

¸

n=1

u

n

(x, t) =

∞

¸

n=1

φ

n

(x)ψ

n

(t) =

∞

¸

n=1

c

n

exp

−

αn

2

π

2

2

t

sin

nπ

x

.

(9.10)

The constants c

n

are determined by application of the initial condition (9.3), for

which

u(x, 0) =

∞

¸

n=1

c

n

sin

nπ

x

= f(x),

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 367 / 454

Hydrodynamic Stability and the Eigenproblem 1-D, Unsteady Diﬀusion Illustration

or

∞

¸

n=1

c

n

φ

n

(x) = f(x).

Taking the inner product of φ

m

(x) with both sides, the only non-vanishing term

(due to orthogonality of the eigenfunctions φ

n

(x)) occurs when m = n, giving

c

n

[[φ

n

(x)[[

2

= 'f(x), φ

n

(x)` ;

Therefore,

c

n

=

'f(x), φ

n

(x)`

[[φ

n

(x)[[

2

=

2

0

f(x) sin

nπ

x

dx, n = 1, 2, 3, . . . , (9.11)

which are the Fourier sine coeﬃcients of f(x). Thus, the exact solution to

(9.1)–(9.3) is given by equation (9.10) with (9.11).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 368 / 454

Hydrodynamic Stability and the Eigenproblem 1-D, Unsteady Diﬀusion Illustration

Numerical Solution

Now let us consider solving the diﬀerential eigenproblem (9.5), with boundary

conditions (9.2) numerically. Using central diﬀerences, the diﬀerential equation

becomes

φ

i+1

−2φ

i

+φ

i−1

(∆x)

2

= λφ

i

.

Thus, for i = 2, . . . , I (φ

1

= 0, φ

I+1

= 0), in matrix form we have

−2 1 0 0 0

1 −2 1 0 0

0 1 −2 0 0

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

0 0 0 −2 1

0 0 0 1 −2

¸

¸

¸

¸

¸

¸

¸

¸

¸

φ

2

φ

3

φ

4

.

.

.

φ

I−1

φ

I

¸

¸

¸

¸

¸

¸

¸

¸

¸

= (∆x)

2

λ

φ

2

φ

3

φ

4

.

.

.

φ

I−1

φ

I

¸

¸

¸

¸

¸

¸

¸

¸

¸

,

or

Aφ =

¯

λφ. (9.12)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 369 / 454

Hydrodynamic Stability and the Eigenproblem 1-D, Unsteady Diﬀusion Illustration

This is an algebraic eigenproblem for the eigenvalues

¯

λ = (∆x)

2

λ and the

eigenvectors φ, which are discrete approximations of the continuous eigenfunctions

(9.8).

Because A is tridiagonal with constants along each diagonal, we have a closed

form expression for the eigenvalues (see section 3.5). In general, of course, this is

not the case, and the eigenvalues (and eigenvectors) must be determined

numerically for a large matrix A.

See Mathematica notebook “1Ddiﬀ.nb” for a comparison of the eigenvalues

obtained numerically as described here versus the exact eigenvalues from the

previous section.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 370 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

Outline

9

Hydrodynamic Stability and the Eigenproblem

1-D, Unsteady Diﬀusion Illustration

Exact Solution

Numerical Solution

Numerical Solution of the Eigenproblem

Similarity Transformation

QR Method to Obtain Eigenvalues and Eigenvectors

Plane Rotations

Arnoldi Method

Hydrodynamic Stability

Linearized Navier-Stokes Equations

Local Normal Mode Analysis

Numerical Solution of the Orr-Sommerfeld Equation

Example: Plane-Poiseuille Flow

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 371 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

The standard method for numerically determining the eigenvalues and eigenvectors

of a matrix is based on QR decomposition, which entails performing a series of

similarity transformations. This is the approach used by the built-in Mathematica

and Matlab functions Eigenvalues[]/ Eigenvectors[] and eig(), respectively.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 372 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

Similarity Transformation

Consider the eigenproblem

Ax = λx, (9.13)

where A is a real, square matrix. Suppose that Q is an orthogonal matrix such

that Q

−1

= Q

T

. Let us consider the transformation

B = Q

T

AQ. (9.14)

Postmultiplying both sides by Q

T

x leads to

BQ

T

x = Q

T

AQQ

T

x,

= Q

T

Ax,

= Q

T

λx,

BQ

T

x = λQ

T

x.

Deﬁning y = Q

T

x, this can be written as

By = λy, (9.15)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 373 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

which is an eigenproblem for the matrix B deﬁned by the transformation (9.14).

Note that the eigenproblems (9.13) and (9.15) have the same eigenvalues λ;

therefore, we call equation (9.14) a similarity transformation because A and

B = Q

T

AQ have the same eigenvalues. This is the case because Q is orthogonal.

The eigenvectors of A, i.e. x, and B, i.e. y, are related by

y = Q

T

x (x = Qy) . (9.16)

If in addition to being real and square, A is symmetric such that A = A

T

,

observe that

B

T

= [Q

T

AQ]

T

= [Q]

T

[A]

T

[Q

T

]

T

= Q

T

AQ = B.

Therefore, if A is symmetric, B is symmetric as well when Q is orthogonal.

In summary, for A real and symmetric, the similarity transformation (9.14)

preserves the eigenvalues and symmetry of A, and the eigenvectors are related by

(9.16).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 374 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

QR Method to Obtain Eigenvalues and Eigenvectors

Having determined the properties of similarity transformations, we now turn our

attention to the iterative QR method for ﬁnding the eigenvalues and eigenvectors

of a matrix A, which requires such transformations.

Consider A real and symmetric, i.e. A = A

T

. A QR decomposition exists such

that

A = QR,

where Q is an orthogonal matrix, and R is an upper (“right”) triangular matrix.

Letting

A

0

= A, Q

0

= Q, R

0

= R,

the QR decomposition of the given matrix is

A

0

= Q

0

R

0

. (9.17)

Let us form the product (note order)

A

1

= R

0

Q

0

. (9.18)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 375 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

Because Q

0

is orthogonal, premultiplying equation (9.17) by Q

−1

0

= Q

T

0

gives

Q

T

0

A

0

= Q

T

0

Q

0

R

0

= R

0

.

Therefore, substituting for R

0

in (9.18) we may determine A

1

from

A

1

= Q

T

0

A

0

Q

0

, (9.19)

which is a similarity transformation. That is, taking R

0

Q

0

is equivalent to the

similarity transformation (9.19), and A

1

has the same eigenvalues as A

0

= A.

Thus, generalizing equation (9.18) we have

A

k+1

= R

k

Q

k

, k = 0, 1, 2, . . . (9.20)

where all A

1

, A

2

, . . . , A

k

, . . . are similar to A

0

= A. Not only do they all have

the same eigenvalues, the similarity transformations maintain the same structure

as A, e.g. tridiagonal.

It can be shown (not easily) that the sequence of similar matrices

A

0

, A

1

, A

2

, . . .

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 376 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

gets progressively closer, i.e. converges, to a diagonal or upper triangular matrix if

A is symmetric or non-symmetric, respectively. In either case, the eigenvalues of

A (and A

1

, A

2

, . . .) are on the main diagonal in increasing order by absolute

magnitude.

But how do we determine the Q and R matrices for each iteration?

⇒ Plane rotations.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 377 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

Plane Rotations

Consider the n n transformation matrix P comprised of the identity matrix with

only four elements changed in the p

th

and q

th

rows and columns according to

P

pp

= P

qq

= c, P

pq

= s, P

qp

= −s,

where c = cos φ and s = sin φ. That is,

P =

1

.

.

.

1

c 0 0 s

0 1 0

.

.

.

.

.

.

.

.

.

0 1 0

−s 0 0 c

1

.

.

.

1

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 378 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

Observe the eﬀect of transforming a n-D vector x according to the tranformation

y = Px. (9.21)

where x

T

= [x

1

x

2

x

p

x

q

x

n

]. Then

y = Px =

x

1

x

2

.

.

.

y

p

.

.

.

y

q

.

.

.

x

n

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

,

where the only two elements that are altered are

y

p

= cx

p

+sx

q

, (9.22)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 379 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

y

q

= −sx

p

+cx

q

. (9.23)

For example, consider the case for n = 2, i.e. p = 1, q = 2

y

1

= cx

1

+sx

2

,

y

2

= −sx

1

+cx

2

,

or

¸

y

1

y

2

=

¸

cos φ sin φ

−sin φ cos φ

¸

x

1

x

2

.

This transformation rotates the vector x through an angle φ to obtain y. Note

that y = P

T

x rotates the vector x through an angle −φ.

Thus, in the general n-D case (9.21), P rotates the vector x through an angle φ

in the x

p

x

q

-plane.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 380 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

Notes:

1

The transformation matrix P is orthogonal, i.e. P

T

= P

−1

.

2

We can generalize to rotate a set of vectors, i.e. a matrix, by taking

Y = PX.

3

The angle φ may be chosen with one of several objectives in mind. For

example,

i) To zero all elements below (or to the right of) a speciﬁed element, e.g.

y

T

= [y

1

y

2

· · · y

j

0 · · · 0].

Householder transformation (reﬂection) – eﬃcient for dense matrices.

ii) To zero a single element, e.g. y

p

or y

q

(see equations (9.22) and (9.23)).

Givens transformation (rotation) – eﬃcient for sparse, structured (e.g. banded)

matrices.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 381 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

We can imagine a series of Givens or Householder transformations that reduce the

matrix A to a matrix that is upper triangular, which is the R matrix in a QR

decomposition.

Thus, if m projections are required to produce an upper triangular matrix, R is

given by

R = P

m

P

2

P

1

A. (9.24)

Because A = QR, i.e. R = Q

T

A, the orthogonal matrix Q is then obtained from

Q

T

= P

m

P

2

P

1

.

Taking the transpose leads to

Q = P

T

1

P

T

2

P

T

m

. (9.25)

See Mathematica notebook “QRmethod.nb” for an illustration of how QR

decomposition is used in an iterative algorithm to obtain the eigenvalues of a

matrix.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 382 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

Notes:

1

The QR decomposition (9.24) and (9.25) is obtained from a series of plane

(Givens or Householder) rotations.

2

Givens transformations are most eﬃcient for large, sparse, structured

matrices.

→ Conﬁgure to only zero elements that are not already zero.

3

There is a “fast Givens transformation” for which the P matrices are not

orthogonal, but the QR decompositions can be obtained two times faster

than in the standard Givens transformation illustrated in “QRmethod.nb.”

4

Convergence of the iterative QR method may be accelerated using shifting

(see, for example, Numerical Recipes, section 11.3).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 383 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

5

The order of operations for the QR method per iteration are as follows:

Dense matrix → O(n

3

) ⇒ Very expensive.

Hessenberg matrix → O(n

2

)

Tridiagonal matrix → O(n).

Thus, the most eﬃcient procedure is as follows:

i) Transform A to a similar tridiagonal or Hessenberg form if A is symmetric or

non-symmetric, respectively.

→ This is done using a series of similarity transformations based on Householder

rotations for dense matrices or Givens rotations for sparse matrices.

ii) Use iterative QR method to obtain eigenvalues of tridiagonal or Hessenberg

matrix.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 384 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

Arnoldi Method

The Arnoldi method has been developed to treat situations in which we only need

a small number of eigenvalues of a large sparse matrix:

1

The iterative QR method described in the previous section is the general

approach used to obtain the full spectrum of eigenvalues of a dense matrix.

2

As we saw in the 1-D unsteady diﬀusion example, and as we will see when we

evaluate hydrodynamic stability, we often seek the eigenvalues of large sparse

matrices.

3

In addition, we often do not require the full spectrum of eigenvalues in

stability problems as we only seek the “least stable mode.”

⇒ We would like an eﬃcient algorithm that determines a subset of the full

sprectrum of eigenvalues (and possibly eigenvectors) of a sparse matrix.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 385 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

Suppose we seek the largest k eigenvalues (by magnitude) of the large sparse

n n matrix A, where k <n. Given an arbitrary n-D vector q

0

, we deﬁne the

Krylov subspace by

/

k

(A, q

0

) = span

¸

q

0

, Aq

0

, A

2

q

0

, . . . , A

k−1

q

0

¸

,

which has dimension k and is a subspace of 1

n

.

The Arnoldi method is based on constructing an orthonormal basis, e.g. using

Gram-Schmidt, of the Krylov subspace /

k

that can be used to project a general

n n matrix A onto the k-D Krylov subspace /

k

(A, q

0

).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 386 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

We form the orthonormal projection matrix Q using the following step-by-step

(non-iterative) method that produces a Hessenberg matrix H whose eigenvalues

approximate the largest k eigenvalues of A:

1

Specify starting Arnoldi vector q

0

.

2

Normalize: q

1

= q

0

/[[q

0

[[.

3

Set Q = q

1

.

4

Do i = 2, k

i) Multiply q

i

= Aq

i−1

.

ii) Orthogonalize q

i

against q

1

, q

2

, . . . , q

i−1

.

iii) Append q

i

to Q.

iv) Form the Hessenberg matrix H = Q

T

AQ.

v) Determine the eigenvalues of H.

5

End Do

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 387 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

At each step i = 2, . . . , k:

→ An n i orthonormal matrix Q is produced that forms an orthonormal basis

for the Krylov subspace /

i

(A, q

0

).

→ Using the projection matrix Q, we transform A to produce an i i

Hessenberg matrix H (or tridiagonal for symmetric A), which is an

orthogonal projection of A onto the Krylov subspace /

i

.

→ The eigenvalues of H, sometimes called the Ritz eigenvalues, approximate

the largest i eigenvalues of A.

The approximations of the eigenvalues improve as each step is incorporated, and

we obtain the approximation of one additional eigenvalue.

Notes:

1

Because k <n, we only require the determination of eigenvalues of

Hessenberg matrices that or no larger than k k as opposed to the original

n n matrix A.

2

Although the outcome of each step depends upon the starting Arnoldi vector

q

0

used, the procedure converges to the correct eigenvalues of matrix A.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 388 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

3

The more sparse the matrix A is, the smaller k can be to obtain a good

approximation of the largest k eigenvalues of A.

4

When applied to symmetric matrices, the Arnoldi method reduces to the

Lanczos method.

5

A shift and invert approach can be incorporated to determine the k

eigenvalues close to a speciﬁed part of the spectrum rather than that with

the largest magnitude.

For example, it can be designed to determine the k eigenvalues with the

largest real or imaginary part.

6

When seeking a set of eigenvalues in a particular portion of the full spectrum,

it is desirable that the starting Arnoldi vector q

0

be in (or ‘nearly’ in) the

subspace spanned by the eigenvectors corresponding to the sought after

eigenvalues.

As the Arnoldi method progresses, we get better approximations of the desired

eigenvectors that can then be used to form a more desirable starting vector.

This is known as the implicitly restarted Arnoldi method and is based on the

implicitly-shifted QR decomposition method.

Restarting also reduces storage requirements by keeping k small.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 389 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

7

The Arnoldi method may also be adapted to solve linear systems of

equations; this is called the generalized minimal residual (GMRES) method.

8

The Arnoldi method can be designed to apply to the generalized eigenproblem

Ax = λBx.

The generalized eigenproblem will be encountered in hydrodynamic stability.

It also arises in structural design problems in which A is called the stiﬀness

matrix, and B is called the mass matrix.

Application of Arnoldi’s method to the generalized eigenproblem requires that

B be positive deﬁnite, i.e. have all positive eigenvalues.

9

Many have standardized on the Arnoldi method as implemented in ARPACK

(http://www.caam.rice.edu/software/ARPACK/).

ARPACK was developed at Rice University in the mid 1990’s, ﬁrst as a Fortran

77 library of subroutines, and subsequently it has been implemented as

ARPACK

++

for C

++

.

ARPACK has been implemented in Matlab via the eigs() function, where the

‘s’ denotes ‘sparse.’

In addition, it has been implemented in Mathematica, where one includes the

option ‘Method → Arnoldi’ in the Eigenvalues[] function.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 390 / 454

Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem

The Arnoldi method is illustrated in more detail in the Mathematica notebook

“Arnoldi.nb.”

References:

Arnoldi, W. (1951) Q. Appl. Math. 9, 17.

Nayar, N. & Ortega, J. M. (1993) “Computation of Selected Eigenvalues of

Generalized Eigenvalue Problems.” J. Comput. Phys. 108, pp. 8–14.

Saad, Y. Iterative Methods for Sparse Linear Systems SIAM, Philadelphia

(2003).

Radke, R. A Matlab Implementation of the Implicitly Restarted Arnoldi

Method for Solving Large-Scale Eigenvalue Problems, MS Thesis, Rice

University (1996).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 391 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

Outline

9

Hydrodynamic Stability and the Eigenproblem

1-D, Unsteady Diﬀusion Illustration

Exact Solution

Numerical Solution

Numerical Solution of the Eigenproblem

Similarity Transformation

QR Method to Obtain Eigenvalues and Eigenvectors

Plane Rotations

Arnoldi Method

Hydrodynamic Stability

Linearized Navier-Stokes Equations

Local Normal Mode Analysis

Numerical Solution of the Orr-Sommerfeld Equation

Example: Plane-Poiseuille Flow

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 392 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

Linearized Navier-Stokes Equations

Consider the nondimensional Navier-Stokes equations for 2-D, incompressible ﬂow

∂u

∂x

+

∂v

∂y

= 0, (9.26)

∂u

∂t

+u

∂u

∂x

+v

∂u

∂y

= −

∂p

∂x

+

1

Re

¸

∂

2

u

∂x

2

+

∂

2

u

∂y

2

, (9.27)

∂v

∂t

+u

∂v

∂x

+v

∂v

∂y

= −

∂p

∂y

+

1

Re

¸

∂

2

v

∂x

2

+

∂

2

v

∂y

2

. (9.28)

We denote the solution to (9.26)–(9.28), i.e. the base ﬂow, by u

0

(x, y, t),

v

0

(x, y, t) and p

0

(x, y, t), and seek the behavior of small perturbations to this

base ﬂow.

⇒ If the amplitude of the small perturbations grow, the ﬂow is

hydrodynamically unstable.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 393 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

Two possibilities may be considered:

1

Temporal analysis – amplitude of spatial perturbation (e.g. wavy wall)

grows/decays with time.

⇒ Absolutely unstable/stable.

2

Spatial analysis – amplitude of temporal perturbation (e.g. vibrating ribbon)

grows/decays in space.

⇒ Convectively unstable/stable.

For inﬁnitesimally small perturbations ( <1), the ﬂow may be decomposed as

follows

u(x, y, t) = u

0

(x, y, t) +ˆ u(x, y, t),

v(x, y, t) = v

0

(x, y, t) +ˆ v(x, y, t),

p(x, y, t) = p

0

(x, y, t) +ˆ p(x, y, t).

(9.29)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 394 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

Substituting into (9.26)–(9.28) gives

∂u

0

∂x

+

∂ˆ u

∂x

+

∂v

0

∂y

+

∂ˆ v

∂y

= 0,

∂u

0

∂t

+

∂ˆ u

∂t

+ (u

0

+ˆ u)

∂u

0

∂x

+

∂ˆ u

∂x

+ (v

0

+ˆ v)

∂u

0

∂y

+

∂ˆ u

∂y

= −

∂p

0

∂x

−

∂ˆ p

∂x

+

1

Re

¸

∂

2

u

0

∂x

2

+

∂

2

ˆ u

∂x

2

+

∂

2

u

0

∂y

2

+

∂

2

ˆ u

∂y

2

,

∂v

0

∂t

+

∂ˆ v

∂t

+ (u

0

+ˆ u)

∂v

0

∂x

+

∂ˆ v

∂x

+ (v

0

+ˆ v)

∂v

0

∂y

+

∂ˆ v

∂y

= −

∂p

0

∂y

−

∂ˆ p

∂y

+

1

Re

¸

∂

2

v

0

∂x

2

+

∂

2

ˆ v

∂x

2

+

∂

2

v

0

∂y

2

+

∂

2

ˆ v

∂y

2

.

As expected, the O(1) terms are simply the Navier-Stokes equations (9.26)–(9.28)

for the base ﬂow u

0

, v

0

and p

0

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 395 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

The O() terms for the disturbance ﬂow are

∂ˆ u

∂x

+

∂ˆ v

∂y

= 0, (9.30)

∂ˆ u

∂t

+u

0

∂ˆ u

∂x

+v

0

∂ˆ u

∂y

+

∂u

0

∂x

ˆ u +

∂u

0

∂y

ˆ v = −

∂ˆ p

∂x

+

1

Re

¸

∂

2

ˆ u

∂x

2

+

∂

2

ˆ u

∂y

2

, (9.31)

∂ˆ v

∂t

+u

0

∂ˆ v

∂x

+v

0

∂ˆ v

∂y

+

∂v

0

∂x

ˆ u +

∂v

0

∂y

ˆ v = −

∂ˆ p

∂y

+

1

Re

¸

∂

2

ˆ v

∂x

2

+

∂

2

ˆ v

∂y

2

. (9.32)

Because is small, we neglect O(

2

) terms. Thus, the evolution of the

disturbances are governed by the linearized Navier-Stokes (LNS) equations

(9.30)–(9.32), where the base ﬂow is known.

⇒ Linear Stability Theory

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 396 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

In principle, we could impose a perturbation ˆ u, ˆ v, ˆ p at any time t

i

and track its

evolution in time and space to determine if the ﬂow is stable to the imposed

perturbation. To fully characterize the stability of the base ﬂow, however, would

require many calculations of the LNS equations with diﬀerent perturbation

“shapes” imposed at diﬀerent times.

We can formulate a more manageable stability problem by doing one or both of

the following:

1

Consider simpliﬁed base ﬂows.

2

Impose “well-behaved” perturbations.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 397 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

Local Normal Mode Analysis

Classical linear stability analysis takes advantage of both simpliﬁcations mentioned

above:

1

Base ﬂow:

i) Steady

⇒

∂u

0

∂t

=

∂v

0

∂t

= 0. (9.33)

ii) Parallel (e.g. Poiseuille ﬂow)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 398 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

⇒u

0

= u

0

(y), v

0

= 0, p

0

= p

0

(x). (9.34)

2

Perturbations – we impose normal modes for ˆ u, ˆ v, ˆ p of the form (temporal

analysis):

ˆ u(x, y, t) = u

1

(y)e

i(αx−αct)

,

ˆ v(x, y, t) = v

1

(y)e

i(αx−αct)

,

ˆ p(x, y, t) = p

1

(y)e

i(αx−αct)

,

(9.35)

where α is the wavenumber, which is real, and c = c

r

+ic

i

is the complex

wavespeed. Note that the wavelength of the disturbance is proportional to

1/α.

Notes:

1

It is understood that we take the real parts of (9.35) (or add complex

conjugate).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 399 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

2

Consider the disturbances, e.g.

ˆ u(x, y, t) = Re

u

1

(y)e

i(αx−αct)

, c = c

r

+ic

i

= Re

u

1

(y)e

αc

i

t

e

αi(x−c

r

t)

,

= Re [u

1

(y)e

αc

i

t

¦cos[α(x −c

r

t)] +i sin[α(x −c

r

t)]¦] ,

ˆ u(x, y, t) = u

1

(y)e

αc

i

t

cos[α(x −c

r

t)]

⇒ Sine wave with wavenumber α and phase velocity c

r

, i.e. normal mode.

If c

i

> 0, the amplitude of the perturbation grows unbounded as t →∞ with

growth rate αc

i

.

3

Because equations (9.30)–(9.32) are linear, each normal mode with

wavenumber α may be considered independently of one another (cf. von

Neumann numerical stability analysis).

⇒ For a given mode α, we are looking for the eigenvalue (wavespeed) with the

fastest growth rate.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 400 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

4

This is regarded as a “local” analysis because the stability of only one

velocity proﬁle (9.34), i.e. at a single streamwise location, is considered at a

time due to the parallel-ﬂow assumption.

5

In some cases, the parallel ﬂow assumption can be justiﬁed on formal grounds

if the wavelength is such that 1/α <L, where L is a typical streamwise

length scale in the ﬂow.

6

For the temporal analysis considered here, α is real and c is complex. For a

spatial analysis, α is complex and c is real.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 401 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

For steady, parallel base ﬂow (9.33) and (9.34), the Navier-Stokes equations

(9.26)–(9.28) reduces to (from equation (9.27))

d

2

u

0

dy

2

= Re

∂p

0

∂x

, (9.36)

where Rep

0

(x) is a constant for Poiseuille ﬂow. The disturbance equations

(9.30)–(9.32) become

∂ˆ u

∂x

+

∂ˆ v

∂y

= 0, (9.37)

∂ˆ u

∂t

+u

0

∂ˆ u

∂x

+

∂u

0

∂y

ˆ v = −

∂ˆ p

∂x

+

1

Re

¸

∂

2

ˆ u

∂x

2

+

∂

2

ˆ u

∂y

2

, (9.38)

∂ˆ v

∂t

+u

0

∂ˆ v

∂x

= −

∂ˆ p

∂y

+

1

Re

¸

∂

2

ˆ v

∂x

2

+

∂

2

ˆ v

∂y

2

. (9.39)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 402 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

Substitution of the normal modes (9.35) into the disturbance equations

(9.37)–(9.39) leads to

αiu

1

+v

1

= 0, (9.40)

αi(u

0

−c)u

1

+u

0

v

1

= −αip

1

+

1

Re

(u

1

−α

2

u

1

), (9.41)

αi(u

0

−c)v

1

= −p

1

+

1

Re

(v

1

−α

2

v

1

), (9.42)

where primes denote diﬀerentiation with respect to y.

Solving equation (9.40) for u

1

and substituting into equation (9.41) results in

−(u

0

−c)v

1

+u

0

v

1

= −αip

1

−

1

αi

1

Re

(v

1

−α

2

v

1

), (9.43)

leaving equations (9.42) and (9.43) for v

1

(y) and p

1

(y). Solving equation (9.43)

for p

1

(y), diﬀerentiating and substituting into equation (9.42) leads to

(u

0

−c)(v

1

−α

2

v

1

) −u

0

v

1

=

1

αi

1

Re

(v

1

−2α

2

v

1

+α

4

v

1

), (9.44)

which is the Orr-Sommerfeld equation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 403 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

Notes:

1

For a given base ﬂow u

0

(y), Reynolds number Re, and wavenumber α, the

Orr-Sommerfeld equation is a diﬀerential eigenproblem of the form

L

1

v

1

= cL

2

v

1

,

where the wavespeeds c are the (complex) eigenvalues, the disturbance

velocities v

1

(y) are the eigenfunctions, and L

1

and L

2

are diﬀerential

operators.

2

The Orr-Sommerfeld equation applies for steady, parallel, viscous ﬂow

perturbed by inﬁnitesimally small normal modes, which is a local analysis.

3

For inviscid ﬂow, i.e. as Re →∞, the Orr-Sommerfeld equation reduces to

the Rayleigh equation

(u

0

−c)(v

1

−α

2

v

1

) −u

0

v

1

= 0.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 404 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

4

For non-parallel ﬂows, a signiﬁcantly more involved global stability analysis is

required in which the base ﬂow is 2-D, i.e.

u

0

= u

0

(x, y), v

0

= v

0

(x, y), p

0

= p

0

(x, y),

and the perturbations are of the form

ˆ u(x, y, t) = u

1

(x, y)e

−ict

,

ˆ v(x, y, t) = v

1

(x, y)e

−ict

,

ˆ p(x, y, t) = p

1

(x, y)e

−ict

,

in place of equation (9.35).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 405 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

Numerical Solution of the Orr-Sommerfeld Equation

Recall that the continuous diﬀerential eigenproblem (9.44), i.e. the

Orr-Sommerfeld equation, is of the form

L

1

v

1

= cL

2

v

1

.

We seek a corresponding discrete, i.e. algebraic, generalized eigenproblem of the

form

M(α, Re)v = cN(α)v, (9.45)

where we have dropped the subscript on v. Let us rewrite the Orr-Sommerfeld

equation in the form

¸

i

αRe

v

+P

j

v

+Q

j

v

= c

v

−α

2

v

, (9.46)

where

P(y

j

) = u

0

(y

j

) −

2αi

Re

,

Q(y

j

) =

α

3

i

Re

−α

2

u

0

(y

j

) −u

0

(y

j

).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 406 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

To discretize equation (9.46) using central diﬀerences, we take

d

2

v

dy

2

=

v

j+1

−2v

j

+v

j−1

(∆y)

2

+O(∆y

2

),

d

4

v

dy

4

=

v

j+2

−4v

j+1

+ 6v

j

−4v

j−1

+v

j−2

(∆y)

4

+O(∆y

2

).

Substituting these approximations into equation (9.46) and collecting terms leads

to the diﬀerence equation

[Cv

j−2

+B

j

v

j−1

+A

j

v

j

+B

j

v

j+1

+Cv

j+2

] = c

¯

Bv

j−1

+

¯

Av

j

+

¯

Bv

j+1

,

(9.47)

where

A

j

=

6i

αRe

+ (∆y)

2

(∆y)

2

Q

j

−2P

j

,

B

j

= −

4i

αRe

+ (∆y)

2

P

j

,

C =

i

αRe

,

¯

A = −(∆y)

2

2 +α

2

(∆y)

2

,

¯

B = (∆y)

2

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 407 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

Because the Orr-Sommerfeld equation is 4

th

-order, we need two boundary

conditions at each boundary. For solid surfaces at y = a, b, we set

v = v

= 0, at y = a, b. (9.48)

Because v is known at y = a, b, i.e. v

1

= v

J+1

= 0, the unknowns are

v

j

, j = 2, . . . , J.

Applying equation (9.47) at j = 2, we have

¸

Cv

0

+B

2

&

&b

0

v

1

+A

2

v

2

+B

2

v

3

+Cv

4

= c

¸

¯

B

&

&b

0

v

1

+

¯

Av

2

+

¯

Bv

3

,

and from v

= 0 at y = a (j = 1)

v

2

−v

0

2∆y

= 0 ⇒ v

0

= v

2

.

Substituting into the diﬀerence equation for j = 2 results in

[(C +A

2

)v

2

+B

2

v

3

+Cv

4

] = c

¯

Av

2

+

¯

Bv

3

. (9.49)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 408 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

Similarly, for j = J

[Cv

J−2

+B

J

v

J−1

+ (C +A

J

)v

J

] = c [Bv

J−1

+Av

J

] . (9.50)

Also for j = 3, J −1, we have v

1

= v

J+1

= 0. Therefore, the matrices in the

algebraic form of the eigenproblem (9.45) are

M(α, Re) =

C +A

2

B

2

C 0 0 0 0 0 0

B

3

A

3

B

3

C 0 0 0 0 0

C B

4

A

4

B

4

C 0 0 0 0

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

0 0 0 0 0 C B

J−1

A

J−1

B

J−1

0 0 0 0 0 0 C B

J

C +A

J

¸

¸

¸

¸

¸

¸

¸

¸

¸

,

N(α) =

¯

A

¯

B 0 0 0 0 0

¯

B

¯

A

¯

B 0 0 0 0

0

¯

B

¯

A

¯

B 0 0 0

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

0 0 0 0

¯

B

¯

A

¯

B

0 0 0 0 0

¯

B

¯

A

¸

¸

¸

¸

¸

¸

¸

¸

¸

,

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 409 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

and the eigenvector is v

T

= [v

2

v

3

v

J

]. Thus, M is pentadiagonal, and N is

tridiagonal.

The (large) generalized eigenproblem (9.45) must be solved to obtain the complex

wavespeeds c, i.e. the eigenvalues, and the discretized eigenfunctions v(y) for a

given α and Re.

Notes:

1

The J −1 eigenvalues obtained approximate the inﬁnity of eigenvalues of the

continuous diﬀerential eigenproblem (9.44), i.e. the Orr-Sommerfeld

equation.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 410 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

2

The least stable mode, i.e. that with the fastest growth rate αc

i

, is given by

αmax(c

i

).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 411 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

3

A marginal stability curve may be obtained by determining max(c

i

) for a

range of Re and α and plotting the max(c

i

) = 0 contour:

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 412 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

Methods of Solution:

1

Convert the generalized eigenproblem (9.45) to a regular eigenproblem by

multiplying both sides by the inverse of N. That is, ﬁnd the eigenvalues from

N

−1

M−cI

= 0.

This requires inverting a large matrix, and although M and N are typically

sparse and banded, N

−1

M is a full, dense matrix.

⇒ This would require use of a general approach, such as the iterative QR

method, to determine the eigenvalues of a large, dense matrix.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 413 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

2

In order to avoid solving the large matrix problem that results from the BVP,

traditionally the shooting method for IVPs has been used.

→ This approach avoided the need to ﬁnd the eigenvalues of large matrices in the

days when computers were not capable of such large calculations.

→ In addition, it allowed for use of well-developed algorithms for IVPs.

→ However, this is like “using a hammer to drive a screw.”

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 414 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

3

Solve the generalized eigenproblem

Mv = cNv,

where M and N are large, sparse matrices, for the least stable mode. In

addition to the fact that the matrices are sparse, in stability contexts such as

this, we only need the least stable mode, not the entire spectrum of

eigenvalues. Recall that the least stable mode is that with the largest

imaginary part.

→ Currently, the state-of-the-art in such situations is the Arnoldi method

discussed in the last section.

Note that N must be positive deﬁnite for use in the Arnoldi method. That is,

it must have all positive eigenvalues. In our case, this requires us to take the

negatives of the matrices M and N as deﬁned above.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 415 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

Example: Plane-Poiseuille Flow

As an illustration, let us consider stability of Plane-Poiseuille ﬂow, i.e.

pressure-driven ﬂow in a channel.

Such a ﬂow is parallel; therefore, the base ﬂow is a solution of equation (9.36).

The solution is a parabolic velocity proﬁle given by

u

0

(y) = y(2 −y), 0 ≤ y ≤ 2. (9.51)

Note that the base ﬂow is independent of the Reynolds number.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 416 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

See the Mathematica notebook “OS Psvll.nb” for a solution of the

Orr-Sommerfeld equation using the approach outlined in the previous section.

→ This notebook calculates the complex wavespeeds, i.e. the eigenvalues, for a

given wavenumber α and Reynolds number Re in order to evaluate stability.

→ Recall that a ﬂow is unstable if the imaginary part of one of the discrete

eigenvalues is positive, i.e. max(c

i

) > 0. The growth rate of the instability is

then αmax(c

i

).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 417 / 454

Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability

By performing a large number of such calculations for a range of wavenumbers

and Reynolds numbers, we can plot the marginal stability curve for

plane-Poiseuille ﬂow. This shows the curve in α-Re parameter space for which

max(c

i

) = 0 delineating the regions of parameter space in which the ﬂow is stable

and unstable to normal-mode perturbations.

5000 6000 7000 8000 9000 10000

0.80

0.85

0.90

0.95

1.00

1.05

1.10

Thus, the critical Reynolds number is approximately Re

c

= 5, 800.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 418 / 454

Numerical Modeling of Turbulent Flows Introduction

Outline

10

Numerical Modeling of Turbulent Flows

Introduction

Direct Numerical Simulation

Large-Eddy Simulation

Reynolds Averaged Navier-Stokes

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 419 / 454

Numerical Modeling of Turbulent Flows Introduction

Turbulent ﬂows are characterized by the following:

They are highly unsteady ⇒ Seemingly random ﬂuctuations of velocity about

a mean.

They are inherently three-dimensional due to velocity ﬂuctuations (even if the

mean ﬂow is two-dimensional).

They involve a wide range of temporal and spatial scales.

Thus, turbulent ﬂows are very diﬃcult to model numerically.

There are three basic approaches (given in increasing degree of approximation):

1) Direct Numerical Simulation (DNS):

Navier-Stokes equations are solved for all scales. ⇒ Very ﬁne grids are

required.

2) Large Eddy Simulation (LES):

Recognize that only the large-scale motions depend on the macroscopic

features of the particular ﬂow, and that the small-scale features are similar for

certain classes of turbulent ﬂows. ⇒ Solve numerically for large scales and

model small scales.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 420 / 454

Numerical Modeling of Turbulent Flows Introduction

3) Reynolds Averaged Navier-Stokes (RANS):

Solve numerically the time averaged Navier-Stokes equations for the mean

ﬂow.

Requires turbulence models for closure of the governing equations.

Summarizing:

DNS ⇒ no turbulence modeled.

LES ⇒ some, i.e. small-scale, turbulence modeled.

RANS ⇒ all turbulence modeled.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 421 / 454

Numerical Modeling of Turbulent Flows Direct Numerical Simulation

Outline

10

Numerical Modeling of Turbulent Flows

Introduction

Direct Numerical Simulation

Large-Eddy Simulation

Reynolds Averaged Navier-Stokes

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 422 / 454

Numerical Modeling of Turbulent Flows Direct Numerical Simulation

In DNS all scales must be resolved.

Consider the following deﬁnitions:

= rate of dissipation of turbulent kinetic energy

l

K

=

ν

3

1/4

= Kolmogorov scale (size of the smallest turbulent eddies)

L = length scale of large eddies

Re

L

= Reynolds number based on magnitude of

velocity ﬂuctuations and L, e.g. Re

L

≈ 0.01Re.

Here, Re is the macroscopic Reynolds number.

The grid size must be smaller than l

K

in order to resolve all of the scales;

therefore,

N ∼

L

l

K

∼ Re

3/4

L

,

where N is the number of grid points in each direction.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 423 / 454

Numerical Modeling of Turbulent Flows Direct Numerical Simulation

Note that as Re

L

↑ ⇒l

K

↓ ⇒N ↑; therefore, DNS is only practical for small to

moderate Re.

Notes:

1) DNS is only possible for moderate Re ﬂows in simple geometries (with

current computational resources). This gives rise to the early, i.e. 1990s,

”turbulence-in-a-box” simulations.

2) DNS produces very detailed information about the ﬂow (see DNS ﬁgures):

⇒ Can be used to evaluate turbulence statistics, e.g. to compare with

experiments.

⇒ Gives qualitative knowledge of ﬂow (coherent structures, etc...).

⇒ Used to develop turbulence models for similar ﬂows.

3) Spectral methods are popular for DNS because highly accurate solutions can

be obtained.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 424 / 454

Numerical Modeling of Turbulent Flows Large-Eddy Simulation

Outline

10

Numerical Modeling of Turbulent Flows

Introduction

Direct Numerical Simulation

Large-Eddy Simulation

Reynolds Averaged Navier-Stokes

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 425 / 454

Numerical Modeling of Turbulent Flows Large-Eddy Simulation

In LES we ﬁlter the velocity and pressure ﬁelds so they only contain large-scale

components, i.e. local average of complete ﬁelds:

¯ u

i

(x

i

) =

G(x, x

)u

i

(x

)dx

, (10.1)

where G(x, x

**) is the ﬁlter kernel having an associated length scale ∆:
**

Eddies > ∆ ⇒ large eddies (computed).

Eddies < ∆ ⇒ small turbulent eddies (modeled).

That is,

l

K

≤ modeled < ∆ < computed ≤ L

Numerical grid: l

K

< ∆x

i

< ∆, i.e. smaller than ∆, but not as small as l

K

(cf.

DNS).

Apply ﬁlter (10.1) to Navier-Stokes equations with

u

i

(x

i

, t) = ¯ u

i

(x

i

, t) +u

i

(x

i

, t), p(x

i

, t) = ¯ p(x

i

, t) +p

(x

i

, t),

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 426 / 454

Numerical Modeling of Turbulent Flows Large-Eddy Simulation

where ¯ u

i

(x

i

, t) is the resolvable scale velocity (computed), and u

i

(x

i

, t) is the

subgrid scale (SGS) velocity.

The ﬁltered Navier-Stokes equations are (in tensor notation)

∂¯ u

i

∂x

i

= 0,

∂¯ u

i

∂t

+

∂

∂x

j

u

i

u

j

= −

1

ρ

∂¯ p

∂x

i

+ν∇

2

¯ u

i

.

(10.2)

Thus, we have a set of equations for large-scale quantities, but

u

i

u

j

= ¯ u

i

¯ u

j

+ ¯ u

i

u

j

+u

i

¯ u

j

+u

i

u

j

. (10.3)

The ﬁrst term on the right-hand-side is computed from the resolved scales, and

the remaining terms are τ

ij

= SGS Reynolds stress and must be modeled, i.e. they

contain u

i

and u

j

.

Therefore, the subgrid scale (SGS) model must specify τ

ij

as a function of the

resolvable variables (¯ u

i

, ¯ u

j

), and it provides for energy transfer between the

resolvable scales and the SGS.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 427 / 454

Numerical Modeling of Turbulent Flows Large-Eddy Simulation

The earliest and most common SGS model is the Smagorinsky model, which is an

eddy viscosity model (eﬀective viscosity due to small-scale turbulent motion).

Thus, the SGS Reynolds stress τ

ij

increases transport and dissipation.

τ

ij

=

1

3

τ

kk

δ

ij

+ 2µ

t

¯

S

ij

, (10.4)

where

¯

S

ij

=

1

2

∂¯ u

i

∂x

j

+

∂¯ u

j

∂x

i

**= strain-rate for resolved ﬁeld
**

µ

t

= C

2

S

ρ∆

2

[

¯

S[.

Here, C

S

is the model parameter, which must be speciﬁed, and [

¯

S[ = (

¯

S

ij

¯

S

ij

)

1/2

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 428 / 454

Numerical Modeling of Turbulent Flows Large-Eddy Simulation

Notes:

1) The Smagorinsky model only accounts for energy transfer from large to small

scales.

2) The Smagorinsky model does not work well near boundaries (eddy viscosity is

much smaller and ﬂow is more anisotropic).

3) Points (1) and (2) can be improved upon with dynamic SGS models:

Allow model parameter C

S

to vary with space and time, i.e. it is computed

from the resolvable ﬂow ﬁeld.

Automatically adjusts SGS parameter for anisotropic ﬂow and ﬂow near walls.

Allows for backscatter (µ

t

< 0), which accounts for energy transferred from

small scales to large scales.

Active area of ongoing research.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 429 / 454

Numerical Modeling of Turbulent Flows Large-Eddy Simulation

4) LES is more economical computationally than DNS; therefore, it can be

applied to more complex ﬂows. Consider, for example, the ﬂow over a wall

mounted block (Re = 3, 200 and grid: 240 128 128) and combustor ﬂows

(see ﬁgures) and note the level of detail obtained for the ﬂow.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 430 / 454

Numerical Modeling of Turbulent Flows Reynolds Averaged Navier-Stokes

Outline

10

Numerical Modeling of Turbulent Flows

Introduction

Direct Numerical Simulation

Large-Eddy Simulation

Reynolds Averaged Navier-Stokes

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 431 / 454

Numerical Modeling of Turbulent Flows Reynolds Averaged Navier-Stokes

In RANS we compute only the mean ﬂow and model all of the turbulence:

u(x

i

, t) = ¯ u(x

i

) +u

(x

i

, t), (10.5)

where ¯ u(x

i

) is the mean ﬂow, and u

(x

i

, t) are the turbulent ﬂuctuations (not the

same as u

in LES).

To obtain the mean ﬂow, we use Reynolds averaging:

Steady mean ﬂow ⇒ time average Navier-Stokes equations

¯ u(x

i

) = lim

T→∞

1

T

T

0

u(x

i

, t)dt, (10.6)

where T = averaging interval.

Unsteady mean ﬂow ⇒ ensemble average.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 432 / 454

Numerical Modeling of Turbulent Flows Reynolds Averaged Navier-Stokes

For incompressible ﬂow, the Reynolds averaged Navier-Stokes equations are

∂¯ u

∂x

+

∂¯ v

∂y

= 0,

ρ

¸

∂¯ u

∂t

+ ¯ u

∂¯ u

∂x

+ ¯ v

∂¯ u

∂y

= −

∂¯ p

∂x

+

∂

∂x

¸

µ

∂¯ u

∂x

−ρu

u

+

∂

∂y

¸

µ

∂¯ u

∂y

−ρu

v

,

ρ

¸

∂¯ v

∂t

+ ¯ u

∂¯ v

∂x

+ ¯ v

∂¯ v

∂y

= −

∂¯ p

∂y

+

∂

∂x

¸

µ

∂¯ v

∂x

−ρu

v

+

∂

∂y

¸

µ

∂¯ v

∂y

−ρv

v

,

(10.7)

where ρu

u

, ρu

v

, ρv

v

**are the Reynolds stresses. Equations (10.7) are three
**

equations for ﬁve unkowns (¯ u, ¯ v, ¯ p, u

, v

**); therefore, we have a closure problem.
**

Closure is achieved by relating the Reynolds stresses to the mean ﬂow quantities

through a turbulence model.

k − Turbulence Model:

The k − model is the most common turbulence model used in applications, but

there are many others.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 433 / 454

Numerical Modeling of Turbulent Flows Reynolds Averaged Navier-Stokes

Deﬁne:

k =

1

2

u

i

u

i

= turbulent kinetic energy,

= ν

T

∂u

i

∂x

j

∂u

i

∂x

j

**= rate of dissipation of turbulent energy.
**

Here, k and are determined from a solution of the following coupled equations,

which are derived from Navier-Stokes,

ρ

Dk

Dt

=

∂

∂x

j

µ

T

σ

k

∂k

∂x

j

+µ

T

∂u

i

∂x

j

+

∂u

j

∂x

i

∂u

i

∂x

j

−ρ, (10.8)

ρ

D

Dt

=

∂

∂x

j

µ

T

σ

∂

∂x

j

+

C

1

µ

T

k

∂u

i

∂x

j

+

∂u

j

∂x

i

∂u

i

∂x

j

−

ρC

2

2

k

. (10.9)

The terms on the left-hand-side represent the transport of k and , and the ﬁrst,

second and third terms on the right-hand-side represent diﬀusion, production and

dissipation, respectively, of k and .

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 434 / 454

Numerical Modeling of Turbulent Flows Reynolds Averaged Navier-Stokes

µ

T

(x

i

) is the local eddy viscosity and is related to k and by

µ

T

=

C

µ

ρk

2

. (10.10)

The eddy viscosity µ

T

is used to relate the Reynolds stresses to the mean ﬂow

quantities through

−ρu

i

u

j

= µ

T

∂¯ u

i

∂x

j

+

∂¯ u

j

∂x

i

−

2

3

ρkδ

ij

. (10.11)

Notes:

1) Equations (10.8)–(10.10) involve ﬁve constants, C

µ

, C

1

, C

2

, σ

k

, σ

, which

must be determined empirically.

2) Special treatment is necessary at solid boundaries; therefore, wall functions

that are usually based on the log-law are used for turbulent boundary layers.

3) Produces less detailed information about the ﬂow than DNS and LES, but

RANS requires signiﬁcantly more modest computational resources as

compared to DNS and LES. Thus, it is good for engineering applications, and

is used by most commercial CFD codes.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 435 / 454

Numerical Modeling of Turbulent Flows Reynolds Averaged Navier-Stokes

4) Most turbulence models (including k −) have diﬃculties with accurately

predicting separation.

Consider the example of an impinging jet (see ﬁgures). Note the signiﬁcant

diﬀerences between the results obtained with the two models used, both in terms

of the locations and magnitudes of turbulent kinetic energy.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 436 / 454

Parallel Computing Introduction

Outline

11

Parallel Computing

Introduction

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 437 / 454

Parallel Computing Introduction

Glossary:

•

Supercomputer – the fastest computers available at a particular time.

•

MIPS – Millions of Instructions Per Second; outdated measure of computer

performance (architecture dependent).

•

Floating point operation – an operation, e.g. addition, subtraction,

multiplication or division, on one or more ﬂoating point numbers (non

integers).

•

FLOPS – Floating Point Operations Per Second; current measure of

computer performance for numerical applications.

MFLOPS MegaFLOPS million (10

6

) FLOPS

GFLOPS GigaFLOPS billion (10

9

) FLOPS

TFLOPS TeraFLOPS trillion (10

12

) FLOPS

PFLOPS PetaFLOPS 10

15

FLOPS

•

Serial processing – a computer code is executed line-by-line in sequence on

one processor.

•

Scalar processing – a processor performs calculations on a single data

element.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 438 / 454

Parallel Computing Introduction

•

Vector processing – a processor performs calculations on multiple data

elements, i.e. a vector, simultaneously.

•

Parallel processing – multiple processors (or cores) perform operations

simultaneously on diﬀerent data elements.

•

Massively parallel – parallel computers involving thousands of processors.

•

MPP – Massively Parallel Processing.

•

SMP – Symmetric Multi-Processing; shared memory parallelism.

•

Shared memory parallelism – all of the processors share the same memory.

•

Distributed memory parallelism – all of the processors access their own

memory.

•

MPI – Message Passing Interface; most common library used for

inter-processor communication on distributed memory computers.

•

Cluster – a parallel computer comprised of commodity hardware, e.g. Beowulf

cluster (commodity hardware, Linux OS, and open source software).

•

SIMD – Single Instruction, Multiple Data; all processors perform the same

instruction on diﬀerent data elements.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 439 / 454

Parallel Computing Introduction

•

MIMD – Multiple Instruction, Multiple Data; all processors perform diﬀerent

instructions on diﬀerent data elements.

•

Embarrassingly parallel – processors work in parallel with very little or no

communication between them, e.g. image processing and Seti@Home.

•

Coupled parallel – processors work in parallel but require signiﬁcant

communication between them, e.g. CFD.

•

HPC – High Performance Computing.

•

Grid computing – parallel computing across a geographically distributed

network (e.g. the internet); analogous to the electric grid.

•

Multi-core CPUs – a single chip with multiple processors (cores).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 440 / 454

Parallel Computing Introduction

A Brief History of Supercomputers:

Generations of Supercomputer Architectures:

Note that each architecture requires its own approach to programming, and not

all algorithms are amenable to each.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 441 / 454

Parallel Computing Introduction

Milestones:

Year Supercomputer Peak Speed

1906 Babbage Analytical Engine 0.3 OPS

1946 ENIAC 50 kOPS

1964 CDC 6600 (Seymour Cray) 3 MFLOPS

1969 CDC 7600 36 MFLOPS

1976 Cray-1 (Seymour Cray) 250 MFLOPS

1981 CDC Cyber 205 400 MFLOPS

1983 Cray X-MP 941 MFLOPS

1985 Cray-2 3.9 GFLOPS

1985 Thinking Machines CM-2 (64k)

1989 Cray Y-MP

1993 Thinking Machines CM-5 65.5 GFLOPS

1993 Intel Paragon 143.4 GFLOPS

1996 Hitachi/Tsukuba CP-PACS (2k) 368.2 GFLOPS

1999 Intel ASCI Red (10k) 2.8 TFLOPS

2002 NEC Earth Simulator (5k) 35.9 TFLOPS

2005 IBM Blue Gene/L (131k) 280.6 TFLOPS

2008 IBM Roadrunner (130k) 1.105 PFLOPS

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 442 / 454

Parallel Computing Introduction

Milestones (cont’d):

1954 – Fortran (Formula Translation) developed

1970 – Unix developed at AT&T Bell Labs

Components of Computing:

1

Hardware – the computer (CPUs, memory, storage, network, etc.)

→ Assuming adequate memory, the computational time is primarily determined

by:

Sequential → CPU speed

Parallel → number of CPUs, CPU speed, inter-processor communication speed

and bandwidth, percent of code that is run in parallel (see Amdahl’s law).

2

Software – OS, compiler, libraries, program, etc.

3

Algorithms – the numerical method

→ Note that the best algorithms for serial computers often are not the best for

parallel computers (e.g. BLKTRI).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 443 / 454

Parallel Computing Introduction

Issues in Parallel Computing:

1

Data dependency

→ Can calculations be carried out independently of one another on separate

processors?

→ Examples:

Thomas algorithm ⇒ no.

Red-black Gauss-Siedel ⇒ yes.

2

Load balancing

→ Desire all processors to be utilized 100% of the time.

3

Scalability

→ Ability of a parallel code to maintain its speedup with increasing numbers of

processors and increasing problem size ⇒ see Amdahl’s Law.

4

Coarse vs. ﬁne-grain parallelism

Fine-grain parallelism ⇒ parallelize the lower level structures of a program,

e.g. loops.

Coarse-grain parallelism ⇒ parallelize the higher level structures of a program,

e.g. equations.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 444 / 454

Parallel Computing Introduction

5

Architectures:

SIMD (e.g. CM-2) vs. MIMD

Shared memory (e.g. Cray, SGI, multicore CPUs, etc.):

Distributed memory (e.g. CM, clusters, etc.):

.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 445 / 454

Parallel Computing Introduction

Key Ingredients That Make Clusters Possible:

Hardware:

1) Fast, cheap PCs – inexpensive and widely available CPUs, memory, storage.

2) High-performance (high-bandwidth, low latency) LANs, e.g. Gigabit Ethernet,

Myrinet, Inﬁniband.

Software:

3) Open source OS, e.g. Linux – common platform on which to build tools

(previously, most supercomputing vendors had their own proprietary tools, e.g.

CM Fortran).

4) MPI – standardize message passing on various platforms (developed at ANL).

→ Ingredients (3) and (4) were not available during MPP (e.g. CM) heyday

in mid ’80s - mid ’90s. This led to the demise of the CM.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 446 / 454

Parallel Computing Introduction

Amdahl’s Law:

Measure of speedup S(N) on N processors versus single processor, i.e. serial code.

Amdahl’s Law:

S(N) =

T(1)

T(N)

=

N

N −(N −1)F

,

where T(N) is the time required using N processors, and F is the fraction of the

serial run time that the code spends in the parallel portion.

See Mathematica notebook ‘’AmdahlsLaw.nb.”

Notes:

1

If F = 1 (100% parallel) ⇒ S(N) = N (linear speedup)

If F < 1 ⇒ S(N) < N (sub-linear speedup)

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 447 / 454

Parallel Computing Introduction

2

Maximum speedup for given F with N →∞:

lim

N→∞

S(N) = lim

N→∞

N

N −(N −1)F

=

1

1 −F

=

1

F

s

,

where F

s

= 1 −F is the fraction of time in the serial code spent doing the

serial portion.

e.g. F = 0.95 ⇒F

s

= 0.05 ⇒ S(∞) = 20

3

In practice, F

s

(and F) depends on the number of processors N and the size

of the problem n, i.e. the number of grid points.

Thus, for ideal scalability a parallel algorithm should be such that

F

s

(N, n) →0 (F →1) as n →∞

∴ S(N) →N as n →∞ ⇒linear speedup

4

Parallel eﬃciency – fraction of total potential (linear) speedup achieved:

E(N) =

S(N)

N

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 448 / 454

Parallel Computing Introduction

5

Illustrates importance of proﬁling – determining where the code spends most

of its time in order to know where to focus parallelization eﬀorts.

6

Ignores overhead due to parallelization:

•

Inter-processor communication

•

Synchronization of data between processors

•

Load imbalances

Modiﬁed Amdahl’s Law:

Modiﬁed to account for parallel overhead.

Modiﬁed Amdahl’s Law:

S(N) =

N

N −(N −1)F +N

2

F

o

,

where F

o

is the fraction of time spent due to parallel overhead.

See Mathematica notebook “AmdahlsLaw.nb.”

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 449 / 454

Parallel Computing Introduction

Top 500 Supercomputers (www.top500.org)

Compiled every six months based on LINPACK benchmark tests.

November 2005:

26th List / November 2005 www.top500.org page 4

26th List: The TOP10

9

6

5120 2002 Japan Earth Simulator Center 35.86 Earth-Simulator NEC

7

4

5200 2005 USA Oak Ridge National Lab 20.53

Jaguar

Cray XT3

Cray 10

12288 2005 Netherlands

ASTRON

University Groningen

27.45 eServer Blue Gene IBM

4800 2005 Spain

Barcelona Supercomputer

Center

27.91

MareNostrum

BladeCenter JS20, Myrinet

IBM

8

5

10880 2005 USA Sandia 36.19

Red Storm

Cray XT3

Cray

6

10

8000 2005 USA Sandia 38.27 Thunderbird Dell 5

10160 2004 USA NASA Ames 51.87

Columbia

Altix, Infiniband

SGI

4

3

10240 2005 USA DOE/NNSA/LLNL 63.39

ASC Purple

eServer pSeries p575

IBM 3

40960 2005 USA IBM Thomas Watson 91.29

BGW

eServer Blue Gene

IBM 2

131072 2005 USA DOE/NNSA/LLNL 280.6

BlueGene/L

eServer Blue Gene

IBM 1

#Proc Year Country Installation Site

Rmax

[TF/s]

Computer Manufacturer

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 450 / 454

Parallel Computing Introduction

Current List (November 2008):

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 451 / 454

Parallel Computing Introduction

Geographic location of top 100 supercomputers:

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 452 / 454

Parallel Computing Introduction

TOP500 List Highlights - November 2008:

Intel dominates the high-end processor market with 75.8 percent of all

systems and 87.5 percent of quad-core based systems.

410 systems are labeled as clusters, making this the most common

architecture in the TOP500 with a stable share of 82 percent.

Quad-core processor based systems have taken over the TOP500 quite

rapidly. Already 336 systems are using them. Seven systems use IBM’s

advanced Sony PlayStation 3 processor with 9 cores.

The average concurrency level in the TOP500 is 6,240 cores per system up

from 4,850 six month ago.

IBM and Hewlett-Packard continue to sell the bulk of systems at all

performance levels of the TOP500. HP took over the lead in systems with

209 systems (41.8 percent) over IBM with 188 systems (37.6 percent).

The U.S. is the leading consumer of HPC systems with 291 of the 500

systems (up from 257). The European share (151 systems – down from 184)

is settling down after having risen for some time, but is still substantially

larger then the Asian share (47 systems – unchanged).

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 453 / 454

Parallel Computing Introduction

The entry level to the list moved up to the 12.64 Tﬂop/s mark on the

Linpack benchmark, compared to 9.0 Tﬂop/s six months ago.

The last system on the newest list would have been listed at position 267 in

the previous TOP500 just six months ago.

Total combined performance of all 500 systems has grown to 16.95 Pﬂop/s,

compared to 11.7 Pﬂop/s six months ago and 6.97 Pﬂop/s one year ago.

The entry point for the top 100 increased in six months from 18.8 Tﬂop/s to

27.37 Tﬂop/s (which would have been # 9 on the November 2005 list).

The entry level into the TOP50 is at 50.55 Tﬂop/s (which would have been

# 5 on the November 2005 list).

Of the top 50, 56 percent of systems are installed at research labs and 32

percent at universities. Cray’s XT is the most-used system family with 20

percent, followed by IBMs BlueGene with 16 percent. The average

concurrency level is 30,490 cores per system – up from 24,400 six month ago.

Seven U.S. DOE systems dominate the TOP10.

Roadrunner (# 1) is based on the IBM QS22 blades that are built with

advanced versions of the processor in the Sony PlayStation 3.

The list now includes energy consumption of the supercomputers.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 454 / 454

Introduction to CFD

Advantages and disadvantages of analytical, computational and experimental approaches to ﬂuid mechanics: Analytical: + Provides exact solutions to governing equations. + Gives physical insight, e.g. relative importance of diﬀerent eﬀects. + Can consider hypothetical problems (e.g. inviscid, incompressible, zero-gravity, etc.). − Exact solutions only available for simple problems and geometries. − Of limited direct value in design.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

3 / 454

Introduction to CFD

Computational: + Address more complex problems (physics and geometries). + Can consider hypothetical ﬂows ⇒ test theoretical models. + Provides detailed solutions ⇒ good understanding of ﬂow, e.g. does separation occur? + Perform parametric studies. + Can easily try diﬀerent conﬁgurations, e.g. geometry, boundary conditions, etc... ⇒ important in design. + Computers becoming faster and cheaper ⇒ range of CFD expanding. + Increased potential using parallel processing. + More cost eﬀective and faster than experimental prototyping. − Requires accurate governing equations (don’t have for turbulence, combustion, etc..., which require modeling). − Boundary conditions sometimes diﬃcult to implement, e.g. outlet. − Diﬃcult to do in certain parameter regimes, e.g. high Reynolds numbers, and complex geometries.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

4 / 454

Introduction to CFD

Experimental: + Easier to get overall quantities for problem (e.g. lift and drag on an airfoil). + No “modeling” necessary. − Often requires intrusive measurement probes. − Limited measurement accuracy. − Limited measurement resolution. − Eﬀects of support apparatus, end walls, etc... must be considered. − Some quantities diﬃcult to obtain, e.g. streamfunction, vorticity, etc.... − Experimental equipment often expensive and takes up space. − Diﬃcult and costly to test full-scale models. Note: Computational approaches do not replace analytical or experimental approaches, but complement them.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

5 / 454

Numerical Methods: General Considerations and Approaches

Components and Properties of a Numerical Solution

Outline

2

Numerical Methods: General Considerations and Approaches Components and Properties of a Numerical Solution Numerical Solution Approaches

Finite Diﬀerence Boundary-Value Problems Finite Element Spectral Methods Vortex Methods

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

6 / 454

Numerical Methods: General Considerations and Approaches

Components and Properties of a Numerical Solution

**Numerical Solution Procedure:
**

Physical System i.e. Reality

1

Physical Laws + Models

**Mathematical Model i.e. Governing Equations
**

(odes or pdes)

Analytical Solution

2

Discretization

System of Linear Equations

3

Matrix Solver

Numerical Solution

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

7 / 454

Numerical Methods: General Considerations and Approaches

Components and Properties of a Numerical Solution

Steps:

1 2

Mass, momentum and energy conservation + models, idealizations, etc... Discretization – approximation of the continuous diﬀerential equation(s) by a system of algebraic equations for the dependent variables at discrete locations in the independent variables (space and time). For example, using ﬁnite diﬀerences

3

**Numerical solutions of linear systems of equations.
**

⇒ Method of discretization often produces certain structure: e.g. second-order centered diﬀerences lead to a tridiagonal system of equations.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

8 / 454

e. Cassel 10 / 454 . W. Discretization errors – diﬀerence between exact solution of governing equations and exact solution of algebraic equations. 2∆x dx 2 Stability – numerical procedure must not magnify errors produced in the numerical solution. 2 3 Iterative convergence errors – diﬀerence between numerical solution. truncation error. ui+1 −ui−1 → du for consistency. dx 2∆x where O(∆x2 ) is the truncation error.Numerical Methods: General Considerations and Approaches Components and Properties of a Numerical Solution Sources of errors in numerical solutions arise due to each step of the Numerical Solution Procedure: 1 Modeling errors – diﬀerence between actual ﬂow and exact solution of mathematical model. and exact solution to algebraic equations. ⇒ Compromises must often be made at each stage of the procedure. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. This is where the “pragmatism” mentioned by Dawes is an important element of CFD. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.g.e. Unstable method ⇒ diverge from exact solution. DNS of turbulence in other than elementary ﬂows is currently impossible. i. i) Method of discretization → inherent error of method. as ∆x → 0. i. iterative. ii) Computational grid → can be reﬁned.g. e.: du ui+1 − ui−1 = + O(∆x2 ). Cassel 9 / 454 Numerical Methods: General Considerations and Approaches Components and Properties of a Numerical Solution Properties of successful numerical solution methods: 1 Consistency – discretized equations must become governing equations as grid size goes to zero truncation error = discretized equations – exact equations e. W. from the deﬁnition of the derivative. Therefore.

where e is the error. 4 “Correctness” – numerical solution should compare favorably with available analytical solutions. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. therefore. Then halving the grid size reduces the error by a factor of four. for O(∆x2 ) ⇒ ∆x → e. Truncation error gives the rate of convergence to the exact solution as grid is reduced. W. reﬁne grid until grid-independent solution is obtained. W. e.g. experimental results or other computational solutions within the limitations of each. Cassel 11 / 454 Numerical Methods: General Considerations and Approaches Numerical Solution Approaches Outline 2 Numerical Methods: General Considerations and Approaches Components and Properties of a Numerical Solution Numerical Solution Approaches Finite Diﬀerence Boundary-Value Problems Finite Element Spectral Methods Vortex Methods MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. iterative convergence). Cassel 12 / 454 . Generally don’t have exact solution.Numerical Methods: General Considerations and Approaches 3 Components and Properties of a Numerical Solution Convergence – numerical solution of discretized equations approaches exact solution of governing equations as grid size goes to zero (cf.

g. Can extend to higher-order approximations. e. Advantages: Relatively straightforward to understand and implement (based on Taylor series). The most common approaches used in CFD are brieﬂy described below. Produces algebraic equations involving each grid point and surrounding points. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.Numerical Methods: General Considerations and Approaches Numerical Solution Approaches The discretization step (step 2 in the Numerical Solution Procedure) may be accomplished using diﬀerent methods. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Local approximation method. Cassel 14 / 454 . Popular in ﬂuid dynamics research. Very general ⇒ Apply to a wide variety of problems (including complex physics. ﬂuids plus heat transfer plus combustion). W. Cassel 13 / 454 Numerical Methods: General Considerations and Approaches Numerical Solution Approaches Finite Diﬀerence Basic approach: Discretize the governing equations in diﬀerential form using Taylor-series-based ﬁnite-diﬀerence approximations at each grid point. Utilizes familiar diﬀerential form of governing equations.

). even if solution in inaccurate. Popular for commercial CFD codes (e. Advantages: Easier to treat complex geometries than ﬁnite-diﬀerence approach. mass.g. energy. “Ensures” conservation of necessary quantities (i. Disadvantages: More diﬃcult to construct higher-order schemes. FLUENT).Numerical Methods: General Considerations and Approaches Numerical Solution Approaches Disadvantages: More diﬃcult to implement for complex geometries. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.e. Cassel 15 / 454 Numerical Methods: General Considerations and Approaches Numerical Solution Approaches Finite Volume Basic approach: Apply conservation equations in integral form to a set of control volumes. W. momentum. i. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Local approximation method. Produces algebraic equations for each control volume involving surrounding control volumes. Uses less familiar integral formulation of governing equations. etc.e. Cassel 16 / 454 .

Disadvantages: Results in unstructured grids. Cassel 17 / 454 Numerical Methods: General Considerations and Approaches Numerical Solution Approaches Spectral Methods Basic approach: Solution of governing equations in diﬀerential form are approximated using truncated (usually orthogonal) eigenfunction expansions. highly structured matrices). Can achieve rapid convergence. Produces set of linear or nonlinear algebraic equations. ﬁnite diﬀerence ⇒ sparse. Produces system of algebraic equations (steady) or system of ordinary diﬀerential equations (unsteady) involving the coeﬃcients in the eigenfunction expansion. W. Popular in commercial codes (particularly for solid mechanics and heat transfer). Cassel 18 / 454 . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Local approximation method. W. Advantages: Obtain highly accurate solutions when underlying solution is smooth. Popular for direct numerical simulation (DNS) of turbulence. Advantages: Easy to treat complex geometries. Global approximation method.Numerical Methods: General Considerations and Approaches Numerical Solution Approaches Finite Element Basic approach: Apply conservation equations in variational form with weighting function to set of ﬁnite elements. Solution methods are ineﬃcient for the types of matrices resulting from ﬁnite-element discretizations (cf.

W. Small changes in problem can cause large changes in algorithm. Cassel 20 / 454 . Not well suited for solutions having large gradients. Cassel 19 / 454 Numerical Methods: General Considerations and Approaches Numerical Solution Approaches Vortex Methods MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Neumann).g. W. More diﬃcult to treat complicated boundary conditions (e.Numerical Methods: General Considerations and Approaches Numerical Solution Approaches Disadvantages: Less straightforward to implement than ﬁnite diﬀerence. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

The heat transfer within the extended ﬁn is governed by the 1-D ordinary-diﬀerential equation (see. W.Finite-Diﬀerence Methods Extended Fin Example Outline 3 Finite-Diﬀerence Methods Extended Fin Example Formal Basis for Finite Diﬀerences Application to Extended Fin Example Properties of Tridiagonal Matrices Thomas Algorithm Extended Fin Example – Convection Boundary Condition MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. (3. consider the 1-D heat conduction in an extended surface with convection to the ambient air. for example. Cassel 22 / 454 1 dAc Ac dx dT − dx 1 h dAs Ac k dx (T − T∞ ) = 0.1) . Cassel 21 / 454 Finite-Diﬀerence Methods Extended Fin Example As an example. Incropera & DeWitt): d2 T + dx2 where MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W.

h = convective heat transfer coeﬃcient. k = thermal conductivity. .2) g(x) MMAE 517 (Illinois Institute of Technology) = Computational Fluid Dynamics Finite-Diﬀerence Methods Extended Fin Example For now. I.1) as d2 θ dθ + f (x) + g(x)θ = 0. . and the solution θi = θ(xi ) is to be determined for i = 2. Cassel 24 / 454 . and it is a boundary-value problem requiring boundary conditions at both ends of the domain. rewrite equation (3. . Equation (3.3) x = L.2) with boundary conditions (3. Ac k dx c 2010 K.1) is a second-order ordinary diﬀerential equation with variable coeﬃcients. Ac dx − 1 h dAs . (3. W.Finite-Diﬀerence Methods Extended Fin Example T (x) = temperature distribution. W. fi = f (xi ) and gi = g(xi ) are known. Letting θ(x) = T (x) − T∞ . consider Dirichlet boundary conditions θ = θb = Tb − T∞ θ = θL = TL − T∞ at at x = 0.3) represents the mathematical model (step 1 in the Numerical Solution Procedure). 2 dx dx where f (x) = 1 dAc . Cassel 23 / 454 (3. . Step 2 → Discretization: Divide the interval 0 ≤ x ≤ L into I equal subintervals of length ∆x = L I: Here. Ac (x) = cross-sectional area. Note that equation (3. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. As (x) = surface area from base.

Graphical interpretation: MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. i. consider the deﬁnition of the derivative dθ θ(xi + ∆x) − θ(xi ) . W. but not going to zero.e. = lim dx x=xi ∆x→0 ∆x This may be interpreted as a forward diﬀerence if ∆x is small. Cassel 26 / 454 . Cassel 25 / 454 Finite-Diﬀerence Methods Extended Fin Example Forward Diﬀerence: dθ dx dθ dx dθ dx ≈ xi θi+1 − θi ∆x θi − θi−1 ∆x θi+1 − θi−1 2∆x Backward Diﬀerence: ≈ xi Central Diﬀerence: Which approximation is better? ≈ xi MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. ﬁnite diﬀerence.Finite-Diﬀerence Methods Extended Fin Example In order to discretize the diﬀerential equation.

5) Solving for (dθ/dx)i gives dθ dx = i θi+1 − θi ∆x − ∆x 2 d2 θ dx2 − ··· − i ∆xn−1 n! dn θ dxn + ··· .4) + ··· . Cassel 28 / 454 . i Apply the Taylor series at x = xi+1 : (xi+1 − xi = ∆x) θi+1 = θi +∆x dθ dx + i ∆x2 2 d2 θ dx2 + i ∆x3 6 d3 θ dx3 +· · ·+ i ∆xn n! dn θ dxn +· · · .6) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 27 / 454 Finite-Diﬀerence Methods Formal Basis for Finite Diﬀerences Consider the Taylor series expansion of a function θ(x) in the vicinity of the point xi θ(x) = θ(xi ) + (x − xi ) (x − xi )3 + 3! d3 θ dx3 dθ dx (x − xi )2 + 2! i d2 θ dx2 i (x − xi )n + ··· + n! i dn θ dxn (3. i (3. W. i (3.Finite-Diﬀerence Methods Formal Basis for Finite Diﬀerences Outline 3 Finite-Diﬀerence Methods Extended Fin Example Formal Basis for Finite Diﬀerences Application to Extended Fin Example Properties of Tridiagonal Matrices Thomas Algorithm Extended Fin Example – Convection Boundary Condition MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W.

i.10) i i MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 29 / 454 Finite-Diﬀerence Methods Formal Basis for Finite Diﬀerences Equations (3. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.5) to obtain θi+1 − θi−1 = 2∆x dθ dx ∆x3 + 3 i d3 θ dx3 2∆x2n+1 +···+ (2n + 1)! i d2n+1 θ dx2n+1 +··· . if all of the terms are retained in the expansions. dxn i (3.10) are exact expressions for the ﬁrst derivative (dθ/dx)i . apply the Taylor series at x = xi−1 : (xi−1 − xi = −∆x) θi−1 = θi −∆x dθ dx + i ∆x2 2 d2 θ dx2 − i ∆x3 6 d3 θ dx3 +· · ·+ i (−1)n ∆xn n! dn θ +· · · . i (3.7) dn θ +· · · . ⇒ For small ∆x.Finite-Diﬀerence Methods Formal Basis for Finite Diﬀerences Similarly. Cassel 30 / 454 . (3. dxn i (3. successive terms get smaller and the order of the truncation error is given by the ﬁrst truncated term.6). (3.8) Solving again for (dθ/dx)i gives dθ dx = i θi − θi−1 ∆x + ∆x 2 d2 θ dx2 − i ∆x2 6 d3 θ dx3 +· · ·+ i (−1)n ∆xn−1 n! Alternatively.9) and solve for (dθ/dx)i to obtain dθ dx θi+1 − θi−1 ∆x2 = − 2∆x 6 d3 θ dx3 ∆x2n −· · ·− (2n + 1)! i d2n+1 θ dx2n+1 −· · · .8) and (3.e. W. subtract equation (3.7) from (3. W. Approximate ﬁnite diﬀerence expressions for the ﬁrst derivative may then be obtained by truncating the series after the ﬁrst term: dθ dx dθ dx dθ dx ≈ i θi+1 − θi + O(∆x) ∆x θi − θi−1 + O(∆x) ∆x → Forward diﬀerence → Backward diﬀerence ≈ i ≈ i θi+1 − θi−1 + O(∆x2 ) → Central diﬀerence 2∆x The truncation error is the sum of all the truncated terms.

(3. to obtain a second-order acccurate forward-diﬀerence approximation to the ﬁrst derivative.11) to obtain 4θi+1 − θi+2 = 3θi + 2∆x Solving for (dθ/dx)i gives dθ dx −3θi + 4θi+1 − θi+2 ∆x2 = + 2∆x 3 d3 θ dx3 + ··· .Finite-Diﬀerence Methods Formal Basis for Finite Diﬀerences Higher-order approximations may be obtained by various manipulations of the Taylor series at additional points. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. This gives θi+1 + θi−1 = 2θi + ∆x2 Solving for (d2 θ/dx2 )i leads to d2 θ dx2 θi+1 − 2θi + θi−1 ∆x2 = − ∆x2 12 d4 θ dx4 + ··· . i (3. Cassel 32 / 454 . For example. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. i d2 θ dx2 + i ∆x4 12 d4 θ dx4 + ··· . i dθ dx 2∆x3 − 3 i d3 θ dx3 + ··· . W. to eliminate the (dθ/dx)i term.5) − (3. W. respectively. i (3.7) for θi+1 and θi−1 .5) and (3.13) i Note that the second-order accurate central-diﬀerence approximations for both the ﬁrst and second derivatives involve the point of interest and its two neighbors. apply the Taylor series at xi+2 as follows θi+2 = θi + 2∆x dθ dx + i (2∆x)2 2! d2 θ dx2 + i (2∆x)3 3! d3 θ dx3 + · · · .11) i We eliminate the (d2 θ/dx2 )i term by taking 4×(3. Cassel 31 / 454 Finite-Diﬀerence Methods Formal Basis for Finite Diﬀerences For a second-order accurate central-diﬀerence approximation to the second derivative add equation (3.12) i which is second-order accurate and involves the point of interest and the two previous points.

Finite-Diﬀerence Methods Application to Extended Fin Example Outline 3 Finite-Diﬀerence Methods Extended Fin Example Formal Basis for Finite Diﬀerences Application to Extended Fin Example Properties of Tridiagonal Matrices Thomas Algorithm Extended Fin Example – Convection Boundary Condition MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 33 / 454 Finite-Diﬀerence Methods Application to Extended Fin Example Returning to the ﬁn equation (3. .14) where the diﬀerence equation is applied at each interior point of the domain.2) d2 θ dθ + g(x)θ = 0. (∆x)2 2∆x for the point xi . ai = 1 − 2 bi ci di MMAE 517 (Illinois Institute of Technology) = −2 + (∆x)2 gi . c 2010 K. Cassel 34 / 454 ∆x fi . W. . and ∆x fi . . Multiplying by (∆x)2 and collecting terms leads to ai θi−1 + bi θi + ci θi+1 = di . 2 Computational Fluid Dynamics . I. + f (x) dx2 dx and approximating the derivatives using second-order accurate ﬁnite diﬀerences gives θi+1 − 2θi + θi−1 θi+1 − θi−1 + fi + gi θi = 0. = = 1+ 0. (3. i = 2. . W.

i = 2. . . . = . . . .Finite-Diﬀerence Methods Application to Extended Fin Example Note that because we have discretized the diﬀerential equation at each interior grid point. . . . . 0 0 · · · aI−1 bI−1 cI−1 θI−1 dI−1 0 0 ··· 0 aI bI θI dI − cI θI+1 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 36 / 454 . The coeﬃcient b2 c2 a3 b3 0 a4 . . . Cassel 35 / 454 Finite-Diﬀerence Methods Properties of Tridiagonal Matrices Outline 3 Finite-Diﬀerence Methods Extended Fin Example Formal Basis for Finite Diﬀerences Application to Extended Fin Example Properties of Tridiagonal Matrices Thomas Algorithm Extended Fin Example – Convection Boundary Condition MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. I at each interior grid point. . . . . 0 0 0 0 matrix for the diﬀerence equation (3. . . . . . . . . . .. W.14) is tridiagonal 0 0 ··· 0 0 0 θ2 d2 − a2 θ1 c3 0 · · · 0 0 0 θ3 d3 b4 c4 · · · 0 0 0 θ4 d4 . . W. we obtain a set of (I − 1) algebraic equations for the (I − 1) unknown values of the temperature θi . . . .

Consider the common case that may result from the use of central diﬀerences for a second-order derivative: a = 1.15) The eigenvalues with the largest and smallest magnitudes are (which is largest or smallest depends upon a. W. N. π N +1 2 Nπ −π N +1 1 − · · · = −1 + 2 − ··· . . . . W.. . . 0 0 0 0 0 0 constant ai . . Cassel 38 / 454 . c = 1. . and ci ··· 0 0 · · · 0 0 · · · 0 0 . (3. . . b = −2. . |λ|min Let us consider N large. . Cassel 37 / 454 Computational Fluid Dynamics Finite-Diﬀerence Methods Properties of Tridiagonal Matrices Then the condition number of A using an L2 norm is deﬁned by cond2 (A) = |λ|max . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. . . c 2010 K. bi . · · · b c ··· a b It can be shown that the eigenvalues of a tridiagonal matrix are √ λj = b + 2 ac cos jπ N +1 . b and c) √ |λ1 | = b + 2 ac cos √ |λN | = b + 2 ac cos MMAE 517 (Illinois Institute of Technology) π N +1 Nπ N +1 . . which is weakly diagonally dominant. . . . expanding cosine in a Taylor series (the ﬁrst is expanded about π/(N + 1) → 0 and the second about N π/(N + 1) → π cos cos π N +1 Nπ N +1 1 =1− 2! 1 = −1 + 2! π N +1 2 1 + 4! 2 π N +1 4 + ··· . .Finite-Diﬀerence Methods Properties of Tridiagonal Matrices Consider a N × N tridiagonal matrix with b c 0 a b c 0 a b A = . . j = 1. . Thus. .

Then from equation (3. diagonally dominant. c = 1. N |aii | > j=1. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 3) Computations are stable with respect to round-oﬀ errors. b = −4. see the Mathematica notebook “Ill-Conditioned Matrices and Round-Oﬀ Error.16) Thus.j=i |aij |: 1) A is nonsingular. cond2 (A) ≈ (π/(N + 1))2 π2 ⇒ Increases proportional to N 2 with increasing N .Finite-Diﬀerence Methods Properties of Tridiagonal Matrices Then with the large N expansions from above |λ1 | = −2 + 2 1 (1)(1) 1 − 2 1 (1)(1) −1 + 2 π N +1 2 + ··· 2 = π N +1 2 + ··· . therefore. i.” 6 = 3. (3. the condition number for large N is approximately cond2 (A) ≈ ⇒ Constant with increasing N . which is strictly. To see the inﬂuence of condition number on round-oﬀ error. it is invertible. or strongly. Cassel 39 / 454 Finite-Diﬀerence Methods Properties of Tridiagonal Matrices Now consider the case with a = 1. Cassel 40 / 454 . for large N . It can be proven that for any strictly diagonally dominant matrix A. the condition number for large N is approximately 4(N + 1)2 4 = . W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.e. 2) Gauss elimination does not require row interchanges for conditioning.16). W. |λN | = −2 + 2 π N +1 − ··· = 4 + ··· . 2 for large N .

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. . i = I. Fi = δ1 = θ1 = θb = boundary condition δi = di − ai δi−1 . ci . Cassel 42 / 454 . Note the order of evaluation for the back substitution. Cassel 41 / 454 Finite-Diﬀerence Methods Thomas Algorithm Tridiagonal systems of equations may be solved directly using the Thomas algorithm. bi − ai Fi−1 i = 2. W. I. . . . . W. .Finite-Diﬀerence Methods Thomas Algorithm Outline 3 Finite-Diﬀerence Methods Extended Fin Example Formal Basis for Finite Diﬀerences Application to Extended Fin Example Properties of Tridiagonal Matrices Thomas Algorithm Extended Fin Example – Convection Boundary Condition MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. . which is essentially application of Gauss elimination and consists of two stages (shown here for Dirichlet boundary conditions): 1) Forward Elimination: F1 = 0. . 2. bi − ai Fi−1 2) Back Substitution: θI+1 = θL = boundary condition θi = δi − Fi θi+1 .

W. which is as good a scaling as one could hope for. for example. Appendix A for a derivation. 3 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. requires O(I 3 ) operations. Cassel 44 / 454 . this means |bi | ≥ |ai | + |ci |. or weakly diagonally dominant if the equal sign applies. For example. where if the greater than sign applies we say that the matrix is strictly diagonally dominant. To prevent ill-conditioning the system of equations should be diagonally dominant.Finite-Diﬀerence Methods Thomas Algorithm Notes: 1 2 See Anderson. The Thomas algorithm only requires O(I) operations. For our tridiagonal system. note how errors could accumulate in the Fi . Performing operations with ill-conditioned matrices can result in the growth of small round-oﬀ errors that then contaminate the solution. δi coeﬃcients in the Thomas algorithm. W. Gauss elimination of a full (dense) matrix. Cassel 43 / 454 Finite-Diﬀerence Methods Extended Fin Example – Convection Boundary Condition Outline 3 Finite-Diﬀerence Methods Extended Fin Example Formal Basis for Finite Diﬀerences Application to Extended Fin Example Properties of Tridiagonal Matrices Thomas Algorithm Extended Fin Example – Convection Boundary Condition MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

∆x For a more accurate approximation. where p = h. From equation (3. This is known as a Robin boundary condition and is of the form pθ + q dθ =r dx at x = L. q = k. we must use a forward diﬀerence. let us consider a more realistic convection condition at the tip −k or with θ(x) = T (x) − T∞ −k dθ dx = hθ(L) x=L dT = h(T − T∞ ) at x = L. W. we may use the second-order accurate approximation from equation (3.Finite-Diﬀerence Methods Extended Fin Example – Convection Boundary Condition Rather than a Dirichlet boundary condition at the tip of the ﬁn.6) applied at i = 1. Cassel 45 / 454 Finite-Diﬀerence Methods Extended Fin Example – Convection Boundary Condition Now let us consider evaluation of the heat ﬂux at the base of the ﬁn qb = −kAc (0) dT dx = −kAc (0) x=0 dθ dx . 2∆x MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. x=0 In order to evaluate dθ/dx at the base x = 0. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.12) applied at i = 1 dθ dx ≈ x=0 −3θ1 + 4θ2 − θ3 + O(∆x2 ). which are inputs to the Thomas algorithm. dx Note that the convection condition results in specifying a linear combination of the temperature and its derivative at the tip. we have the ﬁrst-order accurate forward-diﬀerence approximation dθ dx ≈ x=0 θ2 − θ1 + O(∆x). which assumes that we know the temperature there. Cassel 46 / 454 . W. r = 0.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.Finite-Diﬀerence Methods Extended Fin Example – Convection Boundary Condition Even higher-order ﬁnite-diﬀerence approximations may be formed. forward-diﬀerence approximation is dθ dx ≈ x=0 −11θ1 + 18θ2 − 9θ3 + 2θ4 + O(∆x3 ). W. the third-order. Cassel 47 / 454 Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation Outline 4 Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation Hyperbolic Equations Parabolic Equations Elliptic Equations Mixed Equations MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 48 / 454 . W. For example. 6∆x Observe that each successive approximation requires one additional point in the interior of the domain.

equation is linear in highest derivative (e.4) (4. dτ dτ ∂x dτ ∂y Thus. i. dτ dτ dτ dτ dτ dτ (4. ψ1 (τ ) = ux .g. ux .3) (4.e.Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation Consider the general second-order partial diﬀerential equation for u(x. c. W. e and f are only functions of (x. y) auxx + buxy + cuyy + dux + euy + f u = g. y). we have d dx ∂ dy ∂ = + .2) dψ1 d dx dy dx dy = ux = uxx + uxy = φ1 + φ2 .1) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. b and c may be functions of (x. Quasi-linear ⇒ a. φ2 (τ ) = uxy . xx Let us determine the criteria necessary for the existence of a smooth (diﬀerentiable) and unique (single-valued) solution along a curve C: (4. b. d. Substituting into equation (4. uy ). y.5) (4. let φ1 (τ ) = uxx . Linear ⇒ a. W.1) gives aφ1 + bφ2 + cφ3 = g − dψ1 − eψ2 − f u = H. ψ2 (τ ) = uy . Cassel 50 / 454 . from (4. Transforming from (x. Cassel 49 / 454 Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation Along C. φ3 (τ ) = uyy .2) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. no u2 terms). y) → τ . u. dτ dτ dτ dτ dτ dτ dψ2 d dx dy dx dy = uy = uxy + uyy = φ2 + φ3 .

Cassel 51 / 454 Computational Fluid Dynamics Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation This is a quadratic equation for dy/dx. b2 − 4ac < 0 ⇒ no real roots ⇒ no characteristics ⇒ elliptic p.6) → The curves C for which y(x) satisfy (4. Cassel 52 / 454 . they are a b c φ1 H dx/dτ dy/dτ φ2 = dψ1 /dτ 0 0 dx/dτ dy/dτ φ3 dψ2 /dτ If the determinant of the coeﬃcient matrix is not equal to zero. b2 − 4ac = 0 ⇒ 1 real root ⇒ 1 characteristic ⇒ parabolic p. i. √ dy b ± b2 − 4ac = . Written in matrix form. Thus.e. It can be shown that if the second-order derivatives exist. the second-order derivatives φ1 .e. Setting the determinant equal to zero gives a dy dτ 2 +c dx dτ 2 −b dx dτ dy dτ = 0. W.e. or multiplying by (dτ /dx)2 a MMAE 517 (Illinois Institute of Technology) dy dx 2 −b dy dx + c = 0.d. the second derivatives are discontinuous along C.1). W. i.e. a unique solution exists for the second derivatives along the curve C. if the determinant of the coeﬃcient matrix is equal to zero.d. their behavior is determined by the sign of b2 − 4ac: b2 − 4ac > 0 ⇒ 2 real roots ⇒ 2 characteristics ⇒ hyperbolic p. Because the characteristics must be real.d. φ2 and φ3 . On the other hand.6) are called characteristic curves of equation (4.3)–(4. c 2010 K. and they are curves along which the second-order derivatives are discontinuous. which is the slope of the curve C. dx 2a (4.e. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.5) are three equations for three unknowns. the solution is not unique. then derivatives of all orders exist along C as well.Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation Equations (4.

W. 2 3 4 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.e. For the case of elliptic equations. 2 = 0. W. Then det[A] = ac − b2 /4 or > 0. The classiﬁcation depends on the coeﬃcients of the highest-order derivatives. we write (let x = x1 . Cassel 53 / 454 Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation Notes: 1 Physically. Note that if from equation (4. y = x2 .e. characteristics are curves along which information propagates in the solution.Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation The terminology arises from classiﬁcation of the second-degree algebraic equation ax2 + bxy + cy 2 + dx + ey + f = 0.1). then b b au11 + 2 u12 + 2 u21 + cu22 = H) A= a b/2 b/2 c (analogous to quadratic forms in MMAE 501). b and c. i. −4 det[A] = b − 4ac < 0. hyperbolic parabolic elliptic MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. conic sections.). It can be shown that the classiﬁcation of a partial diﬀerential equation is independent of the coordinate system (see. the matrix A is positive deﬁnite. Cassel 54 / 454 . Tannehill et al. for example. a. i.

dx dy = λ2 . y = λ 2 x + x2 . b and c are constant (λ1 . which are straight lines. dx (4. For example.7) If a.Classiﬁcation of Second-Order Partial Diﬀerential Equations Hyperbolic Equations Outline 4 Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation Hyperbolic Equations Parabolic Equations Elliptic Equations Mixed Equations MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∂t2 ∂x (y → t : a = σ 2 . σ 1 λ2 = − . then we may integrate to obtain y = λ1 x + x1 . λ1 = MMAE 517 (Illinois Institute of Technology) 1 . from equations (4. b = 0. Cassel 56 / 454 Computational Fluid Dynamics .6). W. Therefore.6) and (4. the solution propagates along two linear characteristic curves. say dy = λ1 . Cassel 55 / 454 Classiﬁcation of Second-Order Partial Diﬀerential Equations Hyperbolic Equations From equation (4. c = −1) where u(x. t) is the amplitude of the wave. λ2 constant). and σ is the wave speed. for a hyperbolic equation there are two real roots. Therefore.7). σ c 2010 K. consider the wave equation ∂2u ∂2u = σ2 2 . W.

Hyperbolic equations in ﬂuid dynamics: Unsteady inviscid ﬂow Steady supersonic inviscid ﬂow MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 0) = f (x). and c constant are straight lines with slopes 1/σ and −1/σ.e. F2 ) only depends upon the initial conditions. W. Cassel 58 / 454 . b. The solution to the wave equation is of the form u(x. c 2010 K. t) = F1 (x + σt) + F2 (x − σt). Cassel 57 / 454 Computational Fluid Dynamics Classiﬁcation of Second-Order Partial Diﬀerential Equations Hyperbolic Equations Note that no boundary conditions are necessary at speciﬁed values of x. such as u(x. i.Classiﬁcation of Second-Order Partial Diﬀerential Equations Hyperbolic Equations Therefore. and initial conditions are required at say t = 0. the solution (F1 . W. the characteristics of the wave equation with a. 0) = g(x). MMAE 517 (Illinois Institute of Technology) ut (x.

then we may integrate to obtain y= b x + γ1 .Classiﬁcation of Second-Order Partial Diﬀerential Equations Parabolic Equations Outline 4 Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation Hyperbolic Equations Parabolic Equations Elliptic Equations Mixed Equations MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. the solution propagates along one linear characteristic direction (usually time).g. consider the one-dimensional. temperature).g. Cassel 60 / 454 . 2a (4. W. b = c = 0) ∂t ∂x where u(x. which is dy b = . heat conduction) ∂u ∂2u = α 2 . Therefore. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. and α is the diﬀusivity.8) which is a straight line. (y → t : a = α. Cassel 59 / 454 Classiﬁcation of Second-Order Partial Diﬀerential Equations Parabolic Equations From equation (4.6). W. t) is the quantity undergoing diﬀusion (e. For example. for a parabolic equation there is only one real root. dx 2a If a and b are constant. unsteady diﬀusion equation (e.

the characteristics (with b = 0) are lines of constant t. Cassel 61 / 454 Classiﬁcation of Second-Order Partial Diﬀerential Equations Parabolic Equations Parabolic equations in ﬂuid dynamics: Unsteady Navier-Stokes Steady boundary-layer ﬂow (no separation): u ∂u ∂p ∂ 2 u ∂u +v =− + . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. t) = g(t). b = 0. Cassel 62 / 454 . ∂x ∂y ∂x ∂y 2 (a = 0. u(x2 . 0) = u0 (x). i. W. t) = f (t). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. such as u(x. Initial and boundary conditions are required. c = 1). u(x1 . In this case the solution marches forward in the x−direction from an initial velocity proﬁle.e.Classiﬁcation of Second-Order Partial Diﬀerential Equations Parabolic Equations The solution marches forward in time.

c = 1) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.Classiﬁcation of Second-Order Partial Diﬀerential Equations Elliptic Equations Outline 4 Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation Hyperbolic Equations Parabolic Equations Elliptic Equations Mixed Equations MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.) ∂2u ∂2u + 2 = 0. potential ﬂow. W. no characteristics ⇒ A disturbance anywhere aﬀects the solution everywhere instantaneously. consider the Laplace equation (e. For example. etc. two-dimensional steady heat conduction. Cassel 64 / 454 . Cassel 63 / 454 Classiﬁcation of Second-Order Partial Diﬀerential Equations Elliptic Equations Disturbances have inﬁnite speed of propagation in all directions. i.g. b = 0. W. ∂x2 ∂y (a = 1.e.

Classiﬁcation of Second-Order Partial Diﬀerential Equations Elliptic Equations Requires a global solution strategy. Cassel 66 / 454 . incompressible. Cassel 65 / 454 Classiﬁcation of Second-Order Partial Diﬀerential Equations Mixed Equations Outline 4 Classiﬁcation of Second-Order Partial Diﬀerential Equations Mathematical Classiﬁcation Hyperbolic Equations Parabolic Equations Elliptic Equations Mixed Equations MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. irrotational) ﬂow Poisson equation for pressure or streamfunction MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. W. Elliptic equations in ﬂuid dynamics: Steady Navier-Stokes (also steady energy equation) Potential (inviscid. and boundary conditions (typically u or ∂u/∂n) must be speciﬁed on a closed contour bounding the domain.

y → n : a = 1 − M 2 . W. b = 0. The governing equation for two-dimensional. To determine the nature of the equation. then b2 − 4ac may change sign with space and/or time. we have the same equation. c = 1). consider transonic ﬂow (Mach ∼ 1). Cassel 68 / 454 . W. and s and n are streamline coordinates with s locally being tangent to the streamline and n being normal to the streamline. but diﬀerent behavior in various regions. For example. n) is the velocity potential. where φ(s. Cassel 67 / 454 Classiﬁcation of Second-Order Partial Diﬀerential Equations Mixed Equations In the above example. therefore. M is the local Mach number. compressible. M < 1 ⇒ b2 − 4ac < 0 ⇒ Elliptic M = 1 ⇒ b2 − 4ac = 0 ⇒ Parabolic M > 1 ⇒ b2 − 4ac > 0 ⇒ Hyperbolic MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. we have diﬀerent equations in diﬀerent regions of the ﬂow. potential ﬂow about a slender body is (1 − M 2 ) ∂2φ ∂2φ + = 0. steady. In the following example. observe that b2 − 4ac = 0 − 4(1 − M 2 )(1) = −4(1 − M 2 ). ∂s2 ∂n2 (x → s. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.Classiﬁcation of Second-Order Partial Diﬀerential Equations Mixed Equations If a. b and c are variable coeﬃcients. ⇒ Character of equations may be diﬀerent in certain regions.

W. W.Classiﬁcation of Second-Order Partial Diﬀerential Equations Mixed Equations Consider the steady. incompressible viscous ﬂow past a surface. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 70 / 454 . Cassel 69 / 454 Numerical Solutions of Elliptic Problems Introduction Outline 5 Numerical Solutions of Elliptic Problems Introduction Finite-Diﬀerence Methods for the Poisson Equation Direct Methods for Linear Systems Fourier Transform Methods Cyclic Reduction Iterative (Relaxation) Methods Jacobi Iteration Gauss-Seidel Iteration Successive Overrelaxation (SOR) Boundary Conditions Dirichlet Boundary Conditions Neumann (Derivative) Boundary Conditions Alternating-Direction-Implicit (ADI) Method Compact Finite Diﬀerences Multigrid Methods Motivation Multigrid Methodology Speed Comparisons MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

e. W. 2 Global solution method. W. Cassel 71 / 454 Numerical Solutions of Elliptic Problems Introduction Recall that elliptic problems have no preferred direction of propagation. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. they require: 1 Boundary conditions on a closed contour surrounding the domain. i. Cassel 72 / 454 . therefore.Numerical Solutions of Elliptic Problems Introduction Outline (cont’d) Treatment of Nonlinear Convective Terms Upwind-Downwind Diﬀerencing MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. boundary-value problem.

Numerical Solutions of Elliptic Problems

Introduction

**Types of boundary conditions:
**

1 2 3

**Dirichlet – φ speciﬁed. Neumann –
**

∂φ ∂n

**speciﬁed (n is normal to boundary).
**

∂φ ∂n

Robin (mixed) –

+ aφ = b speciﬁed

Notes:

1

Combinations of the above boundary conditions may be applied on diﬀerent portions of the boundary as long as some boundary condition is applied at every point along the boundary contour. Solutions to the Laplace and Poisson equations with Neumann boundary conditions on the entire boundary can only be determined relative to an unknown constant, i.e. φ(x, y) + c is a solution.

2

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

73 / 454

Numerical Solutions of Elliptic Problems

Introduction

**Linear vs. Non-Linear Elliptic Problems: Linear – Linear equation and boundary conditions
**

e.g. Laplace (f = 0) or Poisson equations ∂2φ ∂2φ + = f (x, y), ∂x2 ∂y 2 with Dirichlet, Neumann or Robin boundary conditions.

Non-Linear:

1

2

Linear equation with non-linear boundary conditions; e.g. heat conduction with radiation condition ∂2T ∂2T + = 0, ∂x2 ∂y 2 ∂T 4 = D(T 4 − Tsur ). ∂n Non-linear equation; e.g.: Navier-Stokes equations „ 2 « ∂u ∂u ∂p 1 ∂ u ∂2u u +v =− + + . ∂x ∂y ∂x Re ∂x2 ∂y 2 Note that as Reynolds number, Re, increases, the non-linearity increases.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

74 / 454

Numerical Solutions of Elliptic Problems

Finite-Diﬀerence Methods for the Poisson Equation

Outline

5

Numerical Solutions of Elliptic Problems Introduction Finite-Diﬀerence Methods for the Poisson Equation Direct Methods for Linear Systems

Fourier Transform Methods Cyclic Reduction

**Iterative (Relaxation) Methods
**

Jacobi Iteration Gauss-Seidel Iteration Successive Overrelaxation (SOR)

Boundary Conditions

Dirichlet Boundary Conditions Neumann (Derivative) Boundary Conditions

**Alternating-Direction-Implicit (ADI) Method Compact Finite Diﬀerences Multigrid Methods
**

Motivation Multigrid Methodology Speed Comparisons

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 75 / 454

Numerical Solutions of Elliptic Problems

Finite-Diﬀerence Methods for the Poisson Equation

Outline (cont’d)

Treatment of Nonlinear Convective Terms

Upwind-Downwind Diﬀerencing

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

76 / 454

Numerical Solutions of Elliptic Problems

Finite-Diﬀerence Methods for the Poisson Equation

As a representative elliptic equation, which is important in its own right, consider the two-dimensional Poisson equation ∂2φ ∂2φ + 2 = f (x, y), ∂x2 ∂y where if f (x, y) = 0 we have the Laplace equation. (5.1)

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

77 / 454

Numerical Solutions of Elliptic Problems

Finite-Diﬀerence Methods for the Poisson Equation

In order to deﬁne the grid: Divide the x interval, 0 ≤ x ≤ a, into I equal subintervals of length ∆x, with xi = ∆x(i − 1). Divide the y interval, 0 ≤ y ≤ b, into J equal subintervals of length ∆y, with yj = ∆y(j − 1).

⇒ 2-D grid intersecting in (I + 1) × (J + 1) points.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

78 / 454

Numerical Solutions of Elliptic Problems

Finite-Diﬀerence Methods for the Poisson Equation

Consider an approximation to equation (5.1) at a typical point (i, j); the ﬁve point ﬁnite-diﬀerence stencil is

Using second-order accurate, central diﬀerences (with φi,j = φ(xi , yj )): φi+1,j − 2φi,j + φi−1,j ∂2φ ≈ + O(∆x2 ), 2 ∂x (∆x)2 ∂2φ φi,j+1 − 2φi,j + φi,j−1 ≈ + O(∆y 2 ). 2 ∂y (∆y)2

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 79 / 454

Numerical Solutions of Elliptic Problems

Finite-Diﬀerence Methods for the Poisson Equation

**Substituting into (5.1) and multiplying by (∆x)2 gives the ﬁnal form of the ﬁnite-diﬀerence equation φi+1,j − 2 1 + ∆x ∆y
**

2

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

∆x ∆y

2

(φi,j+1 + φi,j−1 ) = (∆x)2 fi,j ,

(5.2) which results in a system of (I + 1) × (J + 1) equations for (I + 1) × (J + 1) unknowns. There are two options for solving such systems of equations:

1

Direct Methods:

i) ii) iii) iv) No iterative convergence errors. Eﬃcient for certain types of linear systems, e.g. tridiagonal, block-tridiagonal. Become less eﬃcient for large systems of equations. Typically cannot adapt to non-linear problems.

2

Iterative Methods:

i) Iterative convergence errors. ii) Generally more eﬃcient for large systems of equations. iii) Apply to non-linear problems.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

80 / 454

W. Cassel 82 / 454 . W.Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems Outline 5 Numerical Solutions of Elliptic Problems Introduction Finite-Diﬀerence Methods for the Poisson Equation Direct Methods for Linear Systems Fourier Transform Methods Cyclic Reduction Iterative (Relaxation) Methods Jacobi Iteration Gauss-Seidel Iteration Successive Overrelaxation (SOR) Boundary Conditions Dirichlet Boundary Conditions Neumann (Derivative) Boundary Conditions Alternating-Direction-Implicit (ADI) Method Compact Finite Diﬀerences Multigrid Methods Motivation Multigrid Methodology Speed Comparisons MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 81 / 454 Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems Outline (cont’d) Treatment of Nonlinear Convective Terms Upwind-Downwind Diﬀerencing MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

j = 1. and i = 1. . our ﬁve-point ﬁnite diﬀerence stencil becomes MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.j − 2(1 + ∆)φi. . I + 1. Cassel 84 / 454 . . Repeating the diﬀerence equation (5. . . . .j−1 ) = (∆x)2 fi. . J + 1. . . ¯ where ∆ = (∆x/∆y)2 . In order to write the system of diﬀerence equations in matrix form. .j . I + 1 and j = 1. j) into a one-dimensional array (n) as follows (5. . we have ¯ ¯ φi+1. . where i = 1. n = 1.Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems We wish to consider direct methods for solving the discretized Poisson equation. let us renumber the two-dimensional mesh (i. .2) for the Poisson equation. Therefore.3) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. . (I + 1)(J + 1). the relationship between the one-dimensional and two-dimensional indices is n = (i − 1)(J + 1) + j. Cassel 83 / 454 Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems Thus. J + 1. W.j + φi−1.j + ∆ (φi. . . .j+1 + φi. . . W.

. (I + 1)(J + 1). . etc.4) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. . .4) for the Poisson equation becomes (with ¯ ∆ = ∆x = ∆y ⇒ ∆ = 1) φn+J+1 + φn−(J+1) + φn+1 + φn−1 − 4φn = ∆2 fn . and the tridiagonal blocks are −4 1 0 ··· 0 0 1 −4 1 · · · 0 0 0 1 −4 · · · 0 0 D= . . . the method for solving the system Aφ = d depends upon the form of the coeﬃcient matrix A: Full or dense ⇒ Gauss elimination. . . . (5. . . . such as the Poisson equation): → Tridiagonal ⇒ Thomas algorithm → Fast Fourier Transform (FFT) and/or cyclic reduction. the system of equations Aφ = d is of the form D I 0 ··· 0 0 φ1 d1 I D I ··· 0 0 φ2 d2 0 I D ··· 0 0 φ3 d3 = . . . .. W. . . . W. . . . . separable elliptic partial diﬀerential equations. . (very expensive computationally). Cassel 86 / 454 . . . . . which generally are the fastest methods for problems in which they apply.Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems And the ﬁnite-diﬀerence equation (5. . . . I is an identity matrix block. 0 0 0 · · · D I φ(I+1)(J+1)−1 d(I+1)(J+1)−1 0 0 0 ··· I D φ(I+1)(J+1) d(I+1)(J+1) A is a block tridiagonal matrix with (I + 1) blocks in both directions. . LU decomposition. . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. and d contains all known information from the boundary conditions. Cassel 85 / 454 Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems 0 is a zero matrix block. where each block is a (J + 1) × (J + 1) matrix.. Sparse and banded → Result from discretizations of certain classes of problems (e. . . . . . Thus. . . . 0 0 0 · · · −4 1 0 0 0 ··· 1 −4 In general. . . . where n = 1.g. .

W. .. . . and i is the imaginary number. Cassel 88 / 454 . N − 1.. N∆ n=− N N . W. the discrete Fourier transform is ∞ H(fn ) = −∞ h(t)e2πifn t dt. k = 0. . The inverse transform is ∞ h(t) = −∞ H(f )e−2πif t df.Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems Fourier Transform Methods The Fourier transform of a continuous function h(t) is deﬁned by ∞ H(f ) = −∞ h(t)e2πif t dt. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.. or approximating the integral by summing over each ∆ interval N −1 H(fn ) ≈ k=0 hk e2πifn tk ∆. where ∆ is the step size in the data. . 1. tk = k∆. 2 2 corresponding to the Nyquist critical frequency range. Consider the discrete form of the Fourier transform in which we have N values of h(t) at discrete points deﬁned by hk = h(tk ). where f is the frequency. Cassel 87 / 454 Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems After taking the Fourier transform. 2. we will have N discrete points in the frequency domain deﬁned by fn = n . Using the fact that fn tk = (n/N ∆)k∆ = nk/N gives N −1 H(fn ) ≈ ∆ k=0 hk e2πikn/N . Thus.

Cassel (5. .2). set ∆ = ∆x = ∆y giving (with i → k.5) K−1 L−1 Φ(fm.9) where now fk. . m = −K .6)) φk.l + φk−1. . W. .8) Now let us apply this to the discretized Poisson equation (5. . j → l) φk+1.l e2πimk/K e2πinl/L . K . we write N −1 ˆ ∴ H(fn ) ≈ ∆hn .l = ∆2 fk. ˆ φm. .n = k=0 l=0 Computational Fluid Dynamics φk. . .l .8) into equation (5. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.l . n=−N/2 (5. For a two-dimensional grid. .Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems ˆ Denoting the summation in the previous expression by hn . . The inverse Fourier transform is (analogous to (5. . . ˆ hn = k=0 hk e2πikn/N .l−1 − 4φk. Cassel 90 / 454 .9) leads to ˆ φm. .l+1 + φk. ˆ where fm. Substituting equation (5.7) 89 / 454 MMAE 517 (Illinois Institute of Technology) Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems This is equivalent to taking the Fourier transform in each direction. m=−K/2 n=−L/2 (5.5) The discrete inverse Fourier transform is then 1 hk = N N/2 ˆ hn e−2πikn/N . (5.n e−2πikm/K e−2πiln/L . we deﬁne: k = 0.n ) ≈ ˆ ∆2 φm.n .l + φk. 2 2 l = 0.n e−2πi(k+1)m/K e−2πiln/L + e−2πi(k−1)m/K e−2πiln/L +e−2πikm/K e−2πi(l+1)n/L + e−2πikm/K e−2πi(l−1)n/L ˆ −4e−2πikm/K e−2πiln/L = ∆2 fm. L 2 2 → Physical grid → Transform space (frequency) The two-dimensional discrete Fourier transform of φ is (analogous to (5.6) The above expressions are all for a one-dimensional domain. (5.l is the right-hand-side of the Poisson equation (not frequency). W. .l 1 = KL K/2 L/2 ˆ φm. L − 1 n = −L. For simplicity. . . K − 1.n e−2πikm/K e−2πiln/L . c 2010 K.n is the Fourier transform of the right-hand-side fk.

n from equation (5. Cassel 92 / 454 .n 2 cos 2πm + cos K . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 2πn L −2 for m = 1. .n = ˆ ∆2 fm.n = k=0 l=0 fk.n .8).l using (similar to (5. . (5. Recalling that cos(ax) = eiax + e−iax /2 gives ˆ φm. . . .7)) K−1 L−1 ˆ fm. W.10) 2πm K + 2 cos 2πn L ˆ − 4 = ∆2 fm.n e−2πim/K + e2πim/K + e−2πin/L + e2πin/L − 4 = ∆2 fm.10). . L − 1.l e2πimk/K e2πinl/L . n = 1. we have ˆ ˆ φm.Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems Canceling the common factor e−2πikm/K e−2πiln/L . . . to solve the diﬀerence equation (5.l using the inverse Fourier transform (5. Cassel 91 / 454 Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems Therefore.n of the right-hand-side fk.n . 3) Compute φk. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. (5.n 2 cos ˆ Solving for φm.9) using Fourier transform methods: ˆ 1) Compute the Fourier transform fm.11) ˆ 2) Compute φm.n leads to ˆ φm. K − 1.

W. For Dirichlet boundary conditions ⇒ Use sine transform. J. y). 4) We use Fourier transforms to solve the diﬀerence equation.l+L . Cassel 93 / 454 Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems Cyclic Reduction Again. . the solution satisﬁes φk. . j = 0. I. . Cassel 94 / 454 . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. .l = φk+K. 2) In practice.l = φk. For Neumann boundary conditions ⇒ Use cosine transform. for example. . . therefore. ∂x2 ∂y discretized on a two-dimensional grid with ∆ = ∆x = ∆y and i = 0. consider the Poisson equation ∂2φ ∂2φ + 2 = f (x. this is not a spectral method. W. 3) Fourier transform methods can only be applied to partial diﬀerential equations with constant coeﬃcients in the direction(s) for which the Fourier transform is applied. where I = 2n with integer n ((I + 1) × (J + 1) points): MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. .e. the Fourier (and inverse) transforms are computed using a Fast Fourier Transform (FFT) technique (see. not the diﬀerential equation. i.Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems Notes: 1) The above procedure works for periodic boundary conditions. Numerical Recipes). .

ui−1 + Bui + ui+1 = ∆2 fi . fi. . . 0 0 ··· ··· ··· . . . Note that equation (5. ··· ··· 0 0 0 . the diﬀerence equation for constant x-lines becomes ui−1 − 2ui + ui+1 + B ui = ∆2 fi . . (5.13) for i − 1. W. . where φi. where the (J + 1) × (J + 1) matrix B is −4 1 0 1 −4 1 0 1 −4 B= . . 0 0 0 1 −2 . .J fi = . (5. equation (5. 0 0 0 0 0 0 i = 0. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.12) becomes ui−1 + Bui + ui+1 = ∆2 fi . . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. . ui + Bui+1 + ui+2 = ∆2 fi+1 . .J−1 fi.J−1 φi. i and i + 1: ui−2 + Bui−1 + ui = ∆2 fi−1 .1 φi. where I is the identity matrix. .1 fi. . . . i = 0.’ Writing three successive equations of (5. .12) correspond to the central diﬀerence in the x-direction. . . ··· ··· 0 0 0 . . fi. 1 −4 0 0 0 . . I. −2 1 0 B = . .13) corresponds to the block-tridiagonal matrix for equation (5. .Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems Applying central diﬀerences to the Poisson equation.. where B is the tridiagonal portion and ui−1 and uu+1 are the ’fringes.J .2 . . . −2 1 0 0 0 . . ..13) ··· ··· ··· . . . . 1 −2 The ﬁrst three terms in equation (5. Cassel 96 / 454 . I. .0 φi.12) ui = . and the fourth term corresponds to the central diﬀerence in the y-direction (see B ).2 . φi.4).0 fi. . −4 1 . . . 0 0 1 −2 1 . Cassel 95 / 454 Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems Taking B = −2I + B . . . . W.

where B∗ = 2I − B2 . solutions for all other i are obtained by successively solving the tridiagonal problems at each level in reverse: (5. applying this procedure to all even numbered i equations in (5. This cyclic reduction procedure can be repeated until a single equation remains for the middle line of variables. 2) Cyclic reduction may be applied to somewhat more general equations.13). 3) Can accelerate by taking FFT in one direction (with constant coeﬃcients) and using cyclic reduction in the other. Cassel 97 / 454 Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems This results in a total of I tridiagonal problems to obtain ui . uI/2 (I = 2n . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.14) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. This is an equation of the same form as (5. such as those with variable coeﬃcients. . Thus. W. I. fi∗ = fi−1 − Bfi + fi+1 .Numerical Solutions of Elliptic Problems Direct Methods for Linear Systems Multiplying −B times the middle equation and adding all three gives ui−2 + B∗ ui + ui+2 = ∆2 fi∗ . therefore. Cassel 98 / 454 . Notes: 1) Speed of FFT and cyclic reduction methods are comparable. . . using the solution for uI/2 . with integer n). W.13) reduces the number of equations by a factor of two. i = 0. . which is tridiagonal.

Cassel 100 / 454 . W. Cassel 99 / 454 Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods Outline (cont’d) Treatment of Nonlinear Convective Terms Upwind-Downwind Diﬀerencing MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W.Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods Outline 5 Numerical Solutions of Elliptic Problems Introduction Finite-Diﬀerence Methods for the Poisson Equation Direct Methods for Linear Systems Fourier Transform Methods Cyclic Reduction Iterative (Relaxation) Methods Jacobi Iteration Gauss-Seidel Iteration Successive Overrelaxation (SOR) Boundary Conditions Dirichlet Boundary Conditions Neumann (Derivative) Boundary Conditions Alternating-Direction-Implicit (ADI) Method Compact Finite Diﬀerences Multigrid Methods Motivation Multigrid Methodology Speed Comparisons MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

where L is the ﬁnite-diﬀerence operator for the particular problem.j at each point i. Cassel 102 / 454 MMAE 517 (Illinois Institute of Technology) . .1) ¯ ¯ φi+1.2) for the Poisson equation (5. . J + 1.j+1 + φi.j .j max |φn | i.17) 2(1 + ∆) Procedure: 1 Provide an initial guess φ1 for φi. . . . . This may be written in general form as Lφ = f. I + 1. (5.j .j 1 n n n 2 ¯ n ¯ φi+1. . for example. . Computational Fluid Dynamics c 2010 K. .16) until convergence.j i.15) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. . .j + ∆ φi. j = 1. . Relax (iterate) by applying (5.j + φi−1.j i. . W. Iterative methods consist of beginning with an initial guess and iteratively “relaxing” equation (5. 2 3 = 10−4 ⇒ convergence to ∼ 4 signiﬁcant ﬁgures.15) for φi.j−1 ) = (∆x)2 fi.j i. (5.j and indicating the iteration number using a superscript φn+1 = i. φ3 .16) (5. . determined by max |φn+1 − φn | i.j i = 1.j Continue until convergence. Cassel 101 / 454 Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods Jacobi Iteration Solving equation (5.j−1 − (∆x) fi.17) at each grid point to produce successive approximations: φ2 .Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods Returning to the diﬀerence equation (5.j + φi−1.j + ∆ (φi. .j − 2(1 + ∆)φi.j+1 + φi. φn . ¯ where ∆ = (∆x/∆y)2 . < .j where. W. i.

section 2. 1 Let D = diagonal elements of A −L = lower triangular elements of A −U Therefore. j = 1. 1 1 or x(n+1) = Mx(n) + M−1 c. . .Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods Notes: 1 2 3 4 Convergence is too slow ⇒ not used in practice. Cassel 104 / 454 .2 notes. = upper triangular elements of A MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. → See MMAE 501. We write A = M1 − M2 . . thus. W.j i. Multiplying by M−1 gives 1 x(n+1) = M−1 M2 x(n) + M−1 c. Requires φn+1 and φn to be stored for all i = 1. . Ax = (D − L − U)x = c. where we put the iteration number in parentheses in order to distinguish it from powers. M2 = L + U): Dx(n+1) = (L + U)x(n) + c x(n+1) = D−1 (L + U)x(n) + D−1 c ∴ M = M−1 M2 = D−1 (L + U) 1 Then we check to be sure that the spectral radius of M satisﬁes ρ < 1 to ensure convergence of the iterative scheme. . . an iterative scheme may be devised by writing Ax = c in the form M1 x(n+1) = M2 x(n) + c. i. Then for Jacobi iteration (M1 = D. Although not necessary. J + 1. W. I + 1.j Used as a basis for comparison with other methods to follow. . Cassel 103 / 454 Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods where M = M−1 M2 is the iteration matrix. it is instructive to view iterative methods in matrix form Ax = c. . 1 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.2.

J) = 1 cos 2 π I +1 + cos π J +1 . Cassel 106 / 454 . For example. Must store current and previous iterations for entire grid.e. As a result. (5. Cassel 105 / 454 Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods Gauss-Seidel Iteration There are two problems with Jacobi iteration: 1 2 Slow convergence. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. It ¯ can be shown that for equation (5. ρJac (I) → 1.18) therefore. The Gauss-Seidel method addresses both problems by using the most recently updated information. then ρJac (I) = cos π I +1 1 =1− 2 π I +1 2 + ··· . W. If I = J and I is large.Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods In addition. if sweeping along lines of constant y MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. as I → ∞. a smaller spectral radius results in more rapid convergence. we observe slower convergence as I is increased.17) with ∆ = 1 (∆x = ∆y) and Dirichlet boundary conditions that ρJac (I. there is a disproportionate increase in computational time as I is increased. i.

j + φi−1.j 1 n+1 n+1 2 n ¯ n ¯ φi+1.Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods Therefore. equation (5. Note: It can be shown that diagonal dominance of A is a suﬃcient (but not necessary) condition for convergence of the Jacobi and Gauss-Seidel iteration methods. the points φi.19) 2(1 + ∆) Observe that now it is not necessary to store φn at the previous iteration.j−1 and φi−1. (5. i. ρ < 1.j values of φi. the Gauss-Seidel method is (M1 = D − L. the Gauss-Seidel method requires one-half the iterations for the same level of accuracy. where ρ is the spectral radius of M = M−1 M2 (see Morton 1 and Mayers.e.j−1 − (∆x) fi.j have already been updated. (5. i.j+1 + φi. Jac MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 107 / 454 Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods therefore.j + ∆ φi. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. for our model problem ρGS (I) = ρ2 (I) Jac 1 = 1− 2 π I +1 2 2 + ··· =1− π I +1 2 + · · · . 205 for proof). p.j . and it is not necessary to distinguish between the (n) or (n + 1)st iterates.j . the rate of convergence is twice as fast as for Jacobi. W. and using these updated values.j are all stored in the same array. We simply use the most recently updated information. In matrix form. M2 = U): (D − L)x(n+1) = Ux(n) + c x(n+1) = (D − L)−1 Ux(n) + (D − L)−1 c ∴ M = M−1 M2 = (D − L)−1 U 1 It can be shown that ρGS = ρ2 .17) is changed to φn+1 = i. The i.20) Thus. when updating φi.e. Cassel 108 / 454 .

22) and for this ωopt . the new SOR iterate is given by i. the change at each iteration.j i.j φn+1 = (1 − ω)φn + ωφ∗ . p. In matrix form. the iterative solution normally approaches the exact solution very slowly. i. Cassel 110 / 454 . (5. M2 = (1 − ω)D + ωU): (D − ωL)x(n+1) = [(1 − ω)D + ωU] x(n) + ωc x(n+1) = (D − ωL)−1 [(1 − ω)D + ωU] x(n) + ω(D − ωL)−1 c ∴ M = M−1 M2 = (D − ωL)−1 [(1 − ω)D + ωU] 1 It can be shown that for the Poisson equation. the spectral radius for SOR is ρSOR = ρJac 1+ 1 − ρ2 Jac 2 . W. (5. W. So if we denote the Gauss-Seidel iterate (5.j i. This is accomplished by taking a weighted average of the previous iterate φn and i. while underrelaxation is often required for convergence when dealing with non-linear problems.23) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. the optimal value of ω is ωopt = 2 1+ 1 − ρ2 Jac .j .Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods Successive Overrelaxation (SOR) In Gauss-Seidel iteration. ω=1 ⇒ Gauss-Seidel 1<ω<2 0<ω<1 MMAE 517 (Illinois Institute of Technology) ⇒ Overrelaxation ⇒ Underrelaxation c 2010 K.” or magnifying.21) where ω is the relaxation parameter and 0 < ω < 2 for convergence (Morton & Mayers. Convergence can often be accelerated by “over-relaxing. Cassel 109 / 454 Computational Fluid Dynamics Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods Overrelaxation typically accelerates convergence of linear problems. 206).j (5. the sign of the error typically does not change from iteration to iteration.j n+1 the Gauss-Seidel iterate φi. therefore. the SOR method is (M1 = D − ωL.19) by φ∗ .

as I → ∞. Cassel 111 / 454 Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods Then for large I ρSOR ≈ 1 − 1+ 1 1− 2 1 2 π I+1 π I+1 2 2 2 ≈ π I +1 π 1− + ··· I +1 2 (5. and ρSOR → 1. 1 + I+1 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ρJac = 1 − ωopt = = 1+ = 1+ ωopt ≈ 1− 1− 2 1− 1− 2 1+ 1 − ρ2 Jac 2 1 2 1 2 π I+1 2 + · · · . Cassel 112 / 454 . W. ωopt → 2.Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods Recall that for our model problem.25) ≈ ρSOR ≈ π 1− + ··· I +1 1− 2π . W. I +1 2 Thus.24) π I+1 2 + ··· 2 π . thus. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. π I+1 2 2 + ··· (5.

Typically.g. we do not. such that SOR converges at a rate 2(I+1) times faster than Gauss-Seidel if the π optimal value of the relaxation parameter is used for the model problem under consideration. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. from a comparison of equations (5. W. e. W.20). Therefore. ωopt must be estimated from a similar problem and/or trial and error.Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods However. This analysis assumes that we know ωopt . and the rate of convergence depends signiﬁcantly on the choice of ω. the relative convergence rate improves linearly with increasing I. it does depend upon: i) ii) iii) iv) diﬀerential equation method of discretization boundary conditions shape of domain 2 For a given problem. Cassel 114 / 454 .25) and (5. the typical behavior for linear problems is as follows (for given I): MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. we see that ρSOR < ρGS . Cassel 113 / 454 Numerical Solutions of Elliptic Problems Iterative (Relaxation) Methods Notes: 1 Although ωopt does not depend on the right-hand-side.

W.Numerical Solutions of Elliptic Problems Boundary Conditions Outline 5 Numerical Solutions of Elliptic Problems Introduction Finite-Diﬀerence Methods for the Poisson Equation Direct Methods for Linear Systems Fourier Transform Methods Cyclic Reduction Iterative (Relaxation) Methods Jacobi Iteration Gauss-Seidel Iteration Successive Overrelaxation (SOR) Boundary Conditions Dirichlet Boundary Conditions Neumann (Derivative) Boundary Conditions Alternating-Direction-Implicit (ADI) Method Compact Finite Diﬀerences Multigrid Methods Motivation Multigrid Methodology Speed Comparisons MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 116 / 454 . W. Cassel 115 / 454 Numerical Solutions of Elliptic Problems Boundary Conditions Outline (cont’d) Treatment of Nonlinear Convective Terms Upwind-Downwind Diﬀerencing MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

j .17). Cassel 117 / 454 MMAE 517 (Illinois Institute of Technology) Numerical Solutions of Elliptic Problems Boundary Conditions Neumann (Derivative) Boundary Conditions Consider the following boundary condition ∂φ = c at x = 0. . 2(1 + ∆) Computational Fluid Dynamics c 2010 K. .19).2 1 n 2 ¯ n ¯ φ3. I.2 + ∆ φ2. J. . . or SOR (5.Numerical Solutions of Elliptic Problems Boundary Conditions Dirichlet Boundary Conditions Simply apply the speciﬁed values at the boundaries to φ1. φI+1. Cassel 118 / 454 .J+1 and iterate on the Jacobi (5. φi. Jacobi or Gauss-Seidel iterate at i = 2. j = 2: φn+1 = 2. ∂x (5. . and φi. W. . .j .21) equation in the interior. Gauss-Seidel (5.2 . . i = 2.3 + φ2. W. j = 2.26) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. For example.2 + φ1.1 .1 − (∆x) f2.

j 1 n n n 2 ¯ n ¯ φ2. 1. .j + O(∆x) = c. J.j + ∆ φ1. (5. because (5.j and substituting into the diﬀerence equation (5. . Cassel 120 / 454 MMAE 517 (Illinois Institute of Technology) . Therefore. Cassel 119 / 454 Numerical Solutions of Elliptic Problems Boundary Conditions However.j 0. .j 2.j−1 − (∆x) f1. .29) for φn gives 0. W. For example.j in the interior for i = 2. 0.j 0.17).27) is only ﬁrst-order accurate. . A second-order 0. this involves a value φn that is outside the domain. . . .j Notes: 1 This is the same procedure used for a Dirichlet condition but with an additional sweep along the left boundary using (5.19).j = φ2. W. .Numerical Solutions of Elliptic Problems Boundary Conditions The simplest treatment would be to use the Jacobi (5. I.26) by a forward diﬀerence applied at i = 1 φ2. This is unacceptable. 1. or SOR (5. J using φ1. j = 2.j .j φn+1 = 1. j = 2.30) for φn+1 .j φn = φn − 2c∆x.26) is φn − φn 2. Gauss-Seidel (5. solving (5.j − φ1. .j + O(∆x2 ) = c.30) 2(1 + ∆) (5.j−1 − (∆x) f1. 2(1 + ∆) (5.30) to update φn+1 .28) to eliminate φn leads to 0.j − c∆x + ∆ φ1. . we could apply Jacobi (5. but now apply the diﬀerence equation at the boundary.21) equation to update φi.j + φ0. . j = 2. 2∆x which also involves the value φn . . we use (5. and then to approximate the boundary condition (5. .j .28) (5.17) at i=1 φn+1 = 1.j − c∆x. J. however.j accurate central-diﬀerence approximation for the boundary condition (5. .j+1 + φ1.j+1 + φ1. A better alternative is to update the interior points as before. .j .29) Thus.27) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.j 1 n n 2 ¯ n ¯ 2 φ2.j Computational Fluid Dynamics c 2010 K. ∆x This could then be used to update φ1.

Cassel 122 / 454 MMAE 517 (Illinois Institute of Technology) . W.J+2 is outside the domain. Computational Fluid Dynamics c 2010 K. 2(1 + ∆) 3 4 which is used to update the corner value i = 1.J+2 − φ d. Cassel 121 / 454 Numerical Solutions of Elliptic Problems Boundary Conditions Applying (5. 2(1 + ∆) (5.J+1 . consider if in addition to (5.J+1 − c∆x + ∆ φ1.30) at the corner i = 1.J+1 .J+1 φn 1.Numerical Solutions of Elliptic Problems 2 Boundary Conditions This approach requires special treatment at corners depending upon the boundary condition along the adjacent boundary.31) using a central diﬀerence in the same manner as (5.32) n where φ1.26) we have ∂φ =d ∂y at y = b.J+2 + φ1.J+2 = φ1.J+1 1 n 2 ¯ n ¯ 2 φ2. j = J + 1 1 n n 2 ¯ n ¯ 2 φ2.J+2 gives φn+1 = 1. For example.27).31) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. such as (5.J + d∆y − (∆x) f1. etc. The above approach is used in thomas.29) gives φn+1 = 1. Substituting into (5.32) to eliminate φn 1. = which leads to n φn 1. is used at a boundary.J − (∆x) f1. (5. If a lower-order approximation. Approximating (5.J + 2d∆y.f. j = J + 1.J+1 − c∆x + 2∆ φ1. its truncation error generally dominates the convergence rate. W.

W. W. Cassel 123 / 454 Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method Outline (cont’d) Treatment of Nonlinear Convective Terms Upwind-Downwind Diﬀerencing MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 124 / 454 .Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method Outline 5 Numerical Solutions of Elliptic Problems Introduction Finite-Diﬀerence Methods for the Poisson Equation Direct Methods for Linear Systems Fourier Transform Methods Cyclic Reduction Iterative (Relaxation) Methods Jacobi Iteration Gauss-Seidel Iteration Successive Overrelaxation (SOR) Boundary Conditions Dirichlet Boundary Conditions Neumann (Derivative) Boundary Conditions Alternating-Direction-Implicit (ADI) Method Compact Finite Diﬀerences Multigrid Methods Motivation Multigrid Methodology Speed Comparisons MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

(5. i. ⇒ These techniques are not very “elliptic like. Cassel 126 / 454 . Gauss-Seidel. For example.33) Consider the j th line and assume that values along the j + 1st and j − 1st lines are taken from the previous iterate. all at once.j + ∆ (φi. (5. I. would allow for the boundary condition at x = a to inﬂuence the solution in the entire domain after only one sweep through the grid. the solution anywhere depends on the solution everywhere. .e.j−1 .j . i. it takes I iterations before the boundary condition at x = a is “felt” at x = 0. and SOR.Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method Recall that in elliptic problems.j along the j th solved using the Thomas algorithm. .15) for the Poisson equation ¯ ¯ φi+1. . which can be MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. sweeping along lines of constant y and solving each constant y-line implicitly.34) line.j − 2(1 + ∆)φi.j along the j th line gives ¯ ¯ i. For example. However.j Therefore. in Jacobi.e.j−1 ) = (∆x)2 fi.j i−1. information only propagates through the mesh one point at a time. W. i = 2. it has an inﬁnite speed of propagation in all directions. i+1. Cassel 125 / 454 Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method Returning to the diﬀerence equation (5.” A more “elliptic-like” method could be obtained by solving entire lines in the grid in an implicit manner. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.j + φi−1.j+1 + φn φn+1 − 2(1 + ∆)φn+1 + φn+1 = (∆x)2 fi. we have a tridiagonal problem for φi.33) as an implicit equation for the values of φi.j+1 + φi.j − ∆ φn i. if sweeping along lines of constant y with 0 ≤ x ≤ a. . Rewriting (5.j i.

j−1 − φi+1. I: ¯ ¯ ¯ ∆φn+1 − (2∆ + σ)φn+1 + ∆φn+1 = (∆x)2 fi.34).j + φi−1. In the ﬁrst half of the iteration we perform a sweep along constant y-lines by solving the series of tridiagonal problems for j = 2. J.and y-directions are kept separate to mimic diﬀusion in each direction. . Note that the σ terms on each side of the equation cancel. σ is an acceleration parameter to enhance diagonal dominance (σ > 0). . therefore. .j−1 becomes φi. This is called a splitting method. Cassel 128 / 454 . ADI Method In the ADI method we sweep along lines but in alternating directions. Can also incorporate SOR. .e.j−1 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.j n+1/2 σ n ¯ −∆ φ n . n+1/2 2 3 In the second half of the iteration we sweep along constant x-lines by solving the series of tridiagonal problems for i = 2. . W. Therefore.j j = 2. j = 2.j i. W. ¯ i. . i. Cassel n+1/2 n+1/2 n+1/2 (5. . . . then φn i. J: φi+1.36) where φn+1 has been updated from the previous line.j MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method Notes: 1 2 3 4 n+1 If sweeping through j-lines. . it reduces the number of iterations required for convergence.35) 127 / 454 Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method Notes: 1 The φi.j = (∆x)2 fi. i−1.j+1 − 2 − ∆ φi.j−1 term on the right-hand-side has been updated from the previous line. I.j n+1/2 n+1/2 + φn+1 . i = 2. This provides motivation for the ADI method. . (5. we use updated values as in Gauss-Seidel.j + φi. but there is more computation per iteration. . . . diﬀerencing in the x. σ = 0 corresponds to no acceleration. . .j − (2 + σ)φi.j−1 in (5. it has already been updated. J.j i. .j+1 i. Unlike in equation (5. .j − (2 − σ) φi. i−1. .34). . More eﬃcient at spreading information throughout the domain.

W. W. 3 The ADI method with splitting is typically faster than Gauss-Seidel or SOR for equations in which the terms are easily factored into x and y directions. where R = max(I + 1.Numerical Solutions of Elliptic Problems Alternating-Direction-Implicit (ADI) Method Notes: 1 2 Involves (I − 1) + (J − 1) tridiagonal solves for each iteration (for Dirichlet boundary conditions). Cassel 129 / 454 Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences Outline 5 Numerical Solutions of Elliptic Problems Introduction Finite-Diﬀerence Methods for the Poisson Equation Direct Methods for Linear Systems Fourier Transform Methods Cyclic Reduction Iterative (Relaxation) Methods Jacobi Iteration Gauss-Seidel Iteration Successive Overrelaxation (SOR) Boundary Conditions Dirichlet Boundary Conditions Neumann (Derivative) Boundary Conditions Alternating-Direction-Implicit (ADI) Method Compact Finite Diﬀerences Multigrid Methods Motivation Multigrid Methodology Speed Comparisons MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. but it is more diﬃcult if have derivative mixed terms such as ∂ 2 φ/∂x∂y. Cassel 130 / 454 . J + 1). it can be shown that for the Poisson (or Laplace) equation with Dirichlet boundary conditions that the acceleration parameter that gives the best speedup is σ = 2 sin (π/R) . ¯ For ∆x = ∆y (∆ = 1). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

Cassel 131 / 454 Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences As we have seen before.13) in section 3.j+1 2 δy φi. we deﬁne the following second-order accurate central-diﬀerence operators φi−1. e. it is advantageous to maintain the compact nature of second-order accurate central diﬀerences because they produce systems of equations. ∆y 2 Recall from equation (3.j−1 − 2φi. in order to obtain higher-order ﬁnite-diﬀerence approximations it is necessary to incorporate more points in the ﬁnite-diﬀerence stencil.j = . tridiagonal.j + φi. W. ∂x2 12 ∂x4 (5.37) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W.Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences Outline (cont’d) Treatment of Nonlinear Convective Terms Upwind-Downwind Diﬀerencing MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Here we derive a compact fourth-order accurate central-diﬀerence approximation for the second-order derivatives in the Poisson equation. Cassel 132 / 454 .j + φi+1. we have ∂2φ ∆x2 ∂ 4 φ 2 = δx φ − + O(∆x4 ). ∆x2 φi. that may be solved eﬃciently.j = . For convenience.j − 2φi. However.j 2 δx φi.2 that from the Taylor series.g.

it is not compact. 12 x ∂x2 Solving for ∂ 2 φ/∂x2 ∂2φ = ∂x2 ∆x2 2 1+ δ 12 x −1 2 δx φ ∆x2 2 + 1+ δ 12 x −1 O(∆x4 ) c 2010 K. 2 δx φ = 2 δx φ = ∂ 2 φ ∆x2 ∂ 4 φ + + O(∆x4 ). W. φi . 12 2 2 Due to the δx (δx φ) operator.40) Because the last term in equation (5. Cassel 134 / 454 . 2 4 ∂x 12 ∂x ∆x2 ∂ 2 ∂ 2 φ 1+ + O(∆x4 ). this approximation involves the ﬁve points φi−2 . Cassel (5.38) gives 2 δx φ = = ∆x2 2 1+ δx + O(∆x2 ) 12 1+ ∂2φ + O(∆x4 ). W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.39) as −1 ∂2φ ∆x2 2 2 δx δx φ + O(∆x4 ).41) leads to a O(∆x4 ) accurate central-diﬀerence approximation for the second derivative ∂2φ = ∂x2 1− ∆x2 2 2 δx δx φ + O(∆x4 ). therefore. (5.Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences Therefore.39) 133 / 454 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences From a binomial expansion (with ∆x suﬃciently small) ∆x2 2 1+ δ 12 x −1 ∆x2 2 =1− δ + O(∆x4 ). ∂x2 (5. 12 x (5.40) into equation (5.38) But from equation (5.37) Substituting into (5. 2 ∂x2 12 ∂x ∂2 2 = δx + O(∆x2 ). however. φi+1 and φi+2 .39) is still O(∆x4 ). 2 ∂x 2 δx φ ∆x2 2 ∂ 2 φ δ + O(∆x4 ). φi−1 .41) = 1+ 2 ∂x 12 Substituting the expression (5. we can write equation (5.

(5. W. we also consider the derivative in the y-direction. y). y). ∆y). W. Cassel 136 / 454 .Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences In order to obtain a compact scheme. Similar to equation (5. we have in the y-direction ∂2φ = ∂y 2 ∆y 2 2 δ 1+ 12 y −1 2 δy φ + O(∆y 4 ). 12 12 (5.42) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.41) and (5. y).42) into the Poisson equation leads to ∆x2 2 1+ δ 12 x −1 2 δx φ ∆y 2 2 + 1+ δ 12 y −1 2 δy φ + O(∆4 ) = f (x. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 135 / 454 Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences Now consider the Poisson equation ∂2φ ∂2φ + 2 = f (x.41). Multiplying by 1 + 1+ ∆x2 2 12 δx 1+ gives ∆y 2 2 2 ∆x2 2 2 δy δx φ + 1 + δx δy φ + O(∆4 ) 12 12 ∆x2 2 ∆y 2 2 = 1+ δx + δy + O(∆4 ) f (x. ∂x2 ∂y Substituting equations (5. ∆y 2 2 12 δy where ∆ = max(∆x.43) which is a fourth-order accurate ﬁnite-diﬀerence approximation to the Poisson equation.

43) as follows 1+ ∆y 2 2 2 δ δ φ 12 y x = = 1+ ∆y 2 2 δ 12 y φi−1. Cassel 138 / 454 .j + 1 [fi−1.j + φi+1.j + fi.j−1 + φi.j + fi+1.j 12 +fi.j − 2φi.j + φi−1.j + 10 (φi.j−1 + φi+1.j ) ∆x2 1 [(φi−1.j+1 ] .j−1 + φi−1.j−1 + φi−1.j+1 ) +φi−1.43) is 1+ ∆x2 2 ∆y 2 2 δ + δ f (x.j + φi+1.j ∆x2 1 (φi−1.j + fi−1.j ) + φi−1.j−1 − 2φi+1.j+1 ] .j + fi. Cassel 137 / 454 Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences Similarly.j − 2φi.Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences Expand the ﬁrst term in equation (5. = Therefore.j−1 + fi.j+1 )] 1 [−20φi.j−1 − 2fi.j+1 + φi+1. expanding the second term in equation (5. y) 12 x 12 y = fi. 1+ and the right-hand-side of equation (5.j + φi.j+1 ) + 12∆x2 −2 (φi.j + φi+1.j−1 + φi.j ) 12∆x2 −2 (φi.j + φi+1.j − 2fi. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 12 = MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.j+1 + φi+1. we have a nine-point stencil.j + φi+1.j−1 − 2φi−1.j+1 ] .j+1 ) 12 12∆y 2 −2 (φi−1.j−1 + φi+1.j + fi+1. but the approximation only requires three points in each direction and thus it is compact.j + 10 (φi−1.j+1 ] 1 [8fi.j+1 ) + (φi+1. W.j−1 − 2φi.43) yields ∆x2 2 2 1 δx δy φ = [−20φi.

y) they are MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 140 / 454 . the coeﬃcients in the ﬁnite-diﬀerence stencil for φ(x. W. y) are as follows: MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 139 / 454 Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences and for f (x. W.Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences Thus.

i. 2 2 2 2 see the δx δy φ and δy δx φ diﬀerence operators. i. for Dirichlet boundary conditions.e.43) the two-dimensionality of the equation has been taken advantage of to obtain the compact ﬁnite-diﬀerence stencil. W. compact ﬁnite-diﬀerence approach is no less eﬃcient then that for the second-order scheme used in the previous section (there are simply additional terms on the right-hand-side of the equations).Numerical Solutions of Elliptic Problems Compact Finite Diﬀerences Notes: 1 Observe that in equation (5. The primary disadvantage of using higher-order schemes is that it is generally necessary to use lower-order approximations for derivative boundary conditions. This is not a problem. application of the ADI method as in the previous section results in a set of tridiagonal problems to solve. Because the ﬁnite-diﬀerence stencil is compact. this fourth-order. Cassel 142 / 454 . Therefore. W.e. however. Cassel 141 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods Outline 5 Numerical Solutions of Elliptic Problems Introduction Finite-Diﬀerence Methods for the Poisson Equation Direct Methods for Linear Systems Fourier Transform Methods Cyclic Reduction Iterative (Relaxation) Methods Jacobi Iteration Gauss-Seidel Iteration Successive Overrelaxation (SOR) Boundary Conditions Dirichlet Boundary Conditions Neumann (Derivative) Boundary Conditions Alternating-Direction-Implicit (ADI) Method Compact Finite Diﬀerences Multigrid Methods Motivation Multigrid Methodology Speed Comparisons MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 2 3 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. only involving three points in each direction.

. consider the simple one-dimensional problem d2 φ = 0. I − 1 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Discretizing equation (5. W. which has the exact solution φ(x) = 0.44) with φ(0) = φ(1) = 0. all plots of the numerical solution are also plots of the error. .Numerical Solutions of Elliptic Problems Multigrid Methods Outline (cont’d) Treatment of Nonlinear Convective Terms Upwind-Downwind Diﬀerencing MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. (5. Therefore. Low-frequency components of error ⇒ slow convergence. Cassel 143 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods Motivation The iterative techniques we have discussed all have the following property: High-frequency components of error ⇒ fast convergence. φ0 = φI = 0. . To illustrate this. Cassel 144 / 454 . dx2 0 ≤ x ≤ 1.44) at I + 1 points using central diﬀerences gives φi+1 − 2φi + φi−1 = 0. i = 1. .

Large k ⇒ highly oscillatory waves (high frequency). where k is the wavenumber and indicates the number of half sine waves on the interval 0 ≤ x ≤ 1. W. . consider an initial guess consisting of the Fourier mode φ(x) = sin(kπx). i = 0. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. with xi = i∆x = i/I. . this is φi = sin kπi I . with the wavenumber 1 ≤ k ≤ I − 1. I. 6 (the ﬁgures are from Briggs et al.): MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. . In discretized form.Numerical Solutions of Elliptic Problems Multigrid Methods To show how the nature of the error aﬀects convergence. smooth waves (low frequency). . Cassel 145 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods Consider initial guesses with k = 1. Thus. Cassel 146 / 454 . 3. Small k ⇒ long.

Jacobi: MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W.Numerical Solutions of Elliptic Problems Multigrid Methods Applying Jacobi and Gauss-Seidel iteration with I = 64. the solution converges more rapidly for the higher frequency initial guess. Cassel 147 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods Gauss-Seidel: MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 148 / 454 .

then slow convergence for the lower frequency modes. medium. 6. and 32 terms represent low-. Cassel 150 / 454 . The k = 1. the error is reduced rapidly during the early iterations but more slowly thereafter. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.and high-frequency modes. for example φi = 1 sin 3 πi I + sin 6πi I + sin 32πi I . Cassel 149 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods Applying Jacobi iteration with I = 64. Thus.Numerical Solutions of Elliptic Problems Multigrid Methods A more realistic situation is one in which the initial guess contains multiple modes. respectively. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. there is rapid convergence until the high-frequency modes are smoothed out.

W. Cassel 152 / 454 . for example.Numerical Solutions of Elliptic Problems Multigrid Methods See. W. the following sequence using Jacobi iteration: k = 3 after 1 iteration (left) and 10 iterations (right): k = 16 after 1 iteration (left) and 10 iterations (right): MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 151 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods k = 2 and k = 16 after 1 iteration (left) and 10 iterations (right): MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Thus.Numerical Solutions of Elliptic Problems Multigrid Methods Multigrid methods take advantage of this property of relaxation techniques by recognizing that smooth components of the error become more oscillatory with respect to the grid size on a coarse grid. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 2) Multigrid methods are comparable in speed with fast direct methods. relaxation is more eﬀective on a coarse grid representation of the error (it is also faster). W. Cassel 154 / 454 . but can be used to solve general elliptic equations with variable coeﬃcients and even nonlinear equations. Cassel 153 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods Notes: 1) Multigrid methods are not so much a speciﬁc set of techniques as they are a framework for accelerating relaxation (iterative) methods. such as Fourier methods and cyclic reduction.

Cassel 155 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods where ai.j 2 ∆y 2∆y +Ei. ∆x2 2∆x Ci.j . y).Numerical Solutions of Elliptic Problems Multigrid Methods Multigrid Methodology Consider the general second-order linear elliptic partial diﬀerential equation of the form ∂2φ ∂2φ ∂φ ∂φ A(x. write (5.j = A(xi .j + φi−1. y)C(x. (5.j φi.j φi.j = ci.j − 2φi. y) 2 +B(x. y) +C(x.j − − ∆x2 bi.j φi. (5.j + Bi.45) ∂x ∂x ∂y ∂y To be elliptic. We rewrite this equation in the form ai.j + φi. y) 2 +D(x. W. The residual is deﬁned by ¯ r = f − Lφ.46) (or some other diﬀerence equation) as Lφ = f.47) where L represents the diﬀerence operator.j + .46) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. etc. Cassel 156 / 454 .j = Ei.j φi−1.j .j − .49) (5.j Di.j Ai. A(x.j−1 φi.46).j = Fi.j Ai. y). − ∆y 2 2∆y 2Ci.j−1 + Di. (5.j Di. ¯ where φ is an approximation to φ.j where Ai.j .j Bi.j = di. then the error is deﬁned by ¯ e = φ − φ. Ai.j + bi. (5. ∆y 2 For convenience. y) +E(x.j + ci.j Bi.j ei. W. If φ is the exact solution to equation (5. ∆x2 2∆x Ci.j = Fi.j φi+1.j φi+1.48) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. y) > 0 for all (x. yj ).j+1 − φi.j+1 + di. + ∆y 2 2∆y 2Ai.j+1 − 2φi. Approximating this diﬀerential equation using second-order accurate central diﬀerences gives φi+1.j Ci.j = . y)φ = F (x.j − φi−1.j−1 + ei.j = .j φi.j 2 ∆x 2∆x φi.

W. ADI. Coarse grid → Ω2h → Grids are typically reduced by a factor of two in each direction. 3) Using the residual as the right-hand-side.50) From these deﬁnitions. 4) Interpolate the error to the ﬁne grid and correct the ﬁne-grid approximation according to h ¯ ¯ φh ← φh + I2h e2h . therefore.47) gives the error equation ¯ Le = r = f − Lφ. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.Numerical Solutions of Elliptic Problems Multigrid Methods ¯ Observe from (5. (5. ¯ 5) Relax Lh φh = f h ν2 times on the ﬁne grid Ωh with corrected approximation ¯ φh as the initial guess. Cassel 158 / 454 . then the residual is zero. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. we can devise a scheme with which to correct the solution on a ﬁne grid by solving for the error on a coarse grid. h Interpolation (Prolongation) operator: I2h → Move information from coarse grid to ﬁne grid. ⇒ Coarse-Grid Correction (CGC) Deﬁnitions: Fine grid → Ωh .48) into equation (5.47) that if φ = φ. the residual is a measure of how “wrong” the approximate solution is. ν1 times on the ﬁne grid Ωh ¯ with an initial guess φh . etc. Cassel 157 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods 2h Restriction operator: Ih → Move information from ﬁne grid to coarse grid. Coarse-Grid Correction Sequence: ¯ 1) Relax Lh φh = f h using Gauss-Seidel. ’solve’ the error equation L2h e2h = r2h on the coarse grid Ω2h . 2) Compute the residual on Ωh and restrict it to the coarse grid Ω2h : 2h 2h ¯ r2h = Ih rh = Ih (f h − Lh φh ). Substituting (5.

i. ν1 and ν2 are small (1. This CGC scheme is the primary component of all the many multigrid algorithms. W.44). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ν1 = 3): Initial guess: MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. φ = 0 (I = 64.e. W. 2. Cassel 160 / 454 . Cassel 159 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods To illustrate consider the CGC sequence for equation (5.Numerical Solutions of Elliptic Problems Multigrid Methods Note: In practice. or 3).

Cassel 162 / 454 . Cassel 161 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods Step 1 after three relaxation sweeps on ﬁne grid: → The low-frequency mode is reduced very little after three relaxation step.Numerical Solutions of Elliptic Problems Multigrid Methods Step 1 after one relaxation sweep on ﬁne grid: → The high-frequency mode is eliminated after only one relaxation step. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

Numerical Solutions of Elliptic Problems Multigrid Methods Step 3 after one relaxation sweep on coarser grid: → . Cassel 164 / 454 . which has higher frequency relative to the coarser grid. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 163 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods Step 3 after three relaxation sweeps on coarser grid: → Restriction to the coarser grid accelerates convergence of the low-frequency mode. W... and not much more after three.

Numerical Solutions of Elliptic Problems Multigrid Methods Step 5 after three relaxation sweeps on ﬁne grid: → Low-frequency mode is nearly eliminated after CGC. W. W. Cassel 165 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods How do we obtain the coarse grid solution for e2h in step 3? → Recursively replace step 3 by additional CGCs on progressively coarser grids. ⇒ V-Cycle For example. a four-grid V-cycle is illustrated by The V-cycles are repeated until convergence. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 166 / 454 . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

. i. Ω4h → relaxation on equation for error on Ω2h . . Cassel 167 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods If no good initial guess is available. W. on grid.Numerical Solutions of Elliptic Problems Multigrid Methods Note: The error being solved for on successively coarser grids is the error of the error on the next ﬁner grid. This simple V-cycle scheme is appropriate when a good initial guess is available. . Ωh → relaxation on original equation for φ. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 6) Perform V-cycles until convergence. 3) Perform V-cycle to correct φ. Cassel 168 / 454 . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.. 4) Interpolate to next ﬁner grid. W. For example. 5) Repeat (3) and (4) until ﬁnest grid is reached..45) in the context of an unsteady calculation in which case the solution for φh from the previous time step is a good initial guess for the current time step. Ω2h → relaxation on equation for error on Ωh . then Full Multigrid V-Cycle (FMV) may be applied according to the following procedure: 1) Solve Lφ = f on the coarset grid (Note: φ not e) 2) Interpolate to next ﬁner grid. when considering a solution to equation (5.e.

nx = 5 c 2010 K. My (L) = my 2[max(ny +L−N. . 3 or 5). ny = 5.1)−1] + 1. Each grid G(L) has Mx (L) × My (L) grid points. W. . nx = 6 and my = 3. < G(N ). nx = 7 Nx = 49 Nx = 81 MMAE 517 (Illinois Institute of Technology) ⇒ mx = 3. and mx and my determine the size of the coarsest grid. W. where n is an integer. For a given grid.1)−1] + 1. G(N ) is the ﬁnest grid and L = 1. and mx and my should be as small as possible for maximum eﬃciency (typically mx and my are 2. nx and ny should be as large as possible. nx = 5 ⇒ mx = 5.Numerical Solutions of Elliptic Problems Multigrid Methods Grid Deﬁnitions: Because each successive grid diﬀers by a factor of two. nx = 6 Nx = 129 ⇒ mx = 2. .51) where nx and ny determine the number of grid levels. .52) where G(1) is the coarsest grid.45) is discretized on a uniform grid having Nx × Ny points which are deﬁned by Nx = mx 2(nx −1) + 1. Somewhat more general grids may be obtained using the following grid deﬁnitions. For example: Nx = 65 ⇒ mx = 2.54) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. N . Cassel 170 / 454 . The diﬀerential equation (5.53) (5. Cassel 169 / 454 Computational Fluid Dynamics Numerical Solutions of Elliptic Problems Multigrid Methods The number of grid levels is given by N = max(nx . Nx = 65. the ﬁnest grid size is often taken as 2n + 1. (5. For example. . where Mx (L) = mx 2[max(nx +L−N. which is (mx + 1) × (my + 1). . . (5. Ny = my 2(ny −1) + 1. ny ) resulting in the series of grids G(1) < . (5. . < G(L) < . Ny = 49 ⇒ mx = 2.

p φ +q h h h h ∂φ ∂n = sh . Cassel 171 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods Boundary Conditions At each boundary the general form of the boundary condition is pφ + q ∂φ = s. thus. p φ 2h 2h +q 2h 2h ∂φ ∂n = s2h . G(2) : Mx (2) = 5. W. G(1) : Mx (1) = 3.56) But on the coarser grids.Numerical Solutions of Elliptic Problems Multigrid Methods Thus. ∂n (5. G(5) : Mx (5) = 33. (5. ny ) = 6 and G(6) : Mx (6) = 65. In order to obtain such a condition. N = max(nx . This boundary condition is applied directly on the ﬁnest grid Ωh . equation (5. W. My (6) = 49 My (5) = 25 My (4) = 13 My (3) = 7 My (2) = 4 My (1) = 4 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.e. On the coarse grid Ω2h . Cassel 172 / 454 . we need the boundary condition for the error. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.55) where n is the direction normal to the surface.55) applies to the solution φ. i. consider the following. G(3) : Mx (3) = 9. G(4) : Mx (4) = 17.

Thus. Neumann ⇒ ∂e ∂n = 0 on boundary. Cassel 174 / 454 . then from ¯ ¯ e2h = φ2h − φ2h = 0. φ2h = φ2h . Dirichlet ⇒ e = 0 on boundary. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. s = 0. For example.Numerical Solutions of Elliptic Problems Multigrid Methods If we enforce the error to be zero on the boundaries. or Robin) does not change. i. the type of boundary condition (Dirichlet. where the original condition on φ is applied. Neumann.e. the boundary conditions are homogeneous on all but the ﬁnest grid. ∂n Therefore. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. but they become homogeneous.e. Cassel 173 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods That is. we also have ¯ p2h φ2h + q 2h ¯ ∂ φ2h = s2h . to obtain a boundary condition for the error on Ω2h p e 2h 2h +q 2h 2h ∂e ∂n ∂e2h ∂n = p φ 2h 2h +q 2h 2h ∂φ ∂n − p φ 2h ¯2h +q 2h ∂ φ ¯2h (5.57) ∂n = s2h − s2h p2h e2h + q 2h = 0. i.e. i. the p and q coeﬃcients are the same.

Note that when Gauss-Seidel is used.j φi−1. .j = fi. Here φ∗ denotes the most recent approximation. if there are large gradients in the solution or rapid variations in the coeﬃcients in the diﬀerential equation (5. red-black Gauss-Seidel iteration is used to relax the diﬀerence equation: By performing the relaxation on all of the red and black points separately. therefore.j − ci. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. .Numerical Solutions of Elliptic Problems Multigrid Methods Relaxation Typically. . In general. . We will refer to this as zebra relaxation. the following tridiagonal problem is solved for each j = 1. W.45).j φi+1. we could use alternating-direction-line (ADL) relaxation.58) for i = 1. Mx (L).j + ei. Cassel 176 / 454 .46)) ∗ ai.j φi. SOR should not be implemented because it destroys the high-frequency smoothing. (5. My (L) (see equation (5. Similar to red-black Gauss-Seidel.j φi. Cassel 175 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods The point-by-point relaxation of Gauss-Seidel does not work well. we may have such behavior in both directions. When sweeping along lines of constant y.j+1 − di. however. . W. In such cases it is better to use line relaxation for the same reason that ADI is better than Gauss-Seidel. it eliminates data dependencies such that it is easily implemented on parallel computers (see section 10). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. .j φ∗ i. we could sweep all lines with j even and j odd separately.j + bi. .j−1 . .

.Numerical Solutions of Elliptic Problems Multigrid Methods Then lines of constant x are swept by solving the tridiagonal problem for each i = 1.j+1 + ei.j − bi. 1 ≤ j ≤ N Y C 1 ≤ i∗ ≤ N XF. Cassel 178 / 454 . . W. My (L).j . j ∗ ) Range 1 ≤ i ≤ N XC.j φi. Notation: Grid Coarser Finer Indices (i.e. N Y C = 1 (N Y F − 1) + 1 2 j ∗ = 2j − 1 The easiest restriction operator is straight injection for which φ2h = φh∗ . 1 ≤ j ∗ ≤ N Y F Applying restriction in both directions: N XC = 1 (N XF − 1) + 1. .j i i. . W. i.j φi. . .j φi−1. . The matrix symbol for straight injection is [1].59) for j = 1. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. (5. Again we could sweep all lines with i even and i odd separately.j − ai.j + di. Cassel 177 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods 2h Restriction Operator: Ih The restriction operator is required for moving information from the ﬁner grid to the coarser grid. Mx (L) given by ∗ ci.j φ∗ i+1. j) (i∗ . . we simply drop the points that are not common to both grids.j ∗ . 2 i∗ = 2i − 1.j−1 = fi.j φi. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

. The matrix symbol is Thus.Numerical Solutions of Elliptic Problems Multigrid Methods A better operator is full weighting.60). . φ2h = φh∗ . N XC. for example.j ∗ i i i i 8 1 h + 4 φi∗ . N Y C and j = 1. Cassel 179 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods We then use straight injection on the boundaries. .j ∗ . i. If. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.j ∗ −1 + φi∗ +1. i.j ∗ + φh∗ +1.j i i = 1. i = 1. .60) This represents a weighted average of surrounding points in the ﬁne mesh. φ2h i.j ∗ (5. .j ∗ +1 + 1 φh∗ .j ∗ +1 + φi∗ +1. .e. W. j = 1. .j ∗ −1 + φi∗ −1. N Y C.j ∗ +1 + φh∗ −1. Cassel 180 / 454 . restriction is applied only in the x-direction. W.j ∗ −1 + φh∗ . .j = 1 h h h h 16 φi∗ −1. N XC. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. then N Y C = N Y F and j ∗ = j in equation (5.

j φ2h + φ2h i.06 = 10−5 Iterations Time (sec) 821 27. ∂x2 ∂x ∂y ∂y with Neumann boundary conditions. the total time required for the N = 129 case is approximately 16× that with N = 65 (∼ 4× increase in points and ∼ 4× increase in iterations). 408 366.j φh∗ +1.j ∗ = φ2h i i. ADI: = 10−4 Iterations Time (sec) 673 22.j ∗ +1 = i 1 2 1 2 ← copy common points φ2h + φ2h i.j i.j i+1.35 2.22 2.j ∗ = i φh∗ . φh∗ .Numerical Solutions of Elliptic Problems Multigrid Methods h Interpolation (Prolongation) Operator: I2h The interpolation operator is required for moving information from the coarser to ﬁner grid. The grid is N × N .j i. W. The most commonly used interpolation operator is based on bilinear interpolation. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 995 456. Cassel 181 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods Speed Comparisons Consider the test problem A(x) ∂2φ ∂2φ ∂φ ∂φ + B(x) + C(y) 2 + D(y) = F (x. Cassel 182 / 454 .j+1 1 4 φh∗ +1. The following times are for an SGI Indy R5000-150MHz.j i+1.j+1 i+1.j ∗ +1 = i MMAE 517 (Illinois Institute of Technology) φ2h + φ2h + φ2h + φ2h i.j+1 Computational Fluid Dynamics c 2010 K. W.03 N 65 129 Note that in both cases. y).

Thomas.” Ann. Rev.28 29 12.e. S. A. J. Here the convergence criterion is evaluated between V-cycles. Fluid Mech..F..10 = 10−5 Iterations Time (sec) 23 2. = 10−4 Iterations Time (sec) 18 1. ⇒ The multigrid method scales to larger grid sizes more eﬀectively than ADI alone. note the small increase in the number of V-cycles with increasing N . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 184 / 454 ..78 23 10. the total time required for the N = 129 case is approximately 6× that with N = 65 (the minimum is 4×).L. W. Henson.E. B.” (2nd Edition) SIAM (2000).T. 2) The case with N = 65 is approximately 13× faster than ADI. W.C. (2003).Numerical Solutions of Elliptic Problems Multigrid Methods Multigrid: V-cycle with ADL relaxation (no FMV to get improved initial guess). “A Multigrid Tutorial.68 N 65 129 Notes: 1) In both cases. V. 35. Diskin. Cassel 183 / 454 Numerical Solutions of Elliptic Problems Multigrid Methods 3) References: 1 2 Briggs. pp. and the case with N = 129 is approximately 36× faster! MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. and Brandt.. W. 317–340. i. and McCormick. “Textbook Multigrid Eﬃciency for Fluid Simulations.

Cassel 186 / 454 .Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms Outline 5 Numerical Solutions of Elliptic Problems Introduction Finite-Diﬀerence Methods for the Poisson Equation Direct Methods for Linear Systems Fourier Transform Methods Cyclic Reduction Iterative (Relaxation) Methods Jacobi Iteration Gauss-Seidel Iteration Successive Overrelaxation (SOR) Boundary Conditions Dirichlet Boundary Conditions Neumann (Derivative) Boundary Conditions Alternating-Direction-Implicit (ADI) Method Compact Finite Diﬀerences Multigrid Methods Motivation Multigrid Methodology Speed Comparisons MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 185 / 454 Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms Outline (cont’d) Treatment of Nonlinear Convective Terms Upwind-Downwind Diﬀerencing MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. W.

62) which represent a simpliﬁed version of the Navier-Stokes equations as there are no pressure terms.j−1 + .j − ui−1. W.j + ui−1.j . W.j ui.Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms Consider the 2-D.61) (5. steady Burger’s equations ∂u ∂u ∂2u ∂2u Re u +v = + 2.j+1 − 2ui.j − 2ui. ∂x ∂y ∂x2 ∂y (5. Cassel 188 / 454 .j+1 + ∆ + 2 Re ∆x ∆1/2 vi.j ui.j 2 1 ∗ ∗ ¯ ¯ ¯ ¯ + ∆ − 1 Re ∆x ∆1/2 vi.j ∗ ui. A simple approach to linearizing the equations is known as Picard iteration in which we take the coeﬃcients of the non-linear (ﬁrst derivative) terms to be known from the previous iteration denoted by ∗ u∗ . and those on the right-hand-side are the viscous or diﬀusion terms.j MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 187 / 454 Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms Let us begin by approximating (5.j−1 + vi. The Burger’s equations are elliptic due to the nature of the second-order viscous terms. ¯ where ∆ = (∆x/∆y)2 .j + 1 + 1 Re ∆x u∗ ui−1.j 2∆x 2∆y = ui+1.j+1 − ui. 2 (∆x) (∆y)2 Multiplying by (∆x)2 and rearranging leads to 1 1 − 2 Re ∆x u∗ ui+1.j−1 2 (5.j ui. The terms on the left-hand-side are the convection terms.j ui+1.j i. ∂x ∂y ∂x2 ∂y ∂v ∂2v ∂v ∂2v +v = Re u + 2. but the convection terms make the equations non-linear. i.j = 0. vi.63) ¯ −2(1 + ∆)ui.61) using central diﬀerences for all derivatives as follows Re u∗ i.j + ui.j i.

j 2 MMAE 517 (Illinois Institute of Technology) and 1 ∗ ¯ Re ∆x vi. However. The same result holds for p < −1 and q < −∆.Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms We can solve (5. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.63) using any of the iterative methods discussed except SOR (generally need under-relaxation for non-linear problems). ∗ The velocities u∗ and vi. Cassel 190 / 454 . 2 c 2010 K. Cassel 189 / 454 Computational Fluid Dynamics Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms which is a restriction on mesh size for given Re and velocity ﬁeld. the grid sizes ∆x and ∆y must decrease. we must have |p| ≤ 1 and |q| ≤ ∆ or 1 Re ∆x u∗ ≤ 1. where p= 1 Re ∆x u∗ . i.j vary throughout the domain and are unknown.63) diagonally dominant? To be diagonally dominant we must have ¯ ¯ ¯ |1 − p| + |1 + p| + ∆ − q + ∆ + q ≤ 2(1 + ∆) . ¯ but with p > 1 and q > ∆ this condition cannot be satisﬁed. then this requires that ¯ ¯ ¯ (p − 1) + (1 + p) + (q − ∆) + (∆ + q) ≤ 2(1 + ∆) ¯ 2(p + q) ≤ 2(1 + ∆). that p > 1 and q > ∆.j ≤ ∆1/2 . Three diﬃculties: 1 As the Reynolds number Re increases. 2 q= ¯ Suppose. i. W.j 2 1 ∗ ¯ Re ∆x ∆1/2 vi. and equation (5.j 2 3 The central diﬀerence approximations for the ﬁrst-order derivatives contribute to the oﬀ-diagonal terms but not the main diagonal terms thereby adversely aﬀecting diagonal dominance. i. W. ¯ Therefore. for example.j . is (5.63) ¯ is not diagonally dominant.

∂y ∆y ∗ If vi.j + O(∆y).j Tx = −Re u = − .j u∗ ∂u ui.j−1 = vi.j + ui−1.j − ui. i.j < 0.j+1 − ui.j . ui. then using a forward diﬀerence i.j .j − ui.j i.e.j − (2 − Re ∆x u∗ )ui.j term to promote diagonal dominance.Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms Upwind-Downwind Diﬀerencing In order to restore diagonal dominance.j u∗ ui+1. Cassel 191 / 454 Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms Similarly for the v ∗ ∂u/∂y term: ∗ 1 If vi.j < 0 therefore. ∂y ∆y Let us consider diagonal dominance of the approximations to the x-derivative terms in Burger’s equation (5. the velocities.j − ui−1.j = u∗ + O(∆x).j .j − ui−1. then using a backward diﬀerence i.j = vi.j − (2 + Re ∆x u∗ )ui. i.j + ui−1. For example.j i.j + O(∆y).j <0 192 / 454 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel .j + (1 + Re ∆x u∗ )ui−1.61) in the x-direction ∗ ∗ ui. u∗ i. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.j .j − ui.j (1 − Re ∆x u∗ )ui+1. 2 If u∗ < 0.j − 2ui. i. W.j ∂x ∆x which again gives a positive addition to the ui. then using a forward diﬀerence v∗ ∂u ∗ ui. we use forward or backward diﬀerences for the ﬁrst-derivative terms depending upon the signs of the coeﬃcients of the ﬁrst derivative terms. i.j ∂u = u∗ + O(∆x). then using a backward diﬀerence v∗ 2 ∂u ∗ ui.j Re ui. i.j > 0.j . consider the u∗ ∂u/∂x term: 1 If u∗ > 0.j u∗ > 0 i.j ∂x ∆x which gives a positive addition to the ui. ui.j > 0 ∂2u ∂u ui+1. (∆x)2 Tx = ui+1.j term to promote diagonal dominance. ∂x2 ∂x (∆x)2 ∆x ∗ ui+1. W.

W. The forward and backward diﬀerences used for the ﬁrst-order derivatives are only ﬁrst-order accurate. W.e. i. the method is O(∆x. therefore.j |1| + |1 − Re ∆x u∗ | ≤ | − (2 − Re ∆x u∗ )| i. consider the 1-D Burger’s equation Re u du d2 u = 2. Cassel 194 / 454 . backward-diﬀerence approximation to the ﬁrst-order derivative is du dx ui − ui−1 ∆x = + ∆x 2 d2 u dx2 + ..j 1 + 1 + Re ∆x u∗ = 2 + Re ∆x u∗ . diagonal dominance of the tridiagonal problems along lines of constant y requires that: 1 For u∗ > 0 (Re ∆x u∗ > 0): i.j i. i.j i. Updwind-downwind diﬀerencing forces diagonal dominance.j i. dx dx (5.j which is weakly diagonally dominant. For u∗ < 0 (Re ∆x u∗ < 0): i. i.j 1 + 1 − Re ∆x u∗ = 2 − Re ∆x u∗ . for example. i i where we have included the truncation error. 2 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.and y-derivative terms. the ﬁrst-order. the iteration will always converge with no mesh restrictions.j i.64) 2 3 Recall from section 3..j which is also weakly diagonally dominant.Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms Therefore.j |1| + |1 + Re ∆x u∗ | ≤ | − (2 + Re ∆x u∗ )| i.j i.2 that. ∆y) accurate.j i. Cassel 193 / 454 Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms Notes: 1 The same is true for the y-derivative terms when sweeping along lines of constant x. To see the potential aﬀects of this error. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. if using ADI with splitting of x..

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. depending upon the values of Re. W. which is not included in the numerical solution. i Therefore. ∆x. but the resulting system of equations would no longer be tridiagonal. the physical diﬀusion term. 4 Remedies: i) Can return to O(∆x2 . W. we could use second-order accurate forward and backward diﬀerences. the truncation error from the ﬁrst-derivative terms. ∆y 2 ) accuracy using deferred correction in which we use the approximate solution to evaluate the leading term of the truncation error which is then added to the original discretized equation as a source term. or even larger than..Numerical Solutions of Elliptic Problems Treatment of Nonlinear Convective Terms Substituting into (5. may be of the same order. not the diﬀerential equation. ii) Alternatively. Cassel 195 / 454 Numerical Solutions of Elliptic Problems 5 Treatment of Nonlinear Convective Terms Note that we have linearized the diﬀerence equation. the eﬀects of which increase with increasing Reynolds number. = i d2 u dx2 .64) gives Re u∗ i or Re ui ui − ui−1 ∆x + ∆x 2 d2 u dx2 + . i Re ui − ui−1 = 1− ∆x u∗ i ∆x 2 d2 u dx2 ∗ . This is often referred to as artiﬁcial or numerical diﬀusion. and u .. in order to obtain a linear system of algebraic equations ⇒ The physical nonlinearity is still being solved for. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 196 / 454 .

Cassel 197 / 454 Numerical Solutions of Parabolic Problems Introduction Outline (cont’d) Factored ADI Method MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 198 / 454 . W.Numerical Solutions of Parabolic Problems Introduction Outline 6 Numerical Solutions of Parabolic Problems Introduction Explicit Methods Euler Method (First-Order Explicit) Richardson Method DuFort-Frankel Method Stability Analysis Introduction Numerical Stability Analysis Implicit Methods First-Order Implicit Crank-Nicolson Non-Linear Convective Problems First-Order Explicit Crank-Nicolson Upwind-Downwind Diﬀerencing Multidimensional Problems First-Order Explicit Method First-Order Implicit Method ADI Method with Time Splitting MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W.

Numerical Solutions of Parabolic Problems Introduction Parabolic ⇒ preferred direction of propagation of solution: 1 2 time (unsteady problems) spatial (some steady problems). W. t) + c(x. it is not necessary to keep solution at every time step (just previous step(s)). Cassel 199 / 454 Numerical Solutions of Parabolic Problems 2 Introduction Numerical algorithm “marches” in preferred direction in step-by-step manner. Consider the general linear.2) . e.2) can be used for equation (6. t). heat conduction (cf. Cassel 200 / 454 (6.1). 1-D. i. t) 2 + b(x. ∂t ∂x where φ = T ⇒ heat conduction φ = u ⇒ momentum diﬀusion (due to viscosity) φ = ω ⇒ vorticity diﬀusion φ = c ⇒ mass diﬀusion (c = concentration) Techniques developed for equation (6. 1-D diﬀusion equation ∂φ ∂2φ = α 2. Initial-value problems.1) (6.g. e.e. unsteady. elliptic ⇒ BVP) Properties: 1 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. t)φ + d(x. 1-D.g. steady duct ﬂows and boundary-layer ﬂows. unsteady equation ∂φ ∂2φ ∂φ = a(x. W. ∂t ∂x ∂x A simple model problem for this is the unsteady.

etc. b) Implicit methods – obtain set of algebraic equations for φ at all mesh points at each ∆t. Finite-diﬀerence methods: a) Explicit methods – obtain equation for φ at each mesh point. Cassel 202 / 454 . e.g.. 2 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Runge-Kutta. predictor-corrector. Cassel 201 / 454 Numerical Solutions of Parabolic Problems Explicit Methods Outline 6 Numerical Solutions of Parabolic Problems Introduction Explicit Methods Euler Method (First-Order Explicit) Richardson Method DuFort-Frankel Method Stability Analysis Introduction Numerical Stability Analysis Implicit Methods First-Order Implicit Crank-Nicolson Non-Linear Convective Problems First-Order Explicit Crank-Nicolson Upwind-Downwind Diﬀerencing Multidimensional Problems First-Order Explicit Method First-Order Implicit Method ADI Method with Time Splitting MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. method of lines. W. W.Numerical Solutions of Parabolic Problems Introduction Methods of Solution: 1 Reduce partial diﬀerential equation to a set of ordinary diﬀerential equations and solve..

Numerical Solutions of Parabolic Problems Explicit Methods Outline (cont’d) Factored ADI Method MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W.e. i Note that now the superscript n denotes the time step rather than the iteration number. i. W. Cassel 204 / 454 . single unknown φn+1 on left-hand-side. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 203 / 454 Numerical Solutions of Parabolic Problems Explicit Methods Explicit Methods ⇒ Spatial derivatives are all evaluated at previous time level(s).

∂t ∆t Second-order. c 2010 K. .Numerical Solutions of Parabolic Problems Explicit Methods Euler Method (First-Order Explicit) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. forward diﬀerence for time derivative ∂φ φn+1 − φn i = i + O(∆t). i i+1 i−1 i MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics . central diﬀerence for spatial derivatives at nth time level (known) φn − 2φn + φn ∂2φ i i−1 = i+1 + O(∆x2 ). . . 2 2 ∂x (∆x) Substituting into (6. I.2) φn − 2φn + φn φn+1 − φn i i−1 i i = α i+1 . 2 ∆t (∆x) and solving for φn+1 i φn+1 = φn + i i α∆t φn − 2φn + φn i+1 i i−1 2 (∆x) i = 2. W. . Cassel 205 / 454 Numerical Solutions of Parabolic Problems Explicit Methods First-order. W. Cassel 206 / 454 (6.3) φn+1 = (1 − 2s)φn + s φn + φn .

Cassel 207 / 454 Numerical Solutions of Parabolic Problems Explicit Methods Richardson Method We want to improve on the temporal accuracy of the Euler method. 2 (∆x) 2 1 α∆t s= > ⇒ unstable. we use a central diﬀerence for the time derivative. 2 (∆x) 2 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. φn − 2φn + φn φn+1 − φn−1 i i−1 i i = α i+1 2 2∆t (∆x) φn+1 = φn−1 + 2s φn − 2φn + φn . W. . . I. i+1 i i−1 i i i = 2.4) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 208 / 454 . W.3) is an explicit equation for φn+1 at the (n + 1)st time step.3): s= 1 α∆t ≤ ⇒ stable (very restrictive). (6. . Restrictions on ∆t and ∆x for Euler method applied to 1-D diﬀusion equation to remain stable (see section 6. Time steps ∆t may be varied from step-to-step. i Method is second-order accurate in space and ﬁrst-order accurate in time. Notes: 1 2 3 4 Equation (6. .Numerical Solutions of Parabolic Problems Explicit Methods where s = α∆t/(∆x)2 . therefore.

To devise i such an approximation. W. Unconditionally unstable for s > 0 ⇒ Do not use. 3 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. i Similarly. i Adding these Taylor series together gives φn+1 i + φn−1 i = 2φn i + ∆t 2 ∂2φ ∂t2 n + ··· . i MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 209 / 454 Numerical Solutions of Parabolic Problems Explicit Methods DuFort-Frankel Method In order to maintain second-order accuracy. Must keep ∆t constant and requires starting method (need φi at two time steps). Cassel 210 / 454 . consider the Taylor series approximation at tn+1 about tn φn+1 i = φn i + ∆t ∂φ ∂t n i ∆t2 + 2 ∂2φ ∂t2 n + ··· . consider the Taylor series approximation at tn−1 about tn φn−1 i = φn i − ∆t ∂φ ∂t n i ∆t2 + 2 ∂2φ ∂t2 n + ··· .Numerical Solutions of Parabolic Problems Explicit Methods Notes: 1 2 Second-order accurate in space and time. but improve stability. W. let us modify the Richardson method by taking an average between time levels for φn .

Numerical Solutions of Parabolic Problems Explicit Methods and solving for φn leads to i φn i 1 n+1 1 = φi + φn−1 − ∆t2 i 2 2 ∂2φ ∂t2 n + ··· . i MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. I.4) from Richardson’s method gives n−1 φn+1 = φi + 2s φn − φn+1 + φn−1 + φn i−1 i+1 i i i (1 + 2s)φn+1 = (1 − 2s)φn−1 + 2s φn + φn i+1 i−1 i i φn+1 = i 2s 1 − 2s n−1 φi + φn + φn . i Substituting the time-averaging equation (6. unsteady diﬀusion equation is approximated as in the Richardson method (with central diﬀerences for the temporal and spacial derivatives) ∂φ ∂2φ ∆t2 φn+1 − φn−1 i i −α 2 = − ∂t ∂x 2∆t 6 ∂3φ ∂t3 n + ··· i φn − 2φn + φn α ∆x2 i i−1 −α i+1 + ∆x2 12 ∂4φ ∂x4 n + ··· . . (6. Substituting into the diﬀerence equation (6. the 1-D. . Cassel 212 / 454 .5) Therefore. Cassel 211 / 454 Numerical Solutions of Parabolic Problems Explicit Methods However. Including the truncation errors of each approximation. W. i−1 1 + 2s 1 + 2s i+1 i = 2. i (6.6) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. .5) for φn to implement the i DuFort-Frankel method leads to ∂2φ φn+1 − φn−1 α ∂φ n−1 i −α 2 = i − φn + φn − φn+1 + φi i+1 i−1 i 2 ∂t ∂x 2∆t ∆x α ∆t2 − ∆x2 ∂2φ ∂t2 n i ∆t2 − 6 ∂3φ ∂t3 n i α ∆x2 + 12 ∂4φ ∂x4 n + ··· . averaging between time levels in this manner is O(∆t2 ) accurate. let us consider the consistency of this approximation. W. .

the DuFort-Frankel method is considered inconsistent. W.Numerical Solutions of Parabolic Problems Explicit Methods For consistency. for consistency. That is. Notes: 1 2 3 4 Second-order accurate in space. The second and third truncation error terms do so. Must keep ∆t constant and starting method necessary. The method is inconsistent ⇒ Do not use. ∆t → 0. i. Cassel 214 / 454 . Method is unconditionally stable for any s = α∆t/(∆x)2 . all of the truncation error terms must go to zero as ∆t → 0. however. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. the ﬁrst term requires that ∆t → 0 faster than ∆x → 0. W. Because this is not the case in general.e. Cassel 213 / 454 Numerical Solutions of Parabolic Problems Stability Analysis Outline 6 Numerical Solutions of Parabolic Problems Introduction Explicit Methods Euler Method (First-Order Explicit) Richardson Method DuFort-Frankel Method Stability Analysis Introduction Numerical Stability Analysis Implicit Methods First-Order Implicit Crank-Nicolson Non-Linear Convective Problems First-Order Explicit Crank-Nicolson Upwind-Downwind Diﬀerencing Multidimensional Problems First-Order Explicit Method First-Order Implicit Method ADI Method with Time Splitting MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∆x → 0. ∆t << ∆x. the diﬀerence equation must reduce to the diﬀerential equation as ∆x.

e.g. round-oﬀ. i. Cassel 215 / 454 Numerical Solutions of Parabolic Problems Stability Analysis Introduction Real ﬂows ⇒ small disturbances. Grow ⇒ unstable (disturbances/errors are ampliﬁed)..g. e. physical 2 Numerical instability – the numerical algorithm magniﬁes small errors → This is not physical ⇒ Need a new method.Numerical Solutions of Parabolic Problems Stability Analysis Outline (cont’d) Factored ADI Method MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. imperfections. etc. e. vibrations. W. Numerical solutions ⇒ small errors.. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Issue → What happens to small disturbances/errors as ﬂow and/or solution evolves in time? Decay ⇒ stable (disturbances/errors are damped out).. Drazin & Reid) → This is real. truncation. Two possible sources of instability in CFD: 1 Hydrodynamic instability – the ﬂow itself is inherently unstable (see. Cassel 216 / 454 . W.. etc. for example.

Numerical Solutions of Parabolic Problems

Stability Analysis

Diﬃculty → In CFD both are manifest in similar ways, i.e. oscillatory solutions; therefore, it is often diﬃcult to determine whether oscillatory numerical solutions are a result of a numerical or hydrodynamic instability. → For an example of this, see “Supersonic Boundary-Layer Flow Over a Compression Ramp,” Cassel, Ruban & Walker, JFM 1995, 1996. Hydrodynamic vs. Numerical Instability:

1

**Hydrodynamic stability analysis (Section 9 and MMAE 514):
**

Often diﬃcult to perform. Assumptions must often be made, e.g. parallel ﬂow. Can provide conclusive evidence for hydrodynamic instability (particularly if conﬁrmed by analytical or numerical results). For example, in supersonic ﬂow over a ramp, the Rayleigh Fjørtoft’s theorems are necessary conditions that can be tested for.

2

**Numerical stability analysis:
**

Often gives guidance, but not always conclusive for complex problems.

Note: Just because a numerical solution does not become oscillatory does not mean that no physical instabilities are present! There may not be suﬃcient resolution.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 217 / 454

Numerical Solutions of Parabolic Problems

Stability Analysis

**Numerical Stability Analysis
**

Two methods: 1) Matrix Method:

More rigorous → evaluates stability of entire scheme, including treatment of boundary conditions. More diﬃcult → involves determining eigenvalues of a large matrix.

**2) von Neumann (Fourier Series) Method:
**

For linear initial-value problems with constant coeﬃcients.

⇒ More restrictive, i.e. nonlinear problems must be linearized.

Does not account for boundary conditions. Most commonly used.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

218 / 454

Numerical Solutions of Parabolic Problems

Stability Analysis

Matrix Method ˜ Denote the exact solution of the diﬀerence equation at t = tn by φn ; then the i error is ˜ en = φn − φn , i = 2, . . . , I, (6.7) i i i where φn is the approximate solution at t = tn . Consider the i ﬁrst-order explicit (Euler) method given by equation (6.3), which is repeated here φn+1 = (1 − 2s)φn + s(φn + φn ), i i+1 i−1 i ˜ where s = α∆t/∆x2 . Both φn and φn satisfy this equation; thus, the error i i satisﬁes the same equation

n+1 ei = (1 − 2s)en + s(en + en ), i i+1 i−1

(6.8)

i = 2, . . . , I.

(6.9)

This may be written in matrix form as en+1 = Aen , n = 0, 1, 2, . . . . (6.10)

**Thus, we perform a matrix multiply to advance each time step (cf. matrix form for iterative methods).
**

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 219 / 454

Numerical Solutions of Parabolic Problems

Stability Analysis

The (I − 1) × (I − 1) matrix A and 1 − 2s s 0 s 1 − 2s s 0 s 1 − 2s A= . . . . . . . . . 0 0 0 0 0 0

the vector en are ··· ··· ··· ··· ··· 0 0 0 . . . 0 0 0 . . . en 2 en 3 en 4 . . .

, 1 − 2s s s 1 − 2s

n e = . n eI−1 en I

Note that if φ is speciﬁed at the boundaries, then the error is zero there, i.e. en = en = 0. 1 I+1 The method is stable if the eigenvalues λj of the matrix A are such that |λj | ≤ 1 for all λj , (6.11)

i.e. ρ ≤ 1, in which case the error will not grow.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

220 / 454

Numerical Solutions of Parabolic Problems

Stability Analysis

Because A is tridiagonal with constant elements along each diagonal, the eigenvalues are (see section 3.5) λj = 1 − (4s) sin2 jπ 2I , j = 1, . . . , I − 1. (6.12)

Note that there are (I − 1) eigenvalues of the (I − 1) × (I − 1) matrix A. For equation (6.11) to hold, −1 ≤ 1 − (4s) sin2 jπ 2I ≤ 1.

The right inequality is true for all j (s > 0 and sin2 () > 0). The left inequality is true if jπ 1 − (4s) sin2 ≥ −1 2I −(4s) sin2 s sin2 ∴ true for all j if s ≤

MMAE 517 (Illinois Institute of Technology)

jπ 2I jπ 2I

≥ −2 ≤ 1 2 0 < sin2 jπ 2I <1

c 2010 K. W. Cassel 221 / 454

1 . 2

Computational Fluid Dynamics

Numerical Solutions of Parabolic Problems

Stability Analysis

Thus, the Euler method is stable for s ≤ 1/2. Notes: Whereas here we only needed eigenvalues for a tridiagonal matrix, in general we need to ﬁnd the eigenvalues of a (I + 1) × (I + 1) matrix. The eﬀect of diﬀerent boundary conditions are reﬂected in A and, therefore, the resulting eigenvalues. This is the same method used to obtain convergence properties of iterative methods for elliptic problems. Recall that the spectral radius ρ(I, J) is the modulus of the largest eigenvalue of the iteration matrix φn+1 = Aφn , where here n indicates successive iterates rather than time steps. If ρ ≤ 1, then the iterative procedure converges. In iterative methods, however, we are concerned not only with whether they will converge or not, but the rate at which they converge, e.g. Gauss-Seidel vs. Jacobi.

⇒ Minimize ρ for maximum convergence rate.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

222 / 454

Numerical Solutions of Parabolic Problems

Stability Analysis

Parabolic problems ⇒ We only require eigenvalues to be less than or equal to one for stability (it is not necessary to minimize).

⇒ It is often advantageous to use a time-marching (parabolic) scheme for solving steady (elliptic) problems due to the less restrictive stability criterion. This is sometimes referred to as the pseudo-transient method, e.g.

2

φ=0

→

∂φ + ∂t

2

φ = 0.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

223 / 454

Numerical Solutions of Parabolic Problems

Stability Analysis

von Neumann Method (Fourier Analysis) We expand the errors along grid lines at one time level as a Fourier series. Then we determine if the Fourier modes decay or amplify in time. Expanding the error at t = 0 (n = 0)

I−1 I−1

e(x, 0) =

m=1

em (x, 0) =

m=1

am (0)eiθm x ,

(6.13)

**where am (0) are the amplitudes of the Fourier modes, θm = mπ, and here √ i = −1. At a later time t
**

I−1 I−1

e(x, t) =

m=1

em (x, t) =

m=1

am (t)eiθm x .

(6.14)

We want to determine how am (t) behaves with time.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

224 / 454

em (x.. then the ampliﬁcation after n time steps is (Gm )n = am (t) am (t − ∆t) am (∆t) am (t) .8) is (use index j instead of i) en+1 = (1 − 2s)en + s(en + en ). each mode m must satisfy the equation independently. Thus. i. . with am (t) = (Gm )n am (0). t − ∆t) am (t − ∆t) which is the ampliﬁcation factor for the mth mode during one time step. Dividing by (Gm )n eiθm x we have Gm = = Gm (1 − 2s) + s eiθm ∆x + e−iθm ∆x 1 − 2s [1 − cos(θm ∆x)] θm ∆x 2 [cos(ax) = (eiax + e−iax )/2] [sin2 x = [1 − cos(2x)]/2] = 1 − (4s) sin2 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. deﬁne the gain of mode m. the error will not grow if |Gm | ≤ 1 for all m.14) with am (t) = (Gm )n am (0) into equation (6. t) am (t) = . .14). j j+1 j−1 j j = 2. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Therefore. If it takes n time steps to get to time t.e.15) gives (canceling am (0) in each term) (Gm )n+1 eiθm x = (1 − 2s)(Gm )n eiθm x + s(Gm )n eiθm (x+∆x) + eiθm (x−∆x) .. of the error equation corresponding to the diﬀerence equation. (6. . The von Neumann method consists of seeking a solution of the form (6. t) = em (x. . = . W. t).15) This equation is linear. therefore. as Gm (x. Cassel 225 / 454 Numerical Solutions of Parabolic Problems Stability Analysis For the ﬁrst-order explicit (Euler) method. Gm (x. I. W. am (t − ∆t) am (t − 2∆t) am (0) am (0) where (Gm )n is the nth power of Gm . the error equation (4.Numerical Solutions of Parabolic Problems Stability Analysis To do this. substituting (6. Cassel 226 / 454 . the method is stable.

Numerical Solutions of Parabolic Problems Stability Analysis For stability. |Gm | ≤ 1. thus. 0 ≤ sin2 θm ∆x 2 ≤ 1. therefore. The left inequality holds if s ≤ 1/2 (see matrix method). |Gm | equals the square root of the sum of the squares of the real and imaginary parts. W. W. Cassel 227 / 454 Numerical Solutions of Parabolic Problems Implicit Methods Outline 6 Numerical Solutions of Parabolic Problems Introduction Explicit Methods Euler Method (First-Order Explicit) Richardson Method DuFort-Frankel Method Stability Analysis Introduction Numerical Stability Analysis Implicit Methods First-Order Implicit Crank-Nicolson Non-Linear Convective Problems First-Order Explicit Crank-Nicolson Upwind-Downwind Diﬀerencing Multidimensional Problems First-Order Explicit Method First-Order Implicit Method ADI Method with Time Splitting MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. if we have a complex number. −1 ≤ 1 − (4s) sin2 θm ∆x 2 ≤1 for all θm = mπ. Note that |Gm | is the modulus. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. i.e. Thus. for this case we obtain the same stability criterion as from the matrix method. Cassel 228 / 454 . The right inequality holds for all m and s > 0.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 230 / 454 .Numerical Solutions of Parabolic Problems Implicit Methods Outline (cont’d) Factored ADI Method MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 229 / 454 Numerical Solutions of Parabolic Problems Implicit Methods We can improve on the stability properties of explicit methods by solving implicitly for more information at the new time level. W.

Note that it is j strongly diagonally dominant. . j j+1 j j−1 j = 2. First-order backward diﬀerence for time derivative. (6.16) which is a tridiagonal problem for φn+1 at the current time level. Cassel 232 / 454 . W. . I. this gives φn+1 − φn φn+1 − 2φn+1 + φn+1 j j j+1 j j−1 =α + O(∆t. . W. sφn+1 − (1 + 2s)φn+1 + sφn+1 = −φn . First-order forward diﬀerence for time derivative. Cassel 231 / 454 Numerical Solutions of Parabolic Problems Implicit Methods For the unsteady. ∆x2 ). 2 ∆t ∆x Thus. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. . First-order implicit: Central diﬀerence for spatial derivatives on the (n + 1)st (current) time level.Numerical Solutions of Parabolic Problems Implicit Methods First-Order Implicit Recall the ﬁrst-order explicit method: Central diﬀerence for spatial derivatives on the nth (previous) time level. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 1-D diﬀusion equation.

we must only be concerned with accuracy. (6. Notes: 1) The ﬁrst-order implicit method is only O(∆t) accurate. W. m=1 θm = mπ. Therefore. j j+1 j j−1 We expand the error at time t as I−1 (6.Numerical Solutions of Parabolic Problems Implicit Methods von Neumann Stability Analysis: Error satisﬁes equation (6. Cassel 234 / 454 .16) sen+1 − (1 + 2s)en+1 + sen+1 = −en . However. W. whereas for implicit methods. 2) There are more computations required per time step than for explicit methods. not stability).18) Substituting into (6. ⇒ For explicit methods. t) = (Gm )n am (0)eiθm x . Note that 1 + (4s) sin2 θm ∆x 2 >1 for all θm and s > 0.17) gives (canceling am (0) in each term) s(Gm )n+1 eiθm (x+∆x) − (1 + 2s)(Gm )n+1 eiθm x +s(Gm )n+1 eiθm (x−∆x) s eiθm ∆x + e−iθm ∆x − (1 + 2s) Gm [(2s) cos(θm ∆x) − (1 + 2s)] Gm {1 + 2s [1 − cos(θm ∆x)]} Gm = = = = −(Gm )n eiθm x −1 −1 1 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. and the method is unconditionally stable. Gm < 1. Cassel 233 / 454 Numerical Solutions of Parabolic Problems Implicit Methods ∴ Gm = 1 + (4s) sin 2 θm ∆x 2 −1 . Thus. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. one can typically use larger time steps (only limited by temporal resolution required. the method is stable if |Gm | ≤ 1. we must choose the time step ∆t for both accuracy and stability.17) e(x.

i+1 i i−1 i+1 i i−1 which we solve for φn+1 at the current time level. I. i i = 2. W.19) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 2 2 ∆t 2 ∆x ∆x Later we will show that averaging the diﬀusion terms across time levels in this manner is second-order accurate in time. Writing the diﬀerence equation in tridiagonal form. Cassel 236 / 454 . . . this is accomplished as follows φn+1 − φn α ∂ 2 φn+1 ∂ 2 φn i i + O(∆t2 ) = + + O(∆t2 ) 2 2 ∆t 2 ∂x ∂x n+1 n+1 n+1 φn − 2φn + φn α φi+1 − 2φi + φi−1 φn+1 − φn i i−1 i i = + i+1 . 1-D diﬀusion equation. . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. (6. W. therefore. we have sφn+1 − 2(1 + s)φn+1 + sφn+1 = −sφn − 2(1 − s)φn − sφn . . Cassel 235 / 454 Numerical Solutions of Parabolic Problems Implicit Methods For the unsteady.Numerical Solutions of Parabolic Problems Implicit Methods Crank-Nicolson We prefer second-order accuracy in time. consider approximating the equation midway between time levels.

4) Very popular scheme for parabolic problems.20) We seek an expression of the form φi MMAE 517 (Illinois Institute of Technology) n+1/2 ˜ = φ + T. i 2 i (6. c 2010 K. W.E.E. we will illustrate a method to determine the accuracy of a speciﬁed approximation (cf. 3) Apply derivative boundary conditions at current time level. Cassel 238 / 454 Computational Fluid Dynamics . Cassel 237 / 454 Numerical Solutions of Parabolic Problems Implicit Methods Averaging Across Time Levels: Here we will again show that averaging across time levels as in the Crank-Nicolson method is second-order accurate in time.Numerical Solutions of Parabolic Problems Implicit Methods Notes: 1) Second-order accurate in space and time. Consider averaging a quantity φi midway between time levels as follows φi n+1/2 = 1 n+1 (φ + φn ) + T. In doing so. W. 2) Unconditionally stable for all s. Taylor series expansions in section 4). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

.20) is second-order accurate. the approximation (6. ∆t Dt 2 k ˜ φ. n+1/2 φi 1 = (2m)! m=0 ˜ 1 =φ+ 2! ∞ ∆t Dt 2 2 2m ˜ φ ∆t Dt 2 4 . 8 ∂t2 therefore.e. k ∞ = k=0 ˜ φ = k=0 (−1)k k! ∆t Dt 2 k ˜ φ. thus. . . . k = 0.E. . 3. φi = φ + T. Note that 1 + (−1)k = k = 1. W. 2.Numerical Solutions of Parabolic Problems Implicit Methods Let us expand each term as a Taylor series about (xi . tn+1/2 ): ∞ φn+1 i φn i = k=0 ∞ 1 k! 1 k! ∆t Dt 2 ∆t − Dt 2 k ˜ φ. Substituting these expansions into (6. Cassel 240 / 454 . n+1/2 ˜ i. ˜ φ + ... . Note that this agrees with the result (6. 5. n+1/2 ˜ where Dt = ∂/∂t. . 4. i. φi n+1/2 ∆t Dt 2 ˜ 1 φ+ 4! The ﬁrst term in the expansion (m = 0) is the exact value and the second term (m = 1) gives the truncation error of the approximation. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.e.. W.5) except for the constant factor (we averaged across two time levels for the DuFort-Frankel method).20) gives n+1/2 φi 1 = 2 ∞ k=0 1 1 + (−1)k k! 0. Cassel 239 / 454 Numerical Solutions of Parabolic Problems Implicit Methods Let k = 2m. This truncation error term is ˜ 1 2 ∂2φ ∆t . φi n+1/2 = 1 n+1 (φ + φn ) + O(∆t2 ). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 2. i 2 i This shows that averaging across time levels gives an O(∆t2 ) approximation of φi at the mid-time level tn+1/2 . and φ is the exact value of φi midway between time levels.

W. W. Cassel 241 / 454 Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Outline (cont’d) Factored ADI Method MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 242 / 454 .Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Outline 6 Numerical Solutions of Parabolic Problems Introduction Explicit Methods Euler Method (First-Order Explicit) Richardson Method DuFort-Frankel Method Stability Analysis Introduction Numerical Stability Analysis Implicit Methods First-Order Implicit Crank-Nicolson Non-Linear Convective Problems First-Order Explicit Crank-Nicolson Upwind-Downwind Diﬀerencing Multidimensional Problems First-Order Explicit Method First-Order Implicit Method ADI Method with Time Splitting MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

and using a forward diﬀerence in time.21) ∂t ∂x ∂x where ν is the viscosity. unsteady diﬀusion equation with convection terms) ∂u ∂2u ∂u =ν 2 −u . ∆t). W. For stability. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. i−1 ν∆t i where s = ∆x2 and Ci = ∆x = Courant number. i Writing in explicit form leads to un+1 = i s− Ci 2 un ∆t un + (1 − 2s)un + s + i+1 i Ci 2 un . this method requires that 2 ≤ Re∆x ≤ 2/Ci . 1-D Burger’s equation (1-D.Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Consider the unsteady. Cassel 244 / 454 . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. This is very restrictive. We want to consider how the nonlinear convection term is treated in the various schemes. Cassel 243 / 454 Numerical Solutions of Parabolic Problems Non-Linear Convective Problems First-Order Explicit Approximating spatial derivatives at the previous time level. − un i+1 i 2 ∆t ∆x 2∆x where the un in the convection term is known from the previous time level. we have un − 2un + un un − un un+1 − un i i−1 i−1 i i = ν i+1 + O(∆x2 . where Re∆x = un ∆x/ν = mesh Reynolds i number. W. (6.

it is nonlinear.23) − s− Ci 2 = u un+1 + 2(1 + s)un+1 − s + i+1 i Ci s− 2 ∆t Ci 2 un+1 i−1 (6. Cassel 245 / 454 Numerical Solutions of Parabolic Problems Non-Linear Convective Problems where 1 n+1 (ui + un ) + O(∆t2 ). W. . i. 2) Compute update for un+1 . i i n+1/2 4) Repeat until un+1 converges for all i. this procedure requires iteration at each time step: 1) Begin with ui = un . . using equation (6. i = 1. but we do not know ui yet.24).22) = MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.e.e. i+1 i−1 4∆x (6. ∆t ). Cassel 246 / 454 . i−1 un i+1 + 2(1 − s)un i Ci + s+ 2 n+1/2 n+1/2 where here Ci = i ∆x .Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Crank-Nicolson un+1 − un i i ∆t ν ∂ 2 un+1 ∂ 2 un 1 ∂un+1 ∂un + − un+1/2 + 2 ∂x2 ∂x2 2 ∂x ∂x ν = un+1 − 2un+1 + un+1 + un − 2un + un i+1 i i−1 i i−1 2∆x2 i+1 n+1/2 ui 2 2 − un+1 − un+1 + un − un i+1 i−1 + O(∆x . W. this results in the implicit ﬁnite diﬀerence equation ui n+1/2 = (6.24) un . i 3) Update ui n+1/2 1 = 2 (un+1 + un ). . i. i MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. use ui from previous time step as initial guess i at current time step. i 2 Thus. I + 1. Therefore. .

W. If un+1/2 > 0.Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Notes: 1) It typically requires less than ten iterations to converge at each time step. if more are required. then the time step ∆t is too large. W. i. whereas here we want an accurate solution at each time step. Cassel 248 / 454 . Cassel 247 / 454 Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Upwind-Downwind Diﬀerencing Consider the ﬁrst-order convective terms in the Crank-Nicolson approximation. then approximate ∂un+1/2 /∂x as follows: MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.e. u n+1/2 n+1/2 ∂u ∂x . 2) In elliptic problems we use Picard iteration because we only care about the ﬁnal converged solution. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Then ∂u 1 = ∂x 2 1 ∂u = ∂x 2 Notes: 1) Although the ﬁnite-diﬀerence approximation at the current time level appears to be a backward diﬀerence and that at the previous time level appears to be a forward diﬀerence. + − ∆x un i MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∆t2 ) accurate will be shown at the end of this section.26) + O(∆x2 . they are really central diﬀerences evaluated at half-points in the grid. 2) The fact that this approximation is O(∆x2 . Cassel 249 / 454 Numerical Solutions of Parabolic Problems Non-Linear Convective Problems If un+1/2 < 0. + − ∆x un i−1 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. ∆t2 ). then approximate ∂un+1/2 /∂x as follows: Now we have ∂u 1 = ∂x 2 1 ∂u = ∂x 2 ∂un+1 ∂x un+1 i+1 + i+1/2 ∂un ∂x un i + O(∆t2 ) i−1/2 − ∆x un+1 i (6. ∂un+1 ∂x un+1 i + i−1/2 ∂un ∂x un i+1 + O(∆t2 ) i+1/2 − ∆x un+1 i−1 (6. Cassel 250 / 454 .25) + O(∆x2 . W. ∆t2 ).

2) Iteration at each time step may require under-relaxation on ui .22) rather than central diﬀerences un+1 − un = i i 1 s un+1 − 2un+1 + un+1 + un − 2un + un i+1 i i−1 i+1 i i−1 2 n+1/2 un+1 − un+1 + un − un . for other than the one-dimensional Burger’s equation. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. uk+1 = ωui i where 0 < ω < 1. ∆t2 ) accurate.. Be sure to check this for diﬀerent equations.27) is diagonally dominant for all s and Ci (note that Ci may be positive or negative). consider the un+1/2 ∂un+1/2 ∂x term with un+1/2 < 0 from (6. ui ui n+1/2 n+1/2 = sun i+1 + 2(1 − + − Ci >0 . . Cassel 252 / 454 k+1/2 + (1 − ω)uk . the truncation error T. of this approximation.E. therefore.28) = (un+1 − un+1 + un − un ) + T.e. n+1/2 2 un+1 − un+1 + un − un . 2. Cassel 251 / 454 Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Notes: 1) Equation (6.26) in equation (6. . this method is (almost) O(∆x2 . . <0 (6. i.26) ∂u 1 (6. i. W. . 3) As shown below. Therefore.E. 1.e. i i−1 i ∂x 2∆x i+1 We would like to determine the order of accuracy. . ui >0 1 i+1 i i i−1 − Ci .27) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. i k = 0. Truncation Error of Crank-Nicolson with Upwind-Downwind Diﬀerencing: We have used second-order accurate central diﬀerences for the ∂u/∂t and ∂ 2 u/∂x2 terms.Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Use (6. ui <0 i i−1 i+1 i This gives the tridiagonal problem −sun+1 i+1 + 2(1 + s)un+1 i s)un i − sun+1 i−1 sun i−1 + Ci un+1 − un+1 i i−1 un+1 − un+1 i+1 i un − un i+1 i un i − un i−1 . .25) and (6.

˜ k = k=0 ∆t − Dt − ∆xDx 2 u = ˜ k=0 ∆t Dt + ∆xDx 2 u. and u is the exact value of ui ˜ between time levels. Dt = ∂/∂t. ˜ MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∂x ∂x n+1/2 midway MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 254 / 454 . Cassel 253 / 454 Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Expanding each term in equation (6. W. W. We seek an expression of the form ∂u ∂u ˜ = + T.28) as a 2-D Taylor series about (xi . ˜ k ∞ = k=0 ∞ u ˜ k = k=0 ∞ (−1)k k! (−1)k k! ∆t Dt 2 k u. ˜ = k=0 ∞ u. tn+1/2 ): ∞ un+1 i+1 un+1 i un i un i−1 = k=0 ∞ 1 k! 1 k! 1 k! 1 k! ∆t Dt + ∆xDx 2 ∆t Dt 2 ∆t − Dt 2 k k u.E.Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Here. Dx = ∂/∂x.

. . 2. 5. . . W. − ∆t Dt 2 k u ˜ . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. m where k m are the binomial coeﬃcients k m = k! m!(k − m)! (0! = 1). let k = 2l + 1. k = 0. . W.Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Substituting these expansions into (6.28) gives ∂u ∂x = 1 2∆x ∞ k=0 1 k! 1 − (−1) k ∆t Dt + ∆xDx 2 ∆t Dt 2 k k + −1 + (−1) ∂u ∂x Note that 1 + (−1)k+1 = Therefore. thus. l=0 1 (2l + 1)! ∆t Dt + ∆xDx 2 2l+1 − ∆t Dt 2 2l+1 u. . Cassel 255 / 454 Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Recall the binomial theorem k (a + b) = m=0 k k k−m m a b . Cassel 256 / 454 . 2. ˜ MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. k = 1. 3. ∂u 1 = ∂x ∆x ∞ k u ˜ k = 1 2∆x ∞ k=0 1 + (−1)k+1 k! ∆t Dt + ∆xDx 2 0. 4.

the v∂u/∂y term has truncation error O(∆t2 . if ∆t < ∆x then the approximation is O(∆x2 ) accurate. ∆x2 ). Similarly. consider the l = 1 term (m = 1. ∆y 2 ). ˜ 2l + 1 m ∆t Dt 2 2l+1−m (∆xDx )m = 1 ∆x ∞ l=0 1 (2l + 1)! + 2l+1 m=1 ∆t Dt 2 2l+1 2l−m+1 (∆xDx )m 2l+1 2l + 1 0 2l+1 ∆t Dt 2 − ∆t Dt 2 u.Numerical Solutions of Parabolic Problems Non-Linear Convective Problems Thus. ˜ ∞ = l=0 (2l + 1)! 1 (2l + 1)! m=1 m!(2l − m + 1)! ∞ 2l+1 ∆t Dt 2 2l−m+1 (∆x)m−1 (Dx )m u. ∆t∆x. Note: 1 Method is unconditionally stable. but strictly speaking it is not O(∆t2 . The loss of accuracy is due to the diagonal averaging across time levels. W. ˜ ∂u ∂x = ∂u ˜ + ∂x l=1 1 m!(2l − m + 1)! m=1 ∆t Dt 2 2l−m+1 (∆x)m−1 (Dx )m u. ˜ MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. ∂u ∂x = 1 ∆x ∞ l=0 1 (2l + 1)! − 2l+1 ∆t Dt 2 m=0 2l+1 2l + 1 m u. and if ∆t > ∆x then the approximation is O(∆t2 ) accurate. Computational Fluid Dynamics c 2010 K. 3) 1 1!2! ∆t 2 2 2 Dt Dx u + ˜ 1 2!1! ∆t 2 2 ∆xDt Dx u + ˜ 1 3 ∆x2 Dx u. This is better than O(∆x) or O(∆t). Cassel 257 / 454 Numerical Solutions of Parabolic Problems Non-Linear Convective Problems To obtain the truncation error. the truncation error is O(∆t2 . 2. ∆t∆y. Cassel 258 / 454 MMAE 517 (Illinois Institute of Technology) . Thus. ∆x2 ). ˜ 3!1! Therefore.

W. Cassel 260 / 454 .Numerical Solutions of Parabolic Problems Multidimensional Problems Outline 6 Numerical Solutions of Parabolic Problems Introduction Explicit Methods Euler Method (First-Order Explicit) Richardson Method DuFort-Frankel Method Stability Analysis Introduction Numerical Stability Analysis Implicit Methods First-Order Implicit Crank-Nicolson Non-Linear Convective Problems First-Order Explicit Crank-Nicolson Upwind-Downwind Diﬀerencing Multidimensional Problems First-Order Explicit Method First-Order Implicit Method ADI Method with Time Splitting MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 259 / 454 Numerical Solutions of Parabolic Problems Multidimensional Problems Outline (cont’d) Factored ADI Method MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W.

j + φi−1. ∆x2 .j i+1. y. t).j+1 − 2φi.j − 2φi.Numerical Solutions of Parabolic Problems Multidimensional Problems Consider the unsteady. y) at t = 0. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.j + φi. We discretize as follows (t is normal to x − y plane): MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∂t ∂x2 ∂y with initial condition φ(x. W. 2-D diﬀusion equation ∂φ ∂2φ ∂2φ =α + 2 .29) and boundary conditions (Dirichlet.j i.29) using a forward diﬀerence in time and central diﬀerences in space at the previous time level gives n n n n φn+1 − φn φn φn i. W.j i. Cassel 262 / 454 . 0) = φ0 (x. ∆y 2 ).30) φ = φ(x. (6. Neumann or mixed) on a closed contour C enclosing the domain. y.j−1 =α + ∆t (∆x)2 (∆y)2 +O(∆t. (6. Cassel 261 / 454 Numerical Solutions of Parabolic Problems Multidimensional Problems First-Order Explicit Method Approximating equation (6.

j i+1. W.j i−1.j i. W.Numerical Solutions of Parabolic Problems Multidimensional Problems Therefore. 2 Thus. solving for the only unknown gives the explicit expression n n n φn+1 = (1 − 2sx − 2sy )φn + sx (φn i.j+1 i. Cassel 263 / 454 Numerical Solutions of Parabolic Problems Multidimensional Problems First-Order Implicit Method Applying a backward diﬀerence in time and central diﬀerences in space at the current time level leads to the implicit expression (1 + 2sx + 2sy )φn+1 − sx (φn+1 + φn+1 ) − sy (φn+1 + φn+1 ) = φn .j i+1.32) i. for MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 4 1 2 which is even more restrictive than for the 1-D diﬀusion equation where s ≤ stability.j + φi−1.j i.j−1 ). For numerical stability. (6.e. Cassel 264 / 454 . a von Neumann stability analysis requires that sx + sy ≤ 1 .j−1 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. (6. sx = sy = s. for example if ∆x = ∆y.31) i.j ) + sy (φi. we must have s≤ 1 .j where sx = α∆t/(∆x)2 and sy = α∆t/(∆y)2 . i.j+1 + φi.

i.Numerical Solutions of Parabolic Problems Multidimensional Problems Notes: 1 2 Unconditionally stable for all sx and sy . evaluated at the previous time step. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics 265 / 454 Numerical Solutions of Parabolic Problems Multidimensional Problems ADI Method with Time Splitting (Fractional-Step Method) As mentioned above. but with more terms on the right-hand-side. called ADI with time splitting. W. Produces a banded matrix (with ﬁve unknowns) that is diﬃcult to solve eﬃciently. we split each time step into two half-time steps as follows: 1 Sweep along lines of constant y during the ﬁrst half step. 3 4 Alternatively. Cassel 266 / 454 . It produces a similar implicit equation. resulting in two sets of tridiagonal problems per time step: Step 1: Solve implicitly for terms associated with one coordinate direction. W. we could split each time step into two half steps.e. Step 2: Solve implicitly for terms associated with other coordinate direction. c 2010 K. Crank-Nicolson could be used to obtain second-order accuracy in time.

j = − sy φn −(1−sy )φn − sy φn . . .34) are solved for φi. .j + sx φi−1. . i. φi.j + φi.j n+1/2 n+1/2 n+1/2 n+1/2 1 1 1 n+1/2 n+1/2 1 n+1/2 sx φi+1.j−1 =α + .Numerical Solutions of Parabolic Problems Multidimensional Problems n n − φn φi+1. Cassel 268 / 454 .j φn i.j − 2φi.j i. i = 1.35) n+1/2 n+1/2 n+1/2 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. .j − 2φi. .j i.j+1 i.j ∆t/2 n+1/2 φi+1. at the intermediate time level.j−1 2 2 2 2 (6.j −(1+sx )φi.j i. ∆t/2 (∆x)2 (∆y)2 (6. W.j+1 i. I + 1.j i. φn+1 − φi. j = 1.j + φi−1. .j φn+1 − 2φn+1 + φn+1 i. . Cassel 267 / 454 Numerical Solutions of Parabolic Problems 2 Multidimensional Problems Sweep along lines of constant x during the second half step.j+1 − 2φi. W. 2 2 (∆x) (∆y) (6.j−1 =α + .j + φi−1.34) n+1/2 The tridiagonal problems (6.33) Therefore.j . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. J + 1.

Numerical Solutions of Parabolic Problems

Multidimensional Problems

Therefore, 1 1 1 n+1/2 n+1/2 1 n+1/2 sy φn+1 −(1+sy )φn+1 + sy φn+1 = − sx φi+1,j −(1−sx )φi,j − sx φi−1,j . i,j+1 i,j i,j−1 2 2 2 2 (6.36) n+1 The tridiagonal problems (6.36) are solved for φi,j , i = 1, . . . , I + 1, j = 1, . . . , J + 1, at the current time level. Notes:

1 2

Method is O(∆t2 , ∆x2 , ∆y 2 ). Requires boundary conditions at the intermediate time level n + 1/2 for equation (6.34). For example, if the boundary condition at x = 0 is Dirichlet as follows φ(0, y, t) = a(y, t), then φn = an . 1,j j

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

269 / 454

Numerical Solutions of Parabolic Problems

Multidimensional Problems

**Subtracting equation (6.35) from (6.33) gives φi,j
**

n+1/2

− φn φn+1 − φi,j i,j i,j − ∆t/2 ∆t/2

n+1/2

n n φn+1 − 2φn+1 + φn+1 φn i,j+1 − 2φi,j + φi,j−1 i,j+1 i,j i,j−1 =α − 2 2 (∆y) (∆y)

**or solving for the unknown at the intermediate time level results in φi,j
**

n+1/2

=

1 n 1 n+1 n+1 n+1 n n φi,j + φn+1 + sy φn i,j+1 − 2φi,j + φi,j−1 − φi,j+1 − 2φi,j + φi,j−1 i,j 2 4

.

**Applying this equation at the boundary x = 0, leads to φ1,j
**

n+1/2

=

1 1 n n+1 aj + aj + sy an − 2an + an − an+1 − 2an+1 + an+1 j+1 j j−1 j+1 j j−1 2 4

.

This provides the boundary condition for φ1,j at the intermediate (n + 1/2) time level. Note that the ﬁrst term on the right-hand-side is the average of a at the n and n + 1 time levels, the second term is ∂ 2 an /∂y 2 , and the third term is ∂ 2 an+1 /∂y 2 .

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

270 / 454

Numerical Solutions of Parabolic Problems 3

Multidimensional Problems

For stability, apply von Neumann analysis at each half step and take the product of the resulting ampliﬁcation factors, G1 and G2 , to obtain G for the full time step.

⇒ Method is unconditionally stable for all sx and sy .

4

In 3-D, we require three fractional steps (∆t/3) for each time step, and the method is only conditionally stable, where sx , sy , sz ≤ 1.5, for stability (sz = α∆t/(∆z)2 ).

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

271 / 454

Numerical Solutions of Parabolic Problems

Multidimensional Problems

**Factored ADI Method
**

Let us reconsider the unsteady, 2-D diﬀusion equation ∂φ ∂2φ ∂2φ + 2 , =α ∂t ∂x2 ∂y and apply the Crank-Nicolson approximation φn+1 − φn α 2 n+1 i,j i,j 2 2 2 = δx φi,j + δx φn + δy φn+1 + δy φn , i,j i,j i,j ∆t 2 where δ represents second-order central diﬀerence operators (as in section 5.7)

2 δx φi,j =

(6.37)

φi+1,j − 2φi,j + φi−1,j , (∆x)2 φi,j+1 − 2φi,j + φi,j−1 . (∆y)2

2 δy φi,j =

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

272 / 454

Numerical Solutions of Parabolic Problems

Multidimensional Problems

Rewriting the diﬀerence equation with the unknowns on the left-hand-side and the knowns on the right leads to 1 2 2 1 − α∆t δx + δy 2 1 2 2 φn+1 = 1 + α∆t δx + δy i,j 2 φn . i,j (6.38)

We “factor” the diﬀerence operator on the left-hand-side as follows 1 2 2 1 − α∆t δx + δy 2 1 2 ≈ 1 − α∆tδx 2 1 2 1 − α∆tδy , 2 (6.39)

where the ﬁrst factor only involves the diﬀerence operator in the x-direction, and the second factor only involves the diﬀerence operator in the y-direction. The factored operator produces an extra term as compared to the unfactored operator 1 2 2 2 2 α ∆t δx δy = O(∆t2 ), 4 which is O(∆t2 ). Therefore, the factorization (6.39) is consistent with the second-order accuracy in time of the Crank-Nicolson approximation.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

273 / 454

Numerical Solutions of Parabolic Problems

Multidimensional Problems

The factored form of (6.38) is 1 2 1 − α∆tδx 2 1 1 2 2 2 1 − α∆tδy φn+1 = 1 + α∆t δx + δy i,j 2 2 φn , i,j

which can be solved in two steps by deﬁning the intermediate variable 1 2 ˆ φi,j = 1 − α∆tδy φn+1 . i,j 2 (6.40)

n+1/2 ˆ Note that φi,j is not the same as φi,j , which is an intermediate approximation to φi,j at the half time step.

**The two stage solution process is:
**

1

Sweep along constant y-lines solving 1 1 2 ˆ 2 2 1 − α∆tδx φi,j = 1 + α∆t δx + δy 2 2 φn , i,j (6.41)

**ˆ which produces a tridiagonal problem at each j for φi,j , i = 1, . . . , I + 1.
**

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 274 / 454

Numerical Solutions of Parabolic Problems 2

Multidimensional Problems

Sweep along constant x-lines solving (from (6.40)) 1 2 ˆ 1 − α∆tδy φn+1 = φi,j , i,j 2 (6.42)

which produces a tridiagonal problem at each i for φn+1 , j = 1, . . . , J + 1 at i,j the current time step. Note that the right-hand-side of this equation is the solution of (6.41).

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

275 / 454

Numerical Solutions of Parabolic Problems

Multidimensional Problems

Notes:

1

Similar to the ADI method with time splitting, but have an intermediate n+1/2 ˆ variable φi,j rather than half time step φi,j .

Factored ADI is somewhat faster; it only requires one evaluation of the spatial derivatives on the right-hand-side per time step (for equation (6.41)) rather than two for the ADI method (see equations (6.34) and (6.36)).

2

3

Method is O(∆t2 , ∆x2 , ∆y 2 ) accurate and is unconditionally stable (even for 3-D implementation of unsteady diﬀusion equation). ˆ Requires boundary conditions for the intermediate variable φi,j to solve (6.41). These are obtained from equation (6.40) applied at the boundaries (see Fletcher, section 8.4.1). The order of solution can be reversed, i.e. we could deﬁne 1 2 ˆ φi,j = 1 − α∆tδx φn+1 . i,j 2 instead of (6.40).

4

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

276 / 454

Cassel 278 / 454 . use upwind-downwind diﬀerencing as in section 6. Smith & Walker. JFM. pp.e. Observe that numerical methods for parabolic problems do not require relaxation or acceleration parameters as is often the case for elliptic solvers. unsteady Navier-Stokes or transport equation.3. W. 99–131 (1991). Cassel 277 / 454 Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation Outline 7 Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation Vorticity-Streamfunction Formulation Boundary Conditions for Vorticity-Streamfunction Formulation Thom’s Method Jensen’s Method Numerical Solutions of Coupled Systems of Equations Sequential Method MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Recall that the issue is numerical stability. W. 6 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.Numerical Solutions of Parabolic Problems 5 Multidimensional Problems If we have non-linear convective terms. 232. Vol. not iterative convergence.5. i. which shows factored ADI with upwind-downwind diﬀerencing applied to the the unsteady boundary-layer equations (but method applies to more general equations). See Peridier.

y ∗ . W. The density is ρ. y ∗ . It is convenient to nondimensionalize using a characteristic length scale L and velocity U according to (x∗ .1) V =− p+ 1 Re 2 V. given by the momentum equation ∂V∗ ρ + V∗ · ∗ ∂t and the continuity equation · V∗ = 0. W. ∂t ∂x ∂y ∂y Re ∂x2 ∂y (7. U p∗ p= .2) (7. and the velocity vector in Cartesian coordinates. z ∗ ) (x. Cassel 280 / 454 . Cartesian coordinates. L t∗ t= L/U V∗ V= . z) = . t∗ ). the viscosity is µ. z ∗ . the pressure is p∗ (x∗ . ρU 2 V∗ = − p∗ + µ 2 V∗ . y. for example. Cassel 279 / 454 Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation Applying to the Navier-Stokes equations gives ∂V +V· ∂t and · V = 0. In 2-D. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∂t ∂x ∂y ∂x Re ∂x2 ∂y y-momentum: ∂v ∂v ∂v ∂p 1 ∂2v ∂2v +u +v =− + + 2 . where Re = ρU L/µ is the nondimensional Reynolds number. is V∗ = u∗ i + v ∗ j + w∗ k. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. the incompressible Navier-Stokes equations are: x-momentum: ∂u ∂u ∂u ∂p 1 ∂2u ∂2u +u +v =− + + 2 .Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation Incompressible ﬂow of a Newtonian ﬂuid is governed by the Navier-Stokes equations.

t) and p(x. Re ∂x3 ∂x∂y 2 ∂x2 ∂y ∂y MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. we can determine v(x. y. t) given that p does not appear in equation (7. ∂x ∂y Thus. t). t) from equation (7. y) and v(x. W. y. t). take the divergence of the momentum equation in vector form. y.e. v(x. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. y. t) and p(x. Therefore. which in 2-D is equivalent to taking ∂/∂x of equation (7. Given u(x.2). (7. Cassel 282 / 454 . t). y. t).3)? ⇒ Need equation for p(x. W.Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation Continuity: ∂u ∂v + = 0. t) from equation (7. ∂/∂y of equation (7. we have three coupled equations for three dependent variables u(x. y) in terms of u(x. · (N S). y. which we refer to as primitive variables. y. y) at time t. we can determine u(x.3) To obtain such an equation.1).2) and adding. y. i. t) and p(x. Cassel 281 / 454 Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation Doing so gives ∂2p ∂2p + 2 ∂x2 ∂y ∂2u = − + ∂t∂x ∂u ∂x 2 ∂ 2 u ∂v ∂u ∂2u +u 2 + +v ∂x ∂x ∂y ∂x∂y ∂v ∂y 2 ∂2v ∂u ∂v ∂2v + + +u + ∂t∂y ∂y ∂x ∂x∂y + +v ∂2v ∂y 2 ∂3u ∂3v ∂3v 1 ∂3u + + + 3 . But how do we determine p(x. y.1). the system is closed mathematically: Given v(x. y.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∂x ∂y MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W.3) B ¨0 B0 ¨ B ¨0 2 2 ∂ p ∂ p ∂v ∂ ∂u ¨¨ ∂v ∂ ∂u ¨¨ ∂v ∂ ∂u ¨¨ + +u + +v + + 2 = − ¨¨ ¨¨ ¨¨ ∂x2 ∂y ∂t¨∂x ∂y ∂x¨∂x ∂y ∂y ¨∂x ∂y + ∂u ∂x 2 + ∂v ∂y 2 +2 ∂v ∂u ∂x ∂y B ¨0 2 B ¨0 1 ∂ 2 ∂u ¨¨ ∂v ∂ ∂u ¨¨ ∂v + + + 2 + 2 . Cassel 283 / 454 Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation But from the continuity equation (7. Cassel 284 / 454 .Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation Doing so gives ∂2p ∂2p + 2 ∂x2 ∂y ∂2u + = − ∂t∂x ∂u ∂x 2 ∂ 2 u ∂v ∂u ∂2u +u 2 + +v ∂x ∂x ∂y ∂x∂y ∂v ∂y 2 ∂2v ∂u ∂v ∂2v + + +u + ∂t∂y ∂y ∂x ∂x∂y + Or ∂2p ∂2p + 2 ∂x2 ∂y = − ∂ ∂u ∂v ∂ ∂u ∂v + +u + ∂t ∂x ∂y ∂x ∂x ∂y 2 2 ∂u ∂v ∂v ∂u + + +2 ∂x ∂y ∂x ∂y ∂u ∂v + ∂x ∂y ∂2 + 2 ∂y +v ∂2v ∂y 2 ∂3u ∂3v ∂3v 1 ∂3u + + + 3 . W. Re ∂x3 ∂x∂y 2 ∂x2 ∂y ∂y +v ∂ ∂y ∂u ∂v + ∂x ∂y 1 ∂2 + Re ∂x2 ∂u ∂v + ∂x ∂y . ¨ ¨ ¨ ¨ Re ∂x ¨∂x ∂y ∂y ¨∂x ∂y We also have from continuity that ∂u ∂x 2 = ∂v ∂y 2 =− ∂u ∂v .

2) with u = v = 0: ∂p 1 ∂2u = ∂x Re ∂x2 1 ∂2v ∂p n=y⇒ = ∂y Re ∂x2 n=x⇒ Other boundary conditions for pressure obtained similarly.. W.1) and (7. Notes: 1 (7. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. respectively): Surface: us = un = 0 (no slip and impermeability) Inﬂow: us and un speciﬁed Outﬂow: ∂us = ∂un = 0 (fully-developed ﬂow) ∂n ∂n Symmetry: ∂us ∂n = 0.2).Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation Substituting gives ∂2p ∂v ∂u ∂2p ∂u ∂v − . etc.. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.1) and (7.. ADI. un = 0 (no ﬂow through symmetry plane) Note that the domain must be suﬃciently long for the fully-developed outﬂow boundary condition to be valid. ⇒ Can be solved using cyclic reduction. Factored-ADI.2) are parabolic in time. respectively. W. + 2 =2 ∂x2 ∂y ∂x ∂y ∂x ∂y which is a Poisson equation for pressure with u(x. Gauss-Seidel. y) known from solutions of equations (7.. Cassel 285 / 454 Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation Velocity Boundary Conditions (us and un are velocity components tangential and normal to the surface. Cassel 286 / 454 .. y) and v(x. ADI. 2 The pressure equation (7. ⇒ May be solved using Crank-Nicolson. Pressure Boundary Conditions at a Surface: From the momentum equations (7.2) are elliptic.4) The unsteady momentum equations (7.1) and (7. etc..4) and steady forms of (7. Observe that we have Neumann boundary conditions on pressure at solid surfaces.1) and (7. multigrid.

incompressible ﬂow by u= ∂ψ . t) is deﬁned for 2-D. Lines of constant ψ are called streamlines and are everywhere tangent to the local velocity vectors. y. ∂x (7. W. Cassel 288 / 454 .5) such that the continuity equation (7. W. y.6) and measures the local rate of rotation of ﬂuid particles. with the sign corresponding to the right-hand-rule. ∂y v=− ∂ψ .Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation Outline 7 Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation Vorticity-Streamfunction Formulation Boundary Conditions for Vorticity-Streamfunction Formulation Thom’s Method Jensen’s Method Numerical Solutions of Coupled Systems of Equations Sequential Method MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∂x ∂y (7. ω MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. The vorticity ω(x.3) is identically satisﬁed. t) in 2-D is deﬁned by ω= ∂u ∂v − . Note that in general 3-D ﬂows vorticity is a − vector → = × V. Cassel 287 / 454 Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation The streamfunction ψ(x.

but no vorticity? To obtain the vorticity-transport equation. × (N S). vortex – a spatially coherent region of ﬂuid rotating as a unit. i.e. ∂x∂y ∂x∂y Re ∂x3 ∂x∂y 2 ∂x2 ∂y ∂y MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.” Example of a ﬂow with vorticity. an “eddy. W. W.e. but no vortex? Example of a ﬂow with vortex.1): MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. i. take the curl of the momentum equation in vector form. which in 2-D is equivalent to taking ∂/∂x of equation (7. Cassel 289 / 454 Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation Doing so gives ∂2v ∂u ∂v ∂2v ∂2v ∂v ∂v + +u 2 + +v ∂x∂t ∂x ∂x ∂x ∂x ∂y ∂x∂y 2 2 ∂ u ∂u ∂u ∂ u ∂v ∂u ∂2u − − −u − −v 2 ∂y∂t ∂y ∂x ∂x∂y ∂y ∂y ∂y ∂2p 1 ∂3v ∂3u ∂2p ∂3v ∂3u =− + + + − − 3 . Cassel 290 / 454 .2) minus ∂/∂y of equation (7.Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation Note that vorticity = vortex: vorticity – spatial distribution of rotation rates of individual ﬂuid particles.

=− + + + − ∂x∂y ∂x∂y Re ∂x3 ∂x∂y 2 ∂x2 ∂y ∂y Or ∂ ∂t ∂v ∂u − ∂x ∂y ∂u − ∂y +u ∂ ∂x ∂v ∂u − ∂x ∂y 1 ∂2 = Re ∂x2 +v ∂ ∂y ∂v ∂u − ∂x ∂y ∂2 + 2 ∂y + ∂v ∂x ∂u ∂v + ∂x ∂y ∂u ∂v + ∂x ∂y ∂v ∂u − ∂x ∂y ∂v ∂u − ∂x ∂y MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 292 / 454 . Cassel 291 / 454 Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation But from the continuity equation (7. W.6) B ¨ω B ¨ω B ¨ω B ¨0 ∂ ∂v ¨¨ ∂u ∂ ∂v ¨¨ ∂u ∂ ∂v ¨¨ ∂u ∂v ∂u ¨¨ ∂v − +u − +v − + + ¨ ¨ ¨ ¨¨ ¨ ¨ ¨ ∂t¨∂x ∂y ∂x¨∂x ∂y ∂y ¨∂x ∂y ∂x¨∂x ∂y B ¨ω 2 B ¨ω B ¨0 2 ∂u ∂u ¨¨ ∂v 1 ∂ ∂v ¨¨ ∂u ∂ ∂v ¨¨ ∂u − + = − + 2 − ¨ ¨ ¨ ¨ ¨ ¨ ∂y ¨∂x ∂y Re ∂x2 ¨∂x ∂y ∂y ¨∂x ∂y Therefore. W.Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation Doing so gives ∂2v ∂u ∂v ∂2v ∂2v ∂v ∂v + +u 2 + +v ∂x∂t ∂x ∂x ∂x ∂x ∂y ∂x∂y 2 2 ∂ u ∂u ∂u ∂ u ∂v ∂u ∂2u − − −u − −v 2 ∂y∂t ∂y ∂x ∂x∂y ∂y ∂y ∂y 1 ∂3v ∂3u ∂2p ∂3v ∂3u ∂2p − 3 .7) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.3) and the deﬁnition of vorticity (7. ∂t ∂x ∂y Re ∂x2 ∂y 2 which is a convection-diﬀusion equation. (7. the vorticity-transport equation in 2-D is ∂ω ∂ω ∂ω 1 ∂2ω ∂2ω +u +v = + .

The streamfunction equation (7.7)). there is no need to calculate the pressure in order to advance the solution in time. t) and ψ(x. incompressible ﬂows. 2 3 4 The vorticity-streamfunction formulation consists of two equations for the two unknowns ω(x. Cassel 293 / 454 Numerical Solutions of Navier-Stokes Equations 5 Vorticity-Streamfunction Formulation Unlike the primitive variables formulation.5) into (7. Cannot deﬁne streamfunction in 3-D ⇒ Vorticity-velocity potential formulation.6) to obtain ∂2ψ ∂2ψ + = −ω.Numerical Solutions of Navier-Stokes Equations Vorticity-Streamfunction Formulation The vorticity and streamfunction may be related by substituting (7. W. The vorticity-transport equation (7. Notes: 1 Equations (7. Cassel 294 / 454 .8) ∂x2 ∂y 2 which is a Poisson equation for ψ(x. t) (cf. W. y. t) from equation (7. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.8) is elliptic. → Can compute p(x. The pressure terms have been eliminated. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. y. y. 6 We do not have straightforward boundary conditions for vorticity (see next section). ⇒ Because of notes (3) and (4) (notwithstanding (6)). y. primitive variables formulation with three equations for three unknowns in 2-D). t) is known. Stretching and tilting terms in 3-D vorticity equations. t) if ω(x. v = −∂ψ/∂x in (7.4) if desired.8) are coupled equations for ω and ψ (with u = ∂ψ/∂y.7) is parabolic when unsteady and elliptic when steady.e. y.7) and (7. i. the ω–ψ formulation does not easily extend to 3-D: Three components of vorticity ⇒ Three vorticity equations. (7. this is the preferred formulation for 2-D.

Cassel 295 / 454 Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation Consider the driven cavity ﬂow: Recall that the streamfunction is deﬁned by u= ∂ψ . W. ∂x MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 296 / 454 . ∂y v=− ∂ψ .Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation Outline 7 Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation Vorticity-Streamfunction Formulation Boundary Conditions for Vorticity-Streamfunction Formulation Thom’s Method Jensen’s Method Numerical Solutions of Coupled Systems of Equations Sequential Method MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W.

the streamfunction and its normal derivative are speciﬁed.Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation Thus. Cassel 297 / 454 Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation On CD: v=0⇒ ∂ψ =0⇒ψ=0 ∂x ∂ψ =1 u=1⇒ ∂y ∴ ψ and ∂ψ speciﬁed (n = y). ∂n At solid boundaries. where only one is needed. = 0 ∂y ∂ψ v=0⇒ =0 ∂x ∂ψ ∴ ψ and speciﬁed (n = x). Note that we have two boundary conditions on the streamfunction. therefore. W. on AB: ∂ψ =0⇒ψ=0 v=0⇒ ∂x ∂ψ u=0⇒ =0 ∂y ∂ψ ∴ ψ and speciﬁed (n = y). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. Cassel 298 / 454 . on AD and BC: ∂ψ u=0⇒ = 0 ⇒ ψ = const. ∂n MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∂n Similarly.

10) where the tangential wall velocity uw (x) = g(x) is speciﬁed. for example. to obtain a condition for ω at the surface. along AB ψ = 0. y=0 ωw = − We also have u= ∂2ψ ∂y 2 (7. for example. ∂x2 ∂y 2 However.9) ∂ψ = 0 on y = 0. W. ∂x ∂y where τw is the wall shear stress. W. However. Cassel 300 / 454 . Use “extra” boundary condition ∂ψ/∂n = const. ∂y For generality. τw is unknown and must be determined from the solution. consider a moving wall with ∂ψ ∂y = uw (x) = g(x). Strategy: Use ψ = const.Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation In order to consider boundary conditions on vorticity. therefore. on AB: v=0⇒ ∂v ∂u τw =0⇒ω=− =− . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 299 / 454 Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation Thom’s Method Consider. ⇒ Don’t have boundary condition for ω. and . y=0 (7. Throughout the domain we have ∂2ψ ∂2ψ + = −ω.8). ∂x ∂y µ ∂v ∂u − . ∂2ψ ∂x2 = 0. as boundary condition for streamfunction equation (7. recall its deﬁnition ω= Thus. the lower boundary AB (y = 0). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation Applying a central diﬀerence to (7. W. it exhibits second-order convergence (Huang & Wetton 1996).11) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.2 − 2ψi.10) gives ψi.9) gives ωi.2 − 2∆y gi + O(∆y 3 ). However.13) We then use the most recent iterate for streamfunction ψ to obtain a Dirichlet boundary condition for vorticity ω. ψi.12) Substituting (7. 2∆y therefore.11) for ψi. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.2 − ψi.2 − ψi. (∆y)2 (7.0 in the previous equation leads to ωi.0 = ψi.1 − ∆y gi ] + O(∆y). Note: The truncation error for Thom’s method is only O(∆y). W. Cassel 302 / 454 .0 + O(∆y 2 ).1 + ψi. Cassel 301 / 454 Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation A central diﬀerence for (7.1 = − ψi. (7.0 = gi + O(∆y 2 ). (∆y)2 (7.1 = − 2 [ψi.

therefore.3 = gi + O(∆y 3 ). II.Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation Jensen’s Method We would like a method that is O(∆y 2 ) overall.2 + ψi.14) therefore.2 − ψi. 6∆y 3 1 ψi. Treatment of vorticity (and pressure) boundary conditions is still an active area of research and debate (see. 2 2 Substituting into (7. for example.3 + 6∆y gi ] + O(∆y 2 ).1 = − 1 [7ψi. pp. consider using an O(∆y 3 ) approximation for (7. Cassel 304 / 454 . 2 2(∆y) (7.12) results in ωi. Vol. see Fletcher. Cassel 303 / 454 Numerical Solutions of Navier-Stokes Equations Boundary Conditions for Vorticity-Streamfunction Formulation Notes: 1 For discussion of boundary conditions on vorticity and streamfunction at inlets and outlets.2 − ψi. Rempfer 2003). We then use (7.1 + 3ψi.10) −2ψi. 380–381.14) in place of (7.3 − 3∆y gi + O(∆y 4 ). 2 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.0 = − ψi.0 − 3ψi.1 − 8ψi. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.13) to obtain a Dirichlet boundary condition for vorticity. W.1 + 6ψi.

iterate on. Vol. i. i. use most recent values.e. Requires one pass through mesh for each equation at each iteration. See. W. Cassel 306 / 454 . Vanka. W. produces an n × n block tridiagonal system of equations that is solved for all the dependent variables simultaneously. 138–158 (1986). P. p)). Phys.. ⇒ If have n dependent variables (e. such as the Navier-Stokes equations in the primitive-variables or vorticity-streamfunction formulations. pp. each equation for its dominant variable. 2 Simultaneous (or Coupled) Solution: Combine coupled equations into a single system of algebraic equations.e. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. S. but in ﬂuid dynamics we must solve systems of coupled equations. 65. Comput.g. for example. v. Two methods for treating coupled equations numerically: 1 Sequential Solution: Solve.Numerical Solutions of Navier-Stokes Equations Numerical Solutions of Coupled Systems of Equations Outline 7 Numerical Solutions of Navier-Stokes Equations Primitive-Variables Formulation Vorticity-Streamfunction Formulation Boundary Conditions for Vorticity-Streamfunction Formulation Thom’s Method Jensen’s Method Numerical Solutions of Coupled Systems of Equations Sequential Method MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. J. treating the other variables as known. 2-D primitive variables ⇒ n = 3 (u. we have considered methods for solving single equations. ⇒ Most common and easiest to implement. Cassel 305 / 454 Numerical Solutions of Navier-Stokes Equations Numerical Solutions of Coupled Systems of Equations Until now.

2 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. if solving using Gauss-Seidel: 1 Sequential ⇒ One Gauss-Seidel expression for each dependent variable updated in succession. W. Cassel 308 / 454 . Cassel 307 / 454 Numerical Solutions of Navier-Stokes Equations Numerical Solutions of Coupled Systems of Equations Sequential Method Consider for example the primitive-variables formulation. Simultaneous ⇒ Solve n equations for n unknown dependent variables directly at each grid point.Numerical Solutions of Navier-Stokes Equations Numerical Solutions of Coupled Systems of Equations For example. Steady Problems: Note: May require underrelaxation for convergence due to nonlinearity. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

⇒ Trade-oﬀ: Generally. Non-Uniform Grids Grid Generation Algebraic Grid Generation Elliptic Grid Generation Variational Grid Generation MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. reducing ∆t reduces number of inner loop iterations. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. (If ∆t small enough. Cassel 309 / 454 Grids and Grid Generation Introduction Outline 8 Grids and Grid Generation Introduction Staggered vs. Cassel 310 / 454 . Collocated Grids Uniform vs. Inner loop to obtain solution of coupled equations at current time step. W. no iteration is necessary).Numerical Solutions of Navier-Stokes Equations Numerical Solutions of Coupled Systems of Equations Unsteady Problems: Notes: Outer loop for time marching.

W. W. In the following two sections we consider alternatives to uniform and collocated grids. Collocated Grids Outline 8 Grids and Grid Generation Introduction Staggered vs. collocated grids. Cassel 311 / 454 Grids and Grid Generation Staggered vs. Non-Uniform Grids Grid Generation Algebraic Grid Generation Elliptic Grid Generation Variational Grid Generation MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Collocated ⇒ All dependent variables are approximated at the same point. Collocated Grids Uniform vs.” Uniform ⇒ Grid spacings in each direction ∆x and ∆y are uniform. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 312 / 454 .Grids and Grid Generation Introduction Thus far we have used what are called “uniform.

Collocated Grids Alternatively. ∂t ∂x ∂y ∂y Re ∂x2 ∂y ∂v ∂u ∂2p ∂2p ∂u ∂v − . Cassel 313 / 454 Grids and Grid Generation Staggered vs. all three equations are approximated at the same points in the grid for their respective dependent variables u(x. y). Collocated Grids Recall the 2-D. y). Cassel 314 / 454 . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.1) + 2 . and p(x. incompressible Navier-Stokes equations in the primitive variables formulation ∂u ∂u ∂u ∂p 1 ∂2u ∂2u +u +v =− + (8. v(x. ∂t ∂x ∂y ∂x Re ∂x2 ∂y ∂v ∂v ∂p 1 ∂2v ∂v ∂2v +u +v =− + + 2 .2) (8. using a staggered grid we approximate each primitive variable and its associated equation as follows. W.3) When using collocated grids. y). + 2 =2 2 ∂x ∂y ∂x ∂y ∂x ∂y (8. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W.Grids and Grid Generation Staggered vs.

and v points do not coincide with the x = 0 boundary in the above example. Cassel 316 / 454 .j + ui.j − 2ui.2) and (8. 2∆x 1 ui.j−1 + vi+1. 2 ∆x ui.j + O(∆x2 ).j−1 (vi. 4 2∆y pi+1. let us consider how each of the terms in the x-momentum equation (8. Speciﬁcally. Collocated Grids For example.j + O(∆x2 ).j + vi+1.j + O(∆x2 ). ∆x ui+1. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Collocated Grids Note that special treatment is required at the boundaries.j−1 + O(∆y 2 ).j+1 − ui.3) are treated in a similar manner at their respective points while being approximated at their respective locations in the grid. either grid points at which u or v are computed or speciﬁed do not coincide with the boundary.j+1 − 2ui.j + vi. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 315 / 454 Grids and Grid Generation Staggered vs.j + ui−1. the points where u are taken do not coincide with the y = 0 boundary. 2 ∆y = = = The terms in equations (8.j ui+1. W. W. Therefore.j − pi.j−1 ) + O(∆y 2 ).Grids and Grid Generation Staggered vs.1) are approximated (using central diﬀerences) on a staggered grid u v ∂u ∂x ∂u ∂y ∂p ∂x ∂2u ∂x2 ∂2u ∂y 2 = = ui.j − ui−1.

Grids and Grid Generation Staggered vs. Cassel 317 / 454 Grids and Grid Generation Uniform vs. W. “Ensures” conservation of kinetic energy. Non-Uniform Grids Outline 8 Grids and Grid Generation Introduction Staggered vs. 2 Advantages of collocated grid: 1 Easier to understand and program. Collocated Grids Advantages of staggered grid: 1 Helps avoid oscillations in pressure that can occur in some methods applied to incompressible Navier-Stokes. W.e. vi. Easier to implement boundary conditions.j and pi. ui.j are all approximated at the same location. particularly for complex boundaries. Cassel 318 / 454 . i. Non-Uniform Grids Grid Generation Algebraic Grid Generation Elliptic Grid Generation Variational Grid Generation MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.j . 2 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Collocated Grids Uniform vs.

Alternatively. e.g. Therefore. Applying Taylor series at xi−1 and xi+1 with ∆xi = ∆xi+1 and solving for ∂φ/∂x leads to ∆x2 − ∆x2 ∂φ φi+1 − φi−1 i+1 i = − ∂x ∆xi + ∆xi+1 2(∆xi + ∆xi+1 ) ∂2φ ∂x2 ∆x3 + ∆x3 i+1 i − i 6(∆xi + ∆xi+1 ) ∂3φ ∂x3 +· · · . W.Grids and Grid Generation Uniform vs. Non-Uniform Grids In many ﬂows. Non-Uniform Grids Let us obtain the ﬁnite-diﬀerence approximations using Taylor series as before. a ﬁne grid is necessary to resolve the ﬂow near boundaries. those involving boundary layers. the solution has local regions of intense gradients. Cassel 319 / 454 Grids and Grid Generation Uniform vs. Cassel 320 / 454 . but without assuming all ∆x’s are equal. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. As a result. W. a non-uniform grid would allow us to reﬁne the grid where it is needed. a uniform grid would waste computational resources where they are not needed. For example. consider the ﬁrst-derivative term ∂φ/∂x. i MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. but the same resolution is not necessary in the remainder of the domain.

Grids and Grid Generation Uniform vs.e. Non-Uniform Grids If the grid is uniform. W. ∂x ∆xi+1 ∆xi (∆xi + ∆xi+1 ) As one can imagine. and the approximation reduces to the usual O(∆x2 )-accurate central diﬀerence approximation for the ﬁrst derivative. the truncation error is only O(∆x). Non-Uniform Grids Grid Generation Algebraic Grid Generation Elliptic Grid Generation Variational Grid Generation MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. and it is diﬃcult to ensure consistent accuracy for all approximations. Cassel 322 / 454 . However. W. which results in φi+1 ∆x2 − φi−1 ∆x2 + φi (∆x2 − ∆x2 ) ∂φ i i+1 i+1 i = + O(∆x2 ). i. this gets very complicated. Cassel 321 / 454 Grids and Grid Generation Grid Generation Outline 8 Grids and Grid Generation Introduction Staggered vs. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. We could restore second-order accuracy by using an appropriate approximation to ∂ 2 φ/∂x2 i in the second term. Collocated Grids Uniform vs. then the second term vanishes. for a non-uniform grid. ∆xi = ∆xi+1 .

y) and η = η(x.6) (8. i. η). 2 We consider transformations of the form (x. W. We desire a smooth grid distribution. ∂y ∂y ∂ξ ∂y ∂η where ξx = ∂ξ/∂x. it is often advantageous to transform the problem to a computational domain on which a uniform mesh may be used. and (ξ. ηy (8. y). η) are the variables in the computational domain such that ξ = ξ(x. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. rectangular or circular. y) are the variables in the physical domain. which requires that J = 0. where (x.5) Properties of the transformation: 1 2 Mapping must be one-to-one. η). To transform back to the physical domain.4) (8.e. Cluster grid points in regions of the physical domain where the solution varies rapidly. and ηy = ∂η/∂y are called the metrics of the transformation. Cassel 324 / 454 . therefore.g. large gradients occur. e. η) and y = y(ξ. Such a transformation generally has one or both of the following objectives: 1 Transform a complex physical domain into a simple.Grids and Grid Generation Grid Generation Rather than using non-uniform grids. ηx = ∂η/∂x. the metrics should be smoothly varying throughout the domain. ξy = ∂ξ/∂y. y) ⇐⇒ (ξ. The Jacobian of the transformation is J= ξx ξy ηx ξ = x ηy ηx ξy = ξx ηy − ξy ηx . we regard x = x(ξ. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. the transformation laws are ∂ ∂ξ ∂ ∂η ∂ = + . ∂x ∂x ∂ξ ∂x ∂η ∂ ∂ξ ∂ ∂η ∂ = + . computational domain. Cassel 323 / 454 Grids and Grid Generation Grid Generation From the chain rule.

Diﬃcult to extend to 3-D. Cassel 326 / 454 .e. 2 3 4 Algebraic transformation. 97-100). W. Variational methods. For details. for example. W. solution of partial diﬀerential equation. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. i. recall MMAE 501. Methods of obtaining the mapping: 1 Conformal mapping See ﬁgure 1 for an example of a Schwarz-Christoﬀel transformation. Elliptic grid generation. Cassel 325 / 454 Grids and Grid Generation Grid Generation Algebraic Grid Generation Consider. the ﬂow in a diﬀuser: The equation for the upper (sloped) boundary is yb = f (x) = H1 + H2 − H1 x. L MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.Grids and Grid Generation 3 Grid Generation We may want to enforce orthogonality of the grid (see Fletcher pp.

H2 −H1 ∂y f (x) H1 + L ξ See ﬁgure 2 for plots of these metrics. Cassel 327 / 454 Grids and Grid Generation Grid Generation The inverse transformation is then x = ξ. W.8) which produces a stretched grid in the physical domain. ∂x ∂ξ = 0. ∂y H2 −H1 η ∂η f (x) f (ξ) L . η). which show that they are smooth. W. L (8. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. f (x) (8. Cassel 328 / 454 . = −y 2 =− η=− ∂x f (x) f (ξ) H1 + H2 −H1 ξ L ∂η 1 1 = = . Let us check the metrics of this transformation ∂ξ = 1. η= y . y = f (x)η = H1 + H2 − H1 ξ η.Grids and Grid Generation Grid Generation We seek to transform this physical domain into a rectangular computational domain through the algebraic tranformation ξ = x.7) We then utilize a uniform grid in the computational domain (ξ.

We have introduced the boundary-layer variable Y such that y = Re−1/2 Y. y) ∂u ∂u f (ξ) ∂u = u(ξ. W. Cassel 329 / 454 Grids and Grid Generation Grid Generation Let us now consider another scenario in which we have a semi-inﬁnite boundary-layer ﬂow above a surface.4) and (8.Grids and Grid Generation Grid Generation Let us transform the governing equations using the transformation laws (8. W.5) ∂ ∂ξ ∂ ∂η ∂ ∂ f (ξ) ∂ = + = −η . ∂x ∂ξ f (ξ) ∂η MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∂y ∂y ∂ξ ∂y ∂η f (ξ) ∂η For example. η) −η . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 0 ≤ Y ≤ ∞. consider the convection term u(x. ∂x ∂x ∂ξ ∂x ∂η ∂ξ f (ξ) ∂η ∂ξ ∂ ∂η ∂ 1 ∂ ∂ = + = . Cassel 330 / 454 .

W. For an illustration. The transformation laws for the transformation (8. it is necessary to know where to cluster the grid points a priori. to the equations themselves. and reducing a concentrates more grid points near the surface at y = 0 in the physical domain when using a uniform grid in the computational (ξ. Cassel 332 / 454 3 4 5 MMAE 517 (Illinois Institute of Technology) . however. One possibility is ξ = x. Must choose the algebraic transformation ahead of time. i. complex geometry and grid.e. It is easy to cluster grid points in the desired regions of the domain. Physical domain ⇒ “simple” equations. 2 Computational overhead is typically relatively small for algebraic methods. complex boundaries and/or non-uniform grids.e. Computational domain ⇒ simple geometry and grid. i. “complex” equations. Cassel 331 / 454 Grids and Grid Generation Grid Generation where Γ(η) = Then 1 [1 + cos(πη)] . i. variational grid generation).9) is used in the x-direction and a stretching transformation similar to that for the diﬀuser is used in the y-direction. (8. see ﬁgure 3 in which transformation (8.Grids and Grid Generation Grid Generation We want a transformation that maps the semi-inﬁnite domain into a ﬁnite one and clusters points near the surface.9) This maps Y = 0 to η = 0 and Y = ∞ to η = 1. before solving the problem (cf.e. = Γ(η) 2 ∂Y ∂η ∂η ∂η ∂η Notes: 1 Algebraic methods move the complexity. W. there are no additional equations to solve. ∂Y ∂Y ∂ξ ∂Y ∂η ∂η MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∂x ∂ξ ∂ ∂ξ ∂ ∂η ∂ ∂ = + = Γ(η) . η= 2 tan−1 π Y a . It is diﬃcult to handle complex geometries.9) are ∂ ∂ = . Computational Fluid Dynamics c 2010 K. πa ∂2 ∂ ∂ ∂2 ∂ 2 Γ(η) = Γ (η) 2 + Γ(η)Γ (η) . η) domain.

φ → ξ. a uniform grid in (ξ.e. ζ = ξ + iη. ∂x2 ∂y ∂2η ∂2η + 2 = 0. W.e. i. i. W. ∂x2 ∂y 2 (8. i. we could utilize complex variables: z = x + iy. ∂x2 ∂y (8. Cassel 334 / 454 . 89-96) and is good for two-dimensional ﬂows in certain types of geometries. vol.Grids and Grid Generation Grid Generation Elliptic Grid Generation Consider the potential ﬂow past a cylinder: The velocity potential and streamfunction both satisfy the Laplace equation ∂2φ ∂2φ + 2 = 0.11) would provide a good mapping on which to base the computational grid. therefore.10) Observe that the streamlines and isopotential lines would make a good grid on which to obtain a numerical solution.11): 1) Grid parameters are governed by the Laplace equation. ψ → η. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. an appropriate solution to ∂2ξ ∂2ξ + 2 = 0. pp. elliptic grid generation. i.e. η) produces the above grid in physical space. ∂x2 ∂y ∂2ψ ∂2ψ + = 0. Cassel 333 / 454 Grids and Grid Generation Grid Generation Thus. There are two approaches to obtaining the solution to (8. II. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.e. 2) Solve a boundary-value problem to generate the grid. they are harmonic. This approach uses conformal mapping (see Fletcher.

12) in the computational domain (ξ. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Note that equations (8. η). For ξ = ξ(x. ∂x2 ∂y ∂2η ∂2η + 2 = Q(x.13) Similarly. known functions involving sources and sinks may be added to the right-hand-side of equations (8. W. y). y). We want to solve (8. ∂x ∂y η = η(x. y). dη We can solve the latter expression for [dξ dη]T by multiplying by the inverse dξ dη = xξ yξ xη yη −1 dx dy = dξ dη = yη −xη −yξ xξ dx dy xξ xη yξ yη 1 yη −xη dx dy J −yξ xξ MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. η) and y = y(ξ. y) and η = η(x. we must transform the governing equation(s). ∂x ∂y dη = ∂η ∂η dx + dy. η). y). ∂x2 ∂y (8. to the computational domain.12) are for ξ = ξ(x. y). Therefore. Cassel 335 / 454 Grids and Grid Generation Grid Generation or in matrix form dξ ξ = x dη ηx ξy ηy dx . e. η) to obtain the grid transformations x = x(ξ. In addition. we seek the transformation laws for (x. y). η) to (x. the total diﬀerentials are dξ = ∂ξ ∂ξ dx + dy.12) where P and Q contain exponential functions. Navier-Stokes. y) → (ξ. W.Grids and Grid Generation Grid Generation In order to control grid clustering. we have that dx x = ξ dy yξ xη yη dξ . Cassel 336 / 454 .g. dy (8. for the inverse transformation from (ξ.11) ∂2ξ ∂2ξ + 2 = P (x.

∂ξ ∂ξ∂η ∂η J ∂ξ ∂η ∂2y 1 ∂y ∂y ∂2y ∂2y g22 2 − 2g12 + g11 2 = − 2 P +Q . Cassel 337 / 454 Grids and Grid Generation Grid Generation From these we obtain the second derivative transformation laws as follows ∂2 ∂2η ∂ ∂2ξ ∂ + 2 + = ∂x2 ∂x2 ∂ξ ∂x ∂η and ∂2 ∂2η ∂ ∂2ξ ∂ = + 2 + ∂y 2 ∂y 2 ∂ξ ∂y ∂η ∂ξ ∂y 2 ∂ξ ∂x 2 ∂2 + ∂ξ 2 ∂η ∂x 2 ∂2 ∂η ∂ξ ∂ 2 . ∂ξ ∂η ∂η ∂ξ MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.14) +2 ∂η 2 ∂x ∂x ∂η∂ξ ∂2 + ∂ξ 2 ∂η ∂y 2 ∂2 ∂η ∂ξ ∂ 2 +2 . ∂x J ∂ξ ∂ξ 1 ∂x =− .Grids and Grid Generation Grid Generation Comparing with equation (8.4) and (8. ∂y J ∂ξ Substituting into the transformation laws (8.13). ∂ξ ∂ξ∂η ∂η J ∂ξ ∂η (8.14) and (8.16) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∂x J ∂η 1 ∂y ∂η =− . we see that ξx ηx 1 yη ξy = ηy J −yξ −xη . (8.15) ∂η 2 ∂y ∂y ∂η∂ξ Application of equations (8. W.12) gives ∂2x ∂2x ∂2x 1 ∂x ∂x g22 2 − 2g12 + g11 2 = − 2 P +Q . W.15) to equations (8. the transformation metrics are 1 ∂y ∂ξ = . (8. ∂η ∂ξ ∂ξ ∂η ∂x ∂ ∂x ∂ − . xξ Thus.5) give ∂ ∂ξ ∂ ∂η ∂ 1 = + = ∂x ∂x ∂ξ ∂x ∂η J ∂ ∂η ∂ ∂ξ ∂ 1 = + = ∂y ∂y ∂η ∂y ∂ξ J ∂y ∂ ∂y ∂ − . ∂y J ∂η ∂η 1 ∂x = . Cassel 338 / 454 .

. etc. We solve (GS. η) to obtain the inverse transformation x = x(ξ. ∂ξ ∂η ∂ξ ∂η ∂x ∂η 2 + ∂y ∂η 2 . W. η).) equations (8. Notes: 1) Provides smoother grids than algebraic transformations due to use of diﬀusion-type equations to generate grid.16) on a uniform grid in (ξ. For boundary conditions to apply to equations (8. 2) Can enforce grid orthogonality. W. Cassel 339 / 454 Grids and Grid Generation Grid Generation Therefore. ∂x ∂x ∂y ∂y + . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.16). y = y(ξ. Note that the coeﬃcients in the equations are deﬁned such that g= g11 g21 g12 = J 2. 2) Grid line slopes at the boundaries.Grids and Grid Generation Grid Generation where g11 g12 g22 = = = ∂x ∂ξ 2 + ∂y ∂ξ 2 . we have a coupled set of nonlinear elliptic equations with Dirichlet or Neumann boundary conditions. multigrid. → Eﬀects of discontinuities at boundaries are smoothed out in interior. η). specify either: 1) Grid point locations (x. y) on boundaries. ADI. SOR.. g22 (g12 = g21 ). Cassel 340 / 454 . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

for example. U. in which the grid “adapts” to local features of the solution as it is computed. Winslow and TTM methods. η) for desired clustering. 6) Large computational times are required to produce the grid. Z.Foundation and Applications. i. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. who consider smoothness. Cassel 342 / 454 . W. J. C. Cassel 341 / 454 Grids and Grid Generation Grid Generation 7) References: For more elliptic grid generation options. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 4) Can extend to three-dimensional geometries (cf. one must use trial-and-error until something that “looks good” is obtained. see Knupp. “Fundamentals of Grid Generation.” CRC Press (1994). variational grid generation. 8) The ultimate in grid generation is adaptive grid methods. and Mastin.Grids and Grid Generation Grid Generation 3) Can treat multiply-connected regions (see ﬁgure 5). A. Thompson. on the same order as the time required to solve the governing equations. η) and Q(ξ. “Numerical Grid Generation . 5) Diﬃcult to choose P (ξ. P. F. Warsi.. Generally. conformal mapping).e..” North Holland (1985). see.. and Steinberg. W. S.

One-Dimensional: We determine functionals for which the stationary function(s) gives a transformation in which the grid spacing ∆xi is proportional to a weight function φ(ξi+1/2 ). W. i.” grid in a least squares sense. it eliminates the trial-and-error necessary in elliptic grid generation. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 343 / 454 Grids and Grid Generation Grid Generation Physical domain: a ≤ x ≤ b Computational domain: 0 ≤ ξ ≤ 1 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ”best.e. therefore.Grids and Grid Generation Grid Generation Variational Grid Generation Advantages: Provides a more intuitive and mathematically formal basis for grid generation. Generally formulated to produce the optimal. Cassel 344 / 454 . W.

xξ ) = .17) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.Grids and Grid Generation Grid Generation Consider the following discrete functional I S= i=1 (xi+1 − xi )2 = 2φi+1/2 I i=1 ∆x2 i . Cassel 346 / 454 . (8. we want to minimize S subject to the end conditions x1 = a. W. With the integrand of the functional being 1 x2 ξ F = F (ξ. We seek the grid distribution x(ξ) that minimizes the functional I[x(ξ)]. This is known as the weighted length functional. φ (8. φ MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. x(1) = b. For a given weight function φ(ξ). Cassel 345 / 454 Grids and Grid Generation Grid Generation with the end conditions x(0) = a. 2φi+1/2 where xi = x(ξi ). 2 φ Euler’s equation is given by ∂F d − ∂x dξ − ∴ xξξ − d dξ ∂F ∂xξ xξ φ =0 =0 (φ > 0). xi+1 = x(ξi+1 ) and φi+1/2 = (φ(ξi ) + φ(ξi+1 ))/2. Dividing the above expression by ∆ξ (= constant) gives S = ∆ξ I i=1 ∆xi ∆ξ 2 ∆ξ . W. 2φi+1/2 Taking ∆ξ → 0 gives the continuous functional 1 I[x(ξ)] = 2 1 0 (∂x/∂ξ)2 1 dξ = φ(ξ) 2 1 0 x2 ξ dξ. x. xI+1 = b.18) (8.19) φξ xξ = 0.

Cassel 348 / 454 . In this case. say w(x). In that case. the integrand of the functional is 1 x2 ξ F = F (ξ. x(1) = b. x(1) = b. Conceptually. we prefer to think in terms of physical weight functions. dξ Writing this expression in discrete form yields ∆xi =Cφ ∆ξ ξi+1 + ξi 2 . we take φ = w2 > 0 in equation (8. where the proportionality constant is C∆ξ. x. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 347 / 454 Grids and Grid Generation Grid Generation Note that the weight function φ(ξ) has been expressed in the computational domain. we see that this requires that ∆xi be proportional to φi+1/2 . (8.17) giving the physical weight length functional 1 1 x2 ξ I[x(ξ)] = dξ. Therefore.18).Grids and Grid Generation Grid Generation with boundary conditions x(0) = a. W. ∆xi = K w xi+1 + xi 2 2 . In order to see what this means for the grid spacing. 2 (x) 2w MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Let us set the grid spacing to be proportional to [w(x)]2 . Therefore. and it is not necessarily clear how it should be chosen. φ ξ Integrating (with integration constant C) and multiplying by φ(ξ) gives dx = Cφ(ξ).20) 2 (x) 2 0 w with x(0) = a. i.e. let us consider equation (8. the grid spacing is determined by a physical variable or one of its derivatives giving rise to feature-adaptive grid generation. which is xξ = 0. W. xξ ) = .

Cassel (8. ∂F wx = − 3 x2 . the Euler equation is xξξ − MMAE 517 (Illinois Institute of Technology) xξ ∂F = 2. except that now w(x) is a physical weight function. The boundary conditions are x(0) = a. xξ wξ xξ = 0. w ξ − By the chain rule d dξ d 1 d = = dx dx dξ xξ dξ Thus. c 2010 K. where c is the convection speed.Grids and Grid Generation Grid Generation Therefore. x(1) = b. steady convection-diﬀusion equation uxx − cux = 0.21) 349 / 454 Computational Fluid Dynamics Grids and Grid Generation Grid Generation which is of the same form as (8. e −1 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 350 / 454 . ∂x w ξ and Euler’s equation gives wx 2 d xξ =0 x − 3 ξ w dξ w2 wx xξ wx 2 xξξ xξ + 2 − 2 3 xξ = 0 w3 w w wx 2 xξξ − x = 0. u(a) = 0. Increasing c produces an increasingly thin boundary layer near x = b. a ≤ x ≤ b. One-Dimensional Illustration: Consider the one-dimensional. (8.22) is ec(x−a) − 1 u(x) = c(b−a) . The exact solution to (8. w (w > 0). ∂xξ w ⇒ wx = 1 wξ . W.22) u(b) = 1. W.19) (this is why we set φ = w2 ).

Grids and Grid Generation Grid Generation The governing equation (8. Cassel 351 / 454 Grids and Grid Generation Grid Generation To solve (8. w≈ 1 . Here we will use the grid equation (8.22) and the grid equation must be transformed into the computational domain. 0 < w ≤ 1.23) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.21) (corresponding to the physical weighted-length functional (8. W. u(1) = 1. xξ dξ xξ dξ xξ dξ xξ dξ Transforming the governing equation (8. xξξ + cxξ uξ = 0. x2 dξ 2 xξ dξ xξ dξ ξ or uξξ − with boundary conditions u(0) = 0. Observe that ux small ux large ⇒ ⇒ w ≈ 1. the transformation laws are d dx d2 dx2 = = dξ d 1 d = .20)) wξ xξξ − xξ = 0. x(1) = b.23) for the velocity u(ξ) requires the grid x(ξ). (8.24) w with the boundary conditions x(0) = a. dx dξ xξ dξ 1 d2 1 d 1 d xξξ d = 2 2− 3 . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.22) to computational coordinates gives 1 du 1 d2 u xξξ du − 3 −c = 0.25) is a parameter to be chosen. (8. → How to choose w(x)? A common choice for a feature-adaptive weight function is based on the gradient of the dependent variable of the form w(x) = where 1 1+ 2 u2 x . W. |ux | (|ux | ↑ ⇒ w ↓ ⇒ ∆x ↓). Cassel 352 / 454 . In one dimension. xξ (8.

x(0) = a.24) is wξ = w 2 uξ xξξ xξ uξ − uξξ x2 + 2 u2 ξ ξ . xξξ − W (ξ)xξ = 0. where X(ξ) = u(0) = 0. we have two coupled second-order linear ordinary diﬀerential equations.27) Note: A uniform grid in the physical domain results if = 0 (w = 1.27).e.28) (8. i.24). Thus. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. w Recall that the last expression is given by equation (8. (8.27) expressed in the computational ξ-plane are uξξ − X(ξ)uξ = 0.24) (with (8.23) and the grid equation (8. the coeﬃcient in equation (8. 1+ 2 x2 ξ u2 ξ Therefore. u(1) = 1. and all the weight function information is contained in the W (ξ) coeﬃcient in the grid equation. x(ξ) = (b − a)ξ + a. x(1) = b. Thus.29) xξξ + cxξ . (8. increasing increases the inﬂuence of the transformation. wξ = 0). we need the weight function (8.26) wξ = − − 2 xξξ u2 3 ξ ξ x 2 uξ 2 1+ 2 x2 ξ u2 ξ 3/2 = xξξ xξ uξ − uξξ 3/2 x2 ξ . (8. Cassel 353 / 454 Grids and Grid Generation Grid Generation Numerical Procedure: The governing equation (8. Note that all of the grid transformation information is encapsulated in the X(ξ) coeﬃcient in the governing equation. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. xξ wξ W (ξ) = . Cassel 354 / 454 . respectively. W.Grids and Grid Generation Grid Generation For use in the grid equation (8.25) in terms of the computational coordinate ξ: w (x(ξ)) = 1 1+ Taking the derivative 2 2 x2 uξ uξξ ξ 2 x2 ξ u2 ξ .

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. . ∆ξ Xi . I.29). y] = 2 0 0 φ(ξ.2. η). η) > 0.28) approximated on the computational grid using central diﬀerences ui+1 − 2ui + ui−1 ui+1 − ui−1 = 0.e. We obtain a similar tridiagional problem for the grid equation (8.nb’ Two-Dimensional: The two-dimensional analog to the one-dimensional weighted-length functional (8. ξ 2 x2 + yη = K2 ψ(ξ. η) > 0 and ψ(ξ. η) where we now have two weight functions φ(ξ. . i. √ √ g11 = 2 x2 + yξ = K1 φ(ξ. − Xi 2 ∆ξ 2∆ξ Thus. we have the tridiagonal problem Ai ui−1 + Bi ui + Ci ui+1 = Di . η) ψ(ξ. η g22 = Recall that g11 and g22 are deﬁned in section 8. 2 i = 2. Cassel 356 / 454 . I[x. This produces a grid for which the lengths of the coordinate lines are proportional to the weight functions.4. where Ai Bi Ci Di = = = = 1+ −2. . 2 ∆ξ Xi . 1− 0. W. . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.Grids and Grid Generation Grid Generation Consider equation (8.17) is 2 2 x2 + yη 1 1 1 x2 + yξ ξ η + dξdη. η). W. Cassel 355 / 454 Grids and Grid Generation Grid Generation See the Mathematica notebook ’GridGen.

η) > 0. Cassel 358 / 454 . is proportional to a weight function φ(ξ. + ξ xη ψ yη ψ = 0. W.Grids and Grid Generation Grid Generation The Euler equations are then xξ φ yξ φ Notes: 1) If φ = ψ = c. then the Euler equations are Laplace equations xξξ + xηη = 0. η MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. elliptic grid generation. 2) The weight functions control the interior grid locations in a much more formal manner than the P and Q forcing functions in elliptic grid generation. the local grid spacing is directly proportional to the speciﬁed weight functions. ∴ IA [x. η MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. i. cf. which may be related directly to the physical solution. which is related to the Jacobian J. η − ξ = 0. Cassel 357 / 454 Grids and Grid Generation Grid Generation Other functionals are also possible: Area Functional: The area of each cell. That is. η + ξ = 0. yξξ + yηη = 0. W. φ Jxξ φ Jyξ φ = 0.e. y] = Euler equations: Jxη φ Jyη φ − ξ 1 2 1 0 0 1 J2 dξdη.

One criteria could be emphasized over the other by including weight coeﬃcients in the respective terms in the functional. W. Euler equations: (g12 xη )ξ + (g12 xξ )η = 0. This results in a grid such that the average of the area and orthogonality functionals are minimized. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. For example. consider the area-orthogonality functional 1 IAO [x. y] = 2 1 0 0 1 2 J 2 + g12 1 dξdη. (g12 yη )ξ + (g12 yξ )η = 0. η + ξ = 0. = φ 2 1 0 0 1 g11 g22 dξdη. the orthogonality functional is 1 1 1 2 g dξdη. therefore. Cassel 360 / 454 . W. y] = 2 0 0 12 such that g12 is minimized in a least squares sense (without a weight function). Cassel 359 / 454 Grids and Grid Generation Grid Generation Combination Functionals: We can form combinations of the above functionals. Euler equations: g22 xξ φ g22 yξ φ + ξ g11 xη φ g11 yη φ = 0. η MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ∴ IO [x. φ 2 where again the fact that J 2 = g = g11 g22 − g12 has been used.Grids and Grid Generation Grid Generation Orthogonality Functional: The grid is orthogonal if g12 = xξ xη + yξ yη = 0.

y. w(x. η) can be obtained by solving the Euler equations (most common) or the variational form directly. yξ . functionals may be written to determine ξ(x. η). in order to determine the mappings x(ξ. i. xξ . rather than in the computational domain.5 and chapter 11). W. These are called contravariant functionals (see Knupps and Steinberg section 8. Cassel 362 / 454 . ξy . t). y. η) remains ﬁxed and uniform).Grids and Grid Generation Grid Generation Notes: 1) Just as in the one-dimensional case. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. xη . η] = 2 1 0 0 1 F (x.e. φ(ξ. ηy )dxdy. i. t). 1 I[ξ. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. η) and y(ξ. ξx . Cassel 361 / 454 Grids and Grid Generation Grid Generation 4) For unsteady problems additional terms are required in the governing equations due to movement of the grid in the physical domain (the computational grid (ξ. 3) All of the two-dimensional functionals above have been written in the form I[x. ξ. y. η. η). x. ξ = ξ(x. ηx . y) and η(x. y). yη )dξdη.e. i. y(ξ. 2) The grid x(ξ. η). it is generally preferable to deﬁne weight functions in the physical domain.e. Alternatively. y] = 1 2 1 0 0 1 F (ξ. W. η. y). η = η(x.e. y. i.

(9. Unsteady Diﬀusion Illustration Consider the one-dimensional. Unsteady Diﬀusion Illustration Exact Solution Numerical Solution Numerical Solution of the Eigenproblem Similarity Transformation QR Method to Obtain Eigenvalues and Eigenvectors Plane Rotations Arnoldi Method Hydrodynamic Stability Linearized Navier-Stokes Equations Local Normal Mode Analysis Numerical Solution of the Orr-Sommerfeld Equation Example: Plane-Poiseuille Flow MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 364 / 454 . 0) = f (x).Hydrodynamic Stability and the Eigenproblem 1-D. and the initial condition u(x. Cassel 363 / 454 Hydrodynamic Stability and the Eigenproblem 1-D. W.1) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. unsteady diﬀusion equation ∂u ∂2u = α 2.3) u( . t) = 0. W. Unsteady Diﬀusion Illustration Outline 9 Hydrodynamic Stability and the Eigenproblem 1-D. t) = 0. (9.2) 0≤x≤ . ∂t ∂x with the boundary conditions u(0. (9.

.7) The boundary condition u(0. (9. which requires that c1 = 0. t) = φ(x)ψ(t). t) = 0.5) is φ(x) = c1 cos(µx) + c2 sin(µx). Therefore. (9.4) Moving everything depending upon t to the left-hand-side and everything depending upon x to the right-hand-side.6) dt each of which are diﬀerential eigenproblems. . dt dx (9. so we consider the case where λ = −µ2 < 0. Substituting into equation (9. 3. (9. we must have φ( ) = 0.5) 2 dx dψ + αµ2 ψ = 0. αψ dt φ dx2 Because the x and t dependence can be separated in this way. Unsteady Diﬀusion Illustration Exact Solution Let us begin by using the method of separation of variables to obtain an exact solution for equation (9. Cassel 365 / 454 Hydrodynamic Stability and the Eigenproblem 1-D. W. µn = nπ .Hydrodynamic Stability and the Eigenproblem 1-D. say λ. W. Cassel 366 / 454 . n = 1. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. which requires that sin(µn ) = 0. From the boundary condition u( .1). this becomes 1 d2 φ 1 dψ = = λ = −µ2 . the partial diﬀerential equation (9. both sides of the equation must be equal to a constant. . We separate the variables according to u(x. 2.1) is converted into two ordinary diﬀerential equations d2 φ + µ2 φ = 0. Unsteady Diﬀusion Illustration trivial solution for the boundary conditions given. t) = 0 requires that φ(0) = 0. The solution to equation (9. . Therefore.1) gives φ d2 φ dψ = αψ 2 . Positive and zero λ produce only the MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

cn = f (x). Therefore. Thus.1)–(9.8) n = 1. 3.Hydrodynamic Stability and the Eigenproblem 1-D. Then the eigenfunctions are ∞ ∞ ∞ 2 nπ x . φn (x) . 2.9) u(x. .10) with (9. n=1 Taking the inner product of φm (x) with both sides. W. t) = n=1 un (x. (9. . .3) is given by equation (9. the only non-vanishing term (due to orthogonality of the eigenfunctions φn (x)) occurs when m = n. Unsteady Diﬀusion Illustration or ∞ cn φn (x) = f (x). Cassel 368 / 454 . we have the spatial eigenfunction φn (x) = sin The solution to (9. . W. 3. 2. Unsteady Diﬀusion Illustration and the eigenvalues are λn = −µ2 n =− n2 π 2 2 . n = 1. 2.11) which are the Fourier sine coeﬃcients of f (x). (9. . Letting c2 = 1. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.10) The constants cn are determined by application of the initial condition (9.6) is ψn (t) = cn e−αµn t . . φn (x) 2 = 2 ||φn (x)|| f (x) sin 0 nπ x dx. . . (9. Cassel 367 / 454 Hydrodynamic Stability and the Eigenproblem 1-D. for which ∞ nπ u(x. the exact solution to (9. . n=1 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. t) = n=1 φn (x)ψn (t) = n=1 cn exp − αn2 π 2 2 t sin nπ x . n = 1. (9. 3. 0) = cn sin x = f (x).11).3). . giving cn ||φn (x)||2 = f (x).

. .5). .2) numerically. See Mathematica notebook “1Ddiﬀ. . Cassel 370 / 454 . Unsteady Diﬀusion Illustration ¯ This is an algebraic eigenproblem for the eigenvalues λ = (∆x)2 λ and the eigenvectors φ.5). . for i = 2. which are discrete approximations of the continuous eigenfunctions (9. . Because A is tridiagonal with constants along each diagonal.nb” for a comparison of the eigenvalues obtained numerically as described here versus the exact eigenvalues from the previous section. In general.12) (φ1 = 0. . . . . . . . this is not the case. . I −2 1 1 −2 0 1 . .8). . Using central diﬀerences. . W. in matrix form we have φ2 φ2 0 ··· 0 0 φ3 1 ··· 0 0 φ3 φ4 −2 · · · 0 0 φ4 2 . W. (9. the diﬀerential equation becomes φi+1 − 2φi + φi−1 = λφi . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 0 0 0 0 or ¯ Aφ = λφ.Hydrodynamic Stability and the Eigenproblem 1-D. . φI−1 0 · · · −2 1 φI−1 0 ··· 1 −2 φI φI MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Unsteady Diﬀusion Illustration Numerical Solution Now let us consider solving the diﬀerential eigenproblem (9. . . of course. . with boundary conditions (9. Cassel 369 / 454 Hydrodynamic Stability and the Eigenproblem 1-D.. = (∆x) λ . . . and the eigenvalues (and eigenvectors) must be determined numerically for a large matrix A. . φI+1 = 0). (∆x)2 Thus. . we have a closed form expression for the eigenvalues (see section 3.

Cassel 371 / 454 Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem The standard method for numerically determining the eigenvalues and eigenvectors of a matrix is based on QR decomposition. which entails performing a series of similarity transformations. W. W. Cassel 372 / 454 . respectively.Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem Outline 9 Hydrodynamic Stability and the Eigenproblem 1-D. This is the approach used by the built-in Mathematica and Matlab functions Eigenvalues[]/ Eigenvectors[] and eig(). Unsteady Diﬀusion Illustration Exact Solution Numerical Solution Numerical Solution of the Eigenproblem Similarity Transformation QR Method to Obtain Eigenvalues and Eigenvectors Plane Rotations Arnoldi Method Hydrodynamic Stability Linearized Navier-Stokes Equations Local Normal Mode Analysis Numerical Solution of the Orr-Sommerfeld Equation Example: Plane-Poiseuille Flow MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

we call equation (9. Therefore. Cassel (9. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.13) and (9. if A is symmetric. for A real and symmetric.14) preserves the eigenvalues and symmetry of A.15) have the same eigenvalues λ. (9. BQT x = λQT x. A is symmetric such that A = AT . (9. observe that BT = [QT AQ]T = [Q]T [A]T [QT ]T = QT AQ = B.Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem Similarity Transformation Consider the eigenproblem Ax = λx. (9. W. B is symmetric as well when Q is orthogonal. The eigenvectors of A. Let us consider the transformation B = QT AQ. In summary. i. This is the case because Q is orthogonal.16) If in addition to being real and square.14).e. W.15) 373 / 454 Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem which is an eigenproblem for the matrix B deﬁned by the transformation (9. Postmultiplying both sides by QT x leads to BQT x = QT AQQT x.16).14) a similarity transformation because A and B = QT AQ have the same eigenvalues. x. and B. Cassel 374 / 454 . and the eigenvectors are related by (9. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. square matrix. = QT Ax. y. i. Note that the eigenproblems (9.e. Suppose that Q is an orthogonal matrix such that Q−1 = QT . are related by y = QT x (x = Qy) . therefore. this can be written as By = λy.14) Deﬁning y = QT x.13) where A is a real. the similarity transformation (9. = QT λx.

Not only do they all have the same eigenvalues. taking R0 Q0 is equivalent to the similarity transformation (9. . 0 (9.19). .19) which is a similarity transformation. A2 . . k = 0. . (9. 2. and R is an upper (“right”) triangular matrix. . R0 = R. 0 0 Therefore.18) 375 / 454 Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem Because Q0 is orthogonal. . the QR decomposition of the given matrix is A 0 = Q0 R0 . Q0 = Q. Cassel (9.18) we have Ak+1 = Rk Qk . W. premultiplying equation (9. Cassel 376 / 454 . the similarity transformations maintain the same structure as A.18) we may determine A1 from A 1 = QT A 0 Q0 . e. It can be shown (not easily) that the sequence of similar matrices A0 . A QR decomposition exists such that A = QR. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 1. i. A2 . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. and A1 has the same eigenvalues as A0 = A. Consider A real and symmetric. A = AT . we now turn our attention to the iterative QR method for ﬁnding the eigenvalues and eigenvectors of a matrix A. Letting A0 = A. Let us form the product (note order) A 1 = R0 Q0 . generalizing equation (9.e. are similar to A0 = A.g. substituting for R0 in (9. Thus. . . W. which requires such transformations. A1 .20) where all A1 . That is. Ak . . where Q is an orthogonal matrix. tridiagonal. . .17) by Q−1 = QT gives 0 0 QT A0 = QT Q0 R0 = R0 . .Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem QR Method to Obtain Eigenvalues and Eigenvectors Having determined the properties of similarity transformations.17) (9. .

··· 1 0 0 c 1 . . W.. Cassel 378 / 454 ··· . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. In either case. W. 0 s 0 . . Pqp = −s. Computational Fluid Dynamics . . P= . where c = cos φ and s = sin φ. the eigenvalues of A (and A1 .) are on the main diagonal in increasing order by absolute magnitude.e. respectively.. Ppq = s. But how do we determine the Q and R matrices for each iteration? ⇒ Plane rotations. converges. . A2 . .Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem gets progressively closer. 0 −s 0 MMAE 517 (Illinois Institute of Technology) . 1 .. . That is. . 1 c 2010 K. Cassel 377 / 454 Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem Plane Rotations Consider the n × n transformation matrix P comprised of the identity matrix with only four elements changed in the pth and q th rows and columns according to Ppp = Pqq = c. i. . . 1 c 0 0 1 . to a diagonal or upper triangular matrix if A is symmetric or non-symmetric.

P rotates the vector x through an angle φ in the xp xq -plane. . q = 2 y1 = cx1 + sx2 . where xT = [x1 x2 · · · xp · · · xq · · · xn ]. Note that y = PT x rotates the vector x through an angle −φ.23) This transformation rotates the vector x through an angle φ to obtain y. i. yq . .22) (9. y2 = −sx1 + cx2 . Then x1 x2 . . W.21) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. For example. . or y1 cos φ = y2 − sin φ sin φ cos φ x1 . . Thus. Cassel 379 / 454 Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem yq = −sxp + cxq . p = 1. Cassel 380 / 454 . yp y = Px = . xn where the only two elements that are altered are yp = cxp + sxq . consider the case for n = 2.21). in the general n-D case (9. .e. (9. W.Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem Observe the eﬀect of transforming a n-D vector x according to the tranformation y = Px. x2 (9. . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

R is given by R = Pm · · · P2 P1 A. banded) matrices. i. (9. Householder transformation (reﬂection) – eﬃcient for dense matrices. Thus.25) See Mathematica notebook “QRmethod. the orthogonal matrix Q is then obtained from QT = Pm · · · P2 P1 . by taking Y = PX. Cassel 381 / 454 Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem We can imagine a series of Givens or Householder transformations that reduce the matrix A to a matrix that is upper triangular. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. a matrix. i.g.e. if m projections are required to produce an upper triangular matrix.nb” for an illustration of how QR decomposition is used in an iterative algorithm to obtain the eigenvalues of a matrix. We can generalize to rotate a set of vectors.e.22) and (9.23)). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 382 / 454 .g. e. e. structured (e.g.24) Because A = QR. PT = P−1 . 3 The angle φ may be chosen with one of several objectives in mind. Taking the transpose leads to Q = PT PT · · · PT . yp or yq (see equations (9. i. W. which is the R matrix in a QR decomposition. i) To zero all elements below (or to the right of) a speciﬁed element.Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem Notes: 1 2 The transformation matrix P is orthogonal. 1 2 m (9. yT = [y1 y2 · · · yj 0 · · · 0]. R = QT A. ii) To zero a single element. Givens transformation (rotation) – eﬃcient for sparse. W.e. For example.

→ This is done using a series of similarity transformations based on Householder rotations for dense matrices or Givens rotations for sparse matrices. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Numerical Recipes. Cassel 383 / 454 Hydrodynamic Stability and the Eigenproblem 5 Numerical Solution of the Eigenproblem The order of operations for the QR method per iteration are as follows: Dense matrix → O(n3 ) ⇒ Very expensive. W. for example. but the QR decompositions can be obtained two times faster than in the standard Givens transformation illustrated in “QRmethod.” Convergence of the iterative QR method may be accelerated using shifting (see. respectively. 4 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Thus. ii) Use iterative QR method to obtain eigenvalues of tridiagonal or Hessenberg matrix.Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem Notes: 1 The QR decomposition (9. Givens transformations are most eﬃcient for large. structured matrices. → Conﬁgure to only zero elements that are not already zero. Cassel 384 / 454 .25) is obtained from a series of plane (Givens or Householder) rotations. the most eﬃcient procedure is as follows: i) Transform A to a similar tridiagonal or Hessenberg form if A is symmetric or non-symmetric. 2 3 There is a “fast Givens transformation” for which the P matrices are not orthogonal. Hessenberg matrix → O(n2 ) Tridiagonal matrix → O(n). section 11.3).24) and (9. W.nb. sparse.

. 2 3 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Aq0 . using Gram-Schmidt. A2 q0 . W. W. we deﬁne the Krylov subspace by Kk (A. In addition.Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem Arnoldi Method The Arnoldi method has been developed to treat situations in which we only need a small number of eigenvalues of a large sparse matrix: 1 The iterative QR method described in the previous section is the general approach used to obtain the full spectrum of eigenvalues of a dense matrix. which has dimension k and is a subspace of Rn . q0 ).” ⇒ We would like an eﬃcient algorithm that determines a subset of the full sprectrum of eigenvalues (and possibly eigenvectors) of a sparse matrix. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. . The Arnoldi method is based on constructing an orthonormal basis. Given an arbitrary n-D vector q0 . where k n. and as we will see when we evaluate hydrodynamic stability. e. . . we often do not require the full spectrum of eigenvalues in stability problems as we only seek the “least stable mode. of the Krylov subspace Kk that can be used to project a general n × n matrix A onto the k-D Krylov subspace Kk (A. Cassel 386 / 454 .g. As we saw in the 1-D unsteady diﬀusion example. Cassel 385 / 454 Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem Suppose we seek the largest k eigenvalues (by magnitude) of the large sparse n × n matrix A. q0 ) = span q0 . Ak−1 q0 . we often seek the eigenvalues of large sparse matrices.

Normalize: q1 = q0 /||q0 ||. and we obtain the approximation of one additional eigenvalue. Cassel 387 / 454 Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem At each step i = 2. k: → An n × i orthonormal matrix Q is produced that forms an orthonormal basis for the Krylov subspace Ki (A. . Although the outcome of each step depends upon the starting Arnoldi vector q0 used. → The eigenvalues of H. Set Q = q1 . q0 ). . sometimes called the Ritz eigenvalues. Notes: 1 Because k n. Cassel 388 / 454 . 5 End Do MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Orthogonalize qi against q1 . the procedure converges to the correct eigenvalues of matrix A. Form the Hessenberg matrix H = QT AQ. Do i = 2. Determine the eigenvalues of H. . qi−1 .Hydrodynamic Stability and the Eigenproblem Numerical Solution of the Eigenproblem We form the orthonormal projection matrix Q using the following step-by-step (non-iterative) method that produces a Hessenberg matrix H whose eigenvalues approximate the largest k eigenvalues of A: 1 2 3 4 Specify starting Arnoldi vector q0 . we only require the determination of eigenvalues of Hessenberg matrices that or no larger than k × k as opposed to the original n × n matrix A. → Using the projection matrix Q. we transform A to produce an i × i Hessenberg matrix H (or tridiagonal for symmetric A). . Append qi to Q. W. The approximations of the eigenvalues improve as each step is incorporated. . . . q2 . . which is an orthogonal projection of A onto the Krylov subspace Ki . k i) ii) iii) iv) v) Multiply qi = Aqi−1 . W. 2 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. approximate the largest i eigenvalues of A.

the smaller k can be to obtain a good approximation of the largest k eigenvalues of A. it can be designed to determine the k eigenvalues with the largest real or imaginary part. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ARPACK has been implemented in Matlab via the eigs() function. As the Arnoldi method progresses. This is known as the implicitly restarted Arnoldi method and is based on the implicitly-shifted QR decomposition method. this is called the generalized minimal residual (GMRES) method.’ In addition. have all positive eigenvalues. A shift and invert approach can be incorporated to determine the k eigenvalues close to a speciﬁed part of the spectrum rather than that with the largest magnitude. Restarting also reduces storage requirements by keeping k small. The generalized eigenproblem will be encountered in hydrodynamic stability. it is desirable that the starting Arnoldi vector q0 be in (or ‘nearly’ in) the subspace spanned by the eigenvectors corresponding to the sought after eigenvalues. W.e.caam. ARPACK was developed at Rice University in the mid 1990’s. where one includes the option ‘Method → Arnoldi’ in the Eigenvalues[] function. and B is called the mass matrix. it has been implemented in Mathematica. For example. where the ‘s’ denotes ‘sparse. 8 9 Many have standardized on the Arnoldi method as implemented in ARPACK (http://www. Cassel 389 / 454 Hydrodynamic Stability and the Eigenproblem 7 Numerical Solution of the Eigenproblem The Arnoldi method may also be adapted to solve linear systems of equations.edu/software/ARPACK/). When applied to symmetric matrices. the Arnoldi method reduces to the Lanczos method. 4 5 6 When seeking a set of eigenvalues in a particular portion of the full spectrum. Application of Arnoldi’s method to the generalized eigenproblem requires that B be positive deﬁnite. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. The Arnoldi method can be designed to apply to the generalized eigenproblem Ax = λBx.Hydrodynamic Stability and the Eigenproblem 3 Numerical Solution of the Eigenproblem The more sparse the matrix A is. and subsequently it has been implemented as ARPACK++ for C++ . W. i.rice. Cassel 390 / 454 . we get better approximations of the desired eigenvectors that can then be used to form a more desirable starting vector. It also arises in structural design problems in which A is called the stiﬀness matrix. ﬁrst as a Fortran 77 library of subroutines.

Hydrodynamic Stability and the Eigenproblem

Numerical Solution of the Eigenproblem

The Arnoldi method is illustrated in more detail in the Mathematica notebook “Arnoldi.nb.” References: Arnoldi, W. (1951) Q. Appl. Math. 9, 17. Nayar, N. & Ortega, J. M. (1993) “Computation of Selected Eigenvalues of Generalized Eigenvalue Problems.” J. Comput. Phys. 108, pp. 8–14. Saad, Y. Iterative Methods for Sparse Linear Systems SIAM, Philadelphia (2003). Radke, R. A Matlab Implementation of the Implicitly Restarted Arnoldi Method for Solving Large-Scale Eigenvalue Problems, MS Thesis, Rice University (1996).

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

391 / 454

Hydrodynamic Stability and the Eigenproblem

Hydrodynamic Stability

Outline

9

**Hydrodynamic Stability and the Eigenproblem 1-D, Unsteady Diﬀusion Illustration
**

Exact Solution Numerical Solution

**Numerical Solution of the Eigenproblem
**

Similarity Transformation QR Method to Obtain Eigenvalues and Eigenvectors Plane Rotations Arnoldi Method

Hydrodynamic Stability

Linearized Navier-Stokes Equations Local Normal Mode Analysis Numerical Solution of the Orr-Sommerfeld Equation Example: Plane-Poiseuille Flow

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

392 / 454

Hydrodynamic Stability and the Eigenproblem

Hydrodynamic Stability

**Linearized Navier-Stokes Equations
**

Consider the nondimensional Navier-Stokes equations for 2-D, incompressible ﬂow ∂u ∂v + = 0, ∂x ∂y ∂u ∂u ∂p 1 ∂2u ∂2u ∂u +u +v =− + + 2 , ∂t ∂x ∂y ∂x Re ∂x2 ∂y ∂v ∂v ∂p 1 ∂2v ∂2v ∂v +u +v =− + + 2 . ∂t ∂x ∂y ∂y Re ∂x2 ∂y (9.26)

(9.27) (9.28)

We denote the solution to (9.26)–(9.28), i.e. the base ﬂow, by u0 (x, y, t), v0 (x, y, t) and p0 (x, y, t), and seek the behavior of small perturbations to this base ﬂow. ⇒ If the amplitude of the small perturbations grow, the ﬂow is hydrodynamically unstable.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

393 / 454

Hydrodynamic Stability and the Eigenproblem

Hydrodynamic Stability

**Two possibilities may be considered:
**

1

**Temporal analysis – amplitude of spatial perturbation (e.g. wavy wall) grows/decays with time.
**

⇒ Absolutely unstable/stable.

2

**Spatial analysis – amplitude of temporal perturbation (e.g. vibrating ribbon) grows/decays in space.
**

⇒ Convectively unstable/stable.

For inﬁnitesimally small perturbations ( 1), the ﬂow may be decomposed as follows u(x, y, t) = u0 (x, y, t) + u(x, y, t), ˆ v(x, y, t) = v0 (x, y, t) + v (x, y, t), ˆ p(x, y, t) = p0 (x, y, t) + p(x, y, t). ˆ (9.29)

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

394 / 454

Hydrodynamic Stability and the Eigenproblem

Hydrodynamic Stability

Substituting into (9.26)–(9.28) gives ∂u0 ∂ u ∂v0 ˆ ∂ˆ v + + + = 0, ∂x ∂x ∂y ∂y ∂u0 ∂u ˆ ∂u0 ∂u ˆ ∂u0 ∂u ˆ + + (u0 + u) ˆ + + (v0 + v ) ˆ + ∂t ∂t ∂x ∂x ∂y ∂y 2 2 2 2 ∂p0 ∂p ˆ 1 ∂ u0 ˆ ˆ ∂ u ∂ u0 ∂ u − + , + + + =− ∂x ∂x Re ∂x2 ∂x2 ∂y 2 ∂y 2 ∂ˆ v ∂v0 ∂ˆ v ∂v0 ∂ˆ v ∂v0 + + (u0 + u) ˆ + + (v0 + v ) ˆ + ∂t ∂t ∂x ∂x ∂y ∂y ∂p0 ∂p ˆ 1 ∂ 2 v0 ∂2v ˆ ∂ 2 v0 ∂2v ˆ =− − + + + + . ∂y ∂y Re ∂x2 ∂x2 ∂y 2 ∂y 2 As expected, the O(1) terms are simply the Navier-Stokes equations (9.26)–(9.28) for the base ﬂow u0 , v0 and p0 .

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

395 / 454

Hydrodynamic Stability and the Eigenproblem

Hydrodynamic Stability

The O( ) terms for the disturbance ﬂow are ∂ u ∂ˆ ˆ v + = 0, ∂x ∂y ∂u ˆ ∂u ˆ ∂ u ∂u0 ˆ ∂u0 ∂p ˆ 1 ∂2u ∂2u ˆ ˆ + u0 + v0 + u+ ˆ v=− ˆ + + 2 , ∂t ∂x ∂y ∂x ∂y ∂x Re ∂x2 ∂y ∂ˆ v ∂ˆ v ∂ˆ ∂v0 v ∂v0 ∂p ˆ 1 ∂2v ˆ ∂2v ˆ + u0 + v0 + u+ ˆ v=− ˆ + + 2 . 2 ∂t ∂x ∂y ∂x ∂y ∂y Re ∂x ∂y Because is small, we neglect O( 2 ) terms. Thus, the evolution of the disturbances are governed by the linearized Navier-Stokes (LNS) equations (9.30)–(9.32), where the base ﬂow is known. ⇒ Linear Stability Theory (9.30)

(9.31) (9.32)

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

396 / 454

Hydrodynamic Stability and the Eigenproblem

Hydrodynamic Stability

In principle, we could impose a perturbation u, v , p at any time ti and track its ˆ ˆ ˆ evolution in time and space to determine if the ﬂow is stable to the imposed perturbation. To fully characterize the stability of the base ﬂow, however, would require many calculations of the LNS equations with diﬀerent perturbation “shapes” imposed at diﬀerent times. We can formulate a more manageable stability problem by doing one or both of the following:

1 2

Consider simpliﬁed base ﬂows. Impose “well-behaved” perturbations.

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

397 / 454

Hydrodynamic Stability and the Eigenproblem

Hydrodynamic Stability

**Local Normal Mode Analysis
**

Classical linear stability analysis takes advantage of both simpliﬁcations mentioned above:

1

Base ﬂow:

i) Steady ⇒ ii) Parallel (e.g. Poiseuille ﬂow) ∂u0 ∂v0 = = 0. ∂t ∂t (9.33)

MMAE 517 (Illinois Institute of Technology)

Computational Fluid Dynamics

c 2010 K. W. Cassel

398 / 454

p of the form (temporal ˆ ˆ ˆ analysis): u(x. = Re [u1 (y)eαci t {cos[α(x − cr t)] + i sin[α(x − cr t)]}] . p0 = p0 (x). W. normal mode. v . Cassel 399 / 454 Hydrodynamic Stability and the Eigenproblem 2 Hydrodynamic Stability Consider the disturbances. e. y. u(x.35) (or add complex conjugate). ⇒ For a given mode α. which is real. y. u(x.35) Notes: 1 It is understood that we take the real parts of (9. Cassel 400 / 454 . i. ˆ p(x. von Neumann numerical stability analysis). y. t) = v1 (y)ei(αx−αct) . If ci > 0. ˆ v (x. (9. (9. 2 v0 = 0.32) are linear. y. ˆ where α is the wavenumber.g.30)–(9.Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability ⇒ u0 = u0 (y). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. t) ˆ = Re u1 (y)ei(αx−αct) . and c = cr + ici is the complex wavespeed. W. y. t) = u1 (y)ei(αx−αct) . the amplitude of the perturbation grows unbounded as t → ∞ with growth rate αci . c = cr + ici = Re u1 (y)eαci t eαi(x−cr t) .e. 3 Because equations (9.34) Perturbations – we impose normal modes for u. t) = p1 (y)ei(αx−αct) . each normal mode with wavenumber α may be considered independently of one another (cf. Note that the wavelength of the disturbance is proportional to 1/α. t) = u1 (y)eαci t cos[α(x − cr t)] ˆ ⇒ Sine wave with wavenumber α and phase velocity cr . we are looking for the eigenvalue (wavespeed) with the fastest growth rate.

37) ∂x ∂y ∂u ˆ ∂ u ∂u0 ˆ ∂p ˆ 1 ∂2u ∂2u ˆ ˆ + u0 + v=− ˆ + + 2 . α is complex and c is real. ∂t ∂x ∂y Re ∂x2 ∂y (9. For the temporal analysis considered here.39) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. parallel base ﬂow (9.38) (9. W.33) and (9.36) where Rep0 (x) is a constant for Poiseuille ﬂow.28) reduces to (from equation (9. the parallel ﬂow assumption can be justiﬁed on formal grounds if the wavelength is such that 1/α L. is considered at a time due to the parallel-ﬂow assumption. where L is a typical streamwise length scale in the ﬂow.30)–(9. ∂t ∂x ∂y ∂x Re ∂x2 ∂y ∂ˆ v ∂ˆ v ∂p ˆ 1 ∂2v ˆ ∂2v ˆ + u0 =− + + 2 . i.26)–(9. W. In some cases. For a spatial analysis. The disturbance equations (9.27)) d2 u0 ∂p0 . α is real and c is complex. Cassel 401 / 454 Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability For steady.34). the Navier-Stokes equations (9.e. = Re dy 2 ∂x (9. (9.34).32) become v ∂ u ∂ˆ ˆ + = 0. 5 6 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.Hydrodynamic Stability and the Eigenproblem 4 Hydrodynamic Stability This is regarded as a “local” analysis because the stability of only one velocity proﬁle (9. Cassel 402 / 454 . at a single streamwise location.

i.41) results in −(u0 − c)v1 + u0 v1 = −αip1 − 1 1 (v1 − α2 v1 ).43) for p1 (y). For inviscid ﬂow. which is a local analysis. the disturbance velocities v1 (y) are the eigenfunctions. W. viscous ﬂow perturbed by inﬁnitesimally small normal modes. and wavenumber α. the Orr-Sommerfeld equation is a diﬀerential eigenproblem of the form L1 v1 = cL2 v1 . parallel. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 403 / 454 1 1 (v − 2α2 v1 + α4 v1 ). αi Re 1 (9. diﬀerentiating and substituting into equation (9. The Orr-Sommerfeld equation applies for steady. Re where primes denote diﬀerentiation with respect to y.43) leaving equations (9.39) leads to αiu1 + v1 = 0.44) Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability Notes: 1 For a given base ﬂow u0 (y). as Re → ∞.37)–(9.42) leads to (u0 − c)(v1 − α2 v1 ) − u0 v1 = which is the Orr-Sommerfeld equation. Solving equation (9.42) and (9.40) (9.40) for u1 and substituting into equation (9. and L1 and L2 are diﬀerential operators. Reynolds number Re. where the wavespeeds c are the (complex) eigenvalues.Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability Substitution of the normal modes (9. αi(u0 − c)u1 + u0 v1 = −αip1 + αi(u0 − c)v1 = −p1 + 1 (u1 − α2 u1 ). Solving equation (9. Re (9.43) for v1 (y) and p1 (y).42) 1 (v1 − α2 v1 ).41) (9. αi Re (9.e. W. the Orr-Sommerfeld equation reduces to the Rayleigh equation (u0 − c)(v1 − α2 v1 ) − u0 v1 = 0.35) into the disturbance equations (9. Cassel 404 / 454 . 2 3 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

35). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. y)e−ict . y)e−ict . ˆ v (x. We seek a corresponding discrete. Re)v = cN(α)v. W. y.e. Cassel 406 / 454 . Cassel 405 / 454 Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability Numerical Solution of the Orr-Sommerfeld Equation Recall that the continuous diﬀerential eigenproblem (9. (9. (9. p0 = p0 (x.e. y). i. t) = v1 (x. y).46) 2αi . and the perturbations are of the form u(x.44). t) = p1 (x. i. y)e−ict . ˆ p(x. y. generalized eigenproblem of the form M(α. W. Let us rewrite the Orr-Sommerfeld equation in the form i v αRe where P (yj ) = u0 (yj ) − + Pj v + Qj v = c v − α2 v .45) where we have dropped the subscript on v. is of the form L1 v1 = cL2 v1 . algebraic. a signiﬁcantly more involved global stability analysis is required in which the base ﬂow is 2-D. the Orr-Sommerfeld equation. y). i. y.Hydrodynamic Stability and the Eigenproblem 4 Hydrodynamic Stability For non-parallel ﬂows. t) = u1 (x. Re MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. v0 = v0 (x.e. Re α3 i Q(yj ) = − α2 u0 (yj ) − u0 (yj ). u0 = u0 (x. ˆ in place of equation (9.

For solid surfaces at y = a. we have 0 ¯ v1 0 ¯ ¯ b & b & Cv0 + B2& + A2 v2 + B2 v3 + Cv4 = c B& + Av2 + Bv3 . . b. W. we take d2 v vj+1 − 2vj + vj−1 = + O(∆y 2 ). . .Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability To discretize equation (9.48) Because v is known at y = a. αRe i C = . . J. αRe ¯ A = −(∆y)2 2 + α2 (∆y)2 . b.46) and collecting terms leads to the diﬀerence equation ¯ ¯ ¯ [Cvj−2 + Bj vj−1 + Aj vj + Bj vj+1 + Cvj+2 ] = c Bvj−1 + Avj + Bvj+1 . (9. 4 4 dy (∆y) Substituting these approximations into equation (9. Cassel (9. Computational Fluid Dynamics c 2010 K. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.47) at j = 2.e. j = 2. Aj = αRe 4i Bj = − + (∆y)2 Pj . we set v = v = 0. b. Substituting into the diﬀerence equation for j = 2 results in ¯ ¯ [(C + A2 )v2 + B2 v3 + Cv4 ] = c Av2 + Bv3 . Applying equation (9. v1 = vJ+1 = 0. at y = a. Cassel 407 / 454 Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability Because the Orr-Sommerfeld equation is 4th -order. (9. ¯ B MMAE 517 (Illinois Institute of Technology) = (∆y)2 .46) using central diﬀerences. we need two boundary conditions at each boundary. the unknowns are vj . i. W. v1 and from v = 0 at y = a (j = 1) v2 − v0 =0 2∆y ⇒ v 0 = v2 .47) where 6i + (∆y)2 (∆y)2 Qj − 2Pj . 2 2 dy (∆y) d4 v vj+2 − 4vj+1 + 6vj − 4vj−1 + vj−2 = + O(∆y 2 ).49) 408 / 454 .

The (large) generalized eigenproblem (9. W.e. .45) must be solved to obtain the complex wavespeeds c. . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. . we have v1 = vJ+1 = 0. . . and the discretized eigenfunctions v(y) for a given α and Re. 0 0 ··· ··· ··· . . M is pentadiagonal. . and N is tridiagonal. . . .Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability Similarly. . . . . Notes: 1 The J − 1 eigenvalues obtained approximate the inﬁnity of eigenvalues of the continuous diﬀerential eigenproblem (9.50) Also for j = 3. ¯ B 0 0 0 0 . the matrices in the algebraic form of the eigenproblem (9. . Cassel 410 / 454 . . . ··· ··· 0 0 0 .45) are C + A2 B 2 C 0 0 ··· 0 0 0 0 B3 A3 B 3 C 0 · · · 0 0 0 0 C B4 A4 B4 C · · · 0 0 0 0 M(α. . . Re) = . 0 0 0 0 0 · · · C BJ−1 AJ−1 BJ−1 0 0 0 0 0 ··· 0 C BJ C + AJ ¯ A ¯ B 0 N(α) = . . . J − 1.. Cassel 409 / 454 Computational Fluid Dynamics Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability and the eigenvector is vT = [v2 v3 · · · vJ ]. the Orr-Sommerfeld equation. i. . . . 0 0 0 ¯ B ¯ A . . Thus. . . . . 0 0 MMAE 517 (Illinois Institute of Technology) ¯ B ¯ A ¯ B . . . . . 0 0 0 0 ¯ B .e. . ¯ A ¯ B 0 0 0 . for j = J [CvJ−2 + BJ vJ−1 + (C + AJ )vJ ] = c [BvJ−1 + AvJ ] . . . ¯ B ¯ A c 2010 K. . (9. . . Therefore. .44). . the eigenvalues. i.. W. . . . .

W. is given by αmax(ci ).Hydrodynamic Stability and the Eigenproblem 2 Hydrodynamic Stability The least stable mode. that with the fastest growth rate αci . Cassel 411 / 454 Hydrodynamic Stability and the Eigenproblem 3 Hydrodynamic Stability A marginal stability curve may be obtained by determining max(ci ) for a range of Re and α and plotting the max(ci ) = 0 contour: MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.e. i. Cassel 412 / 454 . W.

” MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. → This approach avoided the need to ﬁnd the eigenvalues of large matrices in the days when computers were not capable of such large calculations. N−1 M is a full. ⇒ This would require use of a general approach. That is. This requires inverting a large matrix. ﬁnd the eigenvalues from N−1 M − cI = 0. W. such as the iterative QR method. traditionally the shooting method for IVPs has been used. dense matrix. W. dense matrix. this is like “using a hammer to drive a screw.45) to a regular eigenproblem by multiplying both sides by the inverse of N.Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability Methods of Solution: 1 Convert the generalized eigenproblem (9. and although M and N are typically sparse and banded. → In addition. to determine the eigenvalues of a large. → However. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 413 / 454 Hydrodynamic Stability and the Eigenproblem 2 Hydrodynamic Stability In order to avoid solving the large matrix problem that results from the BVP. Cassel 414 / 454 . it allowed for use of well-developed algorithms for IVPs.

W. i. Such a ﬂow is parallel. (9. we only need the least stable mode. in stability contexts such as this.e.36). Note that N must be positive deﬁnite for use in the Arnoldi method. Recall that the least stable mode is that with the largest imaginary part. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. The solution is a parabolic velocity proﬁle given by u0 (y) = y(2 − y). sparse matrices. the base ﬂow is a solution of equation (9. → Currently. That is. not the entire spectrum of eigenvalues. pressure-driven ﬂow in a channel. the state-of-the-art in such situations is the Arnoldi method discussed in the last section. 0 ≤ y ≤ 2. for the least stable mode.51) Note that the base ﬂow is independent of the Reynolds number.Hydrodynamic Stability and the Eigenproblem 3 Hydrodynamic Stability Solve the generalized eigenproblem Mv = cNv. therefore. In addition to the fact that the matrices are sparse. Cassel 416 / 454 . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. let us consider stability of Plane-Poiseuille ﬂow. where M and N are large. this requires us to take the negatives of the matrices M and N as deﬁned above. it must have all positive eigenvalues. In our case. Cassel 415 / 454 Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability Example: Plane-Poiseuille Flow As an illustration.

95 0.e.Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability See the Mathematica notebook “OS Psvll. This shows the curve in α-Re parameter space for which max(ci ) = 0 delineating the regions of parameter space in which the ﬂow is stable and unstable to normal-mode perturbations. i. for a given wavenumber α and Reynolds number Re in order to evaluate stability.nb” for a solution of the Orr-Sommerfeld equation using the approach outlined in the previous section. W.e. the critical Reynolds number is approximately Rec = 5. we can plot the marginal stability curve for plane-Poiseuille ﬂow. W. Cassel 417 / 454 Hydrodynamic Stability and the Eigenproblem Hydrodynamic Stability By performing a large number of such calculations for a range of wavenumbers and Reynolds numbers. max(ci ) > 0. → This notebook calculates the complex wavespeeds. the eigenvalues.00 0. The growth rate of the instability is then α max(ci ).05 1. Cassel 418 / 454 .90 0. 800. i. → Recall that a ﬂow is unstable if the imaginary part of one of the discrete eigenvalues is positive. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. 1. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.85 0.80 5000 6000 7000 8000 9000 10 000 Thus.10 1.

and that the small-scale features are similar for certain classes of turbulent ﬂows. W. Thus. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. ⇒ Very ﬁne grids are required.Numerical Modeling of Turbulent Flows Introduction Outline 10 Numerical Modeling of Turbulent Flows Introduction Direct Numerical Simulation Large-Eddy Simulation Reynolds Averaged Navier-Stokes MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. turbulent ﬂows are very diﬃcult to model numerically. There are three basic approaches (given in increasing degree of approximation): 1) Direct Numerical Simulation (DNS): Navier-Stokes equations are solved for all scales. They are inherently three-dimensional due to velocity ﬂuctuations (even if the mean ﬂow is two-dimensional). They involve a wide range of temporal and spatial scales. 2) Large Eddy Simulation (LES): Recognize that only the large-scale motions depend on the macroscopic features of the particular ﬂow. Cassel 420 / 454 . Cassel 419 / 454 Numerical Modeling of Turbulent Flows Introduction Turbulent ﬂows are characterized by the following: They are highly unsteady ⇒ Seemingly random ﬂuctuations of velocity about a mean. ⇒ Solve numerically for large scales and model small scales.

Summarizing: DNS LES ⇒ no turbulence modeled. W. small-scale. ⇒ some. RANS ⇒ all turbulence modeled. W. turbulence modeled. i. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Requires turbulence models for closure of the governing equations.Numerical Modeling of Turbulent Flows Introduction 3) Reynolds Averaged Navier-Stokes (RANS): Solve numerically the time averaged Navier-Stokes equations for the mean ﬂow. Cassel 422 / 454 .e. Cassel 421 / 454 Numerical Modeling of Turbulent Flows Direct Numerical Simulation Outline 10 Numerical Modeling of Turbulent Flows Introduction Direct Numerical Simulation Large-Eddy Simulation Reynolds Averaged Navier-Stokes MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

W. Cassel 423 / 454 Numerical Modeling of Turbulent Flows Direct Numerical Simulation Note that as ReL ↑ ⇒ lK ↓ ⇒ N ↑. lK where N is the number of grid points in each direction. 2) DNS produces very detailed information about the ﬂow (see DNS ﬁgures): ⇒ Can be used to evaluate turbulence statistics.). ”turbulence-in-a-box” simulations. DNS is only practical for small to moderate Re.e. e. ⇒ Used to develop turbulence models for similar ﬂows. i. W.g. ⇒ Gives qualitative knowledge of ﬂow (coherent structures. Cassel 424 / 454 . Re is the macroscopic Reynolds number. e. Notes: 1) DNS is only possible for moderate Re ﬂows in simple geometries (with current computational resources). This gives rise to the early. therefore..g. 1990s..01Re. to compare with experiments. Consider the following deﬁnitions: = rate of dissipation of turbulent kinetic energy lK L ReL = ν3 1/4 = Kolmogorov scale (size of the smallest turbulent eddies) = length scale of large eddies = Reynolds number based on magnitude of velocity ﬂuctuations and L. 3) Spectral methods are popular for DNS because highly accurate solutions can be obtained. L 3/4 N∼ ∼ ReL . therefore. ReL ≈ 0. The grid size must be smaller than lK in order to resolve all of the scales. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Here.Numerical Modeling of Turbulent Flows Direct Numerical Simulation In DNS all scales must be resolved. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. etc.

but not as small as lK (cf. smaller than ∆. t). ¯ MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 426 / 454 .e.1) to Navier-Stokes equations with ui (xi .e.Numerical Modeling of Turbulent Flows Large-Eddy Simulation Outline 10 Numerical Modeling of Turbulent Flows Introduction Direct Numerical Simulation Large-Eddy Simulation Reynolds Averaged Navier-Stokes MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. W. t) = ui (xi . (10. ¯ p(xi . t). That is. DNS). t) + p (xi . i. t) = p(xi . x ) is the ﬁlter kernel having an associated length scale ∆: Eddies > ∆ ⇒ large eddies (computed). t) + ui (xi .1) where G(x. lK ≤ modeled < ∆ < computed ≤ L Numerical grid: lK < ∆xi < ∆. Apply ﬁlter (10. Eddies < ∆ ⇒ small turbulent eddies (modeled). i. local average of complete ﬁelds: ui (xi ) = ¯ G(x. x )ui (x )dx . Cassel 425 / 454 Numerical Modeling of Turbulent Flows Large-Eddy Simulation In LES we ﬁlter the velocity and pressure ﬁelds so they only contain large-scale components.

and |S| = (Sij Sij )1/2 . CS is the model parameter. which must be speciﬁed. and ui (xi .2) 2 ui . we have a set of equations for large-scale quantities. the subgrid scale (SGS) model must specify τij as a function of the resolvable variables (¯i . and the remaining terms are τij = SGS Reynolds stress and must be modeled. ∂xi ∂ ui ¯ ∂ 1 ∂p ¯ + ui uj = − +ν ∂t ∂xj ρ ∂xi (10. i. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. and it provides for energy transfer between the u ¯ resolvable scales and the SGS. Cassel 428 / 454 . uj ).e.Numerical Modeling of Turbulent Flows Large-Eddy Simulation where ui (xi . ¯ ¯ ¯ Here. 3 = strain-rate for resolved ﬁeld (10. τij = where ¯ Sij µt 1 2 1 ¯ τkk δij + 2µt Sij . ¯ Thus. The ﬁltered Navier-Stokes equations are (in tensor notation) ∂ ui ¯ = 0. W.4) = ∂ ui ¯ ∂ uj ¯ + ∂xj ∂xi 2 ¯ = CS ρ∆2 |S|. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 427 / 454 Numerical Modeling of Turbulent Flows Large-Eddy Simulation The earliest and most common SGS model is the Smagorinsky model. but ui uj = ui uj + ui uj + ui uj + ui uj . Therefore. which is an eddy viscosity model (eﬀective viscosity due to small-scale turbulent motion). t) is the resolvable scale velocity (computed). Thus. t) is the ¯ subgrid scale (SGS) velocity. the SGS Reynolds stress τij increases transport and dissipation.3) The ﬁrst term on the right-hand-side is computed from the resolved scales. ¯ ¯ ¯ ¯ (10. they contain ui and uj .

200 and grid: 240 × 128 × 128) and combustor ﬂows (see ﬁgures) and note the level of detail obtained for the ﬂow. it is computed from the resolvable ﬂow ﬁeld. 2) The Smagorinsky model does not work well near boundaries (eddy viscosity is much smaller and ﬂow is more anisotropic). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. which accounts for energy transferred from small scales to large scales. Automatically adjusts SGS parameter for anisotropic ﬂow and ﬂow near walls. Cassel 430 / 454 . 3) Points (1) and (2) can be improved upon with dynamic SGS models: Allow model parameter CS to vary with space and time. W. Allows for backscatter (µt < 0). i. Active area of ongoing research. the ﬂow over a wall mounted block (Re = 3. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. therefore.e. W. it can be applied to more complex ﬂows. Cassel 429 / 454 Numerical Modeling of Turbulent Flows Large-Eddy Simulation 4) LES is more economical computationally than DNS.Numerical Modeling of Turbulent Flows Large-Eddy Simulation Notes: 1) The Smagorinsky model only accounts for energy transfer from large to small scales. for example. Consider.

¯ (10. W. W. 0 (10. t). To obtain the mean ﬂow. Cassel 432 / 454 . Unsteady mean ﬂow ⇒ ensemble average. T u(xi .Numerical Modeling of Turbulent Flows Reynolds Averaged Navier-Stokes Outline 10 Numerical Modeling of Turbulent Flows Introduction Direct Numerical Simulation Large-Eddy Simulation Reynolds Averaged Navier-Stokes MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. and u (xi . t)dt. t) are the turbulent ﬂuctuations (not the ¯ same as u in LES).6) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. t) = u(xi ) + u (xi .5) where u(xi ) is the mean ﬂow. we use Reynolds averaging: Steady mean ﬂow ⇒ time average Navier-Stokes equations 1 u(xi ) = lim ¯ T →∞ T where T = averaging interval. Cassel 431 / 454 Numerical Modeling of Turbulent Flows Reynolds Averaged Navier-Stokes In RANS we compute only the mean ﬂow and model all of the turbulence: u(xi .

7) where ρu u . respectively. 2 i i ∂ui ∂xj ∂ui ∂xj = rate of dissipation of turbulent energy. Cassel 434 / 454 . we have a closure problem.9) The terms on the left-hand-side represent the transport of k and . p. = νT Here. ∂xj 2 (10. but there are many others.Numerical Modeling of Turbulent Flows Reynolds Averaged Navier-Stokes For incompressible ﬂow. which are derived from Navier-Stokes. ρv v are the Reynolds stresses. the Reynolds averaged Navier-Stokes equations are v ∂ u ∂¯ ¯ + = 0. of k and . (10. and the ﬁrst. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. k − Turbulence Model: The k − model is the most common turbulence model used in applications. second and third terms on the right-hand-side represent diﬀusion. k and are determined from a solution of the following coupled equations. ∂x ∂y ρ ρ ∂u ¯ ∂u ¯ ∂u ¯ ∂p ¯ ∂ ∂u ¯ +u ¯ +v ¯ =− + µ − ρu u ∂t ∂x ∂y ∂x ∂x ∂x ∂¯ v ∂¯ v ∂¯ v ∂p ¯ ∂ ∂¯ v +u ¯ +v ¯ =− + µ − ρu v ∂t ∂x ∂y ∂y ∂x ∂x + + ∂ ∂u ¯ µ − ρu v ∂y ∂y ∂¯ v ∂ µ − ρv v ∂y ∂y . MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.8) ρ ∂ D = Dt ∂xj C 1 µT k ∂ui ∂uj + ∂xj ∂xi ∂ui ρC 2 − ∂xj k . (10. u ¯ ¯ Closure is achieved by relating the Reynolds stresses to the mean ﬂow quantities through a turbulence model. ρ Dk ∂ = Dt ∂xj µT ∂ σ ∂xj µT ∂k σk ∂xj + + µT ∂ui ∂uj + ∂xj ∂xi ∂ui −ρ . v . W. production and dissipation. ρu v . Equations (10. u . v ). therefore.7) are three equations for ﬁve unkowns (¯. W. Cassel 433 / 454 Numerical Modeling of Turbulent Flows Reynolds Averaged Navier-Stokes Deﬁne: k = 1 u u = turbulent kinetic energy. .

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. C 1 .10) The eddy viscosity µT is used to relate the Reynolds stresses to the mean ﬂow quantities through −ρui uj = µT Notes: 1) Equations (10. it is good for engineering applications. wall functions that are usually based on the log-law are used for turbulent boundary layers. Cassel 436 / 454 . by (10. Note the signiﬁcant diﬀerences between the results obtained with the two models used. but RANS requires signiﬁcantly more modest computational resources as compared to DNS and LES. which must be determined empirically. W. and is used by most commercial CFD codes. both in terms of the locations and magnitudes of turbulent kinetic energy. W. Cµ . Cassel 435 / 454 ∂ ui ¯ ∂ uj ¯ + ∂xj ∂xi 2 − ρkδij .11) Numerical Modeling of Turbulent Flows Reynolds Averaged Navier-Stokes 4) Most turbulence models (including k − ) have diﬃculties with accurately predicting separation.10) involve ﬁve constants. 3 (10.8)–(10. σ . therefore. Thus.Numerical Modeling of Turbulent Flows Reynolds Averaged Navier-Stokes µT (xi ) is the local eddy viscosity and is related to k and µT = Cµ ρk 2 . 3) Produces less detailed information about the ﬂow than DNS and LES. 2) Special treatment is necessary at solid boundaries. Consider the example of an impinging jet (see ﬁgures). MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. σk . C 2 .

MIPS – Millions of Instructions Per Second. W. Cassel 437 / 454 Parallel Computing Introduction Glossary: • • Supercomputer – the fastest computers available at a particular time. W. Computational Fluid Dynamics c 2010 K. Scalar processing – a processor performs calculations on a single data element. MFLOPS GFLOPS TFLOPS PFLOPS MegaFLOPS GigaFLOPS TeraFLOPS PetaFLOPS million (106 ) FLOPS billion (109 ) FLOPS trillion (1012 ) FLOPS 1015 FLOPS • • • Serial processing – a computer code is executed line-by-line in sequence on one processor. on one or more ﬂoating point numbers (non integers). e. FLOPS – Floating Point Operations Per Second. outdated measure of computer performance (architecture dependent). subtraction. Cassel 438 / 454 • MMAE 517 (Illinois Institute of Technology) . Floating point operation – an operation.Parallel Computing Introduction Outline 11 Parallel Computing Introduction MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. addition. current measure of computer performance for numerical applications.g. multiplication or division.

HPC – High Performance Computing. MPP – Massively Parallel Processing. SMP – Symmetric Multi-Processing.e. and open source software). Beowulf cluster (commodity hardware. e. a vector. • • • • • MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.g. e. shared memory parallelism. simultaneously. e. Embarrassingly parallel – processors work in parallel with very little or no communication between them. Cluster – a parallel computer comprised of commodity hardware. MPI – Message Passing Interface. Coupled parallel – processors work in parallel but require signiﬁcant communication between them. Distributed memory parallelism – all of the processors access their own memory. the internet). all processors perform the same instruction on diﬀerent data elements. • • • • • • • • • MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.g. Cassel 439 / 454 Parallel Computing Introduction • MIMD – Multiple Instruction. analogous to the electric grid. Parallel processing – multiple processors (or cores) perform operations simultaneously on diﬀerent data elements. Multiple Data.g. Massively parallel – parallel computers involving thousands of processors. Cassel 440 / 454 . i.g. W. Multi-core CPUs – a single chip with multiple processors (cores). all processors perform diﬀerent instructions on diﬀerent data elements. Grid computing – parallel computing across a geographically distributed network (e. image processing and Seti@Home. most common library used for inter-processor communication on distributed memory computers. Linux OS.Parallel Computing Introduction • Vector processing – a processor performs calculations on multiple data elements. CFD. Shared memory parallelism – all of the processors share the same memory. W. Multiple Data. SIMD – Single Instruction.

8 TFLOPS 35.105 PFLOPS c 2010 K. Cassel 441 / 454 Parallel Computing Introduction Milestones: Year 1906 1946 1964 1969 1976 1981 1983 1985 1985 1989 1993 1993 1996 1999 2002 2005 2008 Supercomputer Babbage Analytical Engine ENIAC CDC 6600 (Seymour Cray) CDC 7600 Cray-1 (Seymour Cray) CDC Cyber 205 Cray X-MP Cray-2 Thinking Machines CM-2 (64k) Cray Y-MP Thinking Machines CM-5 Intel Paragon Hitachi/Tsukuba CP-PACS (2k) Intel ASCI Red (10k) NEC Earth Simulator (5k) IBM Blue Gene/L (131k) IBM Roadrunner (130k) Computational Fluid Dynamics Peak Speed 0.9 GFLOPS 65.2 GFLOPS 2. and not all algorithms are amenable to each. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.9 TFLOPS 280.5 GFLOPS 143.4 GFLOPS 368. W. Cassel 442 / 454 MMAE 517 (Illinois Institute of Technology) . W.Parallel Computing Introduction A Brief History of Supercomputers: Generations of Supercomputer Architectures: Note that each architecture requires its own approach to programming.3 OPS 50 kOPS 3 MFLOPS 36 MFLOPS 250 MFLOPS 400 MFLOPS 941 MFLOPS 3.6 TFLOPS 1.

Cassel 443 / 454 Parallel Computing Introduction Issues in Parallel Computing: 1 Data dependency → Can calculations be carried out independently of one another on separate processors? → Examples: Thomas algorithm ⇒ no.g. loops. 2 Load balancing → Desire all processors to be utilized 100% of the time. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W. etc. inter-processor communication speed and bandwidth. e. storage.g. e.g. 3 Scalability → Ability of a parallel code to maintain its speedup with increasing numbers of processors and increasing problem size ⇒ see Amdahl’s Law. Cassel 444 / 454 . network. W. BLKTRI). etc. percent of code that is run in parallel (see Amdahl’s law). Coarse-grain parallelism ⇒ parallelize the higher level structures of a program. Red-black Gauss-Siedel ⇒ yes. memory. compiler. CPU speed.) → Assuming adequate memory.Parallel Computing Introduction Milestones (cont’d): 1954 – Fortran (Formula Translation) developed 1970 – Unix developed at AT&T Bell Labs Components of Computing: 1 Hardware – the computer (CPUs. 2 3 Software – OS. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. the computational time is primarily determined by: Sequential → CPU speed Parallel → number of CPUs. program. Algorithms – the numerical method → Note that the best algorithms for serial computers often are not the best for parallel computers (e. 4 Coarse vs. equations. libraries. ﬁne-grain parallelism Fine-grain parallelism ⇒ parallelize the lower level structures of a program.

CM. storage.): Distributed memory (e.g. SGI. multicore CPUs. CM Fortran). Cray. memory.Parallel Computing 5 Introduction Architectures: SIMD (e.g.g. e. Software: 3) Open source OS. 4) MPI – standardize message passing on various platforms (developed at ANL).): . most supercomputing vendors had their own proprietary tools.g. 2) High-performance (high-bandwidth. Cassel 445 / 454 Parallel Computing Introduction Key Ingredients That Make Clusters Possible: Hardware: 1) Fast. → Ingredients (3) and (4) were not available during MPP (e. etc.mid ’90s.g. Myrinet. CM) heyday in mid ’80s .g. Inﬁniband. e. MIMD Shared memory (e. Cassel 446 / 454 . e. W. clusters. Gigabit Ethernet.g. cheap PCs – inexpensive and widely available CPUs. CM-2) vs. W. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. etc. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. low latency) LANs. This led to the demise of the CM. Linux – common platform on which to build tools (previously.

Thus. Cassel 447 / 454 Parallel Computing 2 Introduction Maximum speedup for given F with N → ∞: lim S(N ) = lim 1 1 N = = . serial code. F = 0. and F is the fraction of the serial run time that the code spends in the parallel portion. n) → 0 (F → 1) ∴ S(N ) → N as n → ∞ as n → ∞ ⇒ linear speedup 4 Parallel eﬃciency – fraction of total potential (linear) speedup achieved: E(N ) = S(N ) N MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.g. e. W. See Mathematica notebook ‘’AmdahlsLaw. T (N ) N − (N − 1)F where T (N ) is the time required using N processors. Cassel 448 / 454 . Fs (and F ) depends on the number of processors N and the size of the problem n. i.Parallel Computing Introduction Amdahl’s Law: Measure of speedup S(N ) on N processors versus single processor.95 ⇒ Fs = 0.e.e. i. the number of grid points. N →∞ N − (N − 1)F 1−F Fs N →∞ where Fs = 1 − F is the fraction of time in the serial code spent doing the serial portion. Amdahl’s Law: S(N ) = T (1) N = . W.05 ⇒ S(∞) = 20 3 In practice.nb. for ideal scalability a parallel algorithm should be such that Fs (N.” Notes: 1 If F = 1 (100% parallel) ⇒ S(N ) = N (linear speedup) If F < 1 ⇒ S(N ) < N (sub-linear speedup) MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

53 Oak Ridge National Lab USA 2005 5200 Cray XT3 www.27 36.91 Spain 2005 4800 BladeCenter JS20.39 51.19 35.Parallel Computing 5 Introduction Illustrates importance of proﬁling – determining where the code spends most of its time in order to know where to focus parallelization eﬀorts. Ignores overhead due to parallelization: • • • 6 Inter-processor communication Synchronization of data between processors Load imbalances Modiﬁed Amdahl’s Law: Modiﬁed to account for parallel overhead. W.6 91.45 Netherlands 2005 12288 University Groningen Jaguar 20.nb.top500. Cassel 450 / 454 . N − (N − 1)F + N 2 Fo where Fo is the fraction of time spent due to parallel overhead.org page 4 26th List / November 2005 MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. W.org) Compiled every six months based on LINPACK benchmark tests. November 2005: 26th List: The TOP10 Manufacturer 1 2 3 4 3 5 6 10 7 4 8 5 9 6 10 IBM IBM IBM SGI Dell Cray NEC IBM IBM Cray Computer BlueGene/L eServer Blue Gene BGW eServer Blue Gene ASC Purple eServer pSeries p575 Columbia Altix. See Mathematica notebook “AmdahlsLaw. Infiniband Rmax [TF/s] Installation Site DOE/NNSA/LLNL IBM Thomas Watson DOE/NNSA/LLNL NASA Ames Sandia Sandia Earth Simulator Center Country USA USA USA USA USA USA Japan Year #Proc 2005 131072 2005 40960 2005 10240 2004 10160 2005 8000 280. Cassel 449 / 454 Parallel Computing Introduction Top 500 Supercomputers (www.29 63.top500. Myrinet Center ASTRON eServer Blue Gene 27.” MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Modiﬁed Amdahl’s Law: S(N ) = N .86 Thunderbird Red Storm Cray XT3 2005 10880 2002 5120 Earth-Simulator MareNostrum Barcelona Supercomputer 27.87 38.

W. W. Cassel 451 / 454 Parallel Computing Introduction Geographic location of top 100 supercomputers: MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K. Cassel 452 / 454 .Parallel Computing Introduction Current List (November 2008): MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.

MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.8 Tﬂop/s to 27.S. W. The entry point for the top 100 increased in six months from 18.8 percent of all systems and 87. Already 336 systems are using them. making this the most common architecture in the TOP500 with a stable share of 82 percent.6 percent). Seven U.S.55 Tﬂop/s (which would have been # 5 on the November 2005 list).64 Tﬂop/s mark on the Linpack benchmark.850 six month ago. is the leading consumer of HPC systems with 291 of the 500 systems (up from 257).240 cores per system up from 4. Cray’s XT is the most-used system family with 20 percent. compared to 11. The list now includes energy consumption of the supercomputers. DOE systems dominate the TOP10. Roadrunner (# 1) is based on the IBM QS22 blades that are built with advanced versions of the processor in the Sony PlayStation 3. 410 systems are labeled as clusters. The average concurrency level is 30. Seven systems use IBM’s advanced Sony PlayStation 3 processor with 9 cores.37 Tﬂop/s (which would have been # 9 on the November 2005 list). W.400 six month ago. Cassel 454 / 454 .7 Pﬂop/s six months ago and 6. Of the top 50. The U. HP took over the lead in systems with 209 systems (41. but is still substantially larger then the Asian share (47 systems – unchanged).97 Pﬂop/s one year ago. followed by IBMs BlueGene with 16 percent. The entry level into the TOP50 is at 50. compared to 9.5 percent of quad-core based systems.November 2008: Intel dominates the high-end processor market with 75. The European share (151 systems – down from 184) is settling down after having risen for some time. IBM and Hewlett-Packard continue to sell the bulk of systems at all performance levels of the TOP500.95 Pﬂop/s. Cassel 453 / 454 Parallel Computing Introduction The entry level to the list moved up to the 12. Total combined performance of all 500 systems has grown to 16.490 cores per system – up from 24. 56 percent of systems are installed at research labs and 32 percent at universities. The last system on the newest list would have been listed at position 267 in the previous TOP500 just six months ago. The average concurrency level in the TOP500 is 6. MMAE 517 (Illinois Institute of Technology) Computational Fluid Dynamics c 2010 K.0 Tﬂop/s six months ago.Parallel Computing Introduction TOP500 List Highlights . Quad-core processor based systems have taken over the TOP500 quite rapidly.8 percent) over IBM with 188 systems (37.

- Reproducing the REal Pressure Coefficients
- Troubleshooting Refinery Equipment With Multiphase CFD Modelling
- AADE-11-NTCE-72
- Visual Simulation of Smoke
- 0018-01-0013-0006-35
- Comparitive CFD Study for a Ship Hull With Sonar Dome at Different Positions
- Common Course Work
- An Introduction to Numerical Analysisfor Computational Fluid Mechanics
- Computational Fluid Dynamics
- Numerical Methods Intro
- 1
- 1603MetodosNumericosEcuacionesDerivadasParciales
- Volumenes finitos
- Civil Eng-Geotechnical.pdf
- 62E2017-0597
- KumarCV4
- E-letter2
- McCabe's_synthesis_hyd_packages.pdf
- Phd
- Heat Conduction in 2 and 3 Dimensions
- Ferreira 2005
- Numerical Solution Based Parameter Estimation_2009
- indoor environmental design
- Matlab Assignment Latest~~1
- chap08.pdf
- MenuFile_695_2010_5_20_46_57_383
- Engineering20100500009_65406611
- CH01 Introduction
- CFD Internship India
- Puneshwars Resume

Close Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Loading