Example 1: Linear Truss
6 min read • 1,082 wordsA finite element model of a simple truss is created, and static analysis is performed.
This example is of a linear-elastic three bar truss, as shown in the figure above, subject to static loads. The purpose of this example is to develop the basic requirements for performing finite element analysis with OpenSees. This includes the definition of nodes, materials, elements, loads and constraints.
Scripts for this example can be downloaded for either Python or Tcl:
We begin the simulation by creating a Model
, which will manage
the nodes, elements, loading and state. This is done through
either Python or Tcl as follows:
where we’ve specified
2
for the spatial dimension ndm
, and
2
for the number of degrees of freedom ndf
.
Next we define the four nodes of the structural model by specifying
a tag which identifies the node, and coordinates in the
plane.
In general, the node
constructor must be passed ndm
coordinates.
The restraints at the nodes with reactions (ie, nodes 1
, 2
, and 3
)
are then defined.
Since the truss elements have the same elastic material,
a single Elastic material object is created. The first
argument assigns the tag 1
to the material, and the
second specifies a Young’s modulus of 3000
.
Finally, define the elements. The syntax for creating the truss element requires the following arguments:
"Truss"
,1
through 3
,10.0
for element 1
and 5.0
for elements 2
and 3
.1
The final step before we can configure and run the analysis is to define
some loading. In this case we have two point loads at the apex of
the truss (node 4
).
In OpenSees, loads are assigned to load patterns, which define how loads
are scaled with each load step.
In Python, the simplest way to represent a nodal load is by a dictionary with
node numbers as keys, and corresponding load vector as values. For the problem at
hand, we want to apply a load to node 4
with 100
units in the
direction, and
-50
units in the
direction; the corresponding definition is:
We then add a "Plain"
load pattern to the model with these loads,
and use the "Linear"
option
to specify that it should be increased linearly with each new load step.
Note that it is common to define the
load
data structure inside the call to thepattern
function. This looks like:
Next we configure that analysis procedure.
The model is linear, so we use a solution Algorithm of type Linear
.
Even though the solution is linear, we have to select a procedure for
applying the load, which is called an Integrator
.
For this problem, a LoadControl
integrator is selected, which
advances the solution by incrementing the applied loads by a
factor of 1.0
each time the analyze
command is called.
The equations are formed
using a banded system, so the System is BandSPD
(banded, symmetric
positive definite). This is a good choice for most moderate size models.
The equations have to be numbered, so typically an RCM numberer object
is used (for Reverse Cuthill-McKee).
The constraints are most easily represented with a Plain
constraint handler.
Once all the components of an analysis are defined, the Analysis
itself is defined. For this problem a Static
analysis is used.
Finally, one analysis step is performed by invoking analyze
:
When the analysis is complete the state of node 4
and all three elements
may be printed to the screen:
Node: 4
Coordinates : 72 96
commitDisps: 0.530093 -0.177894
unbalanced Load: 100 -50
Element: 1 type: Truss iNode: 1 jNode: 4 Area: 10 Total Mass: 0
strain: 0.00146451 axial load: 43.9352
unbalanced load: -26.3611 -35.1482 26.3611 35.1482
Material: Elastic tag: 1
E: 3000 eta: 0
Element: 2 type: Truss iNode: 2 jNode: 4 Area: 5 Total Mass: 0
strain: -0.00383642 axial load: -57.5463
unbalanced load: -34.5278 46.0371 34.5278 -46.0371
Material: Elastic tag: 1
E: 3000 eta: 0
Element: 3 type: Truss iNode: 3 jNode: 4 Area: 5 Total Mass: 0
strain: -0.00368743 axial load: -55.3114
unbalanced load: -39.1111 39.1111 39.1111 -39.1111
Material: Elastic tag: 1
E: 3000 eta: 0
For the node, displacements and loads are given. For the truss elements, the axial strain and force are provided along with the resisting forces in the global coordinate system.
The file example.out
, specified in the recorder command, provides
the nodal displacements for the
and
directions of node 4
. The file
consists of a single line:
1.0 0.530093 -0.177894
The
corresponds to the load factor (pseudo time) in the model at
which point the recorder was invoked. The
and
correspond to the response at node 4
for the 1 and 2
degree-of-freedom. Note that if more analysis steps had been performed,
the line would contain a line for every analysis step that completed
successfully.