# Basic Truss Example
__NOTOC__ This example is of a linear-elastic three bar truss, as shown in the figure, subject to static loads. Here is the file: Truss.tcl
NOTE:
The model consists of four nodes, three truss elements, a single load pattern with a load acting at node 4, and constraints fixing the movement at the other three nodes in the model. As each Truss element has the same Young's Modulus, a single elastic material is created.
<pre>
wipe
model BasicBuilder -ndm 2 -ndf 2
node 1 0.0 0.0 node 2 144.0 0.0 node 3 168.0 0.0 node 4 72.0 96.0
fix 1 1 1 fix 2 1 1 fix 3 1 1
uniaxialMaterial Elastic 1 3000
element Truss 1 1 4 10.0 1 element Truss 2 2 4 5.0 1 element Truss 3 3 4 5.0 1
timeSeries Linear 1
pattern Plain 1 1 {
load 4 100 -50 } </pre>
We will now show the commands to perform a static analysis using a linear solution algorithm 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 advances the solution. The equations are formed using a banded system so the System is BandSPD, banded symmetric positive definite This is a good choice for most small size models. The equations have to be numbered so the widely used RCM (Reverse Cuthill-McKee) numberer is used. The constraints are most easily represented with a Plain constraint handler. Once all the components of an analysis are defined, the Analysis object itself is created. For this problem, a Static Analysis object is used.
<pre>
system BandSPD
numberer RCM
constraints Plain
integrator LoadControl 1.0
algorithm Linear
analysis Static </pre>
For this analysis, we will record the displacement at node 4, and all the element forces expressed both in the global coordinate system and the local system.
<pre>
recorder Node -file example.out -time -node 4 -dof 1 2 disp
recorder Element -file eleGlobal.out -time -ele 1 2 3 forces recorder Element -file eleLocal.out -time -ele 1 2 3 basicForces </pre>
After the objects for the model, analysis and output has been defined we now perform the analysis.
<pre> analyze 1 </pre>
In addition to using recorders, it is possible to specify output using the print and puts commands. When no file identifiers are provided, these commands will print results to the screen.
<pre> puts "node 4 displacement: [nodeDisp 4]" print node 4 print element </pre>
When you run this script, you should see the following printed to the screen:
In addition, your directory should contain the following 3 files with the data shown: