Skip to content

Commit

Permalink
Import quadratures from quadratures module
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Dec 20, 2023
1 parent 717ebf7 commit e5f4880
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions post_processing/common_utils.jl
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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 =
Expand Down
7 changes: 3 additions & 4 deletions post_processing/remap/remap_helpers.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/cache/cache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 1 addition & 2 deletions src/prognostic_equations/hyperdiffusion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions src/solver/type_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand All @@ -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"])
Expand Down Expand Up @@ -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 =
Expand All @@ -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 (;
Expand Down
2 changes: 1 addition & 1 deletion test/orographic_gravity_wave/ogwd_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion test/orographic_gravity_wave/ogwd_baseflux.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e5f4880

Please sign in to comment.