Free for humans·Paid for agents · x402
Climate TechRank #10 · 2026-W38

DiffSWE2d: a differentiable Shallow Water Equations solver for end-to-end flood and tsunami modelling

arXiv:2609.11426

Zhonghou Xu

Solving inverse and optimisation problems with traditional shallow water equations (SWE) solvers can be computationally expensive, particularly when gradients with respect to model inputs or parameters must be estimated through repeated forward simulations. In this paper, we introduce DiffSWE2d, an open-source differentiable shallow water equations solver for end-to-end flood and tsunami modelling implemented in PyTorch. By leveraging automatic differentiation, DiffSWE2d represents the time-marching physics as a differentiable computational graph, enabling gradients to be propagated directly through the numerical solver. We validate the solver against two established benchmark cases and demonstrate its application to tsunami waveform inversion, showing its ability to infer model inputs through gradient-based optimisation. DiffSWE2d provides a flexible framework for integrating physics-based hydrodynamic modelling with modern optimisation and machine learning methods. The source code and reproducible examples are publicly available at: https://github.com/ZhonghouXu/DiffSWE2d