Function and type index
Core.Type — MethodGenerator function pulling the resolution information from spectral_grid.
SpeedyTransforms.SpectralTransform — MethodSpectralTransform(
spectral_grid::SpectralGrid;
one_more_degree,
kwargs...
) -> Any
Generator function for a SpectralTransform struct pulling in parameters from a SpectralGrid struct.
SpeedyWeather.AbstractLandSeaMask — TypeAbstract super type for land-sea masks. Custom land-sea masks have to be defined as
CustomMask{NF, GridVariable2D} <: AbstractLandSeaMaskand need to have at least a field called mask::GridVariable2D that uses a GridVariable2D as defined by the spectral grid object, so of correct size and with the number format NF. All AbstractLandSeaMask have a convenient generator function to be used like mask = CustomMask(spectral_grid, option=argument), but you may add your own or customize by defining CustomMask(args...) which should return an instance of type CustomMask{NF, Grid} with parameters matching the spectral grid. Then the initialize function has to be extended for that new mask
initialize!(mask::CustomMask, model::PrimitiveEquation)which generally is used to tweak the mask.mask grid as you like, using any other options you have included in CustomMask as fields or anything else (preferrably read-only, because this is only to initialize the land-sea mask, nothing else) from model. You can for example read something from file, set some values manually, or use coordinates from model.geometry.
The land-sea mask grid is expected to have values between [0, 1] as we use a fractional mask, allowing for grid points being, e.g. quarter land and three quarters sea for 0.25 with 0 (=sea) and 1 (=land). The surface fluxes will weight proportionally the fluxes e.g. from sea and land surface temperatures. Note however, that the land-sea mask can declare grid points being (at least partially) ocean even though the sea surface temperatures aren't defined (=NaN) in that grid point. In that case, not flux is applied.
SpeedyWeather.AbstractOcean — TypeAbstract super type for ocean models, which control the sea surface temperature and sea ice concentration as boundary conditions to a SpeedyWeather simulation. A new ocean model has to be defined as
CustomOceanModel <: AbstractOceanand can have parameters like CustomOceanModel{T} and fields. They need to extend the following functions
function initialize!(ocean_model::CustomOceanModel, model::PrimitiveEquation)
# your code here to initialize the ocean model itself
# you can use other fields from model, e.g. model.geometry
end
function initialize!(
ocean::PrognosticVariablesOcean,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
ocean_model::CustomOceanModel,
model::PrimitiveEquation,
)
# your code here to initialize the prognostic variables for the ocean
# namely, ocean.sea_surface_temperature, ocean.sea_ice_concentration, e.g.
# ocean.sea_surface_temperature .= 300 # 300K everywhere
end
function timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
ocean_model::CustomOceanModel,
model::PrimitiveEquation,
)
# your code here to change the progn.ocean.sea_surface_temperature
endTemperatures in ocean.seasurfacetemperature have units of Kelvin, or NaN for no ocean. Note that neither sea surface temperature, land-sea mask or orography have to agree. It is possible to have an ocean on top of a mountain. For an ocean grid-cell that is (partially) masked by the land-sea mask, its value will be (fractionally) ignored in the calculation of surface fluxes (potentially leading to a zero flux depending on land surface temperatures). For an ocean grid-cell that is NaN but not masked by the land-sea mask, its value is always ignored.
SpeedyWeather.AdiabaticConversion — TypeTerms used to compute the adiabatic conversion term in the spectral model. Fields are:
nlayers::Int64σ_lnp_A::Any: σ-related factor A needed for adiabatic conversion termσ_lnp_B::Any: σ-related factor B needed for adiabatic conversion term
SpeedyWeather.AlbedoOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.AquaPlanet — TypeAquaPlanet sea surface temperatures that are constant in time and longitude, but vary in latitude following a coslat². To be created like
ocean = AquaPlanet(spectral_grid, temp_equator=302, temp_poles=273)Fields and options are
temp_equator::Any: [OPTION] Temperature on the Equator [K]temp_poles::Any: [OPTION] Temperature at the poles [K]mask::Bool: [OPTION] Mask the sea surface temperature according to model.landseamask?
SpeedyWeather.AquaPlanetMask — TypeLand-sea mask with zero = sea everywhere.
mask::Any: 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::SpectralGridarchitecture::Anygeometry::Anyplanet::Anyatmosphere::Anycoriolis::Anyforcing::Anydrag::Anyparticle_advection::Anyinitial_conditions::Anyrandom_process::Anytracers::Dict{Symbol, Tracer}time_stepping::Anyspectral_transform::Anyimplicit::Anyhorizontal_diffusion::Anyoutput::Anycallbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}feedback::Any
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.Century — TypeCentury <: PeriodConvenience time type representing a 100-year period.
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 Kelvinlatent_heat_condensation::AbstractFloat: Latent heat of condensation/vaporization of water [J/kg]latent_heat_fusion::AbstractFloat: Latent heat of freezing/fusion of ice [J/kg]latent_heat_sublimation::AbstractFloat: Latent heat of freezing/sublimation of ice [J/kg]heat_capacity::AbstractFloat: Specific heat of air 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: [DERIVED] Latent heat of condensation divided by gas constant of water vapour [K]T₀⁻¹::AbstractFloat: [DERIVED] Inverse of T₀, one over 0°C in Kelvinmol_ratio::AbstractFloat: [DERIVED] 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 fortimestep_counter::Int64: Counting all time steps during simulationn_timesteps::Int64: number of time steps to integrate for, set ininitialize!(::Clock, ::AbstractTimeStepper)Δt::Millisecond: Time step
SpeedyWeather.Clock — MethodClock(
time_stepping::SpeedyWeather.AbstractTimeStepper;
kwargs...
) -> Clock
Create and initialize a clock from time_stepping.
SpeedyWeather.CloudTopOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
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. Most column vectors have nlayers entries, from [1] at the top to [end] at the lowermost model level at the planetary boundary layer.
nlayers::Int64nbands_shortwave::Int64nbands_longwave::Int64ij::Int64jring::Int64lond::Anylatd::Anyland_fraction::Anyorography::Anyu::Anyv::Anytemp::Anyhumid::Anyln_pres::Anypres::Anyu_tend::Anyv_tend::Anytemp_tend::Anyhumid_tend::Anyflux_u_upward::Anyflux_u_downward::Anyflux_v_upward::Anyflux_v_downward::Anyflux_temp_upward::Anyflux_temp_downward::Anyflux_humid_upward::Anyflux_humid_downward::Anyrandom_value::Anyboundary_layer_depth::Int64boundary_layer_drag::Anysurface_geopotential::Anysurface_u::Anysurface_v::Anysurface_temp::Anysurface_humid::Anysurface_wind_speed::Anyskin_temperature_sea::Anyskin_temperature_land::Anysoil_moisture_availability::Anysurface_humidity_flux::Anysurface_humidity_flux_ocean::Anysurface_humidity_flux_land::Anysensible_heat_flux::Anysensible_heat_flux_ocean::Anysensible_heat_flux_land::Anysurface_air_density::Anysat_humid::Anydry_static_energy::Anytemp_virt::Anygeopot::Anycloud_top::Int64rain_convection::Anyrain_large_scale::Anyrain_rate_convection::Anyrain_rate_large_scale::Anysnow_convection::Anysnow_large_scale::Anysnow_rate_convection::Anysnow_rate_large_scale::Anycos_zenith::Anyalbedo_ocean::Anyalbedo_land::Anysurface_shortwave_down::Anysurface_longwave_down::Anysurface_shortwave_up::Anysurface_shortwave_up_ocean::Anysurface_shortwave_up_land::Anysurface_longwave_up::Anysurface_longwave_up_ocean::Anysurface_longwave_up_land::Anyoutgoing_longwave_radiation::Anyoutgoing_shortwave_radiation::Anyoptical_depth_shortwave::Anyoptical_depth_longwave::Anya::Anyb::Anyc::Anyd::Any
SpeedyWeather.ConstantOceanClimatology — TypeConstant ocean climatology that reads monthly sea surface temperature fields from file, and interpolates them only for the initial conditions in time to be stored in the prognostic variables. It is therefore an ocean from climatology but without a seasonal cycle that is constant in time. To be created like
ocean = SeasonalOceanClimatology(spectral_grid)and the ocean time is set with initialize!(model, time=time). Fields and options are
path::String: [OPTION] path to the folder containing the land-sea mask file, pkg path defaultfile::String: [OPTION] filename of sea surface temperaturesvarname::String: [OPTION] Variable name in netcdf filefile_Grid::Type{<:AbstractGrid}: [OPTION] Grid the sea surface temperature file comes onmissing_value::Float64: [OPTION] The missing value in the data respresenting land
SpeedyWeather.ConvectiveHeating — TypeConvective heating as defined by Lee and Kim, 2003, JAS implemented as convection parameterization. Fields are
nlat::Int64time_scale::Second: [OPTION] Qmax heating strength as 1K/timescalep₀::Any: [OPTION] Pressure of maximum heating [hPa]σₚ::Any: [OPTION] Vertical extent of heating [hPa]θ₀::Any: [OPTION] Latitude of heating [˚N]σθ::Any: [OPTION] Latitudinal width of heating [˚]lat_mask::Vector
SpeedyWeather.ConvectiveRainOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Anyrate::Any
SpeedyWeather.ConvectiveRainRateOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Any
SpeedyWeather.ConvectiveSnowOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Anyrate::Any
SpeedyWeather.ConvectiveSnowRateOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Any
SpeedyWeather.DiagnosticVariables — TypeAll diagnostic variables.
spectrum::Any: Spectral resolution: Max degree of spherical harmonicsgrid_used::Any: Grid resolution: Number of latitude rings on one hemisphere (Equator incl.)nlayers::Int64: Number of vertical layersnparticles::Int64: Number of particles for particle advectiontendencies::Tendencies: Tendencies (spectral and grid) of the prognostic variablesgrid::GridVariables: Gridded prognostic variablesdynamics::DynamicsVariables: Intermediate variables for the dynamical corephysics::PhysicsVariables: Global fields returned from physics parameterizationsparticles::ParticleVariables: Intermediate variables for the particle advectioncolumn::ColumnVariables: Vertical column for the physics parameterizationstemp_average::Any: Average temperature of every horizontal layer [K]scale::Base.RefValue: Scale applied to vorticity and divergence
SpeedyWeather.DiagnosticVariables — MethodDiagnosticVariables(
SG::SpectralGrid;
spectral_transform,
nbands_shortwave,
nbands_longwave
)
Generator function. If a transform is handed over, the same scratch memory is used.
SpeedyWeather.DivergenceOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64unscale::Bool
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
time_scale::Second: [OPTION] Relaxation time for profile adjustmentsurface_temp::Any: [OPTION] Surface perturbation of temp to calculate the dry adiabat
SpeedyWeather.DynamicsVariables — TypeIntermediate quantities for the dynamics of a given layer.
spectrum::Anygrid::Anynlayers::Int64a::Any: Multi-purpose a, 3D work array to be reused in various placesb::Any: Multi-purpose b, 3D work array to be reused in various placesa_grid::Any: Multi-purpose a, 3D work array to be reused in various placesb_grid::Any: Multi-purpose b, 3D work array to be reused in various placesa_2D::Any: Multi-purpose a, work array to be reused in various placesb_2D::Any: Multi-purpose b, work array to be reused in various placesa_2D_grid::Any: Multi-purpose a, work array to be reused in various placesb_2D_grid::Any: Multi-purpose b, work array to be reused in various placesuv∇lnp::Any: Pressure flux (uₖ, vₖ)⋅∇ln(pₛ)uv∇lnp_sum_above::Any: Sum of Δσₖ-weighted uv∇lnp abovediv_sum_above::Any: Sum of div_weighted from top to ktemp_virt::Any: Virtual temperature [K], spectral for geopotentialgeopot::Any: Geopotential [m²/s²] on full layersσ_tend::Any: Vertical velocity (dσ/dt), on half levels k+1/2 below, pointing to the surface (σ=1)∇lnp_x::Any: Zonal gradient of log surf pressure∇lnp_y::Any: Meridional gradient of log surf pressureu_mean_grid::Any: Vertical average of zonal velocity [m/s]v_mean_grid::Any: Vertical average of meridional velocity [m/s]div_mean_grid::Any: Vertical average of divergence [1/s], griddiv_mean::Any: Vertical average of divergence [1/s], spectralscratch_memory::Any: Scratch memory for the transforms
SpeedyWeather.DynamicsVariables — MethodDynamicsVariables(SG::SpectralGrid; spectral_transform)
Generator function. If a spectral_transform is handed over, the same scratch memory is used.
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
radius::AbstractFloat: Earth's radius [m]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]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.EarthLandSeaMask — 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{<:AbstractGrid}: Grid the land-sea mask file comes onquantization::Float64: [OPTION] Quantization to fraction?mask::Any: Land-sea mask [1] on grid-point space. Land=1, sea=0, land-area fraction in between.
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{<:AbstractGrid}: Grid the orography file comes onscale::Any: scale orography by a factorsmoothing::Bool: smooth the orography field?smoothing_power::Any: power of Laplacian for smoothingsmoothing_strength::Any: highest degree l is multiplied bysmoothing_fraction::Any: fraction of highest wavenumbers to smoothorography::Any: height [m] on grid-point space.geopot_surf::Any: surface geopotential, height*gravity [m²/s²]
SpeedyWeather.Feedback — TypeFeedback struct that contains options and object for command-line feedback like the progress meter.
verbose::Bool: [OPTION] print feedback to REPL?, default is isinteractive(), true in interactive REPL modedebug::Bool: [OPTION] check for NaNs in the prognostic variablesdescription::String: [OPTION] Progress descriptionshowspeed::Bool: [OPTION] show speed in progress meter?progress_meter::ProgressMeter.Progress: [DERIVED] struct containing everything progress relatednans_detected::Bool: [DERIVED] did NaNs occur in the simulation?
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 resolutionnlat_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)nlat::Int64: number of latitude ringsnlayers::Int64: number of vertical levelsnpoints::Int64: total number of horizontal grid pointsradius::Base.RefValue: Planet's radius [m], set from model.planet during initialize!lond::Any: array of longitudes in degrees (0...360˚), empty for non-full gridslatd::Any: array of latitudes in degrees (90˚...-90˚)lat::Any: array of latitudes in radians (π...-π)colat::Any: array of colatitudes in radians (0...π)londs::Any: longitude (0˚...360˚) for each grid point in ring orderlatds::Any: latitude (-90˚...˚90) for each grid point in ring orderlons::Any: longitude (0...2π) for each grid point in ring orderlats::Any: latitude (-π/2...π/2) for each grid point in ring ordersinlat::Any: sin of latitudescoslat::Any: cos of latitudescoslat⁻¹::Any: = 1/cos(lat)coslat²::Any: = cos²(lat)coslat⁻²::Any: # = 1/cos²(lat)σ_levels_half::Any: σ at half levels, σ_k+1/2σ_levels_full::Any: σ at full levels, σₖσ_levels_thick::Any: σ level thicknesses, σₖ₊₁ - σₖln_σ_levels_full::Any: log of σ at full levels, include surface (σ=1) as last elementfull_to_half_interpolation::Any: Full to half levels interpolation
SpeedyWeather.Geometry — MethodGeometry(
SG::SpectralGrid;
vertical_coordinates
) -> Geometry{var"#s107", _A, <:AbstractVector} where {var"#s107"<:AbstractFloat, _A}
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::Int64temp::Vector
SpeedyWeather.GridVariables — TypeTransformed prognostic variables (and u, v, temp_virt) into grid-point space.
grid::Anynlayers::Int64vor_grid::Any: Relative vorticity of the horizontal wind [1/s]div_grid::Any: Divergence of the horizontal wind [1/s]temp_grid::Any: Absolute temperature [K]temp_virt_grid::Any: Virtual temperature [K]humid_grid::Any: Specific_humidity [kg/kg]u_grid::Any: Zonal velocity [m/s]v_grid::Any: Meridional velocity [m/s]pres_grid::Any: Logarithm of surface pressure [Pa]tracers_grid::Dict{Symbol}: Tracers [?]random_pattern::Any: Random pattern controlled by random process [1]temp_grid_prev::Any: Absolute temperature [K] at previous time stephumid_grid_prev::Any: Specific humidity [kg/kg] at previous time stepu_grid_prev::Any: Zonal velocity [m/s] at previous time stepv_grid_prev::Any: Meridional velocity [m/s] at previous time steppres_grid_prev::Any: Logarithm of surface pressure [Pa] at previous time steptracers_grid_prev::Dict{Symbol}: Tracers [?] at previous time step
.
SpeedyWeather.GridVariables — MethodGridVariables(
SG::SpectralGrid
) -> GridVariables{var"#s107", var"#s108", _A, <:AbstractArray, <:AbstractArray} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A}
Generator function.
SpeedyWeather.HeldSuarez — TypeTemperature relaxation from Held and Suarez, 1996 BAMS
nlat::Int64: number of latitude ringsnlayers::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<:AbstractFloatp₀::Base.RefValue{NF} where NF<:AbstractFloattemp_relax_freq::Matrix{NF} where NF<:AbstractFloattemp_equil_a::Vector{NF} where NF<:AbstractFloattemp_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.HumidityOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.HyperDiffusion — TypeHorizontal hyper diffusion of vor, div, temp, humid; implicitly in spectral space with a power of the Laplacian (default = 4) and the strength controlled by time_scale (default = 1 hour). For vorticity and divergence, by default, the time_scale (=1/strength of diffusion) is reduced with increasing resolution through resolution_scaling and the power is linearly decreased in the vertical above the tapering_σ sigma level to power_stratosphere (default 2).
For the BarotropicModel and ShallowWaterModel no tapering or scaling is applied. Fields and options are
trunc::Int64: spectral resolutionnlayers::Int64: number of vertical levelspower::Any: [OPTION] power of Laplaciantime_scale::Second: [OPTION] diffusion time scaletime_scale_div::Second: [OPTION] diffusion time scale for temperature and humidityresolution_scaling::Any: [OPTION] stronger diffusion with resolution? 0: constant with trunc, 1: (inverse) linear with trunc, etcpower_stratosphere::Any: [OPTION] different power for tropopause/stratospheretapering_σ::Any: [OPTION] linearly scale towards power_stratosphere above this σexpl::Anyimpl::Anyexpl_div::Anyimpl_div::Any
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 with implicit time stepping.
relative_humidity_threshold::AbstractFloat: [OPTION] Relative humidity threshold [1 = 100%] to trigger condensationreevaporation::AbstractFloat: [OPTION] Reevaporation efficiency [1/(kg/kg)], 0 for no reevaporationsnow::Bool: [OPTION] Convert rain below freezing to snow?freezing_threshold::AbstractFloat: [OPTION] Freezing temperature for snow fall [K]melting_threshold::AbstractFloat: [OPTION] Melting temperature for snow fall [K]time_scale::AbstractFloat: [OPTION] Time scale in multiples of time step Δt, the larger the less immediate
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 resolutionnlayers::Int64: Number of vertical layersα::Any: Time-step coefficient: 0=explicit, 0.5=centred implicit, 1=backward implicitreinitialize::Bool: Reinitialize at restart when initialized=trueinitialized::Bool: Flag automatically set to true when initialize! has been calledtemp_profile::Any: vertical temperature profile, obtained from diagn on first time stepξ::Base.RefValue: time step 2α*Δt packed in RefValue for mutabilityR::Any: divergence: operator for the geopotential calculationU::Any: divergence: the -RdTₖ∇² term excl the eigenvalues from ∇² for divergenceL::Any: temperature: operator for the TₖD + κTₖDlnps/Dt termW::Any: pressure: vertical averaging of the -D̄ term in the log surface pres equationL0::Any: components to construct L, 1/ 2ΔσL1::Any: vert advection term in the temperature equation (below+above)L2::Any: factor in front of the divsumabove termL3::Any: sumabove operator itselfL4::Any: factor in front of div term in Dlnps/DtS::Any: for every l the matrix to be invertedS⁻¹::Any: combined inverted operator: S = 1 - ξ²(RL + UW)
SpeedyWeather.ImplicitPrimitiveEquation — MethodImplicitPrimitiveEquation(
spectral_grid::SpectralGrid;
kwargs...
) -> ImplicitPrimitiveEquation{<:AbstractFloat, <:AbstractVector, <:AbstractMatrix, <:AbstractArray}
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. The implicit time step between i-1 and i+1 is controlled by the parameter α in the range [0, 1]
α = 0 means the gravity wave terms are evaluated at i-1 (forward)
α = 0.5 evaluates at i+1 and i-1 (centered implicit)
α = 1 evaluates at i+1 (backward implicit)
α ∈ [0.5, 1] are also possible which controls the strength of the gravity wave dampening.
α = 0.5 slows gravity waves and prevents them from amplifying
α > 0.5 will dampen the gravity waves within days to a few timesteps (α=1)Fields are
α::Any: [OPTION] coefficient for semi-implicit computations to filter gravity waves, 0.5 <= α <= 1time_step::Any: Time step [s], = αdt = 2αΔt (for leapfrog)
SpeedyWeather.ImplicitShallowWater — MethodImplicitShallowWater(
SG::SpectralGrid;
kwargs...
) -> ImplicitShallowWater{<:AbstractFloat}
Generator using the resolution from spectral_grid.
SpeedyWeather.InterfaceDisplacementOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.JLD2Output — TypeOutput writer for a JLD2 file that saves the PrognosticVariables and DiagnosticVariables structs directly to a JLD2 file. All internal scalings and units are still applied to these outputs. Fields are
active::Boolpath::String: [OPTION] path to output folder, run_???? will be created withinrun_prefix::String: [OPTION] Prefix for run folder where data is stored, e.g. 'run_'id::String: [OPTION] run identification, added between runprefix and runnumberrun_number::Int64: [OPTION] run identification number, automatically determined if overwrite=falserun_digits::Int64: [OPTION] run numbers digitsrun_folder::String: [DERIVED] folder name where data is stored, determined at initialize!run_path::String: [DERIVED] full path to folder where data is stored, determined at initialize!overwrite::Bool: [OPTION] Overwrite an existing run folder?filename::String: [OPTION] name of the output jld2 filewrite_restart::Bool: [OPTION] also write restart file if output=true?write_parameters_txt::Bool: [OPTION] also write parameters txt file if output=true?write_progress_txt::Bool: [OPTION] also write progress txt file if output=true?output_dt::Second: [OPTION] output frequency, time stepmerge_output::Bool: [OPTION] will reopen and resave the file to merge everything in one big vector. Turn off if the file is too large for memory.output_prognostic::Bool: [OPTION] output the PrognosticVariablesoutput_diagnostic::Bool: [OPTION] output the DiagnosticVariables as welloutput_every_n_steps::Int64timestep_counter::Int64output_counter::Int64jld2_file::Union{Nothing, JLD2.JLDFile}
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.JeevanjeeRadiation — TypeTemperature flux longwave radiation from Jeevanjee and Romps, 2018, following Seeley and Wordsworth, 2023, eq (1)
dF/dT = α*(T_t - T)with F the upward temperature flux between two layers with temperature difference dT, α = 0.025 W/m²/K² and T_t = 200K a prescribed tropopause temperature. Flux into the lowermost layer is 0. Flux out of uppermost layer also 0, but dT/dt = (T_t - T)/τ is added to relax the uppermost layer towards the tropopause temperature T_t with time scale τ = 24h (Seeley and Wordsworth, 2023 use 6h, which is unstable a low resolutions here). Fields are
α::Any: [OPTION] Radiative forcing constant (W/m²/K²)emissivity_ocean::Any: [OPTION] Effective emissivity for surface flux over ocean [1]emissivity_land::Any: [OPTION] Effective emissivity for surface flux over land [1]temp_tropopause::Any: [OPTION] Tropopause temperature [K]time_scale::Second: [OPTION] Tropopause relaxation time scale to temp_tropopause
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 ringsnlayers::Int64: Number of vertical layerslatitude::Any: jet latitude [˚N]width::Any: jet width [˚], default ≈ 19.29˚sigma::Any: sigma level [1], vertical location of jetspeed::Any: jet speed scale [m/s]time_scale::Second: time scale [days]amplitude::Any: precomputed amplitude vector [m/s²]tapering::Any: precomputed vertical tapering
SpeedyWeather.KolmogorovFlow — TypeKolmogorov flow forcing. Fields are
strength::Any: [OPTION] Strength of forcing [1/s²]wavenumber::Any: [OPTION] Wavenumber of forcing in meridional direction (pole to pole)
SpeedyWeather.LandBucketTemperature — TypeMITgcm's two-layer soil model (https://mitgcm.readthedocs.io/en/latest/phys_pkgs/land.html). Fields assert
mask::Bool: [OPTION] Apply land-sea mask to set ocean-only points?ocean_temperature::Any: [OPTION] Initial soil temperature over ocean [K]
SpeedyWeather.LandSeaMaskOutput — TypeDefines netCDF output for a specific variable, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.LargeScaleRainOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Anyrate::Any
SpeedyWeather.LargeScaleRainRateOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Any
SpeedyWeather.LargeScaleSnowOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Anyrate::Any
SpeedyWeather.LargeScaleSnowRateOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Any
SpeedyWeather.Leapfrog — TypeLeapfrog time stepping defined by the following fields
trunc::Int64: [DERIVED] Spectral resolution (max degree of spherical harmonics)nsteps::Int64: [CONST] Number of time steps stored simultaneously in prognostic variablesΔt_at_T31::Second: [OPTION] Time step in minutes for T31, scale linearly totruncadjust_with_output::Bool: [OPTION] AdjustΔt_at_T31with theoutput_dtto reachoutput_dtexactly in integer time stepsstart_with_euler::Bool: [OPTION] Start integration with (1) Euler step with dt/2, (2) Leapfrog step with dtcontinue_with_leapfrog::Bool: [OPTION] Setsfirst_step_euler=falseafter first step to continue with leapfrog after 1strun!callfirst_step_euler::Bool: [DERIVED] Use Euler on first time step? (controlled bystart_with_eulerandcontinue_with_leapfrog)robert_filter::AbstractFloat: [OPTION] Robert (1966) time filter coefficient to suppress the computational modewilliams_filter::AbstractFloat: [OPTION] Williams time filter (Amezcua 2011) coefficient for 3rd order accradius::AbstractFloat: [DERIVED] Radius of sphere [m], used for scaling, set ininitialize!toplanet.radiusΔt_millisec::Millisecond: [DERIVED] Time step Δt in milliseconds at specified resolutionΔt_sec::AbstractFloat: [DERIVED] Time step Δt [s] at specified resolutionΔt::AbstractFloat: [DERIVED] 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
nlayers::Int64σb::AbstractFloattime_scale::Seconddrag_coefs::Vector{NF} where NF<:AbstractFloat
SpeedyWeather.LinearDrag — MethodLinearDrag(SG::SpectralGrid; kwargs...) -> LinearDrag
Generator function using nlayers from SG::SpectralGrid
SpeedyWeather.ManualAlbedo — TypeManual albedo field, to be used with set! and is copied into the diagnostic variables on every time step. Defined so that parameterizations can change the albedo at every time step (e.g. snow cover) without losing the information of the original surface albedo. Fields are
albedo::Any
SpeedyWeather.MeanSeaLevelPressureOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Any
SpeedyWeather.MeridionalVelocity10mOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.MeridionalVelocityOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.Millenium — TypeMillenium <: PeriodConvenience time type representing a 1000-year period.
SpeedyWeather.NetCDFOutput — TypeNetCDFOutput(
SG::SpectralGrid;
...
) -> NetCDFOutput{Field2D, Field3D, Interpolator} where {Field2D<:(Union{Field{_A, _B, _C, <:AbstractFullGrid{Architecture}} where Architecture, Field{_A, _B, _C, Grid} where {Architecture, Grid<:AbstractFullGrid{Architecture}}} where {_A, _B, _C<:AbstractArray}), Field3D<:(Union{Field{_A, _B, _C, <:AbstractFullGrid{Architecture}} where Architecture, Field{_A, _B, _C, Grid} where {Architecture, Grid<:AbstractFullGrid{Architecture}}} where {_A, _B, _C<:AbstractArray}), Interpolator<:AnvilInterpolator}
NetCDFOutput(
SG::SpectralGrid,
Model::Type{<:AbstractModel};
output_grid,
output_NF,
output_dt,
kwargs...
) -> NetCDFOutput{Field2D, Field3D, Interpolator} where {Field2D<:(Union{Field{_A, _B, _C, <:AbstractFullGrid{Architecture}} where Architecture, Field{_A, _B, _C, Grid} where {Architecture, Grid<:AbstractFullGrid{Architecture}}} where {_A, _B, _C<:AbstractArray}), Field3D<:(Union{Field{_A, _B, _C, <:AbstractFullGrid{Architecture}} where Architecture, Field{_A, _B, _C, Grid} where {Architecture, Grid<:AbstractFullGrid{Architecture}}} where {_A, _B, _C<:AbstractArray}), Interpolator<:AnvilInterpolator}
Constructor for NetCDFOutput based on S::SpectralGrid and optionally the Model type (e.g. ShallowWater, PrimitiveWet) as second positional argument. The output grid is optionally determined by keyword arguments output_Grid (its type, full grid required), nlat_half (resolution) and output_NF (number format). By default, uses the full grid equivalent of the grid and resolution used in SpectralGrid S.
SpeedyWeather.NetCDFOutput — TypeOutput writer for a netCDF file with (re-)gridded variables. Interpolates non-rectangular grids. Fields are
active::Boolpath::String: [OPTION] path to output parent folder, run folders will be created withinrun_prefix::String: [OPTION] Prefix for run folder where data is stored, e.g. 'run_'id::String: [OPTION] run identification, added between runprefix and runnumberrun_number::Int64: [OPTION] run identification number, automatically determined if overwrite=falserun_digits::Int64: [OPTION] run numbers digitsrun_folder::String: [DERIVED] folder name where data is stored, determined at initialize!run_path::String: [DERIVED] full path to folder where data is stored, determined at initialize!overwrite::Bool: [OPTION] Overwrite an existing run folder?filename::String: [OPTION] name of the output netcdf filewrite_restart::Bool: [OPTION] also write restart file if output=true?write_parameters_txt::Bool: [OPTION] also write parameters txt file if output=true?write_progress_txt::Bool: [OPTION] also write progress txt file if output=true?startdate::DateTime: [DERIVD] start date of the simulation, used for time dimension in netcdf fileoutput_dt::Second: [OPTION] output frequency, time stepvariables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable}: [OPTION] dictionary of variables to output, e.g. u, v, vor, div, pres, temp, humidoutput_every_n_steps::Int64timestep_counter::Int64output_counter::Int64netcdf_file::Union{Nothing, NCDatasets.NCDataset}interpolator::Anyfield2D::Anyfield3D::Anyfield3Dland::Any
SpeedyWeather.NoCallback — TypeDummy callback that doesn't do anything.
SpeedyWeather.NoOrography — TypeOrography with zero height in orography and zero surface geopotential geopot_surf.
orography::Any: height [m] on grid-point space.geopot_surf::Any: surface geopotential, height*gravity [m²/s²]
SpeedyWeather.NoOutputVariable — TypeDummy output variable that doesn't do anything.
SpeedyWeather.NoSurfacePerturbation — TypeReturns the surface temperature and humidity without perturbation from the lowermost layer.
SpeedyWeather.NoSurfacePerturbation — MethodReturns the surface temperature and humidity without perturbation from the lowermost layer. Used as a functor.
SpeedyWeather.OrographyOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.ParametersTxt — TypeParametersTxt callback. Writes a parameters.txt file with all model parameters. Options are
path::String: [OPTION] Path for parameters.txt file, uses model.output.run_path if not specifiedfilename::String: [OPTION] File name for parameters.txt filewrite_only_with_output::Bool: [OPTION] Only write with model.output.active = true?
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 active field. By default, a particle is active, of number format DEFAULT_NF and at 0˚N, 0˚E, σ=0.
active::Bool: activitylon::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
schedule::Schedule: [OPTION] when to schedule particle trackingfilename::String: [OPTION] File name for netCDF filepath::String: [OPTION] Path for netCDF file, uses model.output.run_path if not specifiedcompression_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 locationsnparticles::Int64: Number of particles to tracknetcdf_file::Union{Nothing, NCDatasets.NCDataset}: The netcdf file to be written into, will be created at initializationlon::Vectorlat::Vectorσ::Vector
SpeedyWeather.ParticleVariables — TypeDiagnostic variables for the particle advection
nparticles::Int64: Number of particleslocations::Any: Work array: particle locationsu::Any: Work array: velocity uv::Any: Work array: velocity vσ_tend::Any: Work array: velocity w = dσ/dtinterpolator::Any: Interpolator to interpolate velocity fields onto particle positions
SpeedyWeather.ParticleVariables — MethodParticleVariables(
SG::SpectralGrid
) -> ParticleVariables{var"#s107", var"#s108", var"#s119", VectorNF, Interpolator} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, var"#s119"<:AbstractArray, VectorNF<:(Vector{<:AbstractFloat}), Interpolator<:(AnvilInterpolator{NF, Geometry, Locator} where {Locator, Geometry, NF})}
Generator function.
SpeedyWeather.PhysicsVariables — TypeDiagnostic variables of the physical parameterizations.
grid::Anyocean::DynamicsVariablesOceanland::DynamicsVariablesLandrain_large_scale::Any: Accumulated large-scale rain [m]rain_convection::Any: Accumulated convective rain [m]snow_large_scale::Any: Accumulated large-scale snow [m]snow_convection::Any: Accumulated convective snow [m]total_precipitation_rate::Any: Rate of total precipitation (rain+snow) [kg/m²/s]cloud_top::Any: Cloud top [m]sensible_heat_flux::Any: Sensible heat flux [W/m²], positive upsurface_humidity_flux::Any: Surface humidity flux [kg/s/m^2], positive upsurface_latent_heat_flux::Any: Surface latent heat flux [W/m²], positive upsurface_shortwave_up::Any: Surface radiation: shortwave up [W/m²]surface_shortwave_down::Any: Surface radiation: shortwave down [W/m²]surface_longwave_up::Any: Surface radiation: longwave up [W/m²]surface_longwave_down::Any: Surface radiation: longwave down [W/m²]outgoing_shortwave_radiation::Any: Outgoing shortwave radiation [W/m^2]outgoing_longwave_radiation::Any: Outgoing longwave radiation [W/m^2]albedo::Any: Albedo [1]cos_zenith::Any: Cosine of solar zenith angle [1]
SpeedyWeather.PhysicsVariables — MethodPhysicsVariables(
SG::SpectralGrid
) -> PhysicsVariables{var"#s107", var"#s108", _A, <:AbstractArray} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A}
Generator function.
SpeedyWeather.PrimitiveDryModel — TypeThe PrimitiveDryModel contains all model components (themselves structs) needed for the simulation of the primitive equations without humidity. To be constructed like
model = PrimitiveDryModel(spectral_grid; kwargs...)with spectral_grid::SpectralGrid used to initalize all non-default components passed on as keyword arguments, e.g. planet=Earth(spectral_grid). Fields, representing model components, are
spectral_grid::SpectralGridarchitecture::Anydynamics::Boolgeometry::Anyplanet::Anyatmosphere::Anycoriolis::Anygeopotential::Anyadiabatic_conversion::Anyparticle_advection::Anyinitial_conditions::Anyforcing::Anydrag::Anyrandom_process::Anytracers::Dict{Symbol, Tracer}orography::Anyland_sea_mask::Anyocean::Anysea_ice::Anyland::Anysolar_zenith::Anyalbedo::Anyphysics::Boolboundary_layer_drag::Anytemperature_relaxation::Anyvertical_diffusion::Anysurface_thermodynamics::Anysurface_wind::Anysurface_heat_flux::Anyconvection::Anyoptical_depth::Anyshortwave_radiation::Anylongwave_radiation::Anystochastic_physics::Anytime_stepping::Anyspectral_transform::Anyimplicit::Anyhorizontal_diffusion::Anyvertical_advection::Anyoutput::Anycallbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}feedback::Any
SpeedyWeather.PrimitiveWetModel — TypeThe PrimitiveWetModel contains all model components (themselves structs) needed for the simulation of the primitive equations with humidity. To be constructed like
model = PrimitiveWetModel(spectral_grid; kwargs...)with spectral_grid::SpectralGrid used to initalize all non-default components passed on as keyword arguments, e.g. planet=Earth(spectral_grid). Fields, representing model components, are
spectral_grid::SpectralGridarchitecture::Anydynamics::Boolgeometry::Anyplanet::Anyatmosphere::Anycoriolis::Anygeopotential::Anyadiabatic_conversion::Anyparticle_advection::Anyinitial_conditions::Anyforcing::Anydrag::Anyrandom_process::Anytracers::Dict{Symbol, Tracer}orography::Anyland_sea_mask::Anyocean::Anysea_ice::Anyland::Anysolar_zenith::Anyalbedo::Anyphysics::Boolclausius_clapeyron::Anyboundary_layer_drag::Anytemperature_relaxation::Anyvertical_diffusion::Anysurface_thermodynamics::Anysurface_wind::Anysurface_heat_flux::Anysurface_humidity_flux::Anylarge_scale_condensation::Anyconvection::Anyoptical_depth::Anyshortwave_radiation::Anylongwave_radiation::Anystochastic_physics::Anytime_stepping::Anyspectral_transform::Anyimplicit::Anyhorizontal_diffusion::Anyvertical_advection::Anyhole_filling::Anyoutput::Anycallbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}feedback::Any
SpeedyWeather.PrognosticVariables — MethodPrognosticVariables(
SG::SpectralGrid,
model::AbstractModel
) -> PrognosticVariables{var"#s107", var"#s108", _A, _B, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A, _B}
Generator function.
SpeedyWeather.PrognosticVariables — MethodPrognosticVariables(
SG::SpectralGrid{Architecture, SpectrumType, GridType};
nsteps
) -> PrognosticVariables{var"#s107", var"#s108", _A, _B, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A, _B}
Generator function.
SpeedyWeather.ProgressTxt — TypeProgressTxt callback. Writes a progress.txt file with time stepping progress. Options are
path::String: [OPTION] Path for progress.txt file, uses model.output.run_path if not specifiedfilename::String: [OPTION] File name for progress.txt filewrite_only_with_output::Bool: [OPTION] Only write with model.output.active = true?every_n_percent::Int64: [OPTION] Every n% of time steps write to progress.txt, default is 5%file::IOStream: [DERIVED] IOStream for progress.txt file
SpeedyWeather.RandomPatternOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.RandomVelocity — TypeStart with random velocity as initial conditions
max_speed::Float64: [OPTION] maximum speed [ms⁻¹]truncation::Int64: [OPTION] Maximum wavenumber after truncationseed::Int64: [OPTION] Random number generator seed, 0=randomly seed from Julia's GLOBAL_RNGrandom_number_generator::Random.Xoshiro: Independent random number generator for this random process
SpeedyWeather.RandomVorticity — TypeStart with random vorticity as initial conditions
power::Float64: [OPTION] Power of the spectral distribution k^poweramplitude::Float64: [OPTION] the (approximate) amplitude in [1/s], used as standard deviation of spherical harmonic coefficientsmax_wavenumber::Int64: [OPTION] Maximum wavenumberseed::Int64: [OPTION] Random number generator seed, 0=randomly seed from Julia's GLOBAL_RNGrandom_number_generator::Random.Xoshiro: Independent random number generator for this random process
SpeedyWeather.RandomWaves — TypeParameters for random initial conditions for the interface displacement η in the shallow water equations.
A::Float64lmin::Int64lmax::Int64
SpeedyWeather.RestartFile — TypeRestartFile callback. Writes a restart file as .jld2. Options are
filename::String: [OPTION] File name for restart file, should end with .jld2path::String: [OPTION] Path for restart file, uses model.output.run_path if not specifiedcompress::Bool: [OPTION] Apply lossless compression in JLD2?write_only_with_output::Bool: [OPTION] Only write with model.output.active = true?pkg_version::VersionNumber: [DERIVED] package version to track possible incompatibilities
SpeedyWeather.RiverRunoffOutput — TypeDefines netCDF output for a specific variable, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.RockyPlanetMask — TypeLand-sea mask with one = land everywhere.
mask::Any: Land-sea mask [1] on grid-point space. Land=1, sea=0, land-area fraction in between.
SpeedyWeather.RossbyHaurwitzWave — TypeRossby-Haurwitz wave initial conditions as in Williamson et al. 1992, J Computational Physics with an additional cut-off amplitude c to filter out tiny harmonics in the vorticity field. Parameters are
m::Int64ω::Float64K::Float64c::Float64
SpeedyWeather.Schedule — TypeA schedule for callbacks, to execute them periodically after a given period has passed (first timestep excluded) or on/after specific times (initial time excluded). For two consecutive time steps i, i+1, an event is scheduled at i+1 when it occurs in (i,i+1]. Similarly, a periodic schedule of period p will be executed at start+p, but p is rounded to match the multiple of the model timestep. Periodic schedules and event schedules can be combined, executing at both. A Schedule is supposed to be added into callbacks as fields
Base.@kwdef struct MyCallback
schedule::Schedule = Schedule(every=Day(1))
other_fields
endsee also initialize!(::Schedule,::Clock) and isscheduled(::Schedule,::Clock). Fields
every::Second: [OPTION] Execute every time period, first timestep excluded. Default=never.times::Vector{DateTime}: [OPTION] Events scheduled at timesschedule::BitVector: Actual schedule, true=execute this timestep, false=don'tsteps::Int64: Number of scheduled executionscounter::Int64: Count up the number of executions
SpeedyWeather.Schedule — MethodSchedule(times::DateTime...) -> Schedule
A Schedule based on DateTime arguments, For two consecutive time steps i, i+1, an event is scheduled at i+1 when it occurs in (i,i+1].
SpeedyWeather.SeaIceConcentrationOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.SeaSurfaceTemperatureOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Any
SpeedyWeather.SeasonalOceanClimatology — TypeSeasonal ocean climatology that reads monthly sea surface temperature fields from file, and interpolates them in time on every time step and writes them to the prognostic variables. Fields and options are
grid::Any: Grid used for the modelpath::String: [OPTION] Path to the folder containing the sea surface temperatures, pkg path defaultfile::String: [OPTION] Filename of sea surface temperaturesvarname::String: [OPTION] Variable name in netcdf filefile_Grid::Type{<:AbstractGrid}: [OPTION] Grid the sea surface temperature file comes onmissing_value::Any: [OPTION] The missing value in the data respresenting landmonthly_temperature::Any: Monthly sea surface temperatures [K], interpolated onto Grid
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::SpectralGridarchitecture::Anygeometry::Anyplanet::Anyatmosphere::Anycoriolis::Anyorography::Anyforcing::Anydrag::Anyparticle_advection::Anyinitial_conditions::Anyrandom_process::Anytracers::Dict{Symbol, Tracer}time_stepping::Anyspectral_transform::Anyimplicit::Anyhorizontal_diffusion::Anyoutput::Anycallbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}feedback::Any
SpeedyWeather.SigmaCoordinates — TypeSigma coordinates for the vertical coordinates, defined by their half layers. Sigma coordinates are currently hardcoded in Geometry.
nlayers::Int64σ_half::Any
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
time_scale::Second: [OPTION] Relaxation time for profile adjustmentrelative_humidity::Any: [OPTION] Relative humidity for reference profile [1]surface_temp_humid::Any: [OPTION] Surface perturbation of temp, humid to calculate the moist pseudo adiabat
SpeedyWeather.Simulation — TypeSimulation is a container struct to be used with run!(::Simulation). It contains
prognostic_variables::Any: define the current state of the modeldiagnostic_variables::Any: contain the tendencies and auxiliary arrays to compute themmodel::AbstractModel: 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::Anyequinox::DateTimelength_of_year::Secondlength_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.SoilMoistureAvailabilityOutput — TypeDefines netCDF output for a specific variable, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.SoilMoistureOutput — TypeDefines netCDF output for a specific variable, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}is_land::Boolmissing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.SoilTemperatureOutput — TypeDefines netCDF output for a specific variable, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}is_land::Boolmissing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Any
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::AbstractFloats1::AbstractFloatc1::AbstractFloats2::AbstractFloatc2::AbstractFloats3::AbstractFloatc3::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.
length_of_day::Secondlength_of_year::Secondequation_of_time::Boolseasonal_cycle::Boolsolar_declination::SpeedyWeather.SinSolarDeclination{NF} where NF<:AbstractFloattime_correction::SpeedyWeather.SolarTimeCorrectioninitial_time::Base.RefValue{DateTime}
SpeedyWeather.SolarZenithSeason — TypeSolar zenith angle varying with seasonal cycle only.
length_of_day::Secondlength_of_year::Secondseasonal_cycle::Boolsolar_declination::SpeedyWeather.SinSolarDeclination{NF} where NF<:AbstractFloatinitial_time::Base.RefValue{DateTime}
SpeedyWeather.SpectralAR1Process — TypeFirst-order auto-regressive random process (AR1) in spectral space, evolving wavenumbers with respectice time_scales and standard_deviations independently. Transformed after every time step to grid space with a clamp applied to limit extrema. For reproducability seed can be provided and an independent random_number_generator is used that is reseeded on every initialize!. Fields are:
trunc::Int64time_scale::Second: [OPTION] Time scale of the AR1 processwavenumber::Int64: [OPTION] Wavenumber of the AR1 processstandard_deviation::Any: [OPTION] Standard deviation of the AR1 processclamp::Tuple{NF, NF} where NF: [OPTION] Range to clamp values into after every transform into grid spaceseed::Int64: [OPTION] Random number generator seed, 0=randomly seed from Julia's GLOBAL_RNGrandom_number_generator::Random.Xoshiro: Independent random number generator for this random processautoregressive_factor::Base.RefValue: Precomputed auto-regressive factor [1], function of time scale and model time stepnoise_factors::Any: Precomputed noise factors [1] for every total wavenumber l
SpeedyWeather.SpectralFilter — TypeSpectral filter for horizontal diffusion. Fields are:
trunc::Int64: spectral resolutionnlayers::Int64: number of vertical levelsshift::Any: [OPTION] shift diffusion to higher (positive shift) or lower (neg) wavenumbers, relative to truncscale::Any: [OPTION] Scale-selectiveness, steepness of the sigmoid, higher is more selectivetime_scale::Second: [OPTION] diffusion time scaletime_scale_div::Second: [OPTION] stronger diffusion time scale for divergenceresolution_scaling::Any: [OPTION] resolution scaling to shorten time_scale with truncpower::Any: [OPTION] power of the tanh functionpower_div::Any: [OPTION] power of the tanh function for divergenceexpl::Anyimpl::Anyexpl_div::Anyimpl_div::Any
SpeedyWeather.SpectralFilter — MethodSpectralFilter(
spectral_grid::SpectralGrid;
kwargs...
) -> SpectralFilter{<:AbstractFloat}
Generator function based on the resolutin in spectral_grid. Passes on keyword arguments.
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 modelarchitecture::Any: [OPTION] device architecture to run onArrayType::Type{<:AbstractArray}: [OPTION] array type to use for all variablesVectorType::Type{<:AbstractVector}: [DERIVED] Type of vectorMatrixType::Type{<:AbstractMatrix}: [DERIVED] Type of matrixTensorType::Type{<:AbstractArray}: [DERIVED] Type of 3D arraytrunc::Int64: [OPTION] horizontal resolution as the maximum degree of spherical harmonicsspectrum::Any: [DERIVED] spectral spaceSpectralVariable2D::Type{<:AbstractArray}: [DERIVED] Type of spectral variable in 2D (horizontal only, flattened into 1D vector)SpectralVariable3D::Type{<:AbstractArray}: [DERIVED] Type of spectral variable in 3D (horizontal only + e.g vertical, flattened into 2D matrix)SpectralVariable4D::Type{<:AbstractArray}: [DERIVED] Type of spectral variable in 4D (horizontal only + e.g. vertical and time, flattened into 3D array)dealiasing::Float64: [OPTION] how to match spectral with grid resolution: dealiasing factor, 1=linear, 2=quadratic, 3=cubic gridnlat_half::Int64: [DERIVED] number of latitude rings on one hemisphere (Equator incl)nlat::Int64: [DERIVED] number of latitude rings on both hemispheresnpoints::Int64: [DERIVED] total number of grid points in the horizontalgrid::Any: [DERIVED] instance of horizontal grid used for calculations in grid-point spaceGrid::Type{<:AbstractGrid}: [OPTION] type of horizontal grid used for calculations in grid-point spaceGridVariable2D::Type{<:AbstractArray}: [DERIVED] Type of grid variable in 2D (horizontal only, flattened into 1D vector)GridVariable3D::Type{<:AbstractArray}: [DERIVED] Type of grid variable in 3D (horizontal + e.g. vertical, flattened into 2D matrix)GridVariable4D::Type{<:AbstractArray}: [DERIVED] Type of grid variable in 4D (horizontal + e.g. vertical + time, flattened into 3D array)nparticles::Int64: [OPTION] number of particles for particle advection [1]ParticleVector::Type{<:AbstractArray}: [DERIVED] ArrayType of particle vectornlayers::Int64: [OPTION] number of vertical layers in the atmospherenlayers_soil::Int64: [OPTION] number of vertical layers in the soil/land
nlat_half and npoints should not be chosen but are derived from trunc, Grid and dealiasing.
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 filerun_prefix::String: run prefix, e.g. 'run' in 'run_0001/restart.jld2'id::String: identification of run folder, e.g. 'set1' in 'runset10001/restart.jld2'run_number::Int64: run number, e.g. 1 in 'runset10001/restart.jld2'run_digits::Int64: run digits, e.g. 4 in 'runset10001/restart.jld2' for run_number=1run_folder::String: directly specify the run folder, e.q. 'run_0001'filename::String: File name of restart file, default 'restart.jld2'
SpeedyWeather.SurfaceHumidityFluxOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.SurfaceLatentHeatFluxOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.SurfacePressureOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Any
SpeedyWeather.SurfaceSensibleHeatFluxOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.SurfaceTemperatureOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Any
SpeedyWeather.TemperatureOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Any
SpeedyWeather.Tendencies — TypeTendencies of the prognostic variables in spectral and grid-point space
spectrum::Anygrid::Anynlayers::Int64vor_tend::Any: Vorticity of horizontal wind field [1/s]div_tend::Any: Divergence of horizontal wind field [1/s]temp_tend::Any: Absolute temperature [K]humid_tend::Any: Specific humidity [kg/kg]u_tend::Any: Zonal velocity [m/s]v_tend::Any: Meridional velocity [m/s]pres_tend::Any: Logarithm of surface pressure [Pa]tracers_tend::Dict{Symbol}: Tracers [?]u_tend_grid::Any: Zonal velocity [m/s], gridv_tend_grid::Any: Meridinoal velocity [m/s], gridtemp_tend_grid::Any: Absolute temperature [K], gridhumid_tend_grid::Any: Specific humidity [kg/kg], gridpres_tend_grid::Any: Logarith of surface pressure [Pa], gridtracers_tend_grid::Dict{Symbol}: Tracers [?], grid
SpeedyWeather.Tendencies — MethodTendencies(
SG::SpectralGrid
) -> Tendencies{var"#s107", var"#s108", _A, _B, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A, _B}
Generator function.
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.TotalPrecipitationOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64transform::Any
SpeedyWeather.Tracer — TypeDefine tracer through a name::Symbol (used as key in the tracer dictionaries) and define it as active (=true default). active=false will (temporarily) disable the time evolution of the tracer. Fields are
name::Symbolactive::Bool
SpeedyWeather.UniformCooling — TypeUniform cooling following Paulius and Garner, 2006. JAS. https://doi.org/10.1175/JAS3705.1 imposing a default temperature tendency of -1.5K/day (=1K/16hours for a time_scale of 16 hours) on every level except for the stratosphere (diagnosed as temp < temp_min) where a relaxation term with time_scale_stratosphere towards temp_stratosphere is applied.
dT/dt = -1.5K/day for T > 207.5K else (200K-T) / 5 daysFields are
time_scale::Second: [OPTION] time scale of cooling, default = -1.5K/day = -1K/16hrstemp_min::Any: [OPTION] temperature [K] below which stratospheric relaxation is appliedtemp_stratosphere::Any: [OPTION] target temperature [K] of stratospheric relaxationtime_scale_stratosphere::Second: [OPTION] time scale of stratospheric relaxation
SpeedyWeather.VorticityOutput — TypeDefines netCDF output of vorticity. Fields are
name::String: [Required] short name of variable (unique) used in netCDF file and key for dictionaryunit::String: [Required] unit of variablelong_name::String: [Required] long name of variable used in netCDF filedims_xyzt::NTuple{4, Bool}: [Required] NetCDF dimensions the variable uses, lon, lat, layer, timemissing_value::Float64: [Optional] missing value for the variable, if not specified uses NaNcompression_level::Int64: [Optional] compression level of the lossless compressor, 1=lowest/fastest, 9=highest/slowest, 3=defaultshuffle::Bool: [Optional] bitshuffle the data for compression, false = defaultkeepbits::Int64: [Optional] number of mantissa bits to keep for compression (default: 15)unscale::Bool: [Optional] Unscale the variable for output? (default: true)
Custom variable output defined similarly with required fields marked, optional fields otherwise use variable-independent defaults. Initialize with VorticityOutput() and non-default fields can always be passed on as keyword arguments, e.g. VorticityOutput(long_name="relative vorticity", compression_level=0). Custom variable output also requires the path(::MyOutputVariable, simulation) to be extended to return the AbstractField subject to output. Custom element-wise variable transforms, e.g. scale and/or offset to change units, or even exp(x)/100 to change from log surface pressure to hPa are passed on as transform::Function = x -> exp(x)/100.
SpeedyWeather.ZonalJet — TypeA struct that contains all parameters for the Galewsky et al, 2004 zonal jet intitial conditions for the ShallowWaterModel. Default values as in Galewsky.
latitude::Float64: jet latitude [˚N]width::Float64: jet width [˚], default ≈ 19.29˚umax::Float64: jet maximum velocity [m/s]perturb_lat::Float64: perturbation latitude [˚N], position in jet by 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.
η₀::Any: conversion from σ to Jablonowski's ηᵥ-coordinatesu₀::Any: max amplitude of zonal wind [m/s] that scales orography heightorography::Any: height [m] on grid-point space.geopot_surf::Any: surface geopotential, height*gravity [m²/s²]
SpeedyWeather.ZonalVelocity10mOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
SpeedyWeather.ZonalVelocityOutput — TypeDefines netCDF output for a specific variables, see VorticityOutput for details. Fields are:
name::Stringunit::Stringlong_name::Stringdims_xyzt::NTuple{4, Bool}missing_value::Float64compression_level::Int64shuffle::Boolkeepbits::Int64
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: [OPTION] max amplitude of zonal wind [m/s]perturb_lat::Float64: [OPTION] perturbation centred at [˚N]perturb_lon::Float64: [OPTION] perturbation centred at [˚E]perturb_uₚ::Float64: [OPTION] perturbation strength [m/s]perturb_radius::Float64: [OPTION] 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.
Base.delete! — Methoddelete!(
output::NetCDFOutput,
keys::Union{String, Symbol}...
) -> NetCDFOutput
Delete output variables from output by their (short name) (Symbol or String), corresponding to the keys in the dictionary.
Base.delete! — Methoddelete!(progn::PrognosticVariables, tracers::Tracer...)
Delete tracers in the prognostic variables progn in progn.tracers::Dict.
Base.delete! — Methoddelete!(
simulation::SpeedyWeather.AbstractSimulation,
tracer::Tracer
) -> Any
Delete a tracer from a simulation, deleted from the model and the variables.
Base.fill! — Methodfill!(
tendencies::Tendencies,
x,
_::Type{<:Barotropic}
) -> Tendencies
Set the tendencies for the barotropic model to x.
Base.fill! — Methodfill!(
tendencies::Tendencies,
x,
_::Type{<:PrimitiveDry}
) -> Tendencies
Set the tendencies for the primitive dry model to x.
Base.fill! — Methodfill!(
tendencies::Tendencies,
x,
_::Type{<:PrimitiveWet}
) -> Tendencies
Set the tendencies for the primitive wet model to x.
Base.fill! — Methodfill!(
tendencies::Tendencies,
x,
_::Type{<:ShallowWater}
) -> Tendencies
Set the tendencies for the shallow-water model to x.
Base.mod — Methodmod(p::Particle) -> Particle
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].
SpeedyTransforms.transform! — Methodtransform!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
model::Barotropic;
kwargs...
)
Propagate the spectral state of the prognostic variables progn to the diagnostic variables in diagn for the barotropic vorticity model. Updates grid vorticity, spectral stream function and spectral and grid velocities u, v.
SpeedyTransforms.transform! — Methodtransform!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
random_process::Nothing,
spectral_transform::SpectralTransform
)
random_process=nothing does not need to transform any random pattern from spectral to grid space.
SpeedyTransforms.transform! — Methodtransform!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
model::PrimitiveEquation;
initialize
)
Propagate the spectral state of the prognostic variables progn to the diagnostic variables in diagn for primitive equation models. Updates grid vorticity, grid divergence, grid temperature, pressure (pres_grid) and the velocities u, v.
SpeedyTransforms.transform! — Methodtransform!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
model::ShallowWater;
kwargs...
)
Propagate the spectral state of the prognostic variables progn to the diagnostic variables in diagn for the shallow water model. Updates grid vorticity, grid divergence, grid interface displacement (pres_grid) and the velocities u, v.
SpeedyTransforms.transform! — Methodtransform!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
random_process::SpeedyWeather.AbstractRandomProcess,
spectral_transform::SpectralTransform
) -> Union{Nothing, AbstractArray}
General transform for random processes <: AbstractRandomProcess. Takes the spectral random_pattern in the prognostic variables and transforms it to spectral space in diagn.grid.random_pattern.
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.WhichZenith — MethodWhichZenith(
SG::SpectralGrid,
P::SpeedyWeather.AbstractPlanet;
kwargs...
) -> Union{SolarZenith, SolarZenithSeason}
Chooses from SolarZenith (daily and seasonal cycle) or SolarZenithSeason given the parameters in model.planet. In both cases the seasonal cycle can be disabled, calculating the solar declination from the initial time instead of current time.
SpeedyWeather.activate! — Methodactivate!(
simulation::SpeedyWeather.AbstractSimulation,
tracers::Tracer...
)
Activate a deactivated (=frozen) tracers in a simulation, which is a setting in simulation.model only.
SpeedyWeather.activate — Methodactivate(p::Particle{NF}) -> Particle
Activate particle. Active particles can move.
SpeedyWeather.add! — Methodadd!(
model::AbstractModel,
key_callbacks::Pair{Symbol, <:SpeedyWeather.AbstractCallback}...
) -> Any
Add a or several callbacks to a model::AbstractModel. To be used like
add!(model, :my_callback => callback)
add!(model, :my_callback1 => callback, :my_callback2 => other_callback)SpeedyWeather.add! — Methodadd!(
model::AbstractModel,
callbacks::SpeedyWeather.AbstractCallback...
)
Add a or several callbacks to a mdoel without specifying the key which is randomly created like callback_????. To be used like
add!(model.callbacks, callback)
add!(model.callbacks, callback1, callback2).SpeedyWeather.add! — Methodadd!(
model::AbstractModel,
outputvariables::SpeedyWeather.AbstractOutputVariable...
) -> Any
Add outputvariables to the dictionary in output::NetCDFOutput of model, i.e. at model.output.variables.
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...;
verbose
)
Add a or several callbacks to a Dict{Symbol, AbstractCallback} dictionary without specifying the key which is randomly created like callback_????. To be used like
add!(model.callbacks, callback)
add!(model.callbacks, callback1, callback2).SpeedyWeather.add! — Methodadd!(
D::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
outputvariables::SpeedyWeather.AbstractOutputVariable...
) -> Dict{Symbol, SpeedyWeather.AbstractOutputVariable}
Add outputvariables to a dictionary defining the variables subject to NetCDF output.
SpeedyWeather.add! — Methodadd!(
output::NetCDFOutput,
outputvariables::SpeedyWeather.AbstractOutputVariable...
) -> NetCDFOutput
Add outputvariables to the dictionary in output::NetCDFOutput, i.e. at output.variables.
SpeedyWeather.add! — Methodadd!(
progn::PrognosticVariables{NF, ArrayType, SpectrumType, GridType, SpectralVariable2D, SpectralVariable3D, SpectralVariable4D},
tracers::Tracer...
)
Add tracers to the prognostic variables progn in progn.tracers::Dict.
SpeedyWeather.add_default! — Methodadd_default!(
output_variables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
Model::Type{<:Barotropic}
) -> Dict{Symbol, SpeedyWeather.AbstractOutputVariable}
Add default variables to output for a Barotropic model: Vorticity, zonal and meridional velocity.
SpeedyWeather.add_default! — Methodadd_default!(
variables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
Model::Type{<:PrimitiveDry}
) -> Dict{Symbol, SpeedyWeather.AbstractOutputVariable}
Add default variables to output for a PrimitiveDry model, same as for a Barotropic model but also the surface pressure and temperature.
SpeedyWeather.add_default! — Methodadd_default!(
variables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
Model::Type{<:PrimitiveWet}
) -> Dict{Symbol, SpeedyWeather.AbstractOutputVariable}
Add default variables to output for a PrimitiveWet model, same as for a PrimitiveDry model but also the specific humidity.
SpeedyWeather.add_default! — Methodadd_default!(
variables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
Model::Type{<:ShallowWater}
) -> Dict{Symbol, SpeedyWeather.AbstractOutputVariable}
Add default variables to output for a ShallowWater model, same as for a Barotropic model but also the interface displacement.
SpeedyWeather.bernoulli_potential! — Methodbernoulli_potential!(
diagn::DiagnosticVariables,
S::SpectralTransform
)
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.bulk_richardson! — Methodbulk_richardson!(
column::ColumnVariables,
atmosphere::SpeedyWeather.AbstractAtmosphere
) -> Any
Calculate the bulk richardson number following Frierson, 2007. For vertical stability in the boundary layer.
SpeedyWeather.bulk_richardson_surface — Methodbulk_richardson_surface(
column::ColumnVariables,
atmosphere::SpeedyWeather.AbstractAtmosphere
) -> Any
Calculate the bulk richardson number following Frierson, 2007. For vertical stability in the boundary layer.
SpeedyWeather.callback! — Methodcallback!(
callback::GlobalSurfaceTemperatureCallback,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
) -> Any
Pulls the average temperature from the lowermost layer and stores it in the next element of the callback.temp vector.
SpeedyWeather.callback! — Methodcallback!(progress_txt::ProgressTxt, progn, diagn, model)
Writes the time stepping progress to the progress.txt file every every_n_percent % of time steps.
SpeedyWeather.convection! — Methodconvection!(
column::ColumnVariables{NF},
DBM::DryBettsMiller,
geometry::Geometry,
atmosphere::SpeedyWeather.AbstractAtmosphere,
model::PrimitiveEquation
)
calculates temperature tendency for the dry convection scheme following the simplified Betts-Miller convection from Frierson 2007 but with zero humidity. Starts with a first-guess relaxation to determine the convective criterion, then adjusts the reference profiles for thermodynamic consistency (e.g. in dry convection the humidity profile is non-precipitating), and relaxes current vertical profiles to the adjusted references.
SpeedyWeather.convection! — Methodconvection!(
column::ColumnVariables{NF},
SBM::SimplifiedBettsMiller,
clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron,
geometry::Geometry,
planet::SpeedyWeather.AbstractPlanet,
atmosphere::SpeedyWeather.AbstractAtmosphere,
time_stepping::SpeedyWeather.AbstractTimeStepper,
model::PrimitiveWet
)
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!(f::AbstractField; rotation) -> AbstractField
Return the Coriolis parameter f on the grid Grid of resolution nlat_half on a planet of rotation [1/s]. Default rotation of Earth.
SpeedyWeather.coriolis — Methodcoriolis(field::AbstractField; kwargs...) -> AbstractField
Return the Coriolis parameter f on the same grid as field on a planet of kwarg rotation [1/s]. Default rotation of Earth.
SpeedyWeather.cos_zenith! — Methodcos_zenith!(
cos_zenith::AbstractField,
S::SolarZenith,
time::DateTime,
geometry::SpeedyWeather.AbstractGeometry
)
Calculate cos of solar zenith angle with a daily cycle at time time. Seasonal cycle or time correction may be disabled, depending on parameters in SolarZenith.
SpeedyWeather.cos_zenith! — Methodcos_zenith!(
cos_zenith::AbstractField,
S::SolarZenithSeason,
time::DateTime,
geometry::SpeedyWeather.AbstractGeometry
)
Calculate cos of solar zenith angle as daily average at time time. Seasonal cycle or time correction may be disabled, depending on parameters in SolarZenithSeason.
SpeedyWeather.create_run_folder! — Methodcreate_run_folder!(
output::SpeedyWeather.AbstractOutput
) -> String
Creates a new folder prefix_id_number with the identification id. Also returns the full path run_path of that folder.
SpeedyWeather.deactivate! — Methoddeactivate!(
simulation::SpeedyWeather.AbstractSimulation,
tracers::Tracer...
)
Deactivate a tracer in a simulation, which is a setting in simulation.model only.
SpeedyWeather.deactivate — Methoddeactivate(p::Particle{NF}) -> Particle
Deactivate particle. Inactive particles cannot move.
SpeedyWeather.default_sigma_coordinates — Methoddefault_sigma_coordinates(
nlayers::Integer
) -> Vector{T} where T<:Union{Float16, Float32, Float64}
Vertical sigma coordinates defined by their nlayers+1 half levels σ_levels_half. Sigma coordinates are fraction of surface pressure (p/p0) and are sorted from top (stratosphere) to bottom (surface). The first half level is at 0 the last at 1. Default levels are equally spaced from 0 to 1 (including).
SpeedyWeather.determine_run_folder! — Methoddetermine_run_folder!(
output::SpeedyWeather.AbstractOutput
) -> String
Checks existing folders in path and determine run_numberby counting up. E.g. if folder run0001 exists then runnumber is 2. Does not create a folder for the returned run id.
SpeedyWeather.drag! — Methoddrag!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
drag::LinearVorticityDrag,
lf::Integer,
model::AbstractModel
)
Linear drag for the vorticity equations of the form F = -cξ with c drag coefficient [1/s].
SpeedyWeather.drag! — Methoddrag!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
drag::QuadraticDrag,
lf::Integer,
model::AbstractModel
)
Quadratic drag for the momentum equations.
F = -c_D/H*|(u, v)|*(u, v)with c_D the non-dimensional drag coefficient as defined in drag::QuadraticDrag. c_D and layer thickness H are precomputed in initialize!(::QuadraticDrag, ::AbstractModel) and scaled by the radius as are the momentum equations.
SpeedyWeather.dry_adiabat! — Methoddry_adiabat!(
temp_ref_profile::AbstractVector,
temp_environment::AbstractVector,
temp_parcel::Real,
σ::AbstractVector,
atmosphere::SpeedyWeather.AbstractAtmosphere
) -> Int64
Calculates the moist pseudo adiabat given temperature and humidity of surface parcel. Follows the dry adiabat till condensation and then continues on the pseudo moist-adiabat with immediate condensation to the level of zero buoyancy. Levels above are skipped, set to NaN instead and should be skipped in the relaxation.
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! — Methoddynamics_tendencies!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
model::Barotropic
)
Calculate all tendencies for the BarotropicModel.
SpeedyWeather.dynamics_tendencies! — Methoddynamics_tendencies!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
model::PrimitiveEquation
)
Calculate all tendencies for the PrimitiveEquation model (wet or dry).
SpeedyWeather.dynamics_tendencies! — Methoddynamics_tendencies!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
model::ShallowWater
)
Calculate all tendencies for the ShallowWaterModel.
SpeedyWeather.finalize! — Methodfinalize!(F::Feedback)
Finalises the progress meter and the progress txt file.
SpeedyWeather.finalize! — Methodfinalize!(progress_txt::ProgressTxt, progn, diagn, model)
Finalizes the ProgressTxt callback by writing the total time taken to the progress.txt file and closing it.
SpeedyWeather.finalize! — Methodfinalize!(
restart::RestartFile,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
) -> Any
A restart file restart.jld2 with the prognostic variables is written to the output folder (or current path) that can be used to restart the model. restart.jld2 will then be used as initial conditions. Variables in restart file are not scaled.
SpeedyWeather.finalize! — Methodfinalize!(
simulation::SpeedyWeather.AbstractSimulation
) -> Any
Finalize a simulation. Finishes the progress meter, unscales variables, finalizes the output, writes a restart file and finalizes callbacks.
SpeedyWeather.first_timesteps! — Methodfirst_timesteps!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
Performs the first two initial time steps (Euler forward, unfiltered leapfrog) to populate the prognostic variables with two time steps (t=0, Δt) that can then be used in the normal leap frogging.
SpeedyWeather.first_timesteps! — Methodfirst_timesteps!(
simulation::SpeedyWeather.AbstractSimulation
)
First 1 or 2 time steps of simulation. If model.time_stepping.start_with_euler is true, then start with one Euler step with dt/2, followed by one Leapfrog step with dt. If false, continue with leapfrog steps at 2Δt (e.g. restart).
SpeedyWeather.flux_divergence! — Methodflux_divergence!(
A_tend::LowerTriangularArray,
A_grid::AbstractField,
diagn::DiagnosticVariables,
G::Geometry,
S::SpectralTransform;
add,
flipsign
)
Computes ∇⋅((u, v)*A) with the option to add/overwrite A_tend and to flip_sign of the flux divergence by doing so.
A_tend = ∇⋅((u, v)*A)foradd=false,flip_sign=falseA_tend = -∇⋅((u, v)*A)foradd=false,flip_sign=trueA_tend += ∇⋅((u, v)*A)foradd=true,flip_sign=falseA_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::DiagnosticVariables,
forcing::JetStreamForcing
)
Set for every latitude ring the tendency to the precomputed forcing in the momentum equations following the JetStreamForcing. The forcing is precomputed in initialize!(::JetStreamForcing, ::AbstractModel).
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::DiagnosticVariables,
pres::LowerTriangularArray,
planet::SpeedyWeather.AbstractPlanet
)
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,
implicit::SpeedyWeather.AbstractImplicit
) -> Any
Update C::ColumnVariables by copying the prognostic variables from D::DiagnosticVariables at gridpoint index ij. Provide G::Geometry for coordinate information.
SpeedyWeather.get_full_output_file_path — Methodget_full_output_file_path(
output::SpeedyWeather.AbstractOutput
) -> String
Returns the full path of the output file after it was created.
SpeedyWeather.get_step — Methodget_step(
coeffs::LowerTriangularArray{T, 2, ArrayType} where ArrayType<:AbstractArray{T, 2},
i
) -> LowerTriangularArray
Get the i-th step of a LowerTriangularArray as a view (wrapped into a LowerTriangularArray). "step" refers to the last dimension, for prognostic variables used for the leapfrog time step. This method is for a 2D spectral variable (horizontal only) with steps in the 3rd dimension.
SpeedyWeather.get_step — Methodget_step(
coeffs::LowerTriangularArray{T, 3, ArrayType} where ArrayType<:AbstractArray{T, 3},
i
) -> LowerTriangularArray
Get the i-th step of a LowerTriangularArray as a view (wrapped into a LowerTriangularArray). "step" refers to the last dimension, for prognostic variables used for the leapfrog time step. This method is for a 3D spectral variable (horizontal+vertical) with steps in the 4rd dimension.
SpeedyWeather.get_thermodynamics! — Methodget_thermodynamics!(
column::ColumnVariables,
model::PrimitiveEquation
)
Calculate geopotentiala and dry static energy for the primitive equation model.
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(Model::Type{<:AbstractModel}, var_name::Symbol) -> Any
Returns true if the model M has a prognostic variable var_name, false otherwise. The default fallback is that all variables are included.
SpeedyWeather.horizontal_diffusion! — Functionhorizontal_diffusion!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
model::Barotropic
)
horizontal_diffusion!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
model::Barotropic,
lf::Integer
)
Apply horizontal diffusion to vorticity in the BarotropicModel.
SpeedyWeather.horizontal_diffusion! — Functionhorizontal_diffusion!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
model::PrimitiveEquation
)
horizontal_diffusion!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
model::PrimitiveEquation,
lf::Integer
)
Apply horizontal diffusion applied to vorticity, divergence, temperature, and humidity (PrimitiveWet only) in the PrimitiveEquation models.
SpeedyWeather.horizontal_diffusion! — Functionhorizontal_diffusion!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
model::ShallowWater
)
horizontal_diffusion!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
model::ShallowWater,
lf::Integer
)
Apply horizontal diffusion to vorticity and divergence in the ShallowWaterModel.
SpeedyWeather.horizontal_diffusion! — Methodhorizontal_diffusion!(
tendency::LowerTriangularArray,
var::LowerTriangularArray,
expl::AbstractMatrix,
impl::AbstractMatrix
)
Apply horizontal diffusion to a 2D field var in spectral space by updating its tendency tendency with an implicitly calculated diffusion term. The implicit diffusion of the next time step is split into an explicit part expl and an implicit part impl, such that both can be calculated in a single forward step by using var as well as its tendency tendency.
SpeedyWeather.implicit_correction! — Methodimplicit_correction!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
implicit::ImplicitPrimitiveEquation,
model::PrimitiveEquation
)
Apply the implicit corrections to dampen gravity waves in the primitive equation models.
SpeedyWeather.implicit_correction! — Methodimplicit_correction!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
implicit::ImplicitShallowWater,
model::ShallowWater
)
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! — Methodinitialize!(
land_sea_mask::AquaPlanetMask,
model::PrimitiveEquation
)
Sets all grid points to 0 = sea.
SpeedyWeather.initialize! — Methodinitialize!(
model::Barotropic;
time
) -> Simulation{Model, Progn, Diagn} where {Model<:Barotropic, Progn<:(PrognosticVariables{var"#s107", var"#s108", _A, _B, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A, _B}), Diagn<:(DiagnosticVariables{var"#s107", var"#s108", _A, _B, var"#s112", var"#s113", var"#s116", var"#s117", var"#s119", var"#s109", var"#s110", SpeedyTransforms.ScratchMemory{NF, ArrayComplexType, VectorType, VectorComplexType}, AnvilInterpolator{NF1, Geometry, Locator}} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A, _B, var"#s112"<:AbstractArray, var"#s113"<:AbstractArray, var"#s116"<:AbstractArray, var"#s117"<:AbstractArray, var"#s119"<:AbstractArray, var"#s109"<:(AbstractVector), var"#s110"<:(AbstractMatrix), NF, ArrayComplexType, VectorType, VectorComplexType, Locator, Geometry, NF1})}
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!(
clock::Clock,
Δt::Dates.Period,
period::Dates.Period
) -> Clock
Initialize the clock with the time step Δt and period to integrate for.
SpeedyWeather.initialize! — Methodinitialize!(
clock::Clock,
Δt::Dates.Period,
n_timesteps::Integer
) -> Clock
Initialize the clock with the time step Δt and the number of time steps n_timesteps.
SpeedyWeather.initialize! — Methodinitialize!(
clock::Clock,
time_stepping::SpeedyWeather.AbstractTimeStepper,
args...
)
Initialize the clock with the time step Δt from time_stepping.
SpeedyWeather.initialize! — Methodinitialize!(clock::Clock) -> Clock
Initialize the clock with setting the start time and resetting the timestep counter.
SpeedyWeather.initialize! — Methodinitialize!(
land_sea_mask::EarthLandSeaMask,
model::PrimitiveEquation
) -> AbstractArray
Reads a high-resolution land-sea mask from file and interpolates (grid-cell average) onto the model grid for a fractional sea mask.
SpeedyWeather.initialize! — Methodinitialize!(
orog::EarthOrography,
P::SpeedyWeather.AbstractPlanet,
S::SpectralTransform
)
Initialize the arrays orography, geopot_surf in orog by reading the orography field from file.
SpeedyWeather.initialize! — Methodinitialize!(
feedback::Feedback,
clock::Clock,
model::AbstractModel
) -> 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!(diffusion::HyperDiffusion, model::AbstractModel)
Precomputes the hyper diffusion terms in diffusion based on the model time step, and possibly with a changing strength/power in the vertical.
SpeedyWeather.initialize! — Methodinitialize!(
diffusion::HyperDiffusion,
G::SpeedyWeather.AbstractGeometry,
L::SpeedyWeather.AbstractTimeStepper
)
Precomputes the hyper diffusion terms for all layers based on the model time step in L, the vertical level sigma level in G.
SpeedyWeather.initialize! — Methodinitialize!(
implicit::ImplicitShallowWater,
dt::Real,
args...
)
Update the implicit terms in implicit for the shallow water model as they depend on the time step dt.
SpeedyWeather.initialize! — Methodinitialize!(
output::JLD2Output,
feedback::SpeedyWeather.AbstractFeedback,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
) -> Union{Nothing, Bool}
Initialize JLD2 output by creating a JLD2 file. To be called just before the first timesteps.
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!(L::Leapfrog, model::AbstractModel)
Initialize leapfrogging L by recalculating the time step 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!(
output::NetCDFOutput,
feedback::SpeedyWeather.AbstractFeedback,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
Initialize NetCDF output by creating a netCDF file and storing the initial conditions of diagn (and progn). To be called just before the first timesteps.
SpeedyWeather.initialize! — Methodinitialize!(
parameters_txt::ParametersTxt,
progn,
diagn,
model
)
Initialize ParametersTxt by writing the model parameters (via defined show of model components) into a text file.
SpeedyWeather.initialize! — Methodinitialize!(
model::PrimitiveDry;
time
) -> Simulation{Model, Progn, Diagn} where {Model<:PrimitiveDry, Progn<:(PrognosticVariables{var"#s107", var"#s108", _A, _B, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A, _B}), Diagn<:(DiagnosticVariables{var"#s107", var"#s108", _A, _B, var"#s112", var"#s113", var"#s116", var"#s117", var"#s119", var"#s109", var"#s110", SpeedyTransforms.ScratchMemory{NF, ArrayComplexType, VectorType, VectorComplexType}, AnvilInterpolator{NF1, Geometry, Locator}} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A, _B, var"#s112"<:AbstractArray, var"#s113"<:AbstractArray, var"#s116"<:AbstractArray, var"#s117"<:AbstractArray, var"#s119"<:AbstractArray, var"#s109"<:(AbstractVector), var"#s110"<:(AbstractMatrix), NF, ArrayComplexType, VectorType, VectorComplexType, Locator, Geometry, NF1})}
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, Progn, Diagn} where {Model<:PrimitiveWet, Progn<:(PrognosticVariables{var"#s107", var"#s108", _A, _B, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A, _B}), Diagn<:(DiagnosticVariables{var"#s107", var"#s108", _A, _B, var"#s112", var"#s113", var"#s116", var"#s117", var"#s119", var"#s109", var"#s110", SpeedyTransforms.ScratchMemory{NF, ArrayComplexType, VectorType, VectorComplexType}, AnvilInterpolator{NF1, Geometry, Locator}} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A, _B, var"#s112"<:AbstractArray, var"#s113"<:AbstractArray, var"#s116"<:AbstractArray, var"#s117"<:AbstractArray, var"#s119"<:AbstractArray, var"#s109"<:(AbstractVector), var"#s110"<:(AbstractMatrix), NF, ArrayComplexType, VectorType, VectorComplexType, Locator, Geometry, NF1})}
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
)
Initialize surface pressure on orography by integrating the hydrostatic equation with the reference temperature lapse rate.
SpeedyWeather.initialize! — Methodinitialize!(
progn::PrognosticVariables,
initial_conditions::RossbyHaurwitzWave,
model::AbstractModel
)
Rossby-Haurwitz wave initial conditions as in Williamson et al. 1992, J Computational Physics with an additional cut-off amplitude c to filter out tiny harmonics in the vorticity field.
SpeedyWeather.initialize! — Methodinitialize!(
progn_new::PrognosticVariables,
initial_conditions::StartFromFile,
model::AbstractModel
)
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::AbstractModel
)
Initial conditions from Galewsky, 2004, Tellus
SpeedyWeather.initialize! — Methodinitialize!(progress_txt::ProgressTxt, progn, diagn, model)
Initializes the ProgressTxt callback by creating a progress.txt file and writing some initial information to it.
SpeedyWeather.initialize! — Methodinitialize!(
land_sea_mask::RockyPlanetMask,
model::PrimitiveEquation
)
Sets all grid points to 1 = land.
SpeedyWeather.initialize! — Methodinitialize!(scheduler::Schedule, clock::Clock) -> Schedule
Initialize a Schedule with a Clock (which is assumed to have been initialized). Takes both scheduler.every and scheduler.times into account, such that both periodic and events can be scheduled simulataneously. But execution will happen only once if they coincide on a given time step.
SpeedyWeather.initialize! — Methodinitialize!(
model::ShallowWater;
time
) -> Simulation{Model, Progn, Diagn} where {Model<:ShallowWater, Progn<:(PrognosticVariables{var"#s107", var"#s108", _A, _B, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A, _B}), Diagn<:(DiagnosticVariables{var"#s107", var"#s108", _A, _B, var"#s112", var"#s113", var"#s116", var"#s117", var"#s119", var"#s109", var"#s110", SpeedyTransforms.ScratchMemory{NF, ArrayComplexType, VectorType, VectorComplexType}, AnvilInterpolator{NF1, Geometry, Locator}} where {var"#s107"<:AbstractFloat, var"#s108"<:AbstractArray, _A, _B, var"#s112"<:AbstractArray, var"#s113"<:AbstractArray, var"#s116"<:AbstractArray, var"#s117"<:AbstractArray, var"#s119"<:AbstractArray, var"#s109"<:(AbstractVector), var"#s110"<:(AbstractMatrix), NF, ArrayComplexType, VectorType, VectorComplexType, Locator, Geometry, NF1})}
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!(
simulation::SpeedyWeather.AbstractSimulation;
period,
steps,
output
) -> Any
Initializes a simulation. Scales the variables, initializes the output, stores initial conditions, initializes the progress meter feedback, callbacks and performs the first two initial time steps to spin up the leapfrogging scheme.
SpeedyWeather.initialize! — Methodinitialize!(
orog::ZonalRidge,
P::SpeedyWeather.AbstractPlanet,
S::SpectralTransform,
G::Geometry
)
Initialize the arrays orography, geopot_surf in orog following Jablonowski and Williamson, 2006.
SpeedyWeather.initialize! — Methodinitialize!(
callback::GlobalSurfaceTemperatureCallback{NF},
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
) -> Int64
Initializes callback.temp vector that records the global mean surface temperature on every time step. Allocates vector of correct length (number of elements = total time steps plus one) and stores the global surface temperature of the initial conditions
SpeedyWeather.initialize! — Methodinitialize!(
implicit::ImplicitPrimitiveEquation,
dt::Real,
diagn::DiagnosticVariables{NF},
geometry::SpeedyWeather.AbstractGeometry,
geopotential::SpeedyWeather.AbstractGeopotential,
atmosphere::SpeedyWeather.AbstractAtmosphere,
adiabatic_conversion::SpeedyWeather.AbstractAdiabaticConversion
)
Initialize the implicit terms for the PrimitiveEquation models.
SpeedyWeather.initialize! — Methodinitialize!(
progn::PrognosticVariables{NF},
initial_conditions::JablonowskiTemperature,
model::PrimitiveEquation
)
Initial conditions from Jablonowski and Williamson, 2006, QJR Meteorol. Soc
SpeedyWeather.initialize! — Methodinitialize!(
progn::PrognosticVariables{NF},
initial_conditions::RandomVelocity,
model::Barotropic
)
Start with random vorticity as initial conditions
SpeedyWeather.initialize! — Methodinitialize!(
progn::PrognosticVariables{NF},
initial_conditions::RandomVorticity,
model::Barotropic
)
Start with random vorticity as initial conditions
SpeedyWeather.initialize! — Methodinitialize!(
progn::PrognosticVariables{NF},
initial_conditions::RandomWaves,
model::ShallowWater
)
Random initial conditions for the interface displacement η in the shallow water equations. The flow (u, v) is zero initially. This kicks off gravity waves that will interact with orography.
SpeedyWeather.initialize! — Methodinitialize!(
progn::PrognosticVariables{NF},
initial_conditions::ZonalWind,
model::PrimitiveEquation
)
Initial conditions from Jablonowski and Williamson, 2006, QJR Meteorol. Soc
SpeedyWeather.initialize! — Methodinitialize!(
particles::AbstractArray{P<:Particle, 1},
progn::PrognosticVariables,
diagn::DiagnosticVariables,
particle_advection::ParticleAdvection2D,
model::AbstractModel
)
Initialize particle locations uniformly in latitude, longitude and in the vertical σ coordinates. This uses a cosin-distribution in latitude for an equal-area uniformity.
SpeedyWeather.initialize! — Methodinitialize!(
diagn::DiagnosticVariables,
particles::AbstractArray{P<:Particle, 1},
progn::PrognosticVariables,
particle_advection::ParticleAdvection2D,
model::AbstractModel
) -> Any
Initialize particle advection time integration: Store u,v interpolated initial conditions in diagn.particles.u and .v to be used when particle advection actually executed for first time.
SpeedyWeather.isactive — Methodisactive(p::Particle{NF}) -> Bool
Check whether particle is active.
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.isscheduled — Methodisscheduled(S::Schedule, clock::Clock) -> Bool
Evaluate whether (e.g. a callback) should be scheduled at the timestep given in clock. Returns true for scheduled executions, false for no execution on this time step.
SpeedyWeather.large_scale_condensation! — Methodlarge_scale_condensation!(
column::ColumnVariables,
condensation::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.later_timestep! — Methodlater_timestep!(
simulation::SpeedyWeather.AbstractSimulation
)
Perform one single "normal" time step of simulation, after first_timesteps!.
SpeedyWeather.leapfrog! — Methodleapfrog!(
progn::PrognosticVariables,
tend::Tendencies,
dt::Real,
lf::Int64,
model::AbstractModel
)
Leapfrog time stepping for all prognostic variables in progn using their tendencies in tend. Depending on model decides which variables to time step.
SpeedyWeather.leapfrog! — Methodleapfrog!(
A_old::LowerTriangularArray,
A_new::LowerTriangularArray,
tendency::LowerTriangularArray,
dt::Real,
lf::Int64,
L::Leapfrog{NF}
)
Performs one leapfrog time step with (lf=2) or without (lf=1) Robert+Williams filter (see Williams (2009), Montly Weather Review, Eq. 7-9).
SpeedyWeather.linear_pressure_gradient! — Methodlinear_pressure_gradient!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Int64,
atmosphere::SpeedyWeather.AbstractAtmosphere,
implicit::ImplicitPrimitiveEquation
)
Add the linear contribution of the pressure gradient to the geopotential. The pressure gradient in the divergence equation takes the form
-∇⋅(Rd * Tᵥ * ∇lnpₛ) = -∇⋅(Rd * Tᵥ' * ∇lnpₛ) - ∇²(Rd * Tₖ * lnpₛ)So that the second term inside the Laplace operator can be added to the geopotential. Rd is the gas constant, Tᵥ the virtual temperature and Tᵥ' its anomaly wrt to the average or reference temperature Tₖ, lnpₛ is the logarithm of surface pressure.
SpeedyWeather.linear_virtual_temperature! — Methodlinear_virtual_temperature!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
model::PrimitiveDry
) -> Any
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::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
model::PrimitiveEquation
) -> Any
Calculates a linearised virtual temperature Tᵥ as
Tᵥ = T + TₖμqWith 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::AbstractModel
) -> Any
Loads a var_name trajectory of the model M that has been saved in a netCDF file during the time stepping.
SpeedyWeather.merge_output — Methodmerge_output(output::JLD2Output)
We can't directly push to arrays in a JLD2 file or have extendable dimensions. This routine rewrites the file to a single vector. Might be turned off if the file doesn't fit into the memory or speed is a concern.
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*Qwith 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},
dlon,
dlat,
dσ
) -> Particle{NF} where NF
Move a particle with increments (dlon, dlat, dσ) in those respective coordinates.
SpeedyWeather.move — Methodmove(p::Particle{NF}, dlon, dlat) -> Particle{NF} where NF
Move a particle with increments (dlon, dlat) in 2D. No movement in vertical σ.
SpeedyWeather.nan_detection! — Methodnan_detection!(
feedback::Feedback,
progn::PrognosticVariables
) -> Union{Nothing, Bool}
Detect NaN (Not-a-Number, or Inf) in the prognostic variables.
SpeedyWeather.output! — Methodoutput!(output::NetCDFOutput, time::DateTime)
Write the current time time::DateTime to the netCDF file in output.
SpeedyWeather.output! — Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.AbstractOutputVariable,
simulation::SpeedyWeather.AbstractSimulation
)
Output a variable into the netCDF file output.netcdf_file. Interpolates onto the output grid and resolution as specified in output. Method used for all output variables <: AbstractOutputVariable with dispatch over the second argument. Interpolates, scales, custom transform, bitrounding and writes to file.
SpeedyWeather.output! — Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.AbstractRateOutputVariable,
acc_variable::SpeedyWeather.AbstractOutputVariable
)
Post-process the netCDF output file to convert accumulated precipitation rain/snow to rates.
SpeedyWeather.output! — Methodoutput!(
output::NetCDFOutput,
variable::Union{SpeedyWeather.MeridionalVelocity10mOutput, SpeedyWeather.ZonalVelocity10mOutput},
simulation::SpeedyWeather.AbstractSimulation
)
10m wind is defined using a logarithmic profile from the lowermost model layer.
\[u_{10}=u_{bottom} * ln(10/z₀) / ln(z_{bottom}/z₀)\]
(with z in m), with
\[z_{bottom} = z_{surf} + T_{bottom} * Δp_geopot_{bottom} / g\]
SpeedyWeather.output! — Methodoutput!(
output::SpeedyWeather.AbstractOutput,
output_variables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
simulation::SpeedyWeather.AbstractSimulation
)
Loop over every variable in output.variables to call the respective output! method to write into the output.netcdf_file.
SpeedyWeather.output! — Methodoutput!(
output::SpeedyWeather.AbstractOutput,
simulation::SpeedyWeather.AbstractSimulation
) -> Any
Writes the variables from progn or diagn of time step i at time time into output.netcdf_file. Simply escapes for no netcdf output or if output shouldn't be written on this time step. Interpolates onto output grid and resolution as specified in output, converts to output number format, truncates the mantissa for higher compression and applies lossless compression.
SpeedyWeather.parameterization_tendencies! — Methodparameterization_tendencies!(
column::ColumnVariables,
progn::PrognosticVariables,
model::PrimitiveEquation
)
Calls for column one physics parameterization after another and convert fluxes to tendencies.
SpeedyWeather.parameterization_tendencies! — Methodparameterization_tendencies!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
time::DateTime,
model::PrimitiveEquation
)
Compute tendencies for u, v, temp, humid from physical parametrizations. Extract for each vertical atmospheric column the prognostic variables (stored in diagn as they are grid-point transformed), loop over all grid-points, compute all parametrizations on a single-column basis, then write the tendencies back into a horizontal field of tendencies.
SpeedyWeather.path — Methodpath(_::SpeedyWeather.VorticityOutput, simulation) -> Any
To be extended for every output variable to define the path where in simulation to find that output variable ::AbstractField.
SpeedyWeather.physics_tendencies_only! — Methodphysics_tendencies_only!(
diagn::DiagnosticVariables,
model::PrimitiveEquation
)
For dynamics=false, after calling parameterization_tendencies! call this function to transform the physics tendencies from grid-point to spectral space including the necessary coslat⁻¹ scaling.
SpeedyWeather.pressure_gradient_flux! — Methodpressure_gradient_flux!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
S::SpectralTransform
)
Compute the gradient ∇lnps of the logarithm of surface pressure, followed by its flux, (u,v) * ∇lnps.
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,
steps,
output
)
Run a SpeedyWeather.jl simulation. The simulation.model is assumed to be initialized.
SpeedyWeather.run_folder_name — Methodrun_folder_name(
prefix::String,
id::String,
number::Int64;
fmt
) -> String
Concatenate the run folder name from prefix, id and number to e.g. "run0001" or "runshallowconvection0001".
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 / pressureSpeedyWeather.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/preswith both pressures in same units and qsat in kg/kg.
SpeedyWeather.scale! — Methodscale!(
diagn::DiagnosticVariables,
var::Symbol,
scale::Real
) -> Any
Scale the variable var inside diagn with scalar scale.
SpeedyWeather.scale! — Methodscale!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
scale::Real
) -> Real
Scales the prognostic variables vorticity and divergence with the Earth's radius which is used in the dynamical core.
SpeedyWeather.scale! — Methodscale!(
progn::PrognosticVariables,
var::Symbol,
scale::Real
) -> Any
Scale the variable var inside progn with scalar scale.
SpeedyWeather.set! — Methodset!(
model::AbstractModel;
orography,
land_sea_mask,
kwargs...
)
Sets a boundary condition fields for model. The input can be a function, RingGrid, LowerTriangularMatrix, or scalar as for other set! functions. If the keyword add==true the input is added to the exisiting field instead.
SpeedyWeather.set! — Methodset!(
progn::PrognosticVariables,
geometry::Geometry;
u,
v,
vor,
div,
temp,
humid,
pres,
sea_surface_temperature,
sea_ice_concentration,
soil_temperature,
snow_depth,
soil_moisture,
lf,
add,
spectral_transform,
coslat_scaling_included,
kwargs...
)
Sets new values for the keyword arguments (velocities, vorticity, divergence, etc..) into the prognostic variable struct progn at timestep index lf. If add==true they are added to the current value instead. If a SpectralTransform S is provided, it is used when needed to set the variable, otherwise it is recomputed. In case u and v are provied, actually the divergence and vorticity are set and coslat_scaling_included specficies whether or not the 1/cos(lat) scaling is already included in the arrays or not (default: false)
The input may be:
- A function or callable object
f(lond, latd, σ) -> value(multilevel variables) - A function or callable object
f(lond, latd) -> value(surface level variables) - An instance of
AbstractField - An instance of
LowerTriangularArray - A scalar
<: Number(interpreted as a constant field in grid space)
SpeedyWeather.set! — Methodset!(S::SpeedyWeather.AbstractSimulation; kwargs...) -> Any
Sets properties of the simuluation S. Convenience wrapper to call the other concrete set! methods. All kwargs are forwarded to these methods, which are documented seperately. See their documentation for possible kwargs.
SpeedyWeather.set! — Methodset!(
L::SpeedyWeather.AbstractTimeStepper,
Δt::Dates.Period
) -> SpeedyWeather.AbstractTimeStepper
Change time step of timestepper L to Δt (unscaled) and disables adjustment to output frequency.
SpeedyWeather.sigma_okay — Methodsigma_okay(nlayers::Integer, σ_half::AbstractVector) -> Bool
Check that nlayers 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.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! — Methodtemperature_anomaly!(
diagn::DiagnosticVariables,
implicit::ImplicitPrimitiveEquation
)
Convert absolute and virtual temperature to anomalies wrt to the reference profile
SpeedyWeather.temperature_average! — Methodtemperature_average!(
diagn::DiagnosticVariables,
temp::LowerTriangularArray,
S::SpectralTransform
)
Calculates the average temperature of a layer from the l=m=0 harmonic and stores the result in diagn.temp_average
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::DiagnosticVariables,
adiabatic_conversion::SpeedyWeather.AbstractAdiabaticConversion,
atmosphere::SpeedyWeather.AbstractAtmosphere,
implicit::ImplicitPrimitiveEquation,
G::Geometry,
S::SpectralTransform
)
Compute the temperature tendency
∂T/∂t += -∇⋅((u, v)*T') + T'D + κTᵥ*Dlnp/Dt+= because the tendencies already contain parameterizations and vertical advection. T' is the anomaly with respect to the reference/average temperature. Tᵥ is the virtual temperature used in the adiabatic term κTᵥ*Dlnp/Dt.
SpeedyWeather.time_stepping! — Methodtime_stepping!(simulation::SpeedyWeather.AbstractSimulation)
Main time loop that loops over all time steps.
SpeedyWeather.timestep! — Functiontimestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::ShallowWater
)
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::ShallowWater,
lf1::Integer
)
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::ShallowWater,
lf1::Integer,
lf2::Integer
)
Calculate a single time step for the model <: ShallowWater.
SpeedyWeather.timestep! — Functiontimestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::PrimitiveEquation
)
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::PrimitiveEquation,
lf1::Integer
)
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::PrimitiveEquation,
lf1::Integer,
lf2::Integer
)
Calculate a single time step for the model<:PrimitiveEquation
SpeedyWeather.timestep! — Functiontimestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::Barotropic
)
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::Barotropic,
lf1::Integer
)
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::Barotropic,
lf1::Integer,
lf2::Integer
)
Calculate a single time step for the barotropic model.
SpeedyWeather.timestep! — Methodtimestep!(simulation::SpeedyWeather.AbstractSimulation)
Perform one single time step of simulation including possibly output and callbacks.
SpeedyWeather.tree — Methodtree(M::AbstractModel; modules, with_size, kwargs...)
Create a tree of fields inside a model and fields within these fields as long as they are defined within the modules argument (default SpeedyWeather). Other keyword arguments are max_level::Integer=10, with_types::Bool=false or with_size::Bool=false.
SpeedyWeather.tree — Methodtree(S; modules, with_size, kwargs...)
Create a tree of fields inside S and fields within these fields as long as they are defined within the modules argument (default SpeedyWeather). Other keyword arguments are max_level::Integer=10, with_types::Bool=false or with_size::Bool=false.
SpeedyWeather.tree — Methodtree(S::Simulation{M}; modules, with_size, kwargs...)
Create a tree of fields inside a Simulation instance and fields within these fields as long as they are defined within the modules argument (default SpeedyWeather). Other keyword arguments are max_level::Integer=10, with_types::Bool=false or with_size::Bool=false.
SpeedyWeather.unscale! — Methodunscale!(variable::AbstractArray, scale::Real) -> Any
Undo the radius-scaling for any variable. Method used for netcdf output.
SpeedyWeather.unscale! — Methodunscale!(diagn::DiagnosticVariables) -> Int64
Undo the radius-scaling of vorticity and divergence from scale!(diagn, scale::Real).
SpeedyWeather.unscale! — Methodunscale!(progn::PrognosticVariables) -> Int64
Undo the radius-scaling of vorticity and divergence from scale!(progn, scale::Real).
SpeedyWeather.vertical_integration! — Methodvertical_integration!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
geometry::Geometry
)
Calculates the vertically averaged (weighted by the thickness of the σ level) velocities (*coslat) and divergence. E.g.
u_mean = ∑_k=1^nlayers Δσ_k * u_ku, 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=nlayers+1/2).
SpeedyWeather.virtual_temperature! — Methodvirtual_temperature!(
diagn::DiagnosticVariables,
model::PrimitiveDry
)
Virtual temperature in grid-point space: For the PrimitiveDry temperature and virtual temperature are the same (humidity=0). Just copy over the arrays.
SpeedyWeather.virtual_temperature! — Methodvirtual_temperature!(
diagn::DiagnosticVariables,
model::PrimitiveWet
)
Calculates the virtual temperature Tᵥ as
Tᵥ = T(1+μq)With absolute temperature T, specific humidity q and
μ = (1-ξ)/ξ, ξ = R_dry/R_vapour.in grid-point space.
SpeedyWeather.volume_flux_divergence! — Methodvolume_flux_divergence!(
diagn::DiagnosticVariables,
orog::SpeedyWeather.AbstractOrography,
atmosphere::SpeedyWeather.AbstractAtmosphere,
G::SpeedyWeather.AbstractGeometry,
S::SpectralTransform
)
Computes the (negative) divergence of the volume fluxes uh, vh for the continuity equation, -∇⋅(uh, vh).
SpeedyWeather.vordiv_tendencies! — Methodvordiv_tendencies!(
diagn::DiagnosticVariables,
model::PrimitiveEquation
)
Function barrier to unpack model.
SpeedyWeather.vordiv_tendencies! — Methodvordiv_tendencies!(
diagn::DiagnosticVariables,
coriolis::SpeedyWeather.AbstractCoriolis,
atmosphere::SpeedyWeather.AbstractAtmosphere,
geometry::SpeedyWeather.AbstractGeometry,
S::SpectralTransform
)
Tendencies for vorticity and divergence. Excluding Bernoulli potential with geopotential and linear pressure gradient inside the Laplace operator, which are added later in spectral space.
u_tend += v*(f+ζ) - RTᵥ'*∇lnp_x
v_tend += -u*(f+ζ) - RTᵥ'*∇lnp_y+= because the tendencies already contain the parameterizations and vertical advection. f is coriolis, ζ relative vorticity, R the gas constant Tᵥ' the virtual temperature anomaly, ∇lnp the gradient of surface pressure and _x and _y its zonal/meridional components. The tendencies are then curled/dived to get the tendencies for vorticity/divergence in spectral space
∂ζ/∂t = ∇×(u_tend, v_tend)
∂D/∂t = ∇⋅(u_tend, v_tend) + ...+ ... because there's more terms added later for divergence.
SpeedyWeather.vorticity_flux! — Methodvorticity_flux!(
diagn::DiagnosticVariables,
model::Barotropic
)
Vorticity flux tendency in the barotropic vorticity equation
∂ζ/∂t = ∇×(u_tend, v_tend)
with
u_tend = Fᵤ + v*(ζ+f) v_tend = Fᵥ - u*(ζ+f)
with Fᵤ, Fᵥ the forcing from forcing! already in u_tend_grid/v_tend_grid and vorticity ζ, coriolis f.
SpeedyWeather.vorticity_flux! — Methodvorticity_flux!(
diagn::DiagnosticVariables,
model::ShallowWater
)
Vorticity flux tendency in the shallow water equations
∂ζ/∂t = ∇×(u_tend, v_tend) ∂D/∂t = ∇⋅(u_tend, v_tend)
with
u_tend = Fᵤ + v*(ζ+f) v_tend = Fᵥ - u*(ζ+f)
with Fᵤ, Fᵥ the forcing from forcing! already in u_tend_grid/v_tend_grid and vorticity ζ, coriolis f.
SpeedyWeather.vorticity_flux_curldiv! — Methodvorticity_flux_curldiv!(
diagn::DiagnosticVariables,
coriolis::SpeedyWeather.AbstractCoriolis,
geometry::Geometry,
S::SpectralTransform;
div,
add
)
Compute the vorticity advection as the curl/div of the vorticity fluxes
∂ζ/∂t = ∇×(u_tend, v_tend) ∂D/∂t = ∇⋅(u_tend, v_tend)
with
u_tend = Fᵤ + v*(ζ+f) v_tend = Fᵥ - u*(ζ+f)
with Fᵤ, Fᵥ from u_tend_grid/v_tend_grid that are assumed to be alread set in forcing!. Set div=false for the BarotropicModel which doesn't require the divergence tendency.
SpeedyWeather.write_column_tendencies! — Methodwrite_column_tendencies!(
diagn::DiagnosticVariables,
column::ColumnVariables,
planet::SpeedyWeather.AbstractPlanet,
atmosphere::SpeedyWeather.AbstractAtmosphere,
ij::Integer
)
Write the parametrization tendencies from C::ColumnVariables into the horizontal fields of tendencies stored in D::DiagnosticVariables at gridpoint index ij.
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.σ_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).
SpeedyWeatherInternals.Architectures.AbstractArchitecture — TypeAbstractArchitectureAbstract supertype for architectures supported by SpeedyWeather.
SpeedyWeatherInternals.Architectures.AbstractCPU — TypeAbstractCPU <: AbstractArchitectureAbstract supertype for CPU architectures supported by SpeedyWeather.
SpeedyWeatherInternals.Architectures.CPU — TypeCPU <: AbstractCPURun SpeedyWeather on one CPU node.
SpeedyWeatherInternals.Architectures.GPU — TypeGPU(device)Return a GPU architecture using device. device defauls to CUDA.CUDABackend(always_inline=true). CUDA has to be loaded for this to work.
SpeedyWeatherInternals.Architectures.architecture — Methodarchitecture(a::AbstractArchitecture)Return the architecture of a.
SpeedyWeatherInternals.Architectures.architecture — Methodarchitecture(x)Return the default architecture that's associated with the input x.
SpeedyWeatherInternals.Architectures.array_type — Method array_type(::AbstractArchitecture, NF::Type, N::Int)Return the concrete array type that's used with the architecture for a number type NF and dimension N.
SpeedyWeatherInternals.Architectures.array_type — Methodarray_type(arch::AbstractArchitecture)Return the array type that's used with the architecture arch.
SpeedyWeatherInternals.Architectures.compatible_array_types — Methodcompatible_array_types(arch::AbstractArchitecture)Return the array types that are compatible with the architecture arch. This includes the regular array_type(arch) as well as any other array types that are compatible with the architecture, e.g. device arrays on GPU.
SpeedyWeatherInternals.Architectures.nonparametric_type — Methodnonparametric_type(array_T::Type{<:AbstractArray})Strip away all the parameters of array_T and return the nonparametric type.
SpeedyWeatherInternals.Architectures.on_architecture — Methodon_architecture(arch::AbstractArchitecture, a)Return a, but on the architecture arch.
SpeedyWeatherInternals.Utils.AbstractWorkOrder — TypeAbstract type for different work order patterns in kernel launching.
SpeedyWeatherInternals.Utils.Array3DWorkOrder — TypeWork order for kernels over a regular 3D array.
SpeedyWeatherInternals.Utils.DiagonalWorkOrder — TypeWork order for kernels over the diagonal of a (m+1)×m or m×m LowerTriangularArray.
SpeedyWeatherInternals.Utils.LinearWorkOrder — TypeWork order for kernels over linear/eachindex iteration.
SpeedyWeatherInternals.Utils.RingGridWorkOrder — TypeWork order for kernels over RingGrids 'ij' indices and layers.
SpeedyWeatherInternals.Utils.SpectralInnerWorkOrder — TypeWork order for kernels over spectral number 'lm' and layers, excluding the lm=1 element.
SpeedyWeatherInternals.Utils.SpectralWorkOrder — TypeWork order for kernels over spectral number 'lm' and layers.
SpeedyWeatherInternals.Utils.clip_negatives! — Methodclip_negatives!(A::AbstractArray)Set all negative entries a in A to zero.
SpeedyWeatherInternals.Utils.configure_kernel — Methodconfigure_kernel(
arch,
work_order::Type{<:SpeedyWeatherInternals.Utils.AbstractWorkOrder},
worksize,
kernel!
) -> Tuple{Any, Any}
Configure kernel! to launch over the dims of grid on the architecture arch.
Arguments
============
arch: The architecture on which the kernel will be launched.dims_type: The dimensions on which the kernel will be executed, a subtype ofAbstractWorkOrder.worksize: The size that defines the work distribution.kernel!: The kernel function to be executed.
SpeedyWeatherInternals.Utils.flipsign! — Methodflipgsign!(A::AbstractArray)Like -A but in-place.
SpeedyWeatherInternals.Utils.isdecreasing — Methodisdecreasing(v::AbstractVector) -> Bool
Check whether elements of a vector v are strictly decreasing.
SpeedyWeatherInternals.Utils.isincreasing — Methodisincreasing(v::AbstractVector) -> Bool
Check whether elements of a vector v are strictly increasing.
SpeedyWeatherInternals.Utils.launch! — Methodlaunch!(arch, dimstype, worksize, kernel!, kernelargs...)
Launches kernel! with arguments kernel_args over the dims_type with worksize on the architecture arch. Kernels run on the default stream.
See configure_kernel for more information.
SpeedyWeatherInternals.Utils.nans — MethodA = nans(dims...)Allocate A::Array{Float64} with NaNs.
SpeedyWeatherInternals.Utils.nans — MethodA = nans(T, dims...)Allocate array A with NaNs of type T. Similar to zeros(T, dims...).
SpeedyWeatherInternals.Utils.print_fields — Methodprint_fields(io::IO, A, keys; arrays)
Prints to io all fields of a struct A identified by their keys.
SpeedyWeatherInternals.Utils.underflow! — Methodunderflow!(A::AbstractArray, ϵ::Real)Underflows element a in A to zero if abs(a) < ϵ.
SpeedyWeatherInternals.Utils.work_layout — Methodwork_layout(
_::Type{SpeedyWeatherInternals.Utils.Array3DWorkOrder},
worksize::NTuple{N, Int64}
) -> Tuple{Union{Int64, Tuple{Int64, Int64}, Tuple{Int64, Int64, Int64}}, NTuple{N, Int64} where N}
Returns the workgroup and worksize for launching a kernel over a regular 3D array.
SpeedyWeatherInternals.Utils.work_layout — Methodwork_layout(
_::Type{SpeedyWeatherInternals.Utils.DiagonalWorkOrder},
worksize::NTuple{N, Int64}
) -> Tuple{Union{Int64, Tuple{Any, Any}, Tuple{Any, Any, Any}}, Tuple{Int64, Vararg{Any}}}
Returns the workgroup and worksize for launching a kernel over the diagonal of a LowerTriangularArray.
SpeedyWeatherInternals.Utils.work_layout — Methodwork_layout(
_::Type{SpeedyWeatherInternals.Utils.LinearWorkOrder},
worksize::NTuple{N, Int64}
) -> Tuple{Int64, Tuple{Int64}}
Returns the workgroup and worksize for launching a kernel with linear iteration.
SpeedyWeatherInternals.Utils.work_layout — Methodwork_layout(
_::Type{SpeedyWeatherInternals.Utils.RingGridWorkOrder},
worksize::NTuple{N, Int64}
) -> Tuple{Union{Int64, Tuple{Int64, Int64}, Tuple{Int64, Int64, Int64}}, NTuple{N, Int64} where N}
Returns the workgroup and worksize for launching a kernel with ring grid work order.
SpeedyWeatherInternals.Utils.work_layout — Methodwork_layout(
_::Type{SpeedyWeatherInternals.Utils.SpectralInnerWorkOrder},
worksize::NTuple{N, Int64}
) -> Tuple{Union{Int64, Tuple{Any, Any}, Tuple{Any, Any, Any}}, Tuple{Int64, Vararg{Any}}}
Returns the workgroup and worksize for launching a kernel with spectral inner work order, excluding the lm=1 element.
SpeedyWeatherInternals.Utils.work_layout — Methodwork_layout(
_::Type{SpeedyWeatherInternals.Utils.SpectralWorkOrder},
worksize::NTuple{N, Int64}
) -> Tuple{Union{Int64, Tuple{Int64, Int64}, Tuple{Int64, Int64, Int64}}, NTuple{N, Int64} where N}
Returns the workgroup and worksize for launching a kernel with spectral work order.
SpeedyWeather.SpeedyParameters.SpeedyParam — TypeSpeedyParam{NF<:AbstractFloat} <: AbstractParamSpecialized implementation of AbstractParam for Speedy models that defines a fixed set of fields with concrete types.
SpeedyWeather.SpeedyParameters.SpeedyParams — TypeSpeedyParams{NT<:NamedTuple} <: ModelParameters.AbstractModelLightweight wrapper around a NamedTuple of parameters following the ModelParameters AbstractModel interface. This provides a table-like interface for interacting with model parameters.
SpeedyWeather.SpeedyParameters._attrs — MethodInternal helper function for filtering out built-in parameter fields.
SpeedyWeather.SpeedyParameters._selectrecursive — Method_selectrecursive(selector, nt::NamedTuple)Recursively filters out all values from a (possibly nested) named tuple nt for which selector returns true.
SpeedyWeather.SpeedyParameters.attributes — MethodReturns a NamedTuple of any additional attributes defined for param.
SpeedyWeather.SpeedyParameters.bounds — MethodReturns the numerical bounds of the parameter param.
SpeedyWeather.SpeedyParameters.description — MethodReturns a human-readable description of the parameter param.
SpeedyWeather.SpeedyParameters.parameterof — Methodparameterof(obj, ; kwargs...)
Convenience method that creates a model parameter from its property with the given name and optional extra attributes in kwargs. A parameter attribute copmonenttype is automatically added with value T.
SpeedyWeather.SpeedyParameters.parameters — Methodparameters(obj; kwargs...)
Extract parameters from the given obj as (possibly nested) named-tuple of SpeedyParams or some other AbstractParam type. If obj
SpeedyWeather.SpeedyParameters.reconstruct — Methodreconstruct(obj, value)
Reconstructs the given (possibly nested) data structure with the given values. If values is a NamedTuple, the nested structure must match that of obj. This function is used to reconstruct model types from SpeedyParams.
SpeedyWeather.SpeedyParameters.stripparams — Methodstripparams(param)
Unpacks and strips all AbstractParam types from the given params object, replacing them with their numeric val. This is a type-stable alternative to the (currently unstable) stripparams in ModelParameters.
SpeedyWeather.SpeedyParameters.unpack_params — Methodunpack_params(x)
Simple recursive dispatch algorithm for unpacking nested named tuples of SpeedyParams
SpeedyWeather.SpeedyParameters.value — MethodReturns the value of the given param.
SpeedyWeather.SpeedyParameters.@parameterized — MacroConvenience macro for creating "parameterized" structs. Fields can be marked as parameters with @param, e.g:
@parameterized Base.@kwdef struct Foo{T}
@param x::T = 1.0
y::T = NaN
endwhere here x will be treated as a parameter field and y will not. Parameters will be then automatically generated in a corresponding parameters(::Foo) method definition with descriptions set to the corresponding struct field docstring, if present. Additional parameter attributes can be supplied as keywords after the parameter, e.g. @param p::T = 0.5 bounds=UnitInterval() or @param p::T = 0.5 (bounds=UnitInterval(), constant=false).
Known limitations
This macro will fail to behave correctly in the following known corner cases:
1. **Untyped struct fields without default values**. The macro will not work if the struct has untyped
fields without default values specified using the `@kwdef` syntax. This is because untyped fields are
not distinguishable in the expression tree from symbols in other expressions (such as typed field definitions).
This problem can be avoided by always specifying types on struct fields (which should always be done anyway!).
2. **`@kwdef` struct with a single parameter field and no default value**. `@parameterized` has a buggy
interaction with `@kwdef` in this corner case:
```julia
@parameterized @kwdef struct Foo{T}
@param x::T
end
```
where the auto-generated constructors erroneously duplicate `T` as a function and type parameter. This is, however,
a fairly meaningless corner-case since there is no purpose in marking this struct as `@kwdef` if no default assignments
are made!If you encounter any other weird interactions or behaviors, please raise an issue.