Truss elements

A two-dimensional truss element carries axial load while its orientation maps that axial behavior into global x and y directions. Each node contributes ux and uy displacement DOFs, with corresponding fx and fy forces.

Use nusa.model.TrussModel with nusa.element.Truss.

Element properties

A truss receives reusable material and section objects. Its formulation requires Young’s modulus E from the material and cross-sectional area A from the section:

material = Material(E=30e6)
section = Section(A=2.0)

element = Truss(
    (n1, n2),
    material=material,
    section=section,
)

Its canonical result contains:

axial_force
axial_stress

Example: three-member truss

The following example builds a three-member planar truss, applies a vertical load, visualizes the problem definition, solves it, and plots the deformed shape.

 1# -*- coding: utf-8 -*-
 2# ***********************************
 3#  Author: Pedro Jorge De Los Santos
 4#  E-mail: delossantosmfq@gmail.com
 5#  License: MIT License
 6# ***********************************
 7
 8import matplotlib.pyplot as plt
 9
10from nusa import Material, Node, Section, Truss, TrussModel, plot_model
11
12
13def build_model():
14    """Build Logan's three-member truss example."""
15    E = 30e6
16    A = 2.0
17    P = 10e3
18
19    material = Material(E=E)
20    section = Section(A=A)
21
22    model = TrussModel("Truss Model")
23    n1 = Node((0.0, 0.0))
24    n2 = Node((0.0, 120.0))
25    n3 = Node((120.0, 120.0))
26    n4 = Node((120.0, 0.0))
27
28    model.add_nodes([n1, n2, n3, n4])
29    model.add_elements([
30        Truss((n1, n2), material=material, section=section),
31        Truss((n1, n3), material=material, section=section),
32        Truss((n1, n4), material=material, section=section),
33    ])
34    model.add_force(n1, (0.0, -P))
35    model.add_constraint(n2, ux=0.0, uy=0.0)
36    model.add_constraint(n3, ux=0.0, uy=0.0)
37    model.add_constraint(n4, ux=0.0, uy=0.0)
38    return model
39
40
41def main():
42    model = build_model()
43    plot_model(model)
44
45    result = model.solve()
46    result.plot_deformed_shape()
47    plt.show()
48
49
50if __name__ == "__main__":
51    main()

Problem and solved visualization

The undeformed problem definition is visualized from the model:

from nusa import plot_model

plot_model(model)

The solved shape is visualized from the result:

result = model.solve()
result.plot_deformed_shape()

Important result queries

Nodal displacement:

result.displacement(n1)

Support reaction:

result.reaction(n2)

Axial member response:

result.element_result(model.elements[0])["axial_force"]

The model stores geometry and supports; the StaticResult stores the solved state used for deformation plots and member forces.