SpeedyWeather / StochasticStir.jl

Twist it, spin it, but randomly.
GNU General Public License v3.0
4 stars 0 forks source link

StochasticStir.jl

CI DOI

Repository for the implementation of the stochastic stirring forcing and jet drag following Barnes and Hartmann, 2011 and Vallis et al. 2004 for SpeedyWeather.jl.

Background

See

Installation

Via Julia's package manager (opened with ])

julia>]add https://github.com/SpeedyWeather/StochasticStir.jl

or via using Pkg; Pkg.add("https://github.com/SpeedyWeather/StochasticStir.jl"). This package is not registered in Julia's general registry, so you have to specify the whole URL as above. Requires SpeedyWeather.jl v0.8 or higher.

Usage

This package exports StochasticStirring and JetDrag. The respective terms can be added to SpeedyWeather.jl's BarotropicModel or ShallowWaterModel as follows. Feel free to raise an issue here for any related questions.

using SpeedyWeather
using StochasticStir

# model components
spectral_grid = SpectralGrid(trunc=42,nlev=1)   
forcing = StochasticStirring(spectral_grid,latitude=45,strength=7e-11)
drag = JetDrag(spectral_grid,time_scale=Day(6))
initial_conditions = StartFromRest()

# construct the model and initialize
model = BarotropicModel(;spectral_grid,initial_conditions,forcing,drag)
simulation = initialize!(model)

# now run and store output
run!(simulation,period=Day(100),output=true)

and you can get a list of options for JetDrag and StochasticStirring by typing

julia>?JetDrag
julia>?StochasticStirring

where ? opens the help.

Gallery

A visualisation of the above simulation

https://github.com/SpeedyWeather/StochasticStir.jl/assets/25530332/3924a9fd-8515-4628-8128-f555e6054616