Skip to content

noresm3_0_031_cam6_4_121: refactor nudging code to use CDEPS#243

Merged
gold2718 merged 33 commits intoNorESMhub:noresm_developfrom
mvertens:feature/refactor_nudging
Apr 23, 2026
Merged

noresm3_0_031_cam6_4_121: refactor nudging code to use CDEPS#243
gold2718 merged 33 commits intoNorESMhub:noresm_developfrom
mvertens:feature/refactor_nudging

Conversation

@mvertens
Copy link
Copy Markdown

@mvertens mvertens commented Oct 30, 2025

Summary: Refactor nudging code to use CDEPS on line remapping and interpolation

Contributors: @mvertens, @gold2718, @Ovewh

Reviewers: @gold2718

Purpose of changes:
The current nudging code (nudging.F90) requires a single file for every time sample - and often this is every 6 hours. In addition it does not do any mapping from the forcing data to the model grid. Using the CDEPS inline functionality along with its capability to do online horizontal regridding (including for multiple vertical levels) and time interpolation the nudging code has been completely refactored. With this new code - monthly nudging data can be read at just one resolution and the model vertical levels and used with any model grid.
The one change that comes with this is if there is missing data. In the original scheme, if missing data was encountered then the model 'coasted' through the forcing interval and was not nudged. In the new scheme, the time interpolation (linear or upper) is used with the actual data that is available.

To see more details of the inline functionality from CDEPS used here see: https://escomp.github.io/CDEPS/versions/master/html/index.html and in particular https://escomp.github.io/CDEPS/versions/master/html/streams.html#data-model-stream-inline-api

Changes made to build system: None

Changes made to the namelist: The following new namelist variables were introduced:
Nudge_Filenames, Nudge_Meshfile, Nugde_beg_day, Nudge_beg_month, Nudge_beg_year, Nudge_end_day, Nudge_end_month, Nudge_end_year, Nudge_file_times_per_day, Model_update_times_per_day

Changes to the defaults for the boundary datasets: None

Substantial timing or memory changes: TODO - the expectation is that the new code should be faster than the old one since a new file does not have to be opened and closed at every nudging time step. This needs to be confirmed.

Validation:
The following validation was run. using a noresm3_0_beta09 sandbox with this PR and the CDEPS PR NorESMhub/CDEPS#26. Two simulations were done - a reference simulation and a nudging to the reference simulation.

Reference Simulation:

/create_newcase --case /cluster/home/mvertens/noresm/NF1850_ne16pg3_ne16pg3_mtn14_b09_ref --compset 1850_CAM70%LT%NORESM%CAMoslo_CLM60%SP_CICE%PRES_DOCN%DOM_MOSART_DGLC%NOEVOLVE_SWAV_SESP --res ne16pg3_ne16pg3_mtn14 --project nn9560
k --run-unsupported --mach betzy

with the following user_nl_cam

empty_htapes=.true.
nhtfrq = 0, -6, -1,
mfilt  = 1,  28, 168,
ndens  = 2,  2,  2,
fincl2 = 'PS:I','U:I','V:I','T:I','Q:I'
fincl3 = 'PS:I','U:I','V:I','T:I','Q:I','U850:I','V850:I','T850:I','Z500:I'
fincl3lonlat = '11e_60n'

zmconv_c0_lnd             = 0.0075D0
zmconv_c0_ocn             = 0.0075D0
zmconv_ke                 =  5.0E-6
zmconv_ke_lnd             =  1.0E-5
dust_emis_fact            = 6.1D0
clim_modal_aero_top_press = 1.D-4
micro_mg_dcs              = 700.D-6
clubb_c8                  =  5.0D0

Nudging Simulation:

./create_newcase --case /cluster/home/mvertens/noresm/NF1850_ne16pg3_ne16pg3_mtn14_b09_nudging --compset 1850_CAM70%LT%NORESM%CAMoslo_CLM60%SP_CICE%PRES_DOCN%DOM_MOSART_DGLC%NOEVOLVE_SWAV_SESP --res ne16pg3_ne16pg3_mtn14 --project nn
9560k --run-unsupported --mach betzy

The following was set in user_nl_cam:

&nudging_nl
Nudge_Model         = .true.
Nudge_Datapath      = '/cluster/work/users/mvertens/archive/NF1850_ne16pg3_ne16pg3_mtn14_b09_ref/atm/hist'
Nudge_Filenames     = 'NF1850_ne16pg3_ne16pg3_mtn14_b09_ref.cam.h1i.0001-01-01-21600.nc',
                      'NF1850_ne16pg3_ne16pg3_mtn14_b09_ref.cam.h1i.0001-01-08-21600.nc',
                      'NF1850_ne16pg3_ne16pg3_mtn14_b09_ref.cam.h1i.0001-01-15-21600.nc'
Nudge_Meshfile      = '/cluster/shared/noresm/inputdata/share/meshes/ne16pg3_ESMFmesh_cdf5_c20211018.nc'
Nudge_TimeScale_Opt = 0
Nudge_Force_Opt     = 1
Nudge_Uprof         = 1
Nudge_Ucoef         = 1.0
Nudge_Vprof         = 1
Nudge_Vcoef         = 1.0
Nudge_Tprof         = 0
Nudge_Tcoef         = 0.0
Nudge_PSprof        = 0
Nudge_PScoef        = 0.0
Nudge_Qprof         = 0
Nudge_Qcoef         = 0.0
Nudge_beg_year      = 1
Nudge_beg_month     = 1
Nudge_beg_day       = 2
Nudge_end_day       = 14
Nudge_end_month     = 1
Nudge_end_year      = 1
Nudge_taxmode       = 'limit'
Model_update_times_per_day = 48
!
empty_htapes       =.true.
nhtfrq             = 0, -6, -1,
mfilt            = 1,  28, 168,
!mfilt             = 1,   1,   1
ndens              = 2,  2,  2,
fincl2             = 'PS:I','U:I','V:I','T:I','Q:I','Target_U','Target_V','Nudge_U','Nudge_V'
fincl3             = 'PS:I','U:I','V:I','T:I','Q:I','U850:I','V850:I','T850:I','Z500:I',
                     'Target_U','Target_V','Nudge_U','Nudge_V'
fincl3lonlat       = '11e_60n'
!
zmconv_c0_lnd             = 0.0075D0
zmconv_c0_ocn             = 0.0075D0
zmconv_ke                 =  5.0E-6
zmconv_ke_lnd             =  1.0E-5
dust_emis_fact            = 6.1D0
clim_modal_aero_top_press = 1.D-4

Following is the nudging validation:

Screenshot 2025-12-25 at 12 27 27 PM

Testing:

  • Two tests were added to aux_cam_noresm which test this functionality
  • Tested on Betzy

Copy link
Copy Markdown

@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.

This work will be a great improvement to NorESM/CAM!

  • I have a few questions and a bunch of (hopefully easy) change requests.
  • I have included a set of change requests to refactor how the model is aligned with the nudging data. This is to allow nudging to be turned on and off during a model run while independently choosing which nudging data to use.
  • Consider moving the cnst_get_ind call in timestep_init to init and make the Q index a module variable. Then, you can remove the call in nudging_timestep_tend (it is not the cheapest function).

Comment thread bld/namelist_files/namelist_definition.xml Outdated
Comment thread src/physics/cam/nudging.F90 Outdated
Comment thread src/cpl/nuopc/atm_comp_nuopc.F90 Outdated
Comment thread src/physics/cam/nudging.F90 Outdated
Comment thread src/physics/cam/nudging.F90 Outdated
Comment thread bld/namelist_files/namelist_definition.xml
Comment thread src/physics/cam/nudging.F90 Outdated
Comment thread bld/namelist_files/namelist_definition.xml Outdated
Comment thread src/physics/cam/nudging.F90 Outdated
Comment thread src/physics/cam/nudging.F90 Outdated
@github-project-automation github-project-automation Bot moved this from Todo to In Progress in NorESM Development Feb 6, 2026
Copy link
Copy Markdown

@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.

This work will be a great improvement to NorESM/CAM!

  • I have a few questions and a bunch of (hopefully easy) change requests.
  • I have included a set of change requests to refactor how the model is aligned with the nudging data. This is to allow nudging to be turned on and off during a model run while independently choosing which nudging data to use.
  • Consider moving the cnst_get_ind call in timestep_init to init and make the Q index a module variable. Then, you can remove the call in nudging_timestep_tend (it is not the cheapest function).

@mvertens mvertens requested a review from gold2718 February 12, 2026 12:02
Copy link
Copy Markdown

@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.

Much better! I think we are down to 4 items that need to be looked at.

mvertens added 2 commits March 7, 2026 10:43
Move to new topography for 2 degree runs (ne16pg3)

Replace the current ne16pg3 topography with a new file from NCAR

Summary: Update the ne16pg3 topography as recommended by Peter Lauritzen
Contributors: gold2718
Reviewers: @oyvindseland
Purpose of changes: NorESMhub#258
Github PR URL: NorESMhub#264
Changes made to build system: None
Changes made to the namelist: Updated the default bnd_topo for ne16pg3
Changes to the defaults for the boundary datasets: None
Substantial timing or memory changes: None
Testing:
- aux_cam_noresm tests pass with baseline differences for ne16pg3 runs
- Comparison to a beta11 run:
  https://ns2345k.web.sigma2.no/datalake/diagnostics/ADF/goldy/n1850_ne16pg3_tn14_new_topo_586_595_vs_n1850_ne16pg3_tn14_beta11_586_595/
@mvertens mvertens requested a review from gold2718 March 7, 2026 10:24
Copy link
Copy Markdown

@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.

There is a typo in a comment but otherwise, this looks great, thanks!
(Note, I can fix the typo when I merge this).

Comment thread src/physics/cam/nudging.F90 Outdated
@gold2718 gold2718 added this to the noresm3_0_beta13 milestone Mar 20, 2026
@Ovewh Ovewh force-pushed the feature/refactor_nudging branch from a3167e5 to f3dfc76 Compare April 23, 2026 10:03
Copy link
Copy Markdown

@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 have some suggestions that I can implement if that helps.

Comment thread cime_config/testdefs/testmods_dirs/cam/nudging/user_nl_cam Outdated
Comment thread cime_config/testdefs/testmods_dirs/cam/nudging/user_nl_cam Outdated
Comment thread cime_config/testdefs/testmods_dirs/cam/nudging/user_nl_cam Outdated
Comment thread cime_config/testdefs/testmods_dirs/cam/nudging/user_nl_cam Outdated
Comment thread cime_config/testdefs/testmods_dirs/cam/nudging/user_nl_cam Outdated
Comment thread cime_config/testdefs/testlist_cam.xml Outdated
Comment thread cime_config/testdefs/testlist_cam.xml
Ovewh and others added 2 commits April 23, 2026 14:28
Co-authored-by: goldy <1588651+gold2718@users.noreply.github.com>
@gold2718 gold2718 changed the title refactor nudging code to use cdeps on line remapping and interpolation noresm3_0_031_cam6_4_121: refactor nudging code to use CDEPS Apr 23, 2026
Copy link
Copy Markdown

@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.

This looks great now. Thanks for all the work @mvertens and @Ovewh

@gold2718 gold2718 merged commit b8baed1 into NorESMhub:noresm_develop Apr 23, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in NorESM Development Apr 23, 2026
@gold2718
Copy link
Copy Markdown

Tagged as noresm3_0_031_cam6_4_121

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