Salome HOME
0021308: EDF 1923 SMESH: Remove hard-coded dependency of the external mesh plugins...
[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 consists of:
6 <ul>
7 <li>Selecting a geometrical object for meshing</li>
8 <li>Applying \subpage basic_meshing_algos_page "meshing algorithms" and
9 \subpage about_hypo_page "hypotheses" which will be used at computation of
10 this mesh.</li>
11 </ul>
12
13 <em>To construct a mesh:</em>
14 <ol>
15 <li>In the \b Mesh menu select <b>Create Mesh</b> or click <em>"Create
16 Mesh"</em> button in the toolbar. 
17
18 \image html image32.png
19 <center><em>"Create Mesh" button</em></center>
20
21 The following dialog box will appear: 
22
23 \image html createmesh-inv.png
24 </li>
25 <li>For example, you need to mesh a 3d object.
26 \n First, type the name for your mesh in the "Name" box, by default,
27 it is "Mesh_1". Then select the object you wish to mesh in the Object
28 Browser and click the "Add" button (if name of the object not yet
29 appeared in \b Geometry field).
30
31 \image html image120.png
32 <center><em>"Add" button</em></center>
33
34 Now you can define 1d Algorithm and 1d Hypotheses, which will be
35 applied to the edges of your object. (Note that any object has edges,
36 even if their existence is not apparent, for example, a sphere has 4
37 edges). Click the <em>"Add Hypothesis"</em>  button to add a
38 hypothesis.
39
40 \image html image121.png
41 <center><em>"Add Hypothesis" button</em></center>
42
43 Click the <em>"Edit Hypothesis"</em> button to define values for the
44 current hypothesis.
45
46 \image html image122.png
47 <center><em>"Edit Hypothesis" button</em></center>
48
49 The use of additional hypotheses is optional (i.e. you may leave
50 "None" in this box).
51
52 Proceed in the same way with 2d and 3d Algorithms and Hypotheses, note
53 that the choice of hypotheses depends on the algorithm. There must be
54 one Algorithm and zero or several Hypotheses for each dimension of your
55 object (most standard 2D and 3D algorithms can work without
56 hypotheses using some default parameters), 
57 otherwise you will not get any mesh at all. Of course, if you
58 wish to mesh a face, which is a 2d object, you don't need to define 3d
59 Algorithm and Hypotheses.
60 \n In the <b>Object Browser</b> the structure of the new mesh will be
61 displayed as follows:
62
63 \image html image88.jpg
64
65 It contains:
66 <ul>
67 <li>a reference to the geometrical object on the basis of which the mesh has been constructed;</li>
68 <li><b>Applied hypotheses</b> folder containing the references to the
69 hypotheses applied to the construction of the mesh;</li>
70 <li><b>Applied algorithms</b> folder containing the references to the
71 algorithms applied to the construction of the mesh.</li>
72 </ul>
73 <br>
74 There is an alternative way to create a mesh on an object simply by
75 clicking <b>Assign a set of hypotheses</b> button and selecting among
76 pre-defined sets of hypotheses. In addition to the standard
77 sets of hypotheses, it is possible to create custom sets by editing
78 CustomMeshers.xml file located in the home directory. CustomMeshers.xml
79 file must describe sets of hypotheses in the
80 same way as ${SMESH_ROOT_DIR}/share/salome/resources/smesh/StdMeshers.xml 
81 file does (sets of hypotheses are enclosed between <hypotheses-set-group>
82 tags).
83 \image html hypo_sets.png
84 <center>List of sets of hypotheses: <em>[custom]</em> is automatically added to the sets defined
85 by the user</center>
86 </li>
87
88 \anchor preview_mesh_anchor
89
90 <li> After the mesh object is created and all hypotheses are assigned and
91 before the mesh computation, it is possible to see the mesh preview.
92
93 For this, select the mesh in the Object Browser. From the \b Mesh menu
94 select \b Preview or click "Preview" button in the
95 toolbar or activate "Preview" item from the pop-up menu.
96
97 \image html mesh_precompute.png
98 <center><em>"Preview" button</em></center>
99
100 Select <b>1D mesh</b> or <b>2D mesh</b> preview mode in the Preview dialog. 
101
102
103 \image html preview_mesh_1D.png "1D mesh preview shows nodes computed on geometry edges"
104
105 \image html preview_mesh_2D.png "2D mesh preview shows edge mesh elements, computed on geometry faces"
106
107 <b>Compute</b> button computes the whole mesh.
108
109 When the Preview dialog is closed, the question about the storage of temporarily
110 created mesh elements appers:
111
112 \image html preview_tmp_data.png
113
114 These elenents can be reused in the next mesh computation.
115 </li>
116
117
118 <li>It is equally possible to skip the Preview and \b Compute the mesh
119 after the hypotheses are assigned. For this, select your mesh in the <b>Object
120 Browser</b>. From the \b Mesh menu select \b Compute or click "Compute" button of the
121 toolbar. 
122
123 \image html image28.png
124 <center><em>"Compute" button</em></center>
125
126 The Mesh Computation information box appears.
127
128 \image html meshcomputationsucceed.png
129
130 If the mesh computation failed, the information about the cause of the
131 failure is provided.
132
133 \image html meshcomputationfail.png
134
135 After you select the error, <b>Show Sub-shape</b> button allows
136 visualizing the geometrical entity that causes it.
137
138 \image html failed_computation.png "Example of the invalid input mesh"
139
140 \note Mesh Computation Information box does not appear if you set
141 "Mesh computation/Show a computation result notification" preference 
142 to the "Never" value. This option gives the possibility to control mesh
143 computation reporting. There are the following possibilities: always
144 show information box, only if an error occurs or never. 
145 By default, the information box is always shown after mesh computation operation.
146
147 <b>Publish Sub-shape</b> button publishes the sub-shape, whose meshing
148 failed, in GEOM component as a child of the mesh geometry, which
149 allows analyzing the problem geometry and creating a submesh on it in
150 order to locally tune hypotheses.
151
152 <b>NOTE</b> It is possible to define a 1D or a 2D mesh in a
153 python script and then use such submeshes in the construction of a 3D
154 mesh. For this, there exist two algorithms: <b>Use existing edges</b> and <b>Use
155 existing faces</b>. They are not entirely usable from the GUI, so a
156 mesh created using these algorithms should be exported into a python
157 script, edited and then imported into the GUi. 
158
159 <li>It is possible to calculate the eventual mesh size 
160 before \b Compute operation. For this, select the mesh in the <b>Object
161 Browser</b> and from the \b Mesh menu select \b Evaluate. The result of
162 evaluation will be displayed in the following information box:
163
164 \image html mesh_evaluation_succeed.png
165
166 </li>
167
168
169 \anchor mesh_order_anchor
170
171 <li>
172 If the mesh contains concurrent submeshes, it is possible to change
173 the priority of their computation, i.e. to change the priority of
174 applying algorithms to the shared sub-shapes of the Mesh shape.</li>
175
176 <em>To change submesh priority:</em>
177
178 <li>Choose "Change submesh priority" from the Mesh menu or a popup menu. The opened dialogue
179 shows a list of submeshes in the order of their priority. 
180
181 There is an example of submesh order modifications of the Mesh created on a Box
182 shape. The main Mesh object:
183 <ul>
184 <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=20</li>
185 <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>Max Element Area</b>
186 </li>
187 </ul>
188 The first submesh object <b>Submesh_1</b> created on <b>Face_1</b>
189 is:
190 <ul>
191 <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=4</li>
192 <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>MaxElementArea</b>=1200</li>
193 </ul>
194 The second submesh object <b>Submesh_2</b> created on <b>Face_2</b>
195 is:
196 <ul>
197 <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=8</li>
198 <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>MaxElementArea</b>=1200</li>
199 </ul>
200
201 And the last submesh object <b>Submesh_3</b> created on <b>Face_3</b>
202 is:
203 <ul>
204 <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=12</li>
205 <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>MaxElementArea</b>=1200</li>
206 </ul>
207
208 The submeshes become concurrent if they share sub-shapes that can be meshed 
209 with different algorithms (or different hypothesises).
210 In the example, we have three submeshes with concurrent algorithms,
211 because they have different hypotheses. 
212
213 The first mesh computation is made with:
214 \image html mesh_order_123.png
215 <center><em>"Mesh order SubMesh_1, SubMesh_2, SubMesh_3"</em></center>
216 \image html mesh_order_123_res.png
217 <center><em>"Result mesh with order SubMesh_1, SubMesh_2, SubMesh_3 "</em></center>
218
219 The next mesh computation is made with:
220 \image html mesh_order_213.png
221 <center><em>"Mesh order SubMesh_2, SubMesh_1, SubMesh_3"</em></center>
222 \image html mesh_order_213_res.png
223 <center><em>"Result mesh with order SubMesh_2, SubMesh_1, SubMesh_3 "</em></center>
224
225 And the last mesh computation is made with:
226 \image html mesh_order_321.png
227 <center><em>"Mesh order SubMesh_3, SubMesh_2, SubMesh_1"</em></center>
228 \image html mesh_order_321_res.png
229 <center><em>"Result mesh with order SubMesh_3, SubMesh_2, SubMesh_1 "</em></center>
230
231 As we can see, each mesh computation has a different number of result
232 elements and a different mesh discretisation on the shared edges (the edges 
233 that are shared between <b>Face_1</b>, <b>Face_2</b> and <b>Face_3</b>)
234
235 Additionally, submesh priority (the order of applied algorithms) can
236 be modified not only in a separate dialog box, but also in the
237 <b>Preview</b>. This helps to preview different mesh results,
238 modifying the order of submeshes.
239 \image html mesh_order_preview.png
240 <center><em>"Preview with submesh priority list box"</em></center>
241
242 If there are no concurrent submeshes under the Mesh object, the user will see the
243 following information.
244 \image html mesh_order_no_concurrent.png
245 <center><em>"No concurrent submeshes detected"</em></center>
246
247 </ol>
248
249 Consider trying a sample script for construction of a mesh from our 
250 \ref tui_creating_meshes_page "TUI Scripts" section.
251
252 */