Python 1D FEM Example 1

January 12, 2017 by Ritchie Vink

fem

Example 1: Framework

Simple code example for anaStruct.

view

# if using ipython notebook
%matplotlib inline

from anastruct.fem.system import SystemElements

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

# Add beams to the system.
ss.add_element(location=[[0, 0], [3, 4]], EA=5e9, EI=8000)
ss.add_element(location=[[3, 4], [8, 4]], EA=5e9, EI=4000)

# get a visual of the element IDs and the node IDs
ss.show_structure()

# add loads to the element ID 2
ss.q_load(element_id=2, q=-10)

# add hinged support to node ID 1
ss.add_support_hinged(node_id=1)

# add fixed support to node ID 2
ss.add_support_fixed(node_id=3)

# solve
ss.solve()

# show the structure
ss.show_structure()

# show the reaction forces
ss.show_reaction_force()

# show the axial forces
ss.show_axial_force()

# show the shear force
ss.show_shear_force()

# show the bending moment
ss.show_bending_moment()

# show the displacements
ss.show_displacement()

(c) 2020 Ritchie Vink.