Skip to content

Commit 2e73ba8

Browse files
committed
resolved trivial merge conflict
2 parents 9f8b19a + 7ce1c5c commit 2e73ba8

22 files changed

+3562
-702
lines changed

biogeochem/EDCanopyStructureMod.F90

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module EDCanopyStructureMod
2525
use FatesInterfaceMod , only : hlm_days_per_year
2626
use FatesInterfaceMod , only : hlm_use_planthydro
2727
use FatesInterfaceMod , only : numpft
28-
use FatesPlantHydraulicsMod, only : UpdateH2OVeg,InitHydrCohort
28+
use FatesPlantHydraulicsMod, only : UpdateH2OVeg,InitHydrCohort, RecruitWaterStorage
2929
use EDTypesMod , only : maxCohortsPerPatch
3030

3131
use PRTGenericMod, only : leaf_organ
@@ -587,6 +587,7 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr)
587587
! demoted to the understory
588588

589589
allocate(copyc)
590+
590591
call InitPRTCohort(copyc)
591592
if( hlm_use_planthydro.eq.itrue ) then
592593
call InitHydrCohort(currentSite,copyc)
@@ -1011,6 +1012,7 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
10111012
elseif ( cc_gain > nearzero .and. cc_gain < currentCohort%c_area) then
10121013

10131014
allocate(copyc)
1015+
10141016
call InitPRTCohort(copyc)
10151017
if( hlm_use_planthydro.eq.itrue ) then
10161018
call InitHydrCohort(CurrentSite,copyc)
@@ -1920,6 +1922,7 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out)
19201922

19211923
! If hydraulics is turned on, update the amount of water bound in vegetation
19221924
if (hlm_use_planthydro.eq.itrue) then
1925+
call RecruitWaterStorage(nsites,sites,bc_out)
19231926
call UpdateH2OVeg(nsites,sites,bc_out)
19241927
end if
19251928

biogeochem/EDCohortDynamicsMod.F90

Lines changed: 72 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module EDCohortDynamicsMod
88
use FatesGlobals , only : fates_log
99
use FatesInterfaceMod , only : hlm_freq_day
1010
use FatesInterfaceMod , only : bc_in_type
11+
use FatesInterfaceMod , only : hlm_use_planthydro
1112
use FatesConstantsMod , only : r8 => fates_r8
1213
use FatesConstantsMod , only : fates_unset_int
1314
use FatesConstantsMod , only : itrue,ifalse
@@ -21,6 +22,7 @@ module EDCohortDynamicsMod
2122
use EDTypesMod , only : min_npm2, min_nppatch
2223
use EDTypesMod , only : min_n_safemath
2324
use EDTypesMod , only : nlevleaf
25+
use EDTypesMod , only : ican_upper
2426
use FatesInterfaceMod , only : hlm_use_planthydro
2527
use FatesInterfaceMod , only : hlm_parteh_mode
2628
use FatesPlantHydraulicsMod, only : FuseCohortHydraulics
@@ -30,6 +32,9 @@ module EDCohortDynamicsMod
3032
use FatesPlantHydraulicsMod, only : InitHydrCohort
3133
use FatesPlantHydraulicsMod, only : DeallocateHydrCohort
3234
use FatesPlantHydraulicsMod, only : AccumulateMortalityWaterStorage
35+
use FatesPlantHydraulicsMod, only : UpdateTreeHydrNodes
36+
use FatesPlantHydraulicsMod, only : UpdateTreeHydrLenVolCond
37+
use FatesPlantHydraulicsMod, only : SavePreviousCompartmentVolumes
3338
use FatesSizeAgeTypeIndicesMod, only : sizetype_class_index
3439
use FatesAllometryMod , only : bleaf
3540
use FatesAllometryMod , only : bfineroot
@@ -97,6 +102,13 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, dbh, bleaf, bfine
97102
!
98103
! !DESCRIPTION:
99104
! create new cohort
105+
! There are 4 places this is called
106+
! 1) Initializing new cohorts at the beginning of a cold-start simulation
107+
! 2) Initializing new recruits during dynamics
108+
! 3) Initializing new cohorts at the beginning of a inventory read
109+
! 4) Initializing new cohorts during restart
110+
!
111+
! It is assumed that in the first 3, this is called with a reasonable amount of starter information.
100112
!
101113
! !USES:
102114
!
@@ -124,7 +136,8 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, dbh, bleaf, bfine
124136
! !LOCAL VARIABLES:
125137
type(ed_cohort_type), pointer :: new_cohort ! Pointer to New Cohort structure.
126138
type(ed_cohort_type), pointer :: storesmallcohort
127-
type(ed_cohort_type), pointer :: storebigcohort
139+
type(ed_cohort_type), pointer :: storebigcohort
140+
integer :: nlevsoi_hyd ! number of hydraulically active soil layers
128141
integer :: tnull,snull ! are the tallest and shortest cohorts allocate
129142
!----------------------------------------------------------------------
130143

@@ -241,12 +254,31 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, dbh, bleaf, bfine
241254
new_cohort%isnew = .true.
242255

243256
if( hlm_use_planthydro.eq.itrue ) then
244-
call InitHydrCohort(CurrentSite,new_cohort)
245-
call updateSizeDepTreeHydProps(CurrentSite,new_cohort, bc_in)
246-
call initTreeHydStates(CurrentSite,new_cohort, bc_in)
257+
258+
nlevsoi_hyd = currentSite%si_hydr%nlevsoi_hyd
259+
260+
! This allocates array spaces
261+
call InitHydrCohort(currentSite,new_cohort)
262+
263+
! This calculates node heights
264+
call UpdateTreeHydrNodes(new_cohort%co_hydr,new_cohort%pft, &
265+
new_cohort%hite,nlevsoi_hyd,bc_in)
266+
267+
! This calculates volumes, lengths and max conductances
268+
call UpdateTreeHydrLenVolCond(new_cohort,nlevsoi_hyd,bc_in)
269+
270+
! Since this is a newly initialized plant, we set the previous compartment-size
271+
! equal to the ones we just calculated.
272+
call SavePreviousCompartmentVolumes(new_cohort%co_hydr)
273+
274+
! This comes up with starter suctions and then water contents
275+
! based on the soil values
276+
call initTreeHydStates(currentSite,new_cohort, bc_in)
277+
247278
if(recruitstatus==1)then
248-
new_cohort%co_hydr%is_newly_recuited = .true.
279+
new_cohort%co_hydr%is_newly_recruited = .true.
249280
endif
281+
250282
endif
251283

252284
call insert_cohort(new_cohort, patchptr%tallest, patchptr%shortest, tnull, snull, &
@@ -602,19 +634,26 @@ subroutine terminate_cohorts( currentSite, currentPatch, level )
602634
endif ! if (.not.currentCohort%isnew .and. level == 2) then
603635

604636
if (terminate == 1) then
637+
605638
! preserve a record of the to-be-terminated cohort for mortality accounting
606-
if (currentCohort%canopy_layer .eq. 1) then
607-
levcan = 1
608-
else
609-
levcan = 2
610-
endif
639+
levcan = currentCohort%canopy_layer
611640

612-
currentSite%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) = &
613-
currentSite%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) + currentCohort%n
614-
!
615-
currentSite%termination_carbonflux(levcan) = currentSite%termination_carbonflux(levcan) + &
616-
currentCohort%n * (struct_c+sapw_c+leaf_c+fnrt_c+store_c+repro_c)
617-
641+
if( hlm_use_planthydro == itrue ) &
642+
call AccumulateMortalityWaterStorage(currentSite,currentCohort,currentCohort%n)
643+
644+
if(levcan==ican_upper) then
645+
currentSite%term_nindivs_canopy(currentCohort%size_class,currentCohort%pft) = &
646+
currentSite%term_nindivs_canopy(currentCohort%size_class,currentCohort%pft) + currentCohort%n
647+
648+
currentSite%term_carbonflux_canopy = currentSite%term_carbonflux_canopy + &
649+
currentCohort%n * (struct_c+sapw_c+leaf_c+fnrt_c+store_c+repro_c)
650+
else
651+
currentSite%term_nindivs_ustory(currentCohort%size_class,currentCohort%pft) = &
652+
currentSite%term_nindivs_ustory(currentCohort%size_class,currentCohort%pft) + currentCohort%n
653+
654+
currentSite%term_carbonflux_ustory = currentSite%term_carbonflux_ustory + &
655+
currentCohort%n * (struct_c+sapw_c+leaf_c+fnrt_c+store_c+repro_c)
656+
end if
618657

619658
!put the litter from the terminated cohorts straight into the fragmenting pools
620659
if (currentCohort%n.gt.0.0_r8) then
@@ -729,6 +768,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
729768
real(r8) :: newn
730769
real(r8) :: diff
731770
real(r8) :: dynamic_fusion_tolerance
771+
real(r8) :: leaf_c ! leaf carbon [kg]
732772

733773
integer :: largersc, smallersc, sc_i ! indices for tracking the growth flux caused by fusion
734774
real(r8) :: larger_n, smaller_n
@@ -845,8 +885,11 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
845885

846886
call sizetype_class_index(currentCohort%dbh,currentCohort%pft, &
847887
currentCohort%size_class,currentCohort%size_by_pft_class)
888+
848889

849-
if(hlm_use_planthydro.eq.itrue) call FuseCohortHydraulics(currentSite,currentCohort,nextc,bc_in,newn)
890+
if(hlm_use_planthydro.eq.itrue) then
891+
call FuseCohortHydraulics(currentSite,currentCohort,nextc,bc_in,newn)
892+
endif
850893

851894
! recent canopy history
852895
currentCohort%canopy_layer_yesterday = (currentCohort%n*currentCohort%canopy_layer_yesterday + &
@@ -927,7 +970,6 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
927970
currentCohort%cmort = (currentCohort%n*currentCohort%cmort + nextc%n*nextc%cmort)/newn
928971
currentCohort%hmort = (currentCohort%n*currentCohort%hmort + nextc%n*nextc%hmort)/newn
929972
currentCohort%bmort = (currentCohort%n*currentCohort%bmort + nextc%n*nextc%bmort)/newn
930-
currentCohort%fmort = (currentCohort%n*currentCohort%fmort + nextc%n*nextc%fmort)/newn
931973
currentCohort%frmort = (currentCohort%n*currentCohort%frmort + nextc%n*nextc%frmort)/newn
932974

933975
! logging mortality, Yi Xu
@@ -976,7 +1018,18 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
9761018
endif
9771019

9781020
! At this point, nothing should be pointing to current Cohort
979-
if (hlm_use_planthydro.eq.itrue) call DeallocateHydrCohort(nextc)
1021+
! update hydraulics quantities that are functions of hite & biomasses
1022+
! deallocate the hydro structure of nextc
1023+
if (hlm_use_planthydro.eq.itrue) then
1024+
call carea_allom(currentCohort%dbh,currentCohort%n,currentSite%spread, &
1025+
currentCohort%pft,currentCohort%c_area)
1026+
leaf_c = currentCohort%prt%GetState(leaf_organ, all_carbon_elements)
1027+
currentCohort%treelai = tree_lai(leaf_c, &
1028+
currentCohort%pft, currentCohort%c_area, currentCohort%n, &
1029+
currentCohort%canopy_layer, currentPatch%canopy_layer_tlai )
1030+
call updateSizeDepTreeHydProps(currentSite,currentCohort, bc_in)
1031+
call DeallocateHydrCohort(nextc)
1032+
endif
9801033

9811034
! Deallocate the cohort's PRT structure
9821035
call nextc%prt%DeallocatePRTVartypes()
@@ -1303,7 +1356,6 @@ subroutine copy_cohort( currentCohort,copyc )
13031356
! Mortality diagnostics
13041357
n%cmort = o%cmort
13051358
n%bmort = o%bmort
1306-
n%fmort = o%fmort
13071359
n%hmort = o%hmort
13081360
n%frmort = o%frmort
13091361

biogeochem/EDMortalityFunctionsMod.F90

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module EDMortalityFunctionsMod
1616
use FatesInterfaceMod , only : bc_in_type
1717
use FatesInterfaceMod , only : hlm_use_ed_prescribed_phys
1818
use FatesInterfaceMod , only : hlm_freq_day
19+
use FatesInterfaceMod , only : hlm_use_planthydro
1920
use EDLoggingMortalityMod , only : LoggingMortality_frac
2021
use EDParamsMod , only : fates_mortality_disturbance_fraction
2122
use FatesInterfaceMod , only : bc_in_type
@@ -62,8 +63,14 @@ subroutine mortality_rates( cohort_in,bc_in,cmort,hmort,bmort,frmort )
6263
real(r8) :: leaf_c_target ! target leaf biomass kgC
6364
real(r8) :: store_c
6465
real(r8) :: hf_sm_threshold ! hydraulic failure soil moisture threshold
66+
real(r8) :: hf_flc_threshold ! hydraulic failure fractional loss of conductivity threshold
6567
real(r8) :: temp_dep_fraction ! Temp. function (freezing mortality)
6668
real(r8) :: temp_in_C ! Daily averaged temperature in Celcius
69+
real(r8) :: min_fmc_ag ! minimum fraction of maximum conductivity for aboveground
70+
real(r8) :: min_fmc_tr ! minimum fraction of maximum conductivity for transporting root
71+
real(r8) :: min_fmc_ar ! minimum fraction of maximum conductivity for absorbing root
72+
real(r8) :: min_fmc ! minimum fraction of maximum conductivity for whole plant
73+
real(r8) :: flc ! fractional loss of conductivity
6774
real(r8), parameter :: frost_mort_buffer = 5.0_r8 ! 5deg buffer for freezing mortality
6875
logical, parameter :: test_zero_mortality = .false. ! Developer test which
6976
! may help to debug carbon imbalances
@@ -77,12 +84,28 @@ subroutine mortality_rates( cohort_in,bc_in,cmort,hmort,bmort,frmort )
7784

7885
! Proxy for hydraulic failure induced mortality.
7986
hf_sm_threshold = EDPftvarcon_inst%hf_sm_threshold(cohort_in%pft)
80-
81-
if(cohort_in%patchptr%btran_ft(cohort_in%pft) <= hf_sm_threshold)then
87+
hf_flc_threshold = EDPftvarcon_inst%hf_flc_threshold(cohort_in%pft)
88+
if(hlm_use_planthydro.eq.itrue)then
89+
!note the flc is set as the fraction of max conductivity in hydro
90+
min_fmc_ag = minval(cohort_in%co_hydr%flc_ag(:))
91+
min_fmc_tr = minval(cohort_in%co_hydr%flc_troot(:))
92+
min_fmc_ar = minval(cohort_in%co_hydr%flc_aroot(:))
93+
min_fmc = min(min_fmc_ag, min_fmc_tr)
94+
min_fmc = min(min_fmc, min_fmc_ar)
95+
flc = 1.0_r8-min_fmc
96+
if(flc >= hf_flc_threshold .and. hf_flc_threshold < 1.0_r8 )then
97+
hmort = (flc-hf_flc_threshold)/(1.0_r8-hf_flc_threshold) * &
98+
EDPftvarcon_inst%mort_scalar_hydrfailure(cohort_in%pft)
99+
else
100+
hmort = 0.0_r8
101+
endif
102+
else
103+
if(cohort_in%patchptr%btran_ft(cohort_in%pft) <= hf_sm_threshold)then
82104
hmort = EDPftvarcon_inst%mort_scalar_hydrfailure(cohort_in%pft)
83105
else
84106
hmort = 0.0_r8
85-
endif
107+
endif
108+
endif
86109

87110
! Carbon Starvation induced mortality.
88111
if ( cohort_in%dbh > 0._r8 ) then

0 commit comments

Comments
 (0)