1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2020 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 """Insertion de fissure longue - maillage face de fissure"""
26 from salome.smesh import smeshBuilder
29 from .geomsmesh import smesh
31 from .putName import putName
33 def insereFissureLongue_e (faceFiss, edgePeauFiss, groupEdgesPeauFiss, group_generFiss, groupEdgesFaceFissPipe, \
34 profondeur, rayonPipe, \
35 mailleur="MeshGems", nro_cas=None):
36 """maillage face de fissure"""
38 logging.info("Maillage avec %s pour le cas n°%s", mailleur, nro_cas)
40 meshFaceFiss = smesh.Mesh(faceFiss)
41 putName(meshFaceFiss, "faceFiss", i_pref=nro_cas)
43 mesh_size = (profondeur - rayonPipe)/math.sqrt(3.0) # pour avoir deux couches de triangles équilatéraux partout sur la fissure
44 if ( mailleur == "MeshGems"):
45 algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.MG_CADSurf)
46 hypo2d = algo2d.Parameters()
47 hypo2d.SetPhySize( mesh_size )
48 hypo2d.SetMinSize( mesh_size/10. )
49 hypo2d.SetMaxSize( mesh_size*3. )
50 hypo2d.SetChordalError( mesh_size*0.25 )
51 hypo2d.SetVerbosity( 0 )
53 algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_2D)
54 hypo2d = algo2d.Parameters()
55 hypo2d.SetMaxSize( mesh_size )
56 hypo2d.SetOptimize( 1 )
57 hypo2d.SetFineness( 2 )
58 hypo2d.SetMinSize( 2 )
59 hypo2d.SetQuadAllowed( 0 )
60 putName(algo2d.GetSubMesh(), "faceFiss", i_pref=nro_cas)
61 putName(algo2d, "algo2d_faceFiss", i_pref=nro_cas)
62 putName(hypo2d, "hypo2d_faceFiss", i_pref=nro_cas)
64 algo1d = meshFaceFiss.UseExisting1DElements(geom=edgePeauFiss)
65 hypo1d = algo1d.SourceEdges([ groupEdgesPeauFiss ],0,0)
66 putName(algo1d.GetSubMesh(), "edgeFissPeau", i_pref=nro_cas)
67 putName(algo1d, "algo1d_edgeFissPeau", i_pref=nro_cas)
68 putName(hypo1d, "hypo1d_edgeFissPeau", i_pref=nro_cas)
70 algo1d = meshFaceFiss.UseExisting1DElements(geom=groupEdgesFaceFissPipe)
71 hypo1d = algo1d.SourceEdges([ group_generFiss ],0,0)
72 putName(algo1d.GetSubMesh(), "edgeFissPeau", i_pref=nro_cas)
73 putName(algo1d, "algo1d_edgeFissPeau", i_pref=nro_cas)
74 putName(hypo1d, "hypo1d_edgeFissPeau", i_pref=nro_cas)
76 _ = meshFaceFiss.GroupOnGeom(faceFiss, "fisOutPi", SMESH.FACE)
78 is_done = meshFaceFiss.Compute()
79 text = "meshFaceFiss.Compute"
81 logging.info(text+" OK")
83 text = "Erreur au calcul du maillage.\n" + text