from sympy import *
init_printing()
t = 20
t
C = 200000/(1-0.26**2) * Matrix([[1, 0.26, 0],
[0.26, 1, 0],
[0, 0, (1-0.26)/2]])
C
N1 = symbols('r')
N1
N2 = symbols('s')
N2
N3 = 1 - symbols('r') - symbols('s')
N3
N = Matrix([[N1, N2, N3]])
N
A = 1.0/2.0
A
x1, y1 = 0, 0
x2, y2 = 250, 0
x3, y3 = 0, 250
x = simplify(N1*x1 + N2*x2 + N3*x3)
x
y = simplify(N1*y1 + N2*y2 + N3*y3)
y
r = -(symbols('x') + symbols('y') - 250)/250
r
s = symbols('x')/250
s
J = Matrix([[diff(x, symbols('r')), diff(y, symbols('r'))],
[diff(x, symbols('s')), diff(y, symbols('s'))]])
J
detJ = det(J)
detJ
M1 = Matrix([[1, 0, 0, 0],
[0, 0, 0, 1],
[0, 1, 1, 0]])
M1
M2 = Matrix([[diff(r, symbols('x')), diff(s, symbols('x')), 0, 0],
[diff(r, symbols('y')), diff(s, symbols('y')), 0, 0],
[0, 0, diff(r, symbols('x')), diff(s, symbols('x'))],
[0, 0, diff(r, symbols('y')), diff(s, symbols('y'))]])
M2
M3 = Matrix([[diff(N1, symbols('r')), 0, diff(N2, symbols('r')), 0, diff(N3, symbols('r')), 0],
[diff(N1, symbols('s')), 0, diff(N2, symbols('s')), 0, diff(N3, symbols('s')), 0],
[0, diff(N1, symbols('r')), 0, diff(N2, symbols('r')), 0, diff(N3, symbols('r'))],
[0, diff(N1, symbols('s')), 0, diff(N2, symbols('s')), 0, diff(N3, symbols('s'))]])
M3
B = M1*M2*M3
B
K = transpose(B)*C*B*detJ*t*A
K.evalf(9)
Elemento 2, página 222 del libro MATLAB Guide to Finite Elements - Peter I. Kattan
t = 25
C = 210000/(1-0.3**2) * Matrix([[1, 0.3, 0],
[0.3, 1, 0],
[0, 0, (1-0.3)/2]])
N1 = symbols('r')
N2 = symbols('s')
N3 = 1 - symbols('r') - symbols('s')
N = Matrix([[N1, N2, N3]])
A = 1.0/2.0
x1, y1 = 0, 0
x2, y2 = 500, 0
x3, y3 = 500, 250
x = simplify(N1*x1 + N2*x2 + N3*x3)
y = simplify(N1*y1 + N2*y2 + N3*y3)
r = -(symbols('x') - 500)/500
s = (symbols('x') - 2*symbols('y'))/500
J = Matrix([[diff(x, symbols('r')), diff(y, symbols('r'))],
[diff(x, symbols('s')), diff(y, symbols('s'))]])
detJ = det(J)
M1 = Matrix([[1, 0, 0, 0],
[0, 0, 0, 1],
[0, 1, 1, 0]])
M2 = Matrix([[diff(r, symbols('x')), diff(s, symbols('x')), 0, 0],
[diff(r, symbols('y')), diff(s, symbols('y')), 0, 0],
[0, 0, diff(r, symbols('x')), diff(s, symbols('x'))],
[0, 0, diff(r, symbols('y')), diff(s, symbols('y'))]])
M3 = Matrix([[diff(N1, symbols('r')), 0, diff(N2, symbols('r')), 0, diff(N3, symbols('r')), 0],
[diff(N1, symbols('s')), 0, diff(N2, symbols('s')), 0, diff(N3, symbols('s')), 0],
[0, diff(N1, symbols('r')), 0, diff(N2, symbols('r')), 0, diff(N3, symbols('r'))],
[0, diff(N1, symbols('s')), 0, diff(N2, symbols('s')), 0, diff(N3, symbols('s'))]])
B = M1*M2*M3
K = transpose(B)*C*B*detJ*t*A
K.evalf(9)