By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method,...

23
ME 747 Introduction to computational fluid dynamics By Chainarong Chaktranond Lecture 4 Introduction to numerical methods

Transcript of By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method,...

Page 1: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

ME 747 Introduction to computational

fluid dynamics

By Chainarong Chaktranond

Lecture 4

Introduction to numerical methods

Page 2: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

2Chainarong Chaktranond, Thammasat University

Lecture schedule

5. Introduction to solve engineering problems with finite-different method

- Taylor series expansion, Approximation of the second derivative, Initial condition and

Boundary conditions

6 – 7

4. Introduction to numerical methods

- Finite different method, Finite volume method, Finite element method, etc.

5

3. Overviews of governing equations for flow and heat transfer

-Elliptic, Parabolic and Hyperbolic equations

4

2. Introduction to Fortran programming

- Basic commands in Fortran programming

2 - 3

1.Overviews of computational fluid dynamics

- Overviews and importance of heat transfer in real applications1

TopicsSession

Page 3: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

3Chainarong Chaktranond, Thammasat University

Contents

Overviews of numerical solving methods

Finite difference method

Page 4: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

4Chainarong Chaktranond, Thammasat University

Introduction to numerical methods

การกาหนดฟสกสของปญหา (Define the physical problem)

การกาหนดแบบจาลอง (Create a mathematical model)

- Systems of PDEs, ODEs, algebraic equations

- การกาหนดเงอนเรมตน เงอนไขขอบเขต เพอใหสอดคลองกบปญหา (Well- posed

problem)

การสรางแบบจาลองแบบดสครท (Discrete model)

- การดสครไตซโดเมน → การสรางกรด → การไดแบบจาลองแบบดสครท

- ระบบการแกสมการดสครท

การวเคราะหคาผดพลาดในระบบดสครท (Analyze errors in the discrete system)

- ความสอดคลอง/ตรงกบกายภาพ ความเสถยร และการวเคราะหการลเขาของคาตอบ

Page 5: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

5Chainarong Chaktranond, Thammasat University

Numerical solving methods

Finite difference method

Finite element method

Finite volume method

Spectral method

Page 6: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

6Chainarong Chaktranond, Thammasat University

Main numerical methods for PDEs

Finite difference method (FDM)

Advantages:

Simple and easy to design the scheme

Flexible to deal with the nonlinear problem

Widely used for elliptic, parabolic and hyperbolic equations

Most popular method for simple geometry, ….

Disadvantages:

Not easy to deal with complex geometry

Not easy for complicated boundary conditions

……..

Page 7: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

7Chainarong Chaktranond, Thammasat University

Finite difference method

( )0, XΩ =

หลกการ คอ การหาคาอนพนธในสมการอนพนธยอยเปนคาประมาณโดยใชคาฟงกชนเชงเสนทจด

บนกรด

1 D ( )i iu u x≈ 0,1,2, ,i N= …

Grid points ix i x= Δ Mesh sizeXxN

Δ =

อนพนธอนดบท 1( ) ( ) ( ) ( )

0 0lim limi i i ii

x x

u x x u x u x u x xux x xΔ → Δ →

+ Δ − − − Δ∂= =

∂ Δ Δ

( ) ( )0

lim2

i i

x

u x x u x xxΔ →

+ Δ − − Δ=

Δ

Page 8: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

8Chainarong Chaktranond, Thammasat University

การประมาณคาอนพนธอนดบทหนง

1i i

i

u uux x

+ −∂⎛ ⎞ ≈⎜ ⎟∂ Δ⎝ ⎠

1i i

i

u uux x

−−∂⎛ ⎞ ≈⎜ ⎟∂ Δ⎝ ⎠

1 1

2i i

i

u uux x

+ −−∂⎛ ⎞ ≈⎜ ⎟∂ Δ⎝ ⎠

Taylor series expansion

x

( ) ( )2 32 3

1 2 32 6i ii i i

x xu u uu u xx x x+

Δ Δ⎛ ⎞ ⎛ ⎞∂ ∂ ∂⎛ ⎞= + Δ + + +⎜ ⎟ ⎜ ⎟⎜ ⎟∂ ∂ ∂⎝ ⎠ ⎝ ⎠ ⎝ ⎠

( ) ( )2 32 3

1 2 32 6i ii i i

x xu u uu u xx x x−

Δ Δ⎛ ⎞ ⎛ ⎞∂ ∂ ∂⎛ ⎞= − Δ + − +⎜ ⎟ ⎜ ⎟⎜ ⎟∂ ∂ ∂⎝ ⎠ ⎝ ⎠ ⎝ ⎠

T1

T2

Page 9: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

9Chainarong Chaktranond, Thammasat University

คาผดพลาดจากการประมาณคาอนพนธอนดบทหนง

T1

- T2

Truncation error ( )O xΔ

T1

T2

คาผดจากการการคานวณโดยการประมาณอนพนธอนดบหนง

Page 10: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

10Chainarong Chaktranond, Thammasat University

การประมาณอนพนธอนดบทสอง

( )( )

221 1

2 2

2i i i

i

u u uu O xx x

− +⎛ ⎞ − +∂= + Δ⎜ ⎟∂ Δ⎝ ⎠

Central difference scheme

Alternative derivative

Page 11: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

11Chainarong Chaktranond, Thammasat University

การประมาณคาโดยอนพนธผสม

Second difference approximation

Page 12: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

12Chainarong Chaktranond, Thammasat University

การประมาณคาโดยอนพนธอนดบสงๆ

Taylor series expansion

backward

forward

central

central

Page 13: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

13Chainarong Chaktranond, Thammasat University

Example: 1-D Poisson equation

Page 14: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

14Chainarong Chaktranond, Thammasat University

Example: 1-D Poisson equation

Page 15: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

15Chainarong Chaktranond, Thammasat University

Example: 2-D Poisson equation

Page 16: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

16Chainarong Chaktranond, Thammasat University

Example: 2-D Poisson equation

Page 17: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

17Chainarong Chaktranond, Thammasat University

Page 18: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

18Chainarong Chaktranond, Thammasat University

Page 19: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

19Chainarong Chaktranond, Thammasat University

Page 20: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

20Chainarong Chaktranond, Thammasat University

Main numerical methods

Finite element method (FEM)

Advantages:

Flexible to deal with problems with complex geometry and complicated boundary conditions

Keep physical laws in the discretized level

Rigorous mathematical theory for error analysis

Widely used in mechanical structure analysis, computational fluid dynamics (CFD), heat transfer, electromagnetics, …

Disadvantages:

Need more mathematical knowledge to formulate a good and equivalent variational form

Page 21: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

21Chainarong Chaktranond, Thammasat University

Finite element methods

Basic idea( ) ( ) ( )

1

ˆM

j jj

u x u x u xφ=

≈ = ∑basic functions

M unknowns: ตอง M สมการ

Discretizing derivative results in linear system

jujφ

Page 22: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

22Chainarong Chaktranond, Thammasat University

Main numerical methods

Finite volume method (FVM)

Flexible to deal with problems with complex geometry and complicated boundary conditions

Keep physical laws in the discretized level

Widely used in CFD

2

2e w

e wP

u ux xu

x xx

⎡ ⎤∂ ∂⎛ ⎞ ⎛ ⎞−⎜ ⎟ ⎜ ⎟⎢ ⎥∂ ∂⎡ ⎤∂ ⎝ ⎠ ⎝ ⎠⎣ ⎦=⎢ ⎥ −∂⎣ ⎦

E P

e E P

u uux x x

−∂⎛ ⎞ =⎜ ⎟∂ −⎝ ⎠P W

w P W

u uux x x

−∂⎛ ⎞ =⎜ ⎟∂ −⎝ ⎠

Page 23: By Chainarong Chaktranond CFD... · 4. Introduction to numerical methods - Finite different method, Finite volume method, Finite element method, etc. 5 3. Overviews of governing equations

23Chainarong Chaktranond, Thammasat University

Main numerical methods

Spectral method

Advantage

High (spectral) order of accuracy

Usually restricted for problems with regular geometry

Widely used for linear elliptic and parabolic equations on regular geometry

Widely used in quantum physics, quantum chemistry, material sciences,

Disadvantage

Not easy to deal with nonlinear problem

Not easy to deal with hyperbolic problem

…..