]> SALOME platform Git repositories - modules/homard.git/blob - doc/files/tutorial_5.py
Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/homard.git] / doc / files / tutorial_5.py
1 #!/usr/bin/env python
2 # -*- coding: iso-8859-1 -*-
3
4 # Copyright (C) 2011-2012  CEA/DEN, EDF R&D
5 #
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.
10 #
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.
15 #
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
19 #
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22
23 """
24 Exemple de couplage HOMARD-Salome
25 Copyright EDF-R&D 1996, 2010
26 """
27 __revision__ = "V1.2"
28 #
29 # ==================================
30 # Repertoire a personnaliser
31 # Ce repertoire contient les fichiers de donnees : tutorial_5.00.med, tutorial_5.fr.med
32 # Ce repertoire contiendra les fichiers de resultats : maill.01.med, maill.02.med
33 dircase = "/tmp"
34 # ==================================
35 #
36 import salome
37 salome.salome_init()
38 import HOMARD
39 #
40 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
41 study_main = salome.myStudyManager.NewStudy("HOMARD")
42 homard.SetCurrentStudy(salome.myStudy)
43 #
44 # Creation of the boundaries
45 # ==========================
46 # Creation of the discrete boundary Boun_1
47 Boun_1 = homard.CreateBoundaryDi('Boun_1', 'MAIL_EXT', dircase+'/tutorial_5.fr.med')
48 #
49 # Creation of the zones
50 # =====================
51 # Creation of the disk with hole enveloppe
52 enveloppe = homard.CreateZoneDiskWithHole( 'enveloppe', 0., 0., 250., 193., 1 )
53 # Creation of the rectangle quart_sup
54 quart_sup = homard.CreateZoneBox2D( 'quart_sup', 0., 250., 0., 250., 1 )
55 #
56 # Hypothesis
57 # ==========
58 # Creation of the hypothesis Hypo_1
59 Hypo_1 = homard.CreateHypothesis('Hypo_1')
60 Hypo_1.SetAdapRefinUnRef(0, 1, 0)
61 homard.AssociateHypoZone('enveloppe', 'Hypo_1')
62 # Creation of the hypothesis Hypo_2
63 Hypo_2 = homard.CreateHypothesis('Hypo_2')
64 Hypo_2.SetAdapRefinUnRef(0, 1, 0)
65 homard.AssociateHypoZone('quart_sup', 'Hypo_2')
66 #
67 # Case "Case_1"
68 # =============
69 Case_1 = homard.CreateCase('Case_1', 'COEUR_2D', dircase+'/tutorial_5.00.med')
70 Case_1.SetDirName(dircase)
71 Case_1.SetConfType(3)
72 Case_1.AddBoundaryGroup('Boun_1', '')
73 #
74 # Iteration "Iter_1"
75 # ==================
76 Iter_1 = homard.CreateIteration('Iter_1', Case_1.GetIter0Name())
77 Iter_1.SetMeshName('COEUR_2D_01')
78 Iter_1.SetMeshFile(dircase+'/maill.01.med')
79 homard.AssociateIterHypo('Iter_1', 'Hypo_1')
80 codret = Iter_1.Compute(1)
81 #
82 # Iteration "Iter_2"
83 # ==================
84 Iter_2 = homard.CreateIteration('Iter_2', 'Iter_1')
85 Iter_2.SetMeshName('COEUR_2D_02')
86 Iter_2.SetMeshFile(dircase+'/maill.02.med')
87 homard.AssociateIterHypo('Iter_2', 'Hypo_2')
88 codret = Iter_2.Compute(1)
89
90
91 if salome.sg.hasDesktop():
92   salome.sg.updateObjBrowser(1)