Upload
donald-gibson
View
233
Download
3
Embed Size (px)
Citation preview
使用波動方程式的擬真和互動式水面模擬
496410032 吳金龍Advisor: Damon Shing-Min Liu
IntroductionWhat can fluid simulation do for us?
What is the difficulty of the topic?
ObjectiveReal-time and visual quality
Interact with users
Height Field present water surface as a
2D function h(x,y)
2D array h[i,j]
x
y
h
h
i
j
Height FieldPros: Process from 3D to 2D reduce computational time
Cons: One location (x,y) maps to exactly one height no breaking waves
Hello World!
AlgorithmUse 2 arrays A[N][M] , B[N][M] of the same sizeInitialize A[i][j] with arbitrary valuesInitialize B[i][j] with 0
loop
forall i,j do B[i,j] += (A[i-1,j] + A[i+1,j] + A[i,j-1]
+ A[i,j+1])/4- A[i,j];
forall i,j do B[i,j] *= 0.99;
forall i,j do A[i,j] += B[i,j];
endloop
AlgorithmIt simulate the wave propagation
phenomenontravel direction
Pros and Cons Pros: 1). Simple
2). Computational time is independent of wave source
Cons: 1). Unnatural shape of wave propagation 2). Slow wave propagation
demo
Addition of Sine Waves
Governing Equation
h : height of water surface A : amplitude ω : angular velocity t : time φ : phase λ : wave length f : frequency
)cos(0
iii
sourceNum
i
twAh
Algorithmsummate all sine waves
v = λ x f is a constant , and λ increases with t
Phase increases constantly to animate wave propagation
Pros and Cons Pros: Better look of shape of wave
propagation
Cons: Computational time is proportional to wave source number
demo
Wave Equation
Governing Equation
)yh
xh
(cth
2
2
2
22
2
2
h: height of water surfacet: timec: velocityx: position of x directiony: position of y direction
DampingWith damping
Where k is damping factor
)yh
xh
(cth
kth
2
2
2
22
2
2
Finite Difference
hh
)f(xh)f(xf ii
2iii
h)h)f(x)2f(xh)f(x
(2
2
h
f
Where h is a insignificant and non-zero value
Discrete Wave Equation
yx
y
hhh
y
h
x
hhh
x
h
t
hhh
t
h
nyx
nyx
nyx
nyx
nyx
nyx
nyx
nyx
nyx
)(
2
)(
2
)(
2
2
1,,
1,
2
2
2
1,,
1,
2
2
2
1,,
1,
2
2
Discrete Wave Equation
))4(2
1
4(
))(1(
)4(
))(1(
,1,11,11,11,1
,1,1,,1,12
22
,,,,
,1,1,,1,12
22
,,,,
tyx
tyx
tyx
tyx
tyx
tyx
tyx
tyx
tyx
tyx
ttyx
tyx
tyx
ttyx
tyx
tyx
tyx
tyx
tyx
ttyx
tyx
tyx
ttyx
hhhhh
hhhhhx
tc
hhtkhh
or
hhhhhx
tc
hhtkhh
stabilityHow to choose ?
Courant-Friedrichs-Lewy stability condition holds which says that information must not travel more than one grid cell per time step, i.e. c t < x
2
22
x
tc
ResultCPU : AMD Athlon™ 3500+ 2.2 GHZGraphics Card: Radeon HD 3650RAM : 1 GAbout 60 fps in grid size of 360 x 360
demo 1 demo 2
END
Thanks for listening.