User:CAE41

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 POURSUITE.

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 create 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',),);
MAILLAGE_NP1=CO('mai_n2'),
RESULTAT_N=res_n1,
INDICATEUR='ERRE_ELEM_SIGM',
NOM_CMP_INDICA='ERREST',
CRIT_RAFF_PE=0.1,);
mod_n2=AFFE_MODELE(MAILLAGE=mai_n2,
AFFE=_F(TOUT='OUI',
PHENOMENE='MECANIQUE',
MODELISATION='3D',),);
ama_n2=AFFE_MATERIAU(MAILLAGE=mai_n2,
AFFE=_F(TOUT='OUI',
MATER=mat,),);
con_n2=AFFE_CHAR_MECA(MODELE=mod_n2,
DDL_IMPO=_F(GROUP_MA='BLOCAGE',
LIAISON='ENCASTRE',),
PRES_REP=_F(GROUP_MA='PRESSION',
PRES=10,),);
res_n2=MECA_STATIQUE(MODELE=mod_n2,
CHAM_MATER=ama_n2,
EXCIT=_F(CHARGE=con_n2,),);
res_n2=CALC_ELEM(reuse =res_n2,
RESULTAT=res_n2,
OPTION='SIGM_ELNO_DEPL',);
IMPR_RESU(FORMAT='MED',
RESU=_F(RESULTAT=res_n2,),);
FIN();
```

To make it work, you must use ASTK with B1 in D (data) and a new base (B2) in R (result).

To continue, you have to :

• change n2 in n3, n1 in n2 to make a test3.comm
• put B2 in D and create a new base B3 in R

And so on.