Function and type index
Core.Type
— MethodGenerator function pulling the resolution information from spectral_grid
.
Core.Type
— MethodGenerator function pulling the resolution information from spectral_grid
for all Orography <: AbstractOrography.
SpeedyWeather.AbstractDevice
— Typeabstract type AbstractDevice
Supertype of all devices SpeedyWeather.jl can run on
SpeedyWeather.AbstractLandSeaMask
— TypeAbstract super type for land-sea masks. Custom land-sea masks have to be defined as
CustomMask{NF<:AbstractFloat, Grid<:AbstractGrid{NF}} <: AbstractLandSeaMask{NF, Grid}
and need to have at least a field called mask::Grid
that uses a Grid
as defined by the spectral grid object, so of correct size and with the number format NF
. All AbstractLandSeaMask
have a convenient generator function to be used like mask = CustomMask(spectral_grid, option=argument)
, but you may add your own or customize by defining CustomMask(args...)
which should return an instance of type CustomMask{NF, Grid}
with parameters matching the spectral grid. Then the initialize function has to be extended for that new mask
initialize!(mask::CustomMask, model::PrimitiveEquation)
which generally is used to tweak the mask.mask grid as you like, using any other options you have included in CustomMask
as fields or anything else (preferrably read-only, because this is only to initialize the land-sea mask, nothing else) from model
. You can for example read something from file, set some values manually, or use coordinates from model.geometry
.
The land-sea mask grid is expected to have values between [0, 1] as we use a fractional mask, allowing for grid points being, e.g. quarter land and three quarters sea for 0.25 with 0 (=sea) and 1 (=land). The surface fluxes will weight proportionally the fluxes e.g. from sea and land surface temperatures. Note however, that the land-sea mask can declare grid points being (at least partially) ocean even though the sea surface temperatures aren't defined (=NaN) in that grid point. In that case, not flux is applied.
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 <: AbstractOcean
and can have parameters like CustomOceanModel{T} and fields. They need to extend the following functions
function initialize!(ocean_model::CustomOceanModel, model::PrimitiveEquation)
# your code here to initialize the ocean model itself
# you can use other fields from model, e.g. model.geometry
end
function initialize!(
ocean::PrognosticVariablesOcean,
time::DateTime,
ocean_model::CustomOceanModel,
model::PrimitiveEquation,
)
# your code here to initialize the prognostic variables for the ocean
# namely, ocean.sea_surface_temperature, ocean.sea_ice_concentration, e.g.
# ocean.sea_surface_temperature .= 300 # 300K everywhere
end
function ocean_timestep!(
ocean::PrognosticVariablesOcean,
time::DateTime,
ocean_model::CustomOceanModel,
)
# your code here to change the ocean.sea_surface_temperature and/or
# ocean.sea_ice_concentration on any timestep
end
Temperatures in ocean.seasurfacetemperature have units of Kelvin, or NaN for no ocean. Note that neither sea surface temperature, land-sea mask or orography have to agree. It is possible to have an ocean on top of a mountain. For an ocean grid-cell that is (partially) masked by the land-sea mask, its value will be (fractionally) ignored in the calculation of surface fluxes (potentially leading to a zero flux depending on land surface temperatures). For an ocean grid-cell that is NaN but not masked by the land-sea mask, its value is always ignored.
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
nlat::Int64
: Number of latitude ringstemp_equator::Any
: [OPTION] Temperature on the Equator [K]temp_poles::Any
: [OPTION] Temperature at the poles [K]temp_lat::Vector
: Latitudinal temperature profile [K]
SpeedyWeather.AquaPlanetMask
— TypeLand-sea mask with zero = sea everywhere.
mask::AbstractGrid{NF} where NF<:AbstractFloat
: Land-sea mask [1] on grid-point space. Land=1, sea=0, land-area fraction in between.
SpeedyWeather.BarotropicModel
— TypeThe BarotropicModel contains all model components needed for the simulation of the barotropic vorticity equations. To be constructed like
model = BarotropicModel(spectral_grid; kwargs...)
with spectral_grid::SpectralGrid
used to initalize all non-default components passed on as keyword arguments, e.g. planet=Earth(spectral_grid)
. Fields, representing model components, are
spectral_grid::SpectralGrid
device_setup::Any
geometry::Any
planet::Any
atmosphere::Any
coriolis::Any
forcing::Any
drag::Any
particle_advection::Any
initial_conditions::Any
random_process::Any
time_stepping::Any
spectral_transform::Any
implicit::Any
horizontal_diffusion::Any
output::Any
callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}
feedback::Any
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.CPU
— TypeCPU <: AbstractDevice
Indicates that SpeedyWeather.jl runs on a single CPU
SpeedyWeather.ClausiusClapeyron
— TypeParameters for computing saturation vapour pressure of water using the Clausis-Clapeyron equation,
e(T) = e₀ * exp( -Lᵥ/Rᵥ * (1/T - 1/T₀)),
where T is in Kelvin, Lᵥ the the latent heat of condensation and Rᵥ the gas constant of water vapour
e₀::AbstractFloat
: Saturation water vapour pressure at 0°C [Pa]T₀::AbstractFloat
: 0°C in KelvinLᵥ::AbstractFloat
: Latent heat of condensation/vaporization of water [J/kg]cₚ::AbstractFloat
: Specific heat at constant pressure [J/K/kg]R_vapour::AbstractFloat
: Gas constant of water vapour [J/kg/K]R_dry::AbstractFloat
: Gas constant of dry air [J/kg/K]Lᵥ_Rᵥ::AbstractFloat
: Latent heat of condensation divided by gas constant of water vapour [K]T₀⁻¹::AbstractFloat
: Inverse of T₀, one over 0°C in Kelvinmol_ratio::AbstractFloat
: Ratio of molecular masses [1] of water vapour over dry air (=Rdry/Rvapour).
SpeedyWeather.ClausiusClapeyron
— MethodFunctor: Saturation water vapour pressure as a function of temperature using the Clausius-Clapeyron equation,
e(T) = e₀ * exp( -Lᵥ/Rᵥ * (1/T - 1/T₀)),
where T is in Kelvin, Lᵥ the the latent heat of vaporization and Rᵥ the gas constant of water vapour, T₀ is 0˚C in Kelvin.
SpeedyWeather.Clock
— TypeClock struct keeps track of the model time, how many days to integrate for and how many time steps this takes
time::DateTime
: current model timestart::DateTime
: start time of simulationperiod::Second
: period to integrate for, set in set_period!(::Clock, ::Dates.Period)timestep_counter::Int64
: Counting all time steps during simulationn_timesteps::Int64
: number of time steps to integrate for, set in initialize!(::Clock, ::AbstractTimeStepper)Δt::Dates.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::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::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::Int64
ij::Int64
jring::Int64
lond::AbstractFloat
latd::AbstractFloat
land_fraction::AbstractFloat
orography::AbstractFloat
u::Vector{NF} where NF<:AbstractFloat
v::Vector{NF} where NF<:AbstractFloat
temp::Vector{NF} where NF<:AbstractFloat
humid::Vector{NF} where NF<:AbstractFloat
ln_pres::Vector{NF} where NF<:AbstractFloat
pres::Vector{NF} where NF<:AbstractFloat
u_tend::Vector{NF} where NF<:AbstractFloat
v_tend::Vector{NF} where NF<:AbstractFloat
temp_tend::Vector{NF} where NF<:AbstractFloat
humid_tend::Vector{NF} where NF<:AbstractFloat
flux_u_upward::Vector{NF} where NF<:AbstractFloat
flux_u_downward::Vector{NF} where NF<:AbstractFloat
flux_v_upward::Vector{NF} where NF<:AbstractFloat
flux_v_downward::Vector{NF} where NF<:AbstractFloat
flux_temp_upward::Vector{NF} where NF<:AbstractFloat
flux_temp_downward::Vector{NF} where NF<:AbstractFloat
flux_humid_upward::Vector{NF} where NF<:AbstractFloat
flux_humid_downward::Vector{NF} where NF<:AbstractFloat
random_value::AbstractFloat
boundary_layer_depth::Int64
boundary_layer_drag::AbstractFloat
surface_geopotential::AbstractFloat
surface_u::AbstractFloat
surface_v::AbstractFloat
surface_temp::AbstractFloat
surface_humid::AbstractFloat
surface_wind_speed::AbstractFloat
skin_temperature_sea::AbstractFloat
skin_temperature_land::AbstractFloat
soil_moisture_availability::AbstractFloat
surface_air_density::AbstractFloat
sat_humid::Vector{NF} where NF<:AbstractFloat
dry_static_energy::Vector{NF} where NF<:AbstractFloat
temp_virt::Vector{NF} where NF<:AbstractFloat
geopot::Vector{NF} where NF<:AbstractFloat
cloud_top::Int64
precip_convection::AbstractFloat
precip_large_scale::AbstractFloat
cos_zenith::AbstractFloat
albedo::AbstractFloat
a::Vector{NF} where NF<:AbstractFloat
b::Vector{NF} where NF<:AbstractFloat
c::Vector{NF} where NF<:AbstractFloat
d::Vector{NF} where NF<:AbstractFloat
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.ConvectivePrecipitationOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
rate::SpeedyWeather.AbstractOutputVariable
SpeedyWeather.ConvectivePrecipitationRateOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
SpeedyWeather.DeviceSetup
— TypeHolds information about the device the model is running on and workgroup size.
device::SpeedyWeather.AbstractDevice
: ::AbstractDevice, device the model is running on.device_KA::Any
: ::KernelAbstractions.Device, device for use with KernelAbstractionsn::Int64
: workgroup size
SpeedyWeather.DiagnosticVariables
— TypeAll diagnostic variables.
trunc::Int64
: Spectral resolution: Max degree of spherical harmonics (0-based)nlat_half::Int64
: Grid resoltion: Number of latitude rings on one hemisphere (Equator incl.)nlayers::Int64
: Number of vertical 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{NF, ArrayType, ParticleVector, VectorNF, Grid} where {NF, ArrayType, Grid, ParticleVector, VectorNF}
: Intermediate variables for the particle advectioncolumns::Array{ColumnVariables{NF}, 1} where NF
: 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) -> DiagnosticVariables
Generator function.
SpeedyWeather.DivergenceOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
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
nlayers::Int64
: number of vertical layers/levelstime_scale::Second
: [OPTION] Relaxation time for profile adjustment
SpeedyWeather.DynamicsVariables
— TypeIntermediate quantities for the dynamics of a given layer.
trunc::Int64
nlat_half::Int64
nlayers::Int64
a::Any
: Multi-purpose a, 3D work array to be reused in various 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], spectral
SpeedyWeather.DynamicsVariables
— MethodDynamicsVariables(
SG::SpectralGrid
) -> DynamicsVariables{<:AbstractFloat, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray}
Generator function.
SpeedyWeather.Earth
— TypeCreate a struct Earth<:AbstractPlanet
, with the following physical/orbital characteristics. Note that radius
is not part of it as this should be chosen in SpectralGrid
. Keyword arguments are
rotation::AbstractFloat
: angular frequency of Earth's rotation [rad/s]gravity::AbstractFloat
: gravitational acceleration [m/s^2]daily_cycle::Bool
: switch on/off daily cyclelength_of_day::Second
: Seconds in a daily rotationseasonal_cycle::Bool
: switch on/off seasonal cyclelength_of_year::Second
: Seconds in an orbit around the sunequinox::DateTime
: time of spring equinox (year irrelevant)axial_tilt::AbstractFloat
: angle [˚] rotation axis tilt wrt to orbitsolar_constant::AbstractFloat
: Total solar irradiance at the distance of 1 AU [W/m²]
SpeedyWeather.EarthAtmosphere
— TypeCreate a struct EarthAtmosphere <: AbstractAtmosphere
, with the following physical/chemical characteristics. Keyword arguments are
mol_mass_dry_air::AbstractFloat
: molar mass of dry air [g/mol]mol_mass_vapour::AbstractFloat
: molar mass of water vapour [g/mol]heat_capacity::AbstractFloat
: specific heat at constant pressure cₚ [J/K/kg]R_gas::AbstractFloat
: universal gas constant [J/K/mol]R_dry::AbstractFloat
: specific gas constant for dry air [J/kg/K]R_vapour::AbstractFloat
: specific gas constant for water vapour [J/kg/K]mol_ratio::AbstractFloat
: Ratio of gas constants: dry air / water vapour, often called ε [1]μ_virt_temp::AbstractFloat
: Virtual temperature Tᵥ calculation, Tᵥ = T(1 + μ*q), humidity q, absolute tempereature Tκ::AbstractFloat
: = R_dry/cₚ, gas const for air over heat capacitywater_density::AbstractFloat
: water density [kg/m³]latent_heat_condensation::AbstractFloat
: latent heat of condensation [J/kg] for consistency with specific humidity [kg/kg]latent_heat_sublimation::AbstractFloat
: latent heat of sublimation [J/kg]stefan_boltzmann::AbstractFloat
: stefan-Boltzmann constant [W/m²/K⁴]pres_ref::AbstractFloat
: surface reference pressure [Pa]temp_ref::AbstractFloat
: surface reference temperature [K]moist_lapse_rate::AbstractFloat
: reference moist-adiabatic temperature lapse rate [K/m]dry_lapse_rate::AbstractFloat
: reference dry-adiabatic temperature lapse rate [K/m]layer_thickness::AbstractFloat
: layer thickness for the shallow water model [m]
SpeedyWeather.EarthOrography
— TypeEarth's orography read from file, with smoothing.
path::String
: path to the folder containing the orography file, pkg path defaultfile::String
: filename of orographyfile_Grid::Type{<:AbstractGrid}
: Grid the orography file comes onscale::Float64
: scale orography by a factorsmoothing::Bool
: smooth the orography field?smoothing_power::Float64
: power of Laplacian for smoothingsmoothing_strength::Float64
: highest degree l is multiplied bysmoothing_fraction::Float64
: fraction of highest wavenumbers to smoothorography::AbstractGrid{NF} where NF<:AbstractFloat
: height [m] on grid-point space.geopot_surf::LowerTriangularArray{Complex{NF}, 1, Array{Complex{NF}, 1}} where NF<:AbstractFloat
: surface geopotential, height*gravity [m²/s²]
SpeedyWeather.Feedback
— TypeFeedback struct that contains options and object for command-line feedback like the progress meter.
verbose::Bool
: print feedback to REPL?, default is isinteractive(), true in interactive REPL modedebug::Bool
: check for NaRs in the prognostic variablesoutput::Bool
: write a progress.txt file? State synced with NetCDFOutput.outputid::String
: identification of run, taken from ::OutputWriterrun_path::String
: path to run folder, taken from ::OutputWriterprogress_meter::ProgressMeter.Progress
: struct containing everything progress relatedprogress_txt::Union{Nothing, IOStream}
: txt is a Nothing in case of no outputnars_detected::Bool
: did Infs/NaNs occur in the simulation?
SpeedyWeather.GPU
— TypeGPU <: AbstractDevice
Indicates that SpeedyWeather.jl runs on a single GPU
SpeedyWeather.Geometry
— TypeConstruct Geometry struct containing parameters and arrays describing an iso-latitude grid <:AbstractGrid and the vertical levels. Pass on SpectralGrid
to calculate the following fields
spectral_grid::SpectralGrid
: SpectralGrid that defines spectral and grid 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)nlon::Int64
: =nlon_max, same (used for compatibility), TODO: still needed?nlat::Int64
: number of latitude ringsnlayers::Int64
: number of vertical levelsnpoints::Int64
: total number of horizontal grid pointsradius::AbstractFloat
: Planet's radius [m]colat::Vector{Float64}
: array of colatitudes in radians (0...π)lat::Vector{NF} where NF<:AbstractFloat
: array of latitudes in radians (π...-π)latd::Vector{Float64}
: array of latitudes in degrees (90˚...-90˚)lond::Vector{Float64}
: array of longitudes in degrees (0...360˚), empty for non-full gridslonds::Vector{NF} where NF<:AbstractFloat
: longitude (0˚...360˚) for each grid point in ring orderlatds::Vector{NF} where NF<:AbstractFloat
: latitude (-90˚...˚90) for each grid point in ring orderlons::Vector{NF} where NF<:AbstractFloat
: longitude (0...2π) for each grid point in ring orderlats::Vector{NF} where NF<:AbstractFloat
: latitude (-π/2...π/2) for each grid point in ring ordersinlat::Vector{NF} where NF<:AbstractFloat
: sin of latitudescoslat::Vector{NF} where NF<:AbstractFloat
: cos of latitudescoslat⁻¹::Vector{NF} where NF<:AbstractFloat
: = 1/cos(lat)coslat²::Vector{NF} where NF<:AbstractFloat
: = cos²(lat)coslat⁻²::Vector{NF} where NF<:AbstractFloat
: # = 1/cos²(lat)σ_levels_half::Vector{NF} where NF<:AbstractFloat
: σ at half levels, σ_k+1/2σ_levels_full::Vector{NF} where NF<:AbstractFloat
: σ at full levels, σₖσ_levels_thick::Vector{NF} where NF<:AbstractFloat
: σ level thicknesses, σₖ₊₁ - σₖln_σ_levels_full::Vector{NF} where NF<:AbstractFloat
: log of σ at full levels, include surface (σ=1) as last elementfull_to_half_interpolation::Vector{NF} where NF<:AbstractFloat
: Full to half levels interpolation
SpeedyWeather.Geometry
— MethodGeometry(SG::SpectralGrid) -> Geometry
Generator function for Geometry
struct based on spectral_grid
.
SpeedyWeather.GlobalSurfaceTemperatureCallback
— TypeCallback that records the global mean surface temperature on every time step
timestep_counter::Int64
temp::Vector
.
SpeedyWeather.GridVariables
— TypeTransformed prognostic variables (and u, v, temp_virt) into grid-point space.
nlat_half::Int64
nlayers::Int64
vor_grid::Any
: Relative vorticity of the horizontal wind [1/s]div_grid::Any
: Divergence of the horizontal wind [1/s]temp_grid::Any
: Absolute temperature [K]temp_virt_grid::Any
: Virtual tempereature [K]humid_grid::Any
: Specific_humidity [kg/kg]u_grid::Any
: Zonal velocity [m/s]v_grid::Any
: Meridional velocity [m/s]pres_grid::Any
: Logarithm of surface pressure [Pa]random_pattern::Any
: Random pattern controlled by random process [1]temp_grid_prev::Any
: Absolute temperature [K] at previous time 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 step
.
SpeedyWeather.GridVariables
— MethodGridVariables(
SG::SpectralGrid
) -> GridVariables{<:AbstractFloat, <:AbstractArray, <:AbstractArray, <:AbstractArray}
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<:AbstractFloat
p₀::Base.RefValue{NF} where NF<:AbstractFloat
temp_relax_freq::Matrix{NF} where NF<:AbstractFloat
temp_equil_a::Vector{NF} where NF<:AbstractFloat
temp_equil_b::Vector{NF} where NF<:AbstractFloat
SpeedyWeather.HeldSuarez
— MethodHeldSuarez(SG::SpectralGrid; kwargs...) -> HeldSuarez
create a HeldSuarez temperature relaxation with arrays allocated given spectral_grid
SpeedyWeather.HumidityOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
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::Any
impl::Any
expl_div::Any
impl_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 as with implicit precipitation.
relative_humidity_threshold::AbstractFloat
: Relative humidity threshold [1 = 100%] to trigger condensationtime_scale::AbstractFloat
: 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α::AbstractFloat
: time-step coefficient: 0=explicit, 0.5=centred implicit, 1=backward implicittemp_profile::Vector{NF} where NF<:AbstractFloat
: vertical temperature profile, obtained from diagn on first time stepξ::Base.RefValue{NF} where NF<:AbstractFloat
: time step 2α*Δt packed in RefValue for mutabilityR::Matrix{NF} where NF<:AbstractFloat
: divergence: operator for the geopotential calculationU::Vector{NF} where NF<:AbstractFloat
: divergence: the -RdTₖ∇² term excl the eigenvalues from ∇² for divergenceL::Matrix{NF} where NF<:AbstractFloat
: temperature: operator for the TₖD + κTₖDlnps/Dt termW::Vector{NF} where NF<:AbstractFloat
: pressure: vertical averaging of the -D̄ term in the log surface pres equationL0::Vector{NF} where NF<:AbstractFloat
: components to construct L, 1/ 2ΔσL1::Matrix{NF} where NF<:AbstractFloat
: vert advection term in the temperature equation (below+above)L2::Vector{NF} where NF<:AbstractFloat
: factor in front of the divsumabove termL3::Matrix{NF} where NF<:AbstractFloat
: sumabove operator itselfL4::Vector{NF} where NF<:AbstractFloat
: factor in front of div term in Dlnps/DtS::Matrix{NF} where NF<:AbstractFloat
: for every l the matrix to be invertedS⁻¹::Array{NF, 3} where NF<:AbstractFloat
: combined inverted operator: S = 1 - ξ²(RL + UW)
SpeedyWeather.ImplicitPrimitiveEquation
— MethodImplicitPrimitiveEquation(
spectral_grid::SpectralGrid,
kwargs...
) -> ImplicitPrimitiveEquation
Generator using the resolution from SpectralGrid.
SpeedyWeather.ImplicitShallowWater
— TypeStruct that holds various precomputed arrays for the semi-implicit correction to prevent gravity waves from amplifying in the shallow water model.
trunc::Int64
α::AbstractFloat
: [OPTION] coefficient for semi-implicit computations to filter gravity waves, 0.5 <= α <= 1H::Base.RefValue{NF} where NF<:AbstractFloat
ξH::Base.RefValue{NF} where NF<:AbstractFloat
g∇²::Vector{NF} where NF<:AbstractFloat
ξg∇²::Vector{NF} where NF<:AbstractFloat
S⁻¹::Vector{NF} where NF<:AbstractFloat
SpeedyWeather.ImplicitShallowWater
— MethodImplicitShallowWater(
spectral_grid::SpectralGrid;
kwargs...
) -> ImplicitShallowWater
Generator using the resolution from spectral_grid
.
SpeedyWeather.InterfaceDisplacementOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
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
: Radiative forcing constant (W/m²/K²)temp_tropopause::Any
: Tropopause temperature [K]time_scale::Second
: 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::Vector
: precomputed amplitude vector [m/s²]tapering::Vector
: precomputed vertical tapering
SpeedyWeather.LandSeaMask
— TypeLand-sea mask, fractional, read from file.
path::String
: path to the folder containing the land-sea mask file, pkg path defaultfile::String
: filename of land sea maskfile_Grid::Type{<:AbstractGrid}
: Grid the land-sea mask file comes onmask::AbstractGrid{NF} where NF<:AbstractFloat
: Land-sea mask [1] on grid-point space. Land=1, sea=0, land-area fraction in between.
SpeedyWeather.LargeScalePrecipitationOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
rate::SpeedyWeather.AbstractOutputVariable
SpeedyWeather.LargeScalePrecipitationRateOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
SpeedyWeather.Leapfrog
— TypeLeapfrog time stepping defined by the following fields
trunc::Int64
: spectral resolution (max degree of spherical harmonics)nsteps::Int64
: Number of timesteps stored simultaneously in prognostic variablesΔt_at_T31::Second
: Time step in minutes for T31, scale linearly totrunc
radius::AbstractFloat
: Radius of sphere [m], used for scalingadjust_with_output::Bool
: Adjust ΔtatT31 with the outputdt to reach outputdt exactly in integer time stepsrobert_filter::AbstractFloat
: Robert (1966) time filter coefficeint to suppress comput. modewilliams_filter::AbstractFloat
: Williams time filter (Amezcua 2011) coefficient for 3rd order accΔt_millisec::Dates.Millisecond
: time step Δt [ms] at specified resolutionΔt_sec::AbstractFloat
: time step Δt [s] at specified resolutionΔt::AbstractFloat
: time step Δt [s/m] at specified resolution, scaled by 1/radius
SpeedyWeather.Leapfrog
— MethodLeapfrog(spectral_grid::SpectralGrid; kwargs...) -> Leapfrog
Generator function for a Leapfrog struct using spectral_grid
for the resolution information.
SpeedyWeather.LinearDrag
— TypeLinear boundary layer drag following Held and Suarez, 1996 BAMS
nlayers::Int64
σb::AbstractFloat
time_scale::Second
drag_coefs::Vector{NF} where NF<:AbstractFloat
SpeedyWeather.LinearDrag
— MethodLinearDrag(SG::SpectralGrid; kwargs...) -> LinearDrag
Generator function using nlayers
from SG::SpectralGrid
SpeedyWeather.MeridionalVelocityOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
SpeedyWeather.NetCDFOutput
— TypeNetCDFOutput(
S::SpectralGrid;
...
) -> NetCDFOutput{_A, _B, Interpolator} where {_A, _B, Interpolator<:(AnvilInterpolator{Float32})}
NetCDFOutput(
S::SpectralGrid,
Model::Type{<:AbstractModel};
output_Grid,
nlat_half,
output_NF,
output_dt,
kwargs...
) -> NetCDFOutput{_A, _B, Interpolator} where {_A, _B, Interpolator<:(AnvilInterpolator{Float32})}
Constructor for NetCDFOutput based on S::SpectralGrid
and optionally the Model
type (e.g. ShallowWater
, PrimitiveWet
) as second positional argument. The output grid is optionally determined by keyword arguments output_Grid
(its type, full grid required), nlat_half
(resolution) and output_NF
(number format). By default, uses the full grid equivalent of the grid and resolution used in SpectralGrid
S
.
SpeedyWeather.NetCDFOutput
— TypeOutput writer for a netCDF file with (re-)gridded variables. Interpolates non-rectangular grids. Fields are
active::Bool
path::String
: [OPTION] path to output folder, run_???? will be created withinid::String
: [OPTION] run identification number/stringrun_path::String
filename::String
: [OPTION] name of the output netcdf filewrite_restart::Bool
: [OPTION] also write restart file if output==true?pkg_version::VersionNumber
startdate::DateTime
output_dt::Second
: [OPTION] output frequency, time stepvariables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable}
: [OPTION] dictionary of variables to output, e.g. u, v, vor, div, pres, temp, humidoutput_every_n_steps::Int64
timestep_counter::Int64
output_counter::Int64
netcdf_file::Union{Nothing, NCDatasets.NCDataset}
interpolator::Any
grid2D::Any
grid3D::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::AbstractGrid{NF} where NF<:AbstractFloat
: height [m] on grid-point space.geopot_surf::LowerTriangularArray{Complex{NF}, 1, Array{Complex{NF}, 1}} where NF<:AbstractFloat
: surface geopotential, height*gravity [m²/s²]
SpeedyWeather.NoOutputVariable
— TypeDummy output variable that doesn't do anything.
SpeedyWeather.NoRandomProcess
— TypeDummy type for no random process.
SpeedyWeather.OrographyOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
SpeedyWeather.Particle
— TypeParticle with location lon (longitude), lat (latitude) and σ (vertical coordinate). Longitude is assumed to be in [0,360˚E), latitude in [-90˚,90˚N] and σ in [0,1] but not strictly enforced at creation, see mod(::Particle)
and ismod(::Particle)
. A particle is either active or inactive, determined by the Boolean in it's 2nd type parameter. By default, a particle is active, of number format DEFAULT_NF and at 0˚N, 0˚E, σ=0.
lon::AbstractFloat
: longitude in [0,360˚]lat::AbstractFloat
: latitude [-90˚,90˚]σ::AbstractFloat
: vertical sigma coordinate [0 (top) to 1 (surface)]
SpeedyWeather.ParticleTracker
— TypeA ParticleTracker is implemented as a callback to output the trajectories of particles from particle advection. To be added like
add!(model.callbacks, ParticleTracker(spectral_grid; kwargs...))
Output done via netCDF. Fields and options are
schedule::Schedule
: [OPTION] when to schedule particle trackingfile_name::String
: [OPTION] File name for netCDF filecompression_level::Int64
: [OPTION] lossless compression level; 1=low but fast, 9=high but slowshuffle::Bool
: [OPTION] shuffle/bittranspose filter for compressionkeepbits::Int64
: [OPTION] mantissa bits to keep, (14, 15, 16) means at least (2km, 1km, 500m) accurate locationsnparticles::Int64
: Number of particles to tracknetcdf_file::Union{Nothing, NCDatasets.NCDataset}
: The netcdf file to be written into, will be created at initializationlon::Vector
lat::Vector
σ::Vector
SpeedyWeather.ParticleVariables
— TypeDiagnostic variables for the particle advection
nparticles::Int64
: Number of particlesnlat_half::Int64
: Number of latitudes on one hemisphere (Eq. incld.), resolution parameter of Gridlocations::Any
: Work array: particle locationsu::Any
: Work array: velocity uv::Any
: Work array: velocity vσ_tend::Any
: Work array: velocity w = dσ/dtinterpolator::AnvilInterpolator{NF, Grid} where {NF, Grid}
: Interpolator to interpolate velocity fields onto particle positions
SpeedyWeather.ParticleVariables
— MethodParticleVariables(
SG::SpectralGrid
) -> ParticleVariables{var"#s250", var"#s158", var"#s146", _A, <:AbstractGrid} where {var"#s250"<:AbstractFloat, var"#s158"<:AbstractArray, var"#s146"<:AbstractArray, _A}
Generator function.
SpeedyWeather.PhysicsVariables
— TypeDiagnostic variables of the physical parameterizations.
nlat_half::Int64
precip_large_scale::Any
: Accumulated large-scale precipitation [m]precip_convection::Any
: Accumulated large-scale precipitation [m]cloud_top::Any
: Cloud top [m]soil_moisture_availability::Any
: Availability of soil moisture to evaporation [1]cos_zenith::Any
: Cosine of solar zenith angle [1]
SpeedyWeather.PhysicsVariables
— MethodPhysicsVariables(
SG::SpectralGrid
) -> PhysicsVariables{<:AbstractFloat, <:AbstractArray, <:AbstractArray}
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::SpectralGrid
device_setup::Any
dynamics::Bool
geometry::Any
planet::Any
atmosphere::Any
coriolis::Any
geopotential::Any
adiabatic_conversion::Any
particle_advection::Any
initial_conditions::Any
random_process::Any
orography::Any
land_sea_mask::Any
ocean::Any
land::Any
solar_zenith::Any
albedo::Any
physics::Bool
boundary_layer_drag::Any
temperature_relaxation::Any
vertical_diffusion::Any
surface_thermodynamics::Any
surface_wind::Any
surface_heat_flux::Any
convection::Any
shortwave_radiation::Any
longwave_radiation::Any
time_stepping::Any
spectral_transform::Any
implicit::Any
horizontal_diffusion::Any
vertical_advection::Any
output::Any
callbacks::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::SpectralGrid
device_setup::Any
dynamics::Bool
geometry::Any
planet::Any
atmosphere::Any
coriolis::Any
geopotential::Any
adiabatic_conversion::Any
particle_advection::Any
initial_conditions::Any
random_process::Any
orography::Any
land_sea_mask::Any
ocean::Any
land::Any
solar_zenith::Any
albedo::Any
soil::Any
vegetation::Any
physics::Bool
clausius_clapeyron::Any
boundary_layer_drag::Any
temperature_relaxation::Any
vertical_diffusion::Any
surface_thermodynamics::Any
surface_wind::Any
surface_heat_flux::Any
surface_evaporation::Any
large_scale_condensation::Any
convection::Any
shortwave_radiation::Any
longwave_radiation::Any
time_stepping::Any
spectral_transform::Any
implicit::Any
horizontal_diffusion::Any
vertical_advection::Any
hole_filling::Any
output::Any
callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}
feedback::Any
SpeedyWeather.PrognosticVariables
— MethodPrognosticVariables(
SG::SpectralGrid,
model::AbstractModel
) -> PrognosticVariables{var"#s250", var"#s158", _A, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray} where {var"#s250"<:AbstractFloat, var"#s158"<:AbstractArray, _A}
Generator function.
SpeedyWeather.PrognosticVariables
— MethodPrognosticVariables(
SG::SpectralGrid;
nsteps
) -> PrognosticVariables{var"#s250", var"#s158", _A, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray} where {var"#s250"<:AbstractFloat, var"#s158"<:AbstractArray, _A}
Generator function.
SpeedyWeather.RandomPatternOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
SpeedyWeather.RandomWaves
— TypeParameters for random initial conditions for the interface displacement η in the shallow water equations.
A::Float64
lmin::Int64
lmax::Int64
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
ω::Float64
K::Float64
c::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
end
see also initialize!(::Schedule,::Clock) and isscheduled(::Schedule,::Clock). Fields
every::Second
: [OPTION] Execute every time period, first timestep excluded. Default=never.times::Vector{DateTime}
: [OPTION] Events scheduled at 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.SeasonalOceanClimatology
— TypeSeasonal ocean climatology that reads monthly sea surface temperature fields from file, and interpolates them in time regularly (default every 3 days) to be stored in the prognostic variables. Fields and options are
nlat_half::Int64
: number of latitudes on one hemisphere, Equator includedΔt::Day
: [OPTION] Time step used to update sea surface temperaturespath::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::Vector{Grid} where {NF, Grid<:AbstractGrid{NF}}
: 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::SpectralGrid
device_setup::Any
geometry::Any
planet::Any
atmosphere::Any
coriolis::Any
orography::Any
forcing::Any
drag::Any
particle_advection::Any
initial_conditions::Any
random_process::Any
time_stepping::Any
spectral_transform::Any
implicit::Any
horizontal_diffusion::Any
output::Any
callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}
feedback::Any
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
nlayers::Int64
: number of vertical layerstime_scale::Second
: [OPTION] Relaxation time for profile adjustmentrelative_humidity::Any
: [OPTION] Relative humidity for reference profile
SpeedyWeather.Simulation
— TypeSimulation is a container struct to be used with run!(::Simulation)
. It contains
prognostic_variables::PrognosticVariables
: define the current state of the modeldiagnostic_variables::DiagnosticVariables
: contain the tendencies and auxiliary arrays to compute themmodel::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::Any
equinox::DateTime
length_of_year::Second
length_of_day::Second
SpeedyWeather.SinSolarDeclination
— MethodSinSolarDeclination functor, computing the solar declination angle of angular fraction of year g [radians] using the coefficients of the SinSolarDeclination struct.
SpeedyWeather.SinSolarDeclination
— MethodGenerator function using the planet's orbital parameters to adapt the solar declination calculation.
SpeedyWeather.SinSolarDeclination
— MethodGenerator function pulling the number format NF from a SpectralGrid.
SpeedyWeather.SolarDeclination
— TypeCoefficients to calculate the solar declination angle δ from
δ = 0.006918 - 0.399912*cos(g) + 0.070257*sin(g)
- 0.006758*cos(2g) + 0.000907*sin(2g)
- 0.002697*cos(3g) + 0.001480*sin(3g)
with g the angular fraction of the year in radians. Following Spencer 1971, Fourier series representation of the position of the sun. Search 2(5):172.
a::AbstractFloat
s1::AbstractFloat
c1::AbstractFloat
s2::AbstractFloat
c2::AbstractFloat
s3::AbstractFloat
c3::AbstractFloat
SpeedyWeather.SolarDeclination
— MethodSolarDeclination functor, computing the solar declination angle of angular fraction of year g [radians] using the coefficients of the SolarDeclination struct.
SpeedyWeather.SolarDeclination
— MethodGenerator function pulling the number format NF from a SpectralGrid.
SpeedyWeather.SolarTimeCorrection
— TypeCoefficients for the solar time correction (also called Equation of time) which adjusts the solar hour to an oscillation of sunrise/set by about +-16min throughout the year.
SpeedyWeather.SolarTimeCorrection
— MethodFunctor that returns the time correction for a angular fraction of the year g [radians], so that g=0 for Jan-01 and g=2π for Dec-31.
SpeedyWeather.SolarZenith
— TypeSolar zenith angle varying with daily and seasonal cycle.
length_of_day::Second
length_of_year::Second
equation_of_time::Bool
seasonal_cycle::Bool
solar_declination::SpeedyWeather.SinSolarDeclination{NF} where NF<:AbstractFloat
time_correction::SpeedyWeather.SolarTimeCorrection
initial_time::Base.RefValue{DateTime}
SpeedyWeather.SolarZenithSeason
— TypeSolar zenith angle varying with seasonal cycle only.
length_of_day::Second
length_of_year::Second
seasonal_cycle::Bool
solar_declination::SpeedyWeather.SinSolarDeclination{NF} where NF<:AbstractFloat
initial_time::Base.RefValue{DateTime}
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::Int64
time_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 seedrandom_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::Vector
: Precomputed noise factors [1] for evert 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::Any
impl::Any
expl_div::Any
impl_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 modeldevice::SpeedyWeather.AbstractDevice
: [OPTION] device archictecture to run onArrayType::Type{<:AbstractArray}
: [OPTION] array type to use for all variablestrunc::Int64
: [OPTION] horizontal resolution as the maximum degree of spherical harmonicsGrid::Type{<:AbstractGrid}
: [OPTION] horizontal grid used for calculations in grid-point spacedealiasing::Float64
: [OPTION] how to match spectral with grid resolution: dealiasing factor, 1=linear, 2=quadratic, 3=cubic gridradius::Float64
: [OPTION] radius of the sphere [m]nparticles::Int64
: [OPTION] number of particles for particle advection [1]nlat_half::Int64
: number of latitude rings on one hemisphere (Equator incl)nlat::Int64
: number of latitude rings on both hemispheresnpoints::Int64
: total number of grid points in the horizontalnlayers::Int64
: [OPTION] number of vertical levelsvertical_coordinates::SpeedyWeather.VerticalCoordinates
: [OPTION] coordinates used to discretize the verticalSpectralVariable2D::Type{<:AbstractArray}
SpectralVariable3D::Type{<:AbstractArray}
SpectralVariable4D::Type{<:AbstractArray}
GridVariable2D::Type{<:AbstractArray}
GridVariable3D::Type{<:AbstractArray}
GridVariable4D::Type{<:AbstractArray}
ParticleVector::Type{<:AbstractArray}
nlat_half
and npoints
should not be chosen but are derived from trunc
, Grid
and dealiasing
.
SpeedyWeather.SpeedyTransforms.SpectralTransform
— MethodSpectralTransform(
spectral_grid::SpectralGrid;
one_more_degree,
kwargs...
) -> SpectralTransform{NF, _A, _B, _C, _D, _E, _F, LowerTriangularArray{NF1, 1, _A1}, LowerTriangularArray{NF2, 2, _A2}} where {NF<:AbstractFloat, _A, _B, _C, _D, _E, _F, NF1<:AbstractFloat, _A1, NF2<:AbstractFloat, _A2}
Generator function for a SpectralTransform struct pulling in parameters from a SpectralGrid struct.
SpeedyWeather.StartFromFile
— TypeRestart from a previous SpeedyWeather.jl simulation via the restart file restart.jld2 Applies interpolation in the horizontal but not in the vertical. restart.jld2 is identified by
path::String
: path for restart fileid::Union{Int64, String}
:run_id
of restart file inrun_????/restart.jld2
SpeedyWeather.StartWithRandomVorticity
— TypeStart with random vorticity as initial conditions
power::Float64
: Power of the spectral distribution k^poweramplitude::Float64
: (approximate) amplitude in [1/s], used as standard deviation of spherical harmonic coefficients
SpeedyWeather.SurfaceEvaporation
— TypeSurface evaporation following a bulk formula with wind from model.surface_wind
use_boundary_layer_drag::Bool
: Use column.boundarylayerdrag coefficientmoisture_exchange_land::AbstractFloat
: Otherwise, use the following drag coefficient for evaporation over landmoisture_exchange_sea::AbstractFloat
: Or drag coefficient for evaporation over sea
SpeedyWeather.SurfacePressureOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
SpeedyWeather.TemperatureOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
SpeedyWeather.Tendencies
— TypeTendencies of the prognostic variables in spectral and grid-point space
trunc::Int64
nlat_half::Int64
nlayers::Int64
vor_tend::Any
: Vorticity of horizontal wind field [1/s]div_tend::Any
: Divergence of horizontal wind field [1/s]temp_tend::Any
: Absolute temperature [K]humid_tend::Any
: Specific humidity [kg/kg]u_tend::Any
: Zonal velocity [m/s]v_tend::Any
: Meridional velocity [m/s]pres_tend::Any
: Logarithm of surface pressure [Pa]u_tend_grid::Any
: Zonal velocity [m/s], 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], grid
SpeedyWeather.Tendencies
— MethodTendencies(
SG::SpectralGrid
) -> Tendencies{<:AbstractFloat, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray, <:AbstractArray}
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.UniformCooling
— TypeUniform cooling following Pauluis and Garner, 2006. JAS. https://doi.org/10.1175/JAS3705.1 imposing a default temperature tendency of -1.5K/day (=1K/16hours for a time_scale
of 16 hours) on every level except for the stratosphere (diagnosed as temp < temp_min
) where a relaxation term with time_scale_stratosphere
towards temp_stratosphere
is applied.
dT/dt = -1.5K/day for T > 207.5K else (200K-T) / 5 days
Fields are
time_scale::Second
: [OPTION] time scale of cooling, default = -1.5K/day = -1K/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)
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)
.
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.
η₀::Float64
: conversion from σ to Jablonowski's ηᵥ-coordinatesu₀::Float64
: max amplitude of zonal wind [m/s] that scales orography heightorography::AbstractGrid{NF} where NF<:AbstractFloat
: height [m] on grid-point space.geopot_surf::LowerTriangularArray{Complex{NF}, 1, Array{Complex{NF}, 1}} where NF<:AbstractFloat
: surface geopotential, height*gravity [m²/s²]
SpeedyWeather.ZonalVelocityOutput
— TypeDefines netCDF output for a specific variables, see VorticityOutput
for details. Fields are
name::String
unit::String
long_name::String
dims_xyzt::NTuple{4, Bool}
missing_value::Float64
compression_level::Int64
shuffle::Bool
keepbits::Int64
SpeedyWeather.ZonalWind
— TypeCreate a struct that contains all parameters for the Jablonowski and Williamson, 2006 intitial conditions for the primitive equation model. Default values as in Jablonowski.
η₀::Float64
: conversion from σ to Jablonowski's ηᵥ-coordinatesu₀::Float64
: max amplitude of zonal wind [m/s]perturb_lat::Float64
: perturbation centred at [˚N]perturb_lon::Float64
: perturbation centred at [˚E]perturb_uₚ::Float64
: perturbation strength [m/s]perturb_radius::Float64
: radius of Gaussian perturbation in units of Earth's radius [1]
Base.copy!
— Methodcopy!(
progn_new::PrognosticVariables,
progn_old::PrognosticVariables
) -> 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.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) -> Any
Modulo operator for particle locations to map them back into [0,360˚E) and [-90˚,90˚N], in the horizontal and to clamp vertical σ coordinates into [0,1].
SpeedyWeather.CallbackDict
— MethodCallbackDict(
pairs::Pair{Symbol, <:SpeedyWeather.AbstractCallback}...
) -> Dict{Symbol, SpeedyWeather.AbstractCallback}
Create Callback dictionary like normal dictionaries.
SpeedyWeather.CallbackDict
— MethodCallbackDict(
) -> Dict{Symbol, SpeedyWeather.AbstractCallback}
Empty Callback dictionary generator.
SpeedyWeather.DeviceArray
— MethodDeviceArray(_::CPU, x) -> Any
Adapts x
to an Array
when device::CPU
is used. Define for CPU
for compatibility with adapt to CuArrays etc. Uses adapt
, thus also can return SubArrays etc.
SpeedyWeather.Device_KernelAbstractions
— MethodDevice_KernelAbstractions(
_::CPU
) -> Type{KernelAbstractions.CPU}
Return used device for use with KernelAbstractions
SpeedyWeather.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.
SpeedyWeather.SpeedyTransforms.transform!
— Methodtransform!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
random_process::NoRandomProcess,
spectral_transform::SpectralTransform
)
NoRandomProcess
does not need to transform any random pattern from spectral to grid space.
SpeedyWeather.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.
SpeedyWeather.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.
SpeedyWeather.SpeedyTransforms.transform!
— Methodtransform!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
lf::Integer,
random_process::SpeedyWeather.AbstractRandomProcess,
spectral_transform::SpectralTransform
)
General transform for random processes <: AbstractRandomProcess
. Takes the spectral random_pattern
in the prognostic variables and transforms it to spectral space in diagn.grid.random_pattern
.
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(
p::Particle{NF}
) -> Particle{_A, true} where _A<:AbstractFloat
Activate particle. Active particles can move.
SpeedyWeather.active
— Methodactive(_::Particle{NF, isactive}) -> Any
Check whether particle is active.
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...
)
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_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
) -> Vector{NF} where NF<:AbstractFloat
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.clip_negatives!
— Methodclip_negatives!(A::AbstractArray)
Set all negative entries a
in A
to zero.
SpeedyWeather.convection!
— Methodconvection!(
column::ColumnVariables{NF},
DBM::DryBettsMiller,
geometry::Geometry,
atmosphere::SpeedyWeather.AbstractAtmosphere
)
calculates temperature tendency for the dry convection scheme following the simplified Betts-Miller convection from Frierson 2007 but with zero humidity. Starts with a first-guess relaxation to determine the convective criterion, then adjusts the reference profiles for thermodynamic consistency (e.g. in dry convection the humidity profile is non-precipitating), and relaxes current vertical profiles to the adjusted references.
SpeedyWeather.convection!
— Methodconvection!(
column::ColumnVariables{NF},
SBM::SimplifiedBettsMiller,
clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron,
geometry::Geometry,
planet::SpeedyWeather.AbstractPlanet,
atmosphere::SpeedyWeather.AbstractAtmosphere,
time_stepping::SpeedyWeather.AbstractTimeStepper
) -> Union{Nothing, Int64}
calculates temperature and humidity tendencies for the convection scheme following the simplified Betts-Miller convection. Starts with a first-guess relaxation to determine the convective criteria (none, dry/shallow or deep), then adjusts reference profiles for thermodynamic consistency (e.g. in dry convection the humidity profile is non-precipitating), and relaxes current vertical profiles to the adjusted references.
SpeedyWeather.coriolis
— Methodcoriolis(grid::AbstractGridArray; kwargs...) -> Any
Return the Coriolis parameter f
on a grid like grid
on a planet of ratation
[1/s]. Default rotation of Earth.
SpeedyWeather.coriolis
— Methodcoriolis(grid::AbstractGridArray; kwargs...) -> Any
Return the Coriolis parameter f
on the grid Grid
of resolution nlat_half
on a planet of ratation
[1/s]. Default rotation of Earth.
SpeedyWeather.cos_zenith!
— Methodcos_zenith!(
cos_zenith::AbstractGridArray{NF, 1, Array{NF, 1}},
S::SolarZenith,
time::DateTime,
geometry::SpeedyWeather.AbstractGeometry
)
Calculate cos of solar zenith angle with a daily cycle at time time
. Seasonal cycle or time correction may be disabled, depending on parameters in SolarZenith.
SpeedyWeather.cos_zenith!
— Methodcos_zenith!(
cos_zenith::AbstractGridArray{NF, 1, Array{NF, 1}},
S::SolarZenithSeason,
time::DateTime,
geometry::SpeedyWeather.AbstractGeometry
)
Calculate cos of solar zenith angle as daily average at time time
. Seasonal cycle or time correction may be disabled, depending on parameters in SolarZenithSeason.
SpeedyWeather.create_output_folder
— Methodcreate_output_folder(
path::String,
id::Union{Int64, String}
) -> String
Creates a new folder run_*
with the identification id
. Also returns the full path run_path
of that folder.
SpeedyWeather.deactivate
— Methoddeactivate(
p::Particle{NF}
) -> Particle{_A, false} where _A<:AbstractFloat
Deactivate particle. Inactive particles cannot move.
SpeedyWeather.default_array_type
— Methoddefault_array_type(
device::SpeedyWeather.AbstractDevice
) -> Type{Array}
Default array type on device
.
SpeedyWeather.default_sigma_coordinates
— Methoddefault_sigma_coordinates(
nlayers::Integer
) -> Vector{Float64}
Vertical sigma coordinates defined by their nlayers+1 half levels σ_levels_half
. Sigma coordinates are fraction of surface pressure (p/p0) and are sorted from top (stratosphere) to bottom (surface). The first half level is at 0 the last at 1. Default levels are equally spaced from 0 to 1 (including).
SpeedyWeather.drag!
— Methoddrag!(diagn::DiagnosticVariables, drag::QuadraticDrag)
Quadratic drag for the momentum equations.
F = -c_D/H*|(u, v)|*(u, v)
with cD the non-dimensional drag coefficient as defined in drag::QuadraticDrag
. cD and layer thickness H
are precomputed in initialize!(::QuadraticDrag, ::AbstractModel) and scaled by the radius as are the momentum equations.
SpeedyWeather.dry_adiabat!
— Methoddry_adiabat!(
temp_ref_profile::AbstractVector,
temp_environment::AbstractVector,
σ::AbstractVector,
atmosphere::SpeedyWeather.AbstractAtmosphere
) -> Int64
Calculates the moist pseudo adiabat given temperature and humidity of surface parcel. Follows the dry adiabat till condensation and then continues on the pseudo moist-adiabat with immediate condensation to the level of zero buoyancy. Levels above are skipped, set to NaN instead and should be skipped in the relaxation.
SpeedyWeather.dry_static_energy!
— Methoddry_static_energy!(
column::ColumnVariables,
atmosphere::SpeedyWeather.AbstractAtmosphere
)
Compute the dry static energy SE = cₚT + Φ (latent heat times temperature plus geopotential) for the column.
SpeedyWeather.dynamics_tendencies!
— 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.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.flipsign!
— Methodflipgsign!(A::AbstractArray)
Like -A
but in-place.
SpeedyWeather.flux_divergence!
— Methodflux_divergence!(
A_tend::LowerTriangularArray,
A_grid::AbstractGridArray,
diagn::DiagnosticVariables,
G::Geometry,
S::SpectralTransform;
add,
flipsign
)
Computes ∇⋅((u, v)*A) with the option to add/overwrite A_tend
and to flip_sign
of the flux divergence by doing so.
A_tend = ∇⋅((u, v)*A)
foradd=false
,flip_sign=false
A_tend = -∇⋅((u, v)*A)
foradd=false
,flip_sign=true
A_tend += ∇⋅((u, v)*A)
foradd=true
,flip_sign=false
A_tend -= ∇⋅((u, v)*A)
foradd=true
,flip_sign=true
SpeedyWeather.fluxes_to_tendencies!
— Methodfluxes_to_tendencies!(
column::ColumnVariables,
geometry::Geometry,
planet::SpeedyWeather.AbstractPlanet,
atmosphere::SpeedyWeather.AbstractAtmosphere
)
Convert the fluxes on half levels to tendencies on full levels.
SpeedyWeather.forcing!
— Methodforcing!(
diagn::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,
albedo::SpeedyWeather.AbstractAlbedo,
implicit::SpeedyWeather.AbstractImplicit
) -> Any
Update C::ColumnVariables
by copying the prognostic variables from D::DiagnosticVariables
at gridpoint index ij
. Provide G::Geometry
for coordinate information.
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_run_id
— Methodget_run_id(path::String, id::String) -> String
Checks existing run_????
folders in path
to determine a 4-digit id
number by counting up. E.g. if folder run_0001 exists it will return the string "0002". Does not create a folder for the returned run id.
SpeedyWeather.get_thermodynamics!
— Methodget_thermodynamics!(
column::ColumnVariables,
model::PrimitiveEquation
)
Calculate geopotentiala and dry static energy for the primitive equation model.
SpeedyWeather.get_Δ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
) -> Any
horizontal_diffusion!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
model::Barotropic,
lf::Integer
) -> Any
Apply horizontal diffusion to vorticity in the BarotropicModel.
SpeedyWeather.horizontal_diffusion!
— Functionhorizontal_diffusion!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
model::PrimitiveEquation
) -> Any
horizontal_diffusion!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
model::PrimitiveEquation,
lf::Integer
) -> Any
Apply horizontal diffusion applied to vorticity, divergence, temperature, and humidity (PrimitiveWet only) in the PrimitiveEquation models.
SpeedyWeather.horizontal_diffusion!
— Functionhorizontal_diffusion!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
model::ShallowWater
) -> Any
horizontal_diffusion!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
diffusion::SpeedyWeather.AbstractHorizontalDiffusion,
model::ShallowWater,
lf::Integer
) -> Any
Apply horizontal diffusion to vorticity and divergence in the ShallowWaterModel.
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,
implicit::ImplicitPrimitiveEquation,
progn::PrognosticVariables
)
Apply the implicit corrections to dampen gravity waves in the primitive equation models.
SpeedyWeather.implicit_correction!
— Methodimplicit_correction!(
diagn::DiagnosticVariables,
progn::PrognosticVariables,
implicit::ImplicitShallowWater
)
Apply correction to the tendencies in diagn
to prevent the gravity waves from amplifying. The correction is implicitly evaluated using the parameter implicit.α
to switch between forward, centered implicit or backward evaluation of the gravity wave terms.
SpeedyWeather.initialize!
— Methodinitialize!(
land_sea_mask::AquaPlanetMask,
model::PrimitiveEquation
)
Sets all grid points to 0 = sea.
SpeedyWeather.initialize!
— Methodinitialize!(
model::Barotropic;
time
) -> Simulation{Model} where Model<:Barotropic
Calls all initialize!
functions for most fields, representing components, of model
, except for model.output
and model.feedback
which are always called at in time_stepping!
.
SpeedyWeather.initialize!
— Methodinitialize!(
clock::Clock,
time_stepping::SpeedyWeather.AbstractTimeStepper
) -> Clock
Initialize the clock with the time step Δt
in the time_stepping
.
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::ImplicitPrimitiveEquation,
dt::Real,
diagn::DiagnosticVariables,
geometry::SpeedyWeather.AbstractGeometry,
geopotential::SpeedyWeather.AbstractGeopotential,
atmosphere::SpeedyWeather.AbstractAtmosphere,
adiabatic_conversion::SpeedyWeather.AbstractAdiabaticConversion
)
Initialize the implicit terms for the PrimitiveEquation models.
SpeedyWeather.initialize!
— Methodinitialize!(
implicit::ImplicitShallowWater,
dt::Real,
planet::SpeedyWeather.AbstractPlanet,
atmosphere::SpeedyWeather.AbstractAtmosphere
)
Update the implicit terms in implicit
for the shallow water model as they depend on the time step dt
.
SpeedyWeather.initialize!
— Methodinitialize!(
scheme::JablonowskiRelaxation,
model::PrimitiveEquation
)
initialize the JablonowskiRelaxation temperature relaxation by precomputing terms for the equilibrium temperature Teq and the frequency (strength of relaxation).
SpeedyWeather.initialize!
— Methodinitialize!(
land_sea_mask::LandSeaMask,
model::PrimitiveEquation
) -> AbstractGrid{NF} where NF<:AbstractFloat
Reads a high-resolution land-sea mask from file and interpolates (grid-call average) onto the model grid for a fractional sea mask.
SpeedyWeather.initialize!
— Methodinitialize!(L::Leapfrog, model::AbstractModel)
Initialize leapfrogging L
by recalculating the timestep given the output time step output_dt
from model.output
. Recalculating will slightly adjust the time step to be a divisor such that an integer number of time steps matches exactly with the output time step.
SpeedyWeather.initialize!
— Methodinitialize!(scheme::LinearDrag, model::PrimitiveEquation)
Precomputes the drag coefficients for this BoundaryLayerDrag
scheme.
SpeedyWeather.initialize!
— Methodinitialize!(
model::PrimitiveDry;
time
) -> Simulation{Model} where Model<:PrimitiveDry
Calls all initialize!
functions for components of model
, except for model.output
and model.feedback
which are always called at in time_stepping!
and model.implicit
which is done in first_timesteps!
.
SpeedyWeather.initialize!
— Methodinitialize!(
model::PrimitiveWet;
time
) -> Simulation{Model} where Model<:PrimitiveWet
Calls all initialize!
functions for components of model
, except for model.output
and model.feedback
which are always called at in time_stepping!
and model.implicit
which is done in first_timesteps!
.
SpeedyWeather.initialize!
— Methodinitialize!(
progn::PrognosticVariables,
_::PressureOnOrography,
model::PrimitiveEquation
)
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
) -> PrognosticVariables
Restart from a previous SpeedyWeather.jl simulation via the restart file restart.jld2 Applies interpolation in the horizontal but not in the vertical.
SpeedyWeather.initialize!
— Methodinitialize!(
progn::PrognosticVariables,
initial_conditions::ZonalJet,
model::AbstractModel
)
Initial conditions from Galewsky, 2004, Tellus
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} where Model<:ShallowWater
Calls all initialize!
functions for most components (=fields) of model
, except for model.output
and model.feedback
which are always initialized in time_stepping!
and model.implicit
which is done in first_timesteps!
.
SpeedyWeather.initialize!
— Methodinitialize!(
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!(
output::NetCDFOutput{Grid2D, Grid3D, Interpolator},
feedback::SpeedyWeather.AbstractFeedback,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
Initialize NetCDF output
by creating a netCDF file and storing the initial conditions of diagn
(and progn
). To be called just before the first timesteps.
SpeedyWeather.initialize!
— Methodinitialize!(
particles::Array{Particle{NF}, 1},
progn::PrognosticVariables,
diagn::DiagnosticVariables,
particle_advection::ParticleAdvection2D
) -> Any
Initialize particle advection time integration: Store u,v interpolated initial conditions in diagn.particles.u
and .v
to be used when particle advection actually executed for first time.
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!(
progn::PrognosticVariables{NF},
initial_conditions::JablonowskiTemperature,
model::AbstractModel
)
Initial conditions from Jablonowski and Williamson, 2006, QJR Meteorol. Soc
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::StartWithRandomVorticity,
model::AbstractModel
)
Start with random vorticity as initial conditions
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::Array{P<:Particle, 1},
model::AbstractModel
)
Initialize particle locations uniformly in latitude, longitude and in the vertical σ coordinates. This uses a cosin-distribution in latitude for an equal-area uniformity.
SpeedyWeather.isdecreasing
— Methodisdecreasing(v::AbstractVector) -> Bool
Check whether elements of a vector v
are strictly decreasing.
SpeedyWeather.isincreasing
— Methodisincreasing(v::AbstractVector) -> Bool
Check whether elements of a vector v
are strictly increasing.
SpeedyWeather.ismod
— Methodismod(p::Particle) -> Bool
Check that a particle is in longitude [0,360˚E), latitude [-90˚,90˚N], and σ in [0,1].
SpeedyWeather.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,
scheme::ImplicitCondensation,
clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron,
geometry::Geometry,
planet::SpeedyWeather.AbstractPlanet,
atmosphere::SpeedyWeather.AbstractAtmosphere,
time_stepping::SpeedyWeather.AbstractTimeStepper
)
Large-scale condensation for a column
by relaxation back to 100% relative humidity. Calculates the tendencies for specific humidity and temperature from latent heat release and integrates the large-scale precipitation vertically for output.
SpeedyWeather.launch_kernel!
— Methodlaunch_kernel!(
device_setup::SpeedyWeather.DeviceSetup,
kernel!,
ndrange,
kernel_args...
)
Launches the kernel!
on the device_setup
with ndrange
computations over the kernel and arguments kernel_args
.
SpeedyWeather.leapfrog!
— Methodleapfrog!(
A_old::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::PrimitiveEquation
)
Calculates a linearised virtual temperature Tᵥ as
Tᵥ = T + Tₖμq
With absolute temperature T, layer-average temperarture Tₖ (computed in temperature_average!), specific humidity q and
μ = (1-ξ)/ξ, ξ = R_dry/R_vapour.
in spectral space.
SpeedyWeather.linear_virtual_temperature!
— Methodlinear_virtual_temperature!(
diagn::SpeedyWeather.DiagnosticVariablesLayer,
progn::SpeedyWeather.PrognosticLayerTimesteps,
lf::Integer,
model::PrimitiveDry
)
Linear virtual temperature for model::PrimitiveDry
: Just copy over arrays from temp
to temp_virt
at timestep lf
in spectral space as humidity is zero in this model
.
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.moist_static_energy!
— Methodmoist_static_energy!(
column::ColumnVariables,
clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron
)
Compute the moist static energy
MSE = SE + Lc*Q = cₚT + Φ + Lc*Q
with the static energy SE
, the latent heat of condensation Lc
, the geopotential Φ
. As well as the saturation moist static energy which replaces Q with Q_sat
SpeedyWeather.move
— Methodmove(
p::Particle{NF, false},
args...
) -> Particle{NF, false} where NF
Inactive particles are not moved.
SpeedyWeather.move
— Methodmove(
p::Particle{NF, true},
dlon,
dlat,
dσ
) -> Particle{_A, true} where _A<:AbstractFloat
Move a particle with increments (dlon, dlat, dσ) in those respective coordinates. Only active particles are moved.
SpeedyWeather.move
— Methodmove(
p::Particle{NF, true},
dlon,
dlat
) -> Particle{_A, true} where _A<:AbstractFloat
Move a particle with increments (dlon, dlat) in 2D. No movement in vertical σ. Only active particles are moved.
SpeedyWeather.nans
— MethodA = nans(dims...)
Allocate A::Array{Float64} with NaNs.
SpeedyWeather.nans
— MethodA = nans(T, dims...)
Allocate array A with NaNs of type T. Similar to zeros(T, dims...).
SpeedyWeather.nar_detection!
— Methodnar_detection!(
feedback::Feedback,
progn::PrognosticVariables
) -> Union{Nothing, Bool}
Detect NaR (Not-a-Real) in the prognostic variables.
SpeedyWeather.output!
— Methodoutput!(output::NetCDFOutput, time::DateTime)
Write the current time time::DateTime
to the netCDF file in output
.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
output_variables::Dict{Symbol, SpeedyWeather.AbstractOutputVariable},
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
Loop over every variable in output.variables
to call the respective output!
method to write into the output.netcdf_file
.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
Writes the variables from progn
or diagn
of time step i
at time time
into output.netcdf_file
. Simply escapes for no netcdf output or if output shouldn't be written on this time step. Interpolates onto output grid and resolution as specified in output
, converts to output number format, truncates the mantissa for higher compression and applies lossless compression.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.CloudTopOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
output!
method for variable
, see output!(::NetCDFOutput, ::VorticityOutput, ...)
for details.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.ConvectivePrecipitationOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
output!
method for variable
, see output!(::NetCDFOutput, ::VorticityOutput, ...)
for details.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.DivergenceOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
output!
method for variable
, see output!(::NetCDFOutput, ::VorticityOutput, ...)
for details.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.HumidityOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
output!
method for variable
, see output!(::NetCDFOutput, ::VorticityOutput, ...)
for details.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.InterfaceDisplacementOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
output!
method for variable
, see output!(::NetCDFOutput, ::VorticityOutput, ...)
for details.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.LargeScalePrecipitationOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
output!
method for variable
, see output!(::NetCDFOutput, ::VorticityOutput, ...)
for details.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.MeridionalVelocityOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
output!
method for variable
, see output!(::NetCDFOutput, ::VorticityOutput, ...)
for details.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.OrographyOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
output!
method for variable
, see output!(::NetCDFOutput, ::VorticityOutput, ...)
for details.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.RandomPatternOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
output!
method for variable
, see output!(::NetCDFOutput, ::VorticityOutput, ...)
for details.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.SurfacePressureOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
output!
method for variable
, see output!(::NetCDFOutput, ::VorticityOutput, ...)
for details.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.TemperatureOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
output!
method for variable
, see output!(::NetCDFOutput, ::VorticityOutput, ...)
for details.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.VorticityOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
Output the vorticity field vor
from diagn.grid
into the netCDF file output.netcdf_file
. Interpolates the vorticity field onto the output grid and resolution as specified in output
. Method required for all output variables <: AbstractOutputVariable
with dispatch over the second argument.
SpeedyWeather.output!
— Methodoutput!(
output::NetCDFOutput,
variable::SpeedyWeather.ZonalVelocityOutput,
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
)
output!
method for ZonalVelocityOutput
to write the zonal velocity field u
from diagn.grid
, see output!(::NetCDFOutput, ::VorticityOutput, ...)
for details.
SpeedyWeather.parameterization_tendencies!
— Methodparameterization_tendencies!(
column::ColumnVariables,
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.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.print_fields
— Methodprint_fields(io::IO, A, keys; arrays)
Prints to io
all fields of a struct A
identified by their keys
.
SpeedyWeather.progress!
— Methodprogress!(feedback::Feedback)
Calls the progress meter and writes every 5% progress increase to txt.
SpeedyWeather.pseudo_adiabat!
— Methodpseudo_adiabat!(
temp_ref_profile::AbstractVector,
temp_parcel,
humid_parcel::Real,
temp_virt_environment::AbstractVector,
geopot::AbstractVector,
pres::Real,
σ::AbstractVector,
clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron
) -> Int64
Calculates the moist pseudo adiabat given temperature and humidity of surface parcel. Follows the dry adiabat till condensation and then continues on the pseudo moist-adiabat with immediate condensation to the level of zero buoyancy. Levels above are skipped, set to NaN instead and should be skipped in the relaxation.
SpeedyWeather.readable_secs
— Methodreadable_secs(secs::Real) -> Dates.CompoundPeriod
Returns Dates.CompoundPeriod
rounding to either (days, hours), (hours, minutes), (minutes, seconds), or seconds with 1 decimal place accuracy for >10s and two for less. E.g.
julia> using SpeedyWeather: readable_secs
julia> readable_secs(12345)
SpeedyWeather.remaining_time
— Methodremaining_time(p::ProgressMeter.Progress) -> String
Estimates the remaining time from a ProgresssMeter.Progress
. Adapted from ProgressMeter.jl
SpeedyWeather.reset_column!
— Methodreset_column!(column::ColumnVariables{NF})
Set the accumulators (tendencies but also vertical sums and similar) back to zero for column
to be reused at other grid points.
SpeedyWeather.run!
— Methodrun!(
simulation::SpeedyWeather.AbstractSimulation;
period,
output
) -> Union{UnicodePlots.Plot{T, Val{true}} where T<:UnicodePlots.HeatmapCanvas, UnicodePlots.Plot{T, Val{false}} where T<:UnicodePlots.HeatmapCanvas}
Run a SpeedyWeather.jl simulation
. The simulation.model
is assumed to be initialized.
SpeedyWeather.saturation_humidity!
— Methodsaturation_humidity!(
column::ColumnVariables,
clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron
)
Compute the saturation water vapour pressure [Pa], the saturation humidity [kg/kg] and the relative humidity following clausius_clapeyron
.
SpeedyWeather.saturation_humidity
— Methodsaturation_humidity(
temp_kelvin,
pres,
clausius_clapeyron::SpeedyWeather.AbstractClausiusClapeyron
) -> Any
Saturation humidity [kg/kg] from temperature [K], pressure [Pa] via
sat_vap_pres = clausius_clapeyron(temperature)
saturation humidity = mol_ratio * sat_vap_pres / pressure
SpeedyWeather.saturation_humidity
— Methodsaturation_humidity(sat_vap_pres, pres; mol_ratio) -> Any
Saturation humidity from saturation vapour pressure and pressure via
qsat = mol_ratio*sat_vap_pres/pres
with both pressures in same units and qsat in kg/kg.
SpeedyWeather.scale!
— Methodscale!(
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)
Scale the variable var
inside progn
with scalar scale
.
SpeedyWeather.set!
— Methodset!(model::AbstractModel; orography, kwargs...)
Sets a new orography
for the 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 orography instead.
SpeedyWeather.set!
— Methodset!(
progn::PrognosticVariables,
geometry::Geometry;
u,
v,
vor,
div,
temp,
humid,
pres,
sea_surface_temperature,
sea_ice_concentration,
land_surface_temperature,
snow_depth,
soil_moisture_layer1,
soil_moisture_layer2,
lf,
add,
spectral_transform,
coslat_scaling_included
)
Sets new values for the keyword arguments (velocities, vorticity, divergence, etc..) into the prognostic variable struct progn
at timestep index lf
. If add==true
they are added to the current value instead. If a SpectralTransform
S is provided, it is used when needed to set the variable, otherwise it is recomputed. In case u
and v
are provied, actually the divergence and vorticity are set and coslat_scaling_included
specficies whether or not the 1/cos(lat) scaling is already included in the arrays or not (default: false
)
The input may be:
- A function or callable object
f(lond, latd, σ) -> value
(multilevel variables) - A function or callable object
f(lond, latd) -> value
(surface level variables) - An instance of
AbstractGridArray
- An instance of
LowerTriangularArray
- A scalar
<: Number
(interpreted as a constant field in grid space)
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_period!
— Methodset_period!(clock::Clock, period::Dates.Period) -> Second
Set the period
of the clock to a new value. Converts any Dates.Period
input to Second
.
SpeedyWeather.set_period!
— Methodset_period!(clock::Clock, period::Real) -> Any
Set the period
of the clock to a new value. Converts any ::Real
input to Day
.
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!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
model::AbstractModel
) -> Union{UnicodePlots.Plot{T, Val{true}} where T<:UnicodePlots.HeatmapCanvas, UnicodePlots.Plot{T, Val{false}} where T<:UnicodePlots.HeatmapCanvas}
Main time loop that that initializes output and feedback, loops over all time steps and calls the output and feedback functions.
SpeedyWeather.timestep!
— Functiontimestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::Barotropic
) -> Union{Nothing, Bool}
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::Barotropic,
lf1::Integer
) -> Union{Nothing, Bool}
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::Barotropic,
lf1::Integer,
lf2::Integer
) -> Union{Nothing, Bool}
Calculate a single time step for the barotropic model.
SpeedyWeather.timestep!
— Functiontimestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::ShallowWater
) -> Union{Nothing, Bool}
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::ShallowWater,
lf1::Integer
) -> Union{Nothing, Bool}
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::ShallowWater,
lf1::Integer,
lf2::Integer
) -> Union{Nothing, Bool}
Calculate a single time step for the model <: ShallowWater
.
SpeedyWeather.timestep!
— Functiontimestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::PrimitiveEquation
) -> Union{Nothing, Bool}
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::PrimitiveEquation,
lf1::Integer
) -> Union{Nothing, Bool}
timestep!(
progn::PrognosticVariables,
diagn::DiagnosticVariables,
dt::Real,
model::PrimitiveEquation,
lf1::Integer,
lf2::Integer
) -> Union{Nothing, Bool}
Calculate a single time step for the model<:PrimitiveEquation
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.underflow!
— Methodunderflow!(A::AbstractArray, ϵ::Real)
Underflows element a
in A
to zero if abs(a) < ϵ
.
SpeedyWeather.unscale!
— Methodunscale!(variable::AbstractArray, scale::Real) -> Any
Undo the radius-scaling for any variable. Method used for netcdf output.
SpeedyWeather.unscale!
— Methodunscale!(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_k
u, v are averaged in grid-point space, divergence in spectral space.
SpeedyWeather.vertical_interpolate!
— Methodvertical_interpolate!(
A_half::Vector,
A_full::Vector,
G::Geometry
)
Given a vector in column defined at full levels, do a linear interpolation in log(σ) to calculate its values at half-levels, skipping top (k=1/2), extrapolating to bottom (k=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.workgroup_size
— Methodworkgroup_size(
device::SpeedyWeather.AbstractDevice
) -> Int64
Returns a workgroup size depending on device
. WIP: Will be expanded in the future to also include grid information.
SpeedyWeather.write_column_tendencies!
— Methodwrite_column_tendencies!(
diagn::DiagnosticVariables,
column::ColumnVariables,
planet::SpeedyWeather.AbstractPlanet,
ij::Integer
)
Write the parametrization tendencies from C::ColumnVariables
into the horizontal fields of tendencies stored in D::DiagnosticVariables
at gridpoint index ij
.
SpeedyWeather.write_restart_file
— Methodwrite_restart_file(
output::SpeedyWeather.AbstractOutput,
progn::PrognosticVariables{T}
) -> Any
A restart file restart.jld2
with the prognostic variables is written to the output folder (or current path) that can be used to restart the model. restart.jld2
will then be used as initial conditions. The prognostic variables are bitrounded for compression and the 2nd leapfrog time step is discarded. Variables in restart file are unscaled.
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).