Skip to content

Calculate and add new fields to clm history - #4288

Draft
slevis-lmwg wants to merge 7 commits into
ESCOMP:b4b-devfrom
slevis-lmwg:extra_lnd_vars_for_CMIP
Draft

slevis-lmwg wants to merge 7 commits into
ESCOMP:b4b-devfrom
slevis-lmwg:extra_lnd_vars_for_CMIP

Conversation

@slevis-lmwg

@slevis-lmwg slevis-lmwg commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Motivated by CMIP7 and/or other requests. Here are the requests from issue (#4240) + any new ones as they come in:

2026/9/30 email thread with Abby Swann sums up to these requests:

  • Calculate PSNSUNLN and add to history (where LN = local noon)
  • Would also like RH_LEAF (currently default='inactive' and Claude tells me not even actually calculated, so skipping) or VPD_CAN, though again preferably at LN, so at least add LN version of the latter (doing this)

Earlier request for _ICE fields appears here:
#4035

@wwieder suggests adding all mortality fields into a total mortality (see #4304):

  • Maybe this should also differentiate between M*_FIRE and total mortality (which includes fire)? Maybe need to check what's in the CMIP7 data request?

From Heather Graven's email request (Claude found that these are available and may just need a fincl to activate):
C13 + C14 CWD, wood, and one or two sub-pools of soil carbon. <-- Might as well do all 3 SOM pools.

Explicit field list is in the spreadsheet:
https://docs.google.com/spreadsheets/d/1-sjjQraIT1sYlRsAcbSvF7Zma5ZjKac60ePiQqhOYSc/edit?gid=991078248#gid=991078248

Specific notes

Contributors other than yourself, if any:

CTSM issues resolved or otherwise addressed, if any:
Resolves #4240

Testing planned or performed, if any:

  • aux_clm

Requirements before merge:

  • The code in this PR branch builds with no errors.
  • The code in this PR branch runs with no errors: Testing documented below.
  • This does not change answers, only changes field lists.
  • I have reviewed relevant parts of the CLM documentation Tech Note or User's Guide to determine if anything needs to be changed or added. If it does, describe:
  • Update the .rst files that list clm's field lists.

@slevis-lmwg slevis-lmwg self-assigned this Oct 28, 2026
@slevis-lmwg slevis-lmwg added the b4b bit-for-bit label Oct 28, 2026
@github-project-automation github-project-automation Bot moved this to Ready to start (or start again) in CTSM: Upcoming tags Oct 28, 2026
@slevis-lmwg slevis-lmwg moved this from Ready to start (or start again) to In progress - b4b-dev in CTSM: Upcoming tags Oct 28, 2026
@slevis-lmwg slevis-lmwg moved this from Todo to In Progress in LMWG: Sprint Planning Board Oct 28, 2026
@slevis-lmwg slevis-lmwg linked an issue Oct 28, 2026 that may be closed by this pull request
@slevis-lmwg

slevis-lmwg commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Add daily output to my ERS_D_Ld20.f10_f10_mt201.I1850Clm60Bgc.derecho_intel.20261028_174104_1rh6ic to confirm that the new field(s) work (trying with ERS_D_Ld20.f10_f10_mt201.I1850Clm60Bgc.derecho_intel.clm-extra_outputs)

claude --resume d6999fa6-9b5f-406b-ac42-d49a8312d230
and revisit my last step before proceeding.

@wwieder wwieder mentioned this pull request Nov 6, 2026
@slevis-lmwg

slevis-lmwg commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

To avoid changing answers, I have reverted the last commit, which was a one-line addition plus comment; however,

  • Open issue about it and GSSUNLN/GSSHALN? Claude states the following:
    GSSUNLN and GSSHALN probably have the same gap I fixed for IWUELN, though I haven't confirmed it in output.
    The photosynthesis routines only write them for patches in the exposed-vegetation filter, and set them to
    spval outside the noon window. But nothing resets them when a patch leaves the filter: neither TimeStepInit
    nor CanopyFluxesResetDiagnostics does. A patch that leaves right after a noon step would keep that
    conductance and have it averaged in at every step. The fix is the same: set both to spval in
    CanopyFluxesResetDiagnostics. That routine doesn't currently receive photosyns_inst, so the change is a few
    lines in that routine and its call in clm_driver.F90.

Looking further through the spreadsheet, I asked Claude:
Do we output Jmx25Z?
and got this, which would change answers, so

  • I'm saving for an answer-changing issue:
- Jmx25Z is written when LUNA is on, which your case has enabled, but the array is initialized to 60 rather than
  spval, so I'm checking how LUNA handles non-vegetated patches.

- Yes. Jmx25Z is registered in PhotosynthesisMod.F90:713 (as a 1-D field, since nlevcan = 1), alongside Vcmx25Z.
  Both are only registered when use_luna = .true., which is the case in your test. They're active by default
  and use avgflag='A'. JMX25T also exists: it uses avgflag='M' (maximum over the history interval) and returns
  missing for lakes and urban.

  However, Jmx25Z (and Vcmx25Z) include placeholder values for patches without vegetation.
  - jmx25_z_patch is allocated with a value of 60 everywhere, and vcmx25_z_patch with 30
    (PhotosynthesisMod.F90:373-374).
  - LUNA only updates patches in the exposed-vegetation filter (CanopyFluxesMod.F90:1723). Bare ground, lakes,
    urban, glacier and wetland patches keep 60 and 30 permanently, and these are saved and reloaded through
    restarts.
  - Neither field is registered with set_lake, set_urb or set_spec. So the gridcell average weights those
    placeholders in, just like real values.

  Your last test confirms this. Of the 84 gridcells with TLAI = 0 on the last day, 70 report exactly Jmx25Z = 60
  and Vcmx25Z = 30, the placeholders rather than LUNA output. In vegetated gridcells, the placeholders from
  bare-ground or special-landunit patches pull the average toward 60 and 30.

  This is in the base code, not something this branch introduced. Fixing it takes some care, because these
  arrays are model state (restart variables used by photosynthesis), not history-only values:
  1. Simplest, but not robust: add set_spec=spval to the registration, plus spval for bare-ground patches. This
     writes into the state arrays at startup, and a restart or initial-conditions file written before the fix
     would reload the 60 and 30 values.
  2. Robust (my recommendation): add history-only copies of the two fields. Each step, set them to spval for
     special-landunit and bare-ground patches, and copy LUNA's values for vegetated patches. Dormant or
     snow-buried vegetation would keep LUNA's retained last-valid value, which is a real property of those
     leaves. The model state stays untouched, results don't change, and old restart files are fine.

  Want me to implement option 2, or just leave the caveat documented?

@slevis-lmwg

slevis-lmwg commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Ok, I have

  • addressed Abby's request to add new fields PSNSUNLN and VPD_CANLN
  • verified that other fields requested already exist in the model

I have not followed up so far regarding anything we may wish to do to fire variables.

I will run aux_clm to confirm b4b:
./run_sys_tests -s aux_clm -c ctsm5.4.066 --skip-generate LOOKS LIKE I SHOULD HAVE COMPARED TO 069

  • derecho
  • izumi

This branch has not been deployed

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

Labels

b4b bit-for-bit

Projects

Status: In progress - b4b-dev
Status: In Progress

Development

Successfully merging this pull request may close these issues.

Extra land variables for CMIP output

1 participant