Library

Documentation for the public user interface.

Oceanostics._show_diagnostic — Method

Print Oceananigans' KFO tree for op, then a └── computes: … line with the diagnostic's description. On color-capable streams the leading name in the header and the description are tinted with DESCRIPTION_CRAYON. The tree is rendered through Oceananigans' own KFO show (into a buffer) so its layout is reused verbatim; we only recolor the diagnostic name, which is the header's prefix.

source
Oceanostics._show_diagnostic_summary — Method

Print the compact summary(op) one-liner (used when a diagnostic appears nested in a container, e.g. the NamedTuple of components a tensor returns), tinting the leading name with DESCRIPTION_CRAYON on color-capable streams — so the name matches the colored header of the multi-line show. The summary starts with name, so we recolor only that prefix and leave the rest (KernelFunctionOperation at …) untinted, exactly as the tree does.

source
Oceanostics.free_surface_displacement — Method
free_surface_displacement(free_surface)

Return the displacement η of free_surface, a ZFaceField windowed to the top face of the grid, or nothing for a rigid lid. Oceananigans named the field η through 0.103 and displacement from 0.104 on, both inside the compat range.

source
Oceanostics.model_free_surface — Method
model_free_surface(model)

Return the free surface of model, or nothing when it has none. A HydrostaticFreeSurfaceModel always has the slot; a NonhydrostaticModel has had it since Oceananigans 0.102 but fills it only when built with a free_surface, and keeps a rigid lid otherwise. The free-surface diagnostics take this and dispatch on nothing.

source
Oceanostics.momentum_advection — Method
momentum_advection(model)

Return the scheme model advects momentum with. HydrostaticFreeSurfaceModel and, since Oceananigans 0.112, NonhydrostaticModel keep their schemes in a NamedTuple with a momentum entry plus one entry per tracer; an older NonhydrostaticModel carries a single scheme for everything, which is returned as is.

source
Oceanostics.perturbation_fields — Method
perturbation_fields(
    model;
    perturbation_boundary_conditions,
    kwargs...
)

Remove mean fields, passed as keyword arguments such as u = U, from the velocities and tracers of model with the same names, and return them with the rest of fields(model), which includes the auxiliary fields and, for a HydrostaticFreeSurfaceModel, the diagnostic w. A keyword that names no velocity or tracer throws an ArgumentError. That includes U and V, which on a model with a SplitExplicitFreeSurface name the barotropic transports rather than the means of u and v.

Each perturbation is a computed Field with boundary conditions of its own. They are zero flux at every wall unless perturbation_boundary_conditions sets them, as a NamedTuple of FieldBoundaryConditions keyed by field name, and a side left out keeps the default. At a wall where the model field has a value or gradient condition, give the perturbation the condition it satisfies there, or derivatives across the wall face come out zero. For a no-slip bottom and a horizontal mean of u, that is perturbation_boundary_conditions = (u = FieldBoundaryConditions(bottom = ValueBoundaryCondition(0)),). A computed Field fills its halos without the model's clock or fields, so the conditions have to be constants.

source
Oceanostics.set_description_color! — Method
set_description_color!(c::Crayon)

Configure the Crayon used to color a diagnostic's show output (the header's diagnostic name and the └── computes: … description line). Build a Crayon with Crayons.jl (using Crayons), e.g. crayon"red" or Crayon(foreground = :red).

julia> using Oceanostics, Crayonsjulia> set_description_color!(crayon"magenta");julia> DESCRIPTION_CRAYON[] == crayon"magenta"true
source
Oceanostics.tracer_advection — Method
tracer_advection(model, tracer_name)

Return the scheme model advects the tracer tracer_name with. See momentum_advection for the two layouts of model.advection this covers.

source
Oceanostics.SurfaceDisplacement — Type
SurfaceDisplacement(η)

Wrap the displacement η for use as a KernelFunctionOperation argument. η is a Field windowed to the top face, indices = (:, :, Nz+1), and handed to an operation as it is it would narrow the operation's own indices to that face, which has no intersection with a three-dimensional result (intersect_indices). The wrapper keeps the window out of that calculation and indexes like the field, so the kernels read it on the top face explicitly. nothing, a rigid lid, passes through.

source
Oceanostics.@diagnostic_show — Macro
@diagnostic_show T name [description]

Give the CustomKFO type alias T a custom display: rename its show/summary header to "<name> KernelFunctionOperation", and (when description is non-empty) append a └── computes: <description> line to its multi-line show. On color-capable streams the leading <name> and the description are tinted with DESCRIPTION_CRAYON. The header rename goes through Oceananigans' operation_name, so it also propagates (uncolored) to summary(op) and to op's appearance inside larger operation trees and Field operand lines.

Following the Julia convention, the full multi-line tree is the three-arg show (used by the REPL/display for a standalone object), while the two-arg show is the compact summary(op) one-liner with the leading <name> tinted the same DESCRIPTION_CRAYON as the tree's header. This keeps a diagnostic readable when it appears nested in a container — e.g. inside the NamedTuple of components a tensor diagnostic returns, which would otherwise print one full tree per component.

source