Shun Li’s Blog

👋 Welcome to my blog!

  • 🌱 I’m a Ph.D. student in Computational Mathematics at USTC.
  • 🔭 My research mainly focuses on Numerical analysis and Scientific computing.
  • 😄 I enjoy learning about different things and techniques, diving into theory, and blogging.

Discontinuous Galerkin Method for 1D Scalar Conservation Laws

A Python implementation of the Discontinuous Galerkin (DG) method for solving one-dimensional scalar hyperbolic conservation laws. Reference: Shu, Chi-Wang. “Discontinuous Galerkin Methods: General Approach and Stability.” (2008). import numpy as np import matplotlib.pyplot as plt from numpy.polynomial import legendre import pandas as pd plt.rcParams.update( { "savefig.dpi": 300, "figure.autolayout": True, "text.usetex": True, "font.family": "serif", "font.serif": ["Times New Roman"], "pdf.fonttype": 42, "ps.fonttype": 42, "font.size": 14, "axes.labelsize": 14, "axes.titlesize": 14, "xtick.labelsize": 14, "ytick.labelsize": 14, "legend.fontsize": 14, "lines.linewidth": 1.0, "lines.markersize": 5, "axes.linewidth": 1.0, "lines.markerfacecolor": "none", "lines.markeredgecolor": "auto", "xtick.direction": "in", "ytick.direction": "in", "legend.facecolor": "white", "legend.edgecolor": "black", "legend.framealpha": 1.0, } ) 1. Burgers Equation Consider the scalar conservation law $$u_t + f(u)_x = 0$$with the flux function $f(u) = \frac{u^2}{2}$, which yields the inviscid Burgers equation: ...

2025-08-08 · 20 min · 4208 words · Shun Li