smesh/doc/examples/defining_hypotheses_ex06.py

37 lines
818 B
Python
Raw Normal View History

2013-02-12 20:37:44 +06:00
# Maximum Element Volume
import salome
salome.salome_init_without_session()
from salome.smesh import smeshBuilder
2022-04-11 18:28:01 +05:00
from salome.geom import geomBuilder
geom_builder = geomBuilder.New()
smesh_builder = smeshBuilder.New()
2013-02-12 20:37:44 +06:00
# create a cylinder
2022-04-11 18:28:01 +05:00
cyl = geom_builder.MakeCylinderRH(30., 50.)
geom_builder.addToStudy(cyl, "cyl")
2013-02-12 20:37:44 +06:00
# create a mesh on the cylinder
2022-04-11 18:28:01 +05:00
tetra = smesh_builder.Mesh(cyl, "Cylinder : tetrahedrical mesh")
2013-02-12 20:37:44 +06:00
# assign algorithms
algo1D = tetra.Segment()
algo2D = tetra.Triangle()
algo3D = tetra.Tetrahedron()
# assign 1D and 2D hypotheses
algo1D.NumberOfSegments(7)
algo2D.MaxElementArea(150.)
# assign Max Element Volume hypothesis
algo3D.MaxElementVolume(200.)
# compute the mesh
ret = tetra.Compute()
if ret == 0:
2017-03-20 17:27:30 +05:00
print("problem when computing the mesh")
2013-02-12 20:37:44 +06:00
else:
2017-03-20 17:27:30 +05:00
print("Computation succeeded")