Skip to content

About

HydroPol2D: a MATLAB model of floods and water quality, from rain to runoff, groundwater and pollutants. Free and open source (GPL-3.0).

Topics

Resources

Stars

16 stars

Watchers

1 watching

Forks

Latest commit

 

History

314 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HydroPol2D: a distributed hydrologic-hydrodynamic framework for coupled surface-subsurface processes

GitHub stars GitHub forks GitHub watchers

Latest version Last commit Commit activity Open issues License: GPL-3.0 MATLAB R2020a or newer Documentation HydroPol2D Studio HydroPol2D paper

Documentation · Quick start · Examples · Gallery · Studio and Case Builder · Licenses · Cite

HydroPol2D is a computer model of floods and water quality. It follows rain across a landscape, cell by cell. It computes how much water plants and snow hold, how much soaks into the soil and reaches the groundwater, and where the rest flows, how deep it gets and what pollutants it carries. It works for cities, suburbs and rural catchments, including places with few measurements. This repository is the MATLAB version of the model. It is free and open source.

Animated maps of eight synchronized HydroPol2D outputs for a 10 m simulation of Stanford campus
Stanford campus, CA, simulated on a 10 m grid. Top: flood depth, flow speed, flood hazard and water level. Bottom: infiltration, rainfall, groundwater depth and groundwater recharge. Click for the full video.

What it does

Six questions, the part of the model that answers each and the outputs that show it: surface flow, rain to runoff, snow, groundwater, people at risk and water quality

Area What HydroPol2D computes
Flood flow Water flowing over the land and in rivers. Five ways to compute it are available. The default is local inertial.
Rain to runoff Rain caught by leaves, snow that builds up and melts, evaporation and plant water use, and water soaking into three soil layers.
Groundwater The water table, groundwater flow between cells, a deep aquifer and water exchange with rivers.
Structures Reservoirs and gates, dam breaks, storm drains, detention ponds and green infrastructure such as rain gardens.
Water quality and risk Pollutants that build up on surfaces and wash off with runoff, and the risk for people standing in floodwater.
Grids and computers A regular grid or a flexible mesh. It runs on a normal computer or on an NVIDIA graphics card, and its time step adapts so that water is conserved.
Outputs Maps (GeoTIFF), animations (MP4), hydrographs and water balances (CSV), and figures (PDF and PNG).

Quick start

git clone https://github.com/marcusnobrega-eng/HydroPol2D.git

Open MATLAB in the HydroPol2D folder and run an example:

run('Examples/VTilted_Excel/run_excel.m')   % a simple synthetic catchment, about 3 min
run('Examples/Stanford/run_excel.m')        % San Francisquito Creek, CA, about 14 min

You need MATLAB R2020a or newer with the Mapping Toolbox and the Image Processing Toolbox. Runs on a graphics card also need the Parallel Computing Toolbox and an NVIDIA card. Terrain smoothing needs the Optimization Toolbox.

Your own case is one Excel workbook. Copy Input_Data_Sheets/HydroPol2D_Inputs.xlsx, fill in its tabs and run run_HydroPol2D.m. As supplied, the workbook runs the 30 m San Francisquito Creek example on the CPU (Input_Data_Sheets/Readme.txt). The website explains every tab, with a picture of each one, in Case Workbook Settings and Run from Excel. For automated studies, a script can replace the workbook (Config/input_data_bypass_script.m).

Examples you can run

Example Run in MATLAB What it shows Time Expected results
V-tilted catchment (synthetic) run('Examples/VTilted_Excel/run_excel.m') 10.8 mm/h of rain for 90 min, 180 min simulated, on a regular grid or a mesh ~3 min rain 16.20 mm, peak outflow 1.525 m³/s, runoff coefficient 0.94, maximum depth 0.15 m
San Francisquito Creek, CA (30 m grid) run('Examples/Stanford/run_excel.m') 100 mm/h of rain for 1 h on a 157 km² catchment, 180 min simulated ~14 min rain 99.97 mm, peak outflow across the domain edge 402.8 m³/s, runoff coefficient 0.16, maximum depth 5.87 m
One check per process each case's run script about 80 small synthetic cases, each with a pass or fail rule 1-10 min each Validation_Cases.csv

Each example writes its results to its own Outputs/ folder. A 24 h version of the Stanford case, with maps and a video, is on the website.

Gallery

Results from studies. Their inputs are not in this repository.

Animated flood simulation of an urban catchment
A 50-year storm over an urban catchment with storm drains, São Paulo, Brazil
Dam-break flood over a city
A full dam break over a city in Pernambuco, Brazil

A rainfall-runoff event in a catchment near Palo Alto, CA

stanford_lidar.mp4

A 22-day simulation with rainfall that varies in space (MSWEP), Pune, India

pune.mp4

The HydroPol2D family

Product What it is License
HydroPol2D (MATLAB) This repository. The model's source code in MATLAB. You prepare a case in an Excel workbook and run it in MATLAB. Free and open source (GPL-3.0)
HydroPol2D Studio A desktop app for Mac and Windows. You build a model on a map, run it, calibrate it and view the results in one window, with no MATLAB and no coding. It runs the Python version of the model. Proprietary, needs a license code
HydroPol2D Case Builder A tool that prepares a ready-to-run case for a city or a catchment from public global data: the model area, terrain, rivers, land use, soil, rain and weather. It writes cases for this MATLAB version and for the Python version. Proprietary, needs a license code

Maps, parameter tables, forcing and settings make one case, which HydroPol2D Studio or HydroPol2D (MATLAB) runs into maps, time series, animations and a results package

Licenses

  • HydroPol2D (MATLAB) is free under the GNU General Public License v3.0. You may use, study, change and share it. Software that you distribute and that is built on it must stay open source under the same license. The bundled TopoToolbox code keeps its own GPL-3.0 license (third_party/NOTICE.md).
  • HydroPol2D Studio and HydroPol2D Case Builder are proprietary. To get a license, write to Marcus N. Gomes Jr. at marcusnobrega.engcivil@gmail.com. Studio downloads are on its release page.

Repository layout

Path Contents
run_HydroPol2D.m Main script. It reads the case workbook and runs the model. HydroPol2D_V115.m, its former name, still works.
HydroPol2D_Functions/ Model code
Input_Data_Sheets/ Case workbook template
Config/ Script settings for automated studies
Examples/ Examples you can run
Validation/ Process checks with pass or fail rules
Applications/ Cluster (SLURM) template and dam-case runners
tools/ Workbook builder, which converts older General_Data.xlsx cases, and other tools
third_party/ Bundled TopoToolbox terrain code

Documentation

The HydroPol2D website, in English, Portuguese and Spanish, has the full manual: getting started, inputs, case workbook, theory, validation, Studio, Case Builder and the changelog.

Versions

This repository is at v1.19.0-rc2 (release notes), a release candidate. It matches HydroPol2D Studio 0.9.0rc2. Version v1.17.0 stays the stable reference until the last hardware and packaging checks pass.

Data sources of the examples

  • San Francisquito Creek, terrain: USGS 3D Elevation Program (3DEP), 10 m averaged to 30 m (Examples/Stanford/Static/DEM.tif) and 10 m (Examples/Stanford/Static_10m_LiDAR), U.S. public domain.
  • San Francisquito Creek, land use: ESA WorldCover 2020 (v100), CC BY 4.0. © ESA WorldCover project 2020 / Contains modified Copernicus Sentinel data (2020) processed by ESA WorldCover consortium. The class codes 10 to 90 and their names in the land-use table are WorldCover's.
  • San Francisquito Creek, other maps: single values set for the example (soil class 8, depth to bedrock 1.5 m, LAI 1, albedo 0.25, initial soil moisture 0.1104).
  • V-tilted catchment: all inputs are generated by prepare_standard_case.m.

Cite

If you use HydroPol2D, please cite:

More publications using HydroPol2D

Contact

Dr. Marcus N. Gomes Jr., mngomes@stanford.edu. Please report bugs and ask questions as GitHub issues. For licenses and for a short course (2-hour classes with slides), write to marcusnobrega.engcivil@gmail.com.

Acknowledgments: University of São Paulo, São Carlos School of Engineering. University of Texas at San Antonio, Civil and Environmental Engineering. Stanford University, Stanford Doerr School of Sustainability, Department of Earth System Science.

About

HydroPol2D: a MATLAB model of floods and water quality, from rain to runoff, groundwater and pollutants. Free and open source (GPL-3.0).

Topics

Resources

Stars

16 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages