The case corresponds to BI2 - Inviscid flow over a bump, and it's solved on a unstructured mesh using Discontinous-Galerkin finite-element method, solving the Euler equations.
- The code can run polynomial orders
$p=0,1,2$ using Lagrange basis. - RK4 is used to march the solution with a local time stepping.
- The fluxes are computed using the Roe flux
- The armadillo package must be installed in order to compute some matrix operations (inverse of the mass matrix)
DG.h
defines all the functions used by the solver and the constants for the flow.flux_BC.cpp
includes the flux (Fx,Fy,and Roe) and the boundary conditionsquad.cpp
includes the basis functions, 1d/2d quad points, Jacobian calculations, Mass Matrix for curved elementsreadgrid.cpp
is the function used to read the curved mesh. It just works for this particular case.residuals.cpp
includes 4 functions to compute the interior and edge residual contributions.solver.cpp
puts everything together and runs the time marching scheme RK4main.cpp
call the solver and there you can set the mesh, p, tolerance, and CFL
Files to generate the meshes in gen_mesh
-
generate_mesh.m
: get the nodes and triangle points for the first unstructured mesh. This uses the distmesh package by Per-Olof Persson. Elements are clusters around the bump. -
gri_file.py
: generate .gri file. Containing nodes, triangles, and boundaries information. -
process_grid.py
: Process the .gri file and generates the (text files)matrices:- I2E: mapping from interior faces to elements. Contains 4 integers
elemL
,faceL
,elemR
,faceR
. Containing the elements adjacent to the face and the local numbering of their corresponding face. The left (L) element is arbitrarily chosen as the one with the lower element index. - B2E: Mapping from boundary faces to elements and boundary group. Contains three integers
elem
,face
,bgroup
. - In: Normal vectors for interior faces.
- Bn: Normal vector for boundary faces.
- Area: Area of each element.
The matrices are all 1-based. This file also does a sanity check:
$$\sum\limits_{i=1}^3 l_i\vec{n}_{i,out}=0$$
- I2E: mapping from interior faces to elements. Contains 4 integers
-
refine.py
: File to do uniform mesh refinement, where element is split into four subelements by means of edge bisection. This generates a new set of elements of nodes that can be processed withgri_file.m
andprocess_grid.py
.
The meshes are finally curved and the codes are in curve_mesh
:
-
convert.py
: Creates elements of order$q=3$ by obtaining the high-order nodes from a uniformly-refined mesh. -
process_grid.py
: Same as before but add an extra list with the high order elements at the bottom.
Only the elements at the bottom of the domain are curved, the rest are kept linear.
- The
Area
file does not take into account the high order representation of the elements at the bottom. But this quantity is only used to compute the localdt
to march the solution. - The flag
free-stream
is to run a test running free-stream on all boundaries. - For curved elements, the normals are computed inside the residual calculations.
- The postprocessing folder has some python files to plot stuff, but it's not very clean.