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