]> SALOME platform Git repositories - modules/smesh.git/blob - doc/salome/examples/defining_hypotheses_ex17.py
Salome HOME
Fix for the '52701: SIGSEGV in Mesh creation dialog box after activating Viscous...
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex17.py
1 # Viscous layers construction
2
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8
9 import SMESH, SALOMEDS
10 from salome.smesh import smeshBuilder
11 smesh =  smeshBuilder.New(salome.myStudy)
12
13 X = geompy.MakeVectorDXDYDZ( 1,0,0 )
14 O = geompy.MakeVertex( 100,50,50 )
15 plane = geompy.MakePlane( O, X, 200 ) # plane YZ
16
17 box = geompy.MakeBoxDXDYDZ(200,100,100)
18
19 shape = geompy.MakeHalfPartition( box, plane )
20
21 faces = geompy.SubShapeAllSorted(shape, geompy.ShapeType["FACE"])
22 face1 = faces[1]
23 ignoreFaces = [ faces[0], faces[-1]]
24
25 geompy.addToStudy( shape, "shape" )
26 geompy.addToStudyInFather( shape, face1, "face1")
27
28 # 3D Viscous layers
29
30 mesh = smesh.Mesh(shape, "CFD")
31
32 mesh.Segment().NumberOfSegments( 4 )
33
34 mesh.Triangle()
35 mesh.Quadrangle(face1)
36 mesh.Compute()
37 algo3D = mesh.Tetrahedron()
38
39 thickness = 20
40 numberOfLayers = 10
41 stretchFactor = 1.5
42 layersHyp = algo3D.ViscousLayers(thickness,numberOfLayers,stretchFactor,ignoreFaces)
43
44 mesh.Compute()
45
46 mesh.MakeGroup("Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_TETRA)
47 mesh.MakeGroup("Pyras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PYRAMID)
48 mesh.MakeGroup("Prims",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PENTA)
49
50 # 2D Viscous layers
51
52 # 3 edges of the 4 edges of face1
53 edgeIds = geompy.SubShapeAllIDs( face1, geompy.ShapeType["EDGE"])[:-1]
54
55 mesh = smesh.Mesh(face1,"VicsousLayers2D")
56 mesh.Segment().NumberOfSegments( 5 )
57
58 # viscous layers should be created on 1 edge, as we set 3 edges to ignore
59 vlHyp = mesh.Triangle().ViscousLayers2D( 2, 3, 1.5, edgeIds, isEdgesToIgnore=True )
60
61 mesh.Compute()
62
63 # viscous layers should be created on 3 edges, as we pass isEdgesToIgnore=False
64 vlHyp.SetEdges( edgeIds, False )
65
66 mesh.Compute()