Salome HOME
Readded with -kb flag.
[modules/smesh.git] / doc / html / SMESHTutorial_1 / SMESHTutorial_1.html
1 <!DOCTYPE HTML PUBLIC "HTML 4.01 Transitional">
2 <html>
3 <head>
4   <meta http-equiv="Content-Type" content="text/html">
5   <title>Geometry module in SALOME environnement </title>
6 </head>
7
8 <body>
9 <h1>SMESH starting tutorial</h1>
10
11 <h2>2D meshing with MEFISTO</h2>
12
13 <h3>Overview</h3>
14
15 <p><i>Before following this tutorial you need to create or import a geometry.
16 Please refere to the GEOM module documentation to do so.</i></p>
17
18 <p>Now we have to load SMESH component. To do so&nbsp;: </p>
19 <ul>
20   <li>click on the SMESH icon or on 'SMESH' into the combo box of resources
21     on botton left.</li>
22 </ul>
23
24 <p><i>SMESH is used to mesh edges, faces and volums each one thanks to a
25 specialised algorithm. To mesh an entity which degree is n, one must have all
26 its lower degree entities meshed. For instance, to mesh a face requires a
27 previous meshing of all its edges. In the example MEFISTO meshes faces, and
28 Regular_1D meshes edges. MEFISTO doesn't check how edges are meshed. The only
29 test it does is to verify that edges are meshed before starting its work.
30 MEFISTO requires an hypothesis&nbsp;: maximum area of triangles. Regular_1D
31 requires one hypothesis among two: number of segments per edge <u>or</u>
32 length of segment.</i>&nbsp; </p>
33
34 <p>The entire operation is done by :</p>
35 <ol>
36   <li>init a mesh object associated to a geometrical object</li>
37   <li>choosing an <u>algorithm</u> for meshing faces, here MEFISTO is
38   choosen</li>
39   <li>choosing an <u>algorithm</u> for meshing edges, here Regular1d is
40     choosen</li>
41   <li>creating <u>hypothesis</u> of calculation. We need to inform :
42     <ul>
43       <li>the number of segments per edge</li>
44       <li>the maximum area per triangle of meshing</li>
45     </ul>
46   </li>
47   <li>setting or attaching algorithm and hypothesis to the object loaded</li>
48   <li>launching computation</li>
49   <li>displaying the result in the best mode.</li>
50 </ol>
51 <img alt="" src="SMESHOverview.png">
52
53 <h3>Details</h3>
54
55 <p>Below are explained those 6 steps precisely&nbsp;: </p>
56 <ol>
57   <li><p><u>init a mesh object associated to a geometrical object :</u></p>
58     <p><img src="MeshInit.png"></p>
59     <ul>
60       <li>In the menu bar on the top, find the <u>Mesh</u> menu and click on
61         <u>Init.</u></li>
62       <li>Then in the dialog box select the topology into Geometry field of
63         ObjectBrowser or Viewer, give a name an click on Ok.</li>
64       <li>The topology is now known inside SMESH component.</li>
65     </ul>
66   </li>
67   <li><p>define algorithms for meshing&nbsp;: </p>
68     <p><img src="SelectAlgorithms.png"></p>
69     <ul>
70       <li>In the menu bar, find <u>Hypothesis</u>, <u>Algorithm</u> then
71         click on <u>Mefisto.</u></li>
72       <li>Do the same to load 'Regular1D'.</li>
73       <li>Remember, Regular1D is needed for edge meshing.</li>
74     </ul>
75   </li>
76   <li><p>define <u>hypothesis</u> of calculation&nbsp;:<br>
77     In the menu bar, find <u>Hypothesis</u> then Hypothesis and click on
78     Segments. Then in the dialog box give a name for <u>hypothesis</u> and a
79     value that is the number of segments per edge. Enter 7 segments for
80     example.<br>
81     Do the same for 'Max. Element Area' argument that is the maximum surface
82     of triangles builded during meshing. Enter 2500 here.</p>
83   </li>
84   <li><p>Attach previous arguments (hypothesis) and algorithm to the
85     topology&nbsp;:<br>
86     Select the object in the Object Browser then using pop up menu (right
87     click on object),<br>
88     'Set algorithm' and 'Set Hypothesis' into specialized dialog boxes.<br>
89     You can also find these methods in the menu 'Hypothesis'.</p>
90   </li>
91   <li><p>Selecting the mesh object before, start computation in the pop up
92     menu; click on 'Compute'.</p>
93   </li>
94   <li><p>Update the display using '<i>Update'</i> if necessary.<br>
95     Note&nbsp;: in <i>Preferencies</i>&nbsp;/ <i>Mesh</i> menu there is an
96     option to have an automatic update of the display after operations that
97     modify it such as Compute, adding nodesâ&#x20ac;¦ If this option is not
98     setted user must make an update of the display manually.<br>
99     <br>
100     You may also adjust the display '<i>Properties' / 'Display Mode</i>' has
101     you prefer&nbsp;; shading, wireframe or shrink,<br>
102     and adjust color and size attributs in a specific dialog box shown
103     below.</p>
104     <p><img src="SetColor.png"></p>
105   </li>
106 </ol>
107
108 <h3>Final result of meshing</h3>
109
110 <p>At this final step you can observe the result of 2D meshing of faces by
111 MEFISTO.</p>
112
113 <p>Note&nbsp;: it is possible to change an hypothesis by mean the pop up then
114 <i>Edit</i> and finally compute again.</p>
115
116 <p><img src="MeshResult.png"></p>
117
118 <h2>Meshing with global and local hypothesis</h2>
119
120 <h3>details</h3>
121
122 <p><i>We would now make a mesh as before but with a local modification of
123 parameter (hypothesis) on an edge. We first have to explode the initial
124 topology in GEOMETRY component. This operation will give us access to sub
125 shapes edges of geom.brep.</i></p>
126 <ol>
127   <li><p>import or create a geometry as before</p>
128   </li>
129   <li><p>call 'Explode' method found in 'New Entity' on the menu bar&nbsp;;
130     (remember the tip about Automatic/Store&nbsp;!) </p>
131     <p><img src="SubShapesSelection.png"></p>
132   </li>
133   <li><p>select the main object, choose 'Edge' in the combo box and click on
134     Ok.<br>
135     <u>Note</u>&nbsp;: do not click on 'select sub shape' at anytime. This
136     function is used with OCC viewer for individual sub shape selection not
137     yet available with VTK.<br>
138     <br>
139     Now the object browser contents all edges as sub shapes of the main
140     topology. Select the first edge <i>Edge_&nbsp;1</i> and display only it.
141     Use the pop up 'Display only' mode for this.<br>
142     You may also rename the edge to remember it for future meshing.<br>
143     <i>Our scope&nbsp;: apply a local hypothesis on this edge.<br>
144     </i></p>
145   </li>
146   <li><p>The job is now finished for GEOMETRY component.</p>
147   </li>
148   <li><p>Load SMESH component and use menus 'Mesh' and 'Init' to load the
149     topology into SMESH as before.<br>
150     (Already defined if you have kept the previous study.)</p>
151   </li>
152   <li><p>Define algorithms Regular_1D and Mefisto using menus 'Hypothesis'
153     and 'Algorithm'.</p>
154   </li>
155   <li><p>Define hypothesis 'Segments' = 7 and 'Max. Element Area' = 2500.
156     (Already defined ifâ&#x20ac;¦) </p>
157   </li>
158   <li><p>Define another hypothesis 'Local length' = 100 to be used only as
159     local parameter for the edge.</p>
160   </li>
161   <li><p>Now we have to attach algorithms and hypothesis to topologies, the
162     global and the sub shape edge.<br>
163     For the main topology, select it and use 'Set algorithms' and 'Set
164     Hypothesis' and attach&nbsp;:<br>
165     hypothesis 'Segments' = 7 and 'Max. Element Area' = 2500.</p>
166   </li>
167   <li><p>To set a local parameter of meshing on the edge we do :<br>
168     click on 'Mesh' menu then 'Add Sub Mesh'. On the dialog box select the
169     main object then sub object edge from Object Browser and GEOMETRY field.
170     Give it a local name; for example <i>myEdge</i> or anyone.</p>
171     <p><img src="SubMeshContruction.png"></p>
172   </li>
173   <li><p>Set the algorithm used for edge meshing. Here use Regular_&nbsp;1D.
174     </p>
175   </li>
176   <li><p>Set a local hypothesis to the edge. Use 'Local length' = 100.</p>
177   </li>
178   <li><p>'<i>Compute'</i> (and '<i>Update'</i> display if necessary see
179     before) the main&nbsp;mesh object. This will compute also the edge sub
180     shape.<br>
181     Do not forget to activate the display&nbsp;mode Wireframe,
182     Shading&nbsp;or Shrink; see in pop up menu '<i>Properties'</i>,
183     '<i>Display mode'</i>â&#x20ac;¦ </p>
184   </li>
185   <li><p>Move the point of view&nbsp;to watch the edge meshed with a local
186     hypothesis 'Local length' = 100. </p>
187   </li>
188 </ol>
189
190 <h3>The result of second meshing</h3>
191
192 <p>As we see below, the effect produced by setting a local hypothesis setted
193 on the edge <i>Edge_&nbsp;1.</i></p>
194
195 <p align="left">Compare to another edge that have the same physical
196 length.</p>
197
198 <p><img src="MeshResult2.png"></p>
199
200 <h2>Using PYTHON interpretor to import an example script</h2>
201 It is easy to import an example of meshing procedure using PYTHON interpretor
202 :
203 <ul>
204   <li>Load SMESH component with VTK viewer.</li>
205   <li>Just type <i>'import geomMesh.py'</i> in the textual window of
206   PYTHON.</li>
207   <li>Validate with the <i>Enter</i> key.</li>
208   <li>You just have to run 'Compute' then choose a display mode to see the
209     result.</li>
210 </ul>
211 This imported example is very similar to the last exercice. It uses a local
212 hypothesis on an edge too.
213
214 <p><img src="ImportResult.png"></p>
215
216 <h2>Control features</h2>
217
218 <p>Test now a control function of area for mesh resulting triangles.</p>
219
220 <p>Find <i>Control</i> on the menu bar then <i>Cells</i> and <i>Area</i>. The
221 image below displays areas with a color depending on its value in the scalar
222 bar shown on the left.<br>
223 Scalar bar general parameters are setted in <i>Preferencies</i>&nbsp;/
224 <i>Mesh</i> / <i>Scalar Bar</i>.</p>
225
226 <p>Specific range parameters are changed with the pop up menu.</p>
227
228 <p><img src="ControlFeature.png"></p>
229 </body>
230 </html>