Salome HOME
90c9215a506382963584e48ca3fe38cb1d8ae92b
[plugins/ghs3dprlplugin.git] / doc / salome / gui / GHS3DPRLPLUGIN / input / ghs3dprl_hypo.doc
1 /*!
2
3 \page ghs3dprl_hypo_page MG-Tetra_HPC Parameters hypothesis
4
5 \n MG-Tetra Parameters hypothesis works only with <b>MG-Tetra</b>
6 meshing algorithm which uses <b>MG-Tetra_HPC</b> code (formerly tepal)
7 which is the parallel implementation of MG-Tetra (formerly TetMesh-GHS3D) algorithm. 
8 This algorithm is a DISTENE commercial software, its use requires a license.
9 \n
10 See http://www.distene.com and http://www.meshgems.com/volume-meshing-meshgems-tetra.html.
11 \n MG-Tetra-hpc (Tepal V3 in fact) gives the possibility to generate a partitioned
12 mesh with more than 200 million tetrahedrons on computers using MPI.
13 The launch of this version is described below.
14 \n This is a serious alternative to MG-Tetra, which requires a much less common
15 configuration with 64Go RAM to only try to make a partition of a mesh with
16 200 million tetrahedrons, no result guaranteed (in 2010).
17 \n
18 \note The plug-in doesn't load in the memory the supposedly large resulting meshes. 
19 The meshes are saved in MED files and can be imported in the user-defined location via menu File-Import-MED Files.
20 \n Pay attention, that Salome GUI needs 2Go RAM to load a MED
21 file with 5 million tetrahedrons.
22
23 \image html ghs3dprl_parameters_basic.png
24
25 <ul>
26 <li>
27 <b>Name</b> - allows to define the name of the hypothesis (MG-Tetra_HPC Parameters by default).
28 </li>
29 <li>
30 <b>MED Name</b> - allows to define the path and the prefix of the 
31 resulting MED files ("DOMAIN" by default).
32 If the path is not defined, the environment variable $SALOME_TMP_DIR
33 is used. If $SALOME_TMP_DIR is not defined as well, the environment
34 variable $TMP is used.
35 </li>
36 <li>
37 <b>Nb Partitions</b> - allows to define the number of generated MED files.
38 The initial skin (triangles) will be meshed (tetrahedrons) and partitioned 
39 in Nb_Part by the elementary algorithm implemented in Tepal.<br>
40 </li>
41 <li>
42 <b>Keep Files</b> - if this box is checked, input files of MG-Tetra-hpc
43 (GHS3DPRL.points and GHS3DPRL.faces) are not deleted after use (if the
44 background mode was not used).
45 </li>
46 <li>
47 <b>Tetra_hpc in Background</b> - if this box is checked, MG-Tetra-hpc execution
48 and MED file generation are launched in background mode and the user
49 can even exit Salome. Pay attention that in this case MG-Tetra-hpc algorithm works
50 independently of "killSalome.py", and sometimes on another host.
51 </li>
52 <li>
53 <b>Tetra_hpc Multithread</b> - if this box is checked, MG-Tetra-hpc execution
54 is with mg_tetra_hpc.exe (multithread version), else mg_tetra_hpc_mpi.exe (MPI distributed version).
55 </li>
56 <li>
57 <b>Merge subdomains</b> - if this box is checked, merge the sub-domains 
58 into one mesh and write the output .mesh(b).
59 </li>
60 <li>
61 <b>Tag subdomains</b> - if this box is checked, use the parallel sub-domain 
62 index as tag into the merged output mesh or not (used in combination with the 
63 <b>Merge subdomains</b> option).
64 </li>
65 <li>
66 <b>Output interfaces</b> - if this box is checked, write the parallel
67 sub-domains interface triangles into the merged output mesh (used in
68 combination with the <b>Merge subdomains</b> option).
69 </li>
70 <li>
71 <b>Discard subdomains</b> - if this box is checked, discard the parallel sub-domains 
72 (mesh, global numbering and interfaces).
73 </li>
74
75 \image html ghs3dprl_parameters_advanced.png
76
77 In \b Advanced tab page you can specify not exposed options of MG_Tetra-hpc.
78
79 <b>Add option</b> adds a line to the table where you can type an option and its value as text.
80 A check box in the first column activates/deactivates the option of the current row. A deactivated option will be erased upon pressing \a Ok.
81
82 <h1>Modifying MG-Tetra-hpc Advanced Parameters</h1><br>
83 MG-Tetra_HPC plug-in launches a standalone binary
84 executable <b>tetrahpc2med</b>.<br>
85 tetrahpc2med launches MG_Tetra-hpc, waits for the end of computation, and
86 converts the resulting output files into MED files.<br>
87 Some advanced optional parameters are accessible as arguments.<br>
88
89 If <b>Keep Files</b> option is checked, it is possible to re-launch 
90 \a tetrahpc2med or MG-Tetra-hpc in the Terminal as a command with
91 custom parameters.<br> 
92
93 <li>
94 <b>Advanced tetrahpc2med Parameters</b> - type <b>tetrahpc2med --help</b> in the Terminal. <p>
95
96 \verbatim
97 myname@myhost > /export/home/myname/salome_7/GHS3DPRLPLUGIN/bin/salome/tetrahpc2med --help
98 tetrahpc2med V3.0 (MED3+tetra-hpc) Available options:
99    --help               : produces this help message
100    --casename           : path and name of input tetrahpc2med files which are
101                            - output files of GHS3DPRL_Plugin .mesh
102                            - output file of GHS3DPRL_Plugin casename_skin.med (optional)
103                           with initial skin and its initial groups
104    --number             : number of partitions
105    --medname            : path and name of output MED files
106    --limitswap          : max size of working cpu memory (Mo) (before swapping on .temp files)
107    --verbose            : trace of execution (0->6)
108    --test               : more tests about joints, before generation of output files
109    --menu               : a GUI menu for option number
110    --launchtetra        : also launch tetra-hpc on files casename.mesh and option number
111    --merge_subdomains   : merge the subdomains into one mesh and write the output .mesh(b) file
112    --tag_subdomains     : use the parallel subdomain index as tag into the merged output mesh
113                             to identify the parallel subdomains (used in combination with the merge_subdomains option)
114    --output_interfaces  : write the parallel subdomains interface triangles into the merged output mesh
115                             (used in combination with the merge_subdomains option)
116    --discard_subdomains : discard the parallel subdomains informations output (mesh, global numbering and interfaces)
117    --background         : force background mode from launch tetra-hpc and generation of final MED files (big meshes)
118    --deletegroups       : regular expression (see QRegExp) which matches unwanted groups in final MED files
119                             (try --deletegroups="(\bJOINT)"
120                             (try --deletegroups="(\bAll_Nodes|\bAll_Faces)"
121                             (try --deletegroups="((\bAll_|\bNew_)(N|F|T))"
122 example:
123    tetrahpc2med --casename=/tmp/GHS3DPRL --number=2 --medname=DOMAIN --limitswap=1000 --verbose=0 --test=yes --menu=no --launchtetra=no
124
125 \endverbatim
126 \n
127 </li>
128 <li>
129 <b>Advanced tetra_hpc parameters (2014)</b> <p>
130
131 \verbatim
132
133 Usage: tetra_hpc.exe [options]
134
135 Options: 
136
137      Short option (if it exists)
138     /    Long option
139    |    /   Description
140    |   |   /
141    v   v  v
142
143      --help
144           print this help
145
146      --in <input mesh file name>
147           Sets the input file
148           (MANDATORY)
149
150      --out <output mesh file name>
151           Sets the output file
152           (MANDATORY)
153
154      --merge_subdomains <merge>
155           Describes whether to merge the subdomains into one mesh and write the
156           output .mesh(b) file or not.
157           if <merge> is
158              yes : the subdomains will be merged into one mesh and written to
159           the output .mesh(b),
160              no : the subdomains will not be merged.
161           default : no
162
163      --tag_subdomains <tag>
164           Describes whether to use the parallel subdomain index as tag into the
165           merged output mesh or not (used in combination with the
166           merge_subdomains option).
167           if <tag> is
168              yes : the tags of the tetrahedra in the merged output will
169           identify the parallel subdomains,
170              no : the tag will keep its standard meaning of volume domain.
171           default : no
172
173      --output_interfaces <output_interfaces>
174           Describes whether to write the parallel subdomains interface
175           triangles into the merged output mesh or not (used in combination
176           with the merge_subdomains option).
177           if <output_interfaces> is
178              yes : the parallel subdomains interface triangles will be written
179           into the merged output mesh,
180              no : they will not be added to the merged output mesh.
181           default : no
182
183      --verbose <verbose>
184           Set the verbosity level, increasing from 0 to 10.
185            <verbose> values are increasing from 0 to 10 :
186              0 : no details
187             10 : very detailed
188           default : 3
189
190      --discard_subdomains <discard>
191           Describes whether to discard the parallel subdomains (mesh, global
192           numbering and interfaces) or not.
193           if <discard> is
194              yes : the subdomain informations (mesh, global numbering and
195           interfaces) will be discarded,
196              no : they will be written to disk as output.
197           default : no
198
199 \endverbatim
200 \n
201 </li>
202
203 <h1>Saving user's preferred MG-Tetra_HPC Advanced Parameters</h1><br>
204 MG-Tetra_HPC plug-in launches standalone binary executable tetrahpc2med.<br>
205 You may rename file tetrahpc2med as tetrahpc2med.exe for example, and replace
206 tetrahpc2med by a shell script at your convenience to overriding parameters.
207 <br>... or else $PATH modification... .<br>
208 <li>
209 <b>Advanced tetrahpc2med Parameters</b> - overriding parameter deletegroups<p>
210 You may rename tetrahpc2med as tetrahpc2med.exe for example.
211
212 \code
213 #!/bin/bash
214 #script tetrahpc2med overriding parameter deletegroups
215 #we have renamed binary executable tetrahpc2med as tetrahpc2med.exe
216 #echo tetrahpc2med initial parameters are $1 $2 $3 $4 ... or $*
217 #$0 is ignored
218
219 tetrahpc2med.exe $* --deletegroups="(\bAll_Nodes|\bAll_Faces)"
220
221 \endcode
222 \n
223 </li>
224  
225 <h1>tetra_hpc and MPI use.</h1><br>
226 This 2014 beta-version needs MPI, (openmpi was used). To use it you have to proceed as below.
227
228 <li>
229 <b>Obsolete example tepal_v2_mpirun.</b><p>
230
231 \code
232
233 #!/bin/bash
234 #script tepal overriding launching Tepal_V2.0 with MPI (tepal run 64 bits only).
235 #we have renamed binary executable tepal as tepal64_v2.exe.
236 #typical command to launch tepal v1 :
237 #tepal -f /tmp/myname/GHS3DPRL -n 16 > /tmp/myname/tepal.log
238 #this file is an example to transform this call for tepal v2.0, 
239 #   (beta version using .mesh input file)
240 #you have to adapt for your convenience.
241
242 #first problem  is convert v1 input files GHS3DPRL.faces and GHS3DPRL.points 
243 #               to v2 input file GHS3DPRL.mesh.
244 #second problem is to launch on heterogeneous system linux cluster of 
245 #               2 hosts (64 bits) of 8 nodes (by example)
246 #               with different 2 executables codes linked on 2 different
247 #               openmpi shared library codes.
248 #third problem  is convert tepal v2 output files GHS3DPRL*.mesh
249 #               to v1 input files GHS3DPRL*.faces an GHS3DPRL*.points.
250
251 #you have to work on the same physical disk and same path input and output files : $SAME_DIR
252 #you have to work on different physical disk but same path and name for executable files 
253 #    (and shared libraries) : $DIFF_DIR
254
255 echo "parameter 0="$0
256 echo "parameter 1="$1
257 echo "parameter 2="$2
258 echo "parameter 3="$3
259 echo "parameter 4="$4
260
261 export SAME_DIR=/same_physical_disk_and_same path/tmp
262 export DIFF_DIR=/different_physical_disk_but_same path/myname
263
264 #copy input local files from local current directory (something like /tmp/myname)
265 #in this case we need /tmp/myname and $SAME_DIR different
266 cd $SAME_DIR
267 rm *
268 cp $2* .
269
270 export IN_FILES=`basename $2`
271 export IN_DIR=`dirname $2`
272 #created .mesh from .faces et .points
273 /through_salome_path/facespoints2mesh.py $IN_FILES
274
275 #there are 2 executable openmpi and library through 2 physical DIFF_DIR
276 export PATH=$DIFF_DIR/openmpi-1.3.1_install/bin:${PATH}
277 export LD_LIBRARY_PATH=$DIFF_DIR/openmpi-1.3.1_install/lib:${LD_LIBRARY_PATH}
278
279 #there are 2 executables tepal_v2 through 2 physical DIFF_DIR
280 export LD_LIBRARY_PATH=$DIFF_DIR/tepal-2.0.0/bin/Linux_64:${LD_LIBRARY_PATH}
281 export PATH=$DIFF_DIR/tepal-2.0.0/bin/Linux_64:$PATH
282
283 #small test between friends
284 #rm hostnames.log
285 #mpirun -n $4 hostname >> hostnames.log
286
287 #there necessary set env licence file for tepal v2
288 export DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR"
289 export DLIM8VAR="dlim8 1:1:29030@is142356/0016175ef08c::a1ba...9e19"
290 export SIMULOGD_LICENSE_FILE=29029@is142356 
291 export LICENSE_FILE=/product/distene/dlim8.var.sh
292
293 #mpirun with necessary set environment
294 export TMP_ENV="-x PATH -x LD_LIBRARY_PATH -x DISTENE_LICENSE_FILE -x DLIM8VAR \
295                 -x SIMULOGD_LICENSE_FILE -x LICENSE_FILE"
296 #mpirun $TMPENV -n $4 which tepal64_v2.exe >> hostnames.log
297
298 #real mpirun uncomment after verify small test
299 mpirun $TMPENV -n $4 tepal64_v2.exe --in $IN_FILES.mesh --out $IN_FILES.mesh --verbose 100
300
301 #convert output files tepalv1 format
302 /through_salome_path/mesh2facespoints.py $IN_FILES
303
304 #copy output files from $SAME_DIR to local current directory (something like /tmp/myname)
305 cp -f hostnames.log $IN_DIR
306 cp -f $IN_FILES* $IN_DIR
307
308 #ls -al $SAME_DIR
309 #cat $SAME_DIR/hostnames.log
310 #cat /tmp/myname/tepal.log
311
312 \endcode
313 \n
314 </li>
315
316 <h1>TUI use.</h1><br>
317
318 <li>
319 <b>example ex30_tepal.py.</b><p>
320
321 \code
322
323 #!/bin/python
324 import os
325
326 import GEOM
327 from salome.geom import geomBuilder
328 geompy = geomBuilder.New(salome.myStudy)
329
330 import SMESH
331 from salome.smesh import smeshBuilder
332 smesh = smeshBuilder.New(salome.myStudy)
333
334 # Parameters
335 # ----------
336
337 results = "/tmp/ZZ"
338
339 radius =  50
340 height = 200
341
342 # Build a cylinder
343 # ----------------
344
345 base = geompy.MakeVertex(0, 0, 0)
346 direction = geompy.MakeVectorDXDYDZ(0, 0, 1)
347
348 cylinder = geompy.MakeCylinder(base, direction, radius, height)
349
350 geompy.addToStudy(cylinder, "Cylinder")
351
352 # Define a mesh on a geometry
353 # ---------------------------
354
355 m = smesh.Mesh(cylinder)
356
357 # 2D mesh with BLSURF
358 # -------------------
359
360 algo2d = m.Triangle(smeshBuilder.BLSURF)
361
362 algo2d.SetPhysicalMesh(1)
363 algo2d.SetPhySize(5)
364
365 algo2d.SetGeometricMesh(0)
366
367 # 3D mesh with tetra-hpc (formerly tepal v3 (2014))
368 # ----------------------------------------------------
369
370 algo3d = m.Tetrahedron(smeshBuilder.MG_Tetra_HPC)
371
372 algo3d.SetMEDName(results)
373 algo3d.SetNbPart(4)
374 algo3d.SetBackground(False)
375 algo3d.SetMultithread(False)
376 algo3d.SetKeepFiles(False)
377 algo3d.SetGradation(1.05)
378 algo3d.SetMinSize(0)
379 algo3d.SetMaxSize(0)
380
381
382 # Launch meshers
383 # --------------
384
385 status = m.Compute()
386
387 # Test if ok
388 # ----------
389
390 if os.access(results+".xml", os.F_OK):
391     print "Ok: tetra_hpc"
392 else:
393     print "KO: tetra_hpc"
394 \endcode
395 \n
396 </li>
397 </ul>
398
399
400 */