Home

Awesome

HDPG1D

This is a python package that solves 1-Dimensional PDEs using hybridizable discontinuous Petrov-Galerkin discretization, a novel FEA discretization that ensures the best solution quality without extra stablization mechanism. The following image shows the solution of 1D inviscid Burger's equation using HDPG discretization.

\frac{\partial u}{\partial t} + \frac{1}{2} \frac{\partial u^2}{\partial x} = 0, \quad \text{in } \Omega \in [0,1].

Notice that the oscillations near the shock are well controlled even without any artificial stablization mechanism.

<p align="center"> <img align="centre" img src="http://i.imgur.com/HrWIi4s.png" width="50%" height="50%" title="source: imgur.com" /> </p>

The main task of this project is to build an automated CFD framework based on HPDG discretization and robust adaptive mesh refinement. The solver is currently capable of solving 1D linear convection-diffusion-reaction equations of the following form with Dirichlet boundary condition,

c_1\frac{\partial u}{\partial x} + c_2\frac{\partial^2 u}{\partial x^2} + c_3u = f,

where $c_1$, $c_2$, and $c_3$ are constants and $f$ is the forcing term.

This package currently only has HDG discretization as a preliminary discretization, please refer to this paper for implementation details.

Install

In the souce directory:

python setup.py sdist
cd dist/
pip install hdpg1d

Usage

In terminal, call:

PGsolve

Follow the prompts to setup problem, visualize solution, and check convergence plot.

Convergence plot

The error on the convergence plot is calculated using approximated 'exact' solution with higher polynomial functions and higher number of elements. Therefore, the error plot, especially the adaptive solution error, may not be accurate after certain error threshold.

Adaptive method

By default, the solver seeks to adapt mesh based on the right boundary flux. The solver stops after the estimated error is lower than a user defined tolerance or reaches maximum iteration number.

Problem setup

PGsolve provides two methods to setup the problem:

To-do