|
2 | 2 |
|
3 | 3 | import matplotlib.pyplot as plt |
4 | 4 | import numpy as np |
| 5 | +from flopy.discretization.modeltime import ModelTime |
| 6 | +from flopy.discretization.structuredgrid import StructuredGrid |
5 | 7 |
|
6 | | -from flopy4.mf6.gwf import Chd, Dis, Gwf, Ic, Npf, Oc |
| 8 | +from flopy4.mf6.gwf import Chd, Gwf, Npf, Oc |
7 | 9 | from flopy4.mf6.ims import Ims |
8 | 10 | from flopy4.mf6.simulation import Simulation |
9 | | -from flopy4.mf6.tdis import Tdis |
10 | | - |
11 | | -ws = Path(__file__).parent / "quickstart_data" |
12 | | -name = "mymodel" |
13 | | -tdis = Tdis() |
14 | | -ims = Ims() |
15 | | -sim = Simulation(name=name, tdis=tdis, solutions={"ims": ims}, sim_ws=ws) |
16 | | -dis = Dis(nrow=10, ncol=10) |
17 | | -gwf = Gwf(parent=sim, name=name, save_flows=True, dis=dis) |
18 | | -ic = Ic(parent=gwf) |
| 11 | + |
| 12 | +name = "quickstart" |
| 13 | +workspace = Path(__file__).parent / name |
| 14 | +time = ModelTime(perlen=[1.0], nstp=[1]) |
| 15 | +grid = StructuredGrid(nlay=1, nrow=10, ncol=10) |
| 16 | +sim = Simulation(name=name, path=workspace, tdis=time) |
| 17 | +ims = Ims(parent=sim) |
| 18 | +gwf_name = "mymodel" |
| 19 | +gwf = Gwf(parent=sim, name=gwf_name, save_flows=True, dis=grid) |
19 | 20 | npf = Npf(parent=gwf, save_specific_discharge=True) |
20 | 21 | chd = Chd( |
21 | 22 | parent=gwf, |
22 | 23 | head={"*": {(0, 0, 0): 1.0, (0, 9, 9): 0.0}}, |
23 | 24 | ) |
24 | 25 | oc = Oc( |
25 | 26 | parent=gwf, |
26 | | - budget_file=f"{name}.bud", |
27 | | - head_file=f"{name}.hds", |
| 27 | + budget_file=f"{gwf.name}.bud", |
| 28 | + head_file=f"{gwf.name}.hds", |
28 | 29 | save_head={"*": "all"}, |
29 | 30 | save_budget={"*": "all"}, |
30 | 31 | ) |
|
35 | 36 | assert np.allclose(chd.data.head[:, 1:99], np.full(98, 1e30)) |
36 | 37 |
|
37 | 38 | # check DIS |
38 | | -assert dis.data.botm.sel(lay=0, col=0, row=0) == 0.0 |
| 39 | +assert gwf.dis.data.botm.sel(lay=0, col=0, row=0) == 0.0 |
39 | 40 |
|
40 | 41 | # check OC |
41 | 42 | assert oc.data["save_head"][0] == "all" |
|
56 | 57 | head.plot.imshow(ax=ax) |
57 | 58 | head.plot.contour(ax=ax, levels=[0.2, 0.4, 0.6, 0.8], linewidths=3.0) |
58 | 59 | budget.plot.quiver(x="x", y="y", u="npf-qx", v="npf-qy", ax=ax, color="white") |
59 | | -fig.savefig(ws / "quickstart.png") |
| 60 | +fig.savefig(workspace / f"{name}.png") |
0 commit comments