The shallow-water equations are not necessarily called that because water has to be shallow, but because the flows are the same at all water depths. So we're doing the calculation of water flow that is independent of water depth where you don't have different flows. You have to maintain different grid cells in the vertical, you just need a lattice of grid cells in two dimensions in the horizontal. So this is what that grid looks like, so this is latitude and longitude. And each grid cell has an elevation of water level height which is defined, just like in the ice sheet model, it's defined in the cell centers. And then there are flows between the cells, which are like in the ice sheet model designed on the cell edges. So the grid could look like h00, h01, h02, and then v velocities, which are the north south velocities defined on the south faces there are now four of them as opposed to the three elevations. Just like in the ice sheet model, you have to worry about the boundaries. Now the north and south boundaries, we are going to say that there is a wall there so. These flows are both going to all equal zero across that wall and that wall. In the horizontal dimension there will be two options you're going to build into your code. One is to put walls there which means that you'll be setting these velocities, these u values to be zero. And the other is to have it wrap around in which case, you have stuff can flow out one side and it would just flow in the other side. So the way that you calculate the evolution of the elevation of the surface is by tracking the flows coming and going out the boundaries. So dU/dX, that's saying you have, more flowing in this side than that side. That would give you a value du dx that would actually be decreasing as you go this way. And so the negative of that multiplied by the aspect ratio. Tells you how much of this water is going to be piling up and making this box get deeper. So to accomplish this model, you are going to be given a template which has a lot of the overhead dealt with for you already like that makes the animation and what not. So this is what that template looks like. There's some stuff here at the top that you can play with after you get everything going. Some stuff here that you probably won't need to change. It's just sort of set up and then here is the main time stepping subroutine, and there are instructions for how to write Python loops to calculate the derivatives. The DUDX and the VDDY and things like that. In this loop, so you just need to flesh out this loop here. As the template comes initially, it's simplest to de-bug a thing like this when it's got a really small grid. So, this is what the thing will look like, just in the three by three grid. And the colors are the elevations and the arrows are the flows defined at the cell faces, like I said. And this particular simulation starts out with a big tower of water in the middle. And you get wild flow initially but then it settles down to a geostrophic balance where the rotation is balancing the pressure gradient sort of sideways. Three by three isn't very exciting so if we expand that to a bigger grid so there's the initial transient waves going all over the place. But then it settles down, and you get this sort of rotation going around the perturbation, this high pressure in the center. And this wave will tend to drift to the west. Because the rotation of the planet in higher latitudes is faster than the rotation rate in lower latitudes and that's set in this model. And so that tends to make raspy waves like this drift toward the west. So you can see this cell is getting redder and redder than that one as this peak is sort of going to slowly move across this grid, toward the West. I should say that this is a very, very small ocean. And it's got a very big degree of rotational change between the lower part latitude and the high latitude here. So it's like a small ocean on a small planet, but with the limited power of Python, we have to do what we can to make things run quickly. Here's another trick that the shallow water circulation code can do. In this case, you have winds that are blowing in this direction toward the west in the lower half of this domain and in the upper half the winds are blowing toward the east. And with the rotation what that does is it causes water to pile up in the center of this gyre. And once this water piles up, that pressure gradient actually starts to drive the flow around the gyre. So it's going the way the wind would tell it to go, but it's going there because the pressure gradient in the water is telling it to, not because the wind is telling it to. These arrows arise as this pressure difference in the water arises. And then this is like a giant Rossby wave, it's drifting to the west. And what that does in this case where you have walls at the east and west boundaries is it tends to lead to an intense flow on the Westward boundary. This is called Westward intensification and it's responsible for the Gulf stream and the Kuroshio and other Western boundary currents around the world that are very intense for this dynamical reason.