Inviscid & Compressible 1D FVM solver containing implementations of exact and approximate Riemann solvers.
- CMake >= 3.20
- A C++20-capable compiler (e.g., GCC 10+, Clang 12+)
- Python 3.9+ (for post-processing)
From the project root:
python3 -m pip install -r requirements.txtThis project is built with CMake. Configure and build from a dedicated build folder:
mkdir -p build
cd build
cmake ..
cmake --build .The executable expects to find inputs in ../tests and writes outputs to ../data, so it must be run from the /build directory:
cd build
./discontinuityThis will iterate through all test files in tests/ and write step_*.csv snapshots into data/.
The script post_process.py turns the CSV snapshots into plots and animations.
Disclaimer: Generating .mp4 animations requires ffmpeg to be installed and available on your PATH. See the official installation guides for your OS at https://ffmpeg.org/download.html.
- Generate a static plot at a target time (closest snapshot chosen automatically) and an animation:
python3 post_process.py --data-dir data/test_1 --out-dir data/test_1 --t-target 0.25 --anim animation.mp4- Use every Nth frame for faster animations:
python3 post_process.py --data-dir data/test_1 --out-dir data/test_1 --stride 4 --fps 30 --anim animation.gif- Please make sure the post processing utility script is ran from the projects root.
--data-dir: Directory containing step_*.csv files (default: data)--pattern: Glob pattern for snapshots (default: step_*.csv)--out-dir: Output directory for plots/animations (default: data)--t-target: Target time for static plot (default: 0.25)--stride: Use every Nth frame (default: 1)--fps: Frames per second for animation (default: 30)--anim: Animation file name (.mp4 or .gif, default: animation.mp4)
There are three predefined test cases in tests/ that correspond to the Riemann problems described in Riemann Solvers and Numerical Methods for Fluid Dynamics by Eleuterio F. Toro, Chapter 4.
Qualitative comparison of the analytical solution against the numerical one (using the HLLC approximate solver) for Test 1 against Fig. 4.7 “Test 1: Exact solution for density, velocity, pressure, and specific internal energy at time t = 0.25” from Toro’s Riemann Solvers for Fluid Dynamics:
Qualitative comparison of the analytical solution against the numerical one (using the HLLC approximate solver) for Test 3 against Fig. 4.9 “Test 3: Exact solution for density, velocity, pressure, and specific internal energy at time t = 0.012” from Toro’s Riemann Solvers for Fluid Dynamics:
Each test is a plain-text file in tests/ (e.g., tests/test_2.txt) with key-value pairs, one per line:
name: Output subfolder name under data/solver: Riemann solver type to use (see below)N: Number of cellst_end: Final simulation timecfl: CFL numberdt_out: Output intervalleft: Left state asrho u pright: Right state asrho u p
Two solver types are available:
exacthllc

