Skip to content

Commit

Permalink
Add evaluation of DHDRY value in tables
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhughes-usgs committed Apr 16, 2024
1 parent 3c2e4df commit 61db5d3
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 28 deletions.
56 changes: 36 additions & 20 deletions autotest/test_gwf_sfr_inactive02.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,37 +70,36 @@ def build_models(idx, test):
flopy.mf6.ModflowGwfghb(gwf, stress_period_data=[((0, 0, 0), 1.0, 1e6)])

# sfr data
nreaches = 2
nreaches = 4

# <ifno> <cellid(ncelldim)> <rlen> <rwid> <rgrd> <rtp> <rbth> <rhk> <man> <ncon> <ustrf> <ndv>
package_data = []
for idx in range(nreaches):
if idx == 0:
ustrf = 0.0
else:
ustrf = 1.0
package_data.append(
(idx, (0, 0, 0), delr, 1.0, 1e-3, 0.0, 1.0, 1.0, 0.001, 1, ustrf, 0)
)
package_data = [
(0, (-1, -1, -1), delr, 1.0, 1e-3, 0.0, 1.0, 1.0, 0.001, 1, 0.0, 0),
(1, (0, 0, 0), delr, 1.0, 1e-3, 0.0, 1.0, 1.0, 0.001, 1, 1.0, 0),
(2, (0, 0, 0), delr, 1.0, 1e-3, 0.0, 1.0, 1.0, 0.001, 1, 0.0, 0),
(3, (0, 0, 0), delr, 1.0, 1e-3, 0.0, 1.0, 1.0, 0.001, 1, 1.0, 0),
]
connection_data = [
(0, -1),
(1, 0)
(1, 0),
(2, -3),
(3, 2),
]

sfr_spd = {
0:
[
(0, "inflow", 1.0),
(0, "rainfall", 1.0),
(0, "evaporation", 1.0),
(0, "runoff", 1.0),
(1, "rainfall", 1.0),
(1, "evaporation", 1.0),
(1, "runoff", 1.0),
(2, "inflow", 1.0),
(2, "rainfall", 1.0),
(2, "evaporation", 1.0),
(2, "runoff", 1.0),
(3, "rainfall", 1.0),
(3, "evaporation", 1.0),
(3, "runoff", 1.0),
],
1:
[
(1, "status", "inactive"),
(3, "status", "inactive"),
],
}

Expand All @@ -123,17 +122,34 @@ def build_models(idx, test):
budget_filerecord=f"{name}.sfr.cbc",
length_conversion=1.0,
time_conversion=1.0,
mover=True,
nreaches=nreaches,
packagedata=package_data,
connectiondata=connection_data,
perioddata=sfr_spd,
observations=sfr_obs,
pname="SFR-1"
)

flopy.mf6.ModflowGwfmvr(
gwf,
print_input=True,
print_flows=True,
maxmvr=1,
maxpackages=1,
packages=["SFR-1"],
perioddata={
1: [
("SFR-1", 2, "SFR-1", 0, "FACTOR", 1.0),
],
}
)

flopy.mf6.ModflowGwfoc(
gwf,
head_filerecord=f"{name}.hds",
budget_filerecord=f"{name}.cbc",
saverecord=[("budget", "all")],
saverecord=[("head", "all"), ("budget", "all")],
)

return sim, None
Expand Down
15 changes: 11 additions & 4 deletions src/Model/GroundWaterFlow/gwf-sfr.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2456,7 +2456,7 @@ subroutine sfr_ot_package_flows(this, icbcfl, ibudfl)
pertim, totim, this%iout)
end if
!
! -- Print lake flows table
! -- Print sfr flows table
if (ibudfl /= 0 .and. this%iprflow /= 0) then
!
! -- If there are any 'none' gwf connections then need to calculate
Expand Down Expand Up @@ -2566,7 +2566,11 @@ subroutine sfr_ot_dv(this, idvsave, idvprint)
w = DHNOFLO
cond = DHNOFLO
end if
call this%stagetab%add_term(stage)
if (depth == DZERO) then
call this%stagetab%add_term(DHDRY)
else
call this%stagetab%add_term(stage)
end if
call this%stagetab%add_term(depth)
call this%stagetab%add_term(w)
if (node > 0) then
Expand Down Expand Up @@ -5352,9 +5356,9 @@ subroutine sfr_fill_budobj(this)
call this%budobj%budterm(idx)%reset(this%nconn)
do n = 1, this%maxbound
n1 = n
q = DZERO
ca = DZERO
do i = this%ia(n) + 1, this%ia(n + 1) - 1
q = DZERO
ca = DZERO
if (this%iboundpak(n) /= 0) then
n2 = this%ja(i)
! flow to downstream reaches
Expand All @@ -5374,6 +5378,9 @@ subroutine sfr_fill_budobj(this)
! calculate flow area
call this%sfr_calc_reach_depth(n, qt, d)
ca = this%calc_area_wet(n, d)
else
q = DZERO
ca = DZERO
end if
this%qauxcbc(1) = ca
call this%budobj%budterm(idx)%update_term(n1, n2, q, this%qauxcbc)
Expand Down
10 changes: 6 additions & 4 deletions src/Utilities/Table.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module TableModule
use ConstantsModule, only: LINELENGTH, LENBUDTXT, &
TABSTRING, TABUCSTRING, TABINTEGER, TABREAL, &
TABCENTER, &
DHNOFLO
DHNOFLO, DHDRY
use TableTermModule, only: TableTermType
use InputOutputModule, only: UWWORD, parseline
use SimModule, only: store_error
Expand Down Expand Up @@ -796,7 +796,11 @@ subroutine add_real(this, rval)
integer(I4B) :: alignment
! ------------------------------------------------------------------------------
!
if (rval /= DHNOFLO) then
if (rval == DHNOFLO) then
call this%add_string("INACTIVE")
else if (rval == DHDRY) then
call this%add_string("DRY")
else
!
! -- write header
if (this%icount == 0 .and. this%ientry == 0) then
Expand Down Expand Up @@ -844,8 +848,6 @@ subroutine add_real(this, rval)
if (this%allow_finalization) then
call this%finalize()
end if
else
call this%add_string("INACTIVE")
end if
!
! -- Return
Expand Down

0 comments on commit 61db5d3

Please sign in to comment.