Skip to content

Commit 5df1284

Browse files
mjrenomjreno
authored andcommitted
incremental progress
1 parent 162dfb5 commit 5df1284

File tree

6 files changed

+582
-19
lines changed

6 files changed

+582
-19
lines changed

docs/examples/image/quickstart.png

2.79 KB
Loading

docs/examples/quickstart.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
from pathlib import Path
22

3+
import flopy
34
import imod.mf6
45
import matplotlib.pyplot as plt
56
import numpy as np
67

78
from flopy4.mf6.gwf import Chd, Dis, Gwf, Ic, Npf, Oc
89
from flopy4.mf6.ims import Ims
10+
from flopy4.mf6.interface.flopy3 import Flopy3Model
911
from flopy4.mf6.simulation import Simulation
1012
from flopy4.mf6.tdis import Tdis
1113

@@ -30,6 +32,9 @@
3032
save_budget={"*": "all"},
3133
)
3234

35+
# model interface
36+
gwfif = Flopy3Model(gwf)
37+
3338
# check CHD
3439
assert chd.data["head"][0, 0] == 1.0
3540
assert chd.data.head.sel(per=0)[99] == 0.0
@@ -42,29 +47,26 @@
4247
assert oc.data["save_head"][0] == "all"
4348
assert oc.data.save_head.sel(per=0) == "all"
4449

45-
# PLOT
46-
# create budget reader
50+
# set paths
4751
bpth = Path("./quickstart_data/mymodel.bud")
4852
grbpth = Path("./quickstart_data/mymodel.dis.grb")
49-
50-
# set specific discharge
51-
spdis = imod.mf6.open_cbc(bpth, grbpth, merge_to_dataset=True)
52-
53-
# create head reader
5453
hpth = Path("./quickstart_data/mymodel.hds")
54+
55+
# set data
56+
bobj = flopy.utils.CellBudgetFile(bpth, precision="double")
57+
spdis = bobj.get_data(text="DATA-SPDIS")[0]
58+
# spdis = imod.mf6.open_cbc(bpth, grbpth, merge_to_dataset=True)
5559
heads = imod.mf6.open_hds(hpth, grbpth)
56-
sq = heads.squeeze()
60+
61+
# discharge vectors
62+
qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge(spdis, gwfif)
63+
64+
# plot
5765
fig, ax = plt.subplots()
58-
ax.tick_params()
59-
ax.set_xticks(np.arange(0, 11, 2), minor=False)
60-
ax.set_xticks(np.arange(1, 10, 2), minor=True)
61-
ax.set_yticks(np.arange(0, 11, 2), minor=False)
62-
ax.set_yticks(np.arange(1, 10, 2), minor=True)
63-
ax.grid(which="both", color="white")
64-
sq.plot.imshow(ax=ax)
65-
sq.plot.contour(ax=ax, levels=[0.2, 0.4, 0.6, 0.8], linewidths=3.0)
66-
spdis.squeeze().plot.quiver(
67-
x="x", y="y", u="npf-qx", v="npf-qy", ax=ax, color="white"
68-
)
66+
pmv = flopy.plot.PlotMapView(model=gwfif, ax=ax)
67+
pmv.plot_array(heads[0][0])
68+
pmv.plot_grid(colors="white")
69+
pmv.contour_array(heads[0][0], levels=[0.2, 0.4, 0.6, 0.8], linewidths=3.0)
70+
pmv.plot_vector(qx, qy, color="white")
6971
qs_pth = Path("./image/quickstart.png")
7072
fig.savefig(qs_pth)

flopy4/mf6/ims.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ class Ims(Solution):
5959
inner_dvclose: Optional[float] = field(
6060
default=None, metadata={"block": "linear"}
6161
)
62+
inner_hclose: Optional[float] = field(
63+
default=None, metadata={"block": "linear"}
64+
)
6265
inner_rclose: Optional[float] = field(
6366
default=None, metadata={"block": "linear"}
6467
)

flopy4/mf6/interface/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)