Tutorial2 Vibr String
Tutorial2 Vibr String
The future division statement (line 1) change, throughout the module, the /
operator to mean true division instead of returning the floor of the mathematical
result of division when the arguments are ints or longs (transitional measure
from Python 2.x to the standard meaning in Python 3.0).
The math module (line 2) provides access to several mathematical functions
(floor, exp, sqrt, cos, sin . . . ).
The following three lines correspond with three main modules of XC :
• xc_base: includes the basic functions for the Python interface: assign and
retrieve properties stored in the C++ classes (see example test_evalPy.py)
and execute Python scripts (see example test_execPy.py).
• geom: handles entities related to geometry, like points, lines, polylines,
planes, polygons, circles, coordinate systems, grids, vectors, matrices, ro-
tations, translations, . . .
• xc: this module provides access to the finite element classes and functions:
mesh generation, element type and material definition, analysis, . . .
Import statements in lines 6-7 have to do with the following modules:
• predefined_spaces: this module is intended to set the dimension of the
space and the number of nodal DOF, as well as to introduce constraints
to them.
• typical_materials: several often-used materials are predefined in this
module: elastic uniaxial with or without tension branch, prestressed cable,
concrete, steel, . . .
Definition of the element type. The type of element used lately to mesh
the model is defined in lines 20 to 25. It is a two-dimensional co-rotational
truss, allowed to have large displacements and rotations at the global level by
means of the co-rotational formulation. This formulation seeks to separate rigid
body motions (rotation and translation) from strain producing deformations at
the local element level. A co-rotating frame is attached to the truss with origin
at its first node and x-axis directed along the element. This local coordinate
system translates and rotates with the truss, so that with respect to it only local
strain producing deformations along the x-axis remains.
20 se edEl emHa ndle r = preprocessor . g e t E l e m e n t H a n d l e r .
see dEl emHa ndle r
21 se edEl emHa ndle r . d efa ultM ater ial = " cable "
22 se edEl emHa ndle r . dimElem = 2 # Dimension of element space
23 se edEl emHa ndle r . defaultTag = 1 #Tag for the next element.
24 truss = seed Ele mHan dler . newElement ( " CorotTruss " , xc . ID ([0 ,0]) )
25 truss . area = area
Listing 5: Element type.
Definition of the points and lines. Two points and the line joining them
is created in lines of code 26 to 31.
26 points = preprocessor . g e t M u l t i B l o c k T o p o l o g y . getPoints
27 pt1 = points . newPntIDPos3d (1 , geom . Pos3d (0.0 ,0.0 ,0.0) )
28 pt2 = points . newPntIDPos3d (2 , geom . Pos3d (l ,0.0 ,0.0) )
29 lines = preprocessor . g e t M u l t i B l o c k T o p o l o g y . getLines
30 lines . defaultTag = 1
31 l = lines . newLine ( pt1 . tag , pt2 . tag )
Listing 6: Points and lines.
Meshing The line created is meshed using the type of element defined in
listing 5 and set as default. The number of elements created is given by the
number of divisions in the line, defined by means of its attribute nDiv.
33 l . nDiv = NumDiv
34 l . genMesh ( xc . meshDir . I )
Listing 7: Mesh.
In line of code number 46, the solution algorithm is defined. That algorithm
determines the sequence of steps taken to solve the non-linear equation; for this
case the well-known Newton-Raphson method is applied, i.e. the set of nonlinear
equations is locally linearized and solved. If the solution does not satisfy the
original nonlinear equations, the latter are again linearized at the new solution.
Review results of static analysis. We ask one element of the string its
stress and axial internal force.
57 elements = preprocessor . g e t E l e m e n t H a n d l e r
58 ele1 = elements . getElement (1)
59 tension = ele1 . getN ()
60 sigma = ele1 . getMaterial () . getStress ()
61 print " stress = " , sigma
62 print " tension = " , tension
Listing 10: Results static analysis.
σ = Es × 0 = 1050e6P a
The natural frequencies for a string under conditions such as those in this ex-
ample, can be obtained by:
s
n T
fn = , n = 1, 2, 3, · · ·
2L ρ
s
T
By applying this equation for n= 1,2,3 with = 365.7 m/s, we obtain
ρs
the exact value of the first three frequencies:
1
f1 = c = 91.432Hz
2L
2
f2 = c = 182.865Hz
2L
3
f3 = c = 274.297Hz
2L
that must coincide, approximately, with the three values obtained from the
eigenanalysis.