Salome HOME
Coquilles
[modules/homard.git] / doc / files / tutorial_5.py
index 0daeb9a645dc44063ca7cafc7fa5c6e2a12d28a0..8b82bfba08590b35cb5855ae704a45ab8cb0446f 100755 (executable)
 Exemple de couplage HOMARD-Salome
 Copyright EDF-R&D 1996, 2010, 2014
 """
-__revision__ = "V1.8"
+__revision__ = "V2.1"
 #
 import os
 import sys
 #
 # ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
 # Repertoire des donnees du tutorial
-data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-data_dir = os.path.normpath(data_dir)
-sys.path.append(data_dir)
+DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
 from tutorial_util import gzip_gunzip
 from tutorial_util import creation_dircase
 # ==================================
-dircase = creation_dircase(5)
-gzip_gunzip(data_dir, 5, -1)
+DIRCASE = creation_dircase(5)
+gzip_gunzip(DATA_TUTORIAL, 5, -1)
 # ==================================
 #
 import salome
@@ -52,8 +52,8 @@ homard.SetCurrentStudy(salome.myStudy)
 #
 # Frontiere
 # =========
-# Creation of the discrete boundary Boun_5_1
-Boun_5_1 = homard.CreateBoundaryDi('Boun_5_1', 'MAIL_EXT', data_dir+'/tutorial_5.fr.med')
+# Creation of the discrete boundary boun_5_1
+boun_5_1 = homard.CreateBoundaryDi('boun_5_1', 'MAIL_EXT', DATA_TUTORIAL+'/tutorial_5.fr.med')
 #
 # Creation des zones
 # ==================
@@ -64,38 +64,38 @@ quart_sup = homard.CreateZoneBox2D( 'quart_sup', 0., 250., 0., 250., 1 )
 #
 # Hypotheses
 # ==========
-# Creation of the hypothesis Hypo_5
-Hypo_5 = homard.CreateHypothesis('Hypo_5')
-Hypo_5.AddZone('enveloppe', 1)
-# Creation of the hypothesis Hypo_5_bis
-Hypo_5_bis = homard.CreateHypothesis('Hypo_5_bis')
-Hypo_5_bis.AddZone('quart_sup', 1)
+# Creation of the hypothesis hypo_5
+hypo_5 = homard.CreateHypothesis('hypo_5')
+hypo_5.AddZone('enveloppe', 1)
+# Creation of the hypothesis hypo_5_bis
+hypo_5_bis = homard.CreateHypothesis('hypo_5_bis')
+hypo_5_bis.AddZone('quart_sup', 1)
 #
 # Cas
 # ===
-Case_5 = homard.CreateCase('Case_5', 'COEUR_2D', data_dir+'/tutorial_5.00.med')
-Case_5.SetDirName(dircase)
-Case_5.SetConfType(3)
-Case_5.AddBoundaryGroup('Boun_5_1', '')
+case_5 = homard.CreateCase('Case_5', 'COEUR_2D', DATA_TUTORIAL+'/tutorial_5.00.med')
+case_5.SetDirName(DIRCASE)
+case_5.SetConfType(3)
+case_5.AddBoundaryGroup('boun_5_1', '')
 #
-# Iteration "Iter_5_1"
+# Iteration "iter_5_1"
 # ====================
-Iter_5_1 = Case_5.NextIteration('Iter_5_1')
-Iter_5_1.SetMeshName('COEUR_2D_01')
-Iter_5_1.SetMeshFile(dircase+'/maill.01.med')
-Iter_5_1.AssociateHypo('Hypo_5')
-error = Iter_5_1.Compute(1, 2)
+iter_5_1 = case_5.NextIteration('iter_5_1')
+iter_5_1.SetMeshName('COEUR_2D_01')
+iter_5_1.SetMeshFile(DIRCASE+'/maill.01.med')
+iter_5_1.AssociateHypo('hypo_5')
+error = iter_5_1.Compute(1, 2)
 #
-# Iteration "Iter_5_2"
+# Iteration "iter_5_2"
 # ====================
-Iter_5_2 = Iter_5_1.NextIteration('Iter_5_2')
-Iter_5_2.SetMeshName('COEUR_2D_02')
-Iter_5_2.SetMeshFile(dircase+'/maill.02.med')
-Iter_5_2.AssociateHypo('Hypo_5_bis')
-error = Iter_5_2.Compute(1, 2)
+iter_5_2 = iter_5_1.NextIteration('iter_5_2')
+iter_5_2.SetMeshName('COEUR_2D_02')
+iter_5_2.SetMeshFile(DIRCASE+'/maill.02.med')
+iter_5_2.AssociateHypo('hypo_5_bis')
+error = iter_5_2.Compute(1, 2)
 
 # ==================================
-gzip_gunzip(data_dir, 5, 1)
+gzip_gunzip(DATA_TUTORIAL, 5, 1)
 # ==================================
 
 if salome.sg.hasDesktop():