Contrib:KeesWouters/beam/orientation

From CAELinuxWiki
Revision as of 17:20, 2 January 2011 by Keeswouters (Talk | contribs) ('''Define the orientation of the beam by a Python list''')

Jump to: navigation, search

Static displacement of a single beam on point load

januari 2011 - SalomeMeca 2010 (Code Aster 10.2) - Ubuntu Meerkat 10.10 64bits.

Define orientation of beam elements by Python list

If you are already familiar to Code Aster, enjoy this. Otherwise start with a less complicated example, eg have a look here first please.

Geometry, mesh and material properties

This is just a simple example of the use of beams for static calculations. The main focus is on varying orientation of the beam by a Python list. The orientation of the beams depend on the x coordinate of the beam element. The cross section of the beams is a rectangle defined by HY, HZ and EP, ie the height in y and z direction and the wall thickness respectively. Length of the beam is 1.41 [m].
The boundary conditions are: fully clamped at x = 0, free at the opposite end.

The mesh consists of about thirty beam elements distributed along the x axis. This has the curious effect that the coordinates of the nodes are defined by a single coordinate. Mind that you need to adapt the code in case of two or three dimensional coordinates (see define_beam_orient).

General way to define the orientation of the beam

The geometry and mesh are generated in Salome in the standard way. In Code Aster the mesh is read, including nodes number, node coordinates, element types and element connectivity. We use linear seg2 elements for the beams.
Of each element we can

  • determine the nodes by the connectivity matrix,
  • determine the x coordinates of the nodes and
  • generate the orientation of the beam

by Python commands.

Kw beam mesh1.jpg


Define a beam element by standard commands

After reading the mesh file the following two commands define the beam elements in a standard way:

#Assign to the Model
BeamMod=AFFE_MODELE(MAILLAGE=BeamMesh,
                   AFFE=_F(##TOUT='OUI',
                           GROUP_MA='beam1',
                           PHENOMENE='MECANIQUE',
                           MODELISATION='POU_D_T',),);
#Characteristics of Elements, now combined
Beam1=AFFE_CARA_ELEM(MODELE=BeamMod,
                     POUTRE=(_F(GROUP_MA='beam1',
                               SECTION='RECTANGLE',
                               CARA=('HY','HZ','EP',),
                               VALE=(0.0200,0.0100,0.0025,),),),
                     ORIENTATION=(_F(GROUP_MA='beam1',
                                    CARA='VECT_Y',
                                    VALE=(0.0,0.0,1.0,),),),)

The first command AFFE_MODELE(...) defines a beam model 'POU_D_T' for a the seg2 elements in the group GROUP_MA='beam1'.
The second command AFFE_CARA_ELEM defines the geometrical quantities of the beam: in this case a rectangular cross section with width HY and height HZ. The wall thickness is defined by EP. The orientation of the beam is defined by the ORIENTATION parameter for all beams of GROUP_MA='beam1'. We define the local y vector by CARE='VECT_Y' and the vector VALE=(0.0,0.0,1.0). Note that the local x axis is defined by the axial direction of the beam (X = (P2-P1) where P1 and P1 are the nodes of the beam). The projection of the vector VECT_Y (with VALE=[vx,vy,vz]) defines the local y axis of the beam. Then of course the local z axis is defined as well.

Define the orientation of the beam by a Python list

The part of the command

 AFFE_CARA_ELEM(MODELE(.....
                       ORIENTATION=(_F(GROUP_MA='beam1',
                                       CARA='VECT_Y',
                                       VALE=(0.0,0.0,1.0,),),),)

can be caught in a Python list as follows:

OrientBeam = ({'MAILLE': 'M1',  'CARA': 'VECT_Y', 'VALE': [0.0, y_vy, z_vy]})

where GROUP_MA is replaced by 'MAILLE' and the remaining parameters are identical. The y and z components of vector VECT_Y depend on the position of the beam. For the complete list we have in this case:

OrientBeam:
 [{'MAILLE': 'M1', 'CARA': 'VECT_Y', 'VALE': [0.0, 0.64738628478182769, 0.76216205512763646]}, 
  {'MAILLE': 'M2', 'CARA': 'VECT_Y', 'VALE': [0.0, 0.41988910156026477, 0.90757541967095701]}, 
  ....

{'MAILLE': 'M28', 'CARA': 'VECT_Y', 'VALE': [0.0, 0.88351204444602294, 0.46840844069979015]}, {'MAILLE': 'M29', 'CARA': 'VECT_Y', 'VALE': [0.0, 0.37013815533991457, 0.92897671981679142]}]

In 'pseudo' Python code:

## define mesh quantities
meshCA   = MAIL_PY()
meshCA.FromAster(mesh);
nonu     = meshCA.dime_maillage[0]
elnu     = meshCA.dime_maillage[2]
ncoord   = meshCA.cn
connect  = meshCA.co
...
for ii in xrange(len(ElemList)):
      Gnode = connect[ii][jj] 
      ...
      phase = math.pi/2.0*ncoord[Gnode]/xmax
      print 'phase: ',phase
      Yvy = math.cos(phase)
      Zvy = math.sin(phase)
      ...
      vy = [0.000000, Yvy, Zvy]
      OrientBeam.append({'CARA':'VECT_Y','VALE':vy,'MAILLE':'M%d'%(ii+1)});