tomchor / Oceanostics.jl

Diagnostics for Oceananigans
https://tomchor.github.io/Oceanostics.jl/
MIT License
24 stars 8 forks source link

Rework of `ProgressMessenger`s #129

Closed tomchor closed 10 months ago

tomchor commented 1 year ago

At the moment we only have 3 types of progress messengers that have a mostly pre-determined output: SimpleProgressMessenger, SingleLineProgressMessenger and TimedProgressMessenger. This isn't very flexible and there's a lot of code shared between these three.

I'm thinking creating an AbstractProgressMessenger struct that takes a list of functions, each of these functions acts on simulation to get a specific output. A lot of these functions could be pre-programmed (the obvious stuff like max velocity, cfl, etc.) but they could also be user-defined.

The UI would be something like

using Oceanostics.ProgressMessengers

progress_messenger = ProgressMessenger(Iteration, MaxVelocity, AdvectiveCFL)
simulation.callbacks[:progress] = Callback(progress_messenger)

where Iteration, MaxVelocity and AdvectiveCFL would be Oceanostics functions that print the time step, maximum vel and CFL in a nice way.