Salome HOME
c424f047d78c4451359513504b4ba19987473b89
[modules/homard.git] / doc / en / tui_create_iteration.rst
1 .. _tui_create_iteration:
2
3 The iteration
4 #############
5
6 .. index:: single: iteration
7 .. index:: single: hypothesis
8 .. index:: single: zone
9
10 The variables are described in :ref:`gui_create_iteration`.
11
12 Methods of the class homard
13 ***************************
14
15 +---------------------------------------------------------------+
16 +---------------------------------------------------------------+
17 | .. module:: GetIteration                                      |
18 |                                                               |
19 | **GetIteration(iter_name)**                                   |
20 |     Returns an instance of the class ``iteration``            |
21 |     known by its name                                         |
22 |                                                               |
23 |     - ``iter_name``: the name of the iteration                |
24 +---------------------------------------------------------------+
25 | .. module:: GetAllIterationsName                              |
26 |                                                               |
27 | **GetAllIterationsName()**                                    |
28 |     Returns the liste of the name of all the existing         |
29 |     iterations                                                |
30 |                                                               |
31 +---------------------------------------------------------------+
32
33 Methods of both classes cas and iteration
34 ****************************************"
35 See also in :ref:`tui_create_case`.
36
37 +---------------------------------------------------------------+
38 +---------------------------------------------------------------+
39 | .. module:: NextIteration                                     |
40 |                                                               |
41 | **NextIteration(iter_name)**                                  |
42 |     Returns an instance of the class ``iteration`` after      |
43 |     its creation. It is the next iteration after:             |
44 |                                                               |
45 |     - for a case: the very first one that corresponds to the  |
46 |       first mesh of the case                                  |
47 |     - for an iteration: the current iteration                 |
48 |                                                               |
49 | Default:  the produced mesh has got the same name as the      |
50 | iteration                                                     |
51 |                                                               |
52 |     - ``iter_name``: the name of this next iteration          |
53 +---------------------------------------------------------------+
54 | .. module:: LastIteration                                     |
55 |                                                               |
56 | **LastIteration()**                                           |
57 |     Returns an instance of the class ``iteration`` that is    |
58 |     the last iteration into the descendants of:               |
59 |                                                               |
60 |     - for a case: the very first one that corresponds to the  |
61 |       first mesh of the case                                  |
62 |     - for an iteration: the current iteration                 |
63 |                                                               |
64 |     It is the one that has got no child. There is an error if |
65 |     more than one branch exists into the descendants.         |
66 |                                                               |
67 +---------------------------------------------------------------+
68
69 Methods of the class iteration
70 ******************************
71
72 General methods
73 ===============
74
75 +---------------------------------------------------------------+
76 +---------------------------------------------------------------+
77 | .. module:: Compute                                           |
78 |                                                               |
79 | **Compute(option1, option2)**                                 |
80 |     Computes the mesh produced by the iteration               |
81 |                                                               |
82 |     - ``option1``: an integer to decide what to do with       |
83 |       existing files, if any                                  |
84 |                                                               |
85 |         * 0: stop with error                                  |
86 |         * 1: the old files are removed                        |
87 |                                                               |
88 |     - ``option2``: an integer to decide what to do with       |
89 |       the results                                             |
90 |                                                               |
91 |         * 1: no specific action                               |
92 |         * 2: publication into the module SMESH                |
93 |                                                               |
94 |     Returns an integer:                                       |
95 |         * 0: successful adaptation                            |
96 |         * other value: problem                                |
97 +---------------------------------------------------------------+
98 | .. module:: GetName                                           |
99 |                                                               |
100 | **GetName()**                                                 |
101 |     Returns the name of the iteration                         |
102 +---------------------------------------------------------------+
103 | .. module:: GetNumber                                         |
104 |                                                               |
105 | **GetNumber()**                                               |
106 |     Returns the number of the iteration.                      |
107 |                                                               |
108 |     The iteration #0 is the one associated to the initial     |
109 |     mesh. Then, an iteration with number #N comes from the    |
110 |     adaptation of an iteration with number #(N-1).            |
111 +---------------------------------------------------------------+
112 | .. module:: GetIterParent                                     |
113 |                                                               |
114 | **GetIterParent()**                                           |
115 |     Returns the iteration parent                              |
116 +---------------------------------------------------------------+
117 | .. module:: AssociateHypo                                     |
118 |                                                               |
119 | **AssociateHypo(hypo_name)**                                  |
120 |     Associate an hypothesis with the iteration                |
121 |                                                               |
122 |     - ``hypo_name``: the name of the hypothesis               |
123 +---------------------------------------------------------------+
124 | .. module:: GetHypoName                                       |
125 |                                                               |
126 | **GetHypoName()**                                             |
127 |     Returns the name of the associated hypothesis             |
128 +---------------------------------------------------------------+
129 | .. module:: GetCaseName                                       |
130 |                                                               |
131 | **GetCaseName()**                                             |
132 |     Returns the name of the associated case                   |
133 +---------------------------------------------------------------+
134 | .. module:: GetState                                          |
135 |                                                               |
136 | **GetState()**                                                |
137 |     Returns the state of the iteration                        |
138 |                                                               |
139 |     - ``2``: computed iteration                               |
140 |     - ``1``: non computed iteration                           |
141 |     - ``<=0``: initial iteration not to be computed, with a   |
142 |       number equal to the absolute valure of the state        |
143 +---------------------------------------------------------------+
144 | .. module:: GetLogFile                                        |
145 |                                                               |
146 | **GetLogFile()**                                              |
147 |     Returns the name of the file with the messages all along  |
148 |     the running of HOMARD                                     |
149 +---------------------------------------------------------------+
150 | .. module:: GetFileInfo                                       |
151 |                                                               |
152 | **GetFileInfo()**                                             |
153 |     Returns the name of the file with the analysis of the mesh|
154 +---------------------------------------------------------------+
155 | .. module:: GetDirName                                        |
156 |                                                               |
157 | **GetDirName()**                                              |
158 |     Returns the name of the directory that contains the       |
159 |     results of the iteration                                  |
160 +---------------------------------------------------------------+
161 | .. module:: Delete                                            |
162 |                                                               |
163 | **Delete(option)**                                            |
164 |     Deletes the iteration and all its children                |
165 |                                                               |
166 |     - ``option``: an integer to define what to do with the    |
167 |       MED file of the associated meshes                       |
168 |                                                               |
169 |         * 0: the files are kept                               |
170 |         * 1: the files are removed                            |
171 |                                                               |
172 |     Returns an integer:                                       |
173 |         * 0: the destruction is done                          |
174 |         * other value: problem                                |
175 +---------------------------------------------------------------+
176
177 Information about the meshes
178 ============================
179
180 +---------------------------------------------------------------+
181 +---------------------------------------------------------------+
182 | .. module:: SetMeshName                                       |
183 |                                                               |
184 | **SetMeshName(mesh_name)**                                    |
185 |     Defines the name of the produced mesh                     |
186 |                                                               |
187 |     - ``mesh_name``: the name of the produced mesh            |
188 +---------------------------------------------------------------+
189 | .. module:: GetMeshName                                       |
190 |                                                               |
191 | **GetMeshName()**                                             |
192 |     Returns the name of the produced mesh                     |
193 +---------------------------------------------------------------+
194 | .. module:: SetMeshFile                                       |
195 |                                                               |
196 | **SetMeshFile(mesh_file)**                                    |
197 |     Defines the name of the MED file of the produced mesh     |
198 |                                                               |
199 |     - ``mesh_file``: the name of the MED file of the          |
200 |       produced mesh                                           |
201 +---------------------------------------------------------------+
202 | .. module:: GetMeshFile                                       |
203 |                                                               |
204 | **GetMeshFile()**                                             |
205 |     Returns the name of the MED file of the produced mesh     |
206 +---------------------------------------------------------------+
207 | .. module:: MeshInfo                                          |
208 |                                                               |
209 | **MeshInfo(Qual, Diam, Conn, Tail, Inte)**                    |
210 |     Gives information about the current mesh. For every       |
211 |     option, the choice #0 corresponds to 'no action', while   |
212 |     the choice #1 launches the option.                        |
213 |                                                               |
214 |     - ``Qual``: quality of the elements                       |
215 |     - ``Diam``: diametre of the elements                      |
216 |     - ``Conn``: connexity of the domain; a single block, how  |
217 |       many holes, etc.                                        |
218 |     - ``Tail``: size of the parts of the domain, group by     |
219 |       group                                                   |
220 |     - ``Inte``: staggered elements, by dimension              |
221 +---------------------------------------------------------------+
222
223 Information about the field
224 ===========================
225
226 The file of the fields
227 ----------------------
228
229 +---------------------------------------------------------------+
230 +---------------------------------------------------------------+
231 | .. module:: SetFieldFile                                      |
232 |                                                               |
233 | **SetFieldFile(field_file)**                                  |
234 |     Defines the MED file of the fields                        |
235 |                                                               |
236 |     - ``field_file``: the name of the MED file of the fields: |
237 |       the driving field for the adaptation, or the fields to  |
238 |       be interpolated                                         |
239 +---------------------------------------------------------------+
240 | .. module:: GetFieldFileName                                  |
241 |                                                               |
242 | **GetFieldFileName()**                                        |
243 |     Returns the name of the MED file of the fields            |
244 +---------------------------------------------------------------+
245
246 The time step for the driving field
247 -----------------------------------
248
249 If no time step is defined for the field or if a single time step is defined for the field, the definition of a time step is useless. That will be the default choice.
250
251 +---------------------------------------------------------------+
252 +---------------------------------------------------------------+
253 | .. module:: SetTimeStep                                       |
254 |                                                               |
255 | **SetTimeStep(TimeStep)**                                     |
256 |     Defines the time step for the driving field for the       |
257 |     adaptation. The rank will be ignored.                     |
258 |                                                               |
259 |     - ``TimeStep``: the selected time step                    |
260 +---------------------------------------------------------------+
261 | .. module:: SetTimeStepRank                                   |
262 |                                                               |
263 | **SetTimeStepRank(TimeStep, Rank)**                           |
264 |     Defines the time step and the rank for the driving field  |
265 |     for the adaptation                                        |
266 |                                                               |
267 |     - ``TimeStep``: the selected time step                    |
268 |     - ``Rank``: the selected rank                             |
269 +---------------------------------------------------------------+
270 | .. module:: SetTimeStepRankLast                               |
271 |                                                               |
272 | **SetTimeStepRankLast()**                                     |
273 |     The last time step will be used for the driving field for |
274 |     the adaptation, whatever its value                        |
275 +---------------------------------------------------------------+
276 | .. module:: GetTimeStep                                       |
277 |                                                               |
278 | **GetTimeStep()**                                             |
279 |     Returns the selected time step for the driving field      |
280 +---------------------------------------------------------------+
281 | .. module:: GetRank                                           |
282 |                                                               |
283 | **GetRank()**                                                 |
284 |     Returns the selected rank for the driving field           |
285 +---------------------------------------------------------------+
286
287 The time steps for the fields to interpolate
288 --------------------------------------------
289
290 The choice of the fields to interpolated are defined in the hypothesis (see :ref:`tui_create_hypothese`).
291 For a given field, if nothing is declared, every single time step will be considered.
292 If some time steps are wanted, they must be defined as follows.
293
294 +---------------------------------------------------------------+
295 +---------------------------------------------------------------+
296 | .. module:: SetFieldInterpTimeStep                            |
297 |                                                               |
298 | **SetFieldInterpTimeStep(FieldName, TimeStep)**               |
299 |     Defines the time step for the interpolation of the field. |
300 |     The rank will be ignored.                                 |
301 |                                                               |
302 |     - ``FieldName``: the name of the field to interpolate     |
303 |     - ``TimeStep``: the selected time step                    |
304 +---------------------------------------------------------------+
305 | .. module:: SetFieldInterpTimeStepRank                        |
306 |                                                               |
307 | **SetFieldInterpTimeStepRank(FieldName, TimeStep)**           |
308 |     Defines the time step and the rank for the interpolation  |
309 |     of the field.                                             |
310 |                                                               |
311 |     - ``FieldName``: the name of the field to interpolate     |
312 |     - ``TimeStep``: the selected time step                    |
313 |     - ``Rank``: the selected rank                             |
314 +---------------------------------------------------------------+
315 | .. module:: GetFieldInterpsTimeStepRank                       |
316 |                                                               |
317 | **GetFieldInterpsTimeStepRank()**                             |
318 |     Returns the information (name of the field, time step,    |
319 |     rank)                                                     |
320 |                                                               |
321 |     Warning: the time step and the rank are stored as strings |
322 |     in the list and not as integers.                          |
323 |                                                               |
324 |     Example: ['DEPL', '1', '1', 'DEPL', '2', '1', 'Mass',     |
325 |     '2', '0', 'Mass', '3', '0']                               |
326 +---------------------------------------------------------------+
327
328 Miscellenaous
329 =============
330
331 +---------------------------------------------------------------+
332 +---------------------------------------------------------------+
333 | .. module:: SetInfoCompute                                    |
334 |                                                               |
335 | **SetInfoCompute(MessInfo)**                                  |
336 |     Defines options to track the computation of the iteration |
337 |                                                               |
338 |     - ``MessInfo``: integer that drives prints, as a multiple |
339 |       of 2, 3 and 5                                           |
340 |                                                               |
341 |         * 1 : nothing (default)                               |
342 |         * 2x : computational time                             |
343 |         * 3x : MED files                                      |
344 |         * 5x : memory                                         |
345 +---------------------------------------------------------------+
346 | .. module:: GetInfoCompute                                    |
347 |                                                               |
348 | **GetInfoCompute()**                                          |
349 |     Returns the options to track the computation              |
350 +---------------------------------------------------------------+
351
352
353 Example
354 *******
355 .. index:: single: mesh;initial
356
357 To create the first iteration, the starting point is the iteration associated to the initial mesh. It is the one that defines the case.
358 ::
359
360     iter_name = "Iteration_1"
361     iter_1 = case_1.NextIteration(iter_name)
362     iter_1.SetField(field_file)
363     iter_1.SetTimeStepRank( 0, 0)
364     iter_1.SetMeshName("maill_01")
365     iter_1.SetMeshFile("/local00/M.01.med")
366     iter_1.AssociateHypo("HypoField")
367     codret = iter_1.Compute(1, 2)
368
369 Then, the next iteration is created from the current iteration.
370 ::
371
372     iter_name = "Iteration_2"
373     iter_2 = iter_1.NextIteration(iter_name)
374     iter_2.SetField(field_file)
375     iter_2.SetTimeStepRank( 1, 1)
376     iter_2.SetMeshName("maill_02")
377     iter_2.SetMeshFile("/local00/M.02.med")
378     iter_2.AssociateHypo("HypoField")
379     codret = iter_2.Compute(1, 2)
380
381
382 Similar graphical input
383 ***********************
384 Look at :ref:`gui_create_iteration`