Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add index to cpl_scalars to allow CSG or regional (single tile) mediator history files for ATM component in UFS #436

Merged
merged 11 commits into from
Mar 19, 2024

Conversation

DeniseWorthen
Copy link
Collaborator

@DeniseWorthen DeniseWorthen commented Mar 5, 2024

Description of changes

Adds an index to cpl_scalars to allow 6 tiles of a CSG or a single tile of a regional ATM grid to be written as the required number of 2-d fields in the mediator history files. Replaces current implementation of this feature, which is limited to CSG and component level history files (ie, not history written by the history write phase).

Specific notes

The additional index of cpl_scalars is specified with the variable ScalarFieldIdxGridNTile.
Includes final changes that were required for CDEPS_INLINE functionality in UFS
Includes minor fixup of typos, removal of unnecessary string trims on coupling_mode .
Includes fix for UFS lnd->atm masking

Contributors other than yourself, if any:

CMEPS Issues Fixed (include github issue #): NOAA-EMC#111

UFS Issue ufs-community/ufs-weather-model#2171

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

No

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

Only for UFS

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

DeniseWorthen and others added 9 commits January 31, 2024 09:20
… air-sea flux computation (NOAA-EMC#107)


* Update ufs/ccpp/data/MED_typedefs.meta.
Sync w/ ESCOMP, adding CDEPS inline capability to CMEPS
* add new cpl_scalar for mediator history files for tiled
gridded domains, eg cube-sphere. Replaces existing use of
config variables which restricted the use to 6-tiles domain
* remove unnecessary trims, fix minor typos and indentation
@DeniseWorthen
Copy link
Collaborator Author

DeniseWorthen commented Mar 5, 2024

@uturuncoglu I have this working in UFS when testing w/ a feature branch of FV3 to allow the export of the cpl_scalars from FV3. Would you please test in CESM. I believe it should work but I would prefer this to get tested and merged at ESCOMP first.

I also could add the required changes to the NOAHMP cap also.

@uturuncoglu
Copy link
Collaborator

@DeniseWorthen Sorry for late response. Last two days were full of meetings. Let me check this with CESM. I think I'll follow same approach and create baseline first and then check against it with your changes. @jedwards4b Please let me know if we have a baseline already.

@DeniseWorthen
Copy link
Collaborator Author

@uturuncoglu Thanks. Let me know if you run into any issues. Right now this is draft, but if you don't run into any issues, I'd like to commit it here first.

Note the PR also contains the final changes we made to get the CDEPS inline work committed for HAFS implementation.

@uturuncoglu
Copy link
Collaborator

@DeniseWorthen Okay. I was going to ask those changes. I'll update you once I finalize the tests.

@uturuncoglu
Copy link
Collaborator

@jedwards4b @fischer-ncar I created my own baseline using cesm2_3_alpha17b and compare agains it using the version of CMEPS in this PR and the tests are failing with following error. It seems that the tests could not find specific files. The baseline seems passing without any issue. So, maybe there is incotibility issue among component such as cime etc. but I am not sure why, I supposed that if you tag the model the components needs to be consistent. Right?

    FAIL ERR_Ld5.f09_t061.B1850MOM.derecho_intel.allactive-defaultio MEMCOMP [Errno 2] No such file or directory: '/glade/derecho/scratch/turuncu/baselines/20240306_cesm2_3_alpha17b/ERR_Ld5.f09_t061.B1850MOM.derecho_intel.allactive-defaultio/cpl-mem.log'
    FAIL ERR_Ld5.f09_t061.B1850MOM.derecho_intel.allactive-defaultio TPUTCOMP [Errno 2] No such file or directory: '/glade/derecho/scratch/turuncu/baselines/20240306_cesm2_3_alpha17b/ERR_Ld5.f09_t061.B1850MOM.derecho_intel.allactive-defaultio/cpl-tput.log'
    FAIL ERS_Ld5.f09_g17.I1850Clm50Sp.derecho_intel.clm-default MEMCOMP [Errno 2] No such file or directory: '/glade/derecho/scratch/turuncu/baselines/20240306_cesm2_3_alpha17b/ERS_Ld5.f09_g17.I1850Clm50Sp.derecho_intel.clm-default/cpl-mem.log'
    FAIL ERS_Ld5.f19_g17.I2000Clm51Bgc.derecho_intel.clm-default MEMCOMP [Errno 2] No such file or directory: '/glade/derecho/scratch/turuncu/baselines/20240306_cesm2_3_alpha17b/ERS_Ld5.f19_g17.I2000Clm51Bgc.derecho_intel.clm-default/cpl-mem.log'
    FAIL ERS_Ld5.ne30pg3_t232.BLT1850_v0c.derecho_intel.allactive-defaultio MEMCOMP [Errno 2] No such file or directory: '/glade/derecho/scratch/turuncu/baselines/20240306_cesm2_3_alpha17b/ERS_Ld5.ne30pg3_t232.BLT1850_v0c.derecho_intel.allactive-defaultio/cpl-mem.log'
    FAIL ERS_Ld5.T62_g37.DTEST.derecho_intel MEMCOMP [Errno 2] No such file or directory: '/glade/derecho/scratch/turuncu/baselines/20240306_cesm2_3_alpha17b/ERS_Ld5.T62_g37.DTEST.derecho_intel/cpl-mem.log'
    FAIL ERS_Ld5.T62_t061.CMOM.derecho_intel MEMCOMP [Errno 2] No such file or directory: '/glade/derecho/scratch/turuncu/baselines/20240306_cesm2_3_alpha17b/ERS_Ld5.T62_t061.CMOM.derecho_intel/cpl-mem.log'
    FAIL ERS_Ld5.T62_t061.GMOM.derecho_intel MEMCOMP [Errno 2] No such file or directory: '/glade/derecho/scratch/turuncu/baselines/20240306_cesm2_3_alpha17b/ERS_Ld5.T62_t061.GMOM.derecho_intel/cpl-mem.log'
    FAIL ERS_Ln9_C3.f19_g17_rx1.A.derecho_intel MEMCOMP [Errno 2] No such file or directory: '/glade/derecho/scratch/turuncu/baselines/20240306_cesm2_3_alpha17b/ERS_Ln9_C3.f19_g17_rx1.A.derecho_intel/cpl-mem.log'
    FAIL ERS_Ln9.f19_g17.X.derecho_intel MEMCOMP [Errno 2] No such file or directory: '/glade/derecho/scratch/turuncu/baselines/20240306_cesm2_3_alpha17b/ERS_Ln9.f19_g17.X.derecho_intel/cpl-mem.log'
    FAIL SMS_D_Ly1.f09_g17_gl4.T1850Gg.derecho_intel MEMCOMP [Errno 2] No such file or directory: '/glade/derecho/scratch/turuncu/baselines/20240306_cesm2_3_alpha17b/SMS_D_Ly1.f09_g17_gl4.T1850Gg.derecho_intel/cpl-mem.log'
  SMS_Ld2.ww3a.ADWAV.derecho_intel (Overall: FAIL) details:
    FAIL SMS_Ld2.ww3a.ADWAV.derecho_intel RUN time=16

FYI, the commands that I used to create baseline and check agains it,

./create_test --xml-testlist ../../components/cmeps/cime_config/testdefs/testlist_drv.xml --xml-machine derecho --xml-category nuopc --xml-compiler intel --generate 20240306_cesm2_3_alpha17b --baseline-root /glade/derecho/scratch/turuncu/baselines --xml-category aux_cmeps
./create_test --xml-testlist ../../components/cmeps/cime_config/testdefs/testlist_drv.xml --xml-machine derecho --xml-category nuopc --xml-compiler intel --compare 20240306_cesm2_3_alpha17b  --baseline-root /glade/derecho/scratch/turuncu/baselines --xml-category aux_cmeps

@fischer-ncar
Copy link
Contributor

@uturuncoglu I wouldn't worry about these failures. There's issues with the generation of the cpl-mem.log and cpl-tput.log.

@uturuncoglu
Copy link
Collaborator

@fischer-ncar Thanks for the confirmation and help. I think this PR is fine to go to main branch. Please let me know if you need more test. Otherwise, I think @DeniseWorthen could go ahead and make this PR ready for review.

As a side note, I think these kinds of issues are annoying for the unexperienced users like me and make hard to test the CESM. Since, this is shared component with UFS, I think we need to have more smooth testing and maybe guideline for the users that want to contribute to CMEPS and CDEPS. So, they could test easily until we have automated testing capability.

@DeniseWorthen DeniseWorthen marked this pull request as ready for review March 7, 2024 18:31
@DeniseWorthen
Copy link
Collaborator Author

@uturuncoglu Thanks for your testing. I did want to apologize for combining multiple things in this PR. I'll refrain in the future.

@uturuncoglu
Copy link
Collaborator

@DeniseWorthen No worries. I think it is better to combine them since testing in CESM side takes time.

@DeniseWorthen
Copy link
Collaborator Author

DeniseWorthen commented Mar 9, 2024

There is a small fix required to write mediator fractions on ntiles for the case where the med_phases_history_write phase is used. I can add this through a later PR if preferred, but I wanted to make note of it. The change is

diff --git a/mediator/med_phases_history_mod.F90 b/mediator/med_phases_history_mod.F90
index 606b6159..52b20c03 100644
--- a/mediator/med_phases_history_mod.F90
+++ b/mediator/med_phases_history_mod.F90
@@ -336,12 +336,14 @@ contains
                 ! Write mediator fraction field bundles
                 if (ESMF_FieldBundleIsCreated(is_local%wrap%FBFrac(n),rc=rc)) then
                    call med_io_write(io_file, is_local%wrap%FBFrac(n), whead(m), wdata(m), &
-                        is_local%wrap%nx(n), is_local%wrap%ny(n), nt=1, pre='Med_frac_'//trim(compname(n)), rc=rc)
+                        is_local%wrap%nx(n), is_local%wrap%ny(n), nt=1, pre='Med_frac_'//trim(compname(n)), &
+                        ntile=is_local%wrap%ntile(n), rc=rc)
                    if (ChkErr(rc,__LINE__,u_FILE_u)) return
                 end if
                 ! Write component mediator area field bundles
                 call med_io_write(io_file, is_local%wrap%FBArea(n), whead(m), wdata(m), &
-                     is_local%wrap%nx(n), is_local%wrap%ny(n), nt=1, pre='MED_'//trim(compname(n)), rc=rc)
+                     is_local%wrap%nx(n), is_local%wrap%ny(n), nt=1, pre='MED_'//trim(compname(n)), &
+                     ntile=is_local%wrap%ntile(n), rc=rc)
              end do

              ! Write atm/ocn fluxes and ocean albedoes if field bundles are created

* testing of this feature w/ UFS noahmp lnd component, which currently
runs on the CSG, found two issues. One to write the mediator fractions
and areas on the tiles when using the single history file. A second fix
is the mapping masking for lnd-atm coupling in UFS.
@DeniseWorthen DeniseWorthen requested review from uturuncoglu, jedwards4b and mvertens and removed request for uturuncoglu March 13, 2024 16:11
Copy link
Collaborator

@uturuncoglu uturuncoglu left a comment

Choose a reason for hiding this comment

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

@DeniseWorthen This looks good to me. Let me try to run CESM tests one more time if you don't mind to be sure that we are not changing anything in CESM side.

mediator/med_phases_restart_mod.F90 Show resolved Hide resolved
@uturuncoglu
Copy link
Collaborator

@DeniseWorthen I have just start test. Will update you soon.

@uturuncoglu
Copy link
Collaborator

@DeniseWorthen I run CMEPS aux tests with cesm2_3_alpha17b and compare agains my previously generated baseline and it look fine. @fischer-ncar @jedwards4b please let me know if you want me to do more test. Other than that I think this is ready to merge.

@uturuncoglu
Copy link
Collaborator

uturuncoglu commented Mar 13, 2024

@DeniseWorthen @jedwards4b @fischer-ncar Please wait before merging this. We might need to modify mask for lnd->atm for ufs. I'll update you soon. I think that the issue that we see around coastline is created by the masking. I'll try to set it differently and try again.

@uturuncoglu
Copy link
Collaborator

@DeniseWorthen If you don't mind could you modify

       if (n1 == complnd .and. n2 == compatm) then
          srcMaskValue = ispval_mask
          dstMaskValue = 0
       end if

as

       if (n1 == complnd .and. n2 == compatm) then
          srcMaskValue = ispval_mask
          dstMaskValue = ispval_mask
       end if

This will solve the coastline issue that we see in the results. I think, the 0 in destination mask is creating issue since there are fractional grid in UFS side so some grid points are fractional. If you want you could go without mask changes at all in this PR that is also fine and I could bring this later. Anyway, let me know what you think.

@DeniseWorthen
Copy link
Collaborator Author

@uturuncoglu I will make the change since I've got this CMEPS PR already open.

@uturuncoglu
Copy link
Collaborator

@DeniseWorthen Thanks. I think we could merge this but lets wait confirmation from @fischer-ncar and @jedwards4b.

@DeniseWorthen
Copy link
Collaborator Author

@uturuncoglu Are there any issues preventing this getting merged?

@uturuncoglu
Copy link
Collaborator

@DeniseWorthen As I know this Pr is fine to merge. @jedwards4b Can we merge this since this is preventing UFS level PR.

Copy link
Collaborator

@jedwards4b jedwards4b left a comment

Choose a reason for hiding this comment

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

LGTM

@jedwards4b jedwards4b merged commit 1825c2b into ESCOMP:main Mar 19, 2024
2 checks passed
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.

5 participants