Create Your Own Riemann Solver (With Python)

Philip Mocz
Level Up Coding
Published in
7 min readAug 13, 2023

--

In today’s recreational coding exercise, we create an exact Riemann Solver for the Euler equations. The solver finds the solution for the time evolution of the 1D shock structure in a fluid with an initially discontinuous Left and Right state. It can be integrated into finite volume codes to make flux calculations less diffusive and be used as a numerical benchmark solution too.

You may find the accompanying Python code on GitHub.

Before diving in, below is a gif of what running our interactive solver looks like:

--

--

Computational Physicist. Sharing intro tutorials on creating your own computer simulations! Harvard ’12 (A.B), ’17 (PhD). Connect with me @PMocz