Important:
MESHFREE needs the surface/shell of the considered geometry.
MESHFREE is able to read-in different geometry formats:
-
- STL (ASCII)
- FDNEUT (native Fidap Neutral geometry format)
- PAMCRASH
- NASTRAN
- GMSH
- OBJ
Especially
OBJ and
STL are formats, that can easily be generated by most of the classical CAD-tools.
STL is widely used, however consumes a lot of memory.
OBJ is more efficient in memory, however the standard of this format is more extensive, not all features are implemented in
MESHFREE.
The problem using
STL or
OBJ consists in the fact, that the user usually does not have control over the orientation (inside/outside) of the shells, which however is a necessary information for
MESHFREE.
There are several features to control the orientation during start-up of
MESHFREE.
A true control of the orientation and the way of surface triangulation can be taken by using the free open-source software Gmsh. If you intend to work with formats like
STL or
OBJ (native CAD formats), you can skip this section.
In the tutorials, the geometries are mostly given as Gmsh-generated files. It is clear, that the geometry could be given in different ways, of course.
Goals of this Unit:
-
- Creation of the geometry with Gmsh.
Three Dimensional Geometry Generation:
If we want to generate the geometrical configuration file with Gmsh the following steps have to be done in order to get the information required by
MESHFREE:
-
- Construction of the geometry
- Generation of a mesh for each face which does not belong to a volume
- Generation of a mesh for each volume (in case a volume has been constructed at all)
- Specification of the boundary type ("WALL") and naming faces or groups of faces
- 2D the meshing and save the mesh.
In a three dimensional setting volumes are not necessary. It suffices to build the faces, because
MESHFREE only requires the geometrical information for the faces. If any face or boundary is not required even after the generation of the mesh by Gmsh one can simply ignore the unnecessary face or boundary by using the flag "IGNORE" in the
ALIAS section in "USER_common_variables.dat".
begin_alias{}
...
"groupname" = " IGNORE "
...
end_alias
How to generate a geometry using Gmsh:
Gmsh generates two kinds of files, namely filename.geo and filename.msh. The first file deals with the operations used to define the geometry and the second file contains the mesh generated by Gmsh.
To open Gmsh in Linux, you may use a shortcut of the following type:
alias mygmsh='/path/to/gmsh/gmsh &'
An alias can be defined in the start-up file, such as by editing .bashrc .
-
- kate ~/. bashrc &
- Edit alias section.
- save the file
Now the shortcut command is active any time a Linux-bash shell is launched.
Now, Gmsh can be started by using the command mygmsh (since the alias is defined in this way, one can change this name accordingly).
At the moment when the Gmsh window appears a file untitled.geo at the current directory where user has opened the Gmsh is generated.
The interface of Gmsh has the following options to use:
Modules
1.
Geometry.
2. Mesh.
3. Solver.
We will not use its solver section.
Starting with Gmsh:
(Here we generate a geometry using Gmsh).
The reader should be familiar with the geometry which will be created in this section; the annulus. The mesh will be of higher resolution.
The following steps will be undertaken:
-
- Create the geometry using the Gmsh GUI:
-
- A rectangle will be formed. This rectangle represents a radial plane through the annulus.
- The plane will be extruded-rotated in order to form a quadrant of the annulus.
- The above step is then repeated, until the complete annulus is formed.
- Define physical groups.
- Customize the geometry by editing the geometry script file.
- Produce a mesh.
Creating the geometry: Forming an annulus with extrusions
Through the interface go to "Geometry>>Elementary entities>>Add>>Point"
and create the three points (2.5,0.0,0.0), (5.25,0.0,0.0), (8.0,0.0,0.0).
Figure 1:
The click at "Point" will create a "Contextual Geometry Definitions" window as shown in Figure 1.
At the first three spaces, the coordinates of the wanted point have to be defined and afterwards the point has to been added. Moving the mouse over the Gmsh window while adding a point may change the value of the coordinates in an unwanted way.
The above created points should lie on a line along the x-direction and form a radial line across the annulus. Create two lines: the first line should connect point 1 and point 2 and the second line point 2 and point 3. This can be done by clicking on "Geometry>>Elementary entities>>Add>>Straight line" and select via mouse the points which form the line. Now, extrude the lines to create surfaces ("Geometry>>Elementary entities>>Translate>>Extrude line" ) as shown in Figure 2.
Figure 2:
Fill in (x,y,z) = (0.0,0.0,14.0). Note that both lines should be selected during the extrusion step. Finally change the view of point, so that you can see the rectangles just created, the result should be something similar as in Figure 3.
Figure 3:
The next step is to extrude-rotate the rectangular surface in order to create the annulus .
-
- Go to the top of the geometry module in the Gmsh menu window.
- Click on Geometry>>Rotate>>Extrude surface. The contextual Geometry Definitions window will appear, on the Rotation tab. Also they will now be high-lighted on the graphic window, as red. The window is used to define the axis of revolution and the sweeping angle. The axis of revolution is defined by specifying any point on it and the components of a vector parallel to the axis. In addition, the sweeping angle must be specified in radians, in the anti-clockwise sense.
- Change the parameters in the Contextual Definitions window to the following:
0,0,0,0,0,1,pi/2.
- Pick both the surfaces on the graphic and press "e" ("e" is for adding the selection "u" is for undoing the last selection and "q" is for abort the mission.). A quarter of the annulus should have been formed in the graphic window, as shown in left panel of Figure 4.
Figure 4:
Without changing the parameters in the "Contextual Geometry Definitions" window, pick the newly formed surfaces normal to the x- axis. And press the "e" key, to form half of the annulus. Repeat the procedure to form the complete annulus, shown in the right panel of Figure 4.
Physical Groups:
In case of 3D,
MESHFREE needs only surfaces of the boundaries. So if created at all delete the volumes using "Geometry>>Delete>>Volume". Doing so a small ball with yellow color will appear, selecting this volume will turn it red.
-
- Go to the top of the Geometry module in the Gmsh menu window.
- Click on "Geometry>>Physical groups>>Add>>Surface". Select the surfaces needed to be specified as boundaries and press "e". All the surfaces selected in this way will from one group. If another group should be formed, pressing "e " will differentiate between the groups.
- Open the script file i.e. filename.geo. Here, the names of the groups can be changed.
Meshing:
Before meshing the normal size has to be changed. In order to do so go to "Tools>>Options>>Mesh>>Visibility>>Normals and Tangents" and change the first space to 20 (or accordingly as shown in Figure 5).
Figure 5:
Also, the Element size factor should be changed to 0.1. Therefore, go to "Tools>>Options>>Mesh>>General".
Now go to the Mesh section and build a 2D mesh by clicking on "Mesh>>2D". Go to "File" and save the mesh ("File>>Save Mesh").
Close Gmsh.
Change the name of the files generated by editing its name.
Note:- Before meshing user needs to reload the file (Geometry>>Reload), in the case that changes have been done by the user that should be reloaded by Gmsh.
Understanding the steps of filename.geo:
Figure 6:
Open the file cube.geo in
tut3d_01, a window as in Figure 6 will appear.
The first two lines of the document show that two points have been created followed by their corresponding coordinates.
The third line implies that a line has been generated connecting Point(1) and Point(2).
The fourth line says that in the direction of the x-axis (positive direction) Line{1} has been extruded to form a rectangular geometry.
Fifth line tells that the surface created has been extruded in the positive direction of z for one unit, to form a cube.
After that each line shows that a physical group has been added each time "e" was pressed (while preparing the geometry using Gmsh). The names of the physical groups can be changed by writing "User_defined_Name" between the brackets following the text "Physical Surface" .
Note :- While saving the mesh one should check the direction of the normals in Gmsh. If normals are pointing out side to the volume then it is correct if not the flag
REV_ORIENT has to be used in front of the alias definitions of the corresponding surfaces in User_common_variables.dat.