Merged
Conversation
mvertens
approved these changes
Jan 1, 2026
Collaborator
mvertens
left a comment
There was a problem hiding this comment.
Thanks for this - it looks good.
billsacks
added a commit
to ESCOMP/CMEPS
that referenced
this pull request
Jan 2, 2026
Refactor med_methods_FB_init to allow handling of water tracer fields ### Description of changes Rather than having med_methods_FB_init accept one of fieldNameList or STflds, now it accepts an array of med_field_info_type objects. med_field_info_type is defined in a new module that also includes some creation methods, making calls to med_methods_FB_init a two-step process: first create field_info_array, then call med_methods_FB_init with this field_info_array. A key new feature is that the creation of a field_info_array from field_names will assume a single ungridded dimension with size given by shr_wtracers_get_num_tracers for any field with the water tracer suffix. This was the main motivation for the refactor here. Some specific notes about the changes in this commit: - Behavior change: if there are only scalar or blank fields, we do some unnecessary work now (retrieving the mesh that we won't end up ever using) - I think I got the gridToFieldMap right: before it was hard-coded to 2, but I think that was only right for a single ungridded dimension; here I'm generalizing that for multiple ungridded dimensions **This depends on the CESM_share changes in ESCOMP/CESM_share#78 and ESCOMP/CESM_share#80 ### Specific notes Contributors other than yourself, if any: CMEPS Issues Fixed (include github issue #): Are changes expected to change answers? (specify if bfb, different at roundoff, more substantial) No - bfb Any User Interface Changes (namelist or namelist defaults changes)? No ### Testing performed Please describe the tests along with the target model and machine(s) If possible, please also added hashes that were used in the testing Ran a subset of the CESM prealpha tests with baseline comparisons, using cesm3_0_alpha08a with this CMEPS branch and the share branch from ESCOMP/CESM_share#78: ``` ERS_D_Ld3.ne30pg3_t232.B1850C_LTso.derecho_intel.allactive-defaultio ERI.ne30pg3_t232.B1850C_LTso.derecho_intel.allactive-defaultio ERC_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s ERS_Ly7.f09_g17_gris4.T1850Gg.derecho_intel SMS_Lm13.f10_f10_mg37.I1850Clm50SpG.derecho_intel MULTINOAIS_Ly2.f10_f10_ais8gris4_mg37.I1850Clm50SpRsGag.derecho_intel.cism-change_params SMS_D_Ld1.ne30pg3_t232.I1850Clm50BgcSpinup.derecho_intel.clm-cplhist ERI.TL319_t232.G_JRA.derecho_intel.cice-default SMS_D.TL319_t232.G_JRA_RYF.derecho_intel SMS_Ld40.TL319_t232.C_JRA.derecho_intel ``` All tests pass and are bit-for-bit with the baselines. There were NLCOMP failures in some tests; from spot-checking, the NLCOMP failures all seem to be in MOM files. Nothing in this PR or the accompanying share PR could change the namelists, so I assume these are a pre-existing issue: ``` FAIL ERI.ne30pg3_t232.B1850C_LTso.derecho_intel.allactive-defaultio NLCOMP FAIL ERI.TL319_t232.G_JRA.derecho_intel.cice-default NLCOMP FAIL ERS_D_Ld3.ne30pg3_t232.B1850C_LTso.derecho_intel.allactive-defaultio NLCOMP FAIL SMS_D.TL319_t232.G_JRA_RYF.derecho_intel NLCOMP FAIL SMS_Ld40.TL319_t232.C_JRA.derecho_intel NLCOMP ```
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.
The main motivation of adding this is that it helps me break a dependency of CMEPS on CESM_share, which I'll illustrate in ESCOMP/CMEPS#620. But this also feels like it will lead to more self-documenting code, since
shr_wtracers_is_wtracer_fieldis more clear than callingshr_string_withoutSuffixdirectly.