DEM + SPH · one CUDA GPU · agentic

GranumFL

Grains and water, coupled on one GPU. GranumFL adds an SPH water phase to the Granum discrete element program, lays out debris flows on real terrain from a GeoTIFF, and lets an AI agent set up and read a site study through 20 MCP tools.

t 0.0 s
stage gate closed
grain front –
water front –

A 2D toy running in your browser (grains coloured by speed, water in blue). GranumFL itself is 3D WCSPH–DEM on the GPU.

1.9×10⁸SPH particle updates per second on one RTX 5090
12.2 Mwater particles in 32 GB
4.6 Mgrains coupled with 1 M water particles
20MCP tools for water and real sites
33 / 33objective checks passed by agents in 4 trials

What it does

Debris flows as grains and water, not one fluid

Depth-averaged models replace boulders and water by one continuum. GranumFL keeps the grains as discrete elements and the water as SPH particles, so the boulders that dam a channel, the pore water that drains from a deposit and the erosion of a bed all come out of the physics.

⇄

Unresolved DEM–SPH coupling

The locally averaged formulation of Robinson, Ramaioli and Luding (2014): grains smaller than the smoothing length, a porosity field, Di Felice drag and −V∇P on each grain, with the exchanged momentum balanced to round-off.

▦

Both phases on one GPU

CUDA kernels compiled at run time with NVRTC (sm_120 included). The water reads the grains from the DEM buffers on the device, so a coupled step moves no particle data to the host. The same algorithm runs on the CPU in double precision.

⛰

Real terrain in a few clicks

Open a GeoTIFF or ESRI grid, or download the Copernicus GLO-30 tile of a latitude and longitude, crop, resample and cut. WGS 84 and UTM read from the file.

◎

Hazard maps and place records

Debris thickness, erosion and deposit, peak speed, flood depth by volume, runout and travel angle, and records at named places (thickness, speed, water depth, ρv²), as PNG maps or ESRI grids for GIS.

✦

An agent can drive it

A Model Context Protocol server built into the program. The in-app agent or any MCP client sets up the site, checks the warnings, runs or exports the case and reads the results.

☁

Large cases on a GPU server

Export a case for a CUDA server, run it with one command and load its results folder back into the app. A million grains over 150 s of flow ran in 63 min on one RTX 5090.

Architecture

The app and the agent call the same functions

An engineer works in the desktop app or asks the agent; both reach the site layer, which lays out the case for the coupled solver. Large cases go to a GPU server and come back as a results folder.

Architecture: users, interfaces (desktop app, MCP server), core (site layer, solver with SPH water, coupling and DEM grains), outputs (results, GPU server)

Real terrain

From a GeoTIFF to a site study

  1. Terrain. Open an elevation model or download the GLO-30 tile, crop by bounds or by a point and a size, and cut the terrain at the cell size you choose.
  2. Source & path. Draw the source and the catchment on the plan map, trace the steepest-descent path, lay an erodible bed and channel water along it, and name places.
  3. Soil and water. Start from a material preset and a Manning surface, and read the estimates and warnings, such as a water layer thinner than two particle spacings.
  4. Run and read. Run small cases locally or export to a GPU server, then read thickness, peak speed and flood maps, place records and the travel angle.

Copernicus GLO-30 is a surface model: canopy and buildings are in its heights, so a lidar terrain model gives better flow paths where one exists.

GranumFL Output: plan map of debris thickness over shaded terrain with named places and the traced flow path
Debris thickness on the plan map, with the places and the traced path.
GranumFL Output: plan map of peak water depth by volume
Peak water depth, measured by volume so spray does not set it.

Agentic

Twenty tools, one request

In four independent trials an LLM agent, given only the engineer's request and the MCP tools, built or edited the 2026 Patong (Phuket) debris-flow site and passed all 33 objective checks, scored from the models it left. Two trials found on their own that the steepest-descent path on the surface model misses Nanai Road. Below is a replay of a real trial (T4, five tool calls).

agent trial T4 · edit an existing model

      

The tools

Connect a client


        
      

Calibration

Checked against Kratos, eight DEM codes, MercuryDPM and experiments

Each phase was compared with published results of established codes on the same problems, in the geometry of the original studies. No other code was run here, so the comparisons rest on their published numbers.

Phase and testReferenceGranumFLReference result
DEM · Chung & Ooi impacts 1–2Hertz, Kratosforce and overlap within 0.09 %exact (analytic)
DEM · Chung & Ooi oblique impactKratosrebound angle mean 0.19° above 15°–
DEM · DEM8 penetration, 25,000 grains8 open codes (Dosta et al. 2024)rebound −0.044 m in 1.1 min (RTX 5090)−0.048 to −0.024 m; 1.2–122 min
Coupled · sedimenting porous block, ε = 0.8, h/d = 2 / 5 / 6MercuryDPM (Robinson et al. 2014)−2.7 / +9.3 / +14.4 %+5 / +15 / +22 %
Coupled · porous block, ε = 0.6–0.9Robinson et al., Eq. (36)−2.7 to +5.0 %within 5 %
SPH · dam break, three resolutionsMartin & Moyce (1952)3.0–3.1 % RMS front error–
SPH · hydrostatic tankρ₀ g (H − z)0.68 % (GPU), 1.05 % (CPU)–
Comparison with the MercuryDPM SPH-DEM of Robinson et al. 2014: single grain error, porous block error against h/d, block velocity against porosity
Comparison with the reference implementation of the coupling (MercuryDPM SPH–DEM, Robinson et al. 2014), in their geometry.

Where it falls short

  • A single settling grain is accurate only for 2.5 ≤ h/d ≤ 4: its own volume lowers the porosity it sees at small h/d, and a truncated kernel weakens its buoyancy at large h/d (+8.9 % at h/d = 6, on two GPUs).
  • A dense fixed bed gives 1.5 to 3.3 times Ergun's pressure drop at h/d = 2, several times the code's own Di Felice drag, so quick conditions and liquefied beds are not yet quantitative.
  • Field cases need the coarse-grained friction, rolling resistance and cohesion calibrated against an observed runout.
Dam break surge front against Martin and Moyce
Dam break against Martin & Moyce.
Settling grain against Di Felice terminal velocity
Settling grain against Di Felice.
DEM8 penetration against eight open-source codes
DEM8 penetration against eight codes.

GPU performance

Production-class speed on one card

The water phase sustains 1.6 to 1.9×10⁸ particle updates per second from 0.2 to 12.2 million particles on an RTX 5090, 55 to 66 times 30 CPU threads of an EPYC 7502. The coupled phase advances 3.5 to 4.8×10⁷ grain steps per second up to 4.6 million grains.

For scale only: the DualSPHysics run of Crespo et al. (2015) on a GTX Titan corresponds to at least 2.9×10⁷ particle updates per second; that was older hardware and a mature, optimised code.

Throughput in particle updates per second against particle count, GPU and CPU

Download

Editions

The same coupled solver in both editions. The Education edition is free for teaching and non-commercial academic research and limits the size of a model, so it runs the bundled templates and small site studies on your own computer.

For students and teachers

Education

Free

  • Desktop app with Granum's laboratory tests and staged soil models
  • Water + grains mode: dam break, hydrostatic tank, settling, quick condition and a 25° debris-flow flume
  • Real terrain from a GeoTIFF or the Copernicus GLO-30 tile, with source, path, bed and places
  • Result maps, records at places and runout on the plan
  • AI chat assistant and built-in MCP server
Education limits Up to 50,000 grains and 50,000 water particles per water + grains case Up to 50,000 particles per discrete element model Terrain up to 1 km² in plan Calculates on your own computer: no GPU-server export, no GIS (.asc) map export Reports, maps and pictures carry an Education watermark

For teaching and non-commercial academic research. Need larger sites for your research? Ask for an Academic Research licence.

For engineering practice

Professional

On request

  • Licence for commercial and consulting projects
  • Million-grain site studies on CUDA GPUs
  • Case export for cloud GPU servers and GIS result grids
  • Dynamic granular flow in the DEM: silos, drums, impact and tamping
  • Help with calibration against observed runout
  • Technical support and training

Tell us about your project and we will reply with a licence offer.

Paper

GranumFL: an agentic, GPU-accelerated coupled DEM–SPH program for debris flows on real terrain

Sompote Youwai, King Mongkut's University of Technology Thonburi, 2026. The paper describes the unresolved DEM–SPH coupling on one CUDA GPU, the calibration of each phase against published benchmarks (Chung and Ooi impacts within 0.09 % of Hertz, DEM8 penetration within the spread of eight open-source codes, a sedimenting porous block closer to theory than the reference implementation), the cases where the coupling is not yet accurate, the GPU performance, and the agent trials that set up a site study through 20 MCP tools.

Cite GranumFL
@misc{youwai2026granumfl,
  author    = {Youwai, Sompote},
  title     = {GranumFL: an agentic, GPU-accelerated
               coupled DEM--SPH program for debris
               flows on real terrain},
  year      = {2026},
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.23858571},
  url       = {https://zenodo.org/records/23858571}
}

Contact

Talk to us

AI Research Group, Department of Civil Engineering, King Mongkut's University of Technology Thonburi (KMUTT), Bangkok.

tellusfem@gmail.com

GranumFL is built on Granum, our discrete element program for soil.

GranumFL Education edition

Download

Licence · Quick start · All releases and checksums