.. include:: ../icons.inc Mesh preparation ================ .. note An alternative to the manual mesh preparation, using IMAS, is presented in section :ref:`inres1-case-imas`. In *Mesh module* we can mesh different types of geometry. In this HOWTO we will first explain how to mesh geometry files within Mesh module and the we will explain how to import NASTRAN mesh files. Meshing CAD geometry -------------------- First we must activate the Geometry module. We can activate the Geometry module with a click on |icon_geometry_module| button from the toolbar. Then we go to :menuselection:`&File --> Import` and there we can import different geometry files, which we select from file browser. When we choose the file, we can see the geometry with the click on |icon_visiblemesh| next to the name of our geometry in ``Object Browser`` under Geometry. If there are no meshes displayed, you can right-click on |icon_geometry_module| ``Geometry`` and select ``Expand All``. Then we go to toolbar of OCC scene and we select |icon_globalpanning| ``Global panning`` to see the selected geometry. .. note:: It is also possible to create your own geometry in Geometry module. For more information you should check **Salome Documentation**. Now we can move to Mesh module by clicking |icon_mesh_module| in toolbar. To create mesh hypothesis of our geometry, we select |icon_mesh_init| from mesh toolbar. THe following dialog appears on screen. .. image:: images/meshprep_1a.png :align: center In this dialog we define the name of our mesh. Then we select geometry from Geometry module in ``Object Browser`` that we want to mesh. In ``Mesh type`` options we select type of mesh and then we can apply appropriate algorithm for 3D, 2D or 1D mesh. Different algorithms are possible for each type of mesh. If our mesh type is triangular, we can choose Mefisto algorithm or more advanced algorithms like 2D projection, polygons per faces and manually created faces. At the bottom we have an option ``assign a set of hypotheses``. When we select a hypothesis, new dialog appears on screen. In this dialog we can set name for our hypothesis, number of segments and type of distribution. .. image:: images/meshprep_1b.png :align: center In this dialog we can define mesh density. After we click :guilabel:`OK` and then apply, options for the meshing algorithm are stored. To compute a mesh, we right-click on name of our mesh in ``Object Browser`` under |icon_mesh| mesh. From selected options we click |icon_mesh_compute| ``Compute`` button and computation starts. When computation is finished, the dialog with mesh information appears on screen. .. note:: For detailed examples on meshing geometry parts, meaning of meshing algorithms and space modelling check Salome documentation. +------------------------------------+---------------------------------------+ | Mesh Module - important icons | | | | | +====================================+=======================================+ | |icon_visiblemesh| Visible mesh | Makes mesh visible in VTK viewer in | | | the Mesh module. | +------------------------------------+---------------------------------------+ | |icon_globalpanning| Global Panning| Resizes VTK viewer to fit current mesh| | | on screen. | +------------------------------------+---------------------------------------+ | |icon_mesh_init| Initialize mesh | Opens dialog to define mesh type and | | | algorithm. | +------------------------------------+---------------------------------------+ | |icon_mesh_compute| Compute Mesh | Computes mesh. | +------------------------------------+---------------------------------------+ Importing NASTRAN meshes ------------------------ Now we will show how to mesh Inres1 tile from NASTRAN file. Provided input data are NASTRAN geometry files with ``.dat`` extension, that contain mesh information for both target and shadow surfaces. Our goal is to convert those files to SALOME meshes that will be used later on. To convert NASTRAN file to mesh, we choose |icon_mesh| ``NASTRAN to MESH`` function. New dialog Get mesh from NASTRAN file is created. It contains options for input file and mesh name. If we click on |icon_buttonthreedots| button, a file browser appears and we can navigate to appropriate :file:`.dat` file. Once the file is chosen, we can define name for mesh. Then we click :guilabel:`Apply`. We can see meshes in :guilabel:`Object Browser`. To display mesh, we can navigate to mesh module by right-clicking on |icon_mesh| Mesh and choosing ``Activate Mesh Module``. In Mesh module we click on |icon_visiblemesh| next to the name of our mesh to make the mesh visible in VTK scene. In toolbar of VTK scene we click on ``Global Panning`` to see the mesh. .. figure:: images/meshprep_2.png :align: center Global panning in SMESH module. Building submeshes ------------------ In this section we will divide one single mesh into two submeshes. The geometry we will use is ITER first wall panel. We will divide this panel into two subpanels. In the image below we can see the selected panel. .. index:: Observed panel. .. figure:: images/panel.png :align: center Observed panel. We want to mesh the left and right subpanels separately. To do that, it is the most appropriate to show the panel in :math:`x` -direction. To do that, click on the icon as shown in image below. .. index:: Panel observed from :math:`x` -axis. .. figure:: images/panelXdirection.png :align: center Panel observed from :math:`x` -axis. Let us first create a copy of the existing mesh. To do that, select the chosen mesh in Object Browser and then click icon. New dialog appeares on screen. In the argument section next to Source Object we can see the name of the existing mesh. Below we can insert the name of new mesh. After we are done, we click *Apply and Close* and new mesh is generated in Object Browser. .. index:: Creating a copy of mesh. .. figure:: images/copyMesh.png :align: center Creating a copy of mesh. Now we can remove elements from existing mesh and create left subpanel.We go to the toolbar and click Modification->Remove->Elements. Then we select elements in the viewer scene that we want to remove with the left mouse click. If we want to select multiple elements, hold down shift while selecting elements. Selected elements are colored in yellow as shown in image. When we are done, we select *Apply and Close* and selected mesh is now presenting only the left side of the panel. We have to repeat the same process with the copied mesh in order to get the right side of panel. .. index:: Removing elements from mesh. .. figure:: images/removeElements.png :align: center Building a Compound out of multiple Meshes ------------------------------------------ Suppose we have multiple individual meshes in ``Mesh`` module that we want to merge into one single mesh. To do that, we have to select meshes in ``Object Browser`` (To select multiple meshes, hold down ``ctrl`` button and select meshes with right-click). .. index:: Selecting multiple meshes. .. figure:: images/SelectingMultipleMeshes.png :align: center Selecting multiple meshes. After selection we move to header bar and select :menuselection:`&Mesh --> Build Compound`. .. index:: Selecting Build Compound. .. figure:: images/MeshBuildCompound.png :align: center Selecting Build Compound. New dialog appears on screen. In the *Result* name table you can type the name of a new compound mesh. In the table *arguments* you see the selected objects. After you are done with setting options for new generated mesh, click *Apply and Close*. A new mesh will appear in ``Object Browser``. .. index:: *Create A Compound* Dialog. .. figure:: images/CreateACompound.png :align: center *Create A Compound* Dialog. Moving Meshes in 3D Space ------------------------- The most important transformation operations in moving meshes are rotation and translation. Translation of Mesh objects ~~~~~~~~~~~~~~~~~~~~~~~~~~~ To translate object in a certain direction, we must firstly move to toolbar and go to :menuselection:`&Modification--> Transformation--> Translation`. .. index:: Selecting *translation* option. .. figure:: images/modification_translation.png :align: center Selecting *translation* option. When we click on Translation, new dialog opens and in the translation table we can select the type of definition of translation. First option allows us to define translation via two points (starting point and ending point of translation) and second option defines translation via vector. First we have to define Element IDs in Arguments sector that we want to translate. Below this selection we can select a checkbox if we want to translate whole mesh, sub-mesh or group (which is for the majority of cases), otherwise not (for example if we want to move only individual nodes, then this checkbox is unnecessary). Then we type in the coordinates of starting and ending points of translation. For example, if we want to move mesh for *10 mm* in :math:`x` -direction we would define *Point 1* and *Point 2* coordinates as | :math:`x1` = 0, :math:`y1` = 0, :math:`z1` = 0 | :math:`x2` = 300, :math:`y2` = 0, :math:`z2` = 0 Here only the distance between two points matters. This means that if we changed x coordinates to :math:`x1` = 200 mm and :math:`x2` = 500 mm, the result would still be the same. Fo you wish to see preview of moved mesh select option *Preview* in the *arguments* sector, located at the bottom. .. index:: Translation dialog. .. figure:: images/Translation.png :align: center Translation dialog. If we want our translated mesh to be stored in study as new mesh, we have to select option *Create a new mesh* and insert name of new mesh in line next to selected option. If we just want to move already existing mesh, select option *Move Elements*. If you want to copy elements and generate groups from this new copy, select option *Copy Elements* and then *Generate groups*. In the end click *Apply and Close*. For more help, click *Help* button. If you selected second option of translating the mesh, the procedure is the same, only here you have to type in the scalar components of translating vector. Rotation of Mesh objects ~~~~~~~~~~~~~~~~~~~~~~~~ To rotate object around certain vector, we must firstly move to toolbar and go to :menuselection:`&Modification--> Transformation--> Rotation`. .. index:: Selecting *rotation* option. .. figure:: images/modification_rotation.png :align: center Selecting *rotation* option. After we click on *Rotation*, a new dialog appears on screen. In the Arguments sector, we can select Element IDs that we want to rotate. Below this selection we can select a checkbox if we want to rotate the whole mesh, sub-mesh or group (which covers the majority of cases), otherwise not (for example if we want to rotate only individual nodes, then checking this checkbox is unnecessary). In the axis subsection we have to define two main parameters for rotation. Firstly, we have to define a starting point of rotation axis and then a vector that is coincident with the rotation axis. In our case we have defined a starting point at the origin of coordinate system. The rotation vector coincides with z-axis. The value of :math:`dZ` must be non-zero and :math:`dX` and *dY* must be zero. Then we must determine the angle of rotation around the chosen axis. In our case this angle is *120 Deg*. To see the preview, select option :guilabel:`Preview`. .. index:: Rotation dialog. .. figure:: images/Rotation.png :align: center Rotation dialog. If we want our rotated mesh to be stored in a study as a new mesh, we have to select option *Create a new mesh* and insert the name of new mesh in line next to selected option. If we just want to move an already existing mesh, select option *Move Elements*. If you want to copy elements and generate groups from this new copy, select option *Copy Elements* and then *Generate groups*. In the end click *Apply and Close*. For more help, click *Help* button.