From 6a8a2e951822d3979e00c9de08a068d84b51d2e1 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Thu, 24 Oct 2024 14:24:08 -0400 Subject: [PATCH 1/2] Try using purely vertical spaces for column configurations --- src/solver/type_getters.jl | 38 +++++++++++++++++--------------------- src/utils/common_spaces.jl | 23 +++++++++++++++++++++++ 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/src/solver/type_getters.jl b/src/solver/type_getters.jl index b267cb5d1d..1a9564a8db 100644 --- a/src/solver/type_getters.jl +++ b/src/solver/type_getters.jl @@ -199,26 +199,17 @@ function get_spaces(parsed_args, params, comms_ctx) elseif parsed_args["config"] == "column" # single column @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 = Quadratures.GL{1}() - horizontal_mesh = periodic_rectangle_mesh(; - x_max = Δx, - y_max = Δx, - x_elem = 1, - y_elem = 1, - ) - if bubble + quad = nothing + horizontal_mesh = nothing + bubble && @warn "Bubble correction not compatible with single column configuration. It will be switched off." - bubble = false - end - h_space = - make_horizontal_space(horizontal_mesh, quad, comms_ctx, bubble) z_stretch = if parsed_args["z_stretch"] Meshes.HyperbolicTangentStretching(dz_bottom) else Meshes.Uniform() end - make_hybrid_spaces(h_space, z_max, z_elem, z_stretch; parsed_args) + # make_hybrid_spaces(h_space, z_max, z_elem, z_stretch; parsed_args) + make_column_spaces(z_max, z_elem, z_stretch, comms_ctx) elseif parsed_args["config"] == "box" FT = eltype(params) nh_poly = parsed_args["nh_poly"] @@ -274,13 +265,18 @@ function get_spaces(parsed_args, params, comms_ctx) deep, ) end - ncols = Fields.ncolumns(center_space) - ndofs_total = ncols * z_elem - hspace = Spaces.horizontal_space(center_space) - quad_style = Spaces.quadrature_style(hspace) - Nq = Quadratures.degrees_of_freedom(quad_style) - - @info "Resolution stats: " Nq h_elem z_elem ncols ndofs_total + if center_space isa Spaces.FiniteDifferenceSpace + ncols = 1 + ndofs_total = ncols * z_elem + @info "Resolution stats: " z_elem ncols ndofs_total + else + ncols = Fields.ncolumns(center_space) + ndofs_total = ncols * z_elem + hspace = Spaces.horizontal_space(center_space) + quad_style = Spaces.quadrature_style(hspace) + Nq = Quadratures.degrees_of_freedom(quad_style) + @info "Resolution stats: " Nq h_elem z_elem ncols ndofs_total + end return (; center_space, face_space, diff --git a/src/utils/common_spaces.jl b/src/utils/common_spaces.jl index 7feb5f3805..2a20b903e5 100644 --- a/src/utils/common_spaces.jl +++ b/src/utils/common_spaces.jl @@ -56,6 +56,29 @@ function make_horizontal_space( return space end +function make_column_spaces( + z_max, + z_elem, + z_stretch, + comms_ctx::ClimaComms.SingletonCommsContext, +) + z_domain = Domains.IntervalDomain( + Geometry.ZPoint(zero(z_max)), + Geometry.ZPoint(z_max); + boundary_names = (:bottom, :top), + ) + z_mesh = Meshes.IntervalMesh(z_domain, z_stretch; nelems = z_elem) + @info "z heights" z_mesh.faces + device = ClimaComms.device(comms_ctx) + z_topology = Topologies.IntervalTopology( + ClimaComms.SingletonCommsContext(device), + z_mesh, + ) + cspace = Spaces.CenterFiniteDifferenceSpace(z_topology) + fspace = Spaces.CenterFiniteDifferenceSpace(cspace) + return (cspace, fspace) +end + function make_horizontal_space(mesh, quad, comms_ctx, bubble) if mesh isa Meshes.AbstractMesh1D error("Distributed mode does not work with 1D horizontal spaces.") From 1bb3ff1ddd9e66712d66a057e5be44c52ae955f3 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Thu, 7 Nov 2024 16:59:35 -0800 Subject: [PATCH 2/2] Update src/utils/common_spaces.jl Co-authored-by: Akshay Sridhar <43710045+akshaysridhar@users.noreply.github.com> --- src/utils/common_spaces.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/common_spaces.jl b/src/utils/common_spaces.jl index 2a20b903e5..c32973cfd8 100644 --- a/src/utils/common_spaces.jl +++ b/src/utils/common_spaces.jl @@ -75,7 +75,7 @@ function make_column_spaces( z_mesh, ) cspace = Spaces.CenterFiniteDifferenceSpace(z_topology) - fspace = Spaces.CenterFiniteDifferenceSpace(cspace) + fspace = Spaces.FaceFiniteDifferenceSpace(cspace) return (cspace, fspace) end