diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg
index a6fae66356..69d13ca73b 100644
--- a/Externals_CLM.cfg
+++ b/Externals_CLM.cfg
@@ -1,8 +1,8 @@
[fates]
local_path = src/fates
protocol = git
-repo_url = https://github.com/NGEET/fates
-tag = sci.1.71.0_api.33.0.0
+repo_url = https://github.com/rgknox/fates
+tag = sci.1.72.2_api.34.0.0
required = True
[externals_description]
diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm
index 9b0af55452..b4eefd984c 100755
--- a/bld/CLMBuildNamelist.pm
+++ b/bld/CLMBuildNamelist.pm
@@ -784,7 +784,8 @@ sub setup_cmdl_fates_mode {
my @list = ( "fates_spitfire_mode", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys",
"use_fates_cohort_age_tracking","use_fates_inventory_init","use_fates_fixed_biogeog",
"use_fates_nocomp","use_fates_sp","fates_inventory_ctrl_filename","use_fates_logging",
- "fates_parteh_mode","use_fates_tree_damage","fates_seeddisp_cadence","use_fates_luh","fluh_timeseries" );
+ "fates_parteh_mode","use_fates_tree_damage","fates_history_dimlevel","fates_seeddisp_cadence",
+ "use_fates_luh","fluh_timeseries" );
# dis-allow fates specific namelist items with non-fates runs
foreach my $var ( @list ) {
if ( defined($nl->get_value($var)) ) {
@@ -2037,7 +2038,7 @@ sub setup_logic_snicar_methods {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'do_sno_oc' );
# Error checking in loop
- my %supportedSettings = ( 'snicar_solarspec' => "'mid_latitude_winter'", 'snicar_dust_optics' => "'sahara'", 'snicar_numrad_snw' => '5', 'snicar_snobc_intmix' => '.false.', 'snicar_snodst_intmix' => '.false.', 'snicar_use_aerosol' => '.true.', 'do_sno_oc' => '.false.' );
+ my %supportedSettings = ( 'snicar_solarspec' => "'mid_latitude_winter'", 'snicar_dust_optics' => "'sahara'", 'snicar_numrad_snw' => '5', 'snicar_snodst_intmix' => '.false.', 'snicar_use_aerosol' => '.true.', 'do_sno_oc' => '.false.' );
keys %supportedSettings;
while ( my ($key, $val) = each %supportedSettings ) {
my $var = $nl->get_value($key);
@@ -2055,13 +2056,13 @@ sub setup_logic_snicar_methods {
$log->warning("$key1=$val1a and $val1b are supported; $var1 is EXPERIMENTAL, UNSUPPORTED, and UNTESTED!");
}
- # snicar_snobc_intmix and snicar_snodst_intmix cannot both be true
+ # snicar_snobc_intmix and snicar_snodst_intmix cannot both be true, however, they can both be false
my $key1 = 'snicar_snobc_intmix';
my $key2 = 'snicar_snodst_intmix';
my $var1 = $nl->get_value($key1);
my $var2 = $nl->get_value($key2);
- my $val1 = $supportedSettings{$key1}; # supported value for this option
- if (($var1 eq $var2) && ($var1 ne $val1)) {
+ my $val2 = $supportedSettings{$key2}; # supported value for this option
+ if (($var1 eq $var2) && ($var2 ne $val2)) {
$log->warning("$key1 = $var1 and $key2 = $var2 do not work together!");
}
}
@@ -4438,7 +4439,8 @@ sub setup_logic_fates {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'});
my @list = ( "fates_spitfire_mode", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys",
"use_fates_inventory_init","use_fates_fixed_biogeog","use_fates_nocomp","fates_seeddisp_cadence",
- "use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking","use_fates_tree_damage","use_fates_luh" );
+ "use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking","use_fates_tree_damage",
+ "use_fates_luh","fates_history_dimlevel" );
foreach my $var ( @list ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_fates'=>$nl_flags->{'use_fates'},
'use_fates_sp'=>$nl_flags->{'use_fates_sp'} );
diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml
index 3ef6615b73..5c86d230fd 100644
--- a/bld/namelist_files/namelist_defaults_ctsm.xml
+++ b/bld/namelist_files/namelist_defaults_ctsm.xml
@@ -441,7 +441,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
1.e9
SwensonLawrence2012
+
Jordan1991
+Sturm1997
-lnd/clm2/paramdata/ctsm51_params.c240207b.nc
-lnd/clm2/paramdata/clm50_params.c240207b.nc
-lnd/clm2/paramdata/clm45_params.c240207b.nc
+lnd/clm2/paramdata/ctsm51_params.c240208.nc
+lnd/clm2/paramdata/clm50_params.c240208.nc
+lnd/clm2/paramdata/clm45_params.c240208.nc
@@ -1637,7 +1639,8 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1
mid_latitude_winter
sahara
.false.
-.false.
+.false.
+.true.
.true.
.false.
@@ -2783,7 +2786,7 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1
.false.
1
0
-
+2,2
.true.
.false.
.true.
diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml
index 0469af2344..8b292294c9 100644
--- a/bld/namelist_files/namelist_definition_ctsm.xml
+++ b/bld/namelist_files/namelist_definition_ctsm.xml
@@ -777,6 +777,19 @@ Full pathname to the inventory initialization control file.
(Only relevant if FATES is on).
+
+ Setting for what types of FATES history to be allocate and
+ calculated at the dynamics timestep (1st integer) and the
+ model timestep (2nd integer). This must be consistent with
+ hist_fincl*, ie output variables must not be listed if the
+ output level is not enabled.
+ 0 = no fates history variables are calculated or allocated
+ 1 = only time x space (3d) fates history variables allowed
+ 2 = multiplexed dimensioned fates history is also allowed
+ (Only relevant if FATES is on)
+
+
diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm
index 7f5ece27c8..a426c775b0 100644
--- a/cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm
+++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm
@@ -3,75 +3,57 @@ hist_mfilt = 365
hist_nhtfrq = -24
hist_empty_htapes = .false.
fates_spitfire_mode = 1
+fates_history_dimlevel = 2,2
+use_fates_tree_damage = .true.
hist_ndens = 1
-hist_fincl1 = 'FATES_CROWNAREA_PF', 'FATES_CANOPYCROWNAREA_PF',
-'FATES_NCL_AP', 'FATES_NPATCH_AP', 'FATES_VEGC_AP',
-'FATES_SECONDARY_FOREST_FRACTION', 'FATES_WOOD_PRODUCT',
-'FATES_SECONDARY_FOREST_VEGC', 'FATES_SECONDAREA_ANTHRODIST_AP',
-'FATES_SECONDAREA_DIST_AP', 'FATES_STOMATAL_COND_AP', 'FATES_LBLAYER_COND_AP',
-'FATES_NPP_AP', 'FATES_GPP_AP', 'FATES_PARSUN_Z_CLLL', 'FATES_PARSHA_Z_CLLL',
-'FATES_PARSUN_Z_CLLLPF', 'FATES_PARSHA_Z_CLLLPF', 'FATES_PARSUN_Z_CL',
-'FATES_PARSHA_Z_CL', 'FATES_LAISUN_Z_CLLL', 'FATES_LAISHA_Z_CLLL',
-'FATES_LAISUN_Z_CLLLPF', 'FATES_LAISHA_Z_CLLLPF', 'FATES_LAISUN_TOP_CL',
-'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_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',
-'FATES_MORTALITY_CANOPY_SZAP', 'FATES_MORTALITY_USTORY_SZAP',
-'FATES_NPLANT_SZAPPF', 'FATES_NPP_APPF', 'FATES_VEGC_APPF', 'FATES_GPP_SZPF',
-'FATES_GPP_CANOPY_SZPF', 'FATES_AUTORESP_CANOPY_SZPF', 'FATES_GPP_USTORY_SZPF',
-'FATES_AUTORESP_USTORY_SZPF', 'FATES_NPP_SZPF', 'FATES_LEAF_ALLOC_SZPF',
-'FATES_SEED_ALLOC_SZPF', 'FATES_FROOT_ALLOC_SZPF', 'FATES_BGSAPWOOD_ALLOC_SZPF',
-'FATES_BGSTRUCT_ALLOC_SZPF', 'FATES_AGSAPWOOD_ALLOC_SZPF',
-'FATES_AGSTRUCT_ALLOC_SZPF', 'FATES_STORE_ALLOC_SZPF', 'FATES_DDBH_SZPF',
-'FATES_GROWTHFLUX_SZPF', 'FATES_GROWTHFLUX_FUSION_SZPF',
-'FATES_DDBH_CANOPY_SZPF', 'FATES_DDBH_USTORY_SZPF', 'FATES_BASALAREA_SZPF',
-'FATES_VEGC_ABOVEGROUND_SZPF', 'FATES_NPLANT_SZPF', 'FATES_NPLANT_ACPF',
-'FATES_MORTALITY_BACKGROUND_SZPF', 'FATES_MORTALITY_HYDRAULIC_SZPF',
-'FATES_MORTALITY_CSTARV_SZPF', 'FATES_MORTALITY_IMPACT_SZPF',
-'FATES_MORTALITY_FIRE_SZPF', 'FATES_MORTALITY_CROWNSCORCH_SZPF',
-'FATES_MORTALITY_CAMBIALBURN_SZPF', 'FATES_MORTALITY_TERMINATION_SZPF',
-'FATES_MORTALITY_LOGGING_SZPF', 'FATES_MORTALITY_FREEZING_SZPF',
-'FATES_MORTALITY_SENESCENCE_SZPF', 'FATES_MORTALITY_AGESCEN_SZPF',
-'FATES_MORTALITY_AGESCEN_ACPF', 'FATES_MORTALITY_CANOPY_SZPF',
-'FATES_STOREC_CANOPY_SZPF', 'FATES_LEAFC_CANOPY_SZPF',
-'FATES_NPLANT_CANOPY_SZPF', 'FATES_MORTALITY_USTORY_SZPF',
-'FATES_STOREC_USTORY_SZPF', 'FATES_LEAFC_USTORY_SZPF',
-'FATES_NPLANT_USTORY_SZPF', 'FATES_CWD_ABOVEGROUND_DC',
-'FATES_CWD_BELOWGROUND_DC', 'FATES_CWD_ABOVEGROUND_IN_DC',
-'FATES_CWD_BELOWGROUND_IN_DC', 'FATES_CWD_ABOVEGROUND_OUT_DC',
-'FATES_CWD_BELOWGROUND_OUT_DC', 'FATES_AUTORESP_SZPF', 'FATES_GROWAR_SZPF',
-'FATES_MAINTAR_SZPF', 'FATES_RDARK_SZPF', 'FATES_AGSAPMAINTAR_SZPF',
-'FATES_BGSAPMAINTAR_SZPF', 'FATES_FROOTMAINTAR_SZPF',
-'FATES_YESTCANLEV_CANOPY_SZ', 'FATES_YESTCANLEV_USTORY_SZ',
-'FATES_VEGC_SZ', 'FATES_DEMOTION_RATE_SZ', 'FATES_PROMOTION_RATE_SZ',
-'FATES_SAI_CANOPY_SZ', 'FATES_SAI_USTORY_SZ', 'FATES_NPP_CANOPY_SZ',
-'FATES_NPP_USTORY_SZ', 'FATES_TRIMMING_CANOPY_SZ', 'FATES_TRIMMING_USTORY_SZ',
-'FATES_CROWNAREA_CANOPY_SZ', 'FATES_CROWNAREA_USTORY_SZ',
-'FATES_LEAFCTURN_CANOPY_SZ', 'FATES_FROOTCTURN_CANOPY_SZ',
-'FATES_STORECTURN_CANOPY_SZ', 'FATES_STRUCTCTURN_CANOPY_SZ',
-'FATES_SAPWOODCTURN_CANOPY_SZ', 'FATES_SEED_PROD_CANOPY_SZ',
-'FATES_LEAF_ALLOC_CANOPY_SZ', 'FATES_FROOT_ALLOC_CANOPY_SZ',
-'FATES_SAPWOOD_ALLOC_CANOPY_SZ', 'FATES_STRUCT_ALLOC_CANOPY_SZ',
-'FATES_SEED_ALLOC_CANOPY_SZ', 'FATES_STORE_ALLOC_CANOPY_SZ',
-'FATES_RDARK_CANOPY_SZ', 'FATES_LSTEMMAINTAR_CANOPY_SZ',
-'FATES_CROOTMAINTAR_CANOPY_SZ', 'FATES_FROOTMAINTAR_CANOPY_SZ',
-'FATES_GROWAR_CANOPY_SZ', 'FATES_MAINTAR_CANOPY_SZ',
-'FATES_LEAFCTURN_USTORY_SZ', 'FATES_FROOTCTURN_USTORY_SZ',
-'FATES_STORECTURN_USTORY_SZ', 'FATES_STRUCTCTURN_USTORY_SZ',
-'FATES_SAPWOODCTURN_USTORY_SZ', 'FATES_SEED_PROD_USTORY_SZ',
-'FATES_LEAF_ALLOC_USTORY_SZ', 'FATES_FROOT_ALLOC_USTORY_SZ',
-'FATES_SAPWOOD_ALLOC_USTORY_SZ', 'FATES_STRUCT_ALLOC_USTORY_SZ',
-'FATES_SEED_ALLOC_USTORY_SZ', 'FATES_STORE_ALLOC_USTORY_SZ',
-'FATES_RDARK_USTORY_SZ', 'FATES_LSTEMMAINTAR_USTORY_SZ',
-'FATES_CROOTMAINTAR_USTORY_SZ', 'FATES_FROOTMAINTAR_USTORY_SZ',
-'FATES_GROWAR_USTORY_SZ', 'FATES_MAINTAR_USTORY_SZ', 'FATES_VEGC_SZPF',
-'FATES_LEAFC_SZPF', 'FATES_FROOTC_SZPF', 'FATES_SAPWOODC_SZPF',
-'FATES_STOREC_SZPF', 'FATES_REPROC_SZPF', 'FATES_DROUGHT_STATUS_PF',
-'FATES_DAYSINCE_DROUGHTLEAFOFF_PF', 'FATES_DAYSINCE_DROUGHTLEAFON_PF',
-'FATES_MEANLIQVOL_DROUGHTPHEN_PF', 'FATES_MEANSMP_DROUGHTPHEN_PF',
-'FATES_ELONG_FACTOR_PF'
+hist_fincl1 = 'FATES_TLONGTERM',
+'FATES_TGROWTH','FATES_SEEDS_IN_GRIDCELL_PF','FATES_SEEDS_OUT_GRIDCELL_PF','FATES_NCL_AP',
+'FATES_NPATCH_AP','FATES_VEGC_AP','FATES_SECONDAREA_ANTHRODIST_AP','FATES_SECONDAREA_DIST_AP',
+'FATES_FUEL_AMOUNT_APFC','FATES_STOREC_TF_USTORY_SZPF','FATES_STOREC_TF_CANOPY_SZPF',
+'FATES_CROWNAREA_CLLL','FATES_ABOVEGROUND_MORT_SZPF',
+'FATES_ABOVEGROUND_PROD_SZPF','FATES_NPLANT_SZAP','FATES_NPLANT_CANOPY_SZAP',
+'FATES_NPLANT_USTORY_SZAP','FATES_DDBH_CANOPY_SZAP','FATES_DDBH_USTORY_SZAP',
+'FATES_MORTALITY_CANOPY_SZAP','FATES_MORTALITY_USTORY_SZAP','FATES_NPLANT_SZAPPF',
+'FATES_NPP_APPF','FATES_VEGC_APPF','FATES_SCORCH_HEIGHT_APPF','FATES_GPP_SZPF',
+'FATES_GPP_CANOPY_SZPF','FATES_AUTORESP_CANOPY_SZPF','FATES_GPP_USTORY_SZPF',
+'FATES_AUTORESP_USTORY_SZPF','FATES_NPP_SZPF','FATES_LEAF_ALLOC_SZPF',
+'FATES_SEED_ALLOC_SZPF','FATES_FROOT_ALLOC_SZPF','FATES_BGSAPWOOD_ALLOC_SZPF',
+'FATES_BGSTRUCT_ALLOC_SZPF','FATES_AGSAPWOOD_ALLOC_SZPF','FATES_AGSTRUCT_ALLOC_SZPF',
+'FATES_STORE_ALLOC_SZPF','FATES_DDBH_SZPF','FATES_GROWTHFLUX_SZPF','FATES_GROWTHFLUX_FUSION_SZPF',
+'FATES_DDBH_CANOPY_SZPF','FATES_DDBH_USTORY_SZPF','FATES_BASALAREA_SZPF','FATES_VEGC_ABOVEGROUND_SZPF',
+'FATES_NPLANT_SZPF','FATES_NPLANT_ACPF','FATES_MORTALITY_BACKGROUND_SZPF','FATES_MORTALITY_HYDRAULIC_SZPF',
+'FATES_MORTALITY_CSTARV_SZPF','FATES_MORTALITY_IMPACT_SZPF','FATES_MORTALITY_FIRE_SZPF',
+'FATES_MORTALITY_CROWNSCORCH_SZPF','FATES_MORTALITY_CAMBIALBURN_SZPF','FATES_MORTALITY_TERMINATION_SZPF',
+'FATES_MORTALITY_LOGGING_SZPF','FATES_MORTALITY_FREEZING_SZPF','FATES_MORTALITY_SENESCENCE_SZPF',
+'FATES_MORTALITY_AGESCEN_SZPF','FATES_MORTALITY_AGESCEN_ACPF','FATES_MORTALITY_CANOPY_SZPF',
+'FATES_M3_MORTALITY_CANOPY_SZPF','FATES_M3_MORTALITY_USTORY_SZPF','FATES_C13DISC_SZPF',
+'FATES_STOREC_CANOPY_SZPF','FATES_LEAFC_CANOPY_SZPF','FATES_LAI_CANOPY_SZPF','FATES_CROWNAREA_CANOPY_SZPF',
+'FATES_CROWNAREA_USTORY_SZPF','FATES_NPLANT_CANOPY_SZPF','FATES_MORTALITY_USTORY_SZPF','FATES_STOREC_USTORY_SZPF',
+'FATES_LEAFC_USTORY_SZPF','FATES_LAI_USTORY_SZPF','FATES_NPLANT_USTORY_SZPF','FATES_CWD_ABOVEGROUND_DC',
+'FATES_CWD_BELOWGROUND_DC','FATES_CWD_ABOVEGROUND_IN_DC','FATES_CWD_BELOWGROUND_IN_DC',
+'FATES_CWD_ABOVEGROUND_OUT_DC','FATES_CWD_BELOWGROUND_OUT_DC','FATES_YESTCANLEV_CANOPY_SZ',
+'FATES_YESTCANLEV_USTORY_SZ','FATES_VEGC_SZ','FATES_DEMOTION_RATE_SZ','FATES_PROMOTION_RATE_SZ',
+'FATES_SAI_CANOPY_SZ','FATES_M3_MORTALITY_CANOPY_SZ','FATES_M3_MORTALITY_USTORY_SZ','FATES_SAI_USTORY_SZ',
+'FATES_NPP_CANOPY_SZ','FATES_NPP_USTORY_SZ','FATES_TRIMMING_CANOPY_SZ','FATES_TRIMMING_USTORY_SZ',
+'FATES_CROWNAREA_CANOPY_SZ','FATES_CROWNAREA_USTORY_SZ','FATES_LEAFCTURN_CANOPY_SZ','FATES_FROOTCTURN_CANOPY_SZ',
+'FATES_STORECTURN_CANOPY_SZ','FATES_STRUCTCTURN_CANOPY_SZ','FATES_SAPWOODCTURN_CANOPY_SZ','FATES_SEED_PROD_CANOPY_SZ',
+'FATES_LEAF_ALLOC_CANOPY_SZ','FATES_FROOT_ALLOC_CANOPY_SZ','FATES_SAPWOOD_ALLOC_CANOPY_SZ','FATES_STRUCT_ALLOC_CANOPY_SZ',
+'FATES_SEED_ALLOC_CANOPY_SZ','FATES_STORE_ALLOC_CANOPY_SZ','FATES_LEAFCTURN_USTORY_SZ','FATES_FROOTCTURN_USTORY_SZ',
+'FATES_STORECTURN_USTORY_SZ','FATES_STRUCTCTURN_USTORY_SZ','FATES_SAPWOODCTURN_USTORY_SZ',
+'FATES_SEED_PROD_USTORY_SZ','FATES_LEAF_ALLOC_USTORY_SZ','FATES_FROOT_ALLOC_USTORY_SZ','FATES_SAPWOOD_ALLOC_USTORY_SZ',
+'FATES_STRUCT_ALLOC_USTORY_SZ','FATES_SEED_ALLOC_USTORY_SZ','FATES_STORE_ALLOC_USTORY_SZ','FATES_CROWNAREA_CANOPY_CD',
+'FATES_CROWNAREA_USTORY_CD','FATES_NPLANT_CDPF','FATES_NPLANT_CANOPY_CDPF','FATES_NPLANT_USTORY_CDPF',
+'FATES_M3_CDPF','FATES_M11_SZPF','FATES_M11_CDPF','FATES_MORTALITY_CDPF','FATES_M3_MORTALITY_CANOPY_CDPF',
+'FATES_M3_MORTALITY_USTORY_CDPF','FATES_M11_MORTALITY_CANOPY_CDPF','FATES_M11_MORTALITY_USTORY_CDPF',
+'FATES_MORTALITY_CANOPY_CDPF','FATES_MORTALITY_USTORY_CDPF','FATES_DDBH_CDPF','FATES_DDBH_CANOPY_CDPF',
+'FATES_DDBH_USTORY_CDPF','FATES_VEGC_SZPF','FATES_LEAFC_SZPF','FATES_FROOTC_SZPF','FATES_SAPWOODC_SZPF',
+'FATES_STOREC_SZPF','FATES_REPROC_SZPF','FATES_NPP_AP','FATES_GPP_AP','FATES_RDARK_USTORY_SZ',
+'FATES_LSTEMMAINTAR_USTORY_SZ','FATES_CROOTMAINTAR_USTORY_SZ','FATES_FROOTMAINTAR_USTORY_SZ','FATES_GROWAR_USTORY_SZ',
+'FATES_MAINTAR_USTORY_SZ','FATES_RDARK_CANOPY_SZ','FATES_CROOTMAINTAR_CANOPY_SZ','FATES_FROOTMAINTAR_CANOPY_SZ',
+'FATES_GROWAR_CANOPY_SZ','FATES_MAINTAR_CANOPY_SZ','FATES_LSTEMMAINTAR_CANOPY_SZ','FATES_AUTORESP_SZPF',
+'FATES_GROWAR_SZPF','FATES_MAINTAR_SZPF','FATES_RDARK_SZPF','FATES_AGSAPMAINTAR_SZPF','FATES_BGSAPMAINTAR_SZPF',
+'FATES_FROOTMAINTAR_SZPF','FATES_PARSUN_CLLL','FATES_PARSHA_CLLL','FATES_PARSUN_CLLLPF','FATES_PARSHA_CLLLPF',
+'FATES_PARSUN_CL','FATES_PARSHA_CL','FATES_LAISUN_CLLL','FATES_LAISHA_CLLL','FATES_LAISUN_CLLLPF',
+'FATES_LAISHA_CLLLPF','FATES_PARPROF_DIR_CLLLPF','FATES_PARPROF_DIF_CLLLPF','FATES_LAISUN_CL','FATES_LAISHA_CL',
+'FATES_PARPROF_DIR_CLLL','FATES_PARPROF_DIF_CLLL','FATES_NET_C_UPTAKE_CLLL','FATES_CROWNFRAC_CLLLPF',
+'FATES_LBLAYER_COND_AP','FATES_STOMATAL_COND_AP'
diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_cwd_hr/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/ciso_cwd_hr/user_nl_clm
index c235d72df1..3c686f08b9 100644
--- a/cime_config/testdefs/testmods_dirs/clm/ciso_cwd_hr/user_nl_clm
+++ b/cime_config/testdefs/testmods_dirs/clm/ciso_cwd_hr/user_nl_clm
@@ -1,2 +1,2 @@
-paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/ctsm51_ciso_cwd_hr_params.c240207b.nc'
+paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/ctsm51_ciso_cwd_hr_params.c240208.nc'
hist_fincl1 = 'CWDC_HR','C13_CWDC_HR','C14_CWDC_HR','CWD_HR_L2','CWD_HR_L2_vr','CWD_HR_L3','CWD_HR_L3_vr'
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 9ef124937f..f822c5a72e 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,4 +1,227 @@
===============================================================
+Tag name: ctsm5.1.dev175
+Originator(s): slevis (Samuel Levis,UCAR/TSS,303-665-1310)
+Date: Thu 21 Mar 2024 05:49:04 PM MDT
+One-line Summary: merge-b4bdev-20240321
+
+Purpose and description of changes
+----------------------------------
+
+Merge master 20240313 #2421 (Update of externals to what's expected in cesm2_3_beta17)
+Fix for cray compiler format issue #2391
+Remove LILAC references to mct #2374
+Refactoring of neon_site into tower_site and neon_site #2363
+Fix misplaced stopf in CNDriverMod.F90 #2358
+Update some PE layouts on Derecho #2429
+
+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.]
+
+[ ] clm5_1
+
+[ ] clm5_0
+
+[ ] ctsm5_0-nwp
+
+[ ] clm4_5
+
+
+Bugs fixed
+----------
+CTSM issues fixed (include CTSM Issue #):
+ Listed in Purpose and Description above
+
+Testing summary:
+----------------
+
+ [PASS means all tests PASS; OK means tests PASS other than expected fails.]
+
+ regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing):
+
+ derecho ----- OK
+ izumi ------- OK
+
+Answer changes
+--------------
+Changes answers relative to baseline: NO
+
+Other details
+-------------
+List any externals directories updated (cime, rtm, mosart, cism, fates, etc.):
+ See #2421 for update of externals to what's expected in cesm2_3_beta17
+
+Pull Requests that document the changes (include PR ids):
+ https://github.com/ESCOMP/ctsm/pull/2431
+
+===============================================================
+===============================================================
+Tag name: ctsm5.1.dev174
+Originator(s): olyson (Keith Oleson,UCAR/TSS)
+Date: Thu 14 Mar 2024 04:56:37 PM MDT
+One-line Summary: Improve vegetation health at high latitudes
+
+Purpose and description of changes
+----------------------------------
+
+The corresponding changes:
+
+Remove snicar_snobc_intmix from EXPERIMENTAL endrun (allow it to be true)
+Remove flg_snoage_scl in SNICAR such that xdrdt can have an effect (fixes #2298 )
+New parameter file and namelist values for clm5_1:
+
+- snow_thermal_cond_method = Sturm1997 (default for clm5_1)
+- snicar_snobc_intmix = .true. (default for clm5_1)
+- ctsm51_params.c240208.nc is the new CTSM parameter file (changes: froot_leaf(11:12)=1.2, FUN_fracfixers(11:12)=1, xdrdt=5, scvng_fct_mlt_sf=0.5, snw_rds_refrz=1500, fresh_snw_rds_max=400)
+- New history fields for coupler history verification (default off)
+- Add snow5d_thresh_for_onset to parameter file, set to 0.2 for clm51 and 0.1 (unchanged) for clm50 and clm45.
+
+
+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.]
+
+[X] clm5_1
+
+[ ] clm5_0
+
+[ ] ctsm5_0-nwp
+
+[ ] clm4_5
+
+
+Bugs fixed
+----------
+CTSM issues fixed (include CTSM Issue #):
+Fixes #2298
+Fixes LMWG_dev discussion #3
+
+New bug discovered or introduced:
+Relevant post appears in #2348 on 2024/3/14
+
+Notes of particular relevance for users
+---------------------------------------
+Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables):
+ New namelist defaults including new parameter files:
+ ctsm51_params.c240208.nc
+ clm50_params.c240208.nc
+ clm45_params.c240208.nc
+ ctsm51_ciso_cwd_hr_params.c240208.nc
+
+
+Testing summary:
+----------------
+
+ [PASS means all tests PASS; OK means tests PASS other than expected fails.]
+
+ regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing):
+
+ derecho ----- OK
+ izumi ------- OK
+
+ any other testing (give details below):
+ Keith Oleson replicated simulation in LMWG_dev issue #51 as bfb when
+ snow5d_thresh_for_onset on ctsm51_ciso_cwd_hr_params.c240208.nc was set
+ to original value of 0.1.
+
+Answer changes
+--------------
+
+Changes answers relative to baseline: YES
+
+ Summarize any changes to answers, i.e.,
+ - what code configurations: clm51
+ - what platforms/compilers: all
+ - nature of change: new climate at high latitudes
+
+ See LMWG_dev discussion #3 and simulations discussed therein,
+ including (though possibly not limited to) LMWG_dev issues #51, 52, 54, 57.
+
+ slevis will add this tag with the label "SIGNIFICANT" to the
+ Answer-changing-tags wiki:
+ https://github.com/ESCOMP/CTSM/wiki/Answer-changing-tags
+
+Other details
+-------------
+Pull Requests that document the changes (include PR ids):
+ https://github.com/ESCOMP/ctsm/pull/2348
+
+===============================================================
+===============================================================
+Tag name: ctsm5.1.dev173
+Originator(s): rgknox (Ryan Knox,LAWRENCE BERKELEY NATIONAL LABORATORY)
+Date: Wed 13 Mar 2024 04:46:37 PM MDT
+One-line Summary: New FATES namelist variable, fates_history_dimlevel
+
+Purpose and description of changes
+----------------------------------
+This set of changes introduces a new namelist setting that allows more control over fates history diagnostics. This setting, fates_history_dimlevel accepts two integers, comma-delimited, from 0-2. The first specifies the history output dimension level for high-frequency output (ie model timestep) and the second is for output at the dynamics timestep. A value of 0 indicates no history variables should be processed. A value of 1 indicates that only site-level mean values should be processed. A value of 2 indicates that all variables, including those that use an extra dimension should be processed. This is different from adding and excluding history variable names from the namelist, in that these settings not only omit variables from the output file, but they prevent their allocations and calculations all together. Processing history diagnostics in FATES takes a non-trivial amount of time.
+
+
+Significant changes to scientifically-supported configurations
+--------------------------------------------------------------
+
+These changes have no non-trivial impacts on any scientific configurations, this is a refactor.
+
+Bugs fixed
+----------
+
+No bugs fixed, feature addition only.
+
+Notes of particular relevance for users
+---------------------------------------
+
+Users should be aware of the new namelist setting fates_history_dimlevel. Omitting this setting will default to a level of "2" which enables all output and should maintain existing model behavior.
+
+Substantial timing or memory changes: The FATES model is somewhere on the order of 10% faster for level 0 and 1, versus 2, for large gridded runs with non satellite phenology, on derecho.
+
+
+Notes of particular relevance for developers:
+---------------------------------------------
+
+None of note.
+
+
+Testing summary:
+----------------
+
+ build-namelist tests (if CLMBuildNamelist.pm has changed):
+
+ derecho - OK (64 fates tests differ)
+
+ python testing (if python code has changed; see instructions in python/README.md; document testing done):
+
+ derecho - PASS
+
+ regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing):
+
+ derecho ----- OK
+ izumi ------- OK
+
+ fates tests: (give name of baseline if different from CTSM tagname, normally fates baselines are fates--)
+ derecho ----- OK
+ izumi ------- OK
+
+
+If the tag used for baseline comparisons was NOT the previous tag, note that here: (used ctsm5.1.dev172)
+
+
+Answer changes
+--------------
+
+Answer changes for FATES tests were detected. All diffs were small enough to be consistent with order of operations changes, with the exception of some variables that were updated to have ignore values used for non-vegetated patches instead of zero.
+
+
+===============================================================
+===============================================================
Tag name: ctsm5.1.dev172
Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326)
Date: Tue 12 Mar 2024 11:59:48 PM MDT
diff --git a/doc/ChangeSum b/doc/ChangeSum
index c9cf2183f4..e8c32d90a8 100644
--- a/doc/ChangeSum
+++ b/doc/ChangeSum
@@ -1,7 +1,10 @@
Tag Who Date Summary
============================================================================================================================
+ ctsm5.1.dev175 slevis 03/21/2024 merge-b4bdev-20240321
+ ctsm5.1.dev174 olyson 03/14/2024 Improve vegetation health at high latitudes
+ ctsm5.1.dev173 rgknox 03/13/2024 New FATES namelist variable: fates_history_dimlevel
ctsm5.1.dev172 erik 03/12/2024 Merge b4b-dev
- ctsm5.1.dev171 slevis 03/01/2024 Set initial t_soisno=272 for soils and 274K for urban road
+ ctsm5.1.dev171 olyson 03/01/2024 Set initial t_soisno=272 for soils and 274K for urban road
ctsm5.1.dev170 samrabin 02/28/2024 Add hillslope hydrology
ctsm5.1.dev169 samrabin 02/22/2024 Merge b4b-dev
ctsm5.1.dev168 slevis 02/16/2024 Remove a source of negative snocan in CanopyFluxesMod
diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90
index 05041527a7..fffb19bc46 100644
--- a/src/biogeochem/CNPhenologyMod.F90
+++ b/src/biogeochem/CNPhenologyMod.F90
@@ -97,6 +97,7 @@ module CNPhenologyMod
real(r8) :: soilpsi_off ! critical soil water potential for leaf offset
real(r8) :: lwtop ! live wood turnover proportion (annual fraction)
real(r8) :: phenology_soil_depth ! soil depth used for measuring states for phenology triggers
+ real(r8) :: snow5d_thresh_for_onset ! 5-day snow depth threshold for leaf onset
end type params_type
type(params_type) :: params_inst
@@ -280,6 +281,7 @@ subroutine CNPhenologySetParams( )
params_inst%soilpsi_off = -0.8 ! MPa
params_inst%lwtop = 0.7_r8 ! Fraction
params_inst%phenology_soil_depth = 0.08_r8 ! m
+ params_inst%snow5d_thresh_for_onset = 0.2_r8 ! m
end subroutine CNPhenologySetParams
!-----------------------------------------------------------------------
@@ -313,6 +315,7 @@ subroutine readParams ( ncid )
call readNcdioScalar(ncid, 'soilpsi_off', subname, params_inst%soilpsi_off)
call readNcdioScalar(ncid, 'lwtop_ann', subname, params_inst%lwtop)
call readNcdioScalar(ncid, 'phenology_soil_depth', subname, params_inst%phenology_soil_depth)
+ call readNcdioScalar(ncid, 'snow5d_thresh_for_onset', subname, params_inst%snow5d_thresh_for_onset)
end subroutine readParams
@@ -1136,7 +1139,6 @@ function SeasonalDecidOnset( onset_gdd, onset_gddflag, soilt, soila10, t_a5min,
logical :: do_onset ! Flag if onset should happen (return value)
!
! !LOCAL VARIABLES:
- real(r8), parameter :: snow5d_thresh_for_onset = 0.1_r8 ! 5-day snow depth threshold for leaf onset
real(r8), parameter :: min_critical_daylength_onset = 39300._r8/2._r8 ! Minimum daylength for onset to happen
! NOTE above: The 39300/2(19650) value is what we've
! tested with, we are concerned that changing
@@ -1192,7 +1194,8 @@ function SeasonalDecidOnset( onset_gdd, onset_gddflag, soilt, soila10, t_a5min,
else if (season_decid_temperate == 0 .and. onset_gddflag == 1.0_r8 .and. &
soila10 > SHR_CONST_TKFRZ .and. &
t_a5min > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. &
- dayl>min_critical_daylength_onset .and. snow_5daymin_critical_daylength_onset .and. &
+ snow_5day this%forc_aer_grc(begg:endg,1)
+ call hist_addfld1d (fname='BCPHIDRY', units='kg/m^2/s', &
+ avgflag='A', long_name='black carbon deposition (phidry) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,2)
+ call hist_addfld1d (fname='BCPHODRY', units='kg/m^2/s', &
+ avgflag='A', long_name='black carbon deposition (phodry) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,3)
+ call hist_addfld1d (fname='BCPHIWET', units='kg/m^2/s', &
+ avgflag='A', long_name='black carbon deposition (phiwet) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,4)
+ call hist_addfld1d (fname='OCPHIDRY', units='kg/m^2/s', &
+ avgflag='A', long_name='organic carbon deposition (phidry) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,5)
+ call hist_addfld1d (fname='OCPHODRY', units='kg/m^2/s', &
+ avgflag='A', long_name='black carbon deposition (phodry) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,6)
+ call hist_addfld1d (fname='OCPHIWET', units='kg/m^2/s', &
+ avgflag='A', long_name='organic carbon deposition (phiwet) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,7)
+ call hist_addfld1d (fname='DSTWET1', units='kg/m^2/s', &
+ avgflag='A', long_name='dust deposition (wet1) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,8)
+ call hist_addfld1d (fname='DSTDRY1', units='kg/m^2/s', &
+ avgflag='A', long_name='dust deposition (dry1) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,9)
+ call hist_addfld1d (fname='DSTWET2', units='kg/m^2/s', &
+ avgflag='A', long_name='dust deposition (wet2) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,10)
+ call hist_addfld1d (fname='DSTDRY2', units='kg/m^2/s', &
+ avgflag='A', long_name='dust deposition (dry2) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,11)
+ call hist_addfld1d (fname='DSTWET3', units='kg/m^2/s', &
+ avgflag='A', long_name='dust deposition (wet3) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,12)
+ call hist_addfld1d (fname='DSTDRY3', units='kg/m^2/s', &
+ avgflag='A', long_name='dust deposition (dry3) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,13)
+ call hist_addfld1d (fname='DSTWET4', units='kg/m^2/s', &
+ avgflag='A', long_name='dust deposition (wet4) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
+ data1dptr => this%forc_aer_grc(begg:endg,14)
+ call hist_addfld1d (fname='DSTDRY4', units='kg/m^2/s', &
+ avgflag='A', long_name='dust deposition (dry4) from atmosphere', &
+ ptr_gcell=data1dptr, default = 'inactive')
+
! Time averaged quantities
this%fsi24_patch(begp:endp) = spval
call hist_addfld1d (fname='FSI24', units='K', &
diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90
index bdcb653b64..267c425d7d 100644
--- a/src/main/clm_varctl.F90
+++ b/src/main/clm_varctl.F90
@@ -319,6 +319,20 @@ module clm_varctl
logical, public :: use_fates_inventory_init = .false. ! true => initialize fates from inventory
logical, public :: use_fates_fixed_biogeog = .false. ! true => use fixed biogeography mode
logical, public :: use_fates_nocomp = .false. ! true => use no comopetition mode
+
+ ! FATES history dimension level
+ ! fates can produce history at either the daily timescale (dynamics)
+ ! and the model step timescale. It can also generate output on the extra dimension
+ ! Performing this output can be expensive, so we allow different history dimension
+ ! levels.
+ ! The first index is output at the model timescale
+ ! The second index is output at the dynamics (daily) timescale
+ ! 0 - no output
+ ! 1 - include only column level means (3D)
+ ! 2 - include output that includes the 4th dimension
+
+ integer, dimension(2), public :: fates_history_dimlevel = (/2,2/)
+
logical, public :: use_fates_luh = .false. ! true => use FATES landuse data mode
character(len=256), public :: fluh_timeseries = '' ! filename for fates landuse timeseries data
character(len=256), public :: fates_inventory_ctrl_filename = '' ! filename for inventory control
diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90
index eaa7c5c1e4..a5da9c3082 100644
--- a/src/main/controlMod.F90
+++ b/src/main/controlMod.F90
@@ -235,7 +235,8 @@ subroutine control_init(dtime)
fates_inventory_ctrl_filename, &
fates_parteh_mode, &
fates_seeddisp_cadence, &
- use_fates_tree_damage
+ use_fates_tree_damage, &
+ fates_history_dimlevel
! Ozone vegetation stress method
namelist / clm_inparm / o3_veg_stress_method
@@ -495,7 +496,7 @@ subroutine control_init(dtime)
call endrun(msg=' ERROR: C13 and C14 dynamics are not compatible with FATES.'//&
errMsg(sourcefile, __LINE__))
end if
-
+
else
! These do default to false anyway, but this emphasizes they
@@ -636,7 +637,7 @@ subroutine control_init(dtime)
snicar_solarspec /= 'mid_latitude_winter' .or. &
snicar_dust_optics /= 'sahara' .or. &
snicar_numrad_snw /= 5 .or. &
- snicar_snobc_intmix .or. snicar_snodst_intmix .or. &
+ snicar_snodst_intmix .or. &
.not. snicar_use_aerosol .or. &
do_sno_oc) then
call endrun(msg=' ERROR: You have selected an option that is EXPERIMENTAL, UNSUPPORTED, and UNTESTED. For guidance see namelist_defaults_ctsm.xml'//&
@@ -797,6 +798,7 @@ subroutine control_spmd()
call mpi_bcast (fluh_timeseries, len(fluh_timeseries) , MPI_CHARACTER, 0, mpicom, ier)
call mpi_bcast (fates_parteh_mode, 1, MPI_INTEGER, 0, mpicom, ier)
call mpi_bcast (fates_seeddisp_cadence, 1, MPI_INTEGER, 0, mpicom, ier)
+ call mpi_bcast (fates_history_dimlevel, 2, MPI_INTEGER, 0, mpicom, ier)
! flexibleCN nitrogen model
call mpi_bcast (use_flexibleCN, 1, MPI_LOGICAL, 0, mpicom, ier)
diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90
index d419f97630..863bf6e987 100644
--- a/src/main/histFileMod.F90
+++ b/src/main/histFileMod.F90
@@ -180,7 +180,7 @@ module histFileMod
private :: hist_set_snow_field_2d ! Set values in history field dimensioned by levsno
private :: list_index ! Find index of field in exclude list
private :: set_hist_filename ! Determine history dataset filenames
- private :: getname ! Retrieve name portion of input "inname"
+ public :: getname ! Retrieve name portion of input "inname" (PUBLIC FOR FATES)
private :: getflag ! Retrieve flag
private :: next_history_pointer_index ! Latest index into raw history data (clmptr_r*) arrays
private :: max_nFields ! The max number of fields on any tape
diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90
index da167d9266..fcd5cb5230 100644
--- a/src/utils/clmfates_interfaceMod.F90
+++ b/src/utils/clmfates_interfaceMod.F90
@@ -64,6 +64,7 @@ module CLMFatesInterfaceMod
use clm_varctl , only : fates_inventory_ctrl_filename
use clm_varctl , only : use_nitrif_denitrif
use clm_varctl , only : use_lch4
+ use clm_varctl , only : fates_history_dimlevel
use clm_varcon , only : tfrz
use clm_varcon , only : spval
use clm_varcon , only : denice
@@ -133,7 +134,7 @@ module CLMFatesInterfaceMod
use FatesParametersInterface, only : fates_parameters_type
use FatesInterfaceMod , only : DetermineGridCellNeighbors
-
+ use FatesIOVariableKindMod, only : group_dyna_simple, group_dyna_complx
use FatesHistoryInterfaceMod, only : fates_hist
use FatesRestartInterfaceMod, only : fates_restart_interface_type
@@ -274,6 +275,7 @@ module CLMFatesInterfaceMod
public :: CLMFatesGlobals1
public :: CLMFatesGlobals2
+ public :: CrossRefHistoryFields
contains
@@ -406,6 +408,10 @@ subroutine CLMFatesGlobals2()
call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode)
call set_fates_ctrlparms('seeddisp_cadence',ival=fates_seeddisp_cadence)
+
+ call set_fates_ctrlparms('hist_hifrq_dimlevel',ival=fates_history_dimlevel(1))
+ call set_fates_ctrlparms('hist_dynam_dimlevel',ival=fates_history_dimlevel(2))
+
! CTSM-FATES is not fully coupled (yet)
! So lets tell fates to use the RD competition mechanism
! which has fewer boundary conditions (simpler)
@@ -571,6 +577,90 @@ subroutine CLMFatesGlobals2()
return
end subroutine CLMFatesGlobals2
+ ! ===================================================================================
+
+ subroutine CrossRefHistoryFields
+
+ ! This routine only needs to be called on the masterproc.
+ ! Here we cross reference the CLM history master
+ ! list and make sure that all fields that start
+ ! with fates have been allocated. If it has
+ ! not, then we give a more constructive error
+ ! message than what is possible in PIO. The user
+ ! most likely needs to increase the history density
+ ! level
+
+ use histFileMod, only: getname
+ use histFileMod, only: hist_fincl1,hist_fincl2,hist_fincl3,hist_fincl4
+ use histFileMod, only: hist_fincl5,hist_fincl6,hist_fincl7,hist_fincl8
+ use histFileMod, only: hist_fincl9,hist_fincl10
+ use histFileMod, only: max_tapes, max_flds, max_namlen
+
+ integer :: t ! iterator index for history tapes
+ integer :: f ! iterator index for registered history field names
+ integer :: nh ! iterator index for fates registered history
+ logical :: is_fates_field ! Does this start with FATES_ ?
+ logical :: found ! if true, than the history field is either
+ ! not part of the fates set, or was found in
+ ! the fates set
+ character(len=64) :: fincl_name
+ ! This is a copy of the public in histFileMod, copied
+ ! here because it isn't filled at the time of this call
+ character(len=max_namlen+2) :: fincl(max_flds,max_tapes)
+
+ fincl(:,1) = hist_fincl1(:)
+ fincl(:,2) = hist_fincl2(:)
+ fincl(:,3) = hist_fincl3(:)
+ fincl(:,4) = hist_fincl4(:)
+ fincl(:,5) = hist_fincl5(:)
+ fincl(:,6) = hist_fincl6(:)
+ fincl(:,7) = hist_fincl7(:)
+ fincl(:,8) = hist_fincl8(:)
+ fincl(:,9) = hist_fincl9(:)
+ fincl(:,10) = hist_fincl10(:)
+
+ do t = 1,max_tapes
+
+ f = 1
+ search_fields: do while (f < max_flds .and. fincl(f,t) /= ' ')
+
+ fincl_name = getname(fincl(f,t))
+ is_fates_field = fincl_name(1:6)=='FATES_'
+
+ if(is_fates_field) then
+ found = .false.
+ do_fates_hist: do nh = 1,fates_hist%num_history_vars()
+ if(trim(fates_hist%hvars(nh)%vname) == &
+ trim(fincl_name)) then
+ found=.true.
+ exit do_fates_hist
+ end if
+ end do do_fates_hist
+
+ if(.not.found)then
+ write(iulog,*) 'the history field: ',trim(fincl_name)
+ write(iulog,*) 'was requested in the namelist, but was'
+ write(iulog,*) 'not found in the list of fates_hist%hvars.'
+ write(iulog,*) 'Most likely, this is because this history variable'
+ write(iulog,*) 'was specified in the user namelist, but the user'
+ write(iulog,*) 'specified a FATES history output dimension level'
+ write(iulog,*) 'that does not contain that variable in its valid set.'
+ write(iulog,*) 'You may have to increase the namelist setting: fates_history_dimlevel'
+ write(iulog,*) 'current fates_history_dimlevel: ',fates_history_dimlevel(:)
+ !uncomment if you want to list all fates history variables in registry
+ !do_fates_hist2: do nh = 1,fates_hist%num_history_vars()
+ ! write(iulog,*) trim(fates_hist%hvars(nh)%vname)
+ !end do do_fates_hist2
+ call endrun(msg=errMsg(sourcefile, __LINE__))
+ end if
+ end if
+ f = f + 1
+ end do search_fields
+
+ end do
+ end subroutine CrossRefHistoryFields
+
+
! ===================================================================================
subroutine CLMFatesTimesteps()
@@ -1106,9 +1196,9 @@ subroutine dynamics_driv(this, nc, bounds_clump, &
! Flush arrays to values defined by %flushval (see registry entry in
! subroutine define_history_vars()
! ---------------------------------------------------------------------------------
- call fates_hist%flush_hvars(nc,upfreq_in=1)
+ call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_simple)
- call fates_hist%flush_hvars(nc,upfreq_in=5)
+ call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_complx)
! ---------------------------------------------------------------------------------
! Part II: Call the FATES model now that input boundary conditions have been
@@ -1883,11 +1973,20 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, &
! ------------------------------------------------------------------------
! Update history IO fields that depend on ecosystem dynamics
! ------------------------------------------------------------------------
- call fates_hist%flush_hvars(nc,upfreq_in=1)
- do s = 1,this%fates(nc)%nsites
- call fates_hist%zero_site_hvars(this%fates(nc)%sites(s), &
- upfreq_in=1)
- end do
+ if(fates_history_dimlevel(2)>0) then
+ call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_simple)
+ do s = 1,this%fates(nc)%nsites
+ call fates_hist%zero_site_hvars(this%fates(nc)%sites(s), &
+ upfreq_in=group_dyna_simple)
+ end do
+ if(fates_history_dimlevel(2)>1) then
+ call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_complx)
+ do s = 1,this%fates(nc)%nsites
+ call fates_hist%zero_site_hvars(this%fates(nc)%sites(s), &
+ upfreq_in=group_dyna_complx)
+ end do
+ end if
+ end if
call fates_hist%update_history_dyn( nc, &
this%fates(nc)%nsites, &
this%fates(nc)%sites, &
@@ -2067,18 +2166,25 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, &
! ------------------------------------------------------------------------
! Update history IO fields that depend on ecosystem dynamics
! ------------------------------------------------------------------------
- call fates_hist%flush_hvars(nc,upfreq_in=1)
- do s = 1,this%fates(nc)%nsites
- call fates_hist%zero_site_hvars(this%fates(nc)%sites(s), &
- upfreq_in=1)
- end do
- call fates_hist%update_history_dyn( nc, &
+ if(fates_history_dimlevel(2)>0) then
+ call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_simple)
+ do s = 1,this%fates(nc)%nsites
+ call fates_hist%zero_site_hvars(this%fates(nc)%sites(s), &
+ upfreq_in=group_dyna_simple)
+ end do
+ if(fates_history_dimlevel(2)>1) then
+ call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_complx)
+ do s = 1,this%fates(nc)%nsites
+ call fates_hist%zero_site_hvars(this%fates(nc)%sites(s), &
+ upfreq_in=group_dyna_complx)
+ end do
+ end if
+ end if
+ call fates_hist%update_history_dyn( nc, &
this%fates(nc)%nsites, &
this%fates(nc)%sites, &
this%fates(nc)%bc_in)
-
-
end if
end do
!$OMP END PARALLEL DO
@@ -2885,6 +2991,7 @@ subroutine wrap_update_hifrq_hist(this, bounds_clump, &
this%fates(nc)%nsites, &
this%fates(nc)%sites, &
this%fates(nc)%bc_in, &
+ this%fates(nc)%bc_out, &
dtime)
end associate
@@ -3198,6 +3305,8 @@ subroutine init_history_io(this,bounds_proc)
call fates_hist%initialize_history_vars()
nvar = fates_hist%num_history_vars()
+ call CrossRefHistoryFields()
+
do ivar = 1, nvar
associate( vname => fates_hist%hvars(ivar)%vname, &