Anda di halaman 1dari 42

Part II: Basics of Numerics Part II: Basics of Numerics

Presented by Zhonghua Han Presented by Zhonghua Han


E-mail: hanzh@nwpu.edu.cn
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
N P U N P U
P t II B i f th N i Part 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 Aeronautics
2012/5/3 2
# Lecture 5Grid Transformation & # Lecture 5Grid Transformation &
Generation
Presented by Zhonghua Han Presented by Zhonghua Han
E-mail: hanzh@nwpu.edu.cn
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
N P U N P U
Q ti ? Questions?
1) Why do we need to generation grid for numerical 1) Why do we need to generation grid for numerical
solution of governing equations?
2) H id? Wh h i f i 2) How to generate a grid? What are the requirements for generating
a grid.
Take the grid generation for an airfoil as an example Take the grid generation for an airfoil as an example.
Structured: rectangular/hexahedral
Unstructured: triangular/tetrahedral /prism/solar Unstructured: triangular/tetrahedral /prism/solar
Cartesian:
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 Aeronautics
2012/5/3 4
Robustness; efficiency; accuracy
N P U N P U
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 5
N P U N P U
Ch t 5 G id G ti d T f ti Chapter 5 : Grid Generation and Transformation
5 1 I t d ti 5.1 Introduction
Grid generation: The numerical solution of governing
equation needs discrete grid points , which lend them to
id ti t h i grid 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 Aeronautics
2012/5/3 6
N P U N 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 flow condition for determination of the flow.
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 7
Fig.5.1 An airfoil in a purely rectangular grid
N P U N P U
Physical plane
Grid
Transformation
Computational plane
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 8
N P U N 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 ith airfoil 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 fashion plane 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 Aeronautics
2012/5/3 9
N P U N P U
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 10
5.3
N P U N P U
5 2 General Transformation of the Equations 5.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 ( )
t q , ,
(5 1b) ) (
(5.1a) ) , , (
t
t y x =
(5.1c) ) (
(5.1b) ) , , (
t
t y x
t t
q q
=
=
Equations5.1a) to (5.1c) represents the transformation. This is
i f f t f ti f t l li ti th a 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 Aeronautics
2012/5/3 11
relation or sometime a specific numerical relation.
N P U N P U
Transformation of 1
st
order partial derivatives Transformation of 1 order partial derivatives
c c c c c c c
t y t y t y t y
x x x x
, , , , , , ,
) ( ) ( ) ( ) ( ) ( ) ( ) (
c
c
c
c
+
c
c
c
c
+
c
c
c
c
=
c
c t
t
q
q

q t t q
) )( ( ) )( (
c c
+
c c
=
c q
5.2
) )( ( ) )( (
x x x c c
+
c c c q
) )( ( ) )( (
y y y c
c
c
c
+
c
c
c
c
=
c
c q
q

(5.3)
) )( ( ) )( ( ) )( (
dt
d
t t t
t q
c
c
+
c
c
c
c
+
c
c
c
c
=
c
c
(5.5)
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 12
dt t t t t q c c c c c c
( )
N P U N P U
Transformation of 2nd order partial derivatives
) )( ( ) )( ( ) )( (
2
2
2
2
2
2
2
2
2
x x x x c
c
c
c
+
c
c
c
c
+
c
c
c
c
=
c
c

q
q

(5.9)
) )( )( ( 2 ) )( (
2
2
2
2
x x x
x x x x
c
c
c
c
c c
c
+
c
c
c
c
+
c c c c c c c
q
q
q
q
q (5.9)
) )( ( ) )( ( ) )( (
2
2
2
2
2
2
2
2
2
c
c
c
c
+
c
c
c
c
+
c
c
c
c
=
c
c

q
(5 13)
) )( )( ( 2 ) )( (
) )( ( ) )( ( ) )( (
2
2
2
2
2 2 2 2
y y y
y y y y
c
c
c
c
c c
c
+
c
c
c
c
+
c c c c c c c
q
q
q
q
q (5.13)
y y y q q
c c c c c c c c
2 2 2 2
q
(
(

c c
+
c c c
+
c c c
+
c
c
c
c
c
c
+
c c
c
c
c
+
c c
c
c
c
=
c c
c
) )( ( ) )( ( ) ( ) )( )( (
) )( )( ( ) )( ( ) )( (
2 2
2
y x y x y x y x
q q q q

q
q

(5.15)
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 13
(

c c
+
c c c c
+
c c c
+ ) )( ( ) )( ( ) ( ) )( )( (
2
y x y x y x q q
N P U N P U
Example 5.1 Laplaces equation Example 5.1 Laplace s equation
0
2
2
2
2
=
c
c
+
c
c
y x
| |
( ) ( ) ( ) ( )
q q ( ( c c c c c c
+ + +
( (
2 2
2 2 2 2
( ) ( ) ( ) ( )
x y x y q
q q
+ + +
( (
c c c c c c

( c c c c c
2 2
2
2 ( )( ) ( )( )
x x y y
q q
q
q q
( c c c c c
+ +
(
c c c c c c

(
c c c c c c
2 2 2 2
2
(

x y x
q q
q
(
c c c c c c
+ + + +
(
c c c c c c

2 2 2
y
(
=
(

2
0
(5 17)
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 14
(5.17)
N P U N P U
5 3 Metrics and Jacobins 5.3 Metrics and Jacobins
(5 18a) ) ( t q x x =
(5 18c) ) (
(5.18b) ) , , (
(5.18a) ) , , (
t
t q
t q
t t
y y
x x
=
=
(5.18c) ) (t t t =
( )( ) ( )( )
y y ( c c c c c
=
(
1
5 24a ( )( ) ( )( )
x J q q
=
(
c c c c c

( c c c c c 1
5.24a
( )( ) ( )( )
x x
y J q q
( c c c c c
=
(
c c c c c

1
c c
5.24b

q
c c
c
c
c
c
=
c
c

y x
y x
y x
J
) (
) , (
5.22a
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 15
q q
q
c
c
c
c
c
y x
) , (
N P U N P U
5 4 Formof the Governing Equation Particularly Suited 5.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
c c c G F U
(5.37) 0 =
c
c
+
c
c
+
c
c
y
G
x
F
t
U
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 c c c
+ + =
1 1 1
0
transformed form such that
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 16
( )
t q c c c
N P U N P U
The answer is: yes.
(5.47) 0
1 1 1
=
c
+
c
+
c G F U
( )
c c c q t
Where
= JU U
1
q q

c
c

c
c
=
c
c
+
c
c
=
x
G
y
F
y
JG
x
JF F
1

q q
c
c
+
c
c
=
c
c
+
c
c
=
x
G
y
F
y
JG
x
JF G
1
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 17
N P U N P U
5.5 A Comment
The transformation is required by finite-difference
th d hi h d th if id method, 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 place non-uniform mesh in the physical place.
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 18
N P U N P U
5.7 Boundary-fitted Coordinate System: Elliptic
G id G ti Grid Generation
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 19
N P U N P U
Assume that the transformation is defined by an elliptic Assume that the transformation is defined by an elliptic
partial differential equation
0

=
c
c
+
c
c
y x

2
2
2
2
(5.67)
0
2
2
2
2
=
c
c
+
c
c
c c
y x
y x
q q
(5.68)
0 2
2
2 2
2
2
=
c
c
+
c c
c

c
c
q

q
|

o
x x x
c c y x
c
c c
c q
q

0 2
2
2 2
2
2
=
c
+
c c
c

| o
y y y
2 2 2 2

| o y x y y x x y x + = + = + =
2 2
c
c c
c q

q
|

National Key Laboratory of Science and Technology


on Aerodynamic Design and Research School of Aeronautics
2012/5/3 20
, ,
q q q q
| o y x y y x x y x + = + = + =
N P U N P U
Assignment (3): Elliptic Grid Generation Assignment (3): Elliptic Grid Generation
Problem description: Generate O-type grid
around a NACA0012 airfoil by solving around a NACA 0012 airfoil by solving
Laplace equation; write a report to described
your algorithm and results; show me your y g y
ability 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 l any other advanced computer language;
input and output files should be used for the
input parameters and the output grid; p p p g
Simply coping code for others will be
regarded as cheating !
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 21
N P U N P U
The surface coordinates of NACA 0012can be obtained
by following equation
4 3 2
0 6 0 0 0 28 3 0 3 6 0 22 0 2969
by following equation
,
. [ . . . . . ]
u l
y x x x x x = + +
4 3 2
0 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 Aeronautics
2012/5/3 22
N P U N P U
Solving procedure Solving 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 as the x coordinate can be distributed as
) cos 1 (
2
u + =
c
x
u
] 2 , 0 [ t u e
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 23
N P U N P U
2Initialize the grid points
) 0 (
,
) 0 (
,
,
j i j i
y x
3Set up an iteration scheme and update the grid points
according to the different equation until the solutions according to the different equation until the solutions
converge. Please pay attention to the boundary
conditions.
c <
+
) ( ) 1 (
) (
,
) 1 (
,
max
n
j i
n
j i
x x
c <
+ ) (
,
) 1 (
,
max
n
j i
n
j i
y y
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 24
N P U N P U
Difference equations
4
2
) (
2
1 , 1 1 , 1 1 , 1 1 , 1
2
, 1 , , 1
A A
+

A
+
+ + + + +
q
|

o
j i j i j i j i j i j i j i
x x x x x x x
q
0
) (
2
4
) (
2
1 , , 1 ,
=
A
+
+
A A
A
+ +
q

j i j i j i
x x x
) (Aq
4
2
) (
2
1 , 1 1 , 1 1 , 1 1 , 1
2
, 1 , , 1
A A
+

A
+
+ + + + +
q
|

o
j i j i j i j i j i j i j i
y y y y y y y
0
) (
2
4
) (
2
1 , , 1 ,
=
A
+
+
A A
A
+ +
q

j i j i j i
y y y
) ( q
where
2
1 , 1 ,
2
1 , 1 ,
2 2
)
2
( )
2
(
q q
q q
o
y y x x
y x
j i j i j i j i
A

+
A

= + =
+ +
2 2
2 2
q q

|
q q
y x
y y x x
+
+ =
A A

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

y x + =
N P U N P U
Iteration scheme
) ( ) ( [
2
1
1 , 1 , , 1 , 1 ,
|
o + + + =
+ + + j i j i j i j i j i
x x x x x
) /( )] (
2
1 , 1 1 , 1 1 , 1 1 , 1
o
|
+ +
+ + + + j i j i j i j i
x x x x
A powerful technique or numerical solution of elliptic equation:
( ) ( ) ( ) ( )
, , , ,
( )
n n n n
i j i j i j i j
x x x x e
+ +
= +
1 1
e < < 1 2
1
Successive overrelaxation
d l i
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 26
e < 1 underrelaxation
N P U N 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
{
f o r ( j = 1 ; j < n j -1 ; j + + )
{
f o 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 Aeronautics
2012/5/3 27
} w h i le ( )
N P U N P U
5.8 Adaptive Grid p
Classic method Classic method
Adaptation according
to gradient of flow to 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 Aeronautics
2012/5/3 28
N P U N P U
5.9 Some Modern Developments in Grid p
Generation
Zonal grid
Chimera grid
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 29
N P U N P U
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 30
N P U N P U
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 31
N P U N P U
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 32
N P U N P U
CFD f P ll CFD f P ll CFD for Propeller CFD for Propeller
Cal. points
Hole points
Hole boundary
Artificial outer
boundary boundary
Physical boundary
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 33
N P U N P U
CFD f P ll CFD f P ll CFD for Propeller CFD for Propeller
Pros 1suited
for multiple for multiple
blades
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 34
N P U N P U
CFD f P ll CFD f P ll CFD for Propeller CFD for Propeller
Pros 2blade grid is
relatively statics to
the intermodal grid
Pros3the hole points Pros3the hole points
and hole boundary
dont change
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 35
N P U N P U
5.10 Some Modern Developments in Finite-volume p
Mesh Generation: Unstructured Meshes and
a Return to Cartesian Meshes
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 36
N P U N P U
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 37
N P U N P U
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 38
N P U N P U
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 39
N P U N P U
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 40
N P U N P U
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 41
N P U N 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
grid g
Unstructured mesh; Cartesian mesh
Future trend? Meshless? Hybrid grid?
National Key Laboratory of Science and Technology
on Aerodynamic Design and Research School of Aeronautics
2012/5/3 42