Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/smesh.git] / doc / salome / gui / SMESH / input / tui_generate_flat_elements.doc
1 /*!
2
3 \page tui_generate_flat_elements_page Generate flat elements
4
5 <br>
6 \anchor tui_double_nodes_on_group_boundaries
7 <h2>Double nodes on groups boundaries</h2>
8
9 \n Double nodes on shared faces between groups of volumes and create flat elements on demand.
10 \n The list of groups must describe a partition of the mesh volumes. The nodes of the internal
11 faces at the boundaries of the groups are doubled. Optionally, the internal faces are replaced
12 by flat elements.
13 \n Triangles are transformed into prisms, and quadrangles into hexahedrons.
14 \n The flat elements are stored in groups of volumes.
15
16 \n
17 \n This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder).
18 The big cylinder is defined by two geometric volumes.
19
20 \code
21 import geompy
22 import smesh
23 import SMESH
24 # geometry 
25
26 O = geompy.MakeVertex(0, 0, 0)
27 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
28 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
29 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
30 Vertex_1 = geompy.MakeVertex(50, 0, 0)
31 Cylinder_1 = geompy.MakeCylinder(O, OX, 10, 500)
32 Cylinder_2 = geompy.MakeCylinder(Vertex_1, OX, 100, 400)
33 Vertex_2 = geompy.MakeVertex(-200, -200, -200)
34 Vertex_3 = geompy.MakeVertex(250, 200, 200)
35 Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_3)
36 Fuse_1 = geompy.MakeFuse(Cylinder_1, Cylinder_2)
37 Partition_1 = geompy.MakePartition([Fuse_1], [Cylinder_1, Box_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
38 [Solid_1,Solid_2] = geompy.GetShapesOnShape(Cylinder_1, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN)
39 [Solid_3,Solid_4] = geompy.GetShapesOnShape(Cylinder_2, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN)
40 Vertex_4 = geompy.MakeVertex(450, 0, 0)
41 Vertex_5 = geompy.MakeVertex(500, 0, 0)
42 Vertex_6 = geompy.MakeVertex(550, 0, 0)
43 vec1 = geompy.MakeVector(Vertex_4, Vertex_5)
44 vec2 = geompy.MakeVector(Vertex_5, Vertex_6)
45 [Face_1] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec1, geompy.GEOM.ST_ON)
46 [Face_2] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec2, geompy.GEOM.ST_ON)
47
48 # meshing (we have linear tetrahedrons here, but other elements are OK)
49
50 Mesh_1 = smesh.Mesh(Partition_1)
51 Regular_1D = Mesh_1.Segment()
52 Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
53 MEFISTO_2D = Mesh_1.Triangle(algo=smesh.MEFISTO)
54 Length_From_Edges_2D = MEFISTO_2D.LengthFromEdges()
55 ALGO3D = Mesh_1.Tetrahedron()
56 isDone = Mesh_1.Compute()
57
58 # relevant groups of volumes and faces
59
60 Solid_1_1 = Mesh_1.GroupOnGeom(Solid_1,'Solid_1',SMESH.VOLUME)
61 Solid_2_1 = Mesh_1.GroupOnGeom(Solid_2,'Solid_2',SMESH.VOLUME)
62 Solid_3_1 = Mesh_1.GroupOnGeom(Solid_3,'Solid_3',SMESH.VOLUME)
63 Solid_4_1 = Mesh_1.GroupOnGeom(Solid_4,'Solid_4',SMESH.VOLUME)
64 Face_1_1 = Mesh_1.GroupOnGeom(Face_1,'Face_1',SMESH.FACE)
65 Face_2_1 = Mesh_1.GroupOnGeom(Face_2,'Face_2',SMESH.FACE)
66
67 \endcode
68
69 \n Here, the 4 groups of volumes [Solid_1_1, Solid_2_1, Solid_3_1, Solid_4_1] constitute a partition of the mesh.
70 The flat elements on group boundaries and on faces are built with the following code.
71 \n If the last argument (Boolean) in DoubleNodesOnGroupBoundaries is set to 1,
72 the flat elements are built, otherwise, there is only a duplication of the nodes.
73
74 \code
75 Mesh_1.DoubleNodesOnGroupBoundaries([Solid_1_1, Solid_2_1, Solid_3_1, Solid_4_1], 1)
76
77 Mesh_1.CreateFlatElementsOnFacesGroups([Face_1_1, Face_2_1])
78 \endcode
79
80 \n To observe flat element groups, save the resulting mesh on a MED file and reload it.
81
82 */