saitoasukakawaii / Burgers

Solving 1D Burger's equation using discontinuous Galerkin method

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Solving Burger's equation with discontinuous Galerkin method by spectral/hp element

1D burger's equation with viscous term can be expreessed as:

$$\frac{\partial u}{\partial t}+\frac{\partial}{\partial x} \left(\frac{1}{2}u^2\right) = \nu \frac{\partial^2 u}{\partial x^2}$$

We use finite element method (FEM) to solve the equation. Selecting test function $\phi$ giving weighted residual integral formula:

$$\left(\frac{\partial u}{\partial t},\phi\right)+\left(\frac{\partial}{\partial x} \left(\frac{1}{2}u^2\right),\phi\right) = \left(\nu \frac{\partial^2 u}{\partial x^2},\phi\right)$$

Define the flux $q=\partial u/ \partial x$, and flux function $F(u,q)=u^2/2-\nu \partial q/\partial x$, we have: $$\left(\frac{\partial u}{\partial t},\phi\right)+\left(\frac{\partial}{\partial x} F(u,q),\phi\right) = 0$$

Then we integration by parts get the weak form:

$$\left(\frac{\partial u}{\partial t},\phi\right)-\left( F, \frac{\partial \phi}{\partial x}\right)+F^{*}\phi|{x{l}}^{x_{r}} = 0$$

And integration by parts agian return to strong form:

$$\left(\frac{\partial u}{\partial t},\phi\right)+\left(\frac{\partial}{\partial x} F,\phi\right)+(F^{*}-F^{u})\phi|{x{l}}^{x_{r}} = 0$$

Requirements

  • Eigen-3.4.0
  • Boost-1.77.0

Both two third party libraries are c++ header-only library, only unzip the source code to the root path. the gamma function of boost is used, and the matrix and vector and the eigenvalues of eigen are used.

How to use

$ mkdir build
$ cd build
$ cmake ..
$ make

Or just use awesome IDE, for example Clion to compile and run the program.

About

Solving 1D Burger's equation using discontinuous Galerkin method


Languages

Language:C++ 96.0%Language:CMake 4.0%