You are on page 1of 15

CFD tutorials GAMBIT

INTRODUCTION CASE STUDY: Meshing the P-II buildings rea de Mecnica de Fluids EMCI, EPS

Introduction
Fluid dynamics is a discipline that encompasses a wide variety of scientific and technical systems. Historically, fluid dynamics analyses have been carried out by means of analytical approximations with a narrow range of applicability and of expensive experimental studies. Very recently, however, a new technique has arisen, which is based on the numerical integration of the fluid dynamics governing equations. Currently, there exists both open source and commercial general-purpose models that may deal with a wide variety of problems. These software packages are called CFD (Computational Fluid Dynamics) and are rapidly spreading in many disciplines. In short, the simulation process contains three basic steps:

1. Preprocessing This initial step consists of defining the problem geometry, discretize it in small control volumes (mesh) and determine the suitable boundary conditions as well as initial conditions. The mesh generation corresponds to one task within the multiples ones carried out in the preprocessing step. 2. Solver This step refers to the code execution and includes the monitorization of the solution.. 3. Postprocessing This is the final step where we analyze the results obtained from the simulation..

1. Introduction to GAMBIT
Here we use Gambit software for generating meshes. In essence the mesh consists of a discretization of the fluid domain into small control volumes called elements. For a better simulation, the mesh must follow a given quality criteria, use the most suitable surface (triangles, quads, etc.) and volume (tetrahedral, hexahedral, prism, pyramids, etc.) elements. To start Gambit, make a double click on the icon Gambit 2.2.30.. It opens a window where we have to choose the working directory and select run (Run ).

Fig. 1.1. Initial window of the Gambit software. Here we choose the working directory.

In Fig. 1.2 we show the initial window of the Gambit software.

Fig. 1.2. Initial Gambit window.

It is essential to know how to interact with the Gambit graphical interface. Thus:

Right click on the mouse: Zoom. Middle button: Translation. Left click on the mouse: Rotation.

In the upper right corner we find the icons corresponding to the main four operations (Operation) that we may carry out within Gambit: Geometry, Mesh, Zones (determine boundary conditions) and Volumes (from left to right).

Fig. 1.3. Main operations icons.

Each one of these main operations contains a subgroup of icons that allow us to perfrom several tasks. For example, by clicking on the main geometry icon, a new window appears as in Fig. 1.4 where we can carry out operations with vertexs, edges, faces, volumes and groups..

Fig. 1.4. Icons for performing several tasks within the geometry option.

In Fig. 1.5 we show an example of generating a volume.

Fig. 1.5. Generating a brick (volume).

On the other hand, within the mesh icon, we also find several options:

Fig. 1.6. Possible operations within the mesh option.

In Fig. 1.7 we show how to mesh the volume above generated.

Fig. 1.7. Meshing a volume.

In Fig. 1.7, in the lower right corner we see the Global Control window that takes all the information related to the visualization into account. Among these multiple options, the most useful ones are the icon for visualization the full object (1), back and forward operations (2), visualization options (3), types of rendering (4) and mesh examination (5).

Fig. 1.8. Icons for improving the visualization of our problem.

Instead of generating the geometry with Gambit, another possibility is to import a geometry already designed with an external software program. Gambit allows us to import geometries in a wide variety of formats, all common to CAD/CAE codes. This

can be done by choosing File Import in the main menu bar. Then we select the type of file we want to import.

Fig. 1.9 i 1.10. How to import geometry built within an external CAD/CAE software.

In the visualization window, and within the standard parameters of the Gambit software, green edges tell us that the geometry corresponds to a closed volume. In contrast, blue edges would correspond to faces (surfaces) without forming a closed volume. Finally, yellow edges make reference to lines that do not form neiter a surface nor a volume. Since the discretization task of the fluid domain essentially deals with three dimensional (3D) bodies, we need to work with well-defined volumes and not only with surfaces.

Gambit software has a very useful tool, called Size Function, that allows to define those regions (lines, faces, volumes) that require a refinement on the element size. This tool is activated by clicking on the last of the main Operation icons, and choosing the second Tools icons (see Fig. 11). There, in the Create Size Function window, we choose the following options: Source Volumes, Faces, Edges, Vertices (to specify the mesh starting point). Attachment Volumes, Faces, Edges (to specify the region where the Size Function will apply to). Then, we shall define the values of the parameters (Parameters): Start size (element size on the source region), Growth rate (from the source region to the attached one) and Size limit (maximum element size in the attachment region). In addition, we may identify the size function with a name (Label) and select Apply.

Fig. 1.11. Size Function.

In what follows we show how the mesh of our volume is generated. Note that we have already apply the Size Function tool. Figure 1.12 clearly shows the surfaces where we have specified a refined mesh that increases in the element size as it enters to the attachment volume.

Fig. 1.12. Mesh visualization.

Now, by clicking the lower right icon, we can examine the mesh. An example of the result is shown in Fig. 1.13.

Fig. 1.13. Cut plane to visualize the mesh.

2. Case study: meshing the P-II building


In this section we will carry out a practical mesh study. It consists of meshing the air volume above some of the Politechnic buildings, such as the P-II and the Tallers. Once exported, this mesh may be used in different solver codes. The purpose of this mesh is to analyze the wind behavior in order to define the most suitable location for installing a wind generator. Let us open Gambit and select the proper working directory. Once the graphical user interface has been opened, let us import the file that contains the geometry as it is shown in figure 2.1. Note that Gambit allows us to import geometry files in different electrocin formats. In our case, you will find the file PII.igs in your working directory.

Figure 2.1. How to import the geometry file.

Once imported, the geometry will appear in the visualization window in a similar way as it is shown in figure 2.2. Note the icons on the upper right, where the activated operation corresponds to Geometry. This option allow us to select different icones related to vertexs (points), edges (lines), faces (surfaces), volumes and groups (set of different geometrical elements). In the visualization window, the green color reveals that our geometry satisfy the requirements of being a close volume. Let us take a look on the geometry, noting the simplification on defining the small hill near the buildings.

Figure 2.2. Geometry imported in Gambit.

Now, let us discretize the fluid volume shown in figure 2.2. Here, we require small elements near the surface of buildings since, there, the velocity field will greatly vary. Therefore, the most suitable option is the apply an unstructured mesh formed by triangles on surfaces and tetrahedral on the volume. Gambit makes use of a tool, called Size Function, that allows us to define those regions (edges, faces, volumes) that require a smaller size element in order to better represent the actual flow behavior. This tool is activated by choosing the rightmost icon of the main Operation menu and by choosing the second Tools, as we show in figure 2.3. Then, within the Create Size Function window, we choose the option Source Faces, since we will perform an intensive mesh on the building surfaces. In this example, we choose only those surfaces corresponding to the hill and the buildings. For doing so, we keep press the Shift button and click on the visualization window in order to capture all elements. Then, in the Face List (Multiple) window, we shall move to the Available zone all the surfaces that will not use an intensive mesh (i.e., all virtual surfaces of the fluid domain; faces 1, 229, 230, 231, 232 i 233; see figure 2.3).

Figure 2.3. Define sources for the Size Function option.

Then, we fill the parameters of the Size Function window following figure 2.4. Note that in Entities Attachment, we shall select Volumes and include our unique volume. Value 1 in the Start size field implies a characteristic size for the surface elements labeled as Source equal than 1 m (the scale is in meters). On the other hand, the Max. size field makes references to the maximum element size reached in all the elements included in the Attachment. Here we write 8 m. Finally, the Growth rate of the elements starting at the Source and reaching the volume define withn the Attachment field is equal to 1.2 (as in figure 2.4.). Please note that the characteristic element sizes here used is very large since we are dealing with a simple tutorial. A detail study would require a much more refinement in order to properly capture the effects of the boundary layer. However, this would imply a very slow execution since it would require high computational resources.

Figure 2.4. Size Function parameters.

Once we have defined the Size Function, it is time to determine the parameters of the mesh volume. This is achieved by choosing the mesh icon on the main Operation bar on the upper right side. From the Mesh menu, we click on the volume icon (the other options would allow to define the boundary layer and mesh specific lines and surfaces). By doing so, we find several icons below the Volume one. By choosing the first one, a new window will arise, very similar to that shown in figure 2.5. Here we may vary the characteristic size of volume elements. Prior to that, we shall select the volume to mesh in Volumes and to define the element types in Elements. Since, as explained above, we require an unstructured mesh, we choose the Tet/Hybrid element types in order to better represent the fluid domain. Then, we click on the Spacing option and write 8. This corresponds to the 8 meters as the characteristic maximum element size allowed within the fluid domain. Finally, we select Apply and Gambit starts meshing the volume.

Figure 2.5. Parameters for the volume mesh.

The mesh generated by Gambit will be similar to that shown in figure 2.6, where the surface discretization in terms of triangles is shown. Note the refinement regions, corresponding to the surfaces defined in the Size Function tool. Here, it is important to point out the information arisen in the Transcript field, on the lower side of the window. There, Gambit gives us information on the total number of elements required to mesh the entire fluid domains (507976 for the example shown in figure 2.6.). In the very same field, Gambit will provide information of any problem that may arise during the meshing process. For example, we can find messages pointing out a number of highly skew elements (> 0.97) that may invalidate the solution during the execution process. On the other hand, a message of inverted elements warns us that there are elements with negative volumes, being impossible to solve within the execution step. In this case, a remeshing of the entire fluid domain would be required, with different parameters in order to solve this problem.

Figure 2.6. Surface mesh.

The mesh shown in figure 2.6 corresponds, only, to the surface one. The Gambit software allows us to visualize the mesh in several cut planes. For doing so, let us click on the lowest right icon that opens a new window called Examine Mesh, (see figure 2.7). Here, we shall choose the tetrahedra option in the 3D Element box. This opens a new window with information on the mesh quality and, also, with the possibility to visualize the volume mesh in different cut planes (as in figure 2.7). Note that by changing the axis in the Cut Orientation option, you may change the plane.

Figure 2.7. Cut plane to visualize the volume mesh.

Now, we need to define the boundary conditions. In Gambit, boundary conditions are applied by clicking on the third icon of the main Operation bar. This opens a Zones menu with two different icons. The first one allows us to specify the type of boundary conditions on those surfaces that delimit the fluid domain. By choosing this option, a new window arises, being similar to that shown in figure 2.8. Here, in the Faces box we must select all the surfaces that satisfy the same boundary condition. This is chosen among the multiple options that appear in the Type box. All these surfaces will be identified with the label introduced in the Name box. In our example, let us creat six different boundary conditions corresponding to the surfaces that delimit the fluid virtual domain. Thus, we shall define a north, east, south, west and sky boundaries, each one containing a single surface of type wall and, finally, a boundary condition for the remaining surfaces (ground) also of type wall.

Figure 2.8. Definition of boundary conditions.

Now, we can save the mesh in a format suitable for many solver codes (ANSYS CFX, STAR CCM+,...). This is carried out by selecting File Export msh, that will open a new window where you may write the name of the file being stored in the working directory.

You might also like