smesh/doc/examples/radial_prism_3d_algo.py

37 lines
1.0 KiB
Python
Raw Normal View History

2018-05-25 22:04:48 +05:00
# Usage of Radial Prism 3D meshing algorithm
import salome
salome.salome_init_without_session()
2022-04-11 18:28:01 +05:00
2018-05-25 22:04:48 +05: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()
2018-05-25 22:04:48 +05:00
2022-04-11 18:28:01 +05:00
# Create geometry: hollow sphere
2018-05-25 22:04:48 +05:00
2022-04-11 18:28:01 +05:00
sphere_1 = geom_builder.MakeSphereR( 100 )
sphere_2 = geom_builder.MakeSphereR( 50 )
2018-05-25 22:04:48 +05:00
2022-04-11 18:28:01 +05:00
hollow_sphere = geom_builder.MakeCut( sphere_1, sphere_2, theName="hollow sphere")
2018-05-25 22:04:48 +05:00
2022-04-11 18:28:01 +05:00
faces = geom_builder.ExtractShapes( hollow_sphere, geom_builder.ShapeType["FACE"] )
2018-05-25 22:04:48 +05:00
# Create mesh
2022-04-11 18:28:01 +05:00
mesh = smesh_builder.Mesh( hollow_sphere, "Mesh of hollow sphere" )
2018-05-25 22:04:48 +05:00
# assign Global Radial Prism algorithm
prism_algo = mesh.Prism()
# define projection between the inner and outer spheres
mesh.Triangle( smeshBuilder.NETGEN_1D2D, faces[0] ) # NETGEN on faces[0]
mesh.Projection1D2D( faces[1] ).SourceFace( faces[0] ) # projection faces[0] -> faces[1]
# define distribution of layers using Number of Segments hypothesis in logarithmic mode
prism_algo.NumberOfSegments( 4, 5. )
# compute the mesh
mesh.Compute()