From b69b1d9970eac385b40da71194f2f120dc777c07 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Mon, 11 Mar 2024 23:34:43 +0200 Subject: [PATCH] Show method for `HydrostaticFreeSurfaceModel` summarizes advection schemes (#3504) * show(io, ::HydrostaticFreeSurfaceModel) summarizes advection schemes * fix doctests --- .../model_setup/buoyancy_and_equation_of_state.md | 13 +++++++++++++ .../show_hydrostatic_free_surface_model.jl | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/docs/src/model_setup/buoyancy_and_equation_of_state.md b/docs/src/model_setup/buoyancy_and_equation_of_state.md index 8329573b8d..ce9470b11a 100644 --- a/docs/src/model_setup/buoyancy_and_equation_of_state.md +++ b/docs/src/model_setup/buoyancy_and_equation_of_state.md @@ -63,6 +63,8 @@ HydrostaticFreeSurfaceModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = ├── buoyancy: Nothing ├── free surface: ImplicitFreeSurface with gravitational acceleration 9.80665 m s⁻² │ └── solver: FFTImplicitFreeSurfaceSolver +├── advection scheme: +│ └── momentum: Centered reconstruction order 2 └── coriolis: Nothing ``` @@ -94,6 +96,9 @@ HydrostaticFreeSurfaceModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = ├── buoyancy: BuoyancyTracer with ĝ = NegativeZDirection() ├── free surface: ImplicitFreeSurface with gravitational acceleration 9.80665 m s⁻² │ └── solver: FFTImplicitFreeSurfaceSolver +├── advection scheme: +│ ├── momentum: Centered reconstruction order 2 +│ └── b: Centered reconstruction order 2 └── coriolis: Nothing ``` @@ -131,6 +136,10 @@ HydrostaticFreeSurfaceModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = ├── buoyancy: SeawaterBuoyancy with g=9.80665 and LinearEquationOfState(thermal_expansion=0.000167, haline_contraction=0.00078) with ĝ = NegativeZDirection() ├── free surface: ImplicitFreeSurface with gravitational acceleration 9.80665 m s⁻² │ └── solver: FFTImplicitFreeSurfaceSolver +├── advection scheme: +│ ├── momentum: Centered reconstruction order 2 +│ ├── T: Centered reconstruction order 2 +│ └── S: Centered reconstruction order 2 └── coriolis: Nothing ``` @@ -146,6 +155,10 @@ HydrostaticFreeSurfaceModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = ├── buoyancy: SeawaterBuoyancy with g=9.80665 and LinearEquationOfState(thermal_expansion=0.000167, haline_contraction=0.00078) with ĝ = NegativeZDirection() ├── free surface: ImplicitFreeSurface with gravitational acceleration 9.80665 m s⁻² │ └── solver: FFTImplicitFreeSurfaceSolver +├── advection scheme: +│ ├── momentum: Centered reconstruction order 2 +│ ├── T: Centered reconstruction order 2 +│ └── S: Centered reconstruction order 2 └── coriolis: Nothing ``` diff --git a/src/Models/HydrostaticFreeSurfaceModels/show_hydrostatic_free_surface_model.jl b/src/Models/HydrostaticFreeSurfaceModels/show_hydrostatic_free_surface_model.jl index d46b919028..a423ea83f8 100644 --- a/src/Models/HydrostaticFreeSurfaceModels/show_hydrostatic_free_surface_model.jl +++ b/src/Models/HydrostaticFreeSurfaceModels/show_hydrostatic_free_surface_model.jl @@ -31,6 +31,16 @@ function Base.show(io::IO, model::HydrostaticFreeSurfaceModel) end end + if model.advection !== nothing + print(io, "├── advection scheme: ", "\n") + names = keys(model.advection) + for name in names[1:end-1] + print(io, "│ ├── " * string(name) * ": " * summary(model.advection[name]), "\n") + end + name = names[end] + print(io, "│ └── " * string(name) * ": " * summary(model.advection[name]), "\n") + end + if isnothing(model.particles) print(io, "└── coriolis: $(typeof(model.coriolis))") else