1D Saint-Venant (shallow water) equations solver: MUSCL-HLLC + SSP-RK2
Project description
amerta: A Python Library for 1D Idealized Saint-Venant Dam-Break Simulation
Model
The Saint-Venant (shallow water) equations in conservative form on a horizontal, frictionless bed:
Mass conservation: ∂ₜh + ∂ₓ(hu) = 0
Momentum conservation: ∂ₜ(hu) + ∂ₓ(hu² + ½gh²) = 0
Canonical Riemann Problems
| Case | State | Wave Structure |
|---|---|---|
| 1. Stoker | Wet–wet | Left rarefaction + right shock |
| 2. Ritter | Wet–dry | Single rarefaction, dry front |
| 3. Double Rarefaction | Diverging | Two rarefactions |
| 4. Double Shock | Converging | Two shocks |
Numerical Method
- MUSCL reconstruction (minmod slope limiter, 2nd-order spatial)
- HLLC approximate Riemann solver (Roe-averaged wave speeds)
- SSP-RK2 strong-stability-preserving time integration (Shu & Osher 1988)
- Adaptive CFL-limited time step with positivity preservation
- Numba JIT acceleration with parallel
prangesweeps
Installation
pip install amerta
Quick Start
CLI:
amerta case1 # Stoker wet dam break
amerta case2 # Ritter dry dam break
amerta case3 # Double rarefaction
amerta case4 # Double shock
amerta --all # Run all four cases
Python API:
from amerta_sv import SaintVenantSolver, get_case
from amerta_sv.io import ConfigManager, DataHandler
from amerta_sv.core.analytical import compute_analytical, fill_error_norms
cfg = ConfigManager.validate_config({
**get_case('stoker'),
'nx': 500, 'cfl': 0.9, 'g': 9.81, 't_final': 80.0,
'h_left': 10.0, 'h_right': 2.0, 'L': 2000.0,
'scenario_name': 'stoker', 'case_type': 'stoker'
})
solver = SaintVenantSolver(nthreads=8, verbose=True)
result = solver.solve(cfg)
an = compute_analytical('stoker', cfg, result['x'], result['t_all'])
fill_error_norms(an, result['h_all'], result['u_all'], result['dx'],
q_num=result['q_all']) # pass q_all for best accuracy
print(f"L1(h) at t_final = {an['l1_h'][-1]:.4e} m")
print(f"L1(q) at t_final = {an['l1_q'][-1]:.4e} m2/s")
print(f"L1(u_wet) at t_final = {an['l1_u_wet'][-1]:.4e} m/s")
Output Files
For each case, amerta generates:
<case>.nc— CF-1.8 NetCDF4, full trajectory at every timestep including all error norms<case>_metrics.csv— scalar diagnosticscomparison_metrics.csv— side-by-side comparison across all runs<case>_time_evolution.png,<case>_physical.png,<case>_numerical.png<case>.gif— animated evolution
Dependencies
numpy ≥ 1.20, scipy ≥ 1.7, matplotlib ≥ 3.3, netCDF4 ≥ 1.5, numba ≥ 0.53, pandas ≥ 1.3, pillow ≥ 8.0, tqdm ≥ 4.60
License
MIT 2026 © Dasapta E. Irawan, Sandy H. S. Herho, Iwan P. Anwar, Faruq Khadami, Astyka Pamumpuni, Rendy D. Kartiko, Edi Riawan, Rusmawan Suwarman, and Deny J. Puradimaja
Citation
@software{irawanEtAl2026_amerta,
title = {{\texttt{amerta}: A Python library for 1D idealized Saint-Venant dam-break simulation}},
author = {Irawan, Dasapta E. and Herho, Sandy H. S. and Anwar, Iwan P. and
Khadami, Faruq and Pamumpuni, Astyka and Kartiko, Rendy D. and
Riawan, Edi and Suwarman, Rusmawan and Puradimaja, Deny J.},
year = {2026},
version = {0.0.3},
url = {https://github.com/sandyherho/amerta}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file amerta-0.0.3.tar.gz.
File metadata
- Download URL: amerta-0.0.3.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.11.7 Linux/5.15.0-173-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
172a0c424d25cd3749a1697c4f0236408a9d6e9373023e0960576437aa0cc1a3
|
|
| MD5 |
aaf645d82ecc34aabb5c5a1f738ec550
|
|
| BLAKE2b-256 |
64104541b5cfaca9269ee41ca01cac657bfa2ccfa6a105d6c3a8fbbba962a2e4
|
File details
Details for the file amerta-0.0.3-py3-none-any.whl.
File metadata
- Download URL: amerta-0.0.3-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.11.7 Linux/5.15.0-173-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6c6b733d8547ad5a8870f4d8740b9dfa3b14f862e83943899bf311b1fd2253e
|
|
| MD5 |
9770883ff060eff6ca6f4ef53109eb43
|
|
| BLAKE2b-256 |
7ec028afba0324f95547c689ee8c66ef2e930fcd2a9ec361dc0423d59804df1b
|