diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm
index 54f0c0c997..e563bdffa8 100755
--- a/bld/CLMBuildNamelist.pm
+++ b/bld/CLMBuildNamelist.pm
@@ -2932,8 +2932,8 @@ sub setup_logic_do_harvest {
$cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)";
}
- elsif (!&value_is_true($nl->get_value('use_cn')) && !&value_is_true($nl->get_value('use_fates'))) {
- $cannot_be_true = "$var can only be set to true when running with either CN or FATES";
+ elsif (!&value_is_true($nl->get_value('use_cn'))) {
+ $cannot_be_true = "$var can only be set to true when running with CN. Please set use_cn to true.";
}
if ($cannot_be_true) {
@@ -4433,21 +4433,9 @@ sub setup_logic_fates {
}
}
# make sure that fates landuse x pft mode has the necessary run mode configurations
- # and add the necessary landuse x pft static mapping data default if not defined
my $var = "use_fates_lupft";
if ( defined($nl->get_value($var)) ) {
if ( &value_is_true($nl->get_value($var)) ) {
- $var = "flandusepftdat";
- add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
- 'phys'=>$nl_flags->{'phys'}, 'hgrid'=>$nl_flags->{'res'}, nofail=>1 );
- my $fname = remove_leading_and_trailing_quotes( $nl->get_value($var) );
- if ( ! defined($nl->get_value($var)) ) {
- $log->fatal_error("$var is required when use_fates_lupft is set" );
- } elsif ( ! -f "$fname" ) {
- $log->fatal_error("$fname does NOT point to a valid filename" );
- }
-
- # make sure that nocomp and fbg mode are enabled as well as use_fates_luh
my @list = ( "use_fates_luh", "use_fates_nocomp", "use_fates_fixed_biogeog" );
foreach my $var ( @list ) {
if ( ! &value_is_true($nl->get_value($var)) ) {
@@ -4457,50 +4445,79 @@ sub setup_logic_fates {
}
}
# check that fates landuse change mode has the necessary luh2 landuse timeseries data
- # and add the default if not defined
+ # and add the default if not defined. Do not add default if use_fates_potentialveg is true.
+ # If fixed biogeography is on, make sure that flandusepftdat is avilable.
my $var = "use_fates_luh";
if ( defined($nl->get_value($var)) ) {
if ( &value_is_true($nl->get_value($var)) ) {
- $var = "fluh_timeseries";
- add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'phys'=>$nl_flags->{'phys'}, 'hgrid'=>$nl_flags->{'res'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}, nofail=>1 );
- my $fname = remove_leading_and_trailing_quotes( $nl->get_value($var) );
- if ( ! defined($nl->get_value($var)) ) {
- $log->fatal_error("$var is required when use_fates_luh is set" );
- } elsif ( ! -f "$fname" ) {
- $log->fatal_error("$fname does NOT point to a valid filename" );
- }
+ $var = "use_fates_potentialveg";
+ if ( defined($nl->get_value($var)) ) {
+ if ( ! &value_is_true($nl->get_value($var)) ) {
+ $var = "fluh_timeseries";
+ add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'phys'=>$nl_flags->{'phys'},
+ 'hgrid'=>$nl_flags->{'res'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}, nofail=>1 );
+ my $fname = remove_leading_and_trailing_quotes( $nl->get_value($var) );
+ if ( ! defined($nl->get_value($var)) ) {
+ $log->fatal_error("$var is required when use_fates_luh is set and use_fates_potentialveg is false" );
+ } elsif ( ! -f "$fname" ) {
+ $log->fatal_error("$var does NOT point to a valid filename" );
+ }
+ }
+ }
+ $var = "use_fates_fixed_biogeog";
+ if ( defined($nl->get_value($var)) ) {
+ if ( &value_is_true($nl->get_value($var)) ) {
+ $var = "flandusepftdat";
+ add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
+ 'phys'=>$nl_flags->{'phys'}, 'hgrid'=>$nl_flags->{'res'}, nofail=>1 );
+ my $fname = remove_leading_and_trailing_quotes( $nl->get_value($var) );
+ if ( ! defined($nl->get_value($var)) ) {
+ $log->fatal_error("$var is required when use_fates_luh and use_fates_fixed_biogeog is set" );
+ } elsif ( ! -f "$fname" ) {
+ $log->fatal_error("$var does NOT point to a valid filename" );
+ }
+ }
+ }
}
}
# check that fates landuse is on and harvest mode is off when potential veg switch is true
my $var = "use_fates_potentialveg";
if ( defined($nl->get_value($var)) ) {
- if ( &value_is_true($nl->get_value($var)) ) {
- if ( ! &value_is_true($nl->get_value('use_fates_luh')) ) {
- $log->fatal_error("use_fates_luh must be true when $var is true" );
- }
- if ( $nl->get_value('fates_harvest_mode') > 0) {
- $log->fatal_error("fates_harvest_mode must be off (i.e. set to zero) when $var is true" );
+ if ( &value_is_true($nl->get_value($var)) ) {
+ if ( ! &value_is_true($nl->get_value('use_fates_luh')) ) {
+ $log->fatal_error("use_fates_luh must be true when $var is true" );
+ }
+ my $var = remove_leading_and_trailing_quotes($nl->get_value('fates_harvest_mode'));
+ if ( $var ne 'no_harvest') {
+ $log->fatal_error("fates_harvest_mode set to $var. It must set to no_harvest when use_potential_veg is true." );
+ }
+ my $var = "fluh_timeseries";
+ if ( defined($nl->get_value($var)) ) {
+ $log->fatal_error("fluh_timeseries can not be defined when use_fates_potentialveg is true" );
+ }
}
- }
}
# Check fates_harvest_mode compatibility
my $var = "fates_harvest_mode";
if ( defined($nl->get_value($var)) ) {
- # using fates_harvest_mode with CLM landuse driver data - for user convienence
- # if ( $nl->get_value($var) == 2) {
- # # Make sure that do_harvest is set to true
- # if ( ! &value_is_true($nl->get_value('do_harvest')) ) {
- # $log->fatal_error("do_harvest must be true when $var is equal to 2" );
- # }
# using fates_harvest mode with raw luh2 harvest data
- if ( $nl->get_value($var) > 2) {
+ my $mode = remove_leading_and_trailing_quotes($nl->get_value($var));
+ if ( $mode eq 'luhdata_area' || $mode eq 'luhdata_mass' ) {
# Make sure that use_fates_luh is true when using raw fates luh2 harvest data
if ( ! &value_is_true($nl->get_value('use_fates_luh')) ) {
- $log->fatal_error("use_fates_luh is required to be true when $var is greater than 2" );
+ $log->fatal_error("use_fates_luh is required to be true when $var is luhdata_mass or luhdata_area" );
}
- # do_harvest can not be on if we are using the raw fates luh2 harvest data
- if ( &value_is_true($nl->get_value('do_harvest')) ) {
- $log->fatal_error("do_harvest can not be true when $var is greater than 2" );
+ } elsif ( $mode eq 'surfdata_file' ) {
+ # Check to make sure that the user set the flanduse_timeseries file
+ # Since the flanduse_timeseries logic checking is upstream of the fates logic,
+ # don't add the default here. The onus is on the user to match the correct timeseries
+ # data to the correct surface dataset resolution
+ my $var = "flanduse_timeseries";
+ my $fname = remove_leading_and_trailing_quotes( $nl->get_value($var) );
+ if ( ! defined($nl->get_value($var)) ) {
+ $log->fatal_error("$var is required when fates_harvest_mode is surfdata_file" );
+ } elsif ( ! -f "$fname" ) {
+ $log->fatal_error("$var does NOT point to a valid filename" );
}
}
}
diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml
index 9d2a34b7bf..5da9cb22bf 100644
--- a/bld/namelist_files/namelist_defaults_ctsm.xml
+++ b/bld/namelist_files/namelist_defaults_ctsm.xml
@@ -2759,7 +2759,7 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1
0
-0
+no_harvest
.false.
.false.
.false.
@@ -2769,8 +2769,8 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1
.false.
.false.
.false.
-.true.
-.true.
+.true.
+.true.
.true.
.true.
.false.
diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml
index edcfa36d27..58e0aca3a6 100644
--- a/bld/namelist_files/namelist_definition_ctsm.xml
+++ b/bld/namelist_files/namelist_definition_ctsm.xml
@@ -734,15 +734,15 @@ Toggle to turn on no competition mode (only relevant if FATES is being used).
Toggle to turn on FATES satellite phenology mode (only relevant if FATES is being used).
-
-Set FATES harvesting mode by setting fates_harvest_mode > 0.
+
+Set FATES harvesting mode by setting fates_harvest_mode to a valid string option.
Allowed values are:
- 0 : no fates harvesting of any kind
- 1 : fates logging via fates logging event codes (see fates parameter file) only
- 2 : fates harvest driven by CLM landuse timeseries data (dynHarvestMod)
- 3 : fates harvest driven by LUH2 raw harvest data, area-based (dynFATESLandUseChangeMod)
- 4 : fates harvest driven by LUH2 raw harvest data, mass-based (dynFATESLandUseChangeMod)
+ no_harvest: no fates harvesting of any kind
+ event_code: fates logging via fates logging event codes (see fates parameter file) only
+ surfdata_file: fates harvest driven by CLM landuse timeseries data (dynHarvestMod)
+ luhdata_area: fates harvest driven by LUH2 raw harvest data, area-based (dynFATESLandUseChangeMod)
+ luhdata_mass: fates harvest driven by LUH2 raw harvest data, mass-based (dynFATESLandUseChangeMod)
If TRUE, enable use of land use harmonization (LUH) state and transition data from luh_timeseries file.
-This is enabled by default if fates_harvest_mode is set to use the raw LUH2 harvest
-data (fates_harvest_mode >= 3)
+This is enabled by default if fates_harvest_mode is set to use the raw LUH2 harvest data
(Also, only valid for use_fates = true and is incompatible with transient runs currently.)
diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl
index f674849b6f..973fdffd16 100755
--- a/bld/unit_testers/build-namelist_test.pl
+++ b/bld/unit_testers/build-namelist_test.pl
@@ -1047,7 +1047,7 @@ sub cat_and_create_namelistinfile {
phys=>"clm4_5",
},
"useloggingButNOTFATES" =>{ options=>"-envxml_dir . -no-megan",
- namelst=>"fates_harvest_mode=1",
+ namelst=>"fates_harvest_mode=event_code",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm4_5",
},
@@ -1102,12 +1102,12 @@ sub cat_and_create_namelistinfile {
phys=>"clm5_0",
},
"useFATESPOTVEGwithHARVEST" =>{ options=>"-bgc fates -envxml_dir . -no-megan",
- namelst=>"use_fates_potentialveg=T,fates_harvest_mode=1",
+ namelst=>"use_fates_potentialveg=T,fates_harvest_mode=event_code",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
"useFATESHARVEST3WOLUH" =>{ options=>"-bgc fates -envxml_dir . -no-megan",
- namelst=>"use_fates_luh=F,fates_harvest_mode=3",
+ namelst=>"use_fates_luh=F,fates_harvest_mode=luhdata_area",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode0/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode0/user_nl_clm
index 929a8e6e14..b3b338e232 100644
--- a/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode0/user_nl_clm
+++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode0/user_nl_clm
@@ -1 +1 @@
-fates_harvest_mode = 0
+fates_harvest_mode = no_harvest
diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode1/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode1/user_nl_clm
index dea75b71e7..c0e1c476be 100644
--- a/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode1/user_nl_clm
+++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode1/user_nl_clm
@@ -1 +1 @@
-fates_harvest_mode = 1
+fates_harvest_mode = event_code
diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode2/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode2/user_nl_clm
index fd4c74fe57..61e1daaa93 100644
--- a/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode2/user_nl_clm
+++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode2/user_nl_clm
@@ -1 +1 @@
-fates_harvest_mode = 2
+fates_harvest_mode = surfdata_file
diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode3/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode3/user_nl_clm
index 3332e9e526..d760105e68 100644
--- a/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode3/user_nl_clm
+++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode3/user_nl_clm
@@ -1 +1 @@
-fates_harvest_mode = 3
+fates_harvest_mode = luhdata_area
diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode4/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode4/user_nl_clm
index 13dae9efee..bb5f30f75d 100644
--- a/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode4/user_nl_clm
+++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdLUH2Mode4/user_nl_clm
@@ -1 +1 @@
-fates_harvest_mode = 4
+fates_harvest_mode = luhdata_mass
diff --git a/src/dyn_subgrid/dynFATESLandUseChangeMod.F90 b/src/dyn_subgrid/dynFATESLandUseChangeMod.F90
index 4f326d82a5..f330ee2b78 100644
--- a/src/dyn_subgrid/dynFATESLandUseChangeMod.F90
+++ b/src/dyn_subgrid/dynFATESLandUseChangeMod.F90
@@ -35,11 +35,11 @@ module dynFATESLandUseChangeMod
integer, public, parameter :: num_landuse_harvest_vars = 5
! Define the fates landuse namelist mode switch values
- integer, public, parameter :: fates_harvest_no_logging = 0
- integer, public, parameter :: fates_harvest_logging_only = 1
- integer, public, parameter :: fates_harvest_clmlanduse = 2
- integer, public, parameter :: fates_harvest_luh_area = 3
- integer, public, parameter :: fates_harvest_luh_mass = 4
+ character(len=13), public, parameter :: fates_harvest_no_logging = 'no_harvest'
+ character(len=13), public, parameter :: fates_harvest_logging_only = 'event_code'
+ character(len=13), public, parameter :: fates_harvest_clmlanduse = 'surfdata_file'
+ character(len=13), public, parameter :: fates_harvest_luh_area = 'luhdata_area'
+ character(len=13), public, parameter :: fates_harvest_luh_mass = 'luhdata_mass'
! Define landuse harvest unit integer representation
integer, public, parameter :: landuse_harvest_area_units = 1
@@ -171,13 +171,14 @@ subroutine dynFatesLandUseInit(bounds, landuse_filename)
end do
! Get the harvest rate data from the fates luh2 timeseries dataset if enabled
- if (fates_harvest_mode .ge. fates_harvest_luh_area ) then
+ if (trim(fates_harvest_mode) .eq. fates_harvest_luh_area .or. &
+ trim(fates_harvest_mode) .eq. fates_harvest_luh_mass) then
! change the harvest varnames being used depending on the mode selected
- if (fates_harvest_mode .eq. fates_harvest_luh_area ) then
+ if (trim(fates_harvest_mode) .eq. fates_harvest_luh_area ) then
landuse_harvest_varnames => landuse_harvest_area_varnames
landuse_harvest_units = landuse_harvest_area_units
- elseif (fates_harvest_mode .eq. fates_harvest_luh_mass ) then
+ elseif (trim(fates_harvest_mode) .eq. fates_harvest_luh_mass ) then
landuse_harvest_varnames => landuse_harvest_mass_varnames
landuse_harvest_units = landuse_harvest_mass_units
else
@@ -256,7 +257,8 @@ subroutine dynFatesLandUseInterp(bounds, init_state)
call landuse_state_vars(varnum)%get_current_data(this_data)
landuse_states(varnum,bounds%begg:bounds%endg) = this_data(bounds%begg:bounds%endg)
end do
- if (fates_harvest_mode .ge. fates_harvest_luh_area ) then
+ if (trim(fates_harvest_mode) .eq. fates_harvest_luh_area .or. &
+ trim(fates_harvest_mode) .eq. fates_harvest_luh_mass) then
do varnum = 1, num_landuse_harvest_vars
call landuse_harvest_vars(varnum)%get_current_data(this_data)
landuse_harvest(varnum,bounds%begg:bounds%endg) = this_data(bounds%begg:bounds%endg)
diff --git a/src/dyn_subgrid/dynSubgridDriverMod.F90 b/src/dyn_subgrid/dynSubgridDriverMod.F90
index e5ca3f002e..faef029b40 100644
--- a/src/dyn_subgrid/dynSubgridDriverMod.F90
+++ b/src/dyn_subgrid/dynSubgridDriverMod.F90
@@ -89,6 +89,11 @@ subroutine dynSubgrid_init(bounds_proc, glc_behavior, crop_inst)
! Note that dynpft_init needs to be called from outside any loops over clumps - so
! this routine needs to be called from outside any loops over clumps.
!
+ !
+ ! !USES:
+ use clm_varctl , only : fates_harvest_mode
+ use dynFATESLandUseChangeMod , only : fates_harvest_clmlanduse
+ !
! !ARGUMENTS:
type(bounds_type) , intent(in) :: bounds_proc ! processor-level bounds
type(glc_behavior_type) , intent(in) :: glc_behavior
@@ -123,7 +128,7 @@ subroutine dynSubgrid_init(bounds_proc, glc_behavior, crop_inst)
! flanduse_timeseries file. However, this could theoretically be changed so that the
! harvest data were separated from the pftdyn data, allowing them to differ in the
! years over which they apply.
- if (get_do_harvest()) then
+ if (get_do_harvest() .or. trim(fates_harvest_mode) == fates_harvest_clmlanduse) then
call dynHarvest_init(bounds_proc, harvest_filename=get_flanduse_timeseries())
end if
diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90
index 64d6e15747..59b72c8e74 100644
--- a/src/main/clm_varctl.F90
+++ b/src/main/clm_varctl.F90
@@ -302,7 +302,7 @@ module clm_varctl
! > 1 for external data (lightning and/or anthropogenic ignitions)
! see bld/namelist_files/namelist_definition_clm4_5.xml for details
logical, public :: use_fates_tree_damage = .false. ! true => turn on tree damage module
- integer, public :: fates_harvest_mode = 0 ! 0 for no harvest/logging; 1-4 for harvest mode options
+ character(len=256), public :: fates_harvest_mode = '' ! five different harvest modes; see namelist definition
logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro
logical, public :: use_fates_cohort_age_tracking = .false. ! true => turn on cohort age tracking
logical, public :: use_fates_ed_st3 = .false. ! true => static stand structure
diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90
index 55dd92305d..1dd432bb7e 100644
--- a/src/main/controlMod.F90
+++ b/src/main/controlMod.F90
@@ -775,7 +775,7 @@ subroutine control_spmd()
call mpi_bcast (for_testing_allow_interp_non_ciso_to_ciso, 1, MPI_LOGICAL, 0, mpicom, ier)
call mpi_bcast (fates_spitfire_mode, 1, MPI_INTEGER, 0, mpicom, ier)
- call mpi_bcast (fates_harvest_mode, 1, MPI_INTEGER, 0, mpicom, ier)
+ call mpi_bcast (fates_harvest_mode, len(fates_harvest_mode) , MPI_CHARACTER, 0, mpicom, ier)
call mpi_bcast (use_fates_planthydro, 1, MPI_LOGICAL, 0, mpicom, ier)
call mpi_bcast (use_fates_tree_damage, 1, MPI_LOGICAL, 0, mpicom, ier)
call mpi_bcast (use_fates_cohort_age_tracking, 1, MPI_LOGICAL, 0, mpicom, ier)
diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90
index 048824a83a..4205802088 100644
--- a/src/utils/clmfates_interfaceMod.F90
+++ b/src/utils/clmfates_interfaceMod.F90
@@ -169,7 +169,6 @@ module CLMFatesInterfaceMod
use FATESFireBase , only : fates_fire_base_type
use FATESFireFactoryMod , only : no_fire, scalar_lightning, successful_ignitions,&
anthro_ignitions, anthro_suppression
- use dynSubgridControlMod , only : get_do_harvest
use dynHarvestMod , only : num_harvest_inst, harvest_varnames
use dynHarvestMod , only : harvest_units, mass_units, unitless_units
use dynHarvestMod , only : dynHarvest_interp_resolve_harvesttypes
@@ -185,7 +184,9 @@ module CLMFatesInterfaceMod
use dynFATESLandUseChangeMod, only : dynFatesLandUseInterp
use dynFATESLandUseChangeMod, only : num_landuse_harvest_vars
use dynFATESLandUseChangeMod, only : fates_harvest_no_logging
+ use dynFATESLandUseChangeMod, only : fates_harvest_clmlanduse
use dynFATESLandUseChangeMod, only : fates_harvest_luh_area
+ use dynFATESLandUseChangeMod, only : fates_harvest_luh_mass
use dynFATESLandUseChangeMod, only : landuse_harvest
use dynFATESLandUseChangeMod, only : landuse_harvest_units
use dynFATESLandUseChangeMod, only : landuse_harvest_varnames
@@ -489,13 +490,6 @@ subroutine CLMFatesGlobals2()
end if
call set_fates_ctrlparms('use_ed_st3',ival=pass_ed_st3)
- if (fates_harvest_mode > fates_harvest_no_logging) then
- pass_logging = 1
- else
- pass_logging = 0
- end if
- call set_fates_ctrlparms('use_logging',ival=pass_logging)
-
if(use_fates_ed_prescribed_phys) then
pass_ed_prescribed_phys = 1
else
@@ -517,39 +511,34 @@ subroutine CLMFatesGlobals2()
end if
call set_fates_ctrlparms('use_cohort_age_tracking',ival=pass_cohort_age_tracking)
- ! check fates logging namelist value first because hlm harvest can override it
- if (fates_harvest_mode > fates_harvest_no_logging) then
- pass_logging = 1
- else
- pass_logging = 0
+ ! FATES logging and harvest modes
+ pass_logging = 0
+ pass_lu_harvest = 0
+ pass_num_lu_harvest_cats = 0
+ if (trim(fates_harvest_mode) /= fates_harvest_no_logging) then
+ pass_logging = 1 ! Time driven logging, without landuse harvest
+ ! CLM landuse timeseries driven harvest rates
+ if (trim(fates_harvest_mode) == fates_harvest_clmlanduse) then
+ pass_num_lu_harvest_cats = num_harvest_inst
+ pass_lu_harvest = 1
+
+ ! LUH2 landuse timeseries driven harvest rates
+ else if (trim(fates_harvest_mode)== fates_harvest_luh_area .or. &
+ trim(fates_harvest_mode)== fates_harvest_luh_mass) then
+ pass_lu_harvest = 1
+ pass_num_lu_harvest_cats = num_landuse_harvest_vars
+ end if
end if
- if(get_do_harvest()) then
- pass_logging = 1
- pass_num_lu_harvest_cats = num_harvest_inst
- pass_lu_harvest = 1
- else
- pass_lu_harvest = 0
- pass_num_lu_harvest_cats = 0
- end if
+ call set_fates_ctrlparms('use_lu_harvest',ival=pass_lu_harvest)
+ call set_fates_ctrlparms('num_lu_harvest_cats',ival=pass_num_lu_harvest_cats)
+ call set_fates_ctrlparms('use_logging',ival=pass_logging)
+ ! FATES landuse modes
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
-
- ! Do not set harvest passing variables to zero not in luh harvest modes
- ! as the user may want to use the CLM landuse harvest with luh2 transitions
- if(fates_harvest_mode >= fates_harvest_luh_area) then
- ! End the run if do_harvest is true with this run mode.
- ! This should be caught be the build namelist.
- if(get_do_harvest()) then
- call endrun(msg="do_harvest and fates_harvest_mode using luh2 harvest data are incompatible"//&
- errmsg(sourcefile, __LINE__))
- else
- pass_lu_harvest = 1
- end if
- end if
else
pass_use_luh = 0
pass_num_luh_states = 0
@@ -567,12 +556,6 @@ subroutine CLMFatesGlobals2()
end if
call set_fates_ctrlparms('use_fates_potentialveg',ival=pass_use_potentialveg)
- ! Wait to set the harvest and logging variables after checking get_do_harvest
- ! and fates_harvest_modes
- call set_fates_ctrlparms('use_lu_harvest',ival=pass_lu_harvest)
- call set_fates_ctrlparms('num_lu_harvest_cats',ival=pass_num_lu_harvest_cats)
- call set_fates_ctrlparms('use_logging',ival=pass_logging)
-
if(use_fates_inventory_init) then
pass_inventory_init = 1
else
@@ -996,7 +979,8 @@ subroutine dynamics_driv(this, nc, bounds_clump, &
! Set the FATES global time and date variables
call GetAndSetTime
- if (get_do_harvest()) then
+ ! Get harvest rates for CLM landuse timeseries driven rates
+ if (trim(fates_harvest_mode) == fates_harvest_clmlanduse) then
call dynHarvest_interp_resolve_harvesttypes(bounds_clump, &
harvest_rates=harvest_rates(begg:endg,1:num_harvest_inst), &
after_start_of_harvest_ts=after_start_of_harvest_ts)
@@ -1122,7 +1106,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, &
! for now there is one veg column per gridcell, so store all harvest data in each site
! this will eventually change
! today's hlm harvest flag needs to be set no matter what
- if (get_do_harvest()) then
+ if (trim(fates_harvest_mode) == fates_harvest_clmlanduse) then
if (after_start_of_harvest_ts) then
this%fates(nc)%bc_in(s)%hlm_harvest_rates(1:num_harvest_inst) = harvest_rates(g,1:num_harvest_inst)
else
@@ -1140,6 +1124,12 @@ subroutine dynamics_driv(this, nc, bounds_clump, &
write(iulog,*) harvest_units
call endrun(msg=errMsg(sourcefile, __LINE__))
end if
+
+ else if (trim(fates_harvest_mode) == fates_harvest_luh_area .or. &
+ trim(fates_harvest_mode) == fates_harvest_luh_mass) then
+ this%fates(nc)%bc_in(s)%hlm_harvest_rates = landuse_harvest(:,g)
+ this%fates(nc)%bc_in(s)%hlm_harvest_catnames = landuse_harvest_varnames
+ this%fates(nc)%bc_in(s)%hlm_harvest_units = landuse_harvest_units
endif
if (use_fates_luh) then
@@ -1147,12 +1137,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, &
this%fates(nc)%bc_in(s)%hlm_luh_state_names = landuse_state_varnames
this%fates(nc)%bc_in(s)%hlm_luh_transitions = landuse_transitions(:,g)
this%fates(nc)%bc_in(s)%hlm_luh_transition_names = landuse_transition_varnames
-
- if (fates_harvest_mode >= fates_harvest_luh_area) then
- this%fates(nc)%bc_in(s)%hlm_harvest_rates = landuse_harvest(:,g)
- this%fates(nc)%bc_in(s)%hlm_harvest_catnames = landuse_harvest_varnames
- this%fates(nc)%bc_in(s)%hlm_harvest_units = landuse_harvest_units
- end if
end if
end do
@@ -2100,7 +2084,8 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, &
this%fates(nc)%bc_in(s)%hlm_luh_transitions = landuse_transitions(:,g)
this%fates(nc)%bc_in(s)%hlm_luh_transition_names = landuse_transition_varnames
- if (fates_harvest_mode >= fates_harvest_luh_area ) then
+ if (trim(fates_harvest_mode) == fates_harvest_luh_area .or. &
+ trim(fates_harvest_mode) == fates_harvest_luh_mass) then
this%fates(nc)%bc_in(s)%hlm_harvest_rates = landuse_harvest(:,g)
this%fates(nc)%bc_in(s)%hlm_harvest_catnames = landuse_harvest_varnames
this%fates(nc)%bc_in(s)%hlm_harvest_units = landuse_harvest_units