Skip to content

noresm3_0_038_cam6_4_121: Do not create two CO2 tracers#284

Merged
gold2718 merged 3 commits into
NorESMhub:noresm_developfrom
gold2718:fix_co2_cycle
Jun 15, 2026
Merged

noresm3_0_038_cam6_4_121: Do not create two CO2 tracers#284
gold2718 merged 3 commits into
NorESMhub:noresm_developfrom
gold2718:fix_co2_cycle

Conversation

@gold2718

@gold2718 gold2718 commented Jun 14, 2026

Copy link
Copy Markdown

Summary: Introduce change from NorESM2.3 to defer to chemistry when it has an active CO2 specie

Contributors: @gold2718

Reviewers: @mvertens

Purpose of changes: co2_cycle (for emission runs) creates a second CO2 tracer when chemistry when it has an active CO2 specie

Github PR URL: #284

Changes made to build system: Adjust pcnst when both co2_cycle and a GHG chemistry are active

Changes made to the namelist: None

Changes to the defaults for the boundary datasets: None

Substantial timing or memory changes: None

Details:

  • Only create one total CO2 tracer when a CO2 chemistry is running and co2_cycle is on
  • When sharing total CO2 between co2_cycle and chemistry, do not create duplicate CO2 diagnostic fields
  • Create NFxxxxesmGhg esm compsets (so that co2_cycle is turned on)
  • Add test for an esm compset running ghg_mam_oslo chemistry

Testing:

  • aux_cam_noresm on Olivia: All pass except for missing baseline for new test
  • aux_cam_noresm on Betzy: All pass except for missing baseline for new test

- Only create one total CO2 tracer when a CO2 chemistry is running
  and co2_cycle is on
- When sharing total CO2 between co2_cycle and chemistry, do not
  create duplicate CO2 diagnostic fields
- Create NFxxxxesmGhg esm compsets (so that co2_cycle is turned on)
- Add test for an esm compset running ghg_mam_oslo chemistry
@gold2718 gold2718 added this to the noresm3_0_beta20 milestone Jun 14, 2026
@gold2718 gold2718 requested a review from mvertens June 14, 2026 10:23
@gold2718 gold2718 self-assigned this Jun 14, 2026
@gold2718 gold2718 added the bug Something isn't working label Jun 14, 2026
@gold2718 gold2718 moved this from Todo to In Progress in NorESM Development Jun 14, 2026
Comment thread bld/configure
Comment thread cime_config/config_component.xml
Comment thread cime_config/config_component.xml Outdated
<!-- This should move to a CAM use case file
<!-- These values are set here since it is part of the compset
definition -->
<value compset="_BGC%BDRP"> co2_cycle_rad_passive=.false. </value>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CMEPS has no setting for BGC%BDRP. It only has BGC%BPRP and BGC%BDRD - you want to have this be BGC%BPRP instead.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Oops, fixed.
Thanks for catching the typo.

Comment thread src/physics/cam/cam_diagnostics.F90 Outdated
!
! Quadratic height fiels Z3*Z3
!
ftem(ncol+1:,:) = 0.0_r8

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you please add a comment as to why you need ncol+1:

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It's because of all the outfld calls that pass pcols. I wanted to make sure no bad numbers (or NaNs) could cause problems. Alternatively, I could change those outfld calls.

call cnst_add(c_names(icnst), c_mw(icnst), c_cp(icnst), c_qmin(icnst), c_i(icnst), &
longname=c_names(icnst), mixtype='dry')

call cnst_get_ind(c_names(icnst), c_i(icnst), abort=.false.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Would be good to add a comment like the following:
This logic prevents duplicate CO2 tracers from being created. The fix checks whether the CO2 tracer already exists before attempting to register it. If it exists (found in the constituent database), the code skips the cnst_add() call and sets local_co2 = .false., avoiding duplication.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why are you setting local_co2 to be true or false in a loop over constituents? Would you not want to check if the name is co2 before you set the local value? It seems like this will be reset for every constituent that is added. Maybe I am missing a critical piece.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I agree, this is a logic flaw that happened to not cause any problems because CO2 is the last constituent in the array. Logic has been made more robust and a duplicate of any of the other constituents is an error.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks correct now.

Steve Goldhaber added 2 commits June 14, 2026 23:39
@gold2718 gold2718 requested a review from mvertens June 14, 2026 22:11
call cnst_add(c_names(icnst), c_mw(icnst), c_cp(icnst), c_qmin(icnst), c_i(icnst), &
longname=c_names(icnst), mixtype='dry')

call cnst_get_ind(c_names(icnst), c_i(icnst), abort=.false.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks correct now.

@gold2718 gold2718 merged commit 336984c into NorESMhub:noresm_develop Jun 15, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in NorESM Development Jun 15, 2026
@gold2718 gold2718 deleted the fix_co2_cycle branch June 15, 2026 18:03
@gold2718 gold2718 changed the title Do not create two CO2 tracers noresm3_0_038_cam6_4_121: Do not create two CO2 tracers Jun 15, 2026
@gold2718 gold2718 mentioned this pull request Jun 17, 2026
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants