ESCOMP / ESCOMP/CAM

*_PDC physics-dynamics coupling diagnostics wrong on CSLAM (pgN) grids: missing dp_fvm weighting

Open
#1,669 0 comments 0 reactions 1 assignee Claimed by @cacraigucar View on GitHub
bug misc tag
Dominant language
No language data
Stars
91
Forks
183
Avg merge
6d 2m
Merged PRs (30d)
9

Description

### What happened?

Observed by `claude-fable-5-1` in CAM-SIMA FHIST_C4 ne16 runs but the code is identical in CAM.

The column-integrated physics-dynamics coupling loss diagnostics `WV_PDC, WL_PDC, WI_PDC, TT_PDC` are output in the wrong units on any CSLAM (fv_nphys > 0, pgN) grid. They are too small by roughly a factor of dp_fvm (~1e2 to 1e4 Pa).

This is diagnostic-only and is not model state changing (not sure if it is answer-changing or not depending on regression test coverage). Both `ftmp` and `ftmp_fvm` are flagged "Only used for diagnostics!".

GLL / pg0 output is correct.

**Proposed fix**

Weight the fvm increment by dp_fvm at the source, matching the energy-diagnostics usage, in `prim_advance_mod.F90:385`

```fortran
ftmp_fvm(i,j,k,q,ie) = (tmp-v1)*fvm(ie)%dp_fvm(i,j,k) !Only used for diagnostics!
```

### What are the steps to reproduce the bug?

Run FHIST_C4 ne16pg3: WV_PDC values are <= 0 with magnitude <= 2e-26, consistent with mixing-ratio (kg/kg) units rather than kg/m2.

### What CAM tag were you using?

cam6_4_199

### What machine were you running CAM on?

CGD machine (e.g. izumi)

### What compiler were you using?

GNU

### Path to a case directory, if applicable

_No response_

### Will you be addressing this bug yourself?

Any CAM SE can do this

### Extra info

Root cause analysis by `claude-opus-4-8` (reported originally by `claude-fable-5-1`)

`util_function` (`src/dynamics/se/dycore/prim_advance_mod.F90`) column-integrates its input and multiplies by `rga` (1/g), so it expects a `Qdp`-like mass in Pa*kg/kg and returns kg/m2.

- GLL path: `ftmp = dt*FQ - v1` is a Qdp increment (Pa*kg/kg), since `v1 = dt*FQ` is added directly to state%Qdp. Correct.
- CSLAM path: `tmp = dt*fc/dp_fvm`, and `fc = fc_phys*dp_fvm` (fvm_mapping.F90), so `tmp = dt*fc_phys` is a mixing-ratio increment (kg/kg), applied to `fvm%c`. Therefore `ftmp_fvm = tmp - v1` is kg/kg, missing the dp_fvm factor.

`output_qdp_var_dynamics` passes both to util_function identically, so the CSLAM diagnostic is short one dp_fvm.

Corroboration: in the energy/mass diagnostics in the same file, every CSLAM `fvm%c` handed to util_function is first multiplied by dp_fvm (e.g. `cdp_fvm = fvm(ie)%c(...)*fvm(ie)%dp_fvm(...)`), while the GLL branch passes `qdp` directly. That is exactly the factor absent from the PDC path.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.