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

Addition of enthalpy fluxes in CESM #278

Merged
merged 18 commits into from
Apr 1, 2022

Conversation

mvertens
Copy link
Collaborator

@mvertens mvertens commented Mar 30, 2022

Description of changes

Addition of enthalpy fluxes in CESM

Specific notes

Currently in CESM, enthalpy fluxes are not accounted for by other components. In fully-coupled simulation with MOM6, this leads to an imbalance of ~ -0.25 W m-2 in the system. This PR addresses sending enthalpy fluxes back to MOM6 and at the same time adding a correction term to the sensible heat flux sent back to CAM.

Contributors other than yourself, if any: @gustavo-marques

CMEPS Issues Fixed: None

Are changes expected to change answers? (specify if bfb, different at roundoff, more substantial)
Answers will change only for simulations involving MOM6 and where the following must currently be changed for MOM:

set
ENTHALPY_FROM_COUPLER = True
in
SourceMods/src.mom/MOM_override

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

Testing performed

Testing performed if application target is CESM:
Used cesm2_3_beta08 with the updates to CESM and the following branch for MOM6:

repository: https://github.com/gustavo-marques/MOM6.git 
branch: gustavo/enthalpy_coupler

Ran the following tests to show bfb with cesm2_3_beta08:

ERP_Ln9_Vnuopc.f09_f09_mg17.F2000climo.cheyenne_intel.cam-outfrq9s_mg3
ERS.T62_g37.G.cheyenne_intel.pop-cice
SMS_Ld5.f09_g17.B1850G.cheyenne_intel.allactive-cism-test_coupling

Ran ERS.TL319_t061.GMOM_JRA_WD.cheyenne_intel and verified that it passed restart

Testing performed if application target is UFS-coupled:

  • (recommended) UFS-coupled testing
    • description: All coupled, HAFS and NG-GODAS tests pass at 6b1787f
    • details (e.g. failed tests): point to this CMEPS PR branch

Testing performed if application target is UFS-HAFS:

  • (recommended) UFS-HAFS testing
    • description:
    • details (e.g. failed tests):

Hashes used for testing:

Mariana Vertenstein and others added 16 commits July 9, 2021 13:52
* We no longer need to calcuate the enthalpy associated with
meltw. The sea-ice model is already accounting for this enthalpy
and the corresponding heat flux is included in meltw;

* Adding a term representing the enthalpy associated with
condensation (positive evaporation in the ocean). This term is
treated just like liquid precipitation (rain), and is accounted for in
hcorr;

* Revisiting the limeters (min/max depending if mass is liquid or frozen)
in the enthalpy calculations.
@mvertens
Copy link
Collaborator Author

@JEdwards - I don't understand why this build is failing. I was able to successfully build the following on cheyenne with the latest version of CIME and this branch: feature/enthalpy_changes

@jedwards4b
Copy link
Collaborator

The extbuild test is a build of cmeps without cesm. It's failing because you have included usage of shr_const_mod
in med_phases_prep_ocn_mod.F90.

@uturuncoglu
Copy link
Collaborator

@mvertens I got following compile error when I test this under UFS,

/glade/scratch/turuncu/ufs-weather-model/CMEPS-interface/CMEPS/mediator/med_phases_prep_ocn_mod.F90(82): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [SHR_CONST_MOD]
    use shr_const_mod           , only : shr_const_cpsw, shr_const_tkfrz, shr_const_pi
--------^
/glade/scratch/turuncu/ufs-weather-model/CMEPS-interface/CMEPS/mediator/med_phases_prep_ocn_mod.F90(186): error #6404: This name does not have a type, and must have an explicit type.   [SHR_CONST_TKFRZ]
          hrain(n)  = max((tocn(n) - shr_const_tkfrz), 0._r8) * rain(n)  * shr_const_cpsw
-------------------------------------^
/glade/scratch/turuncu/ufs-weather-model/CMEPS-interface/CMEPS/mediator/med_phases_prep_ocn_mod.F90(186): error #6404: This name does not have a type, and must have an explicit type.   [SHR_CONST_CPSW]
          hrain(n)  = max((tocn(n) - shr_const_tkfrz), 0._r8) * rain(n)  * shr_const_cpsw
---------------------------------------------------------------------------^
/glade/scratch/turuncu/ufs-weather-model/CMEPS-interface/CMEPS/mediator/med_phases_prep_ocn_mod.F90(200): error #6404: This name does not have a type, and must have an explicit type.   [SHR_CONST_PI]
          glob_area_inv = 1._r8 / (4._r8 * shr_const_pi)
-------------------------------------------^
/glade/scratch/turuncu/ufs-weather-model/CMEPS-interface/CMEPS/mediator/med_phases_prep_ocn_mod.F90(82): error #6580: Name in only-list does not exist or is not accessible.   [SHR_CONST_CPSW]
    use shr_const_mod           , only : shr_const_cpsw, shr_const_tkfrz, shr_const_pi
-----------------------------------------^
/glade/scratch/turuncu/ufs-weather-model/CMEPS-interface/CMEPS/mediator/med_phases_prep_ocn_mod.F90(82): error #6580: Name in only-list does not exist or is not accessible.   [SHR_CONST_TKFRZ]
    use shr_const_mod           , only : shr_const_cpsw, shr_const_tkfrz, shr_const_pi
---------------------------------------------------------^
/glade/scratch/turuncu/ufs-weather-model/CMEPS-interface/CMEPS/mediator/med_phases_prep_ocn_mod.F90(82): error #6580: Name in only-list does not exist or is not accessible.   [SHR_CONST_PI]
    use shr_const_mod           , only : shr_const_cpsw, shr_const_tkfrz, shr_const_pi
--------------------------------------------------------------------------^
compilation aborted for /glade/scratch/turuncu/ufs-weather-model/CMEPS-interface/CMEPS/mediator/med_phases_prep_ocn_mod.F90 (code 1)
make[2]: *** [CMEPS-interface/CMakeFiles/cmeps.dir/CMEPS/mediator/med_phases_prep_ocn_mod.F90.o] Error 1
make[1]: *** [CMEPS-interface/CMakeFiles/cmeps.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2

UFS uses its on constant module under https://github.com/ESCOMP/CMEPS/blob/master/ufs/ufs_const_mod.F90 and it is not called as shr_const_mod. So, this part requires CPP preprocessor for CESM.

@jedwards4b
Copy link
Collaborator

@uturuncoglu I think this should be fixed now, please try again.

@uturuncoglu
Copy link
Collaborator

@jedwards4b let me try again.

@uturuncoglu
Copy link
Collaborator

@mvertens @jedwards4b the compile is fine now but I am getting following error from the run.

20220331 115942.153 ERROR            PET011 med_methods_mod.F90:1640 (med_methods_FB_GetFldPtr): ERROR field Faxx_sen not in FB
20220331 115942.153 ERROR            PET011 med_phases_prep_atm_mod.F90:230 Failure  - Passing error in return code
20220331 115942.153 ERROR            PET011 MED:src/addon/NUOPC/src/NUOPC_ModelBase.F90:2215 Failure  - Passing error in return code
20220331 115942.153 ERROR            PET011 EARTH Grid Comp:src/addon/NUOPC/src/NUOPC_Driver.F90:3340 Failure  - Phase 'med_phases_prep_atm' Run for modelComp 1 did not return ESMF_SUCCESS
20220331 115942.153 ERROR            PET011 EARTH Grid Comp:src/addon/NUOPC/src/NUOPC_Driver.F90:3625 Failure  - Passing error in return code
20220331 115942.153 ERROR            PET011 EARTH Grid Comp:src/addon/NUOPC/src/NUOPC_Driver.F90:3255 Failure  - Passing error in return code
20220331 115942.153 ERROR            PET011 UFS.F90:403 Failure  - Aborting UFS
20220331 115942.153 INFO             PET011 Finalizing ESMF

@mvertens
Copy link
Collaborator Author

@uturuncoglu - thanks so much for testing this. Can you please point me to your sandbox? Or the mediator log file determining what is being advertised. Or a PET log file. If you are not running on cheyenne - can you bring one of those back to cheyenne so I can look at it?

@uturuncoglu
Copy link
Collaborator

@mvertens It is on Cheyenne. You could see the run directory is here: /glade/scratch/turuncu/FV3_RT/rt_29940/cpld_control_p8/

@mvertens
Copy link
Collaborator Author

@uturuncoglu - thanks I'll take a look.

@DeniseWorthen
Copy link
Collaborator

I think this probably just needs a FB_FldChck for the Faxx_sen field?

@mvertens
Copy link
Collaborator Author

@DeniseWorthen - I think you are right!
I have not had a chance to look at the code but that should do it I believe.

@uturuncoglu
Copy link
Collaborator

uturuncoglu commented Mar 31, 2022

@mvertens @DeniseWorthen testing it now.

    if (FB_FldChk(is_local%wrap%FBExp(compatm), 'Faxx_sen', rc=rc)) then
       call FB_getfldptr(is_local%wrap%FBExp(compatm), 'Faxx_sen', dataptr1, rc=rc)
       if (ChkErr(rc,__LINE__,u_FILE_u)) return
       do n = 1,size(dataptr1)
          dataptr1(n) = dataptr1(n) + global_htot_corr(1)
       end do
       write(6,*)'DEBUG: global_htot_corr = ',global_htot_corr(1)
    end if

@uturuncoglu
Copy link
Collaborator

@mvertens @DeniseWorthen Okay. It passed the test with the changes. I am still not sure about just by adding if statement would be enough. The Faxx_sen could be available but global_htot_corr not. Any idea? @mvertens you could add that code to your branch.

mediator/med_phases_prep_atm_mod.F90 Outdated Show resolved Hide resolved
@mvertens
Copy link
Collaborator Author

mvertens commented Apr 1, 2022

@uturuncoglu @DeniseWorthen - thanks so much for testing this and resolving this problem!
I've pushed the fix back and will plan to go ahead with the PR.

Copy link
Collaborator

@DeniseWorthen DeniseWorthen left a comment

Choose a reason for hiding this comment

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

I've tested UWM with Ufuk's fix and all baselines pass; I've added the info to the PR

@mvertens mvertens merged commit a332fc8 into ESCOMP:master Apr 1, 2022
mvertens added a commit to mvertens/CMEPS that referenced this pull request Apr 14, 2022
Add ability to send enthalpy fluxes back to MOM6 and at the same time adding a correction term to the sensible heat flux sent back to CAM.
@mvertens mvertens deleted the feature/enthalpy_changes branch June 16, 2023 08:06
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