X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Ffiles%2Ftutorial_4.py;h=6adecb70de09a650fc2759feaaa33189c2ed45e4;hb=refs%2Ftags%2FV9_13_0b1;hp=9b4751f168c044bc29f9bcc8f4fc6c5e7608caa2;hpb=3698a6d21be8092b91724c6e3687aae687fffc62;p=modules%2Fhomard.git diff --git a/doc/files/tutorial_4.py b/doc/files/tutorial_4.py index 9b4751f1..6adecb70 100755 --- a/doc/files/tutorial_4.py +++ b/doc/files/tutorial_4.py @@ -1,7 +1,7 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright (C) 2011-2016 CEA/DEN, EDF R&D +# Copyright (C) 2011-2024 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -22,24 +22,22 @@ """ Exemple de couplage HOMARD-Salome -Copyright EDF-R&D 1996, 2011, 2014 +Copyright EDF 1996, 2011, 2019 """ -__revision__ = "V3.1" +__revision__ = "V4.04" # import os import sys # # ================================== -PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR') +PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR") # Repertoire des donnees du tutorial 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(4) -gzip_gunzip(DATA_TUTORIAL, 4, -1) # ================================== # import salome @@ -47,70 +45,57 @@ salome.salome_init() import HOMARD # homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD") +homard.UpdateStudy() # -# Frontieres -# ========== -boun_4_1 = homard.CreateBoundaryDi('intersection', 'PIQUAGE', DATA_TUTORIAL+'/tutorial_4.fr.med') -# -boun_4_2 = homard.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.) +#============================= Début des commandes ============================= # -boun_4_3 = homard.CreateBoundaryCylinder('cyl_2_ext', 17.5, -2.5, -12.5, -100., -75., -25., 50.) -# -boun_4_4 = homard.CreateBoundaryCylinder('cyl_1_int', 0.0, 25., -25., 25., 50., 75., 75.) +# Frontières +# ========== +boun_4 = homard.CreateBoundaryCAO("PIQUAGE", os.path.join(DATA_TUTORIAL, "tutorial_4.xao")) # -boun_4_5 = homard.CreateBoundaryCylinder('cyl_2_int', 17.5, -2.5, -12.5, -100., -75., -25., 25.) +# Cas +# === +le_cas = homard.CreateCase('Case_4', "PIQUAGE", os.path.join(DATA_TUTORIAL, "tutorial_4.00.med")) +le_cas.SetDirName(DIRCASE) +le_cas.AddBoundary( "PIQUAGE" ) # # Hypotheses # ========== # Creation of the hypothesis hypo_4 -hypo_4 = homard.CreateHypothesis('hypo_4') -hypo_4.SetUnifRefinUnRef(1) -hypo_4.AddGroup('T1_INT_I') -hypo_4.AddGroup('T1_INT_O') -hypo_4.AddGroup('T2_INT') +l_hypothese = homard.CreateHypothesis('hypo_4') +l_hypothese.SetUnifRefinUnRef(1) +l_hypothese.AddGroup('T1_INT_I') +l_hypothese.AddGroup('T1_INT_O') +l_hypothese.AddGroup('T2_INT') # Creation of the hypothesis hypo_4_bis -hypo_4_bis = homard.CreateHypothesis('hypo_4_bis') -hypo_4_bis.SetUnifRefinUnRef(1) -hypo_4_bis.AddGroup('T1_EXT_I') -hypo_4_bis.AddGroup('T1_EXT_O') -hypo_4_bis.AddGroup('T2_EXT') -# -# Cas -# === -case_4 = homard.CreateCase('Case_4', 'PIQUAGE', DATA_TUTORIAL+'/tutorial_4.00.med') -case_4.SetDirName(DIRCASE) -case_4.AddBoundaryGroup( 'intersection', '' ) -case_4.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' ) -case_4.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' ) -case_4.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' ) -case_4.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' ) -case_4.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' ) -case_4.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' ) +l_hypothese_bis = homard.CreateHypothesis('hypo_4_bis') +l_hypothese_bis.SetUnifRefinUnRef(1) +l_hypothese_bis.AddGroup('T1_EXT_I') +l_hypothese_bis.AddGroup('T1_EXT_O') +l_hypothese_bis.AddGroup('T2_EXT') # # Iterations # ========== # Iteration iter_4_1 : raffinement selon les faces internes -iter_4_1 = case_4.NextIteration('iter_4_1') +iter_4_1 = le_cas.NextIteration('iter_4_1') iter_4_1.SetMeshName('PIQUAGE_1') -iter_4_1.SetMeshFile(DIRCASE+'/maill.01.med') +iter_4_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med")) iter_4_1.AssociateHypo('hypo_4') -error = iter_4_1.Compute(1, 2) +erreur = iter_4_1.Compute(1, 2) # Iteration iter_4_2 : raffinement selon les faces externes iter_4_2 = iter_4_1.NextIteration('iter_4_2') iter_4_2.SetMeshName('PIQUAGE_2') -iter_4_2.SetMeshFile(DIRCASE+'/maill.02.med') +iter_4_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med")) iter_4_2.AssociateHypo('hypo_4_bis') -error = iter_4_2.Compute(1, 2) +erreur = iter_4_2.Compute(1, 2) # Iteration iter_4_3 : second raffinement selon les faces externes iter_4_3 = iter_4_2.NextIteration('iter_4_3') iter_4_3.SetMeshName('PIQUAGE_3') -iter_4_3.SetMeshFile(DIRCASE+'/maill.03.med') +iter_4_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med")) iter_4_3.AssociateHypo('hypo_4_bis') -error = iter_4_3.Compute(1, 2) - -# ================================== -gzip_gunzip(DATA_TUTORIAL, 4, 1) -# ================================== - +erreur = iter_4_3.Compute(1, 2) +# +#============================== Fin des commandes ============================== +# if salome.sg.hasDesktop(): salome.sg.updateObjBrowser()