%pylab inline import clawpack.visclaw.colormaps as C theta = pi/8. h0 = 10. grav = 9.81 c = sqrt(grav*h0) width = 10. L = 2*width*sin(theta) print "Wavelength in direction of wave propagation L = %g" % L print "Linearized propagation speed (if A small relative to h0): c = %g" % c def wave(x,y,t,A): eta0 = A[0]*sin(2*pi*(x*cos(theta) + y*sin(theta) - c*t)/L) eta1 = A[1]*sin(2*pi*(x*cos(theta) - y*sin(theta) - c*t)/L) h = h0 + eta0 + eta1 u = sqrt(grav/h0) * (eta0 + eta1) * cos(theta) v = sqrt(grav/h0) * (eta0 - eta1) * sin(theta) return h,u,v x = linspace(-20,20,201) y = linspace(-width,width,101) X,Y = meshgrid(x,y) def plot_wave(t,A): h,u,v = wave(X,Y,t,A) pcolor(X,Y,h,cmap=C.blue_white_red) contour(X,Y,v,colors='k') title('t = %8.3f, pcolor=h, contours=v' % t) axis('scaled') figure(figsize=(10,6)) subplot(121) plot_wave(0,[1,0]) subplot(122) plot_wave(0,[0,1]) plot_wave(0,[1,1]) figure() plot_wave(0.5,[1,1])