Skip to content

Models ​

SpeedyWeather implements several models that define which equation are being solved

  • BarotropicModel solves the 2D barotropic vorticity equations

  • ShallowWaterModel solves the 2D shallow water equations

  • PrimitiveDryModel solves the 3D primitive equations without humidity

  • PrimitiveWetModel solves the 3D primitive equations with humidity

but each of these models has further modularity such that the equations being solved also depend on the model components being defined. For example, each of these models can have custom forcing and drag terms, or the primitive equation models can have endless combinations of parameterizations altering all sorts of components of the planetary climate system that is simulated.

We briefly provide an overview of the components of each model. Constructing a model follows the general syntax that is SomeModel(spectral_grid, component=my_component, ...) which we call the model constructor. The first argument is the spectral_grid defining the resolution, then additional keyword arguments can change model components for custom or non-default ones. The order does not matter and you can provide as many as you like just the model.component names have to fit the keywords of the arguments.

The model construction essentially gathers all default or non-default model components (it will construct the default components) but doesn't to much else. All the initialization of the model components and the allocation of Variables happens in initialize!(model).

Model components ​

Many types and components in SpeedyWeather have extended Julia's show function with some pretty printing to give you a better overview of its contents, e.g. a clock::Clock is printed as

julia
using SpeedyWeather
clock = Clock()
Clock{DateTime, Second, Float32, In...} <: SpeedyWeather.AbstractClock
├ time::DateTime = 2000-01-01T00:00:00
├ start::DateTime = 2000-01-01T00:00:00
├ rotation_time::DateTime = 2000-01-01T00:00:00
├ orbit_time::DateTime = 2000-01-01T00:00:00
├ period::Second = 0 seconds
├ rotation_dilation::Float32 = 1.0
├ orbit_dilation::Float32 = 1.0
├ step_counter::Int64 = 0
├ time_step_counter::Int64 = 0
├ n_steps::Int64 = 0
├ n_time_steps::Int64 = 0
└ Δt::Millisecond = 0 milliseconds

illustrating the fields within a clock (one per row), their types (indicated by ::) and (unless they are an array) also their values. For structs (or NamedTuples) within structs however, this information, is not be printed by default. You can use Julia's autocomplete like clock.<tab> by hitting tab after the . to inspect the fields of an instance and that way go down every branch of the simulation "tree".

BarotropicModel ​

The BarotropicModel is the simplest model we have, which will not have many of the model components that are needed to define the primitive equations for example. If you create a model with non-default conponents they will show up here, so your model may look different depending on what you have constructed!

julia
using SpeedyWeather
spectral_grid = SpectralGrid(nlayers=1)     # 2D models require nlayers=1
model = BarotropicModel(spectral_grid)
BarotropicModel{...} <: Barotropic (607.07 KB)
├ spectral_grid::SpectralGrid{CPU{KernelAbstractions.CPU}, Spectrum{CPU{Ker...
├ architecture::CPU{KernelAbstractions.CPU}
├ geometry::Geometry{SpectralGrid{CPU{KernelAbstractions.CPU}, Spectrum{CPU...
├ planet::Earth{Float32, Second, DateTime, Bool}
├ atmosphere::EarthDryAtmosphere{Float32}
├ coriolis::Coriolis{Vector{Float32}}
├ forcing::KolmogorovFlow{Float32}
├ drag::LinearVorticityDrag{Float32}
├ particle_advection::Nothing
├ initial_conditions::@NamedTuple{vordiv::RandomVelocity{Float32, Int64, Ra...
├ random_process::Nothing
├ tracers::Dict{Symbol, Tracer}
├ time_stepping::NCycleLorenz{Float32, NCycleLorenzA, Int64, Second, Millis...
├ spectral_transform::SpectralTransform{Float32, CPU{KernelAbstractions.CPU...
├ implicit::Nothing
├ horizontal_diffusion::HyperDiffusion{Float32, Matrix{Float32}, Int64, Sec...
├ output::NetCDFOutput{Field{Float32, 1, Vector{Float32}, FullGaussianGrid{...
├ callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}
└ feedback::Feedback

ShallowWaterModel ​

The ShallowWaterModel is similar to the BarotropicModel, but it contains for example orography, that the BarotropicModel doesn't have.

julia
spectral_grid = SpectralGrid(nlayers=1)     # 2D models require nlayers=1
model = ShallowWaterModel(spectral_grid)
ShallowWaterModel{...} <: ShallowWater (625.00 KB)
├ spectral_grid::SpectralGrid{CPU{KernelAbstractions.CPU}, Spectrum{CPU{Ker...
├ architecture::CPU{KernelAbstractions.CPU}
├ geometry::Geometry{SpectralGrid{CPU{KernelAbstractions.CPU}, Spectrum{CPU...
├ planet::Earth{Float32, Second, DateTime, Bool}
├ atmosphere::EarthDryAtmosphere{Float32}
├ coriolis::Coriolis{Vector{Float32}}
├ orography::EarthOrography{Float32, Field{Float32, 1, Vector{Float32}, Oct...
├ forcing::Nothing
├ drag::Nothing
├ particle_advection::Nothing
├ initial_conditions::@NamedTuple{vordiv::ZonalJet{Float32}}
├ random_process::Nothing
├ tracers::Dict{Symbol, Tracer}
├ time_stepping::Leapfrog{Float32, Second, Bool, Millisecond}
├ spectral_transform::SpectralTransform{Float32, CPU{KernelAbstractions.CPU...
├ implicit::ImplicitShallowWater{Float32}
├ horizontal_diffusion::HyperDiffusion{Float32, Matrix{Float32}, Int64, Sec...
├ output::NetCDFOutput{Field{Float32, 1, Vector{Float32}, FullGaussianGrid{...
├ callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}
└ feedback::Feedback

PrimitiveDryModel ​

The PrimitiveDryModel is a big jump in complexity compared to the 2D models, but because it doesn't contain humidity, several model components like surface_humidity_flux aren't needed.

julia
spectral_grid = SpectralGrid()
model = PrimitiveDryModel(spectral_grid)
PrimitiveDryModel{...} <: PrimitiveDry (942.55 KB)
├ spectral_grid::SpectralGrid{CPU{KernelAbstractions.CPU}, Spectrum{CPU{Ker...
├ architecture::CPU{KernelAbstractions.CPU}
├ dynamics::Bool
├ geometry::Geometry{SpectralGrid{CPU{KernelAbstractions.CPU}, Spectrum{CPU...
├ planet::Earth{Float32, Second, DateTime, Bool}
├ atmosphere::EarthDryAtmosphere{Float32}
├ coriolis::Coriolis{Vector{Float32}}
├ geopotential::Geopotential{Vector{Float32}}
├ adiabatic_conversion::AdiabaticConversion{Vector{Float32}}
├ particle_advection::Nothing
├ initial_conditions::@NamedTuple{vordiv::ZonalWind{Float32}, pres::Pressur...
├ forcing::Nothing
├ drag::SpeedLimitDrag{Float32}
├ random_process::Nothing
├ tracers::Dict{Symbol, Tracer}
├ dynamics_only::Bool
├ orography::EarthOrography{Float32, Field{Float32, 1, Vector{Float32}, Oct...
├ land_sea_mask::EarthLandSeaMask{Float32, Field{Float32, 1, Vector{Float32...
├ ocean::SlabOcean{Float32}
├ sea_ice::ThermodynamicSeaIce{Float32}
├ land::DryLandModel{LandGeometry{Vector{Float32}, Int64}, LandThermodynami...
├ solar_zenith::SolarZenith{SpeedyWeather.SinSolarDeclination{Float32, Date...
├ albedo::OceanLandAlbedo{OceanSeaIceAlbedo{Float32}, LandSnowAlbedo{Float3...
├ boundary_layer::BoundaryLayer{SurfaceCondition{Float32}, Nothing, Constan...
├ vertical_diffusion::BulkRichardsonDiffusion{Float32, Vector{Float32}}
├ surface_momentum_flux::SurfaceMomentumFlux{Float32}
├ surface_heat_flux::SurfaceHeatFlux{SurfaceOceanHeatFlux{Float32}, Surface...
├ convection::BettsMillerDryConvection{Float32}
├ shortwave_radiation::OneBandShortwave{NoClouds, ConstantShortwaveTransmis...
├ longwave_radiation::OneBandLongwave{ConstantLongwaveTransmissivity{Float3...
├ greenhouse_gases::@NamedTuple{}
├ stochastic_physics::Nothing
├ custom_parameterization::Nothing
├ time_stepping::Leapfrog{Float32, Second, Bool, Millisecond}
├ spectral_transform::SpectralTransform{Float32, CPU{KernelAbstractions.CPU...
├ implicit::ImplicitPrimitiveEquation{Float32, Vector{Float32}, Matrix{Floa...
├ horizontal_diffusion::HyperDiffusion{Float32, Matrix{Float32}, Int64, Sec...
├ vertical_advection::CenteredVerticalAdvection{Float32, 1}
├ output::NetCDFOutput{Field{Float32, 1, Vector{Float32}, FullGaussianGrid{...
├ callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}
├ feedback::Feedback
├ core_components::NTuple{8, Symbol}
├ parameterizations::NTuple{10, Symbol}
└ params::Val{(:solar_zenith, :vertical_diffusion, :convection, :albedo, :s...

PrimitiveWetModel ​

The PrimitiveWetModel is the most complex model we currently have, hence its field tree is the longest, defining many components for the physics parameterizations.

julia
model = PrimitiveWetModel(spectral_grid)
PrimitiveWetModel{...} <: PrimitiveWet (968.57 KB)
├ spectral_grid::SpectralGrid{CPU{KernelAbstractions.CPU}, Spectrum{CPU{Ker...
├ architecture::CPU{KernelAbstractions.CPU}
├ dynamics::Bool
├ geometry::Geometry{SpectralGrid{CPU{KernelAbstractions.CPU}, Spectrum{CPU...
├ planet::Earth{Float32, Second, DateTime, Bool}
├ atmosphere::EarthAtmosphere{Float32}
├ coriolis::Coriolis{Vector{Float32}}
├ geopotential::Geopotential{Vector{Float32}}
├ adiabatic_conversion::AdiabaticConversion{Vector{Float32}}
├ particle_advection::Nothing
├ initial_conditions::@NamedTuple{vordiv::ZonalWind{Float32}, pres::Pressur...
├ forcing::Nothing
├ drag::SpeedLimitDrag{Float32}
├ random_process::Nothing
├ tracers::Dict{Symbol, Tracer}
├ dynamics_only::Bool
├ orography::EarthOrography{Float32, Field{Float32, 1, Vector{Float32}, Oct...
├ land_sea_mask::EarthLandSeaMask{Float32, Field{Float32, 1, Vector{Float32...
├ ocean::SlabOcean{Float32}
├ sea_ice::ThermodynamicSeaIce{Float32}
├ land::LandModel{LandGeometry{Vector{Float32}, Int64}, LandThermodynamics{...
├ solar_zenith::SolarZenith{SpeedyWeather.SinSolarDeclination{Float32, Date...
├ albedo::OceanLandAlbedo{OceanSeaIceAlbedo{Float32}, LandSnowAlbedo{Float3...
├ boundary_layer::BoundaryLayer{SurfaceCondition{Float32}, Nothing, Constan...
├ vertical_diffusion::BulkRichardsonDiffusion{Float32, Vector{Float32}}
├ surface_momentum_flux::SurfaceMomentumFlux{Float32}
├ surface_heat_flux::SurfaceHeatFlux{SurfaceOceanHeatFlux{Float32}, Surface...
├ surface_humidity_flux::SurfaceHumidityFlux{SurfaceOceanHumidityFlux{Float...
├ large_scale_condensation::ImplicitCondensation{Float32}
├ convection::BettsMillerConvection{Float32}
├ shortwave_radiation::OneBandShortwave{DiagnosticClouds{Float32}, Backgrou...
├ longwave_radiation::OneBandLongwave{FriersonLongwaveTransmissivity{Float3...
├ greenhouse_gases::@NamedTuple{}
├ stochastic_physics::Nothing
├ custom_parameterization::Nothing
├ time_stepping::Leapfrog{Float32, Second, Bool, Millisecond}
├ spectral_transform::SpectralTransform{Float32, CPU{KernelAbstractions.CPU...
├ implicit::ImplicitPrimitiveEquation{Float32, Vector{Float32}, Matrix{Floa...
├ horizontal_diffusion::HyperDiffusion{Float32, Matrix{Float32}, Int64, Sec...
├ vertical_advection::CenteredVerticalAdvection{Float32, 1}
├ hole_filling::ClipNegatives
├ output::NetCDFOutput{Field{Float32, 1, Vector{Float32}, FullGaussianGrid{...
├ callbacks::Dict{Symbol, SpeedyWeather.AbstractCallback}
├ feedback::Feedback
├ core_components::NTuple{8, Symbol}
├ parameterizations::NTuple{12, Symbol}
└ params::Val{(:solar_zenith, :vertical_diffusion, :large_scale_condensatio...