@@ -6,18 +6,18 @@ module EDCohortDynamicsMod
66 ! !USES:
77 use FatesGlobals , only : endrun = > fates_endrun
88 use FatesGlobals , only : fates_log
9- use FatesInterfaceMod , only : hlm_freq_day
10- use FatesInterfaceMod , only : bc_in_type
11- use FatesInterfaceMod , only : hlm_use_planthydro
12- use FatesInterfaceMod , only : hlm_use_cohort_age_tracking
9+ use FatesInterfaceTypesMod , only : hlm_freq_day
10+ use FatesInterfaceTypesMod , only : bc_in_type
11+ use FatesInterfaceTypesMod , only : hlm_use_planthydro
12+ use FatesInterfaceTypesMod , only : hlm_use_cohort_age_tracking
1313 use FatesConstantsMod , only : r8 = > fates_r8
1414 use FatesConstantsMod , only : fates_unset_int
1515 use FatesConstantsMod , only : itrue,ifalse
1616 use FatesConstantsMod , only : fates_unset_r8
1717 use FatesConstantsMod , only : nearzero
1818 use FatesConstantsMod , only : calloc_abs_error
19- use FatesInterfaceMod , only : hlm_days_per_year
20- use FatesInterfaceMod , only : nleafage
19+ use FatesInterfaceTypesMod , only : hlm_days_per_year
20+ use FatesInterfaceTypesMod , only : nleafage
2121 use SFParamsMod , only : SF_val_CWD_frac
2222 use EDPftvarcon , only : EDPftvarcon_inst
2323 use EDPftvarcon , only : GetDecompyFrac
@@ -38,17 +38,18 @@ module EDCohortDynamicsMod
3838 use EDTypesMod , only : site_fluxdiags_type
3939 use EDTypesMod , only : num_elements
4040 use EDParamsMod , only : ED_val_cohort_age_fusion_tol
41- use FatesInterfaceMod , only : hlm_use_planthydro
42- use FatesInterfaceMod , only : hlm_parteh_mode
41+ use FatesInterfaceTypesMod , only : hlm_use_planthydro
42+ use FatesInterfaceTypesMod , only : hlm_parteh_mode
4343 use FatesPlantHydraulicsMod, only : FuseCohortHydraulics
4444 use FatesPlantHydraulicsMod, only : CopyCohortHydraulics
45- use FatesPlantHydraulicsMod, only : updateSizeDepTreeHydProps
46- use FatesPlantHydraulicsMod, only : initTreeHydStates
45+ use FatesPlantHydraulicsMod, only : UpdateSizeDepPlantHydProps
46+ use FatesPlantHydraulicsMod, only : InitPlantHydStates
4747 use FatesPlantHydraulicsMod, only : InitHydrCohort
4848 use FatesPlantHydraulicsMod, only : DeallocateHydrCohort
4949 use FatesPlantHydraulicsMod, only : AccumulateMortalityWaterStorage
50- use FatesPlantHydraulicsMod, only : UpdateTreeHydrNodes
51- use FatesPlantHydraulicsMod, only : UpdateTreeHydrLenVolCond
50+ use FatesPlantHydraulicsMod, only : UpdatePlantHydrNodes
51+ use FatesPlantHydraulicsMod, only : UpdatePlantHydrLenVol
52+ use FatesPlantHydraulicsMod, only : UpdatePlantKmax
5253 use FatesPlantHydraulicsMod, only : SavePreviousCompartmentVolumes
5354 use FatesPlantHydraulicsMod, only : ConstrainRecruitNumber
5455 use FatesSizeAgeTypeIndicesMod, only : sizetype_class_index
@@ -188,7 +189,7 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, coage, dbh, &
188189 integer :: iage ! loop counter for leaf age classes
189190 real (r8 ) :: leaf_c ! total leaf carbon
190191 integer :: tnull,snull ! are the tallest and shortest cohorts allocate
191- integer :: nlevsoi_hyd ! number of hydraulically active soil layers
192+ integer :: nlevrhiz ! number of rhizosphere layers
192193
193194 !- ---------------------------------------------------------------------
194195
@@ -300,25 +301,28 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, coage, dbh, &
300301
301302 if ( hlm_use_planthydro.eq. itrue ) then
302303
303- nlevsoi_hyd = currentSite% si_hydr% nlevsoi_hyd
304+ nlevrhiz = currentSite% si_hydr% nlevrhiz
304305
305306 ! This allocates array spaces
306307 call InitHydrCohort(currentSite,new_cohort)
307308
308309 ! This calculates node heights
309- call UpdateTreeHydrNodes (new_cohort% co_hydr,new_cohort% pft, &
310- new_cohort% hite,nlevsoi_hyd,bc_in )
310+ call UpdatePlantHydrNodes (new_cohort% co_hydr,new_cohort% pft, &
311+ new_cohort% hite,currentSite % si_hydr )
311312
312- ! This calculates volumes, lengths and max conductances
313- call UpdateTreeHydrLenVolCond (new_cohort,nlevsoi_hyd,bc_in )
313+ ! This calculates volumes and lengths
314+ call UpdatePlantHydrLenVol (new_cohort,currentSite % si_hydr )
314315
316+ ! This updates the Kmax's of the plant's compartments
317+ call UpdatePlantKmax(new_cohort% co_hydr,new_cohort,currentSite% si_hydr)
318+
315319 ! Since this is a newly initialized plant, we set the previous compartment-size
316320 ! equal to the ones we just calculated.
317321 call SavePreviousCompartmentVolumes(new_cohort% co_hydr)
318322
319323 ! This comes up with starter suctions and then water contents
320324 ! based on the soil values
321- call initTreeHydStates (currentSite,new_cohort, bc_in )
325+ call InitPlantHydStates (currentSite,new_cohort)
322326
323327 if (recruitstatus== 1 )then
324328
@@ -949,7 +953,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
949953 ! !USES:
950954 use EDParamsMod , only : ED_val_cohort_size_fusion_tol
951955 use EDParamsMod , only : ED_val_cohort_age_fusion_tol
952- use FatesInterfaceMod , only : hlm_use_cohort_age_tracking
956+ use FatesInterfaceTypesMod , only : hlm_use_cohort_age_tracking
953957 use FatesConstantsMod , only : itrue
954958 use FatesConstantsMod, only : days_per_year
955959 use EDTypesMod , only : maxCohortsPerPatch
@@ -981,7 +985,6 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
981985 real (r8 ) :: leaf_c_target
982986 real (r8 ) :: dynamic_size_fusion_tolerance
983987 real (r8 ) :: dynamic_age_fusion_tolerance
984- integer :: maxCohortsPerPatch_age_tracking
985988 real (r8 ) :: dbh
986989 real (r8 ) :: leaf_c ! leaf carbon [kg]
987990
@@ -1000,11 +1003,6 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
10001003 ! set the cohort age fusion tolerance (in fraction of years)
10011004 dynamic_age_fusion_tolerance = ED_val_cohort_age_fusion_tol
10021005
1003- if ( hlm_use_cohort_age_tracking .eq. itrue) then
1004- maxCohortsPerPatch_age_tracking = 300
1005- end if
1006-
1007-
10081006
10091007 ! This needs to be a function of the canopy layer, because otherwise, at canopy closure
10101008 ! the number of cohorts doubles and very dissimilar cohorts are fused together
@@ -1386,12 +1384,13 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
13861384 currentCohort% pft, currentCohort% c_area, currentCohort% n, &
13871385 currentCohort% canopy_layer, currentPatch% canopy_layer_tlai, &
13881386 currentCohort% vcmax25top )
1389- call updateSizeDepTreeHydProps (currentSite,currentCohort, bc_in)
1387+ call UpdateSizeDepPlantHydProps (currentSite,currentCohort, bc_in)
13901388 endif
1391-
1389+
13921390 call DeallocateCohort(nextc)
13931391 deallocate (nextc)
13941392 nullify(nextc)
1393+
13951394
13961395 endif ! if( currentCohort%isnew.eqv.nextc%isnew ) then
13971396 endif ! canopy layer
@@ -1429,7 +1428,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
14291428
14301429
14311430 if ( hlm_use_cohort_age_tracking .eq. itrue) then
1432- if ( nocohorts > maxCohortsPerPatch_age_tracking ) then
1431+ if ( nocohorts > maxCohortsPerPatch ) then
14331432 iterate = 1
14341433 !- --------------------------------------------------------------------!
14351434 ! Making profile tolerance larger means that more fusion will happen !
0 commit comments