This page was generated from
docs\source\gallery/timoshenko_matplotlib.ipynb.
Plotting linear static analysis results for beams#
[1]:
import numpy as np
import matplotlib.pyplot as plt
from sigmaepsilon.solid.fourier import LoadGroup, PointLoad, LineLoad
from sigmaepsilon.solid.fourier import NavierBeam
L = 1000.0 # geometry
w, h = 20.0, 80.0 # rectangular cross-section
E, nu = 210000.0, 0.25 # material
I = w * h**3 / 12
A = w * h
EI = E * I
G = E / (2 * (1 + nu))
GA = G * A * 5 / 6
loads = LoadGroup(
concentrated=LoadGroup(
LC1=PointLoad(L / 2, [1.0, 0.0]),
LC5=PointLoad(L / 2, [0.0, 1.0]),
),
distributed=LoadGroup(
LC2=LineLoad([0, L], [1.0, 0.0]),
LC6=LineLoad([L / 2, L], [0.0, 1.0]),
LC3=LineLoad([L / 2, L], ["x", 0]),
),
)
loads.lock() # to protect agains typos
x = np.linspace(0, L, 500) # evaluate in 500 points
beam = NavierBeam(L, 100, EI=EI, GA=GA)
solution = beam.linear_static_analysis(loads, x)
labels = [r"$v$", r"$\theta$", r"$\kappa$", r"$\gamma$", r"$M$", r"$V$"]
colors = ["b", "b", "g", "g", "r", "r"]
plt.rcParams.update(
{
"text.usetex": True,
"font.family": "sans-serif",
}
)
def plot(x, res):
fig, axs = plt.subplots(6, 1, figsize=(4, 6), dpi=200, sharex=True)
for i in range(len(labels)):
axs[i].plot(x, res[:, i], colors[i])
axs[i].set_xlabel("$x$")
axs[i].set_ylabel(labels[i])
plt.subplots_adjust(hspace=0.1)
fig.tight_layout()
# plot the results for the point load at the middle
plot(x, solution["concentrated", "LC1"].values) # try the others too