Stiffness method

36
MSc Structural Analysis Andrew Phillips MEng PhD Lecturer in Structural Engineering and Structural Biomechanics Imperial College London Structural Biomechanics, Structures Section Department of Civil and Environmental Engineering www.imperial.ac.uk/structuralbiomechanics Implementing the Matrix Stiffness Method

description

 

Transcript of Stiffness method

Page 1: Stiffness method

MSc Structural Analysis

Andrew Phillips MEng PhD

Lecturer in Structural Engineering and Structural Biomechanics

Imperial College London

Structural Biomechanics, Structures SectionDepartment of Civil and Environmental Engineering

www.imperial.ac.uk/structuralbiomechanics

Implementing the Matrix Stiffness Method

Page 2: Stiffness method

Implementing the Matrix Stiffness Method

Previously it was stated that the matrix stiffness methodcould easily be implemented in a program such as Matlab.

Here we will look at the implementation for a beam and aframe example.

The approach can be used for any structure made up ofdistinct elements connected together at nodes or joints.

Implementing the Matrix Stiffness Method

Page 3: Stiffness method

Beam Example

Implementing the Matrix Stiffness Method

Page 4: Stiffness method

Node and Element Numbering

Implementing the Matrix Stiffness Method

Page 5: Stiffness method

Matlab Code: Setting Up

% Setting up a member stiffness matrix (bending)k = [4 2; 2 4];

% Setting up a matrix of distributed loadsw=[40 20 20 60];

% Setting up a matrix of lengthsL=[4 6 6 4];

% Setting up a matrix of EI valuesEI = [1 1.5 1.5 2];% Assuming use of UB402x140x42EI = EI. * (2.05 * 10ˆ8 * 0.0001569); % kN/mˆ2 * mˆ4

Implementing the Matrix Stiffness Method

Page 6: Stiffness method

Matlab Code: Moment Stiffness Matrix

% Setting up the combined structure stiffness matrix% Based on the degree of kinematic indeterminacy (5)ndof=5;K=zeros(ndof,ndof);for n=1:ndof-1

K(n:n+1,n:n+1)=K(n:n+1,n:n+1)+k. * EI(n)./L(n);end

Implementing the Matrix Stiffness Method

Page 7: Stiffness method

Matlab Code: Fixed End Moments

% Setting up fixed end moments for each span (FE-M)FEMspan = zeros(ndof-1,2);for n=1:ndof-1

FEMspan(n,1) = +w(n). * L(n)ˆ2./12;FEMspan(n,2) = -w(n). * L(n)ˆ2./12;

end

% Setting up fixed end moments at each support (FE-M)FEMsupport=zeros(ndof,1);FEMsupport(1,1)=FEMspan(1,1);for n=2:ndof-1

FEMsupport(n,1)=FEMspan(n-1,2)+FEMspan(n,1);endFEMsupport(ndof,1)=FEMspan(ndof-1,2);

Implementing the Matrix Stiffness Method

Page 8: Stiffness method

Matlab Code: Finding θ Values

∆˜= K

˜

−1(−R˜

FE )

%%%% Calculation to find values of theta %%%%theta=(Kˆ-1) * (-FEMsupport);fprintf( 'Theta Values (rad): \n' );fprintf( '%1.4e, ' ,theta); fprintf( '\n\n' );

Theta Values (rad):-1.8199e-003, 3.2354e-004, 1.1122e-004, -7.6841e-004, 1 .6278e-003,

Implementing the Matrix Stiffness Method

Page 9: Stiffness method

Matlab Code: Vertical Reactions Stiffness Matrix

% Setting up a vertical stiffness matrix% These values can be taken from the 3D member stiffness matri xkvert = [6 6; -6 -6];Kvert = zeros(ndof,ndof);for n=1:ndof-1

Kvert(n:n+1,n:n+1)=Kvert(n:n+1,n:n+1)+kvert. * EI(n)./L(n).ˆ2;end

Implementing the Matrix Stiffness Method

Page 10: Stiffness method

Matlab Code: Fixed End Vertical Reactions

% Setting up fixed end vertical reactions for each span (FE-R 2)FER2span = zeros(ndof-1,2);for n=1:ndof-1

FER2span(n,1) = w(n). * L(n)./2;FER2span(n,2) = w(n). * L(n)./2;

end

% Setting up fixed end vertical reactions for each support (F E-R2)FER2support=zeros(ndof,1);FER2support(1,1)=FER2span(1,1);for n=2:ndof-1

FER2support(n,1)=FER2span(n-1,2)+FER2span(n,1);endFER2support(ndof,1)=FER2span(ndof-1,2);

Implementing the Matrix Stiffness Method

Page 11: Stiffness method

Matlab Code: Vertical Reactions

%%%% Calculation to find values for the vertical support rea ctions (R2)R2 = FER2support+Kvert * theta;fprintf( 'Vertical Support Reactions (kN): \n' );fprintf( '%1.4e, ' ,R2); fprintf( '\n\n' );

Vertical Support Reactions (kN):6.1951e+001, 1.6154e+002, 1.1122e+002, 2.0602e+002, 9.9 268e+001,

Implementing the Matrix Stiffness Method

Page 12: Stiffness method

Conclusions

The script can be generalised for any continuous beam.

Results are found to match those obtained from Oasys GSAexcluding shear deformations.

Implementing the Matrix Stiffness Method

Page 13: Stiffness method

Frame Example

Implementing the Matrix Stiffness Method

Page 14: Stiffness method

Node and Element Numbering

Implementing the Matrix Stiffness Method

Page 15: Stiffness method

Matlab Code: Setting Up

% Defining the number of elementsnumelem=13;

% Defining the number of nodesnumnodes=11;

% Defining pinned supportssupports=[1 1 1 0; 2 1 1 0; 3 1 1 0; 4 1 1 0];

Implementing the Matrix Stiffness Method

Page 16: Stiffness method

Matlab Code: Setting Up

% Taking a Steel UB406x140x46E = 2.05 * 10ˆ8; %(kN/mˆ2)I = 15685 * 10ˆ-8; %(mˆ4)A = 58.6 * 10ˆ-4; %(mˆ2)

% See the labelling on the diagramL = zeros(numelem,1); %number of elementsL(1:12,1)=4; %refer to diagramL(13,1)=4 * sqrt(2); %refer to diagram

Implementing the Matrix Stiffness Method

Page 17: Stiffness method

Matlab Code: Member Stiffness Matrices

% Setting up a reference member stiffness matrix for each mem berk=zeros(6,6,numelem);for n=1:numelemk(1:6,1:6,n) = [E * A/L(n) 0 0 -E * A/L(n) 0 0; ...

0 12* E* I/L(n)ˆ3 6 * E* I/L(n)ˆ2 0 -12 * E* I/L(n)ˆ3 6 * E* I/L(n)ˆ2; ...0 6* E* I/L(n)ˆ2 4 * E* I/L(n) 0 -6 * E* I/L(n)ˆ2 2 * E* I/L(n); ...-E * A/L(n) 0 0 E * A/L(n) 0 0; ...0 -12 * E* I/L(n)ˆ3 -6 * E* I/L(n)ˆ2 0 12 * E* I/L(n)ˆ3 -6 * E* I/L(n)ˆ2; ...0 6* E* I/L(n)ˆ2 2 * E* I/L(n) 0 -6 * E* I/L(n)ˆ2 4 * E* I/L(n)];

end

Implementing the Matrix Stiffness Method

Page 18: Stiffness method

Matlab Code: Member Stiffness Matrices

% Rotating the member stiffness matices into the global axesalpha=[90 90 90 90 90 90 90 0 0 0 0 0 45];alpha=alpha * pi./180;

N=zeros(3,3,numelem);kdash=zeros(6,6,numelem);

for n=1:numelem;% Setting up a transformation matrix for each of the four quad rantsN(1:3,1:3,n)=[cos(alpha(n)) +sin(alpha(n)) 0; ...

-sin(alpha(n)) cos(alpha(n)) 0; ...0 0 1];

%kdash(1:3,1:3,n)=N(:,:,n)' * k(1:3,1:3,n) * N(:,:,n);kdash(1:3,4:6,n)=N(:,:,n)' * k(1:3,4:6,n) * N(:,:,n);kdash(4:6,1:3,n)=N(:,:,n)' * k(4:6,1:3,n) * N(:,:,n);kdash(4:6,4:6,n)=N(:,:,n)' * k(4:6,4:6,n) * N(:,:,n);

end

Implementing the Matrix Stiffness Method

Page 19: Stiffness method

Matlab Code: Member Stiffness Matrices

Alternative code to transform k to kdash for each element

%%%% The same transformation can be achieved using this code blockN=zeros(6,6,numelem);kdash=zeros(6,6,numelem);for n=1:numelem;

% setting up a transformation matrix for all four quadrants% top-left and bottom-right quadrants of N contain trigonom etric terms% top-right and bottom-left quadrants of N contain zero term sN(1:3,1:3,n)=[cos(alpha(n)) +sin(alpha(n)) 0; ...

-sin(alpha(n)) cos(alpha(n)) 0; ...0 0 1];

N(4:6,4:6,n)=N(1:3,1:3,n);%kdash(1:6,1:6,n)=N(:,:,n)' * k(:,:,n) * N(:,:,n);

end

Implementing the Matrix Stiffness Method

Page 20: Stiffness method

Assembling the Structure Stiffness Matrix

% Setting up connectivity tables for the elements% Refer to the diagram% This will be used to shape the global stiffness matrixconnelem=[1 5; 2 6; 3 7; 4 8; 6 9; 7 10; 8 11; ...

5 6; 6 7; 7 8; 9 10; 10 11; ...5 9];

% As mentioned the k matrices can be broken into quadrants 3x3 in size% Deriving an initial global stiffness matrix, K% Note the final matrix must be symmetrical about the diagona l% Taking each of the nodes in turn and working out where the dif ferent% quadrant of the original kdash matrices should be placed in K

K=zeros(numnodes * 3,numnodes * 3);Klogic=zeros(numnodes,numnodes);

Implementing the Matrix Stiffness Method

Page 21: Stiffness method

Assembling the Structure Stiffness Matrix

Implementing the Matrix Stiffness Method

Page 22: Stiffness method

Assembling the Structure Stiffness Matrix

% placing the top-left quadrantfor n=1:numnodes

clear aa=find(connelem(:,1)==n);if isempty(a) 6=1;

for m=1:length(a);K(1+(n-1) * 3:n * 3,1+(n-1) * 3:n * 3)= ...

K(1+(n-1) * 3:n * 3,1+(n-1) * 3:n * 3)+kdash(1:3,1:3,a(m));%Klogic(n,n)=Klogic(n,n)+1;

endend

end

Implementing the Matrix Stiffness Method

Page 23: Stiffness method

Assembling the Structure Stiffness Matrix

% placing the bottom-right quadrantfor n=1:numnodes

clear aa=find(connelem(:,2)==n);if isempty(a) 6=1;

for m=1:length(a);K(1+(n-1) * 3:n * 3,1+(n-1) * 3:n * 3)= ...

K(1+(n-1) * 3:n * 3,1+(n-1) * 3:n * 3)+kdash(4:6,4:6,a(m));%Klogic(n,n)=Klogic(n,n)+1;

endend

end

Implementing the Matrix Stiffness Method

Page 24: Stiffness method

Assembling the Structure Stiffness Matrix

% placing the top-right and bottom-left quadrantfor n=1:numnodes

clear a ba=find(connelem(:,1)==n);if isempty(a) 6=1;

b=connelem(a,2);for m=1:length(a);

K(1+(n-1) * 3:n * 3,1+(b(m)-1) * 3:b(m) * 3)= ...K(1+(n-1) * 3:n * 3,1+(b(m)-1) * 3:b(m) * 3)+kdash(1:3,4:6,a(m));

K(1+(b(m)-1) * 3:b(m) * 3,1+(n-1) * 3:n * 3)= ...K(1+(b(m)-1) * 3:b(m) * 3,1+(n-1) * 3:n * 3)+kdash(4:6,1:3,a(m));

%Klogic(n,b(m))=Klogic(n,b(m))+1;Klogic(b(m),n)=Klogic(b(m),n)+1;

endend

end

Implementing the Matrix Stiffness Method

Page 25: Stiffness method

Assembling the Structure Stiffness Matrix

% Addressing rows and columns in the stiffness matrix associ ated with% applied support constraints

a=size(supports);b=0;Ksupportrefs=zeros(1,sum(sum(supports(:,2:4) 6=0)));for n=1:a(1)

for m=2:a(2)if supports(n,m)==1;

b=b+1;Ksupportrefs(b)=(supports(n,1)-1) * 3+(m-1);

endend

endclear a b

K(Ksupportrefs(1,:),:)=0;K(:,Ksupportrefs(1,:))=0;for n=1:length(Ksupportrefs)

K(Ksupportrefs(1,n),Ksupportrefs(1,n))=1;end

Implementing the Matrix Stiffness Method

Page 26: Stiffness method

Assembling the Fixed End Reactions Matrix

%Setting up matrix of distributed loadsw=[0 0 0 0 0 0 0 10 10 10 10 10 0];

%Setting up fixed end moments for each element (FE-M)FEMelem = zeros(numelem,2);for n=1:numelem

FEMelem(n,1) = +w(n). * L(n)ˆ2./12;FEMelem(n,2) = -w(n). * L(n)ˆ2./12;

end

%Setting up fixed end x2 reactions for each element (FE-R2)FER2elem = zeros(numelem,2);for n=1:numelem

FER2elem(n,1) = w(n). * L(n)./2;FER2elem(n,2) = w(n). * L(n)./2;

end

Implementing the Matrix Stiffness Method

Page 27: Stiffness method

Assembling the Fixed End Reactions Matrix

%Setting up fixed end moment for each nodeFEMnode=zeros(numnodes,1);for n=1:numnodes

clear a ba = find(connelem(:,1)==n);if isempty(a) 6=1;

for m=1:length(a);FEMnode(n,1)=FEMnode(n,1)+FEMelem(a(m),1);

endendb = find(connelem(:,2)==n);if isempty(b) 6=1;

for m=1:length(b);FEMnode(n,1)=FEMnode(n,1)+FEMelem(b(m),2);

endend

end

Implementing the Matrix Stiffness Method

Page 28: Stiffness method

Assembling the Fixed End Reactions Matrix

%Setting up fixed end x2 reactions for each nodeFER2node=zeros(numnodes,1);for n=1:numnodes

clear a ba = find(connelem(:,1)==n);if isempty(a) 6=1;

for m=1:length(a);FER2node(n,1)=FER2node(n,1)+FER2elem(a(m),1);

endendb = find(connelem(:,2)==n);if isempty(b) 6=1;

for m=1:length(b);FER2node(n,1)=FER2node(n,1)+FER2elem(b(m),2);

endend

end

Implementing the Matrix Stiffness Method

Page 29: Stiffness method

Assembling the Fixed End Reactions Matrix

%Setting up matrix of FE reactionsFERnode=zeros(3 * numnodes,1);FERnode(3:3:3 * numnodes,1)=FEMnode(1:1:numnodes,1);FERnode(2:3:3 * numnodes,1)=FER2node(1:1:numnodes,1);FERnode(Ksupportrefs,1)=0;

Implementing the Matrix Stiffness Method

Page 30: Stiffness method

Finding the Joint Displacements

∆˜= K

˜

−1(−R˜

FE )

%Finding the joint displacementsdisplacements=(Kˆ-1) * (-FERnode);reshapedisplacements=reshape(displacements,3,[]);fprintf( '\nDisplacements at the nodes (m,m,rad):\n\n' );disp(reshapedisplacements);

Implementing the Matrix Stiffness Method

Page 31: Stiffness method

Results: Joint Displacements

Displacements at the nodes (m,m,rad):

1.0e-003 *

Columns 1 through 6

0 0 0 0 0.0672 0.07600 0 0 0 -0.0661 -0.1966

0.0689 -0.0355 -0.0198 -0.0971 -0.1882 0.0140

Columns 7 through 11

0.0893 0.1013 0.2331 0.2170 0.2021-0.2742 -0.1290 -0.2546 -0.4155 -0.1922-0.0274 0.1182 -0.1916 -0.0053 0.2021

Implementing the Matrix Stiffness Method

Page 32: Stiffness method

Find the Support Reactions

R˜= k

˜

′∆˜+ R

˜

FE

%Finding the support reactions%Isolating the elements that have restrained ends%This relies on supports being defined for single elementsa=size(supports);for n=1:a(1)

b=find(connelem(:,1)==n);EndAdisp=displacements(1+(connelem(b,1)-1) * 3:3+(connelem(b,1)-1) * 3,1);EndBdisp=displacements(1+(connelem(b,2)-1) * 3:3+(connelem(b,2)-1) * 3,1);Endsdisp(1:3,1)=EndAdisp;Endsdisp(4:6,1)=EndBdisp;reactions(1+(n-1) * 3:3+(n-1) * 3,1)=kdash(1:3,1:6,b) * Endsdisp+ ...

FERnode(1+(connelem(b,1)-1) * 3:3+(connelem(b,1)-1) * 3,1);endreshapereactions=reshape(reactions,3,[]);fprintf( '\nReactions (kN,kN,kNm):\n\n' );disp(reshapereactions);

Implementing the Matrix Stiffness Method

Page 33: Stiffness method

Results: Support Reactions

Reactions (kN,kN,kNm):

1.0333 -0.1987 0.0305 -0.865119.8530 59.0480 82.3450 38.7540

0.0000 0.0000 -0.0000 0.0000

Implementing the Matrix Stiffness Method

Page 34: Stiffness method

Check: Assembled Structure Stiffness Matrix

Assembly logic of the K matrix:

1 0 0 0 1 0 0 0 0 0 00 1 0 0 0 1 0 0 0 0 00 0 1 0 0 0 1 0 0 0 00 0 0 1 0 0 0 1 0 0 01 0 0 0 3 1 0 0 1 0 00 1 0 0 1 4 1 0 1 0 00 0 1 0 0 1 4 1 0 1 00 0 0 1 0 0 1 3 0 0 10 0 0 0 1 1 0 0 3 1 00 0 0 0 0 0 1 0 1 3 10 0 0 0 0 0 0 1 0 1 2

Implementing the Matrix Stiffness Method

Page 35: Stiffness method

Conclusions

The script can be generalised for any plane frame.

The script can be adapted to include different cross sections.

Results are found to match those obtained from Oasys GSAexcluding shear deformations.

Implementing the Matrix Stiffness Method

Page 36: Stiffness method

Ask not what you can do for the matrix stiffness method...

Ask what the matrix stiffness method can do for you.

Implementing the Matrix Stiffness Method