Skip to content

Add dnwm: CDEPS data component for NWM river discharge (one-way NWM to OCN) - #4

Draft
mansurjisan wants to merge 5 commits into
oceanmodeling:feature/coastalappfrom
mansurjisan:pr/dnwm-data-component
Draft

Add dnwm: CDEPS data component for NWM river discharge (one-way NWM to OCN)#4
mansurjisan wants to merge 5 commits into
oceanmodeling:feature/coastalappfrom
mansurjisan:pr/dnwm-data-component

Conversation

@mansurjisan

@mansurjisan mansurjisan commented Jul 9, 2026

Copy link
Copy Markdown

What

Adds dnwm, a CDEPS data component that reads a National Water Model discharge stream and exports a single field, river_volume_flux (m^3 s-1), one value per unstructured-mesh element. It is the data-ingestion half of one-way NWM -> ocean river forcing for the coastal application (used with a companion ufs-weather-model wiring PR; addresses the data-ingestion portion of ufs-weather-model's NWM coupling roadmap).

Design

  • Cloned from drof and kept deliberately minimal: datamode = "copyall" passthrough of an element-indexed stream. The component knows nothing about reaches or hydrology - the reach-to-element mapping is done offline; dnwm is a faithful transport.

  • Keeps the ROF identity (dshr_init(gcomp, 'ROF', ...)) so a future CMEPS mediator route
    (ROF -> MED -> OCN) is a drop-in.

  • The exchange downstream is remapMethod=redist under an element-id contract (stream/mesh element order == ocean-model global element ids), so the exported field is volumetric m^3/s with no area-flux conversion anywhere.

  • Stream interpolation target: by default the stream is read AT the current time - on the mediator-less direct connector the consumer holds the value over [t, t+dt], so the export must be valid at the window start. A namelist option advance_to_next_time = .true. restores the standard CDEPS next-time convention for configurations where a mediator consumes the export at a later phase. Restart artifacts are always named at the window end (the CDEPS convention a continued run resumes from), independent of the interpolation target.

  • Fill values and negative discharge are clamped to zero; every clamp is counted and reported to the component log (never silent).

New dnwm/ (cloned from drof) exporting river_volume_flux (m3 s-1,
volumetric per-element discharge), datamode copyall. cpl_scalars SetScalar
guarded by NUOPC_IsConnected for the direct NWM->OCN connector path.
Stamp river_volume_flux export at init (InitializeRealize) and each
ModelAdvance so the connector copies a valid timestamp to SCHISM. Pairs with
the SCHISM cap CheckImport override for the direct NWM->OCN connector path.
…s, build-order and rc checks, prune clone leftovers

- add missing error check after shr_strdata_advance (a failed stream read
  no longer silently exports stale discharge)
- count and log clamped special/negative discharge values instead of
  silently zeroing them
- move dnwm before dwav in the component list (cime_config/buildlib waits
  on libdwav.a as the last-built library)
- check rc from NUOPC_FieldDictionaryHasEntry and NUOPC_IsConnected before
  using their results
- remove unused clone leftovers (timeStep/nextTime, itemtype_scalar,
  ESMF alarm/state imports, i8, SHR_CONST_SPVAL, stream-domain import)
- rename next_ymd/next_tod to current_ymd/current_tod to match the
  currTime read; fix the stale next_time comment
- drop the redundant per-mode gate around restart writes (datamode is
  validated at advertise)
@mansurjisan
mansurjisan force-pushed the pr/dnwm-data-component branch from 8a8c7bc to 60d7fb6 Compare July 9, 2026 12:18
…ist option

- restart pointer/file naming now always uses the window-END time (the CDEPS
  convention a continued run resumes from), decoupled from the stream
  interpolation target which defaults to the window start
- new namelist option advance_to_next_time (default .false., the validated
  direct-connector behavior) restores the standard CDEPS next-time
  interpolation convention for configurations where a mediator consumes the
  export at a later phase
- document the deliberate ROF identity at dshr_init and its consequences
  (default log name, PIO keying, no coexistence with drof)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant