Skip to content

Commit

Permalink
(0.92.0) Make RungeKutta3 the default time-stepper for Nonhydrostatic…
Browse files Browse the repository at this point in the history
…Model (#3580)

* Make RK3 the default time-stepper for NonhydrostaticModel

* Change regression tests to use AB2

* Fix up time stepping tests

* Fix up forcings tests

* Fix more tests

* Fix docstrings

* Fix datetime test but thats weird

* Fix doctest for seawater density

* update docstring

* Fix docstrings

* Last docstring? famous last words

* Test AB2 for date tests now

* Use AB2 for time-stepping tests

* Update time stepper tests

* Use AB2 for netcdf tests

* Update NetCDF test to AB2

* Update another NetCDF test to AB2

* Bump to new version

* Just cosmetic stuff

* More cosmetic upgrades

* oops

* FT -> Ft

* Fix eulers

* Update pipeline.yml

---------

Co-authored-by: Navid C. Constantinou <navidcy@users.noreply.github.com>
  • Loading branch information
glwagner and navidcy authored Sep 29, 2024
1 parent 8642ffc commit 41209a2
Show file tree
Hide file tree
Showing 19 changed files with 123 additions and 120 deletions.
8 changes: 8 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ steps:
agents:
queue: Oceananigans
architecture: GPU
retry:
automatic:
- exit_status: 1
limit: 1

- label: "🏕️ initialize cpu environment"
key: "init_cpu"
Expand All @@ -38,6 +42,10 @@ steps:
agents:
queue: Oceananigans
architecture: CPU
retry:
automatic:
- exit_status: 1
limit: 1

#####
##### Unit tests
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Oceananigans"
uuid = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
authors = ["Climate Modeling Alliance and contributors"]
version = "0.91.15"
version = "0.92.0"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
4 changes: 2 additions & 2 deletions docs/src/model_setup/boundary_conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ julia> no_slip_field_bcs = FieldBoundaryConditions(no_slip_bc);
julia> model = NonhydrostaticModel(; grid, boundary_conditions=(u=no_slip_field_bcs, v=no_slip_field_bcs, w=no_slip_field_bcs))
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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: ()
├── closure: Nothing
Expand Down Expand Up @@ -404,7 +404,7 @@ julia> c_bcs = FieldBoundaryConditions(top = ValueBoundaryCondition(20.0),
julia> model = NonhydrostaticModel(grid=grid, boundary_conditions=(u=u_bcs, c=c_bcs), tracers=: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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: c
├── closure: Nothing
Expand Down
12 changes: 6 additions & 6 deletions docs/src/model_setup/buoyancy_and_equation_of_state.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ julia> grid = RectilinearGrid(size=(8, 8, 8), extent=(1, 1, 1));
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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: ()
├── closure: Nothing
Expand All @@ -43,7 +43,7 @@ The option `buoyancy = nothing` is the default for [`NonhydrostaticModel`](@ref)
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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: ()
├── closure: Nothing
Expand Down Expand Up @@ -77,7 +77,7 @@ a buoyancy tracer by including `:b` in `tracers` and specifying `buoyancy = Buo
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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: b
├── closure: Nothing
Expand Down Expand Up @@ -118,7 +118,7 @@ S.I. units ``\text{m}\,\text{s}^{-2}``) and requires to add `:T` and `:S` as tra
julia> model = NonhydrostaticModel(; grid, buoyancy=SeawaterBuoyancy(), 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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: (T, S)
├── closure: Nothing
Expand Down Expand Up @@ -157,7 +157,7 @@ SeawaterBuoyancy{Float64}:
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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: (T, S)
├── closure: Nothing
Expand Down Expand Up @@ -238,7 +238,7 @@ Buoyancy:
julia> model = NonhydrostaticModel(; grid, buoyancy, 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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: b
├── closure: Nothing
Expand Down
2 changes: 1 addition & 1 deletion docs/src/model_setup/lagrangian_particles.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ model = NonhydrostaticModel(grid=grid, particles=lagrangian_particles)
# output
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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: ()
├── closure: Nothing
Expand Down
6 changes: 3 additions & 3 deletions docs/src/model_setup/tracers.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ julia> grid = RectilinearGrid(size=(16, 16, 16), extent=(1, 1, 1));
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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: ()
├── closure: Nothing
Expand All @@ -30,7 +30,7 @@ For example, to add conservative temperature `T` and absolute salinity `S`:
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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: (T, S)
├── closure: Nothing
Expand Down Expand Up @@ -65,7 +65,7 @@ An arbitrary number of tracers may be simulated. For example, to simulate
julia> model = NonhydrostaticModel(; grid, tracers=(:T, :S, :C₁, :CO₂, :nitrogen))
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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: (T, S, C₁, CO₂, nitrogen)
├── closure: Nothing
Expand Down
2 changes: 1 addition & 1 deletion docs/src/simulation_tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ julia> grid = RectilinearGrid(GPU(); size=(1, 1, 1), extent=(1, 1, 1), halo=(1,
julia> model = NonhydrostaticModel(; grid)
NonhydrostaticModel{GPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 1×1×1 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on GPU with 1×1×1 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── timestepper: RungeKutta3TimeStepper
├── tracers: ()
├── closure: Nothing
├── buoyancy: Nothing
Expand Down
2 changes: 1 addition & 1 deletion src/BuoyancyModels/buoyancy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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 1×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: b
├── closure: Nothing
Expand Down
6 changes: 3 additions & 3 deletions src/Models/NonhydrostaticModels/nonhydrostatic_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ end
closure = nothing,
boundary_conditions::NamedTuple = NamedTuple(),
tracers = (),
timestepper = :QuasiAdamsBashforth2,
timestepper = :RungeKutta3,
background_fields::NamedTuple = NamedTuple(),
particles::ParticlesOrNothing = nothing,
biogeochemistry::AbstractBGCOrNothing = nothing,
Expand Down Expand Up @@ -95,7 +95,7 @@ Keyword arguments
- `tracers`: A tuple of symbols defining the names of the modeled tracers, or a `NamedTuple` of
preallocated `CenterField`s.
- `timestepper`: A symbol that specifies the time-stepping method. Either `:QuasiAdamsBashforth2` or
`:RungeKutta3`.
`:RungeKutta3` (default).
- `background_fields`: `NamedTuple` with background fields (e.g., background flow). Default: `nothing`.
- `particles`: Lagrangian particles to be advected with the flow. Default: `nothing`.
- `biogeochemistry`: Biogeochemical model for `tracers`.
Expand All @@ -121,7 +121,7 @@ function NonhydrostaticModel(; grid,
closure = nothing,
boundary_conditions::NamedTuple = NamedTuple(),
tracers = (),
timestepper = :QuasiAdamsBashforth2,
timestepper = :RungeKutta3,
background_fields::NamedTuple = NamedTuple(),
particles::ParticlesOrNothing = nothing,
biogeochemistry::AbstractBGCOrNothing = nothing,
Expand Down
2 changes: 1 addition & 1 deletion src/Models/seawater_density.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ SeawaterBuoyancy{Float64}:
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
├── timestepper: RungeKutta3TimeStepper
├── advection scheme: Centered reconstruction order 2
├── tracers: (T, S)
├── closure: Nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function run_ocean_large_eddy_simulation_regression_test(arch, grid_type, closur

# Model instantiation
model = NonhydrostaticModel(; grid, closure,
timestepper = :QuasiAdamsBashforth2,
coriolis = FPlane(f=1e-4),
buoyancy = SeawaterBuoyancy(; equation_of_state),
tracers = (:T, :S),
Expand Down
1 change: 1 addition & 0 deletions test/regression_tests/rayleigh_benard_regression_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function run_rayleigh_benard_regression_test(arch, grid_type)
bottom = BoundaryCondition(Value(), Δb))

model = NonhydrostaticModel(; grid,
timestepper = :QuasiAdamsBashforth2,
closure = ScalarDiffusivity=ν, κ=κ),
tracers = (:b, :c),
buoyancy = Buoyancy(model=BuoyancyTracer()),
Expand Down
1 change: 1 addition & 0 deletions test/regression_tests/thermal_bubble_regression_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function run_thermal_bubble_regression_test(arch, grid_type)
closure = ScalarDiffusivity=4e-2, κ=4e-2)

model = NonhydrostaticModel(; grid, closure,
timestepper = :QuasiAdamsBashforth2,
coriolis = FPlane(f=1e-4),
buoyancy = SeawaterBuoyancy(),
hydrostatic_pressure_anomaly = CenterField(grid),
Expand Down
12 changes: 7 additions & 5 deletions test/test_boundary_conditions_integration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function test_boundary_condition(arch, FT, topo, side, field_name, boundary_cond
buoyancy=SeawaterBuoyancy(), tracers=(:T, :S))

success = try
time_step!(model, 1e-16, euler=true)
time_step!(model, 1e-16)
true
catch err
@warn "test_boundary_condition errored with " * sprint(showerror, err)
Expand Down Expand Up @@ -61,10 +61,12 @@ function fluxes_with_diffusivity_boundary_conditions_are_correct(arch, FT)
κₑ_bcs = FieldBoundaryConditions(grid, (Center, Center, Center), bottom=ValueBoundaryCondition(κ₀))
model_bcs = (b=buoyancy_bcs, κₑ=(b=κₑ_bcs,))

model = NonhydrostaticModel(
grid=grid, tracers=:b, buoyancy=BuoyancyTracer(),
closure=AnisotropicMinimumDissipation(), boundary_conditions=model_bcs
)
model = NonhydrostaticModel(; grid,
timestepper = :QuasiAdamsBashforth2,
tracers = :b,
buoyancy = BuoyancyTracer(),
closure = AnisotropicMinimumDissipation(),
boundary_conditions = model_bcs)

b₀(x, y, z) = z * bz
set!(model, b=b₀)
Expand Down
Loading

2 comments on commit 41209a2

@glwagner
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/116272

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.92.0 -m "<description of version>" 41209a29b238c401330c59ab467925490ff82b3f
git push origin v0.92.0

Please sign in to comment.