Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions biogeochem/DamageMainMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ module DamageMainMod
character(len=*), parameter, private :: sourcefile = &
__FILE__

public :: GetCrownReduction
public :: GetDamageFrac
public :: IsItDamageTime
public :: damage_time
public :: GetDamageMortality


logical :: debug = .false. ! for debugging


Expand Down Expand Up @@ -163,20 +161,7 @@ end subroutine GetDamageFrac

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

subroutine GetCrownReduction(crowndamage, crown_reduction)

!------------------------------------------------------------------
! This subroutine takes the crown damage class of a cohort (integer)
! and returns the fraction of the crown that is lost.
!-------------------------------------------------------------------

integer(i4), intent(in) :: crowndamage ! crown damage class of the cohort
real(r8), intent(out) :: crown_reduction ! fraction of crown lost from damage

crown_reduction = ED_val_history_damage_bin_edges(crowndamage)/100.0_r8

return
end subroutine GetCrownReduction


!----------------------------------------------------------------------------------------
Expand Down
73 changes: 33 additions & 40 deletions biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,20 @@ module EDCanopyStructureMod
use EDCohortDynamicsMod , only : InitPRTBoundaryConditions
use FatesAllometryMod , only : tree_lai
use FatesAllometryMod , only : tree_sai
use EDCohortDynamicsMod , only : GetNLevVeg
use EDtypesMod , only : ed_site_type, ed_patch_type, ed_cohort_type
use EDTypesMod , only : nclmax
use EDTypesMod , only : nlevleaf
use EDtypesMod , only : AREA
use EDtypesMod , only : area, dinc_vai, dlower_vai
use EDTypesMod , only : n_hite_bins
use EDLoggingMortalityMod , only : UpdateHarvestC
use FatesGlobals , only : endrun => fates_endrun
use FatesInterfaceTypesMod , only : hlm_days_per_year
use FatesInterfaceTypesMod , only : hlm_use_planthydro
use FatesInterfaceTypesMod , only : hlm_use_cohort_age_tracking
use FatesInterfaceTypesMod , only : hlm_use_sp
use FatesInterfaceTypesMod , only : numpft
use FatesInterfaceTypesMod, only : bc_in_type
use FatesInterfaceTypesMod, only : bc_in_type,bc_out_type
use FatesPlantHydraulicsMod, only : UpdateH2OVeg,InitHydrCohort, RecruitWaterStorage
use PRTGenericMod, only : leaf_organ
use PRTGenericMod, only : leaf_organ
Expand Down Expand Up @@ -1228,7 +1230,6 @@ subroutine canopy_spread( currentSite )
! Calculates the spatial spread of tree canopies based on canopy closure.
!
! !USES:
use EDTypesMod , only : AREA
use EDParamsMod, only : ED_val_canopy_closure_thresh
!
! !ARGUMENTS
Expand Down Expand Up @@ -1267,7 +1268,7 @@ subroutine canopy_spread( currentSite )

! If the canopy area is approaching closure,
! squash the tree canopies and make them taller and thinner
if( sitelevel_canopyarea/AREA .gt. ED_val_canopy_closure_thresh ) then
if( sitelevel_canopyarea/area .gt. ED_val_canopy_closure_thresh ) then
currentSite%spread = currentSite%spread - inc
else
currentSite%spread = currentSite%spread + inc
Expand Down Expand Up @@ -1466,8 +1467,10 @@ subroutine leaf_area_profile( currentSite )
!
! currentCohort%treelai ! LAI per unit crown area (m2/m2)
! currentCohort%treesai ! SAI per unit crown area (m2/m2)
! currentCohort%NV ! The number of discrete vegetation
! currentCohort%nveg_ ! The number of discrete vegetation
! ! layers needed to describe this crown
! ! _max: on-allometry
! ! _act: actual (not necessarily on allometry)
!
! The following patch level diagnostics are updated here:
!
Expand All @@ -1491,7 +1494,7 @@ subroutine leaf_area_profile( currentSite )

! !USES:

use EDtypesMod , only : area, dinc_vai, dlower_vai, hitemax, n_hite_bins


!
! !ARGUMENTS
Expand Down Expand Up @@ -1520,8 +1523,6 @@ subroutine leaf_area_profile( currentSite )
real(r8) :: sai ! stem area per canopy area

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


! Here we are trying to generate a profile of leaf area, indexed by 'z' and by pft
! We assume that each point in the canopy recieved the light attenuated by the average
! leaf area index above it, irrespective of PFT identity...
Expand Down Expand Up @@ -1599,19 +1600,19 @@ subroutine leaf_area_profile( currentSite )
! before dividing it by the total area. Fill up layer for whole layers.
! --------------------------------------------------------------------------

do iv = 1,currentCohort%NV
do iv = 1,currentCohort%nveg_act

! This loop builds the arrays that define the effective (not snow covered)
! and total (includes snow covered) area indices for leaves and stems
! We calculate the absolute elevation of each layer to help determine if the layer
! is obscured by snow.

layer_top_hite = currentCohort%hite - &
( real(iv-1,r8)/currentCohort%NV * currentCohort%hite * &
( real(iv-1,r8)/currentCohort%nveg_act * currentCohort%hite * &
prt_params%crown_depth_frac(currentCohort%pft) )

layer_bottom_hite = currentCohort%hite - &
( real(iv,r8)/currentCohort%NV * currentCohort%hite * &
( real(iv,r8)/currentCohort%nveg_act * currentCohort%hite * &
prt_params%crown_depth_frac(currentCohort%pft) )

fraction_exposed = 1.0_r8
Expand All @@ -1627,13 +1628,13 @@ subroutine leaf_area_profile( currentSite )
(layer_top_hite-layer_bottom_hite ))))
endif

if(iv==currentCohort%NV) then
if(iv==currentCohort%nveg_act) then
remainder = (currentCohort%treelai + currentCohort%treesai) - &
(dlower_vai(iv) - dinc_vai(iv))
if(remainder > dinc_vai(iv) )then
write(fates_log(), *)'ED: issue with remainder', &
currentCohort%treelai,currentCohort%treesai,dinc_vai(iv), &
currentCohort%NV,remainder
dlower_vai(iv),currentCohort%nveg_act,remainder

call endrun(msg=errMsg(sourcefile, __LINE__))
endif
Expand Down Expand Up @@ -1793,11 +1794,6 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out)
! to vegetation coverage to the host land model.
! ----------------------------------------------------------------------------------

use EDTypesMod , only : ed_patch_type, ed_cohort_type, &
ed_site_type, AREA
use FatesInterfaceTypesMod , only : bc_out_type

!
! !ARGUMENTS
integer, intent(in) :: nsites
type(ed_site_type), intent(inout), target :: sites(nsites)
Expand Down Expand Up @@ -1903,17 +1899,17 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out)
! The alternative is to assume it is all spatial distinct from tree canopies.
! In which case, the bare area would have to be reduced by the grass area...
! currentPatch%total_canopy_area/currentPatch%area is fraction of this patch cover by plants
! currentPatch%area/AREA is the fraction of the soil covered by this patch.
! currentPatch%area/area is the fraction of the soil covered by this patch.

if(currentPatch%area.gt.0.0_r8)then
bc_out(s)%canopy_fraction_pa(ifp) = &
min(1.0_r8,currentPatch%total_canopy_area/currentPatch%area)*(currentPatch%area/AREA)
min(1.0_r8,currentPatch%total_canopy_area/currentPatch%area)*(currentPatch%area/area)
else
bc_out(s)%canopy_fraction_pa(ifp) = 0.0_r8
endif

bare_frac_area = (1.0_r8 - min(1.0_r8,currentPatch%total_canopy_area/currentPatch%area)) * &
(currentPatch%area/AREA)
(currentPatch%area/area)

total_patch_area = total_patch_area + bc_out(s)%canopy_fraction_pa(ifp) + bare_frac_area

Expand Down Expand Up @@ -1946,7 +1942,7 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out)

else ! nocomp or SP, and currentPatch%nocomp_pft_label .eq. 0

total_patch_area = total_patch_area + currentPatch%area/AREA
total_patch_area = total_patch_area + currentPatch%area/area

end if
currentPatch => currentPatch%younger
Expand Down Expand Up @@ -2119,7 +2115,6 @@ subroutine UpdatePatchLAI(currentPatch)
! ---------------------------------------------------------------------------------------------

! Uses
use EDtypesMod, only : dlower_vai

! Arguments
type(ed_patch_type),intent(inout), target :: currentPatch
Expand All @@ -2134,6 +2129,8 @@ subroutine UpdatePatchLAI(currentPatch)
! patch by canopy layer first. Given that canopy_layer_tlai is a patch level variable
! we could iterate through each cohort in any direction as long as we go down through
! the canopy layers.

currentPatch%ncan(:,:) = 0

canopyloop: do cl = 1,nclmax
currentCohort => currentPatch%tallest
Expand All @@ -2144,12 +2141,10 @@ subroutine UpdatePatchLAI(currentPatch)
ft = currentCohort%pft

! Update the cohort level lai and related variables
call UpdateCohortLAI(currentCohort,currentPatch%canopy_layer_tlai, &
currentPatch%total_canopy_area)

! Update the number of number of vegetation layers
currentPatch%ncan(cl,ft) = max(currentPatch%ncan(cl,ft),currentCohort%NV)
call UpdateCohortLAI(currentCohort,currentPatch)

currentPatch%ncan(cl,ft) = max(currentPatch%ncan(cl,ft),currentCohort%nveg_act)

! Update the patch canopy layer tlai (LAI per canopy area)
currentPatch%canopy_layer_tlai(cl) = currentPatch%canopy_layer_tlai(cl) + &
currentCohort%treelai *currentCohort%c_area/currentPatch%total_canopy_area
Expand All @@ -2163,17 +2158,14 @@ subroutine UpdatePatchLAI(currentPatch)
end subroutine UpdatePatchLAI
! ===============================================================================================

subroutine UpdateCohortLAI(currentCohort, canopy_layer_tlai, total_canopy_area)
subroutine UpdateCohortLAI(currentCohort, currentPatch)

! Update LAI and related variables for a given cohort

! Uses
use EDtypesMod, only : dlower_vai

! Arguments
type(ed_cohort_type),intent(inout), target :: currentCohort
real(r8), intent(in) :: canopy_layer_tlai(nclmax) ! total leaf area index of each canopy layer
real(r8), intent(in) :: total_canopy_area ! either patch%total_canopy_area or patch%area
type(ed_cohort_type) :: currentCohort
type(ed_patch_type) :: currentPatch

! Local variables
real(r8) :: leaf_c ! leaf carbon [kg]
Expand All @@ -2185,19 +2177,20 @@ subroutine UpdateCohortLAI(currentCohort, canopy_layer_tlai, total_canopy_area)
! Note that tree_lai has an internal check on the canopy locatoin
currentCohort%treelai = tree_lai(leaf_c, currentCohort%pft, currentCohort%c_area, &
currentCohort%n, currentCohort%canopy_layer, &
canopy_layer_tlai,currentCohort%vcmax25top )
currentPatch%canopy_layer_tlai, currentCohort%vcmax25top )

if (hlm_use_sp .eq. ifalse) then
currentCohort%treesai = tree_sai(currentCohort%pft, currentCohort%dbh, currentCohort%crowndamage, &
currentCohort%canopy_trim, &
currentCohort%c_area, currentCohort%n, currentCohort%canopy_layer, &
canopy_layer_tlai, currentCohort%treelai , &
currentCohort%vcmax25top,4)
currentPatch%canopy_layer_tlai, currentCohort%treelai , &
sum(dinc_vai),currentCohort%vcmax25top,4)
end if

! Number of actual vegetation layers in this cohort's crown
currentCohort%nv = count((currentCohort%treelai+currentCohort%treesai) .gt. dlower_vai(:)) + 1

! Number of actual vegetation layers in this cohort's crown
call GetNLevVeg(currentCohort,currentPatch)

return
end subroutine UpdateCohortLAI

! ===============================================================================================
Expand Down
Loading