Skip to content
Open
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
636 commits
Select commit Hold shift + click to select a range
7f1be57
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Oct 2, 2025
e5be8a3
Update src/Advection/reconstruction_coefficients.jl
simone-silvestri Oct 2, 2025
9b07df6
test this
simone-silvestri Oct 2, 2025
9fcfe54
add a conservation test for distributed architectures
simone-silvestri Oct 2, 2025
91c2d8d
bugfix
simone-silvestri Oct 3, 2025
d723abd
Update src/Models/HydrostaticFreeSurfaceModels/pcg_implicit_free_surf…
simone-silvestri Oct 3, 2025
7ca87ac
reintroduce WENO11
simone-silvestri Oct 3, 2025
c854bf4
adding coefficients
simone-silvestri Oct 3, 2025
91cc41a
Merge branch 'main' into ss/optimize-weno
simone-silvestri Oct 3, 2025
579b409
adding in the smoothness
simone-silvestri Oct 3, 2025
1ce4e4a
Merge branch 'ss/optimize-weno' of github.com:CliMA/Oceananigans.jl i…
simone-silvestri Oct 3, 2025
444f7b6
complete 11th order implementation
simone-silvestri Oct 3, 2025
97f8a70
Merge branch 'main' into ss/optimize-weno
simone-silvestri Oct 3, 2025
1062702
small test
simone-silvestri Oct 3, 2025
312f620
bugfix
simone-silvestri Oct 3, 2025
5b553e3
Merge branch 'ss/optimize-weno' of github.com:CliMA/Oceananigans.jl i…
simone-silvestri Oct 3, 2025
31c5d7a
another bugfix
simone-silvestri Oct 3, 2025
18873fc
fix all coefficients
simone-silvestri Oct 3, 2025
1d216f1
fix catke RK
simone-silvestri Oct 3, 2025
7f19f0f
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Oct 6, 2025
ed57c81
add order 11
simone-silvestri Oct 6, 2025
e49ba2b
added the different schemes
simone-silvestri Oct 6, 2025
c531a7e
bugfix
simone-silvestri Oct 6, 2025
c026077
fix all tests
simone-silvestri Oct 6, 2025
1a440fa
fixed all the orders
simone-silvestri Oct 6, 2025
9a7487c
fix all tests
simone-silvestri Oct 6, 2025
b455d76
try it like this
simone-silvestri Oct 6, 2025
1e83747
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Oct 6, 2025
54da012
some more changes
simone-silvestri Oct 6, 2025
a70b84c
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Oct 6, 2025
3465cd0
add sixth order also for immersed boundaries
simone-silvestri Oct 6, 2025
fe4c822
remove this for the moment
simone-silvestri Oct 6, 2025
51a6664
Merge branch 'main' into ss/optimize-weno
simone-silvestri Oct 7, 2025
de2b59f
ok this now works
simone-silvestri Oct 7, 2025
6aac95d
works for distributed
simone-silvestri Oct 7, 2025
637596d
remove the compute tendencies in update state
simone-silvestri Oct 8, 2025
599f392
start fixing up tests
simone-silvestri Oct 8, 2025
ec54de3
same formulation for AB2
simone-silvestri Oct 8, 2025
6718991
this works
simone-silvestri Oct 8, 2025
2826f9b
do not compute tendencies in the shallow water
simone-silvestri Oct 8, 2025
40d7eed
back to how it was
simone-silvestri Oct 8, 2025
e1589e5
rmeove the storage space
simone-silvestri Oct 8, 2025
6378637
integers instead of floats
simone-silvestri Oct 8, 2025
b354f4a
all integers
simone-silvestri Oct 8, 2025
4f89324
some space
simone-silvestri Oct 8, 2025
fe84adf
test like this
simone-silvestri Oct 8, 2025
0bdf00d
try with Int32
simone-silvestri Oct 8, 2025
c164206
more improvements
simone-silvestri Oct 8, 2025
5064482
more updates
simone-silvestri Oct 8, 2025
0aa1f3a
commnt
simone-silvestri Oct 8, 2025
2d9cbca
fix zstar tests
simone-silvestri Oct 8, 2025
2dba4cb
add also AB2
simone-silvestri Oct 8, 2025
bf99394
Merge branch 'main' into ss/optimize-weno
simone-silvestri Oct 9, 2025
1559975
chnage the example for the moment
simone-silvestri Oct 9, 2025
4b62ae3
limit correctly the scheme
simone-silvestri Oct 9, 2025
2280a4f
new changes
simone-silvestri Oct 9, 2025
89ad73d
small mistake
simone-silvestri Oct 9, 2025
59a51ad
Merge remote-tracking branch 'origin/ss/optimize-weno' into ss/reform…
simone-silvestri Oct 9, 2025
57a0381
we step the tracers at the end
simone-silvestri Oct 9, 2025
1d08364
Merge branch 'main' into ss/optimize-weno
simone-silvestri Oct 9, 2025
6979dbb
why would this slow down?
simone-silvestri Oct 9, 2025
055dda8
why is this not running?
simone-silvestri Oct 9, 2025
abe8fe8
go back to upwind
simone-silvestri Oct 9, 2025
c09d818
improve the benchmark
simone-silvestri Oct 10, 2025
8cb8e17
improve benchmarks
simone-silvestri Oct 10, 2025
632b76f
not sure why this was different...
simone-silvestri Oct 10, 2025
7def910
Merge branch 'main' into ss/improve-benchmarks-pipeline
simone-silvestri Oct 10, 2025
91317f4
Allow scalar assignment in benchmark tests
simone-silvestri Oct 10, 2025
c4d3141
Merge remote-tracking branch 'origin/ss/improve-benchmarks-pipeline' …
simone-silvestri Oct 10, 2025
a087afe
this is the correct way to do it
simone-silvestri Oct 10, 2025
4cf6043
Merge branch 'main' into ss/optimize-weno
simone-silvestri Oct 11, 2025
edf54df
Merge branch 'main' into ss/optimize-weno
simone-silvestri Oct 13, 2025
4ae301c
correct
simone-silvestri Oct 13, 2025
52bfc01
changes
simone-silvestri Oct 13, 2025
6dfe3ed
bugfix
simone-silvestri Oct 13, 2025
9463b78
comment
simone-silvestri Oct 13, 2025
19a13f5
add the bias
simone-silvestri Oct 13, 2025
62d01ba
Merge branch 'main' into ss/optimize-weno
simone-silvestri Oct 13, 2025
656f44a
mask correct fields
simone-silvestri Oct 13, 2025
ae8803a
introduce correct biases
simone-silvestri Oct 13, 2025
89f5814
this should work
simone-silvestri Oct 13, 2025
c301878
Merge remote-tracking branch 'origin/ss/optimize-weno' into ss/reform…
simone-silvestri Oct 13, 2025
39767b2
immersed order
simone-silvestri Oct 13, 2025
c520979
immersed order
simone-silvestri Oct 13, 2025
60031e3
disambiguate
simone-silvestri Oct 13, 2025
611b5da
make sure this works
simone-silvestri Oct 13, 2025
7c5596c
abstract underlying grid
simone-silvestri Oct 13, 2025
ccf6747
6th order...
simone-silvestri Oct 13, 2025
948d003
fix bugs
simone-silvestri Oct 13, 2025
6bda30e
Update src/Advection/weno_coefficients.jl
simone-silvestri Oct 13, 2025
8461f1b
fill halo every time
simone-silvestri Oct 13, 2025
4b2f590
bugfix
simone-silvestri Oct 13, 2025
41f957d
bugfix
simone-silvestri Oct 13, 2025
a7a9c6f
fill halo in correct spot
simone-silvestri Oct 13, 2025
69c25b5
comment
simone-silvestri Oct 13, 2025
52e0c2d
back to how it was
simone-silvestri Oct 14, 2025
39057c9
fix the tests
simone-silvestri Oct 14, 2025
f87c5c2
Merge branch 'ss/optimize-weno' of github.com:CliMA/Oceananigans.jl i…
simone-silvestri Oct 14, 2025
c9fb757
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Oct 14, 2025
1e3fed5
introduce cache tendencies
simone-silvestri Oct 14, 2025
ca8bb2f
Merge branch 'ss/optimize-weno' into ss/reformulate-hydrostatic-model-2
simone-silvestri Oct 14, 2025
fb21894
cache field tendencies
simone-silvestri Oct 14, 2025
3ea0694
cache field tendencies
simone-silvestri Oct 14, 2025
e7d1c18
do not compute tendencies
simone-silvestri Oct 14, 2025
3926e60
add also shallow water
simone-silvestri Oct 14, 2025
fe97699
correct the implicit solver
simone-silvestri Oct 14, 2025
ce5367e
add the caching
simone-silvestri Oct 14, 2025
88b5015
moew bugfixes
simone-silvestri Oct 14, 2025
b18adb9
add fields(model)
simone-silvestri Oct 14, 2025
1cae6d6
go back to previous advection
simone-silvestri Oct 14, 2025
3810d84
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Oct 14, 2025
40a5bb7
try this
simone-silvestri Oct 15, 2025
6bd3fb1
fix a couple of tests
simone-silvestri Oct 17, 2025
8a09ceb
back to how it was
simone-silvestri Oct 17, 2025
bb139d2
Merge remote-tracking branch 'origin/main' into ss/reformulate-hydros…
simone-silvestri Oct 17, 2025
d7b22af
show condition
simone-silvestri Oct 17, 2025
9853d65
send it
simone-silvestri Oct 17, 2025
17b1fac
more tests
simone-silvestri Oct 17, 2025
0676e44
comment
simone-silvestri Oct 17, 2025
fbbe5fe
fix the geostrophic adjustment
simone-silvestri Oct 17, 2025
a7469c8
correct
simone-silvestri Oct 17, 2025
5f05381
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Oct 20, 2025
637daa7
not yet
simone-silvestri Oct 20, 2025
1b63922
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Oct 20, 2025
87d53c5
more changes
simone-silvestri Oct 20, 2025
c3446d2
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Oct 25, 2025
2f62b9e
remove QAB2 conservation testset
simone-silvestri Oct 27, 2025
692ac92
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Oct 27, 2025
dbc37f8
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Oct 27, 2025
915ec93
back to this default
simone-silvestri Oct 27, 2025
c492ed1
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Oct 27, 2025
92173d9
fix another bug
simone-silvestri Oct 27, 2025
48eb436
fix shallow water
simone-silvestri Oct 27, 2025
496362e
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 2, 2025
85d9b16
no need to compute these tendencies
simone-silvestri Nov 3, 2025
62727ae
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Nov 3, 2025
4fa5fbb
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 6, 2025
da583c2
get it working
simone-silvestri Nov 6, 2025
0c86818
all the pipelines
simone-silvestri Nov 6, 2025
9e634c9
should work also for multi region
simone-silvestri Nov 6, 2025
07e4126
cannot use the ; syntax
simone-silvestri Nov 6, 2025
011fb2f
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 6, 2025
005599c
fill halo regions
simone-silvestri Nov 7, 2025
208faaf
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Nov 7, 2025
094f8b8
add this
simone-silvestri Nov 10, 2025
789bb87
bugfix
simone-silvestri Nov 10, 2025
25c43d6
change stuff
simone-silvestri Nov 10, 2025
b385557
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 10, 2025
924a7c5
add a pressure-correction method
simone-silvestri Nov 10, 2025
721cbc6
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Nov 10, 2025
e3932c1
go ahead
simone-silvestri Nov 10, 2025
af1be45
back to runge kutta3
simone-silvestri Nov 10, 2025
95306a2
do not import this
simone-silvestri Nov 10, 2025
1ddffd5
this should work
simone-silvestri Nov 10, 2025
ab35b5e
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 10, 2025
d56459d
another bugfix
simone-silvestri Nov 10, 2025
cf851ab
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Nov 10, 2025
cb645d2
removing one naturalsort
simone-silvestri Nov 10, 2025
5d1bfcc
include the correct file
simone-silvestri Nov 10, 2025
cc9f4d9
another bugfix
simone-silvestri Nov 10, 2025
c186099
fix more tests
simone-silvestri Nov 10, 2025
1cd8901
other bugfixes
simone-silvestri Nov 10, 2025
48a6a9a
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 11, 2025
bc09587
changes
simone-silvestri Nov 11, 2025
dcd9c1e
Merge remote-tracking branch 'origin/main' into ss/reformulate-hydros…
simone-silvestri Nov 11, 2025
e2d4271
Merge remote-tracking branch 'origin/main' into ss/reformulate-hydros…
simone-silvestri Nov 11, 2025
eb23f1a
Merge remote-tracking branch 'origin/main' into ss/reformulate-hydros…
simone-silvestri Nov 11, 2025
dd457a1
closure fields
simone-silvestri Nov 11, 2025
49af9a6
disambiguate
simone-silvestri Nov 13, 2025
468d0d2
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 13, 2025
dc78ab1
ok this works
simone-silvestri Nov 13, 2025
6ad45a2
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Nov 13, 2025
ec87bfc
fix reactant tests
simone-silvestri Nov 13, 2025
e1989b9
bugfix reactant tests
simone-silvestri Nov 13, 2025
00eac5b
distributed tests should now pass
simone-silvestri Nov 13, 2025
76dfc39
split into two pipelines
simone-silvestri Nov 13, 2025
1cadd63
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 13, 2025
f1f2139
do not add a reference yet
simone-silvestri Nov 13, 2025
b5cd59d
no need to add the extra "distributed" qualifier
simone-silvestri Nov 13, 2025
fde66c3
let's test a mutable vertical discretization
simone-silvestri Nov 13, 2025
88df51d
test also conservation in distributed grids
simone-silvestri Nov 13, 2025
b296f60
not supported implicit stuff
simone-silvestri Nov 13, 2025
68fb457
more conservation tests
simone-silvestri Nov 13, 2025
b2b2f23
fix the conservation tests
simone-silvestri Nov 13, 2025
bc8d70a
correct distributed tests
simone-silvestri Nov 13, 2025
abe45ae
uff
simone-silvestri Nov 13, 2025
b7c8790
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 13, 2025
9a264f2
fix multi-region
simone-silvestri Nov 13, 2025
b8a6dc4
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Nov 13, 2025
d3f0da8
add more tests
simone-silvestri Nov 13, 2025
9423a5c
another bugfix
simone-silvestri Nov 13, 2025
e9ef09a
test like this
simone-silvestri Nov 13, 2025
1fc6a47
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 14, 2025
3c656de
put apply regionally where it matters
simone-silvestri Nov 14, 2025
0b0db8e
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Nov 14, 2025
e97112c
reduce the number of conservation tests
simone-silvestri Nov 14, 2025
6319ad7
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 14, 2025
591abc7
barotropic U
simone-silvestri Nov 15, 2025
e1d3d29
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 15, 2025
c1a3e05
U and V correction
simone-silvestri Nov 15, 2025
34a9152
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Nov 15, 2025
090c952
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 16, 2025
d861213
make sure times is on a CPU
simone-silvestri Nov 16, 2025
0e2ddd4
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Nov 16, 2025
231609b
make sure everything is initialized correctly
simone-silvestri Nov 17, 2025
ec6e017
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Nov 17, 2025
f43184d
correct the signature
simone-silvestri Nov 17, 2025
86802dd
use more time
simone-silvestri Nov 17, 2025
5ab1649
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Nov 17, 2025
ea0b4ab
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Nov 18, 2025
e723e63
Merge remote-tracking branch 'origin/main' into ss/reformulate-hydros…
simone-silvestri Nov 18, 2025
7e01ffe
reinclude split explicit tests
simone-silvestri Nov 18, 2025
4c3cb39
try this thing
simone-silvestri Nov 18, 2025
a822cea
more changes
simone-silvestri Nov 18, 2025
15e71d7
Revert "more changes"
simone-silvestri Nov 18, 2025
2c4351d
Revert "try this thing"
simone-silvestri Nov 18, 2025
cb3df35
change the set!
simone-silvestri Nov 18, 2025
e301041
bugfix
simone-silvestri Nov 18, 2025
70f09c4
some more changes
simone-silvestri Nov 18, 2025
42ae91d
retry the tests
simone-silvestri Nov 18, 2025
567cfcb
update fts
simone-silvestri Nov 19, 2025
b60f037
go ahead
simone-silvestri Nov 27, 2025
fc1ae37
Merge remote-tracking branch 'origin/main' into ss/reformulate-hydros…
simone-silvestri Nov 27, 2025
6166c77
remove some imports
simone-silvestri Nov 27, 2025
36b8d0c
Merge remote-tracking branch 'origin/main' into ss/reformulate-hydros…
simone-silvestri Nov 27, 2025
04c390f
Update src/OrthogonalSphericalShellGrids/distributed_zipper.jl
simone-silvestri Dec 1, 2025
a5cf3d9
Update src/Oceananigans.jl
simone-silvestri Dec 1, 2025
cbd762f
Update Project.toml
simone-silvestri Dec 1, 2025
7b08ad6
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Dec 1, 2025
ed48f71
bugfix
simone-silvestri Dec 2, 2025
536a884
add the xflat grid and yflat grid
simone-silvestri Dec 2, 2025
deb91e2
remove the shows
simone-silvestri Dec 2, 2025
f579e62
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Dec 3, 2025
c9d0694
bugfix
simone-silvestri Dec 3, 2025
4357daa
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Dec 3, 2025
2b20f17
Merge branch 'main' into ss/reformulate-hydrostatic-model-2
simone-silvestri Dec 4, 2025
9e331a4
some cleanup
simone-silvestri Dec 4, 2025
94ff01f
Merge branch 'ss/reformulate-hydrostatic-model-2' of github.com:CliMA…
simone-silvestri Dec 4, 2025
a2c58f7
start fixing up tests
simone-silvestri Dec 4, 2025
dab4d1f
only distributed zstar tests remaining
simone-silvestri Dec 4, 2025
6430b6d
bugfix the nonhydrostatic model
simone-silvestri Dec 4, 2025
a075728
some updates
simone-silvestri Dec 4, 2025
3ac2181
this was not the cause
simone-silvestri Dec 4, 2025
6669f2d
add the free surface
simone-silvestri Dec 4, 2025
c981828
adding more distributed tests
simone-silvestri Dec 4, 2025
c8cac57
bugfix
simone-silvestri Dec 4, 2025
4662431
radius should not be 1 if z goes to -1!
simone-silvestri Dec 4, 2025
0eb35af
will this change stuff?
simone-silvestri Dec 4, 2025
abc7b4f
just a check
simone-silvestri Dec 4, 2025
f0133cc
not sure why this would pass locally and not on buildkite
simone-silvestri Dec 5, 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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ TimesDates = "bdfc003b-8df8-5c39-adcd-3a9087f5df4a"
oneAPI = "8f75cd03-7ff8-4ecb-9b8f-daf728133b1b"

[targets]
test = ["AMDGPU", "CUDA", "oneAPI", "DataDeps", "SafeTestsets", "Test", "Enzyme", "Reactant", "Metal", "CUDA_Runtime_jll", "MPIPreferences", "TimesDates", "NCDatasets"]
test = ["AMDGPU", "CUDA", "oneAPI", "DataDeps", "SafeTestsets", "Test", "Enzyme", "Reactant", "Metal", "CUDA_Runtime_jll", "MPIPreferences", "TimesDates", "NCDatasets"]
2 changes: 2 additions & 0 deletions src/DistributedComputations/distributed_grids.jl
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,14 @@ end
function scatter_local_grids(global_grid::RectilinearGrid, arch::Distributed, local_size)
x, y, z, topo, halo = scatter_grid_properties(global_grid)
global_sz = global_size(arch, local_size)
global_sz = pop_flat_elements(global_sz, topo)
return RectilinearGrid(arch, eltype(global_grid); size=global_sz, x=x, y=y, z=z, halo=halo, topology=topo)
end

function scatter_local_grids(global_grid::LatitudeLongitudeGrid, arch::Distributed, local_size)
x, y, z, topo, halo = scatter_grid_properties(global_grid)
global_sz = global_size(arch, local_size)
global_sz = pop_flat_elements(global_sz, topo)
return LatitudeLongitudeGrid(arch, eltype(global_grid); size=global_sz, longitude=x,
latitude=y, z=z, halo=halo, topology=topo, radius=global_grid.radius)
end
Expand Down
10 changes: 10 additions & 0 deletions src/ImmersedBoundaries/mutable_immersed_grid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ const MutableGridOfSomeKind = Union{MutableImmersedGrid, AbstractMutableGrid}
@inline column_depthᶠᶜᵃ(i, j, grid::MutableGridOfSomeKind) = column_depthᶠᶜᵃ(i, j, 1, grid, grid.z.ηⁿ)
@inline column_depthᶠᶠᵃ(i, j, grid::MutableGridOfSomeKind) = column_depthᶠᶠᵃ(i, j, 1, grid, grid.z.ηⁿ)

@inline column_depthᶜᶜᵃ(i, j, k, grid) = static_column_depthᶜᶜᵃ(i, j, grid)
@inline column_depthᶜᶠᵃ(i, j, k, grid) = static_column_depthᶜᶠᵃ(i, j, grid)
@inline column_depthᶠᶜᵃ(i, j, k, grid) = static_column_depthᶠᶜᵃ(i, j, grid)
@inline column_depthᶠᶠᵃ(i, j, k, grid) = static_column_depthᶠᶠᵃ(i, j, grid)

@inline column_depthᶜᶜᵃ(i, j, k, grid::MutableGridOfSomeKind) = column_depthᶜᶜᵃ(i, j, 1, grid, grid.z.ηⁿ)
@inline column_depthᶜᶠᵃ(i, j, k, grid::MutableGridOfSomeKind) = column_depthᶜᶠᵃ(i, j, 1, grid, grid.z.ηⁿ)
@inline column_depthᶠᶜᵃ(i, j, k, grid::MutableGridOfSomeKind) = column_depthᶠᶜᵃ(i, j, 1, grid, grid.z.ηⁿ)
@inline column_depthᶠᶠᵃ(i, j, k, grid::MutableGridOfSomeKind) = column_depthᶠᶠᵃ(i, j, 1, grid, grid.z.ηⁿ)

# Fallbacks
@inline σⁿ(i, j, k, ibg::IBG, ℓx, ℓy, ℓz) = σⁿ(i, j, k, ibg.underlying_grid, ℓx, ℓy, ℓz)
@inline σ⁻(i, j, k, ibg::IBG, ℓx, ℓy, ℓz) = σ⁻(i, j, k, ibg.underlying_grid, ℓx, ℓy, ℓz)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,50 @@ import Oceananigans: fields, prognostic_fields, initialize!
import Oceananigans.Advection: cell_advection_timescale
import Oceananigans.TimeSteppers: step_lagrangian_particles!
import Oceananigans.Architectures: on_architecture
import Oceananigans.BoundaryConditions: fill_halo_regions!

using Oceananigans.TimeSteppers: SplitRungeKutta3TimeStepper, QuasiAdamsBashforth2TimeStepper

abstract type AbstractFreeSurface{E, G} end

struct ZCoordinate end

struct ZStarCoordinate{CC}
fill_halo_regions!(ztype::ZCoordinate; kwargs...) = nothing

struct ZStarCoordinate{CC} #, FC, CF, FF, H}
storage :: CC # Storage space used in different ways by different timestepping schemes.
# σᶜᶜⁿ :: CC
# σᶠᶜⁿ :: FC
# σᶜᶠⁿ :: CF
# σᶠᶠⁿ :: FF
# σᶜᶜ⁻ :: CC
# ∂t_σ :: CC
# ηⁿ :: H
end

function ZStarCoordinate(grid::AbstractGrid)
storage = Field{Center, Center, Nothing}(grid)
# σᶜᶜⁿ = Field{Center, Center, Nothing}(grid; data=grid.z.σᶜᶜⁿ)
# σᶠᶜⁿ = Field{Face, Center, Nothing}(grid; data=grid.z.σᶠᶜⁿ)
# σᶜᶠⁿ = Field{Center, Face, Nothing}(grid; data=grid.z.σᶜᶠⁿ)
# σᶠᶠⁿ = Field{Face, Face, Nothing}(grid; data=grid.z.σᶠᶠⁿ)
# σᶜᶜ⁻ = Field{Center, Center, Nothing}(grid; data=grid.z.σᶜᶜ⁻)
# ∂t_σ = Field{Center, Center, Nothing}(grid; data=grid.z.∂t_σ)
# ηⁿ = Field{Center, Center, Nothing}(grid; data=grid.z.ηⁿ )
return ZStarCoordinate(storage) #, σᶜᶜⁿ, σᶠᶜⁿ, σᶜᶠⁿ, σᶠᶠⁿ, σᶜᶜ⁻, ∂t_σ, ηⁿ)
end

ZStarCoordinate(grid::AbstractGrid) = ZStarCoordinate(Field{Center, Center, Nothing}(grid))
function fill_halo_regions!(ztype::ZStarCoordinate; kwargs...)
fill_halo_regions!(ztype.storage; kwargs...)
fill_halo_regions!(ztype.σᶜᶜⁿ; kwargs...)
fill_halo_regions!(ztype.σᶠᶜⁿ; kwargs...)
fill_halo_regions!(ztype.σᶜᶠⁿ; kwargs...)
fill_halo_regions!(ztype.σᶠᶠⁿ; kwargs...)
fill_halo_regions!(ztype.σᶜᶜ⁻; kwargs...)
fill_halo_regions!(ztype.∂t_σ; kwargs...)
fill_halo_regions!(ztype.ηⁿ; kwargs...)
return nothing
end

Base.summary(::ZStarCoordinate) = "ZStarCoordinate"
Base.show(io::IO, c::ZStarCoordinate) = print(io, summary(c))
Expand All @@ -50,8 +82,31 @@ free_surface_displacement_field(velocities, ::Nothing, grid) = nothing

# free surface initialization functions
initialize_free_surface!(free_surface, grid, velocities) = nothing
compute_transport_velocities!(model, free_surface) = nothing

# If U and V exist, we use them
@inline barotropic_U(i, j, k, grid, U, u) = @inbounds U[i, j, k]
@inline barotropic_V(i, j, k, grid, V, v) = @inbounds V[i, j, k]

# If either U or V are not available, we compute them
@inline function barotropic_U(i, j, k, grid, ::Nothing, u)
U = 0
for k′ in 1:size(grid, 3)
@inbounds U += u[i, j, k′] * Δzᶠᶜᶜ(i, j, k′, grid)
end
return U
end

@inline function barotropic_V(i, j, k, grid, ::Nothing, v)
V = 0
for k′ in 1:size(grid, 3)
@inbounds V += v[i, j, k′] * Δzᶜᶠᶜ(i, j, k′, grid)
end
return V
end

include("compute_w_from_continuity.jl")
include("hydrostatic_free_surface_field_tuples.jl")

# No free surface
include("nothing_free_surface.jl")
Expand All @@ -71,6 +126,12 @@ include("hydrostatic_free_surface_field_tuples.jl")
include("SplitExplicitFreeSurfaces/SplitExplicitFreeSurfaces.jl")
using .SplitExplicitFreeSurfaces

# Implicit free-surface solver functionality
include("implicit_free_surface_utils.jl")
include("fft_based_implicit_free_surface_solver.jl")
include("pcg_implicit_free_surface_solver.jl")
include("implicit_free_surface.jl")

# ZStarCoordinate implementation
include("z_star_vertical_spacing.jl")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ using Oceananigans.ImmersedBoundaries
using Oceananigans.Grids: AbstractGrid, topology
using Oceananigans.ImmersedBoundaries: linear_index_to_tuple, mask_immersed_field!
using Oceananigans.Models.HydrostaticFreeSurfaceModels: AbstractFreeSurface,
free_surface_displacement_field
free_surface_displacement_field,
update_vertical_velocities!

using Adapt
using Base
Expand All @@ -31,6 +32,7 @@ import Oceananigans.Models.HydrostaticFreeSurfaceModels: initialize_free_surface
materialize_free_surface,
step_free_surface!,
compute_free_surface_tendency!,
compute_transport_velocities!,
explicit_barotropic_pressure_x_gradient,
explicit_barotropic_pressure_y_gradient

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function barotropic_split_explicit_corrector!(u, v, free_surface, grid)
state = free_surface.filtered_state
η = free_surface.η
U, V = free_surface.barotropic_velocities
U̅, V̅ = state.U, state.V
U̅, V̅ = state., state.
arch = architecture(grid)

# NOTE: the filtered `U̅` and `V̅` have been copied in the instantaneous `U` and `V`,
Expand All @@ -54,4 +54,37 @@ end
end
end

@kernel function _compute_transport_velocities!(ũ, ṽ, grid, Ũ, Ṽ, u, v, U̅, V̅)
i, j = @index(Global, NTuple)

for k in 1:size(grid, 3)
@inline ũ[i, j, k] = u[i, j, k] + (Ũ[i, j, 1] - U̅[i, j, 1]) / column_depthᶠᶜᵃ(i, j, grid)
@inline ṽ[i, j, k] = v[i, j, k] + (Ṽ[i, j, 1] - V̅[i, j, 1]) / column_depthᶜᶠᵃ(i, j, grid)
end
end

function compute_transport_velocities!(model, free_surface::SplitExplicitFreeSurface)
grid = model.grid
u, v, _ = model.velocities
ũ, ṽ, _ = model.transport_velocities
Ũ = free_surface.filtered_state.Ũ
Ṽ = free_surface.filtered_state.Ṽ
U̅ = free_surface.filtered_state.U̅
V̅ = free_surface.filtered_state.V̅

compute_barotropic_mode!(U̅, V̅, grid, u, v)

launch!(architecture(grid), grid, :xy,
_compute_transport_velocities!, ũ, ṽ, grid, Ũ, Ṽ, u, v, U̅, V̅)

mask_immersed_field!(ũ)
mask_immersed_field!(ṽ)

# Fill barotropic stuff...
fill_halo_regions!((ũ, ṽ); async=true)

# Update grid velocity and vertical transport velocity
update_vertical_velocities!(model.transport_velocities, model.grid, model)

return nothing
end
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,9 @@ end
@inbounds GVⁿ[i, j, 1] = G_vertical_integral(i, j, grid, Gvⁿ, Center(), Face(), Center())
end

@inline function compute_split_explicit_forcing!(GUⁿ, GVⁿ, grid, Guⁿ, Gvⁿ, timestepper::SplitRungeKutta3TimeStepper)

active_cells_map = get_active_column_map(grid)
@inline compute_split_explicit_forcing!(GUⁿ, GVⁿ, grid, Guⁿ, Gvⁿ, ::SplitRungeKutta3TimeStepper) =
launch!(architecture(grid), grid, :xy, _compute_integrated_rk3_tendencies!,
GUⁿ, GVⁿ, grid, Guⁿ, Gvⁿ; active_cells_map)

return nothing
end
GUⁿ, GVⁿ, grid, Guⁿ, Gvⁿ; active_cells_map = get_active_column_map(grid))

#####
##### Free surface setup
Expand All @@ -93,9 +88,7 @@ function compute_free_surface_tendency!(grid, model, ::SplitExplicitFreeSurface)
baroclinic_timestepper = model.timestepper

@apply_regionally compute_split_explicit_forcing!(GUⁿ, GVⁿ, grid, Guⁿ, Gvⁿ, baroclinic_timestepper)

fields_to_fill = (GUⁿ, GVⁿ)
fill_halo_regions!(fields_to_fill; async=true)
fill_halo_regions!((GUⁿ, GVⁿ); async=true)

return nothing
end
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ function initialize_free_surface_state!(free_surface, baroclinic_timestepper, ti

initialize_free_surface_timestepper!(timestepper, η, U, V)

fill!(free_surface.filtered_state.η, 0)
fill!(free_surface.filtered_state.U, 0)
fill!(free_surface.filtered_state.V, 0)
fill!(free_surface.filtered_state.η̅, 0)
fill!(free_surface.filtered_state.U̅, 0)
fill!(free_surface.filtered_state.V̅, 0)
fill!(free_surface.filtered_state.Ũ, 0)
fill!(free_surface.filtered_state.Ṽ, 0)

return nothing
end
Expand All @@ -58,9 +60,11 @@ function initialize_free_surface_state!(free_surface, baroclinic_ts::SplitRungeK

initialize_free_surface_timestepper!(barotropic_ts, η, U, V)

fill!(free_surface.filtered_state.η, 0)
fill!(free_surface.filtered_state.U, 0)
fill!(free_surface.filtered_state.V, 0)
fill!(free_surface.filtered_state.η̅, 0)
fill!(free_surface.filtered_state.U̅, 0)
fill!(free_surface.filtered_state.V̅, 0)
fill!(free_surface.filtered_state.Ũ, 0)
fill!(free_surface.filtered_state.Ṽ, 0)

return nothing
end
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function SplitExplicitFreeSurface(grid = nothing;
substeps = nothing,
cfl = nothing,
fixed_Δt = nothing,
averaging_kernel = averaging_shape_function,
averaging_kernel = cosine_averaging_kernel, # averaging_shape_function, #
timestepper = ForwardBackwardScheme())

if !isnothing(grid)
Expand Down Expand Up @@ -121,8 +121,8 @@ end
# Simplest case: we have the substeps and the averaging kernel
function split_explicit_substepping(::Nothing, substeps, fixed_Δt, grid, averaging_kernel, gravitational_acceleration)
FT = eltype(gravitational_acceleration)
fractional_step_size, averaging_weights = weights_from_substeps(FT, substeps, averaging_kernel)
return FixedSubstepNumber(fractional_step_size, averaging_weights)
fractional_step_size, averaging_weights, transport_weights = weights_from_substeps(FT, substeps, averaging_kernel)
return FixedSubstepNumber(fractional_step_size, averaging_weights, transport_weights)
end

# The substeps are calculated dynamically when a cfl without a fixed_Δt is provided
Expand Down Expand Up @@ -206,8 +206,10 @@ function materialize_free_surface(free_surface::SplitExplicitFreeSurface, veloci

U̅ = Field{Face, Center, Nothing}(maybe_extended_grid, boundary_conditions = u_bcs)
V̅ = Field{Center, Face, Nothing}(maybe_extended_grid, boundary_conditions = v_bcs)
Ũ = Field{Face, Center, Nothing}(maybe_extended_grid, boundary_conditions = u_bcs)
Ṽ = Field{Center, Face, Nothing}(maybe_extended_grid, boundary_conditions = v_bcs)

filtered_state = (η = η̅, U = U̅, V = V̅)
filtered_state = (η̅ = η̅, = U̅, = V̅, Ũ = Ũ, Ṽ = Ṽ)
barotropic_velocities = (U = U, V = V)

kernel_parameters = maybe_augmented_kernel_parameters(TX, TY, substepping, maybe_extended_grid)
Expand All @@ -225,9 +227,8 @@ function materialize_free_surface(free_surface::SplitExplicitFreeSurface, veloci
end

# (p = 2, q = 4, r = 0.18927) minimize dispersion error from Shchepetkin and McWilliams (2005): https://doi.org/10.1016/j.ocemod.2004.08.002
@inline function averaging_shape_function(τ::FT; p = 2, q = 4, r = FT(0.18927)) where FT
@inline function averaging_shape_function(τ::FT; p = 2, q = 4, r = FT(0.18927)) where FT #0.12)) where FT
τ₀ = (p + 2) * (p + q + 2) / (p + 1) / (p + q + 1)

return (τ / τ₀)^p * (1 - (τ / τ₀)^q) - r * (τ / τ₀)
end

Expand All @@ -246,6 +247,7 @@ a fixed number of substeps with time step size of `fractional_step_size * Δt_ba
struct FixedSubstepNumber{B, F}
fractional_step_size :: B
averaging_weights :: F
transport_weights :: F
end

function FixedTimeStepSize(grid;
Expand All @@ -267,18 +269,26 @@ function FixedTimeStepSize(grid;
end

@inline function weights_from_substeps(FT, substeps, averaging_kernel)

M = substeps ÷ 2
τᶠ = range(FT(0), FT(2), length = substeps+1)
Δτ = τᶠ[2] - τᶠ[1]

averaging_weights = map(averaging_kernel, τᶠ[2:end])
idx = searchsortedlast(averaging_weights, 0, rev=true)
substeps = idx
M★ = substeps

# Find the latest allowable weight
for i in substeps:-1:1
if averaging_weights[i] > 0
M★ = i
break
end
end

averaging_weights = averaging_weights[1:idx]
averaging_weights = averaging_weights[1:M★]
averaging_weights ./= sum(averaging_weights)
transport_weights = [sum(averaging_weights[i:M★]) for i in 1:M★] ./ M

return Δτ, map(FT, tuple(averaging_weights...))
return Δτ, map(FT, tuple(averaging_weights...)), map(FT, tuple(transport_weights...))
end

Base.summary(s::FixedTimeStepSize) = string("FixedTimeStepSize($(prettytime(s.Δt_barotropic)))")
Expand All @@ -299,7 +309,7 @@ function maybe_extend_halos(TX, TY, grid, substepping::FixedSubstepNumber)

old_halos = halo_size(grid)
Nsubsteps = length(substepping.averaging_weights)
step_halo = Nsubsteps + 1
step_halo = Nsubsteps+2

Hx = TX() isa ConnectedTopology ? max(step_halo, old_halos[1]) : old_halos[1]
Hy = TY() isa ConnectedTopology ? max(step_halo, old_halos[2]) : old_halos[2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,14 @@ end
@inline η★(i, j, k, grid, ::ForwardBackwardScheme, ηᵐ⁺¹) = @inbounds ηᵐ⁺¹[i, j, k]
@inline η★(i, j, k, grid, t::AdamsBashforth3Scheme, ηᵐ⁺¹) = @inbounds t.δ * ηᵐ⁺¹[i, j, k] + t.μ * t.ηᵐ[i, j, k] + t.γ * t.ηᵐ⁻¹[i, j, k] + t.ϵ * t.ηᵐ⁻²[i, j, k]

@inline cache_previous_velocities!(::ForwardBackwardScheme, i, j, k, U) = nothing
@inline cache_previous_free_surface!(::ForwardBackwardScheme, i, j, k, η) = nothing
@inline cache_previous_velocities!(::ForwardBackwardScheme, i, j, k, U, V) = nothing
@inline cache_previous_free_surface!(::ForwardBackwardScheme, i, j, k, η) = nothing

@inline function cache_previous_velocities!(t::AdamsBashforth3Scheme, i, j, k, U)
@inline function cache_previous_velocities!(t::AdamsBashforth3Scheme, i, j, k, U, V)
@inbounds t.Uᵐ⁻²[i, j, k] = t.Uᵐ⁻¹[i, j, k]
@inbounds t.Uᵐ⁻¹[i, j, k] = U[i, j, k]
@inbounds t.Vᵐ⁻²[i, j, k] = t.Vᵐ⁻¹[i, j, k]
@inbounds t.Vᵐ⁻¹[i, j, k] = V[i, j, k]

return nothing
end
Expand Down
Loading
Loading