Commit 19545341 authored by Turnhout, M.C. van's avatar Turnhout, M.C. van
Browse files

further cleaning

parent 945397c0
......@@ -10,16 +10,14 @@ disp('* create equation numbers ...');
% global K and f
disp('* start of matrix-building process ...')
% ndof: the total number of degrees of freedom
ndof = max(dest(:));
% initialize q and rhs;
% K: the global stiffness matrix (spalloc allocated space for a sparse matrix)
% rhs: the global right-hand-side matrix
% initialize
ndof = max(dest(:)); % the total number of degrees of freedom
ldof = length(pos(1, :));
K = spalloc(ndof, ndof, sum(ldof)^2);
rhs = zeros(ndof,1);
% global stiffness matrix (spalloc allocated space for a sparse matrix)
K = spalloc(ndof, ndof, sum(ldof)^2);
rhs = zeros(ndof, 1); % global right-hand-side column
% assemble q and rhs
% assemble K and rhs
for ielem = 1:nelem
% compute the element stiffness matrix and right-hand-side array
[Ke, rhse] = elm1d(ielem, coord, top, mat.mat);
......@@ -39,7 +37,7 @@ sol = solvestat(K, rhs, bndcon, nodfrc, dest);
% compute the rhs including the reaction forces
rhs = K*sol;
%* compute the stresses
% compute the stresses
sigma = zeros(nelem, size(top, 2)-2);
for ielem = 1:nelem
sigma(ielem, :) = elm1d_d(ielem, coord, top, mat.mat, pos, sol);
......
......@@ -9,7 +9,7 @@ if ~exist('sol', 'var')
ndof = max(dest(:));
if istat == 1 % steady state solution
sol = zeros(ndof, 1);
elseif istat==2 % unsteady solution
elseif istat == 2 % unsteady solution
sol = zeros(ndof, ntime + 1);
end
end
......@@ -24,20 +24,15 @@ disp('* create equation numbers ...');
% global M, C, K and f
disp('* start of matrix-building process ...')
% ndof: the total number of degrees of freedom
ndof = max(dest(:));
% define number of unknows for each node
ldof = ones(1, size(top, 2)-2);
% initialize
ndof = max(dest(:)); % the total number of degrees of freedom
ldof = length(pos(1, :));
% global stiffness matrix (spalloc allocated space for a sparse matrix)
K = spalloc(ndof, ndof, sum(ldof)^2); % global stiffness matrix
M = K; % global mass matrix
C = K; % global damping matrix
rhs = zeros(ndof, 1); % global right-hand-side column
% initialize q and rhs;
% K: the global stiffness matrix
% M: the global mass matrix
% C: the global damping matrix
% rhs: the global right-hand-side matrix
K = spalloc(ndof, ndof, sum(ldof)^2);
M = K;
C = K;
rhs = zeros(ndof, 1);
% assemble q and rhs
for ielem = 1:nelem
% compute the element stiffness matrix and right-hand-side column
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment