Skip to content

Commit

Permalink
Merge pull request ESCOMP#2829 from samsrabin/merge-b4bdev-20241010
Browse files Browse the repository at this point in the history
Merge b4b-dev:
- Fix clm-basic tests
- Change testlist_clm ne30pg3_t061 tests to ne30pg3_t232
- Remove unused variable elevclass_o in mkglcmecMod.F90
- Add a check in failtest, warntest, finidat_files, so when a new test or finidat file are added and one of the subkeys is misspelled you will get an error and tester will die
- Move from deprecated shr_file to shr_log
- Set eflx_building_lun to spval properly
  • Loading branch information
samsrabin authored Oct 11, 2024
2 parents 899c32c + cfcd041 commit b330990
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 30 deletions.
23 changes: 23 additions & 0 deletions bld/unit_testers/build-namelist_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,13 @@ sub cat_and_create_namelistinfile {
);
foreach my $key ( keys(%failtest) ) {
print( "$key\n" );
my $var;
foreach $var ( "phys" , "options", "namelst" ) {
if ( not exists $failtest{$key}{$var} ) {
die "ERROR: Subkey $var does not exist for failtest $key\nERROR:Check if you spelled $var correctly\n"
}
}

&make_config_cache($failtest{$key}{"phys"});
my $options = $failtest{$key}{"options"};
my $namelist = $failtest{$key}{"namelst"};
Expand Down Expand Up @@ -1366,6 +1373,14 @@ sub cat_and_create_namelistinfile {
);
foreach my $key ( keys(%warntest) ) {
print( "$key\n" );

my $var;
foreach $var ( "phys" , "options", "namelst" ) {
if ( not exists $warntest{$key}{$var} ) {
die "ERROR: Subkey $var does not exist for warntest $key\nERROR:Check if you spelled $var correctly\n"
}
}

&make_config_cache($warntest{$key}{"phys"});
my $options = $warntest{$key}{"options"};
my $namelist = $warntest{$key}{"namelst"};
Expand Down Expand Up @@ -1595,6 +1610,14 @@ sub cat_and_create_namelistinfile {

foreach my $key ( keys(%finidat_files) ) {
print( "$key\n" );

my $var;
foreach $var ( "phys" , "atm_forc", "res", "bgc", "crop", "use_case", "start_ymd", "namelist" ) {
if ( not exists $finidat_files{$key}{$var} ) {
die "ERROR: Subkey $var does not exist for finidat_file $key\nERROR:Check if you spelled $var correctly\n"
}
}

my $phys = $finidat_files{$key}{'phys'};
print "physics = $phys\n";
&make_config_cache($phys);
Expand Down
6 changes: 5 additions & 1 deletion cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<desc lnd="CLM45[%SP][%SP-VIC][%BGC][%BGC-CROP][%FATES][%BGCDV][%BGCDV-CROP]" >clm4.5:</desc>
<desc lnd="CLM50[%SP][%SP-VIC][%SP-NOANTHRO][%BGC-NOANTHRO][%BGC][%BGC-CROP][%FATES][%BGCDV][%BGCDV-CROP][%BGC-CROP-CMIP6DECK][%BGC-CROP-CMIP6WACCMDECK][%NWP-SP][%NWP-BGC-CROP]">clm5.0:</desc>
<desc lnd="CLM51[%SP][%SP-NOANTHRO][%BGC-NOANTHRO][%BGC][%BGC-CROP][%FATES][%FATES-SP][%NWP-SP][%NWP-BGC-CROP]">clm5.1:</desc>
<desc lnd="CLM60[%SP][%SP-NOANTHRO][%BGC-NOANTHRO][%BGC][%BGC-CROP][%FATES][%FATES-SP][%NWP-SP][%NWP-BGC-CROP]">clm6.0:</desc>
<desc lnd="CLM60[%SP][%SP-NOANTHRO][%BGC-NOANTHRO][%BGC][%BGC-CROP][%FATES][%FATES-SP][%BGC-CROP-CMIP6DECK][%BGC-CROP-CMIP6WACCMDECK][%NWP-SP][%NWP-BGC-CROP]">clm6.0:</desc>
<desc option="SP" >Satellite phenology:</desc>

<desc option="SP-VIC" >Satellite phenology with VIC hydrology:</desc>
Expand Down Expand Up @@ -371,6 +371,10 @@
<value grid="l%1.9x2.5" compset="_CLM50%[^_]*CMIP6DECK[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_nociso_deck</value>
<value compset="_CLM50%[^_]*CMIP6WACCMDECK[%_]">$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_waccm_deck</value>
<value grid="l%1.9x2.5" compset="_CLM50%[^_]*CMIP6WACCMDECK[%_]">$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_waccm_nociso_deck</value>
<value compset="_CLM60%[^_]*CMIP6DECK[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_deck</value>
<value grid="l%1.9x2.5" compset="_CLM60%[^_]*CMIP6DECK[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_nociso_deck</value>
<value compset="_CLM60%[^_]*CMIP6WACCMDECK[%_]">$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_waccm_deck</value>
<value grid="l%1.9x2.5" compset="_CLM60%[^_]*CMIP6WACCMDECK[%_]">$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_waccm_nociso_deck</value>
</values>
<group>run_component_ctsm</group>
<file>env_case.xml</file>
Expand Down
8 changes: 8 additions & 0 deletions cime_config/config_compsets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,21 @@
<alias>I1850Clm50BgcCropCmip6</alias>
<lname>1850_DATM%GSWP3v1_CLM50%BGC-CROP-CMIP6DECK_SICE_SOCN_MOSART_SGLC_SWAV</lname>
</compset>
<compset>
<alias>I1850Clm60BgcCropCmip6</alias>
<lname>1850_DATM%GSWP3v1_CLM60%BGC-CROP-CMIP6DECK_SICE_SOCN_MOSART_SGLC_SWAV</lname>
</compset>

<!-- Primarily for testing the CMIP6WACCMDECK compset option -->
<!-- Use the CMIP6 version (clm5_0) -->
<compset>
<alias>I1850Clm50BgcCropCmip6waccm</alias>
<lname>1850_DATM%GSWP3v1_CLM50%BGC-CROP-CMIP6WACCMDECK_SICE_SOCN_MOSART_SGLC_SWAV</lname>
</compset>
<compset>
<alias>I1850Clm60BgcCropCmip6waccm</alias>
<lname>1850_DATM%GSWP3v1_CLM60%BGC-CROP-CMIP6WACCMDECK_SICE_SOCN_MOSART_SGLC_SWAV</lname>
</compset>

<!-- clm5_0 (CMIP6) version with BGC-Crop and CRU forcing -->
<compset>
Expand Down
10 changes: 5 additions & 5 deletions cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,7 @@
<option name="comment" >Repeat ERS_Ly20_Mmpi-serial...cropMonthlyNoinitial test with matrixcnOn</option>
</options>
</test>
<test name="ERS_Ly3" grid="f10_f10_mg37" compset="I1850Clm50BgcCropCmip6" testmods="clm/basic">
<test name="ERS_Ly3" grid="f10_f10_mg37" compset="I1850Clm60BgcCropCmip6" testmods="clm/basic">
<machines>
<machine name="derecho" compiler="intel" category="aux_clm"/>
</machines>
Expand Down Expand Up @@ -1987,7 +1987,7 @@
<option name="comment" >Simple test to make sure the basic Fates-SP compset works"</option>
</options>
</test>
<test name="SMS_D_Ld1" grid="ne30pg3_t061" compset="I1850Clm50BgcSpinup" testmods="clm/cplhist">
<test name="SMS_D_Ld1" grid="ne30pg3_t232" compset="I1850Clm50BgcSpinup" testmods="clm/cplhist">
<machines>
<machine name="derecho" compiler="intel" category="aux_clm"/>
<machine name="derecho" compiler="intel" category="prealpha"/>
Expand All @@ -1996,7 +1996,7 @@
<option name="wallclock">00:20:00</option>
</options>
</test>
<test name="SMS_D_Ld1" grid="ne30pg3_t061" compset="I1850Clm50BgcSpinup" testmods="clm/cplhist--clm/matrixcnOn">
<test name="SMS_D_Ld1" grid="ne30pg3_t232" compset="I1850Clm50BgcSpinup" testmods="clm/cplhist--clm/matrixcnOn">
<machines>
<machine name="derecho" compiler="intel" category="aux_clm"/>
<machine name="derecho" compiler="intel" category="prealpha"/>
Expand Down Expand Up @@ -2431,7 +2431,7 @@
<option name="comment" >include a production intel test of Clm45</option>
</options>
</test>
<test name="SMS_Ld2_D_PS" grid="f09_g17" compset="I1850Clm50BgcCropCmip6" testmods="clm/basic_interp">
<test name="SMS_Ld2_D_PS" grid="f09_g17" compset="I1850Clm60BgcCropCmip6" testmods="clm/basic_interp">
<machines>
<machine name="derecho" compiler="intel" category="aux_clm"/>
</machines>
Expand Down Expand Up @@ -3262,7 +3262,7 @@
<option name="comment">12 month exact restart FATES single site debug test covering anthropogenic fire ignition mode.</option>
</options>
</test>
<test name="SMS_Lm1" grid="f10_f10_mg37" compset="I1850Clm50BgcCropCmip6waccm" testmods="clm/basic">
<test name="SMS_Lm1" grid="f10_f10_mg37" compset="I1850Clm60BgcCropCmip6waccm" testmods="clm/basic">
<machines>
<machine name="derecho" compiler="gnu" category="aux_clm"/>
<machine name="derecho" compiler="gnu" category="prealpha"/>
Expand Down
70 changes: 69 additions & 1 deletion doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,72 @@
===============================================================
Tag name: ctsm5.3.006
Originator(s): samrabin (Sam Rabin, UCAR/TSS, samrabin@ucar.edu)
Date: Fri Oct 11 07:01:09 MDT 2024
One-line Summary: Merge b4b-dev

Purpose and description of changes
----------------------------------

- Fix clm-basic tests (resolves ESCOMP/CTSM#2787)
- Change testlist_clm ne30pg3_t061 tests to ne30pg3_t232 (resolves ESCOMP/CTSM#2702)
- Remove unused variable elevclass_o in mkglcmecMod.F90 (resolves ESCOMP/CTSM#2802)
- Add a check in failtest, warntest, finidat_files, so when a new test or finidat file are added and one of the subkeys is misspelled you will get an error and tester will die (resolves ESCOMP/CTSM#2673)
- Move from deprecated shr_file to shr_log
- Set eflx_building_lun to spval properly (resolves ESCOMP/CTSM#2793)


Significant changes to scientifically-supported configurations
--------------------------------------------------------------

Does this tag change answers significantly for any of the following physics configurations?
(Details of any changes will be given in the "Answer changes" section below.)

[Put an [X] in the box for any configuration with significant answer changes.]

[ ] clm6_0

[ ] clm5_1

[ ] clm5_0

[ ] ctsm5_0-nwp

[ ] clm4_5


Bugs fixed
----------

List of CTSM issues fixed:
- ESCOMP/CTSM#2787 (aux_clm "clm-basic" tests fail as of ctsm5.3.0 because they need c13 in finidat; https://github.com/ESCOMP/CTSM/issues/2787)
- ESCOMP/CTSM#2702 (Tests failing in ctsm5.2.019 for CESM alpha testing; https://github.com/ESCOMP/CTSM/issues/2702)
- ESCOMP/CTSM#2802 (Array elevclass_o in mksurfdata_esmf/src/mkglcmecMod.F90 is not allocated before use; https://github.com/ESCOMP/CTSM/issues/2802)
- ESCOMP/CTSM#2673 (Catch use of namelist attribute in failure testing in perl build-namelist tester; https://github.com/ESCOMP/CTSM/issues/2673)
- ESCOMP/CTSM#2793 (Potential typo/bug in EnergyFluxType.F90; https://github.com/ESCOMP/CTSM/issues/2793)


Testing summary:
----------------

regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing):

derecho ----- OK
izumi ------- OK


Other details
-------------

Pull Requests that document the changes:
- ESCOMP/CTSM#2798: Fix clm-basic tests (https://github.com/ESCOMP/CTSM/pull/2798)
- ESCOMP/CTSM#2799: Change testlist_clm ne30pg3_t061 tests to ne30pg3_t232 (https://github.com/ESCOMP/CTSM/pull/2799)
- ESCOMP/CTSM#2804: Remove unused variable elevclass_o in mkglcmecMod.F90 (https://github.com/ESCOMP/CTSM/pull/2804)
- ESCOMP/CTSM#2678: Add check in build-namelist_test.pl (https://github.com/ESCOMP/CTSM/pull/2678)
- ESCOMP/CTSM#2627: move from depricated shr_file to shr_log (https://github.com/ESCOMP/CTSM/pull/2627)
- ESCOMP/CTSM#2806: Set eflx_building_lun to spval properly (https://github.com/ESCOMP/CTSM/pull/2806)

===============================================================
===============================================================
Tag name: ctsm5.3.005
Originator(s): dmleung (Danny Leung)
Date: Thu 10 Oct 2024 03:15:52 AM MDT
Expand Down Expand Up @@ -91,7 +159,7 @@ Pull Requests that document the changes (include PR ids):
===============================================================
===============================================================
Tag name: ctsm5.3.004
Originator(s): samrabin (Sam Rabin)
Originator(s): samrabin (Sam Rabin, UCAR/TSS, samrabin@ucar.edu)
Date: Mon Oct 7 21:25:20 MDT 2024
One-line Summary: Move hillslope data off surface datasets

Expand Down
1 change: 1 addition & 0 deletions doc/ChangeSum
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Tag Who Date Summary
============================================================================================================================
ctsm5.3.006 samrabin 10/11/2024 Merge b4b-dev
ctsm5.3.005 erik 10/10/2024 Hardcoded tuning adjustments for Leung_2024 dust emissions
ctsm5.3.004 samrabin 10/07/2024 Move hillslope data off surface datasets
ctsm5.3.003 multiple 10/07/2024 FATES default parameter file update
Expand Down
2 changes: 1 addition & 1 deletion src/biogeophys/EnergyFluxType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp)
avgflag='A', long_name='urban heating flux', &
ptr_col=this%eflx_urban_heat_col, set_nourb=0._r8, c2l_scale_type='urbanf')
else
this%eflx_urban_ac_lun(begl:endl) = spval
this%eflx_building_lun(begl:endl) = spval
call hist_addfld1d (fname='EFLXBUILD', units='W/m^2', &
avgflag='A', long_name='building heat flux from change in interior building air temperature', &
ptr_lunit=this%eflx_building_lun, set_nourb=0._r8, l2g_scale_type='unity')
Expand Down
37 changes: 18 additions & 19 deletions src/cpl/nuopc/lnd_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module lnd_comp_nuopc
use NUOPC_Model , only : NUOPC_ModelGet
use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl
use shr_sys_mod , only : shr_sys_abort
use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit
use shr_log_mod , only : shr_log_setLogUnit, shr_log_getLogUnit
use shr_orb_mod , only : shr_orb_decl, shr_orb_params, SHR_ORB_UNDEF_REAL, SHR_ORB_UNDEF_INT
use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date
use spmdMod , only : masterproc, mpicom, spmd_init
Expand Down Expand Up @@ -66,7 +66,7 @@ module lnd_comp_nuopc
private :: clm_orbital_init ! Initialize the orbital information
private :: clm_orbital_update ! Update the orbital information
private :: CheckImport

!--------------------------------------------------------------------------
! Private module data
!--------------------------------------------------------------------------
Expand Down Expand Up @@ -333,8 +333,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
!----------------------------------------------------------------------------
! reset shr logging to original values
!----------------------------------------------------------------------------

call shr_file_setLogUnit (shrlogunit)
call shr_log_setLogUnit(shrlogunit)
call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO)

end subroutine InitializeAdvertise
Expand Down Expand Up @@ -497,8 +496,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
! Reset shr logging to my log file
!----------------------------------------------------------------------------

call shr_file_getLogUnit (shrlogunit)
call shr_file_setLogUnit (iulog)
call shr_log_getLogUnit (shrlogunit)
call shr_log_setLogUnit (iulog)
#if (defined _MEMTRACE)
if (masterproc) then
lbnum=1
Expand Down Expand Up @@ -683,7 +682,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif

call shr_file_setLogUnit (shrlogunit)
call shr_log_setLogUnit (shrlogunit)

#if (defined _MEMTRACE)
if(masterproc) then
Expand Down Expand Up @@ -774,8 +773,8 @@ subroutine ModelAdvance(gcomp, rc)
! Reset share log units
!--------------------------------

call shr_file_getLogUnit (shrlogunit)
call shr_file_setLogUnit (iulog)
call shr_log_getLogUnit (shrlogunit)
call shr_log_setLogUnit (iulog)

#if (defined _MEMTRACE)
if(masterproc) then
Expand Down Expand Up @@ -864,7 +863,7 @@ subroutine ModelAdvance(gcomp, rc)
rstwr = .false.
if (nlend .and. write_restart_at_endofrun) then
rstwr = .true.
else
else
call ESMF_ClockGetAlarm(clock, alarmname='alarm_restart', alarm=alarm, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (ESMF_AlarmIsCreated(alarm, rc=rc)) then
Expand Down Expand Up @@ -964,7 +963,7 @@ subroutine ModelAdvance(gcomp, rc)
! Reset shr logging to my original values
!--------------------------------

call shr_file_setLogUnit (shrlogunit)
call shr_log_setLogUnit (shrlogunit)

call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO)

Expand Down Expand Up @@ -1289,14 +1288,14 @@ subroutine CheckImport(gcomp, rc)
type(ESMF_GridComp) :: gcomp
integer, intent(out) :: rc
character(len=*) , parameter :: subname = "("//__FILE__//":CheckImport)"

! This is the routine that enforces the explicit time dependence on the
! import fields. This simply means that the timestamps on the Fields in the
! importState are checked against the currentTime on the Component's
! importState are checked against the currentTime on the Component's
! internalClock. Consequenty, this model starts out with forcing fields
! at the current time as it does its forward step from currentTime to
! at the current time as it does its forward step from currentTime to
! currentTime + timeStep.

! local variables
type(ESMF_Clock) :: clock
type(ESMF_Time) :: time
Expand All @@ -1320,19 +1319,19 @@ subroutine CheckImport(gcomp, rc)
! query the component for info
call NUOPC_CompGet(gcomp, name=name, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

! query the Component for its clock and importState
call ESMF_GridCompGet(gcomp, clock=clock, importState=importState, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

! get the current time out of the clock
call ESMF_ClockGet(clock, currTime=time, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

! check that Fields in the importState show correct timestamp
allCurrent = NUOPC_IsAtTime(importState, time, fieldList=fieldList, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

if (.not.allCurrent) then
!TODO: introduce and use INCOMPATIBILITY return codes!!!!
do i=1, size(fieldList)
Expand All @@ -1354,6 +1353,6 @@ subroutine CheckImport(gcomp, rc)
rcToReturn=rc)
return ! bail out
endif

end subroutine CheckImport
end module lnd_comp_nuopc
3 changes: 0 additions & 3 deletions tools/mksurfdata_esmf/src/mkglcmecMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ subroutine mkglcmecInit( pioid_o )
! local variables:
type(var_desc_t) :: pio_varid
type(io_desc_t) :: pio_iodesc
real(r8), allocatable :: elevclass_o(:) ! elevation classes
integer :: rcode
character(len=*), parameter :: subname = 'mkglcmecInit'
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -100,8 +99,6 @@ subroutine mkglcmecInit( pioid_o )
call shr_sys_abort()
end if

elevclass_o(:) = elevclass(:)

if (root_task) write(ndiag, '(a)') trim(subname)//" writing out GLC_MEC"
rcode = pio_inq_varid(pioid_o, 'GLC_MEC', pio_varid)
rcode = pio_put_var(pioid_o, pio_varid, elevclass)
Expand Down

0 comments on commit b330990

Please sign in to comment.