More on Advection and Burgers’ Equation#
Piecewise Parabolic Reconstruction#
In astrophysics, the piecewise parabolic method (PPM) is widely used. This reconstructs the data in each cell as parabola (instead of piecewise constant for our first-order method or piecewise linear for our second order method). As a result, this is much more accurate.
Here’s an example code that implements PPM for advection and shows some visualizations: PPMpy
Tip
You can install PPMpy via pip
as:
pip install ppmpy
An advection solver can be created using this, as shown here: https://python-hydro.github.io/ppmpy/advection.html
Multi-dimensions#
In two-dimensions, the advection equation is:
or in conservative form:
defining \(F^{(x)}(a) = (ua)\) and \(F^{(y)}(a) = (va)\), this is:
Now defining the average in two-dimensions as:
and integrating the conservative form of the advection equation over a cell, we have:
Now for each of those double integral terms, the integral in the normal direction is just the divergence theorem, and means that we just evaluate the flux at the limits of integration in that direction. The other integral represents an average of the flux over the interface in the transverse direction. We can just represent that average as the flux evaluated in the center (in the transverse direction), giving:
This can be solved in pretty much the same fashion as we did in one-dimension, but now our grid will need to be two-dimensional and we would have to compute fluxes and upwind in both directions.
The pyro code solves advection (and more) in two-dimensions.
Tip
You can install pyro via pip
as:
pip install pyro-hydro
Some discussion of the advection solver is here: https://python-hydro.github.io/pyro2/advection_basics.html