Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fates patch count controls #1766

Merged
merged 49 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
6986334
Incremental changes to enable fates to drive the number of natveg pat…
rgknox May 20, 2022
72fbe0a
First pass of running/compiling fates with self-dictating patch counts
rgknox May 23, 2022
b3fbf23
Removed endrun from clm_varpar, circular dependency?
rgknox May 23, 2022
69bddf4
changing P32 test to P36 for improved core usage
glemieux May 23, 2022
b637526
Adjusting how maxcfts and maxnatpfts are defined with fates
rgknox May 24, 2022
57fe9ee
Merge branch 'fates-params-api23' of github.com:rgknox/ctsm into fate…
rgknox May 24, 2022
261eb28
Minor updates to fates-patch counting
rgknox May 25, 2022
d709a0f
fixed typo
rgknox May 25, 2022
d9db2b5
Added namelist hooks and interface for activating the tree damage mod…
rgknox May 27, 2022
3e86d6c
Added some placeholder code for harvest-product coupling in fates
rgknox May 27, 2022
8fc4b48
Merge branch 'ctsm5.1.dev098-branch' into fates-params-api23-dev98
rgknox May 27, 2022
ff247db
Small bug fix for fates surface file reads, temporary fates parameter…
rgknox May 29, 2022
da4d52a
Commented out clmfates wrapper code for product pools. Discussion wit…
rgknox May 31, 2022
cc8bc9a
Minor changes to how nat_wt_patch is calculated for fates
rgknox Jun 3, 2022
215864e
Updated default fates parameter file
rgknox Jun 8, 2022
243d26d
Add testmods for FATES and FATES-SP with Drydep and FATES and FATES-S…
ekluzek Jun 10, 2022
b039f49
Fixed location of default parameter file
rgknox Jun 10, 2022
b4e3acc
Added a tree damage test for fates
rgknox Jun 10, 2022
0e1a44f
removed clm_aux test for fates tree damage per Eriks suggestion
rgknox Jun 10, 2022
92226da
Reverted to base for SatellitePhenologyMod.F90 to removed whitespace …
rgknox Jun 10, 2022
b45cd84
Syntax and comment fixes for fates initialization logic. Added abort …
rgknox Jun 10, 2022
c4b16b1
Updates on comments
rgknox Jun 13, 2022
dfef51a
Switch a few cases of the use of ED in namelist documention for FATES…
ekluzek Jun 13, 2022
32c852f
Add a comment about requirement for ignore-warnings when FATES and Dr…
ekluzek Jun 13, 2022
461b8c1
Allowing calse to collapse in surfrdmod to be active with fates, again
rgknox Jun 14, 2022
cb71a47
Merge branch 'fates-params-api23' of github.com:rgknox/CTSM into fate…
ekluzek Jun 14, 2022
1558531
Modify the SP mode InterpMonthly call so will work with dry-depositio…
ekluzek Jun 14, 2022
f418d19
readAnnualVeg if dry-deposition even if FATES is on, and remove some …
ekluzek Jun 14, 2022
635cb1e
Make sure if FATES and DryDep is on SatellitePhenologyInit will be do…
ekluzek Jun 14, 2022
83433df
Work on comments a bit
ekluzek Jun 14, 2022
8fd708e
Add test that fails for FATES and n_dom_pfts
ekluzek Jun 14, 2022
3a20b10
Abort if FATES and n_dom_pft is on at the same time
ekluzek Jun 14, 2022
bc29236
Testing out new bounds system, adding surfpft_lb and ub
rgknox Jun 16, 2022
2d85b3e
Merge branch 'fates-params-api23' into fates_drydep_changes
ekluzek Jun 17, 2022
de1ca54
Minor code cleanup related to natpft_lb and natpft_ub having similar …
rgknox Jun 17, 2022
d3fa22b
Comment out the dry-dep change and add a note about it with the issue…
ekluzek Jun 17, 2022
37f25fb
Change if statements about drydep back to how they were before, but a…
ekluzek Jun 17, 2022
52e9ee1
Add a check that aborts if drydep or megan is on and FATES is on, out…
ekluzek Jun 17, 2022
b71d464
surfpft_lb and ub where required
ekluzek Jun 17, 2022
46e7697
This is required to get the FATES-SP drydep mode to work
ekluzek Jun 17, 2022
fc73c8a
Merge pull request #4 from ekluzek/fates_drydep_changes
rgknox Jun 19, 2022
1c66c59
reverted changes in subgridMod that were unused
rgknox Jun 19, 2022
7cb9f79
Removed misleading statement
rgknox Jun 19, 2022
1bc6e1e
Added intel compiler to tree damage test
rgknox Jun 20, 2022
92e98c7
Updating drydep check
rgknox Jun 20, 2022
a484ba1
Updated unit test to match args in clm_varpar
rgknox Jun 21, 2022
b75a508
Updated changelogs
rgknox Jun 21, 2022
6a4d9ed
Updated issues in the changelog
rgknox Jun 21, 2022
2ead5b8
Updated fates external pointer to sci.1.57.4_api.24.0.0
rgknox Jun 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Externals_CLM.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[fates]
local_path = src/fates
protocol = git
repo_url = https://github.com/NGEET/fates
tag = sci.1.56.0_api.23.0.0
repo_url = https://github.com/rgknox/fates
branch = params-maxpatch-logfinal
required = True

[externals_description]
Expand Down
20 changes: 14 additions & 6 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ sub setup_cmdl_fates_mode {

$var = "use_fates";
if ( &value_is_true($nl_flags->{$var}) ) {
# This section is a place-holder to test for modules that are not allowed with ED
# This section is a place-holder to test for modules that are not allowed with FATES
# the defaults which are set in the logic section of the namelist builder will
# automatically set these correctly (well that is the assumption), but here we
# want to set a catch to fail and warn users if they explicitly set incompatible user namelist
Expand Down Expand Up @@ -774,7 +774,7 @@ sub setup_cmdl_fates_mode {
# dis-allow fates specific namelist items with non-fates runs
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_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" );
# dis-allow fates specific namelist items with non-fates runs
foreach my $var ( @list ) {
if ( defined($nl->get_value($var)) ) {
Expand Down Expand Up @@ -1167,7 +1167,7 @@ sub setup_cmdl_spinup {
$log->fatal_error("$var has an invalid value ($val). Valid values are: @valid_values");
}
if ( $nl_flags->{'bgc_spinup'} eq "on" && (not &value_is_true( $nl_flags->{'use_cn'} )) && (not &value_is_true($nl_flags->{'use_fates'})) ) {
$log->fatal_error("$var can not be '$nl_flags->{'bgc_spinup'}' if neither CN nor ED is turned on (use_cn=$nl_flags->{'use_cn'}, use_fates=$nl_flags->{'use_fates'}).");
$log->fatal_error("$var can not be '$nl_flags->{'bgc_spinup'}' if neither CN nor FATES is turned on (use_cn=$nl_flags->{'use_cn'}, use_fates=$nl_flags->{'use_fates'}).");
}
if ( $nl->get_value("spinup_state") eq 0 && $nl_flags->{'bgc_spinup'} eq "on" ) {
$log->fatal_error("Namelist spinup_state contradicts the command line option bgc_spinup" );
Expand Down Expand Up @@ -2046,6 +2046,10 @@ sub setup_logic_subgrid {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'toosmall_lake');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'toosmall_wetland');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'toosmall_urban');

if ( &value_is_true($nl_flags->{'use_fates'}) && $nl->get_value('n_dom_pfts') != 0 ) {
$log->fatal_error( "FATES and n_dom_pfts can NOT be set at the same time" );
}
}

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -2611,7 +2615,7 @@ sub setup_logic_do_transient_crops {
# In principle, use_fates should be compatible with
# do_transient_crops. However, this hasn't been tested, so to be safe,
# we are not allowing this combination for now.
$cannot_be_true = "$var has not been tested with ED, so for now these two options cannot be combined";
$cannot_be_true = "$var has not been tested with FATES, so for now these two options cannot be combined";
}

if ($cannot_be_true) {
Expand Down Expand Up @@ -3660,6 +3664,10 @@ sub setup_logic_dry_deposition {
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

if ($opts->{'drydep'} ) {
if ( &value_is_true( $nl_flags->{'use_fates'}) && not &value_is_true( $nl_flags->{'use_fates_sp'}) ) {
$log->warning("DryDeposition can NOT be on when FATES is also on unless FATES-SP mode is on.\n" .
" Use the '--no-drydep' option when '-bgc fates' is activated");
}
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'drydep_list');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'drydep_method');
} else {
Expand Down Expand Up @@ -3705,7 +3713,7 @@ sub setup_logic_megan {

if ($nl_flags->{'megan'} ) {
if ( &value_is_true( $nl_flags->{'use_fates'} ) ) {
$log->fatal_error("MEGAN can NOT be on when ED is also on.\n" .
$log->warning("MEGAN can NOT be on when FATES is also on.\n" .
" Use the '-no-megan' option when '-bgc fates' is activated");
}
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'megan_specifier');
Expand Down Expand Up @@ -4107,7 +4115,7 @@ 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",
"use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking" );
"use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking","use_fates_tree_damage" );
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'} );
Expand Down
3 changes: 2 additions & 1 deletion bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- FATES default parameter file -->
<!-- ================================================================== -->

<fates_paramfile>lnd/clm2/paramdata/fates_params_api.22.1.0_12pft_c220307.nc</fates_paramfile>
<fates_paramfile>lnd/clm2/paramdata/fates_params_api.24.0.0_12pft_c220608.nc</fates_paramfile>

<!-- ======================================================================================== -->
<!-- clm 5.0 BGC nitrogen model -->
Expand Down Expand Up @@ -2541,6 +2541,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts
<!-- ===== FATES DEFAULTS =========== -->
<fates_spitfire_mode use_fates=".true.">0</fates_spitfire_mode>
<use_fates_planthydro use_fates=".true.">.false.</use_fates_planthydro>
<use_fates_tree_damage use_fates=".true.">.false.</use_fates_tree_damage>
<use_fates_cohort_age_tracking use_fates=".true.">.false.</use_fates_cohort_age_tracking>
<use_fates_ed_st3 use_fates=".true.">.false.</use_fates_ed_st3>
<use_fates_ed_prescribed_phys use_fates=".true.">.false.</use_fates_ed_prescribed_phys>
Expand Down
8 changes: 7 additions & 1 deletion bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,12 @@ Switch deciding which nutrient model to use in FATES.
(Only relevant if FATES is on)
</entry>

<entry id="use_fates_tree_damage" type="logical" category="physics"
group="clm_inparm" valid_values="" value=".false.">
Toggle to turn on the tree damage module in FATES
(Only relevant if FATES is on)
</entry>

<entry id="fates_spitfire_mode" type="integer" category="physics"
group="clm_inparm" valid_values="0,1,2,3,4,5" value=".false.">
Turn on spitfire module to simulate fire by setting fates_spitfire_mode > 0.
Expand Down Expand Up @@ -2124,7 +2130,7 @@ Command line arguement for biogeochemistry mode for CLM4.5
Nitrification/De-nitrification
Methane model
Vertically resolved Carbon
fates = FATES/ED ecosystem demography model with below ground BGC:
fates = FATES Functionally Assembled Terrestrial Ecosystem Simulator (ecosystem demography model with below ground BGC):
</entry>

<!-- ======================================================================================== -->
Expand Down
12 changes: 11 additions & 1 deletion bld/unit_testers/build-namelist_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ sub cat_and_create_namelistinfile {
#
# Figure out number of tests that will run
#
my $ntests = 1844;
my $ntests = 1846;
if ( defined($opts{'compare'}) ) {
$ntests += 1254;
}
Expand Down Expand Up @@ -956,6 +956,11 @@ sub cat_and_create_namelistinfile {
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
"useFATESWn_dom_pft" =>{ options=>"-bgc fates -envxml_dir . -no-megan",
namelst=>"n_dom_pfts = 1",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
"useFATESWbMH" =>{ options=>"-bgc fates -envxml_dir . -no-megan",
namelst=>"use_biomass_heat_storage=.true.",
GLC_TWO_WAY_COUPLING=>"FALSE",
Expand Down Expand Up @@ -1001,6 +1006,11 @@ sub cat_and_create_namelistinfile {
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm4_5",
},
"useDRYDEPwithFATES" =>{ options=>"--bgc fates --envxml_dir . --no-megan --drydep",
namelst=>"",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm4_5",
},
"useFATESSPWONOCOMP" =>{ options=>"-bgc fates -envxml_dir . -no-megan",
namelst=>"use_fates_sp=T,use_fates_nocomp=F",
GLC_TWO_WAY_COUPLING=>"FALSE",
Expand Down
38 changes: 37 additions & 1 deletion cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1804,6 +1804,24 @@
<option name="wallclock">00:20:00</option>
</options>
</test>
<test name="SMS_D" grid="f45_f45_mg37" compset="I2000Clm50FatesRs" testmods="clm/FatesColdDefDryDep">
<machines>
<machine name="cheyenne" compiler="gnu" category="aux_clm"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment" >Run a test with dry deposition on and regular FATES</option>
</options>
</test>
<test name="ERS_D_Ld15" grid="f45_f45_mg37" compset="I2000Clm50FatesRs" testmods="clm/FatesColdDefTreeDamage">
<machines>
<machine name="cheyenne" compiler="intel" category="fates"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment" >Ensure functionality of the tree damage option in FATES</option>
</options>
</test>
<test name="ERS_D_Ld3_PS" grid="f09_g17" compset="I2000Clm50FatesRs" testmods="clm/FatesColdDef">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_clm"/>
Expand Down Expand Up @@ -2060,7 +2078,7 @@
<option name="comment">Short ERP debug FATES test for f19_g17 grid.</option>
</options>
</test>
<test name="ERP_D_P32x2_Ld3" grid="f19_g17" compset="I2000Clm50FatesCru" testmods="clm/FatesColdDef">
<test name="ERP_D_P36x2_Ld3" grid="f19_g17" compset="I2000Clm50FatesCru" testmods="clm/FatesColdDef">
<machines>
<machine name="cheyenne" compiler="intel" category="fates"/>
</machines>
Expand Down Expand Up @@ -2251,6 +2269,24 @@
<option name="comment">Test with DEBUG on for FatesSP mode, NOTE: FatesSp has the largest difference in CTSM code for any FATES mode</option>
</options>
</test>
<test name="SMS_D" grid="1x1_brazil" compset="I2000Clm51FatesSpCruRsGs" testmods="clm/FatesColdDefDryDepReducedComplexSatPhen">
<machines>
<machine name="cheyenne" compiler="gnu" category="aux_clm"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment" >Run a test with dry deposition on and FATES-SP</option>
</options>
</test>
<test name="SMS_D" grid="1x1_brazil" compset="I2000Clm51FatesSpCruRsGs" testmods="clm/FatesColdDefMeganReducedComplexSatPhen">
<machines>
<machine name="cheyenne" compiler="gnu" category="aux_clm"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment" >Run a test with MEGAN on and FATES-SP</option>
</options>
</test>
<!-- Don't active this test until #1722 is fixed
<test name="SMS_Ld3" grid="f09_f09_mg17" compset="I2000Clm51FatesCruRsGs" testmods="clm/FatesColdDefReducedComplexSatPhen_prescribed">
<machines>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../FatesColdDef
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
./xmlchange CLM_BLDNML_OPTS='--drydep' --append
# The following would be required if you want to run with DryDep and FATES without Fates-SP mode
#./xmlchange CLM_BLDNML_OPTS="--ignore_warnings" --append
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
../FatesColdDefDryDep
../FatesColdDefReducedComplexSatPhen
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../FatesColdDef
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./xmlchange CLM_BLDNML_OPTS='--megan' --append
./xmlchange CLM_BLDNML_OPTS="--ignore_warnings" --append
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
../FatesColdDefMegan
../FatesColdDefReducedComplexSatPhen
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../FatesColdDef
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use_fates_tree_damage=.true.
5 changes: 5 additions & 0 deletions src/biogeochem/DryDepVelocity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,14 @@ Module DryDepVelocity
!------------------------------------------------------------------------
subroutine Init(this, bounds)

use clm_varctl , only : use_fates, use_fates_sp
class(drydepvel_type) :: this
type(bounds_type), intent(in) :: bounds

if ( (.not. use_fates_sp) .and. use_fates .and. (n_drydep > 0 .and. drydep_method == DD_XLND) )then
call endrun( msg='ERROR: Dry-deposition currently does NOT work with FATES outside of FATES-SP mode (see github issue #1044)'//&
errMsg(sourcefile, __LINE__))
end if
call this%InitAllocate(bounds)
call this%InitHistory(bounds)

Expand Down
19 changes: 19 additions & 0 deletions src/biogeochem/EDBGCDynMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,25 @@ subroutine EDBGCDyn(bounds, &
call t_stopf('SoilBiogeochemLittVertTransp')
end if

! Wood product fluxes will eventually be added to FATES-CLM. However
! it is likely this will be implemented during or after we break away from
! using this module. This module and the current coupling stategy bypasses
! a number of processes in CLM, which includes the wood product modules.
! Therefore the following call is a placeholder so that the wood-product
! wrapper code can be copied from here and applied at the right place when the time comes.
! RGK 06-2022

!call FatesWrapWoodProducts(bounds, num_soilc, filter_soilc,c_products_inst)
!call t_startf('CNWoodProducts')
!call c_products_inst%UpdateProducts(bounds, &
! num_soilp, filter_soilp, &
! dwt_wood_product_gain_patch = cnveg_carbonflux_inst%dwt_wood_productc_gain_patch(begp:endp), &
! wood_harvest_patch = cnveg_carbonflux_inst%wood_harvestc_patch(begp:endp), &
! dwt_crop_product_gain_patch = cnveg_carbonflux_inst%dwt_crop_productc_gain_patch(begp:endp), &
! crop_harvest_to_cropprod_patch = cnveg_carbonflux_inst%crop_harvestc_to_cropprodc_patch(begp:endp))
!call t_stopf('CNWoodProducts')


end associate

end subroutine EDBGCDyn
Expand Down
5 changes: 5 additions & 0 deletions src/biogeochem/VOCEmissionMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,15 @@ module VOCEmissionMod
!------------------------------------------------------------------------
subroutine Init(this, bounds)

use clm_varctl , only : use_fates, use_fates_sp
class(vocemis_type) :: this
type(bounds_type), intent(in) :: bounds

if ( shr_megan_mechcomps_n > 0) then
if ( use_fates .and. (.not. use_fates_sp) ) then
call endrun( msg='ERROR: MEGAN currently does NOT work with FATES outside of FATES-SP mode (see github issue #115)'//&
errMsg(sourcefile, __LINE__))
end if
call this%InitAllocate(bounds)
call this%InitHistory(bounds)
call this%InitCold(bounds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ contains
soil_layerstruct_predefined = '20SL_8.5m'

call setup_ncells_single_veg_patch(ncells=1, pft_type=1)
call clm_varpar_init( actual_maxsoil_patches=17, actual_numcft=2 )
call clm_varpar_init( actual_maxsoil_patches=17, surf_numpft=15, surf_numcft=2 )
call this%photo%Init( bounds )
call this%photo%setParamsForTesting( )

Expand Down
19 changes: 18 additions & 1 deletion src/main/clm_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -221,24 +221,41 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro

! ============================================================================
! Specified phenology
! Done in SP mode, FATES-SP mode and also when dry-deposition is active
! ============================================================================

if (use_cn) then
! For dry-deposition need to call CLMSP so that mlaidiff is obtained
! NOTE: This is also true of FATES below
if ( n_drydep > 0 .and. drydep_method == DD_XLND ) then
call t_startf('interpMonthlyVeg')
call interpMonthlyVeg(bounds_proc, canopystate_inst)
call t_stopf('interpMonthlyVeg')
endif

elseif(use_fates) then

! For FATES-Specified phenology mode interpolate the weights for
! time-interpolation of monthly vegetation data (as in SP mode below)
! Also for FATES with dry-deposition as above need to call CLMSP so that mlaidiff is obtained
!if ( use_fates_sp .or. (n_drydep > 0 .and. drydep_method == DD_XLND ) ) then ! Replace with this when we have dry-deposition working
! For now don't allow for dry-deposition because of issues in #1044 EBK Jun/17/2022
if ( use_fates_sp ) then
call t_startf('interpMonthlyVeg')
call interpMonthlyVeg(bounds_proc, canopystate_inst)
call t_stopf('interpMonthlyVeg')
end if

else

! Determine weights for time interpolation of monthly vegetation data.
! This also determines whether it is time to read new monthly vegetation and
! obtain updated leaf area index [mlai1,mlai2], stem area index [msai1,msai2],
! vegetation top [mhvt1,mhvt2] and vegetation bottom [mhvb1,mhvb2]. The
! weights obtained here are used in subroutine SatellitePhenology to obtain time
! interpolated values.
if (doalb .or. ( n_drydep > 0 .and. drydep_method == DD_XLND ) .or. use_fates_sp) then
! This is also done for FATES-SP mode above
if ( doalb .or. ( n_drydep > 0 .and. drydep_method == DD_XLND ) )then
call t_startf('interpMonthlyVeg')
call interpMonthlyVeg(bounds_proc, canopystate_inst)
call t_stopf('interpMonthlyVeg')
Expand Down
Loading