|
| 1 | +module Topography |
| 2 | + |
| 3 | +using ClimaCore: Geometry |
| 4 | + |
| 5 | +export topography_dcmip200, topography_hughes2023 |
| 6 | +export topography_agnesi, agnesi_params |
| 7 | +export topography_schar, schar_params |
| 8 | +export topography_cosine_2d, topography_cosine_3d |
| 9 | +export topography_cosine, cosine_params |
| 10 | + |
1 | 11 | """ |
2 | 12 | topography_dcmip200(coord) |
3 | 13 |
|
|
113 | 123 | topography_cosine(x, y, λ_x, λ_y, h_max) = |
114 | 124 | h_max * cospi(2 * x / λ_x) * cospi(2 * y / λ_y) |
115 | 125 | cosine_params(::Type{FT}) where {FT} = (; h_max = FT(25), λ = FT(25e3)) |
| 126 | + |
| 127 | +abstract type AbstractTopography end |
| 128 | + |
| 129 | +topo_func(t::AbstractTopography) = error("No topography function for topography $t") |
| 130 | + |
| 131 | +struct NoTopography <: AbstractTopography end |
| 132 | + |
| 133 | +# Analytical topography types for idealized test cases |
| 134 | + |
| 135 | +""" |
| 136 | + CosineTopography(; h_max = 25, λ = 25e3, dim = 2) |
| 137 | +
|
| 138 | +Cosine hill topography in 2D or 3D. |
| 139 | +
|
| 140 | +# Arguments |
| 141 | +- `h_max::FT`: Maximum elevation (m) |
| 142 | +- `λ::FT`: Wavelength of the cosine hills (m) |
| 143 | +- `dim::Int`: Spatial dimension (2 or 3) |
| 144 | +""" |
| 145 | +Base.@kwdef struct CosineTopography <: AbstractTopography |
| 146 | + h_max = 25 |
| 147 | + λ = 25e3 |
| 148 | + dim::Int = 2 |
| 149 | +end |
| 150 | + |
| 151 | +topo_func(t::CosineTopography) = t.dim == 2 ? topography_cosine_2d : topography_cosine_3d |
| 152 | + |
| 153 | +""" |
| 154 | + AgnesiTopography(; h_max = 25, x_center = 50e3, a = 5e3) |
| 155 | +
|
| 156 | +Witch of Agnesi mountain topography for 2D simulations. |
| 157 | +
|
| 158 | +# Arguments |
| 159 | +- `h_max`: Maximum elevation (m) |
| 160 | +- `x_center`: Center position (m) |
| 161 | +- `a`: Mountain width parameter (m) |
| 162 | +""" |
| 163 | +Base.@kwdef struct AgnesiTopography <: AbstractTopography |
| 164 | + h_max = 25 |
| 165 | + x_center = 50e3 |
| 166 | + a = 5e3 |
| 167 | +end |
| 168 | + |
| 169 | +topo_func(::AgnesiTopography) = topography_agnesi |
| 170 | + |
| 171 | + |
| 172 | +""" |
| 173 | + ScharTopography(; h_max = 25, x_center = 50e3, λ = 4e3, a = 5e3) |
| 174 | +
|
| 175 | +Schar mountain topography for 2D simulations. |
| 176 | +
|
| 177 | +# Arguments |
| 178 | +- `h_max`: Maximum elevation (m) |
| 179 | +- `x_center`: Center position (m) |
| 180 | +- `λ`: Wavelength parameter (m) |
| 181 | +- `a`: Mountain width parameter (m) |
| 182 | +""" |
| 183 | +Base.@kwdef struct ScharTopography <: AbstractTopography |
| 184 | + h_max = 25 |
| 185 | + x_center = 50e3 |
| 186 | + λ = 4e3 |
| 187 | + a = 5e3 |
| 188 | +end |
| 189 | +topo_func(::ScharTopography) = topography_schar |
| 190 | + |
| 191 | + |
| 192 | +# Data-based topography types |
| 193 | + |
| 194 | +""" |
| 195 | + EarthTopography() |
| 196 | +
|
| 197 | +Earth topography from ETOPO2022 data files. |
| 198 | +""" |
| 199 | +struct EarthTopography <: AbstractTopography end |
| 200 | + |
| 201 | +""" |
| 202 | + DCMIP200Topography() |
| 203 | +
|
| 204 | +Surface elevation for the DCMIP-2-0-0 test problem. |
| 205 | +""" |
| 206 | +struct DCMIP200Topography <: AbstractTopography end |
| 207 | + |
| 208 | +topo_func(::DCMIP200Topography) = topography_dcmip200 |
| 209 | + |
| 210 | +""" |
| 211 | + Hughes2023Topography() |
| 212 | +
|
| 213 | +Surface elevation for baroclinic wave test from Hughes and Jablonowski (2023). |
| 214 | +""" |
| 215 | +struct Hughes2023Topography <: AbstractTopography end |
| 216 | + |
| 217 | +topo_func(::Hughes2023Topography) = topography_hughes2023 |
| 218 | + |
| 219 | +end |
0 commit comments