Skip to content

Do not restrict bathymetry #335

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

Merged
merged 11 commits into from
Mar 5, 2025
Merged

Do not restrict bathymetry #335

merged 11 commits into from
Mar 5, 2025

Conversation

simone-silvestri
Copy link
Collaborator

With CliMA/Oceananigans.jl#4074 we can do domains that cross the 0 in longitude, so we do not really need to restrict the bathymetry.

TODO: after merging the Oceananigans PR, show that we can do a Mediterranean simulation that includes Gibraltar strait.

@glwagner
Copy link
Member

I put the restricting in as a performance consideration, not because we are using different coordinate systems.

@simone-silvestri
Copy link
Collaborator Author

simone-silvestri commented Feb 13, 2025

Right, but this restriction limits us from doing stuff like:

julia> grid = LatitudeLongitudeGrid(size = (1000, 500, 100),
                                    latitude  = (0, 60),
                                    longitude = (-15, 50),
                                    z = (-6000, 0))
1000×500×100 LatitudeLongitudeGrid{Float64, Bounded, Bounded, Bounded} on CPU with 3×3×3 halo and with precomputed metrics
├── longitude: Bounded  λ  [-15.0, 50.0]  regularly spaced with Δλ=0.065
├── latitude:  Bounded  φ  [0.0, 60.0]    regularly spaced with Δφ=0.12
└── z:         Bounded  z  [-6000.0, 0.0] regularly spaced with Δz=60.0

julia> bottom = regrid_bathymetry(grid, major_basins=Inf)
1000×500×1 Field{Center, Center, Nothing} reduced over dims = (3,) on LatitudeLongitudeGrid on CPU
├── grid: 1000×500×100 LatitudeLongitudeGrid{Float64, Bounded, Bounded, Bounded} on CPU with 3×3×3 halo and with precomputed metrics
├── boundary conditions: FieldBoundaryConditions
│   └── west: ZeroFlux, east: ZeroFlux, south: ZeroFlux, north: ZeroFlux, bottom: Nothing, top: Nothing, immersed: ZeroFlux
└── data: 1006×506×1 OffsetArray(::Array{Float64, 3}, -2:1003, -2:503, 1:1) with eltype Float64 with indices -2:1003×-2:503×1:1
    └── max=4161.45, min=-5636.4, mean=-101.856

julia> heatmap(bottom)
Screenshot 2025-02-13 at 10 43 04 AM

which is possible on this branch thanks to the new interpolation routine.
It might be possible to try to circshift to limit the bathymetry to the region of interest if we work on it a bit, but I think it's not warranted given that the cost of regridding the bathymetry scales with the grid we interpolate on, not really the grid we interpolate from and the whole native bathymetric data is loaded anyways.

@simone-silvestri
Copy link
Collaborator Author

I ll merge this in the meantime, since this PR changes the bathymetry and the error in run_simulations.jl is a residual from the tests not working and it is solved in #372 that might require a bit more work

@simone-silvestri simone-silvestri merged commit 8cd6548 into main Mar 5, 2025
16 of 18 checks passed
@simone-silvestri simone-silvestri deleted the ss/bathymetry branch March 5, 2025 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants