You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert

5
7
6
8
A shallow water model with a focus on type-flexibility and 16-bit number formats. ShallowWaters allows for Float64/32/16,
@@ -22,74 +24,13 @@ Requires: Julia 1.2 or higher
22
24
23
25
## How to use
24
26
25
-
`RunModel` initialises the model, preallocates memory and starts the time integration. You find the options and default parameters in `src/DefaultParameters.jl` (or by typing `?Parameter`).
26
-
```julia
27
-
help?> Parameter
28
-
search: Parameter
29
-
30
-
Creates a Parameter struct with following options and default values
31
-
32
-
T::DataType=Float32 # number format
33
-
34
-
Tprog::DataType=T # number format for prognostic variables
35
-
Tcomm::DataType=Tprog # number format for ghost-point copies
36
-
37
-
# DOMAIN RESOLUTION AND RATIO
38
-
nx::Int=100# number of grid cells in x-direction
39
-
Lx::Real=2000e3# length of the domain in x-direction [m]
40
-
L_ratio::Real=2# Domain aspect ratio of Lx/Ly
41
-
...
42
-
```
43
-
They can be changed with keyword arguments. The number format `T` is defined as the first (but optional) argument of `RunModel(T,...)`
Starting ShallowWaters on Sun, 20 Oct 201919:58:25 without output.
47
-
100% Integration done in4.65s.
48
-
```
49
-
or by creating a Parameter struct
50
-
```julia
51
-
julia> P =Parameter(bc="nonperiodic",wind_forcing_x="double_gyre",L_ratio=1,nx=128);
52
-
julia> Prog =run_model(P);
53
-
```
54
-
The number formats can be different (aka mixed-precision) for different parts of the model. `Tprog` is the number type for the prognostic variables, `Tcomm` is used for communication of boundary values.
55
-
56
-
## Double-gyre example
57
-
58
-
You can for example run a double gyre simulation like this
59
27
```julia
60
28
julia>using ShallowWaters
61
-
julia> P =run_model(Ndays=100,nx=100,L_ratio=1,bc="nonperiodic",wind_forcing_x="double_gyre",topography="seamount");
62
-
Starting ShallowWaters on Sat, 15 Aug 202011:59:21 without output.
63
-
100% Integration done in13.7s.
64
-
```
65
-
Sea surface height can be visualised via
66
-
```julia
67
-
julia>using PyPlot
68
-
julia>pcolormesh(P.η')
29
+
julia>run_model()
30
+
Starting ShallowWaters on Thu, 20 Jan 202215:44:30 without output.
`P.u` and `P.v` are the u,v velocity components on the Arakawa C-grid. To add them, we need to interpolate them with `Ix,Iy` (which are exported by `ShallowWaters.jl` too), then chopping off the edges to get two arrays of the same size.
Such that the currents are strongest around the two eddies, as expected in this quasi-geostrophic setup.
83
-
84
-
## (Some) Features
85
-
86
-
- Interpolation of initial conditions from low resolution / high resolution runs.
87
-
- Output of relative vorticity, potential vorticity and tendencies du,dv,deta
88
-
- (Pretty accurate) duration estimate
89
-
- Can be run in ensemble mode with ordered non-conflicting output files
90
-
- Runs at CFL=1 (RK4), and more with the strong stability-preserving Runge-Kutta methods
91
-
- Solving the tracer advection comes at basically no cost, thanks to semi-Lagrangian advection scheme
92
-
- Also outputs the gradient operators ∂/∂x,∂/∂y and interpolations Ix, Iy for easier post-processing.
33
+
You just successfully ran ShallowWaters.jl! For more examples and arguments to pass on to `run_model` see the [documentation](https://milankl.github.io/ShallowWaters.jl/dev).
93
34
94
35
## Installation
95
36
@@ -103,26 +44,6 @@ julia> ] add ShallowWaters
103
44
104
45
ShallowWaters.jl was used and is described in more detail in
105
46
106
-
Klöwer M, Düben PD, Palmer TN. Number formats, error mitigation and scope for 16-bit arithmetics in weather and climate modelling analysed with a shallow water model. Journal of Advances in Modeling Earth Systems. doi: [10.1029/2020MS002246](https://dx.doi.org/10.1029/2020MS002246)
107
-
108
-
Klöwer M, Düben PD, Palmer TN. Posits as an alternative to floats for weather and climate models. In: Proceedings of the Conference for Next Generation Arithmetic 2019. doi: [10.1145/3316279.3316281](https://dx.doi.org/10.1145/3316279.3316281)
109
-
110
-
## The equations
111
-
112
-
The non-linear shallow water model plus tracer equation is
with the prognostic variables velocity u⃗ = (u,v) and sea surface heigth η. The layer thickness is h = η + H(x,y). The Coriolis parameter is f = f₀ + βy with beta-plane approximation. The graviational acceleration is g. Bottom friction is either quadratic with drag coefficient c_D or linear with inverse time scale r. Diffusion is realized with a biharmonic diffusion operator, with either a constant viscosity coefficient ν, or a Smagorinsky-like coefficient that scales as ν = c_Smag*|D|, with deformation rate |D| = √((∂u/∂x - ∂v/∂y)² + (∂u/∂y + ∂v/∂x)²). Wind forcing Fx is constant in time, but may vary in space.
>[1] Klöwer M, PD Düben, and TN Palmer, 2020. Number formats, error mitigation and scope for 16-bit arithmetics in weather and climate modelling analysed with a shallow water model. __Journal of Advances in Modeling Earth Systems__, [10.1029/2020MS002246](https://dx.doi.org/10.1029/2020MS002246)
127
48
128
-
ShallowWaters.jl discretises the equation on an equi-distant Arakawa C-grid, with 2nd order finite-difference operators. Boundary conditions are implemented via a ghost-point copy and each variable has a halo of variable size to account for different stencil sizes of various operators.
49
+
>[2] Klöwer M, PD Düben, and TN Palmer, 2019. Posits as an alternative to floats for weather and climate models. In: __Proceedings of the Conference for Next Generation Arithmetic 2019__, Singapore, __ACM__, [10.1145/3316279.3316281](https://dx.doi.org/10.1145/3316279.3316281)
0 commit comments