From enGrid Wiki
NOTE: This page has moved to the new wiki location: Volume Meshing from Existing Surface Meshes
The content below is kept here only for historic reasons.
Tutorial: Volume Meshing from Existing Surface Meshes
This tutorial will demonstrate how to read a surface mesh and create a volume mesh for a CFD simulation. Figure 1 shows the geometry which will be used for this tutorial; it represents an adjustable throttle. The file containing the surface mesh for this tutorial is called Throttle.msh and it can be downloaded from the enGrid download page from here.
Importing the Surface Mesh
To start, please import the file choosing:
- Import » Gmsh » v2.0 (ASCII)
from the menu bar. A ﬁle-dialogue will show and you can browse for the file and open it. Figure 2 shows a screen-shot of enGrid after importing the file. You can use the mouse to rotate, move, and zoom the view. This mouse interaction is the default mouse interaction provided by VTK.
enGrid colours the faces of the surface grid in order to determine which side of the surface is inside a flow domain and which is outside. The outside is coloured in a pale green, but Figure 2 shows pale yellow; this means the surface is wrongly oriented and it needs to be corrected. To do this, please choose
- Mesh » change surface orientation
from the menu-bar. Afterwards the surface will be oriented correctly.
Defining Boundary Conditions
Unfortunately all faces belong to the same boundary condition and thus it is not possible to see inside the domain. To change this you can pick a surface on the side of the cylindrical geometry and then change its boundary condition to a different value. To pick a face, please point the mouse over a triangle and press the P key on your keyboard. Afterwards you should see something similar to Figure 3.
To change the boundary code, please select:
- Mesh » set boundary code
A small dialogue will pop up and it offers to select a feature angle and a new boundary code. The new boundary code should be set to 2 and the feature angle can remain at 45 degrees. With this setting you should set the whole side of the cylinder to a new boundary code and the faces should disappear, because they have not been selected for viewing yet. Now, do the same with the top (boundary condition 3) and the bottom (boundary condition 4) of the cylinder. To get rid of the red box, please point the mouse into an empty space and press P again. Now would be a good time to save your work. Select:
- File » Save Grid As
to save the file.
Due to the upcoming support for multiple volumes, you also need to define a volume. This is done by adding a new volume and indicating which boundary codes are part of it and which color the outer side of the boundary relative to the volume currently has. To do this, select:
- Simulation » Edit boundary conditions
- Add a new volume by entering a name like vol in the new volume field and clicking on add.
- In the new column vol, set all cells to green by double-clicking on them and selecting green from the drop-down box.
Create Volume Mesh
Creating a first volume mesh, including the boundary layer, is fairly easy now. First choose:
- View » boundary codes
and select the boundary conditions 1 and 2, because these represent the physical walls of the geometry. You should now have something similar to Figure 4.
To create the grid, simply select:
- Mesh » create prismatic boundary layer
select the boundary conditions 1 and 2 and the volume vol. Then click OK. You can watch the progress in the output window on the left side of the screen. This output window can be detached, moved somewhere else, or hidden completely. enGrid indicates that it is busy in the status line at the bottom of the window.
After enGrid has finished you can select tetras and wedges from the available options on the right side of enGrid ’s main window. Don't forget to also check Enable volume elements.
In order to see inside you should also enable the clipping options. The origin of the clipping plane can be set to (0,0,0) and the normal vector to (0,0,-1). If you now select to view only boundary condition 1 and choose:
- View » redraw
your screen should look similar to Figure 5.
To get a nice tetrahedral part of the grid it is advisable to execute:
- Mesh » create improve volume mesh (NETGEN)
once or twice. The mesh size distribution is not ideal for the ﬁrst run of NETGEN. enGrid uses an existing volume grid to compute a mesh size distribution and uses this as input for the next call of NETGEN. Normally you get a rather coarse tetrahedral grid together with the prismatic layer. The next call will produce a grid that might be somewhat too fine. Starting from the second call of:
- Mesh » create improve volume mesh (NETGEN)
the grid should look rather nice, as shown in Figure 5.
- This is a transcript from the manual provided in enGrid's source code repository.
- For more information about element types, see Manual/Element Types.