Skip to content

cam6_4_206: Moving-mountain GWD: MMTAUE/W/S/N diagnostics and atmos_phys bump for tilt/precip source options - #1684

Merged
jimmielin merged 7 commits into
ESCOMP:cam_developmentfrom
JulioTBacmeister:movmtn-mmtau-diagnostics
Oct 4, 2026
Merged

jimmielin merged 7 commits into
ESCOMP:cam_developmentfrom
JulioTBacmeister:movmtn-mmtau-diagnostics

Conversation

@JulioTBacmeister

Copy link
Copy Markdown
Collaborator

Summary

Adds directional (E/W/S/N) Reynolds-stress history diagnostics
(MMTAUE/MMTAUW/MMTAUS/MMTAUN) for the moving-mountain gravity wave
source, and bumps src/atmos_phys to pick up new opt-in flow-dependent
tilt/precipitation source formulations for that scheme.

This PR is blocked on, and must not be merged before, the companion
atmos_phys PR: ESCOMP/atmospheric_physics#448
The src/atmos_phys submodule pointer here currently points at the tip of
that PR's branch on my personal fork (a temporary placeholder) rather than
a real upstream commit, since that PR hasn't merged yet. It will be
updated to the real, tagged upstream commit once #448 merges.

  • gw_drag_cam.F90: wires the scheme's new taucd_west/east/south/north
    outputs into 4 new history fields (MMTAUE/W/S/N, interface levels,
    units Pa), named by direct analogy to the existing Beres BTAUE/W/S/N
    diagnostics but with a plain MM prefix, manually added rather than
    routed through the generic scheme-prefix infrastructure (per author
    preference — the existing infra was judged more general than needed
    here). Also adds TILT_MOVMTN/PSTEER_MOVMTN/PLAUNCH_MOVMTN
    diagnostics and threads a new prect input to the scheme.
  • Also fixes several pre-existing outfld calls that passed ncol
    instead of pcols as the array-bound argument (CAM convention);
    affects only fill values in unused padding columns of those diagnostic
    fields, not the prognostic state.
  • namelist_definition.xml: doc-string-only update for movmtn_source
    describing the new valid values 3-5; default (1) and valid_values
    unchanged.
  • No answer changes for any existing configuration: movmtn_source
    defaults to 1, which exercises only the pre-existing, unchanged
    vorticity_flux_src path; new outputs are write-only diagnostics.

AI involvement disclosure

This PR was produced through heavy, sustained collaboration with Claude
(Anthropic's Claude Code), across every stage: reconciling two weeks of
local development against current cam_development via 3-way merge,
diagnosing and fixing a merge-introduced compile error via an actual test
build, adding the new diagnostics, and drafting this PR/ChangeLog text.
All changes were reviewed and directed by the human author (Julio
Bacmeister) throughout, but the mechanical and drafting work was
substantially done by Claude, not just lightly assisted.

Test plan

  • Compiled successfully (QPC7 compset, ne3pg3_ne3pg3_mt232 grid, casper
    machine): 0 warnings/errors in the modified files.
  • Full aux_cam regression suite (derecho/intel, derecho/nvhpc,
    izumi/nag, izumi/gnu) has not yet been run against this branch —
    opening as draft pending that and pending part of cam6_3_033: Increase default number of tasks on cheyenne for WACCMX #448.
  • Reconciled via git merge-file 3-way merge against the true upstream
    base; confirmed the only real upstream drift was two cosmetic/
    precision-suffix changes unrelated to this branch.

🤖 Generated with Claude Code

JulioTBacmeister and others added 4 commits September 24, 2026 11:18
- Add local arrays and outfld/addfld calls for MMTAUE, MMTAUW, MMTAUS,
  MMTAUN: cardinal-direction Reynolds stresses for the moving-mountain
  gravity wave source, named by direct analogy to Beres's existing
  'B'-prefixed outputs (manually named, not routed through the generic
  scheme-prefix infrastructure).
- Wire the 4 new taucd_west/east/south/north intent(out) args from
  gravity_wave_drag_moving_mountain_run into gw_drag_cam.F90.
- Update namelist_definition.xml doc string for movmtn_source to describe
  all 5 valid values (1=vorticity, 2=PBL momentum flux, 3=tilt-layer-mean,
  4/5=tilt+precip fits); default and valid_values unchanged.
- Bump src/atmos_phys submodule pointer to the branch tip on
  JulioTBacmeister/atmospheric_physics as a temporary placeholder,
  pending merge of the companion atmos_phys PR:
  ESCOMP/atmospheric_physics#448

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
gw_drag_cam_init requested the TTEND_DP pbuf index whenever
(use_gw_convect_dp .or. use_gw_movmtn_pbl), but convect_deep.F90 only
ever registers that field when use_gw_convect_dp .and. deep_scheme=='ZM'.
Running with the moving-mountain source on and use_gw_convect_dp=.false.
therefore failed at init looking up a field that was never added to
pbuf.

gravity_wave_drag_moving_mountain.F90 confirms ttend_dp/netdt is only
read in the use_gw_movmtn_pbl=.false. (legacy, non-PBL) branch of
gw_movmtn_src; every currently-supported movmtn_source path requires
use_gw_movmtn_pbl=.true. and never touches it. So the fix is simply to
stop requesting the index unless the actual producer (deep convection
GW) is enabled; the existing "if (ttend_dp_idx > 0)" fallback already
zero-fills the array otherwise.

Verified: case.build (0 warnings/errors) and a 5-day case.submit run
with use_gw_convect_dp=.false. + use_gw_movmtn_pbl=.true. completed
successfully (CaseStatus: "model execution success"), where it
previously failed at init.

Also bumps the src/atmos_phys submodule pointer to 2a5b2df (the
comment-restoration commit already pushed to atmospheric_physics#448),
which had been left stale after that push.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… PRECT

- Sum PREC_DP + PREC_SH + PREC_STR through the atmos_phys interstitial
  compute_total_precipitation_rate_run, the same routine CAM-SIMA runs, so the
  summation order matches between the two hosts.
- PREC_STR replaces PREC_SED + PREC_PCW (PREC_STR = PREC_PCW + PREC_SED in physpkg).
- Drop the errcode/index guards: all three fields always exist wherever
  gw_drag_cam runs (moist physics only), so a missing field should abort.

Assisted-by: claude-opus:5.5
@jimmielin
jimmielin marked this pull request as ready for review September 30, 2026 19:53
@jimmielin
jimmielin self-requested a review October 1, 2026 21:12
@cacraigucar cacraigucar self-assigned this Oct 1, 2026
@jimmielin jimmielin assigned jimmielin and unassigned jimmielin Oct 1, 2026
jimmielin pushed a commit to ESCOMP/atmospheric_physics that referenced this pull request Oct 2, 2026
…ectional stress diagnostics (#448)

## Summary

Adds flow-dependent tilt/precipitation source options to the
moving-mountain
gravity wave drag scheme, plus new cardinal-direction Reynolds-stress
diagnostics. This is a companion PR to
ESCOMP/CAM#1684, which
adds the corresponding `MMTAUE/W/S/N` history outputs and namelist
documentation.

- New opt-in `movmtn_source` values 3-5 (tilt-layer-mean; tilt+precip
  6-parameter fit; tilt+precip PySR cx17 fit). Existing values 1
  (vorticity, default) and 2 (PBL momentum flux) are unchanged.
- New diagnostic-only outputs threaded through as `intent(out)`:
  `taucd_west/east/south/north` (directional Reynolds stresses from
  `gw_common`'s `calc_taucd`), plus `tilt`, `p_steer`, `p_launch`.
- New `prect` input, used only by the new precip-dependent source
options.
- None of the new pathways are reached unless a user explicitly sets
  `movmtn_source` to 3/4/5; default behavior and answers are unchanged.

## AI involvement disclosure

This PR was produced through heavy, sustained collaboration with Claude
(Anthropic's Claude Code), across every stage: reconciling two weeks of
local development against current `main` via 3-way merge, diagnosing and
fixing a merge-introduced compile error via an actual test build, adding
the new diagnostic outputs, and drafting this PR/ChangeLog text. All
changes were reviewed and directed by the human author (Julio
Bacmeister)
throughout, but the mechanical and drafting work was substantially done
by
Claude, not just lightly assisted.

## Test plan

- Compiled successfully (QPC7 compset, `ne3pg3_ne3pg3_mt232` grid,
casper
  machine): 0 warnings/errors in the modified files.
- Full `aux_cam` regression suite (derecho/intel, derecho/nvhpc,
izumi/nag,
  izumi/gnu) has **not** yet been run against this branch — opening as
  draft pending that.
- No answer changes expected for any existing configuration, since
  `movmtn_source` defaults to 1.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Haipeng Lin <hplin@ucar.edu>

@jimmielin jimmielin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JulioTBacmeister

Ready for tagging.

@jimmielin jimmielin changed the title Moving-mountain GWD: MMTAUE/W/S/N diagnostics and atmos_phys bump for tilt/precip source options cam6_4_206: Moving-mountain GWD: MMTAUE/W/S/N diagnostics and atmos_phys bump for tilt/precip source options Oct 3, 2026
@jimmielin
jimmielin merged commit 6966333 into ESCOMP:cam_development Oct 4, 2026
2 checks passed
@cacraigucar cacraigucar assigned jimmielin and unassigned cacraigucar Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Tag

Development

Successfully merging this pull request may close these issues.

4 participants