Discretization Methods

Preview:

DESCRIPTION

CFD- Discretization Methods

Citation preview

Computational Fluid DynamicsII. Basic Discretization Methods

C.-D. Munz

Universität Stuttgart, Institut für Aerodynamik und Gasdynamik

Pfaffenwaldring 21, 70550 StuttgartTel. +49-711/685-63401 (Sekr.)

Fax +49-711/685-63438 e-mail munz@iag.uni-stuttgart.de

ContentsI. Equations

II. Basic Discretization Methods1. Finite Difference Schemes2. Finite Volume Schemes3. Finite Element Schemes4. Grids – Discretization in Space

III. Numerical Gasdynamics and Finite VolumeSchemes

VI. Numerical Solution of Incompressible and WeaklyCompressibleFluid Flow

1. Finite Difference (FD) Schemes

∆x

u(x)∆x)u(xlim(x)u

0∆x

−+=′→

1. Step: Discretize computational domain (Grid)

2. Step: Choose finite differences and replacederivatives by finite differences

3. Step: Order the difference equations

4. Step: Solve the system of difference equations

Basic idea:

Replace derivatives by difference quotients

PDE,ODE System of algebraic equations

PDE: partial differential equation, ODE: ordinary differential equation

Finite DifferencesTaylor expansions

(1)

(2)

( ) ( ) ( ) ( ) ( ) K−+′′′∆−′′∆+′∆−=− i

3

i

2

ii1i xu6

xxu

2

xxuxxuxu

( ) ( ) ( ) ( ) ( ) K+′′′∆+′′∆+′∆+=+ i

3

i

2

ii1i xu6

xxu

2

xxuxxuxu

Difference quotient for derivative: (2) – (1)

( ) ( ) ( ) ( ) ( )5i

3

i1i1i xOxu6

x2xux2xuxu ∆+′′′∆+′∆=− −+

( ) ( ) ( ) ( )2i

1i1i xOxux2

xuxu ∆+′=∆− −+

( ) ( ) ( ) ( )xOxux

xuxui

i1i ∆+′=∆

−+

( ) ( ) ( ) ( )xOxux

xuxui

1ii ∆+′=∆− −

central difference 2nd order

right-sided difference 1st order

left-sided difference 1st order

Finite difference for 2nd derivative: (1) + (2) + 2y(xi)

( ) ( ) ( ) ( ) ( )2i2

1ii1i hOxuh

xux2uxu +′′=+−⇒ −+

( ) ( ) ( ) ( ) ( )( ) ( )2i

IV4

i2

1ii1i hOxu12

hxuhxux2uxu ++′′=+− −+

central difference quotient, 2nd order.

•Finite differences of higher order need more than 3 points

Taylor expansion gives consistency = guarantee of approximation – assumption: u smooth enough

Conclusion Finite Differences

– Approximate values are values at grid points– Simple coding also for complicated equations– Multidimensional extension is straightforward on Cartesian

grids– Extension to structured grids– Solution has to be smooth enough and can be approximated

by a smooth approximation

u

x

2. Finite Volume (FV) Schemes

( ) [ ]T,0Din 0ufut ×=⋅∇+

smooth piecewise Cboundary

kjfür CC ,CD

j

kjjj

≠Φ=∩=U

iCDiscretization of space

Grid

Numerical scheme for conservation equations

( )( ) dt dS nt,xufuCuC1n

n j

t

t C

njj

1njj ∫ ∫

+

+ ⋅−=r

[ ]1nnj t,tCover n Integratio +×

Evolution equations for integral mean values

Direct approximation of the integral conservation law

Basic Basic Basic Basic partspartspartsparts:1. Discretization in space (quite general grids) 2. Reconstruction of local values3. Appropriate approximation of the flux, numerical flux

Finite Volume Scheme in One Space Dimension

∫ ∫∫ ∫+ +

+ +

=+1n

n

1/2i

1/2i

1n

n

1/2i

1/2i

t

t

x

x

x

t

t

x

x

t 0dxdtt))f(u(x, t)dx (x,u

( ) 0ufu xt =+

Conservation equation t

1−ix ix 1+ix

1nt +

nt

x

t

2/1ix − 2/1ix +ixIntegration over [xi-1/2,xi+1/2]x[tn,tn+1]:

∫∫++

=+ −++

1n

n

1/2i

1/2i

t

t

1/2i1/2i

x

x

n1n 0t))dt,f(u(x-t)),f(u(x )dx tu(x,-)tu(x,

)g - (g ∆x

∆tuu n

1/2-in

1/2ini

1ni +

+ −=flux numerical called is g 1/2i+

Conclusions Finite Volume Schemes

• Approximation of integral values• Consistent with integral conservation• No continuity assumption– approximation of the integral

conservation law• Flux calculation is the basic building block based on

local wave propagation - Shock-capturing possible• Reconstruction to get local data• general grids• stable approximation of

underresolved phenomena

u

x

3. Finite Element (FE) Schemes

Approximation is a function – usually continuous

∑=

=N

1iiih (x)φ(t)c t)(x,u

basis functionsDOF

The DOFs are determined in such a way that the trialfunction becomes a good approximation

Discretization in function space

here, for time dependent problems

DOF = degrees of freedom (time dependent)

trial function

Often Used Basis FunctionsBasis functions are defined to be local, e.g.,

nodal basis: DOF are values at some points of the grid cell

hat functions

modal basis: Coefficients of polynomials

=(x)φ i

i1ii xxxfür)x(xh

11 <<−+ −

1iii xxxfür)x(xh

11 +<<−−

otherwise0

Approximate Solution (Piecewise Linear)

Calculation of DOFs

Method of RitzThe problem may be formulated as a variational problem, too. Solve the variational problem for the trial function

CollocationThe approximate solution solves the problemat some points exactly:

Number of points = number of DOFsMethod of weighted residuals: Trial function

is inserted, DOFs are determined to minimizethe residual with respect to

Galerkin method: OrthogonalityLeast squares method: Least sqare deviation

Calculation of DOFs

Method of RitzThe problem may be formulated as a variational problem, too. Solve the variational problem for the trial function

CollocationThe approximate solution solves the problemat some points exactly:

Number of points = number of DOFsMethod of weighted residuals: Trial function

is inserted, DOFs are determined to minimizethe residual with respect to

Galerkin method: OrthogonalityLeast squares method: Least sqare deviation

Conclusion Finite Elements

- Data as degrees of freedomof a trial function

- Difficult coding- General grids- Problems at strong gradients- Continuous solutions and

approximations

u

Very recent approach: Discontinuous Galerkin schemesfor future aerodynamic codes ?

4. Grids – Discretization in Space• The use of the grid may be different for different discretizaiton

methods

Finite differences

grid points withapproximate values

Finite volumes

Grid cells withapproximate

integral means

Finite elements

Support of trialfunction

∑ φn

1iia

Cartesian Grids

• Simple generation• Good data management• Adaptation difficult• Limited to simple geometries• Curved boundary treatment on Cartesian

meshes possible, but difficult

equidistant non equidistant

Transformation of the equations from physical to logical space

( ) ( ):ξr)r

uxu → 2,1 with ˆ2

2

1

1 =∂∂

∂∂+

∂∂

∂∂=

∂∂

mux

xu

x

xu

mmm ξξξ

2m

2

1m

1

m xxx ξ∂∂

∂ξ∂+

ξ∂∂

∂ξ∂=

∂∂

Derivatives:

Example continuity equation:

( )

( ) ( )0

ˆˆˆˆˆ

0

2

1 2

2

1

1

2

1

=

∂∂

∂∂+

∂∂

∂∂+

∂∂

=∂

∂+∂∂

=

=

m

m

m

m

m

m m

m

u

x

u

xt

x

u

t

ξρξ

ξρξρ

ρρ

Boundary-fitted Structured GridsRequirement: Bijective transformation to a Cartesian grid

),()x,x(:T 2121 ξξ→

Function:

physical coordinates logical coordinates

Boundary-fitted Structured Grid (H-Grid)

Transformation to a Cartesian grid

η

ξ

y

x

a b c d a b c d

η

ξ

y

x

e a = a‘c b = b‘

d

f

fd e

a‘a cb b‘

Boundary-fitted Structured Grid (C-Grid)

η

ξ

y

x

d a = a‘b c = c‘

c‘c d

a‘a b

Boundary-fitted Structured Grid (O-Grid)

Unstructured Grids

• Best approach for complex geometries• Usual triangles and quadrilaterals in 2D or tetrahedrons

and hexahedrons in 3D

Dual Grid

Grid cell edges of the dual grid cell isdefined by the lines betweenbarycenters and midpoints of edges of the primal grid

e.g., implemented in Tau-Code of DLRAirbus code for unstructured grids

flow direction

fan

spinner

Noise calculation of the inlet of turbo engine by solvingthe linearized Euler equations

mean flow given by RANS simulation

Source terms are given by LES

Cooperation withF. Thiele, Berlin

Numerical Results

Block-Structured Chimera-TypeFinite Difference (FD) Mesh

(5,469,928 points / DOF)Mesh generation time: days

Fully Unstructured TetrahedralDiscontinuous Galerkin (DG) Mesh(123,304 elements – 2,466,080 DOF)

Mesh generation time: 55 s.

FD results ( 6.0 CPUh / ms ) DG results ( 2.2 CPUh / ms )

Numerical Methods on Unstructered Grids

• Methods for unstructered grids:– Finite volumes

– Finite elements• The data management needs much more

overhead: Information about neighbors, edges, ..• Adaptation technically simple

Fluid Flow around a Sphere

Flexibility of Discontinuous Galerkin Schemes

our calculations

Literatur - Grundlagen

• C.-D. Munz, T. Westermann: Numerische Behandlung von gewöhnlichen und partiellen Differenzial-gleichungen, Springer-Verlag 2009, auch als e-bookohne CD erhältlich

• C.Hirsch: Numerical Computation of Internal and External Flows, 2nd edition, Elsevier John Wiley and Sons 2007

• K. A. Hoffmann, S. T. Chiang: Computational FluidDynamics for Engineers, Vol. I

Recommended