From 266b9aedd0171005a801b9589f41be4c99a45ff1 Mon Sep 17 00:00:00 2001 From: Julia Sloan Date: Thu, 6 Jun 2024 17:21:08 -0700 Subject: [PATCH] define singleton topo --- ext/TempestRegridderExt.jl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ext/TempestRegridderExt.jl b/ext/TempestRegridderExt.jl index a987e284..1cdc48ab 100644 --- a/ext/TempestRegridderExt.jl +++ b/ext/TempestRegridderExt.jl @@ -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 @@ -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) @@ -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, @@ -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(