diff --git a/src/cube/main.py b/src/cube/__main__.py old mode 100755 new mode 100644 similarity index 72% rename from src/cube/main.py rename to src/cube/__main__.py index f09eb8a..d87aae3 --- a/src/cube/main.py +++ b/src/cube/__main__.py @@ -1,16 +1,17 @@ +import os, sys +print(os.getcwd()) +#sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + import salome salome.salome_init() -import os, sys -sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) - -import _geometry, _mesh +import geometry, mesh alpha = [ 0.1, 0.15, 0.2 ] pore = [] 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)) pore.append(Pore) @@ -21,8 +22,8 @@ for coef in alpha: for Pore in pore: print("Building mesh for {}".format(Pore.GetName())) - [smesh, mesh] = _mesh.create(Pore) - isDone = mesh.Compute() + mesh_ = mesh.create(Pore) + isDone = mesh_.Compute() status = "Succesfully" if isDone else "Mesh is not computed" print(status) diff --git a/src/cube/_mesh.py b/src/cube/_mesh.py index 220ecdf..48d4ba0 100644 --- a/src/cube/_mesh.py +++ b/src/cube/_mesh.py @@ -17,13 +17,14 @@ def create(geomObj): param.SetCheckChartBoundary( 0 ) param.SetMinSize( 0.01 ) param.SetMaxSize( 0.05 ) - param.SetFineness( 5 ) + param.SetFineness( 3 ) param.SetGrowthRate( 0.1 ) param.SetNbSegPerEdge( 5 ) 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 diff --git a/src/cube/_geometry.py b/src/cube/geometry.py similarity index 97% rename from src/cube/_geometry.py rename to src/cube/geometry.py index 7d1693c..32bbf3a 100644 --- a/src/cube/_geometry.py +++ b/src/cube/geometry.py @@ -49,4 +49,4 @@ def create(alpha): box2 = geompy.MakeTranslation(box2, -0.5, 0.5, 0) Segment1_8 = geompy.MakeCommonList([Segment1_4, box2], True) - return geompy, Pore, Segment1_4, Segment1_8 + return Pore, Segment1_4, Segment1_8 diff --git a/src/cube/mesh.py b/src/cube/mesh.py new file mode 100644 index 0000000..2c35af7 --- /dev/null +++ b/src/cube/mesh.py @@ -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 + diff --git a/worksheet/cube-150221.hdf b/worksheet/cube-150221.hdf new file mode 100644 index 0000000..3e98b59 Binary files /dev/null and b/worksheet/cube-150221.hdf differ