1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2021 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
21 """problème de fissure plane sur cylindre, grand fond de fissure en arc de cercle"""
26 from blocFissure import gmu
27 from blocFissure.gmu.geomsmesh import geompy, smesh
28 from blocFissure.gmu.fissureGenerique import fissureGenerique
29 from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
30 from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
31 from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
32 from blocFissure.gmu.putName import putName
34 class cylindre(fissureGenerique):
35 """problème de fissure plane sur cylindre, grand fond de fissure en arc de cercle"""
37 nomProbleme = "cylindre"
38 shapeFissureParams = dict()
39 maillageFissureParams = dict()
40 referencesMaillageFissure = dict()
42 # ---------------------------------------------------------------------------
43 def genereMaillageSain(self, geometriesSaines, meshParams):
45 génère le maillage de l'objet sain, par chargement d'un fichier med
46 ici, les paramètres de géométrie et de maillage ne sont pas utiles
48 logging.info("genereMaillageSain %s", self.nomCas)
50 ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "CylindreSain.med"))
51 putName(objetSain.GetMesh(), self.nomProbleme, i_pref=self.numeroCas)
53 return [objetSain, True] # True : maillage hexa
55 # ---------------------------------------------------------------------------
56 def setParamShapeFissure(self):
58 paramètres de la fissure pour méthode construitFissureGenerale
59 lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
60 rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
62 logging.info("setParamShapeFissure %s", self.nomCas)
63 self.shapeFissureParams = dict(lgInfluence = 20,
66 # ---------------------------------------------------------------------------
67 def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
69 logging.info("genereShapeFissure %s", self.nomCas)
71 lgInfluence = shapeFissureParams['lgInfluence']
73 shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "FissInCylindre2.brep"))
74 fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
75 geompy.UnionIDs(fondFiss, [6])
76 geompy.addToStudy( shellFiss, 'shellFiss' )
77 geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
79 mailleur = self.mailleur2d3d()
80 coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,15, mailleur, self.numeroCas)
83 return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
85 # ---------------------------------------------------------------------------
86 def setParamMaillageFissure(self):
87 self.maillageFissureParams = dict(nomRep = os.curdir,
88 nomFicSain = self.nomProbleme,
89 nomFicFissure = self.nomProbleme + "_fissure",
92 areteFaceFissure = 20)
94 # ---------------------------------------------------------------------------
95 def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams):
96 elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams, \
100 # ---------------------------------------------------------------------------
101 def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
102 shapesFissure, shapeFissureParams, \
103 maillageFissureParams, elementsDefaut, step, \
104 mailleur="MeshGems"):
106 mailleur = self.mailleur2d3d()
107 maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
108 maillageFissureParams, elementsDefaut, \
109 mailleur, self.numeroCas)
110 return maillageFissure
112 # ---------------------------------------------------------------------------
113 def setReferencesMaillageFissure(self):
114 self.referencesMaillageFissure = dict( \
115 Entity_Quad_Quadrangle = 6920, \
116 Entity_Quad_Hexa = 18174, \
117 Entity_Node = 104349, \
118 Entity_Quad_Edge = 718, \
119 Entity_Quad_Triangle = 952, \
120 Entity_Quad_Tetra = 16691, \
121 Entity_Quad_Pyramid = 1110, \
122 Entity_Quad_Penta = 336 \