2016-10-03 19:53:47 +05:00
|
|
|
# Arithmetic Progression and Geometric Progression
|
2013-02-12 20:37:44 +06:00
|
|
|
|
2013-04-04 13:08:19 +06:00
|
|
|
import salome
|
2021-08-12 14:38:10 +05:00
|
|
|
salome.salome_init_without_session()
|
2014-01-15 15:41:17 +06:00
|
|
|
|
2013-04-04 13:08:19 +06:00
|
|
|
from salome.geom import geomBuilder
|
|
|
|
from salome.smesh import smeshBuilder
|
2022-04-11 18:28:01 +05:00
|
|
|
|
|
|
|
geom_builder = geomBuilder.New()
|
|
|
|
smesh_builder = smeshBuilder.New()
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a box
|
2022-04-11 18:28:01 +05:00
|
|
|
box = geom_builder.MakeBoxDXDYDZ(10., 10., 10.)
|
|
|
|
geom_builder.addToStudy(box, "Box")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a hexahedral mesh on the box
|
2022-04-11 18:28:01 +05:00
|
|
|
hexa = smesh_builder.Mesh(box, "Box : hexahedrical mesh")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a Regular 1D algorithm for edges
|
|
|
|
algo1D = hexa.Segment()
|
|
|
|
|
|
|
|
# optionally reverse node distribution on certain edges
|
2022-04-11 18:28:01 +05:00
|
|
|
allEdges = geom_builder.SubShapeAllSorted( box, geom_builder.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()
|