Function and type index
Core.Type
— MethodGenerator function pulling the resolution information from spectral_grid
.
SpeedyWeather.AbstractDevice
— Typeabstract type AbstractDevice
Supertype of all devices SpeedyWeather.jl can ran on
SpeedyWeather.AbstractLandSeaMask
— TypeAbstract type for land-sea masks. Custom land-sea masks have to be defined as
CustomMask{NF<:AbstractFloat, Grid<:AbstractGrid{NF}} <: AbstractLandSeaMask{NF, Grid}
and need to have at least a field called land_sea_mask::Grid
that uses a Grid
as defined by the spectral grid object, so of correct size and with the number format NF
. All AbstractLandSeaMask
have a convenient generator function to be used like mask = CustomMask(spectral_grid, option=argument)
, but you may add your own or customize by defining CustomMask(args...)
which should return an instance of type CustomMask{NF, Grid}
with parameters matching the spectral grid. Then the initialize function has to be extended for that new mask
initialize!(mask::CustomMask, model::PrimitiveEquation)
which generally is used to tweak the mask.landseamask grid as you like, using any other options you have included in CustomMask
as fields or anything else (preferrably read-only, because this is only to initialize the land-sea mask, nothing else) from model
. You can for example read something from file, set some values manually, or use coordinates from model.geometry
.
The land-sea mask grid is expected to have values between [0, 1] as we use a fractional mask, allowing for grid points being, e.g. quarter land and three quarters sea for 0.25 with 0 (=sea) and 1 (=land). The surface fluxes will weight proportionally the fluxes e.g. from sea and land surface temperatures. Note however, that the land-sea mask can declare grid points being (at least partially) ocean even though the sea surface temperatures aren't defined (=NaN) in that grid point. In that case, not flux is applied.
SpeedyWeather.AquaPlanetMask
— TypeLand-sea mask with zero = sea everywhere.
land_sea_mask::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
: Land-sea mask [1] on grid-point space. Land=1, sea=0, land-area fraction in between.
SpeedyWeather.BarotropicModel
— TypeThe BarotropicModel contains all model components needed for the simulation of the barotropic vorticity equations. To be constructed like
model = BarotropicModel(; spectral_grid, kwargs...)
with spectral_grid::SpectralGrid
used to initalize all non-default components passed on as keyword arguments, e.g. planet=Earth(spectral_grid)
. Fields, representing model components, are
spectral_grid::SpectralGrid
geometry::SpeedyWeather.AbstractGeometry
planet::SpeedyWeather.AbstractPlanet
atmosphere::SpeedyWeather.AbstractAtmosphere
coriolis::SpeedyWeather.AbstractCoriolis
forcing::SpeedyWeather.AbstractForcing
drag::SpeedyWeather.AbstractDrag
particle_advection::SpeedyWeather.AbstractParticleAdvection
initial_conditions::SpeedyWeather.AbstractInitialConditions
device_setup::SpeedyWeather.DeviceSetup
time_stepping::SpeedyWeather.AbstractTimeStepper
spectral_transform::SpectralTransform
implicit::SpeedyWeather.AbstractImplicit
horizontal_diffusion::SpeedyWeather.AbstractHorizontalDiffusion
output::SpeedyWeather.AbstractOutputWriter
callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}
feedback::SpeedyWeather.AbstractFeedback
SpeedyWeather.BulkRichardsonDrag
— TypeBoundary 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
SpeedyWeather.CPUDevice
— TypeCPUDevice <: AbstractDevice
Indicates that SpeedyWeather.jl runs on a single CPU
SpeedyWeather.ClausiusClapeyron
— TypeParameters 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 KelvinLᵥ::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 Kelvinmol_ratio::AbstractFloat
: Ratio of molecular masses [1] of water vapour over dry air (=Rdry/Rvapour).
SpeedyWeather.ClausiusClapeyron
— MethodFunctor: 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.
SpeedyWeather.Clock
— TypeClock struct keeps track of the model time, how many days to integrate for and how many time steps this takes
time::DateTime
: current model timestart::DateTime
: start time of simulationperiod::Second
: period to integrate for, set in set_period!(::Clock, ::Dates.Period)timestep_counter::Int64
: Counting all time steps during simulationn_timesteps::Int64
: number of time steps to integrate for, set in initialize!(::Clock, ::AbstractTimeStepper)
.
SpeedyWeather.Clock
— MethodClock(
time_stepping::SpeedyWeather.AbstractTimeStepper;
kwargs...
) -> SpeedyWeather.Clock
Create and initialize a clock from time_stepping
SpeedyWeather.ColumnVariables
— TypeMutable struct that contains all prognostic (copies thereof) and diagnostic variables in a single column needed to evaluate the physical parametrizations. For now the struct is mutable as we will reuse the struct to iterate over horizontal grid points. Every column vector has nlev
entries, from [1] at the top to [end] at the lowermost model level at the planetary boundary layer.
nlev::Int64
ij::Int64
jring::Int64
lond::AbstractFloat
latd::AbstractFloat
land_fraction::AbstractFloat
orography::AbstractFloat
u::Vector{NF} where NF<:AbstractFloat
v::Vector{NF} where NF<:AbstractFloat
temp::Vector{NF} where NF<:AbstractFloat
humid::Vector{NF} where NF<:AbstractFloat
ln_pres::Vector{NF} where NF<:AbstractFloat
pres::Vector{NF} where NF<:AbstractFloat
u_tend::Vector{NF} where NF<:AbstractFloat
v_tend::Vector{NF} where NF<:AbstractFloat
temp_tend::Vector{NF} where NF<:AbstractFloat
humid_tend::Vector{NF} where NF<:AbstractFloat
flux_u_upward::Vector{NF} where NF<:AbstractFloat
flux_u_downward::Vector{NF} where NF<:AbstractFloat
flux_v_upward::Vector{NF} where NF<:AbstractFloat
flux_v_downward::Vector{NF} where NF<:AbstractFloat
flux_temp_upward::Vector{NF} where NF<:AbstractFloat
flux_temp_downward::Vector{NF} where NF<:AbstractFloat
flux_humid_upward::Vector{NF} where NF<:AbstractFloat
flux_humid_downward::Vector{NF} where NF<:AbstractFloat
boundary_layer_depth::Int64
boundary_layer_drag::AbstractFloat
surface_geopotential::AbstractFloat
surface_u::AbstractFloat
surface_v::AbstractFloat
surface_temp::AbstractFloat
surface_humid::AbstractFloat
surface_wind_speed::AbstractFloat
skin_temperature_sea::AbstractFloat
skin_temperature_land::AbstractFloat
soil_moisture_availability::AbstractFloat
surface_air_density::AbstractFloat
sat_humid::Vector{NF} where NF<:AbstractFloat
dry_static_energy::Vector{NF} where NF<:AbstractFloat
temp_virt::Vector{NF} where NF<:AbstractFloat
bulk_richardson::Vector{NF} where NF<:AbstractFloat
geopot::Vector{NF} where NF<:AbstractFloat
cloud_top::Int64
precip_convection::AbstractFloat
precip_large_scale::AbstractFloat
SpeedyWeather.DeviceSetup
— TypeDeviceSetup{S<:AbstractDevice}
Holds information about the device the model is running on and workgroup size.
device::AbstractDevice
: Device the model is running ondevice_KA::KernelAbstractions.Device
: Device for use with KernelAbstractionsn
: workgroup size
SpeedyWeather.DiagnosticVariables
— TypeAll diagnostic variables.
layers::Array{DiagnosticVariablesLayer{NF, Grid}, 1} where {NF<:AbstractFloat, Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF}}
surface::SpeedyWeather.SurfaceVariables
columns::Array{ColumnVariables{NF}, 1} where NF<:AbstractFloat
particles::SpeedyWeather.ParticleVariables
nlat_half::Int64
nlev::Int64
npoints::Int64
scale::Base.RefValue{NF} where NF<:AbstractFloat
SpeedyWeather.DiagnosticVariablesLayer
— TypeAll diagnostic variables for a given layer: tendencies, prognostic varibles on the grid, and intermediate dynamics variables.
npoints::Int64
k::Int64
tendencies::SpeedyWeather.Tendencies
grid_variables::SpeedyWeather.GridVariables
dynamics_variables::SpeedyWeather.DynamicsVariables
temp_average::Base.RefValue{NF} where NF<:AbstractFloat
SpeedyWeather.DryBettsMiller
— TypeThe simplified Betts-Miller convection scheme from Frierson, 2007, https://doi.org/10.1175/JAS3935.1 but with humidity set to zero. Fields and options are
nlev::Int64
: number of vertical layers/levelstime_scale::Second
: [OPTION] Relaxation time for profile adjustmenttemp_ref_profile::Vector
: temperature [K] reference profile to adjust to
SpeedyWeather.DynamicsVariables
— TypeIntermediate quantities for the dynamics of a given layer.
nlat_half::Int64
trunc::Int64
a::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
b::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
a_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
b_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
uv∇lnp::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
uv∇lnp_sum_above::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
div_sum_above::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
temp_virt::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
geopot::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
σ_tend::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
SpeedyWeather.Earth
— TypeCreate 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 cyclelength_of_day::Second
: Seconds in a daily rotationseasonal_cycle::Bool
: switch on/off seasonal cyclelength_of_year::Second
: Seconds in an orbit around the sunequinox::DateTime
: time of spring equinox (year irrelevant)axial_tilt::AbstractFloat
: angle [˚] rotation axis tilt wrt to orbitsolar_constant::AbstractFloat
: Total solar irradiance at the distance of 1 AU [W/m²]
SpeedyWeather.EarthAtmosphere
— TypeCreate 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 capacitywater_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]
SpeedyWeather.EarthOrography
— TypeEarth's orography read from file, with smoothing.
path::String
: path to the folder containing the orography file, pkg path defaultfile::String
: filename of orographyfile_Grid::Type{<:SpeedyWeather.RingGrids.AbstractGrid}
: Grid the orography file comes onscale::Float64
: scale orography by a factorsmoothing::Bool
: smooth the orography field?smoothing_power::Float64
: power of Laplacian for smoothingsmoothing_strength::Float64
: highest degree l is multiplied bysmoothing_truncation::Int64
: resolution of orography in spectral truncorography::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
geopot_surf::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
SpeedyWeather.EarthOrography
— MethodEarthOrography(
spectral_grid::SpectralGrid;
kwargs...
) -> EarthOrography
Generator function pulling the resolution information from spectral_grid
.
SpeedyWeather.Feedback
— TypeFeedback() -> Feedback
Feedback(verbose::Bool) -> Feedback
Feedback(verbose::Bool, debug::Bool) -> Feedback
Generator function for a Feedback struct.
SpeedyWeather.Feedback
— TypeFeedback struct that contains options and object for command-line feedback like the progress meter.
verbose::Bool
: print feedback to REPL?debug::Bool
: check for NaRs in the prognostic variablesoutput::Bool
: write a progress.txt file? State synced with OutputWriter.outputid::Union{Int64, String}
: identification of run, taken from ::OutputWriterrun_path::String
: path to run folder, taken from ::OutputWriterprogress_meter::ProgressMeter.Progress
: struct containing everything progress relatedprogress_txt::Union{Nothing, IOStream}
: txt is a Nothing in case of no outputnars_detected::Bool
: did Infs/NaNs occur in the simulation?
SpeedyWeather.GPUDevice
— TypeGPUDevice <: AbstractDevice
Indicates that SpeedyWeather.jl runs on a single GPU
SpeedyWeather.Geometry
— TypeConstruct 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 resolutionGrid::Type{<:SpeedyWeather.RingGrids.AbstractGrid}
: grid of the dynamical corenlat_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 ringsnlev::Int64
: number of vertical levelsnpoints::Int64
: total number of grid pointsradius::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 gridslonds::Vector{NF} where NF<:AbstractFloat
: longitude (0˚...360˚) for each grid point in ring orderlatds::Vector{NF} where NF<:AbstractFloat
: latitude (-90˚...˚90) for each grid point in ring orderlons::Vector{NF} where NF<:AbstractFloat
: longitude (0...2π) for each grid point in ring orderlats::Vector{NF} where NF<:AbstractFloat
: latitude (-π/2...π/2) for each grid point in ring ordersinlat::Vector{NF} where NF<:AbstractFloat
: sin of latitudescoslat::Vector{NF} where NF<:AbstractFloat
: cos of latitudescoslat⁻¹::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 elementfull_to_half_interpolation::Vector{NF} where NF<:AbstractFloat
: Full to half levels interpolation
SpeedyWeather.Geometry
— MethodGeometry(spectral_grid::SpectralGrid) -> Geometry
Generator function for Geometry
struct based on spectral_grid
.
SpeedyWeather.GlobalSurfaceTemperatureCallback
— TypeCallback that records the global mean surface temperature on every time step
timestep_counter::Int64
temp::Vector
.
SpeedyWeather.GridVariables
— TypeTransformed prognostic variables (plus a few others) into grid-point space.
nlat_half::Int64
vor_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
div_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
temp_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
temp_grid_prev::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
temp_virt_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
humid_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
u_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
v_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
u_grid_prev::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
v_grid_prev::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
.
SpeedyWeather.HeldSuarez
— TypeStruct that defines the temperature relaxation from Held and Suarez, 1996 BAMS
nlat::Int64
: number of latitude ringsnlev::Int64
: number of vertical levelsσb::AbstractFloat
: sigma coordinate below which faster surface relaxation is appliedrelax_time_slow::Second
: time scale for slow global relaxationrelax_time_fast::Second
: time scale for faster tropical surface relaxationTmin::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
SpeedyWeather.HeldSuarez
— MethodHeldSuarez(SG::SpectralGrid; kwargs...) -> HeldSuarez
create a HeldSuarez temperature relaxation with arrays allocated given spectral_grid
SpeedyWeather.HumidityDiffusion
— TypeDiffusion of dry static energy: A relaxation towards a reference gradient of static energy wrt to geopotential, see Fortran SPEEDY documentation.
time_scale::Second
: time scale for strengthhumidity_gradient::AbstractFloat
: [1] ∂RH/∂σ, vertical gradient of relative humidity RH wrt sigma coordinate σFstar::Base.RefValue{NF} where NF<:AbstractFloat
SpeedyWeather.HyperDiffusion
— TypeStruct for horizontal hyper diffusion of vor, div, temp; implicitly in spectral space with a power
of the Laplacian (default=4) and the strength controlled by time_scale
. Options exist to scale the diffusion by resolution, and adaptive depending on the current vorticity maximum to increase diffusion in active layers. Furthermore the power can be decreased above the tapering_σ
to power_stratosphere
(default 2). For Barotropic, ShallowWater, the default non-adaptive constant-time scale hyper diffusion is used. Options are
trunc::Int64
: spectral resolutionnlev::Int64
: number of vertical levelspower::Float64
: power of Laplaciantime_scale::Second
: diffusion time scaleresolution_scaling::Float64
: stronger diffusion with resolution? 0: constant with trunc, 1: (inverse) linear with trunc, etcpower_stratosphere::Float64
: different power for tropopause/stratospheretapering_σ::Float64
: linearly scale towards power_stratosphere above this σadaptive::Bool
: adaptive = higher diffusion for layers with higher vorticity levels.vor_max::Float64
: above this (absolute) vorticity level [1/s], diffusion is increasedadaptive_strength::Float64
: increase strength abovevor_max
by this factor timesmax(abs(vor))/vor_max
∇²ⁿ_2D::Vector
∇²ⁿ_2D_implicit::Vector
∇²ⁿ::Array{Vector{NF}, 1} where NF
∇²ⁿ_implicit::Array{Vector{NF}, 1} where NF
SpeedyWeather.HyperDiffusion
— MethodHyperDiffusion(
spectral_grid::SpectralGrid;
kwargs...
) -> HyperDiffusion{<:AbstractFloat}
Generator function based on the resolutin in spectral_grid
. Passes on keyword arguments.
SpeedyWeather.ImplicitCondensation
— TypeLarge scale condensation as with implicit precipitation.
max_heating::AbstractFloat
: Flux limiter for latent heat release [K] per timesteptime_scale::AbstractFloat
: Time scale in multiples of time step Δt
SpeedyWeather.ImplicitPrimitiveEquation
— TypeStruct that holds various precomputed arrays for the semi-implicit correction to prevent gravity waves from amplifying in the primitive equation model.
trunc::Int64
: spectral resolutionnlev::Int64
: number of vertical levelsα::Float64
: time-step coefficient: 0=explicit, 0.5=centred implicit, 1=backward implicittemp_profile::Vector{NF} where NF<:AbstractFloat
: vertical temperature profile, obtained from diagnξ::Base.RefValue{NF} where NF<:AbstractFloat
: time step 2α*Δt packed in RefValue for mutabilityR::Matrix{NF} where NF<:AbstractFloat
: divergence: operator for the geopotential calculationU::Vector{NF} where NF<:AbstractFloat
: divergence: the -RdTₖ∇² term excl the eigenvalues from ∇² for divergenceL::Matrix{NF} where NF<:AbstractFloat
: temperature: operator for the TₖD + κTₖDlnps/Dt termW::Vector{NF} where NF<:AbstractFloat
: pressure: vertical averaging of the -D̄ term in the log surface pres equationL0::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 termL3::Matrix{NF} where NF<:AbstractFloat
: sumabove operator itselfL4::Vector{NF} where NF<:AbstractFloat
: factor in front of div term in Dlnps/DtS::Matrix{NF} where NF<:AbstractFloat
: for every l the matrix to be invertedS⁻¹::Array{NF, 3} where NF<:AbstractFloat
: combined inverted operator: S = 1 - ξ²(RL + UW)
SpeedyWeather.ImplicitPrimitiveEquation
— MethodImplicitPrimitiveEquation(
spectral_grid::SpectralGrid,
kwargs...
) -> ImplicitPrimitiveEquation
Generator using the resolution from SpectralGrid.
SpeedyWeather.ImplicitShallowWater
— TypeStruct that holds various precomputed arrays for the semi-implicit correction to prevent gravity waves from amplifying in the shallow water model.
trunc::Int64
α::Float64
: coefficient for semi-implicit computations to filter gravity wavesH::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
SpeedyWeather.ImplicitShallowWater
— MethodImplicitShallowWater(
spectral_grid::SpectralGrid;
kwargs...
) -> ImplicitShallowWater
Generator using the resolution from spectral_grid
.
SpeedyWeather.JablonowskiRelaxation
— TypeHeldSuarez-like temperature relaxation, but towards the Jablonowski temperature profile with increasing temperatures in the stratosphere.
SpeedyWeather.JablonowskiRelaxation
— MethodJablonowskiRelaxation(
SG::SpectralGrid;
kwargs...
) -> JablonowskiRelaxation
create a JablonowskiRelaxation temperature relaxation with arrays allocated given spectral_grid
SpeedyWeather.JablonowskiTemperature
— TypeCreate 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
SpeedyWeather.JetStreamForcing
— TypeForcing 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 ringslatitude::Any
: jet latitude [˚N]width::Any
: jet width [˚], default ≈ 19.29˚speed::Any
: jet speed scale [m/s]time_scale::Second
: time scale [days]amplitude::Vector
: precomputed amplitude vector [m/s²]
SpeedyWeather.Keepbits
— TypeNumber of mantissa bits to keep for each prognostic variable when compressed for netCDF and .jld2 data output.
u::Int64
v::Int64
vor::Int64
div::Int64
temp::Int64
pres::Int64
humid::Int64
precip_cond::Int64
precip_conv::Int64
cloud::Int64
SpeedyWeather.LandSeaMask
— TypeLand-sea mask, fractional, read from file.
path::String
: path to the folder containing the land-sea mask file, pkg path defaultfile::String
: filename of land sea maskfile_Grid::Type{<:SpeedyWeather.RingGrids.AbstractGrid}
: Grid the land-sea mask file comes onland_sea_mask::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
: Land-sea mask [1] on grid-point space. Land=1, sea=0, land-area fraction in between.
SpeedyWeather.Leapfrog
— TypeLeapfrog time stepping defined by the following fields
trunc::Int64
: spectral resolution (max degree of spherical harmonics)Δt_at_T31::Second
: time step in minutes for T31, scale linearly totrunc
radius::AbstractFloat
: radius of sphere [m], used for scalingadjust_with_output::Bool
: adjust ΔtatT31 with the outputdt to reach outputdt exactly in integer time stepsrobert_filter::AbstractFloat
: Robert (1966) time filter coefficeint to suppress comput. modewilliams_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
SpeedyWeather.Leapfrog
— MethodLeapfrog(spectral_grid::SpectralGrid; kwargs...) -> Leapfrog
Generator function for a Leapfrog struct using spectral_grid
for the resolution information.
SpeedyWeather.LinearDrag
— TypeLinear boundary layer drag following Held and Suarez, 1996 BAMS
nlev::Int64
σb::AbstractFloat
time_scale::Second
drag_coefs::Vector{NF} where NF<:AbstractFloat
SpeedyWeather.LinearDrag
— MethodLinearDrag(SG::SpectralGrid; kwargs...) -> LinearDrag
Generator function using nlev
from SG::SpectralGrid
SpeedyWeather.NoCallback
— TypeDummy callback that doesn't do anything.
SpeedyWeather.NoOrography
— TypeOrography with zero height in orography
and zero surface geopotential geopot_surf
.
orography::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
: height [m] on grid-point space.geopot_surf::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
: surface geopotential, height*gravity [m²/s²]
SpeedyWeather.NoOrography
— MethodNoOrography(spectral_grid::SpectralGrid) -> NoOrography
Generator function pulling the resolution information from spectral_grid
.
SpeedyWeather.OutputWriter
— TypeNetCDF output writer. Contains all output options and auxiliary fields for output interpolation. To be initialised with OutputWriter(::SpectralGrid, ::Type{<:ModelSetup}, kwargs...)
to pass on the resolution information and the model type which chooses which variables to output. Options include
spectral_grid::SpectralGrid
output::Bool
path::String
: [OPTION] path to output folder, run_???? will be created withinid::String
: [OPTION] run identification number/stringrun_path::String
filename::String
: [OPTION] name of the output netcdf filewrite_restart::Bool
: [OPTION] also write restart file if output==true?pkg_version::VersionNumber
startdate::DateTime
output_dt::Second
: [OPTION] output frequency, time stepoutput_vars::Vector{Symbol}
: [OPTION] which variables to output, u, v, vor, div, pres, temp, humidmissing_value::Union{Float32, Float64}
: [OPTION] missing value to be used in netcdf outputcompression_level::Int64
: [OPTION] lossless compression level; 1=low but fast, 9=high but slowshuffle::Bool
: [OPTION] shuffle/bittranspose filter for compressionkeepbits::SpeedyWeather.Keepbits
: [OPTION] mantissa bits to keep for every variableoutput_every_n_steps::Int64
timestep_counter::Int64
output_counter::Int64
netcdf_file::Union{Nothing, NCDatasets.NCDataset}
input_Grid::Type{<:SpeedyWeather.RingGrids.AbstractGrid}
as_matrix::Bool
: [OPTION] sort grid points into a matrix (interpolation-free), for OctahedralClenshawGrid, OctaHEALPixGrid onlyquadrant_rotation::NTuple{4, Int64}
matrix_quadrant::NTuple{4, Tuple{Int64, Int64}}
output_Grid::Type{<:SpeedyWeather.RingGrids.AbstractFullGrid}
: [OPTION] the grid used for output, full grids onlynlat_half::Int64
: [OPTION] the resolution of the output grid, default: same nlat_half as in the dynamical corenlon::Int64
nlat::Int64
npoints::Int64
nlev::Int64
interpolator::SpeedyWeather.RingGrids.AbstractInterpolator
u::Matrix{NF} where NF<:Union{Float32, Float64}
v::Matrix{NF} where NF<:Union{Float32, Float64}
vor::Matrix{NF} where NF<:Union{Float32, Float64}
div::Matrix{NF} where NF<:Union{Float32, Float64}
temp::Matrix{NF} where NF<:Union{Float32, Float64}
pres::Matrix{NF} where NF<:Union{Float32, Float64}
humid::Matrix{NF} where NF<:Union{Float32, Float64}
precip_cond::Matrix{NF} where NF<:Union{Float32, Float64}
precip_conv::Matrix{NF} where NF<:Union{Float32, Float64}
cloud::Matrix{NF} where NF<:Union{Float32, Float64}
SpeedyWeather.Particle
— TypeParticle 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)]
SpeedyWeather.ParticleTracker
— TypeA ParticleTracker is implemented as a callback to output the trajectories of particles from particle advection. To be added like
add!(model.callbacks, ParticleTracker(spectral_grid; kwargs...))
Output done via netCDF. Fields and options are
Δt::Second
: [OPTION] Frequency to track particles atfile_name::String
: [OPTION] File name for netCDF filecompression_level::Int64
: [OPTION] lossless compression level; 1=low but fast, 9=high but slowshuffle::Bool
: [OPTION] shuffle/bittranspose filter for compressionkeepbits::Int64
: [OPTION] mantissa bits to keep, (14, 15, 16) means at least (2km, 1km, 500m) accurate locationsn_particles::Int64
: Number of particles to trackn_steps::Int64
: Number of timesteps to track particles at (first and last incl)counter::Int64
: Count up the tracked particle positionsevery_n_timesteps::Int64
: Execute callback every n time stepsnetcdf_file::Union{Nothing, NCDatasets.NCDataset}
: The netcdf file to be written into, will be created at initializationlon::Vector
lat::Vector
σ::Vector
SpeedyWeather.PrimitiveDryModel
— TypeThe PrimitiveDryModel struct holds all other structs that contain precalculated constants, whether scalars or arrays that do not change throughout model integration.
spectral_grid::SpectralGrid
geometry::SpeedyWeather.AbstractGeometry
dynamics::Bool
planet::SpeedyWeather.AbstractPlanet
atmosphere::SpeedyWeather.AbstractAtmosphere
coriolis::SpeedyWeather.AbstractCoriolis
geopotential::SpeedyWeather.AbstractGeopotential
adiabatic_conversion::SpeedyWeather.AbstractAdiabaticConversion
particle_advection::SpeedyWeather.AbstractParticleAdvection
initial_conditions::SpeedyWeather.AbstractInitialConditions
orography::SpeedyWeather.AbstractOrography
land_sea_mask::SpeedyWeather.AbstractLandSeaMask
ocean::SpeedyWeather.AbstractOcean
land::SpeedyWeather.AbstractLand
solar_zenith::SpeedyWeather.AbstractZenith
physics::Bool
boundary_layer_drag::SpeedyWeather.AbstractBoundaryLayer
temperature_relaxation::SpeedyWeather.AbstractTemperatureRelaxation
static_energy_diffusion::SpeedyWeather.AbstractVerticalDiffusion
surface_thermodynamics::SpeedyWeather.AbstractSurfaceThermodynamics
surface_wind::SpeedyWeather.AbstractSurfaceWind
surface_heat_flux::SpeedyWeather.AbstractSurfaceHeat
convection::SpeedyWeather.AbstractConvection
shortwave_radiation::SpeedyWeather.AbstractShortwave
longwave_radiation::SpeedyWeather.AbstractLongwave
device_setup::SpeedyWeather.DeviceSetup
time_stepping::SpeedyWeather.AbstractTimeStepper
spectral_transform::SpectralTransform
implicit::SpeedyWeather.AbstractImplicit
horizontal_diffusion::SpeedyWeather.AbstractHorizontalDiffusion
vertical_advection::SpeedyWeather.AbstractVerticalAdvection
output::SpeedyWeather.AbstractOutputWriter
callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}
feedback::SpeedyWeather.AbstractFeedback
SpeedyWeather.PrimitiveWetModel
— TypeThe PrimitiveDryModel struct holds all other structs that contain precalculated constants, whether scalars or arrays that do not change throughout model integration.
spectral_grid::SpectralGrid
geometry::SpeedyWeather.AbstractGeometry
dynamics::Bool
planet::SpeedyWeather.AbstractPlanet
atmosphere::SpeedyWeather.AbstractAtmosphere
coriolis::SpeedyWeather.AbstractCoriolis
geopotential::SpeedyWeather.AbstractGeopotential
adiabatic_conversion::SpeedyWeather.AbstractAdiabaticConversion
particle_advection::SpeedyWeather.AbstractParticleAdvection
initial_conditions::SpeedyWeather.AbstractInitialConditions
orography::SpeedyWeather.AbstractOrography
land_sea_mask::SpeedyWeather.AbstractLandSeaMask
ocean::SpeedyWeather.AbstractOcean
land::SpeedyWeather.AbstractLand
solar_zenith::SpeedyWeather.AbstractZenith
soil::SpeedyWeather.AbstractSoil
vegetation::SpeedyWeather.AbstractVegetation
physics::Bool
clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron
boundary_layer_drag::SpeedyWeather.AbstractBoundaryLayer
temperature_relaxation::SpeedyWeather.AbstractTemperatureRelaxation
static_energy_diffusion::SpeedyWeather.AbstractVerticalDiffusion
humidity_diffusion::SpeedyWeather.AbstractVerticalDiffusion
surface_thermodynamics::SpeedyWeather.AbstractSurfaceThermodynamics
surface_wind::SpeedyWeather.AbstractSurfaceWind
surface_heat_flux::SpeedyWeather.AbstractSurfaceHeat
evaporation::SpeedyWeather.AbstractEvaporation
large_scale_condensation::SpeedyWeather.AbstractCondensation
convection::SpeedyWeather.AbstractConvection
shortwave_radiation::SpeedyWeather.AbstractShortwave
longwave_radiation::SpeedyWeather.AbstractLongwave
device_setup::SpeedyWeather.DeviceSetup
time_stepping::SpeedyWeather.AbstractTimeStepper
spectral_transform::SpectralTransform
implicit::SpeedyWeather.AbstractImplicit
horizontal_diffusion::SpeedyWeather.AbstractHorizontalDiffusion
vertical_advection::SpeedyWeather.AbstractVerticalAdvection
hole_filling::SpeedyWeather.AbstractHoleFilling
output::SpeedyWeather.AbstractOutputWriter
callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}
feedback::SpeedyWeather.AbstractFeedback
SpeedyWeather.PrognosticLayerTimesteps
— TypeCollect the n time steps of PrognosticVariablesLayer of an n-step time integration (leapfrog=2) into a single struct.
timesteps::Array{PrognosticVariablesLayer{NF}, 1} where NF<:AbstractFloat
.
SpeedyWeather.PrognosticSurfaceTimesteps
— TypeCollect the n time steps of PrognosticVariablesSurface of an n-step time integration (leapfrog=2) into a single struct.
timesteps::Array{SpeedyWeather.PrognosticVariablesSurface{NF}, 1} where NF<:AbstractFloat
.
SpeedyWeather.PrognosticVariablesLayer
— TypeA layer of the prognostic variables in spectral space.
trunc::Int64
: Spectral resolution as max degree of spherical harmonicsvor::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
: Vorticity of horizontal wind field [1/s]div::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
: Divergence of horizontal wind field [1/s]temp::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
: Absolute temperature [K]humid::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
: Specific humidity [kg/kg]
SpeedyWeather.PrognosticVariablesSurface
— TypeThe spectral and gridded prognostic variables at the surface.
trunc::Int64
: Spectral resolution as max degree of spherical harmonicspres::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
: log of surface pressure [log(Pa)] for PrimitiveEquation, interface displacement [m] for ShallowWaterModel
SpeedyWeather.RandomWaves
— TypeParameters for random initial conditions for the interface displacement η in the shallow water equations.
A::Float64
lmin::Int64
lmax::Int64
SpeedyWeather.ShallowWaterModel
— TypeThe ShallowWaterModel contains all model components needed for the simulation of the shallow water equations. To be constructed like
model = ShallowWaterModel(; spectral_grid, kwargs...)
with spectral_grid::SpectralGrid
used to initalize all non-default components passed on as keyword arguments, e.g. planet=Earth(spectral_grid)
. Fields, representing model components, are
spectral_grid::SpectralGrid
device_setup::SpeedyWeather.DeviceSetup
planet::SpeedyWeather.AbstractPlanet
atmosphere::SpeedyWeather.AbstractAtmosphere
coriolis::SpeedyWeather.AbstractCoriolis
orography::SpeedyWeather.AbstractOrography
forcing::SpeedyWeather.AbstractForcing
drag::SpeedyWeather.AbstractDrag
particle_advection::SpeedyWeather.AbstractParticleAdvection
initial_conditions::SpeedyWeather.AbstractInitialConditions
time_stepping::SpeedyWeather.AbstractTimeStepper
spectral_transform::SpectralTransform
implicit::SpeedyWeather.AbstractImplicit
horizontal_diffusion::SpeedyWeather.AbstractHorizontalDiffusion
geometry::SpeedyWeather.AbstractGeometry
output::SpeedyWeather.AbstractOutputWriter
callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}
feedback::SpeedyWeather.AbstractFeedback
SpeedyWeather.SimplifiedBettsMiller
— TypeThe simplified Betts-Miller convection scheme from Frierson, 2007, https://doi.org/10.1175/JAS3935.1. This implements the qref-formulation in their paper. Fields and options are
nlev::Int64
: number of vertical layers/levelstime_scale::Second
: [OPTION] Relaxation time for profile adjustmentrelative_humidity::Any
: [OPTION] Relative humidity for reference profiletemp_ref_profile::Vector
: temperature [K] reference profile to adjust tohumid_ref_profile::Vector
: specific humidity [kg/kg] profile to adjust to
SpeedyWeather.Simulation
— TypeSimulation is a container struct to be used with run!(::Simulation)
. It contains
prognostic_variables::PrognosticVariables
: define the current state of the modeldiagnostic_variables::DiagnosticVariables
: contain the tendencies and auxiliary arrays to compute themmodel::ModelSetup
: all parameters, constant at runtime
SpeedyWeather.SinSolarDeclination
— TypeCoefficients 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
SpeedyWeather.SinSolarDeclination
— MethodSinSolarDeclination functor, computing the solar declination angle of angular fraction of year g [radians] using the coefficients of the SinSolarDeclination struct.
SpeedyWeather.SinSolarDeclination
— MethodGenerator function using the planet's orbital parameters to adapt the solar declination calculation.
SpeedyWeather.SinSolarDeclination
— MethodGenerator function pulling the number format NF from a SpectralGrid.
SpeedyWeather.SolarDeclination
— TypeCoefficients 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
SpeedyWeather.SolarDeclination
— MethodSolarDeclination functor, computing the solar declination angle of angular fraction of year g [radians] using the coefficients of the SolarDeclination struct.
SpeedyWeather.SolarDeclination
— MethodGenerator function pulling the number format NF from a SpectralGrid.
SpeedyWeather.SolarTimeCorrection
— TypeCoefficients 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.
SpeedyWeather.SolarTimeCorrection
— MethodFunctor that returns the time correction for a angular fraction of the year g [radians], so that g=0 for Jan-01 and g=2π for Dec-31.
SpeedyWeather.SolarZenith
— TypeSolar zenith angle varying with daily and seasonal cycle.
nlat_half::Int64
length_of_day::Second
length_of_year::Second
equation_of_time::Bool
seasonal_cycle::Bool
solar_declination::SpeedyWeather.SinSolarDeclination{NF} where NF<:AbstractFloat
time_correction::SpeedyWeather.SolarTimeCorrection
initial_time::Base.RefValue{DateTime}
cos_zenith::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
SpeedyWeather.SolarZenithSeason
— TypeSolar zenith angle varying with seasonal cycle only.
nlat_half::Int64
length_of_day::Second
length_of_year::Second
seasonal_cycle::Bool
solar_declination::SpeedyWeather.SinSolarDeclination{NF} where NF<:AbstractFloat
initial_time::Base.RefValue{DateTime}
cos_zenith::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
SpeedyWeather.SpectralGrid
— TypeDefines 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 modeltrunc::Int64
: [OPTION] horizontal resolution as the maximum degree of spherical harmonicsGrid::Type{<:SpeedyWeather.RingGrids.AbstractGrid}
: [OPTION] horizontal grid used for calculations in grid-point spacedealiasing::Float64
: [OPTION] how to match spectral with grid resolution: dealiasing factor, 1=linear, 2=quadratic, 3=cubic gridradius::Float64
: [OPTION] radius of the sphere [m]n_particles::Int64
: [OPTION] number of particles for particle advection [1]nlat_half::Int64
: number of latitude rings on one hemisphere (Equator incl)nlat::Int64
: number of latitude rings on both hemispheresnpoints::Int64
: total number of grid points in the horizontalnlev::Int64
: [OPTION] number of vertical levelsvertical_coordinates::SpeedyWeather.VerticalCoordinates
: [OPTION] coordinates used to discretize the vertical
nlat_half
and npoints
should not be chosen but are derived from trunc
, Grid
and dealiasing
.
SpeedyWeather.SpeedyTransforms.SpectralTransform
— MethodSpectralTransform(
spectral_grid::SpectralGrid;
recompute_legendre,
one_more_degree,
kwargs...
) -> SpectralTransform
Generator function for a SpectralTransform struct pulling in parameters from a SpectralGrid struct.
SpeedyWeather.StartFromFile
— TypeRestart 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 fileid::Union{Int64, String}
:run_id
of restart file inrun_????/restart.jld2
SpeedyWeather.StartWithRandomVorticity
— TypeStart with random vorticity as initial conditions
power::Float64
: Power of the spectral distribution k^poweramplitude::Float64
: (approximate) amplitude in [1/s], used as standard deviation of spherical harmonic coefficients
SpeedyWeather.StaticEnergyDiffusion
— TypeDiffusion of dry static energy: A relaxation towards a reference gradient of static energy wrt to geopotential, see Fortran SPEEDY documentation.
time_scale::Second
: time scale for strengthstatic_energy_lapse_rate::AbstractFloat
: [1] ∂SE/∂Φ, vertical gradient of static energy SE with geopotential ΦFstar::Base.RefValue{NF} where NF<:AbstractFloat
SpeedyWeather.SurfaceEvaporation
— TypeSurface evaporation following a bulk formula with wind from model.surface_wind
use_boundary_layer_drag::Bool
: Use column.boundarylayerdrag coefficientmoisture_exchange_land::AbstractFloat
: Otherwise, use the following drag coefficient for evaporation over landmoisture_exchange_sea::AbstractFloat
: Or drag coefficient for evaporation over sea
SpeedyWeather.SurfaceVariables
— TypeDiagnostic variables for the surface layer.
nlat_half::Int64
trunc::Int64
npoints::Int64
pres_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
pres_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
pres_tend_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
∇lnp_x::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
∇lnp_y::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
u_mean_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
v_mean_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
div_mean_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
div_mean::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
precip_large_scale::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
precip_convection::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
cloud_top::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
soil_moisture_availability::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
SpeedyWeather.Tendencies
— TypeTendencies of the prognostic spectral variables for a given layer.
nlat_half::Int64
trunc::Int64
vor_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
div_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
temp_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
humid_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
u_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
v_tend::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
u_tend_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
v_tend_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
temp_tend_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
humid_tend_grid::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
SpeedyWeather.TetensEquation
— TypeParameters 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 KelvinT₁::AbstractFloat
: Tetens denominator (water) [˚C]T₂::AbstractFloat
: Tetens denominator following Murray (1967, below freezing) [˚C]C₁::AbstractFloat
: Tetens numerator scaling [1], above freezingC₂::AbstractFloat
: Tetens numerator scaling [1], below freezing
SpeedyWeather.TetensEquation
— MethodFunctor: 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.
SpeedyWeather.ZonalJet
— TypeA struct that contains all parameters for the Galewsky et al, 2004 zonal jet intitial conditions for the shallow water model. Default values as in Galewsky.
latitude::Float64
: jet latitude [˚N]width::Float64
: jet width [˚], default ≈ 19.29˚umax::Float64
: jet maximum velocity [m/s]perturb_lat::Float64
: perturbation latitude [˚N], position in jet by defaultperturb_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]
SpeedyWeather.ZonalRidge
— TypeZonal ridge orography after Jablonowski and Williamson, 2006.
η₀::Float64
: conversion from σ to Jablonowski's ηᵥ-coordinatesu₀::Float64
: max amplitude of zonal wind [m/s] that scales orography heightorography::SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
geopot_surf::LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
SpeedyWeather.ZonalRidge
— MethodZonalRidge(
spectral_grid::SpectralGrid;
kwargs...
) -> ZonalRidge
Generator function pulling the resolution information from spectral_grid
.
SpeedyWeather.ZonalWind
— TypeCreate 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 ηᵥ-coordinatesu₀::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]
Base.copy!
— Methodcopy!(progn_new::PrognosticVariables, progn_old::PrognosticVariables)
Copies entries of progn_old
into progn_new
. Only copies those variables that are present in the model of both progn_new
and progn_old
.
Base.mod
— Methodmod(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].
SpeedyWeather.CallbackDict
— MethodCallbackDict(
pairs::Pair{Symbol, <:SpeedyWeather.AbstractCallback}...
) -> Dict{Symbol, SpeedyWeather.AbstractCallback}
Create Callback dictionary like normal dictionaries.
SpeedyWeather.CallbackDict
— MethodCallbackDict(
) -> Dict{Symbol, SpeedyWeather.AbstractCallback}
Empty Callback dictionary generator.
SpeedyWeather.Device
— MethodDevice()
Return default used device for internal purposes, either CPUDevice
or GPUDevice
if a GPU is available.
SpeedyWeather.DeviceArray
— MethodDeviceArray(device::AbstractDevice, x)
Adapts x
to a CuArray
when device<:GPUDevice
is used, otherwise a regular Array
. Uses adapt
, thus also can return SubArrays etc.
SpeedyWeather.DeviceArrayNotAdapt
— MethodDeviceArrayNotAdapt(device::AbstractDevice, x)
Returns a CuArray
when device<:GPUDevice
is used, otherwise a regular Array
. Doesn't uses adapt
, therefore always returns CuArray/Array
SpeedyWeather.Device_KernelAbstractions
— MethodDevice_KernelAbstractions(::AbstractDevice)
Return used device for use with KernelAbstractions
SpeedyWeather.Device_KernelAbstractions
— MethodDevice_KernelAbstractions()
Return default used device for KernelAbstractions, either CPU
or CUDADevice
if a GPU is available
SpeedyWeather.SpeedyTransforms.gridded!
— Methodgridded!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Int64,
model::ModelSetup
)
Propagate the spectral state of progn
to diagn
using time step/leapfrog index lf
. Function barrier that calls gridded! for the respective model
.
SpeedyWeather.SpeedyTransforms.gridded!
— Methodgridded!(
diagn::DiagnosticVariablesLayer,
progn::PrognosticVariablesLayer,
model::Barotropic
)
Propagate the spectral state of the prognostic variables progn
to the diagnostic variables in diagn
for the barotropic vorticity model. Updates grid vorticity, spectral stream function and spectral and grid velocities u, v.
SpeedyWeather.SpeedyTransforms.gridded!
— Methodgridded!(
diagn::DiagnosticVariablesLayer,
progn::PrognosticVariablesLayer,
model::PrimitiveEquation
)
Propagate the spectral state of the prognostic variables progn
to the diagnostic variables in diagn
for primitive equation models. Updates grid vorticity, grid divergence, grid temperature, pressure (pres_grid
) and the velocities u, v.
SpeedyWeather.SpeedyTransforms.gridded!
— Methodgridded!(
diagn::DiagnosticVariablesLayer,
progn::PrognosticVariablesLayer,
model::ShallowWater
)
Propagate the spectral state of the prognostic variables progn
to the diagnostic variables in diagn
for the shallow water model. Updates grid vorticity, grid divergence, grid interface displacement (pres_grid
) and the velocities u, v.
SpeedyWeather.WhichZenith
— MethodWhichZenith(
SG::SpectralGrid,
P::SpeedyWeather.AbstractPlanet;
kwargs...
) -> Any
Chooses from SolarZenith (daily and seasonal cycle) or SolarZenithSeason given the parameters in model.planet. In both cases the seasonal cycle can be disabled, calculating the solar declination from the initial time instead of current time.
SpeedyWeather.activate
— Methodactivate(
p::Particle{NF}
) -> Particle{NF, true} where NF<:AbstractFloat
Activate particle. Active particles can move.
SpeedyWeather.active
— Methodactive(_::Particle{NF, isactive}) -> Any
Check whether particle is active.
SpeedyWeather.add!
— Methodadd!(
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)
SpeedyWeather.add!
— Methodadd!(
D::Dict{Symbol, SpeedyWeather.AbstractCallback},
callbacks::SpeedyWeather.AbstractCallback...
)
Add a or several callbacks to a Dict{Symbol, AbstractCallback} dictionary without specifying the key which is randomly created like callback_????. To be used like
add!(model.callbacks, callback)
add!(model.callbacks, callback1, callback2).
SpeedyWeather.bernoulli_potential!
— Methodbernoulli_potential!(
diagn::DiagnosticVariablesLayer{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
S::SpectralTransform
) -> LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
Computes the Laplace operator ∇² of the Bernoulli potential B
in spectral space.
- computes the kinetic energy KE = ½(u²+v²) on the grid
- transforms KE to spectral space
- adds geopotential for the Bernoulli potential in spectral space
- takes the Laplace operator.
This version is used for both ShallowWater and PrimitiveEquation, only the geopotential calculation in geopotential! differs.
SpeedyWeather.boundary_layer_drag!
— Methodboundary_layer_drag!(
column::ColumnVariables,
scheme::LinearDrag
)
Compute tendency for boundary layer drag of a column
and add to its tendencies fields
SpeedyWeather.callback!
— Methodcallback!(
callback::GlobalSurfaceTemperatureCallback,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::ModelSetup
) -> AbstractFloat
Pulls the average temperature from the lowermost layer and stores it in the next element of the callback.temp vector.
SpeedyWeather.clip_negatives!
— Methodclip_negatives!(A::AbstractArray)
Set all negative entries a
in A
to zero.
SpeedyWeather.convection!
— Methodconvection!(
column::ColumnVariables{NF},
DBM::DryBettsMiller,
geometry::Geometry,
atmosphere::SpeedyWeather.AbstractAtmosphere
)
calculates temperature tendency for the dry convection scheme following the simplified Betts-Miller convection from Frierson 2007 but with zero humidity. Starts with a first-guess relaxation to determine the convective criterion, then adjusts the reference profiles for thermodynamic consistency (e.g. in dry convection the humidity profile is non-precipitating), and relaxes current vertical profiles to the adjusted references.
SpeedyWeather.convection!
— Methodconvection!(
column::ColumnVariables{NF},
SBM::SimplifiedBettsMiller,
clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron,
geometry::Geometry,
planet::SpeedyWeather.AbstractPlanet,
atmosphere::SpeedyWeather.AbstractAtmosphere,
time_stepping::SpeedyWeather.AbstractTimeStepper
) -> Union{Nothing, Int64}
calculates temperature and humidity tendencies for the convection scheme following the simplified Betts-Miller convection. Starts with a first-guess relaxation to determine the convective criteria (none, dry/shallow or deep), then adjusts reference profiles for thermodynamic consistency (e.g. in dry convection the humidity profile is non-precipitating), and relaxes current vertical profiles to the adjusted references.
SpeedyWeather.coriolis
— Methodcoriolis(
grid::SpeedyWeather.RingGrids.AbstractGrid;
rotation
) -> Any
Return the Coriolis parameter f
on a grid like grid
on a planet of ratation
[1/s]. Default rotation of Earth.
SpeedyWeather.coriolis
— Methodcoriolis(
grid::SpeedyWeather.RingGrids.AbstractGrid;
rotation
) -> Any
Return the Coriolis parameter f
on the grid Grid
of resolution nlat_half
on a planet of ratation
[1/s]. Default rotation of Earth.
SpeedyWeather.cos_zenith!
— Methodcos_zenith!(
S::SolarZenithSeason{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
time::DateTime,
geometry::SpeedyWeather.AbstractGeometry
)
Calculate cos of solar zenith angle as daily average at time time
. Seasonal cycle or time correction may be disabled, depending on parameters in SolarZenithSeason.
SpeedyWeather.cos_zenith!
— Methodcos_zenith!(
S::SolarZenith{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
time::DateTime,
geometry::SpeedyWeather.AbstractGeometry
)
Calculate cos of solar zenith angle with a daily cycle at time time
. Seasonal cycle or time correction may be disabled, depending on parameters in SolarZenith.
SpeedyWeather.create_output_folder
— Methodcreate_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.
SpeedyWeather.deactivate
— Methoddeactivate(
p::Particle{NF}
) -> Particle{_A, false} where _A<:AbstractFloat
Deactivate particle. Inactive particles cannot move.
SpeedyWeather.default_sigma_coordinates
— Methoddefault_sigma_coordinates(nlev::Integer) -> Vector{Float64}
Vertical sigma coordinates defined by their nlev+1 half levels σ_levels_half
. Sigma coordinates are fraction of surface pressure (p/p0) and are sorted from top (stratosphere) to bottom (surface). The first half level is at 0 the last at 1. Default levels are equally spaced from 0 to 1 (including).
SpeedyWeather.drag!
— Methoddrag!(
diagn::DiagnosticVariablesLayer,
drag::QuadraticDrag{NF}
)
Quadratic drag for the momentum equations.
F = -c_D/H*|(u, v)|*(u, v)
with cD the non-dimensional drag coefficient as defined in drag::QuadraticDrag
. cD and layer thickness H
are precomputed in intialize!(::QuadraticDrag, ::ModelSetup) and scaled by the radius as are the momentum equations.
SpeedyWeather.dry_adiabat!
— Methoddry_adiabat!(
temp_ref_profile::AbstractVector,
temp_environment::AbstractVector,
σ::AbstractVector,
atmosphere::SpeedyWeather.AbstractAtmosphere
) -> Int64
Calculates the moist pseudo adiabat given temperature and humidity of surface parcel. Follows the dry adiabat till condensation and then continues on the pseudo moist-adiabat with immediate condensation to the level of zero buoyancy. Levels above are skipped, set to NaN instead and should be skipped in the relaxation.
SpeedyWeather.dry_static_energy!
— Methoddry_static_energy!(
column::ColumnVariables,
atmosphere::SpeedyWeather.AbstractAtmosphere
)
Compute the dry static energy SE = cₚT + Φ (latent heat times temperature plus geopotential) for the column.
SpeedyWeather.dynamics_tendencies!
— Functiondynamics_tendencies!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
model::PrimitiveEquation
) -> Any
dynamics_tendencies!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
model::PrimitiveEquation,
lf::Int64
) -> Any
Calculate all tendencies for the PrimitiveEquation model (wet or dry).
SpeedyWeather.dynamics_tendencies!
— Methoddynamics_tendencies!(
diagn::DiagnosticVariablesLayer,
progn::PrognosticVariablesLayer,
time::DateTime,
model::Barotropic
)
Calculate all tendencies for the BarotropicModel.
SpeedyWeather.dynamics_tendencies!
— Methoddynamics_tendencies!(
diagn::DiagnosticVariablesLayer,
progn::PrognosticVariablesLayer,
surface::SpeedyWeather.SurfaceVariables,
pres::LowerTriangularMatrix,
time::DateTime,
model::ShallowWater
)
Calculate all tendencies for the ShallowWaterModel.
SpeedyWeather.finish!
— Methodfinish!(F::Feedback)
Finalises the progress meter and the progress txt file.
SpeedyWeather.first_timesteps!
— Methodfirst_timesteps!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::ModelSetup,
output::SpeedyWeather.AbstractOutputWriter
)
Performs the first two initial time steps (Euler forward, unfiltered leapfrog) to populate the prognostic variables with two time steps (t=0, Δt) that can then be used in the normal leap frogging.
SpeedyWeather.flipsign!
— Methodflipgsign!(A::AbstractArray)
Like -A
but in-place.
SpeedyWeather.flux_divergence!
— Methodflux_divergence!(
A_tend::LowerTriangularMatrix{Complex{NF}},
A_grid::SpeedyWeather.RingGrids.AbstractGrid{NF},
diagn::DiagnosticVariablesLayer{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
G::Geometry{NF},
S::SpectralTransform{NF};
add,
flipsign
)
Computes ∇⋅((u, v)*A) with the option to add/overwrite A_tend
and to flip_sign
of the flux divergence by doing so.
A_tend = ∇⋅((u, v)*A)
foradd=false
,flip_sign=false
A_tend = -∇⋅((u, v)*A)
foradd=false
,flip_sign=true
A_tend += ∇⋅((u, v)*A)
foradd=true
,flip_sign=false
A_tend -= ∇⋅((u, v)*A)
foradd=true
,flip_sign=true
SpeedyWeather.fluxes_to_tendencies!
— Methodfluxes_to_tendencies!(
column::ColumnVariables,
geometry::Geometry,
planet::SpeedyWeather.AbstractPlanet,
atmosphere::SpeedyWeather.AbstractAtmosphere
)
Convert the fluxes on half levels to tendencies on full levels.
SpeedyWeather.forcing!
— Methodforcing!(
diagn::DiagnosticVariablesLayer,
forcing::JetStreamForcing
)
Set for every latitude ring the tendency to the precomputed forcing in the momentum equations following the JetStreamForcing. The forcing is precomputed in initialize!(::JetStreamForcing, ::ModelSetup)
.
SpeedyWeather.geopotential!
— Functiongeopotential!(
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.
SpeedyWeather.geopotential!
— Methodgeopotential!(
diagn::DiagnosticVariables,
geopotential::Geopotential,
orography::SpeedyWeather.AbstractOrography
)
Compute spectral geopotential geopot
from spectral temperature temp
and spectral surface geopotential geopot_surf
(orography*gravity).
SpeedyWeather.geopotential!
— Methodgeopotential!(
diagn::DiagnosticVariablesLayer,
pres::LowerTriangularMatrix,
planet::SpeedyWeather.AbstractPlanet
) -> Any
calculates the geopotential in the ShallowWaterModel as g*η, i.e. gravity times the interface displacement (field pres
)
SpeedyWeather.get_column!
— MethodRecalculate ring index if not provided.
SpeedyWeather.get_column!
— Methodget_column!(
C::ColumnVariables,
D::DiagnosticVariables,
P::PrognosticVariables,
ij::Integer,
jring::Integer,
geometry::Geometry,
planet::SpeedyWeather.AbstractPlanet,
orography::SpeedyWeather.AbstractOrography,
land_sea_mask::SpeedyWeather.AbstractLandSeaMask
) -> Any
Update C::ColumnVariables
by copying the prognostic variables from D::DiagnosticVariables
at gridpoint index ij
. Provide G::Geometry
for coordinate information.
SpeedyWeather.get_full_output_file_path
— Methodget_full_output_file_path(output::OutputWriter) -> String
Returns the full path of the output file after it was created.
SpeedyWeather.get_run_id
— Methodget_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.
SpeedyWeather.get_thermodynamics!
— Methodget_thermodynamics!(
column::ColumnVariables,
model::PrimitiveEquation
)
Calculate geopotentiala and dry static energy for the primitive equation model.
SpeedyWeather.get_var
— Methodget_var(progn::PrognosticVariables, var_name::Symbol; lf::Integer=1)
Returns the prognostic variable var_name
at leapfrog index lf
as a Vector{LowerTriangularMatrices}
.
SpeedyWeather.get_Δt_millisec
— Functionget_Δ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.
SpeedyWeather.grad
— Methodgrad(CC::ClausiusClapeyron{NF}, temp_kelvin) -> Any
Gradient of Clausius-Clapeyron wrt to temperature, evaluated at temp_kelvin
.
SpeedyWeather.grad
— Methodgrad(
TetensCoefficients::TetensEquation{NF},
temp_kelvin
) -> Any
Gradient of the Tetens equation wrt to temperature, evaluated at temp_kelvin
.
SpeedyWeather.grad_saturation_humidity
— Methodgrad_saturation_humidity(
CC::ClausiusClapeyron{NF},
temp_kelvin,
pres
) -> Any
Gradient of Clausius-Clapeyron wrt to temperature, evaluated at temp_kelvin
.
SpeedyWeather.has
— Methodhas(M::Type{<:ModelSetup}, var_name::Symbol) -> Bool
Returns true if the model M
has a prognostic variable var_name
, false otherwise. The default fallback is that all variables are included.
SpeedyWeather.horizontal_diffusion!
— Functionhorizontal_diffusion!(
progn::SpeedyWeather.PrognosticLayerTimesteps,
diagn::DiagnosticVariablesLayer,
model::PrimitiveEquation
) -> Union{Nothing, Bool}
horizontal_diffusion!(
progn::SpeedyWeather.PrognosticLayerTimesteps,
diagn::DiagnosticVariablesLayer,
model::PrimitiveEquation,
lf::Int64
) -> Union{Nothing, Bool}
Apply horizontal diffusion applied to vorticity, diffusion and temperature in the PrimitiveEquation models. Uses the constant diffusion for temperature but possibly adaptive diffusion for vorticity and divergence.
SpeedyWeather.horizontal_diffusion!
— Functionhorizontal_diffusion!(
progn::SpeedyWeather.PrognosticLayerTimesteps,
diagn::DiagnosticVariablesLayer,
model::ShallowWater
)
horizontal_diffusion!(
progn::SpeedyWeather.PrognosticLayerTimesteps,
diagn::DiagnosticVariablesLayer,
model::ShallowWater,
lf::Int64
)
Apply horizontal diffusion to vorticity and diffusion in the ShallowWater models.
SpeedyWeather.horizontal_diffusion!
— Functionhorizontal_diffusion!(
diagn::DiagnosticVariablesLayer,
progn::SpeedyWeather.PrognosticLayerTimesteps,
model::Barotropic
)
horizontal_diffusion!(
diagn::DiagnosticVariablesLayer,
progn::SpeedyWeather.PrognosticLayerTimesteps,
model::Barotropic,
lf::Int64
)
Apply horizontal diffusion to vorticity in the Barotropic models.
SpeedyWeather.horizontal_diffusion!
— Methodhorizontal_diffusion!(
tendency::LowerTriangularMatrix{Complex{NF<:AbstractFloat}},
A::LowerTriangularMatrix{Complex{NF<:AbstractFloat}},
∇²ⁿ_expl::AbstractArray{NF<:AbstractFloat, 1},
∇²ⁿ_impl::AbstractArray{NF<:AbstractFloat, 1}
)
Apply horizontal diffusion to a 2D field A
in spectral space by updating its tendency tendency
with an implicitly calculated diffusion term. The implicit diffusion of the next time step is split into an explicit part ∇²ⁿ_expl
and an implicit part ∇²ⁿ_impl
, such that both can be calculated in a single forward step by using A
as well as its tendency tendency
.
SpeedyWeather.humidity_diffusion!
— Methodhumidity_diffusion!(
column::ColumnVariables,
scheme::HumidityDiffusion,
geometry::Geometry
)
Apply humidity diffusion.
SpeedyWeather.implicit_correction!
— Methodimplicit_correction!(
diagn::DiagnosticVariables,
implicit::ImplicitPrimitiveEquation,
progn::PrognosticVariables
) -> Any
Apply the implicit corrections to dampen gravity waves in the primitive equation models.
SpeedyWeather.implicit_correction!
— Methodimplicit_correction!(
diagn::DiagnosticVariablesLayer{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
progn::SpeedyWeather.PrognosticLayerTimesteps{NF},
diagn_surface::SpeedyWeather.SurfaceVariables{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
progn_surface::SpeedyWeather.PrognosticSurfaceTimesteps{NF},
implicit::ImplicitShallowWater
)
Apply correction to the tendencies in diagn
to prevent the gravity waves from amplifying. The correction is implicitly evaluated using the parameter implicit.α
to switch between forward, centered implicit or backward evaluation of the gravity wave terms.
SpeedyWeather.initialize!
— Functioninitialize!(
scheme::HyperDiffusion,
k::Int64,
G::SpeedyWeather.AbstractGeometry,
L::SpeedyWeather.AbstractTimeStepper
)
initialize!(
scheme::HyperDiffusion,
k::Int64,
G::SpeedyWeather.AbstractGeometry,
L::SpeedyWeather.AbstractTimeStepper,
vor_max::Real
)
Precomputes the hyper diffusion terms in scheme
for layer k
based on the model time step in L
, the vertical level sigma level in G
, and the current (absolute) vorticity maximum level vor_max
SpeedyWeather.initialize!
— Methodinitialize!(
land_sea_mask::AquaPlanetMask,
model::PrimitiveEquation
)
Sets all grid points to 0 = sea.
SpeedyWeather.initialize!
— Methodinitialize!(
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!
.
SpeedyWeather.initialize!
— Methodinitialize!(
orog::EarthOrography,
P::SpeedyWeather.AbstractPlanet,
S::SpectralTransform
) -> LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
Initialize the arrays orography
, geopot_surf
in orog
by reading the orography field from file.
SpeedyWeather.initialize!
— Methodinitialize!(
feedback::Feedback,
clock::SpeedyWeather.Clock,
model::ModelSetup
) -> ProgressMeter.Progress
Initializes the a Feedback
struct.
SpeedyWeather.initialize!
— Methodinitialize!(
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
.
SpeedyWeather.initialize!
— Methodinitialize!(scheme::HeldSuarez, model::PrimitiveEquation)
initialize the HeldSuarez temperature relaxation by precomputing terms for the equilibrium temperature Teq.
SpeedyWeather.initialize!
— Methodinitialize!(
scheme::HumidityDiffusion,
model::PrimitiveEquation
) -> Any
Initialize dry static energy diffusion.
SpeedyWeather.initialize!
— Methodinitialize!(
scheme::HyperDiffusion,
diagn::DiagnosticVariablesLayer,
G::SpeedyWeather.AbstractGeometry,
L::SpeedyWeather.AbstractTimeStepper
)
Pre-function to other initialize!(::HyperDiffusion)
initialisors that calculates the (absolute) vorticity maximum for the layer of diagn
.
SpeedyWeather.initialize!
— Methodinitialize!(scheme::HyperDiffusion, model::ModelSetup)
Precomputes the hyper diffusion terms in scheme
based on the model time step, and possibly with a changing strength/power in the vertical.
SpeedyWeather.initialize!
— Methodinitialize!(
scheme::HyperDiffusion,
L::SpeedyWeather.AbstractTimeStepper
)
Precomputes the 2D hyper diffusion terms in scheme
based on the model time step.
SpeedyWeather.initialize!
— Methodinitialize!(
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.
SpeedyWeather.initialize!
— Methodinitialize!(
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
.
SpeedyWeather.initialize!
— Methodinitialize!(
scheme::JablonowskiRelaxation,
model::PrimitiveEquation
)
initialize the JablonowskiRelaxation temperature relaxation by precomputing terms for the equilibrium temperature Teq and the frequency (strength of relaxation).
SpeedyWeather.initialize!
— Methodinitialize!(
land_sea_mask::LandSeaMask,
model::PrimitiveEquation
) -> SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
Reads a high-resolution land-sea mask from file and interpolates (grid-call average) onto the model grid for a fractional sea mask.
SpeedyWeather.initialize!
— Methodinitialize!(L::Leapfrog, model::ModelSetup)
Initialize leapfrogging L
by recalculating the timestep given the output time step output_dt
from model.output
. Recalculating will slightly adjust the time step to be a divisor such that an integer number of time steps matches exactly with the output time step.
SpeedyWeather.initialize!
— Methodinitialize!(scheme::LinearDrag, model::PrimitiveEquation)
Precomputes the drag coefficients for this BoundaryLayerDrag
scheme.
SpeedyWeather.initialize!
— Methodinitialize!(
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!
.
SpeedyWeather.initialize!
— Methodinitialize!(
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!
.
SpeedyWeather.initialize!
— Methodinitialize!(
progn::PrognosticVariables,
_::PressureOnOrography,
model::PrimitiveEquation
) -> LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
Initialize surface pressure on orography by integrating the hydrostatic equation with the reference temperature lapse rate.
SpeedyWeather.initialize!
— Methodinitialize!(
progn_new::PrognosticVariables,
initial_conditions::StartFromFile,
model::ModelSetup
) -> PrognosticVariables
Restart from a previous SpeedyWeather.jl simulation via the restart file restart.jld2 Applies interpolation in the horizontal but not in the vertical.
SpeedyWeather.initialize!
— Methodinitialize!(
progn::PrognosticVariables,
initial_conditions::ZonalJet,
model::ModelSetup
) -> LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
Initial conditions from Galewsky, 2004, Tellus
SpeedyWeather.initialize!
— Methodinitialize!(
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!
.
SpeedyWeather.initialize!
— Methodinitialize!(
clock::SpeedyWeather.Clock,
time_stepping::SpeedyWeather.AbstractTimeStepper
) -> SpeedyWeather.Clock
Initialize the clock with the time step Δt
in the time_stepping
.
SpeedyWeather.initialize!
— Methodinitialize!(
scheme::StaticEnergyDiffusion,
model::PrimitiveEquation
) -> Any
Initialize dry static energy diffusion.
SpeedyWeather.initialize!
— Methodinitialize!(
orog::ZonalRidge,
P::SpeedyWeather.AbstractPlanet,
S::SpectralTransform,
G::Geometry
) -> LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
Initialize the arrays orography
, geopot_surf
in orog
following Jablonowski and Williamson, 2006.
SpeedyWeather.initialize!
— Methodinitialize!(
output::OutputWriter{output_NF, Model},
feedback::SpeedyWeather.AbstractFeedback,
time_stepping::SpeedyWeather.AbstractTimeStepper,
clock::SpeedyWeather.Clock,
diagn::DiagnosticVariables,
model::ModelSetup
)
Creates a netcdf file on disk and the corresponding netcdf_file
object preallocated with output variables and dimensions. write_output!
then writes consecuitive time steps into this file.
SpeedyWeather.initialize!
— Methodinitialize!(
callback::GlobalSurfaceTemperatureCallback{NF},
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::ModelSetup
) -> Int64
Initializes callback.temp vector that records the global mean surface temperature on every time step. Allocates vector of correct length (number of elements = total time steps plus one) and stores the global surface temperature of the initial conditions
SpeedyWeather.initialize!
— Methodinitialize!(
progn::PrognosticVariables{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
initial_conditions::JablonowskiTemperature,
model::ModelSetup
)
Initial conditions from Jablonowski and Williamson, 2006, QJR Meteorol. Soc
SpeedyWeather.initialize!
— Methodinitialize!(
progn::PrognosticVariables{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
initial_conditions::RandomWaves,
model::ShallowWater
)
Random initial conditions for the interface displacement η in the shallow water equations. The flow (u, v) is zero initially. This kicks off gravity waves that will interact with orography.
SpeedyWeather.initialize!
— Methodinitialize!(
progn::PrognosticVariables{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
initial_conditions::StartWithRandomVorticity,
model::ModelSetup
)
Start with random vorticity as initial conditions
SpeedyWeather.initialize!
— Methodinitialize!(
progn::PrognosticVariables{NF, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF},
initial_conditions::ZonalWind,
model::PrimitiveEquation
)
Initial conditions from Jablonowski and Williamson, 2006, QJR Meteorol. Soc
SpeedyWeather.initialize!
— Methodinitialize!(
particles::Array{P<:Particle, 1},
model::ModelSetup
)
Initialize particle locations uniformly in latitude, longitude and in the vertical σ coordinates. This uses a cosin-distribution in latitude for an equal-area uniformity.
SpeedyWeather.isdecreasing
— Methodisdecreasing(v::AbstractVector) -> Bool
Check whether elements of a vector v
are strictly decreasing.
SpeedyWeather.isincreasing
— Methodisincreasing(v::AbstractVector) -> Bool
Check whether elements of a vector v
are strictly increasing.
SpeedyWeather.ismod
— Methodismod(p::Particle) -> Bool
Check that a particle is in longitude [0,360˚E), latitude [-90˚,90˚N], and σ in [0,1].
SpeedyWeather.large_scale_condensation!
— Methodlarge_scale_condensation!(
column::ColumnVariables{NF},
scheme::ImplicitCondensation,
clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron,
geometry::Geometry,
planet::SpeedyWeather.AbstractPlanet,
atmosphere::SpeedyWeather.AbstractAtmosphere,
time_stepping::SpeedyWeather.AbstractTimeStepper
)
Large-scale condensation for a column
by relaxation back to 100% relative humidity. Calculates the tendencies for specific humidity and temperature from latent heat release and integrates the large-scale precipitation vertically for output.
SpeedyWeather.launch_kernel!
— Methodlaunch_kernel!(device_setup::DeviceSetup, kernel!, ndrange, kernel_args...)
Launches the kernel!
on the device_setup
with ndrange
computations over the kernel and arguments kernel_args
SpeedyWeather.leapfrog!
— Methodleapfrog!(
A_old::LowerTriangularMatrix{Complex{NF<:AbstractFloat}},
A_new::LowerTriangularMatrix{Complex{NF<:AbstractFloat}},
tendency::LowerTriangularMatrix{Complex{NF<:AbstractFloat}},
dt::Real,
lf::Int64,
L::Leapfrog{NF<:AbstractFloat}
)
Performs one leapfrog time step with (lf=2
) or without (lf=1
) Robert+Williams filter (see Williams (2009), Montly Weather Review, Eq. 7-9).
SpeedyWeather.linear_pressure_gradient!
— Methodlinear_pressure_gradient!(
diagn::DiagnosticVariablesLayer,
surface::SpeedyWeather.PrognosticSurfaceTimesteps,
lf::Int64,
atmosphere::SpeedyWeather.AbstractAtmosphere,
I::ImplicitPrimitiveEquation
) -> Any
Add the linear contribution of the pressure gradient to the geopotential. The pressure gradient in the divergence equation takes the form
-∇⋅(Rd * Tᵥ * ∇lnpₛ) = -∇⋅(Rd * Tᵥ' * ∇lnpₛ) - ∇²(Rd * Tₖ * lnpₛ)
So that the second term inside the Laplace operator can be added to the geopotential. Rd is the gas constant, Tᵥ the virtual temperature and Tᵥ' its anomaly wrt to the average or reference temperature Tₖ, lnpₛ is the logarithm of surface pressure.
SpeedyWeather.linear_virtual_temperature!
— Methodlinear_virtual_temperature!(
diagn::DiagnosticVariablesLayer,
progn::SpeedyWeather.PrognosticLayerTimesteps,
model::PrimitiveDry,
lf::Integer
) -> LowerTriangularMatrix{Complex{NF}} where NF<:AbstractFloat
Linear virtual temperature for model::PrimitiveDry
: Just copy over arrays from temp
to temp_virt
at timestep lf
in spectral space as humidity is zero in this model
.
SpeedyWeather.linear_virtual_temperature!
— Methodlinear_virtual_temperature!(
diagn::DiagnosticVariablesLayer,
progn::SpeedyWeather.PrognosticLayerTimesteps,
atmosphere::SpeedyWeather.AbstractAtmosphere,
lf::Int64
) -> Any
Calculates a linearised virtual temperature Tᵥ as
Tᵥ = T + Tₖμq
With absolute temperature T, layer-average temperarture Tₖ (computed in temperature_average!), specific humidity q and
μ = (1-ξ)/ξ, ξ = R_dry/R_vapour.
in spectral space.
SpeedyWeather.load_trajectory
— Methodload_trajectory(
var_name::Union{String, Symbol},
model::ModelSetup
) -> Any
Loads a var_name
trajectory of the model M
that has been saved in a netCDF file during the time stepping.
SpeedyWeather.moist_static_energy!
— Methodmoist_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
SpeedyWeather.move
— Methodmove(
p::Particle{NF, false},
args...
) -> Particle{NF, false} where NF
Inactive particles are not moved.
SpeedyWeather.move
— Methodmove(
p::Particle{NF, true},
dlon,
dlat,
dσ
) -> Particle{NF, true} where NF<:AbstractFloat
Move a particle with increments (dlon, dlat, dσ) in those respective coordinates. Only active particles are moved.
SpeedyWeather.move
— Methodmove(
p::Particle{NF, true},
dlon,
dlat
) -> Particle{NF, true} where NF<:AbstractFloat
Move a particle with increments (dlon, dlat) in 2D. No movement in vertical σ. Only active particles are moved.
SpeedyWeather.nans
— MethodA = nans(dims...)
Allocate A::Array{Float64} with NaNs.
SpeedyWeather.nans
— MethodA = nans(T, dims...)
Allocate array A with NaNs of type T. Similar to zeros(T, dims...).
SpeedyWeather.nar_detection!
— Methodnar_detection!(
feedback::Feedback,
progn::PrognosticVariables
) -> Union{Nothing, Bool}
Detect NaR (Not-a-Real) in the prognostic variables.
SpeedyWeather.parameterization_tendencies!
— Methodparameterization_tendencies!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
time::DateTime,
model::PrimitiveEquation
) -> Any
Compute tendencies for u, v, temp, humid from physical parametrizations. Extract for each vertical atmospheric column the prognostic variables (stored in diagn
as they are grid-point transformed), loop over all grid-points, compute all parametrizations on a single-column basis, then write the tendencies back into a horizontal field of tendencies.
SpeedyWeather.print_fields
— Methodprint_fields(io::IO, A, keys; arrays)
Prints to io
all fields of a struct A
identified by their keys
.
SpeedyWeather.progress!
— Methodprogress!(feedback::Feedback)
Calls the progress meter and writes every 5% progress increase to txt.
SpeedyWeather.pseudo_adiabat!
— Methodpseudo_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.
SpeedyWeather.readable_secs
— Methodreadable_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)
SpeedyWeather.remaining_time
— Methodremaining_time(p::ProgressMeter.Progress) -> String
Estimates the remaining time from a ProgresssMeter.Progress
. Adapted from ProgressMeter.jl
SpeedyWeather.reset_column!
— Methodreset_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.
SpeedyWeather.run!
— Methodrun!(
simulation::SpeedyWeather.AbstractSimulation;
period,
output,
n_days
) -> PrognosticVariables
Run a SpeedyWeather.jl simulation
. The simulation.model
is assumed to be initialized.
SpeedyWeather.saturation_humidity!
— Methodsaturation_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
.
SpeedyWeather.saturation_humidity
— Methodsaturation_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
SpeedyWeather.saturation_humidity
— Methodsaturation_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.
SpeedyWeather.scale!
— Methodscale!(progn::PrognosticVariables, scale::Real) -> Real
Scales the prognostic variables vorticity and divergence with the Earth's radius which is used in the dynamical core.
SpeedyWeather.scale!
— Methodscale!(progn::PrognosticVariables, var::Symbol, scale::Real)
Scale the variable var
inside progn
with scalar scale
.
SpeedyWeather.set_divergence!
— Methodset_divergence!(progn::PrognosticVariables, varargs...; kwargs...)
See set_var!
SpeedyWeather.set_humidity!
— Methodset_humidity!(progn::PrognosticVariables, varargs...; kwargs...)
See set_var!
SpeedyWeather.set_period!
— Methodset_period!(
clock::SpeedyWeather.Clock,
period::Dates.Period
) -> Second
Set the period
of the clock to a new value. Converts any Dates.Period
input to Second
.
SpeedyWeather.set_period!
— Methodset_period!(clock::SpeedyWeather.Clock, period::Real) -> Any
Set the period
of the clock to a new value. Converts any ::Real
input to Day
.
SpeedyWeather.set_pressure!
— Methodset_pressure!(progn::PrognosticVariables{NF},
pressure::AbstractMatrix,
Grid::Type{<:AbstractGrid},
lf::Integer=1) where NF
Sets the prognostic variable with the surface pressure in grid space at leapfrog index lf
.
SpeedyWeather.set_pressure!
— Methodset_pressure!(progn::PrognosticVariables{NF},
pressure::LowerTriangularMatrix;
lf::Integer=1) where NF
Sets the prognostic variable with the surface pressure in spectral space at leapfrog index lf
.
SpeedyWeather.set_pressure!
— Methodset_pressure!(progn::PrognosticVariables{NF},
pressure::AbstractGrid,
M::ModelSetup;
lf::Integer=1) where NF
Sets the prognostic variable with the surface pressure in grid space at leapfrog index lf
.
SpeedyWeather.set_pressure!
— Methodset_pressure!(progn::PrognosticVariables{NF},
pressure::AbstractGrid,
lf::Integer=1) where NF
Sets the prognostic variable with the surface pressure in grid space at leapfrog index lf
.
SpeedyWeather.set_temperature!
— Methodset_temperature!(progn::PrognosticVariables, varargs...; kwargs...)
See set_var!
SpeedyWeather.set_var!
— Methodfunction set_var!(progn::PrognosticVariables{NF},
varname::Symbol,
s::Number;
lf::Integer=1) where NF
Sets all values of prognostic variable varname
at leapfrog index lf
to the scalar s
.
SpeedyWeather.set_var!
— Methodset_var!(progn::PrognosticVariables{NF},
varname::Symbol,
var::Vector{<:AbstractMatrix},
Grid::Type{<:AbstractGrid}=FullGaussianGrid;
lf::Integer=1) where NF
Sets the prognostic variable with the name varname
in all layers at leapfrog index lf
with values given in var
a vector with all information for all layers in grid space.
SpeedyWeather.set_var!
— Methodset_var!(progn::PrognosticVariables{NF},
varname::Symbol,
var::Vector{<:LowerTriangularMatrix};
lf::Integer=1) where NF
Sets the prognostic variable with the name varname
in all layers at leapfrog index lf
with values given in var
a vector with all information for all layers in spectral space.
SpeedyWeather.set_var!
— Methodset_var!(progn::PrognosticVariables{NF},
varname::Symbol,
var::Vector{<:AbstractGrid},
M::ModelSetup;
lf::Integer=1) where NF
Sets the prognostic variable with the name varname
in all layers at leapfrog index lf
with values given in var
a vector with all information for all layers in grid space.
SpeedyWeather.set_var!
— Methodset_var!(progn::PrognosticVariables{NF},
varname::Symbol,
var::Vector{<:AbstractGrid};
lf::Integer=1) where NF
Sets the prognostic variable with the name varname
in all layers at leapfrog index lf
with values given in var
a vector with all information for all layers in grid space.
SpeedyWeather.set_vorticity!
— Methodset_vorticity!(progn::PrognosticVariables, varargs...; kwargs...)
See set_var!
SpeedyWeather.sigma_okay
— Methodsigma_okay(nlev::Integer, σ_half::AbstractVector) -> Bool
Check that nlev and σ_half match.
SpeedyWeather.solar_hour_angle
— Methodsolar_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.
SpeedyWeather.speedstring
— Methodspeedstring(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.
SpeedyWeather.static_energy_diffusion!
— Methodstatic_energy_diffusion!(
column::ColumnVariables,
scheme::StaticEnergyDiffusion
)
Apply dry static energy diffusion.
SpeedyWeather.surface_pressure_tendency!
— Methodsurface_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.
- Calculate ∇ln(p_s) in spectral space, convert to grid.
- Multiply ū, v̄ with ∇ln(p_s) in grid-point space, convert to spectral.
- D̄ is subtracted in spectral space.
- Set tendency of the l=m=0 mode to 0 for better mass conservation.
SpeedyWeather.temperature_anomaly!
— MethodConvert absolute and virtual temperature to anomalies wrt to the reference profile
SpeedyWeather.temperature_average!
— Methodtemperature_average!(
diagn::DiagnosticVariablesLayer,
temp::LowerTriangularMatrix,
S::SpectralTransform
) -> Any
Calculates the average temperature of a layer from the l=m=0 harmonic and stores the result in diagn.temp_average
SpeedyWeather.temperature_relaxation!
— Methodtemperature_relaxation!(
column::ColumnVariables,
scheme::HeldSuarez,
atmosphere::SpeedyWeather.AbstractAtmosphere
)
Apply temperature relaxation following Held and Suarez 1996, BAMS.
SpeedyWeather.temperature_relaxation!
— Methodtemperature_relaxation!(
column::ColumnVariables,
scheme::JablonowskiRelaxation
)
Apply HeldSuarez-like temperature relaxation to the Jablonowski and Williamson vertical profile.
SpeedyWeather.temperature_tendency!
— Methodtemperature_tendency!(
diagn::DiagnosticVariablesLayer,
adiabatic_conversion::SpeedyWeather.AbstractAdiabaticConversion,
atmosphere::SpeedyWeather.AbstractAtmosphere,
G::Geometry,
S::SpectralTransform,
I::ImplicitPrimitiveEquation
)
Compute the temperature tendency
∂T/∂t += -∇⋅((u, v)*T') + T'D + κTᵥ*Dlnp/Dt
+=
because the tendencies already contain parameterizations and vertical advection. T'
is the anomaly with respect to the reference/average temperature. Tᵥ is the virtual temperature used in the adiabatic term κTᵥ*Dlnp/Dt.
SpeedyWeather.tendencies_physics_only!
— FunctionFor 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.
SpeedyWeather.time_stepping!
— Methodtime_stepping!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::ModelSetup
) -> PrognosticVariables
Main time loop that that initializes output and feedback, loops over all time steps and calls the output and feedback functions.
SpeedyWeather.timestep!
— Functiontimestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::Barotropic
)
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::Barotropic,
lf1::Int64
)
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::Barotropic,
lf1::Int64,
lf2::Int64
)
Calculate a single time step for the model <: Barotropic
.
SpeedyWeather.timestep!
— Methodtimestep!(
progn::PrognosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
diagn::DiagnosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
dt::Real,
model::PrimitiveEquation
) -> Any
timestep!(
progn::PrognosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
diagn::DiagnosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
dt::Real,
model::PrimitiveEquation,
lf1::Int64
) -> Any
timestep!(
progn::PrognosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
diagn::DiagnosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
dt::Real,
model::PrimitiveEquation,
lf1::Int64,
lf2::Int64
) -> Any
Calculate a single time step for the model<:PrimitiveEquation
SpeedyWeather.timestep!
— Methodtimestep!(
progn::PrognosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
diagn::DiagnosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
dt::Real,
model::ShallowWater
)
timestep!(
progn::PrognosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
diagn::DiagnosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
dt::Real,
model::ShallowWater,
lf1::Int64
)
timestep!(
progn::PrognosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
diagn::DiagnosticVariables{NF<:AbstractFloat, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{NF<:AbstractFloat},
dt::Real,
model::ShallowWater,
lf1::Int64,
lf2::Int64
)
Calculate a single time step for the model <: ShallowWater
.
SpeedyWeather.underflow!
— Methodunderflow!(A::AbstractArray, ϵ::Real)
Underflows element a
in A
to zero if abs(a) < ϵ
.
SpeedyWeather.unscale!
— Methodunscale!(variable::AbstractArray, scale::Real) -> Any
Undo the radius-scaling for any variable. Method used for netcdf output.
SpeedyWeather.unscale!
— Methodunscale!(progn::PrognosticVariables) -> Int64
Undo the radius-scaling of vorticity and divergence from scale!(progn, scale::Real).
SpeedyWeather.vertical_integration!
— Methodvertical_integration!(Diag::DiagnosticVariables, G::Geometry)
Calculates the vertically averaged (weighted by the thickness of the σ level) velocities (*coslat) and divergence. E.g.
u_mean = ∑_k=1^nlev Δσ_k * u_k
u, v are averaged in grid-point space, divergence in spectral space.
SpeedyWeather.vertical_interpolate!
— Methodvertical_interpolate!(
A_half::Vector,
A_full::Vector,
G::Geometry
)
Given a vector in column defined at full levels, do a linear interpolation in log(σ) to calculate its values at half-levels, skipping top (k=1/2), extrapolating to bottom (k=NLEV+1/2).
SpeedyWeather.virtual_temperature!
— Methodvirtual_temperature!(
diagn::DiagnosticVariablesLayer,
temp::LowerTriangularMatrix,
model::PrimitiveDry
) -> SpeedyWeather.RingGrids.AbstractGrid{NF} where NF<:AbstractFloat
Virtual temperature in grid-point space: For the PrimitiveDry temperature and virtual temperature are the same (humidity=0). Just copy over the arrays.
SpeedyWeather.virtual_temperature!
— Methodvirtual_temperature!(
diagn::DiagnosticVariablesLayer,
temp::LowerTriangularMatrix,
atmosphere::SpeedyWeather.AbstractAtmosphere
)
Calculates the virtual temperature Tᵥ as
Tᵥ = T(1+μq)
With absolute temperature T, specific humidity q and
μ = (1-ξ)/ξ, ξ = R_dry/R_vapour.
in grid-point space.
SpeedyWeather.volume_flux_divergence!
— Methodvolume_flux_divergence!(
diagn::DiagnosticVariablesLayer,
surface::SpeedyWeather.SurfaceVariables,
orog::SpeedyWeather.AbstractOrography,
atmosphere::SpeedyWeather.AbstractAtmosphere,
G::SpeedyWeather.AbstractGeometry,
S::SpectralTransform
)
Computes the (negative) divergence of the volume fluxes uh, vh
for the continuity equation, -∇⋅(uh, vh).
SpeedyWeather.vordiv_tendencies!
— Methodvordiv_tendencies!(
diagn::DiagnosticVariablesLayer,
surf::SpeedyWeather.SurfaceVariables,
model::PrimitiveEquation
)
Function barrier to unpack model
.
SpeedyWeather.vordiv_tendencies!
— Methodvordiv_tendencies!(
diagn::DiagnosticVariablesLayer,
surf::SpeedyWeather.SurfaceVariables,
coriolis::SpeedyWeather.AbstractCoriolis,
atmosphere::SpeedyWeather.AbstractAtmosphere,
geometry::SpeedyWeather.AbstractGeometry,
S::SpectralTransform
)
Tendencies for vorticity and divergence. Excluding Bernoulli potential with geopotential and linear pressure gradient inside the Laplace operator, which are added later in spectral space.
u_tend += v*(f+ζ) - RTᵥ'*∇lnp_x
v_tend += -u*(f+ζ) - RTᵥ'*∇lnp_y
+=
because the tendencies already contain the parameterizations and vertical advection. f
is coriolis, ζ
relative vorticity, R
the gas constant Tᵥ'
the virtual temperature anomaly, ∇lnp
the gradient of surface pressure and _x
and _y
its zonal/meridional components. The tendencies are then curled/dived to get the tendencies for vorticity/divergence in spectral space
∂ζ/∂t = ∇×(u_tend, v_tend)
∂D/∂t = ∇⋅(u_tend, v_tend) + ...
+ ...
because there's more terms added later for divergence.
SpeedyWeather.vorticity_flux!
— Methodvorticity_flux!(
diagn::DiagnosticVariablesLayer,
model::Barotropic
)
Vorticity flux tendency in the barotropic vorticity equation
∂ζ/∂t = ∇×(u_tend, v_tend)
with
u_tend = Fᵤ + v*(ζ+f)
v_tend = Fᵥ - u*(ζ+f)
with Fᵤ, Fᵥ the forcing from forcing!
already in u_tend_grid
/v_tend_grid
and vorticity ζ, coriolis f.
SpeedyWeather.vorticity_flux!
— Methodvorticity_flux!(
diagn::DiagnosticVariablesLayer,
model::ShallowWater
)
Vorticity flux tendency in the shallow water equations
∂ζ/∂t = ∇×(u_tend, v_tend)
∂D/∂t = ∇⋅(u_tend, v_tend)
with
u_tend = Fᵤ + v*(ζ+f)
v_tend = Fᵥ - u*(ζ+f)
with Fᵤ, Fᵥ the forcing from forcing!
already in u_tend_grid
/v_tend_grid
and vorticity ζ, coriolis f.
SpeedyWeather.vorticity_flux_curldiv!
— Methodvorticity_flux_curldiv!(
diagn::DiagnosticVariablesLayer,
coriolis::SpeedyWeather.AbstractCoriolis,
geometry::Geometry,
S::SpectralTransform;
div,
add
)
Compute the vorticity advection as the curl/div of the vorticity fluxes
∂ζ/∂t = ∇×(u_tend, v_tend)
∂D/∂t = ∇⋅(u_tend, v_tend)
with
u_tend = Fᵤ + v*(ζ+f)
v_tend = Fᵥ - u*(ζ+f)
with Fᵤ, Fᵥ
from u_tend_grid
/v_tend_grid
that are assumed to be alread set in forcing!
. Set div=false
for the BarotropicModel which doesn't require the divergence tendency.
SpeedyWeather.workgroup_size
— Methodworkgroup_size(dev::AbstractDevice)
Returns a workgroup size depending on dev
. WIP: Will be expanded in the future to also include grid information.
SpeedyWeather.write_column_tendencies!
— Methodwrite_column_tendencies!(
D::DiagnosticVariables,
column::ColumnVariables,
planet::SpeedyWeather.AbstractPlanet,
ij::Int64
)
Write the parametrization tendencies from C::ColumnVariables
into the horizontal fields of tendencies stored in D::DiagnosticVariables
at gridpoint index ij
.
SpeedyWeather.write_netcdf_time!
— Methodwrite_netcdf_time!(output::OutputWriter, time::DateTime)
Write the current time time::DateTime
to the netCDF file in output::OutputWriter
.
SpeedyWeather.write_netcdf_variables!
— Methodwrite_netcdf_variables!(
output::OutputWriter,
diagn::DiagnosticVariables{NF, Grid, Model}
)
Write diagnostic variables from diagn
to the netCDF file in output::OutputWriter
.
SpeedyWeather.write_output!
— Methodwrite_output!(
outputter::OutputWriter,
time::DateTime,
diagn::DiagnosticVariables
)
Writes the variables from diagn
of time step i
at time time
into outputter.netcdf_file
. Simply escapes for no netcdf output of if output shouldn't be written on this time step. Interpolates onto output grid and resolution as specified in outputter
, converts to output number format, truncates the mantissa for higher compression and applies lossless compression.
SpeedyWeather.write_restart_file
— Methodwrite_restart_file(
progn::PrognosticVariables{T, Grid} where Grid<:SpeedyWeather.RingGrids.AbstractGrid{T},
output::OutputWriter
) -> Union{Nothing, String}
A restart file restart.jld2
with the prognostic variables is written to the output folder (or current path) that can be used to restart the model. restart.jld2
will then be used as initial conditions. The prognostic variables are bitrounded for compression and the 2nd leapfrog time step is discarded. Variables in restart file are unscaled.
SpeedyWeather.year_angle
— Methodyear_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.
SpeedyWeather.zero_tendencies!
— Methodzero_tendencies!(
diagn::DiagnosticVariables{NF, Grid, Model<:Barotropic}
)
Set the tendencies in diagn
to zero.
SpeedyWeather.zero_tendencies!
— Methodzero_tendencies!(
diagn::DiagnosticVariables{NF, Grid, Model<:PrimitiveDry}
)
Set the tendencies in diagn
to zero.
SpeedyWeather.zero_tendencies!
— Methodzero_tendencies!(
diagn::DiagnosticVariables{NF, Grid, Model<:PrimitiveWet}
)
Set the tendencies in diagn
to zero.
SpeedyWeather.zero_tendencies!
— Methodzero_tendencies!(
diagn::DiagnosticVariables{NF, Grid, Model<:ShallowWater}
)
Set the tendencies in diagn
to zero.
SpeedyWeather.σ_interpolation_weights
— Methodσ_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).