Skip to content

major refactor stream of stream usage#376

Merged
billsacks merged 88 commits into
ESCOMP:mainfrom
mvertens:feature/refactor_stream_usage_escomp
Jan 27, 2026
Merged

major refactor stream of stream usage#376
billsacks merged 88 commits into
ESCOMP:mainfrom
mvertens:feature/refactor_stream_usage_escomp

Conversation

@mvertens
Copy link
Copy Markdown
Collaborator

@mvertens mvertens commented Jan 12, 2026

Description of changes

Major refactor of stream usage

Specific notes

All data mode files across the data components(except for datm_datamode_gefs_mod.F90 and dice_datamode_cplhist_mod.F90) now have explicit setting of streams rather than using the implicit copy used by dfields. Copies that used to be done implicitly using the naming convention assumed by dfields are
now done explictly. This makes it clear what export fields are direct copies and what export fields are
derived fields that have no corresponding stream field.

In each datamode module - there are now two sections in the module variable list: export (and sometimes import) state pointers and stream pointer.

The following changes have been made throughout the code: character(*) => character(len=*), trim(subname) => subname (the latter is done since parameters, e.g. subname, don't need trim functions)

The following new routines have been introduced or deleted:

  • dwav
    • dwav_datamode_copyall.F90: new
  • drof
    • drof_datamode_copyall.F90: new
    • introduction of new datatype (stream_pointer_type) for multilevel stream pointers
    • expanded list of stream fields needed for drof.cplhist and added new functionality (e.g. drof_datamode_cplhist_mod.F90) to support this addition.
  • docn
    • combined docn_datamode_copyall_mod.F90 and docn_datamode_iaf_mod.F90 into a new file docn_datamode_sstdata_mod.F90. The two files docn_datamode_copyall_mod.F90 and docn_datamode_iaf_mod.F90 were effectively the same and two different datamodes are not needed since in both cases prescribed SST data was read in. (In addition, docn_datamode_iaf_mod.F90` set pointers to importState data which was never used and not needed).
    • ocn_comp_nuopc.F90: the datamode copyall is now sstdata and the datamode iaf is removed
    • changed cplhist and multilev_cplhist taxmode from extend to cycle
  • dlnd
    • introduction of new datatype (stream_pointer_type) for multilevel stream pointers
  • dice
    • dice_cplhist_data_mod.F90: still uses dfields since it is used by UFS
  • dglc
    • introduction of new datatype (stream_pointer_type) for multilevel stream pointers

NOTE: This PR also provides a new mapfile algorithm as a new option for mapping the streams input to the component model resolution. The new scheme does not have a default but is enabled via adding the following in the appropriate user_nl_XXX_streams where the user needs to fill in the entries in <> below:
<stream_name>:mapalgo = "mapfile:
As an example:
rof.ryf8485_jra:mapalgo="mapfile:/cluster/shared/noresm/inputdata/cpl/cpl6/map_JRA025_to_tnx1v4_e1000r300_170928.nc". This new capability enables a significant speedup in stand-alone ocean simulations. See NorESMhub/BLOM#686 (comment).

NOTE*:

Contributors other than yourself, if any: None

CDEPS Issues Fixed: #377

Are there dependencies on other component PRs (if so list):

Are changes expected to change answers (bfb, different to roundoff, more substantial):

  • docn cplhist mode can change answers due to changing taxmode from extend to cycle

Any User Interface Changes (namelist or namelist defaults changes):

Testing performed (will describe the noresm testing here)

  • aux_cdeps_noresm:
  • prealpha_noresm
    • compared to noresm3_0_beta09 - the only difference is SMS_Lm13.f19_f19_mtn14.I1850Clm50SpG.betzy_intel where atmImp_Faxa_ndep1 and atmImp_Faxa_ndep2 are different due to new new tag cdeps1.0.87_noresm_v2.

Hashes used for testing: noresm3_0_beta09 plus this CDEPS branch

mvertens added 30 commits May 12, 2025 10:26
…d_stream_usage' into feature/refactor_stream_usage
…al_streams' into feature/refactor_stream_usage
@wwieder
Copy link
Copy Markdown
Contributor

wwieder commented Jan 22, 2026

Just flagging this, as we'll want to test with CTSM when we update our submodules, @ekluzek.

@mvertens
Copy link
Copy Markdown
Collaborator Author

@billsacks

  • DWAV is tested in the following test which passed and had no differences with baselines
    • SMS_Ld2.ww3a.2000_SATM_SLND_SICE_SOCN_SROF_SGLC_DWAV%CLIMO.betzy_intel
  • DLND was tested in the following tests which all passed and had no differences with baselines
    • ERS_D_Ld30.f09_f09_mg17.2000_SATM_DLND%RCPL_SICE_SOCN_SROF_SGLC_SWAV.betzy_intel.dlnd-rof_forcing.GC.cdeps_pr3/
    • ERS_D_Ly4.f09_f09_mg17.1850_SATM_DLND%GCPL_SICE_SOCN_SROF_SGLC_SWAV.betzy_intel.dlnd-glc_forcing.GC.cdeps_pr3/
    • SMS_Ld3.f09_f09_mg17.1850_SATM_DLND%SCPL_SICE_SOCN_SROF_SGLC_SWAV.betzy_intel.GC.cdeps_pr3/

@billsacks
Copy link
Copy Markdown
Member

@fischer-ncar - can you please add one more test, with baseline comparisons: SMS_D_Ld5.f10_f10_mg37.ISSP245Clm60BgcCropCrujra.derecho_intel.clm-datm_rcp45_anom_forc. (I had asked for a test that includes DATM bias-correction. I forgot that anomaly forcing is a related-but-different thing.)

@fischer-ncar
Copy link
Copy Markdown
Collaborator

Here's the prealpha test results I have so far. I'm still running the extra tests that @billsacks wanted me to run.

FAIL ERS.TL319_t232.G_JRA.derecho_gnu.cice-default CREATE_NEWCASE
FAIL DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods CREATE_NEWCASE
FAIL ERI.TL319_t232.G_JRA.derecho_intel.cice-default CREATE_NEWCASE
FAIL ERS.TL319_t232_wg37.GW_JRA.derecho_intel CREATE_NEWCASE
FAIL SMS_Ld40.TL319_t232.C_JRA.derecho_intel CREATE_NEWCASE
FAIL SMS.TL319_t232.G1850MARBL_JRA.derecho_intel CREATE_NEWCASE
FAIL SMS.TL319_t232.G_JRA.derecho_intel.mom-no_stoch_physics CREATE_NEWCASE

The above tests all failed with no comp_calss for rof.

ERROR: No description found for comp_class rof matching compsetname 
2000_DATM%JRA-1p5-2023_SLND_CICE_MOM6_DROF%JRA-1p5-2023_SGLC_SWAV_SESP
in file /glade/u/home/fischer/code/cesm3_0_alpha08b.cdeps_pr376/components/cdeps/drof/cime_config/config_component.xml,
expected match in ['DROF'] % ['NULL', 'NYF', 'IAF', 'IAFAIS00', 'IAFAIS45', 'IAFAIS55', 'CPLHIST', 'JRA', 'JRA-1p4-2018', 
'JRA-1p4-2018-AIS0ICE', 'JRA-1p4-2018-AIS0LIQ', 'JRA-1p4-2018-AIS0ROF', 'JRA-RYF6162', 'JRA-RYF8485', 'JRA-RYF9091', 'JRA-RYF0304']

Then there was a couple of small answer changes.

FAIL SMS_D_Ld1.ne30pg3_t232.I1850Clm50BgcSpinup.derecho_intel.clm-cplhist--clm-matrixcnOn BASELINE cesm3_0_alpha08b: DIFF
lndExp_Sa_o3   (lndExp_nx,lndExp_ny,time)  t_index =      1     1

  48600    48600  (  4509,     1,     1) ( 27472,     1,     1) (  4509,     1,     1) (     1,     1,     1)
           48600   6.362811278938516E-08   3.042405400211996E-09 6.4E-08  6.362811278938516E-08 1.0E+00  1.110496591496169E-08
           48600   0.000000000000000E+00   0.000000000000000E+00          0.000000000000000E+00          0.000000000000000E+00
           48600  (     1,     1,     1) (     1,     1,     1)
      avg abs field values:    1.529740347654647E-08    rms diff: 1.7E-08   avg rel diff(npos):  1.0E+00
                               0.000000000000000E+00                        avg decimal digits(ndif):  0.0 worst:  0.0
 RMS lndExp_Sa_o3                     1.6669E-08            NORMALIZED  2.1793E+00"


FAIL SMS_D_Ld1.ne30pg3_t232.I1850Clm50BgcSpinup.derecho_intel.clm-cplhist BASELINE cesm3_0_alpha08b: DIFF
 lndExp_Sa_o3   (lndExp_nx,lndExp_ny,time)  t_index =      1     1
  48600    48600  (  4509,     1,     1) ( 27472,     1,     1) (  4509,     1,     1) (     1,     1,     1)
           48600   6.362811278938516E-08   3.042405400211996E-09 6.4E-08  6.362811278938516E-08 1.0E+00  1.110496591496169E-08
           48600   0.000000000000000E+00   0.000000000000000E+00          0.000000000000000E+00          0.000000000000000E+00
           48600  (     1,     1,     1) (     1,     1,     1)
      avg abs field values:    1.529740347654647E-08    rms diff: 1.7E-08   avg rel diff(npos):  1.0E+00
                               0.000000000000000E+00                        avg decimal digits(ndif):  0.0 worst:  0.0
 RMS lndExp_Sa_o3                     1.6669E-08            NORMALIZED  2.1793E+00

@fischer-ncar
Copy link
Copy Markdown
Collaborator

Here's the three other tests that @billsacks wanted me to do.

PASS SMS_D_Ld2.T62_t232.G.derecho_gnu RUN time=351

FAIL SMS_D_Ld5.f10_f10_mg37.ISSP245Clm60BgcCropCrujra.derecho_intel.clm-datm_rcp45_anom_forc BASELINE cesm3_0_alpha08b: DIFF
lndExp_Sa_co2prog   (lndExp_nx,lndExp_ny,time)  t_index =      1     1
    456      456  (     1,     1,     1) (     1,     1,     1) (     1,     1,     1) (     1,     1,     1)
             456   3.999488830566406E+02   3.999488830566406E+02 4.0E+02  3.999488830566406E+02 1.0E+00  3.999488830566406E+02
             456   0.000000000000000E+00   0.000000000000000E+00          0.000000000000000E+00          0.000000000000000E+00
             456  (     1,     1,     1) (     1,     1,     1)
      avg abs field values:    3.999488830566406E+02    rms diff: 4.0E+02   avg rel diff(npos):  1.0E+00
                               0.000000000000000E+00                        avg decimal digits(ndif):  0.0 worst:  0.0
 RMS lndExp_Sa_co2prog                3.9995E+02            NORMALIZED  2.0000E+00

FAIL ERS_Ld5.TL319_t232.G_IAF.derecho_intel.cice-default CREATE_NEWCASE
ERROR: grid alias TL319_t232 not valid for compset 2000_DATM%IAF_SLND_CICE_MOM6_DROF%IAF_SGLC_SWAV_SESP

@jedwards4b
Copy link
Copy Markdown
Contributor

jedwards4b commented Jan 22, 2026 via email

@billsacks
Copy link
Copy Markdown
Member

@fischer-ncar - thanks a lot for this testing report! And @jedwards4b - thanks for your input.

I have just pushed a commit that restores the JRA-1p5-2023 mode for DROF that I think should fix the issues with G_JRA and C_JRA compsets. (@mvertens - I assume your removal of that mode for DROF was accidental? As far as I can tell the mode should still work but it looks like it was accidentally removed from DROF's config_component... but please let us know if there was a reason why you removed it.) @fischer-ncar - can you please retry the failed tests with this latest version?

The changes in lndExp_Sa_o3 and lndExp_Sa_co2prog are expected based on changes from #373 (but are expected not to feedback to cause any other differences in typical configurations).

For the failing G_IAF case, can you instead try ERS_Ld5.T62_t232.G_IAF.derecho_intel.cice-default? If that doesn't work, I'll reach out to some ocean / sea ice folks to see if I can find a similar, working test.

@fischer-ncar - I have poked around in /glade/derecho/scratch/fischer/t/cesm3_0_alpha08b.cdeps_pr376_i, /glade/derecho/scratch/fischer/t/cesm3_0_alpha08b.cdeps_pr376_g and /glade/derecho/scratch/fischer/t/cesm3_0_alpha08b.cdeps_pr376_n; I don't see anything problematic from those test results (assuming that all failures there other than the ones you called out are expected failures). (I was looking for whether there might have been some expected failures that I want to replace with other, passing tests for testing this PR, but I'm not concerned about the tests that are failing.) So if that's complete in terms of derecho prealpha testing, then I think we're good in terms of the standard derecho prealpha tests once we resolve the above issues.

Have you run the extra tests noted in #376 (comment) - the ones under (1), (2), and the additional DTEST and E1850TEST test, in addition to the more recent additions that I copied at the bottom of that comment?

Thanks again for all of your testing of this!

@mvertens
Copy link
Copy Markdown
Collaborator Author

@billsacks - the removal of JRA-1p5-2023 was a mistake that I made in trying to sync the changes between the PR to NorESMHub and ESCOMP. @jedwards4b - thanks for suggesting the fix. @fischer-ncar - thanks for all of your testing.

@fischer-ncar
Copy link
Copy Markdown
Collaborator

@billsacks I missed those tests, I'll run them now.

@fischer-ncar
Copy link
Copy Markdown
Collaborator

All of the tests with the missing JRA-1p5-2023 have passed. So all of the prealpha tests are now good.

For the extra tests @billsacks wanted me to do, the following passed.

   ERI.TL319_t232.DTEST.derecho_intel.cice-default
   ERS_D_Ld5.f19_g17.E1850TEST.derecho_intel.cice-default
   ERS_Ld5.T62_t232.G_IAF.derecho_intel.cice-default
   SMS_D_Ld2.T62_t232.G.derecho_gnu
   SMS_D_Ld3.f10_f10_mg37.I2000Clm50BgcCru.derecho_gnu.clm-default
   SMS_Ld1_PS.f09_g17.I2000Clm50BgcCru.derecho_gnu.clm-datm_bias_correct_cruv7
   SMS_Ld1_PS.nldas2_rnldas2_mnldas2.I2000Ctsm50NwpSpNldas.derecho_gnu.clm-default--clm-nofireemis
   SMS_Ld5.f10_f10_mg37.ISSP245Clm60BgcCropCrujra.derecho_gnu.clm-ciso_dec2050Start

Of the tests that passed, two of the tests failed to generate complete baselines, which is not an issue with this PR.

FAIL ERS_D_Ld5.f19_g17.E1850TEST.derecho_intel.cice-default BASELINE cesm3_0_alpha08b: ERROR BFAIL some baseline files were missing
FAIL SMS_Ld1_PS.f09_g17.I2000Clm50BgcCru.derecho_gnu.clm-datm_bias_correct_cruv7 BASELINE cesm3_0_alpha08b: ERROR BFAIL some baseline files were missing

This test passed, with expected answer difference caused by #373.

SMS_D_Ld5.f10_f10_mg37.ISSP245Clm60BgcCropCrujra.derecho_intel.clm-datm_rcp45_anom_forc

Then this test failed with a missing grid alias.

FAIL ERS_Ld5.TL319_t232.G_IAF.derecho_intel.cice-default CREATE_NEWCASE
ERROR: grid alias TL319_t232 not valid for compset 2000_DATM%IAF_SLND_CICE_MOM6_DROF%IAF_SGLC_SWAV_SESP

I believe I've run all of the extra tests.

@billsacks
Copy link
Copy Markdown
Member

@fischer-ncar - thanks a lot for this additional testing. I have looked back at the tests you ran compared with what I asked for in various places, and it looks like you have gotten everything - thank you!

Regarding the failures in your most recent set:

  • ERS_D_Ld5.f19_g17.E1850TEST.derecho_intel.cice-default -- I compared this with baselines I generated and it's bfb: good!
  • SMS_Ld1_PS.f09_g17.I2000Clm50BgcCru.derecho_gnu.clm-datm_bias_correct_cruv7 -- I compared this with the baselines that are now available in the standard baseline location and it's bfb: good!
  • ERS_Ld5.TL319_t232.G_IAF.derecho_intel.cice-default -- I'm not concerned about this one anymore since the equivalent (but with different grid) ERS_Ld5.T62_t232.G_IAF.derecho_intel.cice-default passed.

So, from the CESM side, I feel like this testing now looks good!

@NickSzapiro-NOAA - is this good to go at this point from the UFS perspective?

@jedwards4b - do you want to look at this before it's merged or should we remove you as a reviewer?

@mvertens - is there anything else you can think of before this is merged?

@mnlevy1981
Copy link
Copy Markdown
Contributor

FAIL ERS_Ld5.TL319_t232.G_IAF.derecho_intel.cice-default CREATE_NEWCASE

What component added this test to the test list? I don't see it in testlist_mom.xml, but the TL319 grid is for the JRA forcing, while G_IAF uses CORE forcing; I would suggest either switching to the G_JRA compset or removing it completely but would like to hear what @alperaltuntas thinks as well.

Nevermind -- I dug around a little bit and found it in the CICE testlist, but it has been recently replaced with a G_JRA test... so at some point we'll get a CICE tag that prevents this test from failing (thanks @dabail10!)

@billsacks
Copy link
Copy Markdown
Member

Thanks for that extra info, @mnlevy1981 . My motivation for running G_IAF for this PR is that I wanted to make sure that the DATM%IAF mode was still working properly. This was the one test I found in any test list that covered that DATM mode. Based on your comment, it sounds like that mode is effectively going away - or at least will be unused/untested? I don't think we should remove it from this PR, but should we consider removing that mode entirely at some point (as long as NorESM doesn't need it either)?

@mnlevy1981
Copy link
Copy Markdown
Contributor

I don't think IAF is going away, but G_IAF should be on the T62 atmosphere grid because that is the native CORE grid (and the interannual forcing comes from CORE). I think CAM tends to run docn on the atmosphere grid and let the data models interpolate forcing sets (so you may see f09_f09 or ne30_ne30 compsets with a data ocean), but the ocean section prefers to run datm on the native resolution of the datasets and let the coupler do the interpolation.

If I remember right, we intentionally prevented CORE forcing from running on the TL319 atmosphere grid because in those cases the data model would be interpolating from T62 -> TL319 and then the coupler would interpolate from TL319 to the ocean grid and we wanted make sure users were only interpolating once. Also, I think there was some concern that users may not realize they were using CORE forcing rather than JRA forcing and the "double interpolation" wasn't actually what they were expecting from the run.

@billsacks
Copy link
Copy Markdown
Member

Thanks for this additional information, @mnlevy1981 . This makes sense. If DATM%IAF will still be supported, I wonder if it's worth adding a test for it somewhere (maybe at least in the prebeta test list, so it's at least tested occasionally), particularly with its replacement from the aux_cice test list? We do have a single test of it in the aux_cdeps test list, though we don't currently have a regular process/requirement for running that test list (working on that....): SMS_Ld5.ne30pg3_g17.2000_DATM%IAF_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP.derecho_intel - but it seems possibly worth having at least one test with that forcing with an active ocean if that will be a software-supported configuration - i.e., a test of the G_IAF compset or similar. And based on your input, I'm thinking we should change this aux_cdeps test to be at T62_g17 rather than ne30pg3_g17 (I have made that note here).

@billsacks
Copy link
Copy Markdown
Member

@NickSzapiro-NOAA - is this good to go at this point from the UFS perspective?

@NickSzapiro-NOAA - I just wanted to add: from discussion with @mvertens , we're not able to work on the UFS ERA5 issue because it's not part of this repository, so just checking whether you're okay with this PR other than that issue.

@NickSzapiro-NOAA
Copy link
Copy Markdown
Contributor

NickSzapiro-NOAA commented Jan 24, 2026

is this good to go at this point from the UFS perspective?

Yes. All UFS RTs passed except for datm_cdeps_lnd_era5_intel. @uturuncoglu is author of that test and was involved here.

I will say that I'm not so clear on what's needed on UFS side, but it seems that we can follow on there. Thanks for asking

@billsacks billsacks merged commit f948214 into ESCOMP:main Jan 27, 2026
1 check passed
@mvertens mvertens deleted the feature/refactor_stream_usage_escomp branch January 28, 2026 10:58
anton-seaice added a commit to ACCESS-NRI/CDEPS that referenced this pull request Feb 25, 2026
anton-seaice added a commit to ACCESS-NRI/access3-share that referenced this pull request Feb 25, 2026
anton-seaice added a commit to ACCESS-NRI/CDEPS that referenced this pull request Feb 27, 2026
* Standardise jra55do datamode with other updates to CDEPS (ESCOMP#376)
Comment on lines +417 to +420
if (associated(Faxa_swvdr)) Faxa_swvdr(:) = strm_Faxa_swdn(:)*strm_Faxa_swvdr(:)
if (associated(Faxa_swndr)) Faxa_swndr(:) = strm_Faxa_swdn(:)*strm_Faxa_swndr(:)
if (associated(Faxa_swvdf)) Faxa_swvdf(:) = strm_Faxa_swdn(:)*strm_Faxa_swvdf(:)
if (associated(Faxa_swndf)) Faxa_swndf(:) = strm_Faxa_swdn(:)*strm_Faxa_swndf(:)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be deleted? Values are overwritten below in convert J/m^2 to W/m^2 , no?

It's confusing that code treats, say, same term strm_Faxa_swvdr as albedo then radiative flux

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@NickSzapiro-NOAA When I was implementing ERA5 for HAFS, I had a discussion with ECMWF and those variables (Faxa_swvdr) initially storing the coefficients not the exact heat flux in the bands. So, I decided to go with this implementation to calculate shortwave flux in bands. Now we have some issues with it in UFS Coastal and made some changes in the ERA5 data mode. We are testing with CICE coupled configuration at this point and I am plaining to create minor PR in CDEPS side to bering those changes to UFS WM. So, we will clean this implementation soon. Let me know what you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok, I didn't know if I was just confused. Thanks for explaining @uturuncoglu

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docn-multilev is not reading in ocn input correctly

8 participants