Skip to content

Commit

Permalink
Implement RotatedLatitudeLongitudeGrid (#4108)
Browse files Browse the repository at this point in the history
* Start implementing DisplacedLatitudeLongitudeGrid

* Displaced Latlon grid

* Change name to rotated lat-lon grid

* Update rotation matrices

* Add test for RotatedLatLonGrid

* Include new time stepping tests

* Update validation tests

* Reduce range of metric translation

* Add extra method for lat-lon-metric
  • Loading branch information
glwagner authored Feb 22, 2025
1 parent bafe706 commit 2916ad1
Show file tree
Hide file tree
Showing 17 changed files with 3,343 additions and 676 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"
SeawaterPolynomials = "d496a93d-167e-4197-9f49-d3af4ff8fe40"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
TimesDates = "bdfc003b-8df8-5c39-adcd-3a9087f5df4a"
Expand Down
1 change: 1 addition & 0 deletions src/Grids/Grids.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ include("input_validation.jl")
include("grid_generation.jl")
include("rectilinear_grid.jl")
include("orthogonal_spherical_shell_grid.jl")
include("conformal_cubed_sphere_panel.jl")
include("latitude_longitude_grid.jl")

end # module
678 changes: 678 additions & 0 deletions src/Grids/conformal_cubed_sphere_panel.jl

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions src/Grids/grid_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -471,13 +471,9 @@ julia> add_halos(data, loc, topo, (Nx, Ny, Nz), (1, 2, 0))
```
"""
function add_halos(data, loc, topo, sz, halo_sz; warnings=true)

Nx, Ny, Nz = size(data)

arch = architecture(data)

# bring to CPU
map(a -> on_architecture(CPU(), a), data)
map(a -> on_architecture(CPU(), a), data) # bring to CPU

nx, ny, nz = total_length(loc[1](), topo[1](), sz[1], 0),
total_length(loc[2](), topo[2](), sz[2], 0),
Expand Down
5 changes: 3 additions & 2 deletions src/Grids/new_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ Return an `OffsetArray` of zeros of float type `FT` on `arch`itecture,
with indices corresponding to a field on a `grid` of `size(grid)` and located at `loc`.
"""
function new_data(FT::DataType, arch, loc, topo, sz, halo_sz, indices=default_indices(length(loc)))
Tx, Ty, Tz = total_size(loc, topo, sz, halo_sz, indices)
underlying_data = zeros(arch, FT, Tx, Ty, Tz)
Tsz = total_size(loc, topo, sz, halo_sz, indices)
underlying_data = zeros(arch, FT, Tsz...)
indices = validate_indices(indices, loc, topo, sz, halo_sz)
return offset_data(underlying_data, loc, topo, sz, halo_sz, indices)
end
Expand All @@ -73,3 +73,4 @@ new_data(FT::DataType, grid::AbstractGrid, loc, indices=default_indices(length(l
new_data(FT, architecture(grid), loc, topology(grid), size(grid), halo_size(grid), indices)

new_data(grid::AbstractGrid, loc, indices=default_indices) = new_data(eltype(grid), grid, loc, indices)

Loading

0 comments on commit 2916ad1

Please sign in to comment.