Difference between revisions of "Contrib:JMB/DynamicAnalysis"

From CAELinuxWiki
Jump to: navigation, search
(Initial page)
 
(Added commands)
Line 5: Line 5:
 
===Translation of the CodeAster Example===
 
===Translation of the CodeAster Example===
  
This is an early attempt at translating into English and to a newer version of CodeAster an example posted on the CodeAster Wiki page at: http://www.code-aster.org/wiki/doku.php?id=fr:p01_util:p150_python:01_dyna_non_line_contact of a dynamic analysis case study.  That page was created several years ago and the command file posted there no longer works on newer versions of CodeAster.  This page is an attempt at modernizing the comm file.
+
This is an early attempt at translating into English and to a newer version of CodeAster an example posted on the CodeAster Wiki page at: http://www.code-aster.org/wiki/doku.php?id=fr:p01_util:p150_python:01_dyna_non_line_contact of a dynamic analysis case study.  That page was created several years ago and the command file posted there no longer works on newer versions of CodeAster.  This page is an attempt at modernizing the comm file to work in CodeAster ver 10.2+.
  
 
===Summary of the study===
 
===Summary of the study===
Line 15: Line 15:
 
Output to a postscript file (not functional yet!)
 
Output to a postscript file (not functional yet!)
  
 +
 +
[[Image:ailette.gif]]
  
 
You can download the files here: [[Image:ailette.tar.gz]]
 
You can download the files here: [[Image:ailette.tar.gz]]
Line 20: Line 22:
 
===The command file===
 
===The command file===
  
 +
#===========================================
 +
# IMPORT
 +
import Gnuplot
 +
from Numeric import *
 +
# from FFT import *
 +
from numpy import fft
 +
import os
 +
#===========================================
 +
DEBUT(PAR_LOT='NON',);
 +
PRE_GIBI();
 +
 +
MA=LIRE_MAILLAGE();
 +
MO=AFFE_MODELE(MAILLAGE=MA,
 +
              AFFE=_F(TOUT='OUI',
 +
                      PHENOMENE='MECANIQUE',
 +
                      MODELISATION='C_PLAN',),);
 +
MA=MODI_MAILLAGE(reuse =MA,
 +
                MAILLAGE=MA,
 +
                ORIE_PEAU_2D=_F(GROUP_MA=('L3','L4',),),);
 +
 +
MAT=DEFI_MATERIAU(ELAS=_F(E=8.E3,
 +
                          NU=0.3,
 +
                          RHO=7800.0,),);
 +
CHMAT=AFFE_MATERIAU(MAILLAGE=MA,
 +
                    AFFE=_F(TOUT='OUI',
 +
                            MATER=MAT,),);
 +
 +
#==========================================================
 +
CHCAS1=AFFE_CHAR_MECA(MODELE=MO,
 +
                      DDL_IMPO=_F(GROUP_MA='L1',
 +
                                  DX=0.5,
 +
                                  DY=0.0,),);
 +
CHCONT=AFFE_CHAR_MECA(MODELE=MO,);
 +
CHCONT1=DEFI_CONTACT(MODELE=MO,
 +
                    FORMULATION='DISCRETE',
 +
                    REAC_GEOM='CONTROLE',
 +
                    NB_ITER_GEOM=3,
 +
                    ZONE=_F(GROUP_MA_MAIT='L1',
 +
                            GROUP_MA_ESCL='L4',
 +
                            SANS_GROUP_NO='F2',
 +
                            ALGO_CONT='CONTRAINTE',),);
 +
fin = 500.0;
 +
n = 500;
 +
LARCH=DEFI_LIST_REEL(DEBUT=0.0,
 +
                    INTERVALLE=_F(JUSQU_A=fin,
 +
                                  NOMBRE=n,),);
 +
LINST=DEFI_LIST_REEL(DEBUT=0.0,
 +
                    INTERVALLE=_F(JUSQU_A=fin,
 +
                                  NOMBRE=n,),);
 +
FREQ = 0.01;
 +
FONC = FORMULE(VALE='sin(2.*pi*FREQ*INST)',
 +
              NOM_PARA='INST',);
 +
FMULT=CALC_FONC_INTERP(FONCTION=FONC,
 +
                      LIST_PARA=LINST,);
 +
 +
#===========================================
 +
# CALCUL with CONTACT
 +
RESU=DYNA_NON_LINE(MODELE=MO,
 +
                  CHAM_MATER=CHMAT,
 +
                  EXCIT=(_F(CHARGE=CHCONT,
 +
                            FONC_MULT=FMULT,),
 +
                          _F(CHARGE=CHCAS1,),),
 +
                  CONTACT=CHCONT1,
 +
                  COMP_INCR=_F(RELATION='ELAS',
 +
                                TOUT='OUI',),
 +
                  INCREMENT=_F(LIST_INST=LINST,),
 +
                  SCHEMA_TEMPS=_F(SCHEMA='HHT',
 +
                                  COEF_MASS_SHIFT=0,
 +
                                  ALPHA=0.0,
 +
                                  FORMULATION='DEPLACEMENT',),
 +
                  NEWTON=_F(REAC_INCR=0,
 +
                            PREDICTION='ELASTIQUE',
 +
                            MATRICE='TANGENTE',
 +
                            REAC_ITER=0,),
 +
                  SOLVEUR=_F(METHODE='MULT_FRONT',
 +
                              RENUM='METIS',),
 +
                  CONVERGENCE=_F(RESI_GLOB_RELA=1.E-05,
 +
                                  ITER_GLOB_MAXI=20,),
 +
                  ARCHIVAGE=_F(LIST_INST=LARCH,
 +
                                ARCH_ETAT_INIT='OUI',),);
 +
 +
# Write Results to MED file
 +
IMPR_RESU(MODELE=MO,
 +
          FORMAT='MED',
 +
          UNITE=80,
 +
          RESU=_F(MAILLAGE=MA,
 +
                  RESULTAT=RESU,
 +
                  TOUT_CHAM='OUI',
 +
                  TOUT_CMP='OUI',),
 +
          INFO=1,);
 +
 +
#=============================================
 +
# POST-TRAITEMENT
 +
IMPR_RESU(FORMAT='GMSH',
 +
          UNITE=37,
 +
          RESU=_F(MAILLAGE=MA,),);
 +
 +
# PASSAGE ASTER => NUMERIC PYTHON
 +
TAB=POST_RELEVE_T(ACTION=_F(OPERATION='EXTRACTION',
 +
                            INTITULE='DEPLA',
 +
                            RESULTAT=RESU,
 +
                            NOM_CHAM='DEPL',
 +
                            GROUP_NO='A4',
 +
                            TOUT_CMP='OUI',),);
 +
DEPLX=RECU_FONCTION(TABLE=TAB,
 +
                    PARA_X='INST',
 +
                    PARA_Y='DY',);
 +
 +
# In ASTK define a 'mast' type output file named 'Ailette.txt' with unit number 26 with (R)
 +
IMPR_TABLE(TABLE=TAB,
 +
          FORMAT='TABLEAU',
 +
          UNITE=26,
 +
          SEPARATEUR=' , ',
 +
          TITRE='Displacement with contact',);
 +
 +
# AFFICHAGE GNUPLOT INTERACTIF
 +
# CALCUL DES TRANSFORMEES DE FOURIER
 +
FFT_DEPL= fft(DEPLX[:,1])
 +
PUISS=FFT_DEPL*conjugate(FFT_DEPL)
 +
IMPR_FONCTION(FORMAT='XMGRACE',
 +
              PILOTE='INTERACTIF',
 +
              BORNE_X=(0.,500.),
 +
              BORNE_Y=(0.,10.),
 +
              COURBE=( _F( FONC_X  = FFT_DEPL,
 +
                          FONC_Y  = PUISS,
 +
                          MARQUEUR = 1,
 +
                          COULEUR  = 9,
 +
                          STYLE    = 1,
 +
                        ),),
 +
              TITRE='Displacement with contact',
 +
              LEGENDE_X='Frequency',
 +
              LEGENDE_Y='Amplitude',
 +
              )
 +
 +
raw_input('\n\nPress any key to continue...\n\n')
 +
FIN();
  
 
===The Postprocessing===
 
===The Postprocessing===

Revision as of 20:08, 23 August 2010

Topic under construction

Dynamic Analysis with Contact

Translation of the CodeAster Example

This is an early attempt at translating into English and to a newer version of CodeAster an example posted on the CodeAster Wiki page at: http://www.code-aster.org/wiki/doku.php?id=fr:p01_util:p150_python:01_dyna_non_line_contact of a dynamic analysis case study. That page was created several years ago and the command file posted there no longer works on newer versions of CodeAster. This page is an attempt at modernizing the comm file to work in CodeAster ver 10.2+.

Summary of the study

An example of a dynamic non-linear problem involving contact consisting of the following:

An interactive post-treatment Calculation of the Fourier Transform (not functional yet!) Graph of the response Output to a postscript file (not functional yet!)


Ailette.gif

You can download the files here: File:Ailette.tar.gz

The command file

#===========================================
# IMPORT
import Gnuplot
from Numeric import *
# from FFT import *
from numpy import fft
import os
#===========================================
DEBUT(PAR_LOT='NON',);
PRE_GIBI();
MA=LIRE_MAILLAGE();
MO=AFFE_MODELE(MAILLAGE=MA,
              AFFE=_F(TOUT='OUI',
                      PHENOMENE='MECANIQUE',
                      MODELISATION='C_PLAN',),);
MA=MODI_MAILLAGE(reuse =MA,
                MAILLAGE=MA,
                ORIE_PEAU_2D=_F(GROUP_MA=('L3','L4',),),);
MAT=DEFI_MATERIAU(ELAS=_F(E=8.E3,
                         NU=0.3,
                         RHO=7800.0,),);
CHMAT=AFFE_MATERIAU(MAILLAGE=MA,
                   AFFE=_F(TOUT='OUI',
                           MATER=MAT,),);
#==========================================================
CHCAS1=AFFE_CHAR_MECA(MODELE=MO,
                     DDL_IMPO=_F(GROUP_MA='L1',
                                 DX=0.5,
                                 DY=0.0,),);
CHCONT=AFFE_CHAR_MECA(MODELE=MO,);
CHCONT1=DEFI_CONTACT(MODELE=MO,
                    FORMULATION='DISCRETE',
                    REAC_GEOM='CONTROLE',
                    NB_ITER_GEOM=3,
                    ZONE=_F(GROUP_MA_MAIT='L1',
                            GROUP_MA_ESCL='L4',
                            SANS_GROUP_NO='F2',
                            ALGO_CONT='CONTRAINTE',),);
fin = 500.0;
n = 500;
LARCH=DEFI_LIST_REEL(DEBUT=0.0,
                    INTERVALLE=_F(JUSQU_A=fin,
                                  NOMBRE=n,),);
LINST=DEFI_LIST_REEL(DEBUT=0.0,
                    INTERVALLE=_F(JUSQU_A=fin,
                                  NOMBRE=n,),);
FREQ = 0.01;
FONC = FORMULE(VALE='sin(2.*pi*FREQ*INST)',
              NOM_PARA='INST',);
FMULT=CALC_FONC_INTERP(FONCTION=FONC,
                      LIST_PARA=LINST,);
#===========================================
# CALCUL with CONTACT
RESU=DYNA_NON_LINE(MODELE=MO,
                  CHAM_MATER=CHMAT,
                  EXCIT=(_F(CHARGE=CHCONT,
                            FONC_MULT=FMULT,),
                         _F(CHARGE=CHCAS1,),),
                  CONTACT=CHCONT1,
                  COMP_INCR=_F(RELATION='ELAS',
                               TOUT='OUI',),
                  INCREMENT=_F(LIST_INST=LINST,),
                  SCHEMA_TEMPS=_F(SCHEMA='HHT',
                                  COEF_MASS_SHIFT=0,
                                  ALPHA=0.0,
                                  FORMULATION='DEPLACEMENT',),
                  NEWTON=_F(REAC_INCR=0,
                            PREDICTION='ELASTIQUE',
                            MATRICE='TANGENTE',
                            REAC_ITER=0,),
                  SOLVEUR=_F(METHODE='MULT_FRONT',
                             RENUM='METIS',),
                  CONVERGENCE=_F(RESI_GLOB_RELA=1.E-05,
                                 ITER_GLOB_MAXI=20,),
                  ARCHIVAGE=_F(LIST_INST=LARCH,
                               ARCH_ETAT_INIT='OUI',),);
# Write Results to MED file
IMPR_RESU(MODELE=MO,
         FORMAT='MED',
         UNITE=80,
         RESU=_F(MAILLAGE=MA,
                 RESULTAT=RESU,
                 TOUT_CHAM='OUI',
                 TOUT_CMP='OUI',),
         INFO=1,);
#=============================================
# POST-TRAITEMENT
IMPR_RESU(FORMAT='GMSH',
         UNITE=37,
         RESU=_F(MAILLAGE=MA,),);
# PASSAGE ASTER => NUMERIC PYTHON
TAB=POST_RELEVE_T(ACTION=_F(OPERATION='EXTRACTION',
                           INTITULE='DEPLA',
                           RESULTAT=RESU,
                           NOM_CHAM='DEPL',
                           GROUP_NO='A4',
                           TOUT_CMP='OUI',),);
DEPLX=RECU_FONCTION(TABLE=TAB,
                   PARA_X='INST',
                   PARA_Y='DY',);
# In ASTK define a 'mast' type output file named 'Ailette.txt' with unit number 26 with (R)
IMPR_TABLE(TABLE=TAB,
          FORMAT='TABLEAU',
          UNITE=26,
          SEPARATEUR=' , ',
          TITRE='Displacement with contact',);
# AFFICHAGE GNUPLOT INTERACTIF
# CALCUL DES TRANSFORMEES DE FOURIER
FFT_DEPL= fft(DEPLX[:,1])
PUISS=FFT_DEPL*conjugate(FFT_DEPL)
IMPR_FONCTION(FORMAT='XMGRACE',
             PILOTE='INTERACTIF',
             BORNE_X=(0.,500.),
             BORNE_Y=(0.,10.),
             COURBE=( _F( FONC_X   = FFT_DEPL,
                          FONC_Y   = PUISS,
                          MARQUEUR = 1,
                          COULEUR  = 9,
                          STYLE    = 1,
                        ),),
             TITRE='Displacement with contact',
             LEGENDE_X='Frequency',
             LEGENDE_Y='Amplitude',
             )
raw_input('\n\nPress any key to continue...\n\n')
FIN();

The Postprocessing

File:Ailette.png

Some background information

Acknowlegements

This page was made possible by the help and advice of several individuals on the CodeAster Forum in particular: Thomas DeSoza, et.al. If I have missed mentioning somebody whose name should be added, please let me know or edit this section since it is a Wiki that anybody can add to, or correct.

Disclaimer: This page is still evolving and omissions or errors are a regrettable part of such a process. So user beware! -JMB