This repository contains the Python scripts used to analyze, validate, and visualize the numerical outputs (NetCDF format) generated by amerta, a 1D Saint-Venant (shallow water) equations solver using the MUSCL-HLLC + SSP-RK2 scheme.
- Solver Source Code (GitHub): sandyherho/amerta
- Python Package (PyPI): amerta
- Data & Outputs (OSF): OSF Project Page (Contains all generated NetCDF data, raw analysis statistics, high-resolution figures, and GIF animations)
The scripts/ directory contains tools to validate the numerical results against analytical Riemann solutions (Stoker, Ritter, double rarefaction, double shock) and track conservation diagnostics. The scripts read NetCDF data from a ../data/ directory and save outputs to ../figs/ and ../stats/.
01_spacetime_surfaces.py: Generates 3D space-time surface projections of the water depth h(x, t).02_final_time_validation.py: Overlays the final-time numerical depth profiles against the exact analytical solutions.03_self_similarity.py: Validates the self-similarity collapse of the Riemann solutions h(x, t) -> h(xi).04_error_norms_vs_time.py: Plots the time evolution of integral error norms (L1 and L2 for depth, specific discharge, and wet-cell velocity).05_conservation_diagnostics.py: Evaluates boundary-flux-corrected mass residuals, cumulative energy dissipation (entropy condition), Froude numbers, and Total Variation (TV).06_phase_space.py: Maps the simulated final state in (h, u) phase-space against exact analytical wave curves (rarefaction fans and shocks).
To run the analysis, ensure you have the amerta solver outputs (e.g., case_1_stoker_wet_dam_break.nc) placed inside a data/ directory at the root of this repository.
# Navigate to the scripts directory
cd scripts
# Execute the analysis scripts
python 01_spacetime_surfaces.py
python 02_final_time_validation.py
python 03_self_similarity.py
python 04_error_norms_vs_time.py
python 05_conservation_diagnostics.py
python 06_phase_space.pyRunning these scripts will automatically generate the resulting plots in the figs/ directory and textual statistics in the stats/ directory.