Function and type index

Core.TypeMethod

Generator function pulling the resolution information from spectral_grid.

source
SpeedyWeather.AbstractLandSeaMaskType

Abstract type for land-sea masks. Custom land-sea masks have to be defined as

CustomMask{NF<:AbstractFloat, Grid<:AbstractGrid{NF}} <: AbstractLandSeaMask{NF, Grid}

and need to have at least a field called land_sea_mask::Grid that uses a Grid as defined by the spectral grid object, so of correct size and with the number format NF. All AbstractLandSeaMask have a convenient generator function to be used like mask = CustomMask(spectral_grid, option=argument), but you may add your own or customize by defining CustomMask(args...) which should return an instance of type CustomMask{NF, Grid} with parameters matching the spectral grid. Then the initialize function has to be extended for that new mask

initialize!(mask::CustomMask, model::PrimitiveEquation)

which generally is used to tweak the mask.landseamask grid as you like, using any other options you have included in CustomMask as fields or anything else (preferrably read-only, because this is only to initialize the land-sea mask, nothing else) from model. You can for example read something from file, set some values manually, or use coordinates from model.geometry.

The land-sea mask grid is expected to have values between [0, 1] as we use a fractional mask, allowing for grid points being, e.g. quarter land and three quarters sea for 0.25 with 0 (=sea) and 1 (=land). The surface fluxes will weight proportionally the fluxes e.g. from sea and land surface temperatures. Note however, that the land-sea mask can declare grid points being (at least partially) ocean even though the sea surface temperatures aren't defined (=NaN) in that grid point. In that case, not flux is applied.

source
SpeedyWeather.AquaPlanetMaskType

Land-sea mask with zero = sea everywhere.

  • land_sea_mask::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat: Land-sea mask [1] on grid-point space. Land=1, sea=0, land-area fraction in between.
source
SpeedyWeather.BarotropicModelType

The BarotropicModel contains all model components needed for the simulation of the barotropic vorticity equations. To be constructed like

model = BarotropicModel(; spectral_grid, kwargs...)

with spectral_grid::SpectralGrid used to initalize all non-default components passed on as keyword arguments, e.g. planet=Earth(spectral_grid). Fields, representing model components, are

  • spectral_grid::SpectralGrid

  • geometry::SpeedyWeather.AbstractGeometry

  • planet::SpeedyWeather.AbstractPlanet

  • atmosphere::SpeedyWeather.AbstractAtmosphere

  • coriolis::SpeedyWeather.AbstractCoriolis

  • forcing::SpeedyWeather.AbstractForcing

  • drag::SpeedyWeather.AbstractDrag

  • particle_advection::SpeedyWeather.AbstractParticleAdvection

  • initial_conditions::SpeedyWeather.AbstractInitialConditions

  • device_setup::SpeedyWeather.DeviceSetup

  • time_stepping::SpeedyWeather.AbstractTimeStepper

  • spectral_transform::SpectralTransform

  • implicit::SpeedyWeather.AbstractImplicit

  • horizontal_diffusion::SpeedyWeather.AbstractHorizontalDiffusion

  • output::SpeedyWeather.AbstractOutputWriter

  • callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}

  • feedback::SpeedyWeather.AbstractFeedback

source
SpeedyWeather.BulkRichardsonDragType

Boundary layer drag coefficient from the bulk Richardson number, following Frierson, 2006, Journal of the Atmospheric Sciences.

  • κ::Any: von Kármán constant [1]

  • z₀::Any: roughness length [m]

  • Ri_c::Any: Critical Richardson number for stable mixing cutoff [1]

  • drag_max::Base.RefValue: Maximum drag coefficient, κ²/log(zₐ/z₀) for zₐ from reference temperature

source
SpeedyWeather.ClausiusClapeyronType

Parameters for computing saturation vapour pressure of water using the Clausis-Clapeyron equation,

e(T) = e₀ * exp( -Lᵥ/Rᵥ * (1/T - 1/T₀)),

where T is in Kelvin, Lᵥ the the latent heat of condensation and Rᵥ the gas constant of water vapour

  • e₀::AbstractFloat: Saturation water vapour pressure at 0°C [Pa]

  • T₀::AbstractFloat: 0°C in Kelvin

  • Lᵥ::AbstractFloat: Latent heat of condensation/vaporization of water [J/kg]

  • cₚ::AbstractFloat: Specific heat at constant pressure [J/K/kg]

  • R_vapour::AbstractFloat: Gas constant of water vapour [J/kg/K]

  • R_dry::AbstractFloat: Gas constant of dry air [J/kg/K]

  • Lᵥ_Rᵥ::AbstractFloat: Latent heat of condensation divided by gas constant of water vapour [K]

  • T₀⁻¹::AbstractFloat: Inverse of T₀, one over 0°C in Kelvin

  • mol_ratio::AbstractFloat: Ratio of molecular masses [1] of water vapour over dry air (=Rdry/Rvapour).

source
SpeedyWeather.ClausiusClapeyronMethod

Functor: Saturation water vapour pressure as a function of temperature using the Clausius-Clapeyron equation,

e(T) = e₀ * exp( -Lᵥ/Rᵥ * (1/T - 1/T₀)),

where T is in Kelvin, Lᵥ the the latent heat of vaporization and Rᵥ the gas constant of water vapour, T₀ is 0˚C in Kelvin.

source
SpeedyWeather.ClockType

Clock struct keeps track of the model time, how many days to integrate for and how many time steps this takes

  • time::DateTime: current model time

  • start::DateTime: start time of simulation

  • period::Second: period to integrate for, set in set_period!(::Clock, ::Dates.Period)

  • timestep_counter::Int64: Counting all time steps during simulation

  • n_timesteps::Int64: number of time steps to integrate for, set in initialize!(::Clock, ::AbstractTimeStepper)

.

source
SpeedyWeather.ClockMethod
Clock(
    time_stepping::SpeedyWeather.AbstractTimeStepper;
    kwargs...
) -> SpeedyWeather.Clock

Create and initialize a clock from time_stepping

source
SpeedyWeather.ColumnVariablesType

Mutable struct that contains all prognostic (copies thereof) and diagnostic variables in a single column needed to evaluate the physical parametrizations. For now the struct is mutable as we will reuse the struct to iterate over horizontal grid points. Every column vector has nlev entries, from [1] at the top to [end] at the lowermost model level at the planetary boundary layer.

  • nlev::Int64

  • ij::Int64

  • jring::Int64

  • lond::AbstractFloat

  • latd::AbstractFloat

  • land_fraction::AbstractFloat

  • orography::AbstractFloat

  • u::Vector{NF} where NF<:AbstractFloat

  • v::Vector{NF} where NF<:AbstractFloat

  • temp::Vector{NF} where NF<:AbstractFloat

  • humid::Vector{NF} where NF<:AbstractFloat

  • ln_pres::Vector{NF} where NF<:AbstractFloat

  • pres::Vector{NF} where NF<:AbstractFloat

  • u_tend::Vector{NF} where NF<:AbstractFloat

  • v_tend::Vector{NF} where NF<:AbstractFloat

  • temp_tend::Vector{NF} where NF<:AbstractFloat

  • humid_tend::Vector{NF} where NF<:AbstractFloat

  • flux_u_upward::Vector{NF} where NF<:AbstractFloat

  • flux_u_downward::Vector{NF} where NF<:AbstractFloat

  • flux_v_upward::Vector{NF} where NF<:AbstractFloat

  • flux_v_downward::Vector{NF} where NF<:AbstractFloat

  • flux_temp_upward::Vector{NF} where NF<:AbstractFloat

  • flux_temp_downward::Vector{NF} where NF<:AbstractFloat

  • flux_humid_upward::Vector{NF} where NF<:AbstractFloat

  • flux_humid_downward::Vector{NF} where NF<:AbstractFloat

  • boundary_layer_depth::Int64

  • boundary_layer_drag::AbstractFloat

  • surface_geopotential::AbstractFloat

  • surface_u::AbstractFloat

  • surface_v::AbstractFloat

  • surface_temp::AbstractFloat

  • surface_humid::AbstractFloat

  • surface_wind_speed::AbstractFloat

  • skin_temperature_sea::AbstractFloat

  • skin_temperature_land::AbstractFloat

  • soil_moisture_availability::AbstractFloat

  • surface_air_density::AbstractFloat

  • sat_humid::Vector{NF} where NF<:AbstractFloat

  • dry_static_energy::Vector{NF} where NF<:AbstractFloat

  • temp_virt::Vector{NF} where NF<:AbstractFloat

  • bulk_richardson::Vector{NF} where NF<:AbstractFloat

  • geopot::Vector{NF} where NF<:AbstractFloat

  • cloud_top::Int64

  • precip_convection::AbstractFloat

  • precip_large_scale::AbstractFloat

source
SpeedyWeather.DeviceSetupType
DeviceSetup{S<:AbstractDevice}

Holds information about the device the model is running on and workgroup size.

  • device::AbstractDevice: Device the model is running on
  • device_KA::KernelAbstractions.Device: Device for use with KernelAbstractions
  • n: workgroup size
source
SpeedyWeather.DiagnosticVariablesType

All diagnostic variables.

  • layers::Array{DiagnosticVariablesLayer{NF, Grid}, 1} where {NF<:AbstractFloat, Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF}}

  • surface::SpeedyWeather.SurfaceVariables

  • columns::Array{ColumnVariables{NF}, 1} where NF<:AbstractFloat

  • particles::SpeedyWeather.ParticleVariables

  • nlat_half::Int64

  • nlev::Int64

  • npoints::Int64

  • scale::Base.RefValue{NF} where NF<:AbstractFloat

source
SpeedyWeather.DiagnosticVariablesLayerType

All diagnostic variables for a given layer: tendencies, prognostic varibles on the grid, and intermediate dynamics variables.

  • npoints::Int64

  • k::Int64

  • tendencies::SpeedyWeather.Tendencies

  • grid_variables::SpeedyWeather.GridVariables

  • dynamics_variables::SpeedyWeather.DynamicsVariables

  • temp_average::Base.RefValue{NF} where NF<:AbstractFloat

source
SpeedyWeather.DryBettsMillerType

The simplified Betts-Miller convection scheme from Frierson, 2007, https://doi.org/10.1175/JAS3935.1 but with humidity set to zero. Fields and options are

  • nlev::Int64: number of vertical layers/levels

  • time_scale::Second: [OPTION] Relaxation time for profile adjustment

  • temp_ref_profile::Vector: temperature [K] reference profile to adjust to

source
SpeedyWeather.DynamicsVariablesType

Intermediate quantities for the dynamics of a given layer.

  • nlat_half::Int64

  • trunc::Int64

  • a::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

  • b::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

  • a_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • b_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • uv∇lnp::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • uv∇lnp_sum_above::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • div_sum_above::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • temp_virt::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

  • geopot::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

  • σ_tend::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

source
SpeedyWeather.EarthType

Create a struct Earth<:AbstractPlanet, with the following physical/orbital characteristics. Note that radius is not part of it as this should be chosen in SpectralGrid. Keyword arguments are

  • rotation::AbstractFloat: angular frequency of Earth's rotation [rad/s]

  • gravity::AbstractFloat: gravitational acceleration [m/s^2]

  • daily_cycle::Bool: switch on/off daily cycle

  • length_of_day::Second: Seconds in a daily rotation

  • seasonal_cycle::Bool: switch on/off seasonal cycle

  • length_of_year::Second: Seconds in an orbit around the sun

  • equinox::DateTime: time of spring equinox (year irrelevant)

  • axial_tilt::AbstractFloat: angle [˚] rotation axis tilt wrt to orbit

  • solar_constant::AbstractFloat: Total solar irradiance at the distance of 1 AU [W/m²]

source
SpeedyWeather.EarthAtmosphereType

Create a struct EarthAtmosphere <: AbstractAtmosphere, with the following physical/chemical characteristics. Keyword arguments are

  • mol_mass_dry_air::AbstractFloat: molar mass of dry air [g/mol]

  • mol_mass_vapour::AbstractFloat: molar mass of water vapour [g/mol]

  • heat_capacity::AbstractFloat: specific heat at constant pressure cₚ [J/K/kg]

  • R_gas::AbstractFloat: universal gas constant [J/K/mol]

  • R_dry::AbstractFloat: specific gas constant for dry air [J/kg/K]

  • R_vapour::AbstractFloat: specific gas constant for water vapour [J/kg/K]

  • mol_ratio::AbstractFloat: Ratio of gas constants: dry air / water vapour, often called ε [1]

  • μ_virt_temp::AbstractFloat: Virtual temperature Tᵥ calculation, Tᵥ = T(1 + μ*q), humidity q, absolute tempereature T

  • κ::AbstractFloat: = R_dry/cₚ, gas const for air over heat capacity

  • water_density::AbstractFloat: water density [kg/m³]

  • latent_heat_condensation::AbstractFloat: latent heat of condensation [J/kg] for consistency with specific humidity [kg/kg]

  • latent_heat_sublimation::AbstractFloat: latent heat of sublimation [J/kg]

  • stefan_boltzmann::AbstractFloat: stefan-Boltzmann constant [W/m²/K⁴]

  • pres_ref::AbstractFloat: surface reference pressure [Pa]

  • temp_ref::AbstractFloat: surface reference temperature [K]

  • moist_lapse_rate::AbstractFloat: reference moist-adiabatic temperature lapse rate [K/m]

  • dry_lapse_rate::AbstractFloat: reference dry-adiabatic temperature lapse rate [K/m]

  • layer_thickness::AbstractFloat: layer thickness for the shallow water model [m]

source
SpeedyWeather.EarthOrographyType

Earth's orography read from file, with smoothing.

  • path::String: path to the folder containing the orography file, pkg path default

  • file::String: filename of orography

  • file_Grid::Type{<:SpeedyWeather.RingGrids.AbstractGrid}: Grid the orography file comes on

  • scale::Float64: scale orography by a factor

  • smoothing::Bool: smooth the orography field?

  • smoothing_power::Float64: power of Laplacian for smoothing

  • smoothing_strength::Float64: highest degree l is multiplied by

  • smoothing_truncation::Int64: resolution of orography in spectral trunc

  • orography::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • geopot_surf::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

source
SpeedyWeather.EarthOrographyMethod
EarthOrography(
    spectral_grid::SpectralGrid;
    kwargs...
) -> EarthOrography

Generator function pulling the resolution information from spectral_grid.

source
SpeedyWeather.FeedbackType
Feedback() -> Feedback
Feedback(verbose::Bool) -> Feedback
Feedback(verbose::Bool, debug::Bool) -> Feedback

Generator function for a Feedback struct.

source
SpeedyWeather.FeedbackType

Feedback struct that contains options and object for command-line feedback like the progress meter.

  • verbose::Bool: print feedback to REPL?

  • debug::Bool: check for NaRs in the prognostic variables

  • output::Bool: write a progress.txt file? State synced with OutputWriter.output

  • id::Union{Int64, String}: identification of run, taken from ::OutputWriter

  • run_path::String: path to run folder, taken from ::OutputWriter

  • progress_meter::ProgressMeter.Progress: struct containing everything progress related

  • progress_txt::Union{Nothing, IOStream}: txt is a Nothing in case of no output

  • nars_detected::Bool: did Infs/NaNs occur in the simulation?

source
SpeedyWeather.GeometryType

Construct Geometry struct containing parameters and arrays describing an iso-latitude grid <:AbstractGrid and the vertical levels. Pass on SpectralGrid to calculate the following fields

  • spectral_grid::SpectralGrid: SpectralGrid that defines spectral and grid resolution

  • Grid::Type{<:SpeedyWeather.RingGrids.AbstractGrid}: grid of the dynamical core

  • nlat_half::Int64: resolution parameter nlat_half of Grid, # of latitudes on one hemisphere (incl Equator)

  • nlon_max::Int64: maximum number of longitudes (at/around Equator)

  • nlon::Int64: =nlon_max, same (used for compatibility), TODO: still needed?

  • nlat::Int64: number of latitude rings

  • nlev::Int64: number of vertical levels

  • npoints::Int64: total number of grid points

  • radius::AbstractFloat: Planet's radius [m]

  • colat::Vector{Float64}: array of colatitudes in radians (0...π)

  • lat::Vector{NF} where NF<:AbstractFloat: array of latitudes in radians (π...-π)

  • latd::Vector{Float64}: array of latitudes in degrees (90˚...-90˚)

  • lond::Vector{Float64}: array of longitudes in degrees (0...360˚), empty for non-full grids

  • londs::Vector{NF} where NF<:AbstractFloat: longitude (0˚...360˚) for each grid point in ring order

  • latds::Vector{NF} where NF<:AbstractFloat: latitude (-90˚...˚90) for each grid point in ring order

  • lons::Vector{NF} where NF<:AbstractFloat: longitude (0...2π) for each grid point in ring order

  • lats::Vector{NF} where NF<:AbstractFloat: latitude (-π/2...π/2) for each grid point in ring order

  • sinlat::Vector{NF} where NF<:AbstractFloat: sin of latitudes

  • coslat::Vector{NF} where NF<:AbstractFloat: cos of latitudes

  • coslat⁻¹::Vector{NF} where NF<:AbstractFloat: = 1/cos(lat)

  • coslat²::Vector{NF} where NF<:AbstractFloat: = cos²(lat)

  • coslat⁻²::Vector{NF} where NF<:AbstractFloat: # = 1/cos²(lat)

  • σ_levels_half::Vector{NF} where NF<:AbstractFloat: σ at half levels, σ_k+1/2

  • σ_levels_full::Vector{NF} where NF<:AbstractFloat: σ at full levels, σₖ

  • σ_levels_thick::Vector{NF} where NF<:AbstractFloat: σ level thicknesses, σₖ₊₁ - σₖ

  • ln_σ_levels_full::Vector{NF} where NF<:AbstractFloat: log of σ at full levels, include surface (σ=1) as last element

  • full_to_half_interpolation::Vector{NF} where NF<:AbstractFloat: Full to half levels interpolation

source
SpeedyWeather.GeometryMethod
Geometry(spectral_grid::SpectralGrid) -> Geometry

Generator function for Geometry struct based on spectral_grid.

source
SpeedyWeather.GridVariablesType

Transformed prognostic variables (plus a few others) into grid-point space.

  • nlat_half::Int64

  • vor_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • div_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • temp_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • temp_grid_prev::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • temp_virt_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • humid_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • u_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • v_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • u_grid_prev::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • v_grid_prev::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

.

source
SpeedyWeather.HeldSuarezType

Struct that defines the temperature relaxation from Held and Suarez, 1996 BAMS

  • nlat::Int64: number of latitude rings

  • nlev::Int64: number of vertical levels

  • σb::AbstractFloat: sigma coordinate below which faster surface relaxation is applied

  • relax_time_slow::Second: time scale for slow global relaxation

  • relax_time_fast::Second: time scale for faster tropical surface relaxation

  • Tmin::AbstractFloat: minimum equilibrium temperature [K]

  • Tmax::AbstractFloat: maximum equilibrium temperature [K]

  • ΔTy::AbstractFloat: meridional temperature gradient [K]

  • Δθz::AbstractFloat: vertical temperature gradient [K]

  • κ::Base.RefValue{NF} where NF<:AbstractFloat

  • p₀::Base.RefValue{NF} where NF<:AbstractFloat

  • temp_relax_freq::Matrix{NF} where NF<:AbstractFloat

  • temp_equil_a::Vector{NF} where NF<:AbstractFloat

  • temp_equil_b::Vector{NF} where NF<:AbstractFloat

source
SpeedyWeather.HeldSuarezMethod
HeldSuarez(SG::SpectralGrid; kwargs...) -> HeldSuarez

create a HeldSuarez temperature relaxation with arrays allocated given spectral_grid

source
SpeedyWeather.HumidityDiffusionType

Diffusion of dry static energy: A relaxation towards a reference gradient of static energy wrt to geopotential, see Fortran SPEEDY documentation.

  • time_scale::Second: time scale for strength

  • humidity_gradient::AbstractFloat: [1] ∂RH/∂σ, vertical gradient of relative humidity RH wrt sigma coordinate σ

  • Fstar::Base.RefValue{NF} where NF<:AbstractFloat

source
SpeedyWeather.HyperDiffusionType

Struct for horizontal hyper diffusion of vor, div, temp; implicitly in spectral space with a power of the Laplacian (default=4) and the strength controlled by time_scale. Options exist to scale the diffusion by resolution, and adaptive depending on the current vorticity maximum to increase diffusion in active layers. Furthermore the power can be decreased above the tapering_σ to power_stratosphere (default 2). For Barotropic, ShallowWater, the default non-adaptive constant-time scale hyper diffusion is used. Options are

  • trunc::Int64: spectral resolution

  • nlev::Int64: number of vertical levels

  • power::Float64: power of Laplacian

  • time_scale::Second: diffusion time scale

  • resolution_scaling::Float64: stronger diffusion with resolution? 0: constant with trunc, 1: (inverse) linear with trunc, etc

  • power_stratosphere::Float64: different power for tropopause/stratosphere

  • tapering_σ::Float64: linearly scale towards power_stratosphere above this σ

  • adaptive::Bool: adaptive = higher diffusion for layers with higher vorticity levels.

  • vor_max::Float64: above this (absolute) vorticity level [1/s], diffusion is increased

  • adaptive_strength::Float64: increase strength above vor_max by this factor times max(abs(vor))/vor_max

  • ∇²ⁿ_2D::Vector

  • ∇²ⁿ_2D_implicit::Vector

  • ∇²ⁿ::Array{Vector{NF}, 1} where NF

  • ∇²ⁿ_implicit::Array{Vector{NF}, 1} where NF

source
SpeedyWeather.HyperDiffusionMethod
HyperDiffusion(
    spectral_grid::SpectralGrid;
    kwargs...
) -> HyperDiffusion{<:AbstractFloat}

Generator function based on the resolutin in spectral_grid. Passes on keyword arguments.

source
SpeedyWeather.ImplicitCondensationType

Large scale condensation as with implicit precipitation.

  • max_heating::AbstractFloat: Flux limiter for latent heat release [K] per timestep

  • time_scale::AbstractFloat: Time scale in multiples of time step Δt

source
SpeedyWeather.ImplicitPrimitiveEquationType

Struct that holds various precomputed arrays for the semi-implicit correction to prevent gravity waves from amplifying in the primitive equation model.

  • trunc::Int64: spectral resolution

  • nlev::Int64: number of vertical levels

  • α::Float64: time-step coefficient: 0=explicit, 0.5=centred implicit, 1=backward implicit

  • temp_profile::Vector{NF} where NF<:AbstractFloat: vertical temperature profile, obtained from diagn

  • ξ::Base.RefValue{NF} where NF<:AbstractFloat: time step 2α*Δt packed in RefValue for mutability

  • R::Matrix{NF} where NF<:AbstractFloat: divergence: operator for the geopotential calculation

  • U::Vector{NF} where NF<:AbstractFloat: divergence: the -RdTₖ∇² term excl the eigenvalues from ∇² for divergence

  • L::Matrix{NF} where NF<:AbstractFloat: temperature: operator for the TₖD + κTₖDlnps/Dt term

  • W::Vector{NF} where NF<:AbstractFloat: pressure: vertical averaging of the -D̄ term in the log surface pres equation

  • L0::Vector{NF} where NF<:AbstractFloat: components to construct L, 1/ 2Δσ

  • L1::Matrix{NF} where NF<:AbstractFloat: vert advection term in the temperature equation (below+above)

  • L2::Vector{NF} where NF<:AbstractFloat: factor in front of the divsumabove term

  • L3::Matrix{NF} where NF<:AbstractFloat: sumabove operator itself

  • L4::Vector{NF} where NF<:AbstractFloat: factor in front of div term in Dlnps/Dt

  • S::Matrix{NF} where NF<:AbstractFloat: for every l the matrix to be inverted

  • S⁻¹::Array{NF, 3} where NF<:AbstractFloat: combined inverted operator: S = 1 - ξ²(RL + UW)

source
SpeedyWeather.ImplicitShallowWaterType

Struct that holds various precomputed arrays for the semi-implicit correction to prevent gravity waves from amplifying in the shallow water model.

  • trunc::Int64

  • α::Float64: coefficient for semi-implicit computations to filter gravity waves

  • H::Base.RefValue{NF} where NF<:AbstractFloat

  • ξH::Base.RefValue{NF} where NF<:AbstractFloat

  • g∇²::Vector{NF} where NF<:AbstractFloat

  • ξg∇²::Vector{NF} where NF<:AbstractFloat

  • S⁻¹::Vector{NF} where NF<:AbstractFloat

source
SpeedyWeather.JablonowskiRelaxationMethod
JablonowskiRelaxation(
    SG::SpectralGrid;
    kwargs...
) -> JablonowskiRelaxation

create a JablonowskiRelaxation temperature relaxation with arrays allocated given spectral_grid

source
SpeedyWeather.JablonowskiTemperatureType

Create a struct that contains all parameters for the Jablonowski and Williamson, 2006 intitial conditions for the primitive equation model. Default values as in Jablonowski.

  • η₀::Float64: conversion from σ to Jablonowski's ηᵥ-coordinates

  • σ_tropopause::Float64: Sigma coordinates of the tropopause [1]

  • u₀::Float64: max amplitude of zonal wind [m/s]

  • ΔT::Float64: temperature difference used for stratospheric lapse rate [K], Jablonowski uses ΔT = 4.8e5 [K]

  • Tmin::Float64: minimum temperature [K] of profile

source
SpeedyWeather.JetStreamForcingType

Forcing term for the Barotropic or ShallowWaterModel with an idealised jet stream similar to the initial conditions from Galewsky, 2004, but mirrored for both hemispheres.

  • nlat::Int64: Number of latitude rings

  • latitude::Any: jet latitude [˚N]

  • width::Any: jet width [˚], default ≈ 19.29˚

  • speed::Any: jet speed scale [m/s]

  • time_scale::Second: time scale [days]

  • amplitude::Vector: precomputed amplitude vector [m/s²]

source
SpeedyWeather.KeepbitsType

Number of mantissa bits to keep for each prognostic variable when compressed for netCDF and .jld2 data output.

  • u::Int64

  • v::Int64

  • vor::Int64

  • div::Int64

  • temp::Int64

  • pres::Int64

  • humid::Int64

  • precip_cond::Int64

  • precip_conv::Int64

  • cloud::Int64

source
SpeedyWeather.LandSeaMaskType

Land-sea mask, fractional, read from file.

  • path::String: path to the folder containing the land-sea mask file, pkg path default

  • file::String: filename of land sea mask

  • file_Grid::Type{<:SpeedyWeather.RingGrids.AbstractGrid}: Grid the land-sea mask file comes on

  • land_sea_mask::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat: Land-sea mask [1] on grid-point space. Land=1, sea=0, land-area fraction in between.

source
SpeedyWeather.LeapfrogType

Leapfrog time stepping defined by the following fields

  • trunc::Int64: spectral resolution (max degree of spherical harmonics)

  • Δt_at_T31::Second: time step in minutes for T31, scale linearly to trunc

  • radius::AbstractFloat: radius of sphere [m], used for scaling

  • adjust_with_output::Bool: adjust ΔtatT31 with the outputdt to reach outputdt exactly in integer time steps

  • robert_filter::AbstractFloat: Robert (1966) time filter coefficeint to suppress comput. mode

  • williams_filter::AbstractFloat: Williams time filter (Amezcua 2011) coefficient for 3rd order acc

  • Δt_millisec::Dates.Millisecond: time step Δt [ms] at specified resolution

  • Δt_sec::AbstractFloat: time step Δt [s] at specified resolution

  • Δt::AbstractFloat: time step Δt [s/m] at specified resolution, scaled by 1/radius

source
SpeedyWeather.LeapfrogMethod
Leapfrog(spectral_grid::SpectralGrid; kwargs...) -> Leapfrog

Generator function for a Leapfrog struct using spectral_grid for the resolution information.

source
SpeedyWeather.LinearDragType

Linear boundary layer drag following Held and Suarez, 1996 BAMS

  • nlev::Int64

  • σb::AbstractFloat

  • time_scale::Second

  • drag_coefs::Vector{NF} where NF<:AbstractFloat

source
SpeedyWeather.NoOrographyType

Orography with zero height in orography and zero surface geopotential geopot_surf.

  • orography::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat: height [m] on grid-point space.

  • geopot_surf::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat: surface geopotential, height*gravity [m²/s²]

source
SpeedyWeather.NoOrographyMethod
NoOrography(spectral_grid::SpectralGrid) -> NoOrography

Generator function pulling the resolution information from spectral_grid.

source
SpeedyWeather.OutputWriterType

NetCDF output writer. Contains all output options and auxiliary fields for output interpolation. To be initialised with OutputWriter(::SpectralGrid, ::Type{<:ModelSetup}, kwargs...) to pass on the resolution information and the model type which chooses which variables to output. Options include

  • spectral_grid::SpectralGrid

  • output::Bool

  • path::String: [OPTION] path to output folder, run_???? will be created within

  • id::String: [OPTION] run identification number/string

  • run_path::String

  • filename::String: [OPTION] name of the output netcdf file

  • write_restart::Bool: [OPTION] also write restart file if output==true?

  • pkg_version::VersionNumber

  • startdate::DateTime

  • output_dt::Second: [OPTION] output frequency, time step

  • output_vars::Vector{Symbol}: [OPTION] which variables to output, u, v, vor, div, pres, temp, humid

  • missing_value::Union{Float32, Float64}: [OPTION] missing value to be used in netcdf output

  • compression_level::Int64: [OPTION] lossless compression level; 1=low but fast, 9=high but slow

  • shuffle::Bool: [OPTION] shuffle/bittranspose filter for compression

  • keepbits::SpeedyWeather.Keepbits: [OPTION] mantissa bits to keep for every variable

  • output_every_n_steps::Int64

  • timestep_counter::Int64

  • output_counter::Int64

  • netcdf_file::Union{Nothing, NCDatasets.NCDataset}

  • input_Grid::Type{<:SpeedyWeather.RingGrids.AbstractGrid}

  • as_matrix::Bool: [OPTION] sort grid points into a matrix (interpolation-free), for OctahedralClenshawGrid, OctaHEALPixGrid only

  • quadrant_rotation::NTuple{4, Int64}

  • matrix_quadrant::NTuple{4, Tuple{Int64, Int64}}

  • output_Grid::Type{<:SpeedyWeather.RingGrids.AbstractFullGrid}: [OPTION] the grid used for output, full grids only

  • nlat_half::Int64: [OPTION] the resolution of the output grid, default: same nlat_half as in the dynamical core

  • nlon::Int64

  • nlat::Int64

  • npoints::Int64

  • nlev::Int64

  • interpolator::SpeedyWeather.RingGrids.AbstractInterpolator

  • u::Matrix{NF} where NF<:Union{Float32, Float64}

  • v::Matrix{NF} where NF<:Union{Float32, Float64}

  • vor::Matrix{NF} where NF<:Union{Float32, Float64}

  • div::Matrix{NF} where NF<:Union{Float32, Float64}

  • temp::Matrix{NF} where NF<:Union{Float32, Float64}

  • pres::Matrix{NF} where NF<:Union{Float32, Float64}

  • humid::Matrix{NF} where NF<:Union{Float32, Float64}

  • precip_cond::Matrix{NF} where NF<:Union{Float32, Float64}

  • precip_conv::Matrix{NF} where NF<:Union{Float32, Float64}

  • cloud::Matrix{NF} where NF<:Union{Float32, Float64}

source
SpeedyWeather.ParticleType

Particle with location lon (longitude), lat (latitude) and σ (vertical coordinate). Longitude is assumed to be in [0,360˚E), latitude in [-90˚,90˚N] and σ in [0,1] but not strictly enforced at creation, see mod(::Particle) and ismod(::Particle). A particle is either active or inactive, determined by the Boolean in it's 2nd type parameter. By default, a particle is active, of number format DEFAULT_NF and at 0˚N, 0˚E, σ=0.

  • lon::AbstractFloat: longitude in [0,360˚]

  • lat::AbstractFloat: latitude [-90˚,90˚]

  • σ::AbstractFloat: vertical sigma coordinate [0 (top) to 1 (surface)]

source
SpeedyWeather.ParticleTrackerType

A ParticleTracker is implemented as a callback to output the trajectories of particles from particle advection. To be added like

add!(model.callbacks, ParticleTracker(spectral_grid; kwargs...))

Output done via netCDF. Fields and options are

  • Δt::Second: [OPTION] Frequency to track particles at

  • file_name::String: [OPTION] File name for netCDF file

  • compression_level::Int64: [OPTION] lossless compression level; 1=low but fast, 9=high but slow

  • shuffle::Bool: [OPTION] shuffle/bittranspose filter for compression

  • keepbits::Int64: [OPTION] mantissa bits to keep, (14, 15, 16) means at least (2km, 1km, 500m) accurate locations

  • n_particles::Int64: Number of particles to track

  • n_steps::Int64: Number of timesteps to track particles at (first and last incl)

  • counter::Int64: Count up the tracked particle positions

  • every_n_timesteps::Int64: Execute callback every n time steps

  • netcdf_file::Union{Nothing, NCDatasets.NCDataset}: The netcdf file to be written into, will be created at initialization

  • lon::Vector

  • lat::Vector

  • σ::Vector

source
SpeedyWeather.PrimitiveDryModelType

The PrimitiveDryModel struct holds all other structs that contain precalculated constants, whether scalars or arrays that do not change throughout model integration.

  • spectral_grid::SpectralGrid

  • geometry::SpeedyWeather.AbstractGeometry

  • dynamics::Bool

  • planet::SpeedyWeather.AbstractPlanet

  • atmosphere::SpeedyWeather.AbstractAtmosphere

  • coriolis::SpeedyWeather.AbstractCoriolis

  • geopotential::SpeedyWeather.AbstractGeopotential

  • adiabatic_conversion::SpeedyWeather.AbstractAdiabaticConversion

  • particle_advection::SpeedyWeather.AbstractParticleAdvection

  • initial_conditions::SpeedyWeather.AbstractInitialConditions

  • orography::SpeedyWeather.AbstractOrography

  • land_sea_mask::SpeedyWeather.AbstractLandSeaMask

  • ocean::SpeedyWeather.AbstractOcean

  • land::SpeedyWeather.AbstractLand

  • solar_zenith::SpeedyWeather.AbstractZenith

  • physics::Bool

  • boundary_layer_drag::SpeedyWeather.AbstractBoundaryLayer

  • temperature_relaxation::SpeedyWeather.AbstractTemperatureRelaxation

  • static_energy_diffusion::SpeedyWeather.AbstractVerticalDiffusion

  • surface_thermodynamics::SpeedyWeather.AbstractSurfaceThermodynamics

  • surface_wind::SpeedyWeather.AbstractSurfaceWind

  • surface_heat_flux::SpeedyWeather.AbstractSurfaceHeat

  • convection::SpeedyWeather.AbstractConvection

  • shortwave_radiation::SpeedyWeather.AbstractShortwave

  • longwave_radiation::SpeedyWeather.AbstractLongwave

  • device_setup::SpeedyWeather.DeviceSetup

  • time_stepping::SpeedyWeather.AbstractTimeStepper

  • spectral_transform::SpectralTransform

  • implicit::SpeedyWeather.AbstractImplicit

  • horizontal_diffusion::SpeedyWeather.AbstractHorizontalDiffusion

  • vertical_advection::SpeedyWeather.AbstractVerticalAdvection

  • output::SpeedyWeather.AbstractOutputWriter

  • callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}

  • feedback::SpeedyWeather.AbstractFeedback

source
SpeedyWeather.PrimitiveWetModelType

The PrimitiveDryModel struct holds all other structs that contain precalculated constants, whether scalars or arrays that do not change throughout model integration.

  • spectral_grid::SpectralGrid

  • geometry::SpeedyWeather.AbstractGeometry

  • dynamics::Bool

  • planet::SpeedyWeather.AbstractPlanet

  • atmosphere::SpeedyWeather.AbstractAtmosphere

  • coriolis::SpeedyWeather.AbstractCoriolis

  • geopotential::SpeedyWeather.AbstractGeopotential

  • adiabatic_conversion::SpeedyWeather.AbstractAdiabaticConversion

  • particle_advection::SpeedyWeather.AbstractParticleAdvection

  • initial_conditions::SpeedyWeather.AbstractInitialConditions

  • orography::SpeedyWeather.AbstractOrography

  • land_sea_mask::SpeedyWeather.AbstractLandSeaMask

  • ocean::SpeedyWeather.AbstractOcean

  • land::SpeedyWeather.AbstractLand

  • solar_zenith::SpeedyWeather.AbstractZenith

  • soil::SpeedyWeather.AbstractSoil

  • vegetation::SpeedyWeather.AbstractVegetation

  • physics::Bool

  • clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron

  • boundary_layer_drag::SpeedyWeather.AbstractBoundaryLayer

  • temperature_relaxation::SpeedyWeather.AbstractTemperatureRelaxation

  • static_energy_diffusion::SpeedyWeather.AbstractVerticalDiffusion

  • humidity_diffusion::SpeedyWeather.AbstractVerticalDiffusion

  • surface_thermodynamics::SpeedyWeather.AbstractSurfaceThermodynamics

  • surface_wind::SpeedyWeather.AbstractSurfaceWind

  • surface_heat_flux::SpeedyWeather.AbstractSurfaceHeat

  • evaporation::SpeedyWeather.AbstractEvaporation

  • large_scale_condensation::SpeedyWeather.AbstractCondensation

  • convection::SpeedyWeather.AbstractConvection

  • shortwave_radiation::SpeedyWeather.AbstractShortwave

  • longwave_radiation::SpeedyWeather.AbstractLongwave

  • device_setup::SpeedyWeather.DeviceSetup

  • time_stepping::SpeedyWeather.AbstractTimeStepper

  • spectral_transform::SpectralTransform

  • implicit::SpeedyWeather.AbstractImplicit

  • horizontal_diffusion::SpeedyWeather.AbstractHorizontalDiffusion

  • vertical_advection::SpeedyWeather.AbstractVerticalAdvection

  • hole_filling::SpeedyWeather.AbstractHoleFilling

  • output::SpeedyWeather.AbstractOutputWriter

  • callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}

  • feedback::SpeedyWeather.AbstractFeedback

source
SpeedyWeather.PrognosticLayerTimestepsType

Collect the n time steps of PrognosticVariablesLayer of an n-step time integration (leapfrog=2) into a single struct.

  • timesteps::Array{PrognosticVariablesLayer{NF}, 1} where NF<:AbstractFloat

.

source
SpeedyWeather.PrognosticSurfaceTimestepsType

Collect the n time steps of PrognosticVariablesSurface of an n-step time integration (leapfrog=2) into a single struct.

  • timesteps::Array{SpeedyWeather.PrognosticVariablesSurface{NF}, 1} where NF<:AbstractFloat

.

source
SpeedyWeather.PrognosticVariablesLayerType

A layer of the prognostic variables in spectral space.

  • trunc::Int64: Spectral resolution as max degree of spherical harmonics

  • vor::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat: Vorticity of horizontal wind field [1/s]

  • div::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat: Divergence of horizontal wind field [1/s]

  • temp::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat: Absolute temperature [K]

  • humid::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat: Specific humidity [kg/kg]

source
SpeedyWeather.PrognosticVariablesSurfaceType

The spectral and gridded prognostic variables at the surface.

  • trunc::Int64: Spectral resolution as max degree of spherical harmonics

  • pres::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat: log of surface pressure [log(Pa)] for PrimitiveEquation, interface displacement [m] for ShallowWaterModel

source
SpeedyWeather.RandomWavesType

Parameters for random initial conditions for the interface displacement η in the shallow water equations.

  • A::Float64

  • lmin::Int64

  • lmax::Int64

source
SpeedyWeather.ShallowWaterModelType

The ShallowWaterModel contains all model components needed for the simulation of the shallow water equations. To be constructed like

model = ShallowWaterModel(; spectral_grid, kwargs...)

with spectral_grid::SpectralGrid used to initalize all non-default components passed on as keyword arguments, e.g. planet=Earth(spectral_grid). Fields, representing model components, are

  • spectral_grid::SpectralGrid

  • device_setup::SpeedyWeather.DeviceSetup

  • planet::SpeedyWeather.AbstractPlanet

  • atmosphere::SpeedyWeather.AbstractAtmosphere

  • coriolis::SpeedyWeather.AbstractCoriolis

  • orography::SpeedyWeather.AbstractOrography

  • forcing::SpeedyWeather.AbstractForcing

  • drag::SpeedyWeather.AbstractDrag

  • particle_advection::SpeedyWeather.AbstractParticleAdvection

  • initial_conditions::SpeedyWeather.AbstractInitialConditions

  • time_stepping::SpeedyWeather.AbstractTimeStepper

  • spectral_transform::SpectralTransform

  • implicit::SpeedyWeather.AbstractImplicit

  • horizontal_diffusion::SpeedyWeather.AbstractHorizontalDiffusion

  • geometry::SpeedyWeather.AbstractGeometry

  • output::SpeedyWeather.AbstractOutputWriter

  • callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}

  • feedback::SpeedyWeather.AbstractFeedback

source
SpeedyWeather.SimplifiedBettsMillerType

The simplified Betts-Miller convection scheme from Frierson, 2007, https://doi.org/10.1175/JAS3935.1. This implements the qref-formulation in their paper. Fields and options are

  • nlev::Int64: number of vertical layers/levels

  • time_scale::Second: [OPTION] Relaxation time for profile adjustment

  • relative_humidity::Any: [OPTION] Relative humidity for reference profile

  • temp_ref_profile::Vector: temperature [K] reference profile to adjust to

  • humid_ref_profile::Vector: specific humidity [kg/kg] profile to adjust to

source
SpeedyWeather.SimulationType

Simulation is a container struct to be used with run!(::Simulation). It contains

  • prognostic_variables::PrognosticVariables: define the current state of the model

  • diagnostic_variables::DiagnosticVariables: contain the tendencies and auxiliary arrays to compute them

  • model::ModelSetup: all parameters, constant at runtime

source
SpeedyWeather.SinSolarDeclinationType

Coefficients to calculate the solar declination angle δ [radians] based on a simple sine function, with Earth's axial tilt as amplitude, equinox as phase shift.

  • axial_tilt::Any

  • equinox::DateTime

  • length_of_year::Second

  • length_of_day::Second

source
SpeedyWeather.SinSolarDeclinationMethod

SinSolarDeclination functor, computing the solar declination angle of angular fraction of year g [radians] using the coefficients of the SinSolarDeclination struct.

source
SpeedyWeather.SolarDeclinationType

Coefficients to calculate the solar declination angle δ from

δ = 0.006918    - 0.399912*cos(g)  + 0.070257*sin(g)
                - 0.006758*cos(2g) + 0.000907*sin(2g)
                - 0.002697*cos(3g) + 0.001480*sin(3g)

with g the angular fraction of the year in radians. Following Spencer 1971, Fourier series representation of the position of the sun. Search 2(5):172.

  • a::AbstractFloat

  • s1::AbstractFloat

  • c1::AbstractFloat

  • s2::AbstractFloat

  • c2::AbstractFloat

  • s3::AbstractFloat

  • c3::AbstractFloat

source
SpeedyWeather.SolarDeclinationMethod

SolarDeclination functor, computing the solar declination angle of angular fraction of year g [radians] using the coefficients of the SolarDeclination struct.

source
SpeedyWeather.SolarTimeCorrectionType

Coefficients for the solar time correction (also called Equation of time) which adjusts the solar hour to an oscillation of sunrise/set by about +-16min throughout the year.

source
SpeedyWeather.SolarZenithType

Solar zenith angle varying with daily and seasonal cycle.

  • nlat_half::Int64

  • length_of_day::Second

  • length_of_year::Second

  • equation_of_time::Bool

  • seasonal_cycle::Bool

  • solar_declination::SpeedyWeather.SinSolarDeclination{NF} where NF<:AbstractFloat

  • time_correction::SpeedyWeather.SolarTimeCorrection

  • initial_time::Base.RefValue{DateTime}

  • cos_zenith::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

source
SpeedyWeather.SolarZenithSeasonType

Solar zenith angle varying with seasonal cycle only.

  • nlat_half::Int64

  • length_of_day::Second

  • length_of_year::Second

  • seasonal_cycle::Bool

  • solar_declination::SpeedyWeather.SinSolarDeclination{NF} where NF<:AbstractFloat

  • initial_time::Base.RefValue{DateTime}

  • cos_zenith::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

source
SpeedyWeather.SpectralGridType

Defines the horizontal spectral resolution and corresponding grid and the vertical coordinate for SpeedyWeather.jl. Options are

  • NF::Type{<:AbstractFloat}: [OPTION] number format used throughout the model

  • trunc::Int64: [OPTION] horizontal resolution as the maximum degree of spherical harmonics

  • Grid::Type{<:SpeedyWeather.RingGrids.AbstractGrid}: [OPTION] horizontal grid used for calculations in grid-point space

  • dealiasing::Float64: [OPTION] how to match spectral with grid resolution: dealiasing factor, 1=linear, 2=quadratic, 3=cubic grid

  • radius::Float64: [OPTION] radius of the sphere [m]

  • n_particles::Int64: [OPTION] number of particles for particle advection [1]

  • nlat_half::Int64: number of latitude rings on one hemisphere (Equator incl)

  • nlat::Int64: number of latitude rings on both hemispheres

  • npoints::Int64: total number of grid points in the horizontal

  • nlev::Int64: [OPTION] number of vertical levels

  • vertical_coordinates::SpeedyWeather.VerticalCoordinates: [OPTION] coordinates used to discretize the vertical

nlat_half and npoints should not be chosen but are derived from trunc, Grid and dealiasing.

source
SpeedyWeather.SpeedyTransforms.SpectralTransformMethod
SpectralTransform(
    spectral_grid::SpectralGrid;
    recompute_legendre,
    one_more_degree,
    kwargs...
) -> SpectralTransform

Generator function for a SpectralTransform struct pulling in parameters from a SpectralGrid struct.

source
SpeedyWeather.StartFromFileType

Restart from a previous SpeedyWeather.jl simulation via the restart file restart.jld2 Applies interpolation in the horizontal but not in the vertical. restart.jld2 is identified by

  • path::String: path for restart file

  • id::Union{Int64, String}: run_id of restart file in run_????/restart.jld2

source
SpeedyWeather.StartWithRandomVorticityType

Start with random vorticity as initial conditions

  • power::Float64: Power of the spectral distribution k^power

  • amplitude::Float64: (approximate) amplitude in [1/s], used as standard deviation of spherical harmonic coefficients

source
SpeedyWeather.StaticEnergyDiffusionType

Diffusion of dry static energy: A relaxation towards a reference gradient of static energy wrt to geopotential, see Fortran SPEEDY documentation.

  • time_scale::Second: time scale for strength

  • static_energy_lapse_rate::AbstractFloat: [1] ∂SE/∂Φ, vertical gradient of static energy SE with geopotential Φ

  • Fstar::Base.RefValue{NF} where NF<:AbstractFloat

source
SpeedyWeather.SurfaceEvaporationType

Surface evaporation following a bulk formula with wind from model.surface_wind

  • use_boundary_layer_drag::Bool: Use column.boundarylayerdrag coefficient

  • moisture_exchange_land::AbstractFloat: Otherwise, use the following drag coefficient for evaporation over land

  • moisture_exchange_sea::AbstractFloat: Or drag coefficient for evaporation over sea

source
SpeedyWeather.SurfaceVariablesType

Diagnostic variables for the surface layer.

  • nlat_half::Int64

  • trunc::Int64

  • npoints::Int64

  • pres_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • pres_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

  • pres_tend_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • ∇lnp_x::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • ∇lnp_y::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • u_mean_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • v_mean_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • div_mean_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • div_mean::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

  • precip_large_scale::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • precip_convection::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • cloud_top::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • soil_moisture_availability::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

source
SpeedyWeather.TendenciesType

Tendencies of the prognostic spectral variables for a given layer.

  • nlat_half::Int64

  • trunc::Int64

  • vor_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

  • div_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

  • temp_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

  • humid_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

  • u_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

  • v_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

  • u_tend_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • v_tend_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • temp_tend_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • humid_tend_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

source
SpeedyWeather.TetensEquationType

Parameters for computing saturation vapour pressure of water using the Tetens' equation,

eᵢ(T) = e₀ * exp(Cᵢ * (T - T₀) / (T + Tᵢ)),

where T is in Kelvin and i = 1, 2 for saturation above and below freezing, respectively. From Tetens (1930), and Murray (1967) for below freezing.

  • e₀::AbstractFloat: Saturation water vapour pressure at 0°C [Pa]

  • T₀::AbstractFloat: 0°C in Kelvin

  • T₁::AbstractFloat: Tetens denominator (water) [˚C]

  • T₂::AbstractFloat: Tetens denominator following Murray (1967, below freezing) [˚C]

  • C₁::AbstractFloat: Tetens numerator scaling [1], above freezing

  • C₂::AbstractFloat: Tetens numerator scaling [1], below freezing

source
SpeedyWeather.TetensEquationMethod

Functor: Saturation water vapour pressure as a function of temperature using the Tetens equation,

eᵢ(T) = e₀ * exp(Cᵢ * (T - T₀) / (T - Tᵢ)),

where T is in Kelvin and i = 1, 2 for saturation above and below freezing, respectively.

source
SpeedyWeather.ZonalJetType

A struct that contains all parameters for the Galewsky et al, 2004 zonal jet intitial conditions for the shallow water model. Default values as in Galewsky.

  • latitude::Float64: jet latitude [˚N]

  • width::Float64: jet width [˚], default ≈ 19.29˚

  • umax::Float64: jet maximum velocity [m/s]

  • perturb_lat::Float64: perturbation latitude [˚N], position in jet by default

  • perturb_lon::Float64: perturbation longitude [˚E]

  • perturb_xwidth::Float64: perturbation zonal extent [˚], default ≈ 19.1˚

  • perturb_ywidth::Float64: perturbation meridinoal extent [˚], default ≈ 3.8˚

  • perturb_height::Float64: perturbation amplitude [m]

source
SpeedyWeather.ZonalRidgeType

Zonal ridge orography after Jablonowski and Williamson, 2006.

  • η₀::Float64: conversion from σ to Jablonowski's ηᵥ-coordinates

  • u₀::Float64: max amplitude of zonal wind [m/s] that scales orography height

  • orography::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

  • geopot_surf::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

source
SpeedyWeather.ZonalRidgeMethod
ZonalRidge(
    spectral_grid::SpectralGrid;
    kwargs...
) -> ZonalRidge

Generator function pulling the resolution information from spectral_grid.

source
SpeedyWeather.ZonalWindType

Create a struct that contains all parameters for the Jablonowski and Williamson, 2006 intitial conditions for the primitive equation model. Default values as in Jablonowski.

  • η₀::Float64: conversion from σ to Jablonowski's ηᵥ-coordinates

  • u₀::Float64: max amplitude of zonal wind [m/s]

  • perturb_lat::Float64: perturbation centred at [˚N]

  • perturb_lon::Float64: perturbation centred at [˚E]

  • perturb_uₚ::Float64: perturbation strength [m/s]

  • perturb_radius::Float64: radius of Gaussian perturbation in units of Earth's radius [1]

source
Base.copy!Method
copy!(progn_new::PrognosticVariables, progn_old::PrognosticVariables)

Copies entries of progn_old into progn_new. Only copies those variables that are present in the model of both progn_new and progn_old.

source
Base.modMethod
mod(p::Particle) -> Any

Modulo operator for particle locations to map them back into [0,360˚E) and [-90˚,90˚N], in the horizontal and to clamp vertical σ coordinates into [0,1].

source
SpeedyWeather.CallbackDictMethod
CallbackDict(
    pairs::Pair{Symbol, <:SpeedyWeather.AbstractCallback}...
) -> Dict{Symbol, SpeedyWeather.AbstractCallback}

Create Callback dictionary like normal dictionaries.

source
SpeedyWeather.DeviceMethod
Device()

Return default used device for internal purposes, either CPUDevice or GPUDevice if a GPU is available.

source
SpeedyWeather.DeviceArrayMethod
DeviceArray(device::AbstractDevice, x)

Adapts x to a CuArray when device<:GPUDevice is used, otherwise a regular Array. Uses adapt, thus also can return SubArrays etc.

source
SpeedyWeather.DeviceArrayNotAdaptMethod
DeviceArrayNotAdapt(device::AbstractDevice, x)

Returns a CuArray when device<:GPUDevice is used, otherwise a regular Array. Doesn't uses adapt, therefore always returns CuArray/Array

source
SpeedyWeather.SpeedyTransforms.gridded!Method
gridded!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Int64,
    model::ModelSetup
)

Propagate the spectral state of progn to diagn using time step/leapfrog index lf. Function barrier that calls gridded! for the respective model.

source
SpeedyWeather.SpeedyTransforms.gridded!Method
gridded!(
    diagn::DiagnosticVariablesLayer,
    progn::PrognosticVariablesLayer,
    model::Barotropic
)

Propagate the spectral state of the prognostic variables progn to the diagnostic variables in diagn for the barotropic vorticity model. Updates grid vorticity, spectral stream function and spectral and grid velocities u, v.

source
SpeedyWeather.SpeedyTransforms.gridded!Method
gridded!(
    diagn::DiagnosticVariablesLayer,
    progn::PrognosticVariablesLayer,
    model::PrimitiveEquation
)

Propagate the spectral state of the prognostic variables progn to the diagnostic variables in diagn for primitive equation models. Updates grid vorticity, grid divergence, grid temperature, pressure (pres_grid) and the velocities u, v.

source
SpeedyWeather.SpeedyTransforms.gridded!Method
gridded!(
    diagn::DiagnosticVariablesLayer,
    progn::PrognosticVariablesLayer,
    model::ShallowWater
)

Propagate the spectral state of the prognostic variables progn to the diagnostic variables in diagn for the shallow water model. Updates grid vorticity, grid divergence, grid interface displacement (pres_grid) and the velocities u, v.

source
SpeedyWeather.WhichZenithMethod
WhichZenith(
    SG::SpectralGrid,
    P::SpeedyWeather.AbstractPlanet;
    kwargs...
) -> Any

Chooses from SolarZenith (daily and seasonal cycle) or SolarZenithSeason given the parameters in model.planet. In both cases the seasonal cycle can be disabled, calculating the solar declination from the initial time instead of current time.

source
SpeedyWeather.activateMethod
activate(
    p::Particle{NF}
) -> Particle{NF, true} where NF<:AbstractFloat

Activate particle. Active particles can move.

source
SpeedyWeather.add!Method
add!(
    D::Dict{Symbol, SpeedyWeather.AbstractCallback},
    key_callbacks::Pair{Symbol, <:SpeedyWeather.AbstractCallback}...
)

Add a or several callbacks to a Dict{String, AbstractCallback} dictionary. To be used like

add!(model.callbacks, :my_callback => callback)
add!(model.callbacks, :my_callback1 => callback, :my_callback2 => other_callback)
source
SpeedyWeather.add!Method
add!(
    D::Dict{Symbol, SpeedyWeather.AbstractCallback},
    callbacks::SpeedyWeather.AbstractCallback...
)

Add a or several callbacks to a Dict{Symbol, AbstractCallback} dictionary without specifying the key which is randomly created like callback_????. To be used like

add!(model.callbacks, callback)
add!(model.callbacks, callback1, callback2).
source
SpeedyWeather.bernoulli_potential!Method
bernoulli_potential!(
    diagn::DiagnosticVariablesLayer{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
    S::SpectralTransform
) -> LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

Computes the Laplace operator ∇² of the Bernoulli potential B in spectral space.

  1. computes the kinetic energy KE = ½(u²+v²) on the grid
  2. transforms KE to spectral space
  3. adds geopotential for the Bernoulli potential in spectral space
  4. takes the Laplace operator.

This version is used for both ShallowWater and PrimitiveEquation, only the geopotential calculation in geopotential! differs.

source
SpeedyWeather.boundary_layer_drag!Method
boundary_layer_drag!(
    column::ColumnVariables,
    scheme::LinearDrag
)

Compute tendency for boundary layer drag of a column and add to its tendencies fields

source
SpeedyWeather.callback!Method
callback!(
    callback::GlobalSurfaceTemperatureCallback,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::ModelSetup
) -> AbstractFloat

Pulls the average temperature from the lowermost layer and stores it in the next element of the callback.temp vector.

source
SpeedyWeather.convection!Method
convection!(
    column::ColumnVariables{NF},
    DBM::DryBettsMiller,
    geometry::Geometry,
    atmosphere::SpeedyWeather.AbstractAtmosphere
)

calculates temperature tendency for the dry convection scheme following the simplified Betts-Miller convection from Frierson 2007 but with zero humidity. Starts with a first-guess relaxation to determine the convective criterion, then adjusts the reference profiles for thermodynamic consistency (e.g. in dry convection the humidity profile is non-precipitating), and relaxes current vertical profiles to the adjusted references.

source
SpeedyWeather.convection!Method
convection!(
    column::ColumnVariables{NF},
    SBM::SimplifiedBettsMiller,
    clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron,
    geometry::Geometry,
    planet::SpeedyWeather.AbstractPlanet,
    atmosphere::SpeedyWeather.AbstractAtmosphere,
    time_stepping::SpeedyWeather.AbstractTimeStepper
) -> Union{Nothing, Int64}

calculates temperature and humidity tendencies for the convection scheme following the simplified Betts-Miller convection. Starts with a first-guess relaxation to determine the convective criteria (none, dry/shallow or deep), then adjusts reference profiles for thermodynamic consistency (e.g. in dry convection the humidity profile is non-precipitating), and relaxes current vertical profiles to the adjusted references.

source
SpeedyWeather.coriolisMethod
coriolis(
    grid::SpeedyWeather.RingGrids.AbstractGrid;
    rotation
) -> Any

Return the Coriolis parameter f on a grid like grid on a planet of ratation [1/s]. Default rotation of Earth.

source
SpeedyWeather.coriolisMethod
coriolis(
    grid::SpeedyWeather.RingGrids.AbstractGrid;
    rotation
) -> Any

Return the Coriolis parameter f on the grid Grid of resolution nlat_half on a planet of ratation [1/s]. Default rotation of Earth.

source
SpeedyWeather.cos_zenith!Method
cos_zenith!(
    S::SolarZenithSeason{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
    time::DateTime,
    geometry::SpeedyWeather.AbstractGeometry
)

Calculate cos of solar zenith angle as daily average at time time. Seasonal cycle or time correction may be disabled, depending on parameters in SolarZenithSeason.

source
SpeedyWeather.cos_zenith!Method
cos_zenith!(
    S::SolarZenith{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
    time::DateTime,
    geometry::SpeedyWeather.AbstractGeometry
)

Calculate cos of solar zenith angle with a daily cycle at time time. Seasonal cycle or time correction may be disabled, depending on parameters in SolarZenith.

source
SpeedyWeather.create_output_folderMethod
create_output_folder(
    path::String,
    id::Union{Int64, String}
) -> String

Creates a new folder run_* with the identification id. Also returns the full path run_path of that folder.

source
SpeedyWeather.deactivateMethod
deactivate(
    p::Particle{NF}
) -> Particle{_A, false} where _A<:AbstractFloat

Deactivate particle. Inactive particles cannot move.

source
SpeedyWeather.default_sigma_coordinatesMethod
default_sigma_coordinates(nlev::Integer) -> Vector{Float64}

Vertical sigma coordinates defined by their nlev+1 half levels σ_levels_half. Sigma coordinates are fraction of surface pressure (p/p0) and are sorted from top (stratosphere) to bottom (surface). The first half level is at 0 the last at 1. Default levels are equally spaced from 0 to 1 (including).

source
SpeedyWeather.drag!Method
drag!(
    diagn::DiagnosticVariablesLayer,
    drag::QuadraticDrag{NF}
)

Quadratic drag for the momentum equations.

F = -c_D/H*|(u, v)|*(u, v)

with cD the non-dimensional drag coefficient as defined in drag::QuadraticDrag. cD and layer thickness H are precomputed in intialize!(::QuadraticDrag, ::ModelSetup) and scaled by the radius as are the momentum equations.

source
SpeedyWeather.dry_adiabat!Method
dry_adiabat!(
    temp_ref_profile::AbstractVector,
    temp_environment::AbstractVector,
    σ::AbstractVector,
    atmosphere::SpeedyWeather.AbstractAtmosphere
) -> Int64

Calculates the moist pseudo adiabat given temperature and humidity of surface parcel. Follows the dry adiabat till condensation and then continues on the pseudo moist-adiabat with immediate condensation to the level of zero buoyancy. Levels above are skipped, set to NaN instead and should be skipped in the relaxation.

source
SpeedyWeather.dry_static_energy!Method
dry_static_energy!(
    column::ColumnVariables,
    atmosphere::SpeedyWeather.AbstractAtmosphere
)

Compute the dry static energy SE = cₚT + Φ (latent heat times temperature plus geopotential) for the column.

source
SpeedyWeather.dynamics_tendencies!Function
dynamics_tendencies!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    model::PrimitiveEquation
) -> Any
dynamics_tendencies!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    model::PrimitiveEquation,
    lf::Int64
) -> Any

Calculate all tendencies for the PrimitiveEquation model (wet or dry).

source
SpeedyWeather.dynamics_tendencies!Method
dynamics_tendencies!(
    diagn::DiagnosticVariablesLayer,
    progn::PrognosticVariablesLayer,
    time::DateTime,
    model::Barotropic
)

Calculate all tendencies for the BarotropicModel.

source
SpeedyWeather.dynamics_tendencies!Method
dynamics_tendencies!(
    diagn::DiagnosticVariablesLayer,
    progn::PrognosticVariablesLayer,
    surface::SpeedyWeather.SurfaceVariables,
    pres::LowerTriangularMatrix,
    time::DateTime,
    model::ShallowWater
)

Calculate all tendencies for the ShallowWaterModel.

source
SpeedyWeather.first_timesteps!Method
first_timesteps!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::ModelSetup,
    output::SpeedyWeather.AbstractOutputWriter
)

Performs the first two initial time steps (Euler forward, unfiltered leapfrog) to populate the prognostic variables with two time steps (t=0, Δt) that can then be used in the normal leap frogging.

source
SpeedyWeather.flux_divergence!Method
flux_divergence!(
    A_tend::LowerTriangularMatrix{Complex{NF}},
    A_grid::SpeedyWeather.RingGrids.AbstractGrid{NF},
    diagn::DiagnosticVariablesLayer{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
    G::Geometry{NF},
    S::SpectralTransform{NF};
    add,
    flipsign
)

Computes ∇⋅((u, v)*A) with the option to add/overwrite A_tend and to flip_sign of the flux divergence by doing so.

  • A_tend = ∇⋅((u, v)*A) for add=false, flip_sign=false
  • A_tend = -∇⋅((u, v)*A) for add=false, flip_sign=true
  • A_tend += ∇⋅((u, v)*A) for add=true, flip_sign=false
  • A_tend -= ∇⋅((u, v)*A) for add=true, flip_sign=true
source
SpeedyWeather.fluxes_to_tendencies!Method
fluxes_to_tendencies!(
    column::ColumnVariables,
    geometry::Geometry,
    planet::SpeedyWeather.AbstractPlanet,
    atmosphere::SpeedyWeather.AbstractAtmosphere
)

Convert the fluxes on half levels to tendencies on full levels.

source
SpeedyWeather.forcing!Method
forcing!(
    diagn::DiagnosticVariablesLayer,
    forcing::JetStreamForcing
)

Set for every latitude ring the tendency to the precomputed forcing in the momentum equations following the JetStreamForcing. The forcing is precomputed in initialize!(::JetStreamForcing, ::ModelSetup).

source
SpeedyWeather.geopotential!Function
geopotential!(
    geopot::AbstractVector,
    temp::AbstractVector,
    G::Geopotential
)
geopotential!(
    geopot::AbstractVector,
    temp::AbstractVector,
    G::Geopotential,
    geopot_surf::Real
)

Calculate the geopotential based on temp in a single column. This exclues the surface geopotential that would need to be added to the returned vector. Function not used in the dynamical core but for post-processing and analysis.

source
SpeedyWeather.geopotential!Method
geopotential!(
    diagn::DiagnosticVariables,
    geopotential::Geopotential,
    orography::SpeedyWeather.AbstractOrography
)

Compute spectral geopotential geopot from spectral temperature temp and spectral surface geopotential geopot_surf (orography*gravity).

source
SpeedyWeather.geopotential!Method
geopotential!(
    diagn::DiagnosticVariablesLayer,
    pres::LowerTriangularMatrix,
    planet::SpeedyWeather.AbstractPlanet
) -> Any

calculates the geopotential in the ShallowWaterModel as g*η, i.e. gravity times the interface displacement (field pres)

source
SpeedyWeather.get_column!Method
get_column!(
    C::ColumnVariables,
    D::DiagnosticVariables,
    P::PrognosticVariables,
    ij::Integer,
    jring::Integer,
    geometry::Geometry,
    planet::SpeedyWeather.AbstractPlanet,
    orography::SpeedyWeather.AbstractOrography,
    land_sea_mask::SpeedyWeather.AbstractLandSeaMask
) -> Any

Update C::ColumnVariables by copying the prognostic variables from D::DiagnosticVariables at gridpoint index ij. Provide G::Geometry for coordinate information.

source
SpeedyWeather.get_run_idMethod
get_run_id(path::String, id::String) -> String

Checks existing run_???? folders in path to determine a 4-digit id number by counting up. E.g. if folder run_0001 exists it will return the string "0002". Does not create a folder for the returned run id.

source
SpeedyWeather.get_thermodynamics!Method
get_thermodynamics!(
    column::ColumnVariables,
    model::PrimitiveEquation
)

Calculate geopotentiala and dry static energy for the primitive equation model.

source
SpeedyWeather.get_varMethod
get_var(progn::PrognosticVariables, var_name::Symbol; lf::Integer=1)

Returns the prognostic variable var_name at leapfrog index lf as a Vector{LowerTriangularMatrices}.

source
SpeedyWeather.get_Δt_millisecFunction
get_Δt_millisec(
    Δt_at_T31::Dates.TimePeriod,
    trunc,
    radius,
    adjust_with_output::Bool
) -> Any
get_Δt_millisec(
    Δt_at_T31::Dates.TimePeriod,
    trunc,
    radius,
    adjust_with_output::Bool,
    output_dt::Dates.TimePeriod
) -> Any

Computes the time step in [ms]. Δt_at_T31 is always scaled with the resolution trunc of the model. In case adjust_Δt_with_output is true, the Δt_at_T31 is additionally adjusted to the closest divisor of output_dt so that the output time axis is keeping output_dt exactly.

source
SpeedyWeather.gradMethod
grad(CC::ClausiusClapeyron{NF}, temp_kelvin) -> Any

Gradient of Clausius-Clapeyron wrt to temperature, evaluated at temp_kelvin.

source
SpeedyWeather.gradMethod
grad(
    TetensCoefficients::TetensEquation{NF},
    temp_kelvin
) -> Any

Gradient of the Tetens equation wrt to temperature, evaluated at temp_kelvin.

source
SpeedyWeather.hasMethod
has(M::Type{<:ModelSetup}, var_name::Symbol) -> Bool

Returns true if the model M has a prognostic variable var_name, false otherwise. The default fallback is that all variables are included.

source
SpeedyWeather.horizontal_diffusion!Function
horizontal_diffusion!(
    progn::SpeedyWeather.PrognosticLayerTimesteps,
    diagn::DiagnosticVariablesLayer,
    model::PrimitiveEquation
) -> Union{Nothing, Bool}
horizontal_diffusion!(
    progn::SpeedyWeather.PrognosticLayerTimesteps,
    diagn::DiagnosticVariablesLayer,
    model::PrimitiveEquation,
    lf::Int64
) -> Union{Nothing, Bool}

Apply horizontal diffusion applied to vorticity, diffusion and temperature in the PrimitiveEquation models. Uses the constant diffusion for temperature but possibly adaptive diffusion for vorticity and divergence.

source
SpeedyWeather.horizontal_diffusion!Function
horizontal_diffusion!(
    progn::SpeedyWeather.PrognosticLayerTimesteps,
    diagn::DiagnosticVariablesLayer,
    model::ShallowWater
)
horizontal_diffusion!(
    progn::SpeedyWeather.PrognosticLayerTimesteps,
    diagn::DiagnosticVariablesLayer,
    model::ShallowWater,
    lf::Int64
)

Apply horizontal diffusion to vorticity and diffusion in the ShallowWater models.

source
SpeedyWeather.horizontal_diffusion!Function
horizontal_diffusion!(
    diagn::DiagnosticVariablesLayer,
    progn::SpeedyWeather.PrognosticLayerTimesteps,
    model::Barotropic
)
horizontal_diffusion!(
    diagn::DiagnosticVariablesLayer,
    progn::SpeedyWeather.PrognosticLayerTimesteps,
    model::Barotropic,
    lf::Int64
)

Apply horizontal diffusion to vorticity in the Barotropic models.

source
SpeedyWeather.horizontal_diffusion!Method
horizontal_diffusion!(
    tendency::LowerTriangularMatrix{Complex{NF<:AbstractFloat}},
    A::LowerTriangularMatrix{Complex{NF<:AbstractFloat}},
    ∇²ⁿ_expl::AbstractArray{NF<:AbstractFloat, 1},
    ∇²ⁿ_impl::AbstractArray{NF<:AbstractFloat, 1}
)

Apply horizontal diffusion to a 2D field A in spectral space by updating its tendency tendency with an implicitly calculated diffusion term. The implicit diffusion of the next time step is split into an explicit part ∇²ⁿ_expl and an implicit part ∇²ⁿ_impl, such that both can be calculated in a single forward step by using A as well as its tendency tendency.

source
SpeedyWeather.implicit_correction!Method
implicit_correction!(
    diagn::DiagnosticVariables,
    implicit::ImplicitPrimitiveEquation,
    progn::PrognosticVariables
) -> Any

Apply the implicit corrections to dampen gravity waves in the primitive equation models.

source
SpeedyWeather.implicit_correction!Method
implicit_correction!(
    diagn::DiagnosticVariablesLayer{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
    progn::SpeedyWeather.PrognosticLayerTimesteps{NF},
    diagn_surface::SpeedyWeather.SurfaceVariables{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
    progn_surface::SpeedyWeather.PrognosticSurfaceTimesteps{NF},
    implicit::ImplicitShallowWater
)

Apply correction to the tendencies in diagn to prevent the gravity waves from amplifying. The correction is implicitly evaluated using the parameter implicit.α to switch between forward, centered implicit or backward evaluation of the gravity wave terms.

source
SpeedyWeather.initialize!Function
initialize!(
    scheme::HyperDiffusion,
    k::Int64,
    G::SpeedyWeather.AbstractGeometry,
    L::SpeedyWeather.AbstractTimeStepper
)
initialize!(
    scheme::HyperDiffusion,
    k::Int64,
    G::SpeedyWeather.AbstractGeometry,
    L::SpeedyWeather.AbstractTimeStepper,
    vor_max::Real
)

Precomputes the hyper diffusion terms in scheme for layer k based on the model time step in L, the vertical level sigma level in G, and the current (absolute) vorticity maximum level vor_max

source
SpeedyWeather.initialize!Method
initialize!(
    model::Barotropic;
    time
) -> Simulation{Model} where Model<:Barotropic

Calls all initialize! functions for most fields, representing components, of model, except for model.output and model.feedback which are always called at in time_stepping!.

source
SpeedyWeather.initialize!Method
initialize!(
    orog::EarthOrography,
    P::SpeedyWeather.AbstractPlanet,
    S::SpectralTransform
) -> LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

Initialize the arrays orography, geopot_surf in orog by reading the orography field from file.

source
SpeedyWeather.initialize!Method
initialize!(
    feedback::Feedback,
    clock::SpeedyWeather.Clock,
    model::ModelSetup
) -> ProgressMeter.Progress

Initializes the a Feedback struct.

source
SpeedyWeather.initialize!Method
initialize!(
    geopotential::Geopotential,
    model::PrimitiveEquation
)

Precomputes constants for the vertical integration of the geopotential, defined as

Φ_{k+1/2} = Φ_{k+1} + R*T_{k+1}*(ln(p_{k+1}) - ln(p_{k+1/2})) (half levels) Φ_k = Φ_{k+1/2} + R*T_k*(ln(p_{k+1/2}) - ln(p_k)) (full levels)

Same formula but k → k-1/2.

source
SpeedyWeather.initialize!Method
initialize!(scheme::HeldSuarez, model::PrimitiveEquation)

initialize the HeldSuarez temperature relaxation by precomputing terms for the equilibrium temperature Teq.

source
SpeedyWeather.initialize!Method
initialize!(
    scheme::HumidityDiffusion,
    model::PrimitiveEquation
) -> Any

Initialize dry static energy diffusion.

source
SpeedyWeather.initialize!Method
initialize!(
    scheme::HyperDiffusion,
    diagn::DiagnosticVariablesLayer,
    G::SpeedyWeather.AbstractGeometry,
    L::SpeedyWeather.AbstractTimeStepper
)

Pre-function to other initialize!(::HyperDiffusion) initialisors that calculates the (absolute) vorticity maximum for the layer of diagn.

source
SpeedyWeather.initialize!Method
initialize!(scheme::HyperDiffusion, model::ModelSetup)

Precomputes the hyper diffusion terms in scheme based on the model time step, and possibly with a changing strength/power in the vertical.

source
SpeedyWeather.initialize!Method
initialize!(
    scheme::HyperDiffusion,
    L::SpeedyWeather.AbstractTimeStepper
)

Precomputes the 2D hyper diffusion terms in scheme based on the model time step.

source
SpeedyWeather.initialize!Method
initialize!(
    implicit::ImplicitPrimitiveEquation,
    dt::Real,
    diagn::DiagnosticVariables,
    geometry::SpeedyWeather.AbstractGeometry,
    geopotential::SpeedyWeather.AbstractGeopotential,
    atmosphere::SpeedyWeather.AbstractAtmosphere,
    adiabatic_conversion::SpeedyWeather.AbstractAdiabaticConversion
)

Initialize the implicit terms for the PrimitiveEquation models.

source
SpeedyWeather.initialize!Method
initialize!(
    implicit::ImplicitShallowWater,
    dt::Real,
    planet::SpeedyWeather.AbstractPlanet,
    atmosphere::SpeedyWeather.AbstractAtmosphere
)

Update the implicit terms in implicit for the shallow water model as they depend on the time step dt.

source
SpeedyWeather.initialize!Method
initialize!(
    scheme::JablonowskiRelaxation,
    model::PrimitiveEquation
)

initialize the JablonowskiRelaxation temperature relaxation by precomputing terms for the equilibrium temperature Teq and the frequency (strength of relaxation).

source
SpeedyWeather.initialize!Method
initialize!(
    land_sea_mask::LandSeaMask,
    model::PrimitiveEquation
) -> SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

Reads a high-resolution land-sea mask from file and interpolates (grid-call average) onto the model grid for a fractional sea mask.

source
SpeedyWeather.initialize!Method
initialize!(L::Leapfrog, model::ModelSetup)

Initialize leapfrogging L by recalculating the timestep given the output time step output_dt from model.output. Recalculating will slightly adjust the time step to be a divisor such that an integer number of time steps matches exactly with the output time step.

source
SpeedyWeather.initialize!Method
initialize!(scheme::LinearDrag, model::PrimitiveEquation)

Precomputes the drag coefficients for this BoundaryLayerDrag scheme.

source
SpeedyWeather.initialize!Method
initialize!(
    model::PrimitiveDry;
    time
) -> Simulation{Model} where Model<:PrimitiveDry

Calls all initialize! functions for components of model, except for model.output and model.feedback which are always called at in time_stepping! and model.implicit which is done in first_timesteps!.

source
SpeedyWeather.initialize!Method
initialize!(
    model::PrimitiveWet;
    time
) -> Simulation{Model} where Model<:PrimitiveWet

Calls all initialize! functions for components of model, except for model.output and model.feedback which are always called at in time_stepping! and model.implicit which is done in first_timesteps!.

source
SpeedyWeather.initialize!Method
initialize!(
    progn::PrognosticVariables,
    _::PressureOnOrography,
    model::PrimitiveEquation
) -> LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

Initialize surface pressure on orography by integrating the hydrostatic equation with the reference temperature lapse rate.

source
SpeedyWeather.initialize!Method
initialize!(
    progn_new::PrognosticVariables,
    initial_conditions::StartFromFile,
    model::ModelSetup
) -> PrognosticVariables

Restart from a previous SpeedyWeather.jl simulation via the restart file restart.jld2 Applies interpolation in the horizontal but not in the vertical.

source
SpeedyWeather.initialize!Method
initialize!(
    progn::PrognosticVariables,
    initial_conditions::ZonalJet,
    model::ModelSetup
) -> LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

Initial conditions from Galewsky, 2004, Tellus

source
SpeedyWeather.initialize!Method
initialize!(
    model::ShallowWater;
    time
) -> Simulation{Model} where Model<:ShallowWater

Calls all initialize! functions for most components (=fields) of model, except for model.output and model.feedback which are always initialized in time_stepping! and model.implicit which is done in first_timesteps!.

source
SpeedyWeather.initialize!Method
initialize!(
    clock::SpeedyWeather.Clock,
    time_stepping::SpeedyWeather.AbstractTimeStepper
) -> SpeedyWeather.Clock

Initialize the clock with the time step Δt in the time_stepping.

source
SpeedyWeather.initialize!Method
initialize!(
    scheme::StaticEnergyDiffusion,
    model::PrimitiveEquation
) -> Any

Initialize dry static energy diffusion.

source
SpeedyWeather.initialize!Method
initialize!(
    orog::ZonalRidge,
    P::SpeedyWeather.AbstractPlanet,
    S::SpectralTransform,
    G::Geometry
) -> LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

Initialize the arrays orography, geopot_surf in orog following Jablonowski and Williamson, 2006.

source
SpeedyWeather.initialize!Method
initialize!(
    output::OutputWriter{output_NF, Model},
    feedback::SpeedyWeather.AbstractFeedback,
    time_stepping::SpeedyWeather.AbstractTimeStepper,
    clock::SpeedyWeather.Clock,
    diagn::DiagnosticVariables,
    model::ModelSetup
)

Creates a netcdf file on disk and the corresponding netcdf_file object preallocated with output variables and dimensions. write_output! then writes consecuitive time steps into this file.

source
SpeedyWeather.initialize!Method
initialize!(
    callback::GlobalSurfaceTemperatureCallback{NF},
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::ModelSetup
) -> Int64

Initializes callback.temp vector that records the global mean surface temperature on every time step. Allocates vector of correct length (number of elements = total time steps plus one) and stores the global surface temperature of the initial conditions

source
SpeedyWeather.initialize!Method
initialize!(
    progn::PrognosticVariables{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
    initial_conditions::JablonowskiTemperature,
    model::ModelSetup
)

Initial conditions from Jablonowski and Williamson, 2006, QJR Meteorol. Soc

source
SpeedyWeather.initialize!Method
initialize!(
    progn::PrognosticVariables{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
    initial_conditions::RandomWaves,
    model::ShallowWater
)

Random initial conditions for the interface displacement η in the shallow water equations. The flow (u, v) is zero initially. This kicks off gravity waves that will interact with orography.

source
SpeedyWeather.initialize!Method
initialize!(
    progn::PrognosticVariables{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
    initial_conditions::StartWithRandomVorticity,
    model::ModelSetup
)

Start with random vorticity as initial conditions

source
SpeedyWeather.initialize!Method
initialize!(
    progn::PrognosticVariables{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
    initial_conditions::ZonalWind,
    model::PrimitiveEquation
)

Initial conditions from Jablonowski and Williamson, 2006, QJR Meteorol. Soc

source
SpeedyWeather.initialize!Method
initialize!(
    particles::Array{P<:Particle, 1},
    model::ModelSetup
)

Initialize particle locations uniformly in latitude, longitude and in the vertical σ coordinates. This uses a cosin-distribution in latitude for an equal-area uniformity.

source
SpeedyWeather.ismodMethod
ismod(p::Particle) -> Bool

Check that a particle is in longitude [0,360˚E), latitude [-90˚,90˚N], and σ in [0,1].

source
SpeedyWeather.large_scale_condensation!Method
large_scale_condensation!(
    column::ColumnVariables{NF},
    scheme::ImplicitCondensation,
    clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron,
    geometry::Geometry,
    planet::SpeedyWeather.AbstractPlanet,
    atmosphere::SpeedyWeather.AbstractAtmosphere,
    time_stepping::SpeedyWeather.AbstractTimeStepper
)

Large-scale condensation for a column by relaxation back to 100% relative humidity. Calculates the tendencies for specific humidity and temperature from latent heat release and integrates the large-scale precipitation vertically for output.

source
SpeedyWeather.launch_kernel!Method
launch_kernel!(device_setup::DeviceSetup, kernel!, ndrange, kernel_args...)

Launches the kernel! on the device_setup with ndrange computations over the kernel and arguments kernel_args

source
SpeedyWeather.leapfrog!Method
leapfrog!(
    A_old::LowerTriangularMatrix{Complex{NF<:AbstractFloat}},
    A_new::LowerTriangularMatrix{Complex{NF<:AbstractFloat}},
    tendency::LowerTriangularMatrix{Complex{NF<:AbstractFloat}},
    dt::Real,
    lf::Int64,
    L::Leapfrog{NF<:AbstractFloat}
)

Performs one leapfrog time step with (lf=2) or without (lf=1) Robert+Williams filter (see Williams (2009), Montly Weather Review, Eq. 7-9).

source
SpeedyWeather.linear_pressure_gradient!Method
linear_pressure_gradient!(
    diagn::DiagnosticVariablesLayer,
    surface::SpeedyWeather.PrognosticSurfaceTimesteps,
    lf::Int64,
    atmosphere::SpeedyWeather.AbstractAtmosphere,
    I::ImplicitPrimitiveEquation
) -> Any

Add the linear contribution of the pressure gradient to the geopotential. The pressure gradient in the divergence equation takes the form

-∇⋅(Rd * Tᵥ * ∇lnpₛ) = -∇⋅(Rd * Tᵥ' * ∇lnpₛ) - ∇²(Rd * Tₖ * lnpₛ)

So that the second term inside the Laplace operator can be added to the geopotential. Rd is the gas constant, Tᵥ the virtual temperature and Tᵥ' its anomaly wrt to the average or reference temperature Tₖ, lnpₛ is the logarithm of surface pressure.

source
SpeedyWeather.linear_virtual_temperature!Method
linear_virtual_temperature!(
    diagn::DiagnosticVariablesLayer,
    progn::SpeedyWeather.PrognosticLayerTimesteps,
    model::PrimitiveDry,
    lf::Integer
) -> LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat

Linear virtual temperature for model::PrimitiveDry: Just copy over arrays from temp to temp_virt at timestep lf in spectral space as humidity is zero in this model.

source
SpeedyWeather.linear_virtual_temperature!Method
linear_virtual_temperature!(
    diagn::DiagnosticVariablesLayer,
    progn::SpeedyWeather.PrognosticLayerTimesteps,
    atmosphere::SpeedyWeather.AbstractAtmosphere,
    lf::Int64
) -> Any

Calculates a linearised virtual temperature Tᵥ as

Tᵥ = T + Tₖμq

With absolute temperature T, layer-average temperarture Tₖ (computed in temperature_average!), specific humidity q and

μ = (1-ξ)/ξ, ξ = R_dry/R_vapour.

in spectral space.

source
SpeedyWeather.load_trajectoryMethod
load_trajectory(
    var_name::Union{String, Symbol},
    model::ModelSetup
) -> Any

Loads a var_name trajectory of the model M that has been saved in a netCDF file during the time stepping.

source
SpeedyWeather.moist_static_energy!Method
moist_static_energy!(
    column::ColumnVariables,
    clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron
)

Compute the moist static energy

MSE = SE + Lc*Q = cₚT + Φ + Lc*Q

with the static energy SE, the latent heat of condensation Lc, the geopotential Φ. As well as the saturation moist static energy which replaces Q with Q_sat

source
SpeedyWeather.moveMethod
move(
    p::Particle{NF, false},
    args...
) -> Particle{NF, false} where NF

Inactive particles are not moved.

source
SpeedyWeather.moveMethod
move(
    p::Particle{NF, true},
    dlon,
    dlat,
    dσ
) -> Particle{NF, true} where NF<:AbstractFloat

Move a particle with increments (dlon, dlat, dσ) in those respective coordinates. Only active particles are moved.

source
SpeedyWeather.moveMethod
move(
    p::Particle{NF, true},
    dlon,
    dlat
) -> Particle{NF, true} where NF<:AbstractFloat

Move a particle with increments (dlon, dlat) in 2D. No movement in vertical σ. Only active particles are moved.

source
SpeedyWeather.nansMethod
A = nans(T, dims...)

Allocate array A with NaNs of type T. Similar to zeros(T, dims...).

source
SpeedyWeather.nar_detection!Method
nar_detection!(
    feedback::Feedback,
    progn::PrognosticVariables
) -> Union{Nothing, Bool}

Detect NaR (Not-a-Real) in the prognostic variables.

source
SpeedyWeather.parameterization_tendencies!Method
parameterization_tendencies!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    time::DateTime,
    model::PrimitiveEquation
) -> Any

Compute tendencies for u, v, temp, humid from physical parametrizations. Extract for each vertical atmospheric column the prognostic variables (stored in diagn as they are grid-point transformed), loop over all grid-points, compute all parametrizations on a single-column basis, then write the tendencies back into a horizontal field of tendencies.

source
SpeedyWeather.pseudo_adiabat!Method
pseudo_adiabat!(
    temp_ref_profile::AbstractVector,
    temp_parcel,
    humid_parcel::Real,
    temp_virt_environment::AbstractVector,
    geopot::AbstractVector,
    pres::Real,
    σ::AbstractVector,
    clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron
) -> Int64

Calculates the moist pseudo adiabat given temperature and humidity of surface parcel. Follows the dry adiabat till condensation and then continues on the pseudo moist-adiabat with immediate condensation to the level of zero buoyancy. Levels above are skipped, set to NaN instead and should be skipped in the relaxation.

source
SpeedyWeather.readable_secsMethod
readable_secs(secs::Real) -> Dates.CompoundPeriod

Returns Dates.CompoundPeriod rounding to either (days, hours), (hours, minutes), (minutes, seconds), or seconds with 1 decimal place accuracy for >10s and two for less. E.g.

julia> using SpeedyWeather: readable_secs

julia> readable_secs(12345)
source
SpeedyWeather.remaining_timeMethod
remaining_time(p::ProgressMeter.Progress) -> String

Estimates the remaining time from a ProgresssMeter.Progress. Adapted from ProgressMeter.jl

source
SpeedyWeather.reset_column!Method
reset_column!(column::ColumnVariables{NF})

Set the accumulators (tendencies but also vertical sums and similar) back to zero for column to be reused at other grid points.

source
SpeedyWeather.run!Method
run!(
    simulation::SpeedyWeather.AbstractSimulation;
    period,
    output,
    n_days
) -> PrognosticVariables

Run a SpeedyWeather.jl simulation. The simulation.model is assumed to be initialized.

source
SpeedyWeather.saturation_humidity!Method
saturation_humidity!(
    column::ColumnVariables,
    clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron
)

Compute the saturation water vapour pressure [Pa], the saturation humidity [kg/kg] and the relative humidity following clausius_clapeyron.

source
SpeedyWeather.saturation_humidityMethod
saturation_humidity(
    temp_kelvin,
    pres,
    clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron
) -> Any

Saturation humidity [kg/kg] from temperature [K], pressure [Pa] via

sat_vap_pres = clausius_clapeyron(temperature)
saturation humidity = mol_ratio * sat_vap_pres / pressure
source
SpeedyWeather.saturation_humidityMethod
saturation_humidity(sat_vap_pres, pres; mol_ratio) -> Any

Saturation humidity from saturation vapour pressure and pressure via

qsat = mol_ratio*sat_vap_pres/pres

with both pressures in same units and qsat in kg/kg.

source
SpeedyWeather.scale!Method
scale!(progn::PrognosticVariables, scale::Real) -> Real

Scales the prognostic variables vorticity and divergence with the Earth's radius which is used in the dynamical core.

source
SpeedyWeather.scale!Method
scale!(progn::PrognosticVariables, var::Symbol, scale::Real)

Scale the variable var inside progn with scalar scale.

source
SpeedyWeather.set_period!Method
set_period!(
    clock::SpeedyWeather.Clock,
    period::Dates.Period
) -> Second

Set the period of the clock to a new value. Converts any Dates.Period input to Second.

source
SpeedyWeather.set_period!Method
set_period!(clock::SpeedyWeather.Clock, period::Real) -> Any

Set the period of the clock to a new value. Converts any ::Real input to Day.

source
SpeedyWeather.set_pressure!Method
set_pressure!(progn::PrognosticVariables{NF},
              pressure::AbstractMatrix,
              Grid::Type{<:AbstractGrid},
              lf::Integer=1) where NF

Sets the prognostic variable with the surface pressure in grid space at leapfrog index lf.

source
SpeedyWeather.set_pressure!Method
set_pressure!(progn::PrognosticVariables{NF},
              pressure::LowerTriangularMatrix;
              lf::Integer=1) where NF

Sets the prognostic variable with the surface pressure in spectral space at leapfrog index lf.

source
SpeedyWeather.set_pressure!Method
set_pressure!(progn::PrognosticVariables{NF},
              pressure::AbstractGrid,
              M::ModelSetup;
              lf::Integer=1) where NF

Sets the prognostic variable with the surface pressure in grid space at leapfrog index lf.

source
SpeedyWeather.set_pressure!Method
set_pressure!(progn::PrognosticVariables{NF},
              pressure::AbstractGrid,
              lf::Integer=1) where NF

Sets the prognostic variable with the surface pressure in grid space at leapfrog index lf.

source
SpeedyWeather.set_var!Method
function set_var!(progn::PrognosticVariables{NF},
                  varname::Symbol,
                  s::Number;
                  lf::Integer=1) where NF

Sets all values of prognostic variable varname at leapfrog index lf to the scalar s.

source
SpeedyWeather.set_var!Method
set_var!(progn::PrognosticVariables{NF},
         varname::Symbol,
         var::Vector{<:AbstractMatrix},
         Grid::Type{<:AbstractGrid}=FullGaussianGrid;
         lf::Integer=1) where NF

Sets the prognostic variable with the name varname in all layers at leapfrog index lf with values given in var a vector with all information for all layers in grid space.

source
SpeedyWeather.set_var!Method
set_var!(progn::PrognosticVariables{NF},        
         varname::Symbol,
         var::Vector{<:LowerTriangularMatrix};
         lf::Integer=1) where NF

Sets the prognostic variable with the name varname in all layers at leapfrog index lf with values given in var a vector with all information for all layers in spectral space.

source
SpeedyWeather.set_var!Method
set_var!(progn::PrognosticVariables{NF},
         varname::Symbol,
         var::Vector{<:AbstractGrid},
         M::ModelSetup;
         lf::Integer=1) where NF

Sets the prognostic variable with the name varname in all layers at leapfrog index lf with values given in var a vector with all information for all layers in grid space.

source
SpeedyWeather.set_var!Method
set_var!(progn::PrognosticVariables{NF},        
         varname::Symbol,
         var::Vector{<:AbstractGrid};
         lf::Integer=1) where NF

Sets the prognostic variable with the name varname in all layers at leapfrog index lf with values given in var a vector with all information for all layers in grid space.

source
SpeedyWeather.solar_hour_angleMethod
solar_hour_angle(
    _::Type{T},
    time::DateTime,
    λ,
    length_of_day::Second
) -> Any

Fraction of day as angle in radians [0...2π]. TODO: Takes length of day as argument, but a call to Dates.Time() currently have this hardcoded anyway.

source
SpeedyWeather.speedstringMethod
speedstring(sec_per_iter, dt_in_sec) -> String

Define a ProgressMeter.speedstring method that also takes a time step dt_in_sec to translate sec/iteration to days/days-like speeds.

source
SpeedyWeather.surface_pressure_tendency!Method
surface_pressure_tendency!( Prog::PrognosticVariables,
                            Diag::DiagnosticVariables,
                            lf::Int,
                            M::PrimitiveEquation)

Computes the tendency of the logarithm of surface pressure as

-(ū*px + v̄*py) - D̄

with ū, v̄ being the vertically averaged velocities; px, py the gradients of the logarithm of surface pressure ln(p_s) and D̄ the vertically averaged divergence.

  1. Calculate ∇ln(p_s) in spectral space, convert to grid.
  2. Multiply ū, v̄ with ∇ln(p_s) in grid-point space, convert to spectral.
  3. D̄ is subtracted in spectral space.
  4. Set tendency of the l=m=0 mode to 0 for better mass conservation.
source
SpeedyWeather.temperature_average!Method
temperature_average!(
    diagn::DiagnosticVariablesLayer,
    temp::LowerTriangularMatrix,
    S::SpectralTransform
) -> Any

Calculates the average temperature of a layer from the l=m=0 harmonic and stores the result in diagn.temp_average

source
SpeedyWeather.temperature_relaxation!Method
temperature_relaxation!(
    column::ColumnVariables,
    scheme::HeldSuarez,
    atmosphere::SpeedyWeather.AbstractAtmosphere
)

Apply temperature relaxation following Held and Suarez 1996, BAMS.

source
SpeedyWeather.temperature_relaxation!Method
temperature_relaxation!(
    column::ColumnVariables,
    scheme::JablonowskiRelaxation
)

Apply HeldSuarez-like temperature relaxation to the Jablonowski and Williamson vertical profile.

source
SpeedyWeather.temperature_tendency!Method
temperature_tendency!(
    diagn::DiagnosticVariablesLayer,
    adiabatic_conversion::SpeedyWeather.AbstractAdiabaticConversion,
    atmosphere::SpeedyWeather.AbstractAtmosphere,
    G::Geometry,
    S::SpectralTransform,
    I::ImplicitPrimitiveEquation
)

Compute the temperature tendency

∂T/∂t += -∇⋅((u, v)*T') + T'D + κTᵥ*Dlnp/Dt

+= because the tendencies already contain parameterizations and vertical advection. T' is the anomaly with respect to the reference/average temperature. Tᵥ is the virtual temperature used in the adiabatic term κTᵥ*Dlnp/Dt.

source
SpeedyWeather.tendencies_physics_only!Function

For dynamics=false, after calling parameterization_tendencies! call this function to transform the physics tendencies from grid-point to spectral space including the necessary coslat⁻¹ scaling.

source
SpeedyWeather.time_stepping!Method
time_stepping!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::ModelSetup
) -> PrognosticVariables

Main time loop that that initializes output and feedback, loops over all time steps and calls the output and feedback functions.

source
SpeedyWeather.timestep!Function
timestep!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    dt::Real,
    model::Barotropic
)
timestep!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    dt::Real,
    model::Barotropic,
    lf1::Int64
)
timestep!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    dt::Real,
    model::Barotropic,
    lf1::Int64,
    lf2::Int64
)

Calculate a single time step for the model <: Barotropic.

source
SpeedyWeather.timestep!Method
timestep!(
    progn::PrognosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
    diagn::DiagnosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
    dt::Real,
    model::PrimitiveEquation
) -> Any
timestep!(
    progn::PrognosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
    diagn::DiagnosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
    dt::Real,
    model::PrimitiveEquation,
    lf1::Int64
) -> Any
timestep!(
    progn::PrognosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
    diagn::DiagnosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
    dt::Real,
    model::PrimitiveEquation,
    lf1::Int64,
    lf2::Int64
) -> Any

Calculate a single time step for the model<:PrimitiveEquation

source
SpeedyWeather.timestep!Method
timestep!(
    progn::PrognosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
    diagn::DiagnosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
    dt::Real,
    model::ShallowWater
)
timestep!(
    progn::PrognosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
    diagn::DiagnosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
    dt::Real,
    model::ShallowWater,
    lf1::Int64
)
timestep!(
    progn::PrognosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
    diagn::DiagnosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
    dt::Real,
    model::ShallowWater,
    lf1::Int64,
    lf2::Int64
)

Calculate a single time step for the model <: ShallowWater.

source
SpeedyWeather.unscale!Method
unscale!(variable::AbstractArray, scale::Real) -> Any

Undo the radius-scaling for any variable. Method used for netcdf output.

source
SpeedyWeather.unscale!Method
unscale!(progn::PrognosticVariables) -> Int64

Undo the radius-scaling of vorticity and divergence from scale!(progn, scale::Real).

source
SpeedyWeather.vertical_integration!Method
vertical_integration!(Diag::DiagnosticVariables, G::Geometry)

Calculates the vertically averaged (weighted by the thickness of the σ level) velocities (*coslat) and divergence. E.g.

u_mean = ∑_k=1^nlev Δσ_k * u_k

u, v are averaged in grid-point space, divergence in spectral space.

source
SpeedyWeather.vertical_interpolate!Method
vertical_interpolate!(
    A_half::Vector,
    A_full::Vector,
    G::Geometry
)

Given a vector in column defined at full levels, do a linear interpolation in log(σ) to calculate its values at half-levels, skipping top (k=1/2), extrapolating to bottom (k=NLEV+1/2).

source
SpeedyWeather.virtual_temperature!Method
virtual_temperature!(
    diagn::DiagnosticVariablesLayer,
    temp::LowerTriangularMatrix,
    model::PrimitiveDry
) -> SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat

Virtual temperature in grid-point space: For the PrimitiveDry temperature and virtual temperature are the same (humidity=0). Just copy over the arrays.

source
SpeedyWeather.virtual_temperature!Method
virtual_temperature!(
    diagn::DiagnosticVariablesLayer,
    temp::LowerTriangularMatrix,
    atmosphere::SpeedyWeather.AbstractAtmosphere
)

Calculates the virtual temperature Tᵥ as

Tᵥ = T(1+μq)

With absolute temperature T, specific humidity q and

μ = (1-ξ)/ξ, ξ = R_dry/R_vapour.

in grid-point space.

source
SpeedyWeather.volume_flux_divergence!Method
volume_flux_divergence!(
    diagn::DiagnosticVariablesLayer,
    surface::SpeedyWeather.SurfaceVariables,
    orog::SpeedyWeather.AbstractOrography,
    atmosphere::SpeedyWeather.AbstractAtmosphere,
    G::SpeedyWeather.AbstractGeometry,
    S::SpectralTransform
)

Computes the (negative) divergence of the volume fluxes uh, vh for the continuity equation, -∇⋅(uh, vh).

source
SpeedyWeather.vordiv_tendencies!Method
vordiv_tendencies!(
    diagn::DiagnosticVariablesLayer,
    surf::SpeedyWeather.SurfaceVariables,
    model::PrimitiveEquation
)

Function barrier to unpack model.

source
SpeedyWeather.vordiv_tendencies!Method
vordiv_tendencies!(
    diagn::DiagnosticVariablesLayer,
    surf::SpeedyWeather.SurfaceVariables,
    coriolis::SpeedyWeather.AbstractCoriolis,
    atmosphere::SpeedyWeather.AbstractAtmosphere,
    geometry::SpeedyWeather.AbstractGeometry,
    S::SpectralTransform
)

Tendencies for vorticity and divergence. Excluding Bernoulli potential with geopotential and linear pressure gradient inside the Laplace operator, which are added later in spectral space.

u_tend +=  v*(f+ζ) - RTᵥ'*∇lnp_x
v_tend += -u*(f+ζ) - RTᵥ'*∇lnp_y

+= because the tendencies already contain the parameterizations and vertical advection. f is coriolis, ζ relative vorticity, R the gas constant Tᵥ' the virtual temperature anomaly, ∇lnp the gradient of surface pressure and _x and _y its zonal/meridional components. The tendencies are then curled/dived to get the tendencies for vorticity/divergence in spectral space

∂ζ/∂t = ∇×(u_tend, v_tend)
∂D/∂t = ∇⋅(u_tend, v_tend) + ...

+ ... because there's more terms added later for divergence.

source
SpeedyWeather.vorticity_flux!Method
vorticity_flux!(
    diagn::DiagnosticVariablesLayer,
    model::Barotropic
)

Vorticity flux tendency in the barotropic vorticity equation

∂ζ/∂t = ∇×(u_tend, v_tend)

with

u_tend = Fᵤ + v*(ζ+f) v_tend = Fᵥ - u*(ζ+f)

with Fᵤ, Fᵥ the forcing from forcing! already in u_tend_grid/v_tend_grid and vorticity ζ, coriolis f.

source
SpeedyWeather.vorticity_flux!Method
vorticity_flux!(
    diagn::DiagnosticVariablesLayer,
    model::ShallowWater
)

Vorticity flux tendency in the shallow water equations

∂ζ/∂t = ∇×(u_tend, v_tend) ∂D/∂t = ∇⋅(u_tend, v_tend)

with

u_tend = Fᵤ + v*(ζ+f) v_tend = Fᵥ - u*(ζ+f)

with Fᵤ, Fᵥ the forcing from forcing! already in u_tend_grid/v_tend_grid and vorticity ζ, coriolis f.

source
SpeedyWeather.vorticity_flux_curldiv!Method
vorticity_flux_curldiv!(
    diagn::DiagnosticVariablesLayer,
    coriolis::SpeedyWeather.AbstractCoriolis,
    geometry::Geometry,
    S::SpectralTransform;
    div,
    add
)

Compute the vorticity advection as the curl/div of the vorticity fluxes

∂ζ/∂t = ∇×(u_tend, v_tend) ∂D/∂t = ∇⋅(u_tend, v_tend)

with

u_tend = Fᵤ + v*(ζ+f) v_tend = Fᵥ - u*(ζ+f)

with Fᵤ, Fᵥ from u_tend_grid/v_tend_grid that are assumed to be alread set in forcing!. Set div=false for the BarotropicModel which doesn't require the divergence tendency.

source
SpeedyWeather.workgroup_sizeMethod
workgroup_size(dev::AbstractDevice)

Returns a workgroup size depending on dev. WIP: Will be expanded in the future to also include grid information.

source
SpeedyWeather.write_column_tendencies!Method
write_column_tendencies!(
    D::DiagnosticVariables,
    column::ColumnVariables,
    planet::SpeedyWeather.AbstractPlanet,
    ij::Int64
)

Write the parametrization tendencies from C::ColumnVariables into the horizontal fields of tendencies stored in D::DiagnosticVariables at gridpoint index ij.

source
SpeedyWeather.write_netcdf_variables!Method
write_netcdf_variables!(
    output::OutputWriter,
    diagn::DiagnosticVariables{NF, Grid, Model}
)

Write diagnostic variables from diagn to the netCDF file in output::OutputWriter.

source
SpeedyWeather.write_output!Method
write_output!(
    outputter::OutputWriter,
    time::DateTime,
    diagn::DiagnosticVariables
)

Writes the variables from diagn of time step i at time time into outputter.netcdf_file. Simply escapes for no netcdf output of if output shouldn't be written on this time step. Interpolates onto output grid and resolution as specified in outputter, converts to output number format, truncates the mantissa for higher compression and applies lossless compression.

source
SpeedyWeather.write_restart_fileMethod
write_restart_file(
    progn::PrognosticVariables{T, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{T},
    output::OutputWriter
) -> Union{Nothing, String}

A restart file restart.jld2 with the prognostic variables is written to the output folder (or current path) that can be used to restart the model. restart.jld2 will then be used as initial conditions. The prognostic variables are bitrounded for compression and the 2nd leapfrog time step is discarded. Variables in restart file are unscaled.

source
SpeedyWeather.year_angleMethod
year_angle(
    _::Type{T},
    time::DateTime,
    length_of_day::Second,
    length_of_year::Second
) -> Any

Fraction of year as angle in radians [0...2π]. TODO: Takes length of day/year as argument, but calls to Dates.Time(), Dates.dayofyear() currently have these hardcoded.

source
SpeedyWeather.σ_interpolation_weightsMethod
σ_interpolation_weights(
    σ_levels_full::AbstractVector,
    σ_levels_half::AbstractVector
) -> Any

Interpolation weights for full to half level interpolation on sigma coordinates. Following Fortran SPEEDY documentation eq. (1).

source