1、IntroductionlWhat can fluid simulation do for us?lWhat is the difficulty of the topic?ObjectivelReal-time and visual qualitylInteract with usersHeight Field present water surface as a 2D function h(x,y)2D array hi,jxyhhijHeight FieldlPros:Process from 3D to 2D reduce computational timelCons:One loca
2、tion(x,y)maps to exactly one height no breaking wavesHello World!AlgorithmlUse 2 arrays ANM,BNM of the same sizelInitialize Aij with arbitrary valueslInitialize Bij with 0lloop forall i,j do Bi,j+=(Ai-1,j+Ai+1,j+Ai,j-1 +Ai,j+1)/4-Ai,j;forall i,j do Bi,j*=0.99;forall i,j do Ai,j+=Bi,j;endloopAlgorith
3、mlIt simulate the wave propagation phenomenontravel directionPros and ConslPros:1).Simple 2).Computational time is independent of wave sourcelCons:1).Unnatural shape of wave propagation 2).Slow wave propagationdemoAddition of Sine WavesGoverning Equationl lh:height of water surface A:amplitude :angu
4、lar velocity t:time :phase :wave length f:frequency)cos(0iiisourceNumitwAhAlgorithmlsummate all sine waveslv=x f is a constant,and increases with tlPhase increases constantly to animate wave propagationPros and ConslPros:Better look of shape of wave propagationlCons:Computational time is proportiona
5、l to wave source numberdemoWave EquationGoverning Equation)yhxh(cth2222222h:height of water surfacet:timec:velocityx:position of x directiony:position of y directionDampinglWith dampinglWhere k is damping factor)yhxh(cthkth2222222Finite Differencehh)f(xh)f(xfii2iiih)h)f(x)2f(xh)f(x(22hfWhere h is a
6、insignificant and non-zero valueDiscrete Wave Equationyxyhhhyhxhhhxhthhhthnyxnyxnyxnyxnyxnyxnyxnyxnyx)(2)(2)(221,1,2221,1,2221,1,22Discrete Wave Equation)4(214()(1()4()(1(,1,11,11,11,1,1,1,1,1222,1,1,1,1222,tyxtyxtyxtyxtyxtyxtyxtyxtyxtyxttyxtyxtyxttyxtyxtyxtyxtyxtyxttyxtyxtyxttyxhhhhhhhhhhxtchhtkhho
7、rhhhhhxtchhtkhhstabilitylHow to choose?lCourant-Friedrichs-Lewy stability condition holds which says that information must not travel more than one grid cell per time step,i.e.c t x222xtcResultlCPU:AMD Athlon 3500+2.2 GHZlGraphics Card:Radeon HD 3650lRAM:1 GlAbout 60 fps in grid size of 360 x 360ldemo 1 demo 2ENDvThanks for listening.