Commit c2bd15e8 authored by Andreas Zilian's avatar Andreas Zilian
Browse files

Ensure zero initialisation of problem.

parent d336daa8
......@@ -34,12 +34,17 @@ classdef FeProblem < handle
node.idx = self.ndofs + [1:ndof];
self.ndofs = self.ndofs + ndof;
end
%sprintf('feproblem ndofs = %d', self.ndofs)
% initialise state to zero (global dof values)
z = zeros(self.ndofs,1);
% initialise nodal vectors lhs and rhs
self.updateNodalDofs(z,z)
% initialise element internal quantities (forces, stresses)
self.postprocessElements(z)
end
%% assemble system K matrix
function A = assembleSystemStiffnessMatrix(self)
tic
%tic
% create system stiffness matrix
est_entries = round( length(self.elems) * 12*12 * 1.10 );
num_entries = 0;
......@@ -62,10 +67,10 @@ classdef FeProblem < handle
num_entries = num_entries + e_size;
end
A = sparse( id1(1:num_entries), id2(1:num_entries), mat(1:num_entries) );
toc
%toc
return
tic
%tic
% create system stiffness matrix
id1 = zeros(0,1);
id2 = zeros(0,1);
......@@ -82,9 +87,9 @@ classdef FeProblem < handle
mat = [ mat; reshape( e_mat', [], 1 ) ];
end
A = sparse( id1, id2, mat );
toc
%toc
tic
%tic
% create system mass matrix
A = sparse(self.ndofs, self.ndofs);
% loop over all elements and collect element mass matrices
......@@ -96,7 +101,7 @@ classdef FeProblem < handle
% add element contribution to system matrix
A(e_idx,e_idx) = A(e_idx,e_idx) + e_mat;
end
toc
%toc
end
%% assemble system M matrix
function A = assembleSystemMassMatrix(self)
......
Supports Markdown
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