Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(csub): CSUB observations #2114

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
257 changes: 257 additions & 0 deletions autotest/test_gwf_csub_obs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
import flopy
import pytest
from framework import TestFramework

# fmt: off
obs_names = [
"delay-flowtop", "delay-flowtop",
"delay-flowbot", "delay-flowbot",
"delay-head", "delay-head",
"delay-gstress", "delay-gstress",
"delay-estress", "delay-estress",
"delay-preconstress", "delay-preconstress",
"delay-compaction", "delay-compaction",
"delay-thickness", "delay-thickness",
"delay-theta", "delay-theta",
"csub", "csub",
"inelastic-csub", "inelastic-csub",
"elastic-csub", "elastic-csub",
"interbed-compaction", "interbed-compaction",
"inelastic-compaction", "inelastic-compaction",
"elastic-compaction", "elastic-compaction",
]
# fmt: off
boundname = [
False, True,
False, True,
False, True,
False, True,
False, True,
False, True,
False, True,
False, True,
False, True,
False, True,
False, True,
False, True,
False, True,
False, True,
False, True,
]
# fmt: off
test_fail = [
False, False,
False, False,
False, True,
False, True,
False, True,
False, True,
False, True,
False, True,
False, True,
False, False,
False, False,
False, False,
False, True,
False, True,
False, True,
]
cases = [f"csub_obs{idx + 1:02d}" for idx, _ in enumerate(obs_names)]

paktest = "csub"
budtol = 1e-2
ndcell = [19] * len(cases)

# static model data
# spatial discretization
nlay, nrow, ncol = 1, 1, 3
shape3d = (nlay, nrow, ncol)
size3d = nlay * nrow * ncol
delr, delc = 1.0, 1.0
top = 0.0
botm = [-100.0]

# temporal discretization
nper = 1
perlen = [1000.0 for _ in range(nper)]
nstp = [100 for _ in range(nper)]
tsmult = [1.05 for _ in range(nper)]
steady = [False for _ in range(nper)]

strt = 0.0
strt6 = 1.0
hnoflo = 1e30
hdry = -1e30
hk = 1e6
laytyp = [0]
S = 1e-4
sy = 0.0

nouter, ninner = 1000, 300
hclose, rclose, relax = 1e-6, 1e-6, 0.97

tdis_rc = []
for i in range(nper):
tdis_rc.append((perlen[i], nstp[i], tsmult[i]))

ib = 1

c = []
c6 = []
for j in range(0, ncol, 2):
c.append([0, 0, j, strt, strt])
c6.append([(0, 0, j), strt])
cd = {0: c}
cd6 = {0: c6}

# sub data
ndb = 1
nndb = 0
cc = 100.0
cr = 1.0
void = 0.82
theta = void / (1.0 + void)
kv = 0.025
sgm = 0.0
sgs = 0.0
ini_stress = 1.0
thick = [1.0]
sfe = cr * thick[0]
sfv = cc * thick[0]
lnd = [0]
ldnd = [0]
dp = [[kv, cr, cc]]
ss = S / (100.0 - thick[0])

ds15 = [0, 0, 0, 2052, 0, 0, 0, 0, 0, 0, 0, 0]
ds16 = [0, 0, 0, 100, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1]


def get_model(idx, ws):
name = cases[idx]

sim = flopy.mf6.MFSimulation(
sim_name=name, version="mf6", exe_name="mf6", sim_ws=ws
)
# create tdis package
tdis = flopy.mf6.ModflowTdis(sim, time_units="DAYS", nper=nper, perioddata=tdis_rc)

# create iterative model solution
ims = flopy.mf6.ModflowIms(
sim,
print_option="SUMMARY",
outer_dvclose=hclose,
outer_maximum=nouter,
under_relaxation="NONE",
inner_maximum=ninner,
inner_dvclose=hclose,
rcloserecord=rclose,
linear_acceleration="CG",
scaling_method="NONE",
reordering_method="NONE",
relaxation_factor=relax,
)

# create gwf model
gwf = flopy.mf6.ModflowGwf(sim, modelname=name)

dis = flopy.mf6.ModflowGwfdis(
gwf,
nlay=nlay,
nrow=nrow,
ncol=ncol,
delr=delr,
delc=delc,
top=top,
botm=botm,
filename=f"{name}.dis",
)

# initial conditions
ic = flopy.mf6.ModflowGwfic(gwf, strt=strt, filename=f"{name}.ic")

# node property flow
npf = flopy.mf6.ModflowGwfnpf(gwf, save_flows=False, icelltype=laytyp, k=hk, k33=hk)
# storage
sto = flopy.mf6.ModflowGwfsto(
gwf,
save_flows=False,
iconvert=laytyp,
ss=0.0,
sy=sy,
storagecoefficient=True,
transient={0: True},
)

# chd files
chd = flopy.mf6.modflow.mfgwfchd.ModflowGwfchd(
gwf, maxbound=len(c6), stress_period_data=cd6, save_flows=False
)

# csub files
sub6 = [
[
0,
(0, 0, 1),
"delay",
ini_stress,
thick[0],
1.0,
230.258658761733000,
2.302586587617330,
theta,
kv,
ini_stress,
]
]
bname = "interbed"
if boundname[idx]:
sub6[0].append(bname)
obs_idx = ("obs_value", obs_names[idx], bname)
else:
obs_idx = ("obs_value", obs_names[idx], (0,), (0,))

opth = f"{name}.csub.obs"
csub = flopy.mf6.ModflowGwfcsub(
gwf,
boundnames=boundname[idx],
head_based=False,
print_input=True,
save_flows=True,
ndelaycells=ndcell[idx],
ninterbeds=1,
beta=0.0,
cg_ske_cr=ss,
packagedata=sub6,
)
orecarray = {}
orecarray["csub_obs.csv"] = [obs_idx]
csub_obs_package = csub.obs.initialize(
filename=opth, digits=10, print_input=True, continuous=orecarray
)

# output control
oc = flopy.mf6.ModflowGwfoc(
gwf,
printrecord=[("BUDGET", "ALL")],
)

return sim


def build_models(idx, test):
sim = get_model(idx, test.workspace)

return sim, None


@pytest.mark.parametrize("idx, name", enumerate(cases))
def test_mf6model(idx, name, function_tmpdir, targets):
test = TestFramework(
name=name,
workspace=function_tmpdir,
build=lambda t: build_models(idx, t),
targets=targets,
xfail=test_fail[idx],
)
test.run()
6 changes: 3 additions & 3 deletions autotest/test_gwf_csub_sub03.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ def get_model(idx, ws):
)
orecarray = {}
orecarray["csub_obs.csv"] = [
("tcomp1", "interbed-compaction", "01_05_05"),
("tcomp2", "interbed-compaction", "02_05_05"),
("tcomp3", "interbed-compaction", "03_05_05"),
("tcomp1", "interbed-compaction", (44,)),
("tcomp2", "interbed-compaction", (140,)),
("tcomp3", "interbed-compaction", (240,)),
]
csub_obs_package = csub.obs.initialize(
filename=opth, digits=10, print_input=True, continuous=orecarray
Expand Down
2 changes: 1 addition & 1 deletion autotest/test_gwf_csub_subwt01.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def get_model(idx, ws):
)
orecarray = {}
orecarray["csub_obs.csv"] = [
("w1l1", "interbed-compaction", "01_01_02"),
("w1l1", "compaction-cell", (0, 0, 1)),
("w1l1t", "csub-cell", (0, 0, 1)),
]
csub_obs_package = csub.obs.initialize(
Expand Down
18 changes: 9 additions & 9 deletions autotest/test_gwf_csub_subwt02.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,14 @@ def get_model(idx, ws):
)

cobs = [
("w1l1", "interbed-compaction", "01_09_10"),
("w1l2", "interbed-compaction", "02_09_10"),
("w1l3", "interbed-compaction", "03_09_10"),
("w1l4", "interbed-compaction", "04_09_10"),
("w2l1", "interbed-compaction", "01_12_07"),
("w2l2", "interbed-compaction", "02_12_07"),
("w2l3", "interbed-compaction", "03_12_07"),
("w2l4", "interbed-compaction", "04_12_07"),
("w1l1", "interbed-compaction", (89,)),
("w1l2", "interbed-compaction", (299,)),
("w1l3", "interbed-compaction", (509,)),
("w1l4", "interbed-compaction", (719,)),
("w2l1", "interbed-compaction", (130,)),
("w2l2", "interbed-compaction", (340,)),
("w2l3", "interbed-compaction", (550,)),
("w2l4", "interbed-compaction", (760,)),
("s1l1", "coarse-compaction", (0, 8, 9)),
("s1l2", "coarse-compaction", (1, 8, 9)),
("s1l3", "coarse-compaction", (2, 8, 9)),
Expand Down Expand Up @@ -383,7 +383,7 @@ def get_model(idx, ws):
("pc4", "preconstress-cell", (3, 8, 9)),
("sk1l2", "ske-cell", (1, 8, 9)),
("sk2l4", "ske-cell", (3, 11, 6)),
("t1l2", "theta", "02_09_10"),
("t1l2", "theta", (1, 8, 9)),
]

orecarray = {"csub_obs.csv": cobs}
Expand Down
8 changes: 4 additions & 4 deletions autotest/test_gwf_csub_zdisp01.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,13 @@ def build_models(idx, test):
packagedata=sub6,
)
orecarray = {}
tag = f"{3:02d}_{wrp[0] + 1:02d}_{wcp[0] + 1:02d}"
oloc = (2, wrp[0], wcp[0])
ibloc = (449,)
orecarray["csub_obs.csv"] = [
("tcomp3", "interbed-compaction", tag),
("tcomp3", "interbed-compaction", ibloc),
("sk-tcomp3", "coarse-compaction", oloc),
("ibi-tcomp3", "inelastic-compaction", tag),
("ibe-tcomp3", "elastic-compaction", tag),
("ibi-tcomp3", "inelastic-compaction", ibloc),
("ibe-tcomp3", "elastic-compaction", ibloc),
]
csub_obs_package = csub.obs.initialize(
filename=opth, digits=10, print_input=True, continuous=orecarray
Expand Down
42 changes: 21 additions & 21 deletions doc/Common/gwf-csubobs.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,40 @@
CSUB & csub-cell & cellid & -- & Flow between the groundwater system for all interbeds and coarse-grained materials in a GWF cell. \\
CSUB & wcomp-csub-cell & cellid & -- & Flow between the groundwater system for all interbeds and coarse-grained materials in a GWF cell from water compressibility. \\

CSUB & sk & icsubno or boundname & -- & Convertible interbed storativity in a interbed or group of interbeds. Convertible interbed storativity is inelastic interbed storativity if the current effective stress is greater than the preconsolidation stress. The NODATA value is reported for steady-state stress periods. \\
CSUB & ske & icsubno or boundname & -- & Elastic interbed storativity in a interbed or group of interbeds. The NODATA value is reported for steady-state stress periods. \\
CSUB & sk-cell & cellid & -- & Convertible interbed and coarse-grained material storativity in a GWF cell. Convertible interbed storativity is inelastic interbed storativity if the current effective stress is greater than the preconsolidation stress. The NODATA value is reported for steady-state stress periods. \\
CSUB & ske-cell & cellid & -- & Elastic interbed and coarse-grained material storativity in a GWF cell. The NODATA value is reported for steady-state stress periods. \\
CSUB & sk & icsubno & -- & Convertible interbed storativity in a interbed. Convertible interbed storativity is inelastic interbed storativity if the current effective stress is greater than the preconsolidation stress. \\
CSUB & ske & icsubno & -- & Elastic interbed storativity in a interbed. \\
CSUB & sk-cell & cellid & -- & Convertible interbed and coarse-grained material storativity in a GWF cell. Convertible interbed storativity is inelastic interbed storativity if the current effective stress is greater than the preconsolidation stress. \\
CSUB & ske-cell & cellid & -- & Elastic interbed and coarse-grained material storativity in a GWF cell. \\

CSUB & estress-cell & cellid & -- & effective stress in a GWF cell. \\
CSUB & gstress-cell & cellid & -- & geostatic stress in a GWF cell. \\

CSUB & interbed-compaction & icsubno or boundname & -- & interbed compaction in a interbed or group of interbeds. \\
CSUB & inelastic-compaction & icsubno or boundname & -- & inelastic interbed compaction in a interbed or group of interbeds. \\
CSUB & elastic-compaction & icsubno or boundname & -- & elastic interbed compaction a interbed or group of interbeds. \\
CSUB & interbed-compaction & icsubno & -- & interbed compaction in a interbed. \\
CSUB & inelastic-compaction & icsubno & -- & inelastic interbed compaction in a interbed. \\
CSUB & elastic-compaction & icsubno & -- & elastic interbed compaction a interbed. \\
CSUB & coarse-compaction & cellid & -- & elastic compaction in coarse-grained materials in a GWF cell. \\
CSUB & inelastic-compaction-cell & cellid & -- & inelastic compaction in all interbeds in a GWF cell. \\
CSUB & elastic-compaction-cell & cellid & -- & elastic compaction in coarse-grained materials and all interbeds in a GWF cell. \\
CSUB & compaction-cell & cellid & -- & total compaction in coarse-grained materials and all interbeds in a GWF cell. \\

CSUB & thickness & icsubno or boundname & -- & thickness of a interbed or group of interbeds. \\
CSUB & coarse-thickness & cellid & -- & thickness of coarse-grained materials in a GWF cell. \\
CSUB & thickness-cell & cellid & -- & total thickness of coarse-grained materials and all interbeds in a GWF cell. \\
CSUB & thickness & icsubno & -- & thickness of a interbed. \\
CSUB & coarse-thickness & cellid & -- & thickness of coarse-grained materials in a GWF cell. \\
CSUB & thickness-cell & cellid & -- & total thickness of coarse-grained materials and all interbeds in a GWF cell. \\

CSUB & theta & icsubno & -- & porosity of a interbed . \\
CSUB & theta & icsubno & -- & porosity of a interbed. \\
CSUB & coarse-theta & cellid & -- & porosity of coarse-grained materials in a GWF cell. \\
CSUB & theta-cell & cellid & -- & thickness-weighted porosity of coarse-grained materials and all interbeds in a GWF cell. \\

CSUB & delay-flowtop & icsubno & -- & Flow between the groundwater system and a delay interbed across the top of the interbed. \\
CSUB & delay-flowbot & icsubno & -- & Flow between the groundwater system and a delay interbed across the bottom of the interbed. \\
CSUB & delay-flowtop & icsubno or boundname & -- & Flow between the groundwater system and a delay interbed or group of interbeds across the top of the interbed(s). \\
CSUB & delay-flowbot & icsubno or boundname & -- & Flow between the groundwater system and a delay interbed or group of interbeds across the bottom of the interbed(s). \\

CSUB & delay-head & icsubno & idcellno & head in interbed delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). The NODATA value is reported for steady-state stress periods. \\
CSUB & delay-gstress & icsubno & idcellno & geostatic stress in interbed delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). The NODATA value is reported for steady-state stress periods. \\
CSUB & delay-estress & icsubno & idcellno & effective stress in interbed delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). The NODATA value is reported for steady-state stress periods. \\
CSUB & delay-preconstress & icsubno & idcellno & preconsolidation stress in interbed delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). The NODATA value is reported for steady-state stress periods. \\
CSUB & delay-compaction & icsubno & idcellno & compaction in interbed delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). \\
CSUB & delay-thickness & icsubno & idcellno & thickness of interbed delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). \\
CSUB & delay-theta & icsubno & idcellno & porosity of interbed delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). \\
CSUB & delay-head & icsubno & idcellno & head in interbed in delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). \\
CSUB & delay-gstress & icsubno & idcellno & geostatic stress in interbed in delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). \\
CSUB & delay-estress & icsubno & idcellno & effective stress in interbed in delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). \\
CSUB & delay-preconstress & icsubno & idcellno & preconsolidation stress in interbed in delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). \\
CSUB & delay-compaction & icsubno & idcellno & compaction in interbed in delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). \\
CSUB & delay-thickness & icsubno & idcellno & thickness of interbed or group of interbeds in delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). \\
CSUB & delay-theta & icsubno & idcellno & porosity of interbed in delay cell idcellno (1 $<=$ idcellno $<=$ NDELAYCELLS). \\

CSUB & preconstress-cell & cellid & -- & preconsolidation stress in a GWF cell containing at least one interbed. The NODATA value is reported for steady-state stress periods.
CSUB & preconstress-cell & cellid & -- & preconsolidation stress in a GWF cell containing at least one interbed.

Loading
Loading