GyreInABox

Documentation for GyreInABox.

Model details

The model is an adaptation of the baroclinic gyre example from the MITgcm documentation. It simulates a wind and buoyancy forced double-gyre ocean circulation on a spherical shell sector spatial domain, with default domain extents $(0^\circ, 60^\circ) \times (15^\circ, 75^\circ) \times (-1800\textsf{m}, 0\textsf{m})$ (longitude × latitude × depth dimensions).

By default a non-linear TEOS-10 polynomial equation of state is used to compute buoyancy from salinity and temperature fields. No slip / no-flux boundary conditions are applied to the velocity fields on all walls, and a boundary condition corresponding to a damping zonal drag on the bottom surface. The zonal velocity component is subject to a latitude dependent wind stress roughly reflecting average zonal wind patterns at the surface. The temperature and salinity fields have no-flux boundary conditions applied on all walls and the bottom surface, and relaxation boundary conditions on the top surface which restore the surface fields towards a latitude dependent reference temperature / salinity with a parameterized relaxation time. The surface wind stress, reference temperature and reference salinity as a function of latitude are shown in the figure below.

Surface forcings for model

The model is initialised from rest (zero velocity). The temperature and salinity fields are initialised to match the reference temperature and salinity at the surface and following smoothly varying thermocline / halocline like profiles with depth, and constant in longitude, as shown in the figure below.

Initial temperature and salinity fields for model

Usage example

The below example illustrates setting up and running a simulation of the model with the default parameter values and configuration modulo changing the model to record only a horizontal (surface) slice and depth slice along longitude axis as outputs, and decreasing the progress message update frequency. The resulting horizontal and depth slices of simulated fields are recorded as an animation using CairoMakie. A coarse default grid size (60 × 60 × 15) and small simulation time (60 days) are set so as to allow a simulation to run in around 5 minutes on a CPU, but if running on a GPU (controlled by architecture keyword argument to SimulationConfiguration) then finer spatial discretizations and longer simulation times can easily be used.

using Oceananigans.Units
using GyreInABox

parameters = DoubleGyreParameters()
configuration = SimulationConfiguration(
    output_types=(LongitudeDepthSlice(), HorizontalSlice()),
    progress_message_interval=400
)
run_simulation(parameters, configuration)
plot_outputs(AnimationPlotOutput(), parameters, configuration)
[ Info: Initializing simulation...
Iteration: 0000, time: 0 seconds, Δt: 15 minutes, wall time: 0 seconds
  max(|u|) = 0.00e+00 m s⁻¹, max(|v|) = 0.00e+00 m s⁻¹, max(|w|) = 0.00e+00 m s⁻¹, max(|T|) = 2.73e+01 °C, max(|S|) = 3.79e+01 g kg⁻¹, max(|e|) = 0.00e+00 m² s⁻²
[ Info:     ... simulation initialization complete (38.894 seconds)
[ Info: Executing initial time step...
[ Info:     ... initial time step complete (41.104 seconds).
Iteration: 0400, time: 8.167 days, Δt: 30 minutes, wall time: 1.886 minutes
  max(|u|) = 8.67e-01 m s⁻¹, max(|v|) = 1.62e+00 m s⁻¹, max(|w|) = 2.75e-03 m s⁻¹, max(|T|) = 2.75e+01 °C, max(|S|) = 3.80e+01 g kg⁻¹, max(|e|) = 2.38e-03 m² s⁻²
Iteration: 0800, time: 16.500 days, Δt: 30 minutes, wall time: 2.383 minutes
  max(|u|) = 1.05e+00 m s⁻¹, max(|v|) = 2.30e+00 m s⁻¹, max(|w|) = 3.34e-03 m s⁻¹, max(|T|) = 2.82e+01 °C, max(|S|) = 3.81e+01 g kg⁻¹, max(|e|) = 5.46e-03 m² s⁻²
Iteration: 1200, time: 24.833 days, Δt: 30 minutes, wall time: 2.882 minutes
  max(|u|) = 1.58e+00 m s⁻¹, max(|v|) = 2.29e+00 m s⁻¹, max(|w|) = 3.78e-03 m s⁻¹, max(|T|) = 3.31e+01 °C, max(|S|) = 3.89e+01 g kg⁻¹, max(|e|) = 7.24e-03 m² s⁻²
Iteration: 1600, time: 33.167 days, Δt: 30 minutes, wall time: 3.382 minutes
  max(|u|) = 2.51e+00 m s⁻¹, max(|v|) = 2.97e+00 m s⁻¹, max(|w|) = 4.27e-03 m s⁻¹, max(|T|) = 3.83e+01 °C, max(|S|) = 3.96e+01 g kg⁻¹, max(|e|) = 5.26e-03 m² s⁻²
Iteration: 2000, time: 41.500 days, Δt: 30 minutes, wall time: 3.887 minutes
  max(|u|) = 2.29e+00 m s⁻¹, max(|v|) = 2.38e+00 m s⁻¹, max(|w|) = 4.90e-03 m s⁻¹, max(|T|) = 3.63e+01 °C, max(|S|) = 4.03e+01 g kg⁻¹, max(|e|) = 6.72e-03 m² s⁻²
Iteration: 2400, time: 49.833 days, Δt: 30 minutes, wall time: 4.392 minutes
  max(|u|) = 1.59e+00 m s⁻¹, max(|v|) = 2.22e+00 m s⁻¹, max(|w|) = 2.20e-03 m s⁻¹, max(|T|) = 3.15e+01 °C, max(|S|) = 4.00e+01 g kg⁻¹, max(|e|) = 3.41e-03 m² s⁻²
Iteration: 2800, time: 58.167 days, Δt: 30 minutes, wall time: 4.894 minutes
  max(|u|) = 1.76e+00 m s⁻¹, max(|v|) = 2.12e+00 m s⁻¹, max(|w|) = 2.03e-03 m s⁻¹, max(|T|) = 3.45e+01 °C, max(|S|) = 4.07e+01 g kg⁻¹, max(|e|) = 3.56e-03 m² s⁻²
[ Info: Simulation is stopping after running for 5.005 minutes.
[ Info: Simulation time 60 days equals or exceeds stop time 60 days.
[ Info: Recording an animation of longitude_depth_slice_at_latitude_45.0deg to gyre_model_longitude_depth_slice_at_latitude_45.0deg.mp4...
Plotting frame 10 of 61
Plotting frame 20 of 61
Plotting frame 30 of 61
Plotting frame 40 of 61
Plotting frame 50 of 61
Plotting frame 60 of 61
[ Info: Recording an animation of horizontal_slice_at_depth_0.0m to gyre_model_horizontal_slice_at_depth_0.0m.mp4...
Plotting frame 10 of 61
Plotting frame 20 of 61
Plotting frame 30 of 61
Plotting frame 40 of 61
Plotting frame 50 of 61
Plotting frame 60 of 61

API reference

GyreInABox.GyreInABoxModule

Oceananigans based model of an ocean gyre in a bounded domain.

Details

Model of wind and buoyancy forced ocean gyre adapted from MITgcm documentation baroclinic ocean gyre example implemented using Oceananigans (Ramadhan et al. 2020).

Compared to MITgcm example, beyond the change in the underlying software framework, some key differences in the (default) model configuration are

  • The model uses a seawater buoyancy formulation with tracer fields corresponding to salinity and (potential) temperature used to determine the buoyancy using a non-linear (polynomial) equation of state (Roquet et al. 2015).
  • A weighted essentially non-oscillatory numerical scheme is used for momentum advection (Silvestri et al. 2024).
  • The turbulence closure / parameterization used for small-scale turbulent mixing is a convective adjustment turbulent kinetic energy (CATKE) scheme (Wagner et al. 2025).
  • Adaptive time stepping is used based on controlling advective CFL number.

References

  1. MITgcm contributors (2025). MITgcm/MITgcm: checkpoint69e (Version checkpoint69e). Zenodo. https://doi.org/10.5281/zenodo.15320163
  2. Ramadhan, A., Wagner, G., Hill, C., Campin, J. M., Churavy, V., Besard, T., Souza, A., Edelman, A., Ferrari, R. & Marshall, J. (2020). Oceananigans. jl: Fast and friendly geophysical fluid dynamics on GPUs. Journal of Open Source Software, 5(53).
  3. Roquet, F.; Madec, G.; Brodeau, L. and Nycander, J. (2015). Defining a simplified yet “realistic” equation of state for seawater. Journal of Physical Oceanography 45, 2564-2579.
  4. Silvestri, S., Wagner, G. L., Campin, J. M., Constantinou, N. C., Hill, C. N., Souza, A., & Ferrari, R. (2024). A new WENO-based momentum advection scheme for simulations of ocean mesoscale turbulence. Journal of Advances in Modeling Earth Systems, 16(7), e2023MS004130.
  5. Wagner, G. L., Hillier, A., Constantinou, N. C., Silvestri, S., Souza, A., Burns, K. J., Hill, C., Campin, J-M., Marshall, J. & Ferrari, R. (2025). Formulation and calibration of CATKE, a one-equation parameterization for microscale ocean mixing. Journal of Advances in Modeling Earth Systems, 17(4), e2024MS004522.
source
GyreInABox.AnimationPlotOutputType
struct AnimationPlotOutput <: GyreInABox.AbstractPlotOutput

Animated field plot output type.

Details

Specifies recording an animation of model output fields recording during a simulation.

  • frame_rate::Int64: Frame rate (frames per second) to record animation at.

  • frame_step::Int64: Number of time indices to step through in field time series on each frame.

source
GyreInABox.BarotropicStreamFunctionType
struct BarotropicStreamFunction{S} <: GyreInABox.AbstractHorizontalModelOutput{S}

Barotropic stream function output.

Details

Records longitude-latitude or x-y fields corresponding to stream function of barotropic velocity - computed here as zonally accumulated - that is cumulative integral with respect to longitude - of depth integrated meridional velocity component:

\[\Psi^B(\lambda, \varphi, t) = \int_{\lambda_W}^{\lambda} \int_{z_B}^{z_S} v(\lambda', \varphi, z, t) \,\mathrm{d}z \,\mathrm{d}\lambda'\]

or in rectilinear coordinates:

\[\Psi^B(x, y, t) = \int_{x_W}^{x} \int_{z_B}^{z_S} v(x', y, z, t) \,\mathrm{d}z \,\mathrm{d}x'\]

The outputted field is scaled to be in sverdrup (10⁶ m³ s⁻¹) units.

  • schedule::Any
source
GyreInABox.DepthAveragedType
struct DepthAveraged{S} <: GyreInABox.AbstractHorizontalModelOutput{S}

Depth and time averaged output.

Details

Records horizontal fields corresponding to depth averaged model velocity and tracer fields.

  • schedule::Any: Schedule to record output at
source
GyreInABox.DoubleGyreParametersType
struct DoubleGyreParameters{T} <: GyreInABox.AbstractParameters{T}

Parameters for baroclinic wind and buoyancy forced double-gyre ocean circulation model.

  • grid_size::Tuple{Int64, Int64, Int64}: Grid dimensions in longitude, latitude and depth

  • longitude_interval::Tuple{Int64, Int64}: Extent of spatial domain in longitude / °

  • latitude_interval::Tuple{Int64, Int64}: Extent of spatial domain in latitude / °

  • depth_interval::Tuple{T, T} where T: Extent of spatial domain in depth / m

  • depth_stretching_factor::Any: Stretching factor for hyperbolic spaced depth grid

  • halo_size::Tuple{Int64, Int64, Int64}: Dimensions of grid halo region in longitude, latitude and depth

  • u_10::Any: Average zonal wind velocity 10 meters above the ocean / m s⁻¹

  • c_d::Any: Dimensionless drag coefficient

  • ρ_a::Any: Approximate average density of air at sea-level, kg m⁻³

  • φ_u::Any: Latitude offset for zonal wind stress variation / °

  • Lφ_u::Any: Latitude scale for zonal wind stress variation / °

  • φ_S::Any: Latitude offset for reference salinity variation / °

  • Lφ_S::Any: Latitude scale for reference salinity variation / °

  • μ::Any: Bottom drag damping / m s⁻¹

  • ρ_s::Any: Sea water density / kg m⁻³

  • c_s::Any: Sea water specific heat capacity / J K⁻¹ kg⁻¹

  • T_polar::Any: Reference polar surface temperature / °C

  • T_equatorial::Any: Reference equatorial surface temperature / °C

  • T_abyssal::Any: Reference abyssal ocean temperature / °C

  • z_thermocline::Any: Thermocline reference depth / m

  • ℓ_thermocline::Any: Thermocline reference length scale / m

  • z_halocline::Any: Halocline reference depth / m

  • ℓ_halocline::Any: Halocline reference length scale / m

  • S_0::Any: Salinity reference level / g kg⁻¹

  • ΔS::Any: Salinity latitude variation amplitude / g kg⁻¹

  • τ_S::Any: Salinity restoring timescale / s

  • τ_T::Any: Temperature restoring timescale / s

source
GyreInABox.FreeSurfaceFieldsType
struct FreeSurfaceFields{S} <: GyreInABox.AbstractHorizontalModelOutput{S}

Free surface fields output.

Details

Records two-dimensional free surface (height and barotropic velocity) fields.

  • schedule::Any: Time interval to record output at / s
source
GyreInABox.HorizontalSliceType
struct HorizontalSlice{S, T} <: GyreInABox.AbstractHorizontalModelOutput{S}

Horizontal (latitude-longitude) slice output.

Details

Records horizontal slices through model velocity and tracer fields at specified depth.

  • depth::Any: Depth of slice / m

  • schedule::Any: Schedule to record output at

source
GyreInABox.LatitudeDepthSliceType
struct LatitudeDepthSlice{S, T} <: GyreInABox.AbstractVerticalModelOutput{S}

Vertical (latitude-depth) slice output.

Details

Records vertical slices through model velocity and tracer fields at specified longitude.

  • longitude::Any: Longitude of slice / °

  • schedule::Any: Schedule to record output at

source
GyreInABox.LongitudeDepthSliceType
struct LongitudeDepthSlice{S, T} <: GyreInABox.AbstractVerticalModelOutput{S}

Vertical (longitude-depth) slice output.

Details

Records vertical slices through model velocity and tracer fields at specified latitude.

  • latitude::Any: Latitude of slice / °

  • schedule::Any: Schedule to record output at

source
GyreInABox.MOCStreamFunctionType
struct MOCStreamFunction{S} <: GyreInABox.AbstractVerticalModelOutput{S}

Meridional overturning circulation (MOC) stream function output.

Details

Records latitude-depth or y-depth fields corresponding to stream function of meridional overturning circulation - computed here as vertically accumulated - that is cumulative vertical integral with respect to depth - of zonally integrated meridional velocity component:

\[\Psi^M(\varphi, z, t) = \int_{0}^z \int_{\lambda_W}^{\lambda_E} v(\lambda, \varphi, z', t) \,\mathrm{d}\lambda \,\mathrm{d}z'\]

or in rectilinear coordinates:

\[\Psi^M(y, z, t) = \int_{0}^z \int_{x_W}^{x_E} v(x, y, z', t) \,\mathrm{d}x \,\mathrm{d}z'\]

The outputted field is scaled to be in sverdrup (10⁶ m³ s⁻¹) units.

  • schedule::Any
source
GyreInABox.SimulationConfigurationType
struct SimulationConfiguration{T, A}

Configuration for ocean gyre model simulation

Details

Variables defining overall configuration of simulation such as architecture to run on, temporal discretization and outputs to record.

  • architecture::Any: Computational architecture to run simulation on

  • simulation_time::Any: Time to simulate for / s

  • initial_timestep::Any: Initial time step to use / s

  • maximum_timestep::Any: Maximum time step to use in time step adaptation / s

  • output_filename::String: Stem of output file names

  • progress_message_interval::Int64: Iteration interval between progress messages

  • target_cfl::Any: Target (advective) CFL number for time stepping wizard

  • wizard_update_interval::Int64: Update (iteration) interval for time stepping wizard

  • wizard_max_change::Any: Maximum relative time step change in each wizard update

  • output_types::Tuple: Output types to record during simulation

source
GyreInABox.Spall2011ParametersType
struct Spall2011Parameters{T} <: GyreInABox.AbstractParameters{T}

Parameters for simplified ocean gyre model from Spall (2011; 2012).

Details

Real-valued parameters of model controlling initial and boundary conditions.

References

  1. Spall, M.A., 2011. On the Role of Eddies and Surface Forcing in the Heat Transport and Overturning Circulation in Marginal Seas. Journal of Climate, 24, 4844–4858, https://doi.org/10.1175/2011JCLI4130.
  2. Spall, M. A., 2012: Influences of Precipitation on Water Mass Transformation and Deep Convection. J. Phys. Oceanogr., 42, 1684–1700, https://doi.org/10.1175/JPO-D-11-0230.1.
  • grid_size::Tuple{Int64, Int64, Int64}: Grid dimensions in x, y and depth

  • halo_size::Tuple{Int64, Int64, Int64}: Dimensions of grid halo region in x, y and depth

  • coriolis_offset::Any: β-plane Coriolis offset parameters / s⁻¹

  • coriolis_coefficient::Any: β-plane Coriolis coefficient parameter / m⁻¹s⁻¹

  • zonal_wind_stress::Any: Zonal wind stress amplitue / N m⁻²

  • meridional_wind_stress::Any: Meridional wind stress amplitue / N m⁻²

  • surface_temperature_restoring_strength::Any: Surface temperature restoring strength / W m⁻² K⁻¹

  • vertical_stratification::Any: Buoyancy vertical stratification coefficient / s⁻²

  • vertical_viscosity_coefficient::Any: Vertical scalar viscosity turbulence closure coefficient / m² s⁻¹

  • vertical_diffusivity_coefficient::Any: Vertical scalar diffusivity turbulence closure coefficient / m² s⁻¹

  • convective_vertical_diffusivity_coefficient::Any: Enhanced vertical scalar diffusivity coefficient in statically unstable conditions / m² s⁻¹

  • thermal_expansion_coefficient::Any: Thermal expansion coefficient / kg m⁻³ K⁻¹

  • haline_contraction_coefficient::Any: Haline contraction coefficient / kg m⁻³

  • sea_water_density::Any: Sea water reference density / kg m⁻³

  • sea_water_heat_capacity::Any: Sea water specific heat capacity / J K⁻¹ kg⁻¹

  • reference_salinity::Any: Reference salinity level used for initialisation and southern region forcing / psu

  • northern_basin_surface_salinity_flux::Any: Surface salinity flux in northern basin above sill / m s⁻¹

  • northern_surface_temperature::Any: Northern boundary surface temperature / °C

  • southern_surface_temperature::Any: Southern boundary surface temperature / °C

  • southern_region_relaxation_time::Any: Southern region temperature (and salinity) relaxation time scale / s

  • southern_region_extent::Any: Southern region extent / m

  • southern_boundary_window_width::Any: Southern region boundary smoothing window / m

  • depth_grid_scale_factor::Any: Scale factor for exponentially spaced depth grid

  • domain_size_x::Any: Domain size in x dimension / m

  • domain_size_y::Any: Domain size in y dimension / m

  • bottom_depth::Any: Depth of bottom of domain (most negative z) / m

  • sill_center_y::Any: Location of center of sill on sea floor along y dimension / m

  • sill_width::Any: Width of sill on sea floor / m

  • sill_height::Any: Height of sill on sea floor / m

  • side_slope_width::Any: Width of slope on side walls of domain / m

  • side_slope_top_depth::Any: Depth at which slope on side walls starts / m

  • top_slope_width::Any: Width of slope on top wall of domain / m

  • use_catke_closure::Bool: Whether to use CATKE rather than scalar vertical diffusivity turbulence closure

  • use_eddy_closure::Bool: Whether to include a dynamic Smagorinsky closure as a parameterization for eddy viscosity and diffusivity

  • initialize_with_reference_surface_temperature::Bool: Whether to initialise with reference surface temperature or constant

  • surface_wind_forcing_ramp_up_timescale::Any: Surface wind forcing ramp-up time scale / s

source
GyreInABox.TemporalAveragePlotOutputType
struct TemporalAveragePlotOutput{L<:Union{Int64, AbstractVector}} <: GyreInABox.AbstractPlotOutput

Field temporal average plot output type.

Details

Specifies plotting temporal average of model output fields recording during a simulation.

The temporal averages are plotted as filled contour plots.

  • levels::Union{Int64, AbstractVector}: Either an integer specifying number of contour levels with range automatically determined or a vector of specific edge values to use.
source
GyreInABox.XDepthSliceType
struct XDepthSlice{S, T} <: GyreInABox.AbstractVerticalModelOutput{S}

Vertical (x-depth) slice output.

Details

Records vertical slices through model velocity and tracer fields at specified y coordinate.

  • y::Any: y coordinate of slice / m

  • schedule::Any: Schedule to record output at

source
GyreInABox.YDepthSliceType
struct YDepthSlice{S, T} <: GyreInABox.AbstractVerticalModelOutput{S}

Vertical (y-depth) slice output.

Details

Records vertical slices through model velocity and tracer fields at specified x coordinate.

  • x::Any: x coordinate of slice / m

  • schedule::Any: Schedule to record output at

source
GyreInABox.add_output_writers!Method

Register output writers for output types in output_types in simulation using output filenames with stem output_filename_stem

add_output_writers!(
    simulation,
    output_types,
    output_filename_stem
)
source
GyreInABox.axis_aspect_ratioMethod

Aspect ratio for field heatmaps.

axis_aspect_ratio(
    _::GyreInABox.AbstractModelOutput,
    _::Oceananigans.Grids.AbstractGrid
) -> Any
source
GyreInABox.axis_xlabelFunction
axis_xlabel(output, grid)

Label for horizontal axis for field heatmaps on grid grid for output output.

source
GyreInABox.axis_ylabelFunction
axis_ylabel(output, grid)

Label for vertical axis for field heatmaps on grid grid for output output.

source
GyreInABox.bottom_meridional_dragMethod

Bottom surface drag on meridional velocity component in m² s⁻².

bottom_meridional_drag(i, j, grid, clock, model_fields, p)

Details

Computes bottom surface drag at horizontal grid indices i and j for grid grid and model clock clock, with current model fields model_fields and parameters p.

source
GyreInABox.bottom_zonal_dragMethod

Bottom surface drag on zonal velocity component in m² s⁻².

bottom_zonal_drag(i, j, grid, clock, model_fields, p)

Details

Computes bottom surface drag at horizontal grid indices i and j for grid grid and model clock clock, with current model fields model_fields and parameters p.

source
GyreInABox.buoyancyFunction
buoyancy(parameters)

Construct buoyancy formulation for ocean gyre model given parameters parameters.

source
GyreInABox.closureFunction
closure(parameters)

Construct turbulence closure(s) for ocean gyre model given parameters parameters.

source
GyreInABox.coriolisFunction
coriolis(parameters)

Construct Coriolis force formulation for ocean gyre model given parameters parameters.

source
GyreInABox.forcingFunction
forcing(parameters)

Construct named tuple of forcings for ocean gyre model given parameters parameters.

source
GyreInABox.get_titleFunction
get_title(plot_output, time_index, times)

Constructs figure title for plot_output output type optionally using information about simulation times in times and observable time index time_index.

source
GyreInABox.get_variable_plot_configurationsMethod

Get dicitionary of per-variable plot configurations by merging user-provided overrides in plot_configuration_overrides with default configurations.

get_variable_plot_configurations(
    plot_configuration_overrides
)
source
GyreInABox.gridFunction
grid(parameters, architecture::Oceananigans.AbstractArchitecture)

Set up ocean gyre model grid with parameters parameters on architecture architecture.

source
GyreInABox.hyperbolically_spaced_facesMethod

Compute hyperbolically spaced grid face coordinate at index k for coordinate discretized into size cells from lower value lower to upper value upper with strething factor stretching_factor.

hyperbolically_spaced_faces(
    k,
    size,
    lower,
    upper,
    stretching_factor
)
source
GyreInABox.indicesMethod

Spatial grid indices output type records fields at.

indices(
    _::GyreInABox.AbstractModelOutput,
    grid
) -> Tuple{Colon, Colon, Any}
source
GyreInABox.initial_salinityMethod

Initial salinity at latitude φ and depth z with parameters p.

initial_salinity(φ, z, p)

Details

Computes a latitude and depth dependent initial salinity with halocline like profile which smoothly varies from a latitude dependent surface salinity to a constant deep ocean salinity with a sigmoidal profile.

source
GyreInABox.initial_temperatureMethod

Initial temperature at latitude φ and depth z with parameters p.

initial_temperature(φ, z, p)

Details

Computes a latitude and depth dependent initial temperature with thermocline like profile which smoothly varies from a latitude dependent surface temperature to a constant deep ocean temperature with a sigmoidal profile.

source
GyreInABox.initialize!Function
initialize!(model::Oceananigans.AbstractModel, parameters)

Initialize state of ocean gyre model model with parameters parameters.

source
GyreInABox.labelMethod

Symbol label for output type to use in naming output file and registering output writer.

label(_::GyreInABox.AbstractModelOutput) -> Symbol
source
GyreInABox.ordered_field_variablesMethod

Get ordered sequence of field variables to plot from field_time_series based on those for which plot configurations are defined in variable_plot_configurations and not excluded in exclude_variables.

ordered_field_variables(
    field_timeseries,
    variable_plot_configurations,
    exclude_variables
)
source
GyreInABox.output_filenameMethod

Filename to record outputs to.

output_filename(
    stem::String,
    label::Symbol,
    extension::String
) -> String

Details

For an output output a label computed using label function is appended on to stemand file extension is specified byextension` added.

source
GyreInABox.outputsMethod

Named tuple of output variables (fields) to record for output type.

outputs(_::GyreInABox.AbstractModelOutput, model) -> Any
source
GyreInABox.plot_field_on_axis!Function
plot_field_on_axis!(axis, plot_output, field_timeseries, time_index, config)

Plots visual representation of field_timeseries appropriate for plot_output output type on axis, optionally using observable time_index to index into field_timeseries and with plot configuration options for variable represented in field_timeseries specified in config.

source
GyreInABox.plot_grid_dimensionsMethod

Compute dimensions of plot grid for n_fields fields with maximum number of grid columns max_columns.

plot_grid_dimensions(n_fields, max_columns)
source
GyreInABox.plot_outputMethod

Create plot of fields recorded as model output.

plot_output(
    plot_output_type,
    output_filename_stem,
    model_output,
    grid;
    max_columns,
    axis_width,
    axis_height,
    title_height,
    exclude_variables,
    plot_configuration_overrides
)

Details

Generates and record to file with filename stem output_filename_stem an animation of model outputs for output type model_output and for a model grid grid. The simulation must have already been run for a model with this grid and with specified output type active.

Animation is recorded with a frame rate of frame_rate frames per second, with fields arranged on a grid with a maximum of max_columns columns, with the axis for each field heatmap of size (axis_width, axis_height) in pixels and a further title_height pixels allowed at the top of the figure for a title showing the simulation time. Each frame of animation steps frame_step time indices through field time series.

By default the plot configurations for each field variable are taken from the GyreInABox.DEFAULT_VARIABLE_PLOT_CONFIGURATIONS dictionary but these can be overridden by passing a dictionary plot_configuration_overrides with keys corresponding to the variable names to override. Specific variables to exclude from plot can be specified in a tuple of variable names exclude_variables.

source
GyreInABox.plot_outputsMethod

Plot outputs of fields recorded as simulation output.

plot_outputs(
    plot_output_type,
    grid,
    configuration;
    kwargs...
)

Details

Generates and record to files plots of type plot_output_type for model outputs on grid grid and for a simulation configuration configuration. Keyword arguments kwargs are passed through to plot_output() and can be used to customize plot output.

source
GyreInABox.plot_row_column_indicesMethod

Compute figure row and column indices for axis for field variable indexed by variable_index for plot grid with n_columns columns.

plot_row_column_indices(variable_index, n_columns)
source
GyreInABox.run_simulationMethod

Setup and initialize model then setup and run simulation with parameters parameters and configuration configuration.

run_simulation(parameters, configuration)
source
GyreInABox.save_outputFunction
save_output(
    plot_output,
    fig,
    times,
    time_index,
    output_filename_stem,
    model_output
)

Saves plot file output for plot_output and model_output visualized on Makie figure fig with model outputs recorded with output_filename_step, optionally using simulation times times and observable time_index.

source
GyreInABox.scheduleMethod

Time schedule to record output type at.

schedule(output::GyreInABox.AbstractModelOutput) -> Any
source
GyreInABox.setup_figureMethod

Setup figure object of appropriate size for n_rows rows and n_columns of axis objects each of size (axis_width, axis_height) plus a top margin of title_height for inclusion of a figure title.

setup_figure(
    n_rows,
    n_columns,
    axis_width,
    axis_height,
    title_height
)
source
GyreInABox.setup_modelMethod

Set up ocean gyre model with parameters parameters on grid with architecture architecture.

setup_model(parameters; architecture)
source
GyreInABox.sigmoidal_depth_profileMethod

Sigmoidal depth profile which smoothly varies from f_top at z = 0 to f_bottom at z = -depth with length scale for smooth transition and offset for midpoint of smooth transition z_0.

sigmoidal_depth_profile(z, z_0, ℓ, f_bottom, f_top)
source
GyreInABox.smooth_stepMethod

Smooth piecewise defined step function that is zero for negative d, one for d > 1 and smoothly interpolates between these values for 0 ≤ d ≤ 1.

source
GyreInABox.surface_salinity_fluxMethod

Surface salinity flux in g kg⁻¹ m s⁻¹.

surface_salinity_flux(
    i,
    j,
    grid,
    clock,
    model_fields,
    parameters_and_Δz
)

Details

Relaxation boundary condition that restores surface salinity to latitude dependent profile determined by reference_surface_salinity.

source
GyreInABox.surface_temperature_fluxMethod

Surface temperature flux in K m s⁻¹.

surface_temperature_flux(
    i,
    j,
    grid,
    clock,
    model_fields,
    parameters_and_Δz
)

Details

Relaxation boundary condition that restores surface temperature to latitude dependent profile determined by reference_surface_temperature.

source
GyreInABox.tracersFunction
tracers(parameters)

Construct tuple of tracer field names for ocean gyre model given parameters parameters.

source
GyreInABox.variable_limitsMethod

Variable value limits for field color mapping.

variable_limits(
    limits::Tuple{T, T},
    _::Oceananigans.OutputReaders.FieldTimeSeries
) -> Tuple{T, T} where T
source
GyreInABox.zonal_wind_stressMethod

Zonal wind stress applied as surface (flux) boundary condition to velocity field.

zonal_wind_stress(λ, φ, t, p)

Details

Computes wind stress in zonal direction at longitude λ and latitude φ (both in degrees), time t and with model parameters p.

source