Skip to content
Closed
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
Binary file modified docs/examples/image/quickstart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 21 additions & 19 deletions docs/examples/quickstart.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from pathlib import Path

import flopy
import imod.mf6
import matplotlib.pyplot as plt
import numpy as np

from flopy4.mf6.gwf import Chd, Dis, Gwf, Ic, Npf, Oc
from flopy4.mf6.ims import Ims
from flopy4.mf6.interface.flopy3 import Flopy3Model
from flopy4.mf6.simulation import Simulation
from flopy4.mf6.tdis import Tdis

Expand All @@ -30,6 +32,9 @@
save_budget={"*": "all"},
)

# flopy3 model interface
gwf3 = Flopy3Model(gwf)

# check CHD
assert chd.data["head"][0, 0] == 1.0
assert chd.data.head.sel(per=0)[99] == 0.0
Expand All @@ -42,29 +47,26 @@
assert oc.data["save_head"][0] == "all"
assert oc.data.save_head.sel(per=0) == "all"

# PLOT
# create budget reader
# set paths
bpth = Path("./quickstart_data/mymodel.bud")
grbpth = Path("./quickstart_data/mymodel.dis.grb")

# set specific discharge
spdis = imod.mf6.open_cbc(bpth, grbpth, merge_to_dataset=True)

# create head reader
hpth = Path("./quickstart_data/mymodel.hds")

# set data
bobj = flopy.utils.CellBudgetFile(bpth, precision="double")
spdis = bobj.get_data(text="DATA-SPDIS")[0]
# spdis = imod.mf6.open_cbc(bpth, grbpth, merge_to_dataset=True)
heads = imod.mf6.open_hds(hpth, grbpth)
sq = heads.squeeze()

# discharge vectors
qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge(spdis, gwf3)

# plot
fig, ax = plt.subplots()
ax.tick_params()
ax.set_xticks(np.arange(0, 11, 2), minor=False)
ax.set_xticks(np.arange(1, 10, 2), minor=True)
ax.set_yticks(np.arange(0, 11, 2), minor=False)
ax.set_yticks(np.arange(1, 10, 2), minor=True)
ax.grid(which="both", color="white")
sq.plot.imshow(ax=ax)
sq.plot.contour(ax=ax, levels=[0.2, 0.4, 0.6, 0.8], linewidths=3.0)
spdis.squeeze().plot.quiver(
x="x", y="y", u="npf-qx", v="npf-qy", ax=ax, color="white"
)
pmv = flopy.plot.PlotMapView(model=gwf3, ax=ax)
pmv.plot_array(heads[0][0])
pmv.plot_grid(colors="white")
pmv.contour_array(heads[0][0], levels=[0.2, 0.4, 0.6, 0.8], linewidths=3.0)
pmv.plot_vector(qx, qy, color="white")
qs_pth = Path("./image/quickstart.png")
fig.savefig(qs_pth)
6 changes: 3 additions & 3 deletions flopy4/mf6/gwf/dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ class Dis(Package):
)
top: NDArray[np.floating] = array(
default=1.0,
dims=("ncol", "nrow"),
dims=("nrow", "ncol"),
metadata={"block": "griddata"},
converter=Converter(convert_array, takes_self=True, takes_field=True),
)
botm: NDArray[np.floating] = array(
default=0.0,
dims=("ncol", "nrow", "nlay"),
dims=("nlay", "nrow", "ncol"),
metadata={"block": "griddata"},
converter=Converter(convert_array, takes_self=True, takes_field=True),
)
idomain: NDArray[np.integer] = array(
default=1,
dims=("ncol", "nrow", "nlay"),
dims=("nlay", "nrow", "ncol"),
metadata={"block": "griddata"},
converter=Converter(convert_array, takes_self=True, takes_field=True),
)
Expand Down
3 changes: 3 additions & 0 deletions flopy4/mf6/ims.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ class Ims(Solution):
inner_dvclose: Optional[float] = field(
default=None, metadata={"block": "linear"}
)
inner_hclose: Optional[float] = field(
default=None, metadata={"block": "linear"}
)
inner_rclose: Optional[float] = field(
default=None, metadata={"block": "linear"}
)
Expand Down
Empty file.
Loading