|
1 | 1 | from pathlib import Path |
2 | 2 |
|
| 3 | +import flopy |
3 | 4 | import imod.mf6 |
4 | 5 | import matplotlib.pyplot as plt |
5 | 6 | import numpy as np |
6 | 7 |
|
7 | 8 | from flopy4.mf6.gwf import Chd, Dis, Gwf, Ic, Npf, Oc |
8 | 9 | from flopy4.mf6.ims import Ims |
| 10 | +from flopy4.mf6.interface.flopy3 import Flopy3Model |
9 | 11 | from flopy4.mf6.simulation import Simulation |
10 | 12 | from flopy4.mf6.tdis import Tdis |
11 | 13 |
|
|
30 | 32 | save_budget={"*": "all"}, |
31 | 33 | ) |
32 | 34 |
|
| 35 | +# model interface |
| 36 | +gwfif = Flopy3Model(gwf) |
| 37 | + |
33 | 38 | # check CHD |
34 | 39 | assert chd.data["head"][0, 0] == 1.0 |
35 | 40 | assert chd.data.head.sel(per=0)[99] == 0.0 |
|
42 | 47 | assert oc.data["save_head"][0] == "all" |
43 | 48 | assert oc.data.save_head.sel(per=0) == "all" |
44 | 49 |
|
45 | | -# PLOT |
46 | | -# create budget reader |
| 50 | +# set paths |
47 | 51 | bpth = Path("./quickstart_data/mymodel.bud") |
48 | 52 | 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 |
54 | 53 | 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) |
55 | 59 | 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 |
57 | 65 | 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") |
69 | 71 | qs_pth = Path("./image/quickstart.png") |
70 | 72 | fig.savefig(qs_pth) |
0 commit comments