Skip to content

Commit

Permalink
syntax fix for CanopyHydrologyMod
Browse files Browse the repository at this point in the history
  • Loading branch information
rfiorella committed May 9, 2024
1 parent 82ffcc7 commit 44e124b
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions components/elm/src/biogeophys/CanopyHydrologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -801,20 +801,20 @@ subroutine FracH2OSfc(bounds, num_h2osfc, filter_h2osfc, &
real(r8):: min_h2osfc
!-----------------------------------------------------------------------

associate( &
micro_sigma => col_pp%micro_sigma , & ! Input: [real(r8) (:) ] microtopography pdf sigma (m)

iwp_microrel => col_pp%iwp_microrel , & ! Input: [real(r8) (:) ] ice wedge polygon microtopographic relief (m)
iwp_exclvol => col_pp%iwp_exclvol , & ! Input: [real(r8) (:) ] microtopography pdf sigma (m)
iwp_ddep => col_pp%iwp_ddep , & ! Input: [real(r8) (:) ] microtopography pdf sigma (m)
h2osno => col_ws%h2osno , & ! Input: [real(r8) (:) ] snow water (mm H2O)
h2osoi_liq => col_ws%h2osoi_liq , & ! Output: [real(r8) (:,:) ] liquid water (col,lyr) [kg/m2]
h2osfc => col_ws%h2osfc , & ! Output: [real(r8) (:) ] surface water (mm)
frac_sno => col_ws%frac_sno , & ! Output: [real(r8) (:) ] fraction of ground covered by snow (0 to 1)
frac_sno_eff => col_ws%frac_sno_eff , & ! Output: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1)
frac_h2osfc => col_ws%frac_h2osfc , & ! Output: [real(r8) (:) ] col fractional area with surface water greater than zero
associate( &
micro_sigma => col_pp%micro_sigma , & ! Input: [real(r8) (:) ] microtopography pdf sigma (m)

iwp_microrel => col_pp%iwp_microrel , & ! Input: [real(r8) (:) ] ice wedge polygon microtopographic relief (m)
iwp_exclvol => col_pp%iwp_exclvol , & ! Input: [real(r8) (:) ] microtopography pdf sigma (m)
iwp_ddep => col_pp%iwp_ddep , & ! Input: [real(r8) (:) ] microtopography pdf sigma (m)

h2osno => col_ws%h2osno , & ! Input: [real(r8) (:) ] snow water (mm H2O)

h2osoi_liq => col_ws%h2osoi_liq , & ! Output: [real(r8) (:,:) ] liquid water (col,lyr) [kg/m2]
h2osfc => col_ws%h2osfc , & ! Output: [real(r8) (:) ] surface water (mm)
frac_sno => col_ws%frac_sno , & ! Output: [real(r8) (:) ] fraction of ground covered by snow (0 to 1)
frac_sno_eff => col_ws%frac_sno_eff , & ! Output: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1)
frac_h2osfc => col_ws%frac_h2osfc , & ! Output: [real(r8) (:) ] col fractional area with surface water greater than zero
frac_h2osfc_act => col_ws%frac_h2osfc_act & ! Output: [real(r8) (:) ] col fractional area with surface water greater than zero
)

Expand All @@ -829,19 +829,19 @@ subroutine FracH2OSfc(bounds, num_h2osfc, filter_h2osfc, &
if (lun_pp%itype(l) == istsoil .or. lun_pp%itype(l) == istcrop) then

! Use newton-raphson method to iteratively determine frac_h20sfc
! based on amount of surface water storage (h2osfc) and
! based on amount of surface water storage (h2osfc) and
! microtopography variability (micro_sigma) if nonpolygonal, or
! amount of surface water (h2osfc) and microtopographic attributes
! (iwp_microrel, iwp_exclvol) if polygonal tundra

if (h2osfc(c) > min_h2osfc) then
! a cutoff is needed for numerical reasons...(nonconvergence after 5 iterations)

if lun_pp%ispolygon(l) then
! calculate water depth and inundation fraction if column is polygonal
swc = h2osfc(c)/1000 ! convert to m
if swc > iwp_microrel - iwp_exclvol then

if (swc > iwp_microrel - iwp_exclvol) then
d = swc + iwp_exclvol
else
d = 0.0
Expand All @@ -857,10 +857,9 @@ subroutine FracH2OSfc(bounds, num_h2osfc, filter_h2osfc, &

!-- update the submerged areal fraction using the new d value
frac_h2osfc(c) = (3_r8/iwp_microrel) * (2_r8*iwp_exclvol - iwp_microrel) * (d/iwp_microrel)**2_r8 &
+ (2_r8/iwp_microrel) * (2_r8*iwp_microrel - 3_r8*iwp_exclvol) * (d/iwp_microrel)
endif

else
+ (2_r8/iwp_microrel) * (2_r8*iwp_microrel - 3_r8*iwp_exclvol) * (d/iwp_microrel)

else
! calculate water depth and inudation fraction if column is non-polygonal
d=0.0
sigma=1.0e3 * micro_sigma(c) ! convert to mm
Expand Down

0 comments on commit 44e124b

Please sign in to comment.