FEM-Course-Matlab/16.几何非线性有限元matlab编程/几何非线性有限元-悬臂梁/elemLength.m

20 lines
409 B
Mathematica
Raw Permalink Normal View History

2024-01-28 16:46:36 +00:00
function L = elemLength(Elem,U)
% Element nodes
Node1 = Elem.n1;
Node2 = Elem.n2;
% Nodal displacements
dx1 = U(Node1.dof(1));
dy1 = U(Node1.dof(2));
dx2 = U(Node2.dof(1));
dy2 = U(Node2.dof(2));
% New nodal coordinates
x1 = Node1.x + dx1;
y1 = Node1.y + dy1;
x2 = Node2.x + dx2;
y2 = Node2.y + dy2;
% Element length
L = norm([x2-x1, y2-y1]);
end