Skip to content

Commit e7e93fd

Browse files
authored
Merge pull request #343 from xuchongang/bchristo-planthydro-longlived
Bchristo planthydro longlived
2 parents d5e94de + 59611ba commit e7e93fd

18 files changed

+4631
-291
lines changed

biogeochem/EDCanopyStructureMod.F90

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module EDCanopyStructureMod
66
! =====================================================================================
77

88
use FatesConstantsMod , only : r8 => fates_r8
9+
use FatesConstantsMod , only : itrue, ifalse
910
use FatesGlobals , only : fates_log
1011
use EDPftvarcon , only : EDPftvarcon_inst
1112
use FatesAllometryMod , only : carea_allom
@@ -18,8 +19,9 @@ module EDCanopyStructureMod
1819
use EDtypesMod , only : AREA
1920
use FatesGlobals , only : endrun => fates_endrun
2021
use FatesInterfaceMod , only : hlm_days_per_year
22+
use FatesInterfaceMod , only : hlm_use_planthydro
2123
use FatesInterfaceMod , only : numpft
22-
24+
use FatesPlantHydraulicsMod, only : UpdateH2OVeg,InitHydrCohort
2325

2426
! CIME Globals
2527
use shr_log_mod , only : errMsg => shr_log_errMsg
@@ -172,7 +174,7 @@ subroutine canopy_structure( currentSite , bc_in )
172174
! Remove cohorts that are incredibly sparse
173175
call terminate_cohorts(currentSite, currentPatch, 1)
174176

175-
call fuse_cohorts(currentPatch, bc_in)
177+
call fuse_cohorts(currentSite, currentPatch, bc_in)
176178

177179
! Remove cohorts for various other reasons
178180
call terminate_cohorts(currentSite, currentPatch, 2)
@@ -196,7 +198,7 @@ subroutine canopy_structure( currentSite , bc_in )
196198
! Remove cohorts that are incredibly sparse
197199
call terminate_cohorts(currentSite, currentPatch, 1)
198200

199-
call fuse_cohorts(currentPatch, bc_in)
201+
call fuse_cohorts(currentSite, currentPatch, bc_in)
200202

201203
! Remove cohorts for various other reasons
202204
call terminate_cohorts(currentSite, currentPatch, 2)
@@ -390,6 +392,9 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr)
390392
! otherwise currentPatch%spread(i_lyr+1) will be higher and the area will change...!!!
391393

392394
allocate(copyc)
395+
if( hlm_use_planthydro.eq.itrue ) then
396+
call InitHydrCohort(copyc)
397+
endif
393398
call copy_cohort(currentCohort, copyc) !
394399

395400
newarea = currentCohort%c_area - cc_loss
@@ -715,6 +720,9 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
715720
!-----------Split and copy boundary cohort-----------------!
716721
if(cc_gain < currentCohort%c_area)then
717722
allocate(copyc)
723+
if( hlm_use_planthydro.eq.itrue ) then
724+
call InitHydrCohort(copyc)
725+
endif
718726

719727
call copy_cohort(currentCohort, copyc) !makes an identical copy...
720728
! n.b this needs to happen BEFORE the cohort goes into the new layer, otherwise currentPatch
@@ -1588,10 +1596,14 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out)
15881596
if(abs(total_patch_area-1.0_r8)>1e-9)then
15891597
write(fates_log(),*) 'total area is wrong in update_hlm_dynamics',total_patch_area
15901598
endif
1591-
15921599

15931600
end do
15941601

1602+
! If hydraulics is turned on, update the amount of water bound in vegetation
1603+
if (hlm_use_planthydro.eq.itrue) then
1604+
call UpdateH2OVeg(nsites,sites,bc_out)
1605+
end if
1606+
15951607

15961608
end subroutine update_hlm_dynamics
15971609

biogeochem/EDCohortDynamicsMod.F90

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module EDCohortDynamicsMod
2929
use FatesPlantHydraulicsMod, only : initTreeHydStates
3030
use FatesPlantHydraulicsMod, only : InitHydrCohort
3131
use FatesPlantHydraulicsMod, only : DeallocateHydrCohort
32+
use FatesPlantHydraulicsMod, only : AccumulateMortalityWaterStorage
3233
use FatesSizeAgeTypeIndicesMod, only : sizetype_class_index
3334
use FatesAllometryMod , only : bsap_allom
3435
use FatesAllometryMod , only : bleaf
@@ -64,19 +65,23 @@ module EDCohortDynamicsMod
6465
contains
6566

6667
!-------------------------------------------------------------------------------------!
67-
subroutine create_cohort(patchptr, pft, nn, hite, dbh, bleaf, bfineroot, bsap, &
68-
bdead, bstore, laimemory, status, ctrim, clayer, spread, bc_in)
68+
69+
subroutine create_cohort(currentSite, patchptr, pft, nn, hite, dbh, bleaf, bfineroot, bsap, &
70+
bdead, bstore, laimemory, status, recruitstatus,ctrim, clayer, spread, bc_in)
71+
6972
!
7073
! !DESCRIPTION:
7174
! create new cohort
7275
!
7376
! !USES:
7477
!
7578
! !ARGUMENTS
79+
type(ed_site_type), intent(inout), target :: currentSite
7680
type(ed_patch_type), intent(inout), pointer :: patchptr
7781
integer, intent(in) :: pft ! Cohort Plant Functional Type
7882
integer, intent(in) :: clayer ! canopy status of cohort (1 = canopy, 2 = understorey, etc.)
7983
integer, intent(in) :: status ! growth status of plant (2 = leaves on , 1 = leaves off)
84+
integer, intent(in) :: recruitstatus ! recruit status of plant (1 = recruitment , 0 = other)
8085
real(r8), intent(in) :: nn ! number of individuals in cohort per 'area' (10000m2 default)
8186
real(r8), intent(in) :: hite ! height: meters
8287
real(r8), intent(in) :: dbh ! dbh: cm
@@ -89,6 +94,7 @@ subroutine create_cohort(patchptr, pft, nn, hite, dbh, bleaf, bfineroot, bsap, &
8994
real(r8), intent(in) :: ctrim ! What is the fraction of the maximum leaf biomass that we are targeting? :-
9095
real(r8), intent(in) :: spread ! The community assembly effects how spread crowns are in horizontal space
9196
type(bc_in_type), intent(in) :: bc_in ! External boundary conditions
97+
9298
!
9399
! !LOCAL VARIABLES:
94100
type(ed_cohort_type), pointer :: new_cohort ! Pointer to New Cohort structure.
@@ -180,7 +186,10 @@ subroutine create_cohort(patchptr, pft, nn, hite, dbh, bleaf, bfineroot, bsap, &
180186
if( hlm_use_planthydro.eq.itrue ) then
181187
call InitHydrCohort(new_cohort)
182188
call updateSizeDepTreeHydProps(new_cohort, bc_in)
183-
call initTreeHydStates(new_cohort, bc_in)
189+
call initTreeHydStates(currentSite,new_cohort, bc_in)
190+
if(recruitstatus==1)then
191+
new_cohort%co_hydr%is_newly_recuited = .true.
192+
endif
184193
endif
185194

186195
call insert_cohort(new_cohort, patchptr%tallest, patchptr%shortest, tnull, snull, &
@@ -535,6 +544,7 @@ subroutine terminate_cohorts( currentSite, currentPatch, level )
535544
if(associated(shorterCohort)) shorterCohort%taller => null()
536545
else
537546
tallerCohort%shorter => shorterCohort
547+
538548
endif
539549

540550
if (.not. associated(shorterCohort)) then
@@ -557,7 +567,7 @@ end subroutine terminate_cohorts
557567

558568
!-------------------------------------------------------------------------------------!
559569

560-
subroutine fuse_cohorts(currentPatch, bc_in)
570+
subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
561571

562572
!
563573
! !DESCRIPTION:
@@ -567,7 +577,8 @@ subroutine fuse_cohorts(currentPatch, bc_in)
567577
use EDParamsMod , only : ED_val_cohort_fusion_tol
568578
use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=)
569579
!
570-
! !ARGUMENTS
580+
! !ARGUMENTS
581+
type (ed_site_type), intent(inout), target :: currentSite
571582
type (ed_patch_type), intent(inout), target :: currentPatch
572583
type (bc_in_type), intent(in) :: bc_in
573584
!
@@ -711,7 +722,7 @@ subroutine fuse_cohorts(currentPatch, bc_in)
711722
call sizetype_class_index(currentCohort%dbh,currentCohort%pft, &
712723
currentCohort%size_class,currentCohort%size_by_pft_class)
713724

714-
if(hlm_use_planthydro.eq.itrue) call FuseCohortHydraulics(currentCohort,nextc,bc_in,newn)
725+
if(hlm_use_planthydro.eq.itrue) call FuseCohortHydraulics(currentSite,currentCohort,nextc,bc_in,newn)
715726

716727
! recent canopy history
717728
currentCohort%canopy_layer_yesterday = (currentCohort%n*currentCohort%canopy_layer_yesterday + &
@@ -1209,7 +1220,9 @@ subroutine copy_cohort( currentCohort,copyc )
12091220

12101221
! Plant Hydraulics
12111222

1212-
if( hlm_use_planthydro.eq.itrue ) call CopyCohortHydraulics(n,o)
1223+
if( hlm_use_planthydro.eq.itrue ) then
1224+
call CopyCohortHydraulics(n,o)
1225+
endif
12131226

12141227
! indices for binning
12151228
n%size_class = o%size_class

biogeochem/EDLoggingMortalityMod.F90

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ module EDLoggingMortalityMod
3838
use FatesInterfaceMod , only : hlm_model_day
3939
use FatesInterfaceMod , only : hlm_day_of_year
4040
use FatesInterfaceMod , only : hlm_days_per_year
41-
use FatesInterfaceMod , only : hlm_use_logging
41+
use FatesInterfaceMod , only : hlm_use_logging
42+
use FatesInterfaceMod , only : hlm_use_planthydro
4243
use FatesConstantsMod , only : itrue,ifalse
4344
use FatesGlobals , only : endrun => fates_endrun
4445
use FatesGlobals , only : fates_log
4546
use shr_log_mod , only : errMsg => shr_log_errMsg
46-
47+
use FatesPlantHydraulicsMod, only : AccumulateMortalityWaterStorage
48+
4749
implicit none
4850
private
4951

@@ -296,6 +298,12 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
296298
litter_area = currentPatch%area
297299
np_mult = patch_site_areadis/newPatch%area
298300

301+
302+
if( hlm_use_planthydro == itrue ) then
303+
call AccumulateMortalityWaterStorage(currentSite,currentCohort,(direct_dead+indirect_dead))
304+
end if
305+
306+
299307
! ----------------------------------------------------------------------------------------
300308
! Handle woody litter flux for non-bole components of biomass
301309
! This litter is distributed between the current and new patches, &

biogeochem/EDPatchDynamicsMod.F90

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module EDPatchDynamicsMod
2828
use FatesConstantsMod , only : r8 => fates_r8
2929
use FatesConstantsMod , only : itrue
3030
use FatesPlantHydraulicsMod, only : InitHydrCohort
31+
use FatesPlantHydraulicsMod, only : AccumulateMortalityWaterStorage
3132
use FatesPlantHydraulicsMod, only : DeallocateHydrCohort
3233
use EDLoggingMortalityMod, only : logging_litter_fluxes
3334
use EDLoggingMortalityMod, only : logging_time
@@ -655,7 +656,7 @@ subroutine spawn_patches( currentSite, bc_in)
655656
! the second call removes for all other reasons (sparse culling must happen
656657
! before fusion)
657658
call terminate_cohorts(currentSite, currentPatch, 1)
658-
call fuse_cohorts(currentPatch, bc_in)
659+
call fuse_cohorts(currentSite,currentPatch, bc_in)
659660
call terminate_cohorts(currentSite, currentPatch, 2)
660661
call sort_cohorts(currentPatch)
661662

@@ -678,7 +679,7 @@ subroutine spawn_patches( currentSite, bc_in)
678679
! the second call removes for all other reasons (sparse culling must happen
679680
! before fusion)
680681
call terminate_cohorts(currentSite, new_patch, 1)
681-
call fuse_cohorts(new_patch, bc_in)
682+
call fuse_cohorts(currentSite,new_patch, bc_in)
682683
call terminate_cohorts(currentSite, new_patch, 2)
683684
call sort_cohorts(new_patch)
684685

@@ -866,6 +867,10 @@ subroutine fire_litter_fluxes(currentSite, cp_target, new_patch_target, patch_si
866867
bcroot = (currentCohort%bsw + currentCohort%bdead) * (1.0_r8 - EDPftvarcon_inst%allom_agb_frac(p) )
867868
! density of dead trees per m2.
868869
dead_tree_density = (currentCohort%fire_mort * currentCohort%n*patch_site_areadis/currentPatch%area) / AREA
870+
871+
if( hlm_use_planthydro == itrue ) then
872+
call AccumulateMortalityWaterStorage(currentSite,currentCohort,dead_tree_density*AREA)
873+
end if
869874

870875
! Unburned parts of dead tree pool.
871876
! Unburned leaves and roots
@@ -1041,6 +1046,10 @@ subroutine mortality_litter_fluxes(currentSite, cp_target, new_patch_target, pat
10411046
canopy_mortality_root_litter(p) = canopy_mortality_root_litter(p) + &
10421047
canopy_dead*(currentCohort%br+currentCohort%bstore)
10431048

1049+
if( hlm_use_planthydro == itrue ) then
1050+
call AccumulateMortalityWaterStorage(currentSite,currentCohort, canopy_dead)
1051+
end if
1052+
10441053
else
10451054
if(EDPftvarcon_inst%woody(currentCohort%pft) == 1)then
10461055

@@ -1051,6 +1060,10 @@ subroutine mortality_litter_fluxes(currentSite, cp_target, new_patch_target, pat
10511060
understorey_dead* currentCohort%bl
10521061
canopy_mortality_root_litter(p)= canopy_mortality_root_litter(p)+ &
10531062
understorey_dead*(currentCohort%br+currentCohort%bstore)
1063+
1064+
if( hlm_use_planthydro == itrue ) then
1065+
call AccumulateMortalityWaterStorage(currentSite,currentCohort, understorey_dead)
1066+
end if
10541067

10551068
! FIX(SPM,040114) - clarify this comment
10561069
! grass is not killed by canopy mortality disturbance events.
@@ -1059,6 +1072,9 @@ subroutine mortality_litter_fluxes(currentSite, cp_target, new_patch_target, pat
10591072
! no-op
10601073
endif
10611074
endif
1075+
1076+
1077+
10621078

10631079

10641080
currentCohort => currentCohort%taller
@@ -1462,7 +1478,7 @@ subroutine fuse_patches( csite, bc_in )
14621478
if(fuse_flag == 1)then
14631479
tmpptr => currentPatch%older
14641480
call fuse_2_patches(csite, currentPatch, tpp)
1465-
call fuse_cohorts(tpp, bc_in)
1481+
call fuse_cohorts(csite,tpp, bc_in)
14661482
call sort_cohorts(tpp)
14671483
currentPatch => tmpptr
14681484
else

biogeochem/EDPhysiologyMod.F90

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module EDPhysiologyMod
1212
use FatesInterfaceMod, only : hlm_freq_day
1313
use FatesInterfaceMod, only : hlm_day_of_year
1414
use FatesInterfaceMod, only : numpft
15+
use FatesInterfaceMod, only : hlm_use_planthydro
1516
use FatesConstantsMod, only : r8 => fates_r8
1617
use EDPftvarcon , only : EDPftvarcon_inst
1718
use FatesInterfaceMod, only : bc_in_type
@@ -34,6 +35,8 @@ module EDPhysiologyMod
3435
use FatesGlobals , only : fates_log
3536
use FatesGlobals , only : endrun => fates_endrun
3637
use EDParamsMod , only : fates_mortality_disturbance_fraction
38+
39+
use FatesPlantHydraulicsMod , only : AccumulateMortalityWaterStorage
3740
use FatesConstantsMod , only : itrue,ifalse
3841
use FatesConstantsMod , only : calloc_abs_error
3942

@@ -1586,14 +1589,15 @@ subroutine recruitment( currentSite, currentPatch, bc_in )
15861589
use FatesInterfaceMod, only : hlm_use_ed_prescribed_phys
15871590
!
15881591
! !ARGUMENTS
1589-
type(ed_site_type), intent(inout), target :: currentSite
1592+
type(ed_site_type), intent(inout), target :: currentSite
15901593
type(ed_patch_type), intent(inout), pointer :: currentPatch
15911594
type(bc_in_type), intent(in) :: bc_in
15921595
!
15931596
! !LOCAL VARIABLES:
15941597
integer :: ft
15951598
type (ed_cohort_type) , pointer :: temp_cohort
15961599
integer :: cohortstatus
1600+
integer,parameter :: recruitstatus = 1 !weather it the new created cohorts is recruited or initialized
15971601
real(r8) :: b_leaf
15981602
real(r8) :: b_fineroot ! fine root biomass [kgC]
15991603
real(r8) :: b_sapwood ! sapwood biomass [kgC]
@@ -1655,14 +1659,14 @@ subroutine recruitment( currentSite, currentPatch, bc_in )
16551659
currentSite%flux_out = currentSite%flux_out + currentPatch%area * currentPatch%seed_germination(ft)*hlm_freq_day
16561660
endif
16571661

1658-
16591662
if (temp_cohort%n > 0.0_r8 )then
16601663
if ( DEBUG ) write(fates_log(),*) 'EDPhysiologyMod.F90 call create_cohort '
1661-
call create_cohort(currentPatch, temp_cohort%pft, temp_cohort%n, temp_cohort%hite, temp_cohort%dbh, &
1664+
call create_cohort(currentSite,currentPatch, temp_cohort%pft, temp_cohort%n, temp_cohort%hite, temp_cohort%dbh, &
16621665
b_leaf, b_fineroot, b_sapwood, temp_cohort%bdead, temp_cohort%bstore, &
1663-
temp_cohort%laimemory, cohortstatus, temp_cohort%canopy_trim, currentPatch%NCL_p, &
1666+
temp_cohort%laimemory, cohortstatus,recruitstatus, temp_cohort%canopy_trim, currentPatch%NCL_p, &
16641667
currentSite%spread, bc_in)
16651668

1669+
16661670
! keep track of how many individuals were recruited for passing to history
16671671
currentSite%recruitment_rate(ft) = currentSite%recruitment_rate(ft) + temp_cohort%n
16681672

@@ -1779,6 +1783,11 @@ subroutine CWD_Input( currentSite, currentPatch)
17791783
(dead_n_ilogging+dead_n_dlogging) * &
17801784
hlm_freq_day * currentPatch%area
17811785

1786+
if( hlm_use_planthydro == itrue ) then
1787+
call AccumulateMortalityWaterStorage(currentSite,currentCohort,dead_n)
1788+
end if
1789+
1790+
17821791
do c = 1,ncwd
17831792

17841793
currentPatch%cwd_BG_in(c) = currentPatch%cwd_BG_in(c) + (currentCohort%bdead+currentCohort%bsw) * &

0 commit comments

Comments
 (0)