Skip to content

Commit

Permalink
Merge pull request ESCOMP#4 from rgknox/kovenock_slaprofile
Browse files Browse the repository at this point in the history
Sla and nitrogen profiles are now scaled by leaf area alone. SAI is based on target leaf area.
  • Loading branch information
kovenock authored Jul 26, 2018
2 parents 770ac36 + 4925683 commit 3aa3791
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 199 deletions.
40 changes: 21 additions & 19 deletions biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1016,9 +1016,10 @@ subroutine canopy_summarization( nsites, sites, bc_in )

call carea_allom(currentCohort%dbh,currentCohort%n,sites(s)%spread,&
currentCohort%pft,currentCohort%c_area)
currentCohort%treelai = tree_lai(currentCohort%bl, currentCohort%status_coh, &

currentCohort%treelai = tree_lai(currentCohort%bl, &
currentCohort%pft, currentCohort%c_area, currentCohort%n, &
currentCohort%canopy_layer, currentPatch%canopy_layer_tvai )
currentCohort%canopy_layer, currentPatch%canopy_layer_tlai )

canopy_leaf_area = canopy_leaf_area + currentCohort%treelai *currentCohort%c_area

Expand Down Expand Up @@ -1088,7 +1089,7 @@ subroutine leaf_area_profile( currentSite , snow_depth_si, frac_sno_eff_si)
!
! The following patch level diagnostics are updated here:
!
! currentPatch%canopy_layer_tvai(cl) ! total vegetated area index of layer
! currentPatch%canopy_layer_tlai(cl) ! total leaf area index of canopy layer
! currentPatch%ncan(cl,ft) ! number of vegetation layers needed
! ! in this patch's pft/canopy-layer
! currentPatch%nrad(cl,ft) ! same as ncan, but does not include
Expand Down Expand Up @@ -1158,7 +1159,7 @@ subroutine leaf_area_profile( currentSite , snow_depth_si, frac_sno_eff_si)
! calculate tree lai and sai.
! --------------------------------------------------------------------------------

currentPatch%canopy_layer_tvai(:) = 0._r8
currentPatch%canopy_layer_tlai(:) = 0._r8
currentPatch%ncan(:,:) = 0
currentPatch%nrad(:,:) = 0
patch_lai = 0._r8
Expand All @@ -1177,15 +1178,24 @@ subroutine leaf_area_profile( currentSite , snow_depth_si, frac_sno_eff_si)

if (currentPatch%total_canopy_area > nearzero ) then

currentCohort => currentPatch%shortest

currentCohort => currentPatch%tallest
do while(associated(currentCohort))

ft = currentCohort%pft
cl = currentCohort%canopy_layer

currentCohort%treelai = tree_lai(currentCohort%bl, currentCohort%status_coh, currentCohort%pft, &
currentCohort%c_area, currentCohort%n, currentCohort%canopy_layer, currentPatch%canopy_layer_tvai )
currentCohort%treesai = tree_sai(currentCohort%pft, currentCohort%treelai)
! Calculate LAI of layers above
! Note that the canopy_layer_lai is also calculated in this loop
! but since we go top down in terms of plant size, we should be okay

currentCohort%treelai = tree_lai(currentCohort%bl, currentCohort%pft, currentCohort%c_area, &
currentCohort%n, currentCohort%canopy_layer, &
currentPatch%canopy_layer_tlai )

currentCohort%treesai = tree_sai(currentCohort%pft, currentCohort%dbh, currentCohort%canopy_trim, &
currentCohort%c_area, currentCohort%n, currentCohort%canopy_layer, &
currentPatch%canopy_layer_tlai, currentCohort%treelai )

currentCohort%lai = currentCohort%treelai *currentCohort%c_area/currentPatch%total_canopy_area
currentCohort%sai = currentCohort%treesai *currentCohort%c_area/currentPatch%total_canopy_area
Expand All @@ -1197,17 +1207,9 @@ subroutine leaf_area_profile( currentSite , snow_depth_si, frac_sno_eff_si)

patch_lai = patch_lai + currentCohort%lai

! currentPatch%canopy_layer_tvai(cl) = currentPatch%canopy_layer_tvai(cl) + &
! currentCohort%lai + currentCohort%sai
currentPatch%canopy_layer_tlai(cl) = currentPatch%canopy_layer_tlai(cl) + currentCohort%lai

do cl = 1,nclmax-1
if(currentCohort%canopy_layer == cl)then
currentPatch%canopy_layer_tvai(cl) = currentPatch%canopy_layer_tvai(cl) + &
currentCohort%lai + currentCohort%sai
endif
enddo

currentCohort => currentCohort%taller
currentCohort => currentCohort%shorter

enddo !currentCohort

Expand Down Expand Up @@ -1484,7 +1486,7 @@ subroutine leaf_area_profile( currentSite , snow_depth_si, frac_sno_eff_si)
enddo !currentCohort
call endrun(msg=errMsg(sourcefile, __LINE__))
end if
end do
end do

do ft = 1,numpft
do iv = 1,currentPatch%ncan(cl,ft)
Expand Down
12 changes: 9 additions & 3 deletions biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,16 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, dbh, bleaf, bfine
! Assign canopy extent and depth
call carea_allom(new_cohort%dbh,new_cohort%n,spread,new_cohort%pft,new_cohort%c_area)

new_cohort%treelai = tree_lai(new_cohort%bl, new_cohort%status_coh, new_cohort%pft, &
new_cohort%c_area, new_cohort%n, new_cohort%canopy_layer, patchptr%canopy_layer_tvai )
new_cohort%treelai = tree_lai(new_cohort%bl, new_cohort%pft, new_cohort%c_area, &
new_cohort%n, new_cohort%canopy_layer, &
patchptr%canopy_layer_tlai )

new_cohort%treesai = tree_sai(new_cohort%pft, new_cohort%dbh, new_cohort%canopy_trim, &
new_cohort%c_area, new_cohort%n, new_cohort%canopy_layer, &
patchptr%canopy_layer_tlai, new_cohort%treelai )

new_cohort%lai = new_cohort%treelai * new_cohort%c_area/patchptr%area
new_cohort%treesai = tree_sai(new_cohort%pft, new_cohort%treelai)


! Put cohort at the right place in the linked list
storebigcohort => patchptr%tallest
Expand Down
4 changes: 2 additions & 2 deletions biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ subroutine zero_patch(cp_p)
currentPatch%age = nan
currentPatch%age_class = 1
currentPatch%area = nan
currentPatch%canopy_layer_tvai(:) = nan
currentPatch%canopy_layer_tlai(:) = nan
currentPatch%total_canopy_area = nan

currentPatch%tlai_profile(:,:,:) = nan
Expand Down Expand Up @@ -1347,7 +1347,7 @@ subroutine zero_patch(cp_p)
currentPatch%burnt_frac_litter(:) = 0.0_r8
currentPatch%btran_ft(:) = 0.0_r8

currentPatch%canopy_layer_tvai(:) = 0.0_r8
currentPatch%canopy_layer_tlai(:) = 0.0_r8

currentPatch%seeds_in(:) = 0.0_r8
currentPatch%seed_decay(:) = 0.0_r8
Expand Down
50 changes: 31 additions & 19 deletions biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module EDPhysiologyMod
use FatesAllometryMod , only : tree_lai
use FatesAllometryMod , only : tree_sai
use FatesAllometryMod , only : decay_coeff_kn
use FatesAllometryMod , only : CumulativeLayerTVAI

use EDTypesMod , only : numWaterMem
use EDTypesMod , only : dl_sf, dinc_ed
Expand Down Expand Up @@ -181,31 +180,42 @@ subroutine trim_canopy( currentSite )
real(r8) :: sla_levleaf ! sla at leaf level z
real(r8) :: nscaler_levleaf ! nscaler value at leaf level z
integer :: cl ! canopy layer index
real(r8) :: cum_tvai ! cumulative total vegetation area index at arbitrary leaf layers
real(r8) :: vai ! leaf and stem area in this layer
real(r8) :: kn ! nitrogen decay coefficient
real(r8) :: sla_max ! Observational constraint on how large sla (m2/gC) can become

real(r8) :: leaf_inc ! LAI-only portion of the vegetation increment of dinc_ed
real(r8) :: lai_canopy_above ! the LAI in the canopy layers above the layer of interest
real(r8) :: lai_layers_above ! the LAI in the leaf layers, within the current canopy,
! above the leaf layer of interest
real(r8) :: lai_current ! the LAI in the current leaf layer
real(r8) :: cumulative_lai ! the cumulative LAI, top down, to the leaf layer of interest

!----------------------------------------------------------------------

write(fates_log(),*) 'trimming'

currentPatch => currentSite%youngest_patch

do while(associated(currentPatch))

currentCohort => currentPatch%tallest
do while (associated(currentCohort))

trimmed = .false.
ipft = currentCohort%pft
call carea_allom(currentCohort%dbh,currentCohort%n,currentSite%spread,currentCohort%pft,currentCohort%c_area)
currentCohort%treelai = tree_lai(currentCohort%bl, currentCohort%status_coh, currentCohort%pft, &
currentCohort%c_area, currentCohort%n, currentCohort%canopy_layer, currentPatch%canopy_layer_tvai )
currentCohort%treesai = tree_sai(currentCohort%pft, currentCohort%treelai)
currentCohort%nv = ceiling((currentCohort%treelai+currentCohort%treesai)/dinc_ed)
currentCohort%treelai = tree_lai(currentCohort%bl, currentCohort%pft, currentCohort%c_area, &
currentCohort%n, currentCohort%canopy_layer, &
currentPatch%canopy_layer_tlai )

currentCohort%treesai = tree_sai(currentCohort%pft, currentCohort%dbh, currentCohort%canopy_trim, &
currentCohort%c_area, currentCohort%n, currentCohort%canopy_layer, &
currentPatch%canopy_layer_tlai, currentCohort%treelai )

currentCohort%nv = ceiling((currentCohort%treelai+currentCohort%treesai)/dinc_ed)

if (currentCohort%nv > nlevleaf)then
write(fates_log(),*) 'nv > nlevleaf',currentCohort%nv,currentCohort%treelai,currentCohort%treesai, &
currentCohort%c_area,currentCohort%n,currentCohort%bl
write(fates_log(),*) 'nv > nlevleaf',currentCohort%nv, &
currentCohort%treelai,currentCohort%treesai, &
currentCohort%c_area,currentCohort%n,currentCohort%bl
call endrun(msg=errMsg(sourcefile, __LINE__))
endif

call bleaf(currentcohort%dbh,ipft,currentcohort%canopy_trim,tar_bl)
Expand All @@ -226,13 +236,15 @@ subroutine trim_canopy( currentSite )
do z = 1, currentCohort%nv

! Calculate the cumulative total vegetation area index (no snow occlusion, stems and leaves)
cum_tvai = CumulativeLayerTVAI(cl, &
z, &
ipft, &
currentCohort%treelai+currentCohort%treesai, &
currentPatch%canopy_layer_tvai(:))


leaf_inc = dinc_ed * &
currentCohort%treelai/(currentCohort%treelai+currentCohort%treesai)

! Now calculate the cumulative top-down lai of the current layer's midpoint
lai_canopy_above = sum(currentPatch%canopy_layer_tlai(1:cl-1))
lai_layers_above = leaf_inc * (z-1)
lai_current = min(leaf_inc, currentCohort%treelai - lai_layers_above)
cumulative_lai = lai_canopy_above + lai_layers_above + 0.5*lai_current

if (currentCohort%year_net_uptake(z) /= 999._r8)then !there was activity this year in this leaf layer.

Expand All @@ -241,7 +253,7 @@ subroutine trim_canopy( currentSite )
! Scale for leaf nitrogen profile
kn = decay_coeff_kn(ipft)
! Nscaler value at leaf level z
nscaler_levleaf = exp(-kn * cum_tvai)
nscaler_levleaf = exp(-kn * cumulative_lai)
! Sla value at leaf level z after nitrogen profile scaling (m2/gC)
sla_levleaf = EDPftvarcon_inst%slatop(ipft)/nscaler_levleaf

Expand Down
Loading

0 comments on commit 3aa3791

Please sign in to comment.