Skip to content

Commit

Permalink
Move weight calculations inside IM2 block
Browse files Browse the repository at this point in the history
  • Loading branch information
thorntonpe committed Jan 9, 2025
1 parent 259f0e0 commit 874f2bc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
37 changes: 20 additions & 17 deletions components/elm/src/biogeophys/SoilHydrologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -244,21 +244,6 @@ subroutine SurfaceRunoff (bounds, num_hydrologyc, filter_hydrologyc, &

end do

! calculate the sum of column weights on each topounit for columns in the hydrologyc filter
! This will be the istsoil, istcrop, and icol_road_perv subset of urban columns
! First zero the topounit sum of weights. This zeros some multiple times, but no harm done.
do fc = 1, num_hydrologyc
c = filter_hydrologyc(fc)
t = col_pp%topounit(c)
top_pp%uphill_wt(t) = 0._r8
end do
! Next sum the weights
do fc = 1, num_hydrologyc
c = filter_hydrologyc(fc)
t = col_pp%topounit(c)
top_pp%uphill_wt(t) = top_pp%uphill_wt(t) + col_pp%wttopounit(c)
end do

! remove stormflow and snow on h2osfc from qflx_top_soil
do fc = 1, num_hydrologyc
c = filter_hydrologyc(fc)
Expand All @@ -267,14 +252,32 @@ subroutine SurfaceRunoff (bounds, num_hydrologyc, filter_hydrologyc, &
qflx_top_soil(c) = qflx_top_soil(c) + qflx_snow_h2osfc(c) + qflx_floodc(c)
end do

! flow from uphill topounit goes to top of soil for soil, crop, and pervious road columns
! when using the subgrid hillslope lateral flow mechanism (IM2 from NGEE Arctic):
! 1. calculate fraction of topounit flow that goes to each column
! 2. Calculate the weighted flux from uphill (qflx_from_uphill) and add to qflx_top_soil
if (use_IM2_hillslope_hydrology) then
! calculate the sum of column weights on each topounit for columns in the hydrologyc filter
! This will be the istsoil, istcrop, and icol_road_perv subset of urban columns
! First zero the topounit sum of weights. This zeros some multiple times, but no harm done.
do fc = 1, num_hydrologyc
c = filter_hydrologyc(fc)
t = col_pp%topounit(c)
top_pp%uphill_wt(t) = 0._r8
end do
! Next sum the relevant column weights
do fc = 1, num_hydrologyc
c = filter_hydrologyc(fc)
t = col_pp%topounit(c)
top_pp%uphill_wt(t) = top_pp%uphill_wt(t) + col_pp%wttopounit(c)
end do

! flow from uphill topounit goes to top of soil for soil, crop, and pervious road columns
do fc = 1, num_hydrologyc
c = filter_hydrologyc(fc)
t = col_pp%topounit(c)
qflx_from_uphill(c) = (col_pp%wttopounit(c)/top_pp%uphill_wt(t)) * (frac_from_uphill * top_ws%from_uphill(t)) / dtime
qflx_top_soil(c) = qflx_top_soil(c) + qflx_from_uphill(c)
end do
end do
endif

end associate
Expand Down
4 changes: 2 additions & 2 deletions components/elm/src/main/elm_varcon.F90
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ module elm_varcon
! IM2 hillslope hydrology constants
!------------------------------------------------------------------
! fraction of surface runoff fluxes that get transferred to downhill topounit
real(r8), public, parameter :: frac_to_downhill = 1.0 ! (fraction, valid values from 0.0 to 1.0)
real(r8), public, parameter :: frac_to_downhill = 1.0_r8 ! (fraction, valid values from 0.0 to 1.0)
! fraction of from_uphill water state that get transferred to columns on the topounit in each timestep
real(r8), public, parameter :: frac_from_uphill = 0.5 ! (fraction, valid values from 0.0 to 1.0)
real(r8), public, parameter :: frac_from_uphill = 0.5_r8 ! (fraction, valid values from 0.0 to 1.0)

contains

Expand Down

0 comments on commit 874f2bc

Please sign in to comment.