Skip to content

Commit 44f62c1

Browse files
committed
some imports
1 parent 76fd28c commit 44f62c1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/Grids/tripolar_grid.jl

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
device = Oceananigans.Architectures.device
2+
3+
@inline convert_to_0_360(x) = ((x % 360) + 360) % 360
4+
15
""" a structure to represent a tripolar grid on a spherical shell """
26
struct Tripolar{N, F, S}
37
north_poles_latitude :: N
@@ -56,21 +60,21 @@ The north singularities are located at
5660
`i = 1, j = Nφ` and `i = Nλ ÷ 2 + 1, j = Nλ`
5761
"""
5862
function TripolarGrid(arch = CPU(), FT::DataType = Float64;
59-
size,
63+
size,
6064
southernmost_latitude = -80, # The southermost `Center` latitude of the grid
61-
halo = (4, 4, 4),
62-
radius = R_Earth,
65+
halo = (4, 4, 4),
66+
radius = R_Earth,
6367
z = (0, 1),
6468
north_poles_latitude = 55,
6569
first_pole_longitude = 70) # The second pole is at `λ = first_pole_longitude + 180ᵒ`
6670

67-
# TODO: change a couple of allocations here and there to be able
71+
# TODO: change a couple of allocations here and there to be able
6872
# to construct the grid on the GPU. This is not a huge problem as
6973
# grid generation is quite fast, but it might become for sub-kilometer grids
7074

7175
latitude = (southernmost_latitude, 90)
7276
longitude = (-180, 180)
73-
77+
7478
focal_distance = tand((90 - north_poles_latitude) / 2)
7579

7680
Nλ, Nφ, Nz = size
@@ -106,7 +110,7 @@ function TripolarGrid(arch = CPU(), FT::DataType = Float64;
106110
φCC = zeros(Nλ, Nφ)
107111

108112
loop! = _compute_tripolar_coordinates!(device(CPU()), (16, 16), (Nλ, Nφ))
109-
113+
110114
loop!(λFF, φFF, λFC, φFC, λCF, φCF, λCC, φCC,
111115
λᶠᵃᵃ, λᶜᵃᵃ, φᵃᶠᵃ, φᵃᶜᵃ,
112116
first_pole_longitude,
@@ -127,7 +131,7 @@ function TripolarGrid(arch = CPU(), FT::DataType = Float64;
127131

128132
Nx =
129133
Ny =
130-
134+
131135
# return λFF, φFF, λFC, φFC, λCF, φCF, λCC, φCC
132136
# Helper grid to fill halo
133137
grid = RectilinearGrid(; size = (Nx, Ny), halo = (Hλ, Hφ), topology = (Periodic, RightConnected, Flat), x = (0, 1), y = (0, 1))
@@ -148,7 +152,7 @@ function TripolarGrid(arch = CPU(), FT::DataType = Float64;
148152

149153
lFC = Field((Face, Center, Center), grid; boundary_conditions = default_boundary_conditions)
150154
pFC = Field((Face, Center, Center), grid; boundary_conditions = default_boundary_conditions)
151-
155+
152156
lCF = Field((Center, Face, Center), grid; boundary_conditions = default_boundary_conditions)
153157
pCF = Field((Center, Face, Center), grid; boundary_conditions = default_boundary_conditions)
154158

0 commit comments

Comments
 (0)