Skip to content

Commit

Permalink
Fix rank problem with ice wedge polygon microtopographic variables
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckaustin authored and rfiorella committed May 10, 2024
1 parent b07a94c commit 3c15582
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions components/elm/src/biogeophys/CanopyHydrologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -839,25 +839,25 @@ subroutine FracH2OSfc(bounds, num_h2osfc, filter_h2osfc, &

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

if (swc > iwp_microrel - iwp_exclvol) then
d = swc + iwp_exclvol
if (swc > iwp_microrel(c) - iwp_exclvol(c)) then
d = swc + iwp_exclvol(c)
else
d = 0.0
do k=1,10
fd = (2_r8*iwp_exclvol - iwp_microrel) * (d/iwp_microrel)**3_r8 &
+ (2_r8*iwp_microrel - 3_r8*iwp_exclvol) * (d/iwp_microrel)**2_r8 &
fd = (2_r8*iwp_exclvol(c) - iwp_microrel(c)) * (d/iwp_microrel(c))**3_r8 &
+ (2_r8*iwp_microrel(c) - 3_r8*iwp_exclvol(c)) * (d/iwp_microrel(c))**2_r8 &
- swc
dfdd = (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)
dfdd = (3_r8/iwp_microrel(c)) * (2_r8*iwp_exclvol(c) - iwp_microrel(c)) * (d/iwp_microrel(c))**2_r8 &
+ (2_r8/iwp_microrel(c)) * (2_r8*iwp_microrel(c) - 3_r8*iwp_exclvol(c)) * (d/iwp_microrel(c))
d = d - fd/dfdd
enddo
endif

!-- 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)
frac_h2osfc(c) = (3_r8/iwp_microrel(c)) * (2_r8*iwp_exclvol(c) - iwp_microrel(c)) * (d/iwp_microrel(c))**2_r8 &
+ (2_r8/iwp_microrel(c)) * (2_r8*iwp_microrel(c) - 3_r8*iwp_exclvol(c)) * (d/iwp_microrel(c))

else ! calculate water depth and inudation fraction if column is non-polygonal
d=0.0
Expand Down

0 comments on commit 3c15582

Please sign in to comment.