@@ -13,12 +13,13 @@ module EDPhysiologyMod
1313 use FatesInterfaceMod, only : hlm_day_of_year
1414 use FatesInterfaceMod, only : numpft
1515 use FatesInterfaceMod, only : hlm_use_planthydro
16+ use FatesInterfaceMod, only : hlm_parteh_mode
1617 use FatesConstantsMod, only : r8 = > fates_r8
1718 use FatesConstantsMod, only : nearzero
1819 use EDPftvarcon , only : EDPftvarcon_inst
1920 use FatesInterfaceMod, only : bc_in_type
2021 use EDCohortDynamicsMod , only : zero_cohort
21- use EDCohortDynamicsMod , only : create_cohort, sort_cohorts
22+ use EDCohortDynamicsMod , only : create_cohort, sort_cohorts,InitPRTCohort
2223 use FatesAllometryMod , only : tree_lai
2324 use FatesAllometryMod , only : tree_sai
2425 use FatesAllometryMod , only : decay_coeff_kn
@@ -39,6 +40,12 @@ module EDPhysiologyMod
3940 use EDParamsMod , only : fates_mortality_disturbance_fraction
4041
4142 use FatesPlantHydraulicsMod , only : AccumulateMortalityWaterStorage
43+ use FatesPlantHydraulicsMod , only : updateSizeDepTreeHydProps
44+ use FatesPlantHydraulicsMod , only : initTreeHydStates
45+ use FatesPlantHydraulicsMod , only : InitHydrCohort
46+ use FatesPlantHydraulicsMod , only : ConstrainRecruitNumber
47+ use FatesPlantHydraulicsMod , only : DeallocateHydrCohort
48+
4249 use FatesConstantsMod , only : itrue,ifalse
4350 use FatesConstantsMod , only : calloc_abs_error
4451
@@ -54,7 +61,8 @@ module EDPhysiologyMod
5461 use FatesAllometryMod , only : carea_allom
5562 use FatesAllometryMod , only : CheckIntegratedAllometries
5663 use FatesAllometryMod , only : StructureResetOfDH
57-
64+
65+ use PRTGenericMod, only : prt_carbon_allom_hyp
5866 use PRTGenericMod, only : leaf_organ
5967 use PRTGenericMod, only : all_carbon_elements
6068 use PRTGenericMod, only : carbon12_element
@@ -971,6 +979,10 @@ subroutine recruitment( currentSite, currentPatch, bc_in )
971979
972980 allocate (temp_cohort) ! create temporary cohort
973981 call zero_cohort(temp_cohort)
982+ if ( hlm_use_planthydro.eq. itrue ) then
983+ call InitHydrCohort(CurrentSite,temp_cohort)
984+ endif
985+ call InitPRTCohort(temp_cohort)
974986
975987 do ft = 1 ,numpft
976988
@@ -1014,28 +1026,64 @@ subroutine recruitment( currentSite, currentPatch, bc_in )
10141026 else
10151027 ! prescribed recruitment rates. number per sq. meter per year
10161028 temp_cohort% n = currentPatch% area * EDPftvarcon_inst% prescribed_recruitment(ft) * hlm_freq_day
1017- ! modify the carbon balance accumulators to take into account the different way of defining recruitment
1018- ! add prescribed rates as an input C flux, and the recruitment that would have otherwise occured as an output flux
1019- ! (since the carbon associated with them effectively vanishes)
1020- currentSite% flux_in = currentSite% flux_in + temp_cohort% n * &
1021- (b_store + b_leaf + b_fineroot + b_sapwood + b_dead)
1022- currentSite% flux_out = currentSite% flux_out + currentPatch% area * currentPatch% seed_germination(ft)* hlm_freq_day
10231029 endif
10241030
10251031 if (temp_cohort% n > 0.0_r8 )then
1026- if ( debug ) write (fates_log(),* ) ' EDPhysiologyMod.F90 call create_cohort '
1027- call create_cohort(currentSite,currentPatch, temp_cohort% pft, temp_cohort% n, temp_cohort% hite, temp_cohort% dbh, &
1032+ if ( DEBUG ) write (fates_log(),* ) ' EDPhysiologyMod.F90 call create_cohort '
1033+ ! constrain the number of individual based on rhyzosphere water availability
1034+ if ( hlm_use_planthydro.eq. itrue ) then
1035+ call carea_allom(temp_cohort% dbh,temp_cohort% n,currentSite% spread, &
1036+ ft,temp_cohort% c_area)
1037+ if (associated (currentPatch% shortest)) then
1038+ temp_cohort% canopy_layer = currentPatch% shortest% canopy_layer
1039+ else
1040+ temp_cohort% canopy_layer = 1
1041+ endif
1042+ temp_cohort% pft = ft
1043+ select case (hlm_parteh_mode)
1044+ case (prt_carbon_allom_hyp)
1045+
1046+ call SetState(temp_cohort% prt,leaf_organ, carbon12_element, b_leaf)
1047+ call SetState(temp_cohort% prt,fnrt_organ, carbon12_element, b_fineroot)
1048+ call SetState(temp_cohort% prt,sapw_organ, carbon12_element, b_sapwood)
1049+ call SetState(temp_cohort% prt,store_organ, carbon12_element, b_store)
1050+ call SetState(temp_cohort% prt,struct_organ, carbon12_element, b_dead)
1051+ call SetState(temp_cohort% prt,repro_organ , carbon12_element, 0.0_r8 )
1052+
1053+ end select
1054+ temp_cohort% treelai = tree_lai(b_leaf, ft,&
1055+ temp_cohort% c_area,temp_cohort% n, &
1056+ temp_cohort% canopy_layer,currentPatch% canopy_layer_tlai)
1057+ call updateSizeDepTreeHydProps(CurrentSite,temp_cohort, bc_in)
1058+ call initTreeHydStates(CurrentSite,temp_cohort, bc_in)
1059+ call ConstrainRecruitNumber(currentSite,temp_cohort, bc_in)
1060+ endif
1061+ if (temp_cohort% n > 0.0_r8 ) then
1062+ call create_cohort(currentSite,currentPatch, temp_cohort% pft, temp_cohort% n, temp_cohort% hite, temp_cohort% dbh, &
10281063 b_leaf, b_fineroot, b_sapwood, b_dead, b_store, &
10291064 temp_cohort% laimemory, cohortstatus,recruitstatus, temp_cohort% canopy_trim, currentPatch% NCL_p, &
10301065 currentSite% spread, bc_in)
1031-
1032-
1033- ! keep track of how many individuals were recruited for passing to history
1034- currentSite% recruitment_rate(ft) = currentSite% recruitment_rate(ft) + temp_cohort% n
1066+ ! keep track of how many individuals were recruited for passing to history
1067+ currentSite% recruitment_rate(ft) = currentSite% recruitment_rate(ft) + temp_cohort% n
1068+ ! modify the carbon balance accumulators to take into account the different way of defining recruitment
1069+ ! add prescribed rates as an input C flux, and the recruitment that would have otherwise occured as an output flux
1070+ ! (since the carbon associated with them effectively vanishes)
1071+ ! check the water for hydraulics
1072+ if (hlm_use_ed_prescribed_phys .ne. ifalse .and. EDPftvarcon_inst% prescribed_recruitment(ft) .ge. 0 . ) then
1073+ currentSite% flux_in = currentSite% flux_in + temp_cohort% n * &
1074+ (b_store + b_leaf + b_fineroot + b_sapwood + b_dead)
1075+ currentSite% flux_out = currentSite% flux_out + currentPatch% area * currentPatch% seed_germination(ft)* hlm_freq_day
1076+ endif
1077+
1078+ endif
10351079
10361080 endif
10371081 enddo ! pft loop
1038-
1082+ ! deallocate the temporatory cohort
1083+ if (hlm_use_planthydro.eq. itrue) call DeallocateHydrCohort(temp_cohort)
1084+ ! Deallocate the cohort's PRT structure
1085+ call temp_cohort% prt% DeallocatePRTVartypes()
1086+ deallocate (temp_cohort% prt)
10391087 deallocate (temp_cohort) ! delete temporary cohort
10401088
10411089 end subroutine recruitment
@@ -1173,7 +1221,9 @@ subroutine CWD_Input( currentSite, currentPatch)
11731221 hlm_freq_day * currentPatch% area
11741222
11751223 if ( hlm_use_planthydro == itrue ) then
1176- call AccumulateMortalityWaterStorage(currentSite,currentCohort,dead_n)
1224+ ! call AccumulateMortalityWaterStorage(currentSite,currentCohort,dead_n)
1225+ call AccumulateMortalityWaterStorage(currentSite,currentCohort,&
1226+ - 1.0_r8 * currentCohort% dndt * hlm_freq_day)
11771227 end if
11781228
11791229
0 commit comments