Kinematics

import ema as em
import matplotlib.pyplot as plt
import numpy as np
import sympy as sp
%config InlineBackend.figure_format = 'svg'
import scipy.linalg as la
mdl = em.Model(2,3)
n = mdl.dnodes
e = mdl.delems

mdl.node('1', 0.0, 0.0)
mdl.node('2', 0.0, 5.0)
mdl.node('3', 4.0, 5.0)
mdl.node('4', 8.0, 5.0)
mdl.node('5', 8.0, 0.0)
mdl.node('6', 8.0, 10.)

mdl.beam('a', n['1'], n['2'])
mdl.beam('b', n['2'], n['3'])
mdl.beam('c', n['3'], n['4'])
mdl.truss('d', n['4'], n['5'])
mdl.beam('e', n['4'], n['6'])

mdl.hinge(e['a'], n['1'])
mdl.hinge(e['c'], n['3'])
mdl.hinge(e['e'], n['6'])

mdl.fix(n['1'], ['x','y','rz'])
mdl.fix(n['5'], ['x','y','rz'])
mdl.fix(n['6'], ['x','y','rz'])

mdl.numDOF()
em.analysis.characterize(mdl)
m = 1
s = 2
fig, ax = plt.subplots()
em.plot_structure(mdl, ax)
svg
A = em.A_matrix(mdl)
A.f
$1$ $2$ $3$ $4$ $5$ $6$ $7$ $8$ $9$
$a_1$ 0.0 1.00 0.0 0.0 0.00 0.0 0.0 0.00 0.0
$a_2$ 0.2 -0.00 0.0 0.0 0.00 0.0 0.0 0.00 0.0
$a_3$ 0.2 -0.00 1.0 0.0 0.00 0.0 0.0 0.00 0.0
$b_1$ -1.0 -0.00 0.0 1.0 0.00 0.0 0.0 0.00 0.0
$b_2$ -0.0 0.25 1.0 0.0 -0.25 0.0 0.0 0.00 0.0
$b_3$ -0.0 0.25 0.0 0.0 -0.25 1.0 0.0 0.00 0.0
$c_1$ 0.0 0.00 0.0 -1.0 -0.00 0.0 1.0 0.00 0.0
$c_2$ 0.0 0.00 0.0 -0.0 0.25 1.0 0.0 -0.25 0.0
$c_3$ 0.0 0.00 0.0 -0.0 0.25 0.0 0.0 -0.25 1.0
$d_1$ 0.0 0.00 0.0 0.0 0.00 0.0 -0.0 1.00 0.0
$e_1$ 0.0 0.00 0.0 0.0 0.00 0.0 -0.0 -1.00 0.0
$e_2$ 0.0 0.00 0.0 0.0 0.00 0.0 -0.2 0.00 1.0
$e_3$ 0.0 0.00 0.0 0.0 0.00 0.0 -0.2 0.00 0.0
ker = A.c.ker
ker = ker.round(6)/ker[0]
ker
$1$
$1$ 1.000001
$2$ -0.000000
$3$ -0.200000
$4$ 1.000001
$5$ -0.799999
$6$ -0.200000
$7$ 1.000001
$8$ 0.000000
$9$ 0.200000
em.plot_U(mdl, ker, ax, scale=1)
svg