0% found this document useful (0 votes)
26 views

Intro To Computational Fluid Dynamics: Brandon Lloyd COMP 259 April 16, 2003

This document discusses numerical methods for solving the Navier-Stokes equations governing fluid flow. It covers derivation of the equations, basic approaches like finite differences and semi-Lagrangian methods, ensuring the velocity field is divergence-free through projection and pressure correction methods, and tracking the free surface. Boundary conditions and staggered grids are also addressed.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Intro To Computational Fluid Dynamics: Brandon Lloyd COMP 259 April 16, 2003

This document discusses numerical methods for solving the Navier-Stokes equations governing fluid flow. It covers derivation of the equations, basic approaches like finite differences and semi-Lagrangian methods, ensuring the velocity field is divergence-free through projection and pressure correction methods, and tracking the free surface. Boundary conditions and staggered grids are also addressed.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 32

The UNIVERSITY of NORTH CAROLINA at CHAPEL

HILL
Brandon Ll oyd
COMP 259
Apri l 16, 2003
Image courtesy of Prof. A. Davidhazy at RIT. Used without permission.

2
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Understandi ng the Navi er-Stokes
equati ons
- Deri vati on (fol l owi ng [Gri ebel 1998])
- Intui ti on
Sol vi ng the Navi er-Stokes equati ons
- Basi c approaches
- Boundary condi ti ons
Tracki ng the free surface

3
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Operators
- gradi ent
di v - di vergence

2
- Lapl aci an
- Hand wavi ng / Lengthy
math compressi on
y
u
x
u
u u



div

y
u
x
u
u

,
_


y
u
x
u
u


4
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
x d t x u f f
t
x d t x f
dt
d
t t


) , ( ) div( ) , (

'

) , ( ) , ( t c
t
t x u

) , ( t c x

) , ( t c


5
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
density is ; ) , ( ) , ( mass





t
x d t x x d x

) , ( ) div( ) , (

'



x d t x u
t
x d t x
dt
d
t t


) div( +

u
t


Transport theorem
div u

Integrand vanishes

is constant
for incompressible
fluids
Continuity equation

6
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL

t
x d t x u t x

) , ( ) , ( momentum

forces acting momentum in change

t
x d t x f t x

) , ( ) , ( : forces body


t
ds n t x

) , ( : forces surface


+
t t t
ds n t x x d t x f t x x d t x u t x
dt
d


) , ( ) , ( ) , ( ) , ( ) , (
normal : tensor stress : n


7
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
div div ) ( ) )( ( ) ( + + g u u u u u
dt
d

Transport theorem Divergence
theorem
f u p u u
dt
u d

+ +

) (

Momentum equation



+
t t t
ds n t x x d t x f t x x d t x u t x
dt
d


) , ( ) , ( ) , ( ) , ( ) , (

8
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
f u p u u
dt
u d
u

+ +

) (

convection viscosity
external
forces
pressure

9
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Basi c Approach
1. Create a tentati ve vel oci ty
fi el d.
a. Fi ni te di fferences
b. Semi -Lagrangi an method (Stabl e Fl ui ds
[Stam 1999])
2. Ensure that the vel oci ty fi el d
i s di vergence free:
a. Adjust pressure and update vel oci ti es
b. Projecti on method

10
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Fi ni te di fferences mechani cal
transl ati on of equati ons.
n


11
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Li mi ts on ti me step
CFL condi ti ons don t move
more than a si ngl e cel l i n one
ti me step
Di ffusi on term
y t v x t u < <
max max
,

,
_

<
y x
t

12
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Stabl e Fl ui ds Method
1. Add forces:
2. Advecti on
3. Di ffusi on
) ( ) ( ) (
~

x f t x u x u


+

13
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Advecti on
Fi ni te di fferences i s unstabl e for l arge t.
Sol uti on: trace vel oci ti es back i n ti me. Guarantees
that the vel oci ti es wi l l never bl ow up.
)) , ( (
~
) (
~

t x p u x u


14
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Di ffusi on
Di screti zi ng the vi scosi ty term spreads vel oci ty
among i mmedi ate nei ghbors. Unstabl e when ti me
step too smal l , gri d spaci ng too l arge, or vi scosi ty
i s hi gh.
Sol uti on: Instead of usi ng an expl i ci t ti me step use
an i mpl i ci t one.
Thi s l eads to a l arge but sparse l i near system.
) (
~
) (
~
) (

x u x u t

I

15
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
The tentati ve vel oci ty fi el d i s not necessari l y
di vergence free and thus does not sati sfy
the conti nui ty equati on.
Three methods for sati sfyi ng the conti nui ty
equati on:
1. Expl i ci tl y sati sfy the conti nui ty equati on by
i terati vel y adj usti ng the pressures and vel oci ti es i n
each cel l .
2. Fi nd a pressure correcti on term that wi l l make the
vel oci ty fi el d di vergence free.
3. Proj ect the vel oci ti es onto thei r di vergence free
part.

16
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Si nce we have not yet added the pressure term, we
can use pressure to ensure that the vel oci ti es
are di vergence free.
u>0 i ncreased pressure and subsequent outfl ux
u<0 decreased pressure and subsequent i nfl ux
Rel axati on al gori thm
1. Correct the pressure i n a cel l
2. Update vel oci ti es
3. Repeat for al l cel l s unti l each has u<

17
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Another approach i nvol ves sol vi ng for a pressure
correcti on term over the whol e fi el d such that the
vel oci ti es wi l l be di vergence free and then update
the vel oci ti es at the end.
) (
) ( ) (

~
+
+

n
n n
p
t
u u
dt
u d


) ( ) ( ) (
~
+ +


n n n
p
t
u u

~
) ( ) ( ) (


+ + n n n
p
t
u u

Discretize in time
Rearrange terms
Satisfy continuity eq.

18
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
We end up wi th the Poi sson equati on for pressure.
Thi s i s another sparse l i near system. These types of
equati ons can be sol ved usi ng i terati ve methods.
Use pressures to update fi nal vel oci ti es.
) ( ) (
~
n n
u
t
p


+

) ( ) ( ) (
~
+ +


n n n
p
t
u u


19
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
The Hel mhol tz-Hodge Decomposi ti on Theorem states
that any vector fi el d can be decomposed as:
where u i s di vergence free and q i s a scal ar fi el d
defi ned i mpl i ci tl y as:
We can defi ne an operator P that proj ects a vector
fi el d onto i ts di vergence free part:

q u w +

q w

q w w u


20
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Appl yi ng P to both si des of the momentum equati on
yi el ds a si ngl e equati on onl y i n terms of u:
Thus for the l ast step :
Look fami l i ar? The scal ar fi el d q i s actual l y rel ated to
pressure!
q u u q u
~

~


) ) ( P(

f u u u
dt
u d

+ +
) ( ) ( ) (
~
+ +


n n n
p
t
u u

) ( ) (
~
n n
u
t
p


+


21
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Al l three methods are equi val ent!

22
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
No sl i p: Set vel oci ty to 0 on the boundary.
Good for obstacl es.
Free sl i p: Set onl y the vel oci ty i n the
di recti on normal to the boundary to zero.
Good for setti ng up a pl ane of symmetry.
Infl ow: Speci fi ed posi ti ve normal vel oci ty.
Good for sources.
Outfl ow: Speci fi ed negati ve normal
vel oci ty. Good for si nks.
Peri odi c: Copy the l ast row and col umn of
cel l s to fi rst row and col umn. Good for
si mul ati ng an i nfi ni te domai n.

23
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
The staggered gri d provi des
vel oci ti es i mmedi atel y at cel l
boundari es, i s conveni ent for
fi ni te di fferences, and avoi ds
osci l l ati ons.
Consi der probl em of a 2D fl ui d at
rest wi th no external forces. The
conti nuous sol uti on i s:
On a di screti zed non-staggered gri d
you can have:
j i
p
, j i
p
, + j i
p
,
, + j i
p
, j i
p

, + j i
v

, j i
v
j i
u
,

j i
u
,

+
constant p v u
odd for even, for

,
, ,
j i P j i P p
v u
j i
j i j i
+ +


24
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
The movement of the free surface i s
not expl i ci t i n the Navi er-Stokes
equati ons.
Three methods for tracki ng the free
surface:
1. Marker and cel l (MAC) method
2. Front tracki ng
3. Parti cl e l evel set method

25
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Due to [Harl ow and Wel ch 1965].
Track massl ess marker parti cl es to determi ne
where the free surface i s l ocated.
Markers are transported accordi ng to the
vel oci ty fi el d.
Cel l s wi th markers are fl ui d cel l s. Fl ui d cel l s
borderi ng empty cel l s are surface cel l s.
There are boundary condi ti ons that must be
sati sfi ed at the surface.
Extended by [Chen et al . 1997] to track
parti cl es onl y near the surface.

26
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Probl ems:
Can l ead to mass di ssi pati on, especi al l y wi th stabl e
fl ui d styl e advecti on.
No strai ght forward way to extract a smooth
surface.
Image from [Griebel 1998].

27
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Proposed by [Foster and Fedki w 2001]
Front tracki ng uses a combi nati on of a l evel set and
parti cl es to track the surface.
The parti cl es are used to defi ne an i mpl i ci t functi on.
An i socontour of thi s functi on represents the l i qui d
surface.
The i socontour yi el ds a smoother surface than
parti cl es al one.

28
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Usi ng the l evel set method, the i socontour
can be evol ved di rectl y over ti me by usi ng
the fl ui d vel oci ti es.
Parti cl es and l evel set evol uti on have
compl ementary strengths and weaknesses
- Level set evol uti on suffers vol ume l oss
- Parti cl es can cause vi sual arti facts
- Level sets are al ways smooth.
- Parti cl es retai n detai l s.

29
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Combi ne the two techni ques by gi vi ng parti cl es more
wei ght i n areas of hi gh curvature. Parti cl es
escapi ng the l evel set are rendered di rectl y as
spl ashi ng dropl ets.

30
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Presented by [Enri ght et al
2002].
Impl i ci t surface l oses
detai l on coarse gri ds.
Parti cl es keep the surface
from crossi ng them but
can t keep i t from
dri fti ng away.
Add parti cl es to both si de
of the i mpl i ci t surface.
Escaped parti cl es i ndi cate
the l ocati on of errors i n
the i mpl i ci t surface so i t
can be rebui l t.

31
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
Extrapol ated vel oci ti es at the surface gi ve
more real i sti c moti on.

32
The UNIVERSITY of NORTH CAROLINA at CHAPEL
HILL
CHEN, J., AND LOBO, N. 1994. Toward interactive-rate simulation of fluids with
moving obstacles using the navier-stokes equations. Computer Graphics and Image
Processing, 107116.
CHEN, S., JOHNSON, D., RAAD, P. AND FADDA, D. 1997. The surface marker
and micro cell method. International Journal of Numerical Methods in Fluids, 25, 749-
778.
FOSTER, N., AND METAXAS, D. 1996. Realistic animation of liquids. Graphical
Models and Image Processing, 471483.
FOSTER, N., AND FEDKIW, R. 2001. Practical animation of liquids. In Proceedings of
SIGGRAPH 2001, 2330.
GRIEBEL, M., DORNSEIFER, T., AND NEUNHOEFFER, T. 1998. Numerical
Simulation in Fluid Dynamics: A Practical Introduction. SIAM Monographs on
Mathematical Modeling and Computation. SIAM
KASS, M., AND MILLER, G. 1990. Rapid, stable fluid dynamics for computer graphics.
In Computer Graphics (Proceedings of SIGGRAPH 90), vol. 24, 4957.
O BRIEN, J., AND HODGINS, J. 1995. Dynamic simulation of splashing fluids. In
Proceedings of Computer Animation 95, 198205.
STAM, J. 1999. Stable fluids. In Proceedings of SIGGRAPH 99, 121-128.

You might also like