Notes

! Thursday: class will begin late, 11:30am ! In reality, nearby molecules travelling at different velocities occasionally bump into each other, transferring energy • Differences in velocity reduced (damping) • Measure this by strain rate (time of strain, or how far velocity field is from rigid motion) • Add terms to our constitutive law

cs533d-term1-2005 1 cs533d-term1-2005 2

Strain rate Viscous stress

! At any instant in time, measure how fast chunk ! As with linear elasticity, end up with two parameters if we of material is deforming from its current state want isotropy: • Not from its original state viscous ! ij = 2µ"˙ ij + #"˙ kk$ij • So we"re looking at , incremental strain • µ and ! are coefficients of viscosity (first and second) updates • These are not the Lame coefficients! Just use the same symbols • Can use linear Cauchy strain! • ! damps only compression/expansion ! So the strain rate is " Usually !!-2/3µ (exact for monatomic gases) " So end up with # & 1 "ui "u j !˙ ij = 2 % + ( % ( % ( "u "u j 2 "u "x j "xi viscous i k $ ' ! ij = µ' + # $ij * & "x j "xi 3 "xk )

cs533d-term1-2005 3 cs533d-term1-2005 4

Navier-Stokes Nondimensionalization

! Navier-Stokes equations include the viscous ! Actually go even further stress ! ! Incompressible version: Select a characteristic length L u u u 1 p g 1 u uT • e.g. the width of the domain, t + ! " + # " = + # " ! µ(" + " ) ! And a typical velocity U u 0 " ! = • e.g. the speed of the incoming flow ! Often (but not always) viscosity µ is constant, and this reduces to ! Rescale terms 1 µ 2 x"=x/L, u"=u/U, t"=tU/L, p"=p/#U2 ut + u! "u + "p = g + " u • # # so they all are dimensionless

• Call $=µ/# the “kinematic viscosity” Lg # 2 u't +u'!"u'+"p'= 2 + " u' cs533d-term1-2005 5 U UL cs533d-term1-2005 6

Nondimensional parameters Why nondimensionalize?

! Re=UL/$ is the Reynold"s number ! Think of it as a user-interface issue • The smaller it is, the more viscosity plays a ! It lets you focus on what parameters matter • If you scale your problem so nondimensional role in the flow parameters stay constant, solution scales • High Reynold"s numbers are hard to simulate ! Code rot --- you may start off with code which ! Fr= U g L is the Froude number has true dimensions, but as you hack around they lose meaning • The smaller it is, the more gravity plays a role • If you"re nondimensionalized, there should be only in the flow one or two parameters to play with • Note: often can ignore gravity (pressure ! Not always the way to go --- you can look up cancels it out) material constants, but not e.g. Reynolds numbers (0,#1,0) 1 2 ut + u! "u + "p = 2 + " u Fr Re cs533d-term1-2005 7 cs533d-term1-2005 8

Other quantities Boundary conditions

! We may want to carry around auxiliary ! Inviscid flow: quantities • Solid wall: u•n=0 • Free surface: p=0 (or atmospheric pressure) • E.g. temperature, the type of (if we have • Moving solid wall: u•n=uwall•n a mix), concentration of smoke, etc. ! Also enforced in-flow/out-flow ! Use material derivative as before • Between two : u1•n=u2•n and p1=p2+%& ! Viscous flow: ! E.g. if quantity doesn"t change, just is • No-slip wall: u=0 transported (“advected”) around: • Other boundaries can involve coupling tangential Dq components of stress tensor… = q + u! "q = 0 Dt t !" # ! Pressure/velocity coupling at boundary: advection • u•n modified by #p/#n

cs533d-term1-2005 9 cs533d-term1-2005 10

What now? Vorticity

! Can numerically solve the full equations ! How do we measure rotation? • Will do this later • Vorticity of a vector field (velocity)! is:= " # u • Not so simple, could be expensive (3D) • Proportional (but not equal) to ! Or make assumptions and simplify them, of a rigid body - off by a factor of 2 then solve numerically ! Vorticity is what make s smoke look • Simplify flow (e.g. irrotational) interesting • Simplify dimensionality (e.g. go to 2D) • Turbulence

cs533d-term1-2005 11 cs533d-term1-2005 12 Vorticity equation Vorticity equation continued

! Start with N-S, constant viscosity and density ! Simplify with more vector identities, and assume 1 2 ut + u! "u + # "p = g + $" u incompressible to get: ! Take curl of whole equation D! = ! " #u + $# 2! u u u 1 p g 2u Dt ! " t + ! " ( # ! ) + ! " $ ! = ! " + ! " (%! ) ! Lots of terms are zero: ! Important result: Kelvin Circulation Theorem • g is constant (or the potential of some field) • Roughly speaking: if '=0 initially, and there"s no viscosisty, '=0 forever after (following a chunk of • With constant density, pressure term too 2 fluid) ! " ut + ! " (u# !u) = $! " ! u ! Then use vector identities to simplify… " If fluid starts off irrotational, it will stay that way 1 2 2 (in many circumstances) ! " ut + ! " ((! " u) " u + 2 !u ) = #! (! " u) 2 $t + ! " ($ " u) = #! $ cs533d-term1-2005 13 cs533d-term1-2005 14

Potential flow Potential in time

! If velocity is irrotational: ! What if we have a free surface? ! " u = 0 ! Use vector identity u•(u=(()u))u+(|u|2/2 • Which it often is in simple laminar flow " Assume ! Then there must be a stream function (potential) • incompressible ((•u=0), inviscid, irrotational (()u=0) such that: • constant density u = !" • thus potential flow (u=(*, (2*=0) ! Solve for incompressibility: " Then equation simplifies (using G=-gy for gravitational potential) ! " !# = 0 1 2 1 ut + (! " u) " u + 2 ! u + # !p = g ! If u•n is known at boundary, we can solve it 1 2 1 !$t + 2 ! u + # !p = %!G cs533d-term1-2005 15 cs533d-term1-2005 16

Bernoulli’s equation Water waves

! Every term in the simplified momentum ! For small waves (no breaking), can reduce equation is a gradient: integrate to get geometry of water to 2D heightfield p ! Can reduce the physics to 2D also ! + 1 u2 + = #G t 2 " • How do surface waves propagate? • (Remember Bernoulli"s law for pressure?) ! Plan of attack • Start with potential flow, Bernoulli"s equation ! This tells us how the potential should • Write down boundary conditions at water surface evolve in time • Simplify 3D structure to 2D

cs533d-term1-2005 17 cs533d-term1-2005 18

Set up Boundaries

! We"ll take y=0 as the height of the water at ! At sea floor (y=-H), v=0 !y = 0 rest ! At sea surface (y=h!0), v=h ! H is the depth (y=-H is the sea bottom) t • Note again - assuming very small horizontal motion ! h is the current height of the water at (x,z) !y = ht ! Simplification: velocities very small (small amplitude waves) ! At sea surface (y=h!0), p=0 • Or atmospheric pressure, but we only care about pressure differences • Use Bernoulli"s equation, throw out small velocity squared term, use p=0, ! = "gh cs533d-term1-2005 19 t cs533d-term1-2005 20

Finding a wave solution Dispersion relation

! Plug in *=f(y)sin(K•(x,z)-'t) ! So the wave speed c is ! g • In other words, do a Fourier analysis in c = = tanhkH horizontal component, assume nothing much k k happens in vertical ! Notice that waves of different wave- 2 • Solving ( *=0 with boundary conditions on *y numbers k have different speeds gives " cosh(K (y + H)) Separate or disperse in time ! = A sin(K # (x,z) $"t) • K sinh(K H) ! For deep water (H big, k reasonable -- not tsunamis) tanh(kH)!1 • Pressure boundary condition then gives (with k=|K|, the magnitude of K) g c = ! = gk tanhkH k cs533d-term1-2005 21 cs533d-term1-2005 22

Simulating the ocean Energy spectrum

! Far from land, a reasonable thing to do is ! Fourier decomposition of height field: • Do Fourier decomposition of initial surface h(x,z,t) = #hˆ (i, j,t)e !1(i, j)"(x,z) height i, j 2 • Evolve each wave according to given wave ! “Energy” in K=(i,j) is S(K) = hˆ (K) speed (dispersion relation) ! Update phase, use FFT to evaluate ! Oceanographic measurements have found ! How do we get the initial spectrum? models for expected value of S(K) • Measure it! (oceanography) (statistical de scription)

cs533d-term1-2005 23 cs533d-term1-2005 24 Phillips Spectrum Fourier synthesis

! For a “fully developed” sea ! From the prescribed S(K), generate actual • wind has been blowing a long time over a large area, Fourier coefficients statistical distribution of spectrum has stabilized hˆ K,0 = 1 X + X !1 S K ! The Phillips spectrum is: [Tessendorf…] ( ) 2 ( 1 2 ) ( ) 2 " % • Xi is a random number with mean 0, standard 1 !1 2 " K (W % S(K) = A exp$ ! kl ' deviation 1 (Gaussian) 4 $ 2 ( ) '$ ' k # (kL) &# K W & • Uniform numbers from unit circles aren"t terrible either ! Want real-valued h, so must have • A is an arbitrary amplitude ˆ ˆ " • L=|W|2/g is largest size of waves due to wind velocity h (K) = h (!K) W and gravity g • Or give only half the coefficients to FFT routine and • Little l is the smallest length scale you want to model specify you want real output

cs533d-term1-2005 25 cs533d-term1-2005 26

Time evolution Picking parameters

! Dispersion relation gives us '(K) ! Need to fix grid for Fourier synthesis (e.g. 1024x1024 height field grid) " At time t, want ˆ !1(K"x!#t) h(x,t) = $h (K,0)e ! Grid spacing shouldn"t be less than e.g. 2cm (smaller K=(i, j ) than that - surface tension, nonlinear wave terms, etc. hˆ (K,0)e! !1#te !1K"x take over) = $ • Take little l (cut-off) a few times larger K=(i, j ) ! Total grid size should be greater than but still " So then coefficients at time t are comparable to L in Phillips spectrum (depends on wind • For j$0: speed and gravity) • Others: figure out from conjugacy condition (or leave ! Amplitude A shouldn"t be too large it up to real-valued FFT to fill them in) • Assumed waves weren"t very steep hˆ (i, j,t) = hˆ (i, j,0)e! !1"t

cs533d-term1-2005 27 cs533d-term1-2005 28

Note on FFT output Choppy waves

! FFT takes grid of coefficients, outputs grid of ! See Tessendorf for more explanation heights ! Nonlinearities cause real waves to have ! It"s up to you to map that grid sharper peaks and flatter troughs than (0…n-1, 0…n-1) to world-space coordinates linear Fourier synthesis gives ! In practice: scale by something like L/n • Adjust scale factor, amplitude, etc. until it looks nice ! Can manipulate height field to give this ! Alternatively: look up exactly what your FFT effect routines computes, figure out the “true” scale • Distort grid with (x,z) -> (x,z)+!D(x,z,t) factor to get world-space coordinates K D(x,t) = "! !1 hˆ (K,t)e !1K#x K K

cs533d-term1-2005 29 cs533d-term1-2005 30

Choppiness problems

! The distorted grid can actually tangle up (Jacobian has negative determinant - not 1-1 anymore) • Can detect this, do stuff (add particles for foam, spray?)

cs533d-term1-2005 31