Initial commit

This commit is contained in:
L-Nafaryus 2021-02-11 13:36:00 +05:00
commit f1312919e2
3 changed files with 201 additions and 0 deletions

95
anisotrope_cube.py Normal file
View File

@ -0,0 +1,95 @@
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New()
import math
axes = [
geompy.MakeVectorDXDYDZ(1, 0, 0),
geompy.MakeVectorDXDYDZ(0, 1, 0),
geompy.MakeVectorDXDYDZ(0, 0, 1)
]
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.MakeTranslation(box, 2, 0, 0)
vtx = [
geompy.MakeVertex(2, 0, 0),
geompy.MakeVertex(2, 2, 0),
geompy.MakeVertex(2, 2, 2)
]
line = geompy.MakeLineTwoPnt(vtx[1], vtx[2])
#alpha = [ x * 0.01 for x in range(1, 28 + 1) ]
alpha=[0.1]
#for coef in alpha:
sphere = geompy.MakeSpherePntR(vtx[0], 1 / (1 - alpha[0]))
sphere = geompy.MakeMultiTranslation1D(sphere, axes[1], 2, 3)
cut = geompy.MakeCutList(box, [sphere], True)
sphere2 = geompy.MakeTranslation(sphere, 0, 0, 2)
cut2 = geompy.MakeCutList(cut, [sphere2], True)
sphere3 = geompy.MakeRotation(sphere, line, 90 * math.pi / 180.0)
cut3 = geompy.MakeCutList(cut2, [sphere3], True)
sphere4 = geompy.MakeTranslation(sphere3, 0, 0, 2)
Pore = geompy.MakeCutList(cut3, [sphere4], True)
geompy.addToStudy(Pore, 'Pore')
box2 = geompy.MakeBoxDXDYDZ(2, 2, 2)
box2 = geompy.MakeTranslation(box2, 2, 0, 0)
Segment1_4 = geompy.MakeCommonList([Pore, box2], True)
geompy.addToStudy(Segment1_4, 'Segment1_4')
vec1 = geompy.MakeVector(geompy.MakeVertex(3, 1, 0), geompy.MakeVertex(3, 1, 1))
box2 = geompy.MakeRotation(box2, vec1, 45*math.pi/180.0)
vec2 = geompy.MakeVector(geompy.MakeVertex(3, 1, 0), geompy.MakeVertex(2, 0, 0))
box2 = geompy.MakeTranslationVectorDistance(box2, vec2, 1)
box2 = geompy.MakeTranslation(box2, -0.5, 0.5, 0)
Segment1_8 = geompy.MakeCommonList([Segment1_4, box2], True)
geompy.addToStudy(Segment1_8, 'Segment1_8')
###
SegmentMesh = smesh.Mesh(Segment1_8)
netgen = SegmentMesh.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.05 )
param.SetMaxSize( 0.1 )
param.SetFineness( 5 )
param.SetGrowthRate( 0.1 )
param.SetNbSegPerEdge( 5 )
param.SetNbSegPerRadius( 10 )
param.SetQuadAllowed( 1 )
vlayer = netgen.ViscousLayers(0.05, 3, 1.5, [15, 29, 54], 1, smeshBuilder.SURF_OFFSET_SMOOTH)
isDone = SegmentMesh.Compute()
if not isDone:
print("Mesh is not computed")
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser()

53
anisotrope_cube_bc.py Normal file
View File

@ -0,0 +1,53 @@
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New()
import math
axes = [
geompy.MakeVectorDXDYDZ(1, 0, 0),
geompy.MakeVectorDXDYDZ(0, 1, 0),
geompy.MakeVectorDXDYDZ(0, 0, 1)
]
vtx = [
geompy.MakeVertex(1 / math.sqrt(2), -1 / math.sqrt(2), 0.5),
geompy.MakeVertex(-1 / math.sqrt(2), 1 / math.sqrt(2), -0.5),
geompy.MakeVertex(-1, -1, -0.5),
geompy.MakeVertex(-0.5, -0.5, 0)
]
box = geompy.MakeBoxTwoPnt(vtx[0], vtx[1])
box = geompy.MakeRotation(box, axes[2], 45 * math.pi / 180.0)
#alpha = [ x * 0.01 for x in range(1, 28 + 1) ]
alpha=[0.15]
#for coef in alpha:
spheres = geompy.MakeSpherePntR(vtx[2], math.sqrt(3) / 4 / (1 - alpha[0]))
spheres = geompy.MakeMultiTranslation2D(spheres, axes[0], 1, 3, axes[1], 1, 3)
spheres = geompy.MakeMultiTranslation1D(spheres, axes[2], 1, 2)
spheres2 = geompy.MakeSpherePntR(vtx[3], math.sqrt(3) / 4 / (1 - alpha[0]))
spheres2 = geompy.MakeMultiTranslation2D(spheres2, axes[0], 1, 3, axes[1], 1, 3)
Pore = geompy.MakeCutList(box, [spheres, spheres2], False)
geompy.addToStudy(Pore, 'Pore')
box2 = geompy.MakeBoxTwoPnt(vtx[0], geompy.MakeVertex(0, 0, 0))
box2 = geompy.MakeRotation(box2, axes[2], 45 * math.pi / 180.0)
Segment1_8 = geompy.MakeCommonList([Pore, box2], True)
geompy.addToStudy(Segment1_8, 'Segment1_8')
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser()

53
anisotrope_cube_fc.py Normal file
View File

@ -0,0 +1,53 @@
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New()
import math
axes = [
geompy.MakeVectorDXDYDZ(1, 0, 0),
geompy.MakeVectorDXDYDZ(0, 1, 0),
geompy.MakeVectorDXDYDZ(0, 0, 1),
geompy.MakeVectorDXDYDZ(1, 1, 0),
geompy.MakeVectorDXDYDZ(1, -1, 0)
]
vtx = [
geompy.MakeVertex(0, 0, -0.5),
geompy.MakeVertex(1 / math.sqrt(2), 1 / math.sqrt(2), 0.5),
geompy.MakeVertex(0.5, 0, 0),
geompy.MakeVertex(0.5 / math.sqrt(2), 0.5 / math.sqrt(2), 0.5)
]
box = geompy.MakeBoxTwoPnt(vtx[0], vtx[1])
box = geompy.MakeRotation(box, axes[2], -45 * math.pi / 180.0)
#alpha = [ x * 0.01 for x in range(1, 28 + 1) ]
alpha=[0.08]
#for coef in alpha:
spheres = geompy.MakeSpherePntR(vtx[0], math.sqrt(2) / 4 / (1 - alpha[0]))
spheres = geompy.MakeMultiTranslation2D(spheres, axes[3], 1 / math.sqrt(2), 2, axes[4], 1 / math.sqrt(2), 2)
spheres = geompy.MakeMultiTranslation1D(spheres, axes[2], 1, 2)
sphere2 = geompy.MakeSpherePntR(vtx[2], math.sqrt(2) / 4 / (1 - alpha[0]))
Pore = geompy.MakeCutList(box, [spheres, sphere2], True)
geompy.addToStudy(Pore, 'Pore')
box2 = geompy.MakeBoxTwoPnt(geompy.MakeVertex(0, 0, 0), vtx[3])
box2 = geompy.MakeRotation(box2, axes[2], -45 * math.pi / 180.0)
Segment1_8 = geompy.MakeCommonList([Pore, box2], True)
geompy.addToStudy(Segment1_8, 'Segment1_8')
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser()