Feature/wjiang/cs to loc - #5251
Open
weiyuan-jiang wants to merge 6 commits into
Open
Conversation
- Register LocStreamGeomFactory in GeomManager singleton initialize() (was only registered in the unused new_GeomManager() constructor) - Support ESMF_GEOMTYPE_LOCSTREAM in FieldBundleSet - Implement LocStreamGeomFactory make_file_metadata (loc dim + lon/lat coordinate variables), previously a stub - Dispatch componentDriverGridComp internal-state init on geomtype to support LocStream (rank-1) geometries in addition to Grid Verified against MAPL.geom.tests, MAPL.regridder_mgr.tests, and all existing MAPL3G_Comp_Test_case* cases (no regressions). Known remaining gaps (see follow-up issue): - Generic Aspect-based coupling extension does not converge when regridding into a LocStream target - FieldPointerUtilities::clone() is ESMF_Grid-only
Root cause: FieldBundleGet's internal get_geom() helper only
handled ESMF_GEOMTYPE_GRID; for any other geomtype (e.g.
LocStream) it silently left the geom argument untouched instead
of failing loudly, because the caller only invokes it when
has_geom is true but never checks whether geom was actually
populated. This meant GeomAspect update_from_payload kept
reading back the stale source geom from a regrid-transform
output field bundle instead of the newly-regridded destination
(LocStream) geom, so GeomAspect matches() never succeeded and
StateRegistry_Extensions extend() looped until hitting the
MAX_ITERATIONS=10 cap ("StateItem extensions for v_pt did not
converge").
Fix: add a LOCSTREAM branch to FieldBundleGet get_geom(),
mirroring the GRID branch and the LOCSTREAM branch already
added to FieldBundleSet.
Also wire up NEAREST_STOD as a supported regrid method string in
RoutehandleParam (previously only bilinear/conserve were
serializable via ESMF_Info), since CubedSphere to LocStream
regridding should use nearest-neighbor-to-destination-point,
not bilinear/conservative.
Verified: MAPL.geom.tests, MAPL.regridder_mgr.tests, all
MAPL.generic.* pFUnit suites, and all 35 MAPL3G_Comp_Test_case*
tests pass. Manually verified against a CubedSphere to LocStream
coupling reproduction case that the convergence loop is gone
(RUN_MODE=CompareImportsToReference/GenerateExports across two
componentDriverGridComp instances now successfully completes
generic coupling initialize; the only remaining failure is the
already-tracked, separate FieldPointerUtilities clone()
ESMF_Grid-only gap in FILL_DEF constant fill, unrelated to
coupling).
FieldPointerUtilities::clone() unconditionally called
ESMF_FieldGet(x, grid=grid, ...) followed by
ESMF_GridGet(grid, dimCount=grid_rank, ...), which only works
for ESMF_Grid fields. Any field on a non-Grid geometry
(LocStream, Mesh, XGrid) caused an ESMF runtime abort.
Fix: retrieve the field geometry via ESMF_FieldGet(geom=) and
obtain the dimension count generically through ESMF_GeomGet.
For the ESMF_INDEX_USER and non-USER branches, dispatch on
is_grid to pick the correct ESMF_FieldCreate overload:
- Grid path: extract the concrete ESMF_Grid with
ESMF_GeomGet(grid=) and pass staggerloc (Grid-only).
- Non-Grid path: pass the ESMF_Geom directly; omit
staggerloc (not a valid argument for that overload).
Verified: all 70 ctest tests pass including a new manual
CubedSphere->LocStream coupling reproduction case (two
componentDriverGridComp instances, FILL_DEF constant fill on
CS, CompareImportsToReference on LocStream with
regrid: NEAREST_STOD in ExtData).
Two-step component-testing-framework test exercising the full
CubedSphere -> LocStream regridding pipeline:
Step 1 (cap1): GCM1 on CubedSphere(c12, 6 PETs) runs in
GenerateExports mode, filling field E_1 with a constant 17.0.
History writes the field to test.nc4 on the native CS grid.
Step 2 (cap2): GCM2 on a 24-point LocStream (lon/lat spread
globally) runs in CompareImportsToReference mode. ExtData
reads test.nc4 and regrids E_1 to the LocStream using
NEAREST_STOD (nearest-neighbor-to-destination-point, the
correct method for Grid->LocStream). Because the source
field is a spatial constant (17.0), nearest-neighbor
interpolation preserves the value exactly, so the
CompareImportsToReference check passes.
This test would have been impossible without the five LocStream
infrastructure fixes on this branch:
1. GeomManager::initialize() missing LocStreamGeomFactory
2. FieldBundleSet unsupported geomtype for LocStream
3. LocStreamGeomFactory::make_file_metadata stub
4. FieldBundleGet::get_geom() missing LocStream branch
(aspect-extension convergence fix)
5. FieldClone/clone() ESMF_Grid-only (this commit's prereq)
4 tasks
Contributor
Author
|
Only nearest method to reggrid from CubedSphere to Locstream is used |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Types of change(s)
Checklist
make tests)Description
Related Issue