Type something to search...

Two Roles that AI Can Play for Computational Hydraulics Modeling

Two Roles of AI

From my point of view, there are two genuinely useful roles that AI/ML can play in computational hydraulics modeling work (in fact, the same can be said for most computational modeling fields). One is about making your existing workflow automated, faster, and less painful. The other is more radical: replacing the physics-based model itself with a learned AI model.

This post describes both based on my own experience and research.


Role 1: Automation and Productivity Enhancement

The first role is automation. It’s about taking the repetitive, manual, click-heavy parts of hydraulics modeling and handing them off to a script, or increasingly to an AI agent.

From Clicks to Code to Agents

The evolution of hydraulics modeling workflows looks roughly like this (I am not even counting the early days of using DOS command-line to run models):

ApproachWhat it meansTrade-off
GUI operationManual, click-by-click interactionFamiliar, but slow and not reproducible
Python scriptingProgrammatic control of modelsReproducible batch runs, but requires coding
Agentic AIAI reasons, plans, and executes tasks autonomouslyEmerging—great potential, still maturing

Python scripting is already mature and practical. Tools like pyHMT2D let you control SRH-2D and HEC-RAS programmatically—preprocessing meshes, specifying boundary conditions, launching runs, converting outputs, running calibration loops—all from a script. The script becomes both documentation and tool. I have written a whole series of blog posts on that topic, starting with this one.

Where AI Specifically Helps

Two things are making this transition much easier:

Writing the scripts for you. LLMs are really good at generating Python code. If you can describe what you want, e.g., “write a script to loop over Manning’s n values from 0.025 to 0.055, run SRH-2D for each, and collect the water surface elevation at gauge point X”, a capable AI assistant can produce a working first draft. People call this “vibe coding”. You still need to understand what it writes, though. But the barrier to entry for scripting has dropped substantially.

AI Vibe Coding

Agentic workflows. The frontier, still emerging, is AI agents that can operate the entire modeling pipeline with minimal human intervention. The AI agent can reason about the modeling task and the goal given by a user, plan a sequence of actions, and execute them autonomously. Through tool-calling protocols (such as the Model Context Protocol, or MCP) and SKILLs, an AI agent can call tools in packages such as pyHMT2D, inspect results, troubleshoot errors, and make decisions on its own.

AI Agentic Workflow


Role 2: AI as the Hydraulic Model Itself

The second role is more fundamental. Instead of using AI to drive an existing physics-based model such as SRH-2D and HEC-RAS, you train AI to be the model. There are multiple approaches to this, but one prominent and easy example is to use machine learning to learn a surrogate model that approximates the input-output mapping of a physics-based hydraulics model. Once trained, the surrogate can then be used for inference much faster than the original model.

A simple example is reported in one of our early papers published in Journal of Hydraulic Engineering (Song et al., 2023). We trained an autoencoder-based surrogate on a dataset of SRH-2D simulations of flow around a bridge pier. The surrogate learned to reproduce the 2D velocity and water surface fields with good accuracy almost instantaneously.

Why We Need AI-Surrogate?

Its speed is one major advantage. The use cases that become feasible at 1,000× speedup include:

  • Real-time flood forecasting and warning systems, where you need results in seconds, not hours
  • Digital twins of water infrastructure that update continuously
  • Emergency scenario analysis during an active flood event
  • Uncertainty quantification and optimization, which require thousands of model evaluations

Despite the speedup, one severe limitation is that a surrogate trained on one river reach doesn’t automatically transfer to another. You train it for a specific geometry and a specific range of operating conditions. Outside that range, accuracy degrades. Hybrid approaches are emerging that combine physics-based models with AI surrogates to improve generalization, but this is still an active research area.

The Longer-Term Vision: Foundational AI Hydraulics Models

With the rapid advancement of AI, one natural question follows: can we build something more general? Perhaps a “foundational AI hydraulics model”? Such a model would be pre-trained on large and diverse data—terrain, bathymetry, land use, remote sensing, hydrologic observations, weather—and fine-tuned for specific downstream tasks like flood prediction, sediment transport, or infrastructure assessment. This would be, conceptually, the hydraulics equivalent of what large language models are for text: a general-purpose base that specializes to specific tasks.

It’s an ambitious target, and getting there will require community-scale data sharing, substantial compute, and close collaboration between AI researchers and hydraulics domain experts. But the pieces are beginning to come together.


Summary and Practical Advices

Both roles—automation and surrogate modeling—are moving quickly. The practical advices I would give to hydraulics modelers are:

  1. Start with scripting. If you’re not already automating your model runs with Python, that’s the first step. Tools like pyHMT2D handle the boilerplate. AI assistants can help you write the scripts. I myself haven’t written a single line of code in the past year or so; I review and test code generated by AI most of the time. It is a huge shift in the mode of my work and it is a productivity boost.

  2. Use LLMs as coding partners, not your replacement. They’re good at generating code but will make domain-specific mistakes. You need enough understanding of the hydraulics and the code to catch those. Professional responsibility is still on your shoulder, not the AI.

  3. Watch the AI-based surrogate space. For any application where you need fast and/or many model evaluations—calibration, Monte Carlo, real-time forecasting—a surrogate approach is worth considering if you have or can generate the training data.

  4. Think about the skills the field needs. The most valuable people in this emerging AI era combine domain knowledge (open-channel hydraulics, hydrology, sediment transport) with computational proficiency (numerical methods, Python, deep learning, and general AI/ML). Neither alone is sufficient.


References

Y. Song, C. Shen, X. Liu (2023). Surrogate Model for Shallow Water Equations Solvers with Deep Learning. Journal of Hydraulic Engineering., 149(11): 04023045.

Related Posts

Automating Computational Hydraulics Modeling: A Four-Part Series

Automating Computational Hydraulics Modeling: A Four-Part Series

This is a four-part series on automating computational hydraulics modeling using Python and pyHMT2D. The series will cover the following topics:[Why automate computational hydraulics modeling

read more
Automating Computational Hydraulics Modeling: Part 1-Introduction

Automating Computational Hydraulics Modeling: Part 1-Introduction

If you've ever spent an afternoon clicking through HEC‑RAS or SMS—changing Manning's n, re‑running, exporting results, t

read more
Automating Computational Hydraulics Modeling: Part 3-Automated Calibration with pyHMT2D

Automating Computational Hydraulics Modeling: Part 3-Automated Calibration with pyHMT2D

In the previous post, we saw how pyHMT2D controls HEC-RAS 2D and SRH-2D from Python and converts their results to VTK. Here we use that same mac

read more
Automating Computational Hydraulics Modeling: Part 2-Introduction to pyHMT2D

Automating Computational Hydraulics Modeling: Part 2-Introduction to pyHMT2D

In the previous post, we discussed why automation is essential for modern computational hydraulics. We established that Python provides the f

read more
Automating Computational Hydraulics Modeling: Part 4-Monte Carlo Simulation with pyHMT2D

Automating Computational Hydraulics Modeling: Part 4-Monte Carlo Simulation with pyHMT2D

In Part 2 we used pyHMT2D to control HEC-RAS 2D and SRH-2D and convert results to VTK. In [Part 3](/blog/automation_pyhmt2d/blog-3-calibration-p

read more