9
Computational Fluid Dynamics Computational Methods for Domains with Complex Boundaries-I Grétar Tryggvason Spring 2011 http://www.nd.edu/~gtryggva/CFD-Course/ Computational Fluid Dynamics For most engineering problems it is necessary to deal with complex geometries, consisting of arbitrarily curved and oriented boundaries Computational Fluid Dynamics Overview of various strategies Boundary-fitted coordinates - Navier-Stokes equations in vorticity form - Navier-Stokes equations in primitive form Grid generation for body-fitted coordinates - Algebraic methods - Differential methods Outline How to deal with irregular domains Computational Fluid Dynamics - Staircasing - Boundary-fitted coordinates - Immersed boundary method (no grid change) - Unstructured grids: triangular or tetrahedral - Adaptive mesh refinement (AMR) Various Strategies for Complex Geometries and to concentrate grid points in specific regions Overview Computational Fluid Dynamics Staircasing Approximate a curved boundary by a the nearest grid lines Computational Fluid Dynamics Boundary-Fitted Coordinates

Computational Methods for Domains with Complex …gtryggva/CFD-Course/2011-Lecture-24.pdfComputational Fluid Dynamics! x y Boundary-Fitted Coordinates! • Coordinate mapping: transform

  • Upload
    others

  • View
    15

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Computational Methods for Domains with Complex …gtryggva/CFD-Course/2011-Lecture-24.pdfComputational Fluid Dynamics! x y Boundary-Fitted Coordinates! • Coordinate mapping: transform

Computational Fluid Dynamics

Computational Methods for Domains with !

Complex Boundaries-I!

Grétar Tryggvason!Spring 2011!

http://www.nd.edu/~gtryggva/CFD-Course/!Computational Fluid Dynamics

For most engineering problems it is necessary to deal with complex geometries, consisting of arbitrarily curved and oriented boundaries!

Computational Fluid Dynamics

•  Overview of various strategies!•  Boundary-fitted coordinates!!- Navier-Stokes equations in vorticity form!!- Navier-Stokes equations in primitive form!

•  Grid generation for body-fitted coordinates!!- Algebraic methods!!- Differential methods!

Outline!

How to deal with irregular domains!

Computational Fluid Dynamics

- Staircasing!- Boundary-fitted coordinates!- Immersed boundary method (no grid change)!- Unstructured grids: triangular or tetrahedral!- Adaptive mesh refinement (AMR)!

Various Strategies for Complex Geometries and to concentrate grid points in specific regions!

Overview!

Computational Fluid Dynamics

Staircasing!

Approximate a curved boundary by a the nearest grid lines!

Computational Fluid Dynamics

Boundary-Fitted Coordinates!

Page 2: Computational Methods for Domains with Complex …gtryggva/CFD-Course/2011-Lecture-24.pdfComputational Fluid Dynamics! x y Boundary-Fitted Coordinates! • Coordinate mapping: transform

Computational Fluid Dynamics

x

y

Boundary-Fitted Coordinates!

• Coordinate mapping: transform the domain into a simpler (usually rectangular) domain.!

• Boundaries are aligned with a constant coordinate line, thus simplifying the treatment of boundary conditions!

• The mathematical equations become more complicated!

Computational Fluid Dynamics

!

!

x

y

0=!1=!0=!

1=!2=!3=!

),(),( !"#yx

),( yx!! =),( yx!! =

),(),( !"fyxf =

Boundary-Fitted Coordinates!

Computational Fluid Dynamics

f (x) = f (x(!)) = f (!)

First consider the 1D case:!

Boundary-Fitted Coordinates!

dfdx

=dfd!

d!dx

=dfd!

dxd!

"#$

%&'

(1

For the first derivative the change of variables is straightforward using the chain rule:!

For the second derivative the derivation becomes considerably more complex:!

Computational Fluid Dynamics

The second derivative is given by!

!"" /x

Where we have used the expression for the fist derivative for the final step. However, since the equations will be discretized in the new grid system, it is important to end up!with terms like , not . !x!! /"

Boundary-Fitted Coordinates!

dfdx

=dfd!

d!dx

=dfd!

dxd!

"#$

%&'

(1

d 2 fdx2 =

ddx

dfdx

!"#

$%&=

ddx

dfd'

d'dx

!"#

$%&

!

"#$

%&=

dd'

dfd'

d'dx

!"#

$%&

!

"#$

%&d'dx

!"#

$%&

=d 2 fd'2

d'dx

!"#

$%&

2

+dfd'

!"#

$%&

d'dx

!"#

$%&

dd'

d'dx

!"#

$%&=

d 2 fd'2

d'dx

!"#

$%&

2

+dfd'

!"#

$%&

ddx

d'dx

!"#

$%&

=d 2 fd'2

d'dx

!"#

$%&

2

+dfd'

!"#

$%&

d 2'dx2

Computational Fluid Dynamics

To do so, we look at the second derivative in the new system!

Boundary-Fitted Coordinates!

dfd!

=dfdx

dxd!

d 2 fd!2 =

dd!

dfd!

"#$

%&'=

ddx

dfd!

"#$

%&'

dxd!

=ddx

dfdx

dxd!

"#$

%&'

dxd!

"#$

%&'

=d 2 fdx2

dxd!

"#$

%&'

2

+dfdx

"#$

%&'

dxd!

"#$

%&'

ddx

dxd!

=d 2 fdx2

dxd!

"#$

%&'

2

+dfdx

"#$

%&'

d 2xd!2

=d 2 fdx2

dxd!

"#$

%&'

2

+dfd!

"#$

%&'

dxd!

"#$

%&'

(1d 2xd!2

d 2 fdx2 =

d 2 fd!2

dxd!

"#$

%&'

(2

(dfd!

"#$

%&'

dxd!

"#$

%&'

(3d 2xd!2

Solving for the original derivative (which we need to transform) we get:!

Computational Fluid Dynamics

dxdx

=dxd!

d!dx

= 1

dxdξ

=dξdx

⎛⎝⎜

⎞⎠⎟

−1

dd!

dxd!

d!dx

"#$

%&'=

d 2xd!2

d!dx

+dxd!

dd!

d!dx

"#$

%&'=

d 2xd!2

d!dx

+dxd!

"#$

%&'

2d 2!dx2 = 0

dxd!

"#$

%&'

2d 2!dx2 = (

d 2xd!2

d!dx

= (d 2xd!2

dxd!

"#$

%&'

(1

d 2!dx2 = "

d 2xd!2

dxd!

#$%

&'(

"3

By the chain rule we have!

For the second derivative we differentiate the above:!

Often we need the derivatives of the transformation itself: !

Giving:!

Boundary-Fitted Coordinates!

Page 3: Computational Methods for Domains with Complex …gtryggva/CFD-Course/2011-Lecture-24.pdfComputational Fluid Dynamics! x y Boundary-Fitted Coordinates! • Coordinate mapping: transform

Computational Fluid Dynamics

),()),(),,((),( !"!"!" fyxfyxf ==Change of variables!

2D: First Derivatives!

!"" /x

The equations will be discretized in the new!grid system . Therefore, it is important to end up!with terms like , not . !

),( !"x!! /"

Boundary-Fitted Coordinates!Computational Fluid Dynamics

!!!

"""

##

##+

##

##=

##

##

##+

##

##=

##

yyfx

xff

yyfx

xff

Using the chain rule, as we did for the 1D case:!

We want to derive expressions for !in the mapped coordinate system. !

yfxf !!!! /,/

Boundary-Fitted Coordinates!

Computational Fluid Dynamics

!"!"!" ##

##

##+

##

##

##=

##

## xy

yfxx

xfxf

!"!"!" ##

##

##+

##

##

##=

##

## xy

yfxx

xfxf

Solving for the derivatives!

Subtracting!

!!"

#$$%

&''

''(

''

''

''=

''

''(

''

''

)**))**)xyxy

yfxfxf

!!!

"""

##

##+

##

##=

##

##

##+

##

##=

##

yyfx

xff

yyfx

xff

!""x

!""x

Boundary-Fitted Coordinates!Computational Fluid Dynamics

!!"

#$$%

&''

''(

''

''=

''

!!"

#$$%

&''

''(

''

''=

''

)**)

*))*

xfxfJy

f

yfyfJx

f

1

1

( )( )!""!!" ,,

##=

##

##$

##

##= yxyxyx

J

Solving for the original derivatives yields:!

where!

is the Jacobian.!

Boundary-Fitted Coordinates!

Computational Fluid Dynamics

!"!"

"!

!"!"

"!

##=

##=

##=

##=

##=

##=

##=

##=

xx

xx

yy

yy

ff

ff

yf

fxf

f yx

;;;

;;;

A short-hand notation:!

Boundary-Fitted Coordinates!Computational Fluid Dynamics

)(1

)(1

!""!

"!!"

xfxfJ

f

yfyfJ

f

y

x

#=

#=

Rewriting in short-hand notation!

!""! yxyxJ #=where!

is the Jacobian.!

Boundary-Fitted Coordinates!

Page 4: Computational Methods for Domains with Complex …gtryggva/CFD-Course/2011-Lecture-24.pdfComputational Fluid Dynamics! x y Boundary-Fitted Coordinates! • Coordinate mapping: transform

Computational Fluid Dynamics

fx =1J

fy!( )" # fy"( )!

$%&

'()

fy =1J

fx"( )!# fx!( )"$

%&'()

These relations can also be written in conservative form:!

Boundary-Fitted Coordinates!

Since:!

fx =1J

fy!( )" # fy"( )!

$%&

'() =

1J

fy!" + f"y! # fy"! # f!y"$% '( =1J

f"y! # f!y"$% '(

And similarly for the other equation!

Computational Fluid Dynamics

( ) ( )!!"

#

$$%

&'()*

+, --'

()*

+, -=

''(

)**+

,'()*

+,..-'

()*

+,..='

()*

+,..

..=

.

.

/0

/00/0/

/00/

/0

0/

yyfyfJ

yyfyfJJ

yxf

yxf

Jxf

xxf

111

12

2

The second derivatives is found by repeated application of the rules for the first derivative!

( ) ( )!!"

#

$$%

&'()*

+, --'

()*

+, -=

.

./

0/00/0

//00/ xxfxf

Jxxfxf

JJyf 1112

2

Similarly!

2D: Second Derivatives!

Boundary-Fitted Coordinates!

Computational Fluid Dynamics

!2 f!x2 =

1J

1J

f" y# $ f# y"( )%&'

()* "

y# $1J

f" y# $ f# y"( )%&'

()*#

y"

+

,--

.

/00

Adding!

!2 f!y2 =

1J

1J

f"x# $ f#x"( )%&'

()*"

x# $1J

f"x# $ f#x"( )%&'

()* #

x"+

,--

.

/00

and!

yields an expression for the Laplacian:!

2

2

2

22

yf

xf

f!!+

!!="

Boundary-Fitted Coordinates!Computational Fluid Dynamics

!2 f!x2 +

!2 f!y2 =

1J

1J

f" y# $ f# y"( )%&'

()* "

y# $1J

f" y# $ f# y"( )%&'

()*#

y"

+

,--

.

/00+

1J

1J

f#x" $ f"x#( )%&'

()*#

x" $1J

f#x" $ f"x#( )%&'

()* "

x#+

,--

.

/00

Boundary-Fitted Coordinates!

Computational Fluid Dynamics

q1 = x!2 + y!

2

q2 = x"x! + y"y!q3 = x"

2 + y"2

where!

!2 f ="2 f"x2 +

"2 f"y2 =

1J 2

""#

q1 f# $ q2 f%( ) + ""%

q3 f% $ q2 f#( )&

'(

)

*+

+1J 3 $q1J# f# + q2 J% f# + q2 J# f% $ q3J% f%&' )*

Boundary-Fitted Coordinates!Computational Fluid Dynamics

!2 f = 1J 2

q1 f"" # 2q2 f"$ + q3 f$$( ) + !2"( ) f" + !2$( ) f$

Expanding the derivatives yields!

where!

!2" = 1J 3

J x"# x# $ x## x" $ y## y" + y"# y#( ) $ q1J" + q2J#[ ]

!2" = 1J 3

J x#" x# $ x## x" $ y## y" + y#" y#( ) + q2J# $ q3J"[ ]!!"!"!"!!"!!! yxyxyxyxJ ##+=

!""!""""!"!"" yxyxyxyxJ ##+=

Boundary-Fitted Coordinates!

Page 5: Computational Methods for Domains with Complex …gtryggva/CFD-Course/2011-Lecture-24.pdfComputational Fluid Dynamics! x y Boundary-Fitted Coordinates! • Coordinate mapping: transform

Computational Fluid Dynamics

( )!""! yfyfJ

f x #= 1Derivation of!

if !

yyxx !!! +="2

!=f

!x = 1J!! y" #!" y!( ) =

y"J

hence!

!xx = !x( )x=

1J

y"J

#

$%

&

'(!

y" )y"J

#

$%

&

'("

y!

*

+

,,

-

.

//

similarly!

!yy = !y( )y=

1J

"x#J

$

%&

'

()#

x! " "x#J

$

%&

'

()!

x#*

+

,,

-

.

//

Boundary-Fitted Coordinates!Computational Fluid Dynamics

Putting them together, it can be shown that!(prove it!)!

!2" = 1J 3

q1 x# y"" $ y# x""( ) $ 2q2 x# y"# $ y# x"#( ) + q3 x# y## $ y# x##( )[ ]

!2" = 1J 3

q1 y# x## $ x# y##( ) $ 2q2 y# x#" $ x# y#"( ) + q3 y# x"" $ x# y""( )[ ]

Boundary-Fitted Coordinates!

Computational Fluid Dynamics

gy fx ! gx fy = 1Jg" f# ! g# f"( )

We also have, for any function and!f g

Boundary-Fitted Coordinates!Computational Fluid Dynamics

!

!

x

y

0=!1=!0=!

1=!2=!3=! ),( yx!! = ),( yx!! =

),(),( !"fyxf =

A complex domain can be mapped into a rectangular domain where all grid lines are straight. The equations must, however, be rewritten in the new domain. !

)(1

)(1

!""!

"!!"

xfxfJ

f

yfyfJ

f

y

x

#=

#=Thus:!

And more complex expressions for the higher derivatives!

Boundary-Fitted Coordinates!

Computational Fluid Dynamics

Vorticity-Stream Function

Formulation!

Computational Fluid Dynamics

The Navier-Stokes equations in vorticity form are:!

Using the transformation relations obtained earlier,!

!"!t

+# y" x $# x" y = %&2"

!2" = #$

Vorticity-Stream Function Formulation!

Page 6: Computational Methods for Domains with Complex …gtryggva/CFD-Course/2011-Lecture-24.pdfComputational Fluid Dynamics! x y Boundary-Fitted Coordinates! • Coordinate mapping: transform

Computational Fluid Dynamics

The Navier-Stokes equations in vorticity form become:!

!"!t

+1J

(#$"% &#%"$ ) =

' 1J 2 q1"%% & 2q2"%$ + q3"$$( ) + (2%( )"% + (2$( )"$

)*+

,-.

223

2

221

!!

"!"!

""

yxq

yyxxq

yxq

+=

+=

+=

Vorticity-Stream Function Formulation!

1J 2

q1!"" # q2!"$ + q3!$$( ) + %2"( )!" + %2$( )!$ = #&

Computational Fluid Dynamics

0=!

Boundary Conditions!!

Q=!!

Inflow!Outflow!

12

2

1

2

121 )( !!! "=="= ## dvdxudyQ

slipNo: 0,Outflow:Inflow:0

!===

MN

"##

1=!=! "#

Vorticity-Stream Function Formulation!

Computational Fluid Dynamics

HOT21)0,(1)0,()0,()1,( ++!+== "#"#"#$"# $$$

0=!

)0,()0,( 2

22

!"!# $$!!

Jyx +

%=

!(",0) = #2x"2 + y"

2

J 2$(",0) #$(",1)[ ]

Lower wall!Stream function:!Vorticity:! 0= (no-slip)!

( )0=!

Vorticity-Stream Function Formulation!

Using that!

We have:!

Computational Fluid Dynamics

Q = (udy ! vdx) =0

L" d# =0

M" #M !#0

Q=!

!(",M) = #2x"2 + y"

2

J 2$(",M) #$(",M #1)[ ]

Upper wall!Stream function:!

Vorticity:!

η = M( )

Vorticity-Stream Function Formulation!

Computational Fluid Dynamics

Inlet flow!

)(),0( yLCyyu !=

( )0=!

Considering a fully-developed parabolic profile!

3

3

0

2 6;6

)(LQCLCdyyLyCQ

L==+!= "

!=""#=yuyLy

LQyu );(6),0( 3

!!"

#

$$%

&'()*

+,-'

()*

+,=-= .

32

0

23 23)(6)(

Ly

LyQdyyyL

LQyQ

y

Vorticity-Stream Function Formulation!Computational Fluid Dynamics

Inlet flow!

( ) !"#$

%& '==

MMLQu ((() 16,0

( ) !!"

#$$%

&!"#$

%&'!

"#$

%&=

32

23,0MM

Q ((()

( ) !"#$

%& '=

MLQ (() 216,0 2

( )0=!

Considering a fully-developed parabolic profile!and assume that!

MLy !=

Vorticity-Stream Function Formulation!

Page 7: Computational Methods for Domains with Complex …gtryggva/CFD-Course/2011-Lecture-24.pdfComputational Fluid Dynamics! x y Boundary-Fitted Coordinates! • Coordinate mapping: transform

Computational Fluid Dynamics

Outflow!

!

( )N=!

Typically, assuming straight streamlines!

If is normal to the outflow boundary, this yields!

0=!!n"

0=!!"#

If not, then a proper transformation is needed for!n!

!"

Vorticity-Stream Function Formulation!Computational Fluid Dynamics

Velocity-Pressure Formulation!

Computational Fluid Dynamics

!u!t

+!uu!x

+!vu!y

= "!p!x

+ # !2u!x2

+!2u!y2

$%&

'()

!v!t

+!uv!x

+!vv!y

= "!p!y

+ # !2v!x2 +

!2v!y2

$

%&'

()

The Navier-Stokes equations in primitive form!

Velocity-Pressure Formulation!

and continuity equation!

0=!!+

!!

yv

xu

Notice that we have absorbed

the density into the pressure!

Computational Fluid Dynamics

!uu!x

+ !vu!y

= 1J

uu( )" y# $ uu( )# y" + uv( )# x" $ uv( )" x#[ ]Advection Terms!

= 1J

y!uu( )" # uuy"! # y" uu( )! + uuy"![

+ x! uv( )" # uvx!" # x"uv( )! + uvx!" ]

= 1J

u uy! " vx!( ){ }#

+ u vx# " uy#( ){ }!

$ % &

' ( )

( ) ( )!"

#$%

&''+

''= uVuU

J ()1

Velocity-Pressure Formulation!

Computational Fluid Dynamics

Contravariant Velocity!

!!"" uyvxVvxuyU #=#= ;

xu,

yv,

C=!

UV

C=!

Unit tangent vector along! C=!

x! ,y!( )

y! ,"x!( ) = n! Unit normal vector!

!!!! vxuyxyvuU "="#= ),(),(

Therefore, is in the direction.!!U!V is in the direction.!

Velocity-Pressure Formulation!Computational Fluid Dynamics

!p!x

= 1Jp" y# $ p# y"( )

Pressure Term!

Diffusion Term!

!!"

#

$$%

&'()*

+,--.'

()*

+,--='

()*

+,--

--=

--

/0

0/

yxu

yxu

Jxu

xxu 12

2

= 1J1Ju! y" # u" y!( )$

% &

' ( ) !

y" #1Ju! y" # u" y!( )$

% &

' ( ) "

y!*

+ ,

-

. /

!2u!y 2

= 1J1Ju" x# $ u# x"( )%

& '

( ) * "

x# $1Ju" x# $ u# x"( )%

& '

( ) * #

x"+

, -

.

/ 0

Velocity-Pressure Formulation!

Page 8: Computational Methods for Domains with Complex …gtryggva/CFD-Course/2011-Lecture-24.pdfComputational Fluid Dynamics! x y Boundary-Fitted Coordinates! • Coordinate mapping: transform

Computational Fluid Dynamics

!2u!x 2

+ !2u!y 2

= 1J

!!"

# $ %

1Ju" y&

2 ' u& y" y& ' u& x" x& + u" x&2( )(

) * + , -

= 1J

!!"

q1u" # q2u$( ) + !!$

q3u$ # q2u"( )%

& ' (

) *

+ !!"

1Ju" x#

2 $ u# x# x" $ u# y# y" + u" y#2( )%

& ' ( ) * + , -

223

2

221

!!

"!"!

""

yxq

yyxxq

yxq

+=

+=

+=

Velocity-Pressure Formulation!Computational Fluid Dynamics

!u!t

+ 1J

!Uu!"

+ !Vu!#

$

% &

'

( ) = * 1

J+y#

!p!"

* y"!p!#

$

% &

'

( )

+!J 2

""#

q1u# $ q2u%( ) + ""%

q3u% $ q2u#( )&

'(

)

*+

u-Momentum Equation!

!v!t

+1J

!Uv!"

+!Vv!#

$%&

'()= *

1J+

x"

!p!#

* x#!p!"

$%&

'()

+!J 2

""#

q1v# $ q2v%( ) + ""%

q3v% $ q2v#( )&

'(

)

*+

v-Momentum Equation!

U = uy! " vx! ; V = vx# " uy#( )Velocity-Pressure Formulation!

Computational Fluid Dynamics

0=!!+

!!

yv

xu

Continuity Equation!

Using!)(1),(1 !""!"!!" xfxf

Jfyfyf

Jf yx #=#=

1J(u! y" # u" y! ) + (v" x! # v! x" )[ ] = 0

Continuity equation becomes!

or!

uy! " vx!( )# + vx# " uy#( )! = 0

0=!!+

!!

"#VU

Velocity-Pressure Formulation!Computational Fluid Dynamics

The momentum equations can be rearranged to!

!!"

#$$%

&''+

''(!!"

#$$%

&''+

''+

''

)*)* ))VvUv

xVuUu

ytU

J

= ! q1

"p"#

! q2

"p"$

%&'

()*++J

y$""#

q1u# ! q2u$( ) + ""$

q3u$ ! q2u#( ),

-.

/

01

234

54

!"#$

%& +

''(!

"#$

%& +

''

!!tv

Jxtu

Jy ))

U-Momentum Equation!

!x "##$

q1v$ ! q2v"( ) + ##"

q3v" ! q2v$( )%

& ' (

) * + , -

Velocity-Pressure Formulation!

Computational Fluid Dynamics

J !V!t

+ x"!Uu!"

+ !Vu!#

$

% &

'

( ) * y"

!Uv!"

+ !Vv!#

$

% &

'

( )

= ! q3

"p"#

! q2

"p"$

%&'

()*++J

x$

""$

q1v$ ! q2v#( ) + ""#

q3v# ! q2v$( ),

-.

/

01

234

54

V-Momentum Equation!

!y"##"

q1u" ! q2u$( ) + ##$

q3u$ ! q2u"( )%

& ' (

) * + , -

where!

u = 1JUx! +Vx"( )

v = 1JVy! +Uy"( )

Velocity-Pressure Formulation!Computational Fluid Dynamics

!" #In the plane, a staggered grid system can be used.!

Same MAC grid and!projection method !can be used. !

p

C=!

UuVv

C=!

Velocity-Pressure Formulation!

Page 9: Computational Methods for Domains with Complex …gtryggva/CFD-Course/2011-Lecture-24.pdfComputational Fluid Dynamics! x y Boundary-Fitted Coordinates! • Coordinate mapping: transform

Computational Fluid Dynamics

http://www.hpc.msstate.edu/publications/gridbook/!

The “classic”!

Here we have examined the elementary aspects of representing the governing equations in a mapped coordinate system. This is a complex topics with its own “language” that needs to be mastered for further studies. !