Mod: viscous layer + tetra

This commit is contained in:
L-Nafaryus 2021-02-15 15:45:53 +05:00
parent 5e5f354fa4
commit 8a2a28d21f
5 changed files with 43 additions and 12 deletions

15
src/cube/main.py → src/cube/__main__.py Executable file → Normal file
View File

@ -1,16 +1,17 @@
import os, sys
print(os.getcwd())
#sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import salome import salome
salome.salome_init() salome.salome_init()
import os, sys import geometry, mesh
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import _geometry, _mesh
alpha = [ 0.1, 0.15, 0.2 ] alpha = [ 0.1, 0.15, 0.2 ]
pore = [] pore = []
for coef in alpha: for coef in alpha:
[geompy, Pore, Segment1_4, Segment1_8] = _geometry.create(coef) [Pore, Segment1_4, Segment1_8] = geometry.create(coef)
geompy.addToStudy(Pore, 'Pore {}'.format(coef)) geompy.addToStudy(Pore, 'Pore {}'.format(coef))
pore.append(Pore) pore.append(Pore)
@ -21,8 +22,8 @@ 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()))
[smesh, mesh] = _mesh.create(Pore) mesh_ = mesh.create(Pore)
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)

View File

@ -17,13 +17,14 @@ def create(geomObj):
param.SetCheckChartBoundary( 0 ) param.SetCheckChartBoundary( 0 )
param.SetMinSize( 0.01 ) param.SetMinSize( 0.01 )
param.SetMaxSize( 0.05 ) param.SetMaxSize( 0.05 )
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.01, 3, 1.5, [],
1, smeshBuilder.SURF_OFFSET_SMOOTH)
return smesh, mesh return mesh

View File

@ -49,4 +49,4 @@ 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 geompy, Pore, Segment1_4, Segment1_8 return Pore, Segment1_4, Segment1_8

29
src/cube/mesh.py Normal file
View File

@ -0,0 +1,29 @@
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( 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)
return mesh

BIN
worksheet/cube-150221.hdf Normal file

Binary file not shown.