22
使使使使使使使使使使使使使使使使使使 496410032 使使使 Advisor: Damon Shing-Min Liu

使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

Embed Size (px)

Citation preview

Page 1: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

使用波動方程式的擬真和互動式水面模擬

496410032 吳金龍Advisor: Damon Shing-Min Liu

Page 2: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

IntroductionWhat can fluid simulation do for us?

What is the difficulty of the topic?

Page 3: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

ObjectiveReal-time and visual quality

Interact with users

Page 4: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

Height Field present water surface as a

2D function h(x,y)

2D array h[i,j]

x

y

h

h

i

j

Page 5: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

Height FieldPros: Process from 3D to 2D reduce computational time

Cons: One location (x,y) maps to exactly one height no breaking waves

Page 6: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

Hello World!

Page 7: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

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

Page 8: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

AlgorithmIt simulate the wave propagation

phenomenontravel direction

Page 9: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

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

Page 10: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

Addition of Sine Waves

Page 11: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

Governing Equation

h : height of water surface A : amplitude ω : angular velocity t : time φ : phase λ : wave length f : frequency

)cos(0

iii

sourceNum

i

twAh

Page 12: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

Algorithmsummate all sine waves

v = λ x f is a constant , and λ increases with t

Phase increases constantly to animate wave propagation

Page 13: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

Pros and Cons Pros: Better look of shape of wave

propagation

Cons: Computational time is proportional to wave source number

demo

Page 14: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

Wave Equation

Page 15: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

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

Page 16: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

DampingWith damping

Where k is damping factor

)yh

xh

(cth

kth

2

2

2

22

2

2

Page 17: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

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

Page 18: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

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

Page 19: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

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

Page 20: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

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

Page 21: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

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

Page 22: 使用波動方程式的擬真 和互動式水面模擬 496410032 吳金龍 Advisor: Damon Shing-Min Liu

END

Thanks for listening.