Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try using purely vertical spaces for column configurations #3398

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 17 additions & 21 deletions src/solver/type_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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,
Expand Down
23 changes: 23 additions & 0 deletions src/utils/common_spaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.FaceFiniteDifferenceSpace(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.")
Expand Down
Loading