Skip to content

Commit

Permalink
Check for negative CI only in debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdebolskiy committed Dec 20, 2024
1 parent 9e5b793 commit 42b1033
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/biogeochem/VOCEmissionMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ subroutine VOCEmission (bounds, num_soilp, filter_soilp, &
use subgridAveMod , only : p2g
use clm_varctl , only : use_fates
use clm_varcon , only : smallValue
use decompMod , only : subgrid_level_patch
use GridcellType , only : grc
!
! !ARGUMENTS:
type(bounds_type) , intent(in) :: bounds
Expand Down Expand Up @@ -626,14 +626,14 @@ 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,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,1),cisha_z(p,1),forc_pbot(c),fsun(p), co2_ppmv)

! Check of valid intercellular co2 pressure values.
if (debug .and. (cisha_z(p,1) < 0.0_r8 .or. cisun_z(p,1) < 0.0_r8)) then
write(iulog,*) 'WARNINIG at ', __FILE__,__LINE__
write(iulog,*) 'Invalid intercellular co2 pressure (sunlit, shaded), gamma_c: ',cisun_z(p,1),cisha_z(p,1), gamma_c
write(iulog,*) 'Lat,Lon, voc patch type ',grc%latdeg(g),grc%londeg(g), l_pft_itype(p)
endif
else
gamma_c = 1._r8
end if
Expand Down
9 changes: 6 additions & 3 deletions src/utils/clmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2655,9 +2655,12 @@ subroutine wrap_photosynthesis(this, nc, bounds, fn, filterp, &
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__))
cisha_z(p,:) = 0.0_r8
cisun_z(p,:) = 0.0_r8
if (debug) then
write(iulog,*) 'WARNING: 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
endif
endif
! These fields are marked with a bad-value flag
photosyns_inst%psnsun_patch(p) = spval
Expand Down

0 comments on commit 42b1033

Please sign in to comment.