From ea3ec34004f2e5638de36f0b7a591e66e0f0cda0 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 4 Mar 2024 11:12:25 -0500 Subject: [PATCH 1/9] adding fates radiation subfolder --- components/elm/bld/configure | 1 + 1 file changed, 1 insertion(+) diff --git a/components/elm/bld/configure b/components/elm/bld/configure index 01cc15f9d204..e0a13f30be7d 100755 --- a/components/elm/bld/configure +++ b/components/elm/bld/configure @@ -477,6 +477,7 @@ sub write_filepath_cesmbld "external_models/fates/biogeochem", "external_models/fates/fire", "external_models/fates/parteh", + "external_models/fates/radiation", "external_models/mpp/src/mpp/dtypes", "external_models/mpp/src/mpp/thermal", "external_models/mpp/src/mpp/util", From 54ca44f917bcce0c850e2d907ff3538f1298cd2b Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 4 Mar 2024 11:18:12 -0500 Subject: [PATCH 2/9] Changing fates radiation calls to be method agnostic --- components/elm/src/main/elmfates_interfaceMod.F90 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/elm/src/main/elmfates_interfaceMod.F90 b/components/elm/src/main/elmfates_interfaceMod.F90 index edcdd01f1ede..d12704ee1e26 100644 --- a/components/elm/src/main/elmfates_interfaceMod.F90 +++ b/components/elm/src/main/elmfates_interfaceMod.F90 @@ -149,7 +149,8 @@ module ELMFatesInterfaceMod use EDInitMod , only : init_patches use EDInitMod , only : set_site_properties use EDPftVarcon , only : EDpftvarcon_inst - use EDSurfaceRadiationMod , only : ED_SunShadeFracs, ED_Norman_Radiation + use FatesRadiationDriveMod, only : FatesSunShadeFracs + use FatesRadiationDriveMod, only : FatesNormalizedCanopyRadiation use EDBtranMod , only : btran_ed, & get_active_suction_layers use EDCanopyStructureMod , only : canopy_summarization, update_hlm_dynamics @@ -2055,7 +2056,7 @@ subroutine wrap_sunfrac(this,bounds_clump,top_af_inst,canopystate_inst) ! as well as total patch sun/shade fraction output boundary condition ! ------------------------------------------------------------------------------- - call ED_SunShadeFracs(this%fates(nc)%nsites, & + call FatesSunShadeFracs(this%fates(nc)%nsites, & this%fates(nc)%sites, & this%fates(nc)%bc_in, & this%fates(nc)%bc_out) @@ -2563,7 +2564,7 @@ subroutine wrap_canopy_radiation(this, bounds_clump, & end do end do - call ED_Norman_Radiation(this%fates(nc)%nsites, & + call FatesNormalizedCanopyRadiation(this%fates(nc)%nsites, & this%fates(nc)%sites, & this%fates(nc)%bc_in, & this%fates(nc)%bc_out) From 9b1d3ba67f8b5929abc5bde3c658f15cf9041138 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 4 Mar 2024 11:21:22 -0500 Subject: [PATCH 3/9] setting fates submodule pointer to sci.1.72.0_api.33.0.0 --- components/elm/src/external_models/fates | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/elm/src/external_models/fates b/components/elm/src/external_models/fates index 698a8df848ec..42d804ba54d0 160000 --- a/components/elm/src/external_models/fates +++ b/components/elm/src/external_models/fates @@ -1 +1 @@ -Subproject commit 698a8df848ecdb81aa72fee6c86be2c41b2545e9 +Subproject commit 42d804ba54d0cf013a9737018ff9920e0c9808ea From a49e2ca819cb16c07cd6493f1d8919abbf9f5ab2 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 27 Mar 2024 22:25:40 -0700 Subject: [PATCH 4/9] add two stream testmod to fates test list --- cime_config/tests.py | 1 + .../testmods_dirs/elm/fates_cold_twostream/README | 15 +++++++++++++++ .../elm/fates_cold_twostream/include_user_mods | 1 + .../elm/fates_cold_twostream/shell_commands | 8 ++++++++ .../elm/fates_cold_twostream/user_nl_clm | 1 + 5 files changed, 26 insertions(+) create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/README create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/include_user_mods create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/shell_commands create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/user_nl_clm diff --git a/cime_config/tests.py b/cime_config/tests.py index f75032ef3349..e47ef8b7ade9 100644 --- a/cime_config/tests.py +++ b/cime_config/tests.py @@ -425,6 +425,7 @@ "ERS_Ld60.f45_g37.IELMFATES.elm-fates_cold_nofire", "ERS_Ld60.f45_g37.IELMFATES.elm-fates_cold_st3", "ERS_Ld60.f45_g37.IELMFATES.elm-fates_cold_pphys", + "SMS_D_Ld15.f45_g37.IELMFATES.elm-fates_cold_twostream", ) }, diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/README b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/README new file mode 100644 index 000000000000..9044e1135474 --- /dev/null +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/README @@ -0,0 +1,15 @@ +Testing FATES two-stream radiation scheme is activated by switching the fates_rad_model +parameter from 1 to 2. This is all that is needed, both radiation schemes +1) Norman and 2) two-stream use the same optical parameters. + +fates_rad_model + +Note that to avoid exceeding the filename string length maximum, the parameter +file generated on the fly is placed in the $SRCROOT/src/fates/parameter_files +directory. This may still run into problems is the $SRCROOT string is too long. + +Like the test with seed dispersal activation, the main downside of this method is +that this file will require a custom update for every fates parameter file API update. +Allowing the HLM to generate the file at runtime via buildnamelist step +will provide the capability to build the fates parameter file on +the fly which with the appropriate values for this test. diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/include_user_mods b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/include_user_mods new file mode 100644 index 000000000000..14f7591b725f --- /dev/null +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/include_user_mods @@ -0,0 +1 @@ +../FatesCold diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/shell_commands b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/shell_commands new file mode 100644 index 000000000000..5d94e5f6594a --- /dev/null +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/shell_commands @@ -0,0 +1,8 @@ +SRCDIR=`./xmlquery SRCROOT --value` +CASEDIR=`./xmlquery CASEROOT --value` +FATESDIR=$SRCDIR/src/fates +FATESPARAMFILE=$CASEDIR/fates_params_twostream.nc + +ncgen -o $FATESPARAMFILE $FATESDIR/parameter_files/fates_params_default.cdl + +$FATESDIR/tools/modify_fates_paramfile.py --O --fin $FATESPARAMFILE --fout $FATESPARAMFILE --var fates_rad_model --val 2 --allpfts diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/user_nl_clm b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/user_nl_clm new file mode 100644 index 000000000000..cae5fc2112da --- /dev/null +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/user_nl_clm @@ -0,0 +1 @@ +fates_paramfile = '$CASEROOT/fates_params_twostream.nc' From 65df1fe783837555129a41fd468d0ca8752ce63a Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 27 Mar 2024 22:57:02 -0700 Subject: [PATCH 5/9] correct fates two stream testmod --- .../elm/fates_cold_twostream/include_user_mods | 2 +- .../testmods_dirs/elm/fates_cold_twostream/shell_commands | 7 +++++++ .../elm/fates_cold_twostream/{user_nl_clm => user_nl_elm} | 0 3 files changed, 8 insertions(+), 1 deletion(-) rename components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/{user_nl_clm => user_nl_elm} (100%) diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/include_user_mods b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/include_user_mods index 14f7591b725f..45e8af32d22a 100644 --- a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/include_user_mods +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/include_user_mods @@ -1 +1 @@ -../FatesCold +../fates_cold diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/shell_commands b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/shell_commands index 5d94e5f6594a..dbf88f570c46 100644 --- a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/shell_commands +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/shell_commands @@ -1,3 +1,7 @@ +module load e4s +spack env activate gcc +spack load nco + SRCDIR=`./xmlquery SRCROOT --value` CASEDIR=`./xmlquery CASEROOT --value` FATESDIR=$SRCDIR/src/fates @@ -6,3 +10,6 @@ FATESPARAMFILE=$CASEDIR/fates_params_twostream.nc ncgen -o $FATESPARAMFILE $FATESDIR/parameter_files/fates_params_default.cdl $FATESDIR/tools/modify_fates_paramfile.py --O --fin $FATESPARAMFILE --fout $FATESPARAMFILE --var fates_rad_model --val 2 --allpfts + +spack unload nco +module unload e4s diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/user_nl_clm b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/user_nl_elm similarity index 100% rename from components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/user_nl_clm rename to components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/user_nl_elm From 468157c237c1f008fdd1797f265c72ef10a78627 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Sun, 31 Mar 2024 22:57:43 -0700 Subject: [PATCH 6/9] remove history variables from fates allvar test module These variables were removed with API33 --- .../testdefs/testmods_dirs/elm/fates_cold_allvars/user_nl_elm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_allvars/user_nl_elm b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_allvars/user_nl_elm index 67f363bb0a3e..2aff9c0b3c23 100644 --- a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_allvars/user_nl_elm +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_allvars/user_nl_elm @@ -14,8 +14,7 @@ hist_fincl1 = 'FATES_CROWNAREA_PF', 'FATES_CANOPYCROWNAREA_PF', 'FATES_LAISHA_TOP_CL', 'FATES_FABD_SUN_CLLLPF', 'FATES_FABD_SHA_CLLLPF', 'FATES_FABI_SUN_CLLLPF', 'FATES_FABI_SHA_CLLLPF', 'FATES_FABD_SUN_CLLL', 'FATES_FABD_SHA_CLLL', 'FATES_FABI_SUN_CLLL', 'FATES_FABI_SHA_CLLL', -'FATES_PARPROF_DIR_CLLLPF', 'FATES_PARPROF_DIF_CLLLPF', -'FATES_PARPROF_DIR_CLLL', 'FATES_PARPROF_DIF_CLLL', 'FATES_FABD_SUN_TOPLF_CL', +'FATES_PARPROF_DIR_CLLLPF', 'FATES_PARPROF_DIF_CLLLPF','FATES_FABD_SUN_TOPLF_CL', 'FATES_FABD_SHA_TOPLF_CL', 'FATES_FABI_SUN_TOPLF_CL', 'FATES_FABI_SHA_TOPLF_CL', 'FATES_NET_C_UPTAKE_CLLL', 'FATES_CROWNAREA_CLLL', 'FATES_NPLANT_CANOPY_SZAP', 'FATES_NPLANT_USTORY_SZAP', 'FATES_DDBH_CANOPY_SZAP', 'FATES_DDBH_USTORY_SZAP', From 5e483733fa22b287d006d6b3db9e3ed84a83e8a4 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 1 Apr 2024 10:29:35 -0700 Subject: [PATCH 7/9] fix fates path definition in two stream testmod --- .../testdefs/testmods_dirs/elm/fates_cold_twostream/README | 4 ++++ .../testmods_dirs/elm/fates_cold_twostream/shell_commands | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/README b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/README index 9044e1135474..8211a863c35c 100644 --- a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/README +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/README @@ -13,3 +13,7 @@ that this file will require a custom update for every fates parameter file API u Allowing the HLM to generate the file at runtime via buildnamelist step will provide the capability to build the fates parameter file on the fly which with the appropriate values for this test. + +Note that the test as currently designed is not machine agnostic as it requires +specific shell commands for enabling the workflow to have access to ncgen. Currently +this test is only usable on perlmutter. diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/shell_commands b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/shell_commands index dbf88f570c46..e3f2fa482d66 100644 --- a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/shell_commands +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold_twostream/shell_commands @@ -4,7 +4,7 @@ spack load nco SRCDIR=`./xmlquery SRCROOT --value` CASEDIR=`./xmlquery CASEROOT --value` -FATESDIR=$SRCDIR/src/fates +FATESDIR=$SRCDIR/components/elm/src/external_models/fates FATESPARAMFILE=$CASEDIR/fates_params_twostream.nc ncgen -o $FATESPARAMFILE $FATESDIR/parameter_files/fates_params_default.cdl From 801afeec9a866ac44977176fd2fe779fe4a65c42 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 15 Apr 2024 15:35:56 -0400 Subject: [PATCH 8/9] Update elmfates_interfaceMod.F90 --- components/elm/src/main/elmfates_interfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/elm/src/main/elmfates_interfaceMod.F90 b/components/elm/src/main/elmfates_interfaceMod.F90 index d12704ee1e26..9b9fbc6e3903 100644 --- a/components/elm/src/main/elmfates_interfaceMod.F90 +++ b/components/elm/src/main/elmfates_interfaceMod.F90 @@ -520,7 +520,7 @@ subroutine ELMFatesGlobals2() call set_fates_ctrlparms('num_lu_harvest_cats',ival=pass_num_lu_harvest_types) call set_fates_ctrlparms('use_logging',ival=pass_logging) - if(use_fates_luh) then + if (use_fates_luh) then pass_use_luh = 1 pass_num_luh_states = num_landuse_state_vars pass_num_luh_transitions = num_landuse_transition_vars From 03371d602064cf7a5cc5383b4a4950ce1b60adfe Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 16 Apr 2024 15:47:51 -0700 Subject: [PATCH 9/9] add land grid check to fates_cold test mod --- .../testdefs/testmods_dirs/elm/fates_cold/shell_commands | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold/shell_commands b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold/shell_commands index 5c5dc3a9118a..c2771ff61c4a 100644 --- a/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold/shell_commands +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/fates_cold/shell_commands @@ -1,2 +1,8 @@ ./xmlchange TEST_MEMLEAK_TOLERANCE=0.75 ./xmlchange NTHRDS=1 + +# Change PIO settings as temporary fix for #6316 +if [ `./xmlquery --value LND_GRID` == 1.9x2.5 ]; then + ./xmlchange PIO_NUMTASKS=4 + ./xmlchange PIO_STRIDE=-999 +fi