Skip to content

Landice mesh_gen: switch conservative remap weight generation from ESMF to mbtempest#952

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/fix-esmf-regridweightgen-conserve-bug
Draft

Landice mesh_gen: switch conservative remap weight generation from ESMF to mbtempest#952
Copilot wants to merge 6 commits intomainfrom
copilot/fix-esmf-regridweightgen-conserve-bug

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 20, 2026

Conservative remapping in landice mesh_gen can hang/segfault with ESMF_RegridWeightGen at high resolution. This change transitions that path to mbtempest (TempestRemap parallel flow) while keeping the existing interpolation workflow intact.

  • Core change (landice mesh_gen optional interpolation)

    • In compass/landice/mesh.py::interp_gridded2mali(), replaced conservative weight generation via ESMF_RegridWeightGen with:
      1. mbconvert (SCRIP → H5M),
      2. mbpart (parallel partitioning),
      3. mbtempest --type 5 --weights (conservative weights).
    • Preserved existing downstream remap call (interpolate_to_mpasli_grid) and weight-file contract (gridded_to_MPAS_weights.nc).
  • Operational cleanup

    • Removes intermediate .h5m files created during convert/partition to avoid workspace clutter.
  • Config/docs alignment for mesh_gen

    • Updated landice mesh_gen config comments and matching User/Developer Guide snippets so nProcs is described as controlling mbtempest (not ESMF_RegridWeightGen).
# old
srun -n ${nProcs} ESMF_RegridWeightGen --method conserve ...

# new flow
mbconvert -B source.scrip.nc source.scrip.h5m
mbpart ${nProcs} -z RCB source.scrip.h5m source.scrip.p${nProcs}.h5m
srun -n ${nProcs} mbtempest --type 5 \
  --load source.scrip.p${nProcs}.h5m \
  --load destination.scrip.p${nProcs}.h5m \
  --file gridded_to_MPAS_weights.nc --weights --gnomonic --boxeps 1e-9

Checklist

  • User's Guide has been updated
  • Developer's Guide has been updated
  • API documentation in the Developer's Guide (api.rst) has any new or modified class, method and/or functions listed
  • Documentation has been built locally and changes look as expected
  • Document (in a comment titled Testing in this PR) any testing that was used to verify the changes

Copilot AI linked an issue Apr 20, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix bug in conserve mapping with ESMF_RegridWeightGen Landice mesh_gen: switch conservative remap weight generation from ESMF to mbtempest Apr 20, 2026
Copilot AI requested a review from trhille April 20, 2026 16:08
@matthewhoffman matthewhoffman added land ice in progress This PR is not ready for review or merging labels Apr 29, 2026
@trhille
Copy link
Copy Markdown
Collaborator

trhille commented May 1, 2026

Testing this on the landice/greenland/mesh_gen case with default .cfg settings on a single Perlmutter cpu node timed out after 4 hours, sitting in the srun -n 128 mbtempest step for most of that time (I can't tell exactly how long). Meanwhile, the existing approach using ESMF_RegridWeightGen in compass/main takes only about 9.5 minutes, so something is very wrong with the implementation in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in progress This PR is not ready for review or merging land ice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conserve mapping with ESMF_RegridWeightGen

3 participants