smesh/doc/salome/examples/defining_hypotheses_ex01.py

45 lines
1.3 KiB
Python
Raw Normal View History

# Arithmetic Progression and Geometric Progression
2013-02-12 20:37:44 +06:00
import salome
salome.salome_init()
2014-01-15 15:41:17 +06:00
from salome.geom import geomBuilder
2017-06-13 15:01:10 +05:00
geompy = geomBuilder.New()
from salome.smesh import smeshBuilder
2017-06-13 15:01:10 +05:00
smesh = smeshBuilder.New()
2013-02-12 20:37:44 +06:00
# create a box
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
geompy.addToStudy(box, "Box")
# create a hexahedral mesh on the box
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
# create a Regular 1D algorithm for edges
algo1D = hexa.Segment()
# optionally reverse node distribution on certain edges
2014-01-15 15:41:17 +06:00
allEdges = geompy.SubShapeAllSorted( box, geompy.ShapeType["EDGE"])
2013-02-12 20:37:44 +06:00
reversedEdges = [ allEdges[0], allEdges[4] ]
# define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length
algo1D.Arithmetic1D(1, 4, reversedEdges)
2014-01-15 15:41:17 +06:00
# define "Geometric Progression" hypothesis on one edge to cut this edge in segments with length increasing by 20% starting from 1
gpAlgo = hexa.Segment( allEdges[1] )
gpAlgo.GeometricProgression( 1, 1.2 )
# propagate distribution of nodes computed using "Geometric Progression" to parallel edges
gpAlgo.PropagationOfDistribution()
2013-02-12 20:37:44 +06:00
# create a quadrangle 2D algorithm for faces
hexa.Quadrangle()
# create a hexahedron 3D algorithm for solids
hexa.Hexahedron()
# compute the mesh
hexa.Compute()