|
7 | 7 | from flopy4.mf6.component import COMPONENTS |
8 | 8 | from flopy4.mf6.constants import FILL_DNODATA |
9 | 9 | from flopy4.mf6.gwf import Chd, Dis, Gwf, Ic, Npf, Oc |
10 | | -from flopy4.mf6.ims import Ims |
11 | | -from flopy4.mf6.interface.flopy3 import Flopy3Model |
12 | 10 | from flopy4.mf6.simulation import Simulation |
13 | 11 | from flopy4.mf6.tdis import Tdis |
14 | 12 |
|
@@ -201,193 +199,3 @@ def test_init_big_sim(): |
201 | 199 | chd.head.data.todense(), |
202 | 200 | sim.models["gwf"].chd[0].data.head.data.todense(), |
203 | 201 | ) |
204 | | - |
205 | | - |
206 | | -def test_modelif(): |
207 | | - from flopy.mbase import ModelInterface |
208 | | - from flopy.pakbase import PackageInterface |
209 | | - |
210 | | - time = ModelTime(perlen=[1.0], nstp=[1], tsmult=[1.0]) |
211 | | - grid = StructuredGrid(nlay=1, nrow=10, ncol=10) |
212 | | - |
213 | | - dims = { |
214 | | - "nlay": grid.nlay, |
215 | | - "nrow": grid.nrow, |
216 | | - "ncol": grid.ncol, |
217 | | - } |
218 | | - |
219 | | - dis = Dis(**dims) |
220 | | - dis.nogrb = True |
221 | | - dis.xorigin = 0.0 |
222 | | - dis.yorigin = 0.0 |
223 | | - |
224 | | - dims["nper"] = time.nper |
225 | | - dims["nnodes"] = grid.nnodes |
226 | | - |
227 | | - # ims = Ims(dims=dims) |
228 | | - ims = Ims() |
229 | | - ims.inner_hclose = 1e-6 |
230 | | - ims.inner_rclose = 0.1000000 |
231 | | - ic = Ic(dims=dims) |
232 | | - oc = Oc(dims=dims) |
233 | | - npf = Npf(dims=dims) |
234 | | - chd = Chd(dims=dims, head={"*": {(0, 0, 0): 1.0, (0, 9, 9): 0.0}}) |
235 | | - |
236 | | - gwf = Gwf( |
237 | | - dis=dis, |
238 | | - ic=ic, |
239 | | - oc=oc, |
240 | | - npf=npf, |
241 | | - chd=[chd], |
242 | | - dims=dims, |
243 | | - ) |
244 | | - |
245 | | - pnames = ["dis", "ic", "oc", "npf", "chd0"] |
246 | | - ptypes = ["DIS", "IC", "OC", "NPF", "CHD"] |
247 | | - |
248 | | - gwfif = Flopy3Model(model=gwf, modeltime=time, ims=ims) |
249 | | - assert isinstance(gwfif, ModelInterface) |
250 | | - assert gwfif.modelgrid |
251 | | - assert gwfif.modelgrid.nlay == gwf.dis.nlay |
252 | | - assert gwfif.modelgrid.nrow == gwf.dis.nrow |
253 | | - assert gwfif.modelgrid.ncol == gwf.dis.ncol |
254 | | - assert gwfif.modelgrid.nnodes == grid.nnodes |
255 | | - |
256 | | - assert gwfif.solver_tols == (ims.inner_hclose, ims.inner_rclose) |
257 | | - assert np.all( |
258 | | - np.equal(gwfif.laytyp, np.zeros(gwfif.modelgrid.nnodes, dtype=int)) |
259 | | - ) |
260 | | - |
261 | | - # model packages |
262 | | - assert gwfif.get_package_list() == pnames |
263 | | - for i, p in enumerate(gwfif.packagelist): |
264 | | - assert isinstance(p, PackageInterface) |
265 | | - assert p.name == pnames[i] |
266 | | - assert p.package_type == ptypes[i] |
267 | | - # assert p.parent == "gwf" |
268 | | - # TODO oc? |
269 | | - if p.name == "chd0" or p.name == "oc": |
270 | | - assert p.has_stress_period_data |
271 | | - else: |
272 | | - assert not p.has_stress_period_data |
273 | | - |
274 | | - # package data |
275 | | - dlist = [d.name for d in p.data_list] |
276 | | - print(f"PACKAGE {p.name} data list => {dlist}") |
277 | | - for d in p.data_list: |
278 | | - print(f"{p.name} data={d.name}") |
279 | | - # assert d.model == "gwf" |
280 | | - print(f"dtype: {d.dtype}") |
281 | | - print(f"data_type: {d.data_type}") |
282 | | - print(f"array: {d.array}\n") |
283 | | - |
284 | | - kwargs = {} |
285 | | - kwargs["filename_base"] = "modelif" |
286 | | - |
287 | | - # gwfif.plot(**kwargs) |
288 | | - gwfif.plot(filename_base="modelif") |
289 | | - |
290 | | - |
291 | | -def norun_test_cbd_small(): |
292 | | - import sys |
293 | | - |
294 | | - sys.path.append("/home/mjreno/.clone/usgs/flopy/autotest") |
295 | | - from test_grid_cases import GridCases |
296 | | - |
297 | | - time = ModelTime(perlen=[1.0], nstp=[1], tsmult=[1.0]) |
298 | | - |
299 | | - cbd_small = GridCases.structured_cbd_small() |
300 | | - dims = { |
301 | | - "nlay": cbd_small.nlay, |
302 | | - "nrow": cbd_small.nrow, |
303 | | - "ncol": cbd_small.ncol, |
304 | | - } |
305 | | - dis = Dis(**dims) |
306 | | - dims["nper"] = time.nper |
307 | | - dims["nnodes"] = cbd_small.nnodes |
308 | | - gwf = Gwf( |
309 | | - dis=dis, |
310 | | - dims=dims, |
311 | | - ) |
312 | | - gwfif = Flopy3Model(model=gwf, modelgrid=cbd_small, modeltime=time) |
313 | | - gwfif.plot(filename_base="cbd_small") |
314 | | - |
315 | | - |
316 | | -def norun_test_grid2(): |
317 | | - lx = 5.0 |
318 | | - lz = 1.0 |
319 | | - nlay = 1 |
320 | | - nrow = 1 |
321 | | - ncol = 5 |
322 | | - nper = 1 |
323 | | - delc = 1.0 |
324 | | - delr = lx / ncol |
325 | | - delz = lz / nlay |
326 | | - adelc = np.full((nrow), delc) |
327 | | - adelr = np.full((ncol), delr) |
328 | | - top = [0.0, 0.0, -0.90, 0.0, 0.0] |
329 | | - botm = list(top - np.arange(delz, nlay * delz + delz, delz)) |
330 | | - botm[2] = -1.0 |
331 | | - idomain = np.full((nlay, nrow, ncol), 1) |
332 | | - |
333 | | - dims = { |
334 | | - "nlay": nlay, |
335 | | - "nrow": nrow, |
336 | | - "ncol": ncol, |
337 | | - } |
338 | | - |
339 | | - time = ModelTime(perlen=[1.0], nstp=[1], tsmult=[1.0]) |
340 | | - dis = Dis(**dims) |
341 | | - dis.delr = adelr |
342 | | - dis.delc = adelc |
343 | | - dis.top = top |
344 | | - dis.botm = botm |
345 | | - # dis.idomain = idomain |
346 | | - dims["nper"] = time.nper |
347 | | - dims["nnodes"] = nlay * nrow * ncol |
348 | | - gwf = Gwf( |
349 | | - dis=dis, |
350 | | - dims=dims, |
351 | | - ) |
352 | | - gwfif = Flopy3Model(model=gwf, modeltime=time) |
353 | | - gwfif.plot(filename_base="grid2") |
354 | | - |
355 | | - # dis = flopy.mf6.ModflowGwfdis( |
356 | | - # gwf, |
357 | | - # nlay=nlay, |
358 | | - # nrow=nrow, |
359 | | - # ncol=ncol, |
360 | | - # delr=delr, |
361 | | - # delc=delc, |
362 | | - # top=top, |
363 | | - # botm=botm, |
364 | | - # idomain=idomain, |
365 | | - # ) |
366 | | - |
367 | | - |
368 | | -# demo failed case |
369 | | -def test_mgrid2(): |
370 | | - lx = 5.0 |
371 | | - lz = 1.0 |
372 | | - nlay = 1 |
373 | | - nrow = 1 |
374 | | - ncol = 5 |
375 | | - delc = 1.0 |
376 | | - delr = lx / ncol |
377 | | - delz = lz / nlay |
378 | | - adelc = np.full((nrow), delc) |
379 | | - adelr = np.full((ncol), delr) |
380 | | - |
381 | | - dims = { |
382 | | - "nlay": nlay, |
383 | | - "nrow": nrow, |
384 | | - "ncol": ncol, |
385 | | - } |
386 | | - |
387 | | - dis = Dis(**dims) |
388 | | - |
389 | | - print(dis.delr.dims) # prints ('ncol',) |
390 | | - print(dis.delc.dims) # prints ('nrow',) |
391 | | - |
392 | | - dis.delr = adelr # succeeds |
393 | | - dis.delc = adelc # fails |
0 commit comments