Skip to content

Commit

Permalink
refactor(mf6): update DFNS for mf6.4.3, regen/reformat .py files (mod…
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli authored Feb 7, 2024
1 parent 154ba16 commit d3e8a2a
Show file tree
Hide file tree
Showing 104 changed files with 335 additions and 149 deletions.
1 change: 1 addition & 0 deletions .docs/Notebooks/array_output_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np

import flopy

# Set name of MODFLOW exe
Expand Down
1 change: 0 additions & 1 deletion .docs/Notebooks/gridgen_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

# run installed version of flopy or add local path
import flopy

from flopy.utils import flopy_io
from flopy.utils.gridgen import Gridgen

Expand Down
1 change: 0 additions & 1 deletion .docs/Notebooks/groundwater_paper_example_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

# run installed version of flopy or add local path
import flopy

import flopy.modflow as fpm
import flopy.utils as fpu

Expand Down
1 change: 0 additions & 1 deletion .docs/Notebooks/mf6_mnw2_tutorial01.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from tempfile import TemporaryDirectory

import numpy as np

import pandas as pd

import flopy
Expand Down
4 changes: 1 addition & 3 deletions .docs/Notebooks/mf6_parallel_model_splitting_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@
# The `Mf6Splitter()` class supports Structured, Vertex, and Unstructured Grid models.

import sys

import flopy

from pathlib import Path
from tempfile import TemporaryDirectory

import matplotlib.pyplot as plt
import numpy as np

import flopy
from flopy.mf6.utils import Mf6Splitter
from flopy.plot import styles
from flopy.utils.geometry import LineString, Polygon
Expand Down
3 changes: 2 additions & 1 deletion .docs/Notebooks/mfusg_freyberg_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
#
# First we locate the model directory.

from pathlib import Path

# +
from pprint import pformat
from pathlib import Path

import flopy

Expand Down
1 change: 0 additions & 1 deletion .docs/Notebooks/modelgrid_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import numpy as np

import flopy

from flopy.discretization import StructuredGrid, UnstructuredGrid, VertexGrid

print(sys.version)
Expand Down
1 change: 0 additions & 1 deletion .docs/Notebooks/modpath7_unstructured_lateral_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

import flopy


temp_dir = TemporaryDirectory()
workspace = Path(temp_dir.name)
sim_name = "ex04_mf6"
Expand Down
1 change: 0 additions & 1 deletion .docs/Notebooks/mt3dms_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import numpy as np

import flopy

from flopy.utils.util_array import read1d

mpl.rcParams["figure.figsize"] = (8, 8)
Expand Down
1 change: 0 additions & 1 deletion .docs/Notebooks/nwt_option_blocks_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from tempfile import TemporaryDirectory

import flopy

from flopy.utils import OptionBlock

print(sys.version)
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,7 @@ app
.vscode

# mac files
**.DS_Store
**.DS_Store

# DFN backups
flopy/mf6/data/dfn_backup/
2 changes: 1 addition & 1 deletion autotest/test_geospatial_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,4 +549,4 @@ def test_geopandas_dtypes(
gi2 = t.__geo_interface__
is_equal = gi2 == gi1[ix]

assert is_equal, "GeoSpatialCollection conversion error"
assert is_equal, "GeoSpatialCollection conversion error"
20 changes: 12 additions & 8 deletions autotest/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,14 +1091,18 @@ def test_voronoi_vertex_grid(function_tmpdir):
@requires_pkg("shapely", "scipy")
@pytest.mark.parametrize(
"grid_info",
[
GridCases.voronoi_polygon(),
GridCases.voronoi_rectangle(),
GridCases.voronoi_circle(),
GridCases.voronoi_nested_circles(),
GridCases.voronoi_polygons(),
GridCases.voronoi_many_polygons(),
] if (has_pkg("shapely", True) and has_pkg("scipy", True)) else []
(
[
GridCases.voronoi_polygon(),
GridCases.voronoi_rectangle(),
GridCases.voronoi_circle(),
GridCases.voronoi_nested_circles(),
GridCases.voronoi_polygons(),
GridCases.voronoi_many_polygons(),
]
if (has_pkg("shapely", True) and has_pkg("scipy", True))
else []
),
)
def test_voronoi_grid(request, function_tmpdir, grid_info):
name = (
Expand Down
4 changes: 2 additions & 2 deletions autotest/test_modflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ def test_load_with_list_reader(function_tmpdir):
@requires_exe("mf2005")
@pytest.mark.parametrize(
"container",
["recarray", "dataframe", "dict_of_recarray", "dict_of_dataframe"]
["recarray", "dataframe", "dict_of_recarray", "dict_of_dataframe"],
)
def test_pkg_data_containers(function_tmpdir, container):
"""Test various containers for package data (list, ndarray, recarray, dataframe, dict of such)"""
Expand All @@ -1304,7 +1304,6 @@ def test_pkg_data_containers(function_tmpdir, container):

name = "pkg_data"
ws = function_tmpdir


# create the ghbs
ghb_ra = ModflowGhb.get_empty(20)
Expand Down Expand Up @@ -1360,6 +1359,7 @@ def test_pkg_data_containers(function_tmpdir, container):
m.write_input()
success, buff = m.run_model(silent=False, report=True)
from pprint import pformat

assert success, pformat(buff)


Expand Down
21 changes: 11 additions & 10 deletions autotest/test_obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import numpy as np
import pytest
import flopy
from modflow_devtools.markers import requires_exe

import flopy
from flopy.modflow import (
HeadObservation,
Modflow,
Expand All @@ -20,7 +20,6 @@
from flopy.utils.observationfile import Mf6Obs



@requires_exe("mf2005")
def test_hob_simple(function_tmpdir):
"""
Expand Down Expand Up @@ -463,21 +462,23 @@ def test_duplicate_observation_names(function_tmpdir):
top = 10
botm = [0, -10]

dis = flopy.mf6.ModflowGwfdis(gwf, nlay=nlay, nrow=nrow, ncol=ncol, top=top,
botm=botm)
dis = flopy.mf6.ModflowGwfdis(
gwf, nlay=nlay, nrow=nrow, ncol=ncol, top=top, botm=botm
)
ic = flopy.mf6.ModflowGwfic(gwf, strt=top)
npf = flopy.mf6.ModflowGwfnpf(gwf, k=1, k33=1)
sto = flopy.mf6.ModflowGwfsto(gwf)
obs = flopy.mf6.ModflowUtlobs(
gwf,
continuous={"repeat_obs.csv": [
("obsdup", "HEAD", (0, 4, 4)),
("obsdup", "HEAD", (1, 4, 4))
]
}
continuous={
"repeat_obs.csv": [
("obsdup", "HEAD", (0, 4, 4)),
("obsdup", "HEAD", (1, 4, 4)),
]
},
)

spd = {0: [((1, 4, 4), -50.)]}
spd = {0: [((1, 4, 4), -50.0)]}
wel = flopy.mf6.ModflowGwfwel(gwf, stress_period_data=spd)
sim.write_simulation()
sim.run_simulation()
Expand Down
5 changes: 5 additions & 0 deletions flopy/mf6/data/dfn/exg-gwfgwf.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ reader urword
optional true
longname keyword to print input to list file
description keyword to indicate that the list of exchange entries will be echoed to the listing file immediately after it is read.
mf6internal iprpak

block options
name print_flows
Expand All @@ -34,6 +35,7 @@ reader urword
optional true
longname keyword to print gwfgwf flows to list file
description keyword to indicate that the list of exchange flow rates will be printed to the listing file for every stress period in which ``SAVE BUDGET'' is specified in Output Control.
mf6internal iprflow

block options
name save_flows
Expand All @@ -42,6 +44,7 @@ reader urword
optional true
longname keyword to save GWFGWF flows
description keyword to indicate that cell-by-cell flow terms will be written to the budget file for each model provided that the Output Control for the models are set up with the ``BUDGET SAVE FILE'' option.
mf6internal ipakcb

block options
name cell_averaging
Expand Down Expand Up @@ -207,6 +210,7 @@ reader urword
optional true
longname activate interface model on exchange
description activates the interface model mechanism for calculating the coefficients at (and possibly near) the exchange. This keyword should only be used for development purposes.
mf6internal dev_ifmod_on

# --------------------- exg gwfgwf dimensions ---------------------

Expand All @@ -224,6 +228,7 @@ description keyword and integer value specifying the number of GWF-GWF exchanges
block exchangedata
name exchangedata
type recarray cellidm1 cellidm2 ihc cl1 cl2 hwva aux boundname
shape (nexg)
reader urword
optional false
longname exchange data
Expand Down
5 changes: 5 additions & 0 deletions flopy/mf6/data/dfn/exg-gwtgwt.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ reader urword
optional true
longname keyword to print input to list file
description keyword to indicate that the list of exchange entries will be echoed to the listing file immediately after it is read.
mf6internal iprpak

block options
name print_flows
Expand All @@ -50,6 +51,7 @@ reader urword
optional true
longname keyword to print gwfgwf flows to list file
description keyword to indicate that the list of exchange flow rates will be printed to the listing file for every stress period in which ``SAVE BUDGET'' is specified in Output Control.
mf6internal iprflow

block options
name save_flows
Expand All @@ -58,6 +60,7 @@ reader urword
optional true
longname keyword to save GWFGWF flows
description keyword to indicate that cell-by-cell flow terms will be written to the budget file for each model provided that the Output Control for the models are set up with the ``BUDGET SAVE FILE'' option.
mf6internal ipakcb

block options
name adv_scheme
Expand Down Expand Up @@ -168,6 +171,7 @@ reader urword
optional true
longname activate interface model on exchange
description activates the interface model mechanism for calculating the coefficients at (and possibly near) the exchange. This keyword should only be used for development purposes.
mf6internal dev_ifmod_on

# --------------------- exg gwtgwt dimensions ---------------------

Expand All @@ -185,6 +189,7 @@ description keyword and integer value specifying the number of GWT-GWT exchanges
block exchangedata
name exchangedata
type recarray cellidm1 cellidm2 ihc cl1 cl2 hwva aux boundname
shape (nexg)
reader urword
optional false
longname exchange data
Expand Down
14 changes: 14 additions & 0 deletions flopy/mf6/data/dfn/gwf-chd.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ reader urword
optional true
longname print input to listing file
description REPLACE print_input {'{#1}': 'constant-head'}
mf6internal iprpak

block options
name print_flows
Expand All @@ -44,6 +45,7 @@ reader urword
optional true
longname print CHD flows to listing file
description REPLACE print_flows {'{#1}': 'constant-head'}
mf6internal iprflow

block options
name save_flows
Expand All @@ -52,6 +54,7 @@ reader urword
optional true
longname save CHD flows to budget file
description REPLACE save_flows {'{#1}': 'constant-head'}
mf6internal ipakcb

block options
name ts_filerecord
Expand Down Expand Up @@ -128,6 +131,15 @@ optional false
longname obs6 input filename
description REPLACE obs6_filename {'{#1}': 'constant-head'}

# dev options
block options
name dev_no_newton
type keyword
reader urword
optional true
longname turn off Newton for unconfined cells
description turn off Newton for unconfined cells
mf6internal inewton

# --------------------- gwf chd dimensions ---------------------

Expand Down Expand Up @@ -162,6 +174,7 @@ shape (maxbound)
reader urword
longname
description
mf6internal spd

block period
name cellid
Expand Down Expand Up @@ -195,6 +208,7 @@ optional true
time_series true
longname auxiliary variables
description REPLACE aux {'{#1}': 'constant head'}
mf6internal auxvar

block period
name boundname
Expand Down
4 changes: 2 additions & 2 deletions flopy/mf6/data/dfn/gwf-disu.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ name vertices
type recarray iv xv yv
shape (nvert)
reader urword
optional false
optional true
longname vertices data
description

Expand Down Expand Up @@ -219,7 +219,7 @@ name cell2d
type recarray icell2d xc yc ncvert icvert
shape (nodes)
reader urword
optional false
optional true
longname cell2d data
description

Expand Down
Loading

0 comments on commit d3e8a2a

Please sign in to comment.