Skip to content

Conversation

@mvertens
Copy link

@mvertens mvertens commented Nov 4, 2025

Summary: Enable fossil fuel and aircraft co2 forcing that are currently on a 2 degree FV grid to be remapped online to the model grid and time interpolated to the model time using CDEPS in-line functionality. The grid mapping is currently hard-wired to be bilinear, but I am incorporating a new namelist to also easily enable first-order conservative.

Still to do:

  • Test restarts
  • Make mapping type a namelist variable

@adagj @DirkOlivie @tjiputra - the following lists how you can get and use the new code (still in testing)

to get the current branch:

> git clone https://github.com/mvertens/NorESM noresm3_0_beta03b_co2refactor
> cd noresm3_0_beta03b_co2refactor
> git checkout feature/refactor_co2input 
> ./bin/git-fleximod update

compset and resolution

--compset 1850_CAM70%LT%NORESM%CAMoslo_CLM60%FATES_CICE_BLOM%HYB%ECO_MOSART_DGLC%NOEVOLVE_SWAV_SESP_BGC%BPRP
-res ne16pg3_tn14

user_nl_cam

interpolate_nlat           = 96
interpolate_nlon           = 144
interpolate_output         = .true.
use_aerocom                = .false.
history_aerosol            = .false.
zmconv_c0_lnd              =  0.0075D0
zmconv_c0_ocn              =  0.0300D0
zmconv_ke                  =  5.0E-6
zmconv_ke_lnd              =  1.0E-5
clim_modal_aero_top_press  =  1.D-4
bndtvg                     = '/cluster/shared/noresm/inputdata/atm/cam/ggas/noaamisc.r8.nc'
dust_emis_method           = 'Leung_2023'
dust_emis_fact             = 6.1D0
rafsip_on                  = .true.
micro_mg_dcs               = 700.D-6
clubb_c8                   =  5.3
clubb_l_do_expldiff_rtm_thlm = .true.
co2_flag                = .true.
co2_readflux_aircraft   = .true.
co2_readflux_fuel       = .true.
aircraft_co2_datafile   = '/cluster/shared/noresm/inputdata/atm/cam/ggas/emissions-cmip6_CO2_anthro_ac_ScenarioMIP_IAMC-REMIND-MAGPIE-ssp534_201401-210112_fv_1.9x2.5_c20220809.nc'
aircraft_co2_fldname    = 'ac_CO2'
aircraft_co2_meshfile   = '/cluster/shared/noresm/inputdata/share/meshes/fv1.9x2.5_141008_ESMFmesh_c20191001.nc'
aircraft_co2_year_first = 2014
aircraft_co2_year_last  = 2101
aircraft_co2_year_align = 2014
aircraft_co2_taxmode    = 'limit'
!co2flux_fuel_datafile  = '/cluster/shared/noresm/inputdata/atm/cam/ggas/emissions-cmip6_CO2_anthro_surface_ScenarioMIP_IAMC-REMIND-MAGPIE-ssp534_201401-210112_fv_1.9x2.5_c20220809.nc'
co2flux_fuel_datafile   = '/cluster/projects/nn9560k/adagj/co2files/emissions-cmip6_CO2_anthro_surface_2xScenarioMIP_IAMC-REMIND-MAGPIE-ssp534_201401-210112_fv_1.9x2.5_c20220809.nc'
co2flux_fuel_meshfile   = '/cluster/shared/noresm/inputdata/share/meshes/fv1.9x2.5_141008_ESMFmesh_c20191001.nc'
co2flux_fuel_year_first = 2014
co2flux_fuel_year_last  = 2101
co2flux_fuel_year_align = 2014
co2flux_fuel_taxmode    = 'limit'

Reviewers: @gold2718

Changes made to build system: None

Changes made to the namelist: [ describe or write 'None' ]

Changes to the defaults for the boundary datasets: [ describe or write 'None' ]

Substantial timing or memory changes: [ describe or write 'None' ]

Validation:

  • The left plot is the model output on day 16 (2 degree forcing mapped to ne16 and then mapped back out to 2 degree history output)
  • The right plot is the forcing dataset /cluster/shared/noresm/inputdata/atm/cam/ggas/emissions-cmip6_CO2_anthro_surface_ScenarioMIP_IAMC-REMIND-MAGPIE-ssp534_201401-210112_fv_1.9x2.5_c20220809.nc on January 16
Screenshot 2025-11-04 at 3 43 40 PM

@mvertens mvertens marked this pull request as draft November 4, 2025 14:39
@tjiputra
Copy link

tjiputra commented Nov 4, 2025

@mvertens, this command doesn't work
./bin/git-fleximod update

@mvertens
Copy link
Author

mvertens commented Nov 4, 2025

@mvertens, this command doesn't work ./bin/git-fleximod update

@tjiputra - sorry about that - my checkout missed that you need to invoke
> git checkout feature/refactor_co2input
I've updated the documentation.

@adagj
Copy link

adagj commented Nov 5, 2025

@mvertens Thank you Mariana! I will run a N1850 compset with 2xSSP534 CO2 flux data to see if we can track down the (potential) CO2 conservation issue in CAM

@gold2718 gold2718 self-requested a review November 14, 2025 13:42
@gold2718 gold2718 self-assigned this Nov 14, 2025
@gold2718 gold2718 added the enhancement New feature or request label Nov 14, 2025
@gold2718 gold2718 added this to the NorESM3.0 milestone Nov 14, 2025
Copy link

@gold2718 gold2718 left a comment

Choose a reason for hiding this comment

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

I still have most of co2_cycle.F90 and nudging.F90 to review but here are some items I think should be changed.

Comment on lines 6 to 9
public

type(ESMF_Mesh) :: model_mesh ! model mesh
type(ESMF_Clock) :: model_clock ! model clock

Choose a reason for hiding this comment

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

I think this should be private with protected variables initialized by a subroutine:

Suggested change
public
type(ESMF_Mesh) :: model_mesh ! model mesh
type(ESMF_Clock) :: model_clock ! model clock
private
type(ESMF_Mesh), public, protected :: model_mesh ! model mesh
type(ESMF_Clock), public, protected :: model_clock ! model clock
public :: initialize_model_clock
public :: initialize_model_mesh
logical :: model_clock_initialized = .false.
logical :: model_mesh_initialized = .false.
contains
subroutine initialize_model_clock(mclock)
use shr_sys_mod, only: shr_sys_abort
type(ESMF_Clock), intent(in) :: mclock
if (model_clock_initialized) then
call shr_sys_abort('initialize_model_clock: model clock already initialized')
else
model_clock = mclock
model_clock_initialized = .true.
end if
end subroutine initialize_model_clock
subroutine initialize_model_mesh(mmesh)
use shr_sys_mod, only: shr_sys_abort
type(ESMF_Mesh), intent(in) :: mmesh
if (model_mesh_initialized) then
call shr_sys_abort('initialize_model_mesh: model mesh already initialized')
else
model_mesh = mmesh
model_mesh_initialized = .true.
end if
end subroutine initialize_model_mesh

Copy link
Author

Choose a reason for hiding this comment

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

Done

Comment on lines 763 to 765
! Create model_clock as a variable in atm_shr.F90 - needed for generating streams
model_clock = ESMF_ClockCreate(clock, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Choose a reason for hiding this comment

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

I think some or all of this should move into atm_shr.F90

Copy link
Author

Choose a reason for hiding this comment

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

Done

Comment on lines 49 to 50
character(len=cs) :: co2flux_ocn_tintalgo = 'linear' ! time interpolation [lower, upper, nearest, linear or coszen]
character(len=cs) :: co2flux_ocn_taxmode = 'extend' ! time extraploation [cycle, extend or limit]

Choose a reason for hiding this comment

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

I think that these should also be initialized to invalid values. This would have caught the missing namelist variables.

Suggested change
character(len=cs) :: co2flux_ocn_tintalgo = 'linear' ! time interpolation [lower, upper, nearest, linear or coszen]
character(len=cs) :: co2flux_ocn_taxmode = 'extend' ! time extraploation [cycle, extend or limit]
character(len=cs) :: co2flux_ocn_tintalgo = 'NOTSET' ! time interpolation [lower, upper, nearest, linear or coszen]
character(len=cs) :: co2flux_ocn_taxmode = 'NOTSET' ! time extraploation [cycle, extend or limit]

Copy link
Author

Choose a reason for hiding this comment

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

Done

Comment on lines 57 to 58
character(len=cs) :: co2flux_fuel_tintalgo = 'linear' ! time interpolation [lower, upper, nearest, linear or coszen]
character(len=cs) :: co2flux_fuel_taxmode = 'extend' ! time extraploation [cycle, extend or limit]

Choose a reason for hiding this comment

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

I think that these should also be initialized to invalid values. This would have caught the missing namelist variables.

Suggested change
character(len=cs) :: co2flux_fuel_tintalgo = 'linear' ! time interpolation [lower, upper, nearest, linear or coszen]
character(len=cs) :: co2flux_fuel_taxmode = 'extend' ! time extraploation [cycle, extend or limit]
character(len=cs) :: co2flux_fuel_tintalgo = 'NOTSET' ! time interpolation [lower, upper, nearest, linear or coszen]
character(len=cs) :: co2flux_fuel_taxmode = 'NOTSET' ! time extraploation [cycle, extend or limit]

Copy link
Author

Choose a reason for hiding this comment

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

Done

@github-project-automation github-project-automation bot moved this from Todo to In Progress in NorESM Development Nov 25, 2025
@mvertens mvertens marked this pull request as ready for review November 25, 2025 21:09
@mvertens mvertens force-pushed the feature/refactor_co2input branch from 5d1d8c5 to 089444c Compare November 26, 2025 09:12
@mvertens mvertens requested a review from gold2718 November 26, 2025 09:14
@mvertens mvertens changed the title refactor co2input to have online interpolation for fossil fuel and ocn datasets refactor co2_cycle and co2 aircraft emissions to have CDEPS online functionality Nov 26, 2025
@mvertens
Copy link
Author

mvertens commented Dec 1, 2025

@gold2718 - I have removed nudging capability as part of this PR. I have also removed co2_readFlux_ocn from CAM as part of this PR. I think all of the comments above that refer to either of these changes are addressed as part of this removal.

@mvertens
Copy link
Author

mvertens commented Dec 1, 2025

@gold2718 - what tests do you want me to run?

@mvertens mvertens changed the title refactor co2_cycle and co2 aircraft emissions to have CDEPS online functionality refactor co2 fossil fue and aircraft emissions to leverage CDEPS online functionality Dec 1, 2025
@mvertens
Copy link
Author

mvertens commented Dec 3, 2025

@gold2718 - I think this is now ready for another review.

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: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants