Frame#
Attention
This page shows a preview of the assignment. Please fork and clone the assignment to work on it locally from GitHub
Added in version v2025.2.0: After workshop 2
Solutions additional assignments in text and downloads
Given is the following beam [HansWfDUoTechnology22]:

With:
\(EI = 3000\)
\(q = 12\)
\(EA = \infty\)
Exercise (Frame)
Solve this problem by simplifying the stiffness matrix first.
import matplotlib as plt
import numpy as np
sys.path.insert(1, '/matrixmethod_solution')
import matrixmethod_solution as mm
%config InlineBackend.figure_formats = ['svg']
import numpy as np
import matplotlib as plt
import matrixmethod as mm
%config InlineBackend.figure_formats = ['svg']
#YOUR_CODE_HERE
Solution to Exercise (Frame)
mm.Node.clear()
mm.Element.clear()
EI = 3000
q = -12
nodes = []
nodes.append(mm.Node(0,0))
nodes.append(mm.Node(0,-2))
nodes.append(mm.Node(0,-5))
nodes.append(mm.Node(4,0))
nodes.append(mm.Node(4,-2))
elems = []
elems.append(mm.Element(nodes[0], nodes[1]))
elems.append(mm.Element(nodes[1], nodes[2]))
elems.append(mm.Element(nodes[3], nodes[4]))
elems.append(mm.Element(nodes[4], nodes[1]))
elems.append(mm.Element(nodes[4], nodes[2]))
section = {}
section['EI'] = EI
for elem in elems:
elem.set_section (section)
elems[4].add_distributed_load([0,q])
con = mm.Constrainer()
con.fix_dof (nodes[0], 0)
con.fix_dof (nodes[0], 1)
con.fix_dof (nodes[1], 0)
con.fix_dof (nodes[2], 0)
con.fix_dof (nodes[3], 0)
con.fix_dof (nodes[3], 1)
print(con)
for elem in elems:
print(elem)
global_k = np.zeros ((3*len(nodes), 3*len(nodes)))
global_f = np.zeros (3*len(nodes))
for e in elems:
elmat = e.stiffness()
idofs = e.global_dofs()
global_k[np.ix_(idofs,idofs)] += elmat
for n in nodes:
global_f[n.dofs] += n.p
Kff, Ff = con.constrain ( global_k, global_f )
u = np.matmul ( np.linalg.inv(Kff), Ff )
print(u)
print(con.support_reactions(global_k,u,global_f))
This constrainer has constrained the degrees of freedom: [0, 1, 3, 6, 9, 10] with corresponding constrained values: [0, 0, 0, 0, 0, 0])
Element connecting:
node #1:
This node has:
- x coordinate=0,
- z coordinate=0,
- degrees of freedom=[0, 1, 2],
- load vector=[0. 0. 0.]
with node #2:
This node has:
- x coordinate=0,
- z coordinate=-2,
- degrees of freedom=[3, 4, 5],
- load vector=[0. 0. 0.]
Element connecting:
node #1:
This node has:
- x coordinate=0,
- z coordinate=-2,
- degrees of freedom=[3, 4, 5],
- load vector=[0. 0. 0.]
with node #2:
This node has:
- x coordinate=0,
- z coordinate=-5,
- degrees of freedom=[6, 7, 8],
- load vector=[-18. 24. -25.]
Element connecting:
node #1:
This node has:
- x coordinate=4,
- z coordinate=0,
- degrees of freedom=[9, 10, 11],
- load vector=[0. 0. 0.]
with node #2:
This node has:
- x coordinate=4,
- z coordinate=-2,
- degrees of freedom=[12, 13, 14],
- load vector=[-18. 24. 25.]
Element connecting:
node #1:
This node has:
- x coordinate=4,
- z coordinate=-2,
- degrees of freedom=[12, 13, 14],
- load vector=[-18. 24. 25.]
with node #2:
This node has:
- x coordinate=0,
- z coordinate=-2,
- degrees of freedom=[3, 4, 5],
- load vector=[0. 0. 0.]
Element connecting:
node #1:
This node has:
- x coordinate=4,
- z coordinate=-2,
- degrees of freedom=[12, 13, 14],
- load vector=[-18. 24. 25.]
with node #2:
This node has:
- x coordinate=0,
- z coordinate=-5,
- degrees of freedom=[6, 7, 8],
- load vector=[-18. 24. -25.]
[-2.02922078e-04 3.83964131e-19 4.05844156e-04 8.44244743e-19
-4.59956710e-03 -1.51064214e-03 -6.05949804e-19 5.76035869e-19
3.02128427e-03]
[ -0.91314935 -19.19820656 24.44934034 19.26169862 -6.79788961
-28.80179344]
for elem in elems:
u_elem = con.full_disp(u)[elem.global_dofs()]
elem.plot_displaced(u_elem,num_points=51,global_c=True,scale=40)
for elem in elems:
u_elem = con.full_disp(u)[elem.global_dofs()]
elem.plot_moment_diagram(u_elem,num_points=51,global_c=True,scale=0.08)