<jupyter_start><jupyter_text>- - - - Mechpy Tutorialsa mechanical engineering toolboxsource code - https://github.com/nagordon/mechpy  documentation - https://nagordon.github.io/mechpy/web/  - - - -<NAME>  2017-02-20  - - - - Finite Element Method- - - -This a collection of notes, examples and boilerplate code to understand fem. [Finite Element Method](Finite-Element-Method)* [solids FEM example](FEM-Example-1)  - - - -  Python Initilaization with module imports<jupyter_code># 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<jupyter_output><empty_output><jupyter_text>Finite-Element-Method[index](Mechpy) The element connectivty is used to assemble the global stiffness matrix, the nodal force matrix, and the displacement matrixThe 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$  FEM-Example-1<jupyter_code>cst_fem(structure='9node')<jupyter_output>plane stress condition
{'fraction_non_alphanumeric': 0.13027229044313934, 'fraction_numerical': 0.009610250934329953, 'mean_word_length': 4.819875776397516, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '616078', 'license': 'MIT', 'n_tokens_mistral': 613, 'n_tokens_neox': 581, 'n_words': 177, 'path': 'tutorials/fem.ipynb', 'repo_name': 'nagordon/mechpy', 'size': '1878'}