From a0806e156a6e7236ba1dfd4cb4e2de02ebdb6209 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 19 May 2023 14:00:20 -0400 Subject: [PATCH 01/64] Initial commit for new biogenic related options. --- input/namelist.canopy | 1 + src/canopy_bioemi_mod.F90 | 20 ++++++---- src/canopy_calcs.F90 | 76 +++++++++++++++++++------------------- src/canopy_canopts_mod.F90 | 1 + src/canopy_readnml.F90 | 7 +++- 5 files changed, 58 insertions(+), 47 deletions(-) diff --git a/input/namelist.canopy b/input/namelist.canopy index a07e3417..22f283d8 100755 --- a/input/namelist.canopy +++ b/input/namelist.canopy @@ -30,6 +30,7 @@ lu_opt = 1 z0_opt = 0 bio_cce = 0.21 + bio_vert = 0 lai_thresh = 0.1 frt_thresh = 0.1 fch_thresh = 0.5 diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index 85da7d7c..e3af371c 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -6,7 +6,7 @@ module canopy_bioemi_mod !::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & - TEMP2, LU_OPT, VTYPE, MODRES, CCE, EMI_IND, EMI_OUT) + TEMP2, LU_OPT, VTYPE, MODRES, CCE, VERT, EMI_IND, EMI_OUT) !----------------------------------------------------------------------- @@ -52,6 +52,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & REAL(RK), INTENT( IN ) :: MODRES ! Canopy model input vertical resolution (m) REAL(RK), INTENT( IN ) :: CCE ! MEGAN Canopy environment coefficient. INTEGER, INTENT( IN ) :: EMI_IND ! Input biogenic emissions index + INTEGER, INTENT( IN ) :: VERT ! MEGAN vertical integration option (default = 0/no integration) REAL(RK), INTENT( OUT ) :: EMI_OUT(:) ! Output canopy layer volume emissions (kg m-3 s-1) ! Local Variables @@ -300,13 +301,16 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & ! Calculate emissions profile in the canopy EMI_OUT = 0.0_rk ! set initial emissions profile to zero - 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) - EMI_OUT(i) = FLAI(i) * EF * GammaTLEAF_AVE(i) * GammaPPFD_AVE(i) * CCE ! (ug m-3 hr-1) - EMI_OUT(i) = EMI_OUT(i) * 2.7777777777778E-13_rk !TBD: convert emissions output to (kg m-3 s-1) - end if - end do + + 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) + EMI_OUT(i) = FLAI(i) * EF * GammaTLEAF_AVE(i) * GammaPPFD_AVE(i) * CCE ! (ug m-3 hr-1) + EMI_OUT(i) = EMI_OUT(i) * 2.7777777777778E-13_rk !TBD: convert emissions output to (kg m-3 s-1) + end if + end do + end if END SUBROUTINE CANOPY_BIO diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index 3f47929b..8638d8b6 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -153,79 +153,79 @@ SUBROUTINE canopy_calcs !ISOP call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 1, emi_isop_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 1, emi_isop_3d(i,j,:)) !MYRC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 2, emi_myrc_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 2, emi_myrc_3d(i,j,:)) !SABI call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 3, emi_sabi_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 3, emi_sabi_3d(i,j,:)) !LIMO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 4, emi_limo_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 4, emi_limo_3d(i,j,:)) !CARE call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 5, emi_care_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 5, emi_care_3d(i,j,:)) !OCIM call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 6, emi_ocim_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 6, emi_ocim_3d(i,j,:)) !BPIN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 7, emi_bpin_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 7, emi_bpin_3d(i,j,:)) !APIN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 8, emi_apin_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 8, emi_apin_3d(i,j,:)) !MONO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 9, emi_mono_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 9, emi_mono_3d(i,j,:)) !FARN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 10, emi_farn_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 10, emi_farn_3d(i,j,:)) !CARY call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 11, emi_cary_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 11, emi_cary_3d(i,j,:)) !SESQ call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 12, emi_sesq_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 12, emi_sesq_3d(i,j,:)) !MBOL call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 13, emi_mbol_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 13, emi_mbol_3d(i,j,:)) !METH call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 14, emi_meth_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 14, emi_meth_3d(i,j,:)) !ACET call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 15, emi_acet_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 15, emi_acet_3d(i,j,:)) !CO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 16, emi_co_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 16, emi_co_3d(i,j,:)) !BIDI VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 17, emi_bvoc_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 17, emi_bvoc_3d(i,j,:)) !Stress VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 18, emi_svoc_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 18, emi_svoc_3d(i,j,:)) !Other VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 19, emi_ovoc_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 19, emi_ovoc_3d(i,j,:)) end if end if @@ -365,79 +365,79 @@ SUBROUTINE canopy_calcs !ISOP call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 1, emi_isop(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 1, emi_isop(loc,:)) !MYRC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 2, emi_myrc(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 2, emi_myrc(loc,:)) !SABI call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 3, emi_sabi(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 3, emi_sabi(loc,:)) !LIMO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 4, emi_limo(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 4, emi_limo(loc,:)) !CARE call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 5, emi_care(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 5, emi_care(loc,:)) !OCIM call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 6, emi_ocim(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 6, emi_ocim(loc,:)) !BPIN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 7, emi_bpin(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 7, emi_bpin(loc,:)) !APIN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 8, emi_apin(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 8, emi_apin(loc,:)) !MONO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 9, emi_mono(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 9, emi_mono(loc,:)) !FARN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 10, emi_farn(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 10, emi_farn(loc,:)) !CARY call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 11, emi_cary(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 11, emi_cary(loc,:)) !SESQ call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 12, emi_sesq(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 12, emi_sesq(loc,:)) !MBOL call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 13, emi_mbol(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 13, emi_mbol(loc,:)) !METH call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 14, emi_meth(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 14, emi_meth(loc,:)) !ACET call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 15, emi_acet(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 15, emi_acet(loc,:)) !CO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 16, emi_co(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 16, emi_co(loc,:)) !BIDI VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 17, emi_bvoc(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 17, emi_bvoc(loc,:)) !Stress VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 18, emi_svoc(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 18, emi_svoc(loc,:)) !Other VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, 19, emi_ovoc(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, 19, emi_ovoc(loc,:)) end if end if diff --git a/src/canopy_canopts_mod.F90 b/src/canopy_canopts_mod.F90 index 2fd44171..19b8681e 100644 --- a/src/canopy_canopts_mod.F90 +++ b/src/canopy_canopts_mod.F90 @@ -33,5 +33,6 @@ MODULE canopy_canopts_mod real(rk) :: z0ghc !ratio of ground roughness length to canopy top height real(rk) :: lambdars !Value representing influence of roughness sublayer (nondimensional) real(rk) :: bio_cce !MEGAN biogenic emission canopy environment coefficient. + integer :: bio_vert !MEGAN vertical integration of emissions option (default = 0, off) END MODULE canopy_canopts_mod diff --git a/src/canopy_readnml.F90 b/src/canopy_readnml.F90 index a9eb4f4a..860cc8b1 100644 --- a/src/canopy_readnml.F90 +++ b/src/canopy_readnml.F90 @@ -23,7 +23,7 @@ SUBROUTINE canopy_readnml NAMELIST /userdefs/ infmt_opt, nlat, nlon, modlays, modres, href_opt, href_set, & z0ghc, lambdars, flameh_opt, flameh_set, frp_fac, ifcanwind, ifcanwaf, & ifcaneddy, ifcanphot, ifcanbio, pai_opt, pai_set, lu_opt, z0_opt, dx_opt, & - dx_set, lai_thresh, frt_thresh, fch_thresh, rsl_opt, bio_cce + dx_set, lai_thresh, frt_thresh, fch_thresh, rsl_opt, bio_cce, bio_vert !------------------------------------------------------------------------------- ! Error, warning, and informational messages. @@ -201,6 +201,11 @@ SUBROUTINE canopy_readnml bio_cce = 0.21_rk !------------------------------------------------------------------------------- +!------------------------------------------------------------------------------- +! Set default integer value for MEGAN vertical integration of emissions (0, off full leaf-level emissions) + bio_vert = 0 +!------------------------------------------------------------------------------- + !------------------------------------------------------------------------------- ! Read namelist to get user definitions. Rewind namelist file after each ! read in case namelists are not in the correct order in the namelist. From 570037a7d94e3aefadb7d3076fc826df39f7fe97 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 19 May 2023 22:48:03 -0400 Subject: [PATCH 02/64] Forced bio_vert option to only default =0 right now... --- README.md | 1 + src/canopy_bioemi_mod.F90 | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 409f0e3e..8f173613 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `lu_opt` | integer for input model land use type (`0`: VIIRS 17 Cat (default) or `1`: MODIS-IGBP 20 Cat (valid LU types 1-10 and 12); input mapped to Massman et al.) | | `z0_opt` | integer (`0`: use model input or `1`: vegtype dependent z0 for first estimate) | | `bio_cce` | user-set real value of MEGAN biogenic emissions "canopy environment coefficient" used to tune emissions to model inputs/calculations (default: `0.21`, based on Silva et al. 2020) | +| `bio_vert` | user set biogenic vertical integration option (default = 0/no integration, full leaf-level biogenic emissions) | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | | `frt_thresh` | user-set real value of forest fraction threshold for contiguous canopy | | `fch_thresh` | user-set real value of canopy height threshold for contiguous canopy (m) | diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index e3af371c..a2ae27d8 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -302,14 +302,17 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & ! Calculate emissions profile in the canopy EMI_OUT = 0.0_rk ! set initial emissions profile to zero - if (VERT .eq. 0) then !Full 3D leaf-level biogenic emissions (no averaging, summing, or integration + 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 + 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) EMI_OUT(i) = FLAI(i) * EF * GammaTLEAF_AVE(i) * GammaPPFD_AVE(i) * CCE ! (ug m-3 hr-1) - EMI_OUT(i) = EMI_OUT(i) * 2.7777777777778E-13_rk !TBD: convert emissions output to (kg m-3 s-1) + EMI_OUT(i) = EMI_OUT(i) * 2.7777777777778E-13_rk !convert emissions output to (kg m-3 s-1) end if end do + else !Need to add vertical sum/ave/integ options here... + write(*,*) 'Wrong BIO_VERT choice of ', VERT, ' in namelist...exiting' + call exit(2) end if END SUBROUTINE CANOPY_BIO From cf5275fdb6efbd42f53c74436953e5cbec2e6b1b Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Mon, 22 May 2023 16:15:04 -0400 Subject: [PATCH 03/64] Added new bio_vert=1 option for MEGANv3-like sum. --- README.md | 2 +- src/canopy_bioemi_mod.F90 | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8f173613..b1840d28 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `lu_opt` | integer for input model land use type (`0`: VIIRS 17 Cat (default) or `1`: MODIS-IGBP 20 Cat (valid LU types 1-10 and 12); input mapped to Massman et al.) | | `z0_opt` | integer (`0`: use model input or `1`: vegtype dependent z0 for first estimate) | | `bio_cce` | user-set real value of MEGAN biogenic emissions "canopy environment coefficient" used to tune emissions to model inputs/calculations (default: `0.21`, based on Silva et al. 2020) | -| `bio_vert` | user set biogenic vertical integration option (default = 0/no integration, full leaf-level biogenic emissions) | +| `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of equally weighted activity coefficients acoss all sub-canopy layers, caution-- units=kg/m2/s and puts the total emissions in the topmost canopy-app model layer only ) | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | | `frt_thresh` | user-set real value of forest fraction threshold for contiguous canopy | | `fch_thresh` | user-set real value of canopy height threshold for contiguous canopy (m) | diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index a2ae27d8..7c2d33d0 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -93,10 +93,11 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & REAL(RK) :: E_OPT(SIZE(ZK)) ! maximum normalized emission capacity REAL(RK) :: TLEAF_OPT(SIZE(ZK)) ! Tleaf at which E_OPT occurs (K) REAL(RK) :: FLAI(SIZE(ZK)) ! Fractional LAI in layer + REAL(RK) :: VPGWT(SIZE(ZK)) ! MEGANv3-like in-canopy weighting factor REAL(RK) :: CT1 ! Activation energy (kJ/mol) REAL(RK) :: CEO ! Empirical coefficient REAL(RK) :: EF ! Final Mapped Emission factor (EF) (ug/m2 hr) - integer i + integer i, LAYERS ! Constant Canopy Parameters REAL(RK), PARAMETER :: FRAC_PAR = 0.5_rk !Fraction of incoming solar irradiance that is PAR @@ -302,7 +303,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & ! Calculate emissions profile in the canopy EMI_OUT = 0.0_rk ! set initial emissions profile to zero - if (VERT .eq. 0) then !Full 3D leaf-level biogenic emissions (no averaging, summing, or integration) + 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) @@ -310,7 +311,15 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & EMI_OUT(i) = EMI_OUT(i) * 2.7777777777778E-13_rk !convert emissions output to (kg m-3 s-1) end if end do - else !Need to add vertical sum/ave/integ options here... + else if (VERT .eq. 1) then !MEGANv3: Add weighted sum of activity coefficients for all canopy layers + LAYERS = floor(FCH/MODRES) + do i=1, SIZE(ZK) + VPGWT(i) = 1.0_rk/LAYERS !constant weighting factors across depth of canopy + end do + EMI_OUT(SIZE(ZK)) = LAI * EF * SUM(GammaTLEAF_AVE(1:LAYERS) * GammaPPFD_AVE(1:LAYERS) * & + VPGWT(1:LAYERS)) * CCE !put into top model layer (ug m-2 hr-1) + EMI_OUT = EMI_OUT * 2.7777777777778E-13_rk !convert emissions output to (kg m-2 s-1) + else write(*,*) 'Wrong BIO_VERT choice of ', VERT, ' in namelist...exiting' call exit(2) end if From abbe51ba8e648e0235e9c002245180fde640b80d Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Mon, 22 May 2023 21:32:49 -0400 Subject: [PATCH 04/64] Added new crop_opt to specify crop type heights. --- README.md | 2 ++ input/namelist.canopy | 2 ++ src/canopy_calcs.F90 | 32 ++++++++++++++++++++++++++++++++ src/canopy_canopts_mod.F90 | 2 ++ src/canopy_readnml.F90 | 13 ++++++++++++- 5 files changed, 50 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b1840d28..d4541e7f 100644 --- a/README.md +++ b/README.md @@ -198,6 +198,8 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `z0_opt` | integer (`0`: use model input or `1`: vegtype dependent z0 for first estimate) | | `bio_cce` | user-set real value of MEGAN biogenic emissions "canopy environment coefficient" used to tune emissions to model inputs/calculations (default: `0.21`, based on Silva et al. 2020) | | `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of equally weighted activity coefficients acoss all sub-canopy layers, caution-- units=kg/m2/s and puts the total emissions in the topmost canopy-app model layer only ) | +| `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | +| `crop_set` | user-set real value of constant crop vegetation type heights (m) (only used if `crop_opt=1`) **\*\*\*** | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | | `frt_thresh` | user-set real value of forest fraction threshold for contiguous canopy | | `fch_thresh` | user-set real value of canopy height threshold for contiguous canopy (m) | diff --git a/input/namelist.canopy b/input/namelist.canopy index 22f283d8..f5cdf2aa 100755 --- a/input/namelist.canopy +++ b/input/namelist.canopy @@ -31,6 +31,8 @@ z0_opt = 0 bio_cce = 0.21 bio_vert = 0 + crop_opt = 0 + crop_set = 3.0 lai_thresh = 0.1 frt_thresh = 0.1 fch_thresh = 0.5 diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index 8638d8b6..84be7e5f 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -84,6 +84,22 @@ SUBROUTINE canopy_calcs if (lu_opt .eq. 0 .or. lu_opt .eq. 1 ) then !VIIRS or MODIS if (vtyperef .gt. 0 .and. vtyperef .le. 10 .or. vtyperef .eq. 12) then !VIIRS or MODIS types +! ... check for crop_opt from user namelist + if (vtyperef .eq. 12) then !VIIRS/MODIS crop type + if (crop_opt .eq. 0) then !use GEDI inputs for crop height + hcmref = hcmref + else if (crop_opt .eq. 1) then !user set constant crop height + hcmref = crop_set + !recalculate + zhc = zk/hcmref + cansublays = floor(hcmref/modres) + else + write(*,*) 'Wrong CROP_OPT choice of ', crop_opt, & + ' in namelist...exiting' + call exit(2) + end if + end if + ! ... check for contiguous canopy conditions at each model grid cell if (hcmref .gt. fch_thresh .and. ffracref .gt. frt_thresh & .and. lairef .gt. lai_thresh) then @@ -296,6 +312,22 @@ SUBROUTINE canopy_calcs if (lu_opt .eq. 0 .or. lu_opt .eq. 1 ) then !VIIRS or MODIS if (vtyperef .gt. 0 .and. vtyperef .le. 10 .or. vtyperef .eq. 12) then !VIIRS or MODIS types +! ... check for crop_opt from user namelist + if (vtyperef .eq. 12) then !VIIRS/MODIS crop type + if (crop_opt .eq. 0) then !use GEDI inputs for crop height + hcmref = hcmref + else if (crop_opt .eq. 1) then !user set constant crop height + hcmref = crop_set + !recalculate + zhc = zk/hcmref + cansublays = floor(hcmref/modres) + else + write(*,*) 'Wrong CROP_OPT choice of ', crop_opt, & + ' in namelist...exiting' + call exit(2) + end if + end if + ! ... check for contiguous canopy conditions at each model grid cell if (hcmref .gt. fch_thresh .and. ffracref .gt. frt_thresh & .and. lairef .gt. lai_thresh) then diff --git a/src/canopy_canopts_mod.F90 b/src/canopy_canopts_mod.F90 index 19b8681e..4c141f4d 100644 --- a/src/canopy_canopts_mod.F90 +++ b/src/canopy_canopts_mod.F90 @@ -34,5 +34,7 @@ MODULE canopy_canopts_mod real(rk) :: lambdars !Value representing influence of roughness sublayer (nondimensional) real(rk) :: bio_cce !MEGAN biogenic emission canopy environment coefficient. integer :: bio_vert !MEGAN vertical integration of emissions option (default = 0, off) + integer :: crop_opt !Set default integer for crop vegtype option from GEDI or user (default = 0) + real(rk) :: crop_set !Set default value for crop vegtype heights used in model (m) (Default = 3 m) END MODULE canopy_canopts_mod diff --git a/src/canopy_readnml.F90 b/src/canopy_readnml.F90 index 860cc8b1..a2ad9a34 100644 --- a/src/canopy_readnml.F90 +++ b/src/canopy_readnml.F90 @@ -23,7 +23,8 @@ SUBROUTINE canopy_readnml NAMELIST /userdefs/ infmt_opt, nlat, nlon, modlays, modres, href_opt, href_set, & z0ghc, lambdars, flameh_opt, flameh_set, frp_fac, ifcanwind, ifcanwaf, & ifcaneddy, ifcanphot, ifcanbio, pai_opt, pai_set, lu_opt, z0_opt, dx_opt, & - dx_set, lai_thresh, frt_thresh, fch_thresh, rsl_opt, bio_cce, bio_vert + dx_set, lai_thresh, frt_thresh, fch_thresh, rsl_opt, bio_cce, bio_vert, & + crop_opt, crop_set !------------------------------------------------------------------------------- ! Error, warning, and informational messages. @@ -206,6 +207,16 @@ SUBROUTINE canopy_readnml bio_vert = 0 !------------------------------------------------------------------------------- +!------------------------------------------------------------------------------- +! Set default integer for crop vegtype option from GEDI or user (default = 0) + crop_opt = 0 +!------------------------------------------------------------------------------- + +!------------------------------------------------------------------------------- +! Set default value for crop vegtype heights used in model (m) (Default = 3 m) + crop_set = 3.0_rk +!------------------------------------------------------------------------------- + !------------------------------------------------------------------------------- ! Read namelist to get user definitions. Rewind namelist file after each ! read in case namelists are not in the correct order in the namelist. From 1735957cf3f5adbec886d984deb7cf7d09c22b44 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Mon, 22 May 2023 21:39:13 -0400 Subject: [PATCH 05/64] Updated README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4541e7f..3cff4224 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `bio_cce` | user-set real value of MEGAN biogenic emissions "canopy environment coefficient" used to tune emissions to model inputs/calculations (default: `0.21`, based on Silva et al. 2020) | | `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of equally weighted activity coefficients acoss all sub-canopy layers, caution-- units=kg/m2/s and puts the total emissions in the topmost canopy-app model layer only ) | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | -| `crop_set` | user-set real value of constant crop vegetation type heights (m) (only used if `crop_opt=1`) **\*\*\*** | +| `crop_set` | user-set real value of constant crop vegetation type heights (m) (only used if `crop_opt=1`) | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | | `frt_thresh` | user-set real value of forest fraction threshold for contiguous canopy | | `fch_thresh` | user-set real value of canopy height threshold for contiguous canopy (m) | From e43d32bd5d5cec6c8b75076ad7dff0d3c50698cf Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Tue, 23 May 2023 10:53:22 -0400 Subject: [PATCH 06/64] Added bio_vert=2 option for LAD weighted sum. --- README.md | 2 +- src/canopy_bioemi_mod.F90 | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3cff4224..9b8e3a4b 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `lu_opt` | integer for input model land use type (`0`: VIIRS 17 Cat (default) or `1`: MODIS-IGBP 20 Cat (valid LU types 1-10 and 12); input mapped to Massman et al.) | | `z0_opt` | integer (`0`: use model input or `1`: vegtype dependent z0 for first estimate) | | `bio_cce` | user-set real value of MEGAN biogenic emissions "canopy environment coefficient" used to tune emissions to model inputs/calculations (default: `0.21`, based on Silva et al. 2020) | -| `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of equally weighted activity coefficients acoss all sub-canopy layers, caution-- units=kg/m2/s and puts the total emissions in the topmost canopy-app model layer only ) | +| `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of equally weighted activity coefficients acoss all sub-canopy layers, caution-- units=kg/m2/s and puts the total emissions in the topmost canopy-app model layer only; `2`: Same as in option 1, but uses LAD weighted activity coefficients from LAD plant distribution function for the sum -- also units of kg/m2/s in topmost model layer) | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | | `crop_set` | user-set real value of constant crop vegetation type heights (m) (only used if `crop_opt=1`) | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index 7c2d33d0..351ac814 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -300,8 +300,11 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & GammaPPFD_AVE = (GammaPPFD_SUN*FSUN) + (GammaPPFD_SHADE*(1.0-FSUN)) ! average = sum sun and shade weighted by sunlit fraction + +! print*, 'FCLAI=',FCLAI ! Calculate emissions profile in the canopy EMI_OUT = 0.0_rk ! set initial emissions profile to zero + FLAI = 0.0_rk ! set initial fractional FLAI (LAD) profile to zero if (VERT .eq. 0) then !Full 3D leaf-level biogenic emissions (no averaging, summing, or integration) do i=1, SIZE(ZK) @@ -314,7 +317,22 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & else if (VERT .eq. 1) then !MEGANv3: Add weighted sum of activity coefficients for all canopy layers LAYERS = floor(FCH/MODRES) do i=1, SIZE(ZK) - VPGWT(i) = 1.0_rk/LAYERS !constant weighting factors across depth of canopy + VPGWT(i) = 1.0_rk/LAYERS !MEGANv3: Constant weighting factors across depth of canopy + end do + EMI_OUT(SIZE(ZK)) = LAI * EF * SUM(GammaTLEAF_AVE(1:LAYERS) * GammaPPFD_AVE(1:LAYERS) * & + VPGWT(1:LAYERS)) * CCE !put into top model layer (ug m-2 hr-1) + EMI_OUT = EMI_OUT * 2.7777777777778E-13_rk !convert emissions output to (kg m-2 s-1) + else if (VERT .eq. 2) then !Use weighting factors normalized to plant distribution shape (FCLAI) + LAYERS = floor(FCH/MODRES) + 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) + end if + end do + do i=1, SIZE(ZK) + if (ZK(i) .gt. 0.0 .and. ZK(i) .le. FCH) then + VPGWT(i) = (FLAI(i))/sum(FLAI(1:LAYERS)) + end if end do EMI_OUT(SIZE(ZK)) = LAI * EF * SUM(GammaTLEAF_AVE(1:LAYERS) * GammaPPFD_AVE(1:LAYERS) * & VPGWT(1:LAYERS)) * CCE !put into top model layer (ug m-2 hr-1) From 2df01845ff2fd6320bfece72badfcf3e920c8677 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Tue, 23 May 2023 21:05:45 -0400 Subject: [PATCH 07/64] Switched bio_vert option 1 and 2. --- README.md | 2 +- src/canopy_bioemi_mod.F90 | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9b8e3a4b..39f8f5ed 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `lu_opt` | integer for input model land use type (`0`: VIIRS 17 Cat (default) or `1`: MODIS-IGBP 20 Cat (valid LU types 1-10 and 12); input mapped to Massman et al.) | | `z0_opt` | integer (`0`: use model input or `1`: vegtype dependent z0 for first estimate) | | `bio_cce` | user-set real value of MEGAN biogenic emissions "canopy environment coefficient" used to tune emissions to model inputs/calculations (default: `0.21`, based on Silva et al. 2020) | -| `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of equally weighted activity coefficients acoss all sub-canopy layers, caution-- units=kg/m2/s and puts the total emissions in the topmost canopy-app model layer only; `2`: Same as in option 1, but uses LAD weighted activity coefficients from LAD plant distribution function for the sum -- also units of kg/m2/s in topmost model layer) | +| `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of LAD weighted activity coefficients using the plant distribution function, caution-- units=kg/m2/s and puts the total emissions in the topmost canopy-app model layer only; `2`: Same as in option 1, but uses equally weighted activity coefficients acoss all sub-canopy layers -- also units of kg/m2/s in topmost model layer) | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | | `crop_set` | user-set real value of constant crop vegetation type heights (m) (only used if `crop_opt=1`) | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index 351ac814..a89c09a8 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -314,15 +314,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & EMI_OUT(i) = EMI_OUT(i) * 2.7777777777778E-13_rk !convert emissions output to (kg m-3 s-1) end if end do - else if (VERT .eq. 1) then !MEGANv3: Add weighted sum of activity coefficients for all canopy layers - LAYERS = floor(FCH/MODRES) - do i=1, SIZE(ZK) - VPGWT(i) = 1.0_rk/LAYERS !MEGANv3: Constant weighting factors across depth of canopy - end do - EMI_OUT(SIZE(ZK)) = LAI * EF * SUM(GammaTLEAF_AVE(1:LAYERS) * GammaPPFD_AVE(1:LAYERS) * & - VPGWT(1:LAYERS)) * CCE !put into top model layer (ug m-2 hr-1) - EMI_OUT = EMI_OUT * 2.7777777777778E-13_rk !convert emissions output to (kg m-2 s-1) - else if (VERT .eq. 2) then !Use weighting factors normalized to plant distribution shape (FCLAI) + else if (VERT .eq. 1) then !MEGANv3: Use weighting factors normalized to plant distribution shape (FCLAI) LAYERS = floor(FCH/MODRES) do i=1, SIZE(ZK) if (ZK(i) .gt. 0.0 .and. ZK(i) .le. FCH) then @@ -337,6 +329,14 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & EMI_OUT(SIZE(ZK)) = LAI * EF * SUM(GammaTLEAF_AVE(1:LAYERS) * GammaPPFD_AVE(1:LAYERS) * & VPGWT(1:LAYERS)) * CCE !put into top model layer (ug m-2 hr-1) EMI_OUT = EMI_OUT * 2.7777777777778E-13_rk !convert emissions output to (kg m-2 s-1) + else if (VERT .eq. 2) then !MEGANv3: Add weighted sum of activity coefficients for all canopy layers + LAYERS = floor(FCH/MODRES) + do i=1, SIZE(ZK) + VPGWT(i) = 1.0_rk/LAYERS !MEGANv3: Constant weighting factors across depth of canopy + end do + EMI_OUT(SIZE(ZK)) = LAI * EF * SUM(GammaTLEAF_AVE(1:LAYERS) * GammaPPFD_AVE(1:LAYERS) * & + VPGWT(1:LAYERS)) * CCE !put into top model layer (ug m-2 hr-1) + EMI_OUT = EMI_OUT * 2.7777777777778E-13_rk !convert emissions output to (kg m-2 s-1) else write(*,*) 'Wrong BIO_VERT choice of ', VERT, ' in namelist...exiting' call exit(2) From e229622323992a504e24dd0b8e74348eb9aa1f44 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Thu, 25 May 2023 11:51:08 -0400 Subject: [PATCH 08/64] Added new gaussian bio_vert option, and moved others around. --- README.md | 2 +- src/canopy_bioemi_mod.F90 | 46 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 39f8f5ed..828ebb11 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `lu_opt` | integer for input model land use type (`0`: VIIRS 17 Cat (default) or `1`: MODIS-IGBP 20 Cat (valid LU types 1-10 and 12); input mapped to Massman et al.) | | `z0_opt` | integer (`0`: use model input or `1`: vegtype dependent z0 for first estimate) | | `bio_cce` | user-set real value of MEGAN biogenic emissions "canopy environment coefficient" used to tune emissions to model inputs/calculations (default: `0.21`, based on Silva et al. 2020) | -| `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of LAD weighted activity coefficients using the plant distribution function, caution-- units=kg/m2/s and puts the total emissions in the topmost canopy-app model layer only; `2`: Same as in option 1, but uses equally weighted activity coefficients acoss all sub-canopy layers -- also units of kg/m2/s in topmost model layer) | +| `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of LAD weighted activity coefficients using the canopy-app plant distributions, caution-- units=kg/m2/s and puts the total emissions in the topmost canopy-app model layer only; `2`: Same as in option 1, but instead uses Gaussian/normally weighted activity coefficients acoss all sub-canopy layers -- also units of kg/m2/s in topmost model layer; `3`: Same as in option 1, but instead uses evenly weighted activity coefficients acoss all sub-canopy layers -- also units of kg/m2/s in topmost model layer | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | | `crop_set` | user-set real value of constant crop vegetation type heights (m) (only used if `crop_opt=1`) | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index a89c09a8..f0d39efb 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -94,6 +94,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & REAL(RK) :: TLEAF_OPT(SIZE(ZK)) ! Tleaf at which E_OPT occurs (K) REAL(RK) :: FLAI(SIZE(ZK)) ! Fractional LAI in layer REAL(RK) :: VPGWT(SIZE(ZK)) ! MEGANv3-like in-canopy weighting factor + REAL(RK) :: GAUSS(SIZE(ZK)) ! MEGANv3-like in-canopy gaussian REAL(RK) :: CT1 ! Activation energy (kJ/mol) REAL(RK) :: CEO ! Empirical coefficient REAL(RK) :: EF ! Final Mapped Emission factor (EF) (ug/m2 hr) @@ -314,7 +315,8 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & EMI_OUT(i) = EMI_OUT(i) * 2.7777777777778E-13_rk !convert emissions output to (kg m-3 s-1) end if end do - else if (VERT .eq. 1) then !MEGANv3: Use weighting factors normalized to plant distribution shape (FCLAI) + else if (VERT .eq. 1) then !"MEGANv3-like": Use weighting factors normalized to plant distribution shape (FCLAI) + !across canopy layers LAYERS = floor(FCH/MODRES) do i=1, SIZE(ZK) if (ZK(i) .gt. 0.0 .and. ZK(i) .le. FCH) then @@ -326,13 +328,51 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & VPGWT(i) = (FLAI(i))/sum(FLAI(1:LAYERS)) end if end do +! print*,'--------------' +! print*,sum(VPGWT(1:LAYERS)) +! print*,'--------------' EMI_OUT(SIZE(ZK)) = LAI * EF * SUM(GammaTLEAF_AVE(1:LAYERS) * GammaPPFD_AVE(1:LAYERS) * & VPGWT(1:LAYERS)) * CCE !put into top model layer (ug m-2 hr-1) EMI_OUT = EMI_OUT * 2.7777777777778E-13_rk !convert emissions output to (kg m-2 s-1) - else if (VERT .eq. 2) then !MEGANv3: Add weighted sum of activity coefficients for all canopy layers + else if (VERT .eq. 2) then !"MEGANv3-like": Add weighted sum of activity coefficients using normal distribution + !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) + do i=1, SIZE(ZK) + if (ZK(i) .gt. FCH) then + GAUSS(i) = 0.0 + else if (ZK(i) .le. FCH .and. ZK(i) .gt. FCH*(4.0_rk/5.0_rk)) then !Level 1 - 2 + GAUSS(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ 0.118464_rk,0.0_rk /),ZK(i)) + else if (ZK(i) .le. FCH*(4.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(3.0_rk/5.0_rk)) then !Level 2 - 3 + GAUSS(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ 0.239314_rk,0.118464_rk /),ZK(i)) + else if (ZK(i) .le. FCH*(3.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(2.0_rk/5.0_rk)) then !Level 3 - 4 + GAUSS(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ 0.284444_rk,0.239314_rk /),ZK(i)) + else if (ZK(i) .le. FCH*(2.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(1.0_rk/5.0_rk) ) then !Level 4 - Bottom + GAUSS(i) = interp_linear1_internal((/ FCH*(1.0_rk/5.0_rk),FCH*(2.0_rk/5.0_rk) /), & + (/ 0.239314_rk,0.284444_rk /),ZK(i)) + else if (ZK(i) .le. FCH*(1.0_rk/5.0_rk) ) then !Level 4 - Bottom + GAUSS(i) = interp_linear1_internal((/ ZK(1),FCH*(1.0_rk/5.0_rk) /), & + (/ 0.118464_rk,0.239314_rk /),ZK(i)) + end if + end do + + do i=1, SIZE(ZK) + VPGWT(i) = GAUSS(i)/sum(GAUSS(1:LAYERS)) + end do + EMI_OUT(SIZE(ZK)) = LAI * EF * SUM(GammaTLEAF_AVE(1:LAYERS) * GammaPPFD_AVE(1:LAYERS) * & + VPGWT(1:LAYERS)) * CCE !put into top model layer (ug m-2 hr-1) + EMI_OUT = EMI_OUT * 2.7777777777778E-13_rk !convert emissions output to (kg m-2 s-1) + else if (VERT .eq. 3) then !"MEGANv3-like": Add weighted sum of activity coefficients equally + !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) do i=1, SIZE(ZK) - VPGWT(i) = 1.0_rk/LAYERS !MEGANv3: Constant weighting factors across depth of canopy + VPGWT(i) = 1.0_rk/LAYERS end do EMI_OUT(SIZE(ZK)) = LAI * EF * SUM(GammaTLEAF_AVE(1:LAYERS) * GammaPPFD_AVE(1:LAYERS) * & VPGWT(1:LAYERS)) * CCE !put into top model layer (ug m-2 hr-1) From 949f011be741510e5b88ef4a8730377003b7a34c Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Thu, 25 May 2023 12:51:12 -0400 Subject: [PATCH 09/64] Added new shrub/savanna/grass (SSG) user options (ssg_opt). --- README.md | 2 ++ input/namelist.canopy | 2 ++ src/canopy_calcs.F90 | 34 +++++++++++++++++++++++++++++++++- src/canopy_canopts_mod.F90 | 2 ++ src/canopy_readnml.F90 | 12 +++++++++++- 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 828ebb11..fb115be3 100644 --- a/README.md +++ b/README.md @@ -198,6 +198,8 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `z0_opt` | integer (`0`: use model input or `1`: vegtype dependent z0 for first estimate) | | `bio_cce` | user-set real value of MEGAN biogenic emissions "canopy environment coefficient" used to tune emissions to model inputs/calculations (default: `0.21`, based on Silva et al. 2020) | | `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of LAD weighted activity coefficients using the canopy-app plant distributions, caution-- units=kg/m2/s and puts the total emissions in the topmost canopy-app model layer only; `2`: Same as in option 1, but instead uses Gaussian/normally weighted activity coefficients acoss all sub-canopy layers -- also units of kg/m2/s in topmost model layer; `3`: Same as in option 1, but instead uses evenly weighted activity coefficients acoss all sub-canopy layers -- also units of kg/m2/s in topmost model layer | +| `ssg_opt` | integer for using either input data (= `0`, default) or user set shrub/savanna/grass (SSG) vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not SSG. Warning: use of ssg_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates SSG | +| `ssg_set` | user-set real value of constant SSG vegetation type heights (m) (only used if `ssg_opt=1`) | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | | `crop_set` | user-set real value of constant crop vegetation type heights (m) (only used if `crop_opt=1`) | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | diff --git a/input/namelist.canopy b/input/namelist.canopy index f5cdf2aa..76cfec76 100755 --- a/input/namelist.canopy +++ b/input/namelist.canopy @@ -31,6 +31,8 @@ z0_opt = 0 bio_cce = 0.21 bio_vert = 0 + ssg_opt = 0 + ssg_set = 1.0 crop_opt = 0 crop_set = 3.0 lai_thresh = 0.1 diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index 84be7e5f..9bb68b97 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -84,9 +84,25 @@ SUBROUTINE canopy_calcs if (lu_opt .eq. 0 .or. lu_opt .eq. 1 ) then !VIIRS or MODIS if (vtyperef .gt. 0 .and. vtyperef .le. 10 .or. vtyperef .eq. 12) then !VIIRS or MODIS types +! ... check for ssg_opt from user namelist + if (vtyperef .ge. 6 .and. vtyperef .le. 10) then !VIIRS/MODIS shrubs/savannas/grasses (SSG) type + if (ssg_opt .eq. 0) then !use GEDI inputs for SSG heights (not likely captured...) + hcmref = hcmref + else if (ssg_opt .eq. 1) then !user set constant shrubs/savannas/grasslands height + hcmref = ssg_set + !recalculate + zhc = zk/hcmref + cansublays = floor(hcmref/modres) + else + write(*,*) 'Wrong SSG_OPT choice of ', ssg_opt, & + ' in namelist...exiting' + call exit(2) + end if + end if + ! ... check for crop_opt from user namelist if (vtyperef .eq. 12) then !VIIRS/MODIS crop type - if (crop_opt .eq. 0) then !use GEDI inputs for crop height + if (crop_opt .eq. 0) then !use GEDI inputs for crop height (not likely captured...) hcmref = hcmref else if (crop_opt .eq. 1) then !user set constant crop height hcmref = crop_set @@ -312,6 +328,22 @@ SUBROUTINE canopy_calcs if (lu_opt .eq. 0 .or. lu_opt .eq. 1 ) then !VIIRS or MODIS if (vtyperef .gt. 0 .and. vtyperef .le. 10 .or. vtyperef .eq. 12) then !VIIRS or MODIS types +! ... check for ssg_opt from user namelist + if (vtyperef .ge. 6 .and. vtyperef .le. 10) then !VIIRS/MODIS shrubs/savannas/grasses (SSG) type + if (ssg_opt .eq. 0) then !use GEDI inputs for SSG heights (not likely captured...) + hcmref = hcmref + else if (ssg_opt .eq. 1) then !user set constant shrubs/savannas/grasslands height + hcmref = ssg_set + !recalculate + zhc = zk/hcmref + cansublays = floor(hcmref/modres) + else + write(*,*) 'Wrong SSG_OPT choice of ', ssg_opt, & + ' in namelist...exiting' + call exit(2) + end if + end if + ! ... check for crop_opt from user namelist if (vtyperef .eq. 12) then !VIIRS/MODIS crop type if (crop_opt .eq. 0) then !use GEDI inputs for crop height diff --git a/src/canopy_canopts_mod.F90 b/src/canopy_canopts_mod.F90 index 4c141f4d..55346b99 100644 --- a/src/canopy_canopts_mod.F90 +++ b/src/canopy_canopts_mod.F90 @@ -34,6 +34,8 @@ MODULE canopy_canopts_mod real(rk) :: lambdars !Value representing influence of roughness sublayer (nondimensional) real(rk) :: bio_cce !MEGAN biogenic emission canopy environment coefficient. integer :: bio_vert !MEGAN vertical integration of emissions option (default = 0, off) + integer :: ssg_opt !Set default integer for shrubs/savanna/grassland vegtype option from GEDI or user (default = 0) + real(rk) :: ssg_set !Set default value for shrubs/savanna/grassland vegtype heights used in model (m) (Default = 1 m) integer :: crop_opt !Set default integer for crop vegtype option from GEDI or user (default = 0) real(rk) :: crop_set !Set default value for crop vegtype heights used in model (m) (Default = 3 m) diff --git a/src/canopy_readnml.F90 b/src/canopy_readnml.F90 index a2ad9a34..37c649a2 100644 --- a/src/canopy_readnml.F90 +++ b/src/canopy_readnml.F90 @@ -24,7 +24,7 @@ SUBROUTINE canopy_readnml z0ghc, lambdars, flameh_opt, flameh_set, frp_fac, ifcanwind, ifcanwaf, & ifcaneddy, ifcanphot, ifcanbio, pai_opt, pai_set, lu_opt, z0_opt, dx_opt, & dx_set, lai_thresh, frt_thresh, fch_thresh, rsl_opt, bio_cce, bio_vert, & - crop_opt, crop_set + ssg_opt, ssg_set, crop_opt, crop_set !------------------------------------------------------------------------------- ! Error, warning, and informational messages. @@ -207,6 +207,16 @@ SUBROUTINE canopy_readnml bio_vert = 0 !------------------------------------------------------------------------------- +!------------------------------------------------------------------------------- +! Set default integer for shrubs/savanaa/grasslands vegtype option from GEDI or user (default = 0) + ssg_opt = 0 +!------------------------------------------------------------------------------- + +!------------------------------------------------------------------------------- +! Set default value for shrubs/savanaa/grasslands vegtype heights used in model (m) (Default = 1 m) + ssg_set = 1.0_rk +!------------------------------------------------------------------------------- + !------------------------------------------------------------------------------- ! Set default integer for crop vegtype option from GEDI or user (default = 0) crop_opt = 0 From 2307fb9c11d6637e0bf5fc8c66bbfde07da2c923 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Tue, 30 May 2023 22:07:53 -0400 Subject: [PATCH 10/64] Added new CO2 inhibition factor (co2_opt) for biogenic emissions. --- README.md | 2 + input/namelist.canopy | 2 + src/canopy_bioemi_mod.F90 | 29 +++++--- src/canopy_calcs.F90 | 114 ++++++++++++++++++++----------- src/canopy_canopts_mod.F90 | 2 + src/canopy_readnml.F90 | 12 +++- src/canopy_utils_mod.F90 | 133 ++++++++++++++++++++++++++++++++++++- 7 files changed, 243 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index fb115be3..17c32109 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,8 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `ssg_set` | user-set real value of constant SSG vegetation type heights (m) (only used if `ssg_opt=1`) | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | | `crop_set` | user-set real value of constant crop vegetation type heights (m) (only used if `crop_opt=1`) | +| `co2_opt` | integer for using different options for the co2 inhibition option for biogenic isoprene emissions using either Possell & Hewitt (2011) (= `0`, default) or Wilkinson et al. (2009) method (= `1`). To turn off co2 inhibition use `co2_opt=2` | +| `co2_set` | user-set real value of atmospheric co2 concentration (ppmv) (only used if `co2_opt=0` or `co2_opt=1`) | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | | `frt_thresh` | user-set real value of forest fraction threshold for contiguous canopy | | `fch_thresh` | user-set real value of canopy height threshold for contiguous canopy (m) | diff --git a/input/namelist.canopy b/input/namelist.canopy index 76cfec76..69ffd68a 100755 --- a/input/namelist.canopy +++ b/input/namelist.canopy @@ -35,6 +35,8 @@ ssg_set = 1.0 crop_opt = 0 crop_set = 3.0 + co2_opt = 0 + co2_set = 400.0 lai_thresh = 0.1 frt_thresh = 0.1 fch_thresh = 0.5 diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index f0d39efb..bc331566 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -6,7 +6,8 @@ module canopy_bioemi_mod !::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & - TEMP2, LU_OPT, VTYPE, MODRES, CCE, VERT, EMI_IND, EMI_OUT) + TEMP2, LU_OPT, VTYPE, MODRES, CCE, VERT, CO2OPT, CO2SET, & + EMI_IND, EMI_OUT) !----------------------------------------------------------------------- @@ -32,7 +33,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & !----------------------------------------------------------------------- !----------------------------------------------------------------------- use canopy_const_mod, ONLY: rk,rgasuniv !constants for canopy models - use canopy_utils_mod, ONLY: interp_linear1_internal + use canopy_utils_mod, ONLY: interp_linear1_internal, GET_GAMMA_CO2 use canopy_phot_mod use canopy_bioparm_mod @@ -51,8 +52,10 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & INTEGER, INTENT( IN ) :: VTYPE ! Grid cell dominant vegetation type REAL(RK), INTENT( IN ) :: MODRES ! Canopy model input vertical resolution (m) REAL(RK), INTENT( IN ) :: CCE ! MEGAN Canopy environment coefficient. - INTEGER, INTENT( IN ) :: EMI_IND ! Input biogenic emissions index INTEGER, INTENT( IN ) :: VERT ! MEGAN vertical integration option (default = 0/no integration) + INTEGER, INTENT( IN ) :: CO2OPT ! Option for co2 inhibition calculation + REAL(RK), INTENT( IN ) :: CO2SET ! User set atmospheric CO2 conc [ppmv] + 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) ! Local Variables @@ -98,6 +101,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & REAL(RK) :: CT1 ! Activation energy (kJ/mol) REAL(RK) :: CEO ! Empirical coefficient REAL(RK) :: EF ! Final Mapped Emission factor (EF) (ug/m2 hr) + REAL(RK) :: GAMMACO2 ! CO2 inhibition factor (isoprene only) integer i, LAYERS ! Constant Canopy Parameters @@ -301,8 +305,14 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & GammaPPFD_AVE = (GammaPPFD_SUN*FSUN) + (GammaPPFD_SHADE*(1.0-FSUN)) ! average = sum sun and shade weighted by sunlit fraction +! Get CO2 inhibition factor for isoprene only + + if (EMI_IND .eq. 1) then !Isoprene + GAMMACO2 = GET_GAMMA_CO2(CO2OPT,CO2SET) + else + GAMMACO2 = 1.0_rk + end if -! print*, 'FCLAI=',FCLAI ! Calculate emissions profile in the canopy EMI_OUT = 0.0_rk ! set initial emissions profile to zero FLAI = 0.0_rk ! set initial fractional FLAI (LAD) profile to zero @@ -311,7 +321,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & 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) - EMI_OUT(i) = FLAI(i) * EF * GammaTLEAF_AVE(i) * GammaPPFD_AVE(i) * CCE ! (ug m-3 hr-1) + EMI_OUT(i) = FLAI(i) * EF * GammaTLEAF_AVE(i) * GammaPPFD_AVE(i) * GAMMACO2 * CCE ! (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 end do @@ -328,11 +338,8 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & VPGWT(i) = (FLAI(i))/sum(FLAI(1:LAYERS)) end if end do -! print*,'--------------' -! print*,sum(VPGWT(1:LAYERS)) -! print*,'--------------' EMI_OUT(SIZE(ZK)) = LAI * EF * SUM(GammaTLEAF_AVE(1:LAYERS) * GammaPPFD_AVE(1:LAYERS) * & - VPGWT(1:LAYERS)) * CCE !put into top model layer (ug m-2 hr-1) + VPGWT(1:LAYERS)) * GAMMACO2 * CCE !put into top model layer (ug m-2 hr-1) EMI_OUT = EMI_OUT * 2.7777777777778E-13_rk !convert emissions output to (kg m-2 s-1) else if (VERT .eq. 2) then !"MEGANv3-like": Add weighted sum of activity coefficients using normal distribution !across canopy layers using 5 layer numbers directly from MEGANv3 @@ -364,7 +371,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & VPGWT(i) = GAUSS(i)/sum(GAUSS(1:LAYERS)) end do EMI_OUT(SIZE(ZK)) = LAI * EF * SUM(GammaTLEAF_AVE(1:LAYERS) * GammaPPFD_AVE(1:LAYERS) * & - VPGWT(1:LAYERS)) * CCE !put into top model layer (ug m-2 hr-1) + VPGWT(1:LAYERS)) * GAMMACO2 * CCE !put into top model layer (ug m-2 hr-1) EMI_OUT = EMI_OUT * 2.7777777777778E-13_rk !convert emissions output to (kg m-2 s-1) else if (VERT .eq. 3) then !"MEGANv3-like": Add weighted sum of activity coefficients equally !across canopy layers @@ -375,7 +382,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & VPGWT(i) = 1.0_rk/LAYERS end do EMI_OUT(SIZE(ZK)) = LAI * EF * SUM(GammaTLEAF_AVE(1:LAYERS) * GammaPPFD_AVE(1:LAYERS) * & - VPGWT(1:LAYERS)) * CCE !put into top model layer (ug m-2 hr-1) + VPGWT(1:LAYERS)) * GAMMACO2 * CCE !put into top model layer (ug m-2 hr-1) EMI_OUT = EMI_OUT * 2.7777777777778E-13_rk !convert emissions output to (kg m-2 s-1) else write(*,*) 'Wrong BIO_VERT choice of ', VERT, ' in namelist...exiting' diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index 9bb68b97..6c788d1e 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -185,79 +185,98 @@ SUBROUTINE canopy_calcs !ISOP call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 1, emi_isop_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 1, emi_isop_3d(i,j,:)) !MYRC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 2, emi_myrc_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 2, emi_myrc_3d(i,j,:)) !SABI call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 3, emi_sabi_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 3, emi_sabi_3d(i,j,:)) !LIMO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 4, emi_limo_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 4, emi_limo_3d(i,j,:)) !CARE call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 5, emi_care_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 5, emi_care_3d(i,j,:)) !OCIM call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 6, emi_ocim_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 6, emi_ocim_3d(i,j,:)) !BPIN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 7, emi_bpin_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 7, emi_bpin_3d(i,j,:)) !APIN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 8, emi_apin_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 8, emi_apin_3d(i,j,:)) !MONO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 9, emi_mono_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 9, emi_mono_3d(i,j,:)) !FARN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 10, emi_farn_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 10, emi_farn_3d(i,j,:)) !CARY call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 11, emi_cary_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 11, emi_cary_3d(i,j,:)) !SESQ call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 12, emi_sesq_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 12, emi_sesq_3d(i,j,:)) !MBOL call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 13, emi_mbol_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 13, emi_mbol_3d(i,j,:)) !METH call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 14, emi_meth_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 14, emi_meth_3d(i,j,:)) !ACET call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 15, emi_acet_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 15, emi_acet_3d(i,j,:)) !CO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 16, emi_co_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 16, emi_co_3d(i,j,:)) !BIDI VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 17, emi_bvoc_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 17, emi_bvoc_3d(i,j,:)) !Stress VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 18, emi_svoc_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 18, emi_svoc_3d(i,j,:)) !Other VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 19, emi_ovoc_3d(i,j,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 19, emi_ovoc_3d(i,j,:)) end if end if @@ -429,79 +448,98 @@ SUBROUTINE canopy_calcs !ISOP call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 1, emi_isop(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 1, emi_isop(loc,:)) !MYRC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 2, emi_myrc(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 2, emi_myrc(loc,:)) !SABI call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 3, emi_sabi(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 3, emi_sabi(loc,:)) !LIMO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 4, emi_limo(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 4, emi_limo(loc,:)) !CARE call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 5, emi_care(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 5, emi_care(loc,:)) !OCIM call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 6, emi_ocim(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 6, emi_ocim(loc,:)) !BPIN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 7, emi_bpin(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 7, emi_bpin(loc,:)) !APIN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 8, emi_apin(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 8, emi_apin(loc,:)) !MONO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 9, emi_mono(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 9, emi_mono(loc,:)) !FARN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 10, emi_farn(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 10, emi_farn(loc,:)) !CARY call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 11, emi_cary(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 11, emi_cary(loc,:)) !SESQ call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 12, emi_sesq(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 12, emi_sesq(loc,:)) !MBOL call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 13, emi_mbol(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 13, emi_mbol(loc,:)) !METH call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 14, emi_meth(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 14, emi_meth(loc,:)) !ACET call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 15, emi_acet(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 15, emi_acet(loc,:)) !CO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 16, emi_co(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 16, emi_co(loc,:)) !BIDI VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 17, emi_bvoc(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 17, emi_bvoc(loc,:)) !Stress VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 18, emi_svoc(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 18, emi_svoc(loc,:)) !Other VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, 19, emi_ovoc(loc,:)) + lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + 19, emi_ovoc(loc,:)) end if end if diff --git a/src/canopy_canopts_mod.F90 b/src/canopy_canopts_mod.F90 index 55346b99..028002a4 100644 --- a/src/canopy_canopts_mod.F90 +++ b/src/canopy_canopts_mod.F90 @@ -38,5 +38,7 @@ MODULE canopy_canopts_mod real(rk) :: ssg_set !Set default value for shrubs/savanna/grassland vegtype heights used in model (m) (Default = 1 m) integer :: crop_opt !Set default integer for crop vegtype option from GEDI or user (default = 0) real(rk) :: crop_set !Set default value for crop vegtype heights used in model (m) (Default = 3 m) + integer :: co2_opt !Set default integer for co2 inhibition option for biogenic isoprene emissions (default=0; Possell & Hewitt (2011)) + real(rk) :: co2_set !Set default value for atmospheric co2 concentration for co2_opt (m) (Default = 400.0 ppmv) END MODULE canopy_canopts_mod diff --git a/src/canopy_readnml.F90 b/src/canopy_readnml.F90 index 37c649a2..f92a1abb 100644 --- a/src/canopy_readnml.F90 +++ b/src/canopy_readnml.F90 @@ -24,7 +24,7 @@ SUBROUTINE canopy_readnml z0ghc, lambdars, flameh_opt, flameh_set, frp_fac, ifcanwind, ifcanwaf, & ifcaneddy, ifcanphot, ifcanbio, pai_opt, pai_set, lu_opt, z0_opt, dx_opt, & dx_set, lai_thresh, frt_thresh, fch_thresh, rsl_opt, bio_cce, bio_vert, & - ssg_opt, ssg_set, crop_opt, crop_set + ssg_opt, ssg_set, crop_opt, crop_set, co2_opt, co2_set !------------------------------------------------------------------------------- ! Error, warning, and informational messages. @@ -227,6 +227,16 @@ SUBROUTINE canopy_readnml crop_set = 3.0_rk !------------------------------------------------------------------------------- +!------------------------------------------------------------------------------- +! Set default integer for co2 inhibition option for biogenic isoprene emissions (default = 0; Possell & Hewitt (2011)) + co2_opt = 0 +!------------------------------------------------------------------------------- + +!------------------------------------------------------------------------------- +! Set default value for atmospheric co2 concentration for co2_opt (m) (Default = 400.0 ppmv) + co2_set = 400.0_rk +!------------------------------------------------------------------------------- + !------------------------------------------------------------------------------- ! Read namelist to get user definitions. Rewind namelist file after each ! read in case namelists are not in the correct order in the namelist. diff --git a/src/canopy_utils_mod.F90 b/src/canopy_utils_mod.F90 index 312f07a3..a87d8fa0 100644 --- a/src/canopy_utils_mod.F90 +++ b/src/canopy_utils_mod.F90 @@ -6,7 +6,7 @@ module canopy_utils_mod private public IntegrateTrapezoid,interp_linear1_internal,CalcPAI, & - CalcDX,CalcFlameH + CalcDX,CalcFlameH,GET_GAMMA_CO2 contains @@ -125,4 +125,135 @@ function CalcFlameH(frp, dx) end function + real(rk) function GET_GAMMA_CO2(co2_opt, co2_set) result( GAMMA_CO2 ) + !!------------------------------------------------------------------------------ + ! Harmonized Emissions Component (HEMCO) ! + !------------------------------------------------------------------------------ + !BOP + ! + ! !IROUTINE: get_gamma_co2 + ! + ! !DESCRIPTION: Function GET\_GAMMA\_CO2 computes the CO2 activity factor + ! associated with CO2 inhibition of isoprene emission. Called from + ! GET\_MEGAN\_EMISSIONS only. + !\\ + !\\ + ! !INTERFACE: + + ! !INPUT PARAMETERS: + integer, INTENT(IN) :: co2_opt ! Option for co2 inhibition calculation + ! 0=Possell & Hewitt (2011); + ! 1=Wilkinson et al. (2009) + ! >1=off + real(rk), INTENT(IN) :: co2_set ! User set atmospheric CO2 conc [ppmv] + ! + ! !RETURN VALUE: +! REAL(rk) :: GAMMA_CO2 ! CO2 activity factor [unitless] + ! + ! !LOCAL VARIABLES: + REAL(rk) :: CO2i ! Intercellular CO2 conc [ppmv] + REAL(rk) :: ISMAXi ! Asymptote for intercellular CO2 + REAL(rk) :: HEXPi ! Exponent for intercellular CO2 + REAL(rk) :: CSTARi ! Scaling coef for intercellular CO2 + REAL(rk) :: ISMAXa ! Asymptote for atmospheric CO2 + REAL(rk) :: HEXPa ! Exponent for atmospheric CO2 + REAL(rk) :: CSTARa ! Scaling coef for atmospheric CO2 + ! + ! !REMARKS: + ! References: + ! ============================================================================ + ! (1 ) Heald, C. L., Wilkinson, M. J., Monson, R. K., Alo, C. A., + ! Wang, G. L., and Guenther, A.: Response of isoprene emission + ! to ambient co(2) changes and implications for global budgets, + ! Global Change Biology, 15, 1127-1140, 2009. + ! (2 ) Wilkinson, M. J., Monson, R. K., Trahan, N., Lee, S., Brown, E., + ! Jackson, R. B., Polley, H. W., Fay, P. A., and Fall, R.: Leaf + ! isoprene emission rate as a function of atmospheric CO2 + ! concentration, Global Change Biology, 15, 1189-1200, 2009. + ! (3 ) Possell, M., and Hewitt, C. N.: Isoprene emissions from plants + ! are mediated by atmospheric co2 concentrations, Global Change + ! Biology, 17, 1595-1610, 2011. + + ! !REVISION HISTORY: + ! (1 ) Implemented in the standard code by A. Tai (Jun 2012). + ! See https://github.com/geoschem/hemco for complete history + !EOP + !------------------------------------------------------------------------------ + !BOC + + !----------------------- + ! Compute GAMMA_CO2 + !----------------------- + + !---------------------------------------------------------- + ! Choose between two alternative CO2 inhibition schemes + !---------------------------------------------------------- + + IF ( co2_opt .eq. 0 ) THEN + + ! Use empirical relationship of Possell & Hewitt (2011): + ! Empirical relationship of Possell & Hewitt (2011) based on nine + ! experimental studies including Wilkinson et al. (2009). This is + ! especially recommended for sub-ambient CO2 concentrations: + + GAMMA_CO2 = 8.9406_rk / ( 1.0_rk + 8.9406_rk * 0.0024_rk * co2_set ) + + + ELSEIF ( co2_opt .eq. 1 ) THEN + + ! Use parameterization of Wilkinson et al. (2009): + ! Semi-process-based parameterization of Wilkinson et al. (2009), + ! taking into account of sensitivity to intercellular CO2 + ! fluctuation, which is here set as a constant fraction of + ! atmospheric CO2: + + + ! Parameters for intercellular CO2 using linear interpolation: + IF ( co2_set <= 600.0_rk ) THEN + ISMAXi = 1.036_rk - (1.036_rk - 1.072_rk) / & + (600.0_rk - 400.0_rk) * (600.0_rk - co2_set) + HEXPi = 2.0125_rk - (2.0125_rk - 1.7000_rk) / & + (600.0_rk - 400.0_rk) * (600.0_rk - co2_set) + CSTARi = 1150.0_rk - (1150.0_rk - 1218.0_rk) / & + (600.0_rk - 400.0_rk) * (600.0_rk - co2_set) + ELSEIF ( co2_set > 600.0_rk .AND. co2_set < 800.0_rk ) THEN + ISMAXi = 1.046_rk - (1.046_rk - 1.036_rk) / & + (800.0_rk - 600.0_rk) * (800.0_rk - co2_set) + HEXPi = 1.5380_rk - (1.5380_rk - 2.0125_rk) / & + (800.0_rk - 600.0_rk) * (800.0_rk - co2_set) + CSTARi = 2025.0_rk - (2025.0_rk - 1150.0_rk) / & + (800.0_rk - 600.0_rk) * (800.0_rk - co2_set) + ELSE + ISMAXi = 1.014_rk - (1.014_rk - 1.046_rk) / & + (1200.0_rk - 800.0_rk) * (1200.0_rk - co2_set) + HEXPi = 2.8610_rk - (2.8610_rk - 1.5380_rk) / & + (1200.0_rk - 800.0_rk) * (1200.0_rk - co2_set) + CSTARi = 1525.0_rk - (1525.0_rk - 2025.0_rk) / & + (1200.0_rk - 800.0_rk) * (1200.0_rk - co2_set) + ENDIF + + ! Parameters for atmospheric CO2: + ISMAXa = 1.344_rk + HEXPa = 1.4614_rk + CSTARa = 585.0_rk + + ! For now, set CO2_Ci = 0.7d0 * CO2_Ca as recommended by Heald + ! et al. (2009): + CO2i = 0.7_rk * co2_set + + ! Compute GAMMA_CO2: + GAMMA_CO2 = ( ISMAXi - ISMAXi * CO2i**HEXPi / & + ( CSTARi**HEXPi + CO2i**HEXPi ) ) & + * ( ISMAXa - ISMAXa * ( 0.7_rk * co2_set )**HEXPa / & + ( CSTARa**HEXPa + ( 0.7_rk * co2_set )**HEXPa ) ) + + ELSE + + ! No CO2 inhibition scheme is used; GAMMA_CO2 set to unity: + GAMMA_CO2 = 1.0_rk + + ENDIF + + end function GET_GAMMA_CO2 + end module canopy_utils_mod From f12a839e854467a6a2f71676fcd5145f826ce052 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Tue, 30 May 2023 22:10:29 -0400 Subject: [PATCH 11/64] Updated README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 17c32109..5b113096 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `ssg_set` | user-set real value of constant SSG vegetation type heights (m) (only used if `ssg_opt=1`) | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | | `crop_set` | user-set real value of constant crop vegetation type heights (m) (only used if `crop_opt=1`) | -| `co2_opt` | integer for using different options for the co2 inhibition option for biogenic isoprene emissions using either Possell & Hewitt (2011) (= `0`, default) or Wilkinson et al. (2009) method (= `1`). To turn off co2 inhibition use `co2_opt=2` | +| `co2_opt` | user-set options for applying a CO2 inhibition factor for biogenic isoprene-only emissions using either the Possell & Hewitt (2011) (= `0`, default) or Wilkinson et al. (2009) method (= `1`). To turn off co2 inhibition factor set `co2_opt=2` | | `co2_set` | user-set real value of atmospheric co2 concentration (ppmv) (only used if `co2_opt=0` or `co2_opt=1`) | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | | `frt_thresh` | user-set real value of forest fraction threshold for contiguous canopy | From 7060b6b3ecbcb245cbe4ad2bb6fcda2318cdee79 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Tue, 30 May 2023 22:16:21 -0400 Subject: [PATCH 12/64] Updated README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b113096..97e29311 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `ssg_set` | user-set real value of constant SSG vegetation type heights (m) (only used if `ssg_opt=1`) | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | | `crop_set` | user-set real value of constant crop vegetation type heights (m) (only used if `crop_opt=1`) | -| `co2_opt` | user-set options for applying a CO2 inhibition factor for biogenic isoprene-only emissions using either the Possell & Hewitt (2011) (= `0`, default) or Wilkinson et al. (2009) method (= `1`). To turn off co2 inhibition factor set `co2_opt=2` | +| `co2_opt` | user-set options for applying a CO2 inhibition factor for biogenic isoprene-only emissions using either the [Possell & Hewitt (2011)](https://doi.org/10.1111/j.1365-2486.2010.02306.x) (= `0`, default) or [Wilkinson et al. (2009)](https://doi.org/10.1111/j.1365-2486.2008.01803.x) method (= `1`). To turn off co2 inhibition factor set `co2_opt=2` | | `co2_set` | user-set real value of atmospheric co2 concentration (ppmv) (only used if `co2_opt=0` or `co2_opt=1`) | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | | `frt_thresh` | user-set real value of forest fraction threshold for contiguous canopy | From e89dc13bda8563ced442ebb029b973bf2139d360 Mon Sep 17 00:00:00 2001 From: Patrick Campbell Date: Thu, 1 Jun 2023 09:22:06 -0400 Subject: [PATCH 13/64] Update README.md Co-authored-by: Zachary Moon --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 97e29311..a6d504be 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `lu_opt` | integer for input model land use type (`0`: VIIRS 17 Cat (default) or `1`: MODIS-IGBP 20 Cat (valid LU types 1-10 and 12); input mapped to Massman et al.) | | `z0_opt` | integer (`0`: use model input or `1`: vegtype dependent z0 for first estimate) | | `bio_cce` | user-set real value of MEGAN biogenic emissions "canopy environment coefficient" used to tune emissions to model inputs/calculations (default: `0.21`, based on Silva et al. 2020) | -| `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of LAD weighted activity coefficients using the canopy-app plant distributions, caution-- units=kg/m2/s and puts the total emissions in the topmost canopy-app model layer only; `2`: Same as in option 1, but instead uses Gaussian/normally weighted activity coefficients acoss all sub-canopy layers -- also units of kg/m2/s in topmost model layer; `3`: Same as in option 1, but instead uses evenly weighted activity coefficients acoss all sub-canopy layers -- also units of kg/m2/s in topmost model layer | +| `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of LAD weighted activity coefficients using the canopy-app plant distributions, caution-- units=kg m-2 s-1 and puts the total emissions in the topmost canopy-app model layer only; `2`: Same as in option 1, but instead uses Gaussian/normally weighted activity coefficients acoss all sub-canopy layers -- also units of kg m-2 s-1 in topmost model layer; `3`: Same as in option 1, but instead uses evenly weighted activity coefficients acoss all sub-canopy layers -- also units of kg m-2 s-1 in topmost model layer | | `ssg_opt` | integer for using either input data (= `0`, default) or user set shrub/savanna/grass (SSG) vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not SSG. Warning: use of ssg_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates SSG | | `ssg_set` | user-set real value of constant SSG vegetation type heights (m) (only used if `ssg_opt=1`) | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | From 888eea2d5661237218183c2c3dedd9970e7bb28d Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Thu, 1 Jun 2023 09:24:12 -0400 Subject: [PATCH 14/64] Removed HEMCO header. --- src/canopy_utils_mod.F90 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/canopy_utils_mod.F90 b/src/canopy_utils_mod.F90 index a87d8fa0..f1225174 100644 --- a/src/canopy_utils_mod.F90 +++ b/src/canopy_utils_mod.F90 @@ -126,11 +126,6 @@ function CalcFlameH(frp, dx) end function real(rk) function GET_GAMMA_CO2(co2_opt, co2_set) result( GAMMA_CO2 ) - !!------------------------------------------------------------------------------ - ! Harmonized Emissions Component (HEMCO) ! - !------------------------------------------------------------------------------ - !BOP - ! ! !IROUTINE: get_gamma_co2 ! ! !DESCRIPTION: Function GET\_GAMMA\_CO2 computes the CO2 activity factor From 38c59dd312d453bfb9aa61545e770d06c81c145d Mon Sep 17 00:00:00 2001 From: Patrick Campbell Date: Fri, 2 Jun 2023 10:16:16 -0400 Subject: [PATCH 15/64] Update src/canopy_bioemi_mod.F90 Co-authored-by: Zachary Moon --- src/canopy_bioemi_mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index bc331566..fd9013bf 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -327,7 +327,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & 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) + LAYERS = floor(FCH/MODRES) + 1 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) From 1c6481f7bb78b4bf9b797e769a14de530f4ca54b Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 2 Jun 2023 12:44:09 -0400 Subject: [PATCH 16/64] Added LAYERS+1 for all bio_vert options for summing. --- src/canopy_bioemi_mod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index fd9013bf..80416083 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -345,7 +345,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & !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) + LAYERS = floor(FCH/MODRES) + 1 do i=1, SIZE(ZK) if (ZK(i) .gt. FCH) then GAUSS(i) = 0.0 @@ -377,7 +377,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & !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) + LAYERS = floor(FCH/MODRES) + 1 do i=1, SIZE(ZK) VPGWT(i) = 1.0_rk/LAYERS end do From a42c9a858e847bb589436a723fa14c8dd4c5f2f2 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 2 Jun 2023 16:41:53 -0400 Subject: [PATCH 17/64] Updated README for co2_inhibition warning. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a6d504be..80107377 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `ssg_set` | user-set real value of constant SSG vegetation type heights (m) (only used if `ssg_opt=1`) | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | | `crop_set` | user-set real value of constant crop vegetation type heights (m) (only used if `crop_opt=1`) | -| `co2_opt` | user-set options for applying a CO2 inhibition factor for biogenic isoprene-only emissions using either the [Possell & Hewitt (2011)](https://doi.org/10.1111/j.1365-2486.2010.02306.x) (= `0`, default) or [Wilkinson et al. (2009)](https://doi.org/10.1111/j.1365-2486.2008.01803.x) method (= `1`). To turn off co2 inhibition factor set `co2_opt=2` | +| `co2_opt` | user-set options for applying a CO2 inhibition factor for biogenic isoprene-only emissions using either the [Possell & Hewitt (2011)](https://doi.org/10.1111/j.1365-2486.2010.02306.x) (= `0`, default) or [Wilkinson et al. (2009)](https://doi.org/10.1111/j.1365-2486.2008.01803.x) method (= `1`). Use of option = `0` (Possell & Hewitt 2011) is especially recommended for sub-ambient CO2 concentrations. To turn off co2 inhibition factor set `co2_opt=2` | | `co2_set` | user-set real value of atmospheric co2 concentration (ppmv) (only used if `co2_opt=0` or `co2_opt=1`) | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | | `frt_thresh` | user-set real value of forest fraction threshold for contiguous canopy | From fb6c4e7fe34432461bdf1df020b68ad2de597d0e Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Sun, 4 Jun 2023 12:49:48 -0400 Subject: [PATCH 18/64] Updated README for co2 inhibition note. --- README.md | 2 +- src/canopy_utils_mod.F90 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 80107377..df4c2ffe 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `ssg_set` | user-set real value of constant SSG vegetation type heights (m) (only used if `ssg_opt=1`) | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | | `crop_set` | user-set real value of constant crop vegetation type heights (m) (only used if `crop_opt=1`) | -| `co2_opt` | user-set options for applying a CO2 inhibition factor for biogenic isoprene-only emissions using either the [Possell & Hewitt (2011)](https://doi.org/10.1111/j.1365-2486.2010.02306.x) (= `0`, default) or [Wilkinson et al. (2009)](https://doi.org/10.1111/j.1365-2486.2008.01803.x) method (= `1`). Use of option = `0` (Possell & Hewitt 2011) is especially recommended for sub-ambient CO2 concentrations. To turn off co2 inhibition factor set `co2_opt=2` | +| `co2_opt` | user-set options for applying a CO2 inhibition factor for biogenic isoprene-only emissions using either the [Possell & Hewitt (2011)](https://doi.org/10.1111/j.1365-2486.2010.02306.x) (= `0`, default) or [Wilkinson et al. (2009)](https://doi.org/10.1111/j.1365-2486.2008.01803.x) method (= `1`). Use of option = `1` (Possell & Hewitt 2011) is especially recommended for sub-ambient CO2 concentrations. To turn off co2 inhibition factor set `co2_opt=2` | | `co2_set` | user-set real value of atmospheric co2 concentration (ppmv) (only used if `co2_opt=0` or `co2_opt=1`) | | `lai_thresh` | user-set real value of LAI threshold for contiguous canopy (m2/m2) | | `frt_thresh` | user-set real value of forest fraction threshold for contiguous canopy | diff --git a/src/canopy_utils_mod.F90 b/src/canopy_utils_mod.F90 index f1225174..ae1117bb 100644 --- a/src/canopy_utils_mod.F90 +++ b/src/canopy_utils_mod.F90 @@ -188,8 +188,7 @@ real(rk) function GET_GAMMA_CO2(co2_opt, co2_set) result( GAMMA_CO2 ) ! Use empirical relationship of Possell & Hewitt (2011): ! Empirical relationship of Possell & Hewitt (2011) based on nine - ! experimental studies including Wilkinson et al. (2009). This is - ! especially recommended for sub-ambient CO2 concentrations: + ! experimental studies including Wilkinson et al. (2009). GAMMA_CO2 = 8.9406_rk / ( 1.0_rk + 8.9406_rk * 0.0024_rk * co2_set ) @@ -200,7 +199,8 @@ real(rk) function GET_GAMMA_CO2(co2_opt, co2_set) result( GAMMA_CO2 ) ! Semi-process-based parameterization of Wilkinson et al. (2009), ! taking into account of sensitivity to intercellular CO2 ! fluctuation, which is here set as a constant fraction of - ! atmospheric CO2: + ! atmospheric CO2. This is especially recommended for sub-ambient + ! CO2 concentrations:: ! Parameters for intercellular CO2 using linear interpolation: From 5824f767e5a97d6f4af8410fee17a7bf306dfc56 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Tue, 6 Jun 2023 11:41:28 -0400 Subject: [PATCH 19/64] Initial commit of global python canopy data workflow. --- README.md | 2 +- python/README.md | 35 +++ python/environment.yml | 2 + python/global_data_process.py | 431 ++++++++++++++++++++++++++++++++++ 4 files changed, 469 insertions(+), 1 deletion(-) create mode 100755 python/global_data_process.py diff --git a/README.md b/README.md index 409f0e3e..7ecefac3 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ which is read at runtime. ./canopy ``` -You can also [run with Python](./python/README.md). +You can also [generate global inputs and run with Python](./python/README.md). ## Components diff --git a/python/README.md b/python/README.md index c348d048..06faa58e 100644 --- a/python/README.md +++ b/python/README.md @@ -51,3 +51,38 @@ cases = config_cases( ds = run_config_sens(cases) ``` :point_up: We still get a single output dataset, but it has a `case` dimension. + +:point_down: You can also download and generate global gridded canopy-app inputs using python. + +- Edit python script (`global_data_process.py`) + +``` +vim global_data_process.py +``` + +- Change user settings + +``` +'''User Options''' +path = '/scratch/pcampbe8/canopy-app/input' # work directory +year = 2022 # year +month = 7 # month +day = 1 # day +houri = 12 # gfs initialization hour in UTC (caution currently GFS files are initialized at 12 UTC only -- do not change) +hour = 00 # gfs forecast hour in UTC +ref_lev = 10 # reference height (m, a.g.l.) +frp_src = 1 # frp data source (0: local source; 1: check local source first, switch to climatological file if no available data ; 2: 12 month climatology) +``` + +- Activate Python canopy-app environment: + + +``` + conda activate canopy-app +``` + +- Run python script + +``` +python3 global_data_process.py +``` diff --git a/python/environment.yml b/python/environment.yml index c8421258..0a80ee97 100644 --- a/python/environment.yml +++ b/python/environment.yml @@ -21,3 +21,5 @@ dependencies: # # Extra - ipython + - pysolar + - scipy diff --git a/python/global_data_process.py b/python/global_data_process.py new file mode 100755 index 00000000..221cbac1 --- /dev/null +++ b/python/global_data_process.py @@ -0,0 +1,431 @@ +""" +Created on Sun Jun 4 15:45:29 2023 + +Author: Wei-Ting Hung +""" + +import os +import subprocess +from datetime import datetime, timezone + +import numpy as np +from netCDF4 import Dataset +from pysolar.solar import get_altitude +from scipy.interpolate import griddata + +"""User Options""" +path = "/scratch/pcampbe8/canopy-app/input" # work directory +year = 2022 # year +month = 7 # month +day = 1 # day +houri = 12 # gfs initialization hour in UTC (caution: currently GFS input files are initialized at 12 UTC only -- do not change) +hour = 0 # gfs forecast hour (0-24) in UTC +ref_lev = 10 # reference height (m, a.g.l.) +frp_src = 1 # frp data source for WAF (0: local source; 1: check local source first, switch to climatological file if no available data ; 2: 12 month climatology) + + +# ---------------------------------ATTENTION---------------------------------# +# If local FRP is used (frp_src=0,1), archived GBBEPx files since 2020 are # +# available for GMU HOPPER users. For users outside GMU, parameter "f_frp" # +# and function "read_frp_local" need to be modified accordingly. # +# Function read_frp_local is designed for reading GBBEPx by default. # +# # +# Recent GBBEPx v3 files (~ < 3 months) are available for download at: # +# https://www.ospo.noaa.gov/Products/land/gbbepx/ # +# GBBEPx_all01GRID.emissions_v003_'+YY+MM+DD+'.nc' # +# # +# Archived GBBEPx files since 2020 are available for GMU HOPPER users. # +# # +# 12 month climatological FRP will not be respective of actual conditions. # +# Only use it when users do not need the limited WAF application for fires. # +# ---------------------------------------------------------------------------# + + +starttime = datetime.now() +print("------------------------------------") +print("---- Global input pre-process start!", starttime.strftime("%Y/%m/%d %H:%M:%S")) +print("------------------------------------") + + +"""Settings""" +# date/time +YY = str(year) +MM = "%02d" % month +DD = "%02d" % day +HHI = "%02d" % houri +HH = "%02d" % hour + + +# domain +lat_lim = [-90, 90] +lon_lim = [0, 360] + + +# input/output files +f_met = ( + path + "/gfs.t" + HHI + "z." + YY + MM + DD + ".sfcf0" + HH + ".nc" +) # gfs met file +f_can = path + "/gfs.canopy.t" + HHI + "z." + YY + MM + "01.sfcf000.nc" # canopy file +f_output = ( + path + "/gfs.canopy.t" + HHI + "z." + YY + MM + DD + ".global.f0" + HH + ".nc" +) # output file + +if (frp_src == 0) or (frp_src == 1): # local frp file + if int(YY + MM + DD) <= 20230510: # version 3 + f_frp = ( + "/groups/ESS/yli74/data/GBBEPx/ORI/GBBEPx_all01GRID.emissions_v003_" + + YY + + MM + + DD + + ".nc" + ) + else: # version 4 + f_frp = ( + "/groups/ESS/yli74/data/GBBEPx/ORI/GBBEPx-all01GRID_v4r0_blend_" + + YY + + MM + + DD + + ".nc " + ) +elif frp_src == 2: # climatological frp + f_frp = path + "/gfs.canopy.t" + HHI + "z." + YY + MM + "01.sfcf000.nc" + + +# required variables +loclist = ["grid_xt", "lon", "grid_yt", "lat", "time"] +metlist = [ + "ugrd10m", + "vgrd10m", + "fricv", + "sfcr", + "vtype", + "sotyp", + "pressfc", + "dswrf", + "shtfl", + "tmpsfc", + "tmp2m", + "spfh2m", + "hpbl", + "prate_ave", +] +canlist = ["lai", "clu", "ffrac", "fh", "mol", "csz", "frp", "href"] + + +# constants +fill_value = 9.99e20 # fill value +den = 1.18 # air density (kg/m3) +Cp = 1004 # specific heat capacity of Air at 25C (J/kg/K) +K = 0.4 # Von Karman constant +g = 9.8 # gravitational acceleration (m/s2) + + +# functions +def read_varatt(var): + attname = var.ncattrs() + att = [var.getncattr(X) for X in attname] + return attname, att + + +def write_varatt(var, attname, att): + for X in np.arange(len(attname)): + if attname[X] == "_FillValue": + continue + elif attname[X] == "missing_value": + value = np.float32(att[X]) + value = np.round(value / 1e15) * 1e15 + var.setncattr(attname[X], value) + else: + var.setncattr(attname[X], att[X]) + + +def mapping(xgrid, ygrid, data, xdata, ydata, map_method, fvalue): + output = griddata( + (xdata, ydata), data, (xgrid, ygrid), method=map_method, fill_value=fvalue + ) + return output + + +def read_gfs_climatology(filename, lat, lon, varname): + readin = Dataset(filename) + + # map to met grids + yt = readin["lat"][:] + xt = readin["lon"][:] + data = np.squeeze(readin[varname][0, :, :]) + + DATA = mapping(lat, lon, data.flatten(), yt.flatten(), xt.flatten(), "linear", np.nan) + DATA[np.isnan(DATA)] = 0 + DATA[DATA < 0] = 0 + return DATA + + +def read_frp_local(filename, lat, lon, fill_value): + readin = Dataset(filename) + + # map to met grids + xt, yt = np.meshgrid(readin["Longitude"][:], readin["Latitude"][:]) + xt[xt < 0] = xt[xt < 0] + 360 + data = np.squeeze(readin["MeanFRP"][:]) + + DATA = mapping( + lat, lon, data.flatten(), yt.flatten(), xt.flatten(), "nearest", fill_value + ) + return DATA + + +"""Data Download""" +"""Download from servers if required files do not exist.""" +print("---- Checking required files...") +print("------------------------------------") + +# met file +if os.path.isfile(f_met) is True: + print("---- Met file found!") +else: + print("---- Cannot find met file. Downloading from AWS...") + subprocess.run( + [ + "wget", + "--no-check-certificate", + "--no-proxy", + "-O", + path + "/gfs.t" + HHI + "z." + YY + MM + DD + ".sfcf0" + HH + ".nc", + "https://nacc-in-the-cloud.s3.amazonaws.com/inputs/" + + YY + + MM + + DD + + "/gfs.t" + + HHI + + "z.sfcf0" + + HH + + ".nc", + ] + ) + if os.path.isfile(f_met) is True: + os.chmod(f_met, 0o0755) + print("---- Download complete!") + else: + print("---- No available met data. Terminated!") + exit() + +# can file +if os.path.isfile(f_can) is True: + print("---- Canopy file found!") +else: + print("---- Cannot find canopy file. Downloading from AWS...") + subprocess.run( + [ + "wget", + "--no-check-certificate", + "--no-proxy", + "-P", + path, + "https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t" + + HHI + + "z." + + YY + + MM + + "01.sfcf000.nc", + ] + ) + if os.path.isfile(f_can) is True: + os.chmod(f_can, 0o0755) + print("---- Download complete!") + else: + print("---- No available canopy data. Terminated!") + exit() + +# frp file +if frp_src == 0: # local source + if os.path.isfile(f_frp) is True: + os.system("cp " + f_frp + " " + path) + if int(YY + MM + DD) <= 20230510: + f_frp = path + "/GBBEPx_all01GRID.emissions_v003_" + YY + MM + DD + ".nc" + else: + f_frp = path + "/GBBEPx-all01GRID_v4r0_blend_" + YY + MM + DD + ".nc" + os.chmod(f_frp, 0o0755) + print("---- FRP file found!") + else: + print("---- No available FRP file. Terminated!") + exit() + +if frp_src == 1: # local source + if os.path.isfile(f_frp) is True: + os.system("cp " + f_frp + " " + path) + if int(YY + MM + DD) <= 20230510: + f_frp = path + "/GBBEPx_all01GRID.emissions_v003_" + YY + MM + DD + ".nc" + else: + f_frp = path + "/GBBEPx-all01GRID_v4r0_blend_" + YY + MM + DD + ".nc" + os.chmod(f_frp, 0o0755) + print("---- FRP file found!") + else: + print("---- No available FRP file. Switch to Climatology FRP...") + frp_src = 2 + f_frp = path + "/gfs.canopy.t" + HHI + "z." + YY + MM + "01.sfcf000.nc" + +if frp_src == 2: # 12 month climatology frp + if os.path.isfile(f_frp) is True: + print("---- FRP file found!") + else: + print("---- Canot find FRP file. Downloading from AWS...") + subprocess.run( + [ + "wget", + "--no-check-certificate", + "--no-proxy", + "-P", + path, + "https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t" + + HHI + + "z." + + YY + + MM + + "01.sfcf000.nc", + ] + ) + if os.path.isfile(f_met) is True: + os.chmod(f_frp, 0o0755) + print("---- Download complete!") + else: + print("---- No available FRP data. Terminated!") + exit() + + print("-----------!!!WARNING!!!-------------") + print("---!!!Climatological FRP is used!!!--") + + +os.system("cp " + f_met + " " + f_output) # copy gfs met file for appending + + +"""Reading dimensions""" +print("------------------------------------") +print("---- Checking variable dimensions...") +print("------------------------------------") +readin = Dataset(f_met) +grid_yt = readin["grid_yt"][:] +grid_xt = readin["grid_xt"][:] +lat = readin["lat"][:] +lon = readin["lon"][:] +time = readin["time"][:] + + +# dimension sizes +ntime = len(time) +nlat = len(grid_yt) +nlon = len(grid_xt) + + +# var check +print("time", time.shape) +print("grid_yt", grid_yt.shape) +print("grid_xt", grid_xt.shape) +print("lat", lat.shape) +print("lon", lon.shape) + + +"""Adding canvar""" +print("------------------------------------") +print("---- Generating canopy variables...") +print("------------------------------------") + +for i in np.arange(len(canlist)): + varname = canlist[i] + + print("---- " + varname + " processing...") + + if varname == "lai": + ATTNAME = ["long_name", "units", "missing_value"] + ATT = ["Leaf area index", "m^2/m^2", fill_value] + DATA = read_gfs_climatology(f_can, lat, lon, "lai") + + elif varname == "clu": + ATTNAME = ["long_name", "units", "missing_value"] + ATT = ["Canopy clumping index", "none", fill_value] + DATA = read_gfs_climatology(f_can, lat, lon, "clu") + + elif varname == "ffrac": + ATTNAME = ["long_name", "units", "missing_value"] + ATT = ["Forest fraction of grid cell", "none", fill_value] + DATA = read_gfs_climatology(f_can, lat, lon, "ffrac") + + elif varname == "fh": + ATTNAME = ["long_name", "units", "missing_value"] + ATT = ["Canopy height above the surface", "m", fill_value] + DATA = read_gfs_climatology(f_can, lat, lon, "fh") + + elif varname == "mol": + # Reference: + # Essa 1999, ESTIMATION OF MONIN-OBUKHOV LENGTH USING RICHARDSON AND BULK RICHARDSON NUMBER + # https://inis.iaea.org/collection/NCLCollectionStore/_Public/37/118/37118528.pdf + ATTNAME = ["long_name", "units", "missing_value"] + ATT = ["Monin-Obukhov length", "m", fill_value] + + readin = Dataset(f_met) + t2m = np.squeeze(readin["tmp2m"][:]) + fricv = np.squeeze(readin["fricv"][:]) + shtfl = np.squeeze(readin["shtfl"][:]) + + DATA = (-1 * den * Cp * t2m * (fricv**3)) / (K * g * shtfl) + DATA[DATA > 500] = 500 + DATA[DATA < -500] = -500 + + del [readin, t2m, fricv, shtfl] + + elif varname == "csz": + ATTNAME = ["long_name", "units", "missing_value"] + ATT = ["Cosine of solar zenith angle", "none", fill_value] + + time_conv = datetime( + int(YY), int(MM), int(DD), int(HH), 0, 0, 0, tzinfo=timezone.utc + ) + sza = 90 - get_altitude(lat, lon, time_conv) + DATA = np.cos(sza * 0.0174532925) # degree to radian + + del [time_conv, sza] + + elif varname == "frp": + ATTNAME = ["long_name", "units", "missing_value"] + ATT = ["Mean fire radiative power", "MW", fill_value] + + if frp_src == 2: + DATA = read_gfs_climatology(f_can, "frp") + else: + DATA = read_frp_local(f_frp, lat, lon, fill_value) + + elif varname == "href": + ATTNAME = ["long_name", "units", "missing_value"] + ATT = ["Reference height above the surface", "m", fill_value] + DATA = np.empty([nlat, nlon]) + DATA[:] = ref_lev + + # var check + print("Dimension/Attributes:") + print(DATA.shape) + print(ATTNAME) + print(ATT) + + # adding to output file + output = Dataset(f_output, "a") + + var = output.createVariable( + varname, "float", ("time", "grid_yt", "grid_xt"), fill_value=fill_value + ) + write_varatt(var, ATTNAME, ATT) + var[:] = DATA + + output.close() + + print("---- " + varname + " complete!") + + del [output, var] + del [varname, DATA, ATTNAME, ATT] + + +endtime = datetime.now() + + +print("------------------------------------") +print("---- Global input pre-process complete!", endtime.strftime("%Y/%m/%d %H:%M:%S")) +print("---- Process time:", str(endtime - starttime)) +print("------------------------------------") From 20e23b3e53d32600b60063b63b3d7b60e266e0d5 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Tue, 6 Jun 2023 11:48:16 -0400 Subject: [PATCH 20/64] Updated README. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 7ecefac3..d1d8e6db 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,9 @@ Hourly gridded GFSv16 data is available on AWS from March 23, 2021 - Current Day https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022MM01.sfcf000.nc ``` +You can also [generate global inputs using Python (see python/global_data_process.py script)](./python/README.md). + + ### Table 3. Current User Namelist Options | Namelist Option | Namelist Description and Units | From 683e7c9c630f178fcbb39a398c1e1aa9bd6c2093 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Tue, 6 Jun 2023 11:50:13 -0400 Subject: [PATCH 21/64] Updated README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d1d8e6db..f5d0ab38 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ Hourly gridded GFSv16 data is available on AWS from March 23, 2021 - Current Day https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022MM01.sfcf000.nc ``` -You can also [generate global inputs using Python (see python/global_data_process.py script)](./python/README.md). +You can also [generate global inputs using Python (see python/global_data_process.py)](./python/README.md). ### Table 3. Current User Namelist Options From bc97f7456a4122500b1b07a3fc9bdd92981b8aca Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Tue, 6 Jun 2023 17:51:13 -0400 Subject: [PATCH 22/64] Initial commit to restructure tleaf and ppfd modules. --- src/Makefile | 4 +- src/canopy_alloc.F90 | 8 ++- src/canopy_calcs.F90 | 24 +++++-- src/canopy_canvars_mod.F90 | 4 ++ src/canopy_dealloc.F90 | 14 +++-- src/canopy_init.F90 | 8 ++- src/canopy_ppfd_mod.F90 | 126 +++++++++++++++++++++++++++++++++++++ src/canopy_tleaf_mod.F90 | 122 +++++++++++++++++++++++++++++++++++ 8 files changed, 296 insertions(+), 14 deletions(-) create mode 100644 src/canopy_ppfd_mod.F90 create mode 100644 src/canopy_tleaf_mod.F90 diff --git a/src/Makefile b/src/Makefile index eeca9da2..b59b006f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -63,9 +63,11 @@ OBJS :=\ canopy_read_txt.o \ canopy_dxcalc_mod.o \ canopy_profile_mod.o \ + canopy_phot_mod.o \ + canopy_ppfd_mod.o \ + canopy_tleaf_mod.o \ canopy_wind_mod.o \ canopy_waf_mod.o \ - canopy_phot_mod.o \ canopy_eddy_mod.o \ canopy_bioparm_mod.o \ canopy_bioemi_mod.o \ diff --git a/src/canopy_alloc.F90 b/src/canopy_alloc.F90 index 46afb75a..ba007672 100644 --- a/src/canopy_alloc.F90 +++ b/src/canopy_alloc.F90 @@ -25,8 +25,12 @@ SUBROUTINE canopy_alloc ! Allocate arrays for Internal Canopy Distribution Variables !------------------------------------------------------------------------------- - if(.not.allocated(zhc)) allocate(zhc(modlays)) - if(.not.allocated(fafraczInt)) allocate(fafraczInt(modlays)) + if(.not.allocated(zhc)) allocate(zhc(modlays)) + if(.not.allocated(fafraczInt)) allocate(fafraczInt(modlays)) + if(.not.allocated(tleaf_sun)) allocate(tleaf_sun(modlays)) + if(.not.allocated(tleaf_shade)) allocate(tleaf_shade(modlays)) + if(.not.allocated(ppfd_sun)) allocate(ppfd_sun(modlays)) + if(.not.allocated(ppfd_shade)) allocate(ppfd_shade(modlays)) !------------------------------------------------------------------------------- ! Allocate arrays for Canopy Wind Outputs diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index 3f47929b..eff0f621 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -15,11 +15,13 @@ SUBROUTINE canopy_calcs use canopy_utils_mod !main canopy utilities use canopy_dxcalc_mod !main canopy dx calculation use canopy_profile_mod !main canopy foliage profile routines + use canopy_phot_mod !main canopy radiation/photolysis attenuation components + use canopy_tleaf_mod !main canopy leaf temperature components + use canopy_ppfd_mod !main canopy leaf ppfd components use canopy_wind_mod !main canopy wind components - use canopy_waf_mod - use canopy_phot_mod - use canopy_eddy_mod - use canopy_bioemi_mod + use canopy_waf_mod !main canopy WAF components + use canopy_eddy_mod !main canopy eddy diffusivity components + use canopy_bioemi_mod !main canopy biogenic emissions components IMPLICIT NONE @@ -150,6 +152,13 @@ SUBROUTINE canopy_calcs if (ifcanbio) then if (cszref .ge. 0.0_rk .and. dswrfref .gt. 0.0_rk & .and. cluref .gt. 0.0_rk) then + !calculate sunlit/shade leaves, tleaf, and ppfd + call canopy_phot(fafraczInt, & + lairef, cluref, cszref, rjcf_3d(i,j,:)) + call canopy_tleaf_lin( zk, hcmref, tmp2mref, tleaf_sun, tleaf_shade) + call canopy_ppfd_exp( zk, hcmref, dswrfref, lairef, ppfd_sun, & + ppfd_shade) + !calculate biogenic emissions !ISOP call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & @@ -362,6 +371,13 @@ SUBROUTINE canopy_calcs if (ifcanbio) then if (cszref .ge. 0.0_rk .and. dswrfref .gt. 0.0_rk & .and. cluref .gt. 0.0_rk) then + !calculate sunlit/shade leaves, tleaf, and ppfd + call canopy_phot(fafraczInt, & + lairef, cluref, cszref, rjcf(loc, :)) + call canopy_tleaf_lin( zk, hcmref, tmp2mref, tleaf_sun, tleaf_shade) + call canopy_ppfd_exp( zk, hcmref, dswrfref, lairef, ppfd_sun, & + ppfd_shade) + !calculate biogenic emissions !ISOP call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & diff --git a/src/canopy_canvars_mod.F90 b/src/canopy_canvars_mod.F90 index 9365262c..1c5ff989 100644 --- a/src/canopy_canvars_mod.F90 +++ b/src/canopy_canvars_mod.F90 @@ -33,6 +33,10 @@ MODULE canopy_canvars_mod real(rk), allocatable :: fainc ( : ) ! incremental foliage shape function real(rk), allocatable :: fafracz ( : ) ! incremental fractional foliage shape function real(rk), allocatable :: fafraczInt ( : ) ! integral of incremental fractional foliage shape function + real(rk), allocatable :: tleaf_sun ( : ) ! Leaf temp for sunlit leaves (K) + real(rk), allocatable :: tleaf_shade ( : ) ! Leaf temp for shaded leaves (K) + real(rk), allocatable :: ppfd_sun ( : ) ! PPFD for sunlit leaves (umol phot/m2 s) + real(rk), allocatable :: ppfd_shade ( : ) ! PPFD for shaded leaves (umol phot/m2 s) real(rk), allocatable :: canBOT ( : ) ! Canopy bottom wind reduction factors real(rk), allocatable :: canTOP ( : ) ! Canopy top wind reduction factors real(rk), allocatable :: canWIND ( : , : ) ! canopy wind speeds (m/s) diff --git a/src/canopy_dealloc.F90 b/src/canopy_dealloc.F90 index 2094a096..6a65359b 100644 --- a/src/canopy_dealloc.F90 +++ b/src/canopy_dealloc.F90 @@ -25,11 +25,15 @@ SUBROUTINE canopy_dealloc ! Dellocate arrays for Canopy Distribution !------------------------------------------------------------------------------- - if(allocated(zk)) deallocate(zk) !allocated in canopy_readnml - if(allocated(zhc)) deallocate(zhc) - if(allocated(fainc)) deallocate(fainc) !allocated in canopy_profile - if(allocated(fafracz)) deallocate(fafracz) !allocated in canopy_profile - if(allocated(fafraczInt)) deallocate(fafraczInt) + if(allocated(zk)) deallocate(zk) !allocated in canopy_readnml + if(allocated(zhc)) deallocate(zhc) + if(allocated(fainc)) deallocate(fainc) !allocated in canopy_profile + if(allocated(fafracz)) deallocate(fafracz) !allocated in canopy_profile + if(allocated(fafraczInt)) deallocate(fafraczInt) + if(allocated(tleaf_sun)) deallocate(tleaf_sun) + if(allocated(tleaf_shade)) deallocate(tleaf_shade) + if(allocated(ppfd_sun)) deallocate(ppfd_sun) + if(allocated(ppfd_shade)) deallocate(ppfd_shade) !------------------------------------------------------------------------------- ! Deallocate arrays for Canopy Wind diff --git a/src/canopy_init.F90 b/src/canopy_init.F90 index d7af1183..bda4345f 100644 --- a/src/canopy_init.F90 +++ b/src/canopy_init.F90 @@ -19,8 +19,12 @@ SUBROUTINE canopy_init ! Initialize arrays for Canopy Distribution !------------------------------------------------------------------------------- - if(allocated(zhc)) zhc(:) = fillreal - if(allocated(fafraczInt)) fafraczInt(:) = fillreal + if(allocated(zhc)) zhc(:) = fillreal + if(allocated(fafraczInt)) fafraczInt(:) = fillreal + if(allocated(tleaf_sun)) tleaf_sun(:) = fillreal + if(allocated(tleaf_shade)) tleaf_shade(:) = fillreal + if(allocated(ppfd_sun)) ppfd_sun(:) = fillreal + if(allocated(ppfd_shade)) ppfd_shade(:) = fillreal !------------------------------------------------------------------------------- ! Initialize arrays for Canopy Wind diff --git a/src/canopy_ppfd_mod.F90 b/src/canopy_ppfd_mod.F90 new file mode 100644 index 00000000..0a270bda --- /dev/null +++ b/src/canopy_ppfd_mod.F90 @@ -0,0 +1,126 @@ +module canopy_ppfd_mod + + implicit none + +contains + +!::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + SUBROUTINE CANOPY_PPFD_EXP( ZK, FCH, SFCRAD, LAI, PPFD_SUN, PPFD_SHADE) + +!----------------------------------------------------------------------- + +! Description: +! computes linear interpolation method for tleaf sun/shade in canopy. + +! Preconditions: +! in-canopy height, and model LAI, clumping index, and solar zenith angle + +! Subroutines and Functions Called: + +! Revision History: +! Prototype 06/23 by PCC +! Jun 2023 P.C. Campbell: Initial standalone tleaf linear subroutine based on +! Silva et al. (2020) algorithms +!----------------------------------------------------------------------- +!----------------------------------------------------------------------- + use canopy_const_mod, ONLY: RK !constants for canopy models + use canopy_utils_mod, ONLY: interp_linear1_internal + +! Arguments: +! IN/OUT + REAL(RK), INTENT( IN ) :: ZK(:) ! Input model heights (m) + REAL(RK), INTENT( IN ) :: FCH ! Model input canopy height (m) + REAL(RK), INTENT( IN ) :: SFCRAD ! Model input Instantaneous surface downward shortwave flux (W/m2) + REAL(RK), INTENT( IN ) :: LAI ! Model input total Leaf Area Index + REAL(RK), INTENT( OUT ) :: PPFD_SUN(SIZE(ZK)) ! PPFD for sunlit leaves (umol phot/m2 s) + REAL(RK), INTENT( OUT ) :: PPFD_SHADE(SIZE(ZK)) ! PPFD for shaded leaves (umol phot/m2 s) + +! LOCAL + REAL(RK), PARAMETER :: CTEMP_1_SUN = 1.083_rk !Exponential 2-m PPFD --> PPFD parameters (Level 1 = + !top of canopy + REAL(RK), PARAMETER :: CTEMP_2_SUN = 1.096_rk !Based on Table 1 in Silva et al. (2022) + REAL(RK), PARAMETER :: CTEMP_3_SUN = 1.104_rk ! + REAL(RK), PARAMETER :: CTEMP_4_SUN = 1.098_rk ! + REAL(RK), PARAMETER :: CTEMP_5_SUN = 1.090_rk !... + REAL(RK), PARAMETER :: DTEMP_1_SUN = 0.002_rk !... + REAL(RK), PARAMETER :: DTEMP_2_SUN = -0.128_rk !... + REAL(RK), PARAMETER :: DTEMP_3_SUN = -0.298_rk !... + REAL(RK), PARAMETER :: DTEMP_4_SUN = -0.445_rk !... + REAL(RK), PARAMETER :: DTEMP_5_SUN = -0.535_rk !... + REAL(RK), PARAMETER :: CTEMP_1_SHADE = 0.871_rk !... + REAL(RK), PARAMETER :: CTEMP_2_SHADE = 0.890_rk !... + REAL(RK), PARAMETER :: CTEMP_3_SHADE = 0.916_rk !... + REAL(RK), PARAMETER :: CTEMP_4_SHADE = 0.941_rk !... + REAL(RK), PARAMETER :: CTEMP_5_SHADE = 0.956_rk !... + REAL(RK), PARAMETER :: DTEMP_1_SHADE = 0.015_rk !... + REAL(RK), PARAMETER :: DTEMP_2_SHADE = -0.141_rk !... + REAL(RK), PARAMETER :: DTEMP_3_SHADE = -0.368_rk !... + REAL(RK), PARAMETER :: DTEMP_4_SHADE = -0.592_rk !... + REAL(RK), PARAMETER :: DTEMP_5_SHADE = -0.743_rk !... + + REAL(RK), PARAMETER :: FRAC_PAR = 0.5_rk !Fraction of incoming solar irradiance that is PAR + + REAL(RK) :: CTEMP_SUN(SIZE(ZK)) ! Regression coefficient C for sun leaves + REAL(RK) :: DTEMP_SUN(SIZE(ZK)) ! Regression coefficient D for sun leaves + REAL(RK) :: CTEMP_SHADE(SIZE(ZK)) ! Regression coefficient C for shade leaves + REAL(RK) :: DTEMP_SHADE(SIZE(ZK)) ! Regression coefficient D for shade leaves + + integer i + +! Use exponential PPFD model based on Silva et al. (2020) to get approx. sun/shade PPFD +! through canopy +!Citation: +!Silva, S. J., Heald, C. L., and Guenther, A. B.: Development of a reduced-complexity plant canopy +!physics surrogate model for use in chemical transport models: a case study with GEOS-Chem v12.3.0, +!Geosci. Model Dev., 13, 2569–2585, https://doi.org/10.5194/gmd-13-2569-2020, 2020. + do i=1, SIZE(ZK) !calculate linear change in parameters interpolated to Silva et al. 5 layer canopy regions + if (ZK(i) .gt. FCH) then ! above canopy, PPFD_leaf = PPFD_toc (toc=top of canopy) + CTEMP_SUN(i) = 0.0 + DTEMP_SUN(i) = 0.0 + CTEMP_SHADE(i) = 0.0 + DTEMP_SHADE(i) = 0.0 + else if (ZK(i) .le. FCH .and. ZK(i) .gt. FCH*(4.0_rk/5.0_rk)) then !Level 1 - 2 + CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ CTEMP_2_SUN,CTEMP_1_SUN /),ZK(i)) + DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ DTEMP_2_SUN,DTEMP_1_SUN /),ZK(i)) + CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ CTEMP_2_SHADE,CTEMP_1_SHADE /),ZK(i)) + DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ DTEMP_2_SHADE,DTEMP_1_SHADE /),ZK(i)) + else if (ZK(i) .le. FCH*(4.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(3.0_rk/5.0_rk)) then !Level 2 - 3 + CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ CTEMP_3_SUN,CTEMP_2_SUN /),ZK(i)) + DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ DTEMP_3_SUN,DTEMP_2_SUN /),ZK(i)) + CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ CTEMP_3_SHADE,CTEMP_2_SHADE /),ZK(i)) + DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ DTEMP_3_SHADE,DTEMP_2_SHADE /),ZK(i)) + else if (ZK(i) .le. FCH*(3.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(2.0_rk/5.0_rk)) then !Level 3 - 4 + CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ CTEMP_4_SUN,CTEMP_3_SUN /),ZK(i)) + DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ DTEMP_4_SUN,DTEMP_3_SUN /),ZK(i)) + CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ CTEMP_4_SHADE,CTEMP_3_SHADE /),ZK(i)) + DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ DTEMP_4_SHADE,DTEMP_3_SHADE /),ZK(i)) + else if (ZK(i) .le. FCH*(2.0_rk/5.0_rk) ) then !Level 4 - Bottom + CTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & + (/ CTEMP_5_SUN,CTEMP_4_SUN /),ZK(i)) + DTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & + (/ DTEMP_5_SUN,DTEMP_4_SUN /),ZK(i)) + CTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & + (/ CTEMP_5_SHADE,CTEMP_4_SHADE /),ZK(i)) + DTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & + (/ DTEMP_5_SHADE,DTEMP_4_SHADE /),ZK(i)) + end if + end do + + PPFD_SUN = FRAC_PAR * SFCRAD * EXP(CTEMP_SUN + DTEMP_SUN * LAI) !Silva et al. W/m2 --> umol m-2 s-1 + PPFD_SHADE = FRAC_PAR * SFCRAD * EXP(CTEMP_SHADE + DTEMP_SHADE * LAI) + + END SUBROUTINE CANOPY_PPFD_EXP + +end module canopy_ppfd_mod diff --git a/src/canopy_tleaf_mod.F90 b/src/canopy_tleaf_mod.F90 new file mode 100644 index 00000000..a5c172dd --- /dev/null +++ b/src/canopy_tleaf_mod.F90 @@ -0,0 +1,122 @@ +module canopy_tleaf_mod + + implicit none + +contains + +!::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + SUBROUTINE CANOPY_TLEAF_LIN( ZK, FCH, TEMP2, TLEAF_SUN, TLEAF_SHADE) + +!----------------------------------------------------------------------- + +! Description: +! computes linear interpolation method for tleaf sun/shade in canopy. + +! Preconditions: +! canopy height,in-canopy model height, 2-m temp + +! Subroutines and Functions Called: + +! Revision History: +! Prototype 06/23 by PCC +! Jun 2023 P.C. Campbell: Initial standalone tleaf linear subroutine based on +! Silva et al. (2020) algorithms +!----------------------------------------------------------------------- +!----------------------------------------------------------------------- + use canopy_const_mod, ONLY: RK !constants for canopy models + use canopy_utils_mod, ONLY: interp_linear1_internal + +! Arguments: +! IN/OUT + REAL(RK), INTENT( IN ) :: ZK(:) ! Input model heights (m) + REAL(RK), INTENT( IN ) :: FCH ! Model input canopy height (m) + REAL(RK), INTENT( IN ) :: TEMP2 ! Model input 2-m Temperature (K + REAL(RK), INTENT( OUT ) :: TLEAF_SUN(SIZE(ZK)) ! Leaf temp for sunlit leaves (K) + REAL(RK), INTENT( OUT ) :: TLEAF_SHADE(SIZE(ZK)) ! Leaf temp for shaded leaves (K) + +! LOCAL + !Linearized 2-m temp --> leaf temp parameters Based on Table 1 in Silva et al. (2020) + REAL(RK), PARAMETER :: ATEMP_1_SUN = -13.891_rk !Level 1 = top of canopy + REAL(RK), PARAMETER :: ATEMP_2_SUN = -12.322_rk !... + REAL(RK), PARAMETER :: ATEMP_3_SUN = -1.032_rk !... + REAL(RK), PARAMETER :: ATEMP_4_SUN = -5.172_rk !... + REAL(RK), PARAMETER :: ATEMP_5_SUN = -5.589_rk !... + REAL(RK), PARAMETER :: BTEMP_1_SUN = 1.064_rk !... + REAL(RK), PARAMETER :: BTEMP_2_SUN = 1.057_rk !... + REAL(RK), PARAMETER :: BTEMP_3_SUN = 1.031_rk !... + REAL(RK), PARAMETER :: BTEMP_4_SUN = 1.050_rk !... + REAL(RK), PARAMETER :: BTEMP_5_SUN = 1.051_rk !... + REAL(RK), PARAMETER :: ATEMP_1_SHADE = -12.846_rk !... + REAL(RK), PARAMETER :: ATEMP_2_SHADE = -11.343_rk !... + REAL(RK), PARAMETER :: ATEMP_3_SHADE = -1.068_rk !... + REAL(RK), PARAMETER :: ATEMP_4_SHADE = -5.551_rk !... + REAL(RK), PARAMETER :: ATEMP_5_SHADE = -5.955_rk !... + REAL(RK), PARAMETER :: BTEMP_1_SHADE = 1.060_rk !... + REAL(RK), PARAMETER :: BTEMP_2_SHADE = 1.053_rk !... + REAL(RK), PARAMETER :: BTEMP_3_SHADE = 1.031_rk !... + REAL(RK), PARAMETER :: BTEMP_4_SHADE = 1.051_rk !... + REAL(RK), PARAMETER :: BTEMP_5_SHADE = 1.053_rk !... + REAL(RK) :: ATEMP_SUN(SIZE(ZK)) ! Regression coefficient A for sun leaves (Silva et al., 2020) + REAL(RK) :: BTEMP_SUN(SIZE(ZK)) ! Regression coefficient B for sun leaves + REAL(RK) :: ATEMP_SHADE(SIZE(ZK)) ! Regression coefficient A for shade leaves + REAL(RK) :: BTEMP_SHADE(SIZE(ZK)) ! Regression coefficient B for shade leaves + + integer i + +! Use linear canopy temperature model based on Silva et al. (2020) to get approx. sun/shade leaf temperatures +! through canopy (ignores effect of wind speed on leaf boundary layer ~ 1 % error/bias) +!Citation: +!Silva, S. J., Heald, C. L., and Guenther, A. B.: Development of a reduced-complexity plant canopy +!physics surrogate model for use in chemical transport models: a case study with GEOS-Chem v12.3.0, +!Geosci. Model Dev., 13, 2569–2585, https://doi.org/10.5194/gmd-13-2569-2020, 2020. + do i=1, SIZE(ZK) !calculate linear change in parameters interpolated to Silva et al. 5 layer canopy regions + if (ZK(i) .gt. FCH) then ! above canopy, Tleaf = Tair + ATEMP_SUN(i) = 0.0 + BTEMP_SUN(i) = 1.0 + ATEMP_SHADE(i) = 0.0 + BTEMP_SHADE(i) = 1.0 + else if (ZK(i) .le. FCH .and. ZK(i) .gt. FCH*(4.0_rk/5.0_rk)) then !Level 1 - 2 + ATEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ ATEMP_2_SUN,ATEMP_1_SUN /),ZK(i)) + BTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ BTEMP_2_SUN,BTEMP_1_SUN /),ZK(i)) + ATEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ ATEMP_2_SHADE,ATEMP_1_SHADE /),ZK(i)) + BTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ BTEMP_2_SHADE,BTEMP_1_SHADE /),ZK(i)) + else if (ZK(i) .le. FCH*(4.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(3.0_rk/5.0_rk)) then !Level 2 - 3 + ATEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ ATEMP_3_SUN,ATEMP_2_SUN /),ZK(i)) + BTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ BTEMP_3_SUN,BTEMP_2_SUN /),ZK(i)) + ATEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ ATEMP_3_SHADE,ATEMP_2_SHADE /),ZK(i)) + BTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ BTEMP_3_SHADE,BTEMP_2_SHADE /),ZK(i)) + else if (ZK(i) .le. FCH*(3.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(2.0_rk/5.0_rk)) then !Level 3 - 4 + ATEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ ATEMP_4_SUN,ATEMP_3_SUN /),ZK(i)) + BTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ BTEMP_4_SUN,BTEMP_3_SUN /),ZK(i)) + ATEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ ATEMP_4_SHADE,ATEMP_3_SHADE /),ZK(i)) + BTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ BTEMP_4_SHADE,BTEMP_3_SHADE /),ZK(i)) + else if (ZK(i) .le. FCH*(2.0_rk/5.0_rk) ) then !Level 4 - Bottom + ATEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & + (/ ATEMP_5_SUN,ATEMP_4_SUN /),ZK(i)) + BTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & + (/ BTEMP_5_SUN,BTEMP_4_SUN /),ZK(i)) + ATEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & + (/ ATEMP_5_SHADE,ATEMP_4_SHADE /),ZK(i)) + BTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & + (/ BTEMP_5_SHADE,BTEMP_4_SHADE /),ZK(i)) + end if + end do + + TLEAF_SUN = ATEMP_SUN + (BTEMP_SUN*TEMP2) + TLEAF_SHADE = ATEMP_SHADE + (BTEMP_SHADE*TEMP2) + + END SUBROUTINE CANOPY_TLEAF_LIN + +end module canopy_tleaf_mod From 82516878bd15f3fb9a9f8c612dc823ae9b9017d6 Mon Sep 17 00:00:00 2001 From: zmoon Date: Tue, 6 Jun 2023 16:13:36 -0600 Subject: [PATCH 23/64] Attempt to clarify HREF meaning in code comments --- src/canopy_profile_mod.F90 | 4 ++-- src/canopy_wind_mod.F90 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/canopy_profile_mod.F90 b/src/canopy_profile_mod.F90 index 5882a5a6..ee5506bd 100644 --- a/src/canopy_profile_mod.F90 +++ b/src/canopy_profile_mod.F90 @@ -245,13 +245,13 @@ SUBROUTINE CANOPY_ZPD( ZHC, FCLAI, UBZREF, Z0GHC, & REAL(RK), INTENT( IN ) :: ZHC ( : ) ! SUB-CANOPY Total z/h layers (nondimensional) REAL(RK), INTENT( IN ) :: FCLAI ( : ) ! SUB-CANOPY Fractional (z) shapes of the ! plant surface distribution, i.e., a Fractional Culmulative LAI - REAL(RK), INTENT( IN ) :: UBZREF ! Mean wind speed at zref-height of canopy top (m/s) + REAL(RK), INTENT( IN ) :: UBZREF ! Mean wind speed at reference height (ZREF) (m/s) REAL(RK), INTENT( IN ) :: Z0GHC ! Ratio of ground roughness length to canopy top height (nondimensional) REAL(RK), INTENT( IN ) :: LAMBDARS ! Value representing influence of roughness sublayer (nondimensional) REAL(RK), INTENT( IN ) :: CDRAG ! Drag coefficient (nondimensional) REAL(RK), INTENT( IN ) :: PAI ! Total plant/foliage area index (nondimensional) REAL(RK), INTENT( IN ) :: FCH ! Grid cell canopy height (m) - REAL(RK), INTENT( IN ) :: HREF ! Reference Height (m) above the canopy + REAL(RK), INTENT( IN ) :: HREF ! Reference Height above the canopy (ZREF = FCH + HREF; m) REAL(RK), INTENT( IN ) :: Z0_MOD ! Input model value of surface roughness length, z0 (m) INTEGER, INTENT( IN ) :: VTYPE ! Grid cell dominant vegetation type INTEGER, INTENT( IN ) :: LU_OPT ! integer for LU type from model mapped to Massman et al. (default = 0/VIIRS) diff --git a/src/canopy_wind_mod.F90 b/src/canopy_wind_mod.F90 index 53f87d51..6b6e846e 100644 --- a/src/canopy_wind_mod.F90 +++ b/src/canopy_wind_mod.F90 @@ -33,12 +33,12 @@ SUBROUTINE CANOPY_WIND_MOST( HCM, ZK, FAFRACK, UBZREF, Z0GHC, & REAL(RK), INTENT( IN ) :: ZK ! Above/Below canopy height, z (m) REAL(RK), INTENT( IN ) :: FAFRACK ! Fractional (z) shapes of the ! plant surface distribution (nondimensional) - REAL(RK), INTENT( IN ) :: UBZREF ! Mean wind speed at reference height (m/s) + REAL(RK), INTENT( IN ) :: UBZREF ! Mean wind speed at reference height (ZREF) (m/s) REAL(RK), INTENT( IN ) :: Z0GHC ! Ratio of ground roughness length to canopy top height (nondimensional) REAL(RK), INTENT( IN ) :: LAMBDARS ! Value representing influence of roughness sublayer (nondimensional) REAL(RK), INTENT( IN ) :: CDRAG ! Drag coefficient (nondimensional) REAL(RK), INTENT( IN ) :: PAI ! Total plant/foliage area index (nondimensional) - REAL(RK), INTENT( IN ) :: HREF ! Reference Height above canopy associated with ref wind speed (m) + REAL(RK), INTENT( IN ) :: HREF ! Reference Height above the canopy (ZREF = HCM + HREF; m) REAL(RK), INTENT( IN ) :: D_H ! Zero plane displacement heights (nondimensional) REAL(RK), INTENT( IN ) :: ZO_H ! Surface (soil+veg) roughness lengths (nondimensional) REAL(RK), INTENT( OUT ) :: CANBOT_OUT ! Canopy bottom wind reduction factor = canbot (nondimensional) From 7326526c86e3e3b93d92d2660188e6e239b0099a Mon Sep 17 00:00:00 2001 From: zmoon Date: Tue, 6 Jun 2023 16:19:39 -0600 Subject: [PATCH 24/64] More href edits --- README.md | 4 ++-- python/README.md | 2 +- python/global_data_process.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f5d0ab38..86e2c6b2 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ The Canopy-App input data in [Table 2](#table-2-canopy-app-required-input-variab | `frp` | Total Fire Radiative Power (MW/grid cell area) | [NOAA/NESDIS GBBEPx](https://www.ospo.noaa.gov/Products/land/gbbepx/) | | `csz` | Cosine of the solar zenith angle (dimensionless) | [Based on Python Pysolar](https://pysolar.readthedocs.io/en/latest/) | | `mol` | Monin-Obukhov Length (m) | Externally calculated using GFS `tmp2m`, `fricv`, and `shtfl`. ([Essa, 1999](https://inis.iaea.org/collection/NCLCollectionStore/_Public/37/118/37118528.pdf)) | -| `href` | Reference height above canopy (m) - 10 m | Added as a constant reference height above surface (i.e., 10 m). Can be taken from NL. | +| `href` | Reference height above canopy (m) - 10 m | Assumed constant (i.e., 10 m). Can be taken from NL. | **More Information on Data Sources from [Table 2](#table-2-canopy-app-required-input-variables):** @@ -185,7 +185,7 @@ You can also [generate global inputs using Python (see python/global_data_proces | `ifcaneddy` | logical canopy eddy Kz option (default: `.FALSE.`) | | `ifcanphot` | logical canopy photolysis option (default: `.FALSE.`) | | `ifcanbio` | logical canopy biogenic emissions option (default: `.FALSE.`) | -| `href_opt` | integer for using href_set in namelist (= `0`, default) or array from file (= `1`) | +| `href_opt` | integer for using `href_set` in namelist (= `0`, default) or array from file (= `1`) | | `href_set` | user-set real value of reference height above canopy associated with input wind speed (m) (only used if `href_opt=0`) **\*\*\*** | | `z0ghc` | ratio of ground roughness length to canopy top height (Massman et al., 2017) | | `rsl_opt` | user-set option for either MOST or unified Roughness SubLayer (RSL) effects above and at canopy top (Uc).(= `0`, default: uses MOST and a constant lambdars factor only), (= `1`, under development: will use a more unified RSL approach from Bonan et al. (2018) and Abolafia-Rosenzweig et al., 2021) | diff --git a/python/README.md b/python/README.md index 06faa58e..ed6e2114 100644 --- a/python/README.md +++ b/python/README.md @@ -70,7 +70,7 @@ month = 7 # month day = 1 # day houri = 12 # gfs initialization hour in UTC (caution currently GFS files are initialized at 12 UTC only -- do not change) hour = 00 # gfs forecast hour in UTC -ref_lev = 10 # reference height (m, a.g.l.) +ref_lev = 10 # reference height above the canopy (m) frp_src = 1 # frp data source (0: local source; 1: check local source first, switch to climatological file if no available data ; 2: 12 month climatology) ``` diff --git a/python/global_data_process.py b/python/global_data_process.py index 221cbac1..3bb33403 100755 --- a/python/global_data_process.py +++ b/python/global_data_process.py @@ -20,7 +20,7 @@ day = 1 # day houri = 12 # gfs initialization hour in UTC (caution: currently GFS input files are initialized at 12 UTC only -- do not change) hour = 0 # gfs forecast hour (0-24) in UTC -ref_lev = 10 # reference height (m, a.g.l.) +ref_lev = 10 # reference height above the canopy (m) frp_src = 1 # frp data source for WAF (0: local source; 1: check local source first, switch to climatological file if no available data ; 2: 12 month climatology) @@ -395,7 +395,7 @@ def read_frp_local(filename, lat, lon, fill_value): elif varname == "href": ATTNAME = ["long_name", "units", "missing_value"] - ATT = ["Reference height above the surface", "m", fill_value] + ATT = ["Reference height above the canopy", "m", fill_value] DATA = np.empty([nlat, nlon]) DATA[:] = ref_lev From 59d96700c05f9a1f14d0dc65738f0810dd3b2233 Mon Sep 17 00:00:00 2001 From: zmoon Date: Tue, 6 Jun 2023 16:22:49 -0600 Subject: [PATCH 25/64] md --- python/README.md | 49 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/python/README.md b/python/README.md index ed6e2114..22a45080 100644 --- a/python/README.md +++ b/python/README.md @@ -52,37 +52,34 @@ ds = run_config_sens(cases) ``` :point_up: We still get a single output dataset, but it has a `case` dimension. -:point_down: You can also download and generate global gridded canopy-app inputs using python. +### Generating global data -- Edit python script (`global_data_process.py`) +You can also download and generate global gridded canopy-app inputs using Python. -``` -vim global_data_process.py -``` - -- Change user settings +1. Edit python script (`global_data_process.py`) -``` -'''User Options''' -path = '/scratch/pcampbe8/canopy-app/input' # work directory -year = 2022 # year -month = 7 # month -day = 1 # day -houri = 12 # gfs initialization hour in UTC (caution currently GFS files are initialized at 12 UTC only -- do not change) -hour = 00 # gfs forecast hour in UTC -ref_lev = 10 # reference height above the canopy (m) -frp_src = 1 # frp data source (0: local source; 1: check local source first, switch to climatological file if no available data ; 2: 12 month climatology) -``` +2. Change user settings -- Activate Python canopy-app environment: + ```python + '''User Options''' + path = '/scratch/pcampbe8/canopy-app/input' # work directory + year = 2022 # year + month = 7 # month + day = 1 # day + houri = 12 # gfs initialization hour in UTC (caution currently GFS files are initialized at 12 UTC only -- do not change) + hour = 00 # gfs forecast hour in UTC + ref_lev = 10 # reference height above the canopy (m) + frp_src = 1 # frp data source (0: local source; 1: check local source first, switch to climatological file if no available data ; 2: 12 month climatology) + ``` +2. Activate canopy-app Conda environment: -``` - conda activate canopy-app -``` + ``` + conda activate canopy-app + ``` -- Run python script +3. Run python script -``` -python3 global_data_process.py -``` + ``` + python global_data_process.py + ``` From ca03333fc6c36b41da5b86dc6f4484cce552fbe2 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Tue, 6 Jun 2023 21:10:41 -0400 Subject: [PATCH 26/64] Reverted changes to wait for bio_opts changes. --- src/canopy_calcs.F90 | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index eff0f621..3f47929b 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -15,13 +15,11 @@ SUBROUTINE canopy_calcs use canopy_utils_mod !main canopy utilities use canopy_dxcalc_mod !main canopy dx calculation use canopy_profile_mod !main canopy foliage profile routines - use canopy_phot_mod !main canopy radiation/photolysis attenuation components - use canopy_tleaf_mod !main canopy leaf temperature components - use canopy_ppfd_mod !main canopy leaf ppfd components use canopy_wind_mod !main canopy wind components - use canopy_waf_mod !main canopy WAF components - use canopy_eddy_mod !main canopy eddy diffusivity components - use canopy_bioemi_mod !main canopy biogenic emissions components + use canopy_waf_mod + use canopy_phot_mod + use canopy_eddy_mod + use canopy_bioemi_mod IMPLICIT NONE @@ -152,13 +150,6 @@ SUBROUTINE canopy_calcs if (ifcanbio) then if (cszref .ge. 0.0_rk .and. dswrfref .gt. 0.0_rk & .and. cluref .gt. 0.0_rk) then - !calculate sunlit/shade leaves, tleaf, and ppfd - call canopy_phot(fafraczInt, & - lairef, cluref, cszref, rjcf_3d(i,j,:)) - call canopy_tleaf_lin( zk, hcmref, tmp2mref, tleaf_sun, tleaf_shade) - call canopy_ppfd_exp( zk, hcmref, dswrfref, lairef, ppfd_sun, & - ppfd_shade) - !calculate biogenic emissions !ISOP call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & @@ -371,13 +362,6 @@ SUBROUTINE canopy_calcs if (ifcanbio) then if (cszref .ge. 0.0_rk .and. dswrfref .gt. 0.0_rk & .and. cluref .gt. 0.0_rk) then - !calculate sunlit/shade leaves, tleaf, and ppfd - call canopy_phot(fafraczInt, & - lairef, cluref, cszref, rjcf(loc, :)) - call canopy_tleaf_lin( zk, hcmref, tmp2mref, tleaf_sun, tleaf_shade) - call canopy_ppfd_exp( zk, hcmref, dswrfref, lairef, ppfd_sun, & - ppfd_shade) - !calculate biogenic emissions !ISOP call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & From 4d43d2c0cae884045ef269dd4c52f49eb1d0a87f Mon Sep 17 00:00:00 2001 From: zmoon Date: Thu, 8 Jun 2023 15:38:21 -0600 Subject: [PATCH 27/64] Add small example comparing the emissions calc opts for the point case --- python/examples.ipynb | 59 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/python/examples.ipynb b/python/examples.ipynb index d9a75e91..aedd1ac5 100644 --- a/python/examples.ipynb +++ b/python/examples.ipynb @@ -760,6 +760,65 @@ " ax.plot(clu, ds_c[vn])\n", " ax.set(ylabel=vn, xlabel=\"CLU\")" ] + }, + { + "cell_type": "markdown", + "id": "13cc57aa-666c-4f27-ac01-400838ba94a0", + "metadata": {}, + "source": [ + "### Emissions calculation options" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "578f31ab-832e-4303-88c4-9cb444fe99f9", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "cases = config_cases(\n", + " file_vars=\"../input/input_variables_point.txt\",\n", + " infmt_opt=1,\n", + " nlat=1,\n", + " nlon=1,\n", + " bio_vert=[0, 1, 2],\n", + ")\n", + "ds = run_config_sens(cases)\n", + "ds" + ] + }, + { + "cell_type": "markdown", + "id": "affd849c-3464-4f27-abc3-1390a4395e31", + "metadata": {}, + "source": [ + "Currently, method 1 should give the same result as canopy-integrating the laywerwise method 0 results afterwards.\n", + "\n", + "The method 2 result is smaller since it places more weight on the middle of the canopy, where light levels are lower." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "86b197ac-9ecb-40b2-a7e5-1354fcc0a2d3", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "dz = ds.z.diff(\"z\")\n", + "\n", + "e0 = float((ds.emi_isop.isel(case=0) * dz).sum(\"z\"))\n", + "e1 = float(ds.emi_isop.isel(case=1, z=-1))\n", + "e2 = float(ds.emi_isop.isel(case=2, z=-1))\n", + "print(e0)\n", + "print(e1)\n", + "print(e2)\n", + "\n", + "assert np.isclose(e0, e1)" + ] } ], "metadata": { From 65993eabd2de8f01ef614204866eb142556d5c8c Mon Sep 17 00:00:00 2001 From: zmoon Date: Thu, 8 Jun 2023 16:42:23 -0600 Subject: [PATCH 28/64] Add missing emi calc option --- python/examples.ipynb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/python/examples.ipynb b/python/examples.ipynb index aedd1ac5..d37ba600 100644 --- a/python/examples.ipynb +++ b/python/examples.ipynb @@ -783,7 +783,7 @@ " infmt_opt=1,\n", " nlat=1,\n", " nlon=1,\n", - " bio_vert=[0, 1, 2],\n", + " bio_vert=[0, 1, 2, 3],\n", ")\n", "ds = run_config_sens(cases)\n", "ds" @@ -796,7 +796,7 @@ "source": [ "Currently, method 1 should give the same result as canopy-integrating the laywerwise method 0 results afterwards.\n", "\n", - "The method 2 result is smaller since it places more weight on the middle of the canopy, where light levels are lower." + "The method 2 result is smaller since it places more weight on the lower--middle regions of the canopy, where light levels are lower. Method 3 is somewhere in between these (consider the shape of the LAD profile vs a Gaussian in height)." ] }, { @@ -813,9 +813,8 @@ "e0 = float((ds.emi_isop.isel(case=0) * dz).sum(\"z\"))\n", "e1 = float(ds.emi_isop.isel(case=1, z=-1))\n", "e2 = float(ds.emi_isop.isel(case=2, z=-1))\n", - "print(e0)\n", - "print(e1)\n", - "print(e2)\n", + "e3 = float(ds.emi_isop.isel(case=3, z=-1))\n", + "print(e0, e1, e2, e3, sep=\"\\n\")\n", "\n", "assert np.isclose(e0, e1)" ] From 49f0110c48f530119b7f7cc653d66607fd539349 Mon Sep 17 00:00:00 2001 From: quaz115 Date: Thu, 8 Jun 2023 19:15:27 -0600 Subject: [PATCH 29/64] Modified Makefile to work with both ifort or gfortran to build canopy-app --- src/Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index eeca9da2..e934dd1d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,10 +2,13 @@ # Use `FC= ... make` to select compiler # Use `DEBUG=1 ... make` for a debug build # Use `NETCDF=1 ... make` to build with NetCDF using `nf-config` +# compile with either FC=ifort or FC=gfortran # Compiler FC ?= gfortran ifeq ($(FC), f77) # override possible Make default + FC := ifort +else ifeq ($(FC),gfortran) FC := gfortran endif $(info FC setting: '$(FC)') @@ -19,7 +22,12 @@ NETCDF ?= 1 # Compile flags $(info DEBUG setting: '$(DEBUG)') ifeq ($(DEBUG), 1) - FCFLAGS := -g -Wall -Wextra -Wconversion -Og -pedantic -fcheck=bounds -fmax-errors=5 + ifeq ($(FC),gfortran) + FCFLAGS := -g -Wall -Wextra -Wconversion -Og -pedantic -fcheck=bounds -fmax-errors=5 + else ifeq ($(FC),ifort) + #FCFLAGS := -g -warn all -implicitnone -O1 -stand f90 -error-limit 5 #Equivalent to gfortran Debug flags, builds with warnings on Hera + FCFLAGS := -g -warn all -check bounds -traceback #builds without warnings on Hera + endif else ifeq ($(DEBUG), 0) FCFLAGS := -O3 else From 55ba56dc6548974a1e9d8a3c80cd77ce3789c3b6 Mon Sep 17 00:00:00 2001 From: Patrick Campbell Date: Thu, 8 Jun 2023 22:26:36 -0400 Subject: [PATCH 30/64] Update src/Makefile Co-authored-by: Zachary Moon --- src/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index e934dd1d..393deb85 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,7 +2,6 @@ # Use `FC= ... make` to select compiler # Use `DEBUG=1 ... make` for a debug build # Use `NETCDF=1 ... make` to build with NetCDF using `nf-config` -# compile with either FC=ifort or FC=gfortran # Compiler FC ?= gfortran From 91b5b43fd4502f0572497baf8104193bcf4fd177 Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Thu, 8 Jun 2023 19:42:50 -0700 Subject: [PATCH 31/64] Update Makefile --- src/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index 393deb85..6aa2e8b7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,8 +6,6 @@ # Compiler FC ?= gfortran ifeq ($(FC), f77) # override possible Make default - FC := ifort -else ifeq ($(FC),gfortran) FC := gfortran endif $(info FC setting: '$(FC)') From cb97f66ab3222223a342ff665aa11b955ad11160 Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Thu, 8 Jun 2023 19:59:45 -0700 Subject: [PATCH 32/64] Update Makefile ifort --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 6aa2e8b7..933a1c23 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,7 +6,7 @@ # Compiler FC ?= gfortran ifeq ($(FC), f77) # override possible Make default - FC := gfortran + FC := ifort endif $(info FC setting: '$(FC)') From 0798252e2c86b7119abdad40bb8c0e112f6f9445 Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Thu, 8 Jun 2023 20:20:55 -0700 Subject: [PATCH 33/64] Update Makefile- Latest build check with ifort on Hera, both debug flag options work without warning --- src/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index 933a1c23..4e01faba 100644 --- a/src/Makefile +++ b/src/Makefile @@ -22,8 +22,9 @@ ifeq ($(DEBUG), 1) ifeq ($(FC),gfortran) FCFLAGS := -g -Wall -Wextra -Wconversion -Og -pedantic -fcheck=bounds -fmax-errors=5 else ifeq ($(FC),ifort) - #FCFLAGS := -g -warn all -implicitnone -O1 -stand f90 -error-limit 5 #Equivalent to gfortran Debug flags, builds with warnings on Hera - FCFLAGS := -g -warn all -check bounds -traceback #builds without warnings on Hera + # Both the following Debug flag options build Canopy-app on Hera with ifort without warnings + #FCFLAGS := -g -warn all -implicitnone -O1 -stand f90 -error-limit 5 #Equivalent to gfortran Debug flags + FCFLAGS := -g -warn all -check bounds -traceback endif else ifeq ($(DEBUG), 0) FCFLAGS := -O3 From fd24cb156906eb9d3ce996511a894d5052322864 Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Thu, 8 Jun 2023 21:07:31 -0700 Subject: [PATCH 34/64] Update Makefile- Resolved, one debug flag (ifort) gives warning --- src/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index 4e01faba..254b839b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,7 +6,7 @@ # Compiler FC ?= gfortran ifeq ($(FC), f77) # override possible Make default - FC := ifort + FC := gfortran endif $(info FC setting: '$(FC)') @@ -22,9 +22,9 @@ ifeq ($(DEBUG), 1) ifeq ($(FC),gfortran) FCFLAGS := -g -Wall -Wextra -Wconversion -Og -pedantic -fcheck=bounds -fmax-errors=5 else ifeq ($(FC),ifort) - # Both the following Debug flag options build Canopy-app on Hera with ifort without warnings - #FCFLAGS := -g -warn all -implicitnone -O1 -stand f90 -error-limit 5 #Equivalent to gfortran Debug flags - FCFLAGS := -g -warn all -check bounds -traceback + # Tested the following Debug flag options on Hera with 'DEBUG=1 NETCDF=1 FC=ifort make -C src' + #FCFLAGS := -g -warn all -implicitnone -O1 -stand f90 -error-limit 5 #Equivalent to gfortran Debug flags #builds but with WARNINGS to be resolved + FCFLAGS := -g -warn all -check bounds -traceback #builds Canopy-app on Hera with FC=ifort without warnings endif else ifeq ($(DEBUG), 0) FCFLAGS := -O3 From c076b6f90b3fc3c4c90567c4e153e73d88f69029 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 9 Jun 2023 14:30:18 -0400 Subject: [PATCH 35/64] Changed bio_vert to biovert_opt to conform NL. --- README.md | 2 +- input/namelist.canopy | 70 +++++++++++++++++------------------ src/canopy_bioemi_mod.F90 | 2 +- src/canopy_calcs.F90 | 76 +++++++++++++++++++------------------- src/canopy_canopts_mod.F90 | 2 +- src/canopy_readnml.F90 | 4 +- 6 files changed, 78 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index df4c2ffe..bd625e92 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `lu_opt` | integer for input model land use type (`0`: VIIRS 17 Cat (default) or `1`: MODIS-IGBP 20 Cat (valid LU types 1-10 and 12); input mapped to Massman et al.) | | `z0_opt` | integer (`0`: use model input or `1`: vegtype dependent z0 for first estimate) | | `bio_cce` | user-set real value of MEGAN biogenic emissions "canopy environment coefficient" used to tune emissions to model inputs/calculations (default: `0.21`, based on Silva et al. 2020) | -| `bio_vert` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of LAD weighted activity coefficients using the canopy-app plant distributions, caution-- units=kg m-2 s-1 and puts the total emissions in the topmost canopy-app model layer only; `2`: Same as in option 1, but instead uses Gaussian/normally weighted activity coefficients acoss all sub-canopy layers -- also units of kg m-2 s-1 in topmost model layer; `3`: Same as in option 1, but instead uses evenly weighted activity coefficients acoss all sub-canopy layers -- also units of kg m-2 s-1 in topmost model layer | +| `biovert_opt` user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of LAD weighted activity coefficients using the canopy-app plant distributions, caution-- units=kg m-2 s-1 and puts the total emissions in the topmost canopy-app model layer only; `2`: Same as in option 1, but instead uses Gaussian/normally weighted activity coefficients acoss all sub-canopy layers -- also units of kg m-2 s-1 in topmost model layer; `3`: Same as in option 1, but instead uses evenly weighted activity coefficients acoss all sub-canopy layers -- also units of kg m-2 s-1 in topmost model layer | | `ssg_opt` | integer for using either input data (= `0`, default) or user set shrub/savanna/grass (SSG) vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not SSG. Warning: use of ssg_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates SSG | | `ssg_set` | user-set real value of constant SSG vegetation type heights (m) (only used if `ssg_opt=1`) | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | diff --git a/input/namelist.canopy b/input/namelist.canopy index 69ffd68a..a51785b9 100755 --- a/input/namelist.canopy +++ b/input/namelist.canopy @@ -5,39 +5,39 @@ / &USERDEFS - infmt_opt = 0 - nlat = 43 - nlon = 86 - modlays = 100 - modres = 0.5 - ifcanwind = .TRUE. - ifcanwaf = .TRUE. - ifcaneddy = .TRUE. - ifcanphot = .TRUE. - ifcanbio = .TRUE. - href_opt = 0 - href_set = 10.0 - z0ghc = 0.0025 - rsl_opt = 0 - lambdars = 1.25 - dx_opt = 0 - dx_set = 12000.0 - flameh_opt = 2 - flameh_set = 1.0 - frp_fac = 1.0 - pai_opt = 0 - pai_set = 4.0 - lu_opt = 1 - z0_opt = 0 - bio_cce = 0.21 - bio_vert = 0 - ssg_opt = 0 - ssg_set = 1.0 - crop_opt = 0 - crop_set = 3.0 - co2_opt = 0 - co2_set = 400.0 - lai_thresh = 0.1 - frt_thresh = 0.1 - fch_thresh = 0.5 + infmt_opt = 0 + nlat = 43 + nlon = 86 + modlays = 100 + modres = 0.5 + ifcanwind = .TRUE. + ifcanwaf = .TRUE. + ifcaneddy = .TRUE. + ifcanphot = .TRUE. + ifcanbio = .TRUE. + href_opt = 0 + href_set = 10.0 + z0ghc = 0.0025 + rsl_opt = 0 + lambdars = 1.25 + dx_opt = 0 + dx_set = 12000.0 + flameh_opt = 2 + flameh_set = 1.0 + frp_fac = 1.0 + pai_opt = 0 + pai_set = 4.0 + lu_opt = 1 + z0_opt = 0 + bio_cce = 0.21 + biovert_opt = 4 + ssg_opt = 0 + ssg_set = 1.0 + crop_opt = 0 + crop_set = 3.0 + co2_opt = 0 + co2_set = 400.0 + lai_thresh = 0.1 + frt_thresh = 0.1 + fch_thresh = 0.5 / diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index 80416083..ba3d87d2 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -385,7 +385,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & VPGWT(1:LAYERS)) * GAMMACO2 * CCE !put into top model layer (ug m-2 hr-1) EMI_OUT = EMI_OUT * 2.7777777777778E-13_rk !convert emissions output to (kg m-2 s-1) else - write(*,*) 'Wrong BIO_VERT choice of ', VERT, ' in namelist...exiting' + write(*,*) 'Wrong BIOVERT_OPT choice of ', VERT, ' in namelist...exiting' call exit(2) end if diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index 6c788d1e..e4aef172 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -185,97 +185,97 @@ SUBROUTINE canopy_calcs !ISOP call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 1, emi_isop_3d(i,j,:)) !MYRC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 2, emi_myrc_3d(i,j,:)) !SABI call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 3, emi_sabi_3d(i,j,:)) !LIMO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 4, emi_limo_3d(i,j,:)) !CARE call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 5, emi_care_3d(i,j,:)) !OCIM call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 6, emi_ocim_3d(i,j,:)) !BPIN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 7, emi_bpin_3d(i,j,:)) !APIN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 8, emi_apin_3d(i,j,:)) !MONO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 9, emi_mono_3d(i,j,:)) !FARN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 10, emi_farn_3d(i,j,:)) !CARY call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 11, emi_cary_3d(i,j,:)) !SESQ call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 12, emi_sesq_3d(i,j,:)) !MBOL call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 13, emi_mbol_3d(i,j,:)) !METH call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 14, emi_meth_3d(i,j,:)) !ACET call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 15, emi_acet_3d(i,j,:)) !CO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 16, emi_co_3d(i,j,:)) !BIDI VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 17, emi_bvoc_3d(i,j,:)) !Stress VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 18, emi_svoc_3d(i,j,:)) !Other VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 19, emi_ovoc_3d(i,j,:)) end if end if @@ -448,97 +448,97 @@ SUBROUTINE canopy_calcs !ISOP call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 1, emi_isop(loc,:)) !MYRC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 2, emi_myrc(loc,:)) !SABI call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 3, emi_sabi(loc,:)) !LIMO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 4, emi_limo(loc,:)) !CARE call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 5, emi_care(loc,:)) !OCIM call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 6, emi_ocim(loc,:)) !BPIN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 7, emi_bpin(loc,:)) !APIN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 8, emi_apin(loc,:)) !MONO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 9, emi_mono(loc,:)) !FARN call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 10, emi_farn(loc,:)) !CARY call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 11, emi_cary(loc,:)) !SESQ call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 12, emi_sesq(loc,:)) !MBOL call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 13, emi_mbol(loc,:)) !METH call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 14, emi_meth(loc,:)) !ACET call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 15, emi_acet(loc,:)) !CO call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 16, emi_co(loc,:)) !BIDI VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 17, emi_bvoc(loc,:)) !Stress VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 18, emi_svoc(loc,:)) !Other VOC call canopy_bio(zk, fafraczInt, hcmref, & lairef, cluref, cszref, dswrfref, tmp2mref, & - lu_opt, vtyperef, modres, bio_cce, bio_vert, co2_opt, co2_set, & + lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 19, emi_ovoc(loc,:)) end if end if diff --git a/src/canopy_canopts_mod.F90 b/src/canopy_canopts_mod.F90 index 028002a4..b3f1c29c 100644 --- a/src/canopy_canopts_mod.F90 +++ b/src/canopy_canopts_mod.F90 @@ -33,7 +33,7 @@ MODULE canopy_canopts_mod real(rk) :: z0ghc !ratio of ground roughness length to canopy top height real(rk) :: lambdars !Value representing influence of roughness sublayer (nondimensional) real(rk) :: bio_cce !MEGAN biogenic emission canopy environment coefficient. - integer :: bio_vert !MEGAN vertical integration of emissions option (default = 0, off) + integer :: biovert_opt !MEGAN vertical integration of emissions option (default = 0, off) integer :: ssg_opt !Set default integer for shrubs/savanna/grassland vegtype option from GEDI or user (default = 0) real(rk) :: ssg_set !Set default value for shrubs/savanna/grassland vegtype heights used in model (m) (Default = 1 m) integer :: crop_opt !Set default integer for crop vegtype option from GEDI or user (default = 0) diff --git a/src/canopy_readnml.F90 b/src/canopy_readnml.F90 index f92a1abb..52e63989 100644 --- a/src/canopy_readnml.F90 +++ b/src/canopy_readnml.F90 @@ -23,7 +23,7 @@ SUBROUTINE canopy_readnml NAMELIST /userdefs/ infmt_opt, nlat, nlon, modlays, modres, href_opt, href_set, & z0ghc, lambdars, flameh_opt, flameh_set, frp_fac, ifcanwind, ifcanwaf, & ifcaneddy, ifcanphot, ifcanbio, pai_opt, pai_set, lu_opt, z0_opt, dx_opt, & - dx_set, lai_thresh, frt_thresh, fch_thresh, rsl_opt, bio_cce, bio_vert, & + dx_set, lai_thresh, frt_thresh, fch_thresh, rsl_opt, bio_cce, biovert_opt, & ssg_opt, ssg_set, crop_opt, crop_set, co2_opt, co2_set !------------------------------------------------------------------------------- @@ -204,7 +204,7 @@ SUBROUTINE canopy_readnml !------------------------------------------------------------------------------- ! Set default integer value for MEGAN vertical integration of emissions (0, off full leaf-level emissions) - bio_vert = 0 + biovert_opt = 0 !------------------------------------------------------------------------------- !------------------------------------------------------------------------------- From 9d61034c95c5d98c06539759fb272cafdab34953 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 9 Jun 2023 14:33:08 -0400 Subject: [PATCH 36/64] Updated NL for biovert_opt = 0 by default --- input/namelist.canopy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/input/namelist.canopy b/input/namelist.canopy index a51785b9..04781010 100755 --- a/input/namelist.canopy +++ b/input/namelist.canopy @@ -30,7 +30,7 @@ lu_opt = 1 z0_opt = 0 bio_cce = 0.21 - biovert_opt = 4 + biovert_opt = 0 ssg_opt = 0 ssg_set = 1.0 crop_opt = 0 From d3e74202268f8f57dd16b133b9ab802f553e1f76 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 9 Jun 2023 14:34:17 -0400 Subject: [PATCH 37/64] Fixed README for biovert_opt. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bd625e92..f3ba4ed7 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ https://nacc-in-the-cloud.s3.amazonaws.com/inputs/geo-files/gfs.canopy.t12z.2022 | `lu_opt` | integer for input model land use type (`0`: VIIRS 17 Cat (default) or `1`: MODIS-IGBP 20 Cat (valid LU types 1-10 and 12); input mapped to Massman et al.) | | `z0_opt` | integer (`0`: use model input or `1`: vegtype dependent z0 for first estimate) | | `bio_cce` | user-set real value of MEGAN biogenic emissions "canopy environment coefficient" used to tune emissions to model inputs/calculations (default: `0.21`, based on Silva et al. 2020) | -| `biovert_opt` user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of LAD weighted activity coefficients using the canopy-app plant distributions, caution-- units=kg m-2 s-1 and puts the total emissions in the topmost canopy-app model layer only; `2`: Same as in option 1, but instead uses Gaussian/normally weighted activity coefficients acoss all sub-canopy layers -- also units of kg m-2 s-1 in topmost model layer; `3`: Same as in option 1, but instead uses evenly weighted activity coefficients acoss all sub-canopy layers -- also units of kg m-2 s-1 in topmost model layer | +| `biovert_opt` | user set biogenic vertical summing option (`0`: no sum, full leaf-level biogenic emissions, units=kg/m3/s; `1`: MEGANv3-like summing of LAD weighted activity coefficients using the canopy-app plant distributions, caution-- units=kg m-2 s-1 and puts the total emissions in the topmost canopy-app model layer only; `2`: Same as in option 1, but instead uses Gaussian/normally weighted activity coefficients acoss all sub-canopy layers -- also units of kg m-2 s-1 in topmost model layer; `3`: Same as in option 1, but instead uses evenly weighted activity coefficients acoss all sub-canopy layers -- also units of kg m-2 s-1 in topmost model layer | | `ssg_opt` | integer for using either input data (= `0`, default) or user set shrub/savanna/grass (SSG) vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not SSG. Warning: use of ssg_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates SSG | | `ssg_set` | user-set real value of constant SSG vegetation type heights (m) (only used if `ssg_opt=1`) | | `crop_opt` | integer for using either input data (= `0`, default) or user set crop vegetation type heights from namelist (= `1`). Currently, GEDI FCH input data only provides canopy heights for forests and not crops. Warning: use of crop_opt=1 will overide typically higher resolution input data (e.g., GEDI) forest canopy heights where the lower resolution vegtype data indicates crops | From b4bf7cf0c5b50469c10995ea9287ea2720797c59 Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Fri, 9 Jun 2023 13:19:08 -0700 Subject: [PATCH 38/64] Update Makefile- $NETCDF to $NC (ifort builds and make clean without error/warning) --- src/Makefile | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Makefile b/src/Makefile index 254b839b..c2cacd2f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,7 @@ # # Use `FC= ... make` to select compiler # Use `DEBUG=1 ... make` for a debug build -# Use `NETCDF=1 ... make` to build with NetCDF using `nf-config` +# Use `NC=1 ... make` to build with NetCDF using `nf-config` # Compiler FC ?= gfortran @@ -14,17 +14,18 @@ $(info FC setting: '$(FC)') DEBUG ?= 0 # Default to NetCDF build -NETCDF ?= 1 +NC ?= 1 # Compile flags $(info DEBUG setting: '$(DEBUG)') ifeq ($(DEBUG), 1) ifeq ($(FC),gfortran) - FCFLAGS := -g -Wall -Wextra -Wconversion -Og -pedantic -fcheck=bounds -fmax-errors=5 + FCFLAGS := -g -Wall -Wextra -Wconversion -Og -pedantic -fcheck=bounds -fmax-errors=5 -std=f2003 -fall-intrinsics else ifeq ($(FC),ifort) - # Tested the following Debug flag options on Hera with 'DEBUG=1 NETCDF=1 FC=ifort make -C src' - #FCFLAGS := -g -warn all -implicitnone -O1 -stand f90 -error-limit 5 #Equivalent to gfortran Debug flags #builds but with WARNINGS to be resolved - FCFLAGS := -g -warn all -check bounds -traceback #builds Canopy-app on Hera with FC=ifort without warnings + # Tested the following Debug flag options on Hera with 'DEBUG=1 NC=1 FC=ifort make -C src' + # Both options build without warnings and also make clean in src + FCFLAGS := -g -warn all -implicitnone -O1 -error-limit 5 #Equivalent to gfortran Debug flags + #FCFLAGS := -g -warn all -check bounds -traceback #also builds Canopy-app on Hera with FC=ifort without warnings endif else ifeq ($(DEBUG), 0) FCFLAGS := -O3 @@ -35,18 +36,18 @@ endif # NETCDF Settings here LIBS := INC := -$(info NETCDF setting: '$(NETCDF)') -ifeq ($(NETCDF), 1) +$(info NETCDF setting: '$(NC)') +ifeq ($(NC), 1) NETCDF_FLIBS := $(shell nf-config --flibs) NETCDF_INC := -I$(shell nf-config --includedir) # LIBS += $(NETCDF_FLIBS) INC += $(NETCDF_INC) FCFLAGS += -DNETCDF -else ifeq ($(NETCDF), 0) +else ifeq ($(NC), 0) # else - $(error invalid setting for NETCDF, should be 0 or 1 but is '$(NETCDF)') + $(error invalid setting for NETCDF, should be 0 or 1 but is '$(NC)') endif $(info LIBS: '$(LIBS)') $(info INC: '$(INC)') @@ -80,7 +81,7 @@ OBJS :=\ canopy_dealloc.o \ canopy_app.o -ifeq ($(NETCDF), 0) +ifeq ($(NC), 0) _ncf_objs := canopy_check_input.o canopy_ncf_io_mod.o OBJS := $(filter-out $(_ncf_objs),$(OBJS)) endif From 7a310693e20a797eca8aac7c46eb66e1278a1d31 Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Fri, 9 Jun 2023 16:17:30 -0700 Subject: [PATCH 39/64] Update src/Makefile Co-authored-by: Zachary Moon --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index c2cacd2f..11709748 100644 --- a/src/Makefile +++ b/src/Makefile @@ -36,7 +36,7 @@ endif # NETCDF Settings here LIBS := INC := -$(info NETCDF setting: '$(NC)') +$(info NC setting: '$(NC)') ifeq ($(NC), 1) NETCDF_FLIBS := $(shell nf-config --flibs) NETCDF_INC := -I$(shell nf-config --includedir) From b21eba3051903816191077b04cf3cfb8370dd6b8 Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Fri, 9 Jun 2023 16:22:24 -0700 Subject: [PATCH 40/64] Update src/Makefile Co-authored-by: Zachary Moon --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 11709748..f7666949 100644 --- a/src/Makefile +++ b/src/Makefile @@ -47,7 +47,7 @@ ifeq ($(NC), 1) else ifeq ($(NC), 0) # else - $(error invalid setting for NETCDF, should be 0 or 1 but is '$(NC)') + $(error invalid setting for NC, should be 0 or 1 but is '$(NC)') endif $(info LIBS: '$(LIBS)') $(info INC: '$(INC)') From f851b4ec0de840c802f2cfd736a45dbbfdb1cb11 Mon Sep 17 00:00:00 2001 From: Patrick Campbell Date: Fri, 9 Jun 2023 21:02:44 -0400 Subject: [PATCH 41/64] Update python/examples.ipynb Co-authored-by: Zachary Moon --- python/examples.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/examples.ipynb b/python/examples.ipynb index d37ba600..62310959 100644 --- a/python/examples.ipynb +++ b/python/examples.ipynb @@ -783,7 +783,7 @@ " infmt_opt=1,\n", " nlat=1,\n", " nlon=1,\n", - " bio_vert=[0, 1, 2, 3],\n", + " biovert_opt=[0, 1, 2, 3],\n", ")\n", "ds = run_config_sens(cases)\n", "ds" From facadbd38e3f1c70ef0cdab77954efd3cd5db194 Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Sat, 10 Jun 2023 15:29:46 -0700 Subject: [PATCH 42/64] Update README.md- Edited for src/Makefile to build with both gfortran and ifort --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 409f0e3e..ec0b7b42 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,24 @@ Canopy-App requires NetCDF-Fortran Libraries (i.e., `-lnetcdf -lnetcdff`) when u See [the included Makefile](./src/Makefile), which detects NetCDF using `nf-config`, for an example (on GMU Hopper, you can use the `netcdf-c/4.7.4-vh` and `netcdf-fortran/4.5.3-ff` modules). Compilation options can be controlled with environment variables: - - `DEBUG=0` (off; default) or `DEBUG=1` (on) - - `NETCDF=0` (off) or `NETCDF=1` (on; default) + +- `FC=gfortran` (default) or ifort +- `DEBUG=0` (off; default) or `DEBUG=1` (on) + - `NC=0` (off) or `NETCDF=1` (on; default) Example: +a) with gfortran, Debug flags ON and with Netcdf: +``` +DEBUG=1 NC=1 make -C src +``` +Note: Not supplying `FC` doesn't necessary give gfortran, since `FC` might already be set in the environment (such as, `module load` situations do this). On such case do: +``` +DEBUG=1 NC=1 FC=gfortran make -C src ``` -DEBUG=1 NETCDF=1 make -C src +b) with ifort, Debug flags ON and with Netcdf: ``` +DEBUG=1 NC=1 FC=ifort make -C src +``` ### Modify settings From 85f51d20fe88c3c69156a07ea44d125e2b224caa Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Sat, 10 Jun 2023 15:33:37 -0700 Subject: [PATCH 43/64] Update README.md (trailing whitespaces removed) --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ec0b7b42..ab0d7d65 100644 --- a/README.md +++ b/README.md @@ -22,21 +22,21 @@ Compilation options can be controlled with environment variables: - `FC=gfortran` (default) or ifort - `DEBUG=0` (off; default) or `DEBUG=1` (on) - - `NC=0` (off) or `NETCDF=1` (on; default) +- `NC=0` (off) or `NETCDF=1` (on; default) Example: a) with gfortran, Debug flags ON and with Netcdf: ``` -DEBUG=1 NC=1 make -C src +DEBUG=1 NC=1 make -C src ``` Note: Not supplying `FC` doesn't necessary give gfortran, since `FC` might already be set in the environment (such as, `module load` situations do this). On such case do: ``` -DEBUG=1 NC=1 FC=gfortran make -C src +DEBUG=1 NC=1 FC=gfortran make -C src ``` b) with ifort, Debug flags ON and with Netcdf: ``` DEBUG=1 NC=1 FC=ifort make -C src -``` +``` ### Modify settings From 21689fa98146f033be2c1c8b6ca0547fc4f96b17 Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Sat, 10 Jun 2023 15:38:01 -0700 Subject: [PATCH 44/64] Update README.md- Edited README.md to account for enhancement in src/Makefile to build Canopy-app with both ifort and gfortran --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ab0d7d65..46018811 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,11 @@ Compilation options can be controlled with environment variables: - `NC=0` (off) or `NETCDF=1` (on; default) Example: -a) with gfortran, Debug flags ON and with Netcdf: +a) with gfortran, Debug flags ON and with Netcdf (if `echo $FC` gives gfortran): ``` DEBUG=1 NC=1 make -C src ``` -Note: Not supplying `FC` doesn't necessary give gfortran, since `FC` might already be set in the environment (such as, `module load` situations do this). On such case do: +Note: Not supplying `FC` doesn't necessary give gfortran, since `FC` might already be set in the environment (such as, `module load` situations do this). In such case do: ``` DEBUG=1 NC=1 FC=gfortran make -C src ``` From 91365819d0f64ffadbfc7ee8de1ec9e0cdf93c9f Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:31:41 -0700 Subject: [PATCH 45/64] Update README.md Co-authored-by: Zachary Moon --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 46018811..50dd7cf0 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Compilation options can be controlled with environment variables: - `NC=0` (off) or `NETCDF=1` (on; default) Example: -a) with gfortran, Debug flags ON and with Netcdf (if `echo $FC` gives gfortran): +a) with compiler set by `FC` environment variable (falling back to `gfortran` if unset), Debug flags ON and with NetCDF: ``` DEBUG=1 NC=1 make -C src ``` From fe28540a3a99c2eb832d49795c60d9bc73b5925b Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:32:05 -0700 Subject: [PATCH 46/64] Update README.md Co-authored-by: Zachary Moon --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 50dd7cf0..419e4648 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ a) with compiler set by `FC` environment variable (falling back to `gfortran` if ``` DEBUG=1 NC=1 make -C src ``` -Note: Not supplying `FC` doesn't necessary give gfortran, since `FC` might already be set in the environment (such as, `module load` situations do this). In such case do: +Note: Not supplying `FC` doesn't necessarily give `gfortran`, since `FC` might already be set in the environment (for example, `module load` situations may do this). In such case do: ``` DEBUG=1 NC=1 FC=gfortran make -C src ``` From 51e17cae97b3bf3aa598eb850e1550dce35e75a7 Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:32:31 -0700 Subject: [PATCH 47/64] Update README.md Co-authored-by: Zachary Moon --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 419e4648..db51ed4d 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Note: Not supplying `FC` doesn't necessarily give `gfortran`, since `FC` might a ``` DEBUG=1 NC=1 FC=gfortran make -C src ``` -b) with ifort, Debug flags ON and with Netcdf: +b) with Intel Fortran (`ifort`), Debug flags ON and with NetCDF: ``` DEBUG=1 NC=1 FC=ifort make -C src ``` From 7d2b56d9349f3ef3c739001e355c41f9173ba5c3 Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:36:36 -0700 Subject: [PATCH 48/64] Update src/Makefile (final revised ifort FCFLAGS) Co-authored-by: Zachary Moon --- src/Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index f7666949..1b65658f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -22,10 +22,7 @@ ifeq ($(DEBUG), 1) ifeq ($(FC),gfortran) FCFLAGS := -g -Wall -Wextra -Wconversion -Og -pedantic -fcheck=bounds -fmax-errors=5 -std=f2003 -fall-intrinsics else ifeq ($(FC),ifort) - # Tested the following Debug flag options on Hera with 'DEBUG=1 NC=1 FC=ifort make -C src' - # Both options build without warnings and also make clean in src - FCFLAGS := -g -warn all -implicitnone -O1 -error-limit 5 #Equivalent to gfortran Debug flags - #FCFLAGS := -g -warn all -check bounds -traceback #also builds Canopy-app on Hera with FC=ifort without warnings + FCFLAGS := -g -warn all -check bounds -implicitnone -O0 -error-limit 5 endif else ifeq ($(DEBUG), 0) FCFLAGS := -O3 From cd671636debba81aabf9ac07810020e760b0f89b Mon Sep 17 00:00:00 2001 From: quaz115 <63623865+quaz115@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:43:04 -0700 Subject: [PATCH 49/64] Update README.md (NETCDF to NC) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index db51ed4d..648097b5 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Compilation options can be controlled with environment variables: - `FC=gfortran` (default) or ifort - `DEBUG=0` (off; default) or `DEBUG=1` (on) -- `NC=0` (off) or `NETCDF=1` (on; default) +- `NC=0` (off) or `NC=1` (on; default) Example: a) with compiler set by `FC` environment variable (falling back to `gfortran` if unset), Debug flags ON and with NetCDF: From 0ba97443f66c097b09472885023a96844fc69278 Mon Sep 17 00:00:00 2001 From: Wei-Ting Hung <107704243+angehung5@users.noreply.github.com> Date: Wed, 28 Jun 2023 20:49:36 -0400 Subject: [PATCH 50/64] add frp_src=3 --- python/global_data_process.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/global_data_process.py b/python/global_data_process.py index 3bb33403..9f64347b 100755 --- a/python/global_data_process.py +++ b/python/global_data_process.py @@ -21,7 +21,7 @@ houri = 12 # gfs initialization hour in UTC (caution: currently GFS input files are initialized at 12 UTC only -- do not change) hour = 0 # gfs forecast hour (0-24) in UTC ref_lev = 10 # reference height above the canopy (m) -frp_src = 1 # frp data source for WAF (0: local source; 1: check local source first, switch to climatological file if no available data ; 2: 12 month climatology) +frp_src = 1 # frp data source for WAF (0: local source; 1: check local source first, switch to climatological file if no available data; 2: 12 month climatology; 3: all ones when ifcanwaf=.FALSE.) # ---------------------------------ATTENTION---------------------------------# @@ -390,6 +390,9 @@ def read_frp_local(filename, lat, lon, fill_value): if frp_src == 2: DATA = read_gfs_climatology(f_can, "frp") + elif frp_src == 3: + DATA = np.empty(lat.shape) + DATA[:] = 1 else: DATA = read_frp_local(f_frp, lat, lon, fill_value) From 357173879432759d015227e9ec3ea87bb324694e Mon Sep 17 00:00:00 2001 From: Wei-Ting Hung <107704243+angehung5@users.noreply.github.com> Date: Thu, 29 Jun 2023 01:51:00 -0400 Subject: [PATCH 51/64] Update README.md --- python/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/README.md b/python/README.md index 22a45080..447ab8df 100644 --- a/python/README.md +++ b/python/README.md @@ -69,7 +69,7 @@ You can also download and generate global gridded canopy-app inputs using Python houri = 12 # gfs initialization hour in UTC (caution currently GFS files are initialized at 12 UTC only -- do not change) hour = 00 # gfs forecast hour in UTC ref_lev = 10 # reference height above the canopy (m) - frp_src = 1 # frp data source (0: local source; 1: check local source first, switch to climatological file if no available data ; 2: 12 month climatology) + frp_src = 1 # frp data source (0: local source; 1: check local source first, switch to climatological file if no available data; 2: 12 month climatology; 3: all ones when ifcanwaf=.FALSE.) ``` 2. Activate canopy-app Conda environment: From dcdd8afa8699542858bf5e498ba038d3dc905424 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Sun, 16 Jul 2023 13:21:31 -0400 Subject: [PATCH 52/64] Initial commit to start isolating tleaf_ppfd calcs. --- src/canopy_calcs.F90 | 17 +++++++++++++++++ src/canopy_ppfd_mod.F90 | 6 +++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index e4aef172..867e21ed 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -137,6 +137,15 @@ SUBROUTINE canopy_calcs ubzref, z0ghc, lambdars, cdrag, pai, hcmref, hgtref, & z0ref, vtyperef, lu_opt, z0_opt, d_h, zo_h) +! ... calculate canopy leaf temperature (sun/shade) profile + + +! ... calculate canopy Photosynthetic Photon Flux Density (PPFD) (sun/shade) profile + + + + +! ... **** User Canopy-App Options *** ! ... user option to calculate in-canopy wind speeds at height z and midflame WAF if (ifcanwind .or. ifcanwaf) then @@ -400,6 +409,14 @@ SUBROUTINE canopy_calcs ubzref, z0ghc, lambdars, cdrag, pai, hcmref, hgtref, & z0ref, vtyperef, lu_opt, z0_opt, d_h, zo_h) +! ... calculate canopy leaf temperature (sun/shade) profile + + +! ... calculate canopy Photosynthetic Photon Flux Density (PPFD) (sun/shade) profile + + +! ... **** User Canopy-App Options *** + ! ... user option to calculate in-canopy wind speeds at height z and midflame WAF if (ifcanwind .or. ifcanwaf) then diff --git a/src/canopy_ppfd_mod.F90 b/src/canopy_ppfd_mod.F90 index 0a270bda..8f86bd2d 100644 --- a/src/canopy_ppfd_mod.F90 +++ b/src/canopy_ppfd_mod.F90 @@ -10,7 +10,7 @@ SUBROUTINE CANOPY_PPFD_EXP( ZK, FCH, SFCRAD, LAI, PPFD_SUN, PPFD_SHADE) !----------------------------------------------------------------------- ! Description: -! computes linear interpolation method for tleaf sun/shade in canopy. +! computes linear interpolation method for PPFD sun/shade in canopy. ! Preconditions: ! in-canopy height, and model LAI, clumping index, and solar zenith angle @@ -19,8 +19,8 @@ SUBROUTINE CANOPY_PPFD_EXP( ZK, FCH, SFCRAD, LAI, PPFD_SUN, PPFD_SHADE) ! Revision History: ! Prototype 06/23 by PCC -! Jun 2023 P.C. Campbell: Initial standalone tleaf linear subroutine based on -! Silva et al. (2020) algorithms +! Jun 2023 P.C. Campbell: Initial standalone PPFD linear subroutine based on +! Silva et al. (2020) exponential curve algorithms !----------------------------------------------------------------------- !----------------------------------------------------------------------- use canopy_const_mod, ONLY: RK !constants for canopy models From fdef150482472ba4e5baaa325b89e1027bfca890 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Thu, 20 Jul 2023 12:52:24 -0400 Subject: [PATCH 53/64] Added new radiation/fsun routine and other changes. --- src/Makefile | 1 + src/canopy_alloc.F90 | 3 +++ src/canopy_bioemi_mod.F90 | 17 ++++++++++++++ src/canopy_calcs.F90 | 23 ++++++++++++++++--- src/canopy_canvars_mod.F90 | 3 +++ src/canopy_dealloc.F90 | 3 +++ src/canopy_init.F90 | 3 +++ src/canopy_ppfd_mod.F90 | 6 ++++- src/canopy_rad_mod.F90 | 47 ++++++++++++++++++++++++++++++++++++++ src/canopy_tleaf_mod.F90 | 6 ++++- 10 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 src/canopy_rad_mod.F90 diff --git a/src/Makefile b/src/Makefile index e2d99194..0ffe4008 100644 --- a/src/Makefile +++ b/src/Makefile @@ -68,6 +68,7 @@ OBJS :=\ canopy_dxcalc_mod.o \ canopy_profile_mod.o \ canopy_phot_mod.o \ + canopy_rad_mod.o \ canopy_ppfd_mod.o \ canopy_tleaf_mod.o \ canopy_wind_mod.o \ diff --git a/src/canopy_alloc.F90 b/src/canopy_alloc.F90 index ba007672..517de2bf 100644 --- a/src/canopy_alloc.F90 +++ b/src/canopy_alloc.F90 @@ -27,10 +27,13 @@ SUBROUTINE canopy_alloc if(.not.allocated(zhc)) allocate(zhc(modlays)) if(.not.allocated(fafraczInt)) allocate(fafraczInt(modlays)) + if(.not.allocated(fsun)) allocate(fsun(modlays)) if(.not.allocated(tleaf_sun)) allocate(tleaf_sun(modlays)) if(.not.allocated(tleaf_shade)) allocate(tleaf_shade(modlays)) + if(.not.allocated(tleaf_ave)) allocate(tleaf_ave(modlays)) if(.not.allocated(ppfd_sun)) allocate(ppfd_sun(modlays)) if(.not.allocated(ppfd_shade)) allocate(ppfd_shade(modlays)) + if(.not.allocated(ppfd_ave)) allocate(ppfd_ave(modlays)) !------------------------------------------------------------------------------- ! Allocate arrays for Canopy Wind Outputs diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index ba3d87d2..b8889b57 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -30,6 +30,8 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & !----------------------------------------------------------------------- ! Jan 2023 P.C. Campbell: Initial canopy isoprene only version ! Feb 2023 P.C. Campbell: Modified for multiple biogenic species +! Jul 2023 P.C. Campbell: Restructured to use FSUN, TLEAF, and PPFD +! as inputs !----------------------------------------------------------------------- !----------------------------------------------------------------------- use canopy_const_mod, ONLY: rk,rgasuniv !constants for canopy models @@ -42,12 +44,15 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & REAL(RK), INTENT( IN ) :: ZK(:) ! Input model heights (m) REAL(RK), INTENT( IN ) :: FCLAI(:) ! Input Fractional (z) shapes of the ! plant surface distribution (nondimensional), i.e., a Fractional Culmulative LAI +!add....new inputs FSUN, TLEAF_SUN, TLEAF_SHADE, TLEAF_AVE, PPFD_SUN, PPFD_SHADE REAL(RK), INTENT( IN ) :: FCH ! Model input canopy height (m) REAL(RK), INTENT( IN ) :: LAI ! Model input total Leaf Area Index +!---------comment out REAL(RK), INTENT( IN ) :: CLU ! Model input Clumping Index REAL(RK), INTENT( IN ) :: COSZEN ! Model input Cosine Solar Zenith Angle REAL(RK), INTENT( IN ) :: SFCRAD ! Model input Instantaneous surface downward shortwave flux (W/m2) REAL(RK), INTENT( IN ) :: TEMP2 ! Model input 2-m Temperature (K) +!--------- INTEGER, INTENT( IN ) :: LU_OPT ! integer for LU type from model mapped to Massman et al. (default = 0/VIIRS) INTEGER, INTENT( IN ) :: VTYPE ! Grid cell dominant vegetation type REAL(RK), INTENT( IN ) :: MODRES ! Canopy model input vertical resolution (m) @@ -59,6 +64,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & REAL(RK), INTENT( OUT ) :: EMI_OUT(:) ! Output canopy layer volume emissions (kg m-3 s-1) ! Local Variables +!---------comment out REAL(RK) :: FSUN(SIZE(ZK)) ! Sunlit/Shaded fraction from photolysis correction factor REAL(RK) :: PPFD_SUN(SIZE(ZK)) ! PPFD for sunlit leaves (umol phot/m2 s) REAL(RK) :: PPFD_SHADE(SIZE(ZK)) ! PPFD for shaded leaves (umol phot/m2 s) @@ -73,6 +79,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & REAL(RK) :: TLEAF_SUN(SIZE(ZK)) ! Leaf temp for sunlit leaves (K) REAL(RK) :: TLEAF_SHADE(SIZE(ZK)) ! Leaf temp for shaded leaves (K) REAL(RK) :: TLEAF_AVE(SIZE(ZK)) ! Average Leaf temp (K) +!------------- REAL(RK) :: TLEAF24_AVE(SIZE(ZK)) ! Average Leaf temp over the past 24 hours (K) REAL(RK) :: TLEAF240_AVE(SIZE(ZK)) ! Average Leaf temp over the past 240 hours (K) REAL(RK) :: GammaTLEAF_SUN_NUM(SIZE(ZK)) ! Numerator in Tleaf sun activity factor @@ -108,6 +115,8 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & REAL(RK), PARAMETER :: FRAC_PAR = 0.5_rk !Fraction of incoming solar irradiance that is PAR REAL(RK), PARAMETER :: PPFD0_SUN = 200.0 !Constant PPFDo sunlit (umol/m2 s) (Guenther et al.,2012) REAL(RK), PARAMETER :: PPFD0_SHADE = 50.0 !Constant PPFDo shaded (umol/m2 s) (Guenther et al.,2012) + +!----------------comment out REAL(RK), PARAMETER :: ATEMP_1_SUN = -13.891_rk !Linearized 2-m temp --> leaf temp parameters (Level 1 = !top of canopy REAL(RK), PARAMETER :: ATEMP_2_SUN = -12.322_rk !Based on Table 1 in Silva et al. (2022) @@ -150,9 +159,13 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & REAL(RK), PARAMETER :: DTEMP_3_SHADE = -0.368_rk !... REAL(RK), PARAMETER :: DTEMP_4_SHADE = -0.592_rk !... REAL(RK), PARAMETER :: DTEMP_5_SHADE = -0.743_rk !... +!------------ + REAL(RK), PARAMETER :: CT2 = 230.0_rk !Deactivation energy (kJ/mol) (Guenther et al., 2012) + +!------------comment out !Calculate photolyis shading/correction factor through canopy, i.e., the fraction of sunlit leaves downward through canopy ! `canopy_phot` gives relative direct beam irradiance, ! which, multiplied by clumping index, gives sunlit fraction (e.g., Bonan 2019, eq. 14.18) @@ -268,6 +281,10 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & PPFD_SUN = FRAC_PAR * SFCRAD * EXP(CTEMP_SUN + DTEMP_SUN * LAI) !Silva et al. W/m2 --> umol m-2 s-1 PPFD_SHADE = FRAC_PAR * SFCRAD * EXP(CTEMP_SHADE + DTEMP_SHADE * LAI) +!---------------- + +!Start here for biogenic calculations needed in model....new inputs FSUN, TLEAF_SUN, TLEAF_SHADE, TLEAF_AVE + !PPFD_SUN, PPFD_SHADE ! Calculate maximum normalized emission capacity (E_OPT) and Tleaf at E_OPT TLEAF240_AVE = TLEAF_AVE !Assume instantaneous TLEAF estimate for TLEAF240 and TLEAF24 (could improve...) diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index 867e21ed..477f33f6 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -15,7 +15,10 @@ SUBROUTINE canopy_calcs use canopy_utils_mod !main canopy utilities use canopy_dxcalc_mod !main canopy dx calculation use canopy_profile_mod !main canopy foliage profile routines - use canopy_wind_mod !main canopy wind components + use canopy_rad_mod !main canopy radiation sunlit/shaded routines + use canopy_tleaf_mod !main canopy leaf temperature optons + use canopy_ppfd_mod !main canopy leaf PPFD optons + use canopy_wind_mod !main canopy components use canopy_waf_mod use canopy_phot_mod use canopy_eddy_mod @@ -137,13 +140,19 @@ SUBROUTINE canopy_calcs ubzref, z0ghc, lambdars, cdrag, pai, hcmref, hgtref, & z0ref, vtyperef, lu_opt, z0_opt, d_h, zo_h) -! ... calculate canopy leaf temperature (sun/shade) profile +! ... calculate canopy radiation (sunlit and shade) profile + call canopy_fsun_clu( fafraczInt, lairef, cluref, cszref, fsun) -! ... calculate canopy Photosynthetic Photon Flux Density (PPFD) (sun/shade) profile +! ... calculate canopy leaf temperature (sun/shade) profile + call canopy_tleaf_lin(zk, hcmref, tmp2mref, fsun, & + tleaf_sun, tleaf_shade, tleaf_ave) +! ... calculate canopy Photosynthetic Photon Flux Density (PPFD) (sun/shade) profile + call canopy_ppfd_exp(zk, hcmref, dswrfref, lairef, fsun, & + ppfd_sun, ppfd_shade, ppfd_ave) ! ... **** User Canopy-App Options *** ! ... user option to calculate in-canopy wind speeds at height z and midflame WAF @@ -409,11 +418,19 @@ SUBROUTINE canopy_calcs ubzref, z0ghc, lambdars, cdrag, pai, hcmref, hgtref, & z0ref, vtyperef, lu_opt, z0_opt, d_h, zo_h) +! ... calculate canopy radiation (sunlit and shade) profile + + call canopy_fsun_clu( fafraczInt, lairef, cluref, cszref, fsun) + ! ... calculate canopy leaf temperature (sun/shade) profile + call canopy_tleaf_lin(zk, hcmref, tmp2mref, fsun, & + tleaf_sun, tleaf_shade, tleaf_ave) ! ... calculate canopy Photosynthetic Photon Flux Density (PPFD) (sun/shade) profile + call canopy_ppfd_exp(zk, hcmref, dswrfref, lairef, fsun, & + ppfd_sun, ppfd_shade, ppfd_ave) ! ... **** User Canopy-App Options *** diff --git a/src/canopy_canvars_mod.F90 b/src/canopy_canvars_mod.F90 index 1c5ff989..5519e1f2 100644 --- a/src/canopy_canvars_mod.F90 +++ b/src/canopy_canvars_mod.F90 @@ -33,10 +33,13 @@ MODULE canopy_canvars_mod real(rk), allocatable :: fainc ( : ) ! incremental foliage shape function real(rk), allocatable :: fafracz ( : ) ! incremental fractional foliage shape function real(rk), allocatable :: fafraczInt ( : ) ! integral of incremental fractional foliage shape function + real(rk), allocatable :: fsun ( : ) ! Sunlit/Shaded fraction from photolysis correction factor real(rk), allocatable :: tleaf_sun ( : ) ! Leaf temp for sunlit leaves (K) real(rk), allocatable :: tleaf_shade ( : ) ! Leaf temp for shaded leaves (K) + real(rk), allocatable :: tleaf_ave ( : ) ! Average Leaf temp for sunlit and shaded leaves (K) real(rk), allocatable :: ppfd_sun ( : ) ! PPFD for sunlit leaves (umol phot/m2 s) real(rk), allocatable :: ppfd_shade ( : ) ! PPFD for shaded leaves (umol phot/m2 s) + real(rk), allocatable :: ppfd_ave ( : ) ! Average PPFD for sunlit and shaded leaves (umol phot/m2 s) real(rk), allocatable :: canBOT ( : ) ! Canopy bottom wind reduction factors real(rk), allocatable :: canTOP ( : ) ! Canopy top wind reduction factors real(rk), allocatable :: canWIND ( : , : ) ! canopy wind speeds (m/s) diff --git a/src/canopy_dealloc.F90 b/src/canopy_dealloc.F90 index 6a65359b..29f015bc 100644 --- a/src/canopy_dealloc.F90 +++ b/src/canopy_dealloc.F90 @@ -30,10 +30,13 @@ SUBROUTINE canopy_dealloc if(allocated(fainc)) deallocate(fainc) !allocated in canopy_profile if(allocated(fafracz)) deallocate(fafracz) !allocated in canopy_profile if(allocated(fafraczInt)) deallocate(fafraczInt) + if(allocated(fsun)) deallocate(fsun) if(allocated(tleaf_sun)) deallocate(tleaf_sun) if(allocated(tleaf_shade)) deallocate(tleaf_shade) + if(allocated(tleaf_ave)) deallocate(tleaf_ave) if(allocated(ppfd_sun)) deallocate(ppfd_sun) if(allocated(ppfd_shade)) deallocate(ppfd_shade) + if(allocated(ppfd_ave)) deallocate(ppfd_ave) !------------------------------------------------------------------------------- ! Deallocate arrays for Canopy Wind diff --git a/src/canopy_init.F90 b/src/canopy_init.F90 index bda4345f..9a0bfa34 100644 --- a/src/canopy_init.F90 +++ b/src/canopy_init.F90 @@ -21,10 +21,13 @@ SUBROUTINE canopy_init if(allocated(zhc)) zhc(:) = fillreal if(allocated(fafraczInt)) fafraczInt(:) = fillreal + if(allocated(fsun)) fsun(:) = fillreal if(allocated(tleaf_sun)) tleaf_sun(:) = fillreal if(allocated(tleaf_shade)) tleaf_shade(:) = fillreal + if(allocated(tleaf_ave)) tleaf_ave(:) = fillreal if(allocated(ppfd_sun)) ppfd_sun(:) = fillreal if(allocated(ppfd_shade)) ppfd_shade(:) = fillreal + if(allocated(ppfd_ave)) ppfd_ave(:) = fillreal !------------------------------------------------------------------------------- ! Initialize arrays for Canopy Wind diff --git a/src/canopy_ppfd_mod.F90 b/src/canopy_ppfd_mod.F90 index 8f86bd2d..37582b9f 100644 --- a/src/canopy_ppfd_mod.F90 +++ b/src/canopy_ppfd_mod.F90 @@ -5,7 +5,8 @@ module canopy_ppfd_mod contains !::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - SUBROUTINE CANOPY_PPFD_EXP( ZK, FCH, SFCRAD, LAI, PPFD_SUN, PPFD_SHADE) + SUBROUTINE CANOPY_PPFD_EXP( ZK, FCH, SFCRAD, LAI, FSUN, & + PPFD_SUN, PPFD_SHADE, PPFD_AVE) !----------------------------------------------------------------------- @@ -32,8 +33,10 @@ SUBROUTINE CANOPY_PPFD_EXP( ZK, FCH, SFCRAD, LAI, PPFD_SUN, PPFD_SHADE) REAL(RK), INTENT( IN ) :: FCH ! Model input canopy height (m) REAL(RK), INTENT( IN ) :: SFCRAD ! Model input Instantaneous surface downward shortwave flux (W/m2) REAL(RK), INTENT( IN ) :: LAI ! Model input total Leaf Area Index + REAL(RK), INTENT( IN ) :: FSUN(:) ! Sunlit/Shaded fraction from photolysis correction factor REAL(RK), INTENT( OUT ) :: PPFD_SUN(SIZE(ZK)) ! PPFD for sunlit leaves (umol phot/m2 s) REAL(RK), INTENT( OUT ) :: PPFD_SHADE(SIZE(ZK)) ! PPFD for shaded leaves (umol phot/m2 s) + REAL(RK), INTENT( OUT ) :: PPFD_AVE(SIZE(ZK)) ! Average PPFD for sunlit and shaded leaves (umol phot/m2 s) ! LOCAL REAL(RK), PARAMETER :: CTEMP_1_SUN = 1.083_rk !Exponential 2-m PPFD --> PPFD parameters (Level 1 = @@ -120,6 +123,7 @@ SUBROUTINE CANOPY_PPFD_EXP( ZK, FCH, SFCRAD, LAI, PPFD_SUN, PPFD_SHADE) PPFD_SUN = FRAC_PAR * SFCRAD * EXP(CTEMP_SUN + DTEMP_SUN * LAI) !Silva et al. W/m2 --> umol m-2 s-1 PPFD_SHADE = FRAC_PAR * SFCRAD * EXP(CTEMP_SHADE + DTEMP_SHADE * LAI) + PPFD_AVE = (PPFD_SUN*FSUN) + (PPFD_SHADE*(1.0-FSUN)) ! average = sum sun and shade weighted by sunlit fraction END SUBROUTINE CANOPY_PPFD_EXP diff --git a/src/canopy_rad_mod.F90 b/src/canopy_rad_mod.F90 new file mode 100644 index 00000000..579cc183 --- /dev/null +++ b/src/canopy_rad_mod.F90 @@ -0,0 +1,47 @@ +module canopy_rad_mod + + implicit none + +contains + +!::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + SUBROUTINE CANOPY_FSUN_CLU( FCLAI, LAI, CLU, COSZEN, FSUN) + +!----------------------------------------------------------------------- + +! Description: +! computes linear interpolation method for PPFD sun/shade in canopy. + +! Preconditions: +! in-canopy height, and model LAI, clumping index, and solar zenith angle + +! Subroutines and Functions Called: + +! Revision History: +! Prototype 06/23 by PCC +! Jun 2023 P.C. Campbell: Initial standalone PPFD linear subroutine based on +! Silva et al. (2020) exponential curve algorithms +!----------------------------------------------------------------------- +!----------------------------------------------------------------------- + use canopy_const_mod, ONLY: RK !constants for canopy models + use canopy_phot_mod + +! Arguments: +! IN/OUT + REAL(RK), INTENT( IN ) :: FCLAI(:) ! Input Fractional (z) shapes of the + ! plant surface distribution (nondimensional), i.e., a Fractional Culmulative LAI + REAL(RK), INTENT( IN ) :: LAI ! Model input total Leaf Area Index + REAL(RK), INTENT( IN ) :: CLU ! Model input Clumping Index + REAL(RK), INTENT( IN ) :: COSZEN ! Model input Cosine Solar Zenith Angle + REAL(RK), INTENT( OUT ) :: FSUN(SIZE(FCLAI)) ! Sunlit/Shaded fraction from photolysis correction factor + +!Calculate photolyis shading/correction factor through canopy, i.e., the fraction of sunlit leaves downward through canopy +! `canopy_phot` gives relative direct beam irradiance, +! which, multiplied by clumping index, gives sunlit fraction (e.g., Bonan 2019, eq. 14.18) + + call canopy_phot(FCLAI, LAI, CLU, COSZEN, FSUN) + FSUN = FSUN * CLU + + END SUBROUTINE CANOPY_FSUN_CLU + +end module canopy_rad_mod diff --git a/src/canopy_tleaf_mod.F90 b/src/canopy_tleaf_mod.F90 index a5c172dd..aac93106 100644 --- a/src/canopy_tleaf_mod.F90 +++ b/src/canopy_tleaf_mod.F90 @@ -5,7 +5,8 @@ module canopy_tleaf_mod contains !::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - SUBROUTINE CANOPY_TLEAF_LIN( ZK, FCH, TEMP2, TLEAF_SUN, TLEAF_SHADE) + SUBROUTINE CANOPY_TLEAF_LIN( ZK, FCH, TEMP2, FSUN, & + TLEAF_SUN, TLEAF_SHADE, TLEAF_AVE) !----------------------------------------------------------------------- @@ -31,8 +32,10 @@ SUBROUTINE CANOPY_TLEAF_LIN( ZK, FCH, TEMP2, TLEAF_SUN, TLEAF_SHADE) REAL(RK), INTENT( IN ) :: ZK(:) ! Input model heights (m) REAL(RK), INTENT( IN ) :: FCH ! Model input canopy height (m) REAL(RK), INTENT( IN ) :: TEMP2 ! Model input 2-m Temperature (K + REAL(RK), INTENT( IN ) :: FSUN(:) ! Sunlit/Shaded fraction from photolysis correction factor REAL(RK), INTENT( OUT ) :: TLEAF_SUN(SIZE(ZK)) ! Leaf temp for sunlit leaves (K) REAL(RK), INTENT( OUT ) :: TLEAF_SHADE(SIZE(ZK)) ! Leaf temp for shaded leaves (K) + REAL(RK), INTENT( OUT ) :: TLEAF_AVE(SIZE(ZK)) ! Ave Leaf temp for sun/shaded leaves (K) ! LOCAL !Linearized 2-m temp --> leaf temp parameters Based on Table 1 in Silva et al. (2020) @@ -116,6 +119,7 @@ SUBROUTINE CANOPY_TLEAF_LIN( ZK, FCH, TEMP2, TLEAF_SUN, TLEAF_SHADE) TLEAF_SUN = ATEMP_SUN + (BTEMP_SUN*TEMP2) TLEAF_SHADE = ATEMP_SHADE + (BTEMP_SHADE*TEMP2) + TLEAF_AVE = (TLEAF_SUN*FSUN) + (TLEAF_SHADE*(1.0-FSUN)) ! average = sum sun and shade weighted by sunlit fraction END SUBROUTINE CANOPY_TLEAF_LIN From 58835663a01c83549a67cef62b2b9365c1a51eeb Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 21 Jul 2023 16:11:30 -0400 Subject: [PATCH 54/64] Updates to bioemi and main calcs for new inputs. --- src/canopy_bioemi_mod.F90 | 375 ++++++++++++++++++++------------------ src/canopy_calcs.F90 | 114 ++++++++---- 2 files changed, 270 insertions(+), 219 deletions(-) diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index b8889b57..228164ab 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -5,10 +5,15 @@ module canopy_bioemi_mod contains !::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & - TEMP2, LU_OPT, VTYPE, MODRES, CCE, VERT, CO2OPT, CO2SET, & + SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, & + PPFD_SHADE, TLEAF_SUN, TLEAF_SHADE, TLEAF_AVE, LU_OPT, & + VTYPE, MODRES, CCE, VERT, CO2OPT, CO2SET, & EMI_IND, EMI_OUT) +! SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & +! TEMP2, LU_OPT, VTYPE, MODRES, CCE, VERT, CO2OPT, CO2SET, & +! EMI_IND, EMI_OUT) + !----------------------------------------------------------------------- ! Description: @@ -41,17 +46,25 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & ! Arguments: ! IN/OUT - REAL(RK), INTENT( IN ) :: ZK(:) ! Input model heights (m) - REAL(RK), INTENT( IN ) :: FCLAI(:) ! Input Fractional (z) shapes of the + REAL(RK), INTENT( IN ) :: ZK(:) ! Model heights (m) + REAL(RK), INTENT( IN ) :: FCLAI(:) ! Fractional (z) shapes of the ! plant surface distribution (nondimensional), i.e., a Fractional Culmulative LAI !add....new inputs FSUN, TLEAF_SUN, TLEAF_SHADE, TLEAF_AVE, PPFD_SUN, PPFD_SHADE - REAL(RK), INTENT( IN ) :: FCH ! Model input canopy height (m) - REAL(RK), INTENT( IN ) :: LAI ! Model input total Leaf Area Index + REAL(RK), INTENT( IN ) :: FCH ! Ccanopy height (m) + REAL(RK), INTENT( IN ) :: LAI ! Total Leaf Area Index + REAL(RK), INTENT( IN ) :: FSUN(:) ! Sunlit/Shaded fraction from photolysis correction factor + REAL(RK), INTENT( IN ) :: PPFD_SUN(:) ! PPFD for sunlit leaves (umol phot/m2 s) + REAL(RK), INTENT( IN ) :: PPFD_SHADE(:) ! PPFD for shaded leaves (umol phot/m2 s) + REAL(RK), INTENT( IN ) :: TLEAF_SUN(:) ! Leaf temp for sunlit leaves (K) + REAL(RK), INTENT( IN ) :: TLEAF_SHADE(:) ! Leaf temp for shaded leaves (K) + REAL(RK), INTENT( IN ) :: TLEAF_AVE(:) ! Average Leaf temp (K) + + !---------comment out - REAL(RK), INTENT( IN ) :: CLU ! Model input Clumping Index - REAL(RK), INTENT( IN ) :: COSZEN ! Model input Cosine Solar Zenith Angle - REAL(RK), INTENT( IN ) :: SFCRAD ! Model input Instantaneous surface downward shortwave flux (W/m2) - REAL(RK), INTENT( IN ) :: TEMP2 ! Model input 2-m Temperature (K) +! REAL(RK), INTENT( IN ) :: CLU ! Model input Clumping Index +! REAL(RK), INTENT( IN ) :: COSZEN ! Model input Cosine Solar Zenith Angle +! REAL(RK), INTENT( IN ) :: SFCRAD ! Model input Instantaneous surface downward shortwave flux (W/m2) +! REAL(RK), INTENT( IN ) :: TEMP2 ! Model input 2-m Temperature (K) !--------- INTEGER, INTENT( IN ) :: LU_OPT ! integer for LU type from model mapped to Massman et al. (default = 0/VIIRS) INTEGER, INTENT( IN ) :: VTYPE ! Grid cell dominant vegetation type @@ -65,20 +78,20 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & ! Local Variables !---------comment out - REAL(RK) :: FSUN(SIZE(ZK)) ! Sunlit/Shaded fraction from photolysis correction factor - REAL(RK) :: PPFD_SUN(SIZE(ZK)) ! PPFD for sunlit leaves (umol phot/m2 s) - REAL(RK) :: PPFD_SHADE(SIZE(ZK)) ! PPFD for shaded leaves (umol phot/m2 s) - REAL(RK) :: ATEMP_SUN(SIZE(ZK)) ! Regression coefficient A for sun leaves (Silva et al., 2020) - REAL(RK) :: BTEMP_SUN(SIZE(ZK)) ! Regression coefficient B for sun leaves - REAL(RK) :: CTEMP_SUN(SIZE(ZK)) ! Regression coefficient C for sun leaves - REAL(RK) :: DTEMP_SUN(SIZE(ZK)) ! Regression coefficient D for sun leaves - REAL(RK) :: ATEMP_SHADE(SIZE(ZK)) ! Regression coefficient A for shade leaves - REAL(RK) :: BTEMP_SHADE(SIZE(ZK)) ! Regression coefficient B for shade leaves - REAL(RK) :: CTEMP_SHADE(SIZE(ZK)) ! Regression coefficient C for shade leaves - REAL(RK) :: DTEMP_SHADE(SIZE(ZK)) ! Regression coefficient D for shade leaves - REAL(RK) :: TLEAF_SUN(SIZE(ZK)) ! Leaf temp for sunlit leaves (K) - REAL(RK) :: TLEAF_SHADE(SIZE(ZK)) ! Leaf temp for shaded leaves (K) - REAL(RK) :: TLEAF_AVE(SIZE(ZK)) ! Average Leaf temp (K) +! REAL(RK) :: FSUN(SIZE(ZK)) ! Sunlit/Shaded fraction from photolysis correction factor +! REAL(RK) :: PPFD_SUN(SIZE(ZK)) ! PPFD for sunlit leaves (umol phot/m2 s) +! REAL(RK) :: PPFD_SHADE(SIZE(ZK)) ! PPFD for shaded leaves (umol phot/m2 s) +! REAL(RK) :: ATEMP_SUN(SIZE(ZK)) ! Regression coefficient A for sun leaves (Silva et al., 2020) +! REAL(RK) :: BTEMP_SUN(SIZE(ZK)) ! Regression coefficient B for sun leaves +! REAL(RK) :: CTEMP_SUN(SIZE(ZK)) ! Regression coefficient C for sun leaves +! REAL(RK) :: DTEMP_SUN(SIZE(ZK)) ! Regression coefficient D for sun leaves +! REAL(RK) :: ATEMP_SHADE(SIZE(ZK)) ! Regression coefficient A for shade leaves +! REAL(RK) :: BTEMP_SHADE(SIZE(ZK)) ! Regression coefficient B for shade leaves +! REAL(RK) :: CTEMP_SHADE(SIZE(ZK)) ! Regression coefficient C for shade leaves +! REAL(RK) :: DTEMP_SHADE(SIZE(ZK)) ! Regression coefficient D for shade leaves +! REAL(RK) :: TLEAF_SUN(SIZE(ZK)) ! Leaf temp for sunlit leaves (K) +! REAL(RK) :: TLEAF_SHADE(SIZE(ZK)) ! Leaf temp for shaded leaves (K) +! REAL(RK) :: TLEAF_AVE(SIZE(ZK)) ! Average Leaf temp (K) !------------- REAL(RK) :: TLEAF24_AVE(SIZE(ZK)) ! Average Leaf temp over the past 24 hours (K) REAL(RK) :: TLEAF240_AVE(SIZE(ZK)) ! Average Leaf temp over the past 240 hours (K) @@ -117,48 +130,48 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & REAL(RK), PARAMETER :: PPFD0_SHADE = 50.0 !Constant PPFDo shaded (umol/m2 s) (Guenther et al.,2012) !----------------comment out - REAL(RK), PARAMETER :: ATEMP_1_SUN = -13.891_rk !Linearized 2-m temp --> leaf temp parameters (Level 1 = - !top of canopy - REAL(RK), PARAMETER :: ATEMP_2_SUN = -12.322_rk !Based on Table 1 in Silva et al. (2022) - REAL(RK), PARAMETER :: ATEMP_3_SUN = -1.032_rk ! - REAL(RK), PARAMETER :: ATEMP_4_SUN = -5.172_rk ! - REAL(RK), PARAMETER :: ATEMP_5_SUN = -5.589_rk !... - REAL(RK), PARAMETER :: BTEMP_1_SUN = 1.064_rk !... - REAL(RK), PARAMETER :: BTEMP_2_SUN = 1.057_rk !... - REAL(RK), PARAMETER :: BTEMP_3_SUN = 1.031_rk !... - REAL(RK), PARAMETER :: BTEMP_4_SUN = 1.050_rk !... - REAL(RK), PARAMETER :: BTEMP_5_SUN = 1.051_rk !... - REAL(RK), PARAMETER :: CTEMP_1_SUN = 1.083_rk !Exponential 2-m PPFD --> PPFD parameters (Level 1 = - !top of canopy - REAL(RK), PARAMETER :: CTEMP_2_SUN = 1.096_rk !Based on Table 1 in Silva et al. (2022) - REAL(RK), PARAMETER :: CTEMP_3_SUN = 1.104_rk ! - REAL(RK), PARAMETER :: CTEMP_4_SUN = 1.098_rk ! - REAL(RK), PARAMETER :: CTEMP_5_SUN = 1.090_rk !... - REAL(RK), PARAMETER :: DTEMP_1_SUN = 0.002_rk !... - REAL(RK), PARAMETER :: DTEMP_2_SUN = -0.128_rk !... - REAL(RK), PARAMETER :: DTEMP_3_SUN = -0.298_rk !... - REAL(RK), PARAMETER :: DTEMP_4_SUN = -0.445_rk !... - REAL(RK), PARAMETER :: DTEMP_5_SUN = -0.535_rk !... - REAL(RK), PARAMETER :: ATEMP_1_SHADE = -12.846_rk !... - REAL(RK), PARAMETER :: ATEMP_2_SHADE = -11.343_rk !... - REAL(RK), PARAMETER :: ATEMP_3_SHADE = -1.068_rk !... - REAL(RK), PARAMETER :: ATEMP_4_SHADE = -5.551_rk !... - REAL(RK), PARAMETER :: ATEMP_5_SHADE = -5.955_rk !... - REAL(RK), PARAMETER :: BTEMP_1_SHADE = 1.060_rk !... - REAL(RK), PARAMETER :: BTEMP_2_SHADE = 1.053_rk !... - REAL(RK), PARAMETER :: BTEMP_3_SHADE = 1.031_rk !... - REAL(RK), PARAMETER :: BTEMP_4_SHADE = 1.051_rk !... - REAL(RK), PARAMETER :: BTEMP_5_SHADE = 1.053_rk !... - REAL(RK), PARAMETER :: CTEMP_1_SHADE = 0.871_rk !... - REAL(RK), PARAMETER :: CTEMP_2_SHADE = 0.890_rk !... - REAL(RK), PARAMETER :: CTEMP_3_SHADE = 0.916_rk !... - REAL(RK), PARAMETER :: CTEMP_4_SHADE = 0.941_rk !... - REAL(RK), PARAMETER :: CTEMP_5_SHADE = 0.956_rk !... - REAL(RK), PARAMETER :: DTEMP_1_SHADE = 0.015_rk !... - REAL(RK), PARAMETER :: DTEMP_2_SHADE = -0.141_rk !... - REAL(RK), PARAMETER :: DTEMP_3_SHADE = -0.368_rk !... - REAL(RK), PARAMETER :: DTEMP_4_SHADE = -0.592_rk !... - REAL(RK), PARAMETER :: DTEMP_5_SHADE = -0.743_rk !... +! REAL(RK), PARAMETER :: ATEMP_1_SUN = -13.891_rk !Linearized 2-m temp --> leaf temp parameters (Level 1 = +! !top of canopy +! REAL(RK), PARAMETER :: ATEMP_2_SUN = -12.322_rk !Based on Table 1 in Silva et al. (2022) +! REAL(RK), PARAMETER :: ATEMP_3_SUN = -1.032_rk ! +! REAL(RK), PARAMETER :: ATEMP_4_SUN = -5.172_rk ! +! REAL(RK), PARAMETER :: ATEMP_5_SUN = -5.589_rk !... +! REAL(RK), PARAMETER :: BTEMP_1_SUN = 1.064_rk !... +! REAL(RK), PARAMETER :: BTEMP_2_SUN = 1.057_rk !... +! REAL(RK), PARAMETER :: BTEMP_3_SUN = 1.031_rk !... +! REAL(RK), PARAMETER :: BTEMP_4_SUN = 1.050_rk !... +! REAL(RK), PARAMETER :: BTEMP_5_SUN = 1.051_rk !... +! REAL(RK), PARAMETER :: CTEMP_1_SUN = 1.083_rk !Exponential 2-m PPFD --> PPFD parameters (Level 1 = +! !top of canopy +! REAL(RK), PARAMETER :: CTEMP_2_SUN = 1.096_rk !Based on Table 1 in Silva et al. (2022) +! REAL(RK), PARAMETER :: CTEMP_3_SUN = 1.104_rk ! +! REAL(RK), PARAMETER :: CTEMP_4_SUN = 1.098_rk ! +! REAL(RK), PARAMETER :: CTEMP_5_SUN = 1.090_rk !... +! REAL(RK), PARAMETER :: DTEMP_1_SUN = 0.002_rk !... +! REAL(RK), PARAMETER :: DTEMP_2_SUN = -0.128_rk !... +! REAL(RK), PARAMETER :: DTEMP_3_SUN = -0.298_rk !... +! REAL(RK), PARAMETER :: DTEMP_4_SUN = -0.445_rk !... +! REAL(RK), PARAMETER :: DTEMP_5_SUN = -0.535_rk !... +! REAL(RK), PARAMETER :: ATEMP_1_SHADE = -12.846_rk !... +! REAL(RK), PARAMETER :: ATEMP_2_SHADE = -11.343_rk !... +! REAL(RK), PARAMETER :: ATEMP_3_SHADE = -1.068_rk !... +! REAL(RK), PARAMETER :: ATEMP_4_SHADE = -5.551_rk !... +! REAL(RK), PARAMETER :: ATEMP_5_SHADE = -5.955_rk !... +! REAL(RK), PARAMETER :: BTEMP_1_SHADE = 1.060_rk !... +! REAL(RK), PARAMETER :: BTEMP_2_SHADE = 1.053_rk !... +! REAL(RK), PARAMETER :: BTEMP_3_SHADE = 1.031_rk !... +! REAL(RK), PARAMETER :: BTEMP_4_SHADE = 1.051_rk !... +! REAL(RK), PARAMETER :: BTEMP_5_SHADE = 1.053_rk !... +! REAL(RK), PARAMETER :: CTEMP_1_SHADE = 0.871_rk !... +! REAL(RK), PARAMETER :: CTEMP_2_SHADE = 0.890_rk !... +! REAL(RK), PARAMETER :: CTEMP_3_SHADE = 0.916_rk !... +! REAL(RK), PARAMETER :: CTEMP_4_SHADE = 0.941_rk !... +! REAL(RK), PARAMETER :: CTEMP_5_SHADE = 0.956_rk !... +! REAL(RK), PARAMETER :: DTEMP_1_SHADE = 0.015_rk !... +! REAL(RK), PARAMETER :: DTEMP_2_SHADE = -0.141_rk !... +! REAL(RK), PARAMETER :: DTEMP_3_SHADE = -0.368_rk !... +! REAL(RK), PARAMETER :: DTEMP_4_SHADE = -0.592_rk !... +! REAL(RK), PARAMETER :: DTEMP_5_SHADE = -0.743_rk !... !------------ @@ -166,121 +179,121 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & !------------comment out -!Calculate photolyis shading/correction factor through canopy, i.e., the fraction of sunlit leaves downward through canopy -! `canopy_phot` gives relative direct beam irradiance, -! which, multiplied by clumping index, gives sunlit fraction (e.g., Bonan 2019, eq. 14.18) - - call canopy_phot(FCLAI, LAI, CLU, COSZEN, FSUN) - FSUN = FSUN * CLU - -! Use linear canopy temperature model based on Silva et al. (2020) to get approx. sun/shade leaf temperatures -! through canopy (ignores effect of wind speed on leaf boundary layer ~ 1 % error/bias) -!Citation: -!Silva, S. J., Heald, C. L., and Guenther, A. B.: Development of a reduced-complexity plant canopy -!physics surrogate model for use in chemical transport models: a case study with GEOS-Chem v12.3.0, -!Geosci. Model Dev., 13, 2569–2585, https://doi.org/10.5194/gmd-13-2569-2020, 2020. - do i=1, SIZE(ZK) !calculate linear change in parameters interpolated to Silva et al. 5 layer canopy regions - if (ZK(i) .gt. FCH) then ! above canopy, Tleaf = Tair - ATEMP_SUN(i) = 0.0 - BTEMP_SUN(i) = 1.0 - ATEMP_SHADE(i) = 0.0 - BTEMP_SHADE(i) = 1.0 - else if (ZK(i) .le. FCH .and. ZK(i) .gt. FCH*(4.0_rk/5.0_rk)) then !Level 1 - 2 - ATEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & - (/ ATEMP_2_SUN,ATEMP_1_SUN /),ZK(i)) - BTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & - (/ BTEMP_2_SUN,BTEMP_1_SUN /),ZK(i)) - ATEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & - (/ ATEMP_2_SHADE,ATEMP_1_SHADE /),ZK(i)) - BTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & - (/ BTEMP_2_SHADE,BTEMP_1_SHADE /),ZK(i)) - else if (ZK(i) .le. FCH*(4.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(3.0_rk/5.0_rk)) then !Level 2 - 3 - ATEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & - (/ ATEMP_3_SUN,ATEMP_2_SUN /),ZK(i)) - BTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & - (/ BTEMP_3_SUN,BTEMP_2_SUN /),ZK(i)) - ATEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & - (/ ATEMP_3_SHADE,ATEMP_2_SHADE /),ZK(i)) - BTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & - (/ BTEMP_3_SHADE,BTEMP_2_SHADE /),ZK(i)) - else if (ZK(i) .le. FCH*(3.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(2.0_rk/5.0_rk)) then !Level 3 - 4 - ATEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & - (/ ATEMP_4_SUN,ATEMP_3_SUN /),ZK(i)) - BTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & - (/ BTEMP_4_SUN,BTEMP_3_SUN /),ZK(i)) - ATEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & - (/ ATEMP_4_SHADE,ATEMP_3_SHADE /),ZK(i)) - BTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & - (/ BTEMP_4_SHADE,BTEMP_3_SHADE /),ZK(i)) - else if (ZK(i) .le. FCH*(2.0_rk/5.0_rk) ) then !Level 4 - Bottom - ATEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & - (/ ATEMP_5_SUN,ATEMP_4_SUN /),ZK(i)) - BTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & - (/ BTEMP_5_SUN,BTEMP_4_SUN /),ZK(i)) - ATEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & - (/ ATEMP_5_SHADE,ATEMP_4_SHADE /),ZK(i)) - BTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & - (/ BTEMP_5_SHADE,BTEMP_4_SHADE /),ZK(i)) - end if - end do - - TLEAF_SUN = ATEMP_SUN + (BTEMP_SUN*TEMP2) - TLEAF_SHADE = ATEMP_SHADE + (BTEMP_SHADE*TEMP2) - TLEAF_AVE = (TLEAF_SUN*FSUN) + (TLEAF_SHADE*(1.0-FSUN)) ! average = sum sun and shade weighted by sunlit fraction - -! Use exponential PPFD model based on Silva et al. (2020) to get approx. sun/shade PPFD -! through canopy -!Citation: -!Silva, S. J., Heald, C. L., and Guenther, A. B.: Development of a reduced-complexity plant canopy -!physics surrogate model for use in chemical transport models: a case study with GEOS-Chem v12.3.0, -!Geosci. Model Dev., 13, 2569–2585, https://doi.org/10.5194/gmd-13-2569-2020, 2020. - do i=1, SIZE(ZK) !calculate linear change in parameters interpolated to Silva et al. 5 layer canopy regions - if (ZK(i) .gt. FCH) then ! above canopy, PPFD_leaf = PPFD_toc (toc=top of canopy) - CTEMP_SUN(i) = 0.0 - DTEMP_SUN(i) = 0.0 - CTEMP_SHADE(i) = 0.0 - DTEMP_SHADE(i) = 0.0 - else if (ZK(i) .le. FCH .and. ZK(i) .gt. FCH*(4.0_rk/5.0_rk)) then !Level 1 - 2 - CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & - (/ CTEMP_2_SUN,CTEMP_1_SUN /),ZK(i)) - DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & - (/ DTEMP_2_SUN,DTEMP_1_SUN /),ZK(i)) - CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & - (/ CTEMP_2_SHADE,CTEMP_1_SHADE /),ZK(i)) - DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & - (/ DTEMP_2_SHADE,DTEMP_1_SHADE /),ZK(i)) - else if (ZK(i) .le. FCH*(4.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(3.0_rk/5.0_rk)) then !Level 2 - 3 - CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & - (/ CTEMP_3_SUN,CTEMP_2_SUN /),ZK(i)) - DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & - (/ DTEMP_3_SUN,DTEMP_2_SUN /),ZK(i)) - CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & - (/ CTEMP_3_SHADE,CTEMP_2_SHADE /),ZK(i)) - DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & - (/ DTEMP_3_SHADE,DTEMP_2_SHADE /),ZK(i)) - else if (ZK(i) .le. FCH*(3.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(2.0_rk/5.0_rk)) then !Level 3 - 4 - CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & - (/ CTEMP_4_SUN,CTEMP_3_SUN /),ZK(i)) - DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & - (/ DTEMP_4_SUN,DTEMP_3_SUN /),ZK(i)) - CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & - (/ CTEMP_4_SHADE,CTEMP_3_SHADE /),ZK(i)) - DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & - (/ DTEMP_4_SHADE,DTEMP_3_SHADE /),ZK(i)) - else if (ZK(i) .le. FCH*(2.0_rk/5.0_rk) ) then !Level 4 - Bottom - CTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & - (/ CTEMP_5_SUN,CTEMP_4_SUN /),ZK(i)) - DTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & - (/ DTEMP_5_SUN,DTEMP_4_SUN /),ZK(i)) - CTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & - (/ CTEMP_5_SHADE,CTEMP_4_SHADE /),ZK(i)) - DTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & - (/ DTEMP_5_SHADE,DTEMP_4_SHADE /),ZK(i)) - end if - end do - - PPFD_SUN = FRAC_PAR * SFCRAD * EXP(CTEMP_SUN + DTEMP_SUN * LAI) !Silva et al. W/m2 --> umol m-2 s-1 - PPFD_SHADE = FRAC_PAR * SFCRAD * EXP(CTEMP_SHADE + DTEMP_SHADE * LAI) +!!Calculate photolyis shading/correction factor through canopy, i.e., the fraction of sunlit leaves downward through canopy +!! `canopy_phot` gives relative direct beam irradiance, +!! which, multiplied by clumping index, gives sunlit fraction (e.g., Bonan 2019, eq. 14.18) +! +! call canopy_phot(FCLAI, LAI, CLU, COSZEN, FSUN) +! FSUN = FSUN * CLU +! +!! Use linear canopy temperature model based on Silva et al. (2020) to get approx. sun/shade leaf temperatures +!! through canopy (ignores effect of wind speed on leaf boundary layer ~ 1 % error/bias) +!!Citation: +!!Silva, S. J., Heald, C. L., and Guenther, A. B.: Development of a reduced-complexity plant canopy +!!physics surrogate model for use in chemical transport models: a case study with GEOS-Chem v12.3.0, +!!Geosci. Model Dev., 13, 2569–2585, https://doi.org/10.5194/gmd-13-2569-2020, 2020. +! do i=1, SIZE(ZK) !calculate linear change in parameters interpolated to Silva et al. 5 layer canopy regions +! if (ZK(i) .gt. FCH) then ! above canopy, Tleaf = Tair +! ATEMP_SUN(i) = 0.0 +! BTEMP_SUN(i) = 1.0 +! ATEMP_SHADE(i) = 0.0 +! BTEMP_SHADE(i) = 1.0 +! else if (ZK(i) .le. FCH .and. ZK(i) .gt. FCH*(4.0_rk/5.0_rk)) then !Level 1 - 2 +! ATEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & +! (/ ATEMP_2_SUN,ATEMP_1_SUN /),ZK(i)) +! BTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & +! (/ BTEMP_2_SUN,BTEMP_1_SUN /),ZK(i)) +! ATEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & +! (/ ATEMP_2_SHADE,ATEMP_1_SHADE /),ZK(i)) +! BTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & +! (/ BTEMP_2_SHADE,BTEMP_1_SHADE /),ZK(i)) +! else if (ZK(i) .le. FCH*(4.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(3.0_rk/5.0_rk)) then !Level 2 - 3 +! ATEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & +! (/ ATEMP_3_SUN,ATEMP_2_SUN /),ZK(i)) +! BTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & +! (/ BTEMP_3_SUN,BTEMP_2_SUN /),ZK(i)) +! ATEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & +! (/ ATEMP_3_SHADE,ATEMP_2_SHADE /),ZK(i)) +! BTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & +! (/ BTEMP_3_SHADE,BTEMP_2_SHADE /),ZK(i)) +! else if (ZK(i) .le. FCH*(3.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(2.0_rk/5.0_rk)) then !Level 3 - 4 +! ATEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & +! (/ ATEMP_4_SUN,ATEMP_3_SUN /),ZK(i)) +! BTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & +! (/ BTEMP_4_SUN,BTEMP_3_SUN /),ZK(i)) +! ATEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & +! (/ ATEMP_4_SHADE,ATEMP_3_SHADE /),ZK(i)) +! BTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & +! (/ BTEMP_4_SHADE,BTEMP_3_SHADE /),ZK(i)) +! else if (ZK(i) .le. FCH*(2.0_rk/5.0_rk) ) then !Level 4 - Bottom +! ATEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & +! (/ ATEMP_5_SUN,ATEMP_4_SUN /),ZK(i)) +! BTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & +! (/ BTEMP_5_SUN,BTEMP_4_SUN /),ZK(i)) +! ATEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & +! (/ ATEMP_5_SHADE,ATEMP_4_SHADE /),ZK(i)) +! BTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & +! (/ BTEMP_5_SHADE,BTEMP_4_SHADE /),ZK(i)) +! end if +! end do +! +! TLEAF_SUN = ATEMP_SUN + (BTEMP_SUN*TEMP2) +! TLEAF_SHADE = ATEMP_SHADE + (BTEMP_SHADE*TEMP2) +! TLEAF_AVE = (TLEAF_SUN*FSUN) + (TLEAF_SHADE*(1.0-FSUN)) ! average = sum sun and shade weighted by sunlit fraction +! +!! Use exponential PPFD model based on Silva et al. (2020) to get approx. sun/shade PPFD +!! through canopy +!!Citation: +!!Silva, S. J., Heald, C. L., and Guenther, A. B.: Development of a reduced-complexity plant canopy +!!physics surrogate model for use in chemical transport models: a case study with GEOS-Chem v12.3.0, +!!Geosci. Model Dev., 13, 2569–2585, https://doi.org/10.5194/gmd-13-2569-2020, 2020. +! do i=1, SIZE(ZK) !calculate linear change in parameters interpolated to Silva et al. 5 layer canopy regions +! if (ZK(i) .gt. FCH) then ! above canopy, PPFD_leaf = PPFD_toc (toc=top of canopy) +! CTEMP_SUN(i) = 0.0 +! DTEMP_SUN(i) = 0.0 +! CTEMP_SHADE(i) = 0.0 +! DTEMP_SHADE(i) = 0.0 +! else if (ZK(i) .le. FCH .and. ZK(i) .gt. FCH*(4.0_rk/5.0_rk)) then !Level 1 - 2 +! CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & +! (/ CTEMP_2_SUN,CTEMP_1_SUN /),ZK(i)) +! DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & +! (/ DTEMP_2_SUN,DTEMP_1_SUN /),ZK(i)) +! CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & +! (/ CTEMP_2_SHADE,CTEMP_1_SHADE /),ZK(i)) +! DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & +! (/ DTEMP_2_SHADE,DTEMP_1_SHADE /),ZK(i)) +! else if (ZK(i) .le. FCH*(4.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(3.0_rk/5.0_rk)) then !Level 2 - 3 +! CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & +! (/ CTEMP_3_SUN,CTEMP_2_SUN /),ZK(i)) +! DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & +! (/ DTEMP_3_SUN,DTEMP_2_SUN /),ZK(i)) +! CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & +! (/ CTEMP_3_SHADE,CTEMP_2_SHADE /),ZK(i)) +! DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & +! (/ DTEMP_3_SHADE,DTEMP_2_SHADE /),ZK(i)) +! else if (ZK(i) .le. FCH*(3.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(2.0_rk/5.0_rk)) then !Level 3 - 4 +! CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & +! (/ CTEMP_4_SUN,CTEMP_3_SUN /),ZK(i)) +! DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & +! (/ DTEMP_4_SUN,DTEMP_3_SUN /),ZK(i)) +! CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & +! (/ CTEMP_4_SHADE,CTEMP_3_SHADE /),ZK(i)) +! DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & +! (/ DTEMP_4_SHADE,DTEMP_3_SHADE /),ZK(i)) +! else if (ZK(i) .le. FCH*(2.0_rk/5.0_rk) ) then !Level 4 - Bottom +! CTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & +! (/ CTEMP_5_SUN,CTEMP_4_SUN /),ZK(i)) +! DTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & +! (/ DTEMP_5_SUN,DTEMP_4_SUN /),ZK(i)) +! CTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & +! (/ CTEMP_5_SHADE,CTEMP_4_SHADE /),ZK(i)) +! DTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & +! (/ DTEMP_5_SHADE,DTEMP_4_SHADE /),ZK(i)) +! end if +! end do +! +! PPFD_SUN = FRAC_PAR * SFCRAD * EXP(CTEMP_SUN + DTEMP_SUN * LAI) !Silva et al. W/m2 --> umol m-2 s-1 +! PPFD_SHADE = FRAC_PAR * SFCRAD * EXP(CTEMP_SHADE + DTEMP_SHADE * LAI) !---------------- !Start here for biogenic calculations needed in model....new inputs FSUN, TLEAF_SUN, TLEAF_SHADE, TLEAF_AVE diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index 477f33f6..6f05391a 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -202,97 +202,116 @@ SUBROUTINE canopy_calcs .and. cluref .gt. 0.0_rk) then !ISOP call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 1, emi_isop_3d(i,j,:)) !MYRC call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 2, emi_myrc_3d(i,j,:)) !SABI call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 3, emi_sabi_3d(i,j,:)) !LIMO call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 4, emi_limo_3d(i,j,:)) !CARE call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 5, emi_care_3d(i,j,:)) !OCIM call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 6, emi_ocim_3d(i,j,:)) !BPIN call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 7, emi_bpin_3d(i,j,:)) !APIN call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 8, emi_apin_3d(i,j,:)) !MONO call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 9, emi_mono_3d(i,j,:)) !FARN call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 10, emi_farn_3d(i,j,:)) !CARY call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 11, emi_cary_3d(i,j,:)) !SESQ call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 12, emi_sesq_3d(i,j,:)) !MBOL call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 13, emi_mbol_3d(i,j,:)) !METH call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 14, emi_meth_3d(i,j,:)) !ACET call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 15, emi_acet_3d(i,j,:)) !CO call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 16, emi_co_3d(i,j,:)) !BIDI VOC call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 17, emi_bvoc_3d(i,j,:)) !Stress VOC call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 18, emi_svoc_3d(i,j,:)) !Other VOC call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 19, emi_ovoc_3d(i,j,:)) end if @@ -481,97 +500,116 @@ SUBROUTINE canopy_calcs .and. cluref .gt. 0.0_rk) then !ISOP call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 1, emi_isop(loc,:)) !MYRC call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 2, emi_myrc(loc,:)) !SABI call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 3, emi_sabi(loc,:)) !LIMO call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 4, emi_limo(loc,:)) !CARE call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 5, emi_care(loc,:)) !OCIM call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 6, emi_ocim(loc,:)) !BPIN call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 7, emi_bpin(loc,:)) !APIN call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 8, emi_apin(loc,:)) !MONO call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 9, emi_mono(loc,:)) !FARN call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 10, emi_farn(loc,:)) !CARY call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 11, emi_cary(loc,:)) !SESQ call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 12, emi_sesq(loc,:)) !MBOL call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 13, emi_mbol(loc,:)) !METH call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 14, emi_meth(loc,:)) !ACET call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 15, emi_acet(loc,:)) !CO call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 16, emi_co(loc,:)) !BIDI VOC call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 17, emi_bvoc(loc,:)) !Stress VOC call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 18, emi_svoc(loc,:)) !Other VOC call canopy_bio(zk, fafraczInt, hcmref, & - lairef, cluref, cszref, dswrfref, tmp2mref, & + lairef, fsun, ppfd_sun, ppfd_shade, tleaf_sun, tleaf_shade, & + tleaf_ave, & lu_opt, vtyperef, modres, bio_cce, biovert_opt, co2_opt, co2_set, & 19, emi_ovoc(loc,:)) end if From 421855e50d0e444128c351db2f8230bd14ad5e1e Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 21 Jul 2023 16:16:23 -0400 Subject: [PATCH 55/64] Cleaned up bioemi code. --- src/canopy_bioemi_mod.F90 | 200 +------------------------------------- 1 file changed, 1 insertion(+), 199 deletions(-) diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index 228164ab..dfae2419 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -10,17 +10,13 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, & VTYPE, MODRES, CCE, VERT, CO2OPT, CO2SET, & EMI_IND, EMI_OUT) -! SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, CLU, COSZEN, SFCRAD, & -! TEMP2, LU_OPT, VTYPE, MODRES, CCE, VERT, CO2OPT, CO2SET, & -! EMI_IND, EMI_OUT) - !----------------------------------------------------------------------- ! Description: ! computes parameterized canopy biogenic emissions ! Preconditions: -! in-canopy FCLAI, model LAI, surface/skin temperature. +! in-canopy FCLAI, model LAI, etc. ! Subroutines and Functions Called: @@ -49,7 +45,6 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, & REAL(RK), INTENT( IN ) :: ZK(:) ! Model heights (m) REAL(RK), INTENT( IN ) :: FCLAI(:) ! Fractional (z) shapes of the ! plant surface distribution (nondimensional), i.e., a Fractional Culmulative LAI -!add....new inputs FSUN, TLEAF_SUN, TLEAF_SHADE, TLEAF_AVE, PPFD_SUN, PPFD_SHADE REAL(RK), INTENT( IN ) :: FCH ! Ccanopy height (m) REAL(RK), INTENT( IN ) :: LAI ! Total Leaf Area Index REAL(RK), INTENT( IN ) :: FSUN(:) ! Sunlit/Shaded fraction from photolysis correction factor @@ -58,14 +53,6 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, & REAL(RK), INTENT( IN ) :: TLEAF_SUN(:) ! Leaf temp for sunlit leaves (K) REAL(RK), INTENT( IN ) :: TLEAF_SHADE(:) ! Leaf temp for shaded leaves (K) REAL(RK), INTENT( IN ) :: TLEAF_AVE(:) ! Average Leaf temp (K) - - -!---------comment out -! REAL(RK), INTENT( IN ) :: CLU ! Model input Clumping Index -! REAL(RK), INTENT( IN ) :: COSZEN ! Model input Cosine Solar Zenith Angle -! REAL(RK), INTENT( IN ) :: SFCRAD ! Model input Instantaneous surface downward shortwave flux (W/m2) -! REAL(RK), INTENT( IN ) :: TEMP2 ! Model input 2-m Temperature (K) -!--------- INTEGER, INTENT( IN ) :: LU_OPT ! integer for LU type from model mapped to Massman et al. (default = 0/VIIRS) INTEGER, INTENT( IN ) :: VTYPE ! Grid cell dominant vegetation type REAL(RK), INTENT( IN ) :: MODRES ! Canopy model input vertical resolution (m) @@ -77,22 +64,6 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, & REAL(RK), INTENT( OUT ) :: EMI_OUT(:) ! Output canopy layer volume emissions (kg m-3 s-1) ! Local Variables -!---------comment out -! REAL(RK) :: FSUN(SIZE(ZK)) ! Sunlit/Shaded fraction from photolysis correction factor -! REAL(RK) :: PPFD_SUN(SIZE(ZK)) ! PPFD for sunlit leaves (umol phot/m2 s) -! REAL(RK) :: PPFD_SHADE(SIZE(ZK)) ! PPFD for shaded leaves (umol phot/m2 s) -! REAL(RK) :: ATEMP_SUN(SIZE(ZK)) ! Regression coefficient A for sun leaves (Silva et al., 2020) -! REAL(RK) :: BTEMP_SUN(SIZE(ZK)) ! Regression coefficient B for sun leaves -! REAL(RK) :: CTEMP_SUN(SIZE(ZK)) ! Regression coefficient C for sun leaves -! REAL(RK) :: DTEMP_SUN(SIZE(ZK)) ! Regression coefficient D for sun leaves -! REAL(RK) :: ATEMP_SHADE(SIZE(ZK)) ! Regression coefficient A for shade leaves -! REAL(RK) :: BTEMP_SHADE(SIZE(ZK)) ! Regression coefficient B for shade leaves -! REAL(RK) :: CTEMP_SHADE(SIZE(ZK)) ! Regression coefficient C for shade leaves -! REAL(RK) :: DTEMP_SHADE(SIZE(ZK)) ! Regression coefficient D for shade leaves -! REAL(RK) :: TLEAF_SUN(SIZE(ZK)) ! Leaf temp for sunlit leaves (K) -! REAL(RK) :: TLEAF_SHADE(SIZE(ZK)) ! Leaf temp for shaded leaves (K) -! REAL(RK) :: TLEAF_AVE(SIZE(ZK)) ! Average Leaf temp (K) -!------------- REAL(RK) :: TLEAF24_AVE(SIZE(ZK)) ! Average Leaf temp over the past 24 hours (K) REAL(RK) :: TLEAF240_AVE(SIZE(ZK)) ! Average Leaf temp over the past 240 hours (K) REAL(RK) :: GammaTLEAF_SUN_NUM(SIZE(ZK)) ! Numerator in Tleaf sun activity factor @@ -128,177 +99,8 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, & REAL(RK), PARAMETER :: FRAC_PAR = 0.5_rk !Fraction of incoming solar irradiance that is PAR REAL(RK), PARAMETER :: PPFD0_SUN = 200.0 !Constant PPFDo sunlit (umol/m2 s) (Guenther et al.,2012) REAL(RK), PARAMETER :: PPFD0_SHADE = 50.0 !Constant PPFDo shaded (umol/m2 s) (Guenther et al.,2012) - -!----------------comment out -! REAL(RK), PARAMETER :: ATEMP_1_SUN = -13.891_rk !Linearized 2-m temp --> leaf temp parameters (Level 1 = -! !top of canopy -! REAL(RK), PARAMETER :: ATEMP_2_SUN = -12.322_rk !Based on Table 1 in Silva et al. (2022) -! REAL(RK), PARAMETER :: ATEMP_3_SUN = -1.032_rk ! -! REAL(RK), PARAMETER :: ATEMP_4_SUN = -5.172_rk ! -! REAL(RK), PARAMETER :: ATEMP_5_SUN = -5.589_rk !... -! REAL(RK), PARAMETER :: BTEMP_1_SUN = 1.064_rk !... -! REAL(RK), PARAMETER :: BTEMP_2_SUN = 1.057_rk !... -! REAL(RK), PARAMETER :: BTEMP_3_SUN = 1.031_rk !... -! REAL(RK), PARAMETER :: BTEMP_4_SUN = 1.050_rk !... -! REAL(RK), PARAMETER :: BTEMP_5_SUN = 1.051_rk !... -! REAL(RK), PARAMETER :: CTEMP_1_SUN = 1.083_rk !Exponential 2-m PPFD --> PPFD parameters (Level 1 = -! !top of canopy -! REAL(RK), PARAMETER :: CTEMP_2_SUN = 1.096_rk !Based on Table 1 in Silva et al. (2022) -! REAL(RK), PARAMETER :: CTEMP_3_SUN = 1.104_rk ! -! REAL(RK), PARAMETER :: CTEMP_4_SUN = 1.098_rk ! -! REAL(RK), PARAMETER :: CTEMP_5_SUN = 1.090_rk !... -! REAL(RK), PARAMETER :: DTEMP_1_SUN = 0.002_rk !... -! REAL(RK), PARAMETER :: DTEMP_2_SUN = -0.128_rk !... -! REAL(RK), PARAMETER :: DTEMP_3_SUN = -0.298_rk !... -! REAL(RK), PARAMETER :: DTEMP_4_SUN = -0.445_rk !... -! REAL(RK), PARAMETER :: DTEMP_5_SUN = -0.535_rk !... -! REAL(RK), PARAMETER :: ATEMP_1_SHADE = -12.846_rk !... -! REAL(RK), PARAMETER :: ATEMP_2_SHADE = -11.343_rk !... -! REAL(RK), PARAMETER :: ATEMP_3_SHADE = -1.068_rk !... -! REAL(RK), PARAMETER :: ATEMP_4_SHADE = -5.551_rk !... -! REAL(RK), PARAMETER :: ATEMP_5_SHADE = -5.955_rk !... -! REAL(RK), PARAMETER :: BTEMP_1_SHADE = 1.060_rk !... -! REAL(RK), PARAMETER :: BTEMP_2_SHADE = 1.053_rk !... -! REAL(RK), PARAMETER :: BTEMP_3_SHADE = 1.031_rk !... -! REAL(RK), PARAMETER :: BTEMP_4_SHADE = 1.051_rk !... -! REAL(RK), PARAMETER :: BTEMP_5_SHADE = 1.053_rk !... -! REAL(RK), PARAMETER :: CTEMP_1_SHADE = 0.871_rk !... -! REAL(RK), PARAMETER :: CTEMP_2_SHADE = 0.890_rk !... -! REAL(RK), PARAMETER :: CTEMP_3_SHADE = 0.916_rk !... -! REAL(RK), PARAMETER :: CTEMP_4_SHADE = 0.941_rk !... -! REAL(RK), PARAMETER :: CTEMP_5_SHADE = 0.956_rk !... -! REAL(RK), PARAMETER :: DTEMP_1_SHADE = 0.015_rk !... -! REAL(RK), PARAMETER :: DTEMP_2_SHADE = -0.141_rk !... -! REAL(RK), PARAMETER :: DTEMP_3_SHADE = -0.368_rk !... -! REAL(RK), PARAMETER :: DTEMP_4_SHADE = -0.592_rk !... -! REAL(RK), PARAMETER :: DTEMP_5_SHADE = -0.743_rk !... -!------------ - - REAL(RK), PARAMETER :: CT2 = 230.0_rk !Deactivation energy (kJ/mol) (Guenther et al., 2012) - -!------------comment out -!!Calculate photolyis shading/correction factor through canopy, i.e., the fraction of sunlit leaves downward through canopy -!! `canopy_phot` gives relative direct beam irradiance, -!! which, multiplied by clumping index, gives sunlit fraction (e.g., Bonan 2019, eq. 14.18) -! -! call canopy_phot(FCLAI, LAI, CLU, COSZEN, FSUN) -! FSUN = FSUN * CLU -! -!! Use linear canopy temperature model based on Silva et al. (2020) to get approx. sun/shade leaf temperatures -!! through canopy (ignores effect of wind speed on leaf boundary layer ~ 1 % error/bias) -!!Citation: -!!Silva, S. J., Heald, C. L., and Guenther, A. B.: Development of a reduced-complexity plant canopy -!!physics surrogate model for use in chemical transport models: a case study with GEOS-Chem v12.3.0, -!!Geosci. Model Dev., 13, 2569–2585, https://doi.org/10.5194/gmd-13-2569-2020, 2020. -! do i=1, SIZE(ZK) !calculate linear change in parameters interpolated to Silva et al. 5 layer canopy regions -! if (ZK(i) .gt. FCH) then ! above canopy, Tleaf = Tair -! ATEMP_SUN(i) = 0.0 -! BTEMP_SUN(i) = 1.0 -! ATEMP_SHADE(i) = 0.0 -! BTEMP_SHADE(i) = 1.0 -! else if (ZK(i) .le. FCH .and. ZK(i) .gt. FCH*(4.0_rk/5.0_rk)) then !Level 1 - 2 -! ATEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & -! (/ ATEMP_2_SUN,ATEMP_1_SUN /),ZK(i)) -! BTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & -! (/ BTEMP_2_SUN,BTEMP_1_SUN /),ZK(i)) -! ATEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & -! (/ ATEMP_2_SHADE,ATEMP_1_SHADE /),ZK(i)) -! BTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & -! (/ BTEMP_2_SHADE,BTEMP_1_SHADE /),ZK(i)) -! else if (ZK(i) .le. FCH*(4.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(3.0_rk/5.0_rk)) then !Level 2 - 3 -! ATEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & -! (/ ATEMP_3_SUN,ATEMP_2_SUN /),ZK(i)) -! BTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & -! (/ BTEMP_3_SUN,BTEMP_2_SUN /),ZK(i)) -! ATEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & -! (/ ATEMP_3_SHADE,ATEMP_2_SHADE /),ZK(i)) -! BTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & -! (/ BTEMP_3_SHADE,BTEMP_2_SHADE /),ZK(i)) -! else if (ZK(i) .le. FCH*(3.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(2.0_rk/5.0_rk)) then !Level 3 - 4 -! ATEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & -! (/ ATEMP_4_SUN,ATEMP_3_SUN /),ZK(i)) -! BTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & -! (/ BTEMP_4_SUN,BTEMP_3_SUN /),ZK(i)) -! ATEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & -! (/ ATEMP_4_SHADE,ATEMP_3_SHADE /),ZK(i)) -! BTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & -! (/ BTEMP_4_SHADE,BTEMP_3_SHADE /),ZK(i)) -! else if (ZK(i) .le. FCH*(2.0_rk/5.0_rk) ) then !Level 4 - Bottom -! ATEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & -! (/ ATEMP_5_SUN,ATEMP_4_SUN /),ZK(i)) -! BTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & -! (/ BTEMP_5_SUN,BTEMP_4_SUN /),ZK(i)) -! ATEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & -! (/ ATEMP_5_SHADE,ATEMP_4_SHADE /),ZK(i)) -! BTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & -! (/ BTEMP_5_SHADE,BTEMP_4_SHADE /),ZK(i)) -! end if -! end do -! -! TLEAF_SUN = ATEMP_SUN + (BTEMP_SUN*TEMP2) -! TLEAF_SHADE = ATEMP_SHADE + (BTEMP_SHADE*TEMP2) -! TLEAF_AVE = (TLEAF_SUN*FSUN) + (TLEAF_SHADE*(1.0-FSUN)) ! average = sum sun and shade weighted by sunlit fraction -! -!! Use exponential PPFD model based on Silva et al. (2020) to get approx. sun/shade PPFD -!! through canopy -!!Citation: -!!Silva, S. J., Heald, C. L., and Guenther, A. B.: Development of a reduced-complexity plant canopy -!!physics surrogate model for use in chemical transport models: a case study with GEOS-Chem v12.3.0, -!!Geosci. Model Dev., 13, 2569–2585, https://doi.org/10.5194/gmd-13-2569-2020, 2020. -! do i=1, SIZE(ZK) !calculate linear change in parameters interpolated to Silva et al. 5 layer canopy regions -! if (ZK(i) .gt. FCH) then ! above canopy, PPFD_leaf = PPFD_toc (toc=top of canopy) -! CTEMP_SUN(i) = 0.0 -! DTEMP_SUN(i) = 0.0 -! CTEMP_SHADE(i) = 0.0 -! DTEMP_SHADE(i) = 0.0 -! else if (ZK(i) .le. FCH .and. ZK(i) .gt. FCH*(4.0_rk/5.0_rk)) then !Level 1 - 2 -! CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & -! (/ CTEMP_2_SUN,CTEMP_1_SUN /),ZK(i)) -! DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & -! (/ DTEMP_2_SUN,DTEMP_1_SUN /),ZK(i)) -! CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & -! (/ CTEMP_2_SHADE,CTEMP_1_SHADE /),ZK(i)) -! DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & -! (/ DTEMP_2_SHADE,DTEMP_1_SHADE /),ZK(i)) -! else if (ZK(i) .le. FCH*(4.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(3.0_rk/5.0_rk)) then !Level 2 - 3 -! CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & -! (/ CTEMP_3_SUN,CTEMP_2_SUN /),ZK(i)) -! DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & -! (/ DTEMP_3_SUN,DTEMP_2_SUN /),ZK(i)) -! CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & -! (/ CTEMP_3_SHADE,CTEMP_2_SHADE /),ZK(i)) -! DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & -! (/ DTEMP_3_SHADE,DTEMP_2_SHADE /),ZK(i)) -! else if (ZK(i) .le. FCH*(3.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(2.0_rk/5.0_rk)) then !Level 3 - 4 -! CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & -! (/ CTEMP_4_SUN,CTEMP_3_SUN /),ZK(i)) -! DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & -! (/ DTEMP_4_SUN,DTEMP_3_SUN /),ZK(i)) -! CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & -! (/ CTEMP_4_SHADE,CTEMP_3_SHADE /),ZK(i)) -! DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & -! (/ DTEMP_4_SHADE,DTEMP_3_SHADE /),ZK(i)) -! else if (ZK(i) .le. FCH*(2.0_rk/5.0_rk) ) then !Level 4 - Bottom -! CTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & -! (/ CTEMP_5_SUN,CTEMP_4_SUN /),ZK(i)) -! DTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & -! (/ DTEMP_5_SUN,DTEMP_4_SUN /),ZK(i)) -! CTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & -! (/ CTEMP_5_SHADE,CTEMP_4_SHADE /),ZK(i)) -! DTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & -! (/ DTEMP_5_SHADE,DTEMP_4_SHADE /),ZK(i)) -! end if -! end do -! -! PPFD_SUN = FRAC_PAR * SFCRAD * EXP(CTEMP_SUN + DTEMP_SUN * LAI) !Silva et al. W/m2 --> umol m-2 s-1 -! PPFD_SHADE = FRAC_PAR * SFCRAD * EXP(CTEMP_SHADE + DTEMP_SHADE * LAI) -!---------------- - -!Start here for biogenic calculations needed in model....new inputs FSUN, TLEAF_SUN, TLEAF_SHADE, TLEAF_AVE - !PPFD_SUN, PPFD_SHADE - ! Calculate maximum normalized emission capacity (E_OPT) and Tleaf at E_OPT TLEAF240_AVE = TLEAF_AVE !Assume instantaneous TLEAF estimate for TLEAF240 and TLEAF24 (could improve...) TLEAF24_AVE = TLEAF_AVE From 3a0197aebe9343c2023d7bd211fe87610c7ee972 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Mon, 24 Jul 2023 14:47:21 -0400 Subject: [PATCH 56/64] Removed use canopy_phot_mod from bioemi. --- src/canopy_bioemi_mod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index dfae2419..87719db8 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -37,7 +37,6 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, & !----------------------------------------------------------------------- use canopy_const_mod, ONLY: rk,rgasuniv !constants for canopy models use canopy_utils_mod, ONLY: interp_linear1_internal, GET_GAMMA_CO2 - use canopy_phot_mod use canopy_bioparm_mod ! Arguments: From 6cf54290278560800d5ff6c98c534477727e3ad2 Mon Sep 17 00:00:00 2001 From: Patrick Campbell Date: Fri, 28 Jul 2023 10:41:26 -0400 Subject: [PATCH 57/64] Update src/canopy_bioemi_mod.F90 Co-authored-by: Zachary Moon --- src/canopy_bioemi_mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index 87719db8..a67abd20 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -44,7 +44,7 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, & REAL(RK), INTENT( IN ) :: ZK(:) ! Model heights (m) REAL(RK), INTENT( IN ) :: FCLAI(:) ! Fractional (z) shapes of the ! plant surface distribution (nondimensional), i.e., a Fractional Culmulative LAI - REAL(RK), INTENT( IN ) :: FCH ! Ccanopy height (m) + REAL(RK), INTENT( IN ) :: FCH ! Canopy height (m) REAL(RK), INTENT( IN ) :: LAI ! Total Leaf Area Index REAL(RK), INTENT( IN ) :: FSUN(:) ! Sunlit/Shaded fraction from photolysis correction factor REAL(RK), INTENT( IN ) :: PPFD_SUN(:) ! PPFD for sunlit leaves (umol phot/m2 s) From 3f629d3e27f467b5d343d3c4facb5da79c39a8fd Mon Sep 17 00:00:00 2001 From: Patrick Campbell Date: Fri, 28 Jul 2023 10:41:38 -0400 Subject: [PATCH 58/64] Update src/canopy_calcs.F90 Co-authored-by: Zachary Moon --- src/canopy_calcs.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index 6f05391a..7e3ce718 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -16,8 +16,8 @@ SUBROUTINE canopy_calcs use canopy_dxcalc_mod !main canopy dx calculation use canopy_profile_mod !main canopy foliage profile routines use canopy_rad_mod !main canopy radiation sunlit/shaded routines - use canopy_tleaf_mod !main canopy leaf temperature optons - use canopy_ppfd_mod !main canopy leaf PPFD optons + use canopy_tleaf_mod !main canopy leaf temperature options + use canopy_ppfd_mod !main canopy leaf PPFD options use canopy_wind_mod !main canopy components use canopy_waf_mod use canopy_phot_mod From d7042a861e19b8cef261b3f88f40704a1fb1fe6e Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 28 Jul 2023 10:44:47 -0400 Subject: [PATCH 59/64] Removed uneeded FRAC_PAR from bioemi. --- src/canopy_bioemi_mod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/canopy_bioemi_mod.F90 b/src/canopy_bioemi_mod.F90 index a67abd20..16d618ba 100644 --- a/src/canopy_bioemi_mod.F90 +++ b/src/canopy_bioemi_mod.F90 @@ -95,7 +95,6 @@ SUBROUTINE CANOPY_BIO( ZK, FCLAI, FCH, LAI, FSUN, PPFD_SUN, & integer i, LAYERS ! Constant Canopy Parameters - REAL(RK), PARAMETER :: FRAC_PAR = 0.5_rk !Fraction of incoming solar irradiance that is PAR REAL(RK), PARAMETER :: PPFD0_SUN = 200.0 !Constant PPFDo sunlit (umol/m2 s) (Guenther et al.,2012) REAL(RK), PARAMETER :: PPFD0_SHADE = 50.0 !Constant PPFDo shaded (umol/m2 s) (Guenther et al.,2012) REAL(RK), PARAMETER :: CT2 = 230.0_rk !Deactivation energy (kJ/mol) (Guenther et al., 2012) From 3816304ba83d9c18a92f6c0a80ea022b8688549d Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 28 Jul 2023 10:57:45 -0400 Subject: [PATCH 60/64] Removed ppfd_mod and combined into rad_mod --- src/Makefile | 1 - src/canopy_calcs.F90 | 3 +- src/canopy_ppfd_mod.F90 | 130 ---------------------------------------- src/canopy_rad_mod.F90 | 123 +++++++++++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+), 133 deletions(-) delete mode 100644 src/canopy_ppfd_mod.F90 diff --git a/src/Makefile b/src/Makefile index 0ffe4008..41bf8b0d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -69,7 +69,6 @@ OBJS :=\ canopy_profile_mod.o \ canopy_phot_mod.o \ canopy_rad_mod.o \ - canopy_ppfd_mod.o \ canopy_tleaf_mod.o \ canopy_wind_mod.o \ canopy_waf_mod.o \ diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index 7e3ce718..68214e80 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -16,8 +16,7 @@ SUBROUTINE canopy_calcs use canopy_dxcalc_mod !main canopy dx calculation use canopy_profile_mod !main canopy foliage profile routines use canopy_rad_mod !main canopy radiation sunlit/shaded routines - use canopy_tleaf_mod !main canopy leaf temperature options - use canopy_ppfd_mod !main canopy leaf PPFD options + use canopy_tleaf_mod !main canopy leaf temperature sunlit/shaded routines use canopy_wind_mod !main canopy components use canopy_waf_mod use canopy_phot_mod diff --git a/src/canopy_ppfd_mod.F90 b/src/canopy_ppfd_mod.F90 deleted file mode 100644 index 37582b9f..00000000 --- a/src/canopy_ppfd_mod.F90 +++ /dev/null @@ -1,130 +0,0 @@ -module canopy_ppfd_mod - - implicit none - -contains - -!::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - SUBROUTINE CANOPY_PPFD_EXP( ZK, FCH, SFCRAD, LAI, FSUN, & - PPFD_SUN, PPFD_SHADE, PPFD_AVE) - -!----------------------------------------------------------------------- - -! Description: -! computes linear interpolation method for PPFD sun/shade in canopy. - -! Preconditions: -! in-canopy height, and model LAI, clumping index, and solar zenith angle - -! Subroutines and Functions Called: - -! Revision History: -! Prototype 06/23 by PCC -! Jun 2023 P.C. Campbell: Initial standalone PPFD linear subroutine based on -! Silva et al. (2020) exponential curve algorithms -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- - use canopy_const_mod, ONLY: RK !constants for canopy models - use canopy_utils_mod, ONLY: interp_linear1_internal - -! Arguments: -! IN/OUT - REAL(RK), INTENT( IN ) :: ZK(:) ! Input model heights (m) - REAL(RK), INTENT( IN ) :: FCH ! Model input canopy height (m) - REAL(RK), INTENT( IN ) :: SFCRAD ! Model input Instantaneous surface downward shortwave flux (W/m2) - REAL(RK), INTENT( IN ) :: LAI ! Model input total Leaf Area Index - REAL(RK), INTENT( IN ) :: FSUN(:) ! Sunlit/Shaded fraction from photolysis correction factor - REAL(RK), INTENT( OUT ) :: PPFD_SUN(SIZE(ZK)) ! PPFD for sunlit leaves (umol phot/m2 s) - REAL(RK), INTENT( OUT ) :: PPFD_SHADE(SIZE(ZK)) ! PPFD for shaded leaves (umol phot/m2 s) - REAL(RK), INTENT( OUT ) :: PPFD_AVE(SIZE(ZK)) ! Average PPFD for sunlit and shaded leaves (umol phot/m2 s) - -! LOCAL - REAL(RK), PARAMETER :: CTEMP_1_SUN = 1.083_rk !Exponential 2-m PPFD --> PPFD parameters (Level 1 = - !top of canopy - REAL(RK), PARAMETER :: CTEMP_2_SUN = 1.096_rk !Based on Table 1 in Silva et al. (2022) - REAL(RK), PARAMETER :: CTEMP_3_SUN = 1.104_rk ! - REAL(RK), PARAMETER :: CTEMP_4_SUN = 1.098_rk ! - REAL(RK), PARAMETER :: CTEMP_5_SUN = 1.090_rk !... - REAL(RK), PARAMETER :: DTEMP_1_SUN = 0.002_rk !... - REAL(RK), PARAMETER :: DTEMP_2_SUN = -0.128_rk !... - REAL(RK), PARAMETER :: DTEMP_3_SUN = -0.298_rk !... - REAL(RK), PARAMETER :: DTEMP_4_SUN = -0.445_rk !... - REAL(RK), PARAMETER :: DTEMP_5_SUN = -0.535_rk !... - REAL(RK), PARAMETER :: CTEMP_1_SHADE = 0.871_rk !... - REAL(RK), PARAMETER :: CTEMP_2_SHADE = 0.890_rk !... - REAL(RK), PARAMETER :: CTEMP_3_SHADE = 0.916_rk !... - REAL(RK), PARAMETER :: CTEMP_4_SHADE = 0.941_rk !... - REAL(RK), PARAMETER :: CTEMP_5_SHADE = 0.956_rk !... - REAL(RK), PARAMETER :: DTEMP_1_SHADE = 0.015_rk !... - REAL(RK), PARAMETER :: DTEMP_2_SHADE = -0.141_rk !... - REAL(RK), PARAMETER :: DTEMP_3_SHADE = -0.368_rk !... - REAL(RK), PARAMETER :: DTEMP_4_SHADE = -0.592_rk !... - REAL(RK), PARAMETER :: DTEMP_5_SHADE = -0.743_rk !... - - REAL(RK), PARAMETER :: FRAC_PAR = 0.5_rk !Fraction of incoming solar irradiance that is PAR - - REAL(RK) :: CTEMP_SUN(SIZE(ZK)) ! Regression coefficient C for sun leaves - REAL(RK) :: DTEMP_SUN(SIZE(ZK)) ! Regression coefficient D for sun leaves - REAL(RK) :: CTEMP_SHADE(SIZE(ZK)) ! Regression coefficient C for shade leaves - REAL(RK) :: DTEMP_SHADE(SIZE(ZK)) ! Regression coefficient D for shade leaves - - integer i - -! Use exponential PPFD model based on Silva et al. (2020) to get approx. sun/shade PPFD -! through canopy -!Citation: -!Silva, S. J., Heald, C. L., and Guenther, A. B.: Development of a reduced-complexity plant canopy -!physics surrogate model for use in chemical transport models: a case study with GEOS-Chem v12.3.0, -!Geosci. Model Dev., 13, 2569–2585, https://doi.org/10.5194/gmd-13-2569-2020, 2020. - do i=1, SIZE(ZK) !calculate linear change in parameters interpolated to Silva et al. 5 layer canopy regions - if (ZK(i) .gt. FCH) then ! above canopy, PPFD_leaf = PPFD_toc (toc=top of canopy) - CTEMP_SUN(i) = 0.0 - DTEMP_SUN(i) = 0.0 - CTEMP_SHADE(i) = 0.0 - DTEMP_SHADE(i) = 0.0 - else if (ZK(i) .le. FCH .and. ZK(i) .gt. FCH*(4.0_rk/5.0_rk)) then !Level 1 - 2 - CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & - (/ CTEMP_2_SUN,CTEMP_1_SUN /),ZK(i)) - DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & - (/ DTEMP_2_SUN,DTEMP_1_SUN /),ZK(i)) - CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & - (/ CTEMP_2_SHADE,CTEMP_1_SHADE /),ZK(i)) - DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & - (/ DTEMP_2_SHADE,DTEMP_1_SHADE /),ZK(i)) - else if (ZK(i) .le. FCH*(4.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(3.0_rk/5.0_rk)) then !Level 2 - 3 - CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & - (/ CTEMP_3_SUN,CTEMP_2_SUN /),ZK(i)) - DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & - (/ DTEMP_3_SUN,DTEMP_2_SUN /),ZK(i)) - CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & - (/ CTEMP_3_SHADE,CTEMP_2_SHADE /),ZK(i)) - DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & - (/ DTEMP_3_SHADE,DTEMP_2_SHADE /),ZK(i)) - else if (ZK(i) .le. FCH*(3.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(2.0_rk/5.0_rk)) then !Level 3 - 4 - CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & - (/ CTEMP_4_SUN,CTEMP_3_SUN /),ZK(i)) - DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & - (/ DTEMP_4_SUN,DTEMP_3_SUN /),ZK(i)) - CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & - (/ CTEMP_4_SHADE,CTEMP_3_SHADE /),ZK(i)) - DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & - (/ DTEMP_4_SHADE,DTEMP_3_SHADE /),ZK(i)) - else if (ZK(i) .le. FCH*(2.0_rk/5.0_rk) ) then !Level 4 - Bottom - CTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & - (/ CTEMP_5_SUN,CTEMP_4_SUN /),ZK(i)) - DTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & - (/ DTEMP_5_SUN,DTEMP_4_SUN /),ZK(i)) - CTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & - (/ CTEMP_5_SHADE,CTEMP_4_SHADE /),ZK(i)) - DTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & - (/ DTEMP_5_SHADE,DTEMP_4_SHADE /),ZK(i)) - end if - end do - - PPFD_SUN = FRAC_PAR * SFCRAD * EXP(CTEMP_SUN + DTEMP_SUN * LAI) !Silva et al. W/m2 --> umol m-2 s-1 - PPFD_SHADE = FRAC_PAR * SFCRAD * EXP(CTEMP_SHADE + DTEMP_SHADE * LAI) - PPFD_AVE = (PPFD_SUN*FSUN) + (PPFD_SHADE*(1.0-FSUN)) ! average = sum sun and shade weighted by sunlit fraction - - END SUBROUTINE CANOPY_PPFD_EXP - -end module canopy_ppfd_mod diff --git a/src/canopy_rad_mod.F90 b/src/canopy_rad_mod.F90 index 579cc183..163f7a5c 100644 --- a/src/canopy_rad_mod.F90 +++ b/src/canopy_rad_mod.F90 @@ -44,4 +44,127 @@ SUBROUTINE CANOPY_FSUN_CLU( FCLAI, LAI, CLU, COSZEN, FSUN) END SUBROUTINE CANOPY_FSUN_CLU +!::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + SUBROUTINE CANOPY_PPFD_EXP( ZK, FCH, SFCRAD, LAI, FSUN, & + PPFD_SUN, PPFD_SHADE, PPFD_AVE) + +!----------------------------------------------------------------------- + +! Description: +! computes linear interpolation method for PPFD sun/shade in canopy. + +! Preconditions: +! in-canopy height, and model LAI, clumping index, and solar zenith angle + +! Subroutines and Functions Called: + +! Revision History: +! Prototype 06/23 by PCC +! Jun 2023 P.C. Campbell: Initial standalone PPFD linear subroutine based on +! Silva et al. (2020) exponential curve algorithms +!----------------------------------------------------------------------- +!----------------------------------------------------------------------- + use canopy_const_mod, ONLY: RK !constants for canopy models + use canopy_utils_mod, ONLY: interp_linear1_internal + +! Arguments: +! IN/OUT + REAL(RK), INTENT( IN ) :: ZK(:) ! Input model heights (m) + REAL(RK), INTENT( IN ) :: FCH ! Model input canopy height (m) + REAL(RK), INTENT( IN ) :: SFCRAD ! Model input Instantaneous surface downward shortwave flux (W/m2) + REAL(RK), INTENT( IN ) :: LAI ! Model input total Leaf Area Index + REAL(RK), INTENT( IN ) :: FSUN(:) ! Sunlit/Shaded fraction from photolysis correction factor + REAL(RK), INTENT( OUT ) :: PPFD_SUN(SIZE(ZK)) ! PPFD for sunlit leaves (umol phot/m2 s) + REAL(RK), INTENT( OUT ) :: PPFD_SHADE(SIZE(ZK)) ! PPFD for shaded leaves (umol phot/m2 s) + REAL(RK), INTENT( OUT ) :: PPFD_AVE(SIZE(ZK)) ! Average PPFD for sunlit and shaded leaves (umol phot/m2 s) + +! LOCAL + REAL(RK), PARAMETER :: CTEMP_1_SUN = 1.083_rk !Exponential 2-m PPFD --> PPFD parameters (Level 1 = + !top of canopy + REAL(RK), PARAMETER :: CTEMP_2_SUN = 1.096_rk !Based on Table 1 in Silva et al. (2022) + REAL(RK), PARAMETER :: CTEMP_3_SUN = 1.104_rk ! + REAL(RK), PARAMETER :: CTEMP_4_SUN = 1.098_rk ! + REAL(RK), PARAMETER :: CTEMP_5_SUN = 1.090_rk !... + REAL(RK), PARAMETER :: DTEMP_1_SUN = 0.002_rk !... + REAL(RK), PARAMETER :: DTEMP_2_SUN = -0.128_rk !... + REAL(RK), PARAMETER :: DTEMP_3_SUN = -0.298_rk !... + REAL(RK), PARAMETER :: DTEMP_4_SUN = -0.445_rk !... + REAL(RK), PARAMETER :: DTEMP_5_SUN = -0.535_rk !... + REAL(RK), PARAMETER :: CTEMP_1_SHADE = 0.871_rk !... + REAL(RK), PARAMETER :: CTEMP_2_SHADE = 0.890_rk !... + REAL(RK), PARAMETER :: CTEMP_3_SHADE = 0.916_rk !... + REAL(RK), PARAMETER :: CTEMP_4_SHADE = 0.941_rk !... + REAL(RK), PARAMETER :: CTEMP_5_SHADE = 0.956_rk !... + REAL(RK), PARAMETER :: DTEMP_1_SHADE = 0.015_rk !... + REAL(RK), PARAMETER :: DTEMP_2_SHADE = -0.141_rk !... + REAL(RK), PARAMETER :: DTEMP_3_SHADE = -0.368_rk !... + REAL(RK), PARAMETER :: DTEMP_4_SHADE = -0.592_rk !... + REAL(RK), PARAMETER :: DTEMP_5_SHADE = -0.743_rk !... + + REAL(RK), PARAMETER :: FRAC_PAR = 0.5_rk !Fraction of incoming solar irradiance that is PAR + + REAL(RK) :: CTEMP_SUN(SIZE(ZK)) ! Regression coefficient C for sun leaves + REAL(RK) :: DTEMP_SUN(SIZE(ZK)) ! Regression coefficient D for sun leaves + REAL(RK) :: CTEMP_SHADE(SIZE(ZK)) ! Regression coefficient C for shade leaves + REAL(RK) :: DTEMP_SHADE(SIZE(ZK)) ! Regression coefficient D for shade leaves + + integer i + +! Use exponential PPFD model based on Silva et al. (2020) to get approx. sun/shade PPFD +! through canopy +!Citation: +!Silva, S. J., Heald, C. L., and Guenther, A. B.: Development of a reduced-complexity plant canopy +!physics surrogate model for use in chemical transport models: a case study with GEOS-Chem v12.3.0, +!Geosci. Model Dev., 13, 2569–2585, https://doi.org/10.5194/gmd-13-2569-2020, 2020. + do i=1, SIZE(ZK) !calculate linear change in parameters interpolated to Silva et al. 5 layer canopy regions + if (ZK(i) .gt. FCH) then ! above canopy, PPFD_leaf = PPFD_toc (toc=top of canopy) + CTEMP_SUN(i) = 0.0 + DTEMP_SUN(i) = 0.0 + CTEMP_SHADE(i) = 0.0 + DTEMP_SHADE(i) = 0.0 + else if (ZK(i) .le. FCH .and. ZK(i) .gt. FCH*(4.0_rk/5.0_rk)) then !Level 1 - 2 + CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ CTEMP_2_SUN,CTEMP_1_SUN /),ZK(i)) + DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ DTEMP_2_SUN,DTEMP_1_SUN /),ZK(i)) + CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ CTEMP_2_SHADE,CTEMP_1_SHADE /),ZK(i)) + DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(4.0_rk/5.0_rk),FCH /), & + (/ DTEMP_2_SHADE,DTEMP_1_SHADE /),ZK(i)) + else if (ZK(i) .le. FCH*(4.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(3.0_rk/5.0_rk)) then !Level 2 - 3 + CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ CTEMP_3_SUN,CTEMP_2_SUN /),ZK(i)) + DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ DTEMP_3_SUN,DTEMP_2_SUN /),ZK(i)) + CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ CTEMP_3_SHADE,CTEMP_2_SHADE /),ZK(i)) + DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(3.0_rk/5.0_rk),FCH*(4.0_rk/5.0_rk) /), & + (/ DTEMP_3_SHADE,DTEMP_2_SHADE /),ZK(i)) + else if (ZK(i) .le. FCH*(3.0_rk/5.0_rk) .and. ZK(i) .gt. FCH*(2.0_rk/5.0_rk)) then !Level 3 - 4 + CTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ CTEMP_4_SUN,CTEMP_3_SUN /),ZK(i)) + DTEMP_SUN(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ DTEMP_4_SUN,DTEMP_3_SUN /),ZK(i)) + CTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ CTEMP_4_SHADE,CTEMP_3_SHADE /),ZK(i)) + DTEMP_SHADE(i) = interp_linear1_internal((/ FCH*(2.0_rk/5.0_rk),FCH*(3.0_rk/5.0_rk) /), & + (/ DTEMP_4_SHADE,DTEMP_3_SHADE /),ZK(i)) + else if (ZK(i) .le. FCH*(2.0_rk/5.0_rk) ) then !Level 4 - Bottom + CTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & + (/ CTEMP_5_SUN,CTEMP_4_SUN /),ZK(i)) + DTEMP_SUN(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & + (/ DTEMP_5_SUN,DTEMP_4_SUN /),ZK(i)) + CTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & + (/ CTEMP_5_SHADE,CTEMP_4_SHADE /),ZK(i)) + DTEMP_SHADE(i) = interp_linear1_internal((/ ZK(1),FCH*(2.0_rk/5.0_rk) /), & + (/ DTEMP_5_SHADE,DTEMP_4_SHADE /),ZK(i)) + end if + end do + + PPFD_SUN = FRAC_PAR * SFCRAD * EXP(CTEMP_SUN + DTEMP_SUN * LAI) !Silva et al. W/m2 --> umol m-2 s-1 + PPFD_SHADE = FRAC_PAR * SFCRAD * EXP(CTEMP_SHADE + DTEMP_SHADE * LAI) + PPFD_AVE = (PPFD_SUN*FSUN) + (PPFD_SHADE*(1.0-FSUN)) ! average = sum sun and shade weighted by sunlit fraction + + END SUBROUTINE CANOPY_PPFD_EXP + end module canopy_rad_mod From 4fcce8a7e87f723514e2751d61f483124c9d2d63 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 28 Jul 2023 16:15:47 -0400 Subject: [PATCH 61/64] Fix/Update conditions on flameh and WAF calculations. --- src/canopy_calcs.F90 | 52 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index 68214e80..5ced80cd 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -171,12 +171,26 @@ SUBROUTINE canopy_calcs ! ... determine midflamepoint and flame height from user or FRP calculation call canopy_flameh(flameh_opt, flameh_set, dx_2d(i,j), modres, & frpref, frp_fac, hcmref, midflamepoint, flameh_2d(i,j)) - - if (flameh_2d(i,j) .gt. 0.0 .and. flameh_2d(i,j) .le. hcmref) then - !only calculate WAF when flameh > 0 and <= FH - call canopy_waf(hcmref, lambdars, hgtref, flameh_2d(i,j), & - firetype, d_h, zo_h, canBOT(midflamepoint), & - canTOP(midflamepoint), waf_2d(i,j)) + if (firetype .eq. 0) then !forest/sub-canopy firetype + if (flameh_2d(i,j) .gt. 0.0) then !flameh must be > 0 + if (flameh_2d(i,j) .le. hcmref) then !only calculate when flameh <= FCH + call canopy_waf(hcmref, lambdars, hgtref, flameh_2d(i,j), & + firetype, d_h, zo_h, canBOT(midflamepoint), & + canTOP(midflamepoint), waf_2d(i,j)) + else + write(*,*) 'warning...sub-canopy type fire, but flameh > FCH, setting WAF=1' + waf_2d(i,j) = 1.0_rk + end if + end if + else !grass/crops, above-canopy firetype + if (flameh_2d(i,j) .gt. 0.0) then !flameh still must be > 0 + call canopy_waf(hcmref, lambdars, hgtref, flameh_2d(i,j), & + firetype, d_h, zo_h, canBOT(midflamepoint), & + canTOP(midflamepoint), waf_2d(i,j)) + end if + end if + if (waf_2d(i,j) .gt. 1.0_rk) then !Final check of WAF > 1, must be <=1 + waf_2d(i,j) = 1.0_rk end if end if @@ -469,12 +483,26 @@ SUBROUTINE canopy_calcs ! ... determine midflamepoint and flame height from user or FRP calculation call canopy_flameh(flameh_opt, flameh_set, dx(loc), modres, & frpref, frp_fac, hcmref, midflamepoint, flameh(loc)) - - if (flameh(loc) .gt. 0.0 .and. flameh(loc) .le. hcmref) then - !only calculate WAF when flameh > 0 - call canopy_waf(hcmref, lambdars, hgtref, flameh(loc), & - firetype, d_h, zo_h, canBOT(midflamepoint), & - canTOP(midflamepoint), waf(loc)) + if (firetype .eq. 0) then !forest/sub-canopy firetype + if (flameh(loc) .gt. 0.0) then !flameh must be > 0 + if (flameh(loc) .le. hcmref) then !only calculate when flameh <= FCH + call canopy_waf(hcmref, lambdars, hgtref, flameh(loc), & + firetype, d_h, zo_h, canBOT(midflamepoint), & + canTOP(midflamepoint), waf(loc)) + else + write(*,*) 'warning...sub-canopy type fire, but flameh > FCH, setting WAF=1' + waf(loc) = 1.0_rk + end if + end if + else !grass/crops, above-canopy firetype + if (flameh(loc) .gt. 0.0) then !flameh still must be > 0 + call canopy_waf(hcmref, lambdars, hgtref, flameh(loc), & + firetype, d_h, zo_h, canBOT(midflamepoint), & + canTOP(midflamepoint), waf(loc)) + end if + end if + if (waf(loc) .gt. 1.0_rk) then !Final check of WAF > 1, must be <=1 + waf(loc) = 1.0_rk end if end if From 6465d05a7635cab256598cd73e47c940d7248245 Mon Sep 17 00:00:00 2001 From: Patrick Campbell Date: Fri, 4 Aug 2023 15:51:56 -0400 Subject: [PATCH 62/64] Update python/README.md Co-authored-by: Zachary Moon --- python/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/README.md b/python/README.md index 447ab8df..c7dfe85d 100644 --- a/python/README.md +++ b/python/README.md @@ -78,7 +78,7 @@ You can also download and generate global gridded canopy-app inputs using Python conda activate canopy-app ``` -3. Run python script +3. Run Python script ``` python global_data_process.py From d7cfa3a139f06728748e1c0d0dac9e651cde5835 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Fri, 4 Aug 2023 15:58:17 -0400 Subject: [PATCH 63/64] Fixing gfortran debug check for CI case. --- src/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 41bf8b0d..681d98d6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -19,7 +19,7 @@ NC ?= 1 # Compile flags $(info DEBUG setting: '$(DEBUG)') ifeq ($(DEBUG), 1) - ifeq ($(FC),gfortran) + ifeq ($(findstring gfortran,$(notdir $(FC))),gfortran) FCFLAGS := -g -Wall -Wextra -Wconversion -Og -pedantic -fcheck=bounds -fmax-errors=5 -std=f2003 -fall-intrinsics else ifeq ($(FC),ifort) FCFLAGS := -g -warn all -check bounds -implicitnone -O0 -error-limit 5 @@ -29,6 +29,7 @@ else ifeq ($(DEBUG), 0) else $(error invalid setting for DEBUG, should be 0 or 1 but is '$(DEBUG)') endif +$(info FCFLAGS: '$(FCFLAGS)') # NETCDF Settings here LIBS := From 73334b8d6a78249bf3f63ca260415b1222bf02dd Mon Sep 17 00:00:00 2001 From: Patrick Campbell Date: Fri, 4 Aug 2023 21:46:41 -0400 Subject: [PATCH 64/64] Update README.md Co-authored-by: Zachary Moon --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec710c8c..92388d32 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ See [the included Makefile](./src/Makefile), which detects NetCDF using `nf-conf Compilation options can be controlled with environment variables: -- `FC=gfortran` (default) or ifort +- `FC=gfortran` (default) or compiler name/path (e.g. `FC=ifort`, `FC=gfortran-11`, `FC=/usr/bin/gfortran-11`) - `DEBUG=0` (off; default) or `DEBUG=1` (on) - `NC=0` (off) or `NC=1` (on; default)