Salome HOME
23288: [CEA 1626] Meshgems v2.3
[plugins/ghs3dprlplugin.git] / doc / salome / gui / GHS3DPRLPLUGIN / input / ghs3dprl_hypo.doc
1 /*!
2
3 \page ghs3dprl_hypo_page MG-Tetra Parallel 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 Parallel 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 <h1>Modifying MG-Tetra-hpc Advanced Parameters</h1><br>
76 MG-Tetra Parallel plug-in launches a standalone binary
77 executable <b>tetrahpc2med</b>.<br>
78 tetrahpc2med launches MG_Tetra-hpc, waits for the end of computation, and
79 converts the resulting output files into MED files.<br>
80 Some advanced optional parameters are accessible as arguments.<br>
81
82 If <b>Keep Files</b> option is checked, it is possible to re-launch 
83 \a tetrahpc2med or MG-Tetra-hpc in the Terminal as a command with
84 custom parameters.<br> 
85
86 <li>
87 <b>Advanced tetrahpc2med Parameters</b> - type <b>tetrahpc2med --help</b> in the Terminal. <p>
88
89 \verbatim
90 myname@myhost > /export/home/myname/salome_7/GHS3DPRLPLUGIN/bin/salome/tetrahpc2med --help
91 tetrahpc2med V3.0 (MED3+tetra-hpc) Available options:
92    --help               : produces this help message
93    --casename           : path and name of input tetrahpc2med files which are
94                            - output files of GHS3DPRL_Plugin .mesh
95                            - output file of GHS3DPRL_Plugin casename_skin.med (optional)
96                           with initial skin and its initial groups
97    --number             : number of partitions
98    --medname            : path and name of output MED files
99    --limitswap          : max size of working cpu memory (Mo) (before swapping on .temp files)
100    --verbose            : trace of execution (0->6)
101    --test               : more tests about joints, before generation of output files
102    --menu               : a GUI menu for option number
103    --launchtetra        : also launch tetra-hpc on files casename.mesh and option number
104    --merge_subdomains   : merge the subdomains into one mesh and write the output .mesh(b) file
105    --tag_subdomains     : use the parallel subdomain index as tag into the merged output mesh
106                             to identify the parallel subdomains (used in combination with the merge_subdomains option)
107    --output_interfaces  : write the parallel subdomains interface triangles into the merged output mesh
108                             (used in combination with the merge_subdomains option)
109    --discard_subdomains : discard the parallel subdomains informations output (mesh, global numbering and interfaces)
110    --background         : force background mode from launch tetra-hpc and generation of final MED files (big meshes)
111    --deletegroups       : regular expression (see QRegExp) which matches unwanted groups in final MED files
112                             (try --deletegroups="(\bJOINT)"
113                             (try --deletegroups="(\bAll_Nodes|\bAll_Faces)"
114                             (try --deletegroups="((\bAll_|\bNew_)(N|F|T))"
115 example:
116    tetrahpc2med --casename=/tmp/GHS3DPRL --number=2 --medname=DOMAIN --limitswap=1000 --verbose=0 --test=yes --menu=no --launchtetra=no
117
118 \endverbatim
119 \n
120 </li>
121 <li>
122 <b>Advanced tetra_hpc parameters (2014)</b> <p>
123
124 \verbatim
125
126 Usage: tetra_hpc.exe [options]
127
128 Options: 
129
130      Short option (if it exists)
131     /    Long option
132    |    /   Description
133    |   |   /
134    v   v  v
135
136      --help
137           print this help
138
139      --in <input mesh file name>
140           Sets the input file
141           (MANDATORY)
142
143      --out <output mesh file name>
144           Sets the output file
145           (MANDATORY)
146
147      --merge_subdomains <merge>
148           Describes whether to merge the subdomains into one mesh and write the
149           output .mesh(b) file or not.
150           if <merge> is
151              yes : the subdomains will be merged into one mesh and written to
152           the output .mesh(b),
153              no : the subdomains will not be merged.
154           default : no
155
156      --tag_subdomains <tag>
157           Describes whether to use the parallel subdomain index as tag into the
158           merged output mesh or not (used in combination with the
159           merge_subdomains option).
160           if <tag> is
161              yes : the tags of the tetrahedra in the merged output will
162           identify the parallel subdomains,
163              no : the tag will keep its standard meaning of volume domain.
164           default : no
165
166      --output_interfaces <output_interfaces>
167           Describes whether to write the parallel subdomains interface
168           triangles into the merged output mesh or not (used in combination
169           with the merge_subdomains option).
170           if <output_interfaces> is
171              yes : the parallel subdomains interface triangles will be written
172           into the merged output mesh,
173              no : they will not be added to the merged output mesh.
174           default : no
175
176      --verbose <verbose>
177           Set the verbosity level, increasing from 0 to 10.
178            <verbose> values are increasing from 0 to 10 :
179              0 : no details
180             10 : very detailed
181           default : 3
182
183      --discard_subdomains <discard>
184           Describes whether to discard the parallel subdomains (mesh, global
185           numbering and interfaces) or not.
186           if <discard> is
187              yes : the subdomain informations (mesh, global numbering and
188           interfaces) will be discarded,
189              no : they will be written to disk as output.
190           default : no
191
192 \endverbatim
193 \n
194 </li>
195
196 <h1>Saving user's preferred MG-Tetra Parallel Advanced Parameters</h1><br>
197 MG-Tetra Parallel plug-in launches standalone binary executable tetrahpc2med.<br>
198 You may rename file tetrahpc2med as tetrahpc2med.exe for example, and replace
199 tetrahpc2med by a shell script at your convenience to overriding parameters.
200 <br>... or else $PATH modification... .<br>
201 <li>
202 <b>Advanced tetrahpc2med Parameters</b> - overriding parameter deletegroups<p>
203 You may rename tetrahpc2med as tetrahpc2med.exe for example.
204
205 \code
206 #!/bin/bash
207 #script tetrahpc2med overriding parameter deletegroups
208 #we have renamed binary executable tetrahpc2med as tetrahpc2med.exe
209 #echo tetrahpc2med initial parameters are $1 $2 $3 $4 ... or $*
210 #$0 is ignored
211
212 tetrahpc2med.exe $* --deletegroups="(\bAll_Nodes|\bAll_Faces)"
213
214 \endcode
215 \n
216 </li>
217  
218 <h1>tetra_hpc and MPI use.</h1><br>
219 This 2014 beta-version needs MPI, (openmpi was used). To use it you have to proceed as below.
220
221 <li>
222 <b>Obsolete example tepal_v2_mpirun.</b><p>
223
224 \code
225
226 #!/bin/bash
227 #script tepal overriding launching Tepal_V2.0 with MPI (tepal run 64 bits only).
228 #we have renamed binary executable tepal as tepal64_v2.exe.
229 #typical command to launch tepal v1 :
230 #tepal -f /tmp/myname/GHS3DPRL -n 16 > /tmp/myname/tepal.log
231 #this file is an example to transform this call for tepal v2.0, 
232 #   (beta version using .mesh input file)
233 #you have to adapt for your convenience.
234
235 #first problem  is convert v1 input files GHS3DPRL.faces and GHS3DPRL.points 
236 #               to v2 input file GHS3DPRL.mesh.
237 #second problem is to launch on heterogeneous system linux cluster of 
238 #               2 hosts (64 bits) of 8 nodes (by example)
239 #               with different 2 executables codes linked on 2 different
240 #               openmpi shared library codes.
241 #third problem  is convert tepal v2 output files GHS3DPRL*.mesh
242 #               to v1 input files GHS3DPRL*.faces an GHS3DPRL*.points.
243
244 #you have to work on the same physical disk and same path input and output files : $SAME_DIR
245 #you have to work on different physical disk but same path and name for executable files 
246 #    (and shared libraries) : $DIFF_DIR
247
248 echo "parameter 0="$0
249 echo "parameter 1="$1
250 echo "parameter 2="$2
251 echo "parameter 3="$3
252 echo "parameter 4="$4
253
254 export SAME_DIR=/same_physical_disk_and_same path/tmp
255 export DIFF_DIR=/different_physical_disk_but_same path/myname
256
257 #copy input local files from local current directory (something like /tmp/myname)
258 #in this case we need /tmp/myname and $SAME_DIR different
259 cd $SAME_DIR
260 rm *
261 cp $2* .
262
263 export IN_FILES=`basename $2`
264 export IN_DIR=`dirname $2`
265 #created .mesh from .faces et .points
266 /through_salome_path/facespoints2mesh.py $IN_FILES
267
268 #there are 2 executable openmpi and library through 2 physical DIFF_DIR
269 export PATH=$DIFF_DIR/openmpi-1.3.1_install/bin:${PATH}
270 export LD_LIBRARY_PATH=$DIFF_DIR/openmpi-1.3.1_install/lib:${LD_LIBRARY_PATH}
271
272 #there are 2 executables tepal_v2 through 2 physical DIFF_DIR
273 export LD_LIBRARY_PATH=$DIFF_DIR/tepal-2.0.0/bin/Linux_64:${LD_LIBRARY_PATH}
274 export PATH=$DIFF_DIR/tepal-2.0.0/bin/Linux_64:$PATH
275
276 #small test between friends
277 #rm hostnames.log
278 #mpirun -n $4 hostname >> hostnames.log
279
280 #there necessary set env licence file for tepal v2
281 export DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR"
282 export DLIM8VAR="dlim8 1:1:29030@is142356/0016175ef08c::a1ba...9e19"
283 export SIMULOGD_LICENSE_FILE=29029@is142356 
284 export LICENSE_FILE=/product/distene/dlim8.var.sh
285
286 #mpirun with necessary set environment
287 export TMP_ENV="-x PATH -x LD_LIBRARY_PATH -x DISTENE_LICENSE_FILE -x DLIM8VAR \
288                 -x SIMULOGD_LICENSE_FILE -x LICENSE_FILE"
289 #mpirun $TMPENV -n $4 which tepal64_v2.exe >> hostnames.log
290
291 #real mpirun uncomment after verify small test
292 mpirun $TMPENV -n $4 tepal64_v2.exe --in $IN_FILES.mesh --out $IN_FILES.mesh --verbose 100
293
294 #convert output files tepalv1 format
295 /through_salome_path/mesh2facespoints.py $IN_FILES
296
297 #copy output files from $SAME_DIR to local current directory (something like /tmp/myname)
298 cp -f hostnames.log $IN_DIR
299 cp -f $IN_FILES* $IN_DIR
300
301 #ls -al $SAME_DIR
302 #cat $SAME_DIR/hostnames.log
303 #cat /tmp/myname/tepal.log
304
305 \endcode
306 \n
307 </li>
308
309 <h1>TUI use.</h1><br>
310
311 <li>
312 <b>example ex30_tepal.py.</b><p>
313
314 \code
315
316 #!/bin/python
317 import os
318
319 import GEOM
320 from salome.geom import geomBuilder
321 geompy = geomBuilder.New(salome.myStudy)
322
323 import SMESH
324 from salome.smesh import smeshBuilder
325 smesh = smeshBuilder.New(salome.myStudy)
326
327 # Parameters
328 # ----------
329
330 results = "/tmp/ZZ"
331
332 radius =  50
333 height = 200
334
335 # Build a cylinder
336 # ----------------
337
338 base = geompy.MakeVertex(0, 0, 0)
339 direction = geompy.MakeVectorDXDYDZ(0, 0, 1)
340
341 cylinder = geompy.MakeCylinder(base, direction, radius, height)
342
343 geompy.addToStudy(cylinder, "Cylinder")
344
345 # Define a mesh on a geometry
346 # ---------------------------
347
348 m = smesh.Mesh(cylinder)
349
350 # 2D mesh with BLSURF
351 # -------------------
352
353 algo2d = m.Triangle(smeshBuilder.BLSURF)
354
355 algo2d.SetPhysicalMesh(1)
356 algo2d.SetPhySize(5)
357
358 algo2d.SetGeometricMesh(0)
359
360 # 3D mesh with tetra-hpc (formerly tepal v3 (2014))
361 # ----------------------------------------------------
362
363 algo3d = m.Tetrahedron(smeshBuilder.MG_Tetra_Parallel)
364
365 algo3d.SetMEDName(results)
366 algo3d.SetNbPart(4)
367 algo3d.SetBackground(False)
368 algo3d.SetMultithread(False)
369 algo3d.SetKeepFiles(False)
370 algo3d.SetGradation(1.05)
371 algo3d.SetMinSize(0)
372 algo3d.SetMaxSize(0)
373
374
375 # Launch meshers
376 # --------------
377
378 status = m.Compute()
379
380 # Test if ok
381 # ----------
382
383 if os.access(results+".xml", os.F_OK):
384     print "Ok: tetra_hpc"
385 else:
386     print "KO: tetra_hpc"
387 \endcode
388 \n
389 </li>
390 </ul>
391
392
393 */