Python 1D FEM Example 2

February 12, 2017 by Ritchie Vink

fem

Example 2: Truss framework

Simple code example for anaStruct.

view

# if using ipython notebook
%matplotlib inline

import math
from anastruct.fem.system import SystemElements

# Create a new system object.
ss = SystemElements(EA=5000)

# Add beams to the system.
ss.add_truss_element(location=[[0, 0], [0, 5]])
ss.add_truss_element(location=[[0, 5], [5, 5]])
ss.add_truss_element(location=[[5, 5], [5, 0]])
ss.add_truss_element(location=[[0, 0], [5, 5]], EA=5000 * math.sqrt(2))

# get a visual of the element ID's and the node ID's
ss.show_structure()

structure_2

# add hinged supports at node ID 1 and node ID 2
ss.add_support_hinged(node_id=1)
ss.add_support_hinged(node_id=4)


# add point load at node ID 2
ss.point_load(Fx=10, node_id=2)

# show the structure
ss.show_structure()

structure_2

# solve
ss.solve()
# show the reaction forces
ss.show_reaction_force()

# show the normal force
ss.show_axial_force()

ss.show_displacement()

(c) 2020 Ritchie Vink.