<jupyter_start><jupyter_text><jupyter_code>import numpy as np
np.set_printoptions(precision=2)
t = 2
E = 6e6
mu = 0.25
alpha = 7e-6
P = 20
Nodes = np.array([[0.,0.],[2.,0.],[1.,3.]])
Nodes
b = np.roll(Nodes[:,1], -1) - np.roll(Nodes[:,1], 1)
b
c = np.roll(Nodes[:,0], 1) - np.roll(Nodes[:,0], -1)
c
A = 0.5*np.cross(Nodes[1]-Nodes[0], Nodes[2]-Nodes[0])
A
B = np.array([[b[0], 0., b[1], 0., b[2], 0.],
              [0., c[0], 0., c[1], 0., c[2]],
              [c[0], b[0], c[1], b[1], c[2], b[2]]]) / (2*A)
B
D = E/(1-mu**2)*np.array([[1, mu, 0],
                          [mu, 1, 0],
                          [0, 0, (1-mu)/2]])
D
Ke = B.T@D@B*t*A
Ke / 133330
dof = np.array([0,1,3])
Ke[dof] = 0
Ke[:,dof] = 0
Ke[dof,dof] = 1
Ke
import matplotlib.pyplot as plt
plt.spy(Ke)
L21 = np.linalg.norm(Nodes[2]-Nodes[1])
L21
F21 = P*L21*t
F21
cost = Nodes[2,1]/L21
sint = (Nodes[1,0]-Nodes[2,0])/L21
cost, sint
F = np.zeros(Nodes.shape[0]*2)
F
F[[2,3]] = 0.5*F21*np.array([sint, cost])
F[[4,5]] = 0.5*F21*np.array([sint, cost])
F
F[dof] = 0
F
U = np.linalg.solve(Ke, F)
U
NewNodes = Nodes + 1e4*U.reshape(-1,2)
plt.triplot(Nodes[:,0], Nodes[:,1], [[0,1,2]], color='b')
plt.triplot(NewNodes[:,0], NewNodes[:,1], [[0,1,2]], color='r')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2824184566428003, 'fraction_numerical': 0.09785202863961814, 'mean_word_length': 3.2935153583617747, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '128719', 'license': 'MIT', 'n_tokens_mistral': 692, 'n_tokens_neox': 652, 'n_words': 124, 'path': 'p223_2019.ipynb', 'repo_name': 'BoberSA/FEMCourse', 'size': '1257'}