MODFLOW SWMOD (swmod)
swmod is a Python package for coupling custom, physically coherent surface water network models (nodes, channel reaches, control weirs) with MODFLOW 6 groundwater flow models using the MODFLOW API (modflowapi) and FloPy.
Package Purpose & Scope
swmod is specifically designed for regional groundwater-surface water interaction modeling:
-
Steady-State & Long Time-Step Coupling: Targeted at regional studies operating over daily, monthly, or steady-state stress periods. Because surface water flow reaches equilibrium much faster than groundwater moves through an aquifer,
swmodsolves for steady-state surface water mass balance ($R(h) = 0$) during each coupling iteration, avoiding the computational overhead of full 1D/2D unsteady Saint-Venant solvers. -
Physically Coherent Hydraulics:
- Nodes: Lumped surface water storage bodies (lakes, ponds, reservoirs, ditch junctions, constant-head outfalls) exchanging flux with MODFLOW 6 RIV package cells.
- Reaches: Open-channel flow based on Manning's friction ($Q = C \cdot \text{sign}(\Delta h) \sqrt{|\Delta h|}$) or linear conveyance, fully integrated with groundwater exchange along their length.
- Weirs: Sharp/broad-crested control structures using a $C^1$-continuous, strictly monotonic Villemonte-type formulation combining free overflow ($Q_{\text{free}} = C_f b (h_u - z_c)^{1.5}$) with a regularized submergence factor $\phi(r)$ ($0 \le |Q| \le Q_{\text{free}}$) to guarantee smooth convergence during non-linear solver iterations.
-
GeoPandas & Area-Based Conductances: Native integration with
geopandasvector geometries (Polygons and LineStrings). Automatically computes cell intersection areas $A_{\text{intersect}}$ and RIV conductances $C_k = \frac{A_{\text{intersect}, k}}{c_{\text{bed}}}$ from riverbed resistance $c_{\text{bed}} = \frac{M}{K_{\text{bed}}}$ [days].
Requirements
- Python 3.12 or newer
Quickstart
# Install dependencies with uv
uv sync
# Download MODFLOW executables into .bin/ (required on every new machine; not stored in the repo)
uv run get-modflow .bin
# Run test suite
uv run pytest -v
# Run 4-node example
uv run python examples/two_lakes_ditch_weir.py
# Build and preview documentation locally
uv run sphinx-build -b html docs docs/_build/html
uv run python -m http.server --directory docs/_build/html 8000
Metadata
Release files for swmod 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swmod-0.0.1.tar.gz | 462.9 kB | With provenance | Details for swmod-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swmod-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for swmod-0.0.1-py3-none-any.whl |
Total release size: 533.2 kB
Release files / swmod-0.0.1.tar.gz
| Download URL | swmod-0.0.1.tar.gz |
|---|---|
| Size | 462.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30541fbb99fb25cd3ba7a6ffdc94a2395417efb116c7ac5427871ab575f16b17
|
|
BLAKE2b-256 checksum How to use checksums |
c6fcea3866b445ea7fc42be34949927d492521cd7f245d21950d0f43d0c61048
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Transparency logRelease files / swmod-0.0.1-py3-none-any.whl
| Download URL | swmod-0.0.1-py3-none-any.whl |
|---|---|
| Size | 70.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe3f6d0bd36222e2e5f39d46a5e6e0833ae72e44c1aac7d83e899483edded87f
|
|
BLAKE2b-256 checksum How to use checksums |
65f54096f6bb7993d774e2df6b4daa340ba5e116af0e79644978419318ed3a3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Transparency logSecurity for swmod 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for swmod-0.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.