Skip to content

Commit

Permalink
define singleton topo
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Jun 7, 2024
1 parent 49266e0 commit 266b9ae
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ext/TempestRegridderExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ function construct_singleton_space(space)

# Check if input space was constructed using `spacefillingcurve`
use_spacefillingcurve =
space.grid.topology.elemorder isa CartesianIndices ? false : true
ClimaCore.Spaces.topology(space).elemorder isa CartesianIndices ?
false : true

mesh = ClimaCore.Spaces.topology(space).mesh
topology = nothing
Expand Down Expand Up @@ -354,6 +355,8 @@ function hdwrite_regridfile_rll_to_cgll(

# If doesn't make sense to regrid with GPUs/MPI processes
space_singleton = construct_singleton_space(space)
topology_singleton = ClimaCore.Spaces.topology(space_singleton)
cpu_context = ClimaCore.Spaces.topology(space_singleton).context

if isfile(datafile_cgll) == false
isdir(REGRID_DIR) ? nothing : mkpath(REGRID_DIR)
Expand All @@ -365,7 +368,7 @@ function hdwrite_regridfile_rll_to_cgll(
ClimaCoreTempestRemap.rll_mesh(meshfile_rll; nlat = nlat, nlon = nlon)

# write cgll mesh, overlap mesh and weight file
ClimaCoreTempestRemap.write_exodus(meshfile_cgll, topology)
ClimaCoreTempestRemap.write_exodus(meshfile_cgll, topology_singleton)
ClimaCoreTempestRemap.overlap_mesh(
meshfile_overlap,
meshfile_rll,
Expand All @@ -375,6 +378,10 @@ function hdwrite_regridfile_rll_to_cgll(
# 'in_np = 1' and 'mono = true' arguments ensure mapping is conservative and monotone
# Note: for a kwarg not followed by a value, set it to true here (i.e. pass 'mono = true' to produce '--mono')
# Note: out_np = degrees of freedom = polynomial degree + 1
Nq =
ClimaCore.Spaces.Quadratures.polynomial_degree(
ClimaCore.Spaces.quadrature_style(space),
) + 1
kwargs = (; out_type = out_type, out_np = Nq)
kwargs = mono ? (; (kwargs)..., in_np = 1, mono = mono) : kwargs
ClimaCoreTempestRemap.remap_weights(
Expand Down

0 comments on commit 266b9ae

Please sign in to comment.