Skip to content

noresm3_0_042_cam6_4_121: override CO2 surface source to send to land/ocean#294

Merged
gold2718 merged 10 commits into
NorESMhub:noresm_developfrom
mvertens:feature/co2_surface_source
Jul 20, 2026
Merged

noresm3_0_042_cam6_4_121: override CO2 surface source to send to land/ocean#294
gold2718 merged 10 commits into
NorESMhub:noresm_developfrom
mvertens:feature/co2_surface_source

Conversation

@mvertens

@mvertens mvertens commented Jul 14, 2026

Copy link
Copy Markdown

Summary: New ability to have co2 sent to land/ocean be different than used in radiation/chemistry

Purpose of changes: address ability to run the experiments outlined in NorESMhub/NorESM#825 and #296.

Changes made to build system: None

Changes made to the namelist: New namelist group co2_surface_source_stream_nl
To activate this behavior edit user_nl_clm to have the following:

  • If you want to send latitude dependent 1850 CO2 forcing to land/ocean:
co2_surface_source = .true.
stream_co2_surface_source_mesh_filename = '$DIN_LOC_ROOT/atm/waccm/lb/cmip7_ghg_version20260607/esmf_mesh_20degLon.nc'
stream_co2_surface_source_data_filename = '$DIN_LOC_ROOT/atm/waccm/lb/cmip7_ghg_version20260607/ghg_cmip7_CMIP_CR-CMIP-1-0-0_1850_monthly_gnz_0p5degLat_version20260207_20degLon.nc'
stream_co2_surface_source_data_varname = 'CO2_LBC'
stream_co2_surface_source_taxmode = 'cycle'
stream_co2_surface_source_year_first = 1850
stream_co2_surface_source_year_last = 1850
stream_co2_surface_source_year_align = 1

If you want to send 1pct CO2 to land/ocean:

co2_surface_source = .true.
stream_co2_surface_source_mesh_filename = '$DIN_LOC_ROOT/atm/waccm/lb/cmip7_ghg_version20260607/esmf_mesh_20degLon.nc'
stream_co2_surface_source_data_filename = '$DIN_LOC_ROOT/atm/waccm/lb/cmip7_ghg_version20260607/ghg_cmip7_CMIP-1pctco2_CR-CMIP-1-0-0_0000-0166_monthly_gnz_0p5degLat_version20260207_20degLon.nc
stream_co2_surface_source_data_varname = 'CO2_LBC'
stream_co2_surface_source_taxmode = 'extend'
stream_co2_surface_source_year_first = 0
stream_co2_surface_source_year_last = 166
stream_co2_surface_source_year_align = 1

NOTE: a new namelist was also introduced for nitrogen deposition - stream_ndep_taxmode

Changes to the defaults for the boundary datasets: None

Substantial timing or memory changes: None

Detailed description of changes:
The above custom namelists must be set in user_nl_cam - there are no out of the box defaults.
The 1850 and 1pct CO2 files in $DIN_LOC_ROOT/atm/waccm/lb/cmip7_ghg_version20260607/ only had [lat,time] dimensions - and CDEPS cannot work with such files. As a result - 20deg longitude datasets were created for the above scenarios.
Verified that using the following compset 1

1850_CAM70%LT%NORESM%CAMoslo_CLM60%FATES-NCFB%NORESM_CICE_BLOM%HYB%ECO_MOSART_DGLC%NOEVOLVE_
SWAV_SESP 

at ne16pg3_tn14 - the co2 diag field sent to the ocean had the expected behavior that was different than the co2 being used internally for the radiation in CAM.

Testing:

  • All PASS for aux_cam_noresm on Olivia with expected namelist differences and two baseline changes due to fix in ndep namelist defaults

fixes #296

@mvertens
mvertens requested review from gold2718 and tjiputra July 14, 2026 13:10
@mvertens

Copy link
Copy Markdown
Author

@tjiputra - I think I've implemented the behavior you wanted in NorESMhub/NorESM#825.
Could you please give this a test. I have tested that using the latitude dependent 1850 data (see namelist summary above) gives the latitude dependent data sent to blom - whereas cam is using a global surface mean for the radiation.

@mvertens mvertens changed the title Feature/co2 surface source override co2 surface source to send to land/ocean Jul 14, 2026
@tjiputra

Copy link
Copy Markdown

@mvertens - thank you. Should i test this on beta22 or other specific branch?

Using pr-noresm3_0_beta22 branch, I got this error during case.build:
ERROR: in _validate_pair (package Build::NamelistDefinition): Variable name stream_co2_surface_source_year_align not found in /cluster/work/projects/nn9560k/tjiputra/NorESM/NorESM_beta22/components/cam/bld/namelist_files/namelist_definition.xml

@mvertens

mvertens commented Jul 15, 2026

Copy link
Copy Markdown
Author

@tjiputra - yes - please test this on beta22. However, this code is still in a PR status #294. For you to test this - you need to do the following

> git clone https://github.com/NorESMhub/NorESM
> cd NorESM
> git checkout pr-noresm3_0_beta22

edit .gitmodules to have the following

[submodule "cam"]
path = components/cam
#url = https://github.com/NorESMhub/CAM.git
#fxtag = noresm3_0_039_cam6_4_121
url = https://github.com/mvertens/CAM.git
fxtag = c07bbfc9
fxrequired = ToplevelRequired
fxDONOTUSEurl = https://github.com/NorESMhub/CAM.git

Then you can run the following

> ./bin/git-fleximod update

That should give you the CAM code you need. Please let me know if this is working for you.

@tjiputra

tjiputra commented Jul 15, 2026

Copy link
Copy Markdown

@mvertens -
in user_nl_cam:
stream_co2_surface_source_mesh_filename = '$DIN_LOC_ROOT/atm/waccm/lb/cmip7_ghg_version20260607/esmf_mesh_20degLon.nc'
should be:
stream_co2_surface_source_mesh_filename = '$DIN_LOC_ROOT/atm/waccm/lb/cmip7_ghg_version20260607/esmf_mesh_20deglon.nc'

But the run crashes:
/cluster/work/projects/nn9560k/tjiputra/noresm/n1pctCO2-BGC.ne16pg3_tn14.beta22.2026-07-15/run/atm.log.1585890.260715-111118

(shr_stream_verifyTCoord) ERROR: calendar dates must be increasing
(shr_stream_verifyTCoord) date(n), date(n+1) = 11216 10116
(shr_stream_verifyTCoord) ERROR: calendar dates must be increasing

Case directory (Olivia):
/cluster/projects/nn9560k/tjiputra/NorESM/cases-noresm3dev/n1pctCO2-BGC.ne16pg3_tn14.beta22.2026-07-15

@mvertens

Copy link
Copy Markdown
Author

@tjiputra - I had not tested the 1pctCO2 and I have you the wrong namelist:
can your try the following:

stream_co2_surface_source_year_first = 1
stream_co2_surface_source_year_last = 166
stream_co2_surface_source_year_align = 1

If this does not work - I'll try to duplicate the problem and resolve it.

@tjiputra

Copy link
Copy Markdown

@mvertens - the same error occurs again. It seems that it tries to read and cycle the first year even if I set

stream_co2_surface_source_year_first = 0
stream_co2_surface_source_year_last = 166
stream_co2_surface_source_year_align = 0

@mvertens

Copy link
Copy Markdown
Author

@tjiputra - that's very odd. I'll track this down. Sorry you ran into this.

@mvertens

Copy link
Copy Markdown
Author

@tjiputra - the problem is not in the code - it's in the dataset. I generated a time coordinate for this dataset and it seems to have duplicated the first year:
time = "0001-01-16", // time(1)
"0001-02-15", // time(2)
"0001-03-16", // time(3)
......
"0001-12-16", // time(12)
"0001-01-16", // time(13)
"0001-02-15", // time(14)
"0001-03-16", // time(15)
....
"0001-12-16", // time(24)
The problem was that the dataset started from year 0 - and I wanted to start from year 1. I'll go back to the year0 data and see if that works.

@mvertens

mvertens commented Jul 15, 2026

Copy link
Copy Markdown
Author

@tjiputra - I have fixed this file on olivia and tested that the following user_nl_cam works:

co2_surface_source = .true.
stream_co2_surface_source_mesh_filename = '$DIN_LOC_ROOT/atm/waccm/lb/cmip7_ghg_version20260607/esmf_mesh_20deglon.nc'
stream_co2_surface_source_data_filename = '$DIN_LOC_ROOT/atm/waccm/lb/cmip7_ghg_version20260607/ghg_cmip7_CMIP-1pctco2_CR-CMIP-1-0-0_0000-0166_monthly_gnz_0p5degLat_version20260207_20degLon.nc'
stream_co2_surface_source_data_varname = 'CO2_LBC'
stream_co2_surface_source_taxmode = 'extend'
stream_co2_surface_source_year_first = 0
stream_co2_surface_source_year_last = 166
stream_co2_surface_source_year_align = 1

@gold2718 gold2718 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I have several clean-up and documentation requests as well as some bug fixes and safety features.

Comment thread bld/namelist_files/namelist_defaults_cam.xml Outdated
Comment thread bld/namelist_files/namelist_definition.xml Outdated
Comment thread bld/namelist_files/namelist_definition.xml Outdated
Comment thread bld/namelist_files/namelist_definition.xml Outdated
Comment thread bld/namelist_files/namelist_definition.xml Outdated
Comment thread src/cpl/nuopc/atm_stream_co2.F90 Outdated
Comment thread src/cpl/nuopc/atm_stream_co2.F90 Outdated
Comment thread src/cpl/nuopc/atm_stream_co2.F90 Outdated
Comment thread src/cpl/nuopc/atm_stream_co2.F90 Outdated
Comment thread src/cpl/nuopc/atm_stream_ndep.F90 Outdated
@tjiputra

Copy link
Copy Markdown

@mvertens - works and runs well. I will keep this running longer and make sure the behavior of land/ocn/atm is as expected.

Could you also create a stream co2 input file for historical:
/cluster/work/projects/nn9560k/inputdata/atm/waccm/lb/cmip7_ghg_version20260607/ghg_cmip7_CMIP_CR-CMIP-1-0-0_1750-2023_monthly_gnz_0p5degLat_version20260207.nc

Thank you.

@mvertens
mvertens requested a review from gold2718 July 16, 2026 07:26
@mvertens

Copy link
Copy Markdown
Author

@tjiputra - I have created the new dataset - here is the new namelist (assuming you want to start the data at 1850)

co2_surface_source = .true.
stream_co2_surface_source_mesh_filename = '$DIN_LOC_ROOT/atm/waccm/lb/cmip7_ghg_version20260607/esmf_mesh_20deglon.nc'
stream_co2_surface_source_data_filename = '$DIN_LOC_ROOT/atm/waccm/lb/cmip7_ghg_version20260607/ghg_cmip7_CMIP_CR-CMIP-1-0-0_1750-2023_monthly_gnz_0p5degLat_version20260207_20degLon.nc'
stream_co2_surface_source_data_varname = 'CO2_LBC'
stream_co2_surface_source_taxmode = 'extend'
stream_co2_surface_source_year_first = 1850
stream_co2_surface_source_year_last = 2023
stream_co2_surface_source_year_align = 1

@tjiputra

Copy link
Copy Markdown

@mvertens - Could you correct the the unit of CO2 sent to both land and ocean, which expect [ppm] unit but receive [mol/mol]. Simply multiply them by 1e6.

@mvertens

Copy link
Copy Markdown
Author

@tjiputra - thanks for catching this! I'll put the fix in.

@mvertens

Copy link
Copy Markdown
Author

@tjiputra - I have fixed the unit conversion and pushed it back to my branch.

@tjiputra

tjiputra commented Jul 19, 2026

Copy link
Copy Markdown

@mvertens - being inexperience with git, how do i get the updated code?
When I did git pull, i got the following message:

remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Total 5 (delta 4), reused 5 (delta 4), pack-reused 0 (from 0)
Unpacking objects: 100% (5/5), 540 bytes | 30.00 KiB/s, done.
From https://github.com/NorESMhub/NorESM
424f4be..5d651db pr-noresm3_0_beta22 -> origin/pr-noresm3_0_beta22
Updating 424f4be..5d651db
error: Your local changes to the following files would be overwritten by merge:
.gitmodules
Please commit your changes or stash them before you merge.
Aborting

@gold2718

Copy link
Copy Markdown

@tjiputra

Try this:

git stash
git pull
git stash pop

@gold2718 gold2718 self-assigned this Jul 19, 2026
@gold2718 gold2718 added the enhancement New feature or request label Jul 19, 2026
@github-project-automation github-project-automation Bot moved this from Todo to In Progress in NorESM Development Jul 19, 2026
@gold2718 gold2718 added this to the noresm3_0_beta22 milestone Jul 19, 2026

@gold2718 gold2718 left a comment

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 mostly good. I will fix merge conflict and a couple of missing items.

@gold2718
gold2718 merged commit ed80c85 into NorESMhub:noresm_develop Jul 20, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in NorESM Development Jul 20, 2026
@gold2718 gold2718 changed the title override co2 surface source to send to land/ocean noresm3_0_042_cam6_4_121: override co2 surface source to send to land/ocean Jul 20, 2026
@gold2718 gold2718 changed the title noresm3_0_042_cam6_4_121: override co2 surface source to send to land/ocean noresm3_0_042_cam6_4_121: override CO2 surface source to send to land/ocean Jul 20, 2026
@mvertens

Copy link
Copy Markdown
Author

@tjiputra - if you do a clean checkout of pr-noresm3_0_beta22 you should get this tag.

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

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants