From 83bb2f6f7d6d38c78d90aaa7737e75a5db978daf Mon Sep 17 00:00:00 2001 From: Navid Constantinou Date: Sun, 18 Jul 2021 22:34:07 +1000 Subject: [PATCH 01/13] IncompressibleModel->NonhydrostaticModel --- .buildkite/pipeline.yml | 4 +- README.md | 4 +- benchmark/benchmark_abstract_operations.jl | 2 +- benchmark/benchmark_advection_schemes.jl | 2 +- benchmark/benchmark_equations_of_state.jl | 2 +- benchmark/benchmark_incompressible_model.jl | 2 +- .../benchmark_lagrangian_particle_tracking.jl | 2 +- benchmark/benchmark_multithreading_single.jl | 2 +- benchmark/benchmark_time_steppers.jl | 2 +- benchmark/benchmark_topologies.jl | 2 +- benchmark/benchmark_tracers.jl | 2 +- benchmark/benchmark_turbulence_closures.jl | 2 +- ...rtically_stretched_incompressible_model.jl | 2 +- .../benchmarkable_incompressible_model.jl | 2 +- ...ong_scaling_incompressible_model_single.jl | 2 +- docs/make.jl | 2 +- docs/src/appendix/fractional_step.md | 4 +- docs/src/appendix/library.md | 2 +- docs/src/model_setup/background_fields.md | 8 ++-- docs/src/model_setup/boundary_conditions.md | 6 +-- .../buoyancy_and_equation_of_state.md | 20 ++++---- docs/src/model_setup/checkpointing.md | 2 +- docs/src/model_setup/clock.md | 4 +- docs/src/model_setup/forcing_functions.md | 14 +++--- docs/src/model_setup/lagrangian_particles.md | 4 +- docs/src/model_setup/output_writers.md | 8 ++-- docs/src/model_setup/overview.md | 4 +- .../model_setup/setting_initial_conditions.md | 4 +- docs/src/model_setup/tracers.md | 8 ++-- docs/src/physics/incompressible_model.md | 2 +- docs/src/simulation_tips.md | 6 +-- examples/convecting_plankton.jl | 4 +- examples/eady_turbulence.jl | 4 +- examples/horizontal_convection.jl | 2 +- examples/internal_wave.jl | 6 +-- examples/kelvin_helmholtz_instability.jl | 2 +- examples/langmuir_turbulence.jl | 4 +- examples/ocean_wind_mixing_and_convection.jl | 2 +- examples/one_dimensional_diffusion.jl | 6 +-- examples/two_dimensional_turbulence.jl | 2 +- .../continuous_boundary_function.jl | 2 +- src/BuoyancyModels/buoyancy.jl | 2 +- src/Diagnostics/cfl.jl | 4 +- src/Diagnostics/windowed_spatial_average.jl | 2 +- src/Distributed/Distributed.jl | 2 +- .../distributed_incompressible_model.jl | 4 +- src/Fields/background_fields.jl | 2 +- src/Fields/field_tuples.jl | 2 +- src/Forcings/continuous_forcing.jl | 2 +- src/Forcings/forcing.jl | 8 ++-- src/ImmersedBoundaries/mask_immersed_field.jl | 2 +- ...ate_hydrostatic_free_surface_tendencies.jl | 2 +- .../hydrostatic_free_surface_model.jl | 2 +- .../prescribed_hydrostatic_velocity_fields.jl | 2 +- ...te_hydrostatic_free_surface_model_state.jl | 2 +- .../IncompressibleModels.jl | 12 ++--- .../calculate_tendencies.jl | 4 +- ...rect_incompressible_immersed_tendencies.jl | 2 +- .../incompressible_model.jl | 8 ++-- .../pressure_correction.jl | 6 +-- .../set_incompressible_model.jl | 4 +- .../show_incompressible_model.jl | 4 +- .../update_incompressible_model_state.jl | 4 +- src/Models/Models.jl | 8 ++-- src/Oceananigans.jl | 2 +- src/OutputWriters/checkpointer.jl | 2 +- src/OutputWriters/jld2_output_writer.jl | 4 +- src/OutputWriters/netcdf_output_writer.jl | 4 +- src/OutputWriters/windowed_time_average.jl | 2 +- src/TurbulenceClosures/diffusivity_fields.jl | 2 +- ...n_large_eddy_simulation_regression_test.jl | 2 +- .../rayleigh_benard_regression_test.jl | 2 +- .../thermal_bubble_regression_test.jl | 2 +- test/test_abstract_operations.jl | 2 +- test/test_boundary_conditions_integration.jl | 12 ++--- test/test_checkpointer.jl | 14 +++--- test/test_computed_field.jl | 6 +-- test/test_diagnostics.jl | 8 ++-- test/test_distributed_models.jl | 32 ++++++------- test/test_distributed_poisson_solvers.jl | 2 +- test/test_dynamics.jl | 18 +++---- test/test_forcings.jl | 16 +++---- test/test_incompressible_models.jl | 48 +++++++++---------- test/test_jld2_output_writer.jl | 4 +- test/test_lagrangian_particle_tracking.jl | 2 +- test/test_netcdf_output_writer.jl | 16 +++---- test/test_output_readers.jl | 2 +- test/test_output_writers.jl | 4 +- test/test_simulations.jl | 12 ++--- test/test_time_stepping.jl | 24 +++++----- test/test_turbulence_closures.jl | 10 ++-- test/utils_for_runtests.jl | 4 +- .../src/DoublyPeriodicTaylorGreen.jl | 2 +- .../src/ForcedFlowFixedSlip.jl | 4 +- .../src/ForcedFlowFreeSlip.jl | 4 +- .../OneDimensionalCosineAdvectionDiffusion.jl | 6 +-- ...neDimensionalGaussianAdvectionDiffusion.jl | 6 +-- .../src/PointExponentialDecay.jl | 2 +- .../src/TwoDimensionalDiffusion.jl | 2 +- .../flow_around_cylinder.jl | 2 +- .../immersed_bickley_jet.jl | 4 +- ...onhydrostatic_one_dimensional_diffusion.jl | 4 +- .../lid_driven_cavity/lid_driven_cavity.jl | 2 +- .../periodic_advection/periodic_advection.jl | 2 +- .../stommel_gyre/stommel_gyre_advection.jl | 2 +- .../stratified_couette_flow.jl | 2 +- validation/thermal_bubble/thermal_bubble.jl | 2 +- 107 files changed, 280 insertions(+), 280 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 91dd8ecac8..4444a55825 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -109,7 +109,7 @@ steps: depends_on: "init_cpu" ##### -##### IncompressibleModel and time stepping (part 1) +##### NonhydrostaticModel and time stepping (part 1) ##### - label: "🦀 gpu time stepping tests 1" @@ -136,7 +136,7 @@ steps: depends_on: "init_cpu" ##### -##### IncompressibleModel and time stepping (part 2) +##### NonhydrostaticModel and time stepping (part 2) ##### - label: "🦈 gpu time stepping tests 2" diff --git a/README.md b/README.md index 1f11829f6f..b46fd24027 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Let's initialize a 3D horizontally periodic model with 100×100×50 grid points ```julia using Oceananigans grid = RegularRectilinearGrid(size=(100, 100, 50), extent=(2π, 2π, 1)) -model = IncompressibleModel(grid=grid) +model = NonhydrostaticModel(grid=grid) simulation = Simulation(model, Δt=60, stop_time=3600) run!(simulation) ``` @@ -108,7 +108,7 @@ N = Nx = Ny = Nz = 128 # Number of grid points in each dimension. L = Lx = Ly = Lz = 2000 # Length of each dimension. topology = (Periodic, Periodic, Bounded) -model = IncompressibleModel( +model = NonhydrostaticModel( architecture = CPU(), grid = RegularRectilinearGrid(topology=topology, size=(Nx, Ny, Nz), extent=(Lx, Ly, Lz)), closure = IsotropicDiffusivity(ν=4e-2, κ=4e-2) diff --git a/benchmark/benchmark_abstract_operations.jl b/benchmark/benchmark_abstract_operations.jl index 95d838866d..87e453dca5 100644 --- a/benchmark/benchmark_abstract_operations.jl +++ b/benchmark/benchmark_abstract_operations.jl @@ -26,7 +26,7 @@ for Arch in Archs N = Arch == CPU ? (32, 32, 32) : (256, 256, 256) grid = RegularRectilinearGrid(FT, size=N, extent=(1, 1, 1)) - model = IncompressibleModel(architecture=Arch(), grid=grid, + model = NonhydrostaticModel(architecture=Arch(), grid=grid, buoyancy=nothing, tracers=(:α, :β, :γ, :δ, :ζ)) ε(x, y, z) = randn() diff --git a/benchmark/benchmark_advection_schemes.jl b/benchmark/benchmark_advection_schemes.jl index 6770b12978..f7826d34ea 100644 --- a/benchmark/benchmark_advection_schemes.jl +++ b/benchmark/benchmark_advection_schemes.jl @@ -10,7 +10,7 @@ using Benchmarks function benchmark_advection_scheme(Arch, Scheme) grid = RegularRectilinearGrid(size=(192, 192, 192), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=Arch(), grid=grid, advection=Scheme()) + model = NonhydrostaticModel(architecture=Arch(), grid=grid, advection=Scheme()) time_step!(model, 1) # warmup diff --git a/benchmark/benchmark_equations_of_state.jl b/benchmark/benchmark_equations_of_state.jl index 13fac64f7c..a1f400e998 100644 --- a/benchmark/benchmark_equations_of_state.jl +++ b/benchmark/benchmark_equations_of_state.jl @@ -12,7 +12,7 @@ using Benchmarks function benchmark_equation_of_state(Arch, EOS) grid = RegularRectilinearGrid(size=(192, 192, 192), extent=(1, 1, 1)) buoyancy = SeawaterBuoyancy(equation_of_state=EOS()) - model = IncompressibleModel(architecture=Arch(), grid=grid, buoyancy=buoyancy) + model = NonhydrostaticModel(architecture=Arch(), grid=grid, buoyancy=buoyancy) time_step!(model, 1) # warmup diff --git a/benchmark/benchmark_incompressible_model.jl b/benchmark/benchmark_incompressible_model.jl index 51f8b1672d..bcf1d48563 100644 --- a/benchmark/benchmark_incompressible_model.jl +++ b/benchmark/benchmark_incompressible_model.jl @@ -10,7 +10,7 @@ pyplot() function benchmark_incompressible_model(Arch, FT, N) grid = RegularRectilinearGrid(FT, size=(N, N, N), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=Arch(), grid=grid) + model = NonhydrostaticModel(architecture=Arch(), grid=grid) time_step!(model, 1) # warmup diff --git a/benchmark/benchmark_lagrangian_particle_tracking.jl b/benchmark/benchmark_lagrangian_particle_tracking.jl index 521d621dfb..457f97a51f 100644 --- a/benchmark/benchmark_lagrangian_particle_tracking.jl +++ b/benchmark/benchmark_lagrangian_particle_tracking.jl @@ -20,7 +20,7 @@ function benchmark_particle_tracking(Arch, N_particles) particles = LagrangianParticles(x=x₀, y=y₀, z=z₀) end - model = IncompressibleModel(architecture=Arch(), grid=grid, particles=particles) + model = NonhydrostaticModel(architecture=Arch(), grid=grid, particles=particles) time_step!(model, 1) # warmup diff --git a/benchmark/benchmark_multithreading_single.jl b/benchmark/benchmark_multithreading_single.jl index d038cd1898..5e8b314a50 100644 --- a/benchmark/benchmark_multithreading_single.jl +++ b/benchmark/benchmark_multithreading_single.jl @@ -7,7 +7,7 @@ using Benchmarks N = parse(Int, ARGS[1]) grid = RegularRectilinearGrid(size=(N, N, N), extent=(1, 1, 1)) -model = IncompressibleModel(architecture=CPU(), grid=grid) +model = NonhydrostaticModel(architecture=CPU(), grid=grid) time_step!(model, 1) # warmup diff --git a/benchmark/benchmark_time_steppers.jl b/benchmark/benchmark_time_steppers.jl index f1365a6394..c42aeccdab 100644 --- a/benchmark/benchmark_time_steppers.jl +++ b/benchmark/benchmark_time_steppers.jl @@ -9,7 +9,7 @@ using Benchmarks function benchmark_time_stepper(Arch, N, TimeStepper) grid = RegularRectilinearGrid(size=(N, N, N), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=Arch(), grid=grid, timestepper=TimeStepper) + model = NonhydrostaticModel(architecture=Arch(), grid=grid, timestepper=TimeStepper) time_step!(model, 1) # warmup diff --git a/benchmark/benchmark_topologies.jl b/benchmark/benchmark_topologies.jl index 592a83911f..204923a9da 100644 --- a/benchmark/benchmark_topologies.jl +++ b/benchmark/benchmark_topologies.jl @@ -9,7 +9,7 @@ using Benchmarks function benchmark_topology(Arch, N, topo) grid = RegularRectilinearGrid(topology=topo, size=(N, N, N), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=Arch(), grid=grid) + model = NonhydrostaticModel(architecture=Arch(), grid=grid) time_step!(model, 1) # warmup diff --git a/benchmark/benchmark_tracers.jl b/benchmark/benchmark_tracers.jl index 04fe534b7b..efb91ae377 100644 --- a/benchmark/benchmark_tracers.jl +++ b/benchmark/benchmark_tracers.jl @@ -31,7 +31,7 @@ end function benchmark_tracers(Arch, N, n_tracers) n_active, n_passive = n_tracers grid = RegularRectilinearGrid(size=(N, N, N), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=Arch(), grid=grid, buoyancy=buoyancy(n_active), + model = NonhydrostaticModel(architecture=Arch(), grid=grid, buoyancy=buoyancy(n_active), tracers=tracer_list(n_active, n_passive)) time_step!(model, 1) # warmup diff --git a/benchmark/benchmark_turbulence_closures.jl b/benchmark/benchmark_turbulence_closures.jl index c745ca96b4..92e66a617d 100644 --- a/benchmark/benchmark_turbulence_closures.jl +++ b/benchmark/benchmark_turbulence_closures.jl @@ -10,7 +10,7 @@ using Benchmarks function benchmark_closure(Arch, Closure) grid = RegularRectilinearGrid(size=(128, 128, 128), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=Arch(), grid=grid, closure=Closure()) + model = NonhydrostaticModel(architecture=Arch(), grid=grid, closure=Closure()) time_step!(model, 1) # warmup diff --git a/benchmark/benchmark_vertically_stretched_incompressible_model.jl b/benchmark/benchmark_vertically_stretched_incompressible_model.jl index b8c3fa52f1..a582c8cc0b 100644 --- a/benchmark/benchmark_vertically_stretched_incompressible_model.jl +++ b/benchmark/benchmark_vertically_stretched_incompressible_model.jl @@ -9,7 +9,7 @@ using Benchmarks function benchmark_vertically_stretched_incompressible_model(Arch, FT, N) grid = VerticallyStretchedRectilinearGrid(architecture=Arch(), size=(N, N, N), x=(0, 1), y=(0, 1), z_faces=collect(0:N)) - model = IncompressibleModel(architecture=Arch(), grid=grid) + model = NonhydrostaticModel(architecture=Arch(), grid=grid) time_step!(model, 1) # warmup diff --git a/benchmark/benchmarkable_incompressible_model.jl b/benchmark/benchmarkable_incompressible_model.jl index 00bfea484a..cbeac243a8 100644 --- a/benchmark/benchmarkable_incompressible_model.jl +++ b/benchmark/benchmarkable_incompressible_model.jl @@ -19,7 +19,7 @@ for Arch in Architectures, FT in Float_types, N in Ns @info "Setting up benchmark: ($Arch, $FT, $N)..." grid = RegularRectilinearGrid(FT, size=(N, N, N), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=Arch(), grid=grid) + model = NonhydrostaticModel(architecture=Arch(), grid=grid) time_step!(model, 1) # warmup diff --git a/benchmark/strong_scaling_incompressible_model_single.jl b/benchmark/strong_scaling_incompressible_model_single.jl index be72654440..d4e5f1b185 100644 --- a/benchmark/strong_scaling_incompressible_model_single.jl +++ b/benchmark/strong_scaling_incompressible_model_single.jl @@ -32,7 +32,7 @@ Rz = parse(Int, ARGS[7]) topo = (Periodic, Periodic, Periodic) distributed_grid = RegularRectilinearGrid(topology=topo, size=(Nx, Ny, Nz), extent=(1, 1, 1)) arch = MultiCPU(grid=distributed_grid, ranks=(Rx, Ry, Rz)) -model = DistributedIncompressibleModel(architecture=arch, grid=distributed_grid) +model = DistributedNonhydrostaticModel(architecture=arch, grid=distributed_grid) @info "Warming up distributed incompressible model on rank $local_rank..." diff --git a/docs/make.jl b/docs/make.jl index 6157edc837..db63a2c78d 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -92,7 +92,7 @@ model_setup_pages = [ physics_pages = [ "Coordinate system and notation" => "physics/notation.md", "Boussinesq approximation" => "physics/boussinesq.md", - "`IncompressibleModel`" => [ + "`NonhydrostaticModel`" => [ "Incompressible model" => "physics/incompressible_model.md", ], "`HydrostaticFreeSurfaceModel`" => [ diff --git a/docs/src/appendix/fractional_step.md b/docs/src/appendix/fractional_step.md index f378d1d8a1..120507a60a 100644 --- a/docs/src/appendix/fractional_step.md +++ b/docs/src/appendix/fractional_step.md @@ -1,6 +1,6 @@ # Fractional step method -In some models (e.g., `IncompressibleModel` or `HydrostaticFreeSurfaceModel`) solving the momentum +In some models (e.g., `NonhydrostaticModel` or `HydrostaticFreeSurfaceModel`) solving the momentum coupled with the continuity equation can be cumbersome so instead we employ a fractional step method. To approximate the solution of the coupled system we first solve an approximation to the discretized momentum equation for an intermediate velocity field ``\boldsymbol{v}^\star`` @@ -8,7 +8,7 @@ without worrying about satisfying the incompressibility constraint. We then proj onto the space of divergence-free velocity fields to obtain a value for ``\boldsymbol{v}^{n+1}`` that satisfies continuity. -For example, for the `IncompressibleModel`, if we ignore the background velocity fields and the +For example, for the `NonhydrostaticModel`, if we ignore the background velocity fields and the surface waves, we thus discretize the momentum equation as ```math \frac{\boldsymbol{v}^\star - \boldsymbol{v}^n}{\Delta t} diff --git a/docs/src/appendix/library.md b/docs/src/appendix/library.md index 60a943a7c4..2648539411 100644 --- a/docs/src/appendix/library.md +++ b/docs/src/appendix/library.md @@ -166,7 +166,7 @@ Modules = [Oceananigans.Models] Private = false Pages = [ "Models/Models.jl", - "Models/IncompressibleModels/incompressible_model.jl", + "Models/NonhydrostaticModels/incompressible_model.jl", "Models/HydrostaticFreeSurfaceModels/hydrostatic_free_surface_model.jl", "Models/ShallowWaterModels/shallow_water_model.jl" ] diff --git a/docs/src/model_setup/background_fields.md b/docs/src/model_setup/background_fields.md index c3d4579cb4..12cc5bb558 100644 --- a/docs/src/model_setup/background_fields.md +++ b/docs/src/model_setup/background_fields.md @@ -48,7 +48,7 @@ U(x, y, z, t) = 0.2 * z grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) -model = IncompressibleModel(grid = grid, background_fields = (u=U,)) +model = NonhydrostaticModel(grid = grid, background_fields = (u=U,)) model.background_fields.velocities.u @@ -61,7 +61,7 @@ FunctionField located at (Face, Center, Center) ``` `BackgroundField`s are specified by passing them to the kwarg `background_fields` -in the `IncompressibleModel` constructor. The kwarg `background_fields` expects +in the `NonhydrostaticModel` constructor. The kwarg `background_fields` expects a `NamedTuple` of fields, which are internally sorted into `velocities` and `tracers`, wrapped in `FunctionField`s, and assigned their appropriate locations. @@ -85,12 +85,12 @@ BackgroundField{typeof(B), NamedTuple{(:α, :N, :f), Tuple{Float64, Float64, Flo └── parameters: (α = 3.14, N = 1.0, f = 0.1) ``` -When inserted into `IncompressibleModel`, we get out +When inserted into `NonhydrostaticModel`, we get out ```jldoctest moar_background grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) -model = IncompressibleModel(grid = grid, background_fields = (u=U_field, b=B_field), +model = NonhydrostaticModel(grid = grid, background_fields = (u=U_field, b=B_field), tracers=:b, buoyancy=BuoyancyTracer()) model.background_fields.tracers.b diff --git a/docs/src/model_setup/boundary_conditions.md b/docs/src/model_setup/boundary_conditions.md index 4fe7dffa00..37dc3565a9 100644 --- a/docs/src/model_setup/boundary_conditions.md +++ b/docs/src/model_setup/boundary_conditions.md @@ -278,7 +278,7 @@ In general, boundary condition defaults are inferred from the field location and ## Specifying model boundary conditions To specify non-default boundary conditions, a named tuple of [`FieldBoundaryConditions`](@ref) objects is -passed to the keyword argument `boundary_conditions` in the [`IncompressibleModel`](@ref) constructor. +passed to the keyword argument `boundary_conditions` in the [`NonhydrostaticModel`](@ref) constructor. The keys of `boundary_conditions` indicate the field to which the boundary condition is applied. Below, non-default boundary conditions are imposed on the ``u``-velocity and temperature. @@ -293,8 +293,8 @@ julia> u_bcs = FieldBoundaryConditions(top = ValueBoundaryCondition(+0.1), julia> T_bcs = FieldBoundaryConditions(top = ValueBoundaryCondition(20), bottom = GradientBoundaryCondition(0.01)); -julia> model = IncompressibleModel(grid=grid, boundary_conditions=(u=u_bcs, T=T_bcs)) -IncompressibleModel{CPU, Float64}(time = 0 seconds, iteration = 0) +julia> model = NonhydrostaticModel(grid=grid, boundary_conditions=(u=u_bcs, T=T_bcs)) +NonhydrostaticModel{CPU, Float64}(time = 0 seconds, iteration = 0) ├── grid: RegularRectilinearGrid{Float64, Periodic, Periodic, Bounded}(Nx=16, Ny=16, Nz=16) ├── tracers: (:T, :S) ├── closure: Nothing 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 458d311bb9..ad76a1857e 100644 --- a/docs/src/model_setup/buoyancy_and_equation_of_state.md +++ b/docs/src/model_setup/buoyancy_and_equation_of_state.md @@ -20,8 +20,8 @@ end ```jldoctest buoyancy julia> grid = RegularRectilinearGrid(size=(64, 64, 64), extent=(1, 1, 1)); -julia> model = IncompressibleModel(grid=grid, buoyancy=nothing) -IncompressibleModel{CPU, Float64}(time = 0 seconds, iteration = 0) +julia> model = NonhydrostaticModel(grid=grid, buoyancy=nothing) +NonhydrostaticModel{CPU, Float64}(time = 0 seconds, iteration = 0) ├── grid: RegularRectilinearGrid{Float64, Periodic, Periodic, Bounded}(Nx=64, Ny=64, Nz=64) ├── tracers: (:T, :S) ├── closure: Nothing @@ -34,8 +34,8 @@ not want to evolve temperature and salinity, which are included by default. To s also pass`tracers = ()` to the model constructor. ```jldoctest buoyancy -julia> model = IncompressibleModel(grid=grid, buoyancy=nothing, tracers=()) -IncompressibleModel{CPU, Float64}(time = 0 seconds, iteration = 0) +julia> model = NonhydrostaticModel(grid=grid, buoyancy=nothing, tracers=()) +NonhydrostaticModel{CPU, Float64}(time = 0 seconds, iteration = 0) ├── grid: RegularRectilinearGrid{Float64, Periodic, Periodic, Bounded}(Nx=64, Ny=64, Nz=64) ├── tracers: () ├── closure: Nothing @@ -49,8 +49,8 @@ To directly evolve buoyancy as a tracer simply pass `buoyancy = BuoyancyTracer() constructor. BuoyancyModels `:b` must be included as a tracer, for example, ```jldoctest buoyancy -julia> model = IncompressibleModel(grid=grid, buoyancy=BuoyancyTracer(), tracers=(:b)) -IncompressibleModel{CPU, Float64}(time = 0 seconds, iteration = 0) +julia> model = NonhydrostaticModel(grid=grid, buoyancy=BuoyancyTracer(), tracers=(:b)) +NonhydrostaticModel{CPU, Float64}(time = 0 seconds, iteration = 0) ├── grid: RegularRectilinearGrid{Float64, Periodic, Periodic, Bounded}(Nx=64, Ny=64, Nz=64) ├── tracers: (:b,) ├── closure: Nothing @@ -64,8 +64,8 @@ To evolve temperature ``T`` and salinity ``S`` and diagnose the buoyancy, you ca `buoyancy = SeawaterBuoyancy()` which is the default. ```jldoctest buoyancy -julia> model = IncompressibleModel(grid=grid, buoyancy=SeawaterBuoyancy()) -IncompressibleModel{CPU, Float64}(time = 0 seconds, iteration = 0) +julia> model = NonhydrostaticModel(grid=grid, buoyancy=SeawaterBuoyancy()) +NonhydrostaticModel{CPU, Float64}(time = 0 seconds, iteration = 0) ├── grid: RegularRectilinearGrid{Float64, Periodic, Periodic, Bounded}(Nx=64, Ny=64, Nz=64) ├── tracers: (:T, :S) ├── closure: Nothing @@ -85,8 +85,8 @@ julia> buoyancy = SeawaterBuoyancy(gravitational_acceleration=1.3) SeawaterBuoyancy{Float64}: g = 1.3 └── equation of state: LinearEquationOfState{Float64}: α = 1.67e-04, β = 7.80e-04 -julia> model = IncompressibleModel(grid=grid, buoyancy=buoyancy) -IncompressibleModel{CPU, Float64}(time = 0 seconds, iteration = 0) +julia> model = NonhydrostaticModel(grid=grid, buoyancy=buoyancy) +NonhydrostaticModel{CPU, Float64}(time = 0 seconds, iteration = 0) ├── grid: RegularRectilinearGrid{Float64, Periodic, Periodic, Bounded}(Nx=64, Ny=64, Nz=64) ├── tracers: (:T, :S) ├── closure: Nothing diff --git a/docs/src/model_setup/checkpointing.md b/docs/src/model_setup/checkpointing.md index a46f1911ca..a3e9fd5aaa 100644 --- a/docs/src/model_setup/checkpointing.md +++ b/docs/src/model_setup/checkpointing.md @@ -16,7 +16,7 @@ end ```jldoctest julia> using Oceananigans, Oceananigans.Units -julia> model = IncompressibleModel(grid=RegularRectilinearGrid(size=(16, 16, 16), extent=(1, 1, 1))); +julia> model = NonhydrostaticModel(grid=RegularRectilinearGrid(size=(16, 16, 16), extent=(1, 1, 1))); julia> checkpointer = Checkpointer(model, schedule=TimeInterval(5years), prefix="model_checkpoint") Checkpointer{TimeInterval, Vector{Symbol}}(TimeInterval(1.5768e8, 0.0), ".", "model_checkpoint", [:architecture, :grid, :clock, :coriolis, :buoyancy, :closure, :velocities, :tracers, :timestepper, :particles], false, false, false) diff --git a/docs/src/model_setup/clock.md b/docs/src/model_setup/clock.md index a5401d1235..55bd90be0e 100644 --- a/docs/src/model_setup/clock.md +++ b/docs/src/model_setup/clock.md @@ -24,7 +24,7 @@ julia> clock = Clock(time=3600.0) Clock{Float64}: time = 1 hour, iteration = 0, stage = 1 ``` -to the constructor for `IncompressibleModel` causes the simulation +to the constructor for `NonhydrostaticModel` causes the simulation time to start at ``t = 3600`` seconds. The type of the keyword argument `time` should be a float or date type. @@ -38,6 +38,6 @@ julia> clock = Clock(time=TimeDate(2020)) Clock{TimesDates.TimeDate}: time = 2020-01-01T00:00:00, iteration = 0, stage = 1 ``` -to `IncompressibleModel`. +to `NonhydrostaticModel`. `TimeDate` supports nanosecond resolution and is thus recommended over `Base.Dates.DateTime`, which is also supported but has only millisecond resolution. diff --git a/docs/src/model_setup/forcing_functions.md b/docs/src/model_setup/forcing_functions.md index 960f155cae..e06b18b3b6 100644 --- a/docs/src/model_setup/forcing_functions.md +++ b/docs/src/model_setup/forcing_functions.md @@ -13,7 +13,7 @@ end ``` Forcings are added to `Oceananigans` models by passing a `NamedTuple` of functions -or forcing objects to the `forcing` keyword argument in `IncompressibleModel`'s constructor. +or forcing objects to the `forcing` keyword argument in `NonhydrostaticModel`'s constructor. By default, momentum and tracer forcing functions are assumed to be functions of `x, y, z, t`. A basic example is @@ -21,7 +21,7 @@ By default, momentum and tracer forcing functions are assumed to be functions of u_forcing(x, y, z, t) = exp(z) * cos(x) * sin(t) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) -model = IncompressibleModel(grid=grid, forcing=(u=u_forcing,)) +model = NonhydrostaticModel(grid=grid, forcing=(u=u_forcing,)) model.forcing.u @@ -64,7 +64,7 @@ T_forcing_func(x, y, z, t, p) = - p.μ * exp(z / p.λ) * cos(p.k * x) * sin(p.ω T_forcing = Forcing(T_forcing_func, parameters=(μ=1, λ=0.5, k=2π, ω=4π)) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) -model = IncompressibleModel(grid=grid, forcing=(u=u_forcing, T=T_forcing)) +model = NonhydrostaticModel(grid=grid, forcing=(u=u_forcing, T=T_forcing)) model.forcing.T @@ -109,7 +109,7 @@ S_forcing_func(x, y, z, t, S, μ) = - μ * S S_forcing = Forcing(S_forcing_func, parameters=0.01, field_dependencies=:S) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) -model = IncompressibleModel(grid=grid, forcing=(w=w_forcing, S=S_forcing)) +model = NonhydrostaticModel(grid=grid, forcing=(w=w_forcing, S=S_forcing)) model.forcing.w @@ -188,7 +188,7 @@ end u_forcing = Forcing(u_forcing_func, discrete_form=true, parameters=1e-3) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) -model = IncompressibleModel(grid=grid, tracers=:b, buoyancy=BuoyancyTracer(), forcing=(u=u_forcing, b=b_forcing)) +model = NonhydrostaticModel(grid=grid, tracers=:b, buoyancy=BuoyancyTracer(), forcing=(u=u_forcing, b=b_forcing)) model.forcing.b @@ -223,7 +223,7 @@ of the velocity field are damped to zero everywhere on a time-scale of 1000 seco damping = Relaxation(rate = 1/1000) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) -model = IncompressibleModel(grid=grid, forcing=(u=damping, v=damping, w=damping)) +model = NonhydrostaticModel(grid=grid, forcing=(u=damping, v=damping, w=damping)) model.forcing.w @@ -256,7 +256,7 @@ target_temperature = LinearTarget{:z}(intercept=surface_temperature, gradient=te uvw_sponge = Relaxation(rate=damping_rate, mask=bottom_mask) T_sponge = Relaxation(rate=damping_rate, mask=bottom_mask, target=target_temperature) -model = IncompressibleModel(grid=grid, forcing=(u=uvw_sponge, v=uvw_sponge, w=uvw_sponge, T=T_sponge)) +model = NonhydrostaticModel(grid=grid, forcing=(u=uvw_sponge, v=uvw_sponge, w=uvw_sponge, T=T_sponge)) model.forcing.u diff --git a/docs/src/model_setup/lagrangian_particles.md b/docs/src/model_setup/lagrangian_particles.md index 264777e87d..ea27a63029 100644 --- a/docs/src/model_setup/lagrangian_particles.md +++ b/docs/src/model_setup/lagrangian_particles.md @@ -36,10 +36,10 @@ lagrangian_particles = LagrangianParticles(x=x₀, y=y₀, z=z₀) then pass it to a model constructor ```jldoctest particles -model = IncompressibleModel(grid=grid, particles=lagrangian_particles) +model = NonhydrostaticModel(grid=grid, particles=lagrangian_particles) # output -IncompressibleModel{CPU, Float64}(time = 0 seconds, iteration = 0) +NonhydrostaticModel{CPU, Float64}(time = 0 seconds, iteration = 0) ├── grid: RegularRectilinearGrid{Float64, Periodic, Periodic, Bounded}(Nx=10, Ny=10, Nz=10) ├── tracers: (:T, :S) ├── closure: Nothing diff --git a/docs/src/model_setup/output_writers.md b/docs/src/model_setup/output_writers.md index 8fca5d30ea..a0a411b889 100644 --- a/docs/src/model_setup/output_writers.md +++ b/docs/src/model_setup/output_writers.md @@ -57,7 +57,7 @@ using Oceananigans, Oceananigans.OutputWriters grid = RegularRectilinearGrid(size=(16, 16, 16), extent=(1, 1, 1)); -model = IncompressibleModel(grid=grid); +model = NonhydrostaticModel(grid=grid); simulation = Simulation(model, Δt=12, stop_time=3600); @@ -113,7 +113,7 @@ using Oceananigans, Oceananigans.OutputWriters grid = RegularRectilinearGrid(size=(16, 16, 16), extent=(1, 2, 3)); -model = IncompressibleModel(grid=grid); +model = NonhydrostaticModel(grid=grid); simulation = Simulation(model, Δt=1.25, stop_iteration=3); @@ -170,7 +170,7 @@ Write out 3D fields for w and T and a horizontal average: using Oceananigans, Oceananigans.OutputWriters, Oceananigans.Fields using Oceananigans.Utils: hour, minute -model = IncompressibleModel(grid=RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1))) +model = NonhydrostaticModel(grid=RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1))) simulation = Simulation(model, Δt=12, stop_time=1hour) @@ -255,7 +255,7 @@ using Oceananigans using Oceananigans.OutputWriters: JLD2OutputWriter using Oceananigans.Utils: minutes -model = IncompressibleModel(grid=RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1))) +model = NonhydrostaticModel(grid=RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1))) simulation = Simulation(model, Δt=10minutes, stop_time=30years) diff --git a/docs/src/model_setup/overview.md b/docs/src/model_setup/overview.md index dff4d6c404..b223ceff79 100644 --- a/docs/src/model_setup/overview.md +++ b/docs/src/model_setup/overview.md @@ -11,10 +11,10 @@ For reference, here are all the option or keyword arguments that can be passed t currently implemented in Oceananigans.jl. See the different sections on the sidebar for more details and examples for each keyword argument. -### `IncompressibleModel` +### `NonhydrostaticModel` ```@docs -IncompressibleModel +NonhydrostaticModel ``` ### `HydrostaticFreeSurfaceModel` diff --git a/docs/src/model_setup/setting_initial_conditions.md b/docs/src/model_setup/setting_initial_conditions.md index 5a2af7606d..5681ff7c18 100644 --- a/docs/src/model_setup/setting_initial_conditions.md +++ b/docs/src/model_setup/setting_initial_conditions.md @@ -12,7 +12,7 @@ end ```jldoctest julia> grid = RegularRectilinearGrid(size=(16, 16, 16), extent=(1, 1, 1)); -julia> model = IncompressibleModel(grid=grid); +julia> model = NonhydrostaticModel(grid=grid); julia> set!(model, u=0.1, v=1.5) ``` @@ -20,7 +20,7 @@ julia> set!(model, u=0.1, v=1.5) ```jldoctest julia> grid = RegularRectilinearGrid(size=(16, 16, 16), extent=(1, 1, 1)); -julia> model = IncompressibleModel(grid=grid); +julia> model = NonhydrostaticModel(grid=grid); julia> ∂T∂z = 0.01; diff --git a/docs/src/model_setup/tracers.md b/docs/src/model_setup/tracers.md index b9174d609e..2049a4a11c 100644 --- a/docs/src/model_setup/tracers.md +++ b/docs/src/model_setup/tracers.md @@ -12,8 +12,8 @@ end ```jldoctest tracers julia> grid = RegularRectilinearGrid(size=(64, 64, 64), extent=(1, 1, 1)); -julia> model = IncompressibleModel(grid=grid) -IncompressibleModel{CPU, Float64}(time = 0 seconds, iteration = 0) +julia> model = NonhydrostaticModel(grid=grid) +NonhydrostaticModel{CPU, Float64}(time = 0 seconds, iteration = 0) ├── grid: RegularRectilinearGrid{Float64, Periodic, Periodic, Bounded}(Nx=64, Ny=64, Nz=64) ├── tracers: (:T, :S) ├── closure: Nothing @@ -41,8 +41,8 @@ Any number of arbitrary tracers can be appended to this list and passed to a mod quantities ``C_1``, CO₂, and nitrogen as additional passive tracers you could set them up as ```jldoctest tracers -julia> model = IncompressibleModel(grid=grid, tracers=(:T, :S, :C₁, :CO₂, :nitrogen)) -IncompressibleModel{CPU, Float64}(time = 0 seconds, iteration = 0) +julia> model = NonhydrostaticModel(grid=grid, tracers=(:T, :S, :C₁, :CO₂, :nitrogen)) +NonhydrostaticModel{CPU, Float64}(time = 0 seconds, iteration = 0) ├── grid: RegularRectilinearGrid{Float64, Periodic, Periodic, Bounded}(Nx=64, Ny=64, Nz=64) ├── tracers: (:T, :S, :C₁, :CO₂, :nitrogen) ├── closure: Nothing diff --git a/docs/src/physics/incompressible_model.md b/docs/src/physics/incompressible_model.md index 8684ec8e0f..7be4f2d3ee 100644 --- a/docs/src/physics/incompressible_model.md +++ b/docs/src/physics/incompressible_model.md @@ -1,6 +1,6 @@ # Incompressible model -The `IncompressibleModel` solves the incompressible Navier-Stokes equations under the Boussinesq +The `NonhydrostaticModel` solves the incompressible Navier-Stokes equations under the Boussinesq approximation and an arbitrary number of tracer conservation equations. Physics associated with individual terms in the momentum and tracer conservation equations --- the background rotation rate of the equation's reference frame, diff --git a/docs/src/simulation_tips.md b/docs/src/simulation_tips.md index 410bae11dc..baab78d863 100644 --- a/docs/src/simulation_tips.md +++ b/docs/src/simulation_tips.md @@ -106,7 +106,7 @@ For example, in the example below, calculating `u²` works in both CPUs and GPUs ```julia using Oceananigans grid = RegularRectilinearGrid(size=(4, 4, 4), extent=(1, 1, 1)) -model = IncompressibleModel(grid=grid, closure=IsotropicDiffusivity(ν=1e-6)) +model = NonhydrostaticModel(grid=grid, closure=IsotropicDiffusivity(ν=1e-6)) u, v, w = model.velocities ν = model.closure.ν u² = ComputedField(u^2) @@ -234,8 +234,8 @@ RegularRectilinearGrid{Float64, Periodic, Periodic, Bounded} halo size (Hx, Hy, Hz): (1, 1, 1) grid spacing (Δx, Δy, Δz): (1.0, 1.0, 1.0) -julia> model = IncompressibleModel(grid=grid, architecture=GPU()) -IncompressibleModel{GPU, Float64}(time = 0 seconds, iteration = 0) +julia> model = NonhydrostaticModel(grid=grid, architecture=GPU()) +NonhydrostaticModel{GPU, Float64}(time = 0 seconds, iteration = 0) ├── grid: RegularRectilinearGrid{Float64, Periodic, Periodic, Bounded}(Nx=1, Ny=1, Nz=1) ├── tracers: (:T, :S) ├── closure: IsotropicDiffusivity{Float64,NamedTuple{(:T, :S),Tuple{Float64,Float64}}} diff --git a/examples/convecting_plankton.jl b/examples/convecting_plankton.jl index 8998d8ba18..0d0f454617 100644 --- a/examples/convecting_plankton.jl +++ b/examples/convecting_plankton.jl @@ -117,11 +117,11 @@ plankton_dynamics = Forcing(growing_and_grazing, field_dependencies = :P, # ## The model # # The name "`P`" for phytoplankton is specified in the -# constructor for `IncompressibleModel`. We additionally specify a fifth-order +# constructor for `NonhydrostaticModel`. We additionally specify a fifth-order # advection scheme, third-order Runge-Kutta time-stepping, isotropic viscosity and diffusivities, # and Coriolis forces appropriate for planktonic convection at mid-latitudes on Earth. -model = IncompressibleModel( +model = NonhydrostaticModel( grid = grid, advection = UpwindBiasedFifthOrder(), timestepper = :RungeKutta3, diff --git a/examples/eady_turbulence.jl b/examples/eady_turbulence.jl index d4eef2d63c..6d7b381630 100644 --- a/examples/eady_turbulence.jl +++ b/examples/eady_turbulence.jl @@ -188,7 +188,7 @@ biharmonic_horizontal_diffusivity = AnisotropicBiharmonicDiffusivity(νh=κ₄h, # We instantiate the model with the fifth-order WENO advection scheme, a 3rd order # Runge-Kutta time-stepping scheme, and a `BuoyancyTracer`. -model = IncompressibleModel( +model = NonhydrostaticModel( architecture = CPU(), grid = grid, advection = WENO5(), @@ -222,7 +222,7 @@ set!(model, u=uᵢ, v=vᵢ, b=bᵢ) # We subtract off any residual mean velocity to avoid exciting domain-scale # inertial oscillations. We use a `sum` over the entire `parent` arrays or data # to ensure this operation is efficient on the GPU (set `architecture = GPU()` -# in `IncompressibleModel` constructor to run this problem on the GPU if one +# in `NonhydrostaticModel` constructor to run this problem on the GPU if one # is available). ū = sum(model.velocities.u.data.parent) / (grid.Nx * grid.Ny * grid.Nz) diff --git a/examples/horizontal_convection.jl b/examples/horizontal_convection.jl index a6e093e225..3c5e257c99 100644 --- a/examples/horizontal_convection.jl +++ b/examples/horizontal_convection.jl @@ -90,7 +90,7 @@ nothing # hide # We instantiate the model with the fifth-order WENO advection scheme, a 3rd order # Runge-Kutta time-stepping scheme, and a `BuoyancyTracer`. -model = IncompressibleModel( +model = NonhydrostaticModel( architecture = CPU(), grid = grid, advection = WENO5(), diff --git a/examples/internal_wave.jl b/examples/internal_wave.jl index db8d0dbaf1..0c29570de8 100644 --- a/examples/internal_wave.jl +++ b/examples/internal_wave.jl @@ -32,7 +32,7 @@ grid = RegularRectilinearGrid(size=(128, 128), x=(-π, π), z=(-π, π), coriolis = FPlane(f=0.2) # On an `FPlane`, the domain is idealized as rotating at a constant rate with -# rotation period `2π/f`. `coriolis` is passed to `IncompressibleModel` below. +# rotation period `2π/f`. `coriolis` is passed to `NonhydrostaticModel` below. # Our units are arbitrary. # We use Oceananigans' `background_fields` abstraction to define a background @@ -49,12 +49,12 @@ N = 1 ## buoyancy frequency B = BackgroundField(B_func, parameters=N) # We are now ready to instantiate our model. We pass `grid`, `coriolis`, -# and `B` to the `IncompressibleModel` constructor. +# and `B` to the `NonhydrostaticModel` constructor. # We add a small amount of `IsotropicDiffusivity` to keep the model stable # during time-stepping, and specify that we're using a single tracer called # `b` that we identify as buoyancy by setting `buoyancy=BuoyancyTracer()`. -model = IncompressibleModel( +model = NonhydrostaticModel( grid = grid, advection = CenteredFourthOrder(), timestepper = :RungeKutta3, diff --git a/examples/kelvin_helmholtz_instability.jl b/examples/kelvin_helmholtz_instability.jl index a6155d8fed..c5ddd69b8c 100644 --- a/examples/kelvin_helmholtz_instability.jl +++ b/examples/kelvin_helmholtz_instability.jl @@ -130,7 +130,7 @@ plot(U_plot, B_plot, Ri_plot, layout=(1, 3), size=(800, 400)) # # The model -model = IncompressibleModel(timestepper = :RungeKutta3, +model = NonhydrostaticModel(timestepper = :RungeKutta3, advection = UpwindBiasedFifthOrder(), grid = grid, coriolis = nothing, diff --git a/examples/langmuir_turbulence.jl b/examples/langmuir_turbulence.jl index b899f32a06..6d893bff8b 100644 --- a/examples/langmuir_turbulence.jl +++ b/examples/langmuir_turbulence.jl @@ -61,7 +61,7 @@ const Uˢ = amplitude^2 * wavenumber * frequency # m s⁻¹ # The `const` declarations ensure that Stokes drift functions compile on the GPU. # To run this example on the GPU, write `architecture = GPU()` in the constructor -# for `IncompressibleModel` below. +# for `NonhydrostaticModel` below. # # The Stokes drift profile is @@ -127,7 +127,7 @@ coriolis = FPlane(f=1e-4) # s⁻¹ # model for large eddy simulation. Because our Stokes drift does not vary in ``x, y``, # we use `UniformStokesDrift`, which expects Stokes drift functions of ``z, t`` only. -model = IncompressibleModel( +model = NonhydrostaticModel( architecture = CPU(), advection = WENO5(), timestepper = :RungeKutta3, diff --git a/examples/ocean_wind_mixing_and_convection.jl b/examples/ocean_wind_mixing_and_convection.jl index 546a6c230f..abbeb1afec 100644 --- a/examples/ocean_wind_mixing_and_convection.jl +++ b/examples/ocean_wind_mixing_and_convection.jl @@ -139,7 +139,7 @@ S_bcs = FieldBoundaryConditions(top=evaporation_bc) # for large eddy simulation to model the effect of turbulent motions at # scales smaller than the grid scale that we cannot explicitly resolve. -model = IncompressibleModel(architecture = CPU(), +model = NonhydrostaticModel(architecture = CPU(), advection = UpwindBiasedFifthOrder(), timestepper = :RungeKutta3, grid = grid, diff --git a/examples/one_dimensional_diffusion.jl b/examples/one_dimensional_diffusion.jl index a9f565d6f1..5974dbb053 100644 --- a/examples/one_dimensional_diffusion.jl +++ b/examples/one_dimensional_diffusion.jl @@ -29,7 +29,7 @@ using Oceananigans # # ## Instantiating and configuring a model # -# A core Oceananigans type is `IncompressibleModel`. We build an `IncompressibleModel` +# A core Oceananigans type is `NonhydrostaticModel`. We build an `NonhydrostaticModel` # by passing it a `grid`, plus information about the equations we would like to solve. # # Below, we build a regular rectilinear grid with 128 grid points in the `z`-direction, @@ -48,9 +48,9 @@ grid = RegularRectilinearGrid(size=128, z=(-0.5, 0.5), topology=(Flat, Flat, Bou closure = IsotropicDiffusivity(κ=1.0) -# We finally pass these two ingredients to `IncompressibleModel`, +# We finally pass these two ingredients to `NonhydrostaticModel`, -model = IncompressibleModel(grid=grid, closure=closure) +model = NonhydrostaticModel(grid=grid, closure=closure) # Our simple `grid` and `model` use a number of defaults: # diff --git a/examples/two_dimensional_turbulence.jl b/examples/two_dimensional_turbulence.jl index 4f1e7fd5fc..54e030cd2e 100644 --- a/examples/two_dimensional_turbulence.jl +++ b/examples/two_dimensional_turbulence.jl @@ -27,7 +27,7 @@ using Oceananigans grid = RegularRectilinearGrid(size=(128, 128), extent=(2π, 2π), topology=(Periodic, Periodic, Flat)) -model = IncompressibleModel(timestepper = :RungeKutta3, +model = NonhydrostaticModel(timestepper = :RungeKutta3, advection = UpwindBiasedFifthOrder(), grid = grid, buoyancy = nothing, diff --git a/src/BoundaryConditions/continuous_boundary_function.jl b/src/BoundaryConditions/continuous_boundary_function.jl index 961ac4c993..5d99edcf38 100644 --- a/src/BoundaryConditions/continuous_boundary_function.jl +++ b/src/BoundaryConditions/continuous_boundary_function.jl @@ -40,7 +40,7 @@ end location(::ContinuousBoundaryFunction{X, Y, Z}) where {X, Y, Z} = X, Y, Z ##### -##### "Regularization" for IncompressibleModel setup +##### "Regularization" for NonhydrostaticModel setup ##### """ diff --git a/src/BuoyancyModels/buoyancy.jl b/src/BuoyancyModels/buoyancy.jl index 7006aa145a..f218104685 100644 --- a/src/BuoyancyModels/buoyancy.jl +++ b/src/BuoyancyModels/buoyancy.jl @@ -24,7 +24,7 @@ g̃ = (0, sind(θ), cosd(θ)) buoyancy = Buoyancy(model=BuoyancyTracer(), vertical_unit_vector=g̃) -model = IncompressibleModel(grid=grid, buoyancy=buoyancy, tracers=:b) +model = NonhydrostaticModel(grid=grid, buoyancy=buoyancy, tracers=:b) ``` """ function Buoyancy(; model, vertical_unit_vector=ZDirection()) diff --git a/src/Diagnostics/cfl.jl b/src/Diagnostics/cfl.jl index eaf3e76821..079807e48e 100644 --- a/src/Diagnostics/cfl.jl +++ b/src/Diagnostics/cfl.jl @@ -33,7 +33,7 @@ for advection across a cell. Example ======= ```julia -julia> model = IncompressibleModel(grid=RegularRectilinearGrid(size=(16, 16, 16), length=(8, 8, 8))); +julia> model = NonhydrostaticModel(grid=RegularRectilinearGrid(size=(16, 16, 16), length=(8, 8, 8))); julia> cfl = AdvectiveCFL(1.0); @@ -58,7 +58,7 @@ returned. Example ======= ```julia -julia> model = IncompressibleModel(grid=RegularRectilinearGrid(size=(16, 16, 16), length=(1, 1, 1))); +julia> model = NonhydrostaticModel(grid=RegularRectilinearGrid(size=(16, 16, 16), length=(1, 1, 1))); julia> dcfl = DiffusiveCFL(0.1); diff --git a/src/Diagnostics/windowed_spatial_average.jl b/src/Diagnostics/windowed_spatial_average.jl index d98c9447f2..1ff1fb570c 100644 --- a/src/Diagnostics/windowed_spatial_average.jl +++ b/src/Diagnostics/windowed_spatial_average.jl @@ -26,7 +26,7 @@ julia> using Oceananigans.Diagnostics: WindowedSpatialAverage julia> grid = RegularRectilinearGrid(size=(4, 6, 4), extent=(1, 1, 1)); -julia> model = IncompressibleModel(grid=grid); +julia> model = NonhydrostaticModel(grid=grid); julia> set!(model.velocities.u, 1); diff --git a/src/Distributed/Distributed.jl b/src/Distributed/Distributed.jl index eef6908cda..746f5d03cb 100644 --- a/src/Distributed/Distributed.jl +++ b/src/Distributed/Distributed.jl @@ -5,7 +5,7 @@ export HaloCommunication, HaloCommunicationBC, inject_halo_communication_boundary_conditions, DistributedFFTBasedPoissonSolver, - DistributedIncompressibleModel, DistributedShallowWaterModel + DistributedNonhydrostaticModel, DistributedShallowWaterModel using MPI diff --git a/src/Distributed/distributed_incompressible_model.jl b/src/Distributed/distributed_incompressible_model.jl index 69ab3196fb..80bcb00673 100644 --- a/src/Distributed/distributed_incompressible_model.jl +++ b/src/Distributed/distributed_incompressible_model.jl @@ -5,7 +5,7 @@ using Oceananigans.Fields ##### Distributed incompressible model constructor ##### -function DistributedIncompressibleModel(; architecture, grid, model_kwargs...) +function DistributedNonhydrostaticModel(; architecture, grid, model_kwargs...) i, j, k = architecture.local_index Rx, Ry, Rz = architecture.ranks my_connectivity = architecture.connectivity @@ -40,7 +40,7 @@ function DistributedIncompressibleModel(; architecture, grid, model_kwargs...) pressure_solver = haskey(model_kwargs, :pressure_solver) ? Dict(model_kwargs)[:pressure_solver] : DistributedFFTBasedPoissonSolver(architecture, grid, my_grid) - my_model = IncompressibleModel(; + my_model = NonhydrostaticModel(; architecture = architecture, grid = my_grid, pressure_solver = pressure_solver, diff --git a/src/Fields/background_fields.jl b/src/Fields/background_fields.jl index 645842c137..a4c73e1f3f 100644 --- a/src/Fields/background_fields.jl +++ b/src/Fields/background_fields.jl @@ -39,7 +39,7 @@ end """ BackgroundField(func; parameters=nothing) -Returns a `BackgroundField` to be passed to `IncompressibleModel` for use +Returns a `BackgroundField` to be passed to `NonhydrostaticModel` for use as a background velocity or tracer field. If `parameters` is not provided, `func` must be callable with the signature diff --git a/src/Fields/field_tuples.jl b/src/Fields/field_tuples.jl index 2c83ae6a2a..7a51232a18 100644 --- a/src/Fields/field_tuples.jl +++ b/src/Fields/field_tuples.jl @@ -112,7 +112,7 @@ function TendencyFields(arch, grid, tracer_names; end ##### -##### Helper functions for IncompressibleModel constructor +##### Helper functions for NonhydrostaticModel constructor ##### VelocityFields(::Nothing, arch, grid, bcs) = VelocityFields(arch, grid, bcs) diff --git a/src/Forcings/continuous_forcing.jl b/src/Forcings/continuous_forcing.jl index 6beaa1240b..e46526df85 100644 --- a/src/Forcings/continuous_forcing.jl +++ b/src/Forcings/continuous_forcing.jl @@ -88,7 +88,7 @@ ContinuousForcing(func; parameters=nothing, field_dependencies=()) = Regularize `forcing::ContinuousForcing` by determining the indices of `forcing.field_dependencies` in `model_field_names`, and associated interpolation functions so `forcing` can be used during -time-stepping `IncompressibleModel`. +time-stepping `NonhydrostaticModel`. """ function regularize_forcing(forcing::ContinuousForcing, field, field_name, model_field_names) diff --git a/src/Forcings/forcing.jl b/src/Forcings/forcing.jl index 34caa76886..defa386827 100644 --- a/src/Forcings/forcing.jl +++ b/src/Forcings/forcing.jl @@ -9,7 +9,7 @@ are provided, then `func` must be callable with the signature `func(x, y, z, t)` where `x, y, z` are the east-west, north-south, and vertical spatial coordinates, and `t` is time. -Note that this form is also default in the constructor for `IncompressibleModel`, so that `Forcing` is +Note that this form is also default in the constructor for `NonhydrostaticModel`, so that `Forcing` is not needed. If `discrete_form=false` (the default), and `field_dependencies` are provided, @@ -69,11 +69,11 @@ ContinuousForcing{NamedTuple{(:μ, :λ, :ω), Tuple{Int64, Float64, Irrational{: ``` Note that because forcing locations are regularized within the -`IncompressibleModel` constructor: +`NonhydrostaticModel` constructor: ```jldoctest forcing grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) -model = IncompressibleModel(grid=grid, forcing=(v=v_forcing,)) +model = NonhydrostaticModel(grid=grid, forcing=(v=v_forcing,)) model.forcing.v @@ -84,7 +84,7 @@ ContinuousForcing{NamedTuple{(:μ, :λ, :ω), Tuple{Int64, Float64, Irrational{: └── field dependencies: () ``` -After passing through the constructor for `IncompressibleModel`, the `v`-forcing location +After passing through the constructor for `NonhydrostaticModel`, the `v`-forcing location information is available and set to `Center, Face, Center`. ```jldoctest forcing diff --git a/src/ImmersedBoundaries/mask_immersed_field.jl b/src/ImmersedBoundaries/mask_immersed_field.jl index 06667ad1d1..dd99a42b46 100644 --- a/src/ImmersedBoundaries/mask_immersed_field.jl +++ b/src/ImmersedBoundaries/mask_immersed_field.jl @@ -20,7 +20,7 @@ end end ##### -##### mask_immersed_velocities for IncompressibleModel +##### mask_immersed_velocities for NonhydrostaticModel ##### mask_immersed_velocities!(U, arch, grid) = tuple(NoneEvent()) diff --git a/src/Models/HydrostaticFreeSurfaceModels/calculate_hydrostatic_free_surface_tendencies.jl b/src/Models/HydrostaticFreeSurfaceModels/calculate_hydrostatic_free_surface_tendencies.jl index 9d6b691086..3239ed9265 100644 --- a/src/Models/HydrostaticFreeSurfaceModels/calculate_hydrostatic_free_surface_tendencies.jl +++ b/src/Models/HydrostaticFreeSurfaceModels/calculate_hydrostatic_free_surface_tendencies.jl @@ -6,7 +6,7 @@ using Oceananigans.Utils: work_layout using Oceananigans.TurbulenceClosures: TKEBasedVerticalDiffusivity """ - calculate_tendencies!(model::IncompressibleModel) + calculate_tendencies!(model::NonhydrostaticModel) Calculate the interior and boundary contributions to tendency terms without the contribution from non-hydrostatic pressure. diff --git a/src/Models/HydrostaticFreeSurfaceModels/hydrostatic_free_surface_model.jl b/src/Models/HydrostaticFreeSurfaceModels/hydrostatic_free_surface_model.jl index 36e8fa4a54..5be2e8f42a 100644 --- a/src/Models/HydrostaticFreeSurfaceModels/hydrostatic_free_surface_model.jl +++ b/src/Models/HydrostaticFreeSurfaceModels/hydrostatic_free_surface_model.jl @@ -10,7 +10,7 @@ using Oceananigans.BoundaryConditions: regularize_field_boundary_conditions using Oceananigans.Fields: Field, CenterField, tracernames, VelocityFields, TracerFields using Oceananigans.Forcings: model_forcing using Oceananigans.Grids: inflate_halo_size, with_halo, AbstractRectilinearGrid, AbstractCurvilinearGrid, AbstractHorizontallyCurvilinearGrid -using Oceananigans.Models.IncompressibleModels: extract_boundary_conditions +using Oceananigans.Models.NonhydrostaticModels: extract_boundary_conditions using Oceananigans.TimeSteppers: Clock, TimeStepper using Oceananigans.TurbulenceClosures: with_tracers, DiffusivityFields, add_closure_specific_boundary_conditions using Oceananigans.TurbulenceClosures: time_discretization, implicit_diffusion_solver diff --git a/src/Models/HydrostaticFreeSurfaceModels/prescribed_hydrostatic_velocity_fields.jl b/src/Models/HydrostaticFreeSurfaceModels/prescribed_hydrostatic_velocity_fields.jl index 2f373d39e6..cefd48718d 100644 --- a/src/Models/HydrostaticFreeSurfaceModels/prescribed_hydrostatic_velocity_fields.jl +++ b/src/Models/HydrostaticFreeSurfaceModels/prescribed_hydrostatic_velocity_fields.jl @@ -6,7 +6,7 @@ using Oceananigans.Grids: Center, Face using Oceananigans.Fields: AbstractField, FunctionField import Oceananigans.BoundaryConditions: fill_halo_regions! -import Oceananigans.Models.IncompressibleModels: extract_boundary_conditions +import Oceananigans.Models.NonhydrostaticModels: extract_boundary_conditions using Adapt diff --git a/src/Models/HydrostaticFreeSurfaceModels/update_hydrostatic_free_surface_model_state.jl b/src/Models/HydrostaticFreeSurfaceModels/update_hydrostatic_free_surface_model_state.jl index 8953d1633c..5e0c443212 100644 --- a/src/Models/HydrostaticFreeSurfaceModels/update_hydrostatic_free_surface_model_state.jl +++ b/src/Models/HydrostaticFreeSurfaceModels/update_hydrostatic_free_surface_model_state.jl @@ -2,7 +2,7 @@ using Oceananigans.Architectures using Oceananigans.BoundaryConditions using Oceananigans.TurbulenceClosures: calculate_diffusivities! using Oceananigans.ImmersedBoundaries: mask_immersed_field! -using Oceananigans.Models.IncompressibleModels: update_hydrostatic_pressure! +using Oceananigans.Models.NonhydrostaticModels: update_hydrostatic_pressure! import Oceananigans.TimeSteppers: update_state! diff --git a/src/Models/IncompressibleModels/IncompressibleModels.jl b/src/Models/IncompressibleModels/IncompressibleModels.jl index c05e33c936..10231260b5 100644 --- a/src/Models/IncompressibleModels/IncompressibleModels.jl +++ b/src/Models/IncompressibleModels/IncompressibleModels.jl @@ -1,4 +1,4 @@ -module IncompressibleModels +module NonhydrostaticModels using KernelAbstractions: @index, @kernel, Event, MultiEvent using KernelAbstractions.Extras.LoopInfo: @unroll @@ -8,7 +8,7 @@ using Oceananigans.Utils: launch! import Oceananigans: fields, prognostic_fields ##### -##### IncompressibleModel definition +##### NonhydrostaticModel definition ##### include("incompressible_model.jl") @@ -16,16 +16,16 @@ include("show_incompressible_model.jl") include("set_incompressible_model.jl") ##### -##### Time-stepping IncompressibleModels +##### Time-stepping NonhydrostaticModels ##### """ - fields(model::IncompressibleModel) + fields(model::NonhydrostaticModel) Returns a flattened `NamedTuple` of the fields in `model.velocities` and `model.tracers`. """ -fields(model::IncompressibleModel) = merge(model.velocities, model.tracers) -prognostic_fields(model::IncompressibleModel) = fields(model) +fields(model::NonhydrostaticModel) = merge(model.velocities, model.tracers) +prognostic_fields(model::NonhydrostaticModel) = fields(model) include("update_hydrostatic_pressure.jl") include("update_incompressible_model_state.jl") diff --git a/src/Models/IncompressibleModels/calculate_tendencies.jl b/src/Models/IncompressibleModels/calculate_tendencies.jl index b32bd89b61..2e39affd1b 100644 --- a/src/Models/IncompressibleModels/calculate_tendencies.jl +++ b/src/Models/IncompressibleModels/calculate_tendencies.jl @@ -4,12 +4,12 @@ using Oceananigans: fields using Oceananigans.Utils: work_layout """ - calculate_tendencies!(model::IncompressibleModel) + calculate_tendencies!(model::NonhydrostaticModel) Calculate the interior and boundary contributions to tendency terms without the contribution from non-hydrostatic pressure. """ -function calculate_tendencies!(model::IncompressibleModel) +function calculate_tendencies!(model::NonhydrostaticModel) # Note: # diff --git a/src/Models/IncompressibleModels/correct_incompressible_immersed_tendencies.jl b/src/Models/IncompressibleModels/correct_incompressible_immersed_tendencies.jl index 47591faf4e..3bb0db5d35 100644 --- a/src/Models/IncompressibleModels/correct_incompressible_immersed_tendencies.jl +++ b/src/Models/IncompressibleModels/correct_incompressible_immersed_tendencies.jl @@ -10,7 +10,7 @@ Correct the tendency terms to implement no-slip boundary conditions on an immers Makes velocity vanish within the immersed surface. """ -correct_immersed_tendencies!(model::IncompressibleModel, Δt, γⁿ, ζⁿ) = +correct_immersed_tendencies!(model::NonhydrostaticModel, Δt, γⁿ, ζⁿ) = correct_immersed_tendencies!(model, model.immersed_boundary, Δt, γⁿ, ζⁿ) # if no immersed boundary, do nothing (no cost) diff --git a/src/Models/IncompressibleModels/incompressible_model.jl b/src/Models/IncompressibleModels/incompressible_model.jl index 46fe742c1a..b70f446bb9 100644 --- a/src/Models/IncompressibleModels/incompressible_model.jl +++ b/src/Models/IncompressibleModels/incompressible_model.jl @@ -19,7 +19,7 @@ using Oceananigans.Grids: topology const ParticlesOrNothing = Union{Nothing, LagrangianParticles} -mutable struct IncompressibleModel{TS, E, A<:AbstractArchitecture, G, T, B, R, SD, U, C, Φ, F, +mutable struct NonhydrostaticModel{TS, E, A<:AbstractArchitecture, G, T, B, R, SD, U, C, Φ, F, V, S, K, BG, P, I} <: AbstractModel{TS} architecture :: A # Computer `Architecture` on which `Model` is run @@ -43,7 +43,7 @@ mutable struct IncompressibleModel{TS, E, A<:AbstractArchitecture, G, T, B, R, S end """ - IncompressibleModel(; + NonhydrostaticModel(; grid, architecture = CPU(), clock = Clock{eltype(grid)}(0, 0, 1), @@ -83,7 +83,7 @@ Keyword arguments - `timestepper`: A symbol that specifies the time-stepping method. Either `:QuasiAdamsBashforth2` or `:RungeKutta3`. """ -function IncompressibleModel(; grid, +function NonhydrostaticModel(; grid, architecture::AbstractArchitecture = CPU(), clock = Clock{eltype(grid)}(0, 0, 1), advection = CenteredSecondOrder(), @@ -164,7 +164,7 @@ function IncompressibleModel(; grid, model_fields = merge(velocities, tracers) forcing = model_forcing(model_fields; forcing...) - return IncompressibleModel(architecture, grid, clock, advection, buoyancy, coriolis, stokes_drift, + return NonhydrostaticModel(architecture, grid, clock, advection, buoyancy, coriolis, stokes_drift, forcing, closure, background_fields, particles, velocities, tracers, pressures, diffusivities, timestepper, pressure_solver, immersed_boundary) end diff --git a/src/Models/IncompressibleModels/pressure_correction.jl b/src/Models/IncompressibleModels/pressure_correction.jl index 29d2ccc206..efb41a1b3e 100644 --- a/src/Models/IncompressibleModels/pressure_correction.jl +++ b/src/Models/IncompressibleModels/pressure_correction.jl @@ -5,11 +5,11 @@ using Oceananigans.ImmersedBoundaries: mask_immersed_velocities!, mask_immersed_ import Oceananigans.TimeSteppers: calculate_pressure_correction!, pressure_correct_velocities! """ - calculate_pressure_correction!(model::IncompressibleModel, Δt) + calculate_pressure_correction!(model::NonhydrostaticModel, Δt) Calculate the (nonhydrostatic) pressure correction associated `tendencies`, `velocities`, and step size `Δt`. """ -function calculate_pressure_correction!(model::IncompressibleModel, Δt) +function calculate_pressure_correction!(model::NonhydrostaticModel, Δt) # Mask immersed velocities velocity_masking_events = mask_immersed_velocities!(model.velocities, model.architecture, model.grid) @@ -42,7 +42,7 @@ Update the predictor velocities u, v, and w with the non-hydrostatic pressure vi end "Update the solution variables (velocities and tracers)." -function pressure_correct_velocities!(model::IncompressibleModel, Δt) +function pressure_correct_velocities!(model::NonhydrostaticModel, Δt) event = launch!(model.architecture, model.grid, :xyz, _pressure_correct_velocities!, diff --git a/src/Models/IncompressibleModels/set_incompressible_model.jl b/src/Models/IncompressibleModels/set_incompressible_model.jl index f7fc3af2c4..79fdda77e3 100644 --- a/src/Models/IncompressibleModels/set_incompressible_model.jl +++ b/src/Models/IncompressibleModels/set_incompressible_model.jl @@ -14,7 +14,7 @@ a function with arguments `(x, y, z)`, or any data type for which a Example ======= ```julia -model = IncompressibleModel(grid=RegularRectilinearGrid(size=(32, 32, 32), length=(1, 1, 1)) +model = NonhydrostaticModel(grid=RegularRectilinearGrid(size=(32, 32, 32), length=(1, 1, 1)) # Set u to a parabolic function of z, v to random numbers damped # at top and bottom, and T to some silly array of half zeros, @@ -29,7 +29,7 @@ T₀[T₀ .< 0.5] .= 0 set!(model, u=u₀, v=v₀, T=T₀) ``` """ -function set!(model::IncompressibleModel; enforce_incompressibility=true, kwargs...) +function set!(model::NonhydrostaticModel; enforce_incompressibility=true, kwargs...) for (fldname, value) in kwargs if fldname ∈ propertynames(model.velocities) ϕ = getproperty(model.velocities, fldname) diff --git a/src/Models/IncompressibleModels/show_incompressible_model.jl b/src/Models/IncompressibleModels/show_incompressible_model.jl index ae3497105d..259dda9db9 100644 --- a/src/Models/IncompressibleModels/show_incompressible_model.jl +++ b/src/Models/IncompressibleModels/show_incompressible_model.jl @@ -2,8 +2,8 @@ using Oceananigans: short_show using Oceananigans.Utils: prettytime, ordered_dict_show """Show the innards of a `Model` in the REPL.""" -function Base.show(io::IO, model::IncompressibleModel{TS, C, A}) where {TS, C, A} - print(io, "IncompressibleModel{"*string(Base.nameof(A))*", $(eltype(model.grid))}", +function Base.show(io::IO, model::NonhydrostaticModel{TS, C, A}) where {TS, C, A} + print(io, "NonhydrostaticModel{"*string(Base.nameof(A))*", $(eltype(model.grid))}", "(time = $(prettytime(model.clock.time)), iteration = $(model.clock.iteration)) \n", "├── grid: $(short_show(model.grid))\n", "├── tracers: $(tracernames(model.tracers))\n", diff --git a/src/Models/IncompressibleModels/update_incompressible_model_state.jl b/src/Models/IncompressibleModels/update_incompressible_model_state.jl index 6163c0515e..eb7ad8ccd4 100644 --- a/src/Models/IncompressibleModels/update_incompressible_model_state.jl +++ b/src/Models/IncompressibleModels/update_incompressible_model_state.jl @@ -5,11 +5,11 @@ using Oceananigans.TurbulenceClosures: calculate_diffusivities! import Oceananigans.TimeSteppers: update_state! """ - update_state!(model::IncompressibleModel) + update_state!(model::NonhydrostaticModel) Update peripheral aspects of the model (halo regions, diffusivities, hydrostatic pressure) to the current model state. """ -function update_state!(model::IncompressibleModel) +function update_state!(model::NonhydrostaticModel) # Fill halos for velocities and tracers fill_halo_regions!(merge(model.velocities, model.tracers), model.architecture, model.clock, fields(model)) diff --git a/src/Models/Models.jl b/src/Models/Models.jl index 140e9a55d8..fef9eb854d 100644 --- a/src/Models/Models.jl +++ b/src/Models/Models.jl @@ -1,7 +1,7 @@ module Models export - IncompressibleModel, NonDimensionalIncompressibleModel, ShallowWaterModel, + NonhydrostaticModel, NonDimensionalNonhydrostaticModel, ShallowWaterModel, HydrostaticFreeSurfaceModel, VectorInvariant, ExplicitFreeSurface, ImplicitFreeSurface, HydrostaticSphericalCoriolis, VectorInvariantEnstrophyConserving, @@ -13,13 +13,13 @@ import Oceananigans.Architectures: device_event device_event(model::AbstractModel) = device_event(model.architecture) -abstract type AbstractIncompressibleModel{TS} <: AbstractModel{TS} end +abstract type AbstractNonhydrostaticModel{TS} <: AbstractModel{TS} end -include("IncompressibleModels/IncompressibleModels.jl") +include("NonhydrostaticModels/NonhydrostaticModels.jl") include("HydrostaticFreeSurfaceModels/HydrostaticFreeSurfaceModels.jl") include("ShallowWaterModels/ShallowWaterModels.jl") -using .IncompressibleModels: IncompressibleModel +using .NonhydrostaticModels: NonhydrostaticModel using .HydrostaticFreeSurfaceModels: HydrostaticFreeSurfaceModel, VectorInvariant, diff --git a/src/Oceananigans.jl b/src/Oceananigans.jl index a3bdf87a90..01503b35b3 100644 --- a/src/Oceananigans.jl +++ b/src/Oceananigans.jl @@ -56,7 +56,7 @@ export LagrangianParticles, # Models - IncompressibleModel, + NonhydrostaticModel, HydrostaticFreeSurfaceModel, ShallowWaterModel, fields, diff --git a/src/OutputWriters/checkpointer.jl b/src/OutputWriters/checkpointer.jl index 3e087a4a69..618a75e02c 100644 --- a/src/OutputWriters/checkpointer.jl +++ b/src/OutputWriters/checkpointer.jl @@ -345,7 +345,7 @@ function restore_from_checkpoint(filepath; kwargs...) close(file) - model = IncompressibleModel(; kwargs...) + model = NonhydrostaticModel(; kwargs...) return model end diff --git a/src/OutputWriters/jld2_output_writer.jl b/src/OutputWriters/jld2_output_writer.jl index f8222c2b78..5f582625dd 100644 --- a/src/OutputWriters/jld2_output_writer.jl +++ b/src/OutputWriters/jld2_output_writer.jl @@ -6,7 +6,7 @@ using Oceananigans.Utils: TimeInterval, pretty_filesize using Oceananigans.Fields: boundary_conditions -default_included_properties(::IncompressibleModel) = [:grid, :coriolis, :buoyancy, :closure] +default_included_properties(::NonhydrostaticModel) = [:grid, :coriolis, :buoyancy, :closure] default_included_properties(::ShallowWaterModel) = [:grid, :coriolis, :closure] default_included_properties(::HydrostaticFreeSurfaceModel) = [:grid, :coriolis, :buoyancy, :closure] @@ -113,7 +113,7 @@ Write out 3D fields for w and T and a horizontal average: using Oceananigans, Oceananigans.OutputWriters, Oceananigans.Fields using Oceananigans.Utils: hour, minute -model = IncompressibleModel(grid=RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1))) +model = NonhydrostaticModel(grid=RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1))) simulation = Simulation(model, Δt=12, stop_time=1hour) function init_save_some_metadata!(file, model) diff --git a/src/OutputWriters/netcdf_output_writer.jl b/src/OutputWriters/netcdf_output_writer.jl index 68c30e8b11..36d89fd336 100644 --- a/src/OutputWriters/netcdf_output_writer.jl +++ b/src/OutputWriters/netcdf_output_writer.jl @@ -183,7 +183,7 @@ using Oceananigans, Oceananigans.OutputWriters grid = RegularRectilinearGrid(size=(16, 16, 16), extent=(1, 1, 1)); -model = IncompressibleModel(grid=grid); +model = NonhydrostaticModel(grid=grid); simulation = Simulation(model, Δt=12, stop_time=3600); @@ -239,7 +239,7 @@ using Oceananigans, Oceananigans.OutputWriters grid = RegularRectilinearGrid(size=(16, 16, 16), extent=(1, 2, 3)); -model = IncompressibleModel(grid=grid); +model = NonhydrostaticModel(grid=grid); simulation = Simulation(model, Δt=1.25, stop_iteration=3); diff --git a/src/OutputWriters/windowed_time_average.jl b/src/OutputWriters/windowed_time_average.jl index 717360c49e..ed731f828f 100644 --- a/src/OutputWriters/windowed_time_average.jl +++ b/src/OutputWriters/windowed_time_average.jl @@ -60,7 +60,7 @@ using Oceananigans using Oceananigans.OutputWriters: JLD2OutputWriter using Oceananigans.Utils: minutes -model = IncompressibleModel(grid=RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1))) +model = NonhydrostaticModel(grid=RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1))) simulation = Simulation(model, Δt=10minutes, stop_time=30years) diff --git a/src/TurbulenceClosures/diffusivity_fields.jl b/src/TurbulenceClosures/diffusivity_fields.jl index a6e26f2026..72f6747874 100644 --- a/src/TurbulenceClosures/diffusivity_fields.jl +++ b/src/TurbulenceClosures/diffusivity_fields.jl @@ -1,7 +1,7 @@ using Oceananigans.Fields: validate_field_tuple_grid ##### -##### Forms for IncompressibleModel constructor +##### Forms for NonhydrostaticModel constructor ##### DiffusivityFields(diffusivities::NamedTuple, arch, grid, tracer_names, bcs, closure) = diff --git a/test/regression_tests/ocean_large_eddy_simulation_regression_test.jl b/test/regression_tests/ocean_large_eddy_simulation_regression_test.jl index 71fc40d3de..c1fd4799fb 100644 --- a/test/regression_tests/ocean_large_eddy_simulation_regression_test.jl +++ b/test/regression_tests/ocean_large_eddy_simulation_regression_test.jl @@ -28,7 +28,7 @@ function run_ocean_large_eddy_simulation_regression_test(arch, grid_type, closur S_bcs = FieldBoundaryConditions(top = BoundaryCondition(Flux, 5e-8)) # Model instantiation - model = IncompressibleModel( + model = NonhydrostaticModel( architecture = arch, grid = grid, coriolis = FPlane(f=1e-4), diff --git a/test/regression_tests/rayleigh_benard_regression_test.jl b/test/regression_tests/rayleigh_benard_regression_test.jl index 8028169dd0..e39d8e87e9 100644 --- a/test/regression_tests/rayleigh_benard_regression_test.jl +++ b/test/regression_tests/rayleigh_benard_regression_test.jl @@ -39,7 +39,7 @@ function run_rayleigh_benard_regression_test(arch, grid_type) bbcs = FieldBoundaryConditions(top = BoundaryCondition(Value, 0.0), bottom = BoundaryCondition(Value, Δb)) - model = IncompressibleModel( + model = NonhydrostaticModel( architecture = arch, grid = grid, closure = IsotropicDiffusivity(ν=ν, κ=κ), diff --git a/test/regression_tests/thermal_bubble_regression_test.jl b/test/regression_tests/thermal_bubble_regression_test.jl index 4b4fcf999c..36aa2b6da8 100644 --- a/test/regression_tests/thermal_bubble_regression_test.jl +++ b/test/regression_tests/thermal_bubble_regression_test.jl @@ -11,7 +11,7 @@ function run_thermal_bubble_regression_test(arch, grid_type) end closure = IsotropicDiffusivity(ν=4e-2, κ=4e-2) - model = IncompressibleModel(architecture=arch, grid=grid, closure=closure, coriolis=FPlane(f=1e-4)) + model = NonhydrostaticModel(architecture=arch, grid=grid, closure=closure, coriolis=FPlane(f=1e-4)) simulation = Simulation(model, Δt=6, stop_iteration=10) model.tracers.T.data.parent .= 9.85 diff --git a/test/test_abstract_operations.jl b/test/test_abstract_operations.jl index 64a65520cb..2d10f5ef9b 100644 --- a/test/test_abstract_operations.jl +++ b/test/test_abstract_operations.jl @@ -222,7 +222,7 @@ for arch in archs buoyancy = SeawaterBuoyancy(gravitational_acceleration = 1, equation_of_state = LinearEquationOfState(α=1, β=1)) - model = IncompressibleModel(architecture = arch, + model = NonhydrostaticModel(architecture = arch, grid = grid, buoyancy = buoyancy) diff --git a/test/test_boundary_conditions_integration.jl b/test/test_boundary_conditions_integration.jl index 55c3915ea5..4834203567 100644 --- a/test/test_boundary_conditions_integration.jl +++ b/test/test_boundary_conditions_integration.jl @@ -6,7 +6,7 @@ function test_boundary_condition(arch, FT, topo, side, field_name, boundary_cond boundary_condition_kwarg = (; side => boundary_condition) field_boundary_conditions = FieldBoundaryConditions(; boundary_condition_kwarg...) bcs = (; field_name => field_boundary_conditions) - model = IncompressibleModel(grid=grid, architecture=arch, boundary_conditions=bcs) + model = NonhydrostaticModel(grid=grid, architecture=arch, boundary_conditions=bcs) success = try time_step!(model, 1e-16, euler=true) @@ -41,7 +41,7 @@ function test_incompressible_flux_budget(arch, name, side, topo) model_bcs = NamedTuple{tuple(name)}(tuple(field_bcs)) - model = IncompressibleModel(grid=grid, buoyancy=nothing, boundary_conditions=model_bcs, + model = NonhydrostaticModel(grid=grid, buoyancy=nothing, boundary_conditions=model_bcs, closure=nothing, architecture=arch, tracers=:c) is_velocity_field = name ∈ (:u, :v, :w) @@ -75,7 +75,7 @@ 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 = IncompressibleModel( + model = NonhydrostaticModel( grid=grid, architecture=arch, tracers=:b, buoyancy=BuoyancyTracer(), closure=AnisotropicMinimumDissipation(), boundary_conditions=model_bcs ) @@ -128,10 +128,10 @@ test_boundary_conditions(C, FT, ArrayType) = (integer_bc(C, FT, ArrayType), ) @testset "Boundary condition integration tests" begin - @info "Testing boundary condition integration into IncompressibleModel..." + @info "Testing boundary condition integration into NonhydrostaticModel..." @testset "Boundary condition regularization" begin - @info " Testing boundary condition regularization in IncompressibleModel constructor..." + @info " Testing boundary condition regularization in NonhydrostaticModel constructor..." FT = Float64 arch = first(archs) @@ -166,7 +166,7 @@ test_boundary_conditions(C, FT, ArrayType) = (integer_bc(C, FT, ArrayType), w=w_boundary_conditions, T=T_boundary_conditions) - model = IncompressibleModel(architecture = arch, + model = NonhydrostaticModel(architecture = arch, grid = grid, boundary_conditions = boundary_conditions) diff --git a/test/test_checkpointer.jl b/test/test_checkpointer.jl index e114881219..b59c0fe861 100644 --- a/test/test_checkpointer.jl +++ b/test/test_checkpointer.jl @@ -41,7 +41,7 @@ function test_thermal_bubble_checkpointer_output(arch) grid = RegularRectilinearGrid(size=(Nx, Ny, Nz), extent=(Lx, Ly, Lz)) closure = IsotropicDiffusivity(ν=4e-2, κ=4e-2) - true_model = IncompressibleModel(architecture=arch, grid=grid, closure=closure) + true_model = NonhydrostaticModel(architecture=arch, grid=grid, closure=closure) # Add a cube-shaped warm temperature anomaly that takes up the middle 50% # of the domain volume. @@ -73,7 +73,7 @@ function test_thermal_bubble_checkpointer_output(arch) ##### Test `set!(model, checkpoint_file)` ##### - new_model = IncompressibleModel(architecture=arch, grid=grid, closure=closure) + new_model = NonhydrostaticModel(architecture=arch, grid=grid, closure=closure) set!(new_model, "checkpoint_iteration5.jld2") @@ -121,7 +121,7 @@ function test_checkpoint_output_with_function_bcs(arch) u_bcs = FieldBoundaryConditions(top=top_u_bc) T_bcs = FieldBoundaryConditions(top=top_T_bc) - model = IncompressibleModel(architecture=arch, grid=grid, boundary_conditions=(u=u_bcs, T=T_bcs)) + model = NonhydrostaticModel(architecture=arch, grid=grid, boundary_conditions=(u=u_bcs, T=T_bcs)) set!(model, u=π/2, v=ℯ, T=Base.MathConstants.γ, S=Base.MathConstants.φ) checkpointer = Checkpointer(model, schedule=IterationInterval(1)) @@ -184,14 +184,14 @@ function test_checkpoint_output_with_function_bcs(arch) # Test that the restored model can be time stepped time_step!(properly_restored_model, 1) - @test properly_restored_model isa IncompressibleModel + @test properly_restored_model isa NonhydrostaticModel return nothing end function run_cross_architecture_checkpointer_tests(arch1, arch2) grid = RegularRectilinearGrid(size=(16, 16, 16), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=arch1, grid=grid) + model = NonhydrostaticModel(architecture=arch1, grid=grid) set!(model, u=π/2, v=ℯ, T=Base.MathConstants.γ, S=Base.MathConstants.φ) checkpointer = Checkpointer(model, schedule=IterationInterval(1)) @@ -219,14 +219,14 @@ function run_cross_architecture_checkpointer_tests(arch1, arch2) # Test that the restored model can be time stepped time_step!(restored_model, 1) - @test restored_model isa IncompressibleModel + @test restored_model isa NonhydrostaticModel return nothing end function run_checkpointer_cleanup_tests(arch) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) simulation = Simulation(model, Δt=0.2, stop_iteration=10) simulation.output_writers[:checkpointer] = Checkpointer(model, schedule=IterationInterval(3), cleanup=true) diff --git a/test/test_computed_field.jl b/test/test_computed_field.jl index c71cb08322..508337390b 100644 --- a/test/test_computed_field.jl +++ b/test/test_computed_field.jl @@ -205,7 +205,7 @@ end function computation_including_boundaries(arch) topo = (Periodic, Bounded, Bounded) grid = RegularRectilinearGrid(topology=topo, size=(13, 17, 19), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) u, v, w = model.velocities @. u.data = 1 + rand() @@ -243,7 +243,7 @@ end function computations_with_buoyancy_field(arch, buoyancy) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) tracers = buoyancy isa BuoyancyTracer ? :b : (:T, :S) - model = IncompressibleModel(architecture=arch, grid=grid, + model = NonhydrostaticModel(architecture=arch, grid=grid, tracers=tracers, buoyancy=buoyancy) b = BuoyancyField(model) @@ -327,7 +327,7 @@ for arch in archs buoyancy = SeawaterBuoyancy(gravitational_acceleration = 1, equation_of_state = LinearEquationOfState(α=1, β=1)) - model = IncompressibleModel(architecture = arch, + model = NonhydrostaticModel(architecture = arch, grid = grid, buoyancy = buoyancy) diff --git a/test/test_diagnostics.jl b/test/test_diagnostics.jl index 3936070f50..572633cc70 100644 --- a/test/test_diagnostics.jl +++ b/test/test_diagnostics.jl @@ -5,7 +5,7 @@ using Oceananigans.Models.HydrostaticFreeSurfaceModels: VectorInvariant function nan_checker_aborts_simulation(arch) grid = RegularRectilinearGrid(size=(4, 2, 1), extent=(1, 1, 1)) - model = IncompressibleModel(grid=grid, architecture=arch) + model = NonhydrostaticModel(grid=grid, architecture=arch) simulation = Simulation(model, Δt=1, stop_iteration=1) model.velocities.u[1, 1, 1] = NaN @@ -16,7 +16,7 @@ function nan_checker_aborts_simulation(arch) end TestModel_VerticallyStrectedRectGrid(arch, FT, ν=1.0, Δx=0.5) = - IncompressibleModel( + NonhydrostaticModel( grid = VerticallyStretchedRectilinearGrid(FT, architecture = arch, size=(3, 3, 3), x=(0, 3Δx), y=(0, 3Δx), z_faces=0:Δx:3Δx,), closure = IsotropicDiffusivity(FT, ν=ν, κ=ν), architecture = arch @@ -24,7 +24,7 @@ TestModel_VerticallyStrectedRectGrid(arch, FT, ν=1.0, Δx=0.5) = TestModel_RegularRectGrid(arch, FT, ν=1.0, Δx=0.5) = - IncompressibleModel( + NonhydrostaticModel( grid = RegularRectilinearGrid(FT, topology=(Periodic, Periodic, Periodic), size=(3, 3, 3), extent=(3Δx, 3Δx, 3Δx)), closure = IsotropicDiffusivity(FT, ν=ν, κ=ν), architecture = arch @@ -102,7 +102,7 @@ end function accurate_advective_cfl_on_stretched_grid(arch, FT) grid = VerticallyStretchedRectilinearGrid(architecture=arch, size=(4, 4, 8), x=(0, 100), y=(0, 100), z_faces=[k^2 for k in 0:8]) - model = IncompressibleModel(grid=grid, architecture=arch) + model = NonhydrostaticModel(grid=grid, architecture=arch) Δt = FT(15.5) diff --git a/test/test_distributed_models.jl b/test/test_distributed_models.jl index 8ec83e3b2c..075f21a32c 100644 --- a/test/test_distributed_models.jl +++ b/test/test_distributed_models.jl @@ -191,7 +191,7 @@ function test_triply_periodic_local_grid_with_411_ranks() topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(8, 8, 8), extent=(1, 2, 3)) arch = MultiCPU(grid=full_grid, ranks=(4, 1, 1)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid, pressure_solver=nothing) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid, pressure_solver=nothing) local_rank = MPI.Comm_rank(MPI.COMM_WORLD) local_grid = model.grid @@ -211,7 +211,7 @@ function test_triply_periodic_local_grid_with_141_ranks() topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(8, 8, 8), extent=(1, 2, 3)) arch = MultiCPU(grid=full_grid, ranks=(1, 4, 1)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid, pressure_solver=nothing) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid, pressure_solver=nothing) local_rank = MPI.Comm_rank(MPI.COMM_WORLD) local_grid = model.grid @@ -231,7 +231,7 @@ function test_triply_periodic_local_grid_with_114_ranks() topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(8, 8, 8), extent=(1, 2, 3)) arch = MultiCPU(grid=full_grid, ranks=(1, 1, 4)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid, pressure_solver=nothing) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid, pressure_solver=nothing) local_rank = MPI.Comm_rank(MPI.COMM_WORLD) local_grid = model.grid @@ -251,7 +251,7 @@ function test_triply_periodic_local_grid_with_221_ranks() topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(8, 8, 8), extent=(1, 2, 3)) arch = MultiCPU(grid=full_grid, ranks=(2, 2, 1)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid, pressure_solver=nothing) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid, pressure_solver=nothing) i, j, k = arch.local_index local_grid = model.grid @@ -275,7 +275,7 @@ function test_triply_periodic_bc_injection_with_411_ranks() topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(8, 8, 8), extent=(1, 2, 3)) arch = MultiCPU(grid=full_grid, ranks=(4, 1, 1)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid, pressure_solver=nothing) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid, pressure_solver=nothing) for field in merge(fields(model), model.pressures) fbcs = field.boundary_conditions @@ -292,7 +292,7 @@ function test_triply_periodic_bc_injection_with_141_ranks() topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(8, 8, 8), extent=(1, 2, 3)) arch = MultiCPU(grid=full_grid, ranks=(1, 4, 1)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid, pressure_solver=nothing) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid, pressure_solver=nothing) for field in merge(fields(model), model.pressures) fbcs = field.boundary_conditions @@ -309,7 +309,7 @@ function test_triply_periodic_bc_injection_with_114_ranks() topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(8, 8, 8), extent=(1, 2, 3)) arch = MultiCPU(grid=full_grid, ranks=(1, 1, 4)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid, pressure_solver=nothing) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid, pressure_solver=nothing) for field in merge(fields(model), model.pressures) fbcs = field.boundary_conditions @@ -326,7 +326,7 @@ function test_triply_periodic_bc_injection_with_221_ranks() topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(8, 8, 8), extent=(1, 2, 3)) arch = MultiCPU(grid=full_grid, ranks=(2, 2, 1)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid, pressure_solver=nothing) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid, pressure_solver=nothing) for field in merge(fields(model), model.pressures) fbcs = field.boundary_conditions @@ -347,7 +347,7 @@ function test_triply_periodic_halo_communication_with_411_ranks(halo) topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(16, 6, 4), extent=(1, 2, 3), halo=halo) arch = MultiCPU(grid=full_grid, ranks=(4, 1, 1)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid, pressure_solver=nothing) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid, pressure_solver=nothing) for field in merge(fields(model), model.pressures) interior(field) .= arch.local_rank @@ -371,7 +371,7 @@ function test_triply_periodic_halo_communication_with_141_ranks(halo) topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(4, 16, 4), extent=(1, 2, 3), halo=halo) arch = MultiCPU(grid=full_grid, ranks=(1, 4, 1)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid, pressure_solver=nothing) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid, pressure_solver=nothing) for field in merge(fields(model), model.pressures) interior(field) .= arch.local_rank @@ -394,7 +394,7 @@ function test_triply_periodic_halo_communication_with_114_ranks(halo) topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(4, 4, 16), extent=(1, 2, 3), halo=halo) arch = MultiCPU(grid=full_grid, ranks=(1, 1, 4)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid, pressure_solver=nothing) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid, pressure_solver=nothing) for field in merge(fields(model), model.pressures) interior(field) .= arch.local_rank @@ -417,7 +417,7 @@ function test_triply_periodic_halo_communication_with_221_ranks(halo) topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(8, 8, 3), extent=(1, 2, 3), halo=halo) arch = MultiCPU(grid=full_grid, ranks=(2, 2, 1)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid, pressure_solver=nothing) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid, pressure_solver=nothing) for field in merge(fields(model), model.pressures) interior(field) .= arch.local_rank @@ -478,19 +478,19 @@ end end end - @testset "Time stepping IncompressibleModel" begin + @testset "Time stepping NonhydrostaticModel" begin topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=(8, 8, 8), extent=(1, 2, 3)) arch = MultiCPU(grid=full_grid, ranks=(1, 4, 1)) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid) time_step!(model, 1) - @test model isa IncompressibleModel + @test model isa NonhydrostaticModel @test model.clock.time ≈ 1 simulation = Simulation(model, Δt=1, stop_iteration=2) run!(simulation) - @test model isa IncompressibleModel + @test model isa NonhydrostaticModel @test model.clock.time ≈ 2 end diff --git a/test/test_distributed_poisson_solvers.jl b/test/test_distributed_poisson_solvers.jl index 6fc7acc3a1..5d2d8f3eb1 100644 --- a/test/test_distributed_poisson_solvers.jl +++ b/test/test_distributed_poisson_solvers.jl @@ -29,7 +29,7 @@ function divergence_free_poisson_solution_triply_periodic(grid_points, ranks) topo = (Periodic, Periodic, Periodic) full_grid = RegularRectilinearGrid(topology=topo, size=grid_points, extent=(1, 2, 3)) arch = MultiCPU(grid=full_grid, ranks=ranks) - model = DistributedIncompressibleModel(architecture=arch, grid=full_grid) + model = DistributedNonhydrostaticModel(architecture=arch, grid=full_grid) local_grid = model.grid solver = DistributedFFTBasedPoissonSolver(arch, full_grid, local_grid) diff --git a/test/test_dynamics.jl b/test/test_dynamics.jl index c769835880..6c52f61788 100644 --- a/test/test_dynamics.jl +++ b/test/test_dynamics.jl @@ -9,7 +9,7 @@ end function test_diffusion_simple(fieldname, timestepper, time_discretization) - model = IncompressibleModel(timestepper = timestepper, + model = NonhydrostaticModel(timestepper = timestepper, grid = RegularRectilinearGrid(size=(1, 1, 16), extent=(1, 1, 1)), closure = IsotropicDiffusivity(ν=1, κ=1, time_discretization=time_discretization), coriolis = nothing, @@ -69,7 +69,7 @@ end function test_diffusion_cosine(fieldname, timestepper, grid, time_discretization) κ, m = 1, 2 # diffusivity and cosine wavenumber - model = IncompressibleModel(timestepper = timestepper, + model = NonhydrostaticModel(timestepper = timestepper, grid = grid, closure = IsotropicDiffusivity(ν=κ, κ=κ, time_discretization=time_discretization), buoyancy = nothing) @@ -136,7 +136,7 @@ function internal_wave_test(timestepper; N=128, Nt=10, background_stratification w₀(x, y, z) = w(x, y, z, 0) b₀(x, y, z) = b(x, y, z, 0) - model = IncompressibleModel(timestepper = timestepper, + model = NonhydrostaticModel(timestepper = timestepper, grid = RegularRectilinearGrid(size=(N, 1, N), extent=(L, L, L)), closure = IsotropicDiffusivity(ν=ν, κ=κ), buoyancy = BuoyancyTracer(), @@ -177,7 +177,7 @@ function passive_tracer_advection_test(timestepper; N=128, κ=1e-12, Nt=100, bac grid = RegularRectilinearGrid(size=(N, N, 2), extent=(L, L, L)) closure = IsotropicDiffusivity(ν=κ, κ=κ) - model = IncompressibleModel(timestepper=timestepper, grid=grid, closure=closure, + model = NonhydrostaticModel(timestepper=timestepper, grid=grid, closure=closure, background_fields=background_fields) set!(model, u=u₀, v=v₀, T=T₀) @@ -209,7 +209,7 @@ function taylor_green_vortex_test(arch, timestepper, time_discretization; FT=Flo @inline u(x, y, z, t) = -sin(2π*y) * exp(-4π^2 * ν * t) @inline v(x, y, z, t) = sin(2π*x) * exp(-4π^2 * ν * t) - model = IncompressibleModel( + model = NonhydrostaticModel( architecture = arch, timestepper = timestepper, grid = RegularRectilinearGrid(FT, size=(Nx, Ny, Nz), extent=(Lx, Ly, Lz)), @@ -258,7 +258,7 @@ function stratified_fluid_remains_at_rest_with_tilted_gravity_buoyancy_tracer(ar z_bc = GradientBoundaryCondition(N² * g̃[3]) b_bcs = FieldBoundaryConditions(bottom=z_bc, top=z_bc, south=y_bc, north=y_bc) - model = IncompressibleModel( + model = NonhydrostaticModel( architecture = arch, grid = grid, buoyancy = buoyancy, @@ -314,7 +314,7 @@ function stratified_fluid_remains_at_rest_with_tilted_gravity_temperature_tracer z_bc = GradientBoundaryCondition(∂T∂z * g̃[3]) T_bcs = FieldBoundaryConditions(bottom=z_bc, top=z_bc, south=y_bc, north=y_bc) - model = IncompressibleModel( + model = NonhydrostaticModel( architecture = arch, grid = grid, buoyancy = buoyancy, @@ -396,7 +396,7 @@ timesteppers = (:QuasiAdamsBashforth2, :RungeKutta3) grid = RegularRectilinearGrid(size=(4, 4, 4), extent=(1, 1, 1), topology=topology) - model = IncompressibleModel(timestepper = timestepper, + model = NonhydrostaticModel(timestepper = timestepper, grid = grid, closure = closure, tracers = :c, @@ -432,7 +432,7 @@ timesteppers = (:QuasiAdamsBashforth2, :RungeKutta3) grid = RegularRectilinearGrid(size=(2, 2, 2), extent=(1, 1, 1), topology=topology) - model = IncompressibleModel(timestepper = timestepper, + model = NonhydrostaticModel(timestepper = timestepper, grid = grid, closure = AnisotropicBiharmonicDiffusivity(νh=1, νz=1, κh=1, κz=1), coriolis = nothing, diff --git a/test/test_forcings.jl b/test/test_forcings.jl index 51141a11ef..8b448f8ee5 100644 --- a/test/test_forcings.jl +++ b/test/test_forcings.jl @@ -5,7 +5,7 @@ function time_step_with_forcing_functions(arch) @inline Fw(x, y, z, t) = 1.0 grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - model = IncompressibleModel(grid=grid, architecture=arch, forcing=(u=Fu, v=Fv, w=Fw)) + model = NonhydrostaticModel(grid=grid, architecture=arch, forcing=(u=Fu, v=Fv, w=Fw)) time_step!(model, 1, euler=true) return true @@ -21,7 +21,7 @@ function time_step_with_discrete_forcing(arch) Fu = Forcing(Fu_discrete_func, discrete_form=true) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - model = IncompressibleModel(grid=grid, architecture=arch, forcing=(u=Fu,)) + model = NonhydrostaticModel(grid=grid, architecture=arch, forcing=(u=Fu,)) time_step!(model, 1, euler=true) return true @@ -34,7 +34,7 @@ function time_step_with_parameterized_discrete_forcing(arch) Fw = Forcing(Fw_discrete_func, parameters=(τ=60,), discrete_form=true) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - model = IncompressibleModel(grid=grid, architecture=arch, forcing=(v=Fv, w=Fw)) + model = NonhydrostaticModel(grid=grid, architecture=arch, forcing=(v=Fv, w=Fw)) time_step!(model, 1, euler=true) return true @@ -46,7 +46,7 @@ function time_step_with_parameterized_continuous_forcing(arch) u_forcing = Forcing((x, y, z, t, ω) -> sin(ω * x), parameters=π) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - model = IncompressibleModel(grid=grid, architecture=arch, forcing=(u=u_forcing,)) + model = NonhydrostaticModel(grid=grid, architecture=arch, forcing=(u=u_forcing,)) time_step!(model, 1, euler=true) return true @@ -58,7 +58,7 @@ function time_step_with_single_field_dependent_forcing(arch, fld) forcing = NamedTuple{(fld,)}((Forcing((x, y, z, t, u) -> -u, field_dependencies=:u),)) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - model = IncompressibleModel(grid=grid, architecture=arch, forcing=forcing) + model = NonhydrostaticModel(grid=grid, architecture=arch, forcing=forcing) time_step!(model, 1, euler=true) return true @@ -70,7 +70,7 @@ function time_step_with_multiple_field_dependent_forcing(arch) u_forcing = Forcing((x, y, z, t, v, w, T) -> sin(v) * exp(w) * T, field_dependencies=(:v, :w, :T)) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - model = IncompressibleModel(grid=grid, architecture=arch, forcing=(u=u_forcing,)) + model = NonhydrostaticModel(grid=grid, architecture=arch, forcing=(u=u_forcing,)) time_step!(model, 1, euler=true) return true @@ -84,7 +84,7 @@ function time_step_with_parameterized_field_dependent_forcing(arch) u_forcing = Forcing((x, y, z, t, u, p) -> sin(p.ω * x) * u, parameters=(ω=π,), field_dependencies=:u) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - model = IncompressibleModel(grid=grid, architecture=arch, forcing=(u=u_forcing,)) + model = NonhydrostaticModel(grid=grid, architecture=arch, forcing=(u=u_forcing,)) time_step!(model, 1, euler=true) return true @@ -101,7 +101,7 @@ function relaxed_time_stepping(arch) target = π) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - model = IncompressibleModel(grid=grid, architecture=arch, forcing=(u=x_relax, v=y_relax, w=z_relax)) + model = NonhydrostaticModel(grid=grid, architecture=arch, forcing=(u=x_relax, v=y_relax, w=z_relax)) time_step!(model, 1, euler=true) return true diff --git a/test/test_incompressible_models.jl b/test/test_incompressible_models.jl index a6289ecc2d..99a1ea7f01 100644 --- a/test/test_incompressible_models.jl +++ b/test/test_incompressible_models.jl @@ -3,11 +3,11 @@ @testset "Model constructor errors" begin grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - @test_throws TypeError IncompressibleModel(architecture=CPU, grid=grid) - @test_throws TypeError IncompressibleModel(architecture=GPU, grid=grid) - @test_throws TypeError IncompressibleModel(grid=grid, boundary_conditions=1) - @test_throws TypeError IncompressibleModel(grid=grid, forcing=2) - @test_throws TypeError IncompressibleModel(grid=grid, background_fields=3) + @test_throws TypeError NonhydrostaticModel(architecture=CPU, grid=grid) + @test_throws TypeError NonhydrostaticModel(architecture=GPU, grid=grid) + @test_throws TypeError NonhydrostaticModel(grid=grid, boundary_conditions=1) + @test_throws TypeError NonhydrostaticModel(grid=grid, forcing=2) + @test_throws TypeError NonhydrostaticModel(grid=grid, background_fields=3) end topos = ((Periodic, Periodic, Periodic), @@ -22,49 +22,49 @@ arch isa GPU && topo == (Bounded, Bounded, Bounded) && continue grid = RegularRectilinearGrid(FT, topology=topo, size=(16, 16, 2), extent=(1, 2, 3)) - model = IncompressibleModel(grid=grid, architecture=arch) + model = NonhydrostaticModel(grid=grid, architecture=arch) - @test model isa IncompressibleModel + @test model isa NonhydrostaticModel end end end - @testset "Adjustment of halos in IncompressibleModel constructor" begin - @info " Testing adjustment of halos in IncompressibleModel constructor..." + @testset "Adjustment of halos in NonhydrostaticModel constructor" begin + @info " Testing adjustment of halos in NonhydrostaticModel constructor..." default_grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 2, 3)) funny_grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 2, 3), halo=(1, 3, 4)) # Model ensures that halos are at least of size 1 - model = IncompressibleModel(grid=default_grid) + model = NonhydrostaticModel(grid=default_grid) @test model.grid.Hx == 1 && model.grid.Hy == 1 && model.grid.Hz == 1 - model = IncompressibleModel(grid=funny_grid) + model = NonhydrostaticModel(grid=funny_grid) @test model.grid.Hx == 1 && model.grid.Hy == 3 && model.grid.Hz == 4 # Model ensures that halos are at least of size 2 for scheme in (CenteredFourthOrder(), UpwindBiasedThirdOrder()) - model = IncompressibleModel(advection=scheme, grid=default_grid) + model = NonhydrostaticModel(advection=scheme, grid=default_grid) @test model.grid.Hx == 2 && model.grid.Hy == 2 && model.grid.Hz == 2 - model = IncompressibleModel(advection=scheme, grid=funny_grid) + model = NonhydrostaticModel(advection=scheme, grid=funny_grid) @test model.grid.Hx == 2 && model.grid.Hy == 3 && model.grid.Hz == 4 end # Model ensures that halos are at least of size 3 for scheme in (WENO5(), UpwindBiasedFifthOrder()) - model = IncompressibleModel(advection=scheme, grid=default_grid) + model = NonhydrostaticModel(advection=scheme, grid=default_grid) @test model.grid.Hx == 3 && model.grid.Hy == 3 && model.grid.Hz == 3 - model = IncompressibleModel(advection=scheme, grid=funny_grid) + model = NonhydrostaticModel(advection=scheme, grid=funny_grid) @test model.grid.Hx == 3 && model.grid.Hy == 3 && model.grid.Hz == 4 end # Model ensures that halos are at least of size 2 with AnisotropicBiharmonicDiffusivity - model = IncompressibleModel(closure=AnisotropicBiharmonicDiffusivity(), grid=default_grid) + model = NonhydrostaticModel(closure=AnisotropicBiharmonicDiffusivity(), grid=default_grid) @test model.grid.Hx == 2 && model.grid.Hy == 2 && model.grid.Hz == 2 - model = IncompressibleModel(closure=AnisotropicBiharmonicDiffusivity(), grid=funny_grid) + model = NonhydrostaticModel(closure=AnisotropicBiharmonicDiffusivity(), grid=funny_grid) @test model.grid.Hx == 2 && model.grid.Hy == 3 && model.grid.Hz == 4 end @@ -73,11 +73,11 @@ for arch in archs grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 2, 3)) - model = IncompressibleModel(grid=grid, architecture=arch, tracers=:c, buoyancy=nothing) - @test model isa IncompressibleModel + model = NonhydrostaticModel(grid=grid, architecture=arch, tracers=:c, buoyancy=nothing) + @test model isa NonhydrostaticModel - model = IncompressibleModel(grid=grid, architecture=arch, tracers=nothing, buoyancy=nothing) - @test model isa IncompressibleModel + model = NonhydrostaticModel(grid=grid, architecture=arch, tracers=nothing, buoyancy=nothing) + @test model isa NonhydrostaticModel end end @@ -88,7 +88,7 @@ L = (2π, 3π, 5π) grid = RegularRectilinearGrid(FT, size=N, extent=L) - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) u, v, w = model.velocities T, S = model.tracers @@ -159,11 +159,11 @@ # Test setting the background_fields to a Field U_field = XFaceField(arch, grid) U_field .= 1 - model = IncompressibleModel(grid=grid, architecture=arch, background_fields = (u=U_field,)) + model = NonhydrostaticModel(grid=grid, architecture=arch, background_fields = (u=U_field,)) @test model.background_fields.velocities.u isa Field U_field = CenterField(arch, grid) - @test_throws ArgumentError IncompressibleModel(grid=grid, architecture=arch, background_fields = (u=U_field,)) + @test_throws ArgumentError NonhydrostaticModel(grid=grid, architecture=arch, background_fields = (u=U_field,)) end end end diff --git a/test/test_jld2_output_writer.jl b/test/test_jld2_output_writer.jl index 8fe7ef3dfa..e9b3ca404b 100644 --- a/test/test_jld2_output_writer.jl +++ b/test/test_jld2_output_writer.jl @@ -80,7 +80,7 @@ function jld2_sliced_field_output(model, outputs=model.velocities) end function run_jld2_file_splitting_tests(arch) - model = IncompressibleModel(architecture=arch, grid=RegularRectilinearGrid(size=(16, 16, 16), extent=(1, 1, 1))) + model = NonhydrostaticModel(architecture=arch, grid=RegularRectilinearGrid(size=(16, 16, 16), extent=(1, 1, 1))) simulation = Simulation(model, Δt=1, stop_iteration=10) function fake_bc_init(file, model) @@ -167,7 +167,7 @@ for arch in archs # Some tests can reuse this same grid and model. topo =(Periodic, Periodic, Bounded) grid = RegularRectilinearGrid(topology=topo, size=(4, 4, 4), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) @testset "JLD2 output writer [$(typeof(arch))]" begin @info " Testing JLD2 output writer [$(typeof(arch))]..." diff --git a/test/test_lagrangian_particle_tracking.jl b/test/test_lagrangian_particle_tracking.jl index 1586dfae5a..a8d66c53cd 100644 --- a/test/test_lagrangian_particle_tracking.jl +++ b/test/test_lagrangian_particle_tracking.jl @@ -42,7 +42,7 @@ function run_simple_particle_tracking_tests(arch, timestepper) lagrangian_particles = LagrangianParticles(particles; tracked_fields) @test lagrangian_particles isa LagrangianParticles - model = IncompressibleModel(architecture=arch, grid=grid, timestepper=timestepper, + model = NonhydrostaticModel(architecture=arch, grid=grid, timestepper=timestepper, velocities=velocities, particles=lagrangian_particles) set!(model, u=1, v=1) diff --git a/test/test_netcdf_output_writer.jl b/test/test_netcdf_output_writer.jl index b5ede2e18d..61f849f75b 100644 --- a/test/test_netcdf_output_writer.jl +++ b/test/test_netcdf_output_writer.jl @@ -5,7 +5,7 @@ function test_DateTime_netcdf_output(arch) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) clock = Clock(time=DateTime(2021, 1, 1)) - model = IncompressibleModel(architecture=arch, grid=grid, clock=clock) + model = NonhydrostaticModel(architecture=arch, grid=grid, clock=clock) Δt = 5days + 3hours + 44.123seconds simulation = Simulation(model, Δt=Δt, stop_time=DateTime(2021, 2, 1)) @@ -36,7 +36,7 @@ end function test_TimeDate_netcdf_output(arch) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) clock = Clock(time=TimeDate(2021, 1, 1)) - model = IncompressibleModel(architecture=arch, grid=grid, clock=clock) + model = NonhydrostaticModel(architecture=arch, grid=grid, clock=clock) Δt = 5days + 3hours + 44.123seconds simulation = Simulation(model, Δt=Δt, stop_time=TimeDate(2021, 2, 1)) @@ -71,7 +71,7 @@ function test_thermal_bubble_netcdf_output(arch) topo = (Periodic, Periodic, Bounded) grid = RegularRectilinearGrid(topology=topo, size=(Nx, Ny, Nz), extent=(Lx, Ly, Lz)) closure = IsotropicDiffusivity(ν=4e-2, κ=4e-2) - model = IncompressibleModel(architecture=arch, grid=grid, closure=closure) + model = NonhydrostaticModel(architecture=arch, grid=grid, closure=closure) simulation = Simulation(model, Δt=6, stop_iteration=10) # Add a cube-shaped warm temperature anomaly that takes up the middle 50% @@ -236,7 +236,7 @@ function test_thermal_bubble_netcdf_output_with_halos(arch) topo = (Periodic, Periodic, Bounded) grid = RegularRectilinearGrid(topology=topo, size=(Nx, Ny, Nz), extent=(Lx, Ly, Lz)) closure = IsotropicDiffusivity(ν=4e-2, κ=4e-2) - model = IncompressibleModel(architecture=arch, grid=grid, closure=closure) + model = NonhydrostaticModel(architecture=arch, grid=grid, closure=closure) simulation = Simulation(model, Δt=6, stop_iteration=10) # Add a cube-shaped warm temperature anomaly that takes up the middle 50% @@ -328,7 +328,7 @@ function test_netcdf_function_output(arch) iters = 3 grid = RegularRectilinearGrid(size=(N, N, N), extent=(L, 2L, 3L)) - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) simulation = Simulation(model, Δt=Δt, stop_iteration=iters) grid = model.grid @@ -487,7 +487,7 @@ function test_netcdf_time_averaging(arch) c1_forcing = Forcing(Fc1, field_dependencies=:c1) c2_forcing = Forcing(Fc2, field_dependencies=:c2) - model = IncompressibleModel( + model = NonhydrostaticModel( grid = grid, architecture = arch, timestepper = :RungeKutta3, @@ -611,7 +611,7 @@ end function test_netcdf_output_alignment(arch) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) simulation = Simulation(model, Δt=0.2, stop_time=40) test_filename1 = "test_output_alignment1.nc" @@ -646,7 +646,7 @@ function test_netcdf_vertically_stretched_grid_output(arch) zF = [k^2 for k in 0:Nz] grid = VerticallyStretchedRectilinearGrid(architecture=arch, size=(Nx, Ny, Nz), x=(0, 1), y=(-π, π), z_faces=zF) - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) Δt = 1.25 iters = 3 diff --git a/test/test_output_readers.jl b/test/test_output_readers.jl index 4347f40498..3eb3882530 100644 --- a/test/test_output_readers.jl +++ b/test/test_output_readers.jl @@ -17,7 +17,7 @@ function generate_some_interesting_simulation_data(Nx, Ny, Nz; architecture=CPU( evaporation_bc = FluxBoundaryCondition(Qˢ, field_dependencies=:S, parameters=3e-7) S_bcs = FieldBoundaryConditions(top=evaporation_bc) - model = IncompressibleModel( + model = NonhydrostaticModel( architecture = architecture, grid = grid, boundary_conditions = (u=u_bcs, T=T_bcs, S=S_bcs) diff --git a/test/test_output_writers.jl b/test/test_output_writers.jl index 9667f621e1..c3309a7450 100644 --- a/test/test_output_writers.jl +++ b/test/test_output_writers.jl @@ -182,7 +182,7 @@ end # Some tests can reuse this same grid and model. topo = (Periodic, Periodic, Bounded) grid = RegularRectilinearGrid(topology=topo, size=(4, 4, 4), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) @testset "WindowedTimeAverage [$(typeof(arch))]" begin @info " Testing WindowedTimeAverage [$(typeof(arch))]..." @@ -199,7 +199,7 @@ end for arch in archs topo =(Periodic, Periodic, Bounded) grid = RegularRectilinearGrid(topology=topo, size=(4, 4, 4), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) @testset "Dependency adding [$(typeof(arch))]" begin @info " Testing dependency adding [$(typeof(arch))]..." diff --git a/test/test_simulations.jl b/test/test_simulations.jl index d91ad2c47f..277eb99f11 100644 --- a/test/test_simulations.jl +++ b/test/test_simulations.jl @@ -4,7 +4,7 @@ using Oceananigans.Simulations: function run_time_step_wizard_tests(arch) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) Δx = grid.Δx CFL = 0.45 @@ -41,7 +41,7 @@ function run_time_step_wizard_tests(arch) halo = (1, 1, 1), architecture=arch) - model = IncompressibleModel(architecture=arch, grid=grid_stretched) + model = NonhydrostaticModel(architecture=arch, grid=grid_stretched) Δx = grid_stretched.Δx CFL = 0.45 @@ -58,7 +58,7 @@ end function run_basic_simulation_tests(arch, Δt) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) model.clock.time = 0.0 model.clock.iteration = 0 @@ -94,14 +94,14 @@ function run_basic_simulation_tests(arch, Δt) @test wall_time_limit_exceeded(simulation) == true # Test that simulation stops at `stop_iteration`. - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) simulation = Simulation(model, Δt=Δt, stop_iteration=3, iteration_interval=88) run!(simulation) @test simulation.model.clock.iteration == 3 # Test that simulation stops at `stop_time`. - model = IncompressibleModel(architecture=arch, grid=grid) + model = NonhydrostaticModel(architecture=arch, grid=grid) simulation = Simulation(model, Δt=Δt, stop_time=20.20, iteration_interval=123) run!(simulation) @@ -114,7 +114,7 @@ function run_simulation_date_tests(arch, start_time, stop_time, Δt) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)) clock = Clock(time=start_time) - model = IncompressibleModel(architecture=arch, grid=grid, clock=clock) + model = NonhydrostaticModel(architecture=arch, grid=grid, clock=clock) simulation = Simulation(model, Δt=Δt, stop_time=stop_time) diff --git a/test/test_time_stepping.jl b/test/test_time_stepping.jl index 0f0fcced9f..c175dc6ffb 100644 --- a/test/test_time_stepping.jl +++ b/test/test_time_stepping.jl @@ -7,7 +7,7 @@ function time_stepping_works_with_flat_dimensions(arch, topology) size = Tuple(1 for i = 1:topological_tuple_length(topology...)) extent = Tuple(1 for i = 1:topological_tuple_length(topology...)) grid = RegularRectilinearGrid(size=size, extent=extent, topology=topology) - model = IncompressibleModel(grid=grid, architecture=arch) + model = NonhydrostaticModel(grid=grid, architecture=arch) time_step!(model, 1, euler=true) return true # Test that no errors/crashes happen when time stepping. end @@ -15,7 +15,7 @@ end function time_stepping_works_with_coriolis(arch, FT, Coriolis) grid = RegularRectilinearGrid(FT, size=(1, 1, 1), extent=(1, 2, 3)) c = Coriolis(FT, latitude=45) - model = IncompressibleModel(grid=grid, architecture=arch, coriolis=c) + model = NonhydrostaticModel(grid=grid, architecture=arch, coriolis=c) time_step!(model, 1, euler=true) @@ -31,7 +31,7 @@ function time_stepping_works_with_closure(arch, FT, Closure; buoyancy=Buoyancy(m # Use halos of size 2 to accomadate time stepping with AnisotropicBiharmonicDiffusivity. grid = RegularRectilinearGrid(FT; size=(1, 1, 1), halo=(2, 2, 2), extent=(1, 2, 3)) - model = IncompressibleModel(grid=grid, architecture=arch, + model = NonhydrostaticModel(grid=grid, architecture=arch, closure=Closure(FT), tracers=tracers, buoyancy=buoyancy) time_step!(model, 1, euler=true) @@ -42,14 +42,14 @@ end function time_stepping_works_with_advection_scheme(arch, advection_scheme) # Use halo=(3, 3, 3) to accomodate WENO-5 advection scheme grid = RegularRectilinearGrid(size=(1, 1, 1), halo=(3, 3, 3), extent=(1, 2, 3)) - model = IncompressibleModel(grid=grid, architecture=arch, advection=advection_scheme) + model = NonhydrostaticModel(grid=grid, architecture=arch, advection=advection_scheme) time_step!(model, 1, euler=true) return true # Test that no errors/crashes happen when time stepping. end function time_stepping_works_with_nothing_closure(arch, FT) grid = RegularRectilinearGrid(FT; size=(1, 1, 1), extent=(1, 2, 3)) - model = IncompressibleModel(grid=grid, architecture=arch, closure=nothing) + model = NonhydrostaticModel(grid=grid, architecture=arch, closure=nothing) time_step!(model, 1, euler=true) return true # Test that no errors/crashes happen when time stepping. end @@ -60,7 +60,7 @@ function time_stepping_works_with_nonlinear_eos(arch, FT, EOS) eos = EOS() b = SeawaterBuoyancy(equation_of_state=eos) - model = IncompressibleModel(architecture=arch, grid=grid, buoyancy=b) + model = NonhydrostaticModel(architecture=arch, grid=grid, buoyancy=b) time_step!(model, 1, euler=true) return true # Test that no errors/crashes happen when time stepping. @@ -72,7 +72,7 @@ function run_first_AB2_time_step_tests(arch, FT) # Weird grid size to catch https://github.com/CliMA/Oceananigans.jl/issues/780 grid = RegularRectilinearGrid(FT, size=(13, 17, 19), extent=(1, 2, 3)) - model = IncompressibleModel(grid=grid, architecture=arch, forcing=(T=add_ones,)) + model = NonhydrostaticModel(grid=grid, architecture=arch, forcing=(T=add_ones,)) time_step!(model, 1, euler=true) # Test that GT = 1, T = 1 after 1 time step and that AB2 actually reduced to forward Euler. @@ -97,7 +97,7 @@ end velocity field. """ function incompressible_in_time(arch, grid, Nt, timestepper) - model = IncompressibleModel(grid=grid, architecture=arch, timestepper=timestepper) + model = NonhydrostaticModel(grid=grid, architecture=arch, timestepper=timestepper) grid = model.grid u, v, w = model.velocities @@ -145,7 +145,7 @@ function tracer_conserved_in_channel(arch, FT, Nt) topology = (Periodic, Bounded, Bounded) grid = RegularRectilinearGrid(size=(Nx, Ny, Nz), extent=(Lx, Ly, Lz)) - model = IncompressibleModel(architecture = arch, grid = grid, + model = NonhydrostaticModel(architecture = arch, grid = grid, closure = AnisotropicDiffusivity(νh=νh, νz=νz, κh=κh, κz=κz)) Ty = 1e-4 # Meridional temperature gradient [K/m]. @@ -183,7 +183,7 @@ function time_stepping_with_background_fields(arch) background_S_func(x, y, z, t, α) = α * y background_S = BackgroundField(background_S_func, parameters=1.2) - model = IncompressibleModel(grid=grid, background_fields=(u=background_u, v=background_v, w=background_w, + model = NonhydrostaticModel(grid=grid, background_fields=(u=background_u, v=background_v, w=background_w, T=background_T, S=background_S)) time_step!(model, 1, euler=true) @@ -220,13 +220,13 @@ timesteppers = (:QuasiAdamsBashforth2, :RungeKutta3) @testset "Time stepping with DateTimes [$(typeof(arch)), $FT]" begin @info " Testing time stepping with datetime clocks [$(typeof(arch)), $FT]" - model = IncompressibleModel(grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)), + model = NonhydrostaticModel(grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)), clock = Clock(time=DateTime(2020))) time_step!(model, 7.883) @test model.clock.time == DateTime("2020-01-01T00:00:07.883") - model = IncompressibleModel(grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)), + model = NonhydrostaticModel(grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1)), clock = Clock(time=TimeDate(2020))) time_step!(model, 123e-9) # 123 nanoseconds diff --git a/test/test_turbulence_closures.jl b/test/test_turbulence_closures.jl index c23e96eb3a..590b0a24d9 100644 --- a/test/test_turbulence_closures.jl +++ b/test/test_turbulence_closures.jl @@ -112,7 +112,7 @@ function time_step_with_variable_isotropic_diffusivity(arch) closure = IsotropicDiffusivity(ν = (x, y, z, t) -> exp(z) * cos(x) * cos(y) * cos(t), κ = (x, y, z, t) -> exp(z) * cos(x) * cos(y) * cos(t)) - model = IncompressibleModel( + model = NonhydrostaticModel( architecture=arch, closure=closure, grid=RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 2, 3)) ) @@ -133,7 +133,7 @@ function time_step_with_variable_anisotropic_diffusivity(arch) κz = (x, y, z, t) -> 4 * exp(z) * cos(x) * cos(y) * cos(t) ) - model = IncompressibleModel( + model = NonhydrostaticModel( architecture=arch, closure=closure, grid=RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 2, 3)) ) @@ -146,7 +146,7 @@ end function time_step_with_tupled_closure(FT, arch) closure_tuple = (AnisotropicMinimumDissipation(FT), AnisotropicDiffusivity(FT)) - model = IncompressibleModel(architecture=arch, closure=closure_tuple, + model = NonhydrostaticModel(architecture=arch, closure=closure_tuple, grid=RegularRectilinearGrid(FT, size=(1, 1, 1), extent=(1, 2, 3))) time_step!(model, 1, euler=true) @@ -157,11 +157,11 @@ function compute_closure_specific_diffusive_cfl(closurename) grid = RegularRectilinearGrid(size=(1, 1, 1), extent=(1, 2, 3)) closure = getproperty(TurbulenceClosures, closurename)() - model = IncompressibleModel(grid=grid, closure=closure) + model = NonhydrostaticModel(grid=grid, closure=closure) dcfl = DiffusiveCFL(0.1) @test dcfl(model) isa Number - tracerless_model = IncompressibleModel(grid=grid, closure=closure, + tracerless_model = NonhydrostaticModel(grid=grid, closure=closure, buoyancy=nothing, tracers=nothing) dcfl = DiffusiveCFL(0.2) @test dcfl(tracerless_model) isa Number diff --git a/test/utils_for_runtests.jl b/test/utils_for_runtests.jl index 13ebb7d5b7..f1dbb2d53a 100644 --- a/test/utils_for_runtests.jl +++ b/test/utils_for_runtests.jl @@ -31,8 +31,8 @@ end ##### Useful utilities ##### -const AB2Model = IncompressibleModel{<:QuasiAdamsBashforth2TimeStepper} -const RK3Model = IncompressibleModel{<:RungeKutta3TimeStepper} +const AB2Model = NonhydrostaticModel{<:QuasiAdamsBashforth2TimeStepper} +const RK3Model = NonhydrostaticModel{<:RungeKutta3TimeStepper} # For time-stepping without a Simulation function ab2_or_rk3_time_step!(model::AB2Model, Δt, n) diff --git a/validation/convergence_tests/src/DoublyPeriodicTaylorGreen.jl b/validation/convergence_tests/src/DoublyPeriodicTaylorGreen.jl index b58a531d16..02ce36a531 100644 --- a/validation/convergence_tests/src/DoublyPeriodicTaylorGreen.jl +++ b/validation/convergence_tests/src/DoublyPeriodicTaylorGreen.jl @@ -20,7 +20,7 @@ function setup_simulation(; Nx, Δt, stop_iteration, U=1, architecture=CPU(), di grid = RegularRectilinearGrid(size=(Nx, Nx, 1), x=(0, 2π), y=(0, 2π), z=(0, 1), topology=(Periodic, Periodic, Bounded)) - model = IncompressibleModel(architecture = architecture, + model = NonhydrostaticModel(architecture = architecture, grid = grid, coriolis = nothing, buoyancy = nothing, diff --git a/validation/convergence_tests/src/ForcedFlowFixedSlip.jl b/validation/convergence_tests/src/ForcedFlowFixedSlip.jl index 592985961c..d1b6962b2c 100644 --- a/validation/convergence_tests/src/ForcedFlowFixedSlip.jl +++ b/validation/convergence_tests/src/ForcedFlowFixedSlip.jl @@ -48,7 +48,7 @@ function setup_xy_simulation(; Nx, Δt, stop_iteration, architecture=CPU(), dir= u_bcs = FieldBoundaryConditions(north = ValueBoundaryCondition((x, y, t) -> f(x, t)), south = ValueBoundaryCondition(0)) - model = IncompressibleModel(architecture = CPU(), + model = NonhydrostaticModel(architecture = CPU(), grid = grid, coriolis = nothing, buoyancy = nothing, @@ -94,7 +94,7 @@ function setup_xz_simulation(; Nx, Δt, stop_iteration, architecture=CPU(), dir= u_bcs = FieldBoundaryConditions(top = ValueBoundaryCondition((x, z, t) -> f(x, t)), bottom = ValueBoundaryCondition(0)) - model = IncompressibleModel(architecture = CPU(), + model = NonhydrostaticModel(architecture = CPU(), grid = grid, coriolis = nothing, buoyancy = nothing, diff --git a/validation/convergence_tests/src/ForcedFlowFreeSlip.jl b/validation/convergence_tests/src/ForcedFlowFreeSlip.jl index 7c6db20654..7130f3762c 100644 --- a/validation/convergence_tests/src/ForcedFlowFreeSlip.jl +++ b/validation/convergence_tests/src/ForcedFlowFreeSlip.jl @@ -40,7 +40,7 @@ function setup_xz_simulation(; Nx, Δt, stop_iteration, architecture=CPU(), dir= grid = RegularRectilinearGrid(size=(Nx, 1, Nx), x=(0, 2π), y=(0, 1), z=(0, π), topology=(Periodic, Periodic, Bounded)) - model = IncompressibleModel(architecture = architecture, + model = NonhydrostaticModel(architecture = architecture, grid = grid, coriolis = nothing, buoyancy = nothing, @@ -80,7 +80,7 @@ function setup_xy_simulation(; Nx, Δt, stop_iteration, architecture=CPU(), dir= grid = RegularRectilinearGrid(size=(Nx, Nx, 1), x=(0, 2π), y=(0, π), z=(0, 1), topology=(Periodic, Bounded, Bounded)) - model = IncompressibleModel(architecture = architecture, + model = NonhydrostaticModel(architecture = architecture, grid = grid, coriolis = nothing, buoyancy = nothing, diff --git a/validation/convergence_tests/src/OneDimensionalCosineAdvectionDiffusion.jl b/validation/convergence_tests/src/OneDimensionalCosineAdvectionDiffusion.jl index 9e490a8ad8..6cd5b569a2 100644 --- a/validation/convergence_tests/src/OneDimensionalCosineAdvectionDiffusion.jl +++ b/validation/convergence_tests/src/OneDimensionalCosineAdvectionDiffusion.jl @@ -23,7 +23,7 @@ function run_test(; Nx, Δt, stop_iteration, U = 1, κ = 1e-4, domain = (x=(0, 2π), y=(0, 1), z=(0, 1)) grid = RegularRectilinearGrid(topology=topo, size=(Nx, 1, 1), halo=(3, 3, 3); domain...) - model = IncompressibleModel(architecture = architecture, + model = NonhydrostaticModel(architecture = architecture, timestepper = :RungeKutta3, grid = grid, advection = advection, @@ -62,7 +62,7 @@ function run_test(; Nx, Δt, stop_iteration, U = 1, κ = 1e-4, ydomain = (x=(0, 1), y=(0, 2π), z=(0, 1)) ygrid = RegularRectilinearGrid(topology=topo, size=(1, Nx, 1), halo=(3, 3, 3); ydomain...) - model = IncompressibleModel(architecture = architecture, + model = NonhydrostaticModel(architecture = architecture, timestepper = :RungeKutta3, grid = ygrid, advection = advection, @@ -98,7 +98,7 @@ function run_test(; Nx, Δt, stop_iteration, U = 1, κ = 1e-4, zdomain = (x=(0, 1), y=(0, 1), z=(0, 2π)) zgrid = RegularRectilinearGrid(topology=topo, size=(1, 1, Nx), halo=(3, 3, 3); zdomain...) - model = IncompressibleModel(architecture = architecture, + model = NonhydrostaticModel(architecture = architecture, timestepper = :RungeKutta3, grid = zgrid, advection = advection, diff --git a/validation/convergence_tests/src/OneDimensionalGaussianAdvectionDiffusion.jl b/validation/convergence_tests/src/OneDimensionalGaussianAdvectionDiffusion.jl index 5cb0527f2f..14d22af7f3 100644 --- a/validation/convergence_tests/src/OneDimensionalGaussianAdvectionDiffusion.jl +++ b/validation/convergence_tests/src/OneDimensionalGaussianAdvectionDiffusion.jl @@ -26,7 +26,7 @@ function run_test(; Nx, Δt, stop_iteration, U = 1, κ = 1e-4, width = 0.05, domain = (x=(-1, 1.5), y=(0, 1), z=(0, 1)) grid = RegularRectilinearGrid(topology=topo, size=(Nx, 1, 1), halo=(3, 3, 3); domain...) - model = IncompressibleModel(architecture = architecture, + model = NonhydrostaticModel(architecture = architecture, timestepper = :RungeKutta3, grid = grid, advection = advection, @@ -65,7 +65,7 @@ function run_test(; Nx, Δt, stop_iteration, U = 1, κ = 1e-4, width = 0.05, ydomain = (x=(0, 1), y=(-1, 1.5), z=(0, 1)) ygrid = RegularRectilinearGrid(topology=topo, size=(1, Nx, 1), halo=(3, 3, 3); ydomain...) - model = IncompressibleModel(architecture = architecture, + model = NonhydrostaticModel(architecture = architecture, timestepper = :RungeKutta3, grid = ygrid, advection = advection, @@ -101,7 +101,7 @@ function run_test(; Nx, Δt, stop_iteration, U = 1, κ = 1e-4, width = 0.05, zdomain = (x=(0, 1), y=(0, 1), z=(-1, 1.5)) zgrid = RegularRectilinearGrid(topology=topo, size=(1, 1, Nx), halo=(3, 3, 3); zdomain...) - model = IncompressibleModel(architecture = architecture, + model = NonhydrostaticModel(architecture = architecture, timestepper = :RungeKutta3, grid = zgrid, advection = advection, diff --git a/validation/convergence_tests/src/PointExponentialDecay.jl b/validation/convergence_tests/src/PointExponentialDecay.jl index 94c3191511..302937a02b 100644 --- a/validation/convergence_tests/src/PointExponentialDecay.jl +++ b/validation/convergence_tests/src/PointExponentialDecay.jl @@ -27,7 +27,7 @@ function run_test(; Δt, stop_iteration, timestepper, architecture = CPU()) grid = RegularRectilinearGrid(size=(1, 1, 1), x=(0, 1), y=(0, 1), z=(0, 1)) - model = IncompressibleModel(architecture = architecture, + model = NonhydrostaticModel(architecture = architecture, timestepper = timestepper, grid = grid, coriolis = nothing, diff --git a/validation/convergence_tests/src/TwoDimensionalDiffusion.jl b/validation/convergence_tests/src/TwoDimensionalDiffusion.jl index 62764c592f..3907a8f1b2 100644 --- a/validation/convergence_tests/src/TwoDimensionalDiffusion.jl +++ b/validation/convergence_tests/src/TwoDimensionalDiffusion.jl @@ -32,7 +32,7 @@ function setup_simulation(; Nx, Δt, stop_iteration, architecture=CPU(), dir=DAT grid = RegularRectilinearGrid(size=(Nx, Nx, 1), x=(0, Lx(topo)), y=(0, Ly(topo)), z=(0, 1), topology=topo) - model = IncompressibleModel(architecture = architecture, + model = NonhydrostaticModel(architecture = architecture, grid = grid, coriolis = nothing, buoyancy = nothing, diff --git a/validation/immersed_boundaries/flow_around_cylinder.jl b/validation/immersed_boundaries/flow_around_cylinder.jl index edb7e39a57..893b7a8a4e 100644 --- a/validation/immersed_boundaries/flow_around_cylinder.jl +++ b/validation/immersed_boundaries/flow_around_cylinder.jl @@ -32,7 +32,7 @@ v_bcs = VVelocityBoundaryConditions(grid, south = OpenBoundaryCondition(1)) # setting up incompressible model with immersed boundary -model = IncompressibleModel(timestepper = :RungeKutta3, +model = NonhydrostaticModel(timestepper = :RungeKutta3, advection = UpwindBiasedFifthOrder(), grid = grid, buoyancy = nothing, diff --git a/validation/immersed_boundaries/immersed_bickley_jet.jl b/validation/immersed_boundaries/immersed_bickley_jet.jl index 36afbe7d56..0d31942d6d 100644 --- a/validation/immersed_boundaries/immersed_bickley_jet.jl +++ b/validation/immersed_boundaries/immersed_bickley_jet.jl @@ -42,7 +42,7 @@ function run_bickley_jet(; output_time_interval = 2, stop_time = 200, arch = CPU x = (-2π, 2π), y=(-2π, 2π), topology = (Periodic, Bounded, Flat)) - regular_model = IncompressibleModel(architecture = arch, + regular_model = NonhydrostaticModel(architecture = arch, advection = advection, timestepper = :RungeKutta3, grid = grid, @@ -60,7 +60,7 @@ function run_bickley_jet(; output_time_interval = 2, stop_time = 200, arch = CPU immersed_grid = ImmersedBoundaryGrid(expanded_grid, GridFittedBoundary(solid)) - immersed_model = IncompressibleModel(architecture = arch, + immersed_model = NonhydrostaticModel(architecture = arch, advection = advection, timestepper = :RungeKutta3, grid = immersed_grid, diff --git a/validation/implicit_vertical_diffusion/nonhydrostatic_one_dimensional_diffusion.jl b/validation/implicit_vertical_diffusion/nonhydrostatic_one_dimensional_diffusion.jl index d4f3b7743b..124512ee64 100644 --- a/validation/implicit_vertical_diffusion/nonhydrostatic_one_dimensional_diffusion.jl +++ b/validation/implicit_vertical_diffusion/nonhydrostatic_one_dimensional_diffusion.jl @@ -10,8 +10,8 @@ ivd_closure = IsotropicDiffusivity(κ = 1.0, time_discretization = VerticallyImp model_kwargs = (grid=grid, tracers=:c, buoyancy=nothing) -implicit_model = IncompressibleModel(; closure=ivd_closure, model_kwargs...) -explicit_model = IncompressibleModel(; closure=evd_closure, model_kwargs...) +implicit_model = NonhydrostaticModel(; closure=ivd_closure, model_kwargs...) +explicit_model = NonhydrostaticModel(; closure=evd_closure, model_kwargs...) models = (implicit_model, explicit_model) initial_temperature(x, y, z) = exp(-z^2 / 0.02) diff --git a/validation/lid_driven_cavity/lid_driven_cavity.jl b/validation/lid_driven_cavity/lid_driven_cavity.jl index b3a636f132..120c50912f 100644 --- a/validation/lid_driven_cavity/lid_driven_cavity.jl +++ b/validation/lid_driven_cavity/lid_driven_cavity.jl @@ -15,7 +15,7 @@ function simulate_lid_driven_cavity(; Re, N, end_time) w_bcs = FieldBoundaryConditions(north = ValueBoundaryCondition(0), south = ValueBoundaryCondition(0)) - model = IncompressibleModel( + model = NonhydrostaticModel( grid = grid, buoyancy = nothing, tracers = nothing, diff --git a/validation/periodic_advection/periodic_advection.jl b/validation/periodic_advection/periodic_advection.jl index 1d76dbeb84..18d7af9fc8 100644 --- a/validation/periodic_advection/periodic_advection.jl +++ b/validation/periodic_advection/periodic_advection.jl @@ -32,7 +32,7 @@ function setup_model(N, L, U, ϕₐ, time_stepper, advection_scheme) topology = (Periodic, Flat, Flat) grid = RegularRectilinearGrid(topology=topology, size=(N, ), halo=(9, ), x=(-L/2, L/2)) - model = IncompressibleModel( + model = NonhydrostaticModel( grid = grid, timestepper = time_stepper, advection = advection_scheme, diff --git a/validation/stommel_gyre/stommel_gyre_advection.jl b/validation/stommel_gyre/stommel_gyre_advection.jl index 6a84737320..12abc1acb4 100644 --- a/validation/stommel_gyre/stommel_gyre_advection.jl +++ b/validation/stommel_gyre/stommel_gyre_advection.jl @@ -35,7 +35,7 @@ function setup_simulation(N, T, CFL, ϕₐ, advection_scheme; u, v) domain = (x=(0, 1), y=(0, L), z=(0, L)) grid = RegularRectilinearGrid(topology=topology, size=(1, N, N), halo=(3, 3, 3); domain...) - model = IncompressibleModel( + model = NonhydrostaticModel( grid = grid, timestepper = :RungeKutta3, advection = advection_scheme, diff --git a/validation/stratified_couette_flow/stratified_couette_flow.jl b/validation/stratified_couette_flow/stratified_couette_flow.jl index 295bf0fbd0..55900cffae 100644 --- a/validation/stratified_couette_flow/stratified_couette_flow.jl +++ b/validation/stratified_couette_flow/stratified_couette_flow.jl @@ -113,7 +113,7 @@ function simulate_stratified_couette_flow(; Nxy, Nz, arch=GPU(), h=1, U_wall=1, ##### Non-dimensional model setup ##### - model = IncompressibleModel( + model = NonhydrostaticModel( architecture = arch, grid = grid, buoyancy = SeawaterBuoyancy(equation_of_state=LinearEquationOfState(α=1.0, β=0.0)), diff --git a/validation/thermal_bubble/thermal_bubble.jl b/validation/thermal_bubble/thermal_bubble.jl index bb3c3bff95..ca3f1c364a 100644 --- a/validation/thermal_bubble/thermal_bubble.jl +++ b/validation/thermal_bubble/thermal_bubble.jl @@ -31,7 +31,7 @@ function setup_simulation(N, advection_scheme) topology = (Periodic, Flat, Bounded) grid = RegularRectilinearGrid(topology=topology, size=(N, 1, N), halo=(5, 5, 5), extent=(L, L, L)) - model = IncompressibleModel( + model = NonhydrostaticModel( grid = grid, timestepper = :RungeKutta3, advection = advection_scheme, From 702b15c8e460ac43c870d9dd537eaf374918447c Mon Sep 17 00:00:00 2001 From: Navid Constantinou Date: Sun, 18 Jul 2021 22:39:31 +1000 Subject: [PATCH 02/13] rename directory/files --- .../NonhydrostaticModels.jl} | 0 .../calculate_tendencies.jl | 0 .../correct_incompressible_immersed_tendencies.jl | 0 .../incompressible_model.jl | 0 .../pressure_correction.jl | 0 .../set_incompressible_model.jl | 0 .../show_incompressible_model.jl | 0 .../update_hydrostatic_pressure.jl | 0 .../update_incompressible_model_state.jl | 0 .../velocity_and_tracer_tendencies.jl | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename src/Models/{IncompressibleModels/IncompressibleModels.jl => NonhydrostaticModels/NonhydrostaticModels.jl} (100%) rename src/Models/{IncompressibleModels => NonhydrostaticModels}/calculate_tendencies.jl (100%) rename src/Models/{IncompressibleModels => NonhydrostaticModels}/correct_incompressible_immersed_tendencies.jl (100%) rename src/Models/{IncompressibleModels => NonhydrostaticModels}/incompressible_model.jl (100%) rename src/Models/{IncompressibleModels => NonhydrostaticModels}/pressure_correction.jl (100%) rename src/Models/{IncompressibleModels => NonhydrostaticModels}/set_incompressible_model.jl (100%) rename src/Models/{IncompressibleModels => NonhydrostaticModels}/show_incompressible_model.jl (100%) rename src/Models/{IncompressibleModels => NonhydrostaticModels}/update_hydrostatic_pressure.jl (100%) rename src/Models/{IncompressibleModels => NonhydrostaticModels}/update_incompressible_model_state.jl (100%) rename src/Models/{IncompressibleModels => NonhydrostaticModels}/velocity_and_tracer_tendencies.jl (100%) diff --git a/src/Models/IncompressibleModels/IncompressibleModels.jl b/src/Models/NonhydrostaticModels/NonhydrostaticModels.jl similarity index 100% rename from src/Models/IncompressibleModels/IncompressibleModels.jl rename to src/Models/NonhydrostaticModels/NonhydrostaticModels.jl diff --git a/src/Models/IncompressibleModels/calculate_tendencies.jl b/src/Models/NonhydrostaticModels/calculate_tendencies.jl similarity index 100% rename from src/Models/IncompressibleModels/calculate_tendencies.jl rename to src/Models/NonhydrostaticModels/calculate_tendencies.jl diff --git a/src/Models/IncompressibleModels/correct_incompressible_immersed_tendencies.jl b/src/Models/NonhydrostaticModels/correct_incompressible_immersed_tendencies.jl similarity index 100% rename from src/Models/IncompressibleModels/correct_incompressible_immersed_tendencies.jl rename to src/Models/NonhydrostaticModels/correct_incompressible_immersed_tendencies.jl diff --git a/src/Models/IncompressibleModels/incompressible_model.jl b/src/Models/NonhydrostaticModels/incompressible_model.jl similarity index 100% rename from src/Models/IncompressibleModels/incompressible_model.jl rename to src/Models/NonhydrostaticModels/incompressible_model.jl diff --git a/src/Models/IncompressibleModels/pressure_correction.jl b/src/Models/NonhydrostaticModels/pressure_correction.jl similarity index 100% rename from src/Models/IncompressibleModels/pressure_correction.jl rename to src/Models/NonhydrostaticModels/pressure_correction.jl diff --git a/src/Models/IncompressibleModels/set_incompressible_model.jl b/src/Models/NonhydrostaticModels/set_incompressible_model.jl similarity index 100% rename from src/Models/IncompressibleModels/set_incompressible_model.jl rename to src/Models/NonhydrostaticModels/set_incompressible_model.jl diff --git a/src/Models/IncompressibleModels/show_incompressible_model.jl b/src/Models/NonhydrostaticModels/show_incompressible_model.jl similarity index 100% rename from src/Models/IncompressibleModels/show_incompressible_model.jl rename to src/Models/NonhydrostaticModels/show_incompressible_model.jl diff --git a/src/Models/IncompressibleModels/update_hydrostatic_pressure.jl b/src/Models/NonhydrostaticModels/update_hydrostatic_pressure.jl similarity index 100% rename from src/Models/IncompressibleModels/update_hydrostatic_pressure.jl rename to src/Models/NonhydrostaticModels/update_hydrostatic_pressure.jl diff --git a/src/Models/IncompressibleModels/update_incompressible_model_state.jl b/src/Models/NonhydrostaticModels/update_incompressible_model_state.jl similarity index 100% rename from src/Models/IncompressibleModels/update_incompressible_model_state.jl rename to src/Models/NonhydrostaticModels/update_incompressible_model_state.jl diff --git a/src/Models/IncompressibleModels/velocity_and_tracer_tendencies.jl b/src/Models/NonhydrostaticModels/velocity_and_tracer_tendencies.jl similarity index 100% rename from src/Models/IncompressibleModels/velocity_and_tracer_tendencies.jl rename to src/Models/NonhydrostaticModels/velocity_and_tracer_tendencies.jl From b2a197a599d953145a83d47c993498da9cc36e90 Mon Sep 17 00:00:00 2001 From: Navid Constantinou Date: Sun, 18 Jul 2021 22:59:18 +1000 Subject: [PATCH 03/13] incompressible -> nonhydrostatic --- benchmark/README.md | 2 +- benchmark/benchmark_incompressible_model.jl | 4 ++-- benchmark/benchmark_regression.jl | 2 +- ...benchmark_vertically_stretched_incompressible_model.jl | 4 ++-- benchmark/strong_scaling_incompressible_model.jl | 4 ++-- benchmark/strong_scaling_incompressible_model_single.jl | 2 +- docs/make.jl | 2 +- docs/src/appendix/library.md | 2 +- src/Distributed/Distributed.jl | 2 +- src/Models/NonhydrostaticModels/NonhydrostaticModels.jl | 8 ++++---- .../{incompressible_model.jl => nonhydrostatic_model.jl} | 0 test/runtests.jl | 2 +- ...mpressible_models.jl => test_nonhydrostatic_models.jl} | 0 13 files changed, 17 insertions(+), 17 deletions(-) rename src/Models/NonhydrostaticModels/{incompressible_model.jl => nonhydrostatic_model.jl} (100%) rename test/{test_incompressible_models.jl => test_nonhydrostatic_models.jl} (100%) diff --git a/benchmark/README.md b/benchmark/README.md index 3b82c96b2f..18fda092bf 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -11,7 +11,7 @@ julia -e 'using Pkg; Pkg.activate(pwd()); Pkg.instantiate(); Pkg.develop(Package Once the environment has been instantiated, benchmarks can be run via, e.g. ``` -julia --project benchmark_incompressible_model.jl +julia --project benchmark_nonhydrostatic_model.jl ``` Most scripts benchmark one feature (e.g. advection schemes, arbitrary tracers). If your machine contains a CUDA-compatible GPU, benchmarks will also run on the GPU. Tables with benchmark results will be printed (and each table will also be saved to an HTML file). diff --git a/benchmark/benchmark_incompressible_model.jl b/benchmark/benchmark_incompressible_model.jl index bcf1d48563..e11a17e36c 100644 --- a/benchmark/benchmark_incompressible_model.jl +++ b/benchmark/benchmark_incompressible_model.jl @@ -8,7 +8,7 @@ using Plots pyplot() # Benchmark function -function benchmark_incompressible_model(Arch, FT, N) +function benchmark_nonhydrostatic_model(Arch, FT, N) grid = RegularRectilinearGrid(FT, size=(N, N, N), extent=(1, 1, 1)) model = NonhydrostaticModel(architecture=Arch(), grid=grid) @@ -30,7 +30,7 @@ Ns = [32, 64, 128, 256] # Run and summarize benchmarks print_system_info() -suite = run_benchmarks(benchmark_incompressible_model; Architectures, Float_types, Ns) +suite = run_benchmarks(benchmark_nonhydrostatic_model; Architectures, Float_types, Ns) plot_num = length(Ns) CPU_Float32 = zeros(Float64, plot_num) diff --git a/benchmark/benchmark_regression.jl b/benchmark/benchmark_regression.jl index f78f21b5c0..85cd714df4 100644 --- a/benchmark/benchmark_regression.jl +++ b/benchmark/benchmark_regression.jl @@ -5,7 +5,7 @@ using Oceananigans using Benchmarks baseline = BenchmarkConfig(id="master") -script = joinpath(@__DIR__, "benchmarkable_incompressible_model.jl") +script = joinpath(@__DIR__, "benchmarkable_nonhydrostatic_model.jl") resultfile = joinpath(@__DIR__, "regression_benchmarks.json") judge(Oceananigans, baseline, script=script, resultfile=resultfile, verbose=true) diff --git a/benchmark/benchmark_vertically_stretched_incompressible_model.jl b/benchmark/benchmark_vertically_stretched_incompressible_model.jl index a582c8cc0b..e78c904ada 100644 --- a/benchmark/benchmark_vertically_stretched_incompressible_model.jl +++ b/benchmark/benchmark_vertically_stretched_incompressible_model.jl @@ -7,7 +7,7 @@ using Benchmarks # Benchmark function -function benchmark_vertically_stretched_incompressible_model(Arch, FT, N) +function benchmark_vertically_stretched_nonhydrostatic_model(Arch, FT, N) grid = VerticallyStretchedRectilinearGrid(architecture=Arch(), size=(N, N, N), x=(0, 1), y=(0, 1), z_faces=collect(0:N)) model = NonhydrostaticModel(architecture=Arch(), grid=grid) @@ -29,7 +29,7 @@ Ns = [32, 64, 128, 256] # Run and summarize benchmarks print_system_info() -suite = run_benchmarks(benchmark_vertically_stretched_incompressible_model; Architectures, Float_types, Ns) +suite = run_benchmarks(benchmark_vertically_stretched_nonhydrostatic_model; Architectures, Float_types, Ns) df = benchmarks_dataframe(suite) sort!(df, [:Architectures, :Float_types, :Ns], by=(string, string, identity)) diff --git a/benchmark/strong_scaling_incompressible_model.jl b/benchmark/strong_scaling_incompressible_model.jl index d6bdd21f57..a2819d5ff6 100644 --- a/benchmark/strong_scaling_incompressible_model.jl +++ b/benchmark/strong_scaling_incompressible_model.jl @@ -25,7 +25,7 @@ for R in ranks Rx, Ry, Rz = rank_size(R, decomposition) @info "Benchmarking distributed incompressible model strong scaling with $(typeof(decomposition)) decomposition [N=($Nx, $Ny, $Nz), ranks=($Rx, $Ry, $Rz)]..." julia = Base.julia_cmd() - run(`mpiexec -np $R $julia --project strong_scaling_incompressible_model_single.jl $(typeof(decomposition)) $Nx $Ny $Nz $Rx $Ry $Rz`) + run(`mpiexec -np $R $julia --project strong_scaling_nonhydrostatic_model_single.jl $(typeof(decomposition)) $Nx $Ny $Nz $Rx $Ry $Rz`) end # Collect and merge benchmarks from all ranks @@ -38,7 +38,7 @@ for R in ranks case = ((Nx, Ny, Nz), (Rx, Ry, Rz)) for local_rank in 0:R-1 - filename = string("strong_scaling_incompressible_model_$(R)ranks_$(typeof(decomposition))_$local_rank.jld2") + filename = string("strong_scaling_nonhydrostatic_model_$(R)ranks_$(typeof(decomposition))_$local_rank.jld2") jldopen(filename, "r") do file if local_rank == 0 suite[case] = file["trial"] diff --git a/benchmark/strong_scaling_incompressible_model_single.jl b/benchmark/strong_scaling_incompressible_model_single.jl index d4e5f1b185..c51d5cb4ea 100644 --- a/benchmark/strong_scaling_incompressible_model_single.jl +++ b/benchmark/strong_scaling_incompressible_model_single.jl @@ -47,6 +47,6 @@ end samples=10 t_median = BenchmarkTools.prettytime(median(trial).time) @info "Done benchmarking on rank $(local_rank). Median time: $t_median" -jldopen("strong_scaling_incompressible_model_$(R)ranks_$(decomposition)_$local_rank.jld2", "w") do file +jldopen("strong_scaling_nonhydrostatic_model_$(R)ranks_$(decomposition)_$local_rank.jld2", "w") do file file["trial"] = trial end diff --git a/docs/make.jl b/docs/make.jl index db63a2c78d..a782f41530 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -93,7 +93,7 @@ physics_pages = [ "Coordinate system and notation" => "physics/notation.md", "Boussinesq approximation" => "physics/boussinesq.md", "`NonhydrostaticModel`" => [ - "Incompressible model" => "physics/incompressible_model.md", + "Incompressible model" => "physics/nonhydrostatic_model.md", ], "`HydrostaticFreeSurfaceModel`" => [ "Hydrostatic model with a free surface" => "physics/hydrostatic_free_surface_model.md" diff --git a/docs/src/appendix/library.md b/docs/src/appendix/library.md index 2648539411..a73952fd48 100644 --- a/docs/src/appendix/library.md +++ b/docs/src/appendix/library.md @@ -166,7 +166,7 @@ Modules = [Oceananigans.Models] Private = false Pages = [ "Models/Models.jl", - "Models/NonhydrostaticModels/incompressible_model.jl", + "Models/NonhydrostaticModels/nonhydrostatic_model.jl", "Models/HydrostaticFreeSurfaceModels/hydrostatic_free_surface_model.jl", "Models/ShallowWaterModels/shallow_water_model.jl" ] diff --git a/src/Distributed/Distributed.jl b/src/Distributed/Distributed.jl index 746f5d03cb..01c8efd0dd 100644 --- a/src/Distributed/Distributed.jl +++ b/src/Distributed/Distributed.jl @@ -19,7 +19,7 @@ include("halo_communication.jl") include("distributed_fields.jl") include("distributed_fft_based_poisson_solver.jl") include("distributed_solve_for_pressure.jl") -include("distributed_incompressible_model.jl") +include("distributed_nonhydrostatic_model.jl") include("distributed_shallow_water_model.jl") end # module diff --git a/src/Models/NonhydrostaticModels/NonhydrostaticModels.jl b/src/Models/NonhydrostaticModels/NonhydrostaticModels.jl index 10231260b5..f33d3f64a0 100644 --- a/src/Models/NonhydrostaticModels/NonhydrostaticModels.jl +++ b/src/Models/NonhydrostaticModels/NonhydrostaticModels.jl @@ -11,9 +11,9 @@ import Oceananigans: fields, prognostic_fields ##### NonhydrostaticModel definition ##### -include("incompressible_model.jl") -include("show_incompressible_model.jl") -include("set_incompressible_model.jl") +include("nonhydrostatic_model.jl") +include("show_nonhydrostatic_model.jl") +include("set_nonhydrostatic_model.jl") ##### ##### Time-stepping NonhydrostaticModels @@ -28,7 +28,7 @@ fields(model::NonhydrostaticModel) = merge(model.velocities, model.tracers) prognostic_fields(model::NonhydrostaticModel) = fields(model) include("update_hydrostatic_pressure.jl") -include("update_incompressible_model_state.jl") +include("update_nonhydrostatic_model_state.jl") include("pressure_correction.jl") include("velocity_and_tracer_tendencies.jl") include("calculate_tendencies.jl") diff --git a/src/Models/NonhydrostaticModels/incompressible_model.jl b/src/Models/NonhydrostaticModels/nonhydrostatic_model.jl similarity index 100% rename from src/Models/NonhydrostaticModels/incompressible_model.jl rename to src/Models/NonhydrostaticModels/nonhydrostatic_model.jl diff --git a/test/runtests.jl b/test/runtests.jl index aab21ed4bb..c012b10851 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -106,7 +106,7 @@ group = get(ENV, "TEST_GROUP", :all) |> Symbol if group == :time_stepping_1 || group == :all @testset "Model and time stepping tests (part 1)" begin - include("test_incompressible_models.jl") + include("test_nonhydrostatic_models.jl") include("test_time_stepping.jl") end end diff --git a/test/test_incompressible_models.jl b/test/test_nonhydrostatic_models.jl similarity index 100% rename from test/test_incompressible_models.jl rename to test/test_nonhydrostatic_models.jl From fc332ecdd62369a2854f955e2dbcf0042c8da415 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Sun, 18 Jul 2021 23:12:19 +1000 Subject: [PATCH 04/13] Rename benchmark_incompressible_model.jl to benchmark_nonhydrostatic_model.jl --- ..._incompressible_model.jl => benchmark_nonhydrostatic_model.jl} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename benchmark/{benchmark_incompressible_model.jl => benchmark_nonhydrostatic_model.jl} (100%) diff --git a/benchmark/benchmark_incompressible_model.jl b/benchmark/benchmark_nonhydrostatic_model.jl similarity index 100% rename from benchmark/benchmark_incompressible_model.jl rename to benchmark/benchmark_nonhydrostatic_model.jl From ef0e230942456ffe1562ad2277cc21f9f29d1357 Mon Sep 17 00:00:00 2001 From: Navid Constantinou Date: Mon, 19 Jul 2021 05:55:21 +1000 Subject: [PATCH 05/13] update constructor docstring --- src/Models/NonhydrostaticModels/nonhydrostatic_model.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Models/NonhydrostaticModels/nonhydrostatic_model.jl b/src/Models/NonhydrostaticModels/nonhydrostatic_model.jl index b70f446bb9..6b745f1e84 100644 --- a/src/Models/NonhydrostaticModels/nonhydrostatic_model.jl +++ b/src/Models/NonhydrostaticModels/nonhydrostatic_model.jl @@ -65,7 +65,8 @@ end immersed_boundary = nothing ) -Construct an incompressible `Oceananigans.jl` model on `grid`. +Construct a model for a non-hydrostatic, incompressible fluid, using the Boussinesq approximation +when `buoyancy != nothing`. By default, all Bounded directions are rigid and impenetrable. Keyword arguments ================= From 37fb3e9331379e00c9e0b524b88206d06f92e3f2 Mon Sep 17 00:00:00 2001 From: Navid Constantinou Date: Mon, 19 Jul 2021 05:55:33 +1000 Subject: [PATCH 06/13] incompressible -> nonhydrostatic --- .../strong_scaling_incompressible_model.jl | 4 +- .../distributed_incompressible_model.jl | 51 -------------- src/Models/Models.jl | 2 +- .../NonhydrostaticModels.jl | 2 +- ...rect_incompressible_immersed_tendencies.jl | 66 ------------------- .../set_incompressible_model.jl | 59 ----------------- .../show_incompressible_model.jl | 21 ------ .../update_incompressible_model_state.jl | 35 ---------- test/test_boundary_conditions_integration.jl | 8 +-- 9 files changed, 8 insertions(+), 240 deletions(-) delete mode 100644 src/Distributed/distributed_incompressible_model.jl delete mode 100644 src/Models/NonhydrostaticModels/correct_incompressible_immersed_tendencies.jl delete mode 100644 src/Models/NonhydrostaticModels/set_incompressible_model.jl delete mode 100644 src/Models/NonhydrostaticModels/show_incompressible_model.jl delete mode 100644 src/Models/NonhydrostaticModels/update_incompressible_model_state.jl diff --git a/benchmark/strong_scaling_incompressible_model.jl b/benchmark/strong_scaling_incompressible_model.jl index a2819d5ff6..43627d358a 100644 --- a/benchmark/strong_scaling_incompressible_model.jl +++ b/benchmark/strong_scaling_incompressible_model.jl @@ -69,13 +69,13 @@ end plt = plot(rank_num, run_times, lw=4, xaxis=:log2, legend=:none, xlabel="Cores", ylabel="Times (ms)", title="Strong Scaling Incompressible Times") display(plt) -savefig(plt, "ss_incompressible_times.png") +savefig(plt, "ss_nonhydrostatic_times.png") plt2 = plot(rank_num, eff_ratio, lw=4, xaxis=:log2, legend=:none, ylims=(0,1.1), xlabel="Cores", ylabel="Efficiency", title="Strong Scaling Incompressible Efficiency") display(plt2) -savefig(plt2, "ss_incompressible_efficiency.png") +savefig(plt2, "ss_nonhydrostatic_efficiency.png") df = benchmarks_dataframe(suite) sort!(df, :ranks) diff --git a/src/Distributed/distributed_incompressible_model.jl b/src/Distributed/distributed_incompressible_model.jl deleted file mode 100644 index 80bcb00673..0000000000 --- a/src/Distributed/distributed_incompressible_model.jl +++ /dev/null @@ -1,51 +0,0 @@ -using Oceananigans.Grids -using Oceananigans.Fields - -##### -##### Distributed incompressible model constructor -##### - -function DistributedNonhydrostaticModel(; architecture, grid, model_kwargs...) - i, j, k = architecture.local_index - Rx, Ry, Rz = architecture.ranks - my_connectivity = architecture.connectivity - - Nx, Ny, Nz = size(grid) - Lx, Ly, Lz = length(grid) - - # Pull out endpoints for full grid. - xL, xR = grid.xF[1], grid.xF[Nx+1] - yL, yR = grid.yF[1], grid.yF[Ny+1] - zL, zR = grid.zF[1], grid.zF[Nz+1] - - # Make sure we can put an integer number of grid points in each rank. - # Will generalize in the future. - # TODO: Check that we have enough grid points on each rank to fit the halos! - @assert isinteger(Nx / Rx) - @assert isinteger(Ny / Ry) - @assert isinteger(Nz / Rz) - - nx, ny, nz = Nx÷Rx, Ny÷Ry, Nz÷Rz - lx, ly, lz = Lx/Rx, Ly/Ry, Lz/Rz - - x₁, x₂ = xL + (i-1)*lx, xL + i*lx - y₁, y₂ = yL + (j-1)*ly, yL + j*ly - z₁, z₂ = zL + (k-1)*lz, zL + k*lz - - # FIXME? local grid might have different topology! - my_grid = RegularRectilinearGrid(topology=topology(grid), size=(nx, ny, nz), x=(x₁, x₂), y=(y₁, y₂), z=(z₁, z₂), halo=halo_size(grid)) - - ## Construct local model - - pressure_solver = haskey(model_kwargs, :pressure_solver) ? Dict(model_kwargs)[:pressure_solver] : - DistributedFFTBasedPoissonSolver(architecture, grid, my_grid) - - my_model = NonhydrostaticModel(; - architecture = architecture, - grid = my_grid, - pressure_solver = pressure_solver, - model_kwargs... - ) - - return my_model -end diff --git a/src/Models/Models.jl b/src/Models/Models.jl index fef9eb854d..1c459d4051 100644 --- a/src/Models/Models.jl +++ b/src/Models/Models.jl @@ -1,7 +1,7 @@ module Models export - NonhydrostaticModel, NonDimensionalNonhydrostaticModel, ShallowWaterModel, + NonhydrostaticModel, ShallowWaterModel, HydrostaticFreeSurfaceModel, VectorInvariant, ExplicitFreeSurface, ImplicitFreeSurface, HydrostaticSphericalCoriolis, VectorInvariantEnstrophyConserving, diff --git a/src/Models/NonhydrostaticModels/NonhydrostaticModels.jl b/src/Models/NonhydrostaticModels/NonhydrostaticModels.jl index f33d3f64a0..40d4989837 100644 --- a/src/Models/NonhydrostaticModels/NonhydrostaticModels.jl +++ b/src/Models/NonhydrostaticModels/NonhydrostaticModels.jl @@ -32,6 +32,6 @@ include("update_nonhydrostatic_model_state.jl") include("pressure_correction.jl") include("velocity_and_tracer_tendencies.jl") include("calculate_tendencies.jl") -include("correct_incompressible_immersed_tendencies.jl") +include("correct_nonhydrostatic_immersed_tendencies.jl") end # module diff --git a/src/Models/NonhydrostaticModels/correct_incompressible_immersed_tendencies.jl b/src/Models/NonhydrostaticModels/correct_incompressible_immersed_tendencies.jl deleted file mode 100644 index 3bb0db5d35..0000000000 --- a/src/Models/NonhydrostaticModels/correct_incompressible_immersed_tendencies.jl +++ /dev/null @@ -1,66 +0,0 @@ -using Oceananigans.Grids: xnode, ynode, znode, Center, AbstractGrid - -import Oceananigans.TimeSteppers: correct_immersed_tendencies! - -""" - correct_immersed_tendencies!(model, Δt, γⁿ, ζⁿ) - -Correct the tendency terms to implement no-slip boundary conditions on an immersed boundary - without the contribution from the non-hydrostatic pressure. -Makes velocity vanish within the immersed surface. -""" - -correct_immersed_tendencies!(model::NonhydrostaticModel, Δt, γⁿ, ζⁿ) = - correct_immersed_tendencies!(model, model.immersed_boundary, Δt, γⁿ, ζⁿ) - -# if no immersed boundary, do nothing (no cost) -correct_immersed_tendencies!(model, ::Nothing, Δt, γⁿ, ζⁿ) = nothing - -# otherwise, unpack the model -function correct_immersed_tendencies!(model, immersed_boundary, Δt, γⁿ, ζⁿ) - - workgroup, worksize = work_layout(model.grid, :xyz) - - barrier = Event(device(model.architecture)) - - correct_immersed_tendencies_kernel! = _correct_immersed_tendencies!(device(model.architecture), workgroup, worksize) - - # event we want to occur, evaluate using kernel function - correct_tendencies_event = - correct_immersed_tendencies_kernel!(model.timestepper.Gⁿ, - model.grid, - immersed_boundary, - model.timestepper.G⁻, - model.velocities, - Δt, γⁿ, ζⁿ, - dependencies=barrier) - - # wait for these things to happen before continuing in calculations - wait(device(model.architecture), correct_tendencies_event) - - return nothing -end - -@kernel function _correct_immersed_tendencies!(Gⁿ, grid::AbstractGrid{FT}, immersed, G⁻, velocities, Δt, γⁿ, ζⁿ) where FT - i, j, k = @index(Global, NTuple) - - # Evaluate x, y, z at cell centers to determine if node is immersed - x = xnode(Center(), i, grid) - y = ynode(Center(), j, grid) - z = znode(Center(), k, grid) - - @inbounds begin - # correcting velocity tendency terms: if immersd boundary gives true then correct tendency, otherwise don't (it's a fluid node) - Gⁿ.u[i, j, k] = ifelse(immersed(x, y, z), - - (velocities.u[i, j, k] + ζⁿ * Δt * G⁻.u[i, j, k]) / (γⁿ * Δt), - Gⁿ.u[i, j, k]) - - Gⁿ.v[i, j, k] = ifelse(immersed(x, y, z), - - (velocities.v[i, j, k] + ζⁿ * Δt * G⁻.v[i, j, k]) / (γⁿ * Δt), - Gⁿ.v[i, j, k]) - - Gⁿ.w[i, j, k] = ifelse(immersed(x, y, z), - - (velocities.w[i, j, k] + ζⁿ * Δt * G⁻.w[i, j, k]) / (γⁿ * Δt), - Gⁿ.w[i, j, k]) - end -end diff --git a/src/Models/NonhydrostaticModels/set_incompressible_model.jl b/src/Models/NonhydrostaticModels/set_incompressible_model.jl deleted file mode 100644 index 79fdda77e3..0000000000 --- a/src/Models/NonhydrostaticModels/set_incompressible_model.jl +++ /dev/null @@ -1,59 +0,0 @@ -using Oceananigans.TimeSteppers: update_state!, calculate_pressure_correction!, pressure_correct_velocities! - -import Oceananigans.Fields: set! - -""" - set!(model; kwargs...) - -Set velocity and tracer fields of `model`. The keyword arguments -`kwargs...` take the form `name=data`, where `name` refers to one of the -fields of `model.velocities` or `model.tracers`, and the `data` may be an array, -a function with arguments `(x, y, z)`, or any data type for which a -`set!(ϕ::AbstractField, data)` function exists. - -Example -======= -```julia -model = NonhydrostaticModel(grid=RegularRectilinearGrid(size=(32, 32, 32), length=(1, 1, 1)) - -# Set u to a parabolic function of z, v to random numbers damped -# at top and bottom, and T to some silly array of half zeros, -# half random numbers. - -u₀(x, y, z) = z/model.grid.Lz * (1 + z/model.grid.Lz) -v₀(x, y, z) = 1e-3 * rand() * u₀(x, y, z) - -T₀ = rand(size(model.grid)...) -T₀[T₀ .< 0.5] .= 0 - -set!(model, u=u₀, v=v₀, T=T₀) -``` -""" -function set!(model::NonhydrostaticModel; enforce_incompressibility=true, kwargs...) - for (fldname, value) in kwargs - if fldname ∈ propertynames(model.velocities) - ϕ = getproperty(model.velocities, fldname) - elseif fldname ∈ propertynames(model.tracers) - ϕ = getproperty(model.tracers, fldname) - else - throw(ArgumentError("name $fldname not found in model.velocities or model.tracers.")) - end - set!(ϕ, value) - end - - # Apply a mask - tracer_masking_events = Tuple(mask_immersed_field!(c) for c in model.tracers) - velocity_masking_events = mask_immersed_velocities!(model.velocities, model.architecture, model.grid) - wait(device(model.architecture), MultiEvent(tuple(velocity_masking_events..., tracer_masking_events...))) - - update_state!(model) - - if enforce_incompressibility - FT = eltype(model.grid) - calculate_pressure_correction!(model, one(FT)) - pressure_correct_velocities!(model, one(FT)) - update_state!(model) - end - - return nothing -end diff --git a/src/Models/NonhydrostaticModels/show_incompressible_model.jl b/src/Models/NonhydrostaticModels/show_incompressible_model.jl deleted file mode 100644 index 259dda9db9..0000000000 --- a/src/Models/NonhydrostaticModels/show_incompressible_model.jl +++ /dev/null @@ -1,21 +0,0 @@ -using Oceananigans: short_show -using Oceananigans.Utils: prettytime, ordered_dict_show - -"""Show the innards of a `Model` in the REPL.""" -function Base.show(io::IO, model::NonhydrostaticModel{TS, C, A}) where {TS, C, A} - print(io, "NonhydrostaticModel{"*string(Base.nameof(A))*", $(eltype(model.grid))}", - "(time = $(prettytime(model.clock.time)), iteration = $(model.clock.iteration)) \n", - "├── grid: $(short_show(model.grid))\n", - "├── tracers: $(tracernames(model.tracers))\n", - "├── closure: $(typeof(model.closure))\n", - "├── buoyancy: $(typeof(isnothing(model.buoyancy) ? model.buoyancy : model.buoyancy.model))\n") - - if isnothing(model.particles) - print(io, "└── coriolis: $(typeof(model.coriolis))") - else - particles = model.particles.properties - properties = propertynames(particles) - print(io, "├── coriolis: $(typeof(model.coriolis))\n") - print(io, "└── particles: $(length(particles)) Lagrangian particles with $(length(properties)) properties: $properties") - end -end diff --git a/src/Models/NonhydrostaticModels/update_incompressible_model_state.jl b/src/Models/NonhydrostaticModels/update_incompressible_model_state.jl deleted file mode 100644 index eb7ad8ccd4..0000000000 --- a/src/Models/NonhydrostaticModels/update_incompressible_model_state.jl +++ /dev/null @@ -1,35 +0,0 @@ -using Oceananigans.Architectures -using Oceananigans.BoundaryConditions -using Oceananigans.TurbulenceClosures: calculate_diffusivities! - -import Oceananigans.TimeSteppers: update_state! - -""" - update_state!(model::NonhydrostaticModel) - -Update peripheral aspects of the model (halo regions, diffusivities, hydrostatic pressure) to the current model state. -""" -function update_state!(model::NonhydrostaticModel) - - # Fill halos for velocities and tracers - fill_halo_regions!(merge(model.velocities, model.tracers), model.architecture, model.clock, fields(model)) - - # Calculate diffusivities - calculate_diffusivities!(model.diffusivities, model.architecture, model.grid, model.closure, - model.buoyancy, model.velocities, model.tracers) - - fill_halo_regions!(model.diffusivities, model.architecture, model.clock, fields(model)) - - # Calculate hydrostatic pressure - pressure_calculation = launch!(model.architecture, model.grid, :xy, update_hydrostatic_pressure!, - model.pressures.pHY′, model.grid, model.buoyancy, model.tracers, - dependencies=Event(device(model.architecture))) - - # Fill halo regions for pressure - wait(device(model.architecture), pressure_calculation) - - fill_halo_regions!(model.pressures.pHY′, model.architecture) - - return nothing -end - diff --git a/test/test_boundary_conditions_integration.jl b/test/test_boundary_conditions_integration.jl index 4834203567..bc1bd70bec 100644 --- a/test/test_boundary_conditions_integration.jl +++ b/test/test_boundary_conditions_integration.jl @@ -19,7 +19,7 @@ function test_boundary_condition(arch, FT, topo, side, field_name, boundary_cond return success end -function test_incompressible_flux_budget(arch, name, side, topo) +function test_nonhydrostatic_flux_budget(arch, name, side, topo) FT = Float64 Lx = 0.3 @@ -220,19 +220,19 @@ test_boundary_conditions(C, FT, ArrayType) = (integer_bc(C, FT, ArrayType), topo = (Periodic, Bounded, Bounded) for name in (:u, :c), side in (:north, :south, :top, :bottom) @info " Testing budgets with Flux boundary conditions [$(typeof(arch)), $topo, $name, $side]..." - @test test_incompressible_flux_budget(arch, name, side, topo) + @test test_nonhydrostatic_flux_budget(arch, name, side, topo) end topo = (Bounded, Periodic, Bounded) for name in (:v, :c), side in (:east, :west, :top, :bottom) @info " Testing budgets with Flux boundary conditions [$(typeof(arch)), $topo, $name, $side]..." - @test test_incompressible_flux_budget(arch, name, side, topo) + @test test_nonhydrostatic_flux_budget(arch, name, side, topo) end topo = (Bounded, Bounded, Periodic) for name in (:w, :c), side in (:east, :west, :north, :south) @info " Testing budgets with Flux boundary conditions [$(typeof(arch)), $topo, $name, $side]..." - @test test_incompressible_flux_budget(arch, name, side, topo) + @test test_nonhydrostatic_flux_budget(arch, name, side, topo) end end end From d86947f96ec20d457d9ac4efe8e64fb1864ae8c5 Mon Sep 17 00:00:00 2001 From: Navid Constantinou Date: Mon, 19 Jul 2021 05:55:42 +1000 Subject: [PATCH 07/13] incompressible -> nonhydrostatic --- .../distributed_nonhydrostatic_model.jl | 51 ++++++++++++++ ...rect_nonhydrostatic_immersed_tendencies.jl | 66 +++++++++++++++++++ .../set_nonhydrostatic_model.jl | 59 +++++++++++++++++ .../show_nonhydrostatic_model.jl | 21 ++++++ .../update_nonhydrostatic_model_state.jl | 35 ++++++++++ 5 files changed, 232 insertions(+) create mode 100644 src/Distributed/distributed_nonhydrostatic_model.jl create mode 100644 src/Models/NonhydrostaticModels/correct_nonhydrostatic_immersed_tendencies.jl create mode 100644 src/Models/NonhydrostaticModels/set_nonhydrostatic_model.jl create mode 100644 src/Models/NonhydrostaticModels/show_nonhydrostatic_model.jl create mode 100644 src/Models/NonhydrostaticModels/update_nonhydrostatic_model_state.jl diff --git a/src/Distributed/distributed_nonhydrostatic_model.jl b/src/Distributed/distributed_nonhydrostatic_model.jl new file mode 100644 index 0000000000..80bcb00673 --- /dev/null +++ b/src/Distributed/distributed_nonhydrostatic_model.jl @@ -0,0 +1,51 @@ +using Oceananigans.Grids +using Oceananigans.Fields + +##### +##### Distributed incompressible model constructor +##### + +function DistributedNonhydrostaticModel(; architecture, grid, model_kwargs...) + i, j, k = architecture.local_index + Rx, Ry, Rz = architecture.ranks + my_connectivity = architecture.connectivity + + Nx, Ny, Nz = size(grid) + Lx, Ly, Lz = length(grid) + + # Pull out endpoints for full grid. + xL, xR = grid.xF[1], grid.xF[Nx+1] + yL, yR = grid.yF[1], grid.yF[Ny+1] + zL, zR = grid.zF[1], grid.zF[Nz+1] + + # Make sure we can put an integer number of grid points in each rank. + # Will generalize in the future. + # TODO: Check that we have enough grid points on each rank to fit the halos! + @assert isinteger(Nx / Rx) + @assert isinteger(Ny / Ry) + @assert isinteger(Nz / Rz) + + nx, ny, nz = Nx÷Rx, Ny÷Ry, Nz÷Rz + lx, ly, lz = Lx/Rx, Ly/Ry, Lz/Rz + + x₁, x₂ = xL + (i-1)*lx, xL + i*lx + y₁, y₂ = yL + (j-1)*ly, yL + j*ly + z₁, z₂ = zL + (k-1)*lz, zL + k*lz + + # FIXME? local grid might have different topology! + my_grid = RegularRectilinearGrid(topology=topology(grid), size=(nx, ny, nz), x=(x₁, x₂), y=(y₁, y₂), z=(z₁, z₂), halo=halo_size(grid)) + + ## Construct local model + + pressure_solver = haskey(model_kwargs, :pressure_solver) ? Dict(model_kwargs)[:pressure_solver] : + DistributedFFTBasedPoissonSolver(architecture, grid, my_grid) + + my_model = NonhydrostaticModel(; + architecture = architecture, + grid = my_grid, + pressure_solver = pressure_solver, + model_kwargs... + ) + + return my_model +end diff --git a/src/Models/NonhydrostaticModels/correct_nonhydrostatic_immersed_tendencies.jl b/src/Models/NonhydrostaticModels/correct_nonhydrostatic_immersed_tendencies.jl new file mode 100644 index 0000000000..3bb0db5d35 --- /dev/null +++ b/src/Models/NonhydrostaticModels/correct_nonhydrostatic_immersed_tendencies.jl @@ -0,0 +1,66 @@ +using Oceananigans.Grids: xnode, ynode, znode, Center, AbstractGrid + +import Oceananigans.TimeSteppers: correct_immersed_tendencies! + +""" + correct_immersed_tendencies!(model, Δt, γⁿ, ζⁿ) + +Correct the tendency terms to implement no-slip boundary conditions on an immersed boundary + without the contribution from the non-hydrostatic pressure. +Makes velocity vanish within the immersed surface. +""" + +correct_immersed_tendencies!(model::NonhydrostaticModel, Δt, γⁿ, ζⁿ) = + correct_immersed_tendencies!(model, model.immersed_boundary, Δt, γⁿ, ζⁿ) + +# if no immersed boundary, do nothing (no cost) +correct_immersed_tendencies!(model, ::Nothing, Δt, γⁿ, ζⁿ) = nothing + +# otherwise, unpack the model +function correct_immersed_tendencies!(model, immersed_boundary, Δt, γⁿ, ζⁿ) + + workgroup, worksize = work_layout(model.grid, :xyz) + + barrier = Event(device(model.architecture)) + + correct_immersed_tendencies_kernel! = _correct_immersed_tendencies!(device(model.architecture), workgroup, worksize) + + # event we want to occur, evaluate using kernel function + correct_tendencies_event = + correct_immersed_tendencies_kernel!(model.timestepper.Gⁿ, + model.grid, + immersed_boundary, + model.timestepper.G⁻, + model.velocities, + Δt, γⁿ, ζⁿ, + dependencies=barrier) + + # wait for these things to happen before continuing in calculations + wait(device(model.architecture), correct_tendencies_event) + + return nothing +end + +@kernel function _correct_immersed_tendencies!(Gⁿ, grid::AbstractGrid{FT}, immersed, G⁻, velocities, Δt, γⁿ, ζⁿ) where FT + i, j, k = @index(Global, NTuple) + + # Evaluate x, y, z at cell centers to determine if node is immersed + x = xnode(Center(), i, grid) + y = ynode(Center(), j, grid) + z = znode(Center(), k, grid) + + @inbounds begin + # correcting velocity tendency terms: if immersd boundary gives true then correct tendency, otherwise don't (it's a fluid node) + Gⁿ.u[i, j, k] = ifelse(immersed(x, y, z), + - (velocities.u[i, j, k] + ζⁿ * Δt * G⁻.u[i, j, k]) / (γⁿ * Δt), + Gⁿ.u[i, j, k]) + + Gⁿ.v[i, j, k] = ifelse(immersed(x, y, z), + - (velocities.v[i, j, k] + ζⁿ * Δt * G⁻.v[i, j, k]) / (γⁿ * Δt), + Gⁿ.v[i, j, k]) + + Gⁿ.w[i, j, k] = ifelse(immersed(x, y, z), + - (velocities.w[i, j, k] + ζⁿ * Δt * G⁻.w[i, j, k]) / (γⁿ * Δt), + Gⁿ.w[i, j, k]) + end +end diff --git a/src/Models/NonhydrostaticModels/set_nonhydrostatic_model.jl b/src/Models/NonhydrostaticModels/set_nonhydrostatic_model.jl new file mode 100644 index 0000000000..79a49aa077 --- /dev/null +++ b/src/Models/NonhydrostaticModels/set_nonhydrostatic_model.jl @@ -0,0 +1,59 @@ +using Oceananigans.TimeSteppers: update_state!, calculate_pressure_correction!, pressure_correct_velocities! + +import Oceananigans.Fields: set! + +""" + set!(model; kwargs...) + +Set velocity and tracer fields of `model`. The keyword arguments +`kwargs...` take the form `name=data`, where `name` refers to one of the +fields of `model.velocities` or `model.tracers`, and the `data` may be an array, +a function with arguments `(x, y, z)`, or any data type for which a +`set!(ϕ::AbstractField, data)` function exists. + +Example +======= +```julia +model = NonhydrostaticModel(grid=RegularRectilinearGrid(size=(32, 32, 32), length=(1, 1, 1)) + +# Set u to a parabolic function of z, v to random numbers damped +# at top and bottom, and T to some silly array of half zeros, +# half random numbers. + +u₀(x, y, z) = z / model.grid.Lz * (1 + z / model.grid.Lz) +v₀(x, y, z) = 1e-3 * rand() * u₀(x, y, z) + +T₀ = rand(size(model.grid)...) +T₀[T₀ .< 0.5] .= 0 + +set!(model, u=u₀, v=v₀, T=T₀) +``` +""" +function set!(model::NonhydrostaticModel; enforce_incompressibility=true, kwargs...) + for (fldname, value) in kwargs + if fldname ∈ propertynames(model.velocities) + ϕ = getproperty(model.velocities, fldname) + elseif fldname ∈ propertynames(model.tracers) + ϕ = getproperty(model.tracers, fldname) + else + throw(ArgumentError("name $fldname not found in model.velocities or model.tracers.")) + end + set!(ϕ, value) + end + + # Apply a mask + tracer_masking_events = Tuple(mask_immersed_field!(c) for c in model.tracers) + velocity_masking_events = mask_immersed_velocities!(model.velocities, model.architecture, model.grid) + wait(device(model.architecture), MultiEvent(tuple(velocity_masking_events..., tracer_masking_events...))) + + update_state!(model) + + if enforce_incompressibility + FT = eltype(model.grid) + calculate_pressure_correction!(model, one(FT)) + pressure_correct_velocities!(model, one(FT)) + update_state!(model) + end + + return nothing +end diff --git a/src/Models/NonhydrostaticModels/show_nonhydrostatic_model.jl b/src/Models/NonhydrostaticModels/show_nonhydrostatic_model.jl new file mode 100644 index 0000000000..259dda9db9 --- /dev/null +++ b/src/Models/NonhydrostaticModels/show_nonhydrostatic_model.jl @@ -0,0 +1,21 @@ +using Oceananigans: short_show +using Oceananigans.Utils: prettytime, ordered_dict_show + +"""Show the innards of a `Model` in the REPL.""" +function Base.show(io::IO, model::NonhydrostaticModel{TS, C, A}) where {TS, C, A} + print(io, "NonhydrostaticModel{"*string(Base.nameof(A))*", $(eltype(model.grid))}", + "(time = $(prettytime(model.clock.time)), iteration = $(model.clock.iteration)) \n", + "├── grid: $(short_show(model.grid))\n", + "├── tracers: $(tracernames(model.tracers))\n", + "├── closure: $(typeof(model.closure))\n", + "├── buoyancy: $(typeof(isnothing(model.buoyancy) ? model.buoyancy : model.buoyancy.model))\n") + + if isnothing(model.particles) + print(io, "└── coriolis: $(typeof(model.coriolis))") + else + particles = model.particles.properties + properties = propertynames(particles) + print(io, "├── coriolis: $(typeof(model.coriolis))\n") + print(io, "└── particles: $(length(particles)) Lagrangian particles with $(length(properties)) properties: $properties") + end +end diff --git a/src/Models/NonhydrostaticModels/update_nonhydrostatic_model_state.jl b/src/Models/NonhydrostaticModels/update_nonhydrostatic_model_state.jl new file mode 100644 index 0000000000..eb7ad8ccd4 --- /dev/null +++ b/src/Models/NonhydrostaticModels/update_nonhydrostatic_model_state.jl @@ -0,0 +1,35 @@ +using Oceananigans.Architectures +using Oceananigans.BoundaryConditions +using Oceananigans.TurbulenceClosures: calculate_diffusivities! + +import Oceananigans.TimeSteppers: update_state! + +""" + update_state!(model::NonhydrostaticModel) + +Update peripheral aspects of the model (halo regions, diffusivities, hydrostatic pressure) to the current model state. +""" +function update_state!(model::NonhydrostaticModel) + + # Fill halos for velocities and tracers + fill_halo_regions!(merge(model.velocities, model.tracers), model.architecture, model.clock, fields(model)) + + # Calculate diffusivities + calculate_diffusivities!(model.diffusivities, model.architecture, model.grid, model.closure, + model.buoyancy, model.velocities, model.tracers) + + fill_halo_regions!(model.diffusivities, model.architecture, model.clock, fields(model)) + + # Calculate hydrostatic pressure + pressure_calculation = launch!(model.architecture, model.grid, :xy, update_hydrostatic_pressure!, + model.pressures.pHY′, model.grid, model.buoyancy, model.tracers, + dependencies=Event(device(model.architecture))) + + # Fill halo regions for pressure + wait(device(model.architecture), pressure_calculation) + + fill_halo_regions!(model.pressures.pHY′, model.architecture) + + return nothing +end + From 74e83601fc4680bcea0a02c6db27525586e0cc64 Mon Sep 17 00:00:00 2001 From: Navid Constantinou Date: Mon, 19 Jul 2021 06:05:54 +1000 Subject: [PATCH 08/13] incompressible -> nonhydrostatic in docs --- docs/make.jl | 2 +- docs/src/physics/incompressible_model.md | 83 ------------------------ 2 files changed, 1 insertion(+), 84 deletions(-) delete mode 100644 docs/src/physics/incompressible_model.md diff --git a/docs/make.jl b/docs/make.jl index a782f41530..12b3c56cc6 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -93,7 +93,7 @@ physics_pages = [ "Coordinate system and notation" => "physics/notation.md", "Boussinesq approximation" => "physics/boussinesq.md", "`NonhydrostaticModel`" => [ - "Incompressible model" => "physics/nonhydrostatic_model.md", + "Nonhydrostatic model" => "physics/nonhydrostatic_model.md", ], "`HydrostaticFreeSurfaceModel`" => [ "Hydrostatic model with a free surface" => "physics/hydrostatic_free_surface_model.md" diff --git a/docs/src/physics/incompressible_model.md b/docs/src/physics/incompressible_model.md deleted file mode 100644 index 7be4f2d3ee..0000000000 --- a/docs/src/physics/incompressible_model.md +++ /dev/null @@ -1,83 +0,0 @@ -# Incompressible model - -The `NonhydrostaticModel` solves the incompressible Navier-Stokes equations under the Boussinesq -approximation and an arbitrary number of tracer conservation equations. -Physics associated with individual terms in the momentum and tracer conservation -equations --- the background rotation rate of the equation's reference frame, -gravitational effects associated with buoyant tracers under the Boussinesq -approximation, generalized stresses and tracer fluxes associated with viscous and -diffusive physics, and arbitrary "forcing functions" --- are determined by the whims of the -user. - -## The momentum conservation equation - -The equations governing the conservation of momentum in a rotating fluid, including buoyancy -via the Boussinesq approximation and including the averaged effects of surface gravity waves -at the top of the domain via the Craik-Leibovich approximation are -```math - \begin{align} - \partial_t \boldsymbol{v} & = - \left ( \boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} \right ) \boldsymbol{v} - - \left ( \boldsymbol{V} \boldsymbol{\cdot} \boldsymbol{\nabla} \right ) \boldsymbol{v} - - \left ( \boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} \right ) \boldsymbol{V} \nonumber \\ - & \qquad - - \left ( \boldsymbol{f} - \boldsymbol{\nabla} \times \boldsymbol{u}^S \right ) \times \boldsymbol{v} - - \boldsymbol{\nabla} p - + b \boldsymbol{\hat g} - - \boldsymbol{\nabla} \boldsymbol{\cdot} \boldsymbol{\tau} - + \partial_t \boldsymbol{v}^S - + \boldsymbol{F_v} \, , - \label{eq:momentum} - \end{align} -``` -where ``b \boldsymbol{\hat g}`` the is the buoyancy (a vector whose default direction is upward), -``\boldsymbol{\tau}`` is the kinematic stress tensor, ``\boldsymbol{F_v}`` -denotes an internal forcing of the velocity field ``\boldsymbol{v}``, ``p`` is the kinematic -pressure, ``\boldsymbol{u}^S``is the 'Stokes drift' velocity field associated with surface gravity -waves, and ``\boldsymbol{f}`` is the *Coriolis parameter*, or the background vorticity associated -with the specified rate of rotation of the frame of reference. - -The terms that appear on the right-hand side of the momentum conservation equation are (in order): - -* momentum advection: ``\left ( \boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} \right ) - \boldsymbol{v}``, -* advection of resolved momentum by the background velocity field ``\boldsymbol{V}``: - ``\left ( \boldsymbol{V} \boldsymbol{\cdot} \boldsymbol{\nabla} \right ) \boldsymbol{v}``, -* advection of background momentum by resolved velocity: ``\left ( \boldsymbol{v} \boldsymbol{\cdot} - \boldsymbol{\nabla} \right ) \boldsymbol{V}``, -* Coriolis: ``\boldsymbol{f} \times \boldsymbol{v}``, -* the effective background rotation rate due to surface waves: ``\left ( \boldsymbol{\nabla} \times - \boldsymbol{u}^S \right ) \times \boldsymbol{v}``, -* kinematic pressure gradient: ``\boldsymbol{\nabla} p``, -* buoyant acceleration: ``b``, -* vertical unit vector (pointing to the direction opposite to gravity): ``\boldsymbol{\hat g}``, -* molecular or turbulence viscous stress: ``\boldsymbol{\nabla} \boldsymbol{\cdot} \boldsymbol{\tau}``, -* a source of momentum due to forcing or damping of surface waves: ``\partial_t \boldsymbol{v}^S``, and -* an arbitrary internal source of momentum: ``\boldsymbol{F_v}``. - -## The tracer conservation equation - -The conservation law for tracers in Oceananigans.jl is -```math - \begin{align} - \partial_t c = - \boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} c - - \boldsymbol{V} \boldsymbol{\cdot} \boldsymbol{\nabla} c - - \boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} C - - \boldsymbol{\nabla} \boldsymbol{\cdot} \boldsymbol{q}_c - + F_c \, , - \label{eq:tracer} - \end{align} -``` -where ``\boldsymbol{q}_c`` is the diffusive flux of ``c`` and ``F_c`` is an arbitrary source term. -Oceananigans.jl permits arbitrary tracers and thus an arbitrary number of tracer equations to -be solved simultaneously with the momentum equations. - -From left to right, the terms that appear on the right-hand side of the tracer conservation equation are - -* tracer advection: ``\boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} c``, -* tracer advection by the background velocity field, ``\boldsymbol{V}``: ``\boldsymbol{V} \boldsymbol{\cdot} \boldsymbol{\nabla} c``, -* advection of the background tracer field, ``C``, by the resolved velocity field: ``\boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} C``, -* molecular or turbulent diffusion: ``\boldsymbol{\nabla} \boldsymbol{\cdot} \boldsymbol{q}_c``, and -* an arbitrary internal source of tracer: ``F_c``. - -The following subsections provide more details on the possible forms that each individual term -in the momentum and tracer equations can take in Oceananigans.jl. From 8214256f9a5670eb25cfa30589b54d3352dd11e2 Mon Sep 17 00:00:00 2001 From: Navid Constantinou Date: Mon, 19 Jul 2021 06:06:11 +1000 Subject: [PATCH 09/13] incompressible -> nonhydrostatic in docs --- docs/src/physics/nonhydrostatic_model.md | 83 ++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 docs/src/physics/nonhydrostatic_model.md diff --git a/docs/src/physics/nonhydrostatic_model.md b/docs/src/physics/nonhydrostatic_model.md new file mode 100644 index 0000000000..7be4f2d3ee --- /dev/null +++ b/docs/src/physics/nonhydrostatic_model.md @@ -0,0 +1,83 @@ +# Incompressible model + +The `NonhydrostaticModel` solves the incompressible Navier-Stokes equations under the Boussinesq +approximation and an arbitrary number of tracer conservation equations. +Physics associated with individual terms in the momentum and tracer conservation +equations --- the background rotation rate of the equation's reference frame, +gravitational effects associated with buoyant tracers under the Boussinesq +approximation, generalized stresses and tracer fluxes associated with viscous and +diffusive physics, and arbitrary "forcing functions" --- are determined by the whims of the +user. + +## The momentum conservation equation + +The equations governing the conservation of momentum in a rotating fluid, including buoyancy +via the Boussinesq approximation and including the averaged effects of surface gravity waves +at the top of the domain via the Craik-Leibovich approximation are +```math + \begin{align} + \partial_t \boldsymbol{v} & = - \left ( \boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} \right ) \boldsymbol{v} + - \left ( \boldsymbol{V} \boldsymbol{\cdot} \boldsymbol{\nabla} \right ) \boldsymbol{v} + - \left ( \boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} \right ) \boldsymbol{V} \nonumber \\ + & \qquad + - \left ( \boldsymbol{f} - \boldsymbol{\nabla} \times \boldsymbol{u}^S \right ) \times \boldsymbol{v} + - \boldsymbol{\nabla} p + + b \boldsymbol{\hat g} + - \boldsymbol{\nabla} \boldsymbol{\cdot} \boldsymbol{\tau} + + \partial_t \boldsymbol{v}^S + + \boldsymbol{F_v} \, , + \label{eq:momentum} + \end{align} +``` +where ``b \boldsymbol{\hat g}`` the is the buoyancy (a vector whose default direction is upward), +``\boldsymbol{\tau}`` is the kinematic stress tensor, ``\boldsymbol{F_v}`` +denotes an internal forcing of the velocity field ``\boldsymbol{v}``, ``p`` is the kinematic +pressure, ``\boldsymbol{u}^S``is the 'Stokes drift' velocity field associated with surface gravity +waves, and ``\boldsymbol{f}`` is the *Coriolis parameter*, or the background vorticity associated +with the specified rate of rotation of the frame of reference. + +The terms that appear on the right-hand side of the momentum conservation equation are (in order): + +* momentum advection: ``\left ( \boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} \right ) + \boldsymbol{v}``, +* advection of resolved momentum by the background velocity field ``\boldsymbol{V}``: + ``\left ( \boldsymbol{V} \boldsymbol{\cdot} \boldsymbol{\nabla} \right ) \boldsymbol{v}``, +* advection of background momentum by resolved velocity: ``\left ( \boldsymbol{v} \boldsymbol{\cdot} + \boldsymbol{\nabla} \right ) \boldsymbol{V}``, +* Coriolis: ``\boldsymbol{f} \times \boldsymbol{v}``, +* the effective background rotation rate due to surface waves: ``\left ( \boldsymbol{\nabla} \times + \boldsymbol{u}^S \right ) \times \boldsymbol{v}``, +* kinematic pressure gradient: ``\boldsymbol{\nabla} p``, +* buoyant acceleration: ``b``, +* vertical unit vector (pointing to the direction opposite to gravity): ``\boldsymbol{\hat g}``, +* molecular or turbulence viscous stress: ``\boldsymbol{\nabla} \boldsymbol{\cdot} \boldsymbol{\tau}``, +* a source of momentum due to forcing or damping of surface waves: ``\partial_t \boldsymbol{v}^S``, and +* an arbitrary internal source of momentum: ``\boldsymbol{F_v}``. + +## The tracer conservation equation + +The conservation law for tracers in Oceananigans.jl is +```math + \begin{align} + \partial_t c = - \boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} c + - \boldsymbol{V} \boldsymbol{\cdot} \boldsymbol{\nabla} c + - \boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} C + - \boldsymbol{\nabla} \boldsymbol{\cdot} \boldsymbol{q}_c + + F_c \, , + \label{eq:tracer} + \end{align} +``` +where ``\boldsymbol{q}_c`` is the diffusive flux of ``c`` and ``F_c`` is an arbitrary source term. +Oceananigans.jl permits arbitrary tracers and thus an arbitrary number of tracer equations to +be solved simultaneously with the momentum equations. + +From left to right, the terms that appear on the right-hand side of the tracer conservation equation are + +* tracer advection: ``\boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} c``, +* tracer advection by the background velocity field, ``\boldsymbol{V}``: ``\boldsymbol{V} \boldsymbol{\cdot} \boldsymbol{\nabla} c``, +* advection of the background tracer field, ``C``, by the resolved velocity field: ``\boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} C``, +* molecular or turbulent diffusion: ``\boldsymbol{\nabla} \boldsymbol{\cdot} \boldsymbol{q}_c``, and +* an arbitrary internal source of tracer: ``F_c``. + +The following subsections provide more details on the possible forms that each individual term +in the momentum and tracer equations can take in Oceananigans.jl. From 02591b90a8b8bd8b034927b404db340eb5fb654e Mon Sep 17 00:00:00 2001 From: Navid Constantinou Date: Mon, 19 Jul 2021 06:12:41 +1000 Subject: [PATCH 10/13] bump to v0.60.0 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 706dc03232..cf4756e900 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Oceananigans" uuid = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09" -version = "0.59.0" +version = "0.60.0" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" From 3fba691498914aa3fde9b1fea176e4ecfc081c02 Mon Sep 17 00:00:00 2001 From: Navid Constantinou Date: Mon, 19 Jul 2021 10:55:59 +1000 Subject: [PATCH 11/13] incompressible -> nonhydrostatic --- benchmark/README.md | 2 +- benchmark/benchmark_nonhydrostatic_model.jl | 8 ++++---- ...hmark_vertically_stretched_nonhydrostatic_model.jl} | 0 ...model.jl => strong_scaling_nonhydrostatic_model.jl} | 10 +++++----- ...l => strong_scaling_nonhydrostatic_model_single.jl} | 6 +++--- docs/src/physics/nonhydrostatic_model.md | 2 +- validation/immersed_boundaries/flow_around_cylinder.jl | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) rename benchmark/{benchmark_vertically_stretched_incompressible_model.jl => benchmark_vertically_stretched_nonhydrostatic_model.jl} (100%) rename benchmark/{strong_scaling_incompressible_model.jl => strong_scaling_nonhydrostatic_model.jl} (91%) rename benchmark/{strong_scaling_incompressible_model_single.jl => strong_scaling_nonhydrostatic_model_single.jl} (87%) diff --git a/benchmark/README.md b/benchmark/README.md index 18fda092bf..ce9995cabe 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -22,5 +22,5 @@ The `benchmark_multithreading.jl` script will benchmark multithreaded CPU models ## Measuring performance regression -Running the `benchmark_regression.jl` script will run the incompressible model tests on the current branch and on the master branch for comparison. This is useful to test whether the current branch slows down the code or introduces any performance regression. +Running the `benchmark_regression.jl` script will run the nonhydrostatic model tests on the current branch and on the master branch for comparison. This is useful to test whether the current branch slows down the code or introduces any performance regression. diff --git a/benchmark/benchmark_nonhydrostatic_model.jl b/benchmark/benchmark_nonhydrostatic_model.jl index e11a17e36c..b2cc7aaadf 100644 --- a/benchmark/benchmark_nonhydrostatic_model.jl +++ b/benchmark/benchmark_nonhydrostatic_model.jl @@ -48,7 +48,7 @@ for i in 1:plot_num end plt = plot(Ns, CPU_Float32, lw=4, label="CPU Float32", xaxis=:log2, yaxis=:log, legend=:topleft, - xlabel="Nx", ylabel="Times (ms)", title="Incompressible Model Benchmarks: CPU vs GPU") + xlabel="Nx", ylabel="Times (ms)", title="Nonhydrostatic Model Benchmarks: CPU vs GPU") plot!(plt, Ns, CPU_Float64, lw=4, label="CPU Float64") plot!(plt, Ns, GPU_Float32, lw=4, label="GPU Float32") plot!(plt, Ns, GPU_Float64, lw=4, label="GPU Float64") @@ -57,17 +57,17 @@ savefig(plt, "incompressible_times.png") plt2 = plot(Ns, CPU_Float32./GPU_Float32, lw=4, xaxis=:log2, legend=:topleft, label="Float32", - xlabel="Nx", ylabel="Speedup Ratio", title="Incompressible Model Benchmarks: CPU/GPU") + xlabel="Nx", ylabel="Speedup Ratio", title="Nonhydrostatic Model Benchmarks: CPU/GPU") plot!(plt2, Ns, CPU_Float64./GPU_Float64, lw=4, label="Float64") display(plt2) savefig(plt2, "incompressible_speedup.png") df = benchmarks_dataframe(suite) sort!(df, [:Architectures, :Float_types, :Ns], by=(string, string, identity)) -benchmarks_pretty_table(df, title="Incompressible model benchmarks") +benchmarks_pretty_table(df, title="Nonhydrostatic model benchmarks") if GPU in Architectures df_Δ = gpu_speedups_suite(suite) |> speedups_dataframe sort!(df_Δ, [:Float_types, :Ns], by=(string, identity)) - benchmarks_pretty_table(df_Δ, title="Incompressible model CPU to GPU speedup") + benchmarks_pretty_table(df_Δ, title="Nonhydrostatic model CPU to GPU speedup") end diff --git a/benchmark/benchmark_vertically_stretched_incompressible_model.jl b/benchmark/benchmark_vertically_stretched_nonhydrostatic_model.jl similarity index 100% rename from benchmark/benchmark_vertically_stretched_incompressible_model.jl rename to benchmark/benchmark_vertically_stretched_nonhydrostatic_model.jl diff --git a/benchmark/strong_scaling_incompressible_model.jl b/benchmark/strong_scaling_nonhydrostatic_model.jl similarity index 91% rename from benchmark/strong_scaling_incompressible_model.jl rename to benchmark/strong_scaling_nonhydrostatic_model.jl index 43627d358a..0825f6c7a7 100644 --- a/benchmark/strong_scaling_incompressible_model.jl +++ b/benchmark/strong_scaling_nonhydrostatic_model.jl @@ -23,7 +23,7 @@ print_system_info() for R in ranks Nx, Ny, Nz = grid_size(R, decomposition) Rx, Ry, Rz = rank_size(R, decomposition) - @info "Benchmarking distributed incompressible model strong scaling with $(typeof(decomposition)) decomposition [N=($Nx, $Ny, $Nz), ranks=($Rx, $Ry, $Rz)]..." + @info "Benchmarking distributed nonhydrostatic model strong scaling with $(typeof(decomposition)) decomposition [N=($Nx, $Ny, $Nz), ranks=($Rx, $Ry, $Rz)]..." julia = Base.julia_cmd() run(`mpiexec -np $R $julia --project strong_scaling_nonhydrostatic_model_single.jl $(typeof(decomposition)) $Nx $Ny $Nz $Rx $Ry $Rz`) end @@ -67,22 +67,22 @@ for i in 1:plot_num end plt = plot(rank_num, run_times, lw=4, xaxis=:log2, legend=:none, - xlabel="Cores", ylabel="Times (ms)", title="Strong Scaling Incompressible Times") + xlabel="Cores", ylabel="Times (ms)", title="Strong Scaling Nonhydrostatic Times") display(plt) savefig(plt, "ss_nonhydrostatic_times.png") plt2 = plot(rank_num, eff_ratio, lw=4, xaxis=:log2, legend=:none, ylims=(0,1.1), - xlabel="Cores", ylabel="Efficiency", title="Strong Scaling Incompressible Efficiency") + xlabel="Cores", ylabel="Efficiency", title="Strong Scaling Nonhydrostatic Efficiency") display(plt2) savefig(plt2, "ss_nonhydrostatic_efficiency.png") df = benchmarks_dataframe(suite) sort!(df, :ranks) -benchmarks_pretty_table(df, title="Incompressible model strong scaling benchmark") +benchmarks_pretty_table(df, title="Nonhydrostatic model strong scaling benchmark") base_case = (grid_size(1, decomposition), rank_size(1, decomposition)) suite_Δ = speedups_suite(suite, base_case=base_case) df_Δ = speedups_dataframe(suite_Δ, efficiency=:strong, base_case=base_case, key2rank=k->prod(k[2])) sort!(df_Δ, :ranks) -benchmarks_pretty_table(df_Δ, title="Incompressible model strong scaling speedup") +benchmarks_pretty_table(df_Δ, title="Nonhydrostatic model strong scaling speedup") diff --git a/benchmark/strong_scaling_incompressible_model_single.jl b/benchmark/strong_scaling_nonhydrostatic_model_single.jl similarity index 87% rename from benchmark/strong_scaling_incompressible_model_single.jl rename to benchmark/strong_scaling_nonhydrostatic_model_single.jl index c51d5cb4ea..5f7185d835 100644 --- a/benchmark/strong_scaling_incompressible_model_single.jl +++ b/benchmark/strong_scaling_nonhydrostatic_model_single.jl @@ -27,18 +27,18 @@ Rz = parse(Int, ARGS[7]) @assert Rx * Ry * Rz == R -@info "Setting up distributed incompressible model with N=($Nx, $Ny, $Nz) grid points and ranks=($Rx, $Ry, $Rz) ($decomposition decomposition) on rank $local_rank..." +@info "Setting up distributed nonhydrostatic model with N=($Nx, $Ny, $Nz) grid points and ranks=($Rx, $Ry, $Rz) ($decomposition decomposition) on rank $local_rank..." topo = (Periodic, Periodic, Periodic) distributed_grid = RegularRectilinearGrid(topology=topo, size=(Nx, Ny, Nz), extent=(1, 1, 1)) arch = MultiCPU(grid=distributed_grid, ranks=(Rx, Ry, Rz)) model = DistributedNonhydrostaticModel(architecture=arch, grid=distributed_grid) -@info "Warming up distributed incompressible model on rank $local_rank..." +@info "Warming up distributed nonhydrostatic model on rank $local_rank..." time_step!(model, 1) # warmup -@info "Benchmarking distributed incompressible model on rank $local_rank..." +@info "Benchmarking distributed nonhydrostatic model on rank $local_rank..." trial = @benchmark begin @sync_gpu time_step!($model, 1) diff --git a/docs/src/physics/nonhydrostatic_model.md b/docs/src/physics/nonhydrostatic_model.md index 7be4f2d3ee..47357e6a1a 100644 --- a/docs/src/physics/nonhydrostatic_model.md +++ b/docs/src/physics/nonhydrostatic_model.md @@ -1,4 +1,4 @@ -# Incompressible model +# Nonhydrostatic model The `NonhydrostaticModel` solves the incompressible Navier-Stokes equations under the Boussinesq approximation and an arbitrary number of tracer conservation equations. diff --git a/validation/immersed_boundaries/flow_around_cylinder.jl b/validation/immersed_boundaries/flow_around_cylinder.jl index 893b7a8a4e..7f03e50980 100644 --- a/validation/immersed_boundaries/flow_around_cylinder.jl +++ b/validation/immersed_boundaries/flow_around_cylinder.jl @@ -31,7 +31,7 @@ v_bcs = VVelocityBoundaryConditions(grid, north = OpenBoundaryCondition(1), south = OpenBoundaryCondition(1)) -# setting up incompressible model with immersed boundary +# setting up nonhydrostatic model with immersed boundary model = NonhydrostaticModel(timestepper = :RungeKutta3, advection = UpwindBiasedFifthOrder(), grid = grid, From 382334af40f3bfc1260e3c5222cac39574e35bee Mon Sep 17 00:00:00 2001 From: Navid Constantinou Date: Mon, 19 Jul 2021 11:00:01 +1000 Subject: [PATCH 12/13] another incompressible -> nonhydrostatic --- .../benchmark_vertically_stretched_nonhydrostatic_model.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/benchmark_vertically_stretched_nonhydrostatic_model.jl b/benchmark/benchmark_vertically_stretched_nonhydrostatic_model.jl index e78c904ada..9b9b1c6c7e 100644 --- a/benchmark/benchmark_vertically_stretched_nonhydrostatic_model.jl +++ b/benchmark/benchmark_vertically_stretched_nonhydrostatic_model.jl @@ -33,10 +33,10 @@ suite = run_benchmarks(benchmark_vertically_stretched_nonhydrostatic_model; Arch df = benchmarks_dataframe(suite) sort!(df, [:Architectures, :Float_types, :Ns], by=(string, string, identity)) -benchmarks_pretty_table(df, title="Vertically-stretched incompressible model benchmarks") +benchmarks_pretty_table(df, title="Vertically-stretched nonhydrostatic model benchmarks") if GPU in Architectures df_Δ = gpu_speedups_suite(suite) |> speedups_dataframe sort!(df_Δ, [:Float_types, :Ns], by=(string, identity)) - benchmarks_pretty_table(df_Δ, title="Vertically-stretched incompressible model CPU to GPU speedup") + benchmarks_pretty_table(df_Δ, title="Vertically-stretched nonhydrostatic model CPU to GPU speedup") end From 56a725d63847f8192ff98b3327863f7beee52dcc Mon Sep 17 00:00:00 2001 From: Navid Constantinou Date: Mon, 19 Jul 2021 12:17:01 +1000 Subject: [PATCH 13/13] moar incompressible -> nonhydrostatic --- benchmark/benchmark_nonhydrostatic_model.jl | 4 ++-- docs/src/numerical_implementation/time_stepping.md | 2 +- src/Distributed/distributed_nonhydrostatic_model.jl | 2 +- test/test_dynamics.jl | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/benchmark/benchmark_nonhydrostatic_model.jl b/benchmark/benchmark_nonhydrostatic_model.jl index b2cc7aaadf..0b1ab44a04 100644 --- a/benchmark/benchmark_nonhydrostatic_model.jl +++ b/benchmark/benchmark_nonhydrostatic_model.jl @@ -53,14 +53,14 @@ plot!(plt, Ns, CPU_Float64, lw=4, label="CPU Float64") plot!(plt, Ns, GPU_Float32, lw=4, label="GPU Float32") plot!(plt, Ns, GPU_Float64, lw=4, label="GPU Float64") display(plt) -savefig(plt, "incompressible_times.png") +savefig(plt, "nonhydrostatic_times.png") plt2 = plot(Ns, CPU_Float32./GPU_Float32, lw=4, xaxis=:log2, legend=:topleft, label="Float32", xlabel="Nx", ylabel="Speedup Ratio", title="Nonhydrostatic Model Benchmarks: CPU/GPU") plot!(plt2, Ns, CPU_Float64./GPU_Float64, lw=4, label="Float64") display(plt2) -savefig(plt2, "incompressible_speedup.png") +savefig(plt2, "nonhydrostatic_speedup.png") df = benchmarks_dataframe(suite) sort!(df, [:Architectures, :Float_types, :Ns], by=(string, string, identity)) diff --git a/docs/src/numerical_implementation/time_stepping.md b/docs/src/numerical_implementation/time_stepping.md index d2ffd15dfb..0b5212f04a 100644 --- a/docs/src/numerical_implementation/time_stepping.md +++ b/docs/src/numerical_implementation/time_stepping.md @@ -32,7 +32,7 @@ To effect such a fractional step method, we define an intermediate velocity fiel \boldsymbol{v}^\star - \boldsymbol{v}^n = \int_{t_n}^{t_{n+1}} \boldsymbol{G}_{\boldsymbol{v}} \, \mathrm{d} t \, , \end{equation} ``` -where, e.g., for the incompressible model, +where, e.g., for the non-hydrostatic model, ```math \boldsymbol{G}_{\boldsymbol{v}} \equiv - \boldsymbol{\nabla}_h p_{\rm{hyd}} - \left ( \boldsymbol{v} \boldsymbol{\cdot} \boldsymbol{\nabla} \right ) \boldsymbol{v} diff --git a/src/Distributed/distributed_nonhydrostatic_model.jl b/src/Distributed/distributed_nonhydrostatic_model.jl index 80bcb00673..22d379ad9a 100644 --- a/src/Distributed/distributed_nonhydrostatic_model.jl +++ b/src/Distributed/distributed_nonhydrostatic_model.jl @@ -2,7 +2,7 @@ using Oceananigans.Grids using Oceananigans.Fields ##### -##### Distributed incompressible model constructor +##### Distributed Nonhydrostatic model constructor ##### function DistributedNonhydrostaticModel(; architecture, grid, model_kwargs...) diff --git a/test/test_dynamics.jl b/test/test_dynamics.jl index 36a9bf387f..d28ad815dc 100644 --- a/test/test_dynamics.jl +++ b/test/test_dynamics.jl @@ -457,14 +457,14 @@ timesteppers = (:QuasiAdamsBashforth2, :RungeKutta3) end end - @testset "Internal wave with IncompressibleModel" begin + @testset "Internal wave with NonhydrostaticModel" begin for grid in test_grids grid_name = typeof(grid).name.wrapper topo = topology(grid) - model = IncompressibleModel(; grid=grid, kwargs...) + model = NonhydrostaticModel(; grid=grid, kwargs...) - @info " Testing internal wave [IncompressibleModel, $grid_name, $topo]..." + @info " Testing internal wave [NonhydrostaticModel, $grid_name, $topo]..." internal_wave_dynamics_test(model, solution, Δt) end end @@ -494,7 +494,7 @@ timesteppers = (:QuasiAdamsBashforth2, :RungeKutta3) solution, kwargs, background_fields, Δt, σ = internal_wave_solution(L=Lx, background_stratification=true) - model = IncompressibleModel(; grid=y_periodic_regular_grid, background_fields=background_fields, kwargs...) + model = NonhydrostaticModel(; grid=y_periodic_regular_grid, background_fields=background_fields, kwargs...) internal_wave_dynamics_test(model, solution, Δt) end end