# Simulating the 2D wave equation with varying speed

1. Jan 21, 2010

### rewolf

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:
$$h_{tt}=dg\nabla^2h$$
where g is the gravity and $$d=d(x,z)$$ is the depth of the water and $$h(x,z,t)=ground+d$$ 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, $$d = h - ground$$ 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