Preface

Aims and scope

This book addresses an important class of mathematical problems (the Riemann problem) for first-order hyperbolic partial differential equations (PDEs). Such PDEs arise when modeling wave propagation in applications such as fluid dynamics, traffic flow, elasticity, and electromagnetics. The solution of the Riemann problem captures essential information about such models, and is the key ingredient in modern numerical methods for their solution.

The book covers the fundamental ideas related to classical Riemann solutions, including their special structure and the types of waves that arise, as well as the ideas behind fast approximate solvers for the Riemann problem. The emphasis is on the general ideas, but each chapter delves into a particular application.

It is assumed that the reader has some knowledge of hyperbolic problems in advance. This book is intended to supplement rather than replace standard textbooks on the theory and numerical solution of hyperbolic PDEs. It should also be useful as a tool for students or researchers seeking to better understand the nature of Riemann solutions to a particular hyperbolic system.

The notation generally follows that of (LeVeque 2002), which covers most of the topics included here and many others. We have kept citations to a minimum in these notebooks, but there are a wealth of other books and papers available in the literature. In particular, some other books that have substantial discussion of Riemann problems and related topics include (Lax 1972), (LeVeque 1990), (Godlewski and Raviart 1996), (Kröner 1997), (Trangenstein 2009), (Toro 2013), and (Hesthaven 2018).

Book formats

This book is available in three formats:

  • The traditional print medium, in the form of a physical book.

  • As a collection of Jupyter notebooks with executable code and interactive animations, available from the Github repository https://github.com/clawpack/riemann_book. These are not meant to be read on Github, but copied to a local machine or cloud service and run there; see below.

  • As a set of webpages that are rendered from the Jupyter notebooks. These webpages contain some animations, but the interactive widgets from the notebooks do not work and it is not possible to modify and re-run cells.

For the full experience, run the notebooks!

The print version

Most of the figures in this book are generated by Python programs. Most of the code for those figures is in files in the Github repository linked above, but some of it is included inline in the text at the point where each figure appears. The reader may choose to skip the code sections, especially on a first reading.

The Jupyter notebook version

In the electronic version of this book, each chapter is a Jupyter notebook. The Jupyter Notebook is a free, open-source web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text. The notebooks that form this text have some additional benefits not present in the print version:

  • Some of the code in the notebooks generates animations, showing how solutions vary in time or with respect to a parameter.
  • Other code in the notebooks generates interactive "widgets" that allow the reader to vary multiple parameters or plot different quantities, in order to gain deeper insight and understanding.
  • The reader can also modify the code itself, perhaps to vary parameters that we (the authors) didn't think of. We encourage readers to use this to satisfy their own curiosity and enhance their learning.

Although some Python code is included directly in the notebooks, for more clarity much of the code has been "hidden" in Python modules that are imported near the top of each module. We also provide links in each notebook (and each chapter of the printed book) to the online location of these modules in case you wish to dive deeper into the code. Most of this code is in the exact_solvers subdirectory of the Github repository. Other code used primarily for producing plots can be found in the utils subdirectory.

How to access and run the Jupyter notebook version

In order to run the code in the Jupyter notebook version of the book, you will need to have certain tools and libraries installed on a computer, either locally or in the cloud. There are multiple convenient ways to do this.

  • On your own computer: follow the installation instructions
  • With Docker: follow these instructions to use the Dockerfile that is included in the Github repository.
  • With Binder: The cloud service binder allows you to start up a notebook server running notebooks from any Git repository (assuming it specifies the dependencies properly). You can try it out for these notebooks at this link. This should start up a notebook server on a Jupyterhub that lets you execute all the notebooks in your browser with no local installation of the notebooks or dependencies required.

Overview

This book consists of several parts, each divided into several chapters (as independent Jupyter notebooks). The printed book contains only the first two parts, which cover the fundamentals of exact and approximate solutions of Riemann problems; the remaining parts consist of online notebooks that delve into more advanced topics. In a graduate course on hyperbolic conservation laws, the first two parts could be incorporated into the curriculum, while the later chapters might provide suggestions for student projects.

Part I covers the classical theory of the Riemann problem and its solution, introducing the reader to essential concepts including characteristics; similarity solutions; shock waves and the Rankine-Hugoniot jump conditions; rarefactions and Riemann invariants; genuinely nonlinear and linearly degenerate waves; and entropy conditions. Building up from scalar hyperbolic PDEs and linear systems, it culminates with discussions of the full Riemann solution for the shallow water and Euler systems.

Part II introduces approximate Riemann solvers, which are an essential tool in numerical algorithms for hyperbolic PDEs. This part discusses the most important approaches to such solvers: from simple Lax-Friedrichs and HLL solvers to linearizations, including Roe solvers. Potential issues with these methods (such as the need for entropy fixes and lack of positivity) are addressed. Part II concludes with comparisons of canonical approximate solvers for the shallow water and Euler systems.

The Index.html notebook contains links to the chapters of Parts I and II.

The remaining parts are still a work in progress at the time of this writing, and are not included in the print or PDF version of the book. They can be found in the Github repository and additional topics may be added at a later date.

Writing a book with Jupyter notebooks

Although the primary goal of this book is to present the mathematics of Riemann solvers in a novel and educational manner, an additional goal from the beginning has been to explore the use of Jupyter notebooks for this sort of publishing venture, and to help popularize Jupyter notebooks within the applied mathematics community. We believe that notebooks are a great tool for both teaching and research, and an exciting new format for publishing. It has been an interesting challenge to figure out ways to present material that works well in the notebooks and that also translates into html files and a physical book, and we hope that our experiences not only help convey the subject matter but also can serve as a template for other publishing projects or as an impetus to develop better approaches.

All of the notebooks and associtated Python code are of course available in the github repository, and in addition we have written some wiki pages on various other tools we have found useful in developing this book. In particular, bookbook has been used in converting notebooks to latex/pdf files, and tools for working with notebooks such as nbdime and nbstripout have been invaluable for helping to manage modifications to notebooks in the context of git. Without git and github this project would have never come together, since the three authors have been employed on three different continents for most this project, and many discussions about how to do things, what to include, how to edit notebooks, etc. have taken place via pull requests on github. As of this writing there are 183 closed pull requests on this repository, which provide a history of many of our discussions and decisions.

Numerous other books and lecture notes have been written that make extensive use of Jupyter notebooks, and they are also becoming increasingly popular as a supplement to research publications. See the Gallery of interesting Jupyter notebooks for other examples and inspiration. We hope that more applied mathematicians will explore this platform for future publications.

Acknowledgments

We are indebted to the people who created the tools we have used to develop these notebooks, and in particular to the developers of Jupyter. Fernando Perez and several others helped us out at many points during the development of this book. Jake Vanderplas originally developed the JSAnimation package for us to use in Clawpack, and helped us with a number of other notebook issues.

The initial idea for this book arose during discussions at the Clawpack Developers Workshop held at the University of Utah, just before the 2015 SIAM Conference on Computational Science and Engineering. Many members of the Clawpack community have helped support this project, in particular Kyle Mandli, an early adopter who has provided valuable feedback, as did Lisa Davis.

We are delighted that SIAM will be publishing the printed version of these notebooks, and are appreciative of their willingness to support this experiment, and of their patience as we have worked out various kinks in the process. We are also very pleased that they have allowed the notebook repository to remain freely available on github, with licensing that allows you to not only use the notebooks but to adapt them for your own non-commercial purposes. Although running the notebooks is the best way to experience this material, we hope you will also buy the book and support SIAM -- or better yet, write your own book and publish with them.