This repository has been archived by the owner on Mar 1, 2023. It is now read-only.
/
diagnostics_configs.jl
96 lines (87 loc) · 2.53 KB
/
diagnostics_configs.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
using CLIMAParameters
using CLIMAParameters.Planet: planet_radius
using ..Diagnostics
using ..Mesh.Interpolation
"""
DiagnosticsConfiguration
Container for all the `DiagnosticsGroup`s to be used for a simulation.
"""
mutable struct DiagnosticsConfiguration
groups::Array{DiagnosticsGroup, 1}
DiagnosticsConfiguration(
groups::Array{DG, 1},
) where {DG <: DiagnosticsGroup} = new(groups)
end
"""
InterpolationConfiguration(
driver_config::DriverConfiguration,
boundaries::Array,
resolution::Tuple,
)
Creates an `InterpolationTopology` (either an `InterpolationBrick` or an
`InterpolationCubedSphere`) to be used with a `DiagnosticsGroup`.
"""
function InterpolationConfiguration(
driver_config::DriverConfiguration,
boundaries::Array,
resolution::Tuple,
)
param_set = driver_config.bl.param_set
grid = driver_config.grid
if isa(grid.topology, StackedBrickTopology)
axes = (
collect(range(
boundaries[1, 1],
boundaries[2, 1],
step = resolution[1],
)),
collect(range(
boundaries[1, 2],
boundaries[2, 2],
step = resolution[2],
)),
collect(range(
boundaries[1, 3],
boundaries[2, 3],
step = resolution[3],
)),
)
return InterpolationBrick(grid, boundaries, axes[1], axes[2], axes[3])
elseif isa(grid.topology, StackedCubedSphereTopology)
FT = eltype(grid)
_planet_radius::FT = planet_radius(param_set)
info = driver_config.config_info
vert_range = grid1d(
_planet_radius,
FT(_planet_radius + info.domain_height),
nelem = info.nelem_vert,
)
axes = (
collect(range(
boundaries[1, 1],
boundaries[2, 1],
step = resolution[1],
)),
collect(range(
boundaries[1, 2],
boundaries[2, 2],
step = resolution[2],
)),
collect(range(
boundaries[1, 3],
boundaries[2, 3],
step = resolution[3],
)),
)
return InterpolationCubedSphere(
grid,
collect(vert_range),
info.nelem_horz,
axes[1],
axes[2],
axes[3],
)
else
@error "Cannot set up interpolation for this topology."
end
end