Water-quality framework
openWQ
Multi-chemistry water quality for any hydrological model.
How to use it
Step-by-step guides ("openWQ in a nutshell"): install, compile, set up and run.
- Version 1Stable
Native biogeochemistry, transport and sediment modules; coupled to SUMMA, mizuRoute and CRHM.
- Version 2In development
Adds PHREEQC equilibrium chemistry, new hosts (SUMMA with internal mizuRoute, LISFLOOD), calibration and hybrid physics–ML.
What it does
openWQ is a water-quality modelling framework that plugs into existing hydrological and hydrodynamic models instead of carrying its own hydrology: the host model supplies water states and fluxes, and openWQ computes the transport and chemistry of dissolved and particulate constituents on the host's own HRUs, grid cells or river reaches. Reaction networks, loads and module choices are read from input files, so different biogeochemical hypotheses can be tested and the same set-up reused across host models without recompiling. It is used for nitrogen, oxygen, pH and major-ion studies from single basins to continental and global domains, and it is the coupler proposed for a Canadian national water-quality modelling framework (Teufel et al., 2025).
- Couples to a host through four API calls (decl, run_time_start, run_space, run_time_end), with C++, Fortran (iso_c_binding) and Python interfaces; hosts include SUMMA, mizuRoute, SUMMA with internal mizuRoute, CRHM and FLUXOS, with LISFLOOD (GloFAS) in development
- Two chemistry engines chosen per run: NATIVE_BGC_FLEX (user-written kinetic reaction networks in JSON, rate laws compiled at run time with ExprTk and able to use host variables such as temperature or soil moisture) and PHREEQC through PhreeqcRM (speciation, pH, ion exchange, minerals, gases)
- Modular transport: advection or advection–dispersion of solutes with the host's water fluxes, lateral boundary mixing, sediment transport (HYPE MMF and HBV-sed type schemes) and Freundlich/Langmuir sorption; any module can be switched off
- Loads (fertiliser, manure, deposition, effluents) and external water-flux concentrations are separate inputs (JSON, ASCII, HDF5), so loading scenarios change without touching the reaction network
- Forward Euler or SUNDIALS CVODE time integration for stiff networks; written in C++ (CMake), with Docker and Apptainer builds and Python templates for set-up, calibration and output reading
- Verified against 10 analytical unit tests (NSE 0.95 to >0.9999 in SUMMA and CRHM) and applied in a 16-basin continental nitrate benchmark across North America
Figures




Publications
- Costa, D., et al. (under review). Toward flexible and interoperable biogeochemical modeling in Earth system and hydrological models: the OpenWQ framework and a continental-domain nitrate benchmark. Under review
- Costa, D., Klenk, K., Guenter, V. (2026). OpenWQ: Open Water Quality modeling framework (v1.1.1). Zenodo (software). doi:10.5281/zenodo.23183928 Software
- Costa, D. (2026). Configuration files and scripts for the OpenWQ functional unit tests (v1.0.0). Zenodo (dataset). doi:10.5281/zenodo.23184141 Dataset
- Costa, D., Zehsaz, S., Knoben, W.J.M. (2026). Model configurations and calibration results for the OpenWQ continental-domain nitrate benchmark (v1.0.0). Zenodo (dataset). doi:10.5281/zenodo.23185771 Dataset
- Teufel, B., Bonsal, B., Clark, M., Costa, D., Fortin, V., Pietroniro, A., Spence, C., Rao, Y.R. (2025). Towards a Canadian National water quality model: challenges and opportunities. Canadian Water Resources Journal 50(4), 285–295. doi:10.1080/07011784.2025.2536031 Related
- Costa, D., Klenk, K., Knoben, W., Ireson, A., Spiteri, R.J., Clark, M. (2023). OpenWQ v.1: A multi-chemistry modelling framework to enable flexible, transparent, interoperable, and reproducible water quality simulations in existing hydro-models. EGUsphere (preprint, GMD discussion). doi:10.5194/egusphere-2023-2787 Preprint
- Costa, D., Klenk, K., Knoben, W.J.M., Ireson, A., Spiteri, R.J., Clark, M.P. (2023). A multi-chemistry modelling framework to enable flexible and reproducible water quality simulations in existing hydro-models: 1. The OpenWQ concept and the water quality modelling lab. ESS Open Archive (preprint). doi:10.22541/essoar.168718167.75677635/v1 Preprint
- Costa, D., Baulch, H., Elliott, J., Pomeroy, J., Wheater, H. (2020). Modelling nutrient dynamics in cold agricultural catchments: A review. Environmental Modelling & Software 124, 104586. doi:10.1016/j.envsoft.2019.104586 Background
The framework paper is under review; until it is published, please cite the software archive and the preprint.