Salome HOME
A revision of documentation for the new version. Minor corrections.
[modules/smesh.git] / doc / salome / gui / SMESH / input / constructing_meshes.doc
1 /*!
2
3 \page constructing_meshes_page Constructing meshes
4
5 \n Construction of a mesh on some geometry consists of:
6 <ul>
7   <li> \ref create_mesh_anchor "Creating of a mesh object"</li>
8   <li> \ref evaluate_anchor "Evaluating mesh size" (optional)</li>
9   <li> \ref preview_anchor "Previewing the mesh" (optional)</li>
10   <li> \ref submesh_order_anchor "Changing sub-mesh priority" (optional)</li>
11   <li> \ref compute_anchor "Computing the mesh"</li>
12 </ul>
13
14 \anchor create_mesh_anchor
15 <h2>Creation of a mesh object</h2>
16 <em>To construct a mesh:</em>
17 <ol>
18   <li>Select a geometrical object for meshing.</li>
19   <li>In the \b Mesh menu select <b>Create Mesh</b> or click <em>"Create
20       Mesh"</em> button in the toolbar. 
21
22     <center>
23     \image html image32.png
24     <em>"Create Mesh" button</em>
25     </center>
26
27     The following dialog box will appear: 
28
29     \image html createmesh-inv.png
30     <br>
31   </li>
32   <li> To filter off irrelevant meshing algorithms, you can
33     select <b>Mesh Type</b> in the corresponding list from <b>Any,
34       Hexahedral, Tetrahedral, Triangular </b> and \b Quadrilateral (there
35     can be less items for the geometry of lower dimensions).
36
37     Selection of a mesh type hides all meshing algorithms that cannot
38     generate elements of this type.</li>
39
40   <li>Apply \subpage basic_meshing_algos_page "meshing algorithms" and
41     \subpage about_hypo_page "hypotheses" which will be used to compute
42     this mesh.
43
44     "Create mesh" dialog box contains several tab pages titled \b 3D,
45     \b 2D, \b 1D and \b 0D. The title of each page reflects the
46     dimension of the CAD model (geometry) the algorithms listed on
47     this page affect and the maximal dimension of elements the algorithms
48     generate. For example, \b 3D page lists the algorithms that affect
49     3D geometrical objects (solids) and generate 3D mesh elements
50     (tetrahedra, hexahedra etc.)
51
52     \note
53     - Some page(s) can be disabled if the source geometrical
54     object does not include shapes (sub-shapes) of the corresponding
55     dimension(s). For example, if the input object is a geometrical face,
56     \b 3D page is disabled.
57     - Some algorithms affect the geometry of several dimensions,
58     i.e. "1D-2D" or "1D-2D-3D". If such an algorithm is selected by the
59     user, the dialog box pages related to the corresponding lower level
60     dimensions are disabled.
61     - \b 0D page does not refer to the 0D elements, but to 0D
62     geometry (vertices). Mesh module does not provide algorithms that
63     produce 0D elements. Currently \b 0D page provides only one
64     algorithm "Segments around vertex" that allows specyfying the required
65     size of mesh edges about the selected vertex (or vertices).
66
67     For example, you need to mesh a 3D object.
68
69     First, type the name of your mesh in the \b Name box, by default,
70     it is "Mesh_1". Then select the geometrical object you wish to
71     mesh in the Object Browser and click "Select" button near \b Geometry
72     field (if the name of the object has not yet appeared in \b Geometry field).
73     <center>
74     \image html image120.png
75     <em>"Select" button</em>
76     </center>
77
78     Now you can define 3D Algorithm and 3D Hypotheses, which will be
79     applied to the solids of your geometrical object. Click the <em>"Add
80       Hypothesis"</em>  button to add a hypothesis.
81     <center>
82     \image html image121.png
83     <em>"Add Hypothesis" button</em>
84     </center>
85     Click the <em>"Plus"</em> button to enable adding more additional hypotheses.
86
87     Click the <em>"Edit Hypothesis"</em> button to change the values for the
88     current hypothesis.
89     <center>
90     \image html image122.png
91     <em>"Edit Hypothesis" button</em>
92     </center>
93
94     Most 2D and 3D algorithms can work without hypotheses using
95     default meshing parameters. Some algorithms do not require any
96     hypotheses. After selection of an algorithm "Hypothesis" field of
97     the dialog can contain:
98     <ul>
99       <li> <em>\<Default\></em> if the algorithm can work using default
100       parameters.</li>
101       <li> <em>\<None\></em> if the algorithm requires a hypothesis defining
102       its parameters.</li>
103       <li> If the algorithm does not use hypotheses, this field is grayed.</li>
104     </ul>
105     After selection of an algorithm <b>Add. Hypothesis</b> field can contain:
106     <ul>
107       <li> <em>\<None\></em> if the algorithm can be tuned
108       using an additional hypothesis.</li>
109       <li> If the algorithm does not use additional hypotheses, this field is grayed.</li>
110     </ul>
111
112     Proceed in the same way with 2D and 1D Algorithms and Hypotheses that
113     will be used to mesh faces and edges of your geometry. (Note
114     that any object has edges, even if their existence is not
115     apparent, for example, a sphere has 4 edges). Note that the
116     choice of hypotheses and lower dimension algorithms depends on
117     the higher dimension algorithm.
118
119     If you wish you can select different algorithms and/or hypotheses
120     for meshing some parts of your CAD model by \ref constructing_submeshes_page.
121
122     Some algorithms generate mesh of several dimensions, while others
123     produce mesh of only one dimension. In the latter case there must
124     be one Algorithm and zero or several
125     Hypotheses for each dimension of your object, otherwise you will
126     not get any mesh at all. Of course, if you wish to mesh a face,
127     which is a 2D object, you do not need to define a 3D Algorithm and
128     Hypotheses.
129
130     In the <b>Object Browser</b> the structure of the new mesh will be
131     displayed as follows:
132
133     <center>
134     \image html image88.jpg
135     </center>
136
137     It contains: 
138     <ul>
139       <li>a mesh name (<em>Mesh_mechanic</em>);
140       <li>a reference to the geometrical object on the basis of
141         which the mesh has been constructed (\a mechanic);</li> 
142       <li><b>Applied hypotheses</b> folder containing the references
143         to the hypotheses applied at the construction of the mesh;</li>
144       <li><b>Applied algorithms</b> folder containing the references
145         to the algorithms applied at the construction of the mesh.</li> 
146     </ul>
147
148     There is an alternative way to assign Algorithms and Hypotheses by
149     clicking <b>Assign a set of hypotheses</b> button and selecting among
150     pre-defined sets of hypotheses. In addition to the standard
151     sets of hypotheses, it is possible to create custom sets by editing
152     CustomMeshers.xml file located in the home directory. CustomMeshers.xml
153     file must describe sets of hypotheses in the
154     same way as ${SMESH_ROOT_DIR}/share/salome/resources/smesh/StdMeshers.xml 
155     file does (sets of hypotheses are enclosed between <hypotheses-set-group>
156       tags).
157
158       \image html hypo_sets.png
159       List of sets of hypotheses. Tag <em>[custom]</em> is
160       automatically added to the sets defined by the user.
161       
162       \note \a Automatic in the names of predefined sets of
163       hypotheses means only that \ref automatic_length_anchor "Automatic Length" hypothesis 
164           is included in these sets, and not that these sets are suitable for
165       meshing any geometry.
166   </li>
167 </ol>
168
169 Consider trying a sample script for construction of a mesh from our 
170 \ref tui_creating_meshes_page "TUI Scripts" section.
171
172 \anchor evaluate_anchor
173 <h2>Evaluating mesh size</h2>
174
175 After the mesh object is created and all hypotheses are assigned and
176 before \ref compute_anchor "Compute" operation, it is possible to
177 calculate the eventual mesh size. For this, select the mesh in
178 the <b>Object Browser</b> and from the \b Mesh menu select \b
179 Evaluate. The result of evaluation will be displayed in the following
180 information box: 
181
182 \image html mesh_evaluation_succeed.png
183
184 \anchor preview_anchor
185 <h2>Previewing the mesh</h2>
186
187 Before \ref compute_anchor "the mesh computation", it is also possible
188 to see the mesh preview.
189
190 For this, select the mesh in the Object Browser. From the \b Mesh menu
191 select \b Preview or click "Preview" button in the toolbar or activate
192 "Preview" item from the pop-up menu.
193
194 <center>
195 \image html mesh_precompute.png
196 <em>"Preview" button</em>
197 </center>
198
199 Select <b>1D mesh</b> or <b>2D mesh</b> preview mode in the Preview dialog. 
200
201 \image html preview_mesh_1D.png "1D mesh preview shows nodes computed on geometry edges"
202 <br>
203 \image html preview_mesh_2D.png "2D mesh preview shows edge mesh elements, computed on geometry faces"
204
205 <b>Compute</b> button computes the whole mesh.
206
207 When the Preview dialog is closed, the question about the storage of temporarily
208 created mesh elements appears:
209
210 \image html preview_tmp_data.png
211
212 These elements can be kept in the mesh.
213
214
215 \anchor submesh_order_anchor
216 <h2>Changing sub-mesh priority</h2>
217
218 If the mesh contains concurrent \ref constructing_submeshes_page "sub-meshes", 
219 it is possible to change the priority of their computation, i.e. to
220 change the priority of applying algorithms to the shared sub-shapes of
221 the Mesh shape.
222
223 <em>To change submesh priority:</em>
224
225 Choose "Change submesh priority" from the Mesh menu or a pop-up
226 menu. The opened dialog shows a list of submeshes in the order of
227 their priority. 
228
229 There is an example of submesh order modifications taking a Mesh created on a Box
230 shape. The main Mesh object:
231 <ul>
232   <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=20</li>
233   <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>Max Element Area</b>
234   </li>
235 </ul>
236 The first submesh object <b>Submesh_1</b> created on <b>Face_1</b> is:
237 <ul>
238   <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=4</li>
239   <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis <b>MaxElementArea</b>=1200</li>
240 </ul>
241 The second submesh object <b>Submesh_2</b> created on <b>Face_2</b> is:
242 <ul>
243   <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=8</li>
244   <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis <b>MaxElementArea</b>=1200</li>
245 </ul>
246
247 And the last submesh object <b>Submesh_3</b> created on <b>Face_3</b> is:
248 <ul>
249   <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=12</li>
250   <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis <b>MaxElementArea</b>=1200</li>
251 </ul>
252
253 The sub-meshes become concurrent if they share sub-shapes that can be
254 meshed with different algorithms (or different hypotheses). In the
255 example, we have three submeshes with concurrent algorithms, because
256 they have different hypotheses.
257
258 The first mesh computation is made with:
259 <center>
260 \image html mesh_order_123.png
261 <em>"Mesh order SubMesh_1, SubMesh_2, SubMesh_3"</em></center>
262 <center>
263 \image html mesh_order_123_res.png
264 <em>"Result mesh with order SubMesh_1, SubMesh_2, SubMesh_3 "</em></center>
265
266 The next mesh computation is made with:
267 <center>
268 \image html mesh_order_213.png
269 <em>"Mesh order SubMesh_2, SubMesh_1, SubMesh_3"</em></center>
270 <center>
271 \image html mesh_order_213_res.png
272 <em>"Result mesh with order SubMesh_2, SubMesh_1, SubMesh_3 "</em></center>
273
274 And the last mesh computation is made with:
275 <center>
276 \image html mesh_order_321.png
277 <em>"Mesh order SubMesh_3, SubMesh_2, SubMesh_1"</em></center>
278 <center>\image html mesh_order_321_res.png
279 <em>"Result mesh with order SubMesh_3, SubMesh_2, SubMesh_1 "</em></center>
280
281 As we can see, each mesh computation has a different number of result
282 elements and a different mesh discretization on the shared edges (the edges 
283 that are shared between <b>Face_1</b>, <b>Face_2</b> and <b>Face_3</b>)
284
285 Additionally, submesh priority (the order of applied algorithms) can
286 be modified not only in a separate dialog box, but also in
287 the <b>Preview</b>. This helps to preview different mesh results,
288 modifying the order of submeshes. 
289 <center>
290 \image html mesh_order_preview.png
291 <em>"Preview with submesh priority list box"</em></center>
292
293 If there are no concurrent submeshes under the Mesh object, the user
294 will see the following information.
295 <center>
296 \image html mesh_order_no_concurrent.png
297 <em>"No concurrent submeshes detected"</em></center>
298
299
300 \anchor compute_anchor
301 <h2>Computing the mesh</h2>
302
303 It is equally possible to skip  \ref evaluate_anchor "the Evaluation"
304 and \ref preview_anchor "the Preview" and to \b Compute the mesh after
305 the hypotheses are assigned. For this, select your mesh in
306 the <b>Object Browser</b>. From the \b Mesh menu select \b Compute or
307 click "Compute" button of the toolbar.
308
309 <center>
310 \image html image28.png
311 <em>"Compute" button</em>
312 </center>
313
314 After the mesh computation finishes, the Mesh Computation information
315 box appears. In case of a success, the box shows
316 information on number of entities of different types in the mesh.
317
318 \image html meshcomputationsucceed.png
319
320 If the mesh computation failed, the information about the cause of the
321 failure is provided in \b Errors table.
322
323 \image html meshcomputationfail.png
324
325 After you select the error, <b>Show Sub-shape</b> button allows
326 visualizing in magenta the geometrical entity that causes the error.
327
328 \image html failed_computation.png 
329 <em>3D algorithm failed to compute mesh on a box shown using <b>Show
330     Sub-shape</b> button</em>
331
332 <b>Publish Sub-shape</b> button publishes the sub-shape, whose meshing
333 has failed, in GEOM component as a child of the mesh geometry, which
334 allows analyzing the problem geometry and creating a submesh on it in
335 order to locally tune the hypotheses.
336
337 If the failure is caused by an invalid input mesh and the algorithm has
338 found which mesh entities are bad, <b>Show bad Mesh</b> 
339 button appears in the dialog. Clicked, it shows the bad mesh entities in
340 the Viewer in magenta. Sometimes the shown mesh entities are too small
341 or/and hidden by other mesh elements. They can be seen after
342 switching the mesh to Wireframe visualization mode or switching off
343 the visualization of faces and volumes (if any).
344
345 <b>Bad Mesh to Group</b> button creates groups of bad mesh entities
346 to facilitate their analysis.
347
348 \image html show_bad_mesh.png
349 <em>Edges bounding a hole in the surface are shown in magenta using <b>Show
350     bad Mesh</b> button</em>
351
352 \note Mesh Computation Information box does not appear if you set
353 "Mesh computation/Show a computation result notification" preference 
354 to the "Never" value. This option gives the possibility to control mesh
355 computation reporting. There are the following possibilities: always
356 show the information box, show only if an error occurs or never. 
357 By default, the information box is always shown after mesh computation operation.
358
359 <br><br>
360
361
362
363 */