Progress messengers

The ProgressMessengers submodule provides composable simulation progress reporters for use as Oceananigans Callbacks. During long-running ocean simulations, it is important to monitor quantities like the current time step, wall-clock time per iteration, maximum velocities, and CFL numbers. This module supplies individual reporter components for each of these quantities, along with pre-built combinations that cover common use cases.

The key design idea is composability: messengers are combined with two operators:

  • + concatenates messages separated by a comma (,), suitable for grouping independent quantities on one line.
  • * concatenates messages with no separator, useful for building prefixed or bracketed expressions.

This lets users build custom progress output from atomic components without writing formatting boilerplate. For example, Iteration() + SimulationTime() + TimeStep() produces output like iter = 5, time = 5 seconds, Δt = 1 second.

The module provides three levels of pre-built messengers with increasing detail:

  • BasicMessenger: percentage, simulation time, time step, wall time, advective CFL, and diffusive CFL.
  • SingleLineMessenger: adds iteration count and wall time to the basic output.
  • TimedMessenger: the most detailed, adding per-step wall time and maximum velocity components.

Example

julia> using Oceananigans, Oceanostics

julia> grid = RectilinearGrid(size=(4, 4, 4), extent=(1, 1, 1));

julia> model = NonhydrostaticModel(grid; closure=SmagorinskyLilly());

julia> simulation = Simulation(model, Δt=1, stop_time=10);

julia> progress = ProgressMessengers.Iteration() + ProgressMessengers.SimulationTime() + ProgressMessengers.AdvectiveCFLNumber();

julia> simulation.callbacks[:progress] = Callback(progress, IterationInterval(5));

julia> typeof(progress) <: Oceanostics.ProgressMessengers.AbstractProgressMessenger
true

Pre-built messengers

TypeDescription
BasicMessengerPercentage progress, simulation time, time step, wall time, advective CFL, diffusive CFL
SingleLineMessengerIteration count, plus everything in BasicMessenger
TimedMessengerPer-step wall time, max velocities, plus everything in SingleLineMessenger

Timing components

TypeDescription
IterationCurrent iteration number
SimulationTimeCurrent simulation time
TimeStepCurrent time step Δt
PercentageProgressProgress as a percentage (by time or iteration)
WalltimeElapsed wall-clock time since the start
StepDurationWall-clock time per time step
BasicTimeMessengerCombines PercentageProgress, SimulationTime, TimeStep, and Walltime
TimeMessengerAdds Iteration to BasicTimeMessenger
StopwatchMessengerAdds StepDuration to TimeMessenger

Velocity components

TypeDescription
MaxUVelocityMaximum absolute u velocity
MaxVVelocityMaximum absolute v velocity
MaxWVelocityMaximum absolute w velocity
MaxVelocitiesAll three components formatted as a vector

Stability components

TypeDescription
AdvectiveCFLNumberAdvective CFL number (aliased as CourantNumber)
DiffusiveCFLNumberDiffusive CFL number (aliased as NormalizedMaxViscosity)
MaxViscosityMaximum viscosity
BasicStabilityMessengerCombines advective and diffusive CFL
StabilityMessengerAdds MaxViscosity to BasicStabilityMessenger