Chapter 5 -CFD

42
Part II: Basics of Numerics Part II: Basics of Numerics Presented by Zhonghua Han Presented by Zhonghua Han E-mail: [email protected] 12.04.2012 Department of Fluid Mechanics, School of Aeronautics, Northwestern Polytechnical University, Xian, China National Key Laboratory of Science and Technology on Aerodynamic Design and Research Polytechnical University, Xi an, China CFD Course for International Mixed Class

description

CFD Lectures

Transcript of Chapter 5 -CFD

Page 1: Chapter 5 -CFD

Part II: Basics of NumericsPart II: Basics of Numerics

Presented by Zhonghua HanPresented by Zhonghua HanE-mail: [email protected]

12.04.2012

Department of Fluid Mechanics, School of Aeronautics, Northwestern Polytechnical University, Xi’an, China

National Key Laboratory of Science and Technology on Aerodynamic Design and Research

Polytechnical University, Xi an, China

CFD Course for International Mixed Class

Page 2: Chapter 5 -CFD

N P UN P U

P t II B i f th N iPart II: Basics of the Numerics

Finite Difference: Discretization of PDEs

Finite Volume: Diescretization of integral form of the equations g q

Grid Transformation and Grid Generation

Some Simple CFD Techniques

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 2

Page 3: Chapter 5 -CFD

# Lecture 5:Grid Transformation &# Lecture 5:Grid Transformation & Generation

Presented by Zhonghua HanPresented by Zhonghua HanE-mail: [email protected]

12.04.2012

Department of Fluid Mechanics, School of Aeronautics, Northwestern Polytechnical University, Xi’an, China

National Key Laboratory of Science and Technology on Aerodynamic Design and Research

Polytechnical University, Xi an, China

CFD Course for International Mixed Class

Page 4: Chapter 5 -CFD

N P UN P U

Q ti ?Questions?

1) Why do we need to generation grid for numerical1) Why do we need to generation grid for numerical solution of governing equations?

2) H id? Wh h i f i2) How to generate a grid? What are the requirements for generating a grid.Take the grid generation for an airfoil as an exampleTake the grid generation for an airfoil as an example.Structured: rectangular/hexahedral Unstructured: triangular/tetrahedral /prism/solarUnstructured: triangular/tetrahedral /prism/solarCartesian:Meshless: discrete points. p

3) The influence of the grid quality on the solution?R b t ffi i

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 4

Robustness; efficiency; accuracy

Page 5: Chapter 5 -CFD

N P UN P U

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 5

Page 6: Chapter 5 -CFD

N P UN P U

Ch t 5 G id G ti d T f tiChapter 5 : Grid Generation and Transformation

5 1 I t d ti5.1 Introduction

Grid generation: The numerical solution of governing equation needs discrete grid points , which lend them to

id ti t h igrid generation techniques;

Grid transformation: For finite-difference method, we need to transform our body-fitted grid to uniform Cartesian grid; for finite volume method, it is not necessary

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 6

Page 7: Chapter 5 -CFD

N P UN P U

Problems with the rectangular grid sketched in Fig. 5.1 :

1. Some grid points fall inside the airfoil, where they are completely out of the flow.

2.There are few, if any, grid points that fall on the surface of the airfoil. This is not good because the airfoil surface is a vital boundary condition for determination of the flowcondition for determination of the flow.

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 7

Fig.5.1 An airfoil in a purely rectangular grid

Page 8: Chapter 5 -CFD

N P UN P U

Physical plane

Grid Transformation

Computational plane

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 8

Page 9: Chapter 5 -CFD

N P UN P U

Fig. 5.2a shows a non-uniform curvilinear gird or body-fitted grid. The important point is that the grid points naturally fall on the i f il f e d the b d diti i e ie t de l ithairfoil surface and the boundary condition is easier to deal with;

To solve the governing equation with finite-difference method, the grid must be transformed from physical plane to computation plane in a one-to-one fashionplane in a one-to-one fashion.

The governing equation itself should expressed in terms of the new variables.new variables.

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 9

Page 10: Chapter 5 -CFD

N P UN P U

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 10图5.3 第五章路线图

Page 11: Chapter 5 -CFD

N P UN P U

5 2 General Transformation of the Equations5.2 General Transformation of the Equations

For a two-dimensional case, we will transform the independent variables in physical space (x, y, t) to a new set of independent variables in computational space ( )。 ,,

(5 1b))((5.1a) ),,(

ttyx

(5.1c) )((5.1b) ),,(

ttyx

Equations(5.1a) to (5.1c) represents the transformation. This is i f f t f ti f t l li ti tha generic form of transformation; for an actual application, the

transformation must be given as some type of specific analytical relation or sometime a specific numerical relation

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 11

relation or sometime a specific numerical relation.

Page 12: Chapter 5 -CFD

N P UN P U

Transformation of 1st order partial derivativesTransformation of 1 order partial derivatives

tytytyty xxxx ,,,,,,, )()()()()()()(

))(())((

(5.2)))(())((xxx

))(())((yyy

(5.3)

))(())(())((dtd

ttt

(5.5)

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 12

dtttt ( )

Page 13: Chapter 5 -CFD

N P UN P U

Transformation of 2nd order partial derivatives

))(())(())(( 22

2

2

2

2

2

2

2

xxxx

(5.9)

))()((2))(( 2

22

2

xxx

xxxx

(5.9)

))(())(())(( 22

2

2

2

2

2

2

2

(5 13)

))()((2))((

))(())(())((

22

2

2

2222

yyy

yyyy

(5.13)

yyy

2222

))(())(()())()((

))()(())(())((

22

2 yxyxyxyx

(5.15)

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 13

))(())(()())()(( 2 yxyxyx

Page 14: Chapter 5 -CFD

N P UN P U

Example 5.1 Laplace’s equationExample 5.1 Laplace s equation

02

2

2

2

yx

( ) ( ) ( ) ( )

2 22 2 2 2( ) ( ) ( ) ( )

x y x y

2 2

2

2 ( )( ) ( )( )x x y y

2 2 2 2

2

x y x

2 2 2 y

2 0

(5 17)

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 14

(5.17)

Page 15: Chapter 5 -CFD

N P UN P U

5 3 Metrics and Jacobins5.3 Metrics and Jacobins

(5 18a))( xx

(5 18c))((5.18b) ),,((5.18a) ),,(

ttyyxx

(5.18c) )(tt

( )( ) ( )( )y y 1

(5 24a)( )( ) ( )( )x J

1

(5.24a)

( )( ) ( )( )x xy J

1

(5.24b)

yx

yxyxJ)(),(

(5.22a)

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 15

yx),(

Page 16: Chapter 5 -CFD

N P UN P U

5 4 Form of the Governing Equation Particularly Suited5.4 Form of the Governing Equation Particularly Suited for CFD Revisited : the Transformed Version

For the case of unsteady flow in two spatial dimensions, with no source term, the strong conservation form of the governing equations can be written as

GFU (5.37) 0

yG

xF

tU

Question: When it is written in the transformed space, can it be recast in strong conservation form; i.e. can it be written in a t f ed f h th t

? (5.38)U F G 1 1 1 0

transformed form such that

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 16

( )t

Page 17: Chapter 5 -CFD

N P UN P U

The answer is: yes.

(5.47) 0111

GFU ( )

t

Where JUU1

xGyF

yJG

xJFF1

xGyF

yJG

xJFG1

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 17

Page 18: Chapter 5 -CFD

N P UN P U

5.5 A Comment

The transformation is required by finite-difference

th d hi h d th if idmethod, which needs the uniform grid;

Such a transformation is inherently not required by y q y

finite-volume method, which can deal directly with a

non uniform mesh in the physical placenon-uniform mesh in the physical place.

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 18

Page 19: Chapter 5 -CFD

N P UN P U

5.7 Boundary-fitted Coordinate System: Elliptic G id G tiGrid Generation

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 19

Page 20: Chapter 5 -CFD

N P UN P U

Assume that the transformation is defined by an elliptic Assume that the transformation is defined by an elliptic

partial differential equation

0ξξ

yx 2

2

2

2 (5.67)

02

2

2

2

yx

yx

(5.68)

02 2

22

2

2

xxx

yx

02 2

22

2

2

yyy

2222 yxyyxxyx

22

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 20

,, yxyyxxyx

Page 21: Chapter 5 -CFD

N P UN P U

Assignment (3): Elliptic Grid GenerationAssignment (3): Elliptic Grid GenerationProblem description: Generate O-type grid around a NACA 0012 airfoil by solvingaround a NACA 0012 airfoil by solving Laplace equation; write a report to described your algorithm and results; show me your y g yability of computer programming as well as the ability of working as an engineer.

Note: choosing other airfoil shape, such as RAE 2822, is welcome; C or Fortran language or

th d d t lany other advanced computer language; input and output files should be used for the input parameters and the output grid; p p p gSimply coping code for others will be regarded as cheating !

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 21

Page 22: Chapter 5 -CFD

N P UN P U

The surface coordinates of NACA 0012can be obtained by following equation

4 3 20 6 0 0 0 28 3 0 3 6 0 22 0 2969

by following equation

, . [ . . . . . ] u ly x x x x x 4 3 20 6 0 1015 0 2843 0 3576 0 1221 0 2969

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 22

Page 23: Chapter 5 -CFD

N P UN P U

Solving procedureSolving procedure

(1) Boundary condition

Set numbers of grid points along i and j directions, for example 121*33; set the fair-field points, for example, uniformly distributed around a circle with radius of 10c.

Set the points on a NACA 0012 airfoil; the grid points are clustered near the leading and trailing edges. For example, the x-coordinate can be distributed asthe x coordinate can be distributed as

)cos1(2

cx

]2,0[

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 23

Page 24: Chapter 5 -CFD

N P UN P U

(2)Initialize the grid points,

)0(,

)0(, , jiji yx

(3)Set up an iteration scheme and update the grid points according to the different equation until the solutionsaccording to the different equation until the solutions converge. Please pay attention to the boundary conditions.

)()1(

)(,

)1(,max n

jin

ji xx

)(,

)1(,max n

jin

ji yy

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 24

Page 25: Chapter 5 -CFD

N P UN P U

Difference equations:

42

)(

2 1,11,11,11,12

,1,,1

jijijijijijiji xxxxxxx

q

0)(

24)(

21,,1,

jijiji xxx

)(

42

)(

2 1,11,11,11,12

,1,,1

jijijijijijiji yyyyyyy

0)(

24)(

21,,1,

jijiji yyy

)(

where 21,1,21,1,22 )2

()2

(

yyxxyx jijijiji

22

22

yx

yyxx

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 25

yx

Page 26: Chapter 5 -CFD

N P UN P U

Iteration scheme

)()([21

1,1,,1,1,

jijijijiji xxxxx

)/()](2 1,11,11,11,1

jijijiji xxxx

A powerful technique or numerical solution of elliptic equation:

( ) ( ) ( ) ( ), , , ,( )n n n n

i j i j i j i jx x x x 1 1

1 21

Successive overrelaxation

d l i

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 26

1 underrelaxation

Page 27: Chapter 5 -CFD

N P UN P U

Boundary conditions:y

Apply periodic boundary condition for cut CD;

Grid points on the airfoil and far filed boundary are given and Grid points on the airfoil and far filed boundary are given and fixed during the iteration

.. .; ;

. . .

{

n i n j

d o

1 2 1 3 3

{ fo r ( j= 1 ;j< n j-1 ; j+ + ) { fo r ( i= 0 ,i< n i; i+ + ) {{ x [ i ,j ] = . . . ; y [ i , j ] = . . . ; } x [0 ,j] = x [n i-2 ,j ] ;j j y [0 ,j ] = y [n i-2 ,j ] ; x [n i-1 ,j ] = x [1 ,j ] ; y [n i-1 ,j] = y [1 ,j ] ; }

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 27

} w h ile ( )

Page 28: Chapter 5 -CFD

N P UN P U

5.8 Adaptive Gridp

Classic method Classic method

Adaptation according to gradient of flowto gradient of flow variable

Modern method:

Adaptation based on adjoint method

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 28

Page 29: Chapter 5 -CFD

N P UN P U

5.9 Some Modern Developments in Grid pGeneration

Zonal grid

Chimera grid

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 29

Page 30: Chapter 5 -CFD

N P UN P U

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 30

Page 31: Chapter 5 -CFD

N P UN P U

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 31

Page 32: Chapter 5 -CFD

N P UN P U

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 32

Page 33: Chapter 5 -CFD

N P UN P U

CFD f P llCFD f P llCFD for PropellerCFD for Propeller

Cal. points

Hole points

Hole boundary

Artificial outer boundaryboundary

Physical boundary

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 33

Page 34: Chapter 5 -CFD

N P UN P U

CFD f P llCFD f P llCFD for PropellerCFD for PropellerPros 1:suited

for multiplefor multiple blades

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 34

Page 35: Chapter 5 -CFD

N P UN P U

CFD f P llCFD f P llCFD for PropellerCFD for Propeller

Pros 2:blade grid is relatively statics to the intermodal grid

Pros3:the hole pointsPros3:the hole points and hole boundary

don’t change

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 35

Page 36: Chapter 5 -CFD

N P UN P U

5.10 Some Modern Developments in Finite-volume pMesh Generation: Unstructured Meshes and a Return to Cartesian Meshes

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 36

Page 37: Chapter 5 -CFD

N P UN P U

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 37

Page 38: Chapter 5 -CFD

N P UN P U

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 38

Page 39: Chapter 5 -CFD

N P UN P U

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 39

Page 40: Chapter 5 -CFD

N P UN P U

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 40

Page 41: Chapter 5 -CFD

N P UN P U

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 41

Page 42: Chapter 5 -CFD

N P UN P U

5.11 Summaryy

Grid transformation; strong conservative form of governing Grid transformation; strong conservative form of governing equation in computational plane.

Structured grid generation by solving partial differential Structured grid generation by solving partial differential equation; stretched grid; adaptive grid; zonal grid; chimera gridg

Unstructured mesh; Cartesian mesh

Future trend? Meshless? Hybrid grid?

National Key Laboratory of Science and Technology on Aerodynamic Design and Research School of Aeronautics2012/5/3 42