#!/usr/bin/env python
###
### This file is generated automatically by SALOME v9.3.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/hgasca/hdd/Prodisys/2020/004-20-PY-A955_MODELAMIENTO_DP_SARTA_INY/FVR_OXY/Calculos')
###
### GEOM component
###
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
L=0.2
Ll=0.025
Dc=0.019
Di=0.005
l=0.05
Du=0.005
Do=0.008
Ls=0.03
Li=0.05
L2=0.005
e=0.0015
Gap1=0.0005
Gap2=0.003
Gap3=0.001
Gap4=0.005
Gap5=0.003
Gap6=0.003
Lmalla=(L+L2+Ls)*1.1
Dmalla=3*Dc/2*1.05
geompy = geomBuilder.New()
###CICLON
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Cylinder_1 = geompy.MakeCylinderRH(Dc/2, Ll-2*Gap3)
Cone_1 = geompy.MakeConeR1R2H(Dc/2, Du/2, L-Ll)
Rotation_1 = geompy.MakeRotation(Cone_1, OX, 180*math.pi/180.0)
Cylinder_4 = geompy.MakeCylinderRH(Di/2, Dc/2*1.1)
Rotation_2 = geompy.MakeRotation(Cylinder_4, OY, 90*math.pi/180.0)
Translation_1 = geompy.MakeTranslation(Rotation_2, 0, Dc/2-Di/2*1.1, Ll-Gap3-Di)
Cylinder_5 = geompy.MakeCylinderRH(3*Dc/4, Ls+L2+2*Gap3)
Translation_2 = geompy.MakeTranslation(Cylinder_5, 0, 0, Ll-2*Gap3)
Fuse_1 = geompy.MakeFuseList([Cylinder_1, Rotation_1, Translation_1, Translation_2], True, True)
Cylinder_2 = geompy.MakeCylinderRH(Do/2-2*Gap1, Ls/2)
Translation_3 = geompy.MakeTranslation(Cylinder_2, 0, 0, Ll+L2+Ls/2+Gap4)
Cone_2 = geompy.MakeConeR1R2H(Do/2-2*Gap1, Do/16, Ls/2)
Rotation_3 = geompy.MakeRotation(Cone_2, OX, 180*math.pi/180.0)
Translation_4 = geompy.MakeTranslation(Rotation_3, 0, 0, Ll+L2+Ls/2+Gap4)
Fuse_2 = geompy.MakeFuseList([Translation_3, Translation_4], True, True)
Cyclone = geompy.MakeCutList(Fuse_1, [Fuse_2], True)
inlet = geompy.CreateGroup(Cyclone, geompy.ShapeType["FACE"])
geompy.UnionIDs(inlet, [52])
outlet = geompy.CreateGroup(Cyclone, geompy.ShapeType["FACE"])
geompy.UnionIDs(outlet, [10])
outlet2 = geompy.CreateGroup(Cyclone, geompy.ShapeType["FACE"])
geompy.UnionIDs(outlet2, [50])
wall = geompy.CreateGroup(Cyclone, geompy.ShapeType["FACE"])
geompy.UnionIDs(wall, [15, 20, 25, 3, 33, 38, 43, 48])
## Porous 1 - External diameter.
Cylinder_6 = geompy.MakeCylinderRH(Dc/2, L)
Porous_1 = geompy.MakeCutList(Translation_2, [Cylinder_6], True)
Porous1 = geompy.CreateGroup(Porous_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(Porous1, [3, 10, 15, 20])
## Porous 2 - Superior cone.
tg_theta = 2*(Do/2-2*Gap1-Do/16)/Ls
major_rad = L*tg_theta+Do/16
Cone_3 = geompy.MakeConeR1R2H(major_rad, Do/16, L)
Rotation_4 = geompy.MakeRotation(Cone_3, OX, 180*math.pi/180.0)
Translation_5 = geompy.MakeTranslation(Rotation_4, 0, 0, L+Ll-Gap3+L2)
Porous_2 = geompy.MakeCommonList([Cyclone, Translation_5], True)
Porous2 = geompy.CreateGroup(Porous_2, geompy.ShapeType["FACE"])
geompy.UnionIDs(Porous2, [3, 10, 15, 20, 22, 27])
##### OVERSET
Cylinder_10 = geompy.MakeCylinderRH(Do/2+Gap2, l+Gap6-Gap3)
Cylinder_11 = geompy.MakeCylinderRH(Dc/2+Gap5, L2+Gap3+Gap4)
Translation_10 = geompy.MakeTranslation(Cylinder_11, 0, 0, l+Gap6-Gap3)
Fuse_3 = geompy.MakeFuseList([Translation_10, Cylinder_10], True, True)
Cylinder_12 = geompy.MakeCylinderRH(Do/2-Gap1, Gap4+L2+l)
Translation_11 = geompy.MakeTranslation(Cylinder_12, 0, 0, Gap6)
Cut_10 = geompy.MakeCutList(Fuse_3, [Translation_11], True)
Cylinder_13 = geompy.MakeCylinderRH(Do/2+e, l)
Cylinder_14 = geompy.MakeCylinderRH(Dc/2, L2)
Translation_12 = geompy.MakeTranslation(Cylinder_14, 0, 0, l)
Fuse_4 = geompy.MakeFuseList([Translation_12, Cylinder_13], True, True)
Cylinder_15 = geompy.MakeCylinderRH(Do/2, L2+l)
Cut_11 = geompy.MakeCutList(Fuse_4, [Cylinder_15], True)
Translation_13 = geompy.MakeTranslation(Cut_11, 0, 0, Gap6)
Cut_12 = geompy.MakeCutList(Cut_10, [Translation_13], True)
Translation_14 = geompy.MakeTranslation(Cut_12, 0, 0, Ll-l-Gap6)
Ldesp= (Do/2-Gap1-Do/16)/tg_theta-Gap3
Translation_15 = geompy.MakeTranslation(Translation_5, 0, 0, -Ldesp)
Overset = geompy.MakeCutList(Translation_14, [Translation_15], True)
oversetPatch = geompy.CreateGroup(Overset, geompy.ShapeType["FACE"])
geompy.UnionIDs(oversetPatch, [10, 20, 30, 37, 3, 15, 25, 35])
wall_1 = geompy.CreateGroup(Overset, geompy.ShapeType["FACE"])
geompy.UnionIDs(wall_1, [40, 47, 52, 57, 62, 67])
## Porous 3
Translation_16 = geompy.MakeTranslation(Cylinder_6, 0, 0, -L/2)
Porous_3 = geompy.MakeCutList(Overset, [Translation_16], True)
Porous3 = geompy.CreateGroup(Porous_3, geompy.ShapeType["FACE"])
geompy.UnionIDs(Porous3, [3, 10, 15, 20, 25, 30])
## SHOW
Box_1 = geompy.MakeBoxDXDYDZ(0.05, 0.05, 1)
Translation_20 = geompy.MakeTranslation(Box_1, -0.05, 0, -0.5)
Corte_1 = geompy.MakeCutList(Cyclone, [Translation_20], True)
Corte_2 = geompy.MakeCutList(Overset, [Translation_20], True)
Corte_3 = geompy.MakeCutList(Porous_1, [Translation_20], True)
Corte_4 = geompy.MakeCutList(Porous_2, [Translation_20], True)
## BACKGROUND
Divided_Disk_1 = geompy.MakeDividedDisk(Dmalla/2, 1, GEOM.HEXAGON)
Translation_30 = geompy.MakeTranslation(Divided_Disk_1, 0, 0, (Ll-L)*1.05)
## Cilindro = geompy.MakeTranslation(Cylinder_30, 0, 0, -L*1.05+l+L2+Ls)
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
geompy.addToStudy( Cone_1, 'Cone_1' )
geompy.addToStudy( Rotation_1, 'Rotation_1' )
##geompy.addToStudy( Cylinder_3, 'Cylinder_3' )
geompy.addToStudy( Cylinder_4, 'Cylinder_4' )
geompy.addToStudy( Rotation_2, 'Rotation_2' )
geompy.addToStudy( Translation_1, 'Translation_1' )
geompy.addToStudy( Cylinder_5, 'Cylinder_5' )
geompy.addToStudy( Translation_2, 'Translation_2' )
geompy.addToStudy( Fuse_1, 'Fuse_1' )
geompy.addToStudy( Cylinder_2, 'Cylinder_2' )
geompy.addToStudy( Translation_3, 'Translation_3' )
geompy.addToStudy( Cone_2, 'Cone_2' )
geompy.addToStudy( Rotation_3, 'Rotation_3' )
geompy.addToStudy( Translation_4, 'Translation_4' )
geompy.addToStudy( Fuse_2, 'Fuse_2' )
geompy.addToStudy( Cylinder_10, 'Cylinder_10' )
geompy.addToStudy( Cylinder_11, 'Cylinder_11' )
geompy.addToStudy( Translation_10, 'Translation_10' )
geompy.addToStudy( Cylinder_12, 'Cylinder_12' )
geompy.addToStudy( Translation_11, 'Translation_11' )
geompy.addToStudy( Cut_10, 'Cut_10' )
geompy.addToStudy( Cylinder_13, 'Cylinder_13' )
geompy.addToStudy( Cylinder_14, 'Cylinder_14' )
geompy.addToStudy( Translation_12, 'Translation_12' )
geompy.addToStudy( Fuse_4, 'Fuse_4' )
geompy.addToStudy( Cylinder_15, 'Cylinder_15' )
geompy.addToStudy( Cut_11, 'Cut_11' )
geompy.addToStudy( Translation_13, 'Translation_13' )
geompy.addToStudy( Cut_12, 'Cut_12' )
geompy.addToStudy( Cylinder_6, 'Cylinder_6' )
geompy.addToStudy( Cone_3, 'Cone_3' )
geompy.addToStudy( Rotation_3, 'Rotation_3' )
geompy.addToStudy( Rotation_4, 'Rotation_4' )
geompy.addToStudy( Translation_5, 'Translation_5' )
geompy.addToStudy( Translation_14, 'Translation_14' )
geompy.addToStudy( Translation_15, 'Translation_15' )
geompy.addToStudy( Translation_16, 'Translation_16' )
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( Translation_20, 'Translation_20' )
geompy.addToStudy( Cyclone, 'Cyclone' )
geompy.addToStudy( Overset, 'Overset' )
geompy.addToStudy( Porous_1, 'Porous_1' )
geompy.addToStudy( Porous_2, 'Porous_2' )
geompy.addToStudy( Porous_3, 'Porous_3' )
geompy.addToStudy( Corte_1, 'Corte_1' )
geompy.addToStudy( Corte_2, 'Corte_2' )
geompy.addToStudy( Corte_3, 'Corte_3' )
geompy.addToStudy( Corte_4, 'Corte_4' )
geompy.addToStudy( Divided_Disk_1, 'Divided_Disk_1' )
geompy.addToStudy( Translation_30, 'Translation_30' )
geompy.addToStudy( Translation_30, 'Translation_30' )
geompy.addToStudyInFather( Cyclone, inlet, 'inlet' )
geompy.addToStudyInFather( Cyclone, outlet, 'outlet' )
geompy.addToStudyInFather( Cyclone, outlet2, 'outlet2' )
geompy.addToStudyInFather( Cyclone, wall, 'wall' )
geompy.addToStudyInFather( Overset, oversetPatch, 'oversetPatch' )
geompy.addToStudyInFather( Overset, wall_1, 'wall' )
geompy.addToStudyInFather( Porous_1, Porous1, 'Porous1' )
geompy.addToStudyInFather( Porous_2, Porous2, 'Porous2' )
geompy.addToStudyInFather( Porous_3, Porous3, 'Porous3' )
###
### 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)
Mesh_1 = smesh.Mesh(Translation_30)
Regular_1D = Mesh_1.Segment()
Local_Length_1 = Regular_1D.LocalLength(Dc/38,None,1e-07)
Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
isDone = Mesh_1.Compute()
theNbElems = Mesh_1.Evaluate(Translation_30)
Mesh_1.ExtrusionSweepObjects( [ Mesh_1 ], [ Mesh_1 ], [ Mesh_1 ], [ 0, 0, Lmalla/300 ], 300, 1, [ ], 0, [ ], [ ], 0 )
inlet_1 = smesh.Mesh(inlet)
NETGEN_1D_2D = inlet_1.Triangle(algo=smeshBuilder.NETGEN_1D2D)
NETGEN_2D_Parameters_1 = NETGEN_1D_2D.Parameters()
NETGEN_2D_Parameters_1.SetMaxSize( 0.000707107 )
NETGEN_2D_Parameters_1.SetMinSize( 0.000307805 )
NETGEN_2D_Parameters_1.SetSecondOrder( 0 )
NETGEN_2D_Parameters_1.SetOptimize( 1 )
NETGEN_2D_Parameters_1.SetFineness( 2 )
NETGEN_2D_Parameters_1.SetChordalError( -1 )
NETGEN_2D_Parameters_1.SetChordalErrorEnabled( 0 )
NETGEN_2D_Parameters_1.SetUseSurfaceCurvature( 1 )
NETGEN_2D_Parameters_1.SetFuseEdges( 1 )
NETGEN_2D_Parameters_1.SetWorstElemMeasure( 21962 )
NETGEN_2D_Parameters_1.SetUseDelauney( 0 )
NETGEN_2D_Parameters_1.SetQuadAllowed( 0 )
NETGEN_2D_Parameters_1.SetCheckChartBoundary( 184 )
isDone = inlet_1.Compute()
outlet_1 = smesh.Mesh(outlet)
status = outlet_1.AddHypothesis(NETGEN_2D_Parameters_1)
NETGEN_1D_2D_1 = outlet_1.Triangle(algo=smeshBuilder.NETGEN_1D2D)
isDone = outlet_1.Compute()
outlet2_1 = smesh.Mesh(outlet2)
status = outlet2_1.AddHypothesis(NETGEN_2D_Parameters_1)
NETGEN_1D_2D_2 = outlet2_1.Triangle(algo=smeshBuilder.NETGEN_1D2D)
isDone = outlet2_1.Compute()
wall_2 = smesh.Mesh(wall)
status = wall_2.AddHypothesis(NETGEN_2D_Parameters_1)
NETGEN_1D_2D_3 = wall_2.Triangle(algo=smeshBuilder.NETGEN_1D2D)
isDone = wall_2.Compute()
oversetPatch_1 = smesh.Mesh(oversetPatch)
status = oversetPatch_1.AddHypothesis(NETGEN_2D_Parameters_1)
NETGEN_1D_2D_4 = oversetPatch_1.Triangle(algo=smeshBuilder.NETGEN_1D2D)
isDone = oversetPatch_1.Compute()
wall_over = smesh.Mesh(wall_1)
status = wall_over.AddHypothesis(NETGEN_2D_Parameters_1)
NETGEN_1D_2D_5 = wall_over.Triangle(algo=smeshBuilder.NETGEN_1D2D)
isDone = wall_over.Compute()
porous1 = smesh.Mesh(Porous1)
status = porous1.AddHypothesis(NETGEN_2D_Parameters_1)
NETGEN_1D_2D_6 = porous1.Triangle(algo=smeshBuilder.NETGEN_1D2D)
isDone = porous1.Compute()
porous2 = smesh.Mesh(Porous2)
status = porous2.AddHypothesis(NETGEN_2D_Parameters_1)
NETGEN_1D_2D_7 = porous2.Triangle(algo=smeshBuilder.NETGEN_1D2D)
isDone = porous2.Compute()
porous3 = smesh.Mesh(Porous3)
status = porous3.AddHypothesis(NETGEN_2D_Parameters_1)
NETGEN_1D_2D_8 = porous3.Triangle(algo=smeshBuilder.NETGEN_1D2D)
isDone = porous3.Compute()
## Set names of Mesh objects
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
smesh.SetName(Local_Length_1, 'Local Length_1')
smesh.SetName(Mesh_1.GetMesh(), 'backGroundMesh')
smesh.SetName(NETGEN_1D_2D.GetAlgorithm(), 'NETGEN 1D-2D')
smesh.SetName(NETGEN_2D_Parameters_1, 'NETGEN 2D Parameters_1')
smesh.SetName(wall_over.GetMesh(), 'wall_over')
smesh.SetName(oversetPatch_1.GetMesh(), 'oversetPatch')
smesh.SetName(outlet_1.GetMesh(), 'outlet')
smesh.SetName(inlet_1.GetMesh(), 'inlet')
smesh.SetName(wall_2.GetMesh(), 'wall')
smesh.SetName(outlet2_1.GetMesh(), 'outlet2')
smesh.SetName(porous1.GetMesh(), 'porous1')
smesh.SetName(porous2.GetMesh(), 'porous2')
smesh.SetName(porous3.GetMesh(), 'porous3')
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser()