Contrib:KeesWouters/Homard/lshape

From CAELinuxWiki
Revision as of 00:17, 22 February 2010 by Keeswouters (Talk | contribs) ('''The general idea of the refinement''')

Jump to: navigation, search

Mesh refinement by the macro command MACR_ADAP_MAIL

[under construction - just started 2010-02-21 ... ]

To start with, this contribution mainly focuses on the use of Salome, Code Aster and the macro command MACR_ADAP_MAIL. So I do not focus on the results and the mechanical justifications of the code that has been used. So no guarantee that the results will be correct up to five decimal places, which they are probably not. I do hope though that this information is useful. For me it has been, because I had to think about some commands and look through the documentation and learn from that. In case of mistakes, errors or remarks, please notify me, or better, you are invited to correct or edit them yourself. Enjoy.

The geometry

The geometry and the mesh of the construction

The mesh refinement is based on Homard. As usual the geometry is quite simple in order not to disturb the issue we would like to show with other difficulties. We try to refine the mesh of an L shape with a few holes in it. The thickness of the two 'legs' are 0.8 mm and 1.2 mm. The diameters of the holes vary between 0.9 and 1.0 mm. Overall dimensions of the shape are 5 * 6 * 7 mm3.

The geometry is defined in a python script (for download see end of this contribution) and can be loaded into Salome Geometry module by File --> Load script (or ctrl T in the object browser window). Right click Refresh or push F5 after loading if necessary.

Kw lshape.jpg
overall dimension: [x,y,z] = [5.0, 6.0, 7.0]
width of the legs: 1.2 mm vertical and 0.8 mm horizontal
diameters of the circles: in vertical plate: 0.9 mm - in horizontal plate: 0.8 mm
radii of the fillets: innerfillet 0.5 mm - outerfillet 1.2 mm

The mesh consists of coarse, tetrehedral elements to start with.

The load of the construction

The L shape is fixed in all directions at the bottom area Afix. On area at opposite end of L is denoted Apres. For simplicity, on this area a displacement of 0.1 mm is given in the y direction.

The general idea of the refinement

The general idea of the Homard refinement is to start with a rather course mesh and update the mesh according to a criterium. In this case we use the stress error estimate ERRE_ELEM_SIGM and its component ERREST. For more details on this error estimation see [....]. So to start with, a standard load case will be calculated and an error estimation on all the elements will be carried out. Again depending on a criterium the mesh will be adapted. In this example a certain percentage of the elements with the highest error estimates will be refined. A new calculation with the adapted mesh can take place. For this calculation all the models, loads and parameters need to be rebuild. So it is most suitable to define geometrical entities (GROUP_MA) in the mesh in stead of nodes.

To summarise:

  • initial some parameters
  • read initial mesh
  • define material properties
  • define number of refinement iterations (whether or not fixed)
  • loop through:
  • ...define model
  • ...apply material to model
  • ...apply load to model
  • ...perform calculation
  • ...determine element and node parameters
  • ...(write output data)
  • ...refinement of mesh MACR_ADAP_MAIL

The error estimation is determined in the CALC_ELEM command, by the option 'ERRE_ELEM_SIGM':

result...=CALC_ELEM(....,OPTION=(....,'ERRE_ELEM_SIGM',),);


count = [0,1,2,3]; count0 = count[0];

mesh=[None]*10 model=[None]*10 Amat=[None]*10 result=[None]*10 Load=[None]*10

  1. Define material properties - outside loop

steel=DEFI_MATERIAU(ELAS=_F(E=2.1e5,

                           NU=.28,
                           RHO=0.00785,
                           ALPHA=0.001,),);
  1. Read MED mesh file - outside loop

mesh[count0]=LIRE_MAILLAGE(UNITE=20,

                     FORMAT='MED',
                     #NOM_MED='mesh0',
                     INFO_MED=2,
                     INFO=1,);
  1. starting the refinement loop

for counter in count:

model[counter]=AFFE_MODELE(MAILLAGE=mesh[counter],
                 AFFE=_F(TOUT='OUI',
                         PHENOMENE='MECANIQUE',
                         MODELISATION='3D',),);


#Assign material to mesh
Amat[counter]=AFFE_MATERIAU(MAILLAGE=mesh[counter],
                   AFFE=_F(TOUT='OUI',
                           MATER=steel,),);
# define boundary conditions and loads
# boundary conditions - load
Load[counter]=AFFE_CHAR_MECA(MODELE=model[counter],
                    DDL_IMPO=(_F(GROUP_MA='Afix',
                                 DX=0.0,
                                 DY=0.0,
                                 DZ=0.0,),
                              _F(GROUP_MA='Apres',
                                 DX=0.0,
                                 DY=0.1,
                                 DZ=0.0,),),);
result[counter]=MECA_STATIQUE(MODELE=model[counter],
                    CHAM_MATER=Amat[counter],
                    EXCIT=(_F(CHARGE=Load[counter],),),);


result[counter]=CALC_ELEM(reuse =result[counter],
                MODELE=model[counter],
                RESULTAT=result[counter],
                TOUT='OUI',
                TYPE_OPTION='TOUTES',
                OPTION=('EQUI_ELNO_SIGM','SIEF_ELNO_ELGA','ERRE_ELEM_SIGM',),);
result[counter]=CALC_NO(reuse =result[counter],
              RESULTAT=result[counter],
              OPTION=('EQUI_NOEU_SIGM',),);


unitnumber = 80
IMPR_RESU(FORMAT='MED',
         UNITE=unitnumber,
         RESU=_F(MAILLAGE=mesh[counter],
                 RESULTAT=result[counter],
                 NOM_CHAM=('EQUI_ELNO_SIGM','EQUI_NOEU_SIGM','DEPL',),),);
#IMPR_RESU(FORMAT='MED',
#         UNITE=80,
#         RESU=_F(MAILLAGE=mesh[counter],
#                 RESULTAT=result[counter],
#                 NOM_CHAM=('SIGM_NOEU_DEPL','EQUI_NOEU_SIGM','DEPL','ERRE_ELEM_SIGM',),),);


##========================##
## define mesh refinement ##
##========================##

if (counter<count[len(count)-1]):
  print count, len(count), count[len(count)-1], counter
  counterp1 = counter+1;
  meshcp1=CO('mesh_%d' %counterp1)
  MACR_ADAP_MAIL(MAILLAGE_N=mesh[counter],
              MAILLAGE_NP1=meshcp1,
              ADAPTATION='RAFFINEMENT',
              RESULTAT_N=result[counter],
              INDICATEUR='ERRE_ELEM_SIGM',
              NOM_CMP_INDICA='ERREST',
              CRIT_RAFF_PE=0.20,
              QUALITE='OUI',
              CONNEXITE='OUI',
              TAILLE='OUI',);
  mesh[counter+1] = meshcp1;
  # endif