Skip to content

Commit

Permalink
LWRT awareness for LAK (#424)
Browse files Browse the repository at this point in the history
* added lwrt awareness to mflak.py
  • Loading branch information
mnfienen authored and jdhughes-usgs committed Oct 30, 2018
1 parent 5cf3d83 commit e71fbbd
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions flopy/modflow/mflak.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class ModflowLak(Package):
Control or ICBCFL is not equal to 0, the cell-by-cell flows will be
printed in the standard output file. ICBCFL is specified in the input
to the Output Control Option of MODFLOW.
lwrt : int or list of ints (one per SP)
lwrt > 0, suppresses printout from the lake package. Default is 0 (to
print budget information)
theta : float
Explicit (THETA = 0.0), semi-implicit (0.0 < THETA < 1.0), or implicit
(THETA = 1.0) solution for lake stages. SURFDEPTH is read only if
Expand Down Expand Up @@ -260,7 +263,7 @@ def __init__(self, model, nlakes=1, ipakcb=None, theta=-1.,
tab_files=None, tab_units=None, lakarr=None, bdlknc=None,
sill_data=None, flux_data=None,
extension='lak', unitnumber=None, filenames=None,
options=None, **kwargs):
options=None, lwrt=0, **kwargs):
"""
Package constructor.
Expand Down Expand Up @@ -347,6 +350,8 @@ def __init__(self, model, nlakes=1, ipakcb=None, theta=-1.,
self.nssitr = nssitr
self.sscncr = sscncr
self.surfdep = surfdep
self.lwrt = lwrt

if isinstance(stages, float):
if self.nlakes == 1:
stages = np.array([self.nlakes], dtype=np.float) * stages
Expand Down Expand Up @@ -514,8 +519,11 @@ def write_file(self):
itmp2 = 0
if kper in ds9_keys:
itmp2 = 1

t = [itmp, itmp2, 1]
if isinstance(self.lwrt, list):
tmplwrt = self.lwrt[kper]
else:
tmplwrt = self.lwrt
t = [itmp, itmp2, tmplwrt]
comment = 'Stress period {}'.format(kper + 1)
f.write(write_fixed_var(t, free=self.parent.free_format_input,
comment=comment))
Expand Down Expand Up @@ -587,8 +595,8 @@ def load(f, model, nper=None, ext_unit_dict=None):
Returns
-------
str : ModflowStr object
ModflowStr object.
str : ModflowLak object
ModflowLak object.
Examples
--------
Expand Down Expand Up @@ -686,6 +694,7 @@ def load(f, model, nper=None, ext_unit_dict=None):
lake_lknc = {}
sill_data = {}
flux_data = {}
lwrt = []
for iper in range(nper):
if model.verbose:
print(" reading lak dataset 4 - " +
Expand All @@ -695,7 +704,8 @@ def load(f, model, nper=None, ext_unit_dict=None):
t = line.split()
else:
t = read_fixed_var(line, ncol=3)
itmp, itmp1, lwrt = int(t[0]), int(t[1]), int(t[2])
itmp, itmp1, tmplwrt = int(t[0]), int(t[1]), int(t[2])
lwrt.append(tmplwrt)

if itmp > 0:
if model.verbose:
Expand Down Expand Up @@ -806,7 +816,8 @@ def load(f, model, nper=None, ext_unit_dict=None):

lakpak = ModflowLak(model, options=options, nlakes=nlakes,
ipakcb=ipakcb, theta=theta, nssitr=nssitr,
surfdep=surfdep, sscncr=sscncr, stages=stages,
surfdep=surfdep, sscncr=sscncr, lwrt=lwrt,
stages=stages,
stage_range=stage_range, tab_units=tab_units,
lakarr=lake_loc, bdlknc=lake_lknc,
sill_data=sill_data, flux_data=flux_data,
Expand Down

0 comments on commit e71fbbd

Please sign in to comment.