Skip to content

Meshing for HiFiLES

mlopez14 edited this page May 16, 2015 · 5 revisions

Mesh Generation for HiFiLES

HiFiLES currently supports just 2 mesh formats - the Gambit neutral format (.neu), and the Gmsh format (.msh). All meshes must follow the specifications laid out in the documentation of each format (see Gambit specifications, Gmsh specifications). In particular, care must be taken to ensure the proper orientation of each element - i.e. clockwise vs. counter-clockwise ordering of a triangle or quadrilateral.

Gmsh Tutorial

Gmsh is a freely-available unstructured mesh-generation program available at http://geuz.org/gmsh/. It is capable of producing 2D and 3D meshes around complex geometries. The geometry may either be specified within Gmsh, or by importing a neutral CAD file (IGES, STEP, and STL formats available). One very useful feature of Gmsh is its .geo file, which controls the geometry and mesh via scripting in a simple text file. Full documentation is available at http://geuz.org/gmsh/doc/texinfo/gmsh.html, but here are a few basic requirements to keep in mind:

  1. All elements in the mesh must be assigned to a physical surface/volume (2D/3D) which has the name "FLUID".

  2. All desired boundary conditions must be setup using a physical line/surface (2D/3D) with a descriptive name (the name can later be changed in the .msh file to match a HiFiLES-specific boundary condition, but some placeholder must exist).

  3. No overlapping lines or surfaces can exist in the .geo file (as these will lead to a 'cut' in the mesh where elements are not connected [using duplicate, overlapping vertices]).

  4. Although arbitrary mixed meshes of triangles and quadrilaterals are allowed in 2D, only meshes of tetrahedrons or hexahedrons alone are allowed in 3D (due to pyramids being unavailable).

The following file provides a quick tutorial on basic mesh generation for 2D meshes:

// ---- 2D Circular Cylinder Gmsh Tutorial ----
// 2D_cylinder_tutorial.geo
// Creates a mesh with an inner structured-quad region and 
// an outer unstructured tri region
//
// Created 11/26/2014 by Jacob Crabill
// Aerospace Computing Lab, Stanford University
// --------------------------------------------

// Gmsh allows variables; these will be used to set desired
// element sizes at various Points
cl1 = 6;
cl2 = .03;
cl3 = 10;

// Exterior (bounding box) of mesh
Point(1) = {-30, -30, 0, cl1};
Point(2) = { 50, -30, 0, cl3};
Point(3) = { 50,  30, 0, cl3};
Point(4) = {-30,  30, 0, cl1};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};

// Circle & surrounding structured-quad region
Point(5) = {0,   0, 0, cl2};
Point(6) = {0,  .5, 0, cl2};
Point(7) = {0, -.5, 0, cl2};
Point(8) = {0,  .7, 0, cl2};
Point(9) = {0, -.7, 0, cl2};
Circle(5) = {7, 5, 6};
Circle(6) = {6, 5, 7};
Circle(7) = {8, 5, 9};
Circle(8) = {9, 5, 8};
Line(9)  = {6, 8};
Line(10) = {7, 9};
Transfinite Line {5,6,7,8} = 20; // We want 40 points along each of these lines
Transfinite Line {9,10} = 10;    // And 10 points along each of these lines

// Each region which to be independently meshed must have a line loop
// Regions which will be meshed with Transfinite Surface must have 4 lines
// and be labeled in CCW order, with the correct orientation of each edge
Line Loop(1) = {1, 2, 3, 4, 7, 8}; // Exterior
Line Loop(2) = {10, 8, -9, -5}; // RH side of quad region - note ordering
Line Loop(3) = {7, -10, -6, 9}; // LH side of quad region - note ordering

Plane Surface(1) = {1}; // Outer unstructured region
Plane Surface(2) = {2}; // RH inner structured region
Plane Surface(3) = {3}; // LH inner structured region

// Mesh these surfaces in a structured manner
Transfinite Surface{2,3};

// Turn into quads (optional, but Transfinite Surface looks best with quads)
Recombine Surface {2,3};
// Turn outer region into unstructured quads (optional)
//Recombine Surface {1};

// Apply boundary conditions
// Note: Can change names later at top of .msh file
// Each boundary in gmsh must be labeled differently
// rename the boundaries manually in the resulting .msh file
Physical Line("Bottom") = {1};
Physical Line("Right")  = {2};
Physical Line("Top")    = {3};
Physical Line("Left")   = {4};
Physical Line("Circle") = {5,6};
// Alternate version - make all 4 outer bounds part of the same B.C.:
//Physical Line("Char") = {1,2,3,4}; 

// IMPORTANT: "FLUID" MUST contain all fluid surfaces(2D)/volumes(3D)
Physical Surface("FLUID") = {1,2,3};
Clone this wiki locally