refactor nudging code to use cdeps on line remapping and interpolation#243
Open
mvertens wants to merge 29 commits intoNorESMhub:noresm_developfrom
Open
refactor nudging code to use cdeps on line remapping and interpolation#243mvertens wants to merge 29 commits intoNorESMhub:noresm_developfrom
mvertens wants to merge 29 commits intoNorESMhub:noresm_developfrom
Conversation
…r.F90 for model_mesh and model_clock
…sh and model_clock from outside the nuopc cap
…refactor_nudging2
…refactor_nudging2
…refactor_nudging2
…o feature/refactor_nudging3
40ad302 to
875a455
Compare
Collaborator
gold2718
requested changes
Feb 6, 2026
gold2718
left a comment
There was a problem hiding this comment.
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_indcall in timestep_init to init and make theQindex a module variable. Then, you can remove the call innudging_timestep_tend(it is not the cheapest function).
src/physics/cam/nudging.F90
Outdated
| allocate(Nudge_PStau(pcols,begchunk:endchunk),stat=istat) | ||
| call alloc_err(istat,'nudging_init','Nudge_PStau',pcols*((endchunk-begchunk)+1)) | ||
| allocate(Nudge_Utau0(pcols,pver,begchunk:endchunk),stat=istat) | ||
| call alloc_err(istat,subname,'Nudge_Utau',size3d) |
There was a problem hiding this comment.
Please correct the error strings here and below?
Suggested change
| call alloc_err(istat,subname,'Nudge_Utau',size3d) | |
| call alloc_err(istat,subname,'Nudge_Utau0',size3d) |
gold2718
requested changes
Feb 6, 2026
gold2718
left a comment
There was a problem hiding this comment.
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_indcall in timestep_init to init and make theQindex a module variable. Then, you can remove the call innudging_timestep_tend(it is not the cheapest function).
gold2718
requested changes
Feb 16, 2026
gold2718
left a comment
There was a problem hiding this comment.
Much better! I think we are down to 4 items that need to be looked at.
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary: refactor nudging code to use cdeps on line remapping and interpolation
Contributors: @gold2718
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_dayChanges 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:
with the following user_nl_cam
Nudging Simulation:
The following was set in
user_nl_cam:Following is the nudging validation:
[ List each test suite run. For each suite, include machine, compiler, and any test failures.
For each failure, include the contents of TestStatus or the output from cs.status.testid for that test ]
Issues addressed by this PR: [ For each issue include a GitHub issue entry, one per line. ]