hydromodpy.solver.modflow_common.binaries#

Solver binary resolution and lazy download.

Downstream solvers (MODFLOW 6, MODFLOW-NWT, MODPATH, MT3D-USGS) ask for an executable by its canonical name ("mf6", "mfnwt", "mp6", "mp7", "mt3dusgs"). This module locates the file in bin_path and, when bin_path is the HydroModPy-managed cache, downloads it via flopy.utils.get_modflow if missing.

Layout#

Solvers are looked up under <bin_path>/<exe> (flat layout produced by flopy.utils.get_modflow). The managed cache lives at ~/.cache/hydromodpy/bin/ (or the platform equivalent) and a custom directory may be passed via the HMP_BIN env var or the --bindir flag of hmp install-binaries.

Versioning policy#

Once a binary lands in the managed cache we never auto-refresh it: the same MODFLOW version stays in place for the lifetime of the cache, for reproducibility (a run started today must yield the same results a year from now unless the user opts in to an upgrade). A manifest written alongside the binaries (.manifest.json) records the download date and USGS release tag. To pull newer USGS binaries, the user runs:

hmp install-binaries --upgrade

which forces a re-download and rewrites the manifest.

Functions

available_solvers()

Return the canonical names of solvers this module can fetch.

download_solver_binaries([bindir, subset, ...])

Download solver binaries via flopy.utils.get_modflow.

ensure_solver_binary(solver[, bin_path])

Resolve the exe for solver under bin_path, downloading if needed.

exe_filename(solver)

Canonical executable filename for solver on the current OS.

is_managed_cache(bin_path)

Return True when bin_path resolves to the HydroModPy cache.

locate_solver_binary(bin_path, solver)

Return the exe path under bin_path or None if missing.

managed_bin_dir()

Return the managed flat <cache>/bin/ directory, creating it on demand.

read_manifest([bindir])

Return the cache manifest dict, or None if missing/unreadable.