Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Simulating the 2D wave equation with varying speed

  1. Jan 21, 2010 #1
    As a computer scientist and applied math guy, I've recently taken interest in learning to simulate fluids. I've done simple wave equation and KDV simulations before, but after reading the paper
    "Rapid, Stable Fluid Dynamics for Computer Graphics" by Kass and Miller 1990.
    I thought I'd like to try varying the depth of the water and see its effects.

    The paper imposes assumptions on the shallow water equations such that the wave equation is derived:
    [tex]h_{tt}=dg\nabla^2h[/tex]
    where g is the gravity and [tex]d=d(x,z)[/tex] is the depth of the water and [tex]h(x,z,t)=ground+d[/tex] is the water surface height as the sum of ground height and depth.

    I have a single initial gaussian disturbance, and the boundaries are reflective.

    As a first attempt, I tried a simple explicit finite difference scheme. I calculated stability, and am pretty sure that my parameters lead to stable behaviour. if i set d(x,z) to a constant, the simulation appears as expected. If however i let d(x,z) be a continous,smooth surface the results are incorrect. The gaussian propogates outwards as a circular wave BUT the region inside the circle just sinks and sinks and sinks, instead of returning to the equilibrium waterlevel.
    I am struggling to see why this is so. The paper seems to think this works (although they use an implicit discretization).

    This surely cannot be a stability issue as all possible values of d for my given ocean floor, yield stable coefficients.

    It has nothing to do with the shape of the ocean floor either, because the same happens when the floor is flat.

    Each iteration, for each mesh point, [tex]d = h - ground[/tex] is calculated, and it seems that once depth starts decreasing, it doesn't want to stop. :(

    If anyone can shed any light on this matter i'd appreciate it a lot !

    Here are two images of the equation working (when d(x,z)=const - ground(x,z) )
    http://img191.imageshack.us/img191/2551/wavesim2.th.jpg [Broken]
    http://img59.imageshack.us/img59/3576/wavesim1.th.jpg [Broken]


    The following two, are examples of when it doesn't work, ie. d(x,z,t) = h(x,z,t) - ground(x,z)
    http://img641.imageshack.us/img641/6181/wavesim4.th.jpg [Broken]
    http://img199.imageshack.us/img199/2434/wavesim3.th.jpg [Broken]
     
    Last edited by a moderator: May 4, 2017
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted