New: automated grouping for boundaries
This commit is contained in:
parent
8a2a28d21f
commit
034cc26a08
@ -11,8 +11,10 @@ alpha = [ 0.1, 0.15, 0.2 ]
|
|||||||
pore = []
|
pore = []
|
||||||
|
|
||||||
for coef in alpha:
|
for coef in alpha:
|
||||||
[Pore, Segment1_4, Segment1_8] = geometry.create(coef)
|
# TODO: Manage bc, not used
|
||||||
geompy.addToStudy(Pore, 'Pore {}'.format(coef))
|
Pore, bc = geometry.create(coef)
|
||||||
|
geometry.geompy.addToStudy(Pore, 'Pore {}'.format(coef))
|
||||||
|
|
||||||
pore.append(Pore)
|
pore.append(Pore)
|
||||||
|
|
||||||
print("Geometry for alpha = {}".format(coef))
|
print("Geometry for alpha = {}".format(coef))
|
||||||
@ -22,11 +24,11 @@ for coef in alpha:
|
|||||||
for Pore in pore:
|
for Pore in pore:
|
||||||
print("Building mesh for {}".format(Pore.GetName()))
|
print("Building mesh for {}".format(Pore.GetName()))
|
||||||
|
|
||||||
mesh_ = mesh.create(Pore)
|
mesh_ = mesh.create(Pore, bc)
|
||||||
isDone = mesh_.Compute()
|
#isDone = mesh_.Compute()
|
||||||
|
|
||||||
status = "Succesfully" if isDone else "Mesh is not computed"
|
#status = "Succesfully" if isDone else "Mesh is not computed"
|
||||||
print(status)
|
#print(status)
|
||||||
|
|
||||||
#try:
|
#try:
|
||||||
# dirname = os.path.dirname(__file__)
|
# dirname = os.path.dirname(__file__)
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
import SMESH, SALOMEDS
|
|
||||||
from salome.smesh import smeshBuilder
|
|
||||||
smesh = smeshBuilder.New()
|
|
||||||
|
|
||||||
|
|
||||||
def create(geomObj):
|
|
||||||
mesh = smesh.Mesh(geomObj)
|
|
||||||
netgen = mesh.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
|
|
||||||
|
|
||||||
param = netgen.Parameters()
|
|
||||||
param.SetSecondOrder( 0 )
|
|
||||||
param.SetOptimize( 1 )
|
|
||||||
param.SetChordalError( -1 )
|
|
||||||
param.SetChordalErrorEnabled( 0 )
|
|
||||||
param.SetUseSurfaceCurvature( 1 )
|
|
||||||
param.SetFuseEdges( 1 )
|
|
||||||
param.SetCheckChartBoundary( 0 )
|
|
||||||
param.SetMinSize( 0.01 )
|
|
||||||
param.SetMaxSize( 0.05 )
|
|
||||||
param.SetFineness( 3 )
|
|
||||||
param.SetGrowthRate( 0.1 )
|
|
||||||
param.SetNbSegPerEdge( 5 )
|
|
||||||
param.SetNbSegPerRadius( 10 )
|
|
||||||
param.SetQuadAllowed( 0 )
|
|
||||||
|
|
||||||
vlayer = netgen.ViscousLayers(0.01, 3, 1.5, [],
|
|
||||||
1, smeshBuilder.SURF_OFFSET_SMOOTH)
|
|
||||||
|
|
||||||
return mesh
|
|
||||||
|
|
@ -5,12 +5,14 @@ geompy = geomBuilder.New()
|
|||||||
import math
|
import math
|
||||||
|
|
||||||
def create(alpha):
|
def create(alpha):
|
||||||
|
# xyz axes
|
||||||
axes = [
|
axes = [
|
||||||
geompy.MakeVectorDXDYDZ(1, 0, 0),
|
geompy.MakeVectorDXDYDZ(1, 0, 0),
|
||||||
geompy.MakeVectorDXDYDZ(0, 1, 0),
|
geompy.MakeVectorDXDYDZ(0, 1, 0),
|
||||||
geompy.MakeVectorDXDYDZ(0, 0, 1)
|
geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Main box
|
||||||
box = geompy.MakeBoxDXDYDZ(2 * math.sqrt(2), 2 * math.sqrt(2), 2)
|
box = geompy.MakeBoxDXDYDZ(2 * math.sqrt(2), 2 * math.sqrt(2), 2)
|
||||||
box = geompy.MakeRotation(box, axes[2], 45 * math.pi / 180.0)
|
box = geompy.MakeRotation(box, axes[2], 45 * math.pi / 180.0)
|
||||||
box = geompy.MakeTranslation(box, 2, 0, 0)
|
box = geompy.MakeTranslation(box, 2, 0, 0)
|
||||||
@ -22,7 +24,8 @@ def create(alpha):
|
|||||||
]
|
]
|
||||||
|
|
||||||
line = geompy.MakeLineTwoPnt(vtx[1], vtx[2])
|
line = geompy.MakeLineTwoPnt(vtx[1], vtx[2])
|
||||||
|
|
||||||
|
# Spheres for cutting
|
||||||
sphere = geompy.MakeSpherePntR(vtx[0], 1 / (1 - alpha))
|
sphere = geompy.MakeSpherePntR(vtx[0], 1 / (1 - alpha))
|
||||||
sphere = geompy.MakeMultiTranslation1D(sphere, axes[1], 2, 3)
|
sphere = geompy.MakeMultiTranslation1D(sphere, axes[1], 2, 3)
|
||||||
cut = geompy.MakeCutList(box, [sphere], True)
|
cut = geompy.MakeCutList(box, [sphere], True)
|
||||||
@ -34,14 +37,16 @@ def create(alpha):
|
|||||||
cut3 = geompy.MakeCutList(cut2, [sphere3], True)
|
cut3 = geompy.MakeCutList(cut2, [sphere3], True)
|
||||||
|
|
||||||
sphere4 = geompy.MakeTranslation(sphere3, 0, 0, 2)
|
sphere4 = geompy.MakeTranslation(sphere3, 0, 0, 2)
|
||||||
|
|
||||||
|
# Main geometry
|
||||||
Pore = geompy.MakeCutList(cut3, [sphere4], True)
|
Pore = geompy.MakeCutList(cut3, [sphere4], True)
|
||||||
|
|
||||||
|
# 1/4 of Pore
|
||||||
box2 = geompy.MakeBoxDXDYDZ(2, 2, 2)
|
box2 = geompy.MakeBoxDXDYDZ(2, 2, 2)
|
||||||
box2 = geompy.MakeTranslation(box2, 2, 0, 0)
|
box2 = geompy.MakeTranslation(box2, 2, 0, 0)
|
||||||
Segment1_4 = geompy.MakeCommonList([Pore, box2], True)
|
Segment1_4 = geompy.MakeCommonList([Pore, box2], True)
|
||||||
|
|
||||||
|
# 1/8 of Pore
|
||||||
vec1 = geompy.MakeVector(geompy.MakeVertex(3, 1, 0), geompy.MakeVertex(3, 1, 1))
|
vec1 = geompy.MakeVector(geompy.MakeVertex(3, 1, 0), geompy.MakeVertex(3, 1, 1))
|
||||||
box2 = geompy.MakeRotation(box2, vec1, 45*math.pi/180.0)
|
box2 = geompy.MakeRotation(box2, vec1, 45*math.pi/180.0)
|
||||||
vec2 = geompy.MakeVector(geompy.MakeVertex(3, 1, 0), geompy.MakeVertex(2, 0, 0))
|
vec2 = geompy.MakeVector(geompy.MakeVertex(3, 1, 0), geompy.MakeVertex(2, 0, 0))
|
||||||
@ -49,4 +54,29 @@ def create(alpha):
|
|||||||
box2 = geompy.MakeTranslation(box2, -0.5, 0.5, 0)
|
box2 = geompy.MakeTranslation(box2, -0.5, 0.5, 0)
|
||||||
Segment1_8 = geompy.MakeCommonList([Segment1_4, box2], True)
|
Segment1_8 = geompy.MakeCommonList([Segment1_4, box2], True)
|
||||||
|
|
||||||
return Pore, Segment1_4, Segment1_8
|
# Prepare faces
|
||||||
|
vtx.append(geompy.MakeVertex(2, 2, 2))
|
||||||
|
vtx.append(geompy.MakeVertexWithRef(vtx[3], 0, 0, 1))
|
||||||
|
vec2 = geompy.MakeVector(vtx[3], vtx[4])
|
||||||
|
plane = geompy.MakePlane(vtx[3], vec2, 5)
|
||||||
|
common1 = geompy.MakeCommonList([Pore, plane], True)
|
||||||
|
plane = geompy.MakeTranslation(plane, 0, 0, -2)
|
||||||
|
common2 = geompy.MakeCommonList([Pore, plane], True)
|
||||||
|
|
||||||
|
# Main groups (inlet, outlet, wall)
|
||||||
|
inlet = geompy.CreateGroup(Pore, geompy.ShapeType["FACE"])
|
||||||
|
faces = geompy.SubShapeAllIDs(common1, geompy.ShapeType["FACE"])
|
||||||
|
geompy.UnionIDs(inlet, faces)
|
||||||
|
|
||||||
|
outlet = geompy.CreateGroup(Pore, geompy.ShapeType["FACE"])
|
||||||
|
faces = geompy.SubShapeAllIDs(common2, geompy.ShapeType["FACE"])
|
||||||
|
geompy.UnionIDs(outlet, faces)
|
||||||
|
|
||||||
|
PoreGroup = geompy.CreateGroup(Pore, geompy.ShapeType["FACE"])
|
||||||
|
faces = geompy.SubShapeAllIDs(Pore, geompy.ShapeType["FACE"])
|
||||||
|
geompy.UnionIDs(PoreGroup, faces)
|
||||||
|
|
||||||
|
wall = geompy.CutListOfGroups([PoreGroup], [inlet, outlet])
|
||||||
|
|
||||||
|
|
||||||
|
return Pore, [inlet, outlet, wall]
|
||||||
|
@ -3,7 +3,7 @@ from salome.smesh import smeshBuilder
|
|||||||
smesh = smeshBuilder.New()
|
smesh = smeshBuilder.New()
|
||||||
|
|
||||||
|
|
||||||
def create(geomObj):
|
def create(geomObj, bc):
|
||||||
mesh = smesh.Mesh(geomObj)
|
mesh = smesh.Mesh(geomObj)
|
||||||
netgen = mesh.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
|
netgen = mesh.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
|
||||||
|
|
||||||
@ -16,14 +16,19 @@ def create(geomObj):
|
|||||||
param.SetFuseEdges( 1 )
|
param.SetFuseEdges( 1 )
|
||||||
param.SetCheckChartBoundary( 0 )
|
param.SetCheckChartBoundary( 0 )
|
||||||
param.SetMinSize( 0.01 )
|
param.SetMinSize( 0.01 )
|
||||||
param.SetMaxSize( 0.05 )
|
param.SetMaxSize( 0.1 )
|
||||||
param.SetFineness( 5 )
|
param.SetFineness( 3 )
|
||||||
param.SetGrowthRate( 0.1 )
|
#param.SetGrowthRate( 0.1 )
|
||||||
param.SetNbSegPerEdge( 5 )
|
#param.SetNbSegPerEdge( 5 )
|
||||||
param.SetNbSegPerRadius( 10 )
|
#param.SetNbSegPerRadius( 10 )
|
||||||
param.SetQuadAllowed( 1 )
|
param.SetQuadAllowed( 0 )
|
||||||
|
|
||||||
#vlayer = netgen.ViscousLayers(0.05, 3, 1.5, [15, 29, 54], 1, smeshBuilder.SURF_OFFSET_SMOOTH)
|
vlayer = netgen.ViscousLayers(0.025, 5, 1.1, [],
|
||||||
|
1, smeshBuilder.NODE_OFFSET)
|
||||||
|
|
||||||
|
mesh.GroupOnGeom(bc[0], 'inlet', SMESH.FACE)
|
||||||
|
mesh.GroupOnGeom(bc[1], 'outlet', SMESH.FACE)
|
||||||
|
mesh.GroupOnGeom(bc[2], 'wall', SMESH.FACE)
|
||||||
|
|
||||||
return mesh
|
return mesh
|
||||||
|
|
||||||
|
Binary file not shown.
293
worksheet/cube_160220.py
Normal file
293
worksheet/cube_160220.py
Normal file
@ -0,0 +1,293 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
###
|
||||||
|
### This file is generated automatically by SALOME v9.6.0 with dump python functionality
|
||||||
|
###
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import salome
|
||||||
|
|
||||||
|
salome.salome_init()
|
||||||
|
import salome_notebook
|
||||||
|
notebook = salome_notebook.NoteBook()
|
||||||
|
sys.path.insert(0, r'/home/nafaryus/projects/anisotrope-cube/worksheet')
|
||||||
|
|
||||||
|
###
|
||||||
|
### GEOM component
|
||||||
|
###
|
||||||
|
|
||||||
|
import GEOM
|
||||||
|
from salome.geom import geomBuilder
|
||||||
|
import math
|
||||||
|
import SALOMEDS
|
||||||
|
|
||||||
|
|
||||||
|
geompy = geomBuilder.New()
|
||||||
|
|
||||||
|
geomObj_1 = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||||
|
geomObj_2 = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
||||||
|
geomObj_3 = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||||
|
geomObj_4 = geompy.MakeBoxDXDYDZ(2.82842712474619, 2.82842712474619, 2)
|
||||||
|
geomObj_5 = geompy.MakeRotation(geomObj_4, geomObj_3, 45*math.pi/180.0)
|
||||||
|
geomObj_6 = geompy.MakeTranslation(geomObj_5, 2, 0, 0)
|
||||||
|
geomObj_7 = geompy.MakeVertex(2, 0, 0)
|
||||||
|
geomObj_8 = geompy.MakeVertex(2, 2, 0)
|
||||||
|
geomObj_9 = geompy.MakeVertex(2, 2, 2)
|
||||||
|
geomObj_10 = geompy.MakeLineTwoPnt(geomObj_8, geomObj_9)
|
||||||
|
geomObj_11 = geompy.MakeSpherePntR(geomObj_7, 1.111111111111111)
|
||||||
|
geomObj_12 = geompy.MakeMultiTranslation1D(geomObj_11, geomObj_2, 2, 3)
|
||||||
|
geomObj_13 = geompy.MakeCutList(geomObj_6, [geomObj_12], True)
|
||||||
|
geomObj_14 = geompy.MakeTranslation(geomObj_12, 0, 0, 2)
|
||||||
|
geomObj_15 = geompy.MakeCutList(geomObj_13, [geomObj_14], True)
|
||||||
|
geomObj_16 = geompy.MakeRotation(geomObj_12, geomObj_10, 90*math.pi/180.0)
|
||||||
|
geomObj_17 = geompy.MakeCutList(geomObj_15, [geomObj_16], True)
|
||||||
|
geomObj_18 = geompy.MakeTranslation(geomObj_16, 0, 0, 2)
|
||||||
|
Pore_0_1 = geompy.MakeCutList(geomObj_17, [geomObj_18], True)
|
||||||
|
geomObj_19 = geompy.MakeBoxDXDYDZ(2, 2, 2)
|
||||||
|
geomObj_20 = geompy.MakeTranslation(geomObj_19, 2, 0, 0)
|
||||||
|
geomObj_21 = geompy.MakeCommonList([Pore_0_1, geomObj_20], True)
|
||||||
|
geomObj_22 = geompy.MakeVertex(3, 1, 0)
|
||||||
|
geomObj_23 = geompy.MakeVertex(3, 1, 1)
|
||||||
|
geomObj_24 = geompy.MakeVector(geomObj_22, geomObj_23)
|
||||||
|
geomObj_25 = geompy.MakeRotation(geomObj_20, geomObj_24, 45*math.pi/180.0)
|
||||||
|
geomObj_26 = geompy.MakeVertex(3, 1, 0)
|
||||||
|
geomObj_27 = geompy.MakeVertex(2, 0, 0)
|
||||||
|
geomObj_28 = geompy.MakeVector(geomObj_26, geomObj_27)
|
||||||
|
geomObj_29 = geompy.MakeTranslationVectorDistance(geomObj_25, geomObj_28, 1)
|
||||||
|
geomObj_30 = geompy.MakeTranslation(geomObj_29, -0.5, 0.5, 0)
|
||||||
|
geomObj_31 = geompy.MakeCommonList([geomObj_21, geomObj_30], True)
|
||||||
|
geomObj_32 = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||||
|
geomObj_33 = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
||||||
|
geomObj_34 = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||||
|
geomObj_35 = geompy.MakeBoxDXDYDZ(2.82842712474619, 2.82842712474619, 2)
|
||||||
|
geomObj_36 = geompy.MakeRotation(geomObj_35, geomObj_34, 45*math.pi/180.0)
|
||||||
|
geomObj_37 = geompy.MakeTranslation(geomObj_36, 2, 0, 0)
|
||||||
|
geomObj_38 = geompy.MakeVertex(2, 0, 0)
|
||||||
|
geomObj_39 = geompy.MakeVertex(2, 2, 0)
|
||||||
|
geomObj_40 = geompy.MakeVertex(2, 2, 2)
|
||||||
|
geomObj_41 = geompy.MakeLineTwoPnt(geomObj_39, geomObj_40)
|
||||||
|
geomObj_42 = geompy.MakeSpherePntR(geomObj_38, 1.176470588235294)
|
||||||
|
geomObj_43 = geompy.MakeMultiTranslation1D(geomObj_42, geomObj_33, 2, 3)
|
||||||
|
geomObj_44 = geompy.MakeCutList(geomObj_37, [geomObj_43], True)
|
||||||
|
geomObj_45 = geompy.MakeTranslation(geomObj_43, 0, 0, 2)
|
||||||
|
geomObj_46 = geompy.MakeCutList(geomObj_44, [geomObj_45], True)
|
||||||
|
geomObj_47 = geompy.MakeRotation(geomObj_43, geomObj_41, 90*math.pi/180.0)
|
||||||
|
geomObj_48 = geompy.MakeCutList(geomObj_46, [geomObj_47], True)
|
||||||
|
geomObj_49 = geompy.MakeTranslation(geomObj_47, 0, 0, 2)
|
||||||
|
Pore_0_15 = geompy.MakeCutList(geomObj_48, [geomObj_49], True)
|
||||||
|
geomObj_50 = geompy.MakeBoxDXDYDZ(2, 2, 2)
|
||||||
|
geomObj_51 = geompy.MakeTranslation(geomObj_50, 2, 0, 0)
|
||||||
|
geomObj_52 = geompy.MakeCommonList([Pore_0_15, geomObj_51], True)
|
||||||
|
geomObj_53 = geompy.MakeVertex(3, 1, 0)
|
||||||
|
geomObj_54 = geompy.MakeVertex(3, 1, 1)
|
||||||
|
geomObj_55 = geompy.MakeVector(geomObj_53, geomObj_54)
|
||||||
|
geomObj_56 = geompy.MakeRotation(geomObj_51, geomObj_55, 45*math.pi/180.0)
|
||||||
|
geomObj_57 = geompy.MakeVertex(3, 1, 0)
|
||||||
|
geomObj_58 = geompy.MakeVertex(2, 0, 0)
|
||||||
|
geomObj_59 = geompy.MakeVector(geomObj_57, geomObj_58)
|
||||||
|
geomObj_60 = geompy.MakeTranslationVectorDistance(geomObj_56, geomObj_59, 1)
|
||||||
|
geomObj_61 = geompy.MakeTranslation(geomObj_60, -0.5, 0.5, 0)
|
||||||
|
geomObj_62 = geompy.MakeCommonList([geomObj_52, geomObj_61], True)
|
||||||
|
geomObj_63 = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||||
|
geomObj_64 = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
||||||
|
geomObj_65 = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||||
|
geomObj_66 = geompy.MakeBoxDXDYDZ(2.82842712474619, 2.82842712474619, 2)
|
||||||
|
geomObj_67 = geompy.MakeRotation(geomObj_66, geomObj_65, 45*math.pi/180.0)
|
||||||
|
geomObj_68 = geompy.MakeTranslation(geomObj_67, 2, 0, 0)
|
||||||
|
geomObj_69 = geompy.MakeVertex(2, 0, 0)
|
||||||
|
geomObj_70 = geompy.MakeVertex(2, 2, 0)
|
||||||
|
geomObj_71 = geompy.MakeVertex(2, 2, 2)
|
||||||
|
geomObj_72 = geompy.MakeLineTwoPnt(geomObj_70, geomObj_71)
|
||||||
|
geomObj_73 = geompy.MakeSpherePntR(geomObj_69, 1.25)
|
||||||
|
geomObj_74 = geompy.MakeMultiTranslation1D(geomObj_73, geomObj_64, 2, 3)
|
||||||
|
geomObj_75 = geompy.MakeCutList(geomObj_68, [geomObj_74], True)
|
||||||
|
geomObj_76 = geompy.MakeTranslation(geomObj_74, 0, 0, 2)
|
||||||
|
geomObj_77 = geompy.MakeCutList(geomObj_75, [geomObj_76], True)
|
||||||
|
geomObj_78 = geompy.MakeRotation(geomObj_74, geomObj_72, 90*math.pi/180.0)
|
||||||
|
geomObj_79 = geompy.MakeCutList(geomObj_77, [geomObj_78], True)
|
||||||
|
geomObj_80 = geompy.MakeTranslation(geomObj_78, 0, 0, 2)
|
||||||
|
Pore_0_2 = geompy.MakeCutList(geomObj_79, [geomObj_80], True)
|
||||||
|
geomObj_81 = geompy.MakeBoxDXDYDZ(2, 2, 2)
|
||||||
|
geomObj_82 = geompy.MakeTranslation(geomObj_81, 2, 0, 0)
|
||||||
|
geomObj_83 = geompy.MakeCommonList([Pore_0_2, geomObj_82], True)
|
||||||
|
geomObj_84 = geompy.MakeVertex(3, 1, 0)
|
||||||
|
geomObj_85 = geompy.MakeVertex(3, 1, 1)
|
||||||
|
geomObj_86 = geompy.MakeVector(geomObj_84, geomObj_85)
|
||||||
|
geomObj_87 = geompy.MakeRotation(geomObj_82, geomObj_86, 45*math.pi/180.0)
|
||||||
|
geomObj_88 = geompy.MakeVertex(3, 1, 0)
|
||||||
|
geomObj_89 = geompy.MakeVertex(2, 0, 0)
|
||||||
|
geomObj_90 = geompy.MakeVector(geomObj_88, geomObj_89)
|
||||||
|
geomObj_91 = geompy.MakeTranslationVectorDistance(geomObj_87, geomObj_90, 1)
|
||||||
|
geomObj_92 = geompy.MakeTranslation(geomObj_91, -0.5, 0.5, 0)
|
||||||
|
geomObj_93 = geompy.MakeCommonList([geomObj_83, geomObj_92], True)
|
||||||
|
Fillet_1 = geompy.MakeFilletAll(Pore_0_1, 0.1)
|
||||||
|
Vertex_1 = geompy.MakeVertex(2, 2, 2)
|
||||||
|
Vertex_2 = geompy.MakeVertexWithRef(Vertex_1, 0, 0, 1)
|
||||||
|
Vector_1 = geompy.MakeVector(Vertex_1, Vertex_2)
|
||||||
|
Plane_1 = geompy.MakePlane(Vertex_1, Vector_1, 5)
|
||||||
|
Common_1 = geompy.MakeCommonList([Pore_0_1, Plane_1], True)
|
||||||
|
[Face_3,Face_4,Face_5,Face_6] = geompy.ExtractShapes(Common_1, geompy.ShapeType["FACE"], True)
|
||||||
|
[Face_7,Face_8,geomObj_94,Face_2] = geompy.ExtractShapes(Common_1, geompy.ShapeType["FACE"], True)
|
||||||
|
[Face_1,Face_2,Face_3,Face_4] = geompy.ExtractShapes(Common_1, geompy.ShapeType["SHAPE"], True)
|
||||||
|
Translation_1 = geompy.MakeTranslation(Plane_1, 0, 0, -2)
|
||||||
|
Common_2 = geompy.MakeCommonList([Pore_0_1, Translation_1], True)
|
||||||
|
[Face_5,Face_6,Face_7,Face_8] = geompy.ExtractShapes(Common_2, geompy.ShapeType["SHAPE"], True)
|
||||||
|
geomObj_95 = geompy.GetInPlace(Pore_0_1, Common_1, True)
|
||||||
|
[geomObj_96,geomObj_97,geomObj_98,geomObj_99,geomObj_100,geomObj_101,geomObj_102,geomObj_103,geomObj_104,geomObj_105,geomObj_106,geomObj_107,geomObj_108,geomObj_109,geomObj_110,geomObj_111] = geompy.SubShapeAll(geomObj_95, geompy.ShapeType["VERTEX"])
|
||||||
|
[geomObj_112,geomObj_113,geomObj_114,geomObj_115] = geompy.SubShapeAll(geomObj_95, geompy.ShapeType["FACE"])
|
||||||
|
geomObj_116 = geompy.GetInPlace(Pore_0_1, Face_1, True)
|
||||||
|
[geomObj_117] = geompy.SubShapeAll(geomObj_116, geompy.ShapeType["FACE"])
|
||||||
|
geomObj_118 = geompy.GetInPlace(Pore_0_1, Face_1, True)
|
||||||
|
[geomObj_119] = geompy.SubShapeAll(geomObj_118, geompy.ShapeType["FACE"])
|
||||||
|
geomObj_120 = geompy.GetInPlace(Pore_0_1, Common_1, True)
|
||||||
|
[geomObj_121,geomObj_122,geomObj_123,geomObj_124] = geompy.SubShapeAll(geomObj_120, geompy.ShapeType["FACE"])
|
||||||
|
[geomObj_125,geomObj_126,geomObj_127,geomObj_128] = geompy.SubShapeAll(geomObj_120, geompy.ShapeType["FACE"])
|
||||||
|
Group_1 = geompy.CreateGroup(Pore_0_1, geompy.ShapeType["FACE"])
|
||||||
|
geompy.UnionIDs(Group_1, [28, 165, 72, 90])
|
||||||
|
geomObj_129 = geompy.GetInPlace(Pore_0_1, Common_2, True)
|
||||||
|
[geomObj_130,geomObj_131,geomObj_132,geomObj_133,geomObj_134,geomObj_135,geomObj_136,geomObj_137,geomObj_138,geomObj_139,geomObj_140,geomObj_141,geomObj_142,geomObj_143,geomObj_144,geomObj_145] = geompy.SubShapeAll(geomObj_129, geompy.ShapeType["VERTEX"])
|
||||||
|
[geomObj_146,geomObj_147,geomObj_148,geomObj_149] = geompy.SubShapeAll(geomObj_129, geompy.ShapeType["FACE"])
|
||||||
|
[geomObj_150,geomObj_151,geomObj_152,geomObj_153] = geompy.SubShapeAll(geomObj_129, geompy.ShapeType["FACE"])
|
||||||
|
Group_2 = geompy.CreateGroup(Pore_0_1, geompy.ShapeType["FACE"])
|
||||||
|
geompy.UnionIDs(Group_2, [102, 117, 51, 159])
|
||||||
|
Group_3 = geompy.CreateGroup(Pore_0_1, geompy.ShapeType["FACE"])
|
||||||
|
geompy.UnionIDs(Group_3, [3, 17, 28, 33, 42, 51, 56, 63, 72, 77, 90, 95, 102, 107, 117, 120, 129, 136, 142, 149, 156, 159, 162, 165])
|
||||||
|
Cut_1 = geompy.CutListOfGroups([Group_3], [Group_1, Group_2])
|
||||||
|
geompy.addToStudy( Pore_0_1, 'Pore 0.1' )
|
||||||
|
geompy.addToStudy( Pore_0_15, 'Pore 0.15' )
|
||||||
|
geompy.addToStudy( Pore_0_2, 'Pore 0.2' )
|
||||||
|
geompy.addToStudy( Fillet_1, 'Fillet_1' )
|
||||||
|
geompy.addToStudy( Vertex_1, 'Vertex_1' )
|
||||||
|
geompy.addToStudy( Vertex_2, 'Vertex_2' )
|
||||||
|
geompy.addToStudy( Vector_1, 'Vector_1' )
|
||||||
|
geompy.addToStudy( Plane_1, 'Plane_1' )
|
||||||
|
geompy.addToStudy( Translation_1, 'Translation_1' )
|
||||||
|
geompy.addToStudyInFather( Common_2, Face_8, 'Face_8' )
|
||||||
|
geompy.addToStudyInFather( Common_2, Face_7, 'Face_7' )
|
||||||
|
geompy.addToStudyInFather( Common_1, Face_2, 'Face_2' )
|
||||||
|
geompy.addToStudy( Common_2, 'Common_2' )
|
||||||
|
geompy.addToStudyInFather( Common_1, Face_1, 'Face_1' )
|
||||||
|
geompy.addToStudy( Common_1, 'Common_1' )
|
||||||
|
geompy.addToStudyInFather( Common_1, Face_3, 'Face_3' )
|
||||||
|
geompy.addToStudyInFather( Common_1, Face_4, 'Face_4' )
|
||||||
|
geompy.addToStudyInFather( Common_2, Face_5, 'Face_5' )
|
||||||
|
geompy.addToStudyInFather( Common_2, Face_6, 'Face_6' )
|
||||||
|
geompy.addToStudyInFather( Pore_0_1, Group_1, 'Group_1' )
|
||||||
|
geompy.addToStudyInFather( Pore_0_1, Group_2, 'Group_2' )
|
||||||
|
geompy.addToStudyInFather( Pore_0_1, Group_3, 'Group_3' )
|
||||||
|
geompy.addToStudyInFather( Pore_0_1, Cut_1, 'Cut_1' )
|
||||||
|
|
||||||
|
###
|
||||||
|
### SMESH component
|
||||||
|
###
|
||||||
|
|
||||||
|
import SMESH, SALOMEDS
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
|
||||||
|
smesh = smeshBuilder.New()
|
||||||
|
#smesh.SetEnablePublish( False ) # Set to False to avoid publish in study if not needed or in some particular situations:
|
||||||
|
# multiples meshes built in parallel, complex and numerous mesh edition (performance)
|
||||||
|
|
||||||
|
Pore_0_1_1 = smesh.Mesh(Pore_0_1)
|
||||||
|
NETGEN_2D3D_1 = Pore_0_1_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
|
||||||
|
NETGEN_Parameters = NETGEN_2D3D_1.Parameters()
|
||||||
|
NETGEN_Parameters.SetSecondOrder( 0 )
|
||||||
|
NETGEN_Parameters.SetOptimize( 1 )
|
||||||
|
NETGEN_Parameters.SetChordalError( -1 )
|
||||||
|
NETGEN_Parameters.SetChordalErrorEnabled( 0 )
|
||||||
|
NETGEN_Parameters.SetUseSurfaceCurvature( 1 )
|
||||||
|
NETGEN_Parameters.SetFuseEdges( 1 )
|
||||||
|
NETGEN_Parameters.SetCheckChartBoundary( 0 )
|
||||||
|
NETGEN_Parameters.SetMinSize( 0.01 )
|
||||||
|
NETGEN_Parameters.SetMaxSize( 0.05 )
|
||||||
|
NETGEN_Parameters.SetFineness( 5 )
|
||||||
|
NETGEN_Parameters.SetGrowthRate( 0.1 )
|
||||||
|
NETGEN_Parameters.SetNbSegPerEdge( 5 )
|
||||||
|
NETGEN_Parameters.SetNbSegPerRadius( 10 )
|
||||||
|
NETGEN_Parameters.SetQuadAllowed( 1 )
|
||||||
|
isDone = Pore_0_1_1.Compute()
|
||||||
|
Pore_0_15_1 = smesh.Mesh(Pore_0_15)
|
||||||
|
NETGEN_2D3D_1_1 = Pore_0_15_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
|
||||||
|
NETGEN_Parameters_1 = NETGEN_2D3D_1_1.Parameters()
|
||||||
|
NETGEN_Parameters_1.SetSecondOrder( 0 )
|
||||||
|
NETGEN_Parameters_1.SetOptimize( 1 )
|
||||||
|
NETGEN_Parameters_1.SetChordalError( -1 )
|
||||||
|
NETGEN_Parameters_1.SetChordalErrorEnabled( 0 )
|
||||||
|
NETGEN_Parameters_1.SetUseSurfaceCurvature( 1 )
|
||||||
|
NETGEN_Parameters_1.SetFuseEdges( 1 )
|
||||||
|
NETGEN_Parameters_1.SetCheckChartBoundary( 0 )
|
||||||
|
NETGEN_Parameters_1.SetMinSize( 0.01 )
|
||||||
|
NETGEN_Parameters_1.SetMaxSize( 0.05 )
|
||||||
|
NETGEN_Parameters_1.SetFineness( 5 )
|
||||||
|
NETGEN_Parameters_1.SetGrowthRate( 0.1 )
|
||||||
|
NETGEN_Parameters_1.SetNbSegPerEdge( 5 )
|
||||||
|
NETGEN_Parameters_1.SetNbSegPerRadius( 10 )
|
||||||
|
NETGEN_Parameters_1.SetQuadAllowed( 1 )
|
||||||
|
isDone = Pore_0_15_1.Compute()
|
||||||
|
Pore_0_2_1 = smesh.Mesh(Pore_0_2)
|
||||||
|
NETGEN_2D3D_1_2 = Pore_0_2_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
|
||||||
|
NETGEN_Parameters_2 = NETGEN_2D3D_1_2.Parameters()
|
||||||
|
NETGEN_Parameters_2.SetSecondOrder( 0 )
|
||||||
|
NETGEN_Parameters_2.SetOptimize( 1 )
|
||||||
|
NETGEN_Parameters_2.SetChordalError( -1 )
|
||||||
|
NETGEN_Parameters_2.SetChordalErrorEnabled( 0 )
|
||||||
|
NETGEN_Parameters_2.SetUseSurfaceCurvature( 1 )
|
||||||
|
NETGEN_Parameters_2.SetFuseEdges( 1 )
|
||||||
|
NETGEN_Parameters_2.SetCheckChartBoundary( 0 )
|
||||||
|
NETGEN_Parameters_2.SetMinSize( 0.01 )
|
||||||
|
NETGEN_Parameters_2.SetMaxSize( 0.05 )
|
||||||
|
NETGEN_Parameters_2.SetFineness( 5 )
|
||||||
|
NETGEN_Parameters_2.SetGrowthRate( 0.1 )
|
||||||
|
NETGEN_Parameters_2.SetNbSegPerEdge( 5 )
|
||||||
|
NETGEN_Parameters_2.SetNbSegPerRadius( 10 )
|
||||||
|
NETGEN_Parameters_2.SetQuadAllowed( 1 )
|
||||||
|
isDone = Pore_0_2_1.Compute()
|
||||||
|
Mesh_1 = smesh.Mesh(Fillet_1)
|
||||||
|
status = Mesh_1.AddHypothesis(NETGEN_Parameters_2)
|
||||||
|
NETGEN_2D3D_1_3 = Mesh_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
|
||||||
|
Viscous_Layers_1 = NETGEN_2D3D_1_3.ViscousLayers(0.05,1,1,None,None,smeshBuilder.SURF_OFFSET_SMOOTH)
|
||||||
|
NETGEN_Parameters_2.SetMaxSize( 0.1 )
|
||||||
|
NETGEN_Parameters_2.SetFineness( 3 )
|
||||||
|
NETGEN_Parameters_2.SetQuadAllowed( 0 )
|
||||||
|
Viscous_Layers_1.SetTotalThickness( 0.01 )
|
||||||
|
Viscous_Layers_1.SetNumberLayers( 1 )
|
||||||
|
Viscous_Layers_1.SetStretchFactor( 1 )
|
||||||
|
Viscous_Layers_1.SetMethod( smeshBuilder.FACE_OFFSET )
|
||||||
|
Viscous_Layers_1.SetFaces( [], 1 )
|
||||||
|
isDone = Mesh_1.Compute()
|
||||||
|
Mesh_2 = smesh.Mesh(Pore_0_1)
|
||||||
|
status = Mesh_2.AddHypothesis(NETGEN_Parameters_2)
|
||||||
|
status = Mesh_2.AddHypothesis(Viscous_Layers_1)
|
||||||
|
NETGEN_2D3D_1_4 = Mesh_2.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
|
||||||
|
Viscous_Layers_1.SetTotalThickness( 0.025 )
|
||||||
|
Viscous_Layers_1.SetNumberLayers( 5 )
|
||||||
|
Viscous_Layers_1.SetStretchFactor( 1.1 )
|
||||||
|
Viscous_Layers_1.SetMethod( smeshBuilder.NODE_OFFSET )
|
||||||
|
Viscous_Layers_1.SetFaces( [], 1 )
|
||||||
|
isDone = Mesh_2.Compute()
|
||||||
|
Group_1_1 = Mesh_2.GroupOnGeom(Group_1,'Group_1',SMESH.FACE)
|
||||||
|
[ Group_1_1 ] = Mesh_2.GetGroups()
|
||||||
|
Group_2_1 = Mesh_2.GroupOnGeom(Group_2,'Group_2',SMESH.FACE)
|
||||||
|
[ Group_1_1, Group_2_1 ] = Mesh_2.GetGroups()
|
||||||
|
Group_3_1 = Mesh_2.GroupOnGeom(Cut_1,'Group_3',SMESH.FACE)
|
||||||
|
[ Group_1_1, Group_2_1, Group_3_1 ] = Mesh_2.GetGroups()
|
||||||
|
|
||||||
|
|
||||||
|
## Set names of Mesh objects
|
||||||
|
smesh.SetName(NETGEN_2D3D_1.GetAlgorithm(), 'NETGEN_2D3D_1')
|
||||||
|
smesh.SetName(NETGEN_Parameters_1, 'NETGEN_Parameters')
|
||||||
|
smesh.SetName(NETGEN_Parameters_2, 'NETGEN_Parameters')
|
||||||
|
smesh.SetName(NETGEN_Parameters, 'NETGEN_Parameters')
|
||||||
|
smesh.SetName(Viscous_Layers_1, 'Viscous Layers_1')
|
||||||
|
smesh.SetName(Pore_0_1_1.GetMesh(), 'Pore 0.1')
|
||||||
|
smesh.SetName(Pore_0_2_1.GetMesh(), 'Pore 0.2')
|
||||||
|
smesh.SetName(Pore_0_15_1.GetMesh(), 'Pore 0.15')
|
||||||
|
smesh.SetName(Mesh_2.GetMesh(), 'Mesh_2')
|
||||||
|
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
|
||||||
|
smesh.SetName(Group_1_1, 'Group_1')
|
||||||
|
smesh.SetName(Group_2_1, 'Group_2')
|
||||||
|
smesh.SetName(Group_3_1, 'Group_3')
|
||||||
|
|
||||||
|
|
||||||
|
if salome.sg.hasDesktop():
|
||||||
|
salome.sg.updateObjBrowser()
|
Loading…
Reference in New Issue
Block a user