Skip to content

Commit

Permalink
Try using purely vertical spaces for column configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Oct 24, 2024
1 parent 09f7aff commit 52d78ba
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
19 changes: 5 additions & 14 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
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.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.")
Expand Down

0 comments on commit 52d78ba

Please sign in to comment.