Skip to content

Commit

Permalink
changed tiny to nearzero
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoven committed Aug 30, 2022
1 parent 2c2eb56 commit 82bdb83
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions main/FatesHistoryInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,6 @@ subroutine update_history_dyn(this,nc,nsites,sites)
type(ed_patch_type),pointer :: cpatch
type(ed_cohort_type),pointer :: ccohort

real(r8), parameter :: tiny = 1.e-5_r8 ! some small number
real(r8), parameter :: reallytalltrees = 1000. ! some large number (m)

integer :: tmp
Expand Down Expand Up @@ -2967,15 +2966,15 @@ subroutine update_history_dyn(this,nc,nsites,sites)
end do patchloop !patch loop

! divide basal-area-weighted height by basal area to get mean
if ( sum(hio_ba_si_scpf(io_si,:)) .gt. tiny ) then
if ( sum(hio_ba_si_scpf(io_si,:)) .gt. nearzero ) then
hio_ba_weighted_height_si(io_si) = hio_ba_weighted_height_si(io_si) / sum(hio_ba_si_scpf(io_si,:))
else
hio_ba_weighted_height_si(io_si) = 0._r8
endif

! divide so-far-just-summed but to-be-averaged patch-age-class variables by patch-age-class area to get mean values
do ipa2 = 1, nlevage
if (hio_area_si_age(io_si, ipa2) .gt. tiny) then
if (hio_area_si_age(io_si, ipa2) .gt. nearzero) then
hio_lai_si_age(io_si, ipa2) = hio_lai_si_age(io_si, ipa2) / (hio_area_si_age(io_si, ipa2)*AREA)
hio_ncl_si_age(io_si, ipa2) = hio_ncl_si_age(io_si, ipa2) / (hio_area_si_age(io_si, ipa2)*AREA)
do i_pft = 1, numpft
Expand Down Expand Up @@ -3562,7 +3561,6 @@ subroutine update_history_hifrq(this,nc,nsites,sites,bc_in,dt_tstep)
real(r8) :: patch_area_by_age(nlevage) ! patch area in each bin for normalizing purposes
real(r8) :: canopy_area_by_age(nlevage) ! canopy area in each bin for normalizing purposes
real(r8) :: site_area_veg ! area of the site that is not bare-ground
real(r8), parameter :: tiny = 1.e-5_r8 ! some small number
integer :: ipa2 ! patch incrementer
integer :: cnlfpft_indx, cnlf_indx, ipft, ican, ileaf ! more iterators and indices
type(ed_patch_type),pointer :: cpatch
Expand Down Expand Up @@ -3938,7 +3936,7 @@ subroutine update_history_hifrq(this,nc,nsites,sites,bc_in,dt_tstep)
end do !patch loop

do ipa2 = 1, nlevage
if (patch_area_by_age(ipa2) .gt. tiny) then
if (patch_area_by_age(ipa2) .gt. nearzero) then
hio_gpp_si_age(io_si, ipa2) = hio_gpp_si_age(io_si, ipa2) / (patch_area_by_age(ipa2))
hio_npp_si_age(io_si, ipa2) = hio_npp_si_age(io_si, ipa2) / (patch_area_by_age(ipa2))
else
Expand All @@ -3947,7 +3945,7 @@ subroutine update_history_hifrq(this,nc,nsites,sites,bc_in,dt_tstep)
endif

! Normalize resistance diagnostics
if (canopy_area_by_age(ipa2) .gt. tiny) then
if (canopy_area_by_age(ipa2) .gt. nearzero) then
hio_c_stomata_si_age(io_si,ipa2) = &
hio_c_stomata_si_age(io_si,ipa2) / canopy_area_by_age(ipa2)

Expand All @@ -3961,7 +3959,7 @@ subroutine update_history_hifrq(this,nc,nsites,sites,bc_in,dt_tstep)
end do

! Normalize resistance diagnostics
if ( sum(canopy_area_by_age(1:nlevage)) .gt. tiny) then
if ( sum(canopy_area_by_age(1:nlevage)) .gt. nearzero) then
hio_c_stomata_si(io_si) = hio_c_stomata_si(io_si) / sum(canopy_area_by_age(1:nlevage))
hio_c_lblayer_si(io_si) = hio_c_lblayer_si(io_si) / sum(canopy_area_by_age(1:nlevage))
else
Expand Down Expand Up @@ -4003,7 +4001,6 @@ subroutine update_history_hydraulics(this,nc,nsites,sites,bc_in,dt_tstep)
integer :: ipa ! The local "I"ndex of "PA"tches
integer :: ft ! functional type index
! integer :: io_shsl ! The combined "SH"ell "S"oil "L"ayer index in the IO array
real(r8), parameter :: tiny = 1.e-5_r8 ! some small number
real(r8) :: ncohort_scpf(nlevsclass*maxpft) ! Bins to count up cohorts counts used in weighting
! should be "hio_nplant_si_scpf"
real(r8) :: nplant_scpf(nlevsclass*maxpft) ! Bins to count up cohorts counts used in weighting
Expand Down

0 comments on commit 82bdb83

Please sign in to comment.