Function and type index

Core.TypeMethod

Generator function pulling the resolution information from spectral_grid.

source
Core.TypeMethod

Generator function pulling the resolution information from spectral_grid for all Orography <: AbstractOrography.

source
SpeedyWeather.AbstractLandSeaMaskType

Abstract super 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 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.mask 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.AbstractOceanType

Abstract super type for ocean models, which control the sea surface temperature and sea ice concentration as boundary conditions to a SpeedyWeather simulation. A new ocean model has to be defined as

CustomOceanModel <: AbstractOcean

and can have parameters like CustomOceanModel{T} and fields. They need to extend the following functions

function initialize!(ocean_model::CustomOceanModel, model::PrimitiveEquation)
    # your code here to initialize the ocean model itself
    # you can use other fields from model, e.g. model.geometry
end

function initialize!(   
    ocean::PrognosticVariablesOcean,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    ocean_model::CustomOceanModel,
    model::PrimitiveEquation,
)
    # your code here to initialize the prognostic variables for the ocean
    # namely, ocean.sea_surface_temperature, ocean.sea_ice_concentration, e.g.
    # ocean.sea_surface_temperature .= 300      # 300K everywhere
end

function ocean_timestep!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    ocean_model::CustomOceanModel,
    model::PrimitiveEquation,
)
    # your code here to change the progn.ocean.sea_surface_temperature and/or
    # progn.ocean.sea_ice_concentration on any timestep
end

Temperatures in ocean.seasurfacetemperature have units of Kelvin, or NaN for no ocean. Note that neither sea surface temperature, land-sea mask or orography have to agree. It is possible to have an ocean on top of a mountain. For an ocean grid-cell that is (partially) masked by the land-sea mask, its value will be (fractionally) ignored in the calculation of surface fluxes (potentially leading to a zero flux depending on land surface temperatures). For an ocean grid-cell that is NaN but not masked by the land-sea mask, its value is always ignored.

source
SpeedyWeather.AquaPlanetType

AquaPlanet sea surface temperatures that are constant in time and longitude, but vary in latitude following a coslat². To be created like

ocean = AquaPlanet(spectral_grid, temp_equator=302, temp_poles=273)

Fields and options are

  • temp_equator::Any: [OPTION] Temperature on the Equator [K]

  • temp_poles::Any: [OPTION] Temperature at the poles [K]

source
SpeedyWeather.AquaPlanetMaskType

Land-sea mask with zero = sea everywhere.

  • mask::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

  • device_setup::Any

  • geometry::Any

  • planet::Any

  • atmosphere::Any

  • coriolis::Any

  • forcing::Any

  • drag::Any

  • particle_advection::Any

  • initial_conditions::Any

  • random_process::Any

  • time_stepping::Any

  • spectral_transform::Any

  • implicit::Any

  • horizontal_diffusion::Any

  • output::Any

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

  • feedback::Any

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)

  • Δt::Dates.Millisecond: Time step

.

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

Create and initialize a clock from time_stepping

source
SpeedyWeather.CloudTopOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

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. Most column vectors have nlayers entries, from [1] at the top to [end] at the lowermost model level at the planetary boundary layer.

  • nlayers::Int64

  • nbands_shortwave::Int64

  • nbands_longwave::Int64

  • ij::Int64

  • jring::Int64

  • lond::Any

  • latd::Any

  • land_fraction::Any

  • orography::Any

  • u::Any

  • v::Any

  • temp::Any

  • humid::Any

  • ln_pres::Any

  • pres::Any

  • u_tend::Any

  • v_tend::Any

  • temp_tend::Any

  • humid_tend::Any

  • flux_u_upward::Any

  • flux_u_downward::Any

  • flux_v_upward::Any

  • flux_v_downward::Any

  • flux_temp_upward::Any

  • flux_temp_downward::Any

  • flux_humid_upward::Any

  • flux_humid_downward::Any

  • random_value::Any

  • boundary_layer_depth::Int64

  • boundary_layer_drag::Any

  • surface_geopotential::Any

  • surface_u::Any

  • surface_v::Any

  • surface_temp::Any

  • surface_humid::Any

  • surface_wind_speed::Any

  • skin_temperature_sea::Any

  • skin_temperature_land::Any

  • soil_moisture_availability::Any

  • surface_air_density::Any

  • sat_humid::Any

  • dry_static_energy::Any

  • temp_virt::Any

  • geopot::Any

  • cloud_top::Int64

  • precip_convection::Any

  • precip_large_scale::Any

  • cos_zenith::Any

  • albedo::Any

  • outgoing_longwave_radiation::Any

  • outgoing_shortwave_radiation::Any

  • optical_depth_shortwave::Any

  • optical_depth_longwave::Any

  • a::Any

  • b::Any

  • c::Any

  • d::Any

source
SpeedyWeather.ConstantOceanClimatologyType

Constant ocean climatology that reads monthly sea surface temperature fields from file, and interpolates them only for the initial conditions in time to be stored in the prognostic variables. It is therefore an ocean from climatology but without a seasonal cycle that is constant in time. To be created like

ocean = SeasonalOceanClimatology(spectral_grid)

and the ocean time is set with initialize!(model, time=time). Fields and options are

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

  • file::String: [OPTION] filename of sea surface temperatures

  • varname::String: [OPTION] Variable name in netcdf file

  • file_Grid::Type{<:AbstractGrid}: [OPTION] Grid the sea surface temperature file comes on

  • missing_value::Float64: [OPTION] The missing value in the data respresenting land

source
SpeedyWeather.ConvectivePrecipitationOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

  • rate::SpeedyWeather.AbstractOutputVariable

source
SpeedyWeather.ConvectivePrecipitationRateOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

source
SpeedyWeather.DeviceSetupType

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

  • device::SpeedyWeather.AbstractDevice: ::AbstractDevice, device the model is running on.

  • device_KA::Any: ::KernelAbstractions.Device, device for use with KernelAbstractions

  • n::Int64: workgroup size

source
SpeedyWeather.DiagnosticVariablesType

All diagnostic variables.

  • trunc::Int64: Spectral resolution: Max degree of spherical harmonics (0-based)

  • nlat_half::Int64: Grid resoltion: Number of latitude rings on one hemisphere (Equator incl.)

  • nlayers::Int64: Number of vertical layers

  • nparticles::Int64: Number of particles for particle advection

  • tendencies::Tendencies: Tendencies (spectral and grid) of the prognostic variables

  • grid::GridVariables: Gridded prognostic variables

  • dynamics::DynamicsVariables: Intermediate variables for the dynamical core

  • physics::PhysicsVariables: Global fields returned from physics parameterizations

  • particles::ParticleVariables{NF, ArrayType, ParticleVector, VectorType, Grid} where {NF, ArrayType, Grid, ParticleVector, VectorType}: Intermediate variables for the particle advection

  • column::ColumnVariables: Vertical column for the physics parameterizations

  • temp_average::Any: Average temperature of every horizontal layer [K]

  • scale::Base.RefValue: Scale applied to vorticity and divergence

source
SpeedyWeather.DivergenceOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

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

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

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

  • surface_temp::Any: [OPTION] Surface perturbation of temp to calculate the dry adiabat

source
SpeedyWeather.DynamicsVariablesType

Intermediate quantities for the dynamics of a given layer.

  • trunc::Int64

  • nlat_half::Int64

  • nlayers::Int64

  • a::Any: Multi-purpose a, 3D work array to be reused in various places

  • b::Any: Multi-purpose b, 3D work array to be reused in various places

  • a_grid::Any: Multi-purpose a, 3D work array to be reused in various places

  • b_grid::Any: Multi-purpose b, 3D work array to be reused in various places

  • a_2D::Any: Multi-purpose a, work array to be reused in various places

  • b_2D::Any: Multi-purpose b, work array to be reused in various places

  • a_2D_grid::Any: Multi-purpose a, work array to be reused in various places

  • b_2D_grid::Any: Multi-purpose b, work array to be reused in various places

  • uv∇lnp::Any: Pressure flux (uₖ, vₖ)⋅∇ln(pₛ)

  • uv∇lnp_sum_above::Any: Sum of Δσₖ-weighted uv∇lnp above

  • div_sum_above::Any: Sum of div_weighted from top to k

  • temp_virt::Any: Virtual temperature [K], spectral for geopotential

  • geopot::Any: Geopotential [m²/s²] on full layers

  • σ_tend::Any: Vertical velocity (dσ/dt), on half levels k+1/2 below, pointing to the surface (σ=1)

  • ∇lnp_x::Any: Zonal gradient of log surf pressure

  • ∇lnp_y::Any: Meridional gradient of log surf pressure

  • u_mean_grid::Any: Vertical average of zonal velocity [m/s]

  • v_mean_grid::Any: Vertical average of meridional velocity [m/s]

  • div_mean_grid::Any: Vertical average of divergence [1/s], grid

  • div_mean::Any: Vertical average of divergence [1/s], spectral

source
SpeedyWeather.DynamicsVariablesMethod
DynamicsVariables(
    SG::SpectralGrid
) -> DynamicsVariables{<:AbstractFloat, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray}

Generator function.

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{<: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_fraction::Float64: fraction of highest wavenumbers to smooth

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

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

source
SpeedyWeather.FeedbackType

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

  • verbose::Bool: print feedback to REPL?, default is isinteractive(), true in interactive REPL mode

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

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

  • id::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

  • 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

  • nlayers::Int64: number of vertical levels

  • npoints::Int64: total number of horizontal 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(SG::SpectralGrid) -> Geometry

Generator function for Geometry struct based on spectral_grid.

source
SpeedyWeather.GridVariablesType

Transformed prognostic variables (and u, v, temp_virt) into grid-point space.

  • nlat_half::Int64

  • nlayers::Int64

  • vor_grid::Any: Relative vorticity of the horizontal wind [1/s]

  • div_grid::Any: Divergence of the horizontal wind [1/s]

  • temp_grid::Any: Absolute temperature [K]

  • temp_virt_grid::Any: Virtual tempereature [K]

  • humid_grid::Any: Specific_humidity [kg/kg]

  • u_grid::Any: Zonal velocity [m/s]

  • v_grid::Any: Meridional velocity [m/s]

  • pres_grid::Any: Logarithm of surface pressure [Pa]

  • random_pattern::Any: Random pattern controlled by random process [1]

  • temp_grid_prev::Any: Absolute temperature [K] at previous time step

  • humid_grid_prev::Any: Specific humidity [kg/kg] at previous time step

  • u_grid_prev::Any: Zonal velocity [m/s] at previous time step

  • v_grid_prev::Any: Meridional velocity [m/s] at previous time step

  • pres_grid_prev::Any: Logarithm of surface pressure [Pa] at previous time step

.

source
SpeedyWeather.GridVariablesMethod
GridVariables(
    SG::SpectralGrid
) -> GridVariables{<:AbstractFloat, <:AbstractArray, <:AbstractArray, <:AbstractArray}

Generator function.

source
SpeedyWeather.HeldSuarezType

Temperature relaxation from Held and Suarez, 1996 BAMS

  • nlat::Int64: number of latitude rings

  • nlayers::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.HumidityOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

source
SpeedyWeather.HyperDiffusionType

Horizontal hyper diffusion of vor, div, temp, humid; implicitly in spectral space with a power of the Laplacian (default = 4) and the strength controlled by time_scale (default = 1 hour). For vorticity and divergence, by default, the time_scale (=1/strength of diffusion) is reduced with increasing resolution through resolution_scaling and the power is linearly decreased in the vertical above the tapering_σ sigma level to power_stratosphere (default 2).

For the BarotropicModel and ShallowWaterModel no tapering or scaling is applied. Fields and options are

  • trunc::Int64: spectral resolution

  • nlayers::Int64: number of vertical levels

  • power::Any: [OPTION] power of Laplacian

  • time_scale::Second: [OPTION] diffusion time scale

  • time_scale_div::Second: [OPTION] diffusion time scale for temperature and humidity

  • resolution_scaling::Any: [OPTION] stronger diffusion with resolution? 0: constant with trunc, 1: (inverse) linear with trunc, etc

  • power_stratosphere::Any: [OPTION] different power for tropopause/stratosphere

  • tapering_σ::Any: [OPTION] linearly scale towards power_stratosphere above this σ

  • expl::Any

  • impl::Any

  • expl_div::Any

  • impl_div::Any

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.

  • relative_humidity_threshold::AbstractFloat: Relative humidity threshold [1 = 100%] to trigger condensation

  • time_scale::AbstractFloat: Time scale in multiples of time step Δt, the larger the less immediate

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

  • nlayers::Int64: number of vertical layers

  • α::AbstractFloat: 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 on first time step

  • ξ::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

  • α::AbstractFloat: [OPTION] coefficient for semi-implicit computations to filter gravity waves, 0.5 <= α <= 1

  • 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.InterfaceDisplacementOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

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.JeevanjeeRadiationType

Temperature flux longwave radiation from Jeevanjee and Romps, 2018, following Seeley and Wordsworth, 2023, eq (1)

dF/dT = α*(T_t - T)

with F the upward temperature flux between two layers with temperature difference dT, α = 0.025 W/m²/K² and T_t = 200K a prescribed tropopause temperature. Flux into the lowermost layer is 0. Flux out of uppermost layer also 0, but dT/dt = (T_t - T)/τ is added to relax the uppermost layer towards the tropopause temperature T_t with time scale τ = 24h (Seeley and Wordsworth, 2023 use 6h, which is unstable a low resolutions here). Fields are

  • α::Any: Radiative forcing constant (W/m²/K²)

  • temp_tropopause::Any: Tropopause temperature [K]

  • time_scale::Second: Tropopause relaxation time scale to temp_tropopause

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

  • nlayers::Int64: Number of vertical layers

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

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

  • sigma::Any: sigma level [1], vertical location of jet

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

  • time_scale::Second: time scale [days]

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

  • tapering::Vector: precomputed vertical tapering

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{<:AbstractGrid}: Grid the land-sea mask file comes on

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

source
SpeedyWeather.LargeScalePrecipitationOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

  • rate::SpeedyWeather.AbstractOutputVariable

source
SpeedyWeather.LargeScalePrecipitationRateOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

source
SpeedyWeather.LeapfrogType

Leapfrog time stepping defined by the following fields

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

  • nsteps::Int64: Number of timesteps stored simultaneously in prognostic variables

  • Δ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

  • nlayers::Int64

  • σb::AbstractFloat

  • time_scale::Second

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

source
SpeedyWeather.MeridionalVelocityOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

source
SpeedyWeather.NetCDFOutputType
NetCDFOutput(
    S::SpectralGrid;
    ...
) -> NetCDFOutput{_A, _B, Interpolator} where {_A, _B, Interpolator<:(AnvilInterpolator{Float32})}
NetCDFOutput(
    S::SpectralGrid,
    Model::Type{<:AbstractModel};
    output_Grid,
    nlat_half,
    output_NF,
    output_dt,
    kwargs...
) -> NetCDFOutput{_A, _B, Interpolator} where {_A, _B, Interpolator<:(AnvilInterpolator{Float32})}

Constructor for NetCDFOutput based on S::SpectralGrid and optionally the Model type (e.g. ShallowWater, PrimitiveWet) as second positional argument. The output grid is optionally determined by keyword arguments output_Grid (its type, full grid required), nlat_half (resolution) and output_NF (number format). By default, uses the full grid equivalent of the grid and resolution used in SpectralGrid S.

source
SpeedyWeather.NetCDFOutputType

Output writer for a netCDF file with (re-)gridded variables. Interpolates non-rectangular grids. Fields are

  • active::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

  • variables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable}: [OPTION] dictionary of variables to output, e.g. u, v, vor, div, pres, temp, humid

  • output_every_n_steps::Int64

  • timestep_counter::Int64

  • output_counter::Int64

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

  • interpolator::Any

  • grid2D::Any

  • grid3D::Any

source
SpeedyWeather.NoOrographyType

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

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

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

source
SpeedyWeather.OrographyOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

source
SpeedyWeather.OutgoingLongwaveRadiationOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

source
SpeedyWeather.OutgoingShortwaveRadiationOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

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

  • schedule::Schedule: [OPTION] when to schedule particle tracking

  • 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

  • nparticles::Int64: Number of particles to track

  • 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.ParticleVariablesType

Diagnostic variables for the particle advection

  • nparticles::Int64: Number of particles

  • nlat_half::Int64: Number of latitudes on one hemisphere (Eq. incld.), resolution parameter of Grid

  • locations::Any: Work array: particle locations

  • u::Any: Work array: velocity u

  • v::Any: Work array: velocity v

  • σ_tend::Any: Work array: velocity w = dσ/dt

  • interpolator::AnvilInterpolator{NF, Grid} where {NF, Grid}: Interpolator to interpolate velocity fields onto particle positions

source
SpeedyWeather.ParticleVariablesMethod
ParticleVariables(
    SG::SpectralGrid
) -> ParticleVariables{var"#s153", var"#s152", var"#s10", _A, <:AbstractGrid} where {var"#s153"<:AbstractFloat, var"#s152"<:AbstractArray, var"#s10"<:AbstractArray, _A}

Generator function.

source
SpeedyWeather.PhysicsVariablesType

Diagnostic variables of the physical parameterizations.

  • nlat_half::Int64

  • precip_large_scale::Any: Accumulated large-scale precipitation [m]

  • precip_convection::Any: Accumulated large-scale precipitation [m]

  • cloud_top::Any: Cloud top [m]

  • soil_moisture_availability::Any: Availability of soil moisture to evaporation [1]

  • surface_flux_heat::Any: Surface flux of heat [W/m^2]

  • surface_flux_humid::Any: Surface flux of humidity [?]

  • outgoing_shortwave_radiation::Any: Outgoing shortwave radiation [W/m^2]

  • outgoing_longwave_radiation::Any: Outgoing longwave radiation [W/m^2]

  • cos_zenith::Any: Cosine of solar zenith angle [1]

source
SpeedyWeather.PrimitiveDryModelType

The PrimitiveDryModel contains all model components (themselves structs) needed for the simulation of the primitive equations without humidity. To be constructed like

model = PrimitiveDryModel(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::Any

  • dynamics::Bool

  • geometry::Any

  • planet::Any

  • atmosphere::Any

  • coriolis::Any

  • geopotential::Any

  • adiabatic_conversion::Any

  • particle_advection::Any

  • initial_conditions::Any

  • random_process::Any

  • orography::Any

  • land_sea_mask::Any

  • ocean::Any

  • land::Any

  • solar_zenith::Any

  • albedo::Any

  • physics::Bool

  • boundary_layer_drag::Any

  • temperature_relaxation::Any

  • vertical_diffusion::Any

  • surface_thermodynamics::Any

  • surface_wind::Any

  • surface_heat_flux::Any

  • convection::Any

  • optical_depth::Any

  • shortwave_radiation::Any

  • longwave_radiation::Any

  • stochastic_physics::Any

  • time_stepping::Any

  • spectral_transform::Any

  • implicit::Any

  • horizontal_diffusion::Any

  • vertical_advection::Any

  • output::Any

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

  • feedback::Any

source
SpeedyWeather.PrimitiveWetModelType

The PrimitiveWetModel contains all model components (themselves structs) needed for the simulation of the primitive equations with humidity. To be constructed like

model = PrimitiveWetModel(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::Any

  • dynamics::Bool

  • geometry::Any

  • planet::Any

  • atmosphere::Any

  • coriolis::Any

  • geopotential::Any

  • adiabatic_conversion::Any

  • particle_advection::Any

  • initial_conditions::Any

  • random_process::Any

  • orography::Any

  • land_sea_mask::Any

  • ocean::Any

  • land::Any

  • solar_zenith::Any

  • albedo::Any

  • soil::Any

  • vegetation::Any

  • physics::Bool

  • clausius_clapeyron::Any

  • boundary_layer_drag::Any

  • temperature_relaxation::Any

  • vertical_diffusion::Any

  • surface_thermodynamics::Any

  • surface_wind::Any

  • surface_heat_flux::Any

  • surface_evaporation::Any

  • large_scale_condensation::Any

  • convection::Any

  • optical_depth::Any

  • shortwave_radiation::Any

  • longwave_radiation::Any

  • stochastic_physics::Any

  • time_stepping::Any

  • spectral_transform::Any

  • implicit::Any

  • horizontal_diffusion::Any

  • vertical_advection::Any

  • hole_filling::Any

  • output::Any

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

  • feedback::Any

source
SpeedyWeather.PrognosticVariablesMethod
PrognosticVariables(
    SG::SpectralGrid,
    model::AbstractModel
) -> PrognosticVariables{var"#s153", var"#s152", _A, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray} where {var"#s153"<:AbstractFloat, var"#s152"<:AbstractArray, _A}

Generator function.

source
SpeedyWeather.PrognosticVariablesMethod
PrognosticVariables(
    SG::SpectralGrid;
    nsteps
) -> PrognosticVariables{var"#s153", var"#s152", _A, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray} where {var"#s153"<:AbstractFloat, var"#s152"<:AbstractArray, _A}

Generator function.

source
SpeedyWeather.RandomPatternOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

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.RossbyHaurwitzWaveType

Rossby-Haurwitz wave initial conditions as in Williamson et al. 1992, J Computational Physics with an additional cut-off amplitude c to filter out tiny harmonics in the vorticity field. Parameters are

  • m::Int64

  • ω::Float64

  • K::Float64

  • c::Float64

source
SpeedyWeather.ScheduleType

A schedule for callbacks, to execute them periodically after a given period has passed (first timestep excluded) or on/after specific times (initial time excluded). For two consecutive time steps i, i+1, an event is scheduled at i+1 when it occurs in (i,i+1]. Similarly, a periodic schedule of period p will be executed at start+p, but p is rounded to match the multiple of the model timestep. Periodic schedules and event schedules can be combined, executing at both. A Schedule is supposed to be added into callbacks as fields

Base.@kwdef struct MyCallback
    schedule::Schedule = Schedule(every=Day(1))
    other_fields
end

see also initialize!(::Schedule,::Clock) and isscheduled(::Schedule,::Clock). Fields

  • every::Second: [OPTION] Execute every time period, first timestep excluded. Default=never.

  • times::Vector{DateTime}: [OPTION] Events scheduled at times

  • schedule::BitVector: Actual schedule, true=execute this timestep, false=don't

  • steps::Int64: Number of scheduled executions

  • counter::Int64: Count up the number of executions

source
SpeedyWeather.ScheduleMethod
Schedule(times::DateTime...) -> Schedule

A Schedule based on DateTime arguments, For two consecutive time steps i, i+1, an event is scheduled at i+1 when it occurs in (i,i+1].

source
SpeedyWeather.SeaSurfaceTemperatureOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

source
SpeedyWeather.SeasonalOceanClimatologyType

Seasonal ocean climatology that reads monthly sea surface temperature fields from file, and interpolates them in time regularly (default every 3 days) to be stored in the prognostic variables. Fields and options are

  • nlat_half::Int64: number of latitudes on one hemisphere, Equator included

  • path::String: [OPTION] Path to the folder containing the sea surface temperatures, pkg path default

  • file::String: [OPTION] Filename of sea surface temperatures

  • varname::String: [OPTION] Variable name in netcdf file

  • file_Grid::Type{<:AbstractGrid}: [OPTION] Grid the sea surface temperature file comes on

  • missing_value::Any: [OPTION] The missing value in the data respresenting land

  • monthly_temperature::Vector{Grid} where {NF, Grid<:AbstractGrid{NF}}: Monthly sea surface temperatures [K], interpolated onto Grid

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::Any

  • geometry::Any

  • planet::Any

  • atmosphere::Any

  • coriolis::Any

  • orography::Any

  • forcing::Any

  • drag::Any

  • particle_advection::Any

  • initial_conditions::Any

  • random_process::Any

  • time_stepping::Any

  • spectral_transform::Any

  • implicit::Any

  • horizontal_diffusion::Any

  • output::Any

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

  • feedback::Any

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

  • nlayers::Int64: number of vertical layers

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

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

  • surface_temp_humid::Any: [OPTION] Surface perturbation of temp, humid to calculate the moist pseudo adiabat

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::AbstractModel: 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.

  • 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}

source
SpeedyWeather.SolarZenithSeasonType

Solar zenith angle varying with seasonal cycle only.

  • length_of_day::Second

  • length_of_year::Second

  • seasonal_cycle::Bool

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

  • initial_time::Base.RefValue{DateTime}

source
SpeedyWeather.SpectralAR1ProcessType

First-order auto-regressive random process (AR1) in spectral space, evolving wavenumbers with respectice time_scales and standard_deviations independently. Transformed after every time step to grid space with a clamp applied to limit extrema. For reproducability seed can be provided and an independent random_number_generator is used that is reseeded on every initialize!. Fields are

  • trunc::Int64

  • time_scale::Second: [OPTION] Time scale of the AR1 process

  • wavenumber::Int64: [OPTION] Wavenumber of the AR1 process

  • standard_deviation::Any: [OPTION] Standard deviation of the AR1 process

  • clamp::Tuple{NF, NF} where NF: [OPTION] Range to clamp values into after every transform into grid space

  • seed::Int64: [OPTION] Random number generator seed, 0=randomly seed from Julia's GLOBAL_RNG

  • random_number_generator::Random.Xoshiro: Independent random number generator for this random process

  • autoregressive_factor::Base.RefValue: Precomputed auto-regressive factor [1], function of time scale and model time step

  • noise_factors::Vector: Precomputed noise factors [1] for evert total wavenumber l

source
SpeedyWeather.SpectralFilterType

Spectral filter for horizontal diffusion. Fields are

  • trunc::Int64: spectral resolution

  • nlayers::Int64: number of vertical levels

  • shift::Any: [OPTION] shift diffusion to higher (positive shift) or lower (neg) wavenumbers, relative to trunc

  • scale::Any: [OPTION] Scale-selectiveness, steepness of the sigmoid, higher is more selective

  • time_scale::Second: [OPTION] diffusion time scale

  • time_scale_div::Second: [OPTION] stronger diffusion time scale for divergence

  • resolution_scaling::Any: [OPTION] resolution scaling to shorten time_scale with trunc

  • power::Any: [OPTION] power of the tanh function

  • power_div::Any: [OPTION] power of the tanh function for divergence

  • expl::Any

  • impl::Any

  • expl_div::Any

  • impl_div::Any

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

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

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

  • device::SpeedyWeather.AbstractDevice: [OPTION] device archictecture to run on

  • ArrayType::Type{<:AbstractArray}: [OPTION] array type to use for all variables

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

  • Grid::Type{<: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]

  • nparticles::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

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

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

  • VectorType::Type{<:AbstractVector}

  • MatrixType::Type{<:AbstractMatrix}

  • SpectralVariable2D::Type{<:AbstractArray}

  • SpectralVariable3D::Type{<:AbstractArray}

  • SpectralVariable4D::Type{<:AbstractArray}

  • GridVariable2D::Type{<:AbstractArray}

  • GridVariable3D::Type{<:AbstractArray}

  • GridVariable4D::Type{<:AbstractArray}

  • ParticleVector::Type{<:AbstractArray}

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

source
SpeedyWeather.SpeedyTransforms.SpectralTransformMethod
SpectralTransform(
    spectral_grid::SpectralGrid;
    one_more_degree,
    kwargs...
) -> SpectralTransform{NF, _A, _B, _C, _D, _E, _F, LowerTriangularArray{NF1, 1, _A1}, LowerTriangularArray{NF2, 2, _A2}} where {NF<:AbstractFloat, _A, _B, _C, _D, _E, _F, NF1<:AbstractFloat, _A1, NF2<:AbstractFloat, _A2}

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.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.SurfaceFluxHeatOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

source
SpeedyWeather.SurfaceFluxHumidOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

source
SpeedyWeather.SurfacePressureOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

source
SpeedyWeather.TemperatureOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

source
SpeedyWeather.TendenciesType

Tendencies of the prognostic variables in spectral and grid-point space

  • trunc::Int64

  • nlat_half::Int64

  • nlayers::Int64

  • vor_tend::Any: Vorticity of horizontal wind field [1/s]

  • div_tend::Any: Divergence of horizontal wind field [1/s]

  • temp_tend::Any: Absolute temperature [K]

  • humid_tend::Any: Specific humidity [kg/kg]

  • u_tend::Any: Zonal velocity [m/s]

  • v_tend::Any: Meridional velocity [m/s]

  • pres_tend::Any: Logarithm of surface pressure [Pa]

  • u_tend_grid::Any: Zonal velocity [m/s], grid

  • v_tend_grid::Any: Meridinoal velocity [m/s], grid

  • temp_tend_grid::Any: Absolute temperature [K], grid

  • humid_tend_grid::Any: Specific humidity [kg/kg], grid

  • pres_tend_grid::Any: Logarith of surface pressure [Pa], grid

source
SpeedyWeather.TendenciesMethod
Tendencies(
    SG::SpectralGrid
) -> Tendencies{<:AbstractFloat, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray}

Generator function.

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.UniformCoolingType

Uniform cooling following Paulius and Garner, 2006. JAS. https://doi.org/10.1175/JAS3705.1 imposing a default temperature tendency of -1.5K/day (=1K/16hours for a time_scale of 16 hours) on every level except for the stratosphere (diagnosed as temp < temp_min) where a relaxation term with time_scale_stratosphere towards temp_stratosphere is applied.

dT/dt = -1.5K/day for T > 207.5K else (200K-T) / 5 days

Fields are

  • time_scale::Second: [OPTION] time scale of cooling, default = -1.5K/day = -1K/16hrs

  • temp_min::Any: [OPTION] temperature [K] below which stratospheric relaxation is applied

  • temp_stratosphere::Any: [OPTION] target temperature [K] of stratospheric relaxation

  • time_scale_stratosphere::Second: [OPTION] time scale of stratospheric relaxation

source
SpeedyWeather.VorticityOutputType

Defines netCDF output of vorticity. Fields are

  • name::String: [Required] short name of variable (unique) used in netCDF file and key for dictionary

  • unit::String: [Required] unit of variable

  • long_name::String: [Required] long name of variable used in netCDF file

  • dims_xyzt::NTuple{4, Bool}: [Required] NetCDF dimensions the variable uses, lon, lat, layer, time

  • missing_value::Float64: [Optional] missing value for the variable, if not specified uses NaN

  • compression_level::Int64: [Optional] compression level of the lossless compressor, 1=lowest/fastest, 9=highest/slowest, 3=default

  • shuffle::Bool: [Optional] bitshuffle the data for compression, false = default

  • keepbits::Int64: [Optional] number of mantissa bits to keep for compression (default: 15)

Custom variable output defined similarly with required fields marked, optional fields otherwise use variable-independent defaults. Initialize with VorticityOutput() and non-default fields can always be passed on as keyword arguments, e.g. VorticityOutput(long_name="relative vorticity", compression_level=0).

source
SpeedyWeather.ZonalJetType

A struct that contains all parameters for the Galewsky et al, 2004 zonal jet intitial conditions for the ShallowWaterModel. 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::AbstractGrid{NF} where NF<:AbstractFloat: height [m] on grid-point space.

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

source
SpeedyWeather.ZonalVelocityOutputType

Defines netCDF output for a specific variables, see VorticityOutput for details. Fields are

  • name::String

  • unit::String

  • long_name::String

  • dims_xyzt::NTuple{4, Bool}

  • missing_value::Float64

  • compression_level::Int64

  • shuffle::Bool

  • keepbits::Int64

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
) -> PrognosticVariables

Copies entries of progn_old into progn_new.

source
Base.delete!Method
delete!(
    output::NetCDFOutput,
    keys::Union{String, Symbol}...
) -> NetCDFOutput

Delete output variables from output by their (short name) (Symbol or String), corresponding to the keys in the dictionary.

source
Base.fill!Method
fill!(
    tendencies::Tendencies,
    x,
    _::Type{<:Barotropic}
) -> Tendencies

Set the tendencies for the barotropic model to x.

source
Base.fill!Method
fill!(
    tendencies::Tendencies,
    x,
    _::Type{<:PrimitiveDry}
) -> Tendencies

Set the tendencies for the primitive dry model to x.

source
Base.fill!Method
fill!(
    tendencies::Tendencies,
    x,
    _::Type{<:PrimitiveWet}
) -> Tendencies

Set the tendencies for the primitive wet model to x.

source
Base.fill!Method
fill!(
    tendencies::Tendencies,
    x,
    _::Type{<:ShallowWater}
) -> Tendencies

Set the tendencies for the shallow-water model to x.

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.DeviceArrayMethod
DeviceArray(_::CPU, x) -> Any

Adapts x to an Array when device::CPU is used. Define for CPU for compatibility with adapt to CuArrays etc. Uses adapt, thus also can return SubArrays etc.

source
SpeedyWeather.SpeedyTransforms.transform!Method
transform!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Integer,
    model::Barotropic;
    kwargs...
)

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.transform!Method
transform!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Integer,
    random_process::NoRandomProcess,
    spectral_transform::SpectralTransform
)

NoRandomProcess does not need to transform any random pattern from spectral to grid space.

source
SpeedyWeather.SpeedyTransforms.transform!Method
transform!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Integer,
    model::PrimitiveEquation;
    initialize
)

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.transform!Method
transform!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Integer,
    model::ShallowWater;
    kwargs...
)

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.SpeedyTransforms.transform!Method
transform!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Integer,
    random_process::SpeedyWeather.AbstractRandomProcess,
    spectral_transform::SpectralTransform
)

General transform for random processes <: AbstractRandomProcess. Takes the spectral random_pattern in the prognostic variables and transforms it to spectral space in diagn.grid.random_pattern.

source
SpeedyWeather.WhichZenithMethod
WhichZenith(
    SG::SpectralGrid,
    P::SpeedyWeather.AbstractPlanet;
    kwargs...
) -> Union{SolarZenith, SolarZenithSeason}

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{_A, true} where _A<:AbstractFloat

Activate particle. Active particles can move.

source
SpeedyWeather.add!Method
add!(
    model::AbstractModel,
    key_callbacks::Pair{Symbol, <:SpeedyWeather.AbstractCallback}...
) -> Any

Add a or several callbacks to a model::AbstractModel. To be used like

add!(model, :my_callback => callback)
add!(model, :my_callback1 => callback, :my_callback2 => other_callback)
source
SpeedyWeather.add!Method
add!(
    model::AbstractModel,
    callbacks::SpeedyWeather.AbstractCallback...
)

Add a or several callbacks to a mdoel 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.add!Method
add!(
    model::AbstractModel,
    outputvariables::SpeedyWeather.AbstractOutputVariable...
)

Add outputvariables to the dictionary in output::NetCDFOutput of model, i.e. at model.output.variables.

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...;
    verbose
)

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.add!Method
add!(
    D::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
    outputvariables::SpeedyWeather.AbstractOutputVariable...
) -> Dict{Symbol, SpeedyWeather.AbstractOutputVariable}

Add outputvariables to a dictionary defining the variables subject to NetCDF output.

source
SpeedyWeather.add!Method
add!(
    output::NetCDFOutput,
    outputvariables::SpeedyWeather.AbstractOutputVariable...
) -> NetCDFOutput

Add outputvariables to the dictionary in output::NetCDFOutput, i.e. at output.variables.

source
SpeedyWeather.add_default!Method
add_default!(
    output_variables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
    Model::Type{<:Barotropic}
) -> Dict{Symbol, SpeedyWeather.AbstractOutputVariable}

Add default variables to output for a Barotropic model: Vorticity, zonal and meridional velocity.

source
SpeedyWeather.add_default!Method
add_default!(
    variables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
    Model::Type{<:PrimitiveDry}
) -> Dict{Symbol, SpeedyWeather.AbstractOutputVariable}

Add default variables to output for a PrimitiveDry model, same as for a Barotropic model but also the surface pressure and temperature.

source
SpeedyWeather.add_default!Method
add_default!(
    variables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
    Model::Type{<:PrimitiveWet}
) -> Dict{Symbol, SpeedyWeather.AbstractOutputVariable}

Add default variables to output for a PrimitiveWet model, same as for a PrimitiveDry model but also the specific humidity.

source
SpeedyWeather.add_default!Method
add_default!(
    variables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
    Model::Type{<:ShallowWater}
) -> Dict{Symbol, SpeedyWeather.AbstractOutputVariable}

Add default variables to output for a ShallowWater model, same as for a Barotropic model but also the interface displacement.

source
SpeedyWeather.bernoulli_potential!Method
bernoulli_potential!(
    diagn::DiagnosticVariables,
    S::SpectralTransform
)

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.bulk_richardson!Method
bulk_richardson!(
    column::ColumnVariables,
    atmosphere::SpeedyWeather.AbstractAtmosphere
) -> Any

Calculate the bulk richardson number following Frierson, 2007. For vertical stability in the boundary layer.

source
SpeedyWeather.bulk_richardson_surfaceMethod
bulk_richardson_surface(
    column::ColumnVariables,
    atmosphere::SpeedyWeather.AbstractAtmosphere
) -> Any

Calculate the bulk richardson number following Frierson, 2007. For vertical stability in the boundary layer.

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

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,
    model::PrimitiveEquation
)

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,
    model::PrimitiveWet
) -> 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::AbstractGridArray; kwargs...) -> 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::AbstractGridArray; kwargs...) -> 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!(
    cos_zenith::AbstractGridArray{NF, 1, Array{NF, 1}},
    S::SolarZenith,
    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.cos_zenith!Method
cos_zenith!(
    cos_zenith::AbstractGridArray{NF, 1, Array{NF, 1}},
    S::SolarZenithSeason,
    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.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(
    nlayers::Integer
) -> Vector{Float64}

Vertical sigma coordinates defined by their nlayers+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::DiagnosticVariables, drag::QuadraticDrag)

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 initialize!(::QuadraticDrag, ::AbstractModel) and scaled by the radius as are the momentum equations.

source
SpeedyWeather.dry_adiabat!Method
dry_adiabat!(
    temp_ref_profile::AbstractVector,
    temp_environment::AbstractVector,
    temp_parcel::Real,
    σ::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!Method
dynamics_tendencies!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Integer,
    model::Barotropic
)

Calculate all tendencies for the BarotropicModel.

source
SpeedyWeather.dynamics_tendencies!Method
dynamics_tendencies!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Integer,
    model::PrimitiveEquation
)

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

source
SpeedyWeather.dynamics_tendencies!Method
dynamics_tendencies!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Integer,
    model::ShallowWater
)

Calculate all tendencies for the ShallowWaterModel.

source
SpeedyWeather.first_timesteps!Method
first_timesteps!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

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::LowerTriangularArray,
    A_grid::AbstractGridArray,
    diagn::DiagnosticVariables,
    G::Geometry,
    S::SpectralTransform;
    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::DiagnosticVariables,
    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, ::AbstractModel).

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::DiagnosticVariables,
    pres::LowerTriangularArray,
    planet::SpeedyWeather.AbstractPlanet
)

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,
    albedo::SpeedyWeather.AbstractAlbedo,
    implicit::SpeedyWeather.AbstractImplicit
) -> 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_Δ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(Model::Type{<:AbstractModel}, var_name::Symbol) -> Any

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!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
    model::Barotropic
) -> Any
horizontal_diffusion!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
    model::Barotropic,
    lf::Integer
) -> Any

Apply horizontal diffusion to vorticity in the BarotropicModel.

source
SpeedyWeather.horizontal_diffusion!Function
horizontal_diffusion!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
    model::ShallowWater
) -> Any
horizontal_diffusion!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
    model::ShallowWater,
    lf::Integer
) -> Any

Apply horizontal diffusion to vorticity and divergence in the ShallowWaterModel.

source
SpeedyWeather.horizontal_diffusion!Function
horizontal_diffusion!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
    model::PrimitiveEquation
) -> Any
horizontal_diffusion!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
    model::PrimitiveEquation,
    lf::Integer
) -> Any

Apply horizontal diffusion applied to vorticity, divergence, temperature, and humidity (PrimitiveWet only) in the PrimitiveEquation models.

source
SpeedyWeather.horizontal_diffusion!Method
horizontal_diffusion!(
    tendency::LowerTriangularArray,
    var::LowerTriangularArray,
    expl::AbstractMatrix,
    impl::AbstractMatrix
)

Apply horizontal diffusion to a 2D field var 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 var as well as its tendency tendency.

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

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

source
SpeedyWeather.implicit_correction!Method
implicit_correction!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    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!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!(
    clock::Clock,
    time_stepping::SpeedyWeather.AbstractTimeStepper
) -> Clock

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

source
SpeedyWeather.initialize!Method
initialize!(
    orog::EarthOrography,
    P::SpeedyWeather.AbstractPlanet,
    S::SpectralTransform
)

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

source
SpeedyWeather.initialize!Method
initialize!(
    feedback::Feedback,
    clock::Clock,
    model::AbstractModel
) -> 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!(diffusion::HyperDiffusion, model::AbstractModel)

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

source
SpeedyWeather.initialize!Method
initialize!(
    diffusion::HyperDiffusion,
    G::SpeedyWeather.AbstractGeometry,
    L::SpeedyWeather.AbstractTimeStepper
)

Precomputes the hyper diffusion terms for all layers based on the model time step in L, the vertical level sigma level in G.

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
) -> 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::AbstractModel)

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
)

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

source
SpeedyWeather.initialize!Method
initialize!(
    progn::PrognosticVariables,
    initial_conditions::RossbyHaurwitzWave,
    model::AbstractModel
)

Rossby-Haurwitz wave initial conditions as in Williamson et al. 1992, J Computational Physics with an additional cut-off amplitude c to filter out tiny harmonics in the vorticity field.

source
SpeedyWeather.initialize!Method
initialize!(
    progn_new::PrognosticVariables,
    initial_conditions::StartFromFile,
    model::AbstractModel
) -> 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::AbstractModel
)

Initial conditions from Galewsky, 2004, Tellus

source
SpeedyWeather.initialize!Method
initialize!(scheduler::Schedule, clock::Clock) -> Schedule

Initialize a Schedule with a Clock (which is assumed to have been initialized). Takes both scheduler.every and scheduler.times into account, such that both periodic and events can be scheduled simulataneously. But execution will happen only once if they coincide on a given time step.

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!(
    orog::ZonalRidge,
    P::SpeedyWeather.AbstractPlanet,
    S::SpectralTransform,
    G::Geometry
)

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

source
SpeedyWeather.initialize!Method
initialize!(
    output::NetCDFOutput{Grid2D, Grid3D, Interpolator},
    feedback::SpeedyWeather.AbstractFeedback,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

Initialize NetCDF output by creating a netCDF file and storing the initial conditions of diagn (and progn). To be called just before the first timesteps.

source
SpeedyWeather.initialize!Method
initialize!(
    particles::Array{Particle{NF}, 1},
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    particle_advection::ParticleAdvection2D
) -> Any

Initialize particle advection time integration: Store u,v interpolated initial conditions in diagn.particles.u and .v to be used when particle advection actually executed for first time.

source
SpeedyWeather.initialize!Method
initialize!(
    callback::GlobalSurfaceTemperatureCallback{NF},
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
) -> 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},
    initial_conditions::JablonowskiTemperature,
    model::AbstractModel
)

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

source
SpeedyWeather.initialize!Method
initialize!(
    progn::PrognosticVariables{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},
    initial_conditions::StartWithRandomVorticity,
    model::AbstractModel
)

Start with random vorticity as initial conditions

source
SpeedyWeather.initialize!Method
initialize!(
    progn::PrognosticVariables{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::AbstractModel
)

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.isscheduledMethod
isscheduled(S::Schedule, clock::Clock) -> Bool

Evaluate whether (e.g. a callback) should be scheduled at the timestep given in clock. Returns true for scheduled executions, false for no execution on this time step.

source
SpeedyWeather.large_scale_condensation!Method
large_scale_condensation!(
    column::ColumnVariables,
    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::SpeedyWeather.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::LowerTriangularArray,
    A_new::LowerTriangularArray,
    tendency::LowerTriangularArray,
    dt::Real,
    lf::Int64,
    L::Leapfrog{NF}
)

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::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Int64,
    atmosphere::SpeedyWeather.AbstractAtmosphere,
    implicit::ImplicitPrimitiveEquation
)

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::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Integer,
    model::PrimitiveEquation
)

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.linear_virtual_temperature!Method
linear_virtual_temperature!(
    diagn::SpeedyWeather.DiagnosticVariablesLayer,
    progn::SpeedyWeather.PrognosticLayerTimesteps,
    lf::Integer,
    model::PrimitiveDry
)

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.load_trajectoryMethod
load_trajectory(
    var_name::Union{String, Symbol},
    model::AbstractModel
) -> 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{_A, true} where _A<: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{_A, true} where _A<: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.output!Method
output!(output::NetCDFOutput, time::DateTime)

Write the current time time::DateTime to the netCDF file in output.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    output_variables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

Loop over every variable in output.variables to call the respective output! method to write into the output.netcdf_file.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

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

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.CloudTopOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.ConvectivePrecipitationOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.DivergenceOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.HumidityOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.InterfaceDisplacementOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.LargeScalePrecipitationOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.MeridionalVelocityOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.OrographyOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.OutgoingLongwaveRadiationOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.OutgoingShortwaveRadiationOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.RandomPatternOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.SeaSurfaceTemperatureOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.SurfaceFluxHeatOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.SurfaceFluxHumidOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.SurfacePressureOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.TemperatureOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for variable, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.VorticityOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

Output the vorticity field vor from diagn.grid into the netCDF file output.netcdf_file. Interpolates the vorticity field onto the output grid and resolution as specified in output. Method required for all output variables <: AbstractOutputVariable with dispatch over the second argument.

source
SpeedyWeather.output!Method
output!(
    output::NetCDFOutput,
    variable::SpeedyWeather.ZonalVelocityOutput,
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
)

output! method for ZonalVelocityOutput to write the zonal velocity field u from diagn.grid, see output!(::NetCDFOutput, ::VorticityOutput, ...) for details.

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

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.physics_tendencies_only!Method
physics_tendencies_only!(
    diagn::DiagnosticVariables,
    model::PrimitiveEquation
)

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.pressure_gradient_flux!Method
pressure_gradient_flux!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Integer,
    S::SpectralTransform
)

Compute the gradient ∇lnps of the logarithm of surface pressure, followed by its flux, (u,v) * ∇lnps.

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
) -> Union{UnicodePlots.Plot{T, Val{true}} where T<:UnicodePlots.HeatmapCanvas, UnicodePlots.Plot{T, Val{false}} where T<:UnicodePlots.HeatmapCanvas}

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!(
    diagn::DiagnosticVariables,
    var::Symbol,
    scale::Real
) -> Any

Scale the variable var inside diagn with scalar scale.

source
SpeedyWeather.scale!Method
scale!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    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!Method
set!(
    model::AbstractModel;
    orography,
    land_sea_mask,
    albedo,
    kwargs...
) -> Bool

Sets a boundary condition fields for model. The input can be a function, RingGrid, LowerTriangularMatrix, or scalar as for other set! functions. If the keyword add==true the input is added to the exisiting field instead.

source
SpeedyWeather.set!Method
set!(
    progn::PrognosticVariables,
    geometry::Geometry;
    u,
    v,
    vor,
    div,
    temp,
    humid,
    pres,
    sea_surface_temperature,
    sea_ice_concentration,
    land_surface_temperature,
    snow_depth,
    soil_moisture_layer1,
    soil_moisture_layer2,
    lf,
    add,
    spectral_transform,
    coslat_scaling_included
)

Sets new values for the keyword arguments (velocities, vorticity, divergence, etc..) into the prognostic variable struct progn at timestep index lf. If add==true they are added to the current value instead. If a SpectralTransform S is provided, it is used when needed to set the variable, otherwise it is recomputed. In case u and v are provied, actually the divergence and vorticity are set and coslat_scaling_included specficies whether or not the 1/cos(lat) scaling is already included in the arrays or not (default: false)

The input may be:

  • A function or callable object f(lond, latd, σ) -> value (multilevel variables)
  • A function or callable object f(lond, latd) -> value (surface level variables)
  • An instance of AbstractGridArray
  • An instance of LowerTriangularArray
  • A scalar <: Number (interpreted as a constant field in grid space)
source
SpeedyWeather.set!Method
set!(S::SpeedyWeather.AbstractSimulation; kwargs...) -> Any

Sets properties of the simuluation S. Convenience wrapper to call the other concrete set! methods. All kwargs are forwarded to these methods, which are documented seperately. See their documentation for possible kwargs.

source
SpeedyWeather.set_period!Method
set_period!(clock::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::Clock, period::Real) -> Any

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

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_anomaly!Method
temperature_anomaly!(
    diagn::DiagnosticVariables,
    implicit::ImplicitPrimitiveEquation
)

Convert absolute and virtual temperature to anomalies wrt to the reference profile

source
SpeedyWeather.temperature_average!Method
temperature_average!(
    diagn::DiagnosticVariables,
    temp::LowerTriangularArray,
    S::SpectralTransform
)

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::DiagnosticVariables,
    adiabatic_conversion::SpeedyWeather.AbstractAdiabaticConversion,
    atmosphere::SpeedyWeather.AbstractAtmosphere,
    implicit::ImplicitPrimitiveEquation,
    G::Geometry,
    S::SpectralTransform
)

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.time_stepping!Method
time_stepping!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    model::AbstractModel
) -> Union{UnicodePlots.Plot{T, Val{true}} where T<:UnicodePlots.HeatmapCanvas, UnicodePlots.Plot{T, Val{false}} where T<:UnicodePlots.HeatmapCanvas}

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::PrimitiveEquation
) -> Union{Nothing, Bool}
timestep!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    dt::Real,
    model::PrimitiveEquation,
    lf1::Integer
) -> Union{Nothing, Bool}
timestep!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    dt::Real,
    model::PrimitiveEquation,
    lf1::Integer,
    lf2::Integer
) -> Union{Nothing, Bool}

Calculate a single time step for the model<:PrimitiveEquation

source
SpeedyWeather.timestep!Function
timestep!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    dt::Real,
    model::Barotropic
) -> Union{Nothing, Bool}
timestep!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    dt::Real,
    model::Barotropic,
    lf1::Integer
) -> Union{Nothing, Bool}
timestep!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    dt::Real,
    model::Barotropic,
    lf1::Integer,
    lf2::Integer
) -> Union{Nothing, Bool}

Calculate a single time step for the barotropic model.

source
SpeedyWeather.timestep!Function
timestep!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    dt::Real,
    model::ShallowWater
) -> Union{Nothing, Bool}
timestep!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    dt::Real,
    model::ShallowWater,
    lf1::Integer
) -> Union{Nothing, Bool}
timestep!(
    progn::PrognosticVariables,
    diagn::DiagnosticVariables,
    dt::Real,
    model::ShallowWater,
    lf1::Integer,
    lf2::Integer
) -> Union{Nothing, Bool}

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

source
SpeedyWeather.treeMethod
tree(M::AbstractModel; modules, with_size, kwargs...)

Create a tree of fields inside a model and fields within these fields as long as they are defined within the modules argument (default SpeedyWeather). Other keyword arguments are max_level::Integer=10, with_types::Bool=false or `with_size::Bool=false.

source
SpeedyWeather.treeMethod
tree(S; modules, with_size, kwargs...)

Create a tree of fields inside S and fields within these fields as long as they are defined within the modules argument (default SpeedyWeather). Other keyword arguments are max_level::Integer=10, with_types::Bool=false or `with_size::Bool=false.

source
SpeedyWeather.treeMethod
tree(S::Simulation{M}; modules, with_size, kwargs...)

Create a tree of fields inside a Simulation instance and fields within these fields as long as they are defined within the modules argument (default SpeedyWeather). Other keyword arguments are max_level::Integer=10, with_types::Bool=false or `with_size::Bool=false.

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!(diagn::DiagnosticVariables) -> Int64

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

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!(
    diagn::DiagnosticVariables,
    progn::PrognosticVariables,
    lf::Integer,
    geometry::Geometry
)

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

u_mean = ∑_k=1^nlayers Δσ_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=nlayers+1/2).

source
SpeedyWeather.virtual_temperature!Method
virtual_temperature!(
    diagn::DiagnosticVariables,
    model::PrimitiveDry
)

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::DiagnosticVariables,
    model::PrimitiveWet
)

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::DiagnosticVariables,
    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::DiagnosticVariables,
    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::DiagnosticVariables,
    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::DiagnosticVariables,
    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::DiagnosticVariables,
    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(
    device::SpeedyWeather.AbstractDevice
) -> Int64

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

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

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

source
SpeedyWeather.write_restart_fileMethod
write_restart_file(
    output::SpeedyWeather.AbstractOutput,
    progn::PrognosticVariables{T}
) -> Any

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