Skip to content

Commit 739e17f

Browse files
committed
Merge tag 'sci.1.81.1_api.38.0.0' into refactor-history-2-dev5
Migrate parameter file switches to the host land models namelists This includes merge commits for both NGEET#1344 and NGEET#1300
2 parents 307449d + 6903518 commit 739e17f

34 files changed

+6540
-326
lines changed

biogeochem/EDCanopyStructureMod.F90

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ module EDCanopyStructureMod
2727
use FatesCohortMod, only : fates_cohort_type
2828
use EDParamsMod , only : nclmax
2929
use EDParamsMod , only : nlevleaf
30-
use EDParamsMod , only : radiation_model
3130
use EDtypesMod , only : AREA
3231
use EDLoggingMortalityMod , only : UpdateHarvestC
3332
use FatesGlobals , only : endrun => fates_endrun
@@ -1314,10 +1313,11 @@ subroutine canopy_summarization( nsites, sites, bc_in )
13141313
! ---------------------------------------------------------------------------------
13151314

13161315
use FatesInterfaceTypesMod , only : hlm_use_cohort_age_tracking
1316+
use FatesInterfaceTypesMod , only : hlm_radiation_model
13171317
use FatesSizeAgeTypeIndicesMod, only : sizetype_class_index
13181318
use FatesSizeAgeTypeIndicesMod, only : coagetype_class_index
1319-
use EDtypesMod , only : area
1320-
use FatesConstantsMod , only : itrue
1319+
use EDtypesMod , only : area
1320+
use FatesConstantsMod , only : itrue
13211321

13221322
! !ARGUMENTS
13231323
integer , intent(in) :: nsites
@@ -1451,7 +1451,7 @@ subroutine canopy_summarization( nsites, sites, bc_in )
14511451

14521452
call leaf_area_profile(sites(s))
14531453

1454-
if(radiation_model.eq.twostr_solver) then
1454+
if(hlm_radiation_model.eq.twostr_solver) then
14551455
call FatesConstructRadElements(sites(s),bc_in(s)%fcansno_pa,bc_in(s)%coszen_pa)
14561456
end if
14571457

@@ -2266,6 +2266,13 @@ subroutine UpdateCohortLAI(currentCohort, canopy_layer_tlai, total_canopy_area)
22662266

22672267
! Number of actual vegetation layers in this cohort's crown
22682268
currentCohort%nv = count((currentCohort%treelai+currentCohort%treesai) .gt. dlower_vai(:)) + 1
2269+
2270+
if( currentCohort%nv .ne. minloc(dlower_vai, DIM=1, MASK=(dlower_vai>(currentCohort%treelai+currentCohort%treesai))) ) then
2271+
write(fates_log(),*) 'We use two methods of finding maximum leaf layers, and they are not equivalent'
2272+
write(fates_log(),*) 'count method:',currentCohort%nv
2273+
write(fates_log(),*) 'minloc method:',minloc(dlower_vai, DIM=1, MASK=(dlower_vai>(currentCohort%treelai+currentCohort%treesai)))
2274+
call endrun(msg=errMsg(sourcefile, __LINE__))
2275+
end if
22692276

22702277
end subroutine UpdateCohortLAI
22712278

biogeochem/EDMortalityFunctionsMod.F90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module EDMortalityFunctionsMod
1212
use FatesCohortMod , only : fates_cohort_type
1313
use EDTypesMod , only : ed_site_type
1414
use EDParamsMod, only : maxpft
15-
use EDParamsMod , only : mort_cstarvation_model
1615
use FatesConstantsMod , only : itrue,ifalse
1716
use FatesConstantsMod , only : cstarvation_model_lin
1817
use FatesConstantsMod , only : cstarvation_model_exp
@@ -68,6 +67,7 @@ subroutine mortality_rates( cohort_in,bc_in, btran_ft, mean_temp, &
6867
use FatesConstantsMod, only : fates_check_param_set
6968
use DamageMainMod, only : GetDamageMortality
7069
use EDParamsmod, only : soil_tfrz_thresh
70+
use FatesInterfaceTypesMod, only : hlm_mort_cstarvation_model
7171

7272
type (fates_cohort_type), intent(in) :: cohort_in
7373
type (bc_in_type), intent(in) :: bc_in
@@ -204,7 +204,7 @@ subroutine mortality_rates( cohort_in,bc_in, btran_ft, mean_temp, &
204204
call storage_fraction_of_target(target_leaf_c, store_c, frac)
205205

206206
! Select the carbon starvation mortality model (linear or exponential)s.
207-
select case (mort_cstarvation_model)
207+
select case (hlm_mort_cstarvation_model)
208208
case (cstarvation_model_lin)
209209
! Linear model. Carbon starvation mortality will be zero when fraction of
210210
! storage is greater than or equal to mort_upthresh_cstarvation, and will
@@ -223,7 +223,7 @@ subroutine mortality_rates( cohort_in,bc_in, btran_ft, mean_temp, &
223223

224224
case default
225225
write(fates_log(),*) &
226-
'Invalid carbon starvation model (',mort_cstarvation_model,').'
226+
'Invalid carbon starvation model (',hlm_mort_cstarvation_model,').'
227227
call endrun(msg=errMsg(sourcefile, __LINE__))
228228
end select
229229

biogeochem/EDPatchDynamicsMod.F90

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module EDPatchDynamicsMod
3030
use EDTypesMod , only : elem_diag_type
3131
use EDTypesMod , only : min_patch_area
3232
use EDTypesMod , only : min_patch_area_forced
33-
use EDParamsMod , only : regeneration_model
33+
use FatesInterfaceTypesMod, only : hlm_regeneration_model
3434
use FatesInterfaceTypesMod, only : numpft
3535
use FatesConstantsMod , only : dtype_ifall
3636
use FatesConstantsMod , only : dtype_ilog
@@ -682,7 +682,7 @@ subroutine spawn_patches( currentSite, bc_in)
682682

683683
call newPatch%Create(age, site_areadis, i_landusechange_receiverpatchlabel, i_nocomp_pft, &
684684
num_swb, numpft, currentSite%nlevsoil, hlm_current_tod, &
685-
regeneration_model)
685+
hlm_regeneration_model)
686686

687687
! Initialize the litter pools to zero, these
688688
! pools will be populated by looping over the existing patches
@@ -1371,7 +1371,7 @@ subroutine spawn_patches( currentSite, bc_in)
13711371

13721372
call buffer_patch%Create(0._r8, 0._r8, i_land_use_label, 0, &
13731373
num_swb, numpft, currentSite%nlevsoil, hlm_current_tod, &
1374-
regeneration_model)
1374+
hlm_regeneration_model)
13751375

13761376
! Initialize the litter pools to zero
13771377
do el=1,num_elements
@@ -1559,7 +1559,7 @@ subroutine spawn_patches( currentSite, bc_in)
15591559
if ( .not. buffer_patch_in_linked_list) then
15601560
if (buffer_patch%area .lt. rsnbl_math_prec) then
15611561
! here we need to deallocate the buffer patch so that we don't get a memory leak.
1562-
call buffer_patch%FreeMemory(regeneration_model, numpft)
1562+
call buffer_patch%FreeMemory(hlm_regeneration_model, numpft)
15631563
deallocate(buffer_patch, stat=istat, errmsg=smsg)
15641564
if (istat/=0) then
15651565
write(fates_log(),*) 'dealloc: fail on deallocate(dp):'//trim(smsg)
@@ -1576,7 +1576,7 @@ subroutine spawn_patches( currentSite, bc_in)
15761576
end if
15771577
else
15781578
! buffer patch was never even used. deallocate.
1579-
call buffer_patch%FreeMemory(regeneration_model, numpft)
1579+
call buffer_patch%FreeMemory(hlm_regeneration_model, numpft)
15801580
deallocate(buffer_patch, stat=istat, errmsg=smsg)
15811581
if (istat/=0) then
15821582
write(fates_log(),*) 'dealloc: fail on deallocate(dp):'//trim(smsg)
@@ -1664,7 +1664,7 @@ subroutine split_patch(currentSite, currentPatch, new_patch, fraction_to_keep, a
16641664
call new_patch%Create(0._r8, temp_area, &
16651665
currentPatch%land_use_label, currentPatch%nocomp_pft_label, &
16661666
num_swb, numpft, currentSite%nlevsoil, hlm_current_tod, &
1667-
regeneration_model)
1667+
hlm_regeneration_model)
16681668

16691669
! Initialize the litter pools to zero, these
16701670
! pools will be populated shortly
@@ -3188,7 +3188,7 @@ subroutine fuse_2_patches(csite, dp, rp)
31883188
call rp%tveg24%FuseRMean(dp%tveg24,rp%area*inv_sum_area)
31893189
call rp%tveg_lpa%FuseRMean(dp%tveg_lpa,rp%area*inv_sum_area)
31903190

3191-
if ( regeneration_model == TRS_regeneration ) then
3191+
if ( hlm_regeneration_model == TRS_regeneration ) then
31923192
call rp%seedling_layer_par24%FuseRMean(dp%seedling_layer_par24,rp%area*inv_sum_area)
31933193
call rp%sdlng_mort_par%FuseRMean(dp%sdlng_mort_par,rp%area*inv_sum_area)
31943194
call rp%sdlng2sap_par%FuseRMean(dp%sdlng2sap_par,rp%area*inv_sum_area)
@@ -3259,7 +3259,7 @@ subroutine fuse_2_patches(csite, dp, rp)
32593259
end if
32603260

32613261
! We have no need for the dp pointer anymore, we have passed on it's legacy
3262-
call dp%FreeMemory(regeneration_model, numpft)
3262+
call dp%FreeMemory(hlm_regeneration_model, numpft)
32633263
deallocate(dp, stat=istat, errmsg=smsg)
32643264
if (istat/=0) then
32653265
write(fates_log(),*) 'dealloc006: fail on deallocate(dp):'//trim(smsg)
@@ -3810,7 +3810,7 @@ subroutine CopyPatchMeansTimers(dp, rp)
38103810
call rp%tveg_lpa%CopyFromDonor(dp%tveg_lpa)
38113811
call rp%tveg_longterm%CopyFromDonor(dp%tveg_longterm)
38123812

3813-
if ( regeneration_model == TRS_regeneration ) then
3813+
if ( hlm_regeneration_model == TRS_regeneration ) then
38143814
call rp%seedling_layer_par24%CopyFromDonor(dp%seedling_layer_par24)
38153815
call rp%sdlng_mort_par%CopyFromDonor(dp%sdlng_mort_par)
38163816
call rp%sdlng2sap_par%CopyFromDonor(dp%sdlng2sap_par)

biogeochem/EDPhysiologyMod.F90

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ module EDPhysiologyMod
9898
use EDParamsMod , only : q10_mr
9999
use EDParamsMod , only : q10_froz
100100
use EDParamsMod , only : logging_export_frac
101-
use EDParamsMod , only : regeneration_model
102101
use EDParamsMod , only : sdlng_mort_par_timescale
103102
use FatesPlantHydraulicsMod , only : AccumulateMortalityWaterStorage
104103
use FatesConstantsMod , only : itrue,ifalse
@@ -143,7 +142,8 @@ module EDPhysiologyMod
143142
use FatesParameterDerivedMod, only : param_derived
144143
use FatesPlantHydraulicsMod, only : InitHydrCohort
145144
use PRTInitParamsFatesMod, only : NewRecruitTotalStoichiometry
146-
use FatesInterfaceTypesMod , only : hlm_use_luh
145+
use FatesInterfaceTypesMod, only : hlm_use_luh
146+
use FatesInterfaceTypesMod, only : hlm_regeneration_model
147147

148148
implicit none
149149
private
@@ -2157,7 +2157,7 @@ subroutine SeedUpdate( currentSite )
21572157
litt%seed_in_local(pft) = litt%seed_in_local(pft) + site_seed_rain(pft)*(1.0_r8-site_disp_frac(pft))/area ![kg/m2/day]
21582158

21592159
! If we are using the Tree Recruitment Scheme (TRS) with or w/o seedling dynamics
2160-
if ( any(regeneration_model == [TRS_regeneration, TRS_no_seedling_dyn]) .and. &
2160+
if ( any(hlm_regeneration_model == [TRS_regeneration, TRS_no_seedling_dyn]) .and. &
21612161
prt_params%allom_dbh_maxheight(pft) > min_max_dbh_for_trees) then
21622162

21632163
! Send a fraction of reproductive carbon to litter to account for
@@ -2215,7 +2215,7 @@ subroutine SeedDecay( litt , currentPatch, bc_in )
22152215
!
22162216
! !DESCRIPTION:
22172217
! 1. Flux from seed pool into leaf litter pool
2218-
! 2. If the TRS with seedling dynamics is on (regeneration_model = 3)
2218+
! 2. If the TRS with seedling dynamics is on (hlm_regeneration_model = 3)
22192219
! then we calculate seedling mortality here (i.e. flux from seedling pool
22202220
! (into leaf litter pool)
22212221
!
@@ -2249,7 +2249,7 @@ subroutine SeedDecay( litt , currentPatch, bc_in )
22492249

22502250
! If the TRS is switched off or the pft can't get big enough to be considered a tree
22512251
! then use FATES default regeneration.
2252-
if ( regeneration_model == default_regeneration .or. &
2252+
if ( hlm_regeneration_model == default_regeneration .or. &
22532253
prt_params%allom_dbh_maxheight(pft) < min_max_dbh_for_trees ) then
22542254

22552255
! Default seed decay (TRS is off)
@@ -2261,7 +2261,7 @@ subroutine SeedDecay( litt , currentPatch, bc_in )
22612261
! If the TRS is switched on and the pft is a tree then add non-seed reproductive biomass
22622262
! to the seed decay flux. This was added to litt%seed_decay in the previously called SeedIn
22632263
! subroutine
2264-
if ( any(regeneration_model == [TRS_regeneration, TRS_no_seedling_dyn]) .and. &
2264+
if ( any(hlm_regeneration_model == [TRS_regeneration, TRS_no_seedling_dyn]) .and. &
22652265
prt_params%allom_dbh_maxheight(pft) > min_max_dbh_for_trees ) then
22662266

22672267
litt%seed_decay(pft) = litt%seed_decay(pft) + &! From non-seed reproductive biomass (added in
@@ -2271,9 +2271,9 @@ subroutine SeedDecay( litt , currentPatch, bc_in )
22712271
end if
22722272

22732273

2274-
! If the TRS is switched on with seedling dynamics (regeneration_model = 2)
2274+
! If the TRS is switched on with seedling dynamics (hlm_regeneration_model = 2)
22752275
! then calculate seedling mortality.
2276-
if_trs_germ_decay: if ( regeneration_model == TRS_regeneration .and. &
2276+
if_trs_germ_decay: if ( hlm_regeneration_model == TRS_regeneration .and. &
22772277
prt_params%allom_dbh_maxheight(pft) > min_max_dbh_for_trees ) then
22782278

22792279
!----------------------------------------------------------------------
@@ -2379,16 +2379,16 @@ subroutine SeedGermination( litt, cold_stat, drought_stat, bc_in, currentPatch )
23792379

23802380
! If the TRS's seedling dynamics is switched off, then we use FATES's default approach
23812381
! to germination
2382-
if_tfs_or_def: if ( regeneration_model == default_regeneration .or. &
2383-
regeneration_model == TRS_no_seedling_dyn .or. &
2382+
if_tfs_or_def: if ( hlm_regeneration_model == default_regeneration .or. &
2383+
hlm_regeneration_model == TRS_no_seedling_dyn .or. &
23842384
prt_params%allom_dbh_maxheight(pft) < min_max_dbh_for_trees ) then
23852385

23862386
litt%seed_germ_in(pft) = min(litt%seed(pft) * EDPftvarcon_inst%germination_rate(pft), &
23872387
max_germination)*years_per_day
23882388

23892389
! If TRS seedling dynamics is switched on we calculate seedling emergence (i.e. germination)
23902390
! as a pft-specific function of understory light and soil moisture.
2391-
else if ( regeneration_model == TRS_regeneration .and. &
2391+
else if ( hlm_regeneration_model == TRS_regeneration .and. &
23922392
prt_params%allom_dbh_maxheight(pft) > min_max_dbh_for_trees ) then
23932393

23942394
! Step 1. Calculate how germination rate is modified by understory light
@@ -2634,15 +2634,15 @@ subroutine recruitment(currentSite, currentPatch, bc_in)
26342634

26352635
! If TRS seedling dynamics is switched off then the available mass to make new recruits
26362636
! is everything in the seed_germ pool.
2637-
if (regeneration_model == default_regeneration .or. &
2638-
regeneration_model == TRS_no_seedling_dyn .or. &
2637+
if (hlm_regeneration_model == default_regeneration .or. &
2638+
hlm_regeneration_model == TRS_no_seedling_dyn .or. &
26392639
prt_params%allom_dbh_maxheight(ft) < min_max_dbh_for_trees) then
26402640

26412641
mass_avail = currentPatch%area * currentPatch%litter(el)%seed_germ(ft)
26422642

26432643
! If TRS seedling dynamics is on then calculate the available mass to make new recruits
26442644
! as a pft-specific function of light and soil moisture in the seedling layer.
2645-
else if (regeneration_model == TRS_regeneration .and. &
2645+
else if (hlm_regeneration_model == TRS_regeneration .and. &
26462646
prt_params%allom_dbh_maxheight(ft) > min_max_dbh_for_trees) then
26472647

26482648
sdlng2sap_par = currentPatch%sdlng2sap_par%GetMean()* &
@@ -2799,7 +2799,9 @@ subroutine CWDInput( currentSite, currentPatch, litt, bc_in)
27992799
! and turnover in dying trees.
28002800
!
28012801
! !USES:
2802-
2802+
use EDParamsMod , only : landuse_grazing_carbon_use_eff
2803+
use EDParamsMod , only : landuse_grazing_nitrogen_use_eff
2804+
use EDParamsMod , only : landuse_grazing_phosphorus_use_eff
28032805
!
28042806
! !ARGUMENTS
28052807
type(ed_site_type), intent(inout), target :: currentSite
@@ -2846,6 +2848,8 @@ subroutine CWDInput( currentSite, currentPatch, litt, bc_in)
28462848
integer :: numlevsoil ! Actual number of soil layers
28472849

28482850
real(r8) :: SF_val_CWD_frac_adj(4) !SF_val_CWD_frac adjusted based on cohort dbh
2851+
real(r8) :: leaf_herbivory ! leaf that is eaten by grazers [kg]
2852+
real(r8) :: herbivory_element_use_efficiency ! fraction of grazed biomass that is returned to litter pool versus atmosphere
28492853
!----------------------------------------------------------------------
28502854

28512855
! -----------------------------------------------------------------------------------
@@ -2856,6 +2860,15 @@ subroutine CWDInput( currentSite, currentPatch, litt, bc_in)
28562860

28572861
element_id = litt%element_id
28582862

2863+
select case(element_id)
2864+
case (carbon12_element)
2865+
herbivory_element_use_efficiency = landuse_grazing_carbon_use_eff
2866+
case (nitrogen_element)
2867+
herbivory_element_use_efficiency = landuse_grazing_nitrogen_use_eff
2868+
case (phosphorus_element)
2869+
herbivory_element_use_efficiency = landuse_grazing_phosphorus_use_eff
2870+
end select
2871+
28592872
! Object tracking flux diagnostics for each element
28602873
elflux_diags => currentSite%flux_diags%elem(element_pos(element_id))
28612874

@@ -2881,6 +2894,8 @@ subroutine CWDInput( currentSite, currentPatch, litt, bc_in)
28812894
fnrt_m = currentCohort%prt%GetState(fnrt_organ,element_id)
28822895
repro_m = currentCohort%prt%GetState(repro_organ,element_id)
28832896

2897+
leaf_herbivory = currentCohort%prt%GetHerbivory(leaf_organ, element_id)
2898+
28842899
if (prt_params%woody(currentCohort%pft) == itrue) then
28852900
! Assumption: for woody plants fluxes from deadwood and sapwood go together in CWD pool
28862901
leaf_m_turnover = currentCohort%prt%GetTurnover(leaf_organ,element_id)
@@ -2925,7 +2940,9 @@ subroutine CWDInput( currentSite, currentPatch, litt, bc_in)
29252940
do dcmpy=1,ndcmpy
29262941
dcmpy_frac = GetDecompyFrac(pft,leaf_organ,dcmpy)
29272942
litt%leaf_fines_in(dcmpy) = litt%leaf_fines_in(dcmpy) + &
2928-
(leaf_m_turnover+repro_m_turnover) * plant_dens * dcmpy_frac
2943+
(leaf_m_turnover+repro_m_turnover + &
2944+
leaf_herbivory * herbivory_element_use_efficiency) * &
2945+
plant_dens * dcmpy_frac
29292946

29302947
dcmpy_frac = GetDecompyFrac(pft,fnrt_organ,dcmpy)
29312948
do ilyr = 1, numlevsoil
@@ -2938,6 +2955,11 @@ subroutine CWDInput( currentSite, currentPatch, litt, bc_in)
29382955
elflux_diags%root_litter_input(pft) + &
29392956
(fnrt_m_turnover + store_m_turnover ) * currentCohort%n
29402957

2958+
! send the part of the herbivory flux that doesn't go to litter to the atmosphere
2959+
2960+
site_mass%herbivory_flux_out = &
2961+
site_mass%herbivory_flux_out + &
2962+
leaf_herbivory * (1._r8 - herbivory_element_use_efficiency) * currentCohort%n
29412963

29422964
! Assumption: turnover from deadwood and sapwood are lumped together in CWD pool
29432965

0 commit comments

Comments
 (0)