Shallow water model
The shallow water model describes the evolution of a 2D flow described by its velocity and an interface height that conceptually represents pressure. A divergent flow affects the interface height which in turn can impose a pressure gradient force onto the flow. The dynamics include advection, forces, dissipation, and continuity.
The following description of the shallow water model largely follows the idealized models with spectral dynamics developed at the Geophysical Fluid Dynamics Laboratory[^1]: The Shallow Water Equations[^2].
Shallow water equations
The shallow water equations of velocity
We denote time
that is, the layer thickness at rest
In the shallow water system the flow can be described through
With
The divergence/curl of the vorticity flux
equivalently to how this is done in the Barotropic vorticity equation with
Algorithm
- Start with initial conditions of relative vorticity
, divergence , and interface height in spectral space and transform this model state to grid-point space:
Invert the Laplacian of
to obtain the stream function in spectral space Invert the Laplacian of
to obtain the velocity potential in spectral space obtain velocities
fromTransform velocities
, to grid-point space Unscale the
factor to obtain Transform
, , to in grid-point space
Now loop over
Compute the forcing (or drag) terms
Multiply
with in grid-point spaceAdd
andTransform these vector components to spectral space
, Compute the curl of
in spectral space and add to forcing of Compute the divergence of
in spectral space and add to forcing of divergence Compute the kinetic energy
and transform to spectral spaceAdd to the kinetic energy the "geopotential"
in spectral space to obtain the Bernoulli potential Take the Laplacian of the Bernoulli potential and subtract from the divergence tendency
Compute the volume fluxes
in grid-point space via Transform to spectral space and take the divergence for
. Add to forcing for. Correct the tendencies following the semi-implicit time integration to prevent fast gravity waves from causing numerical instabilities
Compute the horizontal diffusion based on the
tendencies Compute a leapfrog time step as described in Time integration with a Robert-Asselin and Williams filter
Transform the new spectral state of
, , to grid-point as described in 0. Possibly do some output
Repeat from 1.
Semi-implicit time integration
Probably the biggest advantage of a spectral model is its ability to solve (parts of) the equations implicitly a low computational cost. The reason is that a linear operator can be easily inverted in spectral space, removing the necessity to solve large equation systems. An operation like
This can be made use of when facing time stepping constraints with explicit schemes, where ridiculously small time steps to resolve fast waves would otherwise result in a horribly slow simulation. In the shallow water system there are gravity waves that propagate at a wave speed of
In the following we will describe how the semi implicit time integration can be combined with the Leapfrog time stepping and the Robert-Asselin and Williams filter for a large increase in numerical stability with gravity waves. Let
with the right-hand side operator
We could already assume to evaluate
Let
because
For the shallow water equations we will only make use of the last formulation, meaning we first evaluate the whole right-hand side
We can now implicitly solve for
So what is
which is a linearization of the equations around a state of rest with uniform constant layer thickness
with
Inserting the second equation into the first, we can first solve for
Where the last formulation just makes it clear that
The idea of the semi-implicit time stepping is now as follows:
Evaluate the right-hand side explicitly at time step
to obtain the explicit, preliminary tendencies (and without a need for semi-implicit correction) Move the implicit terms from
to when calculatingSolve for
, the new, corrected tendency for divergence. With
obtain , the new, corrected tendency for . Apply horizontal diffusion as a correction to
as outlined in Horizontal diffusion. Leapfrog with tendencies that have been corrected for both semi-implicit and diffusion.
Some notes on the semi-implicit time stepping
The inversion of the semi-implicit time stepping depends on
, that means every time the time step changes, the inversion has to be recalculated. You may choose
to dampen gravity waves but initialization shocks still usually kick off many gravity waves that propagate around the sphere for many days.With increasing
these waves are also slowed down, such that for they quickly disappear in several hours.Using the scaled shallow water equations the time step
has to be the scaled time step which is divided by the radius. Then we use the normalized eigenvalues which also omit thescaling, see scaled shallow water equations for more details.
Scaled shallow water equations
Similar to the scaled barotropic vorticity equations, SpeedyWeather.jl scales in the shallow water equations. The vorticity and the divergence equation are scaled with
As in the scaled barotropic vorticity equations, one needs to scale the time step, the Coriolis force, the forcing and the diffusion coefficient, but then enjoys the luxury of working with dimensionless gradient operators. As before, SpeedyWeather.jl will scale vorticity and divergence just before the model integration starts and unscale them upon completion and for output. In the semi-implicit time integration we solve an equation that also has to be scaled. It is with radius squared scaling (because it is the tendency for the divergence equation which is also scaled with
As
The
References
[^1]: Geophysical Fluid Dynamics Laboratory, Idealized models with spectral dynamics
[^2]: Geophysical Fluid Dynamics Laboratory, The Shallow Water Equations.