Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One degree simulation in the examples and correct documentation #276

Open
wants to merge 82 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
3114f74
this works best?
simone-silvestri Nov 22, 2024
9101d57
One degree simulation take 4
simone-silvestri Nov 22, 2024
5833d19
add a biharmonic viscosity
simone-silvestri Nov 22, 2024
96a64a2
Merge branch 'main' into ss/one-degree-take3
navidcy Nov 23, 2024
0aa74dc
infer maximum delta t
simone-silvestri Nov 23, 2024
ea8708f
Merge branch 'ss/one-degree-take3' of github.com:CliMA/ClimaOcean.jl …
simone-silvestri Nov 23, 2024
3a77b67
Merge remote-tracking branch 'origin/main' into ss/one-degree-take3
simone-silvestri Nov 26, 2024
7c87f2b
changes
simone-silvestri Nov 26, 2024
bddeae3
add statistics
simone-silvestri Nov 26, 2024
f129a1d
infer -> compute
simone-silvestri Dec 2, 2024
c0e2038
compute -> infer
simone-silvestri Dec 2, 2024
8de801a
Merge branch 'ss/one-degree-take3' of github.com:CliMA/ClimaOcean.jl …
simone-silvestri Dec 2, 2024
1857737
Merge branch 'main' into ss/one-degree-take3
simone-silvestri Dec 3, 2024
75bd857
Merge branch 'main' into ss/one-degree-take3
simone-silvestri Dec 3, 2024
9d08000
default for distribtued grid
simone-silvestri Dec 4, 2024
2ffa919
Merge branch 'ss/one-degree-take3' of github.com:CliMA/ClimaOcean.jl …
simone-silvestri Dec 4, 2024
9ead323
all_reduce instead of allreduce
simone-silvestri Dec 4, 2024
9425908
update other packages
simone-silvestri Dec 10, 2024
1cde9b9
Merge branch 'main' into ss/one-degree-take3
simone-silvestri Dec 11, 2024
d887392
Merge branch 'main' into ss/one-degree-take3
simone-silvestri Dec 13, 2024
60a4eac
Merge branch 'main' into ss/one-degree-take3
navidcy Dec 15, 2024
fa2eea4
let's see if it works
simone-silvestri Dec 15, 2024
22126cb
try it out
simone-silvestri Dec 15, 2024
7ddd356
run simulation
simone-silvestri Dec 15, 2024
1803be5
remove all instances of diffusion
simone-silvestri Dec 15, 2024
afe79e4
try a zstar grid
simone-silvestri Dec 15, 2024
2f57e3c
need a manifest for this
simone-silvestri Dec 15, 2024
48d70c9
regrid the bathymetry
simone-silvestri Dec 15, 2024
2b88745
better
simone-silvestri Dec 15, 2024
c8c446a
make it work
simone-silvestri Dec 22, 2024
28f95d6
Update Project.toml
simone-silvestri Dec 22, 2024
44d16ce
Merge branch 'main' into ss/one-degree-take3
simone-silvestri Dec 22, 2024
c36c867
Merge branch 'main' into ss/one-degree-take3
simone-silvestri Dec 22, 2024
53b898a
fix docs
simone-silvestri Dec 22, 2024
5c6bf40
fix docs
simone-silvestri Dec 22, 2024
c081671
update project
simone-silvestri Dec 23, 2024
3035819
just remove it for now
simone-silvestri Dec 23, 2024
915320d
Merge remote-tracking branch 'origin/main' into ss/one-degree-take3
simone-silvestri Dec 23, 2024
3ec643c
Merge branch 'main' into ss/one-degree-take3
simone-silvestri Jan 19, 2025
63c8f97
try out correct settings
simone-silvestri Jan 19, 2025
bf0da6d
Update examples/one_degree_simulation.jl
simone-silvestri Jan 23, 2025
d3d7a58
should work now
simone-silvestri Feb 2, 2025
1f0f98d
Merge branch 'main' into ss/one-degree-take3
navidcy Feb 2, 2025
0bbb834
literate one-degree example
navidcy Feb 12, 2025
c161d72
use GPU
navidcy Feb 12, 2025
36cf425
nuke znode
navidcy Feb 12, 2025
c4e21d0
add CairoMakie 0.13 compat
navidcy Feb 12, 2025
90fc47a
explain that there is also e
navidcy Feb 12, 2025
fc0e6cf
add comment for OrthogonalSphericalShellGrids
navidcy Feb 12, 2025
00ca95e
add comment for coupled ocean--sea ice
navidcy Feb 12, 2025
cfe530c
nuke ExplicitTimeDiscretization and fix typo
navidcy Feb 12, 2025
6c275c0
this should work
simone-silvestri Feb 13, 2025
de65394
add another restoring file
simone-silvestri Feb 13, 2025
4a4f6b2
correct videos
simone-silvestri Feb 13, 2025
1d404e1
Merge remote-tracking branch 'origin/main' into ss/one-degree-take3
simone-silvestri Feb 15, 2025
5f90f0c
tamper with the time step
simone-silvestri Feb 15, 2025
0961bd9
bugfix
simone-silvestri Feb 15, 2025
90d5a44
Merge branch 'main' into ss/one-degree-take3
simone-silvestri Feb 16, 2025
2372660
remove for the moment
simone-silvestri Feb 16, 2025
e792172
fix examples
simone-silvestri Feb 17, 2025
23ff95a
bugfix
simone-silvestri Feb 17, 2025
76c4a05
small fix
simone-silvestri Feb 18, 2025
9dcbd3e
try it out
simone-silvestri Feb 18, 2025
d283450
small change
simone-silvestri Feb 19, 2025
953305f
single column sim
simone-silvestri Feb 19, 2025
148eb6a
bugfix
simone-silvestri Feb 20, 2025
428d366
fix yet another example
simone-silvestri Feb 20, 2025
7c5e161
Merge branch 'main' into ss/one-degree-take3
simone-silvestri Feb 21, 2025
9cc0a77
gpu example
simone-silvestri Feb 21, 2025
79a9630
Merge branch 'ss/one-degree-take3' of github.com:CliMA/ClimaOcean.jl …
simone-silvestri Feb 21, 2025
b6501dc
update the clima common
simone-silvestri Feb 21, 2025
ab91378
allow scalar
simone-silvestri Feb 21, 2025
dd9a898
Update examples/one_degree_simulation.jl
simone-silvestri Feb 21, 2025
7271558
Update examples/one_degree_simulation.jl
simone-silvestri Feb 21, 2025
5d3e30f
Update src/OceanSimulations.jl
simone-silvestri Feb 21, 2025
37738ec
Update src/OceanSimulations.jl
simone-silvestri Feb 21, 2025
2870ab1
implement suggestions
simone-silvestri Feb 21, 2025
b5f8d61
implement suggestions
simone-silvestri Feb 21, 2025
a568275
add generate surface fluxes
simone-silvestri Feb 21, 2025
42c6f76
fix timesteps
simone-silvestri Feb 21, 2025
e10d62f
uff
simone-silvestri Feb 21, 2025
f1a603a
works?
simone-silvestri Feb 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ JLD2 = "0.4, 0.5"
KernelAbstractions = "0.9"
MPI = "0.20"
NCDatasets = "0.12, 0.13, 0.14"
Oceananigans = "0.94.3 - 0.99"
Oceananigans = "0.94.3 - 0.99" # This needs to be 0.94.4 when PolarBoundaryCondition is implemented
OffsetArrays = "1.14"
OrthogonalSphericalShellGrids = "0.1.8"
OrthogonalSphericalShellGrids = "0.1.9"
Scratch = "1"
SeawaterPolynomials = "0.3.4"
StaticArrays = "1"
Expand Down
2 changes: 1 addition & 1 deletion examples/generate_bathymetry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ grid = LatitudeLongitudeGrid(size = (Nλ, Nφ, 1),
# one interpolation passes and no restrictions on connected regions.
# - `h_smooth` shows the output of the function with 40 interpolation passes, which results
# in a smoother bathymetry.
# - `h_no_connected_regions` shows the output of the function with `connected_regions_allowed = 0`, which
# - `h_no_connected_regions` shows the output of the function with `major_basins = 1`, which
# means that the function does not allow connected regions in the bathymetry (e.g., lakes)
# and fills them with land.

Expand Down
8 changes: 6 additions & 2 deletions experiments/one_degree_simulation/one_degree_simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ grid = ImmersedBoundaryGrid(underlying_grid, GridFittedBottom(tampered_bottom_he

gm = Oceananigans.TurbulenceClosures.IsopycnalSkewSymmetricDiffusivity(κ_skew=1000, κ_symmetric=1000)
catke = ClimaOcean.OceanSimulations.default_ocean_closure()
viscous_closure = Oceananigans.TurbulenceClosures.HorizontalScalarDiffusivity(ν=2000)
viscous_closure = HorizontalScalarBiharmonicDiffusivity(ν = 1e11)

closure = (gm, catke, viscous_closure)

Expand Down Expand Up @@ -95,7 +95,7 @@ atmosphere = JRA55_prescribed_atmosphere(arch; backend=JRA55NetCDFBackend(20))
#####

coupled_model = OceanSeaIceModel(ocean; atmosphere, radiation)
simulation = Simulation(coupled_model; Δt=15minutes, stop_time=2*365days)
simulation = Simulation(coupled_model; Δt=2minutes, stop_time=30days)

#####
##### Run it!
Expand Down Expand Up @@ -127,3 +127,7 @@ end
add_callback!(simulation, progress, IterationInterval(10))

run!(simulation)

simulation.Δt = 25minutes

run!(simulation)
29 changes: 25 additions & 4 deletions src/OceanSimulations/OceanSimulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ using Oceananigans.TurbulenceClosures.TKEBasedVerticalDiffusivities:
CATKEEquation

using SeawaterPolynomials.TEOS10: TEOS10EquationOfState
using Statistics: mean

using Oceananigans.BuoyancyModels: g_Earth
using Oceananigans.Coriolis: Ω_Earth
Expand All @@ -42,10 +43,30 @@ default_or_override(override, alternative_default=nothing) = override
# Some defaults
default_free_surface(grid) = SplitExplicitFreeSurface(grid; cfl=0.7)

# 70 substeps is a safe rule of thumb for an ocean at 1/4 - 1/10th of a degree
# TODO: pass the cfl and a given Δt to calculate the number of substeps?
function infer_maximum_Δt(grid)
Δx = mean(xspacings(grid))
Δy = mean(yspacings(grid))
Δθ = rad2deg(mean([Δx, Δy])) / grid.radius

# The maximum Δt is roughly 40minutes / Δθ, giving:
# - 40 minutes for a 1 degree ocean
# - 20 minutes for a 1/4 degree ocean
# - 10 minutes for a 1/8 degree ocean
# - 5 minutes for a 1/16 degree ocean
# - 2.5 minutes for a 1/32 degree ocean

return 40minutes / Δθ
end

const TripolarOfSomeKind = Union{TripolarGrid, ImmersedBoundaryGrid{<:Any, <:Any, <:Any, <:Any, <:TripolarGrid}}
default_free_surface(grid::TripolarOfSomeKind) = SplitExplicitFreeSurface(grid; substeps=70)

function default_free_surface(grid::TripolarOfSomeKind;
fixed_Δt = infer_maximum_Δt(grid),
cfl = 0.7)
free_surface = SplitExplicitFreeSurface(grid; cfl, fixed_Δt)
@info "Using a $(free_surface)"
return free_surface
end

function default_ocean_closure()
mixing_length = CATKEMixingLength(Cᵇ=0.01)
Expand Down Expand Up @@ -75,7 +96,7 @@ default_tracer_advection() = FluxFormAdvection(WENO(order=7),
# TODO: Specify the grid to a grid on the sphere; otherwise we can provide a different
# function that requires latitude and longitude etc for computing coriolis=FPlane...
function ocean_simulation(grid;
Δt = 5minutes,
Δt = infer_maximum_Δt(grid),
closure = default_ocean_closure(),
tracers = (:T, :S),
free_surface = default_free_surface(grid),
Expand Down