From e5f48801a8e55ae585d06b44cecfcf85cd221fc9 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Wed, 20 Dec 2023 12:26:54 -0500 Subject: [PATCH] Import quadratures from quadratures module --- post_processing/common_utils.jl | 4 ++-- post_processing/remap/remap_helpers.jl | 7 +++---- src/cache/cache.jl | 2 +- src/prognostic_equations/hyperdiffusion.jl | 3 +-- src/solver/type_getters.jl | 12 ++++++------ test/orographic_gravity_wave/ogwd_3d.jl | 2 +- test/orographic_gravity_wave/ogwd_baseflux.jl | 2 +- 7 files changed, 15 insertions(+), 17 deletions(-) diff --git a/post_processing/common_utils.jl b/post_processing/common_utils.jl index 6bcb940988..07a1072c18 100644 --- a/post_processing/common_utils.jl +++ b/post_processing/common_utils.jl @@ -1,4 +1,4 @@ -import ClimaCore: Spaces, Topologies +import ClimaCore: Spaces, Topologies, Quadratures import JLD2 function export_scaling_file(sol, output_dir, walltime, comms_ctx, nprocs) @@ -8,7 +8,7 @@ function export_scaling_file(sol, output_dir, walltime, comms_ctx, nprocs) center_space = axes(Y.c) horz_space = Spaces.horizontal_space(center_space) horz_topology = horz_space.topology - Nq = Spaces.Quadratures.degrees_of_freedom(horz_space.quadrature_style) + Nq = Quadratures.degrees_of_freedom(horz_space.quadrature_style) nlocalelems = Topologies.nlocalelems(horz_topology) ncols_per_process = nlocalelems * Nq * Nq scaling_file = diff --git a/post_processing/remap/remap_helpers.jl b/post_processing/remap/remap_helpers.jl index a1ca3fcc89..9bf22d71cf 100644 --- a/post_processing/remap/remap_helpers.jl +++ b/post_processing/remap/remap_helpers.jl @@ -1,5 +1,5 @@ import ClimaCoreTempestRemap -import ClimaCore: Spaces, Fields +import ClimaCore: Spaces, Fields, Quadratures import ClimaComms import ClimaAtmos: SurfaceConditions, CT3 import ClimaCore.Utilities: half @@ -29,9 +29,8 @@ function create_weightfile( ) # space info to generate nc raw data hspace = cspace.horizontal_space - Nq = Spaces.Quadratures.degrees_of_freedom( - cspace.horizontal_space.quadrature_style, - ) + Nq = + Quadratures.degrees_of_freedom(cspace.horizontal_space.quadrature_style) # create a temporary dir for intermediate data mktempdir() do tmp mkpath(tmp) diff --git a/src/cache/cache.jl b/src/cache/cache.jl index 948c2a60c0..4d41086148 100644 --- a/src/cache/cache.jl +++ b/src/cache/cache.jl @@ -129,7 +129,7 @@ function build_cache(Y, atmos, params, surface_setup, dt, t_end, start_date) ᶜf = @. CT3(Geometry.WVector(ᶜf)) quadrature_style = Spaces.horizontal_space(axes(Y.c)).quadrature_style - do_dss = quadrature_style isa Spaces.Quadratures.GLL + do_dss = quadrature_style isa Quadratures.GLL ghost_buffer = !do_dss ? (;) : (; c = Spaces.create_dss_buffer(Y.c), f = Spaces.create_dss_buffer(Y.f)) diff --git a/src/prognostic_equations/hyperdiffusion.jl b/src/prognostic_equations/hyperdiffusion.jl index 988feb166b..c827609002 100644 --- a/src/prognostic_equations/hyperdiffusion.jl +++ b/src/prognostic_equations/hyperdiffusion.jl @@ -14,8 +14,7 @@ hyperdiffusion_cache(Y, hyperdiff::Nothing, _) = (;) function hyperdiffusion_cache(Y, hyperdiff::ClimaHyperdiffusion, turbconv_model) do_dss = - Spaces.horizontal_space(axes(Y.c)).quadrature_style isa - Spaces.Quadratures.GLL + Spaces.horizontal_space(axes(Y.c)).quadrature_style isa Quadratures.GLL FT = eltype(Y) n = n_mass_flux_subdomains(turbconv_model) diff --git a/src/solver/type_getters.jl b/src/solver/type_getters.jl index b7591e1e78..632d918e24 100644 --- a/src/solver/type_getters.jl +++ b/src/solver/type_getters.jl @@ -3,7 +3,7 @@ using Dierckx using ImageFiltering using Interpolations import NCDatasets -import ClimaCore: InputOutput, Meshes, Spaces +import ClimaCore: InputOutput, Meshes, Spaces, Quadratures import ClimaAtmos.RRTMGPInterface as RRTMGPI import ClimaAtmos as CA import LinearAlgebra @@ -160,7 +160,7 @@ function get_spaces(parsed_args, params, comms_ctx) radius = CAP.planet_radius(params) center_space, face_space = if parsed_args["config"] == "sphere" nh_poly = parsed_args["nh_poly"] - quad = Spaces.Quadratures.GLL{nh_poly + 1}() + quad = Quadratures.GLL{nh_poly + 1}() horizontal_mesh = cubed_sphere_mesh(; radius, h_elem) h_space = make_horizontal_space(horizontal_mesh, quad, comms_ctx, bubble) @@ -185,7 +185,7 @@ function get_spaces(parsed_args, params, comms_ctx) @warn "perturb_initstate flag is ignored for single column configuration" FT = eltype(params) Δx = FT(1) # Note: This value shouldn't matter, since we only have 1 column. - quad = Spaces.Quadratures.GL{1}() + quad = Quadratures.GL{1}() horizontal_mesh = periodic_rectangle_mesh(; x_max = Δx, y_max = Δx, @@ -207,7 +207,7 @@ function get_spaces(parsed_args, params, comms_ctx) elseif parsed_args["config"] == "box" FT = eltype(params) nh_poly = parsed_args["nh_poly"] - quad = Spaces.Quadratures.GLL{nh_poly + 1}() + quad = Quadratures.GLL{nh_poly + 1}() x_elem = Int(parsed_args["x_elem"]) x_max = FT(parsed_args["x_max"]) y_elem = Int(parsed_args["y_elem"]) @@ -235,7 +235,7 @@ function get_spaces(parsed_args, params, comms_ctx) elseif parsed_args["config"] == "plane" FT = eltype(params) nh_poly = parsed_args["nh_poly"] - quad = Spaces.Quadratures.GLL{nh_poly + 1}() + quad = Quadratures.GLL{nh_poly + 1}() x_elem = Int(parsed_args["x_elem"]) x_max = FT(parsed_args["x_max"]) horizontal_mesh = @@ -259,7 +259,7 @@ function get_spaces(parsed_args, params, comms_ctx) ndofs_total = ncols * z_elem hspace = Spaces.horizontal_space(center_space) quad_style = Spaces.quadrature_style(hspace) - Nq = Spaces.Quadratures.degrees_of_freedom(quad_style) + Nq = Quadratures.degrees_of_freedom(quad_style) @info "Resolution stats: " Nq h_elem z_elem ncols ndofs_total return (; diff --git a/test/orographic_gravity_wave/ogwd_3d.jl b/test/orographic_gravity_wave/ogwd_3d.jl index 2bf1f04c84..e1f6c5c5c0 100644 --- a/test/orographic_gravity_wave/ogwd_3d.jl +++ b/test/orographic_gravity_wave/ogwd_3d.jl @@ -100,7 +100,7 @@ dz_bottom = 300.0 dz_top = 5000.0 radius = 6.371229e6 -quad = Spaces.Quadratures.GLL{nh_poly + 1}() +quad = Quadratures.GLL{nh_poly + 1}() horizontal_mesh = CA.cubed_sphere_mesh(; radius, h_elem) h_space = CA.make_horizontal_space(horizontal_mesh, quad, comms_ctx, false) diff --git a/test/orographic_gravity_wave/ogwd_baseflux.jl b/test/orographic_gravity_wave/ogwd_baseflux.jl index e0306e31f3..214032b451 100644 --- a/test/orographic_gravity_wave/ogwd_baseflux.jl +++ b/test/orographic_gravity_wave/ogwd_baseflux.jl @@ -19,7 +19,7 @@ z_max = 30e3 z_elem = 1 radius = 6.371229e6 -quad = Spaces.Quadratures.GLL{nh_poly + 1}() +quad = Quadratures.GLL{nh_poly + 1}() horizontal_mesh = CA.cubed_sphere_mesh(; radius, h_elem) h_space = CA.make_horizontal_space(horizontal_mesh, quad, comms_ctx, false) z_stretch = Meshes.Uniform()