Skip to content

Commit

Permalink
merged in master
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoven committed Mar 10, 2017
2 parents 6a5aa19 + 4ccb9ef commit 07c10f3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ subroutine canopy_structure( currentSite )
enddo !is there still excess area in any layer?

call fuse_cohorts(currentPatch)
call terminate_cohorts(currentPatch)
call terminate_cohorts(currentSite, currentPatch)

! ----------- Check cohort area ------------------------------!
do i = 1,z
Expand Down Expand Up @@ -562,7 +562,7 @@ subroutine canopy_structure( currentSite )
enddo !is there still not enough canopy area in any layer?

call fuse_cohorts(currentPatch)
call terminate_cohorts(currentPatch)
call terminate_cohorts(currentSite, currentPatch)

if(promswitch == 1)then
!write(fates_log(),*) 'going into cohort check'
Expand Down
12 changes: 7 additions & 5 deletions components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ subroutine zero_cohort(cc_p)
end subroutine zero_cohort

!-------------------------------------------------------------------------------------!
subroutine terminate_cohorts( patchptr )
subroutine terminate_cohorts( siteptr, patchptr )
!
! !DESCRIPTION:
! terminates cohorts when they get too small
Expand All @@ -495,6 +495,7 @@ subroutine terminate_cohorts( patchptr )
use SFParamsMod, only : SF_val_CWD_frac
!
! !ARGUMENTS
type (ed_site_type), intent(inout), target :: siteptr
type (ed_patch_type), intent(inout), target :: patchptr
!
! !LOCAL VARIABLES:
Expand Down Expand Up @@ -571,10 +572,10 @@ subroutine terminate_cohorts( patchptr )
else
levcan = 2
endif
currentPatch%siteptr%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) = &
currentPatch%siteptr%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) + currentCohort%n
siteptr%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) = &
siteptr%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) + currentCohort%n
!
currentPatch%siteptr%termination_carbonflux(levcan) = currentPatch%siteptr%termination_carbonflux(levcan) + &
siteptr%termination_carbonflux(levcan) = siteptr%termination_carbonflux(levcan) + &
currentCohort%n * currentCohort%b
if (.not. associated(currentCohort%taller)) then
currentPatch%tallest => currentCohort%shorter
Expand Down Expand Up @@ -772,7 +773,8 @@ subroutine fuse_cohorts(patchptr)
currentCohort%npp_store = (currentCohort%n*currentCohort%npp_store + nextc%n*nextc%npp_store)/newn

! recent canopy history
currentCohort%canopy_layer_yesterday = (currentCohort%n*currentCohort%canopy_layer_yesterday + nextc%n*nextc%canopy_layer_yesterday)/newn
currentCohort%canopy_layer_yesterday = (currentCohort%n*currentCohort%canopy_layer_yesterday + &
nextc%n*nextc%canopy_layer_yesterday)/newn

do i=1, nlevcan
if (currentCohort%year_net_uptake(i) == 999._r8 .or. nextc%year_net_uptake(i) == 999._r8) then
Expand Down
4 changes: 2 additions & 2 deletions components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ subroutine spawn_patches( currentSite )

!sort out the cohorts, since some of them may be so small as to need removing.
call fuse_cohorts(currentPatch)
call terminate_cohorts(currentPatch)
call terminate_cohorts(currentSite, currentPatch)
call sort_cohorts(currentPatch)

currentPatch => currentPatch%younger
Expand All @@ -413,7 +413,7 @@ subroutine spawn_patches( currentSite )
currentSite%youngest_patch => new_patch

call fuse_cohorts(new_patch)
call terminate_cohorts(new_patch)
call terminate_cohorts(currentSite, new_patch)
call sort_cohorts(new_patch)

endif !end new_patch area
Expand Down
2 changes: 1 addition & 1 deletion components/clm/src/ED/biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ subroutine recruitment( t, currentSite, currentPatch )
temp_cohort%laimemory, cohortstatus, temp_cohort%canopy_trim, currentPatch%NCL_p)

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

enddo !pft loop
Expand Down
4 changes: 2 additions & 2 deletions components/clm/src/ED/main/EDMainMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ subroutine ed_ecosystem_dynamics(currentSite, bc_in)
call fuse_cohorts(currentPatch)

! kills cohorts that are too small
call terminate_cohorts(currentPatch)
call terminate_cohorts(currentSite, currentPatch)


currentPatch => currentPatch%younger
Expand Down Expand Up @@ -341,7 +341,7 @@ subroutine ed_update_site( currentSite, bc_in )
currentPatch => currentSite%oldest_patch
do while(associated(currentPatch))

call terminate_cohorts(currentPatch)
call terminate_cohorts(currentSite, currentPatch)

! FIX(SPM,040314) why is this needed for BFB restarts? Look into this at some point
cohort_number = count_cohorts(currentPatch)
Expand Down
3 changes: 2 additions & 1 deletion components/clm/src/ED/main/FatesHistoryInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,8 @@ subroutine update_history_dyn(this,nc,nsites,sites)
ccohort%npp_bseed * ccohort%n
hio_npp_store_understory_si_scls(io_si,scls) = hio_npp_store_understory_si_scls(io_si,scls) + &
ccohort%npp_store * ccohort%n
hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) = hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) + &
hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) = &
hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) + &
ccohort%canopy_layer_yesterday * ccohort%n
endif
!
Expand Down

0 comments on commit 07c10f3

Please sign in to comment.