|
93 | 93 | @test isfile(fig_png)
|
94 | 94 | end
|
95 | 95 |
|
| 96 | +@testset "finitedifference" begin |
| 97 | + vdomain = ClimaCore.Domains.IntervalDomain( |
| 98 | + ClimaCore.Geometry.ZPoint(0.0), |
| 99 | + ClimaCore.Geometry.ZPoint(10e3); |
| 100 | + boundary_names = (:bottom, :top), |
| 101 | + ) |
| 102 | + context = ClimaComms.context() |
| 103 | + vmesh = ClimaCore.Meshes.IntervalMesh(vdomain; nelems = 45) |
| 104 | + vtopology = ClimaCore.Topologies.IntervalTopology(context, vmesh) |
| 105 | + vspace = ClimaCore.Spaces.CenterFiniteDifferenceSpace(vtopology) |
| 106 | + coords = ClimaCore.Fields.coordinate_field(vspace) |
| 107 | + |
| 108 | + u = sin.(π .* coords.z) |
| 109 | + |
| 110 | + field_fig = Plots.plot(u) |
| 111 | + @test field_fig !== nothing |
| 112 | + |
| 113 | + fig_png = joinpath(OUTPUT_DIR, "fd_field.png") |
| 114 | + Plots.png(field_fig, fig_png) |
| 115 | + @test isfile(fig_png) |
| 116 | +end |
| 117 | + |
| 118 | +@testset "Column from extruded finitedifference" begin |
| 119 | + FT = Float64 |
| 120 | + R = 6.37122e6 |
| 121 | + velem = 40 |
| 122 | + |
| 123 | + horz_domain = ClimaCore.Domains.SphereDomain(R) |
| 124 | + horz_mesh = ClimaCore.Meshes.EquiangularCubedSphere(horz_domain, 6) |
| 125 | + horz_grid_topology = ClimaCore.Topologies.Topology2D( |
| 126 | + ClimaComms.SingletonCommsContext(), |
| 127 | + horz_mesh, |
| 128 | + ) |
| 129 | + quad = ClimaCore.Quadratures.GLL{4}() |
| 130 | + horz_space = |
| 131 | + ClimaCore.Spaces.SpectralElementSpace2D(horz_grid_topology, quad) |
| 132 | + |
| 133 | + vertdomain = ClimaCore.Domains.IntervalDomain( |
| 134 | + ClimaCore.Geometry.ZPoint{FT}(0), |
| 135 | + ClimaCore.Geometry.ZPoint{FT}(1000); |
| 136 | + boundary_names = (:bottom, :top), |
| 137 | + ) |
| 138 | + vertmesh = ClimaCore.Meshes.IntervalMesh(vertdomain, nelems = velem) |
| 139 | + device = ClimaComms.device() |
| 140 | + vert_center_space = |
| 141 | + ClimaCore.Spaces.CenterFiniteDifferenceSpace(device, vertmesh) |
| 142 | + |
| 143 | + hv_center_space = ClimaCore.Spaces.ExtrudedFiniteDifferenceSpace( |
| 144 | + horz_space, |
| 145 | + vert_center_space, |
| 146 | + ) |
| 147 | + coords = ClimaCore.Fields.coordinate_field(hv_center_space) |
| 148 | + |
| 149 | + uw = map(coords) do coord |
| 150 | + sin(coord.z) |
| 151 | + end |
| 152 | + |
| 153 | + colidx = ClimaCore.Fields.ColumnIndex((1, 1), 1) |
| 154 | + field_fig = Plots.plot(uw[colidx]) |
| 155 | + @test field_fig !== nothing |
| 156 | + |
| 157 | + fig_png = joinpath(OUTPUT_DIR, "col_from_extruded_fd_field.png") |
| 158 | + Plots.png(field_fig, fig_png) |
| 159 | + @test isfile(fig_png) |
| 160 | +end |
| 161 | + |
96 | 162 | @testset "spectral element 3D extruded cubed-sphere" begin
|
97 | 163 | FT = Float64
|
98 | 164 | R = 6.37122e6
|
|
104 | 170 | ClimaComms.SingletonCommsContext(),
|
105 | 171 | horz_mesh,
|
106 | 172 | )
|
107 |
| - quad = ClimaCore.Quadratures.GLL{5}() |
| 173 | + quad = ClimaCore.Quadratures.GLL{4}() |
108 | 174 | horz_space =
|
109 | 175 | ClimaCore.Spaces.SpectralElementSpace2D(horz_grid_topology, quad)
|
110 | 176 |
|
|
0 commit comments