User:CAE41

From CAELinuxWiki
Revision as of 11:52, 29 January 2011 by CAE41 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

As shown on this site, it is possible to make some calculations with adapative mesh in Code_Aster with loops in Python. Here, I want to show how to do it with the POURSUITE command because according to me it can give some flexibility.

First, you create a normal .comm like this one.

DEBUT();

mat=DEFI_MATERIAU(ELAS=_F(E=30000.0, 
                            NU=0.3,),);
mai_n1=LIRE_MAILLAGE(FORMAT='MED',);
mod_n1=AFFE_MODELE(MAILLAGE=mai_n1,
                  AFFE=_F(TOUT='OUI',
                          PHENOMENE='MECANIQUE',
                          MODELISATION='3D',),);
ama_n1=AFFE_MATERIAU(MAILLAGE=mai_n1,
                    AFFE=_F(TOUT='OUI',
                            MATER=mat,),);
con_n1=AFFE_CHAR_MECA(MODELE=mod_n1,
                     DDL_IMPO=_F(GROUP_MA='BLOCAGE',
                                 LIAISON='ENCASTRE',),
                     PRES_REP=_F(GROUP_MA='PRESSION',
                                 PRES=10.0,),);
res_n1=MECA_STATIQUE(MODELE=mod_n1,
                    CHAM_MATER=ama_n1,
                    EXCIT=_F(CHARGE=con_n1,),);
res_n1=CALC_ELEM(reuse =res_n1,
                RESULTAT=res_n1,
                OPTION='SIGM_ELNO_DEPL',);
IMPR_RESU(FORMAT='MED',
         RESU=_F(RESULTAT=res_n1,),);
FIN();

If you use Salome_Meca, a base (B1) will be automaticaly created.

Then we will do the next step with the following .comm

POURSUITE();
res_n1=CALC_ELEM(reuse =res_n1,
                RESULTAT=res_n1,
                OPTION=('ERRE_ELEM_SIGM','SIEF_ELNO_ELGA',),);
MACR_ADAP_MAIL(MAILLAGE_N=mai_n1,
              MAILLAGE_NP1=CO('mai_n2'),
              ADAPTATION='RAFFINEMENT',
              RESULTAT_N=res_n1,
              INDICATEUR='ERRE_ELEM_SIGM',
              NOM_CMP_INDICA='ERREST',
              CRIT_RAFF_PE=0.1,);
DETRUIRE(CONCEPT=_F(NOM=(res_n1,mod_n1,mai_n1,con_n1,ama_n1,),),);
mai_n1=CREA_MAILLAGE(MAILLAGE=mai_n2,);
DETRUIRE(CONCEPT=_F(NOM=mai_n2,),);
mod_n1=AFFE_MODELE(MAILLAGE=mai_n1,
                  AFFE=_F(TOUT='OUI',
                          PHENOMENE='MECANIQUE',
                          MODELISATION='3D',),);
ama_n1=AFFE_MATERIAU(MAILLAGE=mai_n1,
                    AFFE=_F(TOUT='OUI',
                            MATER=mat,),);
con_n1=AFFE_CHAR_MECA(MODELE=mod_n1,
                     DDL_IMPO=_F(GROUP_MA='BLOCAGE',
                                 LIAISON='ENCASTRE',),
                     PRES_REP=_F(GROUP_MA='PRESSION',
                                 PRES=10.0,),);
res_n1=MECA_STATIQUE(MODELE=mod_n1,
                    CHAM_MATER=ama_n1,
                    EXCIT=_F(CHARGE=con_n1,),);
res_n1=CALC_ELEM(reuse =res_n1,
                RESULTAT=res_n1,
                OPTION='SIGM_ELNO_DEPL',);
IMPR_RESU(FORMAT='MED',
         RESU=_F(RESULTAT=res_n1,),);
FIN();


To make it work, you must use ASTK with :

  • this .comm
  • a file for the message (.mess)
  • a file for the result (.rmed)
  • B1 in D (data) and in R (result), with C to compress.


To continue, you just have to change the name of the result (.rmed) if you want to keep the previous result.