Skip to content

Commit

Permalink
Fixed issue of tall canopies leading to layer issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
drnimbusrain committed Jan 21, 2024
1 parent a8c2220 commit 4329e91
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 42 deletions.
9 changes: 5 additions & 4 deletions src/canopy_bioemi_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, &
PPFD_SHADE, TLEAF_SUN, TLEAF_SHADE, TLEAF_AVE, TEMP2, LU_OPT, &
VTYPE, MODRES, CCE, VERT, CO2OPT, CO2SET, &
LEAFAGEOPT, PASTLAI, CURRENTLAI, TSTEPLAI, &
EMI_IND, EMI_OUT)
MODLAYS, EMI_IND, EMI_OUT)

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

Expand Down Expand Up @@ -70,6 +70,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, &
REAL(RK), INTENT( IN ) :: CURRENTLAI ! Current LAI [cm2/cm2]
REAL(RK), INTENT( IN ) :: TSTEPLAI !Number of days between the past and current LAI

INTEGER, INTENT( IN ) :: MODLAYS ! Input total model layers
INTEGER, INTENT( IN ) :: EMI_IND ! Input biogenic emissions index
REAL(RK), INTENT( OUT ) :: EMI_OUT(:) ! Output canopy layer volume emissions (kg m-3 s-1)

Expand Down Expand Up @@ -187,7 +188,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, &
end do
else if (VERT .eq. 1) then !"MEGANv3-like": Use weighting factors normalized to plant distribution shape (FCLAI)
!across canopy layers
LAYERS = floor(FCH/MODRES) + 1
LAYERS = min((floor(FCH/MODRES) + 1),MODLAYS)
do i=1, SIZE(ZK)
if (ZK(i) .gt. 0.0 .and. ZK(i) .le. FCH) then
FLAI(i) = ((FCLAI(i+1) - FCLAI(i)) * LAI)/MODRES !fractional LAI in each layer converted to LAD (m2 m-3)
Expand All @@ -205,7 +206,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, &
!across canopy layers using 5 layer numbers directly from MEGANv3
!--warning: weights are not consistent with FCLAI distribution
!used for biomass distribution used for sunlit/shaded in Gamma TLEAF and GammaPPFD.
LAYERS = floor(FCH/MODRES) + 1
LAYERS = min((floor(FCH/MODRES) + 1),MODLAYS)
do i=1, SIZE(ZK)
if (ZK(i) .gt. FCH) then
GAUSS(i) = 0.0
Expand Down Expand Up @@ -237,7 +238,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, &
!across canopy layers
!--warning: weights are not consistent with FCLAI distribution
!used for biomass distribution used for sunlit/shaded in Gamma TLEAF and GammaPPFD.
LAYERS = floor(FCH/MODRES) + 1
LAYERS = min((floor(FCH/MODRES) + 1),MODLAYS)
do i=1, SIZE(ZK)
VPGWT(i) = 1.0_rk/LAYERS
end do
Expand Down
Loading

0 comments on commit 4329e91

Please sign in to comment.