Skip to content

Commit

Permalink
correct typo
Browse files Browse the repository at this point in the history
  • Loading branch information
simone-silvestri committed Oct 10, 2024
1 parent 3592c0b commit 2b48385
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/distributed_tripolar_grid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ function reconstruct_global_grid(grid::DistributedTripolarGrid)

north_poles_latitude = grid.conformal_mapping.north_poles_latitude
first_pole_longitude = grid.conformal_mapping.first_pole_longitude
southermost_latitude = grid.conformal_mapping.southermost_latitude
southernmost_latitude = grid.conformal_mapping.southernmost_latitude

return TripolarGrid(child_arch, FT;
halo,
size,
north_poles_latitude,
first_pole_longitude,
southermost_latitude,
southernmost_latitude,
z)
end
18 changes: 9 additions & 9 deletions src/tripolar_grid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
struct Tripolar{N, F, S}
north_poles_latitude :: N
first_pole_longitude :: F
southermost_latitude :: S
southernmost_latitude :: S
end

Adapt.adapt_structure(to, t::Tripolar) =
Tripolar(Adapt.adapt(to, t.north_poles_latitude),
Adapt.adapt(to, t.first_pole_longitude),
Adapt.adapt(to, t.southermost_latitude))
Adapt.adapt(to, t.southernmost_latitude))

const TripolarGrid{FT, TX, TY, TZ, A, R, FR, Arch} = OrthogonalSphericalShellGrid{FT, TX, TY, TZ, A, R, FR, <:Tripolar, Arch}

"""
TripolarGrid(arch = CPU(), FT::DataType = Float64;
size,
southermost_latitude = -80,
southernmost_latitude = -80,
halo = (4, 4, 4),
radius = R_Earth,
z = (0, 1),
Expand All @@ -39,7 +39,7 @@ Keyword Arguments
=================
- `size`: The number of cells in the (longitude, latitude, vertical) dimensions.
- `southermost_latitude`: The southernmost `Center` latitude of the grid. Default is -80.
- `southernmost_latitude`: The southernmost `Center` latitude of the grid. Default is -80.
- `halo`: The halo size in the (longitude, latitude, vertical) dimensions. Default is (4, 4, 4).
- `radius`: The radius of the spherical shell. Default is `R_Earth`.
- `z`: The vertical ``z``-coordinate range of the grid. Default is (0, 1).
Expand All @@ -57,7 +57,7 @@ The north singularities are located at
"""
function TripolarGrid(arch = CPU(), FT::DataType = Float64;
size,
southermost_latitude = -80, # The southermost `Center` latitude of the grid
southernmost_latitude = -80, # The southermost `Center` latitude of the grid
halo = (4, 4, 4),
radius = R_Earth,
z = (0, 1),
Expand All @@ -68,7 +68,7 @@ function TripolarGrid(arch = CPU(), FT::DataType = Float64;
# to construct the grid on the GPU. This is not a huge problem as
# grid generation is quite fast, but it might become for sub-kilometer grids

latitude = (southermost_latitude, 90)
latitude = (southernmost_latitude, 90)
longitude = (-180, 180)

focal_distance = tand((90 - north_poles_latitude) / 2)
Expand All @@ -87,8 +87,8 @@ function TripolarGrid(arch = CPU(), FT::DataType = Float64;
Lz, zᵃᵃᶠ, zᵃᵃᶜ, Δzᵃᵃᶠ, Δzᵃᵃᶜ = generate_coordinate(FT, Bounded(), Nz, Hz, z, :z, CPU())

# The φ coordinate is a bit more complicated because the center points start from
# southermost_latitude and end at 90ᵒ N.
φᵃᶜᵃ = collect(range(southermost_latitude, 90, length = Nφ))
# southernmost_latitude and end at 90ᵒ N.
φᵃᶜᵃ = collect(range(southernmost_latitude, 90, length = Nφ))
Δφ = φᵃᶜᵃ[2] - φᵃᶜᵃ[1]
φᵃᶠᵃ = φᵃᶜᵃ .- Δφ / 2

Expand Down Expand Up @@ -322,7 +322,7 @@ function TripolarGrid(arch = CPU(), FT::DataType = Float64;
on_architecture(arch, Azᶜᶠᵃ),
on_architecture(arch, Azᶠᶠᵃ),
radius,
Tripolar(north_poles_latitude, first_pole_longitude, southermost_latitude))
Tripolar(north_poles_latitude, first_pole_longitude, southernmost_latitude))

return grid
end
Expand Down
8 changes: 4 additions & 4 deletions src/with_halo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ function with_halo(new_halo, old_grid::TripolarGrid)

north_poles_latitude = old_grid.conformal_mapping.north_poles_latitude
first_pole_longitude = old_grid.conformal_mapping.first_pole_longitude
southermost_latitude = old_grid.conformal_mapping.southermost_latitude
southernmost_latitude = old_grid.conformal_mapping.southernmost_latitude

new_grid = TripolarGrid(architecture(old_grid), eltype(old_grid);
size, z, halo = new_halo,
radius = old_grid.radius,
north_poles_latitude,
first_pole_longitude,
southermost_latitude)
southernmost_latitude)

return new_grid
end
Expand All @@ -32,13 +32,13 @@ function with_halo(new_halo, old_grid::DistributedTripolarGrid)

north_poles_latitude = old_grid.conformal_mapping.north_poles_latitude
first_pole_longitude = old_grid.conformal_mapping.first_pole_longitude
southermost_latitude = old_grid.conformal_mapping.southermost_latitude
southernmost_latitude = old_grid.conformal_mapping.southernmost_latitude

return TripolarGrid(arch, eltype(old_grid);
halo = new_halo,
size = N,
north_poles_latitude,
first_pole_longitude,
southermost_latitude,
southernmost_latitude,
z)
end
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include("dependencies_for_runtests.jl")
grid = TripolarGrid(size = (4, 5, 1), z = (0, 1),
first_pole_longitude = 75,
north_poles_latitude = 35,
southermost_latitude = -80)
southernmost_latitude = -80)

@test grid isa TripolarGrid

Expand All @@ -14,7 +14,7 @@ include("dependencies_for_runtests.jl")

@test grid.conformal_mapping.first_pole_longitude == 75
@test grid.conformal_mapping.north_poles_latitude == 35
@test grid.conformal_mapping.southermost_latitude == -80
@test grid.conformal_mapping.southernmost_latitude == -80

λᶜᶜᵃ = λnodes(grid, Center(), Center())
φᶜᶜᵃ = φnodes(grid, Center(), Center())
Expand All @@ -28,7 +28,7 @@ include("dependencies_for_runtests.jl")
# The minimum latitude is not exactly the southermost latitude because the grid
# undulates slightly to maintain the same analytical description in the whole sphere
# (i.e. constant latitude lines do not exist anywhere in this grid)
@test minimum(φᶜᶜᶜ .+ min_Δφ / 10) grid.conformal_mapping.southermost_latitude
@test minimum(φᶜᶜᶜ .+ min_Δφ / 10) grid.conformal_mapping.southernmost_latitude
end

include("test_tripolar_grid.jl")
Expand Down

0 comments on commit 2b48385

Please sign in to comment.