class_preso.weno_computations module

Helper functions for weno_computations notebook.

Slides can be seen on nbviewer.

class_preso.weno_computations.discontinuity_to_volume()[source]

Make plots similar to introductory, but with a discontinuity.

class_preso.weno_computations.discontinuity_to_volume_single_cell(stopping_point=None)[source]

Plot a piecewise constant function w/discontinuity towards the left.

Parameters:stopping_point (int) – (Optional) The transition point to stop at when creating the plot. By passing in 0, 1, 2, … this allows us to create a short slide-show.
class_preso.weno_computations.interp_simple_stencils()[source]

Return interpolated values for \(u_{j+1/2}\) using simple stencils.

First uses three sets of interpolating values,

\[\left\{\overline{u}_{j-2}, \overline{u}_{j-1}, \overline{u}_j\right\}, \left\{\overline{u}_{j-1}, \overline{u}_j, \overline{u}_{j+1}\right\}, \left\{\overline{u}_j, \overline{u}_{j+1}, \overline{u}_{j+2}\right\},\]

to give local order three approximations.

Then uses all five points \(\left\{x_{j-2}, x_{j-1}, x_j, x_{j+1}, x_{j+2}\right\}\) to give an order five approximation on the whole stencil.

Return type:tuple
Returns:Quadraple of LaTeX strings, one for each set of interpolating points, in the order described above.
class_preso.weno_computations.make_intro_plots(stopping_point=None)[source]

Make introductory plots.

Uses

\[\overline{u}_{-2} = 0, \overline{u}_{-1} = 3, \overline{u}_{0} = 2, \overline{u}_{1} = -1, \overline{u}_{2} = 2\]

And plots the interpolations by quadratics (on the three contiguous subregions) and by a quartic that preserve the interval.

class_preso.weno_computations.make_shock_plot()[source]

Make plots similar to introductory, but with a discontinuity.

class_preso.weno_computations.make_shock_plot_single_cell()[source]

Plot the reconstructed polynomials that occur near a shock.

class_preso.weno_computations.to_latex(value, replace_dict)[source]

Convert an expression to LaTeX.

This method is required so we can get a specified ordering for terms that may not have the desired lexicographic ordering.

Parameters:
  • value (sympy.core.expr.Expr) – A
  • replace_dict (dict) – Dictionary where keys are old variable names (as strings) and values are the new variable names to replace them with.
Return type:

str

Returns:

The value as LaTeX, with all variables replaced.