Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
f8637e7
ci(release): update version strings
wpbonelli Feb 6, 2026
a24571c
Merge pull request #2707 from modflowpy/post-release-3.10.0-reset
wpbonelli Feb 7, 2026
60c2697
chore(deps): bump dawidd6/action-download-artifact from 14 to 15 (#2713)
dependabot[bot] Feb 19, 2026
7746e09
fix(model_splitter): fix spurious ssm creation (#2716)
wpbonelli Feb 25, 2026
1b72355
chore(deps): bump dawidd6/action-download-artifact from 15 to 16 (#2719)
dependabot[bot] Feb 26, 2026
8cfa2e2
chore(deps): bump actions/upload-artifact from 6 to 7 (#2721)
dependabot[bot] Feb 27, 2026
ef59774
chore(deps): bump actions/download-artifact from 7 to 8 (#2720)
dependabot[bot] Feb 27, 2026
2ac89a2
chore(dependencies): support pandas 3 (#2723)
wpbonelli Feb 27, 2026
26855e7
chore(dependencies): exclude modflow-devtools 1.9.0 (#2725)
wpbonelli Mar 4, 2026
224432b
fix(UcnFile): Add check for modflow-6 GWT concentration file header t…
jlarsen-usgs Mar 5, 2026
140e952
chore(deps): bump dawidd6/action-download-artifact from 16 to 17 (#2729)
dependabot[bot] Mar 14, 2026
066270c
fix: wipe toml dfn dir before regenerating mf6 module (#2730)
wpbonelli Mar 14, 2026
10031ad
chore(deps): bump dawidd6/action-download-artifact from 17 to 18 (#2731)
dependabot[bot] Mar 16, 2026
20ce356
fix(vtk): fix add_pathline_points prt data handling (#2732)
wpbonelli Mar 18, 2026
705b271
chore(deps): bump dawidd6/action-download-artifact from 18 to 19 (#2734)
dependabot[bot] Mar 19, 2026
11432e4
fix(vtk): transpose vector before numpy_to_vtk (#2733)
wpbonelli Mar 19, 2026
c80fc6c
fix(model_splitter): multiple bug fixes (#2728)
jlarsen-usgs Mar 23, 2026
f0c0432
fix(mp7particledata): to_prp bug fix (#2737)
kallejahn Mar 26, 2026
741ee84
chore(deps): bump codecov/codecov-action from 5 to 6 (#2739)
dependabot[bot] Mar 27, 2026
269abdc
chore(deps): bump mamba-org/setup-micromamba from 1 to 3 (#2740)
dependabot[bot] Mar 27, 2026
671bb0b
chore(deps): bump prefix-dev/setup-pixi from 0.9.4 to 0.9.5 (#2741)
dependabot[bot] Apr 1, 2026
cbc6e86
chore(deps): bump dawidd6/action-download-artifact from 19 to 20 (#2743)
dependabot[bot] Apr 3, 2026
e6951c4
feat(binaryfile): add write methods (#2722)
wpbonelli Apr 10, 2026
6be21ac
fix(mfpackage): clear timeseries files on ts initialize (#2749)
wpbonelli Apr 16, 2026
71c82d8
feat(mve): add support for gwe-gwe exchanges that include mve package…
emorway-usgs Apr 22, 2026
6888032
update(_remap_array): support non-layered external data (#2747)
jlarsen-usgs Apr 22, 2026
5ab303d
chore(deps): bump dawidd6/action-download-artifact from 20 to 21 (#2751)
dependabot[bot] Apr 29, 2026
2eaad43
ci: drop setup-micromamba (#2753)
wpbonelli May 10, 2026
66b4423
fix(mnw1): fix mnw1 load (#2752)
jdhughes-dev May 10, 2026
3405517
Feat(hfb_util): add method for creating HFBs (#2745)
jlarsen-usgs May 11, 2026
b2ceda3
update(intersect): update days calculation to fix dropped precision (…
jlarsen-usgs May 12, 2026
fe620d5
test(get-modflow): accommodate zonbud3 -> zonbud rename (#2756)
wpbonelli May 14, 2026
9bc7aac
test: accommodate slight triangle grid variations (#2757)
wpbonelli May 16, 2026
0eaf138
chore(deps): bump prefix-dev/setup-pixi from 0.9.5 to 0.9.6 (#2759)
dependabot[bot] May 24, 2026
e9f513d
test: relax grid comparison (#2760)
wpbonelli May 26, 2026
579507e
update(splitter): updates for advanced transport packages (#2761)
jdlarsen-UA May 28, 2026
866bb58
update(ModflowWel): add basic support for mfnwt tabfile based well fi…
jlarsen-usgs May 28, 2026
c4d445e
fix(mf6): defensive devtools compatibility fix (#2762)
wpbonelli Jun 2, 2026
140d5c2
chore(deps): bump codecov/codecov-action from 6 to 7 (#2764)
dependabot[bot] Jun 8, 2026
8a2d055
fix(GeoSpatialUtil): accommodate stricter pyshp API (#2765)
wpbonelli Jun 8, 2026
c27af43
fix(mfdataplist): raise proper MFDataException on wrong col count (#2…
wpbonelli Jun 8, 2026
228668c
fix(mfdataplist): accept DataFrame with tuple cellid (#2767)
wpbonelli Jun 9, 2026
6a5d271
fix(model_attributes_to_shapefile): use modelgrid kwarg if provided (…
wpbonelli Jun 9, 2026
8d5c410
fix(model_splitter): copy on boundname remap (#2769)
wpbonelli Jun 9, 2026
60db7e7
fix(mfusgt): fix multiple bugs (#2770)
wpbonelli Jun 10, 2026
6910978
fix(mf6-dis): auto-set max_columns_of_data to ncol for external write…
wpbonelli Jun 12, 2026
7465a32
fix(CellBudgetFile): trap OSError when detecting precision (#2772)
wpbonelli Jun 17, 2026
6cafcf2
chore(deps): bump actions/checkout from 6 to 7 (#2773)
dependabot[bot] Jun 19, 2026
018bd9c
fix(mfdataplist): fix multiple issues (#2775)
wpbonelli Jun 29, 2026
0980606
feat(cellbudgetfile): support aux vars with full3D in get_data() (#2776)
wpbonelli Jun 29, 2026
012d0f1
chore(deps): bump prefix-dev/setup-pixi from 0.9.6 to 0.10.0 (#2777)
dependabot[bot] Jun 30, 2026
079298e
mfgrdfile: add version and crs properties (#2711)
mjreno Jun 30, 2026
7c71712
mfgrdfile: export follow-on (#2779)
mjreno Jul 1, 2026
38b6a10
fix(rasters): accommodate rasterio>=1.5 (#2781)
wpbonelli Jul 11, 2026
085e6a1
feat(gnc): add ghost node correction data generation (#2787)
jdhughes-dev Aug 4, 2026
4c8c523
feat(gridgen): build GNC package input from gridgen output (#2789)
jdhughes-dev Aug 5, 2026
5cc7204
feat(lgr): add ghost node correction data for a GWF-GWF exchange (#2790)
jdhughes-dev Aug 5, 2026
39aaa73
update(PlotCrossSection): add additional flexibility to cross section…
jlarsen-usgs Aug 5, 2026
8e8feaf
feat(lakpak_utils): add support for VertexGrid embedded lakes (#2786)
afc98 Aug 5, 2026
d165731
docs(create_rstfiles): order the notebook galleries by when a noteboo…
jdhughes-dev Aug 5, 2026
d0bd367
docs(lakpak_utils): add embedded lake connection examples (#2793)
jdhughes-dev Aug 5, 2026
c07f86d
chore: Deprecation warnings maintenance: (#2794)
jlarsen-usgs Aug 5, 2026
1885436
fix(autotest): skip tests that need an optional dependency (#2797)
jdhughes-dev Aug 7, 2026
8c0059d
fix(autotest): skip export tests that need geopandas (#2800)
jdhughes-dev Aug 7, 2026
79a031a
fix(zonebudget_example): index the budget values by position (#2801)
jdhughes-dev Aug 7, 2026
74d7b9e
fix(vtk): transpose the vector after the point scalar expansion (#2799)
jdhughes-dev Aug 7, 2026
7732f39
chore: improve license metadata (PEP 639) (#2783)
mwtoews Aug 7, 2026
3b5ed8a
chore(deps): bump prefix-dev/setup-pixi from 0.10.0 to 0.10.1 (#2802)
dependabot[bot] Aug 11, 2026
9b617b2
test(binaryfile): move markers from fixture to test (#2803)
wpbonelli Aug 11, 2026
78ab37d
fix(mf6): omit removed fields from generated code (#2804)
wpbonelli Aug 12, 2026
e949c41
chore(get-modflow): workaround broken local CA trust store (#2806)
wpbonelli Aug 12, 2026
b8dfaeb
feat(dis_properties): add grid method to get discretization propertie…
jlarsen-usgs Aug 12, 2026
38acfae
fix(get-modflow): use urlopen for download (#2807)
wpbonelli Aug 12, 2026
301eb8f
chore: use dependency groups (#2809)
mwtoews Aug 13, 2026
99982f5
test: add missing shapely requires_pkg markers (#2810)
wpbonelli Aug 13, 2026
081bb9d
docs(examples): fix multiple example notebooks (#2811)
wpbonelli Aug 13, 2026
a222eba
fix(mfusglpf): fix condition for richards laytyp check (#2812)
martinvonk Aug 13, 2026
7868ed3
chore(deps): bump dawidd6/action-download-artifact from 21 to 23 (#2815)
dependabot[bot] Aug 18, 2026
fa1ecc9
chore(dependencies): bump min python to 3.11 (#2817)
wpbonelli Aug 18, 2026
65b6c55
fix(crosssection): make view x/y override symmetric, validate input (…
wpbonelli Aug 19, 2026
6c8b29b
fix(utils): fix zone off-by-one, add test for #2612 (#2818)
wpbonelli Aug 20, 2026
7a6af59
test(markers): fix the scikit-learn requires_pkg marker (#2821)
jdhughes-dev Aug 23, 2026
fe600ab
ci(optional): stop uv run from reinstalling the removed dependencies …
jdhughes-dev Aug 23, 2026
e81048a
chore(deps): bump dawidd6/action-download-artifact from 23 to 24 (#2830)
dependabot[bot] Aug 24, 2026
2dcc3b9
chore(deps): bump pyvista/setup-headless-display-action from 4 to 5 (…
dependabot[bot] Aug 24, 2026
b4b5431
ci(commit): add optional dependencies to the pixi environment (#2822)
jdhughes-dev Aug 24, 2026
4366f69
chore(deps): bump prefix-dev/setup-pixi from 0.10.1 to 0.10.2 (#2832)
dependabot[bot] Aug 31, 2026
73af2a7
fix(binarygrid_util): restore top assignment dropped with reshape (#2…
wpbonelli Aug 31, 2026
d9517a8
test(get-modflow): remove mac.zip from expected assets (#2835)
wpbonelli Sep 3, 2026
3a54703
chore(mf6): regenerate mf6 modules (#2834)
wpbonelli Sep 3, 2026
80e2d13
ci(release): set version to 3.11.0, update components from DFN files,…
github-actions[bot] Sep 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 189 additions & 0 deletions .docs/Notebooks/dis_lake_connections_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# ---
# jupyter:
# jupytext:
# notebook_metadata_filter: all
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.5
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# metadata:
# section: mf6
# authors:
# - name: Joseph Hughes
# ---

# # Embedded Lake Connections for a Structured Grid
#
# A lake embedded in the model domain replaces the cells it occupies, so the MODFLOW 6 Lake (LAK) Package needs a connection to every active cell that touches it. `get_lak_connections()` builds those connections from an array of lake numbers, and returns the idomain with the lake cells deactivated, the number of connections in each lake, and the connectiondata block for the package.
#
# We build a lake embedded in one layer of a structured grid, and put the simulated lake stage into the head array so that a single map shows the water surface. The companion notebook does the same thing on a vertex grid.

# +
import sys
from tempfile import TemporaryDirectory

import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np

import flopy
from flopy.discretization import StructuredGrid
from flopy.mf6.utils import get_lak_connections

print(sys.version)
print(f"numpy version: {np.__version__}")
print(f"matplotlib version: {mpl.__version__}")
print(f"flopy version: {flopy.__version__}")
# -

# ## Build the grid and the lake
#
# We use a grid of two layers with 7 rows and 7 columns. The lake occupies a three by three block in the upper layer, and is given lake number 0. Cells that are not part of a lake are masked.

# +
nlay, nrow, ncol = 2, 7, 7
delr = delc = np.full(7, 100.0)
top = np.full((nrow, ncol), 10.0)
botm = np.array([np.full((nrow, ncol), 0.0), np.full((nrow, ncol), -10.0)])

modelgrid = StructuredGrid(delr=delr, delc=delc, top=top, botm=botm, nlay=nlay)

lake_map = np.full((nlay, nrow, ncol), -1, dtype=np.int32)
lake_map[0, 2:5, 2:5] = 0
lake_map = np.ma.masked_where(lake_map < 0, lake_map)

print(f"Lake cells in layer 1: {(~lake_map.mask[0]).sum()}")
# -

# ## Build the lake connections
#
# The lake map is the same shape as the model grid, so the lake is embedded rather than sitting on top of the model. We give the same bed leakance to every connection.

# +
idomain, connection_dict, connectiondata = get_lak_connections(
modelgrid,
lake_map,
idomain=np.ones((nlay, nrow, ncol), dtype=int),
bedleak=0.1,
)

print(f"Connections in each lake: {connection_dict}")
print(f"connectiondata rows: {len(connectiondata)}")
# -

# A connection is horizontal where the lake meets a cell in the same layer, and vertical where it sits on the cell below. The three by three lake has twelve cells around its perimeter and nine beneath it.

# +
claktype = [row[3] for row in connectiondata]
for kind in ("horizontal", "vertical"):
print(f"{kind:12s}{claktype.count(kind)}")

print()
print("lakeno iconn cellid claktype bedleak connlen connwidth")
for row in connectiondata[:4]:
lakeno, iconn, cellid, kind, leak, _, _, connlen, connwidth = row
print(
f"{lakeno:6d}{iconn:6d} {cellid!s:15s} {kind:12s}"
f"{leak:8.2f}{connlen:9.1f}{connwidth:10.1f}"
)
# -

# The cells the lake occupies are deactivated in the returned idomain, so the lake replaces them rather than sharing the domain with them.

print(f"idomain in the lake cells: {np.unique(idomain[0, 2:5, 2:5])}")
print(f"active cells remaining : {(idomain > 0).sum()} of {idomain.size}")

# ## Run the model
#
# The connectiondata and the idomain go straight into the MODFLOW 6 model. We
# set constant heads on the left and right edges to drive flow across the lake.

# +
temp_dir = TemporaryDirectory()
name = "dis_lake"

sim = flopy.mf6.MFSimulation(sim_name=name, sim_ws=temp_dir.name, exe_name="mf6")
flopy.mf6.ModflowTdis(sim)
flopy.mf6.ModflowIms(
sim,
linear_acceleration="bicgstab",
outer_dvclose=1e-9,
inner_dvclose=1e-10,
outer_maximum=200,
)
gwf = flopy.mf6.ModflowGwf(sim, modelname=name, newtonoptions="newton under_relaxation")
flopy.mf6.ModflowGwfdis(
gwf,
nlay=nlay,
nrow=nrow,
ncol=ncol,
delr=delr,
delc=delc,
top=top,
botm=botm,
idomain=idomain,
)
flopy.mf6.ModflowGwfic(gwf, strt=8.0)
flopy.mf6.ModflowGwfnpf(gwf, icelltype=1, k=10.0)
flopy.mf6.ModflowGwfchd(
gwf,
stress_period_data=[[(0, i, 0), 9.0] for i in range(nrow)]
+ [[(0, i, ncol - 1), 6.0] for i in range(nrow)],
)
lak = flopy.mf6.ModflowGwflak(
gwf,
stage_filerecord=f"{name}.lak.stage.bin",
nlakes=1,
packagedata=[[0, 7.5, connection_dict[0]]],
connectiondata=connectiondata,
perioddata={0: [[0, "rainfall", 0.001]]},
)
flopy.mf6.ModflowGwfoc(gwf, head_filerecord=f"{name}.hds", saverecord=[("HEAD", "ALL")])

sim.write_simulation(silent=True)
success, buff = sim.run_simulation(silent=True)
assert success, "\n".join(buff[-15:])
print("model converged")
# -

# ## Put the lake stage into the head array
#
# The lake cells are inactive, so the head array has no value there. We fill
# those cells with the stage of the lake that occupies them, which gives a
# single array of the water surface that can be plotted in one pass.

# +
head = gwf.output.head().get_data()
stage = lak.output.stage().get_data().flatten()
for lake_number in np.unique(lake_map.compressed()):
head[lake_map == lake_number] = stage[lake_number]

print(f"lake stage: {stage[0]:.3f}")
print(f"cells with no head value: {(np.abs(head) > 1e29).sum()}")
print(f"head range: {head.min():.3f} to {head.max():.3f}")
# -

# ## Head map
#
# The lake reads as part of the water surface rather than as a hole in it.

# +
fig, ax = plt.subplots(figsize=(6, 6))
ax.set_aspect("equal")
pmv = flopy.plot.PlotMapView(modelgrid=modelgrid, ax=ax, layer=0)
cb = pmv.plot_array(head[0])
pmv.plot_grid(colors="0.5", lw=0.5)
pmv.contour_array(head[0], colors="white", linewidths=1.0)
ax.set_title("Head with the lake stage embedded")
fig.colorbar(cb, ax=ax, shrink=0.7, label="head")
# -

try:
temp_dir.cleanup()
except (PermissionError, NotADirectoryError):
pass
4 changes: 2 additions & 2 deletions .docs/Notebooks/dis_triangle_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@
sim,
print_option="SUMMARY",
complexity="complex",
outer_hclose=1.0e-8,
inner_hclose=1.0e-8,
outer_dvclose=1.0e-8,
inner_dvclose=1.0e-8,
)
cell2d = tri.get_cell2d()
vertices = tri.get_vertices()
Expand Down
Loading