Skip to content

Commit

Permalink
Merge pull request #3 from rgknox/rgknox-cxu-dynamic-hydro-restart-me…
Browse files Browse the repository at this point in the history
…rged

restarts
  • Loading branch information
xuchongang authored Nov 21, 2018
2 parents cfbdb86 + 9d70ddd commit 2254e76
Show file tree
Hide file tree
Showing 6 changed files with 1,073 additions and 347 deletions.
38 changes: 34 additions & 4 deletions biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ module EDCohortDynamicsMod
use FatesPlantHydraulicsMod, only : InitHydrCohort
use FatesPlantHydraulicsMod, only : DeallocateHydrCohort
use FatesPlantHydraulicsMod, only : AccumulateMortalityWaterStorage
use FatesPlantHydraulicsMod, only : UpdateTreeHydrNodes
use FatesPlantHydraulicsMod, only : UpdateTreeHydrLenVolCond
use FatesPlantHydraulicsMod, only : SavePreviousCompartmentVolumes
use FatesSizeAgeTypeIndicesMod, only : sizetype_class_index
use FatesAllometryMod , only : bleaf
use FatesAllometryMod , only : bfineroot
Expand Down Expand Up @@ -98,6 +101,13 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, dbh, bleaf, bfine
!
! !DESCRIPTION:
! create new cohort
! There are 4 places this is called
! 1) Initializing new cohorts at the beginning of a cold-start simulation
! 2) Initializing new recruits during dynamics
! 3) Initializing new cohorts at the beginning of a inventory read
! 4) Initializing new cohorts during restart
!
! It is assumed that in the first 3, this is called with a reasonable amount of starter information.
!
! !USES:
!
Expand Down Expand Up @@ -125,7 +135,8 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, dbh, bleaf, bfine
! !LOCAL VARIABLES:
type(ed_cohort_type), pointer :: new_cohort ! Pointer to New Cohort structure.
type(ed_cohort_type), pointer :: storesmallcohort
type(ed_cohort_type), pointer :: storebigcohort
type(ed_cohort_type), pointer :: storebigcohort
integer :: nlevsoi_hyd ! number of hydraulically active soil layers
integer :: tnull,snull ! are the tallest and shortest cohorts allocate
!----------------------------------------------------------------------

Expand Down Expand Up @@ -242,12 +253,31 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, dbh, bleaf, bfine
new_cohort%isnew = .true.

if( hlm_use_planthydro.eq.itrue ) then
call InitHydrCohort(CurrentSite,new_cohort)
call updateSizeDepTreeHydProps(CurrentSite,new_cohort, bc_in)
call initTreeHydStates(CurrentSite,new_cohort, bc_in)

nlevsoi_hyd = currentSite%si_hydr%nlevsoi_hyd

! This allocates array spaces
call InitHydrCohort(currentSite,new_cohort)

! This calculates node heights
call UpdateTreeHydrNodes(new_cohort%co_hydr,new_cohort%pft, &
new_cohort%hite,nlevsoi_hyd,bc_in)

! This calculates volumes, lengths and max conductances
call UpdateTreeHydrLenVolCond(new_cohort,nlevsoi_hyd,bc_in)

! Since this is a newly initialized plant, we set the previous compartment-size
! equal to the ones we just calculated.
call SavePreviousCompartmentVolumes(new_cohort%co_hydr)

! This comes up with starter suctions and then water contents
! based on the soil values
call initTreeHydStates(currentSite,new_cohort, bc_in)

if(recruitstatus==1)then
new_cohort%co_hydr%is_newly_recruited = .true.
endif

endif

call insert_cohort(new_cohort, patchptr%tallest, patchptr%shortest, tnull, snull, &
Expand Down
5 changes: 2 additions & 3 deletions biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1002,13 +1002,12 @@ subroutine recruitment( currentSite, currentPatch, bc_in )
endif

if (temp_cohort%n > 0.0_r8 )then
if ( debug ) write(fates_log(),*) 'EDPhysiologyMod.F90 call create_cohort '

call create_cohort(currentSite,currentPatch, temp_cohort%pft, temp_cohort%n, temp_cohort%hite, temp_cohort%dbh, &
b_leaf, b_fineroot, b_sapwood, b_dead, b_store, &
temp_cohort%laimemory, cohortstatus,recruitstatus, temp_cohort%canopy_trim, currentPatch%NCL_p, &
currentSite%spread, bc_in)



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

Expand Down
28 changes: 28 additions & 0 deletions biogeochem/FatesAllometryMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ module FatesAllometryMod
public :: decay_coeff_kn
public :: StructureResetOfDH ! Method to set DBH to sync with structure biomass
public :: CheckIntegratedAllometries
public :: CrownDepth
public :: set_root_fraction ! Generic wrapper to calculate normalized
! root profiles

Expand Down Expand Up @@ -1843,6 +1844,33 @@ subroutine h2d_martcano(h,p1,p2,p3,d,dddh)
return
end subroutine h2d_martcano

! =====================================================================================


subroutine CrownDepth(height,crown_depth)

! -----------------------------------------------------------------------------------
! This routine returns the depth of a plant's crown. Which is the length
! from the bottom of the crown to the top in the vertical dimension.
!
! This code may be used as a wrapper if different hypotheses are wished to be
! optioned.
! -----------------------------------------------------------------------------------

real(r8),intent(in) :: height ! The height of the plant [m]
real(r8),intent(out) :: crown_depth ! The depth of the crown [m]

! Alternative Hypothesis:
! crown depth from Poorter, Bongers & Bongers
! crown_depth = exp(-1.169_r8)*cCohort%hite**1.098_r8

crown_depth = min(height,0.1_r8)

return
end subroutine CrownDepth



! =============================================================================
! Specific diameter to crown area allometries
! =============================================================================
Expand Down
Loading

0 comments on commit 2254e76

Please sign in to comment.