Sie sind auf Seite 1von 2

27/06/19 13.56 C:\Users\user\Desktop\F...\assembler.

m 1 of 2

function [ ...
... % equivalent nodal load, stiffness
F, K] = assembler( ...
... % data relative to nodes and nodal loads
n_n, coor_n, load_n, ...
... % data relative to element materials
tab_mat, ...
... % data relative to element and element loads
element, n_el, conn, mat, load)

% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% initialization
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

% global number of degrees of freedom


n_dof = 3*n_n;

% equivalent nodal load


F = zeros(n_dof,1);

% stiffness matrix
K = zeros(n_dof,n_dof);

% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% elements
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

% cycle on elements
for el = 1:n_el

% element node
conn_el = conn(:,el);

% coordinates of element nodes in global frame


coor_el = coor_n(:, conn_el);

% element dof in global numbering


dof_el = [3*conn_el-2, 3*conn_el-1, 3*conn_el]';
dof_el = dof_el(:);

% element material
mat_el = tab_mat(:,mat(el));

% element distributed loads in local reference


load_el = load(:,el);

% global to local rotation matrix


[R_el] = geometry(coor_el);

% element routine
[... % material stiffness matrix,
27/06/19 13.56 C:\Users\user\Desktop\F...\assembler.m 2 of 2

K_el, ...
... % nodal forces equivalent to applied loads,
f_l] = feval(element, ...
... % nodal coordinates,
coor_el, ...
... % applied loads,
load_el, ...
... % material parameters,
mat_el);

% Equivalent nodal load vector and stiffness matrix are given in


% element reference frame.
% Before being assembled, they must be converted to global frame
f_l = R_el' * f_l;
K_el = R_el' * K_el * R_el;

% assemble global stiffness matrix


K(dof_el, dof_el) = K(dof_el, dof_el)+ K_el;

% assemble global nodal forces equivalent to applied loads


F(dof_el) = F(dof_el) + f_l;

end
% aggiunta del vincolo molla
K_molla= 10000; % [kN/m]
% posta verticalmente al nodo 5
K(14,14)= K(14,14) + K_molla;

% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% contribution of nodal forces and couples
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

% equivalent nodal load


% nodal load contribution
F = F + load_n(:);

end

Das könnte Ihnen auch gefallen