Shallow Liquid Simulation Using Matlab (2001 Neumann).pdf
(
1004 KB
)
Pobierz
266629461 UNPDF
AMATH581Homework2
ShallowLiquidSimulation
ErikNeumann
610N.65thSt.,Seattle,WA98103
erikn@MyPhysicsLab.com
November19,2001
Abstract
Amodelofshallowfluidbehaviorisevaluatedusingavarietyofnu-
mericalsolvingtechniques.Themodelisdefinedbyapairofpartialdif-
ferentialequationswhichhavetwodimensionsinspaceandonedimension
oftime.Theequationsconcernthevorticity!andthestreamfunction
whicharerelatedtothevelocityfieldofthefluid.Theequationsare
firstdiscretizedintimeandspace.Thetimebehaviorisevaluatedusing
aRunge-Kuttaordinarydierentialequationsolver.Thespatialbehavior
issolvedusingeitherFastFourierTransform,GaussianElimination,LU
Decomposition,oriterativesolvers.Theperformanceofthesetechniques
iscomparedinregardstoexecutiontimeandaccuracy.
Contents
1IntroductionandOverview 2
2TheoreticalBackground 4
2.1Solvingfor -MatrixMethod................... 5
2.2Solvingfor -FFTMethod..................... 6
2.3DiscretizetheAdvection-DiusionEquation............ 6
3AlgorithmImplementationandDevelopment 7
3.1ConstructionofMatrixA...................... 8
3.2ConstructionofMatrixB...................... 9
3.3PinningtheValueof (1,1)..................... 10
1
3.4ComparingSolvers.......................... 11
3.5AnFFTproblem........................... 11
4ComputationalResults 11
4.1Resultsforvariousinitialconditions................ 11
4.2Runningtimes ............................ 17
4.3Accuracyofsolvers.......................... 17
4.4SymmetryofSolution........................ 18
4.5TimeResolutionNeeded....................... 18
4.6MeshDriftInstability........................ 18
5SummaryandConclusions 21
AMATLABfunctionsused 22
BMATLABcode 23
B.1evhump.m............................... 23
B.2evrhs.m................................ 23
B.3wh.m.................................. 23
B.4fr.m.................................. 23
B.5ev2.m................................. 24
CCalculations 34
1IntroductionandOverview
Weconsiderthegoverningequationsassociatedwithshallowfluidmodeling.
Theintendedapplicationistheflowoftheearth’satmosphereoroceancircu-
lation.Themodelassumesa2-dimensionalflow,withnotmuchmovementup
ordown.Anotherassumptionisthatthefluidisshallow,ie.thatthevertical
dimensionismuchsmallerthanthehorizontaldimensions.
Thevelocityfieldisgivenbythesetofvectorsvateachpointwithcomponents
0
u
v
w
1
v=
@
A
(1)
2
whereuisthexcomponentofthevelocity,vistheycomponentofthevelocity
andsoon.Theheightofthefluidisgivenbyh(x,y,t).Fromconservationof
masswecanderivethefollowing
h
t
+(hu)
x
+(hv)
y
=0 (2)
Conservationofmomentumleadstothefollowingtwoequations
(hu)
t
+(hu
2
+
1
2
gh
2
)
x
+(huv)
y
=fhv (3)
(hv)
t
+(hv
2
+
1
2
gh
2
)
y
+(huv)
x
=−fhu (4)
Next,assumethathisconstant(toleadingorder).Thenequation(2)becomes
u
x
+v
y
=0 (5)
whichexpressesthatthisisanincompressibleflow.Wecandefinethestream
function by
u=−
y
v=
x
(6)
whichautomaticallysatisfiestheincompressibilityofequation(5).Theremain-
ingtwoequationsbecome
u
t
+2uu
x
+(uv)
y
=fv (7)
v
t
+2vv
y
+(uv)
x
=−fu (8)
Definethevorticity!by
!=v
x
−u
y
. (9)
Wecansimplifytheseequationsasfollows.Subtractthey-derivativeof(7)from
thex-derivativeof(8)anduseequations(5)and(9)tosimplify(seeappendixC
fordetails).Theresultis
!
t
+u!
x
+v!
y
=0 (10)
Addingadiusionterm(representingviscosity)totherighthandsideandusing
equation(6)leadsto
!
t
−
y
!
x
+
x
!
y
=r
2
! (11)
wherer
2
!=!
xx
+!
yy
andisasmallconstantfactor.
Anotherrelationshipbetweenvorticity!andthestreamfunction isgleaned
fromthefollowing
!=v
x
−u
y
=(
x
)
x
−(−
y
)
y
(12)
!=r
2
(13)
3
Thesystemisthengivenby
!
t
+[ ,!]=r
2
!
(14)
r
2
=!
(15)
where[ ,!]=
x
!
y
−
y
!
x
representstheadvectionterm.Thisadvection-
diusionequationhascharacteristicbehaviorofthethreePDEclassifications,
parabolic: !
t
=r
2
! (diusion)
elliptic: r
2
=!
hyperbolic: !
t
+[ ,!]=0 (advection)
Thenumericalsolutiontechniqueconsistsofthefollowingsteps,startingwith
aninitialvaluefor!.
1.Givenavalueof!,solveequation(15)for .Discretizingther
2
operator
turnsthisintoamatrixequationoftheformA
~
=!where
~
isa
discretizedvectorrearrangementof andsimilarlyfor!.
2.Discretizeequation(14)sothatwegetanothermatrixequation!
t
=B!.
Weregard asfixedforasmallperiodoftime.Thisisnowintheform
ofasetofordinarydierentialequations.
3.StepforwardintimeusingaRunge-Kuttaordinarydierentialequation
solvertoget!atasmalltimeinthefuture.
Thisnewvalueof!isthenusedinstep1andtheprocesscancontinueindef-
initely.Wewillexaminevarioustechniquesforsolvingthematrixequationin
step(1),includingFastFourierTransform,GaussianElimination,LUDecom-
position,anditerativesolvers.
2TheoreticalBackground
Weseektonumericallysimulatethesystemgivenbyequations(14)and(15).
Weassumethatthereisaninitialvorticity!(x,y,t)specifiedattimet=0.
Theareawearesolvingoverisaboxdefinedby
x2[−L/2,L/2] y2[−L/2,L/2] (16)
forsomeconstantlengthL.
Weassumeperiodicboundaryconditions,sothat
!(−L/2,y,t)=!(L/2,y,t) (17)
!(x,−L/2,t)=!(x,−L/2,t) (18)
andsimilarlyfor .
4
2.1Solvingfor -MatrixMethod
Thefirststepistosolveequation(15)for fromagivenvalueof!.Weuse
secondordercentraldierencingtoapproximatethesecondderivatives,sothat
equation(15)becomes
(x+
M
x)−2 (x)+ (x−
M
x)
M
x
2
+
(y+
M
y)−2 (y)+ (y−
M
y)
M
y
2
=!(x,y)
(19)
AssumethattheboxisdiscretizedintoNsegmentshorizontallyandvertically
sothat
M
x=
M
y=L/N=.Labelthepointsalongthexaxisasx
1
,x
2
,...,x
n
andsimilarlyfory.Wedefinethefollowingnotation
(x
m
,y
n
)=
m,n
(20)
andthenwecanwriteequation(19)as
−4
m,n
+
m+1,n
+
m−1,n
+
m,n+1
+
m,n−1
=
2
!
m,n
(21)
Notethattheboundaryconditionsgiveus
m,N+1
=
m,1
m,0
=
m,N
(22)
N+1,n
=
1,n
0,n
=
N,n
(23)
andsimilarlyfor!.
Supposeweform intoavectorrow-wiseasfollows:
~
=(
11
,
12
,...,
1n
,
21
,...,
2n
,...,
nn
) (24)
andsimilarlyfor!.ThesevectorsareoflengthN
2
.Wecanthenwriteequa-
tion(21)asamatrixequation,
A
~
=
2
! (25)
ThematrixAisasparsebandedmatrixwithdimensionsN
2
×N
2
.Anexample
forN=4isshownbelow.
0
−41 0 1 1 0 0 0 0 0 0 0 1 0 0 0
1−41 0 0 1 0 0 0 0 0 0 0 1 0 0
0 1−41 0 0 1 0 0 0 0 0 0 0 1 0
1 0 1−40 0 0 1 0 0 0 0 0 0 0 1
1 0 0 0−41 0 1 1 0 0 0 0 0 0 0
0 1 0 0 1−41 0 0 1 0 0 0 0 0 0
0 0 1 0 0 1−41 0 0 1 0 0 0 0 0
0 0 0 1 1 0 1−40 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0−41 0 1 1 0 0 0
0 0 0 0 0 1 0 0 1−41 0 0 1 0 0
0 0 0 0 0 0 1 0 0 1−41 0 0 1 0
0 0 0 0 0 0 0 1 1 0 1−40 0 0 1
1 0 0 0 0 0 0 0 1 0 0 0−41 0 1
0 1 0 0 0 0 0 0 0 1 0 0 1−41 0
0 0 1 0 0 0 0 0 0 0 1 0 0 1−41
0 0 0 1 0 0 0 0 0 0 0 1 1 0 1−4
1
A=
B
B
B
B
B
B
B
B
B
B
B
B
@
C
C
C
C
C
C
C
C
C
C
C
C
A
5
Plik z chomika:
annam101
Inne pliki z tego folderu:
Computer Algebra Recipes for Mathematical Physics - Enns.pdf
(4681 KB)
Wilson-Turcotte-Halpern- Adv Math & Mech App using MatLab Book-3rd Ed [CRC 2003].zip
(8459 KB)
Visual - Excel Data Analysis Your Visual Blueprint To Analyzing Data, Charts and Pivot Tables [Wi.pdf
(11231 KB)
TeX & LISP.zip
(11300 KB)
Skiena - The Algorithm Design Manual [Springer-Verlag 1997].pdf
(14382 KB)
Inne foldery tego chomika:
Aerodynamics Flight Mechanics
Aerospace Design
Aerospace Propulsion
Astronomy and Astrophysics
Control Systems Analysis
Zgłoś jeśli
naruszono regulamin