|
1 | | -from flopy4.mf6 import Simulation, Tdis |
2 | | -from flopy4.mf6.gwf import Chd, Dis, Gwf, Ic, Npf, Oc |
| 1 | +import numpy as np |
| 2 | + |
| 3 | +from flopy4.mf6.gwf import Chd, Dis, Gwf, Ic, Npf |
| 4 | +from flopy4.mf6.simulation import Simulation |
| 5 | +from flopy4.mf6.tdis import Tdis |
3 | 6 |
|
4 | 7 | # TODO rewrite bottom up |
5 | 8 |
|
6 | 9 | ws = "./mymodel" |
7 | 10 | name = "mymodel" |
8 | | -sim = Simulation(name=name) |
9 | | -tdis = Tdis(sim) |
10 | | -gwf = Gwf(sim, name=name, save_flows=True) |
11 | | -dis = Dis(gwf, nrow=10, ncol=10) |
12 | | -ic = Ic(gwf) |
13 | | -npf = Npf(gwf, save_specific_discharge=True) |
| 11 | +tdis = Tdis() |
| 12 | +sim = Simulation(name=name, tdis=tdis) |
| 13 | +dis = Dis(nrow=10, ncol=10) |
| 14 | +gwf = Gwf(parent=sim, name=name, save_flows=True, dis=dis) |
| 15 | +ic = Ic(parent=gwf) |
| 16 | +npf = Npf(parent=gwf, save_specific_discharge=True) |
14 | 17 | chd = Chd( |
15 | | - gwf, |
16 | | - head={(0, 0, 0): 1.0, (0, 9, 9): 0.0}, |
17 | | -) |
18 | | - |
19 | | -# list input in the mf6 paradigm, just stored in xarray. |
20 | | -# this is straightforward to implement. even in flopy3? |
21 | | -assert all( |
22 | | - period == Chd.Period((0, 0, 0), 1.0) |
23 | | - for period in chd.data["stress_period_data"] |
| 18 | + parent=gwf, |
| 19 | + head={"*": {(0, 0, 0): 1.0, (0, 9, 9): 0.0}}, |
24 | 20 | ) |
25 | 21 |
|
26 | 22 | # adopt xarray paradigm. transpose lists to arrays. this |
|
30 | 26 | # we want to "align" everything to the discretization in |
31 | 27 | # both time and space. |
32 | 28 |
|
| 29 | +assert chd.data["head"][0, 0] == 1.0 |
| 30 | +assert chd.data["head"][0, 99] == 0.0 |
| 31 | +assert np.allclose(chd.data["head"][:, 1:99], np.full(98, 1e30)) |
| 32 | + |
| 33 | +# TODO: xarray index aliasing nlay/ncol/nrow to k/i/j? |
33 | 34 | # assert chd.data["head"].loc(dict(k=0, i=0, j=0)) == 1. |
34 | 35 | # assert chd.data["head"].loc(dict(k=0, i=9, j=9)) == 0. |
35 | 36 |
|
36 | | -oc = Oc( |
37 | | - gwf, |
38 | | - budget_filerecord=f"{name}.bud", |
39 | | - head_filerecord=f"{name}.hds", |
40 | | - saverecord=[("HEAD", "ALL"), ("BUDGET", "ALL")], |
41 | | -) |
| 37 | +# TODO OC! |
| 38 | + |
| 39 | +# oc = Oc( |
| 40 | +# gwf, |
| 41 | +# budget_filerecord=f"{name}.bud", |
| 42 | +# head_filerecord=f"{name}.hds", |
| 43 | +# saverecord=[("HEAD", "ALL"), ("BUDGET", "ALL")], |
| 44 | +# ) |
42 | 45 |
|
43 | 46 | # xarray style. this is how imod-python does it too. |
44 | 47 | # assert oc.data["save_head"] == "all" |
|
0 commit comments