-
Notifications
You must be signed in to change notification settings - Fork 193
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
Fill halos of conformal cubed sphere grid coordinates and metrics in a single pass #3488
Conversation
This commit integrates some key updates from PR #3306, specifically commit 941260f on branch ncc-glw/cubed-sphere-dynamics. We have replaced the following scripts: (a) src/Models/HydrostaticFreeSurfaceModels/ update_hydrostatic_free_surface_model_state.jl; (b) src/MultiRegion/multi_region_cubed_sphere_grid.jl; with their modified versions from the PR. The main improvement involves utilizing the fill_paired_halo_regions! function to fill the halos of grid metrics on conformal cubed sphere panels at center-center, face-center, and center-face locations.
src/Models/HydrostaticFreeSurfaceModels/update_hydrostatic_free_surface_model_state.jl
Outdated
Show resolved
Hide resolved
src/Models/HydrostaticFreeSurfaceModels/update_hydrostatic_free_surface_model_state.jl
Outdated
Show resolved
Hide resolved
src/Models/HydrostaticFreeSurfaceModels/update_hydrostatic_free_surface_model_state.jl
Show resolved
Hide resolved
src/Models/HydrostaticFreeSurfaceModels/update_hydrostatic_free_surface_model_state.jl
Outdated
Show resolved
Hide resolved
@siddharthabishnu, how do we know that now the metrics are filled correctly? you were comparing with a grid from MITgcm? |
Yes. Consider the following sources for the grid metrics:
In the validation scripts for solid body rotation and the Rossby-Haurwitz wave within the |
src/Models/HydrostaticFreeSurfaceModels/update_hydrostatic_free_surface_model_state.jl
Show resolved
Hide resolved
OK, so the benchmark is the |
src/Models/HydrostaticFreeSurfaceModels/update_hydrostatic_free_surface_model_state.jl
Outdated
Show resolved
Hide resolved
I cleaned the PR a bit. Didn't change anything. |
@simone-silvestri and @navidcy, I totally agree. I only introduced CUDA.@allowscalar under the impression it was necessary for certain GPU tests to pass. However, now understanding that isn’t the case, I've removed it in commit 7f54c3c. |
@@ -114,12 +114,10 @@ function fill_cubed_sphere_halo_regions!(field::CubedSphereField{<:Face, <:Face} | |||
return nothing | |||
end | |||
|
|||
fill_cubed_sphere_halo_regions!(fields::Tuple{CubedSphereField, CubedSphereField}; | |||
signed = true) = fill_cubed_sphere_halo_regions!(fields...; signed) | |||
fill_halo_regions!(fields::Tuple{CubedSphereField, CubedSphereField}; signed = true) = fill_halo_regions!(fields...; signed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it clean/good idea to extend fill_halo_regions!
for (::Tuple{Fields})? I guess we need something like that when dealing with vector-like quantities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is already a method for filling the halos of tuples (and namedtuples) of fields. In that case, we launch kernels that fill all the fields together.
See
function fill_halo_regions!(maybe_nested_tuple::Union{NamedTuple, Tuple}, args...; kwargs...) |
and
Oceananigans.jl/src/BoundaryConditions/fill_halo_regions.jl
Lines 45 to 48 in f7042b7
const MaybeTupledData = Union{OffsetArray, NTuple{<:Any, OffsetArray}} | |
"Fill halo regions in ``x``, ``y``, and ``z`` for a given field's data." | |
function fill_halo_regions!(c::MaybeTupledData, boundary_conditions, indices, loc, grid, args...; kwargs...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of a MultiRegionField
(of which a CubedSphereField` is a subset) this behavior is bypassed
Oceananigans.jl/src/MultiRegion/multi_region_boundary_conditions.jl
Lines 34 to 36 in f7042b7
# This can be implemented once we have a buffer for field_tuples | |
@inline function tupled_fill_halo_regions!(full_fields, grid::MultiRegionGrids, args...; kwargs...) | |
for field in full_fields |
there are few outstanding questions still so I took back the approval -- sorry |
This PR fills the halos of the grid metrics of the conformal cubed sphere panels at face-face locations using a dedicated function instead of hard-coded values, similar to the existing approach for center-center, face-center, and center-face locations.
cc @navidcy