WebGPU spectral transform shallow water model.

The goal:

In order to allow people to play with shallow water models and examine their dynamics, I'm going to implement a gpu-parallelized spectral transform shallow water model. If scalability is feasible, I will extend this to a full eulerian spectral transform solver for the hydrostatic primitive equations (HPE).

The paper:

I'll be following the details of Hack and Jakob, 92

Provisionally this paper which indicates that we really should just use webGPU for this project.

The equation sets:

The simpler continuous equation set for vorticity/divergence formulation

tζ \partial_t \zeta =(ζ+f)v = -\nabla \cdot \left(\zeta + f \right)\mathbf{v}
tδ \partial_t \delta =k(×(ζ+f)v)2(Φ+vv2) = \mathbf{k} \cdot \left(\nabla \times \left(\zeta + f \right)\mathbf{v} \right) - \nabla^2 \left(\Phi + \frac{\mathbf{v} \cdot \mathbf{v}}{2} \right)
tΦ\partial_t \Phi =(Φv)Φδ = -\nabla \cdot \left(\Phi\mathbf{v}\right) - \overline{\Phi}\delta

note that this assumes no baseline topography for the moment, and the equations are inviscid.

Rewriting the equations

Make the following definitions:

μ \mu =sinφ = \sin \varphi
U U =ucosφ= u\cos \varphi
V V =vcosφ= v\cos \varphi
η \eta ζ+f=1a(1μ2)λV1aμU+f \equiv \zeta + f = \frac{1}{a(1-\mu^2)} \partial_\lambda V - \frac{1}{a}\partial_\mu U + f
δ \delta =1a(1μ2)λU+1aμV = \frac{1}{a(1-\mu^2)} \partial_\lambda U + \frac{1}{a}\partial_\mu V

Then we get the following set of continuous equations:

tη \partial_t \eta =1a(1μ2)λ[Uη]1aμ[Vη]= -\frac{1}{a(1-\mu^2)}\partial_\lambda \left[U\eta \right] - \frac{1}{a} \partial_\mu \left[V\eta \right]
tδ \partial_t \delta =1a(1μ2)λ[Vη]1aμ[Uη]2(Φ+U2+V22)= \frac{1}{a(1-\mu^2)}\partial_\lambda \left[V\eta \right] - \frac{1}{a} \partial_\mu \left[U\eta \right] - \nabla^2 \left(\Phi + \frac{U^2 + V^2}{2} \right)
tΦ \partial_t \Phi =1a(1μ2)λ[UΦ]1aμ[VΦ]Φδ= -\frac{1}{a(1-\mu^2)}\partial_\lambda \left[U\Phi \right] - \frac{1}{a} \partial_\mu \left[V\Phi \right] - \overline{\Phi} \delta

Extracting velocity components:

Use helmholz theorem to decompose: v=k×ψ+χ.\mathbf{v} = \mathbf{k} \times \nabla \psi + \nabla \chi.

Rearranging this and substituting the above definitions gives that η=2Ψ+f\eta = \nabla^2 \Psi + f and δ=2χ \delta = \nabla^2 \chi where we finally find U=1aλχ(1μ2)aμψ U = \frac{1}{a} \partial_\lambda \chi - \frac{(1-\mu^2)}{a} \partial_\mu \psi and V=1aλψ+(1μ2)aμχ. V = \frac{1}{a} \partial_\lambda \psi + \frac{(1-\mu^2)}{a} \partial_\mu \chi.

Discretizing:

Any scalar quantity ξ(λ,φ)\xi(\lambda, \varphi) will be represented by ξ(λ,φ)=m=MMn=mNξn,mPn,m(μ)eimλ\xi(\lambda, \varphi) = \sum_{m=-M}^M \sum_{n=|m|}^N \xi_{n,m}P_{n,m}(\mu)e^{im\lambda}

Parent post: