Skip to content

Commit

Permalink
Show methods display information about the advection scheme(s) (#3542)
Browse files Browse the repository at this point in the history
* show advection scheme(s)

* delete empty cubed sphere ci pipelines

cubed sphere is tested in MultiRegion atm

* fix doctests

* code alignment
  • Loading branch information
navidcy committed Apr 7, 2024
1 parent 1775f2b commit 02e44aa
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 29 deletions.
27 changes: 0 additions & 27 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -423,33 +423,6 @@ steps:
architecture: CPU
depends_on: "init_cpu"

#####
##### Cubed sphere
#####

- label: "🐡 gpu cubed sphere tests"
env:
JULIA_DEPOT_PATH: "$SVERDRUP_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "cubed_sphere"
commands:
- "$SVERDRUP_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
agents:
queue: Oceananigans
architecture: GPU
depends_on: "init_gpu"

- label: "🦔 cpu cubed sphere tests"
env:
JULIA_DEPOT_PATH: "$TARTARUS_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "cubed_sphere"
CUDA_VISIBLE_DEVICES: "-1"
commands:
- "$TARTARUS_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
agents:
queue: Oceananigans
architecture: CPU
depends_on: "init_cpu"

#####
##### Multi-Region
#####
Expand Down
2 changes: 2 additions & 0 deletions docs/src/model_setup/boundary_conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ julia> model = NonhydrostaticModel(; grid, boundary_conditions=(u=no_slip_field_
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 16×16×16 RectilinearGrid{Float64, Periodic, Bounded, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: ()
├── closure: Nothing
├── buoyancy: Nothing
Expand Down Expand Up @@ -404,6 +405,7 @@ julia> model = NonhydrostaticModel(grid=grid, boundary_conditions=(u=u_bcs, c=c_
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 16×16×16 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: c
├── closure: Nothing
├── buoyancy: Nothing
Expand Down
6 changes: 6 additions & 0 deletions docs/src/model_setup/buoyancy_and_equation_of_state.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ julia> model = NonhydrostaticModel(; grid, buoyancy=nothing)
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 8×8×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: ()
├── closure: Nothing
├── buoyancy: Nothing
Expand All @@ -43,6 +44,7 @@ julia> model = NonhydrostaticModel(; grid)
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 8×8×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: ()
├── closure: Nothing
├── buoyancy: Nothing
Expand Down Expand Up @@ -78,6 +80,7 @@ julia> model = NonhydrostaticModel(; grid, buoyancy=BuoyancyTracer(), tracers=:b
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 8×8×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: b
├── closure: Nothing
├── buoyancy: BuoyancyTracer with ĝ = NegativeZDirection()
Expand Down Expand Up @@ -118,6 +121,7 @@ julia> model = NonhydrostaticModel(; grid, buoyancy=SeawaterBuoyancy(), tracers=
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 8×8×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: (T, S)
├── closure: Nothing
├── buoyancy: SeawaterBuoyancy with g=9.80665 and LinearEquationOfState(thermal_expansion=0.000167, haline_contraction=0.00078) with ĝ = NegativeZDirection()
Expand Down Expand Up @@ -175,6 +179,7 @@ julia> model = NonhydrostaticModel(; grid, buoyancy, tracers=(:T, :S))
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 8×8×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: (T, S)
├── closure: Nothing
├── buoyancy: SeawaterBuoyancy with g=1.3 and LinearEquationOfState(thermal_expansion=0.000167, haline_contraction=0.00078) with ĝ = NegativeZDirection()
Expand Down Expand Up @@ -250,6 +255,7 @@ julia> model = NonhydrostaticModel(; grid,
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 8×8×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: b
├── closure: Nothing
├── buoyancy: BuoyancyTracer with ĝ = Tuple{Float64, Float64, Float64}
Expand Down
1 change: 1 addition & 0 deletions docs/src/model_setup/lagrangian_particles.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ model = NonhydrostaticModel(grid=grid, particles=lagrangian_particles)
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 10×10×10 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: ()
├── closure: Nothing
├── buoyancy: Nothing
Expand Down
3 changes: 3 additions & 0 deletions docs/src/model_setup/tracers.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ julia> model = NonhydrostaticModel(; grid)
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 16×16×16 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: ()
├── closure: Nothing
├── buoyancy: Nothing
Expand All @@ -30,6 +31,7 @@ julia> model = NonhydrostaticModel(; grid, tracers=(:T, :S))
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 16×16×16 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: (T, S)
├── closure: Nothing
├── buoyancy: Nothing
Expand Down Expand Up @@ -64,6 +66,7 @@ julia> model = NonhydrostaticModel(; grid, tracers=(:T, :S, :C₁, :CO₂, :nitr
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 16×16×16 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: (T, S, C₁, CO₂, nitrogen)
├── closure: Nothing
├── buoyancy: Nothing
Expand Down
1 change: 1 addition & 0 deletions src/BuoyancyModels/buoyancy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ model = NonhydrostaticModel(; grid, buoyancy, tracers=:b)
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 1×8×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: b
├── closure: Nothing
├── buoyancy: BuoyancyTracer with ĝ = Tuple{Float64, Float64, Float64}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ function Base.show(io::IO, model::HydrostaticFreeSurfaceModel)
print(io, "└── particles: $(length(particles)) Lagrangian particles with $(length(properties)) properties: $properties")
end
end

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function Base.show(io::IO, model::NonhydrostaticModel)
print(io, summary(model), "\n",
"├── grid: ", summary(model.grid), "\n",
"├── timestepper: ", TS, "\n",
"├── advection scheme: ", summary(model.advection), "\n",
"├── tracers: ", tracernames, "\n",
"├── closure: ", closure_summary(model.closure), "\n",
"├── buoyancy: ", summary(model.buoyancy), "\n")
Expand Down
18 changes: 17 additions & 1 deletion src/Models/ShallowWaterModels/show_shallow_water_model.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
using Oceananigans.Utils: prettytime

"""Show the innards of a `Model` in the REPL."""
Base.show(io::IO, model::ShallowWaterModel{G, A, T}) where {G, A, T} =
function Base.show(io::IO, model::ShallowWaterModel{G, A, T}) where {G, A, T}
TS = nameof(typeof(model.timestepper))

print(io, "ShallowWaterModel{$(Base.typename(A)), $T}",
"(time = $(prettytime(model.clock.time)), iteration = $(model.clock.iteration)) \n",
"├── grid: $(summary(model.grid))\n",
"├── timestepper: ", TS, "\n")

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

print(io,
"├── tracers: $(tracernames(model.tracers))\n",
"└── coriolis: $(typeof(model.coriolis))")
end
1 change: 1 addition & 0 deletions src/Models/seawater_density.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ julia> model = NonhydrostaticModel(; grid, buoyancy, tracers)
NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 1×1×100 RectilinearGrid{Float64, Flat, Flat, Bounded} on CPU with 0×0×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: (T, S)
├── closure: Nothing
├── buoyancy: SeawaterBuoyancy with g=9.80665 and BoussinesqEquationOfState{Float64} with ĝ = NegativeZDirection()
Expand Down

0 comments on commit 02e44aa

Please sign in to comment.