@@ -19,52 +19,15 @@ using ClimaCore:
1919using ClimaComms
2020using ClimaUtilities: SpaceVaryingInputs. SpaceVaryingInput
2121
22+ # Include helper functions from test directory
23+ include (joinpath (@__DIR__ , " .." , " test" , " test_helpers.jl" ))
24+
2225# h_elem is the number of elements per side of every panel (6 panels in total)
2326function cubed_sphere_mesh (; radius, h_elem)
2427 domain = Domains. SphereDomain (radius)
2528 return Meshes. EquiangularCubedSphere (domain, h_elem)
2629end
2730
28- function make_horizontal_space (
29- mesh,
30- quad,
31- comms_ctx:: ClimaComms.SingletonCommsContext ,
32- bubble,
33- )
34-
35- space = if mesh isa Meshes. AbstractMesh1D
36- topology = Topologies. IntervalTopology (comms_ctx, mesh)
37- Spaces. SpectralElementSpace1D (topology, quad)
38- elseif mesh isa Meshes. AbstractMesh2D
39- topology = Topologies. Topology2D (
40- comms_ctx,
41- mesh,
42- Topologies. spacefillingcurve (mesh),
43- )
44- Spaces. SpectralElementSpace2D (topology, quad; enable_bubble = bubble)
45- end
46- return space
47- end
48-
49- function make_horizontal_space (mesh, quad, comms_ctx, bubble)
50- if mesh isa Meshes. AbstractMesh1D
51- error (" Distributed mode does not work with 1D horizontal spaces." )
52- elseif mesh isa Meshes. AbstractMesh2D
53- topology = Topologies. DistributedTopology2D (
54- comms_ctx,
55- mesh,
56- Topologies. spacefillingcurve (mesh),
57- )
58- space = Spaces. SpectralElementSpace2D (
59- topology,
60- quad;
61- enable_bubble = bubble,
62- )
63- end
64- return space
65- end
66-
67-
6831"""
6932 generate_spaces(; h_elem=16)
7033For a given number of elements `h_elem`, this function generates a
@@ -95,7 +58,6 @@ function generate_spaces(;
9558 " z" ,
9659 h_space,
9760 )
98- elev_from_file = @. max (elev_from_file, 0 )
9961 # Fractional damping of smallest resolved scale
10062 # Approximated as k₀ ≈ 1/Δx, with n_attenuation
10163 # the factor by which we wish to damp wavenumber
@@ -104,7 +66,7 @@ function generate_spaces(;
10466 κ = diff_courant * Δh_scale^ 2
10567 maxiter = Int (round (log (n_attenuation) / diff_courant))
10668 diffuse_surface_elevation! (elev_from_file; κ, dt = FT (1 ), maxiter)
107- elev_from_file = @. max (elev_from_file, 0 )
69+ @. elev_from_file = max (elev_from_file, FT ( 0 ) )
10870 return elev_from_file
10971end
11072
0 commit comments