Skip to content

Complete Mesh for a damper in a duct (starting from an STL geometry)

wyldckat edited this page Sep 22, 2012 · 9 revisions

Table of Contents

Description

This tutorial will demonstrate how to read a STL geometry and create a volume mesh for a CFD simulation using enGrid. The geometry, which will be used for this tutorial, represents an adjustable damper within a duct. The file containing the geometry is called Damper.stl and can be found in the /tutorials/01_Damper folder.


Importing the geometry

To start, please open enGrid (./run.bash) and import the file choosing:

Import » STL
from the menu bar. You can browse and open the file within the opening file-browser. You'll be asked for a value for the tolerance within a pop-up window. Please keep the default value. Figure 1 shows a screen-shot of enGrid after importing the file. The geometry has been designed as a cutaway model. You can see the symmetry plane in the front.

The orientation of the 3d view can be modified using the mouse:

  • Left mouse button (LMB) and Ctrl-LMB - rotates
  • Middle mouse button (MMB) - moves
  • Mouse scroll wheel - zooms
the view. This mouse interaction is the default mouse interaction provided by VTK.
Figure 1: After importing the surface mesh

To check the integrity of the imported surface, choose:

Tools » Check surface integrity
from the menu bar. The Output window on the left side should show a message saying The mesh is OK!.

enGrid colours the single faces of the surface grid in order to determine which side of the surface is inside a flow domain and which is outside. To do so a pale green and a pale yellow is used. It's recommended to ensure the outside is coloured in green (although it doesn't matter which colour has been selected as long as all outer faces are in one colour and all inner faces are in the other colour).

Figure 1 shows pale yellow therefore change the orientation by choosing

Mesh » change surface orientation
from the menu-bar. LMB-click somewhere within the 3D view and the surface will be oriented correctly. This is the right time to save the mesh (we suggest to save your results after each important step). From the menu bar, choose:
File » Save Grid As
and store the file as e.g. Damper_S0.egc.


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 of the geometry and then change its boundary condition to a different value. To pick the face of the symmetry plane in the front, please point the mouse over a triangle of the symmetry plane and press the P key on your keyboard. Afterwards you should see something similar to Figure 2.

Figure 2: Picking a boundary face

To change the boundary code, please select:

Mesh » set boundary code (S)
The (S) behind the menu command means you can press the short-cut-key S instead of executing the command from the menu. A dialogue will pop up offering to select a feature angle, a new boundary code and some other options. The new boundary code should be set to 1. The feature angle and other options can remain as they are. With this settings 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. LMB-click into the 3d view and you should see something like Figure 3.
Figure 3: Hiding the front

Now, do the same with the following faces of the duct:

  • back (boundary condition 2)
  • top (boundary condition 3)
  • bottom (boundary condition 4)
  • left (boundary condition 5)
  • right (boundary condition 6)
and then for the damper:
  • top (boundary condition 7)
  • bottom (boundary condition 8)
  • left side (boundary condition 9)
  • right side (boundary condition 10)
  • back side boundary condition 11)
All faces should now have a boundary code (meaning the are hidden).

Choose:

Simulation » Edit boundary conditions (E)
A window opens allowing to rename the boundary conditions. Replace the default names in the BC-name column on the Boundary conditions tab by LMB-double-clicking into the cell and entering more reasonable names as shown in Figure 4. The new names make it easier to identify the conditions later on.
Figure 4: Renaming the boundary conditions

Selecting:

View » Boundary codes (V)
from the menu bar (or just pressing the V-key) allows to select a boundary code and to display the face again. Select all boundary conditions with exception of symmetry_plane.

Now would be a good time to save your work as Damper_S1.egc.

Create Surface Mesh

Although the imported geometry has a surface mesh, this mesh needs to be improved. Therefore, choose

Mesh » edit surface parameters
select to mesh all surfaces on the boundary codes tab and set the other values as shown in Figure 5 and click OK.
Figure 5: Create Surface Mesh - You can copy from the code below:
damper_top = 0.05;
damper_bottom = 0.05;
damper_left = 0.05;
damper_right = 0.05;
damper_back = 0.05;

Note: The rules for the mesh resolution will be combined automatically by enGrid meaning they may look different when re-opening the view.

Now select

Mesh » create/improve surface mesh
and adjust the options as given in Figure 6:
Figure 6: Surface Mesher

The meshing process will start after clicking on OK. You can watch the progress in the output window. Note the message on the bottom of enGrid's main window telling you the application is working. When the calculation has finished, click into the 3D view to update it. You can use the V-key to open the select boundary codes dialogue and select what is shown (e.g. deselect the symmetry-plane to look inside the geometry).

Start the surface meshing process several times (Mesh » create/improve surface mesh) to improve the mesh using the settings as above. Watch the fluctuation ratio and change ratio dropping in the Output window. A negative change ratio can often be used as an indicator for the quality of the mesh, but you need to verify it visually. You should see something like Figure 7 after executing the process three times.

Figure 7: Improved Surface Mesh

Improve Damper Edges

The mesh of the damper edges needs to be improved. Choose

Mesh » edit surface parameters
and add a rule for the mesh resolution of the damper's edges like:
damper_top <AND> damper_left = 0.01;
damper_top <AND> damper_right = 0.01;
damper_top <AND> damper_back = 0.01;
damper_bottom <AND> damper_left = 0.01;
damper_bottom <AND> damper_right = 0.01;
damper_bottom <AND> damper_back = 0.01;

Figure 8 shows the resulting rules.

Figure 8: Settings To Improve Damper Edges

Select

Mesh » create/improve surface mesh
to start the meshing process. Ensure to use select number of iterations=5 and number of smoothing steps per iteration=2 as shown in Figure 6.

Note: You can avoid changing these values for every step by adjusting the default values. The relating dialogue can be found on the surface meshing tab in

Tools » Configure enGrid.
The respective default options are shown here: Default Settings


Deselect displaying the duct's walls by pressing the V-key and the duct's boundary codes. Rotate the damper to ensure the meshing of the edges corresponds to your needs.

Figure 9 shows the resulting mesh:

Figure 9: Improved Meshing of the Damper Edges

Improve Surface Mesh In The Border Zone Of The Damper And Duct

Choose

Mesh » edit surface parameters
switch to the sources tab and select add cone. Then click on the edit button and update the values within the dialogue as given in Figure 10.
Figure 10: Adding a Cone

Click OK two times and select

Mesh » create/improve surface mesh
to start the meshing process. You need to start the meshing process a second time to ensure proper meshing. You should now have a mesh similar to Figure 11.
Figure 11: Improved Mesh in the border zone of the damper/duct

Note: You might need to ensure the duct's faces are displayed by selecting them (V-key).

Ensure to save your work as Damper_S3.egc.

Defining a Volume and creating a Volume Mesh

Define Volume

A volume can be defined by adding a new volume, indicating which boundary codes are part of it and which colour the outer side of the boundary relative to the volume currently has. To do this, select:

Simulation » Edit boundary conditions
  1. Add a new volume by entering a name like vol in the new volume field and clicking on add.
  2. In the new column vol, set all cells to green by double-clicking on them, select green from the drop-down box and then click OK.

Create the Volume Mesh

Creating a first volume mesh, including the boundary layer, is fairly easy now. To create the grid, simply select:

Mesh » create prismatic boundary layer
You need to select all physical walls. To do so, select all boundary conditions and then deselect the symmetry plane (1), duct_left (5) and duct_right (6). Then LMB-click on vol to select the volume. Ensure to set the other options to the values given in Figure 12.
Figure 12: Create prismatic boundary later

Click OK to start the meshing process. You can watch the progress in the output window on the left side of the screen. Again enGrid indicates that it is busy in the status line at the bottom of the window.

You can display the volume mesh as soon as enGrid has finished the computation. You'll find an area labelled elements on the right hand of enGrid's main window. Select enable volume elements, deselect enable surface elements, then click on redraw. You'll realize that only the boundary layer has been filled with a volume mesh. Please choose

Mesh » create/improve volume mesh (NETGEN)
to ensure all volumes are meshed. Select vol within the dialogue and click OK.

The resulting volume mesh should look like Figure 13.

Figure 13: Volume mesh

Improve Volume Mesh Within The Boundary Layer

The volume mesh within the boundary layer needs to be refined to allow good simulation results. This can be done by dividing the prism layer into several layers. Choose

Mesh » divide prismatic boundary layer
from the menu and select the vol as volume. Keep the default values for the other options and click OK.

DO NOT FORGET: you can only divide the boundary layer if you already have both the initial boundary layer and volume mesh, as shown in the previous section!


See Figure 14 showing the improved volume mesh.

Figure 14: Improved boundary volume mesh

Extruding A Volume Mesh

EnGrid allows to extrude a volume mesh. Do do so, choose

Mesh » extrusion
from the menu.

Use the settings as given in Figure 15 to extrude the volume mesh in input direction of the duct and the settings as given in Figure 16 to extrude the volume mesh in output direction of the duct.

Figure 15: Settings for Extrusion of the volume mesh (left)
Figure 16: Settings for Extrusion of the volume mesh (right)

Note: The left side has been extruded using an increasing cell height (increase factor = 1.1) whereas a fixed cell height has been used for the right side (increase factor = 1).

Figure 17 shows the resulting mesh.

Figure 17: Extruded volume mesh

Export To OpenFOAM

Finally, after finishing the mesh, enGrid allows to export it to OpenFOAM. This can be done by selecting

Export » OpenFOAM » OpenFOAM (grid only).
if you want to export the grid or
Export » OpenFOAM » OpenFOAM (grid+solver parameters)
if the solver parameters should be exported, too.

...

...

...

Clone this wiki locally