@@ -8,7 +8,8 @@ using Oceananigans.Fields: Field
8
8
using Oceananigans. ImmersedBoundaries: GridFittedBottom
9
9
10
10
import .. OceananigansReactantExt: deconcretize
11
- import Oceananigans. Grids: LatitudeLongitudeGrid, RectilinearGrid
11
+ import Oceananigans. Grids: LatitudeLongitudeGrid, RectilinearGrid, OrthogonalSphericalShellGrid
12
+ import Oceananigans. OrthogonalSphericalShellGrids: RotatedLatitudeLongitudeGrid
12
13
import Oceananigans. ImmersedBoundaries: ImmersedBoundaryGrid
13
14
14
15
const ReactantGrid{FT, TX, TY, TZ} = AbstractGrid{FT, TX, TY, TZ, <: ReactantState }
@@ -40,29 +41,57 @@ function RectilinearGrid(arch::ReactantState, FT::DataType; kw...)
40
41
return RectilinearGrid {TX, TY, TZ} (arch, other_properties... )
41
42
end
42
43
44
+ function OrthogonalSphericalShellGrid (arch:: ReactantState , FT:: DataType ; kw... )
45
+ cpu_grid = OrthogonalSphericalShellGrid (CPU (), FT; kw... )
46
+ other_names = propertynames (cpu_grid)[2 : end ] # exclude architecture
47
+ other_properties = Tuple (getproperty (cpu_grid, name) for name in other_names)
48
+ TX, TY, TZ = Oceananigans. Grids. topology (cpu_grid)
49
+ return OrthogonalSphericalShellGrid {TX, TY, TZ} (arch, other_properties... )
50
+ end
51
+
52
+ # This is a kind of OrthogonalSphericalShellGrid
53
+ function RotatedLatitudeLongitudeGrid (arch:: ReactantState , FT:: DataType ; kw... )
54
+ cpu_grid = RotatedLatitudeLongitudeGrid (CPU (), FT; kw... )
55
+ other_names = propertynames (cpu_grid)[2 : end ] # exclude architecture
56
+ other_properties = Tuple (getproperty (cpu_grid, name) for name in other_names)
57
+ TX, TY, TZ = Oceananigans. Grids. topology (cpu_grid)
58
+ return OrthogonalSphericalShellGrid {TX, TY, TZ} (arch, other_properties... )
59
+ end
60
+
61
+ # This low-level constructor supports the external package OrthogonalSphericalShellGrids.jl.
43
62
function OrthogonalSphericalShellGrid {TX, TY, TZ} (arch:: ReactantState ,
44
63
Nx, Ny, Nz, Hx, Hy, Hz,
45
64
Lz :: FT ,
46
- λᶜᶜᵃ :: A , λᶠᶜᵃ :: A , λᶜᶠᵃ :: A , λᶠᶠᵃ :: A ,
47
- φᶜᶜᵃ :: A , φᶠᶜᵃ :: A , φᶜᶠᵃ :: A , φᶠᶠᵃ :: A ,
48
- z :: Z ,
49
- Δxᶜᶜᵃ :: A , Δxᶠᶜᵃ :: A , Δxᶜᶠᵃ :: A , Δxᶠᶠᵃ :: A ,
50
- Δyᶜᶜᵃ :: A , Δyᶜᶠᵃ :: A , Δyᶠᶜᵃ :: A , Δyᶠᶠᵃ :: A ,
51
- Azᶜᶜᵃ :: A , Azᶠᶜᵃ :: A , Azᶜᶠᵃ :: A , Azᶠᶠᵃ :: A ,
65
+ λᶜᶜᵃ :: CC , λᶠᶜᵃ :: FC , λᶜᶠᵃ :: CF , λᶠᶠᵃ :: FF ,
66
+ φᶜᶜᵃ :: CC , φᶠᶜᵃ :: FC , φᶜᶠᵃ :: CF , φᶠᶠᵃ :: FF , z :: Z ,
67
+ Δxᶜᶜᵃ :: CC , Δxᶠᶜᵃ :: FC , Δxᶜᶠᵃ :: CF , Δxᶠᶠᵃ :: FF ,
68
+ Δyᶜᶜᵃ :: CC , Δyᶠᶜᵃ :: FC , Δyᶜᶠᵃ :: CF , Δyᶠᶠᵃ :: FF ,
69
+ Azᶜᶜᵃ :: CC , Azᶠᶜᵃ :: FC , Azᶜᶠᵃ :: CF , Azᶠᶠᵃ :: FF ,
52
70
radius :: FT ,
53
- conformal_mapping :: C ) where {TX, TY, TZ, FT, Z, A, C}
54
-
55
- args = (λᶜᶜᵃ, λᶠᶜᵃ, λᶜᶠᵃ, λᶠᶠᵃ,
56
- φᶜᶜᵃ, φᶠᶜᵃ, φᶜᶠᵃ, φᶠᶠᵃ,
57
- z,
58
- Δxᶜᶜᵃ, Δxᶠᶜᵃ, Δxᶜᶠᵃ, Δxᶠᶠᵃ,
59
- Δyᶜᶜᵃ, Δyᶜᶠᵃ, Δyᶠᶜᵃ, Δyᶠᶠᵃ,
60
- Azᶜᶜᵃ, Azᶠᶜᵃ, Azᶜᶠᵃ, Azᶠᶠᵃ)
61
-
62
- dargs = Tuple (deconcretize (a) for a in args)
63
-
64
- return OrthogonalSphericalShellGrid {FT, TX, TY, TZ, CZ, A, C, Arch} (arch, Nx, Ny, Nz, Hx, Hy, Hz, Lz,
65
- dargs... , radius, conformal_mapping)
71
+ conformal_mapping :: Map ) where {TX, TY, TZ, FT, Z, Map,
72
+ CC, FC, CF, FF, C}
73
+
74
+ args1 = (λᶜᶜᵃ, λᶠᶜᵃ, λᶜᶠᵃ, λᶠᶠᵃ,
75
+ φᶜᶜᵃ, φᶠᶜᵃ, φᶜᶠᵃ, φᶠᶠᵃ)
76
+
77
+ args2 = (Δxᶜᶜᵃ, Δxᶠᶜᵃ, Δxᶜᶠᵃ, Δxᶠᶠᵃ,
78
+ Δyᶜᶜᵃ, Δyᶠᶜᵃ, Δyᶜᶠᵃ, Δyᶠᶠᵃ,
79
+ Azᶜᶜᵃ, Azᶠᶜᵃ, Azᶜᶠᵃ, Azᶠᶠᵃ)
80
+
81
+ dargs1 = Tuple (deconcretize (a) for a in args1)
82
+ dz = deconcretize (z)
83
+ dargs2 = Tuple (deconcretize (a) for a in args2)
84
+
85
+ Arch = typeof (arch)
86
+ DCC = typeof (dargs1[1 ]) # deconcretized
87
+ DFC = typeof (dargs1[2 ]) # deconcretized
88
+ DCF = typeof (dargs1[3 ]) # deconcretized
89
+ DFF = typeof (dargs1[4 ]) # deconcretized
90
+ DZ = typeof (dz) # deconcretized
91
+
92
+ return OrthogonalSphericalShellGrid{FT, TX, TY, TZ, DZ, Map,
93
+ DCC, DFC, DCF, DFF, Arch}(arch, Nx, Ny, Nz, Hx, Hy, Hz, Lz,
94
+ dargs1... , dz, dargs2... , radius, conformal_mapping)
66
95
end
67
96
68
97
deconcretize (gfb:: GridFittedBottom ) = GridFittedBottom (deconcretize (gfb. bottom_height),
@@ -89,8 +118,6 @@ ImmersedBoundaryGrid(grid::ReactantGrid, ib::GridFittedBottom; active_cells_map:
89
118
90
119
ImmersedBoundaryGrid (grid:: ReactantGrid , ib; active_cells_map:: Bool = true ) =
91
120
reactant_immersed_boundary_grid (grid, ib; active_cells_map)
92
-
93
-
94
121
95
122
end # module
96
123
0 commit comments