Skip to content

Custom-grid cases keep create_newcase's USER_RES placeholder ROF_NX/ROF_NY (rx1 360x180 for GLOFAS) and ATM/LND_NX/NY=0, so the coupler restart truncates runoff fields #57

Open

Description

@manishvenu

Found by the CrocoDash 1.0.x audit (2026-11-06), against CrocoDash main b8991c89 and the copies it pins (regional-mom6 3ca8b9b, visualCaseGen 0eb6fd6, mom6_forge d74c851). Each finding was reproduced by a separate verifier; repro scripts are in the CROC monorepo under dev/crocodash_1_0_x/audit_repros/.

  • Repo: visualCaseGen
  • Severity: wrong result
  • Evidence: confirmed by repro (audit id vcg-a8)
  • Confidence: high
  • Location: CrocoDash/visualCaseGen/visualCaseGen/custom_widget_types/case_creator.py:960 (ATM_GRID), :962 (LND_GRID), :968-970 (ROF_GRID); also :955-956 (standard WAV_GRID). Missing NX/NY xmlchanges in _update_component_grids_xml.
  • Already fixed on main: No (target is ESMCI/visualCaseGen main; pin 0eb6fd6 == ESMCI main, and no open visualCaseGen PR or local branch adds the NX/NY xmlchanges)
  • Related: none (visualCaseGen Miscellaneous pre-existing issues found while reviewing #45 #47 covers other case_creator.py defects; TRIAGE item 13 / visualCaseGen compatibility with docn issue CROCODILE-CESM/CrocoDash#232 is a different grid constraint)

What's wrong. CrocoDash builds CaseCreator with add_grids_to_ccs_config=False (CrocoDash/case.py:480), so create_newcase runs with --res USER_RES. The USER_RES alias is empty, so the ATM and LND grids start as null (NX/NY=0) and the ROF grid gets the model_grid_defaults value for DROF, rx1 (360x180). update_component_grids_xml then xmlchanges ATM_GRID, LND_GRID and ROF_GRID and their DOMAIN_MESH, but not their NX/NY. It does set NX/NY for OCN, ICE and WAV. The result for any DROF%GLOFAS compset is ROF_GRID=GLOFAS with the GLOFAS mesh (7200x3000 = 21.6M elements) but ROF_NX=360 and ROF_NY=180, plus ATM_NX/NY=0 and LND_NX/NY=0. GRID keeps the stale long name a%null_l%null_oi%null_r%rx1.... DROF's namelist takes nx_global/ny_global from $ROF_NX/$ROF_NY (namelist_definition_drof.xml), and the generated drof_in has nx_global = 360 and ny_global = 180. DROF exports these to the mediator. med_phases_restart_write passes them to med_io_write, which only logs a 'grid2d size not consistent' warning, defines rofImp_nx=360 and rofImp_ny=180, and writes the rof import and fraction fields into those 64,800 slots. The cpl.r file therefore holds only the first 64,800 GLOFAS points (lat -59.975..-59.575) and drops the other 99.7%. On a continue run, med_io_read_init_iodesc reads with the file's 360x180 dims and only warns when ng > grid size, so it does not warn here. ATM_NX/NY=0 is harmless (the mediator falls back to a 1-D layout: atmImp_nx=204800, atmImp_ny=1). The run does not crash, and I found nothing showing the ocean solution changes. On a restart the truncated rofImp should reach only med_phases_diag_rof before DROF refreshes it; that is reasoned from nuopc.runseq, not run.

Who hits it. Any CrocoDash case with a data runoff component: CR_JRA, CWR_JRA, CR_JRA_RYF, CWR_JRA_RYF, GR_JRA, GWR_JRA, CR1850MARBL_JRA, GR1850MARBL_JRA (all DROF%GLOFAS), created through Case(), the CLI or YAML. ATM/LND_NX/NY=0 and the stale GRID long name affect every CrocoDash case but are only cosmetic.

Repro.

source dev/crocodash_1_0_x/audit_repros/env.sh; cd dev/crocodash_1_0_x/audit_repros/verify/vcg-a8 && timeout 900 $PY -u repro.py
Key lines: Grid(lenx=4, leny=4, resolution=0.5, xstart=-60, ystart=30); Topo.set_flat(1000); VGrid.uniform(nk=5, depth=1000); Case(compset="CR_JRA", atm_grid_name="TL319", machine="derecho", override=True). The script then parses env_build.xml with ElementTree (no xmlquery). Fix check: fixtest.py, in the same dir, monkeypatches CaseCreator._update_component_grids_xml to also xmlchange _NX/NY from self._cime.domains[comp][grid]. Runtime corroboration (existing CrocoDash CLI SMS run, read-only): ncdump -h /glade/derecho/scratch/manishrv/SMS_D_Ld2.USER_RES.CR_JRA_GLOFAS.derecho_intel.crocodash.20261106_140157/run/*.cpl.r.2020-01-03-00000.nc, plus grep nx_global run/drof_in.

  • Expected: ROF_NX=7200 and ROF_NY=3000 (component_grids_nuopc.xml, domain GLOFAS), ATM_NX/LND_NX=640 and ATM_NY/LND_NY=320 for TL319. drof_in should have nx_global=7200 and ny_global=3000, and the cpl.r rof fields should cover all 21.6M GLOFAS points.
  • Observed: repro.py: GRID = a%null_l%null_oi%null_r%rx1_g%null_w%null_z%null_m%null; ATM_GRID = TL319, ATM_NX = 0, ATM_NY = 0; LND_NX = 0, LND_NY = 0; OCN_NX = 8, ICE_NX = 8 (correct); ROF_GRID = GLOFAS, ROF_NX = 360, ROF_NY = 180, ROF_DOMAIN_MESH = .../GLOFAS.v4.dis24.ESMFmesh_20260501.nc. The real CrocoDash SMS run (TestStatus: PASS RUN) has the same XML, with drof_in 'nx_global = 360', 'ny_global = 180'. Its cpl.r has dimensions 'rofImp_nx = 360 ; rofImp_ny = 180', and rofImp_lat spans only -59.975..-59.575, i.e. the first 9 of 3000 GLOFAS rows. Also 'atmImp_nx = 204800 ; atmImp_ny = 1'. With the fix monkeypatched: ATM_NX = 640, ATM_NY = 320, LND_NX = 640, LND_NY = 320, ROF_NX = 7200, ROF_NY = 3000.

Root cause. In the xmlchange grid path (add_grids_to_ccs_config=False), create_newcase uses the empty USER_RES alias, so NX/NY are filled from null grids or model_grid_defaults (DROF -> rx1). _update_component_grids_xml later swaps ATM_GRID, LND_GRID and ROF_GRID (and, for a standard wave grid, WAV_GRID) plus their meshes, but copies NX/NY only for the components that share the custom ocean grid. CDEPS takes nx_global/ny_global from _NX/NY, and CMEPS uses them as the 2-D dims for restart and history I/O.

Smallest fix. In _update_component_grids_xml, after each ATM_GRID, LND_GRID, ROF_GRID and standard-WAV_GRID xmlchange, add xmlchange("_NX", self._cime.domains[comp][grid].nx) and the same for _NY. The ComponentGrid namedtuple in cime_interface.py:18 already carries nx and ny. Verified by monkeypatch: this gives ATM 640x320, LND 640x320 and ROF 7200x3000. Optionally also set GRID to a consistent long name, which is cosmetic.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions