| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This directory hosts HydroModPy scientific validation tests.
These tests answer a different question than unit or regression tests:
In practice, a validation test is allowed to evolve internally as long as the model still reproduces the intended benchmark within explicit tolerances.
The current validation suite focuses on analytical groundwater-flow benchmarks:
At the moment:
The design intent is:
A typical validation test follows this sequence:
The launcher execution itself is handled by validation_cases.shared.runtime.run_launcher_validation_case(...).
Each validation run writes into a deterministic output directory derived from:
By default, outputs are created under the system temporary directory in hydromodpy_validation_outputs/. If HMP_OUT_PATH is defined, the run directory is created under:
<HMP_OUT_PATH>/validation/<test_name>/<case_id>
Before re-running the same case, the previous validation directory is removed. The runtime includes a small retry loop to handle transient Windows file locks.
Recommended setup:
Typical environment setup:
conda activate hydromodpy
python -m pytest tests/validation -qThe validation suite is intentionally cross-platform where possible, but not every solver backend is available on every operating system.
Today, the Linux-only PETSc coverage is concentrated in:
In practice:
During pytest execution, validation runs are launched with MPLBACKEND=Agg. Display behaviour is otherwise driven by the [display] TOML section (defaults are non-interactive and save-enabled), which keeps the tests deterministic.
Run all validation tests:
python -m pytest tests/validation -q
python -m pytest -m validation -qRun only the quick validation subset:
python -m pytest -m "validation and fast" -qRun only steady or transient cases:
python -m pytest -m "validation and steady" -q
python -m pytest -m "validation and transient" -qRun a single case:
python -m pytest tests/validation/analytical/steady/test_dupuit_fixed_head_1d.py -q
python -m pytest tests/validation/analytical/steady/test_dupuit_circular_island_ocean_2d.py -qThe repository already exposes the Linux smoke subsets used in CI:
bash tools/ci/run_boussinesq_linux_smoke.sh
bash tools/ci/run_boussinesq_petsc_smoke.shThese scripts are thin wrappers around python -m pytest ... and can be used locally on Linux as-is.
The PETSc smoke subset can also be launched directly with pytest:
python -m pytest \
tests/unit/solver/test_boussinesq_method_catalog.py \
tests/unit/validation/test_dupuit_fixed_head_petsc_alias.py \
tests/validation/analytical/steady/test_dupuit_fixed_head_petsc_1d.py \
tests/validation/numerical/transient/test_boussinesq_drying_petsc.py \
tests/validation/numerical/transient/test_boussinesq_hillslope_recharge_pulse_overflow_petsc.py \
-qThe broader non-PETSc Linux smoke subset is:
python -m pytest \
tests/unit/solver/test_boussinesq_method_catalog.py \
tests/unit/solver/test_boussinesq_smoothing.py \
tests/unit/solver/test_boussinesq_backend.py \
tests/unit/simulation/test_boussinesq_flow_adapter.py \
tests/unit/validation/test_dupuit_fixed_head_petsc_alias.py \
tests/unit/validation/test_hillslope_pulse_overflow_case.py \
"tests/validation/analytical/steady/test_dupuit_fixed_head_1d.py::test_dupuit_fixed_head_1d_matches_reference_profile[boussinesq]" \
-qThe PETSc-focused tests are now tagged with @pytest.mark.petsc, so on a fully provisioned Linux environment you can also use:
python -m pytest -m petsc -qIf you are working in a partial environment and want the narrowest possible selection, the current recommended approach is still either:
Use validation_cases.run_cases when you want to execute every compatible run_case.py sequentially, print the per-case metrics, and optionally open the diagnostic figures.
List the selected cases without running them:
python -m validation_cases.run_cases --solver modflow_nwt --regime both --list
python -m validation_cases.run_cases --solver modflow6 --regime both --listRun all steady or transient cases for one solver without interactive figures:
python -m validation_cases.run_cases --solver modflow_nwt --regime steady --no-show
python -m validation_cases.run_cases --solver modflow_nwt --regime transient --no-show
python -m validation_cases.run_cases --solver modflow6 --regime steady --no-show
python -m validation_cases.run_cases --solver modflow6 --regime transient --no-showRun the full analytical inventory for one solver:
python -m validation_cases.run_cases --solver modflow_nwt --regime both --no-show
python -m validation_cases.run_cases --solver modflow6 --regime both --no-show
python -m validation_cases.run_cases --solver boussinesq --regime both --no-showRun with diagnostic figures enabled:
python -m validation_cases.run_cases --solver modflow_nwt --regime transient --show
python -m validation_cases.run_cases --solver modflow6 --regime steady --showStop the batch on the first failing case:
python -m validation_cases.run_cases --solver modflow_nwt --regime both --no-show --stop-on-errorEvery launcher-backed case also exposes a direct runner under validation_cases/.../run_case.py.
Examples:
python -m validation_cases.analytical.steady.dupuit_fixed_head_1d.run_case
python -m validation_cases.analytical.steady.dupuit_circular_island_ocean_2d.run_case --no-showThe runner:
This is the recommended path when a pytest validation fails and you want a human-readable diagnostic first.
For the full case inventory and case-directory contract, see validation_cases/README.md.
For a case-by-case description of numerical setup, analytical target, metrics, and scientific scope, use the "Detailed Case Sheets" section in validation_cases/README.md.
Current pytest coverage is:
| Test | Regime | Main reference |
|---|---|---|
| analytical/steady/test_dupuit_fixed_head_1d.py | steady | Dupuit fixed-head profile |
| analytical/steady/test_dupuit_uniform_recharge_1d.py | steady | Dupuit recharge profile |
| analytical/steady/test_dupuit_divide_river_1d.py | steady | Dupuit divide-river profile |
| analytical/steady/test_dupuit_circular_island_ocean_2d.py | steady | radial Dupuit-Boussinesq island |
| analytical/steady/test_boussinesq_fixed_head_piecewise_k_1d.py | steady | piecewise-K Boussinesq |
| analytical/steady/test_boussinesq_uniform_recharge_piecewise_k_1d.py | steady | piecewise-K recharge |
| analytical/steady/test_boussinesq_divide_fixed_head_piecewise_k_1d.py | steady | piecewise-K divide |
| analytical/steady/test_boussinesq_hillslope_interception_1d.py | steady | Boussinesq hillslope interception |
| analytical/steady/test_boussinesq_circular_island_piecewise_k_2d.py | steady | radial piecewise-K island |
| analytical/steady/test_linearized_unconfined_drainage_1d.py | steady | linearized distributed drainage |
| analytical/steady/test_linearized_unconfined_hillslope_drainage_1d.py | steady | linearized hillslope drainage |
| analytical/transient/test_boussinesq_hillslope_recharge_step_interception_1d.py | transient | hillslope interception onset |
| analytical/transient/test_linearized_unconfined_transient_1d.py | transient | linearized recharge step / periodic recharge / boundary step / piecewise boundary / deep recharge step (parametrized) |
| analytical/transient/test_late_time_unconfined_pumping_2d.py | transient | late-time radial pumping |
Validation tests use the marker set declared in pyproject.toml:
Examples:
python -m pytest -m "validation and analytical and steady" -q
python -m pytest -m "validation and slow" -q
python -m pytest -m petsc -qEach launcher-backed case in validation_cases/ typically contains:
The corresponding pytest file should stay intentionally thin: it should call the comparison function and assert a small number of clear metrics.
Recommended workflow:
Good practice:
Common failure modes:
When a metric failure occurs, the fastest diagnostic path is usually:
| Back | FazBrowse Home | New Git URL |