1 # Copyright (C) 2014-2016 EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 ##################################################################
21 # Header for salome initialization ###############################
23 import sys, salome, math, os
24 sys.path.append( os.path.join( os.getenv('SMESH_ROOT_DIR'), '@MACMESH_INSTALL_PY@'))
26 import Config, GenFunctions
28 Config.theStudy = salome.myStudy;
30 from MacObject import *
31 from SharpAngle import *
32 from CentralUnrefine import *
33 from PublishGroups import *
34 from CompositeBox import *
35 from CompositeBoxF import *
39 ##################################################################
40 # Mesh name ######################################################
42 Config.StudyName = "SRV_X."
44 ##################################################################
45 # Definition of geometrical parameters ###########################
47 X = 1.0 # Valve initial opening
49 Config.StudyName += str(X)+"mm"
51 R = 7.5 # Upstream pipe radius
52 T = 5.0 # Upstream pipe thickness
53 H = 20.0 # Upstream pipe height
54 J = 6.0 # Jet distance
55 E = 60.0 # Exit extent
57 ##################################################################
58 # Definition of meshing parameters ###############################
60 d = 0.1 # Meshing element size at the inner corner
61 Nl = 1 # Number of levels in the local refinement
62 ##################################################################
66 Bloc.append( SharpAngleOut(0.,0.,X,1.5*X,X,d,'NE',Nl,
67 groups=['PH','PV_IN','VH',None,None,None]) )
70 Bloc.append( CompositeBox(X/2.+0.5*(R-X/2.),0.5*(X+X/2.)-X/2.,R-X/2.,X+X/2.,
71 groups=[None,'VH',None,'AXIS'] ) )
74 Bloc.append( CompositeBoxF((0.,-X/2.),(R,-X/2.),(R,-H),(0.,-H),
75 groups=['IN',None,'PV_IN','AXIS'] ) )
78 Bloc.append( SharpAngleOut(-T,0.,X,X,X,d,'NW',Nl,
79 groups=['PH','PV_OUT',None,None,None,None]) )
82 Bloc.append( SharpAngleOut(-T,X,X,X,X,d,'SW',Nl,
83 groups=['VH','VV',None,None,None,None]) )
87 Bloc.append( MacObject('CompBoxF',[(-X/2.-gap/2.,X/2.),(gap,X)],
88 ['auto'],groups=['PH','VH',None,None] ) )
91 Bloc.append( MacObject('CompBoxF',[(-T-X/2.-(J-X/2.)/2.,X/2.),(J-X/2.,2.*X)],
92 ['auto'],groups=[None,None,None,None] ) )
95 Bloc.append( CentralUnrefine(-T-J,X/2.,2.*E-J,E,'EW',
96 groups=[None,None,None,'OUT_V','OUT_H_HI','OUT_H_LO']))
99 Bloc.append( CompositeBox(-T-J/2.,-X/2.-0.5*((E-X)/2.-X/2.),J,(E-X)/2.-X/2.,
100 groups=['OUT_H_LO',None,None,'PV_OUT'] ) )
103 Bloc.append( CompositeBox(-T-J/2.,X+X/2.+0.5*((E-X)/2.-X/2.),J,(E-X)/2.-X/2.,
104 groups=[None,'OUT_H_HI',None,'VV'] ) )
106 SRVMesh = PublishGroups()
108 RealLocalMeshing = Bloc[0][0].GeoPar[1][0]/Bloc[0][0].DirectionalMeshParams[0]
109 ExtrusionAngle = 2. * math.asin(RealLocalMeshing/(2*R))*180./math.pi
110 print "\nThe mesh will be revolved with an angle of :",ExtrusionAngle
112 RevolveMesh(SRVMesh, Center=[R+0.01,0,0], Direction=[0,1,0], AngleDeg=ExtrusionAngle, Scale=0.001)