Abstract
(Please refer the manual.pdf file in the attached archive for complete documentation of the code)In this post, we implement and validate a three-dimensional algorithm for solving inviscid Euler equations on general geometries represented by a single block for a fair regime of fluid flow. To this end, we first use a set of predefined routines to read the grid topology. The input file is assumed to be in UGRID format. The grid topology is defined using the number of nodes, number of different elements in the grid, coordinates of all nodes, definitions for various elements including triangle and quadlateral for boundaries, and tetrahederal, pyramid, prism and hex for the interior regions. Prior to writing grid maps, we implement different element-based maps which locally specify the relation between face and node, relation between node and nodes, and the relation between edge and node for a particular element. Using these local maps, we proceed to implement various gird maps to access the grid point/edge of interest in the flow-solver section. These maps include, element sourrounding a point, points surrounding a particular point, edges sorrounding point, and element sourrounding an element.
In the second part of of the work, we transfer the cell-centered grid to the equal node centered representation which is more suitable for finite volume approach. In doing so, we define our geometrical data structure based on the edges in the interior of the domain and ghost edges on the boundaries. For each triangle boundary element, we define three ghost edges while for each quad, we will have four. The volume of the new node-centered cell together with conservative variables are stored in node-based array. All maps and transformed node-centered grid are validated using a set of predefined meshes including a 13 node generic grid, an all-hexahederal and all-tetrahederal meshes, a course and fine ramp mesh for supersonic evaluations and a heavy visoucs mesh for NACA0012 airfoil.
In the third part of the work, we implement the flow-solver. The conservation-laws are discretized using finite-volume approach \footnote{integration in space + Divergence theorem)} and a generic equation for temporal update is obtained. Flux vectors are using Roe approach. Roe averages are evaluated at the center of edges providing a Jacobian-based first-order approximation of flow field in space. For temporal discretization, both first-order Euler-explicit and fourth-order classic Runge-Kutta are implemented. A fifth-order Runge-Kutta scheme from Jameson-Baker is also implemented in the code.
To validate the current algorithm, a supersonic ramp flow is solved on both coarse and refined meshes. Convergence study is performed on both coarse and refined meshes. The shock angle and various parameter before and after shock are compared with the one-dimensional oblique shock theory.
The method is extended to second-order in space by using least square method for gradient construction. In addition, viscous terms are added by averaging the gradients over an edge. The final solver is validated for several benchmark problem including nonlinear acoustics of standing waves inside a pipe, vortex propagation and laminar boundary layer over flat plates. A comparison of the results with experimental data and analytical results for boundary layers proves the robustness of current solver.
Sample Results
Here are some pictures. For complete documentation of the theory and running the code please download the attached archive.
coarse grid ramp
A coarse grid supersonic ramp test case with second-order spatial Roe scheme. |
residual history for first-order spatial discretization |
Fine grid ramp
Fine grid ramp with first-order spatial accuracy. The Shock is resolved perfectly! |
Viscous Boundary Layer
Top) the three-dimensional grid for capturing the boundary layer on flat plate. The grid is refined where flat plate starts. Bottom) results from the current solver. For more info please see the PDF manual in the attached file.
Comparison Between Exact Blasius solution, Fluent code, and current code. |
Download the Source Code and Documentation from Here:
PDF Manual: http://ifile.it/amr59xi
Source Code in C: please put your email in the comments and I'll send you one copy of the source code.
Update Feb 2nd, 2016 : The code is uploaded here : https://github.com/arrgasm/ns3D