cfd slayt friburg
TRANSCRIPT
-
8/8/2019 cfd slayt friburg
1/15
1
Computational Fluid Dynamics
An Introduction
SimulationinComputerGraphicsUniversityofFreiburg
WS04/05
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
Thisslidesetisbasedon:
n JohnD.Anderson,Jr.,ComputationalFluidDynamicsTheBasicswithApplications, McGraw-Hill,Inc.,
NewYork,ISBN0-07-001685-2
Acknowledgement
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
Motivation
D.Enright,S.Marschner,R.Fedkiw,
AnimationandRenderingof
ComplexWaterSurfaces,
Siggraph 2002,ACMTOG,
vol.21,pp.736-744,2002.
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n introduction
n pre-requisites
n governingequations
n continuityequation
n momentumequation
n summary
n solutiontechniquesn Lax-Wendroff
n MacCormack
n numericalaspects
n recentresearchingraphics
Outline
-
8/8/2019 cfd slayt friburg
2/15
2
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n physicalaspectsoffluidflowaregovernedby
threeprinciples
n massisconservedn force=mass acceleration(Newtonssecondlaw)n energyisconserved(notconsideredinthislecture)
n principlescanbedescribedwithintegralequationsorpartialdifferentialequations
n inCFD,thesegoverningequationsarereplacedby
discretized algebraicforms
n algebraicformsprovidequantitiesatdiscretepointsintimeandspace,noclosed-formanalyticalsolution
Introduction
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
NumericalSolution- Overview
GoverningEquations
DiscretizationSystem ofAlgebraicEquations
EquationSolver
Approx.Solution
Navier-StokesEuler
FiniteDifference
DiscreteNodalValues
Lax-Wendroff
MacCormack
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n x,y,z 3Dcoordinatesystem
n t time
n ( x,y,z,t ) density
n v ( x,y,z,t ) velocity
n v ( x,y,z,t )=(u ( x,y,z,t ),v ( x,y,z,t ),w ( x,y,z,t ))T
Continuous Quantities
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
Problem
v (x,y,z,t)
(x,y,z,t)
v (x,y,z,t+t) (x,y,z,t+t)
-
8/8/2019 cfd slayt friburg
3/15
3
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n introduction
n pre-requisites
n governingequationsn continuityequation
n momentumequation
n summary
n solutiontechniques
n Lax-Wendroff
n MacCormack
n numericalaspects
n recentresearchingraphics
Outline
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n infinitesimallysmallfluidelementmovingwiththeflow
n ( x1,y1,z1) positionattimet1
n ( x2,y2,z2) positionattimet2
n v1(x1,y1,z1,t1)=(u(x1,y1,z1,t1 ),v (x1,y1,z1,t1 ),w (x1,y1,z1,t1 ))T
n v2(x2,y2,z2,t2)=(u(x2,y2,z2,t2 ),v (x2,y2,z2,t2 ),w (x2,y2,z2,t2 ))T
n 1 ( x1,y1,z1,t1 )
n 2 ( x2,y2,z2,t2 )
Substantial Derivative of
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n Taylorseriesatpoint1
t2 t1
Substantial Derivative of
( ) ( ) ( ) ( )12
1
12
1
12
1
12
1
12tt
tzz
zyy
yxx
x
+
+
+
+=
112
12
112
12
112
12
112
12
+
+
+
=
ttt
zz
ztt
yy
ytt
xx
xtt
111112
12
+
+
+
=
tw
zv
yu
xtt
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n substantialderivativeof
n substantialderivative=localderivative+convectivederivative
n localderivative timerateofchangeatafixedlocation
n convectivederivative timerateofchangeduetofluidflow
n subst.derivative=totalderivativewithrespecttotime
Substantial Derivative
tzw
yv
xu
Dt
D
+
+
+
T
zyxtDt
D
=+
,,)(v
-
8/8/2019 cfd slayt friburg
4/15
4
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n divergenceofvelocityv =timerateofchangeofthe
volumeVofamovingfluidelementperunitvolume
Divergence ofv
( )Dt
VD
Vz
w
y
v
x
u
1=+
+
= v
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n introduction
n pre-requisites
n governingequationsn continuityequation
n momentumequation
n summary
n solutiontechniques
n Lax-Wendroff
n MacCormack
n numericalaspects
n recentresearchingraphics
Outline
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n massisconserved
n infinitesimallysmallfluidelementmovingwiththeflow
n fixedmassm,variablevolumeV, variabledensity
n timerateofchangeofthemassofthemovingfluid
elementiszero
Continuity Equation
Vm =
( ) 0=+==Dt
VD
Dt
DVDt
VD
Dt
mD
01 =+
Dt
VD
VDt
D
0=+ v
Dt
D
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
Continuity Equation
0=+ v
Dt
D
divergenceofvelocity-
timerateofchangeofvolume
ofamovingfluidelementper
volume
substantialderivative
timerateofchangeof
densityofamoving
fluidelement
-
8/8/2019 cfd slayt friburg
5/15
5
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n non-conservationform(considersmovingelement)
n manipulation
n conservationform(considerselementatfixedlocation)
Continuity Equation
0=+ v
Dt
D
( )vvvv
+
=++
=+ttDt
D
( ) 0=+
v
t
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n motivationforconservationform
n infinitesimallysmallelementatafixedlocation
n
massfluxthroughelementn differenceofmassinflowandoutflow=netmassflow
n netmassflow=timerateofmassincrease
Continuity Equation
( ) 0=+
v
t
netmassflow
pervolume
timerateofmass
increasepervolume
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n introduction
n pre-requisites
n governingequations
n continuityequation
n momentumequation
n summary
n
solutiontechniquesn Lax-Wendroff
n MacCormack
n numericalaspects
n recentresearchingraphics
Outline
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n consideramovingfluidelement
n physicalprinciple:F= ma (Newtonssecondlaw)n twosourcesofforces
n bodyforces
n gravity
n surfaceforces
n
basedonpressuredistributiononthesurfacen basedonshearandnormalstressdistributiononthesurface
duetodeformationofthefluidelement
normal
stress
Momentum Equation
pressurefluid
element
gravity
shear
stress
friction
velocity
velocity
-
8/8/2019 cfd slayt friburg
6/15
-
8/8/2019 cfd slayt friburg
7/15
7
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
(yx + yx /ydy)dx dz
Surface Forces in x
dxdy
dzpdy dz (p+p/xdx) dydz
xxdy dz (
xx+
xx/xdx)dy dz
yx dxdz zx notillustrated
dzdydxx
dzdydxx
pppF
xx
xx
xxx
++
+=
dzdydzz
dzdxdyy
zx
zx
zxyx
yx
yx
++
++
dzdydxzyxx
pF zx
yxxxx
+
+
+
=
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
Momentum Equation in x
dzdydxfdzdydxzyxx
p
Dt
Du
dzdydx xzxyxxx
+
+
+
+
=
xxFam =
mass acceleration
timerateofchange
ofvelocityofa
movingfluidelement
surfaceforce
pressure
normalstress
shearstress
bodyforce
gravity
xzxyxxx fzyxx
p
Dt
Du
+
+
+
+
=
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n viscousflow,non-conversationform
n Navier-Stokesequations
Momentum Equation
x
zxyxxx fzyxx
p
Dt
Du
+
+
+
+
=
y
zyyyxyf
zyxy
p
Dt
Dv
+
+
+
+
=
z
zzyzxz fzyxz
p
Dt
Dw
+
+
+
+
=
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n obtainingtheconservationformofNavier-Stokes
Momentum Equation in x
ut
u
Dt
Du += v
( )t
ut
u
t
u
+
=
( )
t
u
tu
t
u
=
( ) ( ) ( ) uuu += vvv ( ) ( ) ( )vvv = uuu
( )( ) ( )vv u
tu
t
u
Dt
Du
+
+
=
continuityequation
( )( )vu
t
u
Dt
Du
+
=
-
8/8/2019 cfd slayt friburg
8/15
8
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n Navier-Stokesequationsinconservationform
Momentum Equation
( ) ( ) xzxyxxx fzyxx
putu ++++=+
v
( )( )
y
zyyyxyf
zyxy
pv
t
v
+
+
+
+
=+
v
( )( )
z
zzyzxz fzyxz
pw
t
w
+
+
+
+
=+
v
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n Newton:shearstressinafluidisproportional
tovelocitygradients
n mostfluidscanbeassumedtobenewtonian,butbloodisapopularnon-newtonianfluid
n Stokes:
n isthemolecularviscositycoefficientn isthesecondviscositycoefficientwith =-2/3
Newtonian Fluids
( )x
uxx
+= 2v ( )
y
vyy
+= 2v ( )
z
wzz
+= 2v
+
==y
u
x
vyxxy
+
==x
w
z
uzxxz
+
==z
v
y
wzyyz
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n intermolecularforcesarenegligible
n R specificgasconstant
n T temperature
n termal equationofstate
Perfect Gas
TRp =
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n now,p canbeexpressedusingdensityand
canbeexpressedusingvelocitygradients,
fx isuser-defined(e.g.gravity)
Momentum Equation in x
( )( )
x
zxyxxx fzyxx
pu
t
u
+
+
+
+
=+
v
-
8/8/2019 cfd slayt friburg
9/15
9
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n introduction
n pre-requisites
n governingequationsn continuityequation
n momentumequation
n summary
n solutiontechniques
n Lax-Wendroff
n MacCormack
n numericalaspects
n recentresearchingraphics
Outline
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n thus,fourequationsandfourunknowns ,u,v,w
Governing Equations Viscous Compressible Flow
( )( )
x
zxyxxx fzyxx
pu
t
u
+
+
+
+
=+
v
( )( ) y
zyyyxyf
zyxy
pv
t
v
+
+
+
+
=+
v
( )( )
z
zzyzxz fzyxz
pw
t
w
+
+
+
+
=+
v
( ) 0=+
v
t
continuityequation
momentume
quation
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n Eulerequations
Governing Equations Inviscid Compressible Flow
( )( )
xf
x
pu
t
u
+=+
v
( ) ( )y
fy
pv
t
v
+=+
v
( )( )
zf
z
pw
t
w
+
=+
v
( ) 0=+
v
tcontinuityequation
momentumeq
uation
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n coupledsystemofnonlinearpartialdifferentialequations
n normalandshearstresstermsarefunctionsofthevelocitygradients
n pressureisafunctionofthedensity
n onlymomentumequationsareNavier-Stokesequations,
howeverthenameiscommonlyusedforthefullset
ofgoverningequations(plusenergyequation)
Commentson the Governing Equations
-
8/8/2019 cfd slayt friburg
10/15
10
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n canbeobtaineddirectly fromacontrolvolumefixedin
space
n
considerflux ofmass,momentum(andenergy)intoandoutofthevolume
n haveadivergencetermwhichinvolvestheflux ofmass(v),momentuminx,y,z(uv,vv,wv)
n canbeexpressedinagenericform
Governing Equations inConservation Form
JHGFU =
+
+
+
zyxt
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n viscousflow
n inviscid flow
Generic Form
=
w
v
u
U
+=
xz
xy
xx
uw
uv
puu
u
F
+ =
yz
yy
yx
tvw?
tpvv?
tvu?
v?
G
=
z
y
x
f?
f?
f?
0
J
++ =
zz
zy
zx
tpww?
tpwv?
twu?
w?
H
=
w
v
u
U
+
=
uw
uv
puu
u
F
+=
vw?
pvv?
vu?
v?
G
=
z
y
x
f?
f?
f?
0
J
++
=
pww?
pwv?
wu?
w?
H
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n U solutionvector(tobesolvedfor)
n F,G,H fluxvectors
n J sourcevector(externalforces,energychanges)
n dependentflowfieldvariablescanbesolvedprogressively
instepsoftime(time-marching )n spatialderivativesareknowfromprevioustimesteps
n numberscanbeobtainedfordensity andfluxvariablesu,v,w
Generic Form
zyxt
+
+
= HGF
JU
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n inmanyreal-worldproblems,discontinuouschangesin
theflow-fieldvariables,v occur(shocks,shockwaves)n problem:differentialformofthegoverningequationsassumesdifferentiable(continuous)flowproperties
n simple1-Dshockwave:1 u1 =2 u2
n conservationformsolvesforu,seesnodiscontinuityn positiveeffectonnumericalaccuracyandstability
Motivation for Different Formsof the Governing Equations
x
x
u
x
u
-
8/8/2019 cfd slayt friburg
11/15
11
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n introduction
n pre-requisites
n governingequationsn continuityequation
n momentumequation
n summary
n solutiontechniques
n Lax-Wendroff
n MacCormack
n numericalaspects
n recentresearchingraphics
Outline
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n flow-fieldvariables,u,v,w areknownateachdiscretespatialposition(x,y,z )attimet
n
Lax-Wendroff computesallinformationattimet+tn second-orderaccuracyinspaceandtime
n explicit,finite-differencemethod
n particularlysuitedtomarchingsolutions
n marchingsuitedtohyperbolic,parabolicPDEs
n unsteady(time-dependent),compressibleflowisgovernedbyhyperbolicPDEs
Lax-Wendroff Technique
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n 2D,inviscid flow,nobodyforce,innon-conservationform
Lax-WendroffExample
+
+
+
=
yv
y
v
xu
x
u
t
+
+
=
x
TR
y
uv
x
uu
t
u
+
+
=
y
TR
y
vv
x
vu
t
v
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n ti,j densityatposition(i, j )andtimetn ti,j ,uti,j ,vti,j areknown
Taylor Series Expansions
( )...
2
2
,
2
2
,
,,+
+
+=+t
tt
t
t
ji
t
ji
t
ji
tt
ji
( )...2
2
,
2
2
,
,, +
+
+=+ t
t
utt
uuu
t
ji
t
ji
t
ji
tt
ji
( )...
2
2
,
2
2
,
,,+
+
+=+t
t
vt
t
vvv
t
ji
t
ji
t
ji
tt
ji
-
8/8/2019 cfd slayt friburg
12/15
12
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n /t canbereplacedbyspatialderivativesgiveninthegoverningequations
n usingsecond-ordercentraldifferences
Taylor Expansion - Density
( )...
2
2
,
2
2
,
,,+
+
+=+
t
tt
t
t
ji
t
ji
t
ji
tt
ji
+
+
+
=
yv
y
v
xu
x
u
t
+
+
+
=
++++
yv
y
vv
xu
x
uu
t
t
ji
t
jit
ji
t
ji
t
jit
ji
t
ji
t
jit
ji
t
ji
t
jit
ji
t
ji 2222
,1,1
,
,1,1
,
,1,1
,
,1,1
,
,
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n 2/t2 canbeobtainedbydifferentiatingthegoverningequationwithrespecttotime
n mixedsecondderivativescanbeobtainedbydifferentiating
thegoverningequationswithrespecttoaspatialvariable,
e.g.
n bracketsmissingonpp.219,220inAndersonsbook!
Taylor Expansion - Density
+
+
+
+
+
+
+
=
t
v
ytyv
ty
v
ty
v
t
u
xtxu
tx
u
tx
u
t
2222
2
2
+
+
+
+
=
2
22
2
22
2
22
x
TR
x
TR
x
v
y
u
yx
uv
x
u
x
uu
tx
u
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n 2/t2 canbecomputedusingcentraldifferencesforspatialderivatives
n higher-ordertermsarerequired,e.g.
n ... u,v arecomputedinthesameway
Taylor Expansion - Density
( )2,1,,1
,
2
2 2
x
uuu
x
ut
ji
t
ji
t
ji
t
ji
+=
+
yx
uuuu
yx
ut
jit
jit
jit
jit
ji
+=
++++4
1,11,11,11,1
,
2
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n introduction
n pre-requisites
n governingequations
n continuityequation
n momentumequation
n summary
n solutiontechniques
n Lax-Wendroff
n MacCormack
n numericalaspects
n recentresearchingraphics
Outline
-
8/8/2019 cfd slayt friburg
13/15
13
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n samecharacteristicslikeLax-Wendroff
n second-orderaccuracyinspaceandtime
n requiresonlyfirsttimederivativen predictor corrector
n illustratedfordensity
MacCormack Technique
tt
av
ji
t
ji
tt
ji
+=+,
,,
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n predictorstepfordensity
n u,v arepredictedthesameway
MacCormack Technique
+
+
+
=
++++
y
v
y
vv
x
u
x
uu
t
t
ji
t
jit
ji
t
ji
t
jit
ji
t
ji
t
jit
ji
t
ji
t
jit
ji
t
ji 2222
,1,1
,
,1,1
,
,1,1
,
,1,1
,
,
tt
t
ji
t
ji
tt
ji
+=+
,
,,
tt
uuu
t
ji
t
ji
tt
ji
+=+
,
,,t
t
vvv
t
ji
t
ji
tt
ji
+=+
,
,,
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n correctorstepfordensity
n correspondstoHeun schemeforODEsn otherhigher-orderschemes,e.g.Runge-Kutta 2or4,couldbeusedaswell
MacCormack Technique
+
+
+
=
+
+++
+
+++
+
+++
+
+++
+
yv
y
vv
xu
x
uu
t
ttji
ttjitt
ji
ttji
ttjitt
ji
ttji
ttjitt
ji
ttji
ttjitt
ji
tt
ji2222
,1,1
,
,1,1
,
,1,1
,
,1,1
,
,
ttt
tt
tt
ji
t
ji
t
ji
av
ji
t
ji
tt
ji
+
+=
+=+
+
,,
,
,
,,2
1
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n Lax-Wendroff andMacCormack canbeusedfor
unsteadyflow
n non-conservationform
n conservationform
n viscousflow
n inviscid flow
n higher-orderaccuracyrequiredtoavoidnumerical
dissipation,artificialviscosity,numericaldispersionn note,thatviscosityisrepresentedbysecondpartialderivativesinthegoverningequations
Comments
-
8/8/2019 cfd slayt friburg
14/15
14
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n introduction
n pre-requisites
n
governingequationsn continuityequation
n momentumequation
n summary
n solutiontechniques
n Lax-Wendroff
n MacCormack
n numericalaspects
n recentresearchingraphics
Outline
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n truncationerrorcausesdissipationanddispersion
n numericaldissipationiscausedbyeven-ordertermsofthetruncationerror
n numericaldispersioniscausedbyodd-orderterms
n leadingterminthetruncationerrordominatesthebehavior
Numerical Effects
x
u
x
u
x
u
originalfunction dissipation dispersion
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n artificialviscositycompromisestheaccuracy,but
improvesthestabilityofthesolution
n addingartificialviscosityincreasestheprobabilityofmakingthesolutionlessaccurate,butimprovesthestability
n similartoiterativesolutionschemesforimplicitintegrationschemes,whereasmallernumberofiterationsintroduces
artificialviscosity,butimprovesthestability
Numerical Effects
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
n governingequationsforcompressibleflow
n continuityequation,momentumequation
n Navier-Stokes(viscousflow)andEuler(inviscid flow)
n discussionofconservationandnon-conservationform
n explicittime-marchingtechniques
n Lax-Wendroff
n MacCormack
n numericalaspects
n recentresearchingraphics
Summary
-
8/8/2019 cfd slayt friburg
15/15
15
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
Recent Research
M.Carlson,P.J.Mucha,G.Turk,RigidFluid:Animatingthe
InterplayBetweenRigidBodiesandFluid,Siggraph 2004.
UniversityofFreiburg-InstituteofComputerScience- ComputerGraphicsLaboratory
Recent Research
T.G.Goktekin,A.W.Bargteil,J.F.OBrien,
AMethodforAnimatingViscoelastic Fluids,Siggraph 2004.