From a84a6ac827f7e37a888801cabbdafeacb4da9087 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Sat, 10 Feb 2024 22:14:14 -0500 Subject: [PATCH] Another fix for tall canopies when differencing. --- src/canopy_bioemi_mod.F90 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index 1c1eb933..68123966 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -181,7 +181,11 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, & if (VERT .eq. 0) then !Full 3D leaf-level biogenic emissions (no averaging, summing, or integration) do i=1, SIZE(ZK) if (ZK(i) .gt. 0.0 .and. ZK(i) .le. FCH) then ! above ground level and at/below canopy top - FLAI(i) = ((FCLAI(i+1) - FCLAI(i)) * LAI)/MODRES !fractional LAI in each layer converted to LAD (m2 m-3) + if (i .lt. MODLAYS) then + FLAI(i) = ((FCLAI(i+1) - FCLAI(i)) * LAI)/MODRES !fractional LAI in each layer converted to LAD (m2 m-3) + else + FLAI(i) = FLAI(MODLAYS-1) + end if EMI_OUT(i) = FLAI(i) * EF * GammaTLEAF_AVE(i) * GammaPPFD_AVE(i) * GAMMACO2 * CCE * GAMMALEAFAGE ! (ug m-3 hr-1) EMI_OUT(i) = EMI_OUT(i) * 2.7777777777778E-13_rk !convert emissions output to (kg m-3 s-1) end if @@ -191,7 +195,11 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, & 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) + if (i .lt. MODLAYS) then + FLAI(i) = ((FCLAI(i+1) - FCLAI(i)) * LAI)/MODRES !fractional LAI in each layer converted to LAD (m2 m-3) + else + FLAI(i) = FLAI(MODLAYS-1) + end if end if end do do i=1, SIZE(ZK)