1 # Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 ##################################################################
23 # Header for salome initialization ###############################
25 import sys, salome, math, os
26 sys.path.append( os.path.join( os.getenv('SMESH_ROOT_DIR'), '@MACMESH_INSTALL_PY@'))
28 import Config, GenFunctions
30 Config.theStudy = salome.myStudy;
32 from MacObject import *
33 from SharpAngle import *
34 from CentralUnrefine import *
35 from PublishGroups import *
36 from CompositeBox import *
37 from CompositeBoxF import *
41 ##################################################################
42 # Mesh name ######################################################
44 Config.StudyName = "SRV_X."
46 ##################################################################
47 # Definition of geometrical parameters ###########################
49 X = 1.0 # Valve initial opening
51 Config.StudyName += str(X)+"mm"
53 R = 7.5 # Upstream pipe radius
54 T = 5.0 # Upstream pipe thickness
55 H = 20.0 # Upstream pipe height
56 J = 6.0 # Jet distance
57 E = 60.0 # Exit extent
59 ##################################################################
60 # Definition of meshing parameters ###############################
62 d = 0.1 # Meshing element size at the inner corner
63 Nl = 1 # Number of levels in the local refinement
64 ##################################################################
68 Bloc.append( SharpAngleOut(0.,0.,X,1.5*X,X,d,'NE',Nl,
69 groups=['PH','PV_IN','VH',None,None,None]) )
72 Bloc.append( CompositeBox(X/2.+0.5*(R-X/2.),0.5*(X+X/2.)-X/2.,R-X/2.,X+X/2.,
73 groups=[None,'VH',None,'AXIS'] ) )
76 Bloc.append( CompositeBoxF((0.,-X/2.),(R,-X/2.),(R,-H),(0.,-H),
77 groups=['IN',None,'PV_IN','AXIS'] ) )
80 Bloc.append( SharpAngleOut(-T,0.,X,X,X,d,'NW',Nl,
81 groups=['PH','PV_OUT',None,None,None,None]) )
84 Bloc.append( SharpAngleOut(-T,X,X,X,X,d,'SW',Nl,
85 groups=['VH','VV',None,None,None,None]) )
89 Bloc.append( MacObject('CompBoxF',[(-X/2.-gap/2.,X/2.),(gap,X)],
90 ['auto'],groups=['PH','VH',None,None] ) )
93 Bloc.append( MacObject('CompBoxF',[(-T-X/2.-(J-X/2.)/2.,X/2.),(J-X/2.,2.*X)],
94 ['auto'],groups=[None,None,None,None] ) )
97 Bloc.append( CentralUnrefine(-T-J,X/2.,2.*E-J,E,'EW',
98 groups=[None,None,None,'OUT_V','OUT_H_HI','OUT_H_LO']))
101 Bloc.append( CompositeBox(-T-J/2.,-X/2.-0.5*((E-X)/2.-X/2.),J,(E-X)/2.-X/2.,
102 groups=['OUT_H_LO',None,None,'PV_OUT'] ) )
105 Bloc.append( CompositeBox(-T-J/2.,X+X/2.+0.5*((E-X)/2.-X/2.),J,(E-X)/2.-X/2.,
106 groups=[None,'OUT_H_HI',None,'VV'] ) )
108 SRVMesh = PublishGroups()
110 RealLocalMeshing = Bloc[0][0].GeoPar[1][0]/Bloc[0][0].DirectionalMeshParams[0]
111 ExtrusionAngle = 2. * math.asin(RealLocalMeshing/(2*R))*180./math.pi
112 print "\nThe mesh will be revolved with an angle of :",ExtrusionAngle
114 RevolveMesh(SRVMesh, Center=[R+0.01,0,0], Direction=[0,1,0], AngleDeg=ExtrusionAngle, Scale=0.001)