a mechanical engineering toolbox
source code - https://github.com/nagordon/mechpy
documentation - https://nagordon.github.io/mechpy/web/
Neal Gordon
2017-02-20
This a collection of notes, examples and boilerplate code to understand fem.
# setup
import numpy as np
import sympy as sp
import scipy
from pprint import pprint
sp.init_printing(use_latex='mathjax')
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (12, 8) # (width, height)
plt.rcParams['font.size'] = 14
plt.rcParams['legend.fontsize'] = 16
from matplotlib import patches
get_ipython().magic('matplotlib') # seperate window
get_ipython().magic('matplotlib inline') # inline plotting
import os ; os.chdir('..') # change to root from the examples folder
from mechpy.fem import cst_fem
The element connectivty is used to assemble the global stiffness matrix, the nodal force matrix, and the displacement matrix
The minimization of the potentail energy is used to solve the global equation once the boundary conditions are applied to prevent rigid body motion
$ \{F\} = [K]\{U\} $
where
$ \{F\}=nodal\ force\ matrix $
$ [K] = global\ stiffness\ matrix $
$ \{U\} = nodal\ displacement\ matrix $
Once the displacements, U are computed, the strain, $\bar{\varepsilon}$ is calcualted
with $\{\varepsilon\}=[B]\{U\}$
where
$[B]=strain-displacement\ matrix$
and stresses, $\bar{\sigma}$ are determined via Hookes Law and
$\{\sigma\}=[C]\{\varepsilon\}$
where
$[C] = compliance\ matrix$
cst_fem(structure='9node')