Skip to content

Commit

Permalink
extend auxmult test to verify time-series step values are applied (#1564
Browse files Browse the repository at this point in the history
)

Co-authored-by: mjreno <[email protected]>
  • Loading branch information
mjreno and mjreno authored Jan 22, 2024
1 parent 0a08d30 commit 288a54e
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions autotest/test_gwf_utl04_auxmult.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@

from framework import TestFramework

cases = ["auxmult01"]
cases = ["auxmult01", "auxmult02"]

wellist = [
[(0, 2, 2), "tsq", "tsqfact"],
[(0, 2, 2), 1.0000000, "tsqfact"]
]

def build_models(idx, test):
global numstep
nlay, nrow, ncol = 1, 3, 3
perlen = [1.0, 1.0, 1.0, 1.0]
nstp = [10, 1, 1, 1]
Expand All @@ -23,6 +28,7 @@ def build_models(idx, test):
delr = delc = lenx / float(nrow)
botm = -1.0
hk = 1.0
numstep = sum(nstp)

nouter, ninner = 100, 300
hclose, rclose, relax = 1e-6, 1e-3, 1.0
Expand Down Expand Up @@ -102,19 +108,28 @@ def build_models(idx, test):
)

# wel files
wellist1 = []
wellist1.append([(0, 2, 2), "tsq", "tsqfact"])
wel = flopy.mf6.ModflowGwfwel(
gwf,
pname="wel",
print_input=True,
print_flows=True,
stress_period_data={0: wellist1},
stress_period_data={0: [wellist[idx]]},
auxiliary=["auxmult"],
auxmultname="auxmult",
)
# ts_filerecord='well-rates.ts')

# wel obs
obs = {
"wel.obs.csv": [
["q", "wel", (0, 2, 2)]
],
}
welobs = wel.obs.initialize(
print_input=True,
continuous=obs,
)

# well ts package
ts_recarray = [
(0.0, 0.0, 1.0),
Expand Down Expand Up @@ -158,7 +173,8 @@ def build_models(idx, test):


def check_output(idx, test):
fpth = os.path.join(test.workspace, "auxmult01.bud")
name = cases[idx]
fpth = os.path.join(test.workspace, f"{name}.bud")
bobj = flopy.utils.CellBudgetFile(fpth, precision="double", verbose=False)
records = bobj.get_data(text="wel")

Expand All @@ -172,6 +188,18 @@ def check_output(idx, test):
msg = f"err {qlist} /= {answer}"
assert np.allclose(qlist, answer), msg

# MODFLOW 6 observations
fpth = os.path.join(test.workspace, "wel.obs.csv")
try:
obs = np.genfromtxt(fpth, names=True, delimiter=",")
except:
assert False, f'could not load data from "{fpth}"'

rate = obs["Q"]
obs_answer = [1.0 if x%2==0 else 0.0 for x in range(numstep)]
msg = f"err {rate} /= {obs_answer}"
assert np.allclose(rate, obs_answer), msg


@pytest.mark.parametrize("idx, name", enumerate(cases))
def test_mf6model(idx, name, function_tmpdir, targets):
Expand Down

0 comments on commit 288a54e

Please sign in to comment.