me - 733 computational fluid mechanics lecture 4computational fluid mechanics lecture 4 dr./ ahmed...

65
ME - 733 Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018

Upload: others

Post on 24-Jan-2021

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

ME - 733Computational Fluid Mechanics

Lecture 4

Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018

Page 2: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• In the solution of differential equations with finite differences, a variety of schemes are available for the discretization of derivatives and the solution of the resulting system of algebraic equations.

• In many situations, questions arise regarding the round-off and truncation errors involved in the numerical computations, as well as the consistency, stability and the convergence of the finite difference scheme.

• Round-off errors: computations are rarely made in exact arithmetic.

• This means that real numbers are represented in “floating point” form and as a result, errors are caused due to the rounding-off of the real numbers.

• In extreme cases such errors, called “round-off” errors, can accumulate and become a main source of error.

Errors Involved in Numerical Solutions

Page 3: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• Before proceeding with an analysis of numerical techniques, it is necessary to define additional terminology for concepts which will be investigated in the upcoming chapters.

1. Consistency: A finite difference approximation of a PDE is consistent if the finite difference equation approaches the PDE as the grid size approaches zero.

2. Stability: A numerical scheme is said to be stable if any error introduced in the finite difference equation does not grow with the solution of the finite difference equation.

3. Convergence: A finite difference scheme is convergent if the solution of the finite difference equation approaches that ofthe PDE as the grid size approaches zero.

4. Lax's equivalence theorem: For a FDE which approximates a well-posed, linear initial value problem, the necessary and sufficient condition for convergence is that the FDE must be stable and consistent.

Remarks and Definitions

Page 4: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Stability Analysis: Von-Neumann Analysis• Von-Neumann analysis is applicable only for linear equations

• Boundary effect on stability analysis is not included

• For any scalar PDE which is approximated by two-level FDE, the mathematical constrainon the amplification factor as follows:

– If G is real, |G|<=1

– If G is complex, |G|2<=1

• The method can be easily extended to multi-dimensional problems

• Benchmark values for stability of unsteady one-dimensional problems may beestablished as follows:

– Explicit problems it will have a condition for stability such as d<= 0.5

– Implicit problems unconditionally stable

• For difficult expressions of the amplification factor to be analyzed, graphicalrepresentation along with some numerical experimentations can facilitate theanalysis

Page 5: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• In this method, a solution of the finite difference equation is expanded in a Fourier series.

• The decay or growth of the amplification factor indicates whether or not the numerical algorithm is stable.

• Actual stability requirement may be more restrictive than the one obtained from the von Neumann stability analysis.

• Nevertheless, the results will provide very useful information on stability requirements.

The procedure: assume a Fourier component for uin

as where 𝐼 = −1, Un is the amplitude at time level n, and P is the wave number in the x-direction, i.e., x= 2/P, where x is the wavelength. • Similarly,

Von Neumann Stability Analysis

ixIPnn

i eUu)(=

Page 6: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• If a phase angle = PΔx is defined, then:

• To proceed with the application of this method, consider the explicit representation of Stokes' first problem.

• The PDEand its FTCS explicit formulation is:

in terms of the diffusion number

)1(

1

11,

++ === iInn

i

iInn

i

iInn

i eUuandeUueUu

2

2

x

u

t

u

=

2

11

1

)(

2

x

uuu

t

uun

i

n

i

n

i

n

i

n

i

+−=

− −+

+

)2( 11

1 n

i

n

i

n

i

n

i

n

i uuuduu −+

+ +−+=

Page 7: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• Utilizing the relation

• Introducing an amplification factor such that Un+1= GUn, then G=1-2d(1-cos ),

• For a stable solution, the absolute value of G must be bounded for all values of . Mathematically, it is expressed as

|G| ≤ 1 or |1-2d(1-cos )| ≤ 1, • So that 1-2d(1-cos ) ≤ 1 and 1-2d(1-cos ) ≥ -1• First inequality is satisfied for all values of . • With the maximum value of (1-cos ) = 2, the left-hand

side of second inequality is (1 - 4d), which must be larger than or equal to -1; thus, 1- 4d ≥ -1 or 4d ≤ 2.

• So the stability condition is that d ≤1/2

Page 8: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• The graphical solution may be either in a polar coordinate or a Cartesian coordinate.

• They are shown in Figures 4-9a and 4-9b, respectively.

Graphical Representation of G

Polar

CartesianFigure 4-9. Amplification factor G=1-2d(1-cos ),illustrated for various values of d.

Page 9: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• Note that in Figure 4-9a, when d = 0.625, some values of G have fallen outside the circle of radius 1; and in Figure 4-9b, it has exceeded the stability limit, indicating an unstable solution for this value of d.

• Consider a 1-D equation with both convection and diffusion terms, i.e.,

• The FTCS explicit formulation is expressed as

• Following the von Neumann stability analysis,

2

2

x

u

x

ua

t

u

+

−=

2

1111

1

)(

2

2 x

uuu

x

uua

t

uun

i

n

i

n

i

n

i

n

i

n

i

n

i

+−+

−−=

− −+−+

+

)2()(2

1111

1 n

i

n

i

n

i

n

i

n

i

n

i

n

i uuuduuc

uu −+−+

+ +−+−−=

Page 10: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• Eliminating eIi,

• With the identities:

• Equation ( 4-35) is written as:

• from which it follows that

• Note that, for this particular problem, the amplification factor has real and imaginary parts.

• A stable solution requires that the modulus of the amplification factor must be bounded.

• Thus, a formal requirement may be expressed as

𝑐𝑜𝑠𝜃 =𝑒𝐼𝜃 + 𝑒−𝐼𝜃

2𝑎𝑛𝑑 𝑠𝑖𝑛𝜃 =

𝑒𝐼𝜃 − 𝑒−𝐼𝜃

2𝐼

Page 11: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• Before mathematical arguments are considered, a graphical presentation is studied.

• It is the equation of an ellipse

• For a stable solution, the ellipse should fall inside the circle of unit radius.

Real

Page 12: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• The two most extreme cases are 1- 2d = 0 or d = 0.5, or c = 1

• Thus, it appears that the stability requirements are d ≤ 0.5 and c ≤ 1.

• However, a more restrictive condition is found by considering the formal requirement that the modulus of must be bounded, i.e., |G|2 ≤ 1.

d = 0.5 c = 1

Page 13: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• This quadratic equation represents either a convex curve (with a minimum) or a concave curve (with a maximum)

Page 14: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• It can be shown that for a stable solution, this quadratic function may not have a global maximum, i.e., the curve cannot be concave.

• The mathematical procedure is as follows.

• The first and second derivatives of the function IGI2 with respect to cosare

Page 15: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 16: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 17: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Graphical Representation of G

Page 18: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• Graphical representation of the amplification factor for various values of c and d is illustrated in Figures 4-14a and 4-14b.

Graphical G

Page 19: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• Consider a fluid bounded by two parallel plates extended to infinity such that no end effects are encountered.

• The planar walls and the fluid are initially at rest. • Now, the lower wall is suddenly accelerated in the x-

direction. • The spacing between two plates is denoted by h.• The Navier-Stokes equations for this problem may be

expressed as • Parabolic equation

• where is the kinematic viscosity of the fluid. • It is required to compute the velocity profile u = u(t, y). • The initial and boundary conditions for this problem are

stated as follows:

Example from Chapter 3

2

2

y

u

t

u

=

Page 20: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 21: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 22: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 23: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Stability Analysis: Error Analysis• For the model equation

• Dissipation error:

– It is the error associated with first-order accurate methods

– Associated with even derivatives

• Dispersion error:

– It is the type of errors associated with

second order accurate methods

- Associated with odd derivatives

Page 24: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Stability Analysis: Error Analysis• For the model equation

• The modified equation for FTBS becomes:

• The artificial viscosity:

– Represents the second derivative term coefficient

– This term dissipate he solution, as a results gradients are reduced

Page 25: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Parabolic PDEs: Discretization• The scheme of the parabolic model equation is:

ujn+1 -u j

n

Dt=n b

u j+1

n+1 - 2u jn+1 +u j-1

n+1

(Dy)2+ (1- b)

u j+1

n - 2u jn +uj-1

n

(Dy)2

é

ëê

ù

ûú+O(Dt, (Dy)2 )

b

b = 0 --- > FTCS

b =1 --- > BTCS

b =1/ 2 --- > Crank -Nicolson

stablellyConditionaFor

stablenallyUnconditioFor

   2/10 

   2/1 

−−−

−−−

Page 26: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Parabolic PDEs: Stability Analysis• Von-Neumann method is the most commonly used method

for stability analysis

• The error function is written in a Fourier seriesrepresentation:

where , is the wave number, and is the erroramplitude.

• For stable solution, the amplification factor G

where

u = U neiKmy

m

å

G £1

i = -1 Km

U n

G =U n+1

U n

Page 27: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Parabolic PDEs: Stability Analysis• FTCS:

• BTCS:

G =1+2D (Cos(q)-1) 0 £D£1

Polar Cartesian

G =1

1+ 2D (1-Cos(q))

Page 28: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Parabolic PDEs: Modified Equation• By substituting back with Taylor series expansion of each

term into the finite difference equation, the modifiedequation is obtained.

• Truncation Error = FDE-PDE =

ujn+1 = uj

n +D(uj+1

n -2ujn +uj-1

n )29

Modified Equation

Dividingby thefollowingequation isobtained

Thisequationcanbewrittenas

Usingthegoverningequation(theparabolicpartial differential equation)

Then

4

4

42

2

2

4

4

43

3

32

2

2

yOy

u

12

y

y

u

tOt

u

!4

t

t

u

!3

t

t

u

2

t

t

u

42

4

42

2

2

2

2

y,tOy

u

12

y

t

u

2

t

y

u

t

u

yyyy2

ttyyyyttyyttttyyttyyt uuuuuuuu0uu

42

yyyy

2

yyt y,tOut6

y

2uu

30

Modified Equation

Themodifiedequationof theFTCS-Explicit schemeis

Ingeneral thetruncation error isof first order in timeandsecondorder inspace

( 2). Thetruncationerror ( T.E. = F.D.E. - P.D.E. ) of thisschemeis

Noodd derivativetermsappear in thetruncation error (T.E.). Asaconsequence,

thisschemehasnodispersiveerrors.

Anoptimumvalueof 1/6 , wherethefirst termin theT.E. equationvanishes,

theT.E. is secondorder in timeandfourthorder inspace.

Tocheck theconsistencyof thescheme, Takethelimit as ( 0, 0) theT.E.

zero, thentheF.D.E. reducestotheoriginal P.D.E. (Theschemeisconsistent)

42

yyyy

2

yyt y,tOut6

y

2uu

42

yyyy

2

y,tOut6

y

2.E.T

Is the scheme consistent?

Page 29: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Parabolic PDEs: Explicit Methods• FTCS method:

– The scheme is first order in time and second order in space

– The amplification factorleads to a stability constrain on the diffusion number to be

• Richardson method:

– The scheme is second order time and space

– Amplification factor where

– Unconditionally unstable (has no practical value)

G =1+2D (Cos(q)-1)0 £D£1/ 2

G = -b ± b 2 +1

b = 2D(cosq -1)

Page 30: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Parabolic PDEs: Explicit Methods• DuFort-Frankel method

– The scheme is second order in time and second order in space

– For stability considerations the term in the diffusion term isreplaced with an average between and

– The resulting equation is explicit formulation

– The amplification factor is

where

– The scheme is unconditionally stable

G =b ± b 2 + 4(1- 4D2 )

2(1+ 2D)b = 4D cosq

uin

uin+1 ui

n-1

Page 31: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Parabolic PDEs: Implicit Methods• Laasonen method (BTCS):

– The scheme is first order in time and second order in space

– The amplification factor

– Unconditionally stable

• The Beta formulation

– The scheme conditionally stable when

– The scheme is unconditionally stable when

– The formulation is FTCS when

– The formulation is Crank-Nicolson when

0 £ b £1/ 2

G =1

1+ 2D (1-Cos(q))

1/ 2 £ b £1

b = 0

b =1/ 2

Page 32: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Parabolic PDEs: Implicit Methods• Crank-Nicolson method

– The scheme is second order time and space

– The diffusion term is replaced by a time average value of the second order central spacedifference term

– The second order in time is unclear, but if we thought of as a summation of two-stepcomputations:

1. Explicit step

2. Implicit step

Page 33: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Parabolic PDEs: Schemes ComparisonError at Time = 0.18 sec. Error at Time = 1.08 sec.

Error at Time = 1.0 sec.For BTCS method

Page 34: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• A summary on application and limitations of the von Neumann

1. The von Neumann stability analysis can be applied to linear equations only.

2. The influence of the boundary conditions on the stability of solution is not included.

3. For a scalar PDE which is approximated by a two-level FDE, the mathematical requirement is imposed on the amplification factor as follows:(a) if G is real, then IGI ≤ 1(b) if G is complex, then IGI2 ≤ 1, where IGI2 = 𝐺 ҧ𝐺

4. For a scalar PDE which is approximated by a three-level FDE, the amplification factor is a matrix. In this case, the requirement is imposed on the eigenvalues of Gas follows:(a) if> is real, then || ≤ 1(b) if> is complex, then | |2 ≤ 1

5. The method can be easily extended to multidimensional problems.

Summary

Page 35: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

6. The procedure can be used for stability analysis of a system of linear PDEs. The requirement is imposed on the largest eigenvalue of the amplification matrix.

7. Benchmark values for the stability of unsteady one-dimensional problems may be established as follows:

(a) For most explicit formulations:I. Courant number, c ≤ 1II. Diffusion number, d ≤ 0.5III. Cell Reynolds number, Rec ≤ (2/c)

(b) For implicit formulation, most are unconditionally stable.

8. For multi-dimensional problems with equal grid sizes in all spatial directions, the stated benchmark values are usually adjusted by dividing them by the number of spatial dimensions.

9. On occasions where the amplification factor is a difficult expression to analyze, graphical solution along with some numerical experimentation will facilitate the analysis.

Page 36: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• In order to determine the dominant error term of a finite difference equation, Taylor series expansions are substituted back into the finite difference equation and, after some algebraic manipulation, the so-called modified equation is obtained.

• Consider the first-order FDE

• Arrange as

Modified Equation

Page 37: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 38: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 39: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• This equation is known as the modified equation.

• When compared to the original PDE, the error introduced in the approximation process is clearly indicated.

• Note that the dominating term in the error is the second term on the right-hand side of Equation (4-84), which includes the second derivative.

Page 40: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• Consider a second-order method in which the dominant error term includes a third-order (odd) derivative.

• Such a formulation is the midpoint leapfrog method given by ( 4-53).

• The equation may be rearranged as

Page 41: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 42: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• Recall the modified Equation (4-84)

Artificial Viscosity

Page 43: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Applications

Page 44: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Dispersion Error

Page 45: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 46: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 47: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 48: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 49: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 50: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 51: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Finite Difference: Elliptic Equations

Solution Technique

• Elliptic equations in engineering are typically used to characterize steady-state, boundary value problems.

• For numerical solution of elliptic PDEs, the PDE is transformed into an algebraic difference equation.

• Because of its simplicity and general relevance to most areas of engineering, we will use a heated plate as an example for solving elliptic PDEs.

Page 52: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 53: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

The Laplacian Difference Equations/

04

022

2

2

0

,1,1,,1,1

2

1,,1,

2

,1,,1

2

1,,1,

2

2

2

,1,,1

2

2

2

2

2

2

=−+++

=

=

+−+

+−

+−=

+−=

=

+

−+−+

−+−+

−+

−+

jijijijiji

jijijijijiji

jijiji

jijiji

TTTTT

yx

y

TTT

x

TTT

y

TTT

y

T

x

TTT

x

T

y

T

x

T

Laplacian difference

equation.

Holds for all interior points

Laplace Equation

O[(x)2]

O[(y)2]

Page 54: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 55: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• In addition, boundary conditions along the edges must be specified to obtain a unique solution.

• The simplest case is where the temperature at the boundary is set at a fixed value, Dirichlet boundary condition.

• A balance for node (1,1) is:

• Similar equations can be developed for other interior points to result a set of simultaneous equations.

754

0

75

04

211211

10

01

1110120121

−=++−

=

=

=−+++

TTT

T

T

TTTTT

Page 56: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

1504

1004

1754

504

04

754

504

04

754

332332

33231322

231312

33322231

2332221221

13221211

323121

22132111

122111

=+−−

=−+−−

=−+−

=−+−−

=−−+−−

=−−+−

=−+−

=−−+−

=−−

TTT

TTTT

TTT

TTTT

TTTTT

TTTT

TTT

TTTT

TTT

• The result is a set of nine simultaneous equations with nine unknowns:

Page 57: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Finite Difference: Parabolic Equations

• Parabolic equations are employed to characterize time-variable (unsteady-state) problems.

• Conservation of energy can be used to develop an unsteady-state energy balance for the differential element in a long, thin insulated rod.

Page 58: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• Energy balance together with Fourier’s law of heat conduction yields heat-conduction equation:

• Just as elliptic PDEs, parabolic equations can be solved by substituting finite divided differences for the partial derivatives.

• In contrast to elliptic PDEs, we must now consider changes in time as well as in space.

• Parabolic PDEs are temporally open-ended and involve new issues such as stability.

t

T

x

Tk

=

2

2

Page 59: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite
Page 60: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

Explicit Methods• The heat conduction equation requires approximations for the second

derivative in space and the first derivative in time:

( )

( )( )211

1

1

2

11

1

2

11

2

2

2

2

2

x

tkTTTTT

t

TT

x

TTTk

t

TT

t

T

x

TTT

x

T

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

=+−+=

−=

+−

−=

+−=

−+

+

+

−+

+

−+

Page 61: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• This equation can be written for all interior nodes on the rod.

• It provides an explicit means to compute values at each node for a future time based on the present values at the node and its neighbors.

Page 62: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

A simple Implicit Method

• Implicit methods overcome difficulties associated with explicit methods at the expense of somewhat more complicated algorithms.

• In implicit methods, the spatial derivative is approximated at an advanced time interval l+1:

which is second-order accurate.( )2

1

1

11

1

2

2 2

x

TTT

x

Tl

i

l

i

l

i

+−

+

++

+

Page 63: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

A simple Implicit Method

( )

( )

( )( ) ( )

( ) ( )1

1

1

1

1

1

01

1

2

1

1

1

0

1

0

1

1

11

1

1

2

1

1

11

1

21

21

21

2

+

+

+

+

+++

++

+

+

++

++

++

+

+=−+

=

+=−+

=

=−++−

−=

+−

l

m

l

m

l

m

l

m

llll

ll

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

l

i

tfTTT

mi

tfTTT

tfT

TTTT

t

TT

x

TTTk

This eqn. applies to all but the first and the last interior nodes, which must be modified to reflect the boundary conditions:

Resulting m unknowns and m linear algebraic equations

Page 64: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• Chapter 2

• Computational Fluid Dynamics by Klaus Hoffmann

• Problems:

• 2.1, 2.2 (parts: a, b), 2.3, 2.6, 2.7 and 2.8

Assignment # 3

Page 65: ME - 733 Computational Fluid Mechanics Lecture 4Computational Fluid Mechanics Lecture 4 Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018 •In the solution of differential equations with finite

• Page 25-28

• Problems:

• 1.2, 1.4, 1.6, 1.8, 1.9 and 1.12

Assignment # 2