diff --git a/src/biogeochem/VOCEmissionMod.F90 b/src/biogeochem/VOCEmissionMod.F90 index 6310cc3088..364779a17c 100644 --- a/src/biogeochem/VOCEmissionMod.F90 +++ b/src/biogeochem/VOCEmissionMod.F90 @@ -546,7 +546,9 @@ subroutine VOCEmission (bounds, num_soilp, filter_soilp, & if (use_fates) then do fp = 1,num_soilp p = filter_soilp(fp) - l_pft_itype(p) = canopystate_inst%voc_pftindex_patch(p) + if (patch%is_fates(p)) then + l_pft_itype(p) = canopystate_inst%voc_pftindex_patch(p) + endif end do else do fp = 1,num_soilp @@ -625,12 +627,12 @@ subroutine VOCEmission (bounds, num_soilp, filter_soilp, & ! Activity factor for CO2 (only for isoprene) if (trim(meg_cmp%name) == 'isoprene') then ! Check of valid intercellular co2 pressure values. - if (cisha_z(p,nlevcan) < smallValue .or. cisun_z(p,nlevcan) < smallValue) then - write(iulog,*) 'Invalid intercellular co2 pressure (patch itype, sunlit, shaded): ', l_pft_itype(p),cisun_z(p,nlevcan),cisha_z(p,nlevcan) + if (cisha_z(p,1) < 0.0_r8 .or. cisun_z(p,1) < 0.0_r8) then + write(iulog,*) 'Invalid intercellular co2 pressure (patch itype, sunlit, shaded): ', l_pft_itype(p),cisun_z(p,1),cisha_z(p,1) call endrun(subgrid_index=p, subgrid_level=subgrid_level_patch, msg=errMsg(sourcefile, __LINE__)) endif co2_ppmv = 1.e6_r8*forc_pco2(g)/forc_pbot(c) - gamma_c = get_gamma_C(cisun_z(p,nlevcan),cisha_z(p,nlevcan),forc_pbot(c),fsun(p), co2_ppmv) + gamma_c = get_gamma_C(cisun_z(p,1),cisha_z(p,1),forc_pbot(c),fsun(p), co2_ppmv) else gamma_c = 1._r8 diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 925640523f..196e72894c 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1111,11 +1111,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, vpd(p) = max((svpts(p) - eah(p)), 50._r8) * 0.001_r8 end do - if ( use_fates ) then ! zeroed out here for megan isoprene calculations, in case patches are not transfered properly. - photosyns_inst%cisha_z_patch(begp:endp,:) = -999._r8 - photosyns_inst%cisun_z_patch(begp:endp,:) = -999._r8 + call clm_fates%wrap_photosynthesis(nc, bounds, fn, filterp(1:fn), & svpts(begp:endp), eah(begp:endp), o2(begp:endp), & co2(begp:endp), rb(begp:endp), dayl_factor(begp:endp), & diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 30b8b8d84a..8fce6e2c1c 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1616,6 +1616,10 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, & patch%is_bareground(col%patchi(c)) = .true. npatch = this%fates(nc)%sites(s)%youngest_patch%patchno + ! set voc_pft_index of bareground to 0 explicitly, so the bare ground is properly ignored in VOCEmissionMod + if (patch%is_bareground(col%patchi(c))) then + voc_pftindex(col%patchi(c)) = 0 + endif ! Precision errors on the canopy_fraction_pa sum, even small (e-12) ! do exist, and can create potentially negetive bare-soil fractions ! (ie -1e-12 or smaller). Even though this is effectively zero, @@ -2650,6 +2654,11 @@ subroutine wrap_photosynthesis(this, nc, bounds, fn, filterp, & ! this is needed for MEGAN to work with FATES cisun_z(p,:) = this%fates(nc)%bc_out(s)%ci_pa(ifp) cisha_z(p,:) = this%fates(nc)%bc_out(s)%ci_pa(ifp) + if (this%fates(nc)%bc_out(s)%ci_pa(ifp) <0.0_r8) then + write(iulog,*) 'ci_pa is less than 0: ', this%fates(nc)%bc_out(s)%ci_pa(ifp) + write(iulog,*) 'filter ran photosynthesis s p icp ifp ilter',s,p,icp,ifp + call endrun(msg=errMsg(sourcefile, __LINE__)) + endif ! These fields are marked with a bad-value flag photosyns_inst%psnsun_patch(p) = spval photosyns_inst%psnsha_patch(p) = spval