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