Skip to content

Bring CMEPS share code into this repository, and organize share code into subdirectories - #88

Merged
billsacks merged 106 commits into
ESCOMP:mainfrom
billsacks:reorganize_share_code
Nov 10, 2026
Merged

billsacks merged 106 commits into
ESCOMP:mainfrom
billsacks:reorganize_share_code

Conversation

@billsacks

@billsacks billsacks commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

The main goal of this PR is to bring the CMEPS nuopc_cap_share code, as well as flux_atmocn/shr_flux_mod.F90, into this repository. Previously, the share library was built with a mix of code in this repository and code in nuopc_cap_share plus shr_flux_mod. This PR makes the library boundaries reflect the repository boundaries, which is more intuitive and will help address various needs (for unit testing, etc.). I brought over most git history of these modules from the CMEPS repository.

This led the src directory to grow larger, so I felt it was time to organize this directory into subdirectories. This PR does that, too, organizing code into four subdirectories: const, coupling, science, and util.

This PR also renames buildlib.csm_share to buildlib.share, but maintains a sym link to the old one for backwards compatibility.

jedwards4b and others added 30 commits June 8, 2009 21:05
…tory and finish refactoring dead nuopc components
…l of shr_sys_abort with ESMF_FAILURE tracing

Conflicts:
	src/share/nuopc/glc_elevclass_mod.F90
Update CIME to ESMCI cime5.8.2-2

Squash merge of jgfouca/branch-for-to-acme-2019-05-06

Features
* Nuopc update
* nldas_forcing_v2: This is a regional, 0.125 degree data set over the U.S., for use in forcing CTSM.
* Change DATM_CLMNCEP_YR_ALIGN for present-day compsets: Make DATM_CLMNCEP_YR_ALIGN 
  match DATM_CLMNCEP_YR_START. This will make the model year align with the forcing year. For
  example, if RUN_STARTDATE is set to 2000-01-01, then the model will use year-2000 atmospheric 
  forcing data in the first year, etc. non-BFB for any present-day compsets using datm (mostly I-cases and G-cases).

Bug fix:
* Fixes to NAG flags in scripts/Tools/Makefile

[non-BFB] (datm)
* esmci_remote_for_split/master: (1657 commits)
  Fix typo
  Small upgrade to e3sm_cime_mgmt
  send run two TestStatus.log to case1 log
  fix mpi-serial
  dont require optional arguments
  Use RawConfigParser to load saved submit options
  Reset Anvil changes
  Fix incorrect var refference
  Upate env_mach_specific schema and CIME docs
  Add more information in comment
  Also allow machine-mpirun level customization of the run_misc_suffix
  Remove lines referring to rcp compsets with nldas2 forcing
  Move custom run_exe into mpirun spec
  Add NLDAS2 datm forcing option
  Allow machine level customization of the run_exe
  increase wallclock time for Vnuopc_Ln9.f19_g17.X test
  check existence of scalar fields before querying their value
  replace tabs with spaces in buildnml
  minor fix in mediator code to merge it with FV3 branch
  Generalize DATM_CLMNCEP_YR_ALIGN for present-day compsets
  ...
…#3547)

Update CIME to ESMCI cime5.8.20

Squash merge of jgfouca/branch-for-to-acme-2020-04-14

This is the first cime update in half a year, lots of changes.

Features:
 * allow for specification of vertical grid in ATM_GRID
 * if no env vars, print comment to assist user in env_mach_specific.xml
 * case.setup: add --keep option for clean/reset actions to keep local changes to generated files
 * case.setup: refresh build Macros when doing a reset/clean
 * cprnc: cime will build a copy in sharelibs if no global version available
 * check_input_data: add ftp timeout, make sure failover to svn is working
 * added support for new OMIP compsets in POP as well as better handling of the different versions of JRA forcings
 * Pio2 updated to latest master
 * reorganize mct and nuopc data, xcpl and stub components based on coupler
 * new auto-triaging feature for tests, will report potentially broken commits to TestStatus.log
 * coupler: Allow writing T-forcing cplhist files even when running with SGLC
 * Add support for UFS model! Not really relevant to E3SM, but is a major development in CIME
 * archiver: Extend archiving support to accept a regex pattern
 * coupler: Update for compatibility with latest CMEPS

Bug fixes:
 * check_input_data: fix issue with pop input files that should not be found
 * fix default for PIO_REARRANGER
 * docn: Small fix to allow scam to run with aquaplanet
 * fix issue with resubmit on systems that use ssh
 * fix misleading output in CaseStatus
 * Update description for FORCE_BUILD_SMP
 * archiver: pop dd history files were not identified by get_extension
 * NOTE: MPAS history files are now being processed as they should have been all along
 * Improve scripts_regression_tests test cleanup
 * dlnd: Some gnu tests were giving an error of different character lengths in dlnd.
 * coupler: seq flux should be initialized even if for some reason the namelist isn't read
 * env_batch.xml: we can now handle the case where multiple queues have the same name
 * ERI: fix tests that were less than a day, or with START_TOD nonzero
 * test hist: Exclude .ref1 and .ref2 from TestStatus files
 * coupler: fix issue with e3sm field

Fixes: #2324

[BFB]
* esmci_remote_for_split/master: (2458 commits)
  fix cime_model to stdout issue
  extend allowed string length
  Add a comment in the Makefile
  improve format
  fix formatting
  revert path change
  add make check, fix tests
  fix format issues
  change type to double for derived vars
  Updated filter on calculating normalized rms. Now, a variable must be >0, not nearly 0, to be normalized. Also, variables that cannot be normalized generate a huge rms.
  Added check that the normalizing denominator is >0 when calculating a relative rms
  Fix typo
  Update for cime5.8.23
  Missing credit in shr_flux_atmOcn
  fix more pylint issues, unrelated to pr
  fix pylint issue
  fix atm level spec so that it does not match 1x1_brazil
  Add missing ROF2OCN grid for r05_TO_gx3v7
  fix for issue 3452 erroneous log error due to FV3 additions to Makefile, and bug fix for FV3 compset definition.
  Update NCPL values
  ...
Add module to read ozone_coupling_nl

This will work together with ESCOMP/CMEPS#212. However, this can safely be brought in prior to that PR, because this code is not yet invoked from anywhere.
* moved files into ufs
* implemented different interface for ufs flux_atmocn_mod
* add compile fixes for ufs
* removed reference to util and replaced with ufs
* clean up of Makefile
* removed references to use of med_kind_mod and introduced ufs_kind_mod
* removed unneeded files needed by ufs
* Optional tiled history files for ATM (#257)
Fixes an issue with how coefficients are applied to individual fire components.
…oupling through CMEPS (ESCOMP#61)


* Add Wave slow loop coupling and Field Exchanges for waves in nems
* Updates CMEPS for dynamic allocation in med_internalstate
### Description of changes
Update shr_pio_mod, removing mct centric initialization.
Improve logging and make sure logs go to the correct component.
Depends on cime branch async_io_in_esmf

### Specific notes

Contributors other than yourself, if any:

CMEPS Issues Fixed (include github issue #):

Are changes expected to change answers? bfb

Any User Interface Changes (namelist or namelist defaults changes)?
The modelio namelist has been eliminated and the parameters from that file were moved to nuopc.runconfig,
The xml variable PIO_ASYNC_INTERFACE was changed from a global variable to one that could be set individually
for each component. 


### Testing performed

Testing performed if application target is CESM:
- [X] (recommended) CIME_DRIVER=nuopc scripts_regression_tests.py
   - machines: cheyenne intel 
   - details (e.g. failed tests): IRT_N2_Vmct_Ln9.f19_g16_rx1.A.cheyenne_intel fails, apparently expected.

- [ ] (recommended) CESM testlist_drv.xml
   - machines and compilers:
   - details (e.g. failed tests):
- [x] (optional) CESM prealpha test
   - machines and compilers
   - details (e.g. failed tests):
- [ ] (other) please described in detail
   - machines and compilers
   - details (e.g. failed tests):

Testing performed if application target is UFS-coupled:
- [ ] (recommended) UFS-coupled testing
   - description:
   - details (e.g. failed tests):

Testing performed if application target is UFS-HAFS:
- [ ] (recommended) UFS-HAFS testing
   - description:
   - details (e.g. failed tests):

### Hashes used for testing:

- [ ] CESM:
  - repository to check out: https://github.com/ESCOMP/CESM.git
  - branch/hash:
- [ ] UFS-coupled, then umbrella repostiory to check out and associated hash:
  - repository to check out:
  - branch/hash:
- [ ] UFS-HAFS, then umbrella repostiory to check out and associated hash:
  - repository to check out:
  - branch/hash:
…MP#65)


* Refactor source and destination masking
* Refactor esmFieldsExchange with the advertise and initialize phases
* Implement a check that each component pair for a field advertise is present. 
* Permit coupling of ATM-WAV with the CMEPS mediator.
        modified:   cesm/nuopc_cap_share/seq_drydep_mod.F90
        new file:   cesm/nuopc_cap_share/shr_drydep_mod.F90
        modified:   cesm/nuopc_cap_share/shr_drydep_mod.F90
Revert "first step - reorder pio_init and move to ensemble_driver"
mvertens and others added 10 commits March 24, 2026 17:44
Sync w/ latest UFS changes

### Description of changes

Adds recent changes for CMEPS in UFS

### Specific notes

Adds ufs_trace wrapper to enable profiling for use in UFS. 
Adds capability to use mapfiles in UFS global applications.
Removes HYCOM field exchanges in UFS/HAFS mode (HYCOM has been removed from our component list).
Removes deprecated flux scheme for UFS (ocean_flux_scheme == -1)
Updates ufs/ccpp as required for ccpp changes

Changes should not touch any CESM code and should be B4B.
…m_v0

merge noresm cmeps1.1.57_noresm_v0

### Description of changes
Merge changes from noresm cmeps1.1.57_noresm_v0 back to ESCOMP

### Specific notes
- In particular, this has enthalpy computation changes in the mediator that would occur for NorESM if CAM computed the enthalpy. However, although these hooks are in CMEPS - the computation of enthalpy in CAM has not been brought over to the main development branch yet.

- In addition if the nuopc.config variable `histaux_l2x1yrg = .true. ` then 
if there is ocn2glc_coupling then the following mediator auxiliary file will be created:
  `  trim(case_name),'.cpl',trim(inst_tag),'.hx.lnd2glc.',trim(nexttime_str),'.nc'`
if there is lnd2glc_coupling then the following mediator auxiliary file will be created:
 ` trim(case_name),'.cpl',trim(inst_tag),'.hx.lnd2glc.',trim(nexttime_str),'.nc'`

Also - this PR might potentially interfere with PR ESCOMP/CMEPS#683

Contributors other than yourself, if any: None

CMEPS Issues Fixed: None

Are changes expected to change answers?  bfb

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

### Testing performed

Ran CESM prealpha testing on derecho with intel and gnu compilers, with baseline comparisons. Tests passed except expected failures.
Organize source code into four subdirectories - const, coupling, science,
and util - and get the system and unit test builds working with this new
organization.

Note that I separated out the water species constants from
shr_wtracers_mod to avoid having anything in the science directory
depend on anything in the coupling directory; this particularly helped
in keeping the shr_wiso unit tests clear of other dependencies (which
was a pre-existing issue, but it showed up in my test run after this
directory separation).

Claude (Opus 5.5) assisted with analyzing the new directory layout,
giving suggestions, writing the documentation, and (importantly)
updating the CMakeLists files. (I reviewed all changes from Claude.)
These are needed by the CTSM unit testing. Previously they were in CMEPS
and the CTSM unit test build included them via a different mechanism.
Now that they're in share, it makes sense to include them via the same
mechanism as other share sources.
@billsacks
billsacks requested a review from mvertens November 8, 2026 22:02
@@ -0,0 +1,24 @@
module shr_water_species_mod

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note that I separated out the water species constants from
shr_wtracers_mod to avoid having anything in the science directory
depend on anything in the coupling directory; this particularly helped
in keeping the shr_wiso unit tests clear of other dependencies (which
was a pre-existing issue, but it showed up in my test run after this
directory separation).

Comment thread src/util/shr_scam_mod.F90

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I wasn't sure whether to put shr_scam_mod in science or util. Based on what happens there, util seems most appropriate.

@billsacks

Copy link
Copy Markdown
Member Author

I have run aux_cime_baselines in the context of cesm3_0_alpha11d, with this branch along with the accompanying CMEPS branch (which I'll open a PR for soon). Tests pass and are bit-for-bit except expected failures.

@billsacks

Copy link
Copy Markdown
Member Author

@mvertens - this does not include the change to the handling of .in files that we discussed. I thought that would be best as a separate step, and I may not have time for that myself for a while.

@billsacks

Copy link
Copy Markdown
Member Author

See also the companion PR ESCOMP/CMEPS#721; the CMEPS PR depends on this CESM_share PR.

@billsacks

Copy link
Copy Markdown
Member Author

I realize that this is a hard PR to review. Here is a summary that will hopefully make it easier:

For the most part, the added F90 files here are moved over exactly from CMEPS. Exceptions are:

  • A few unused variables were removed from some files in 43cb0b7 to fix compiler warnings
  • src/const/shr_water_species_mod.F90 is new - extracted from shr_wtracers_mod.F90, and so the latter is changed slightly for the removal of this piece, and shr_wiso_mod.F90 and test_shr_wiso.pf are also changed slightly for this

Various CMakeLists.txt files, as well as buildlib.csm_share, were changed to accommodate the reorganization of files.

The top-level README.md and src/README.md were also changed to describe this reorganization.

@mvertens mvertens left a comment

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.

This looks really great. It would be good if possible if we could change the filename of buildlib.csm_share to buildlib.share. If that just adds a new cime dependency it can be defferred.

Have backwards compatibility via a sym link.

This is one step towards removing csm/cesm from this repository. Note
that the library is still named csm_share because changing that would
require numerous changes in multiple repositories.
@billsacks
billsacks merged commit 6e17aa2 into ESCOMP:main Nov 10, 2026
1 check passed
billsacks added a commit to ESCOMP/CMEPS that referenced this pull request Nov 10, 2026
Move share code out of CMEPS

### Description of changes

This PR reorganizes the code that was in nuopc_cap_share. Previously this code was built as part of the share library - not CMEPS. This is now moved into the CESM_share repository in ESCOMP/EPS_Share#88, so that library boundaries reflect the repository boundaries.

Specifically:

(1) driver_pio_mod and esm_utils_mod are now in the cesm driver directory, since they are only used from there

(2) all other files from nuopc_cap_share have been moved into CESM_share

(3) shr_flux_mod has also been moved into CESM_share (this module was also built as part of the share library)

**For CESM and NorESM, this PR depends on ESCOMP/EPS_Share#88; this CMEPS PR must be brought in at the same time or after that CESM_share PR.**

### Specific notes

Contributors other than yourself, if any: Mariana Vertenstein helped figure out the organization we want

CMEPS Issues Fixed (include github issue #):
- Resolves #605 
- Resolves #400 
- Helps with #402 
- Helps with #458 
- Helps with #465 

Are changes expected to change answers? (specify if bfb, different at roundoff, more substantial) - bfb

Any User Interface Changes (namelist or namelist defaults changes)? no

### Testing performed
aux_cime_baselines in the context of cesm3_0_alpha11d, with this branch along with the accompanying CESM_share branch. Tests pass and are bit-for-bit except expected failures.
@billsacks
billsacks deleted the reorganize_share_code branch November 10, 2026 19:53
billsacks added a commit to ESMCI/cime that referenced this pull request Nov 12, 2026
Rename buildlib.csm_share to buildlib.share

This updates config_files to agree with the change in file name made in ESCOMP/EPS_Share#88.

That PR was backwards compatible, so it's safe for the CESM_share change to come in before this CIME change, but this CIME change cannot come in before the CESM_share change.
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.

9 participants