Skip to content

Commit

Permalink
Merge pull request #386 from SpeedyWeather/mk/docu
Browse files Browse the repository at this point in the history
Model setups documented
  • Loading branch information
milankl authored Sep 14, 2023
2 parents ee923e7 + 8d2bf19 commit 49e190f
Show file tree
Hide file tree
Showing 15 changed files with 622 additions and 276 deletions.
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ makedocs(
pages=["Home"=>"index.md",
"Installation"=>"installation.md",
"How to run SpeedyWeather.jl"=>"how_to_run_speedy.md",
"Model setups"=>"setups.md",
"Spherical Harmonic Transform"=>"spectral_transform.md",
"Grids"=>"grids.md",
"Barotropic model"=>"barotropic.md",
Expand Down
8 changes: 4 additions & 4 deletions docs/src/barotropic.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Now loop over

## [Horizontal diffusion](@id diffusion)

In SpeedyWeather.jl we use hyerdiffusion through an ``n``-th power Laplacian ``(-1)^{n+1}\nabla^{2n}`` (hyper when ``n>1``) which
In SpeedyWeather.jl we use hyperdiffusion through an ``n``-th power Laplacian ``(-1)^{n+1}\nabla^{2n}`` (hyper when ``n>1``) which
can be implemented as a multiplication of the spectral coefficients ``\Psi_{lm}`` with ``(-l(l+1))^nR^{-2n}`` (see
spectral [Laplacian](@ref)) It is therefore computationally not more expensive to apply hyperdiffusion over diffusion
as the ``(-l(l+1))^nR^{-2n}`` can be precomputed. Note the sign change ``(-1)^{n+1}`` here is such that the dissipative nature of the diffusion operator is retained for ``n`` odd and even.
Expand Down Expand Up @@ -162,7 +162,7 @@ A scaling for vorticity ``\zeta`` and stream function ``\Psi`` is used that is
\tilde{\zeta} = \zeta R, \tilde{\Psi} = \Psi R^{-1}.
```
This is also convenient as vorticity is often ``10^{-5}\text{ s}^{-1}`` in the atmosphere,
but the streamfunction more like ``10^5\text{ m}^2\text{ s}^{-1}`` and so this scaling
but the stream function more like ``10^5\text{ m}^2\text{ s}^{-1}`` and so this scaling
brings both closer to 1 with a typical radius of the Earth of 6371km.
The inversion of the Laplacians in order to obtain ``\Psi`` from ``\zeta`` therefore becomes
```math
Expand All @@ -184,7 +184,7 @@ with
So scaling with the radius squared means we can use dimensionless operators, however, this comes at the
cost of needing to deal with both a time step in seconds as well as a scaled time step in seconds per
meter, which can be confusing. Furthermore, some constants like Coriolis or the diffusion coefficient
need to be scaled too during initialisation, which may be confusing too because values are not
need to be scaled too during initialization, which may be confusing too because values are not
what users expect them to be. SpeedyWeather.jl follows the logic that the scaling to the prognostic
variables is only applied just before the time integration and variables are unscaled for output
and after the time integration finished. That way, the scaling is hidden as much as possible from
Expand All @@ -211,7 +211,7 @@ For the Leapfrog time integration two time steps of the prognostic variables hav
to ``i-1`` in a step that also swaps the indices for the next time step ``i \to i-1`` and ``i+1 \to i``,
so that no additional memory than two time steps have to be stored at the same time.

The Leapfrog time integration has to be initialised with an Euler forward step in order
The Leapfrog time integration has to be initialized with an Euler forward step in order
to have a second time step ``i+1`` available when starting from ``i`` to actually leapfrog over.
SpeedyWeather.jl therefore does two initial time steps that are different from
the leapfrog time steps that follow and that have been described above.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/extending.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# New model setups
# Extending SpeedyWeather

more to come...
14 changes: 5 additions & 9 deletions docs/src/grids.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
The spectral transform (the [Spherical Harmonic Transform](@ref)) in SpeedyWeather.jl supports any ring-based
equi-longitude grid. Several grids are already implemented but other can be added. The following pages will
describe an overview of these grids and but let's start but how they can be used
```julia
julia> spectral_grid = SpectralGrid(Grid = FullGaussianGrid)
SpectralGrid:
Spectral: T31 LowerTriangularMatrix{Complex{Float32}}, radius = 6.371e6 m
Grid: 4608-element, 48-ring FullGaussianGrid{Float32} (quadratic)
Resolution: 333km (average)
Vertical: 8-level SigmaCoordinates
```@example grids
using SpeedyWeather
spectral_grid = SpectralGrid(Grid = FullGaussianGrid)
```
The life of every SpeedyWeather.jl simulation starts with a `SpectralGrid` object which defines the
resolution in spectral and in grid-point space. The generator `SpectralGrid()` can take as a keyword
argument `Grid` which can be any of the grids described below. The resolution of the grid, however,
is not directly chosen, but determined from the spectral resolution `trunc` and the `dealiasing`
factor. More in [Matching spectral and grid resolution](@ref).
factor. More in [SpectralGrid](@ref) and [Matching spectral and grid resolution](@ref).

!!! info "RingGrids is a module too!"
While RingGrids is the underlying module that SpeedyWeather.jl uses for data structs
Expand Down Expand Up @@ -179,7 +175,7 @@ Exactness here means that only rounding errors occur in the transform, meaning t
transform error is very small compared to other errors in a simulation.
This property arises from that property of the
[Gauss-Legendre quadrature](https://en.wikipedia.org/wiki/Gauss%E2%80%93Legendre_quadrature),
which is used in the [Spherical harmonic transform](@ref) with a full Gaussian grid.
which is used in the [Spherical Harmonic Transform](@ref) with a full Gaussian grid.

On the full Gaussian grid there are in total ``N_\phi N_\theta`` grid points, which are squeezed
towards the poles, making the grid area smaller and smaller following a cosine.
Expand Down
Loading

0 comments on commit 49e190f

Please sign in to comment.