13.07.2015 Views

Calfem - A finite element toolbox to MATLAB, version 3.3

Calfem - A finite element toolbox to MATLAB, version 3.3

Calfem - A finite element toolbox to MATLAB, version 3.3

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Contents1 Introduction 1 – 12 General purpose functions 2 – 13 Matrix functions 3 – 14 Material functions 4 – 15 Element functions 5.1 – 15.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1 – 15.2 Spring <strong>element</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 – 15.3 Bar <strong>element</strong>s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 – 15.4 Heat flow <strong>element</strong>s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 – 15.5 Solid <strong>element</strong>s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5 – 15.6 Beam <strong>element</strong>s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6 – 15.7 Plate <strong>element</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7 – 16 System functions 6.1 – 16.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1 – 16.2 Static system functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 – 16.3 Dynamic system functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 – 17 Statements and macros 7 – 18 Graphics functions 8 – 19 User’s Manual, examples 9.1 – 19.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.1 – 19.2 <strong>MATLAB</strong> introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2 – 19.3 Static analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3 – 19.4 Dynamic analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4 – 19.5 Nonlinear analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5 – 1


1 IntroductionThe computer program CALFEM is a <strong>MATLAB</strong> <strong><strong>to</strong>olbox</strong> for <strong>finite</strong> <strong>element</strong> applications.This manual concerns mainly the <strong>finite</strong> <strong>element</strong> functions, but it also contains descriptionsof some often used <strong>MATLAB</strong> functions.The <strong>finite</strong> <strong>element</strong> analysis can be carried out either interactively or in a batch orientedfashion. In the interactive mode the functions are evaluated one by one in the <strong>MATLAB</strong>command window. In the batch oriented mode a sequence of functions are written in a filenamed .m-file, and evaluated by writing the file name in the command window. The batchoriented mode is a more flexible way of performing <strong>finite</strong> <strong>element</strong> analysis because the.m-file can be written in an ordinary edi<strong>to</strong>r. This way of using CALFEM is recommendedbecause it gives a structured organization of the functions. Changes and reruns are alsoeasily executed in the batch oriented mode.A command line consists typically of functions for vec<strong>to</strong>r and matrix operations, calls <strong>to</strong>functions in the CALFEM <strong>finite</strong> <strong>element</strong> library or commands for workspace operations.An example of a command line for a matrix operation isC = A + B ′where two matrices A and B’ are added <strong>to</strong>gether and the result is s<strong>to</strong>red in matrix C .The matrix B’ is the transpose of B. An example of a call <strong>to</strong> the <strong>element</strong> library isKe = bar1e(k)where the two-by-two <strong>element</strong> stiffness matrix K e is computed for a spring <strong>element</strong> withspring stiffness k, and is s<strong>to</strong>red in the variable Ke. The input argument is given withinparentheses ( ) after the name of the function. Some functions have multiple input argumentsand/or multiple output arguments. For example[lambda, X] = eigen(K, M)computes the eigenvalues and eigenvec<strong>to</strong>rs <strong>to</strong> a pair of matrices K and M. The outputvariables - the eigenvalues s<strong>to</strong>red in the vec<strong>to</strong>r lambda and the corresponding eigenvec<strong>to</strong>rss<strong>to</strong>red in the matrix X - are surrounded by brackets [ ] and separated by commas. Theinput arguments are given inside the parentheses and also separated by commas.The statementhelpfunctionprovides information about purpose and syntax for the specified function.1 – 1 INTRODUCTION


The available functions are organized in groups as follows. Each group is described in aseparate chapter.Groups of functionsGeneral purposecommandsMatrix functionsMaterial functionsElement functionsSystem functionsStatementfunctionsGraphics functionsfor managing variables, workspace, output etcfor matrix handlingfor computing material matricesfor computing <strong>element</strong> matrices and <strong>element</strong> forcesfor setting up and solving systems of equationsfor algorithm definitionsfor plottingINTRODUCTION 1 – 2


2 General purpose functionsThe general purpose functions are used for managing variables and workspace, control ofoutput etc. The functions listed here are a subset of the general purpose functions describedin the <strong>MATLAB</strong> manual. The functions can be divided in<strong>to</strong> the following groupsManaging commands and functionshelp Online documentationtype List .m-filewhat Direc<strong>to</strong>ry listing of .m-, .mat- and .mex-files... Continuation% Write a comment linecleardisploadsavewho,whosManaging variables and the workspaceRemove variables from workspaceDisplay variables in workspace on display screenRetrieve variable from disk and load in workspaceSave matrix bank variable on diskList direc<strong>to</strong>ry of variables in workspaceWorking with files and controlling the command windowdiary Save session in a named fileecho Control output on the display screenformat Control the output display formatquit S<strong>to</strong>p execution and exit from the CALFEM program2 – 1 GENERAL PURPOSE


clearPurpose:Syntax:Remove variables from workspace.clearclear name1 name2 name3 ...Description:Note:clear removes all variables from workspace.clear name1 name2 name3 ... removes specified variables from workspace.This is a <strong>MATLAB</strong> built-in function. For more information about the clear function,type help clear.GENERAL PURPOSE 2 – 2


diaryPurpose:Syntax:Save session in a disk file.diary filenamediary offdiary onDescription:Note:diary filename writes a copy of all subsequent keyboard input and most of the resultingoutput (but not graphs) on the named file. If the file filename already exists, theoutput is appended <strong>to</strong> the end of that file.diary off s<strong>to</strong>ps s<strong>to</strong>rage of the output.diary on turns it back on again, using the current filename or default filename diaryif none has yet been specified.The diary function may be used <strong>to</strong> s<strong>to</strong>re the current session for later runs. To makethis possible, finish each command line with semicolon ’;’ <strong>to</strong> avoid the s<strong>to</strong>rage ofintermediate results on the named diary file.This is a <strong>MATLAB</strong> built-in function. For more information about the diary function,type help diary.2 – 3 GENERAL PURPOSE


dispPurpose:Syntax:Display a variable in matrix bank on display screen.disp(A)Description:Note:disp(A) displays the matrix A on the display screen.This is a <strong>MATLAB</strong> built-in function. For more information about the disp function,type help disp.GENERAL PURPOSE 2 – 4


echoPurpose:Syntax:Control output on the display screen.echo onecho offechoDescription:Note:echo on turns on echoing of commands inside Script-files.echo off turns off echoing.echo by itself, <strong>to</strong>ggles the echo state.This is a <strong>MATLAB</strong> built-in function. For more information about the echo function,type help echo.2 – 5 GENERAL PURPOSE


formatPurpose:Syntax:Control the output display format.See the listing below.Description:Note:format controls the output format. By default, <strong>MATLAB</strong> displays numbers in a shortformat with five decimal digits.Command Result Exampleformat short 5 digit scaled fixed point 3.1416format long 15 digit scaled fixed point 3.14159265358979format short e 5 digit floating point 3.1416e+00format long e 16 digit floating point 3.141592653589793e+00This is a <strong>MATLAB</strong> built-in function. For more information about the format function,type help format.GENERAL PURPOSE 2 – 6


helpPurpose:Syntax:Display a description of purpose and syntax for a specific function.help function nameDescription:Example:help provides an online documentation for the specified function.Typing>> help bar1eyieldsKe=bar1e(ep)----------------------------------------------------------PURPOSECompute <strong>element</strong> stiffness matrixfor spring (analog) <strong>element</strong>.INPUT:ep = [k]; spring stiffness or analog quantity.Note:OUTPUT: Ke : stiffness matrix, dim(Ke)= 2 x 2----------------------------------------------------------This is a <strong>MATLAB</strong> built-in function. For more information about the help function,type help help.2 – 7 GENERAL PURPOSE


loadPurpose:Syntax:Retrieve variable from disk and load in workspace.load filenameload filename.extDescription:Note:load filename retrieves the variables from the binary file filename.mat.load filename.ext reads the ASCII file filename.ext with numeric data arranged in mrows and n columns. The result is an m-by-n matrix residing in workspace with thename filename, i.e. with the extension stripped.This is a <strong>MATLAB</strong> built-in function. For more information about the load function,type help load.GENERAL PURPOSE 2 – 8


quitPurpose:Syntax:Terminate CALFEM session.quitDescription:Note:quit filename terminates the CALFEM without saving the workspace.This is a <strong>MATLAB</strong> built-in function. For more information about the quit function,type help quit.2 – 9 GENERAL PURPOSE


savePurpose:Syntax:Save workspace variables on disk.save filenamesave filename variablessave filename variables -asciiDescription:Note:save filename writes all variables residing in workspace in a binary file named filename.matsave filename variables writes named variables, separated by blanks, in a binary filenamed filename.matsave filename variables -ascii writes named variables in an ASCII file named filename.This is a <strong>MATLAB</strong> built-in function. For more information about the save function,type help save.GENERAL PURPOSE 2 – 10


typePurpose:List file.Syntax:type filenameDescription:Note:type filename lists the specified file. Use path names in the usual way for youroperating system. If a filename extension is not given, .m is added by default. Thismakes it convenient <strong>to</strong> list the contents of .m-files on the screen.This is a <strong>MATLAB</strong> built-in function. For more information about the type function,type help type.2 – 11 GENERAL PURPOSE


whatPurpose:Syntax:Direc<strong>to</strong>ry listing of .m-files, .mat-files and .mex-files.whatwhat dirnameDescription:Note:what lists the .m-files, .mat-files and .mex-files in the current direc<strong>to</strong>ry.what dirname lists the files in direc<strong>to</strong>ry dirname in the <strong>MATLAB</strong> search path. Thesyntax of the path depends on your operating system.This is a <strong>MATLAB</strong> built-in function. For more information about the what function,type help what.GENERAL PURPOSE 2 – 12


who, whosPurpose:Syntax:List direc<strong>to</strong>ry of variables in matrix bank.whowhosDescription:Examples:Note:who lists the variables currently in memory.whos lists the current variables and their size.whoYour variables are:A B CK M Xk lambdawhosname size <strong>element</strong>s bytes density complexA 3-by-3 9 72 Full NoB 3-by-3 9 72 Full NoC 3-by-3 9 72 Full NoK 20-by-20 400 3200 Full NoM 20-by-20 400 3200 Full NoX 20-by-20 400 3200 Full Nok 1-by-1 1 8 Full Nolambda 20-by-1 20 160 Full NoGrand <strong>to</strong>tal is 1248 <strong>element</strong>s using 9984 bytesThese are <strong>MATLAB</strong> built-in functions. For more information about the functions,type help who or help whos.2 – 13 GENERAL PURPOSE


...Purpose:Continuation.Syntax:...Description:An expression can be continued on the next line by using ... .Note:This is a <strong>MATLAB</strong> built-in function.GENERAL PURPOSE 2 – 14


%Purpose:Write a comment line.Syntax:% arbitrary textDescription:An arbitrary text can be written after the symbol %.Note:This is a <strong>MATLAB</strong> built-in character.2 – 15 GENERAL PURPOSE


3 Matrix functionsThe group of matrix functions comprises functions for vec<strong>to</strong>r and matrix operations andalso functions for sparse matrix handling. <strong>MATLAB</strong> has two s<strong>to</strong>rage modes, full and sparse.Only nonzero entries and their indices are s<strong>to</strong>red for sparse matrices. Sparse matrices arenot created au<strong>to</strong>matically. But once initiated, sparsity propagates. Operations on sparsematrices produce sparse matrices and operations on a mixture of sparse and full matricesalso normally produce sparse matrices.The following functions are described in this chapter:Vec<strong>to</strong>r and matrix operations[ ] ( ) = Special characters’ . , ; Special characters: Create vec<strong>to</strong>rs and do matrix subscripting+ – ∗ / Matrix arithmeticabs Absolute valuedet Matrix determinantdiag Diagonal matrices and diagonals of a matrixinv Matrix inverselength Vec<strong>to</strong>r lengthmax Maximum <strong>element</strong>(s) of a matrixmin Minimum <strong>element</strong>(s) of a matrixones Generate a matrix of all onesred Reduce the size of a square matrixsize Matrix dimensionssqrt Square rootsum Sum of the <strong>element</strong>s of a matrixzeros Generate a zero matrixfullsparsespySparse matrix handlingConvert sparse matrix <strong>to</strong> full matrixCreate sparse matrixVisualize sparsity structure3 – 1 MATRIX


[ ] ( ) = ’ . , ;Purpose:Syntax:Special characters.[ ] ( ) = ’ . , ;Description:Examples:Note:[ ] Brackets are used <strong>to</strong> form vec<strong>to</strong>rs and matrices.( ) Parentheses are used <strong>to</strong> indicate precedence in arithmetic expressions and <strong>to</strong>specify an <strong>element</strong> of a matrix.= Used in assignment statements.’ Matrix transpose. X’ is the transpose of X. If X is complex, the apostrophesign performs complex conjugate as well. Do X.’ if only the transpose of thecomplex matrix is desired. Decimal point. 314/100, 3.14 and 0.314e1 are all the same., Comma. Used <strong>to</strong> separate matrix subscripts and function arguments.; Semicolon. Used inside brackets <strong>to</strong> end rows. Used after an expression <strong>to</strong>suppress printing or <strong>to</strong> separate statements.By the statementa = 2the scalar a is assigned a value of 2. An <strong>element</strong> in a matrix may be assigned a valueaccording <strong>to</strong>A(2, 5) = 3The statementD = [ 1 2 ; 3 4]results in matrix[ ]1 2D =3 4s<strong>to</strong>red in the matrix bank. To copy the contents of the matrix D <strong>to</strong> a matrix E, useE = DThe character ’ is used in the following statement <strong>to</strong> s<strong>to</strong>re the transpose of the matrixA in a new matrix FF = A ′These are <strong>MATLAB</strong> built-in characters.MATRIX 3 – 2


:Purpose:Create vec<strong>to</strong>rs and do matrix subscripting.Description:The colon opera<strong>to</strong>r uses the following rules <strong>to</strong> create regularly spaced vec<strong>to</strong>rs:j : k is the same as [ j, j + 1, ... , k ]j : i : k is the same as [ j, j + i, j + 2i, ... , k ]The colon notation may also be used <strong>to</strong> pick out selected rows, columns, and <strong>element</strong>sof vec<strong>to</strong>rs and matrices:Examples:A( : , j ) is the j :th column of AA( i , : ) is the i :th row of AThe colon ’:’ used with integersd = 1 : 4results in a row vec<strong>to</strong>rd = [ 1 2 3 4 ]s<strong>to</strong>red in the workspace.The colon notation may be used <strong>to</strong> display selected rows and columns of a matrix onthe terminal. For example, if we have created a 3-times-4 matrix D by the statementD = [ d ; 2 ∗ d ; 3 ∗ d ]resulting in⎡⎢D = ⎣1 2 3 42 4 6 83 6 9 12columns three and four are displayed by enteringresulting inD( : , 3 : 4 )⎡⎢D( : , 3 : 4 ) = ⎣⎤⎥⎦3 46 89 12⎤⎥⎦In order <strong>to</strong> copy parts of the D matrix in<strong>to</strong> another matrix the colon notation is usedasE( 3 : 4 , 2 : 3 ) = D( 1 : 2 , 3 : 4 )3 – 3 MATRIX


:Note:Assuming the matrix E was a zero matrix before the statement is executed, the resultwill be⎡⎤0 0 0 00 0 0 0E = ⎢⎥⎣ 0 3 4 0 ⎦0 6 8 0This is a <strong>MATLAB</strong> built-in character.MATRIX 3 – 4


+ − ∗ /Purpose:Syntax:Matrix arithmetic.A + BA − BA ∗ BA/sDescription:Examples:Note:Matrix operations are defined by the rules of linear algebra.An example of a sequence of matrix-<strong>to</strong>-matrix operations isD = A + B − CA matrix-<strong>to</strong>-vec<strong>to</strong>r multiplication followed by a vec<strong>to</strong>r-<strong>to</strong>-vec<strong>to</strong>r subtraction may bedefined by the statementb = c − A ∗ xand finally, <strong>to</strong> scale a matrix by a scalar s we may useB = A/sThese are <strong>MATLAB</strong> built-in opera<strong>to</strong>rs.3 – 5 MATRIX


absPurpose:Syntax:Absolute value.B=abs(A)Description:B=abs(A) computes the absolute values of the <strong>element</strong>s of matrix A and s<strong>to</strong>res themin matrix B.Examples:Assume the matrix[−7 4C =−3 −8]Note:The statement D=abs(C) results in a matrix[ ]7 4D =3 8s<strong>to</strong>red in the workspace.This is a <strong>MATLAB</strong> built-in function. For more information about the abs function,type help abs.MATRIX 3 – 6


detPurpose:Syntax:Matrix determinant.a=det(A)Description:Note:a=det(A) computes the determinant of the matrix A and s<strong>to</strong>res it in the scalar a.This is a <strong>MATLAB</strong> built-in function. For more information about the det function,type help det.3 – 7 MATRIX


diagPurpose:Syntax:Diagonal matrices and diagonals of a matrix.M=diag(v)v=diag(M)Description:Note:For a vec<strong>to</strong>r v with n components, the statement M=diag(v) results in an n × nmatrix M with the <strong>element</strong>s of v as the main diagonal.For a n × n matrix M, the statement v=diag(M) results in a column vec<strong>to</strong>r v with ncomponents formed by the main diagonal in M.This is a <strong>MATLAB</strong> built-in function. For more information about the diag function,type help diag.MATRIX 3 – 8


fullPurpose:Syntax:Convert sparse matrices <strong>to</strong> full s<strong>to</strong>rage class.A=full(S)Description:Note:A=full(S) converts the s<strong>to</strong>rage of a matrix from sparse <strong>to</strong> full. If A is already full,full(A) returns A.This is a <strong>MATLAB</strong> built-in function. For more information about the full function,type help full.3 – 9 MATRIX


invPurpose:Syntax:Matrix inverse.B=inv(A)Description:Note:B=inv(A) computes the inverse of the square matrix A and s<strong>to</strong>res the result in thematrix B.This is a <strong>MATLAB</strong> built-in function. For more information about the inv function,type help inv.MATRIX 3 – 10


lengthPurpose:Syntax:Vec<strong>to</strong>r length.n=length(x)Description:Note:n=length(x) returns the dimension of the vec<strong>to</strong>r x.This is a <strong>MATLAB</strong> built-in function. For more information about the length function,type help length.3 – 11 MATRIX


maxPurpose:Syntax:Maximum <strong>element</strong>(s) of a matrix.b=max(A)Description:For a vec<strong>to</strong>r a, the statement b=max(a) assigns the scalar b the maximum <strong>element</strong>of the vec<strong>to</strong>r a.For a matrix A, the statement b=max(A) returns a row vec<strong>to</strong>r b containing themaximum <strong>element</strong>s found in each column vec<strong>to</strong>r in A.The maximum <strong>element</strong> found in a matrix may thus be determined byc=max(max(A)).Examples:Note:Assume the matrix B is defined as[ ]−7 4B =−3 −8The statement d=max(B) results in a row vec<strong>to</strong>rd = [ −3 4 ]The maximum <strong>element</strong> in the matrix B may be found by e=max(d) which results inthe scalar e = 4.This is a <strong>MATLAB</strong> built-in function. For more information about the max function,type help max.MATRIX 3 – 12


minPurpose:Syntax:Minimum <strong>element</strong>(s) of a matrix.b=min(A)Description:For a vec<strong>to</strong>r a, the statement b=min(a) assigns the scalar b the minimum <strong>element</strong> ofthe vec<strong>to</strong>r a.For a matrix A, the statement b=min(A) returns a row vec<strong>to</strong>r b containing the minimum<strong>element</strong>s found in each column vec<strong>to</strong>r in A.Examples:Note:The minimum <strong>element</strong> found in a matrix may thus be determined by c=min(min(A)).Assume the matrix B is defined as[ ]−7 4B =−3 −8The statement d=min(B) results in a row vec<strong>to</strong>rd = [ −7 −8 ]The minimum <strong>element</strong> in the matrix B is then found by e=min(d), which results inthe scalar e = −8.This is a <strong>MATLAB</strong> built-in function. For more information about the min function,type help min.3 – 13 MATRIX


onesPurpose:Syntax:Generate a matrix of all ones.A=ones(m,n)Description:Note:A=ones(m,n) results in an m-times-n matrix A with all ones.This is a <strong>MATLAB</strong> built-in function. For more information about the ones function,type help ones.MATRIX 3 – 14


edPurpose:Syntax:Reduce the size of a square matrix by omitting rows and columns.B=red(A,b)Description:B=red(A,b) reduces the square matrix A <strong>to</strong> a smaller matrix B by omitting rows andcolumns of A. The indices for rows and columns <strong>to</strong> be omitted are specified by thecolumn vec<strong>to</strong>r b.Examples:Assume that the matrix A is defined as⎡⎤1 2 3 45 6 7 8A = ⎢⎥⎣ 9 10 11 12 ⎦13 14 15 16and b as[2b =4]The statement B=red(A,b) results in the matrix[ ]1 3B =9 113 – 15 MATRIX


sizePurpose:Syntax:Matrix dimensions.d=size(A)[m,n]=size(A)Description:Note:d=size(A) returns a vec<strong>to</strong>r with two integer components, d=[m,n], from the matrixA with dimensions m times n.[m,n]=size(A) returns the dimensions m and n of the m × n matrix A.This is a <strong>MATLAB</strong> built-in function. For more information about the size function,type help size.MATRIX 3 – 16


sparsePurpose:Syntax:Create sparse matrices.S=sparse(A)S=sparse(m,n)Description:Note:S=sparse(A) converts a full matrix <strong>to</strong> sparse form by extracting all nonzero matrix<strong>element</strong>s. If S is already sparse, sparse(S) returns S.S=sparse(m,n) generates an m-times-n sparse zero matrix.This is a <strong>MATLAB</strong> built-in function. For more information about the sparse function,type help sparse.3 – 17 MATRIX


spyPurpose:Syntax:Visualize matrix sparsity structure.spy(S)Description:Note:spy(S) plots the sparsity structure of any matrix S. S is usually a sparse matrix, butthe function also accepts full matrices and the nonzero matrix <strong>element</strong>s are plotted.This is a <strong>MATLAB</strong> built-in function. For more information about the spy function,type help spy.MATRIX 3 – 18


sqrtPurpose:Syntax:Square root.B=sqrt(A)Description:Note:B=sqrt(A) computes the square root of the <strong>element</strong>s in matrix A and s<strong>to</strong>res the resultin matrix B.This is a <strong>MATLAB</strong> built-in function. For more information about the sqrt function,type help sqrt.3 – 19 MATRIX


sumPurpose:Syntax:Sum of the <strong>element</strong>s of a matrix.b=sum(A)Description:Note:For a vec<strong>to</strong>r a, the statement b=sum(a) results in a scalar a containing the sum ofall <strong>element</strong>s of a.For a matrix A, the statement b=sum(A) returns a row vec<strong>to</strong>r b containing the sumof the <strong>element</strong>s found in each column vec<strong>to</strong>r of A.The sum of all <strong>element</strong>s of a matrix is determined by c=sum(sum(A)).This is a <strong>MATLAB</strong> built-in function. For more information about the sum function,type help sum.MATRIX 3 – 20


zerosPurpose:Syntax:Generate a zero matrix.A=zeros(m,n)Description:Note:A=zeros(m,n) results in an m-times-n matrix A of zeros.This is a <strong>MATLAB</strong> built-in function. For more information about the zeros function,type help zeros.3 – 21 MATRIX


4 Material functionsThe group of material functions comprises functions for constitutive models. The availablemodels can treat linear elastic and isotropic hardening von Mises material. These materialmodels are defined by the functions:hookemisesdmisesMaterial property functionsForm linear elastic constitutive matrixCompute stresses and plastic strains for isotropic hardeningvon Mises materialForm elas<strong>to</strong>-plastic continuum matrix for isotropic hardeningvon Mises material4 – 1 MATERIAL


hookePurpose:Syntax:Compute material matrix for a linear elastic and isotropic material.D = hooke(ptype,E,v)Description:hooke computes the material matrix D for a linear elastic and isotropic material.The variable ptype is used <strong>to</strong> define the type of analysis.⎧⎪⎨ptype =⎪⎩1 plane stress.2 plane strain.3 axisymmetry.4 three dimensional analysis.The material parameters E and v define the modulus of elasticity E and the Poisson’sratio ν, respectively.For plane stress, ptype=1, D is formed as⎡⎤D =E1 ν 01 − ν 2 ⎢ν 1 0⎣0 0 1 − ν ⎥⎦2For plane strain, ptype=2 and axisymmetry, ptype=3, D is formed as⎡⎤1 − ν ν ν 0Eν 1 − ν ν 0D =(1 + ν)(1 − 2ν) ⎢ ν ν 1 − ν 0⎥⎣10 0 0 (1 − 2ν) ⎦2For the three dimensional case, ptype=4, D is formed as⎡⎤1 − ν ν ν 0 0 0ν 1 − ν ν 0 0 0Eν ν 1 − ν 0 0 0D =(1 + ν)(1 − 2ν)10 0 0 (1 − 2ν) 0 02 ⎢1⎣ 0 0 0 0 (1 − 2ν) 0 ⎥2 ⎦10 0 0 0 0 (1 − 2ν) 2MATERIAL 4 – 2


misesPurpose:Syntax:Compute stresses and plastic strains for an elas<strong>to</strong>-plastic isotropic hardening vonMises material.[es,deps,st]=mises(ptype,mp,est,st)Description:Note:mises computes updated stresses es, plastic strain increments deps, and states variablesst for an elas<strong>to</strong>-plastic isotropic hardening von Mises material.The input variable ptype is used <strong>to</strong> define the type of analysis, cf. hooke. The vec<strong>to</strong>rmp contains the material constantsmp = [ E ν h ]where E is the modulus of elasticity, ν is the Poisson’s ratio, and h is the plasticmodulus. The input matrix est contains trial stresses obtained by using the elasticmaterial matrix D in plants or some similar s-function, and the input vec<strong>to</strong>r stcontains the state parametersst = [ yi σ y ɛ p eff ]at the beginning of the step. The scalar yi states whether the material behaviouris elas<strong>to</strong>-plastic (yi=1), or elastic (yi=0). The current yield stress is denoted by σ yand the effectiv plastic strain by ɛ p eff .The output variables es and st contain updated values of es and st obtained byintegration of the constitutive equations over the actual displacement step. Theincrements of the plastic strains are s<strong>to</strong>red in the vec<strong>to</strong>r deps.If es and st contain more than one row, then every row will be treated by the command.It is not necessary <strong>to</strong> check whether the material behaviour is elastic or elas<strong>to</strong>-plastic,this test is done by the function. The computation is based on an Euler-Backwardmethod, i.e. the radial return method.Only the cases ptype=2, 3 and 4, are implemented.4 – 3 MATERIAL


dmisesPurpose:Syntax:Form the elas<strong>to</strong>-plastic continuum matrix for an isotropic hardening von Mises material.D=dmises(ptype,mp,es,st)Description:Note:dmises forms the elas<strong>to</strong>-plastic continuum matrix for an isotropic hardening von Misesmaterial.The input variable ptype is used <strong>to</strong> define the type of analysis, cf. hooke. The vec<strong>to</strong>rmp contains the material constantsmp = [ E ν h ]where E is the modulus of elasticity, ν is the Poisson’s ratio, and h is the plasticmodulus. The matrix es contains current stresses obtained from plants or somesimilar s-function, and the vec<strong>to</strong>r st contains the current state parametersst = [ yi σ y ɛ p eff ]where yi=1 if the material behaviour is elas<strong>to</strong>-plastic, and yi=0 if the materialbehaviour is elastic. The current yield stress is denoted by σ y , and the currenteffective plastic strain by ɛ p eff .Only the case ptype=2 is implemented.MATERIAL 4 – 4


5 Element functions5.1 IntroductionThe group of <strong>element</strong> functions contains functions for computation of <strong>element</strong> matricesand <strong>element</strong> forces for different <strong>element</strong> types. The <strong>element</strong> functions have been dividedin<strong>to</strong> the following groupsSpring <strong>element</strong>Bar <strong>element</strong>sHeat flow <strong>element</strong>sSolid <strong>element</strong>sBeam <strong>element</strong>sPlate <strong>element</strong>For each <strong>element</strong> type there is a function for computation of the <strong>element</strong> stiffness matrixK e . For most of the <strong>element</strong>s, an <strong>element</strong> load vec<strong>to</strong>r f e can also be computed. Thesefunctions are identified by their last letter -e.Using the function assem, the <strong>element</strong> stiffness matrices and <strong>element</strong> load vec<strong>to</strong>rs areassembled in<strong>to</strong> a global stiffness matrix K and a load vec<strong>to</strong>r f. Unknown nodal values oftemperatures or displacements a are computed by solving the system of equations Ka = fusing the function solveq. A vec<strong>to</strong>r of nodal values of temperatures or displacements for aspecific <strong>element</strong> are formed by the function extract.When the <strong>element</strong> nodal values have been computed, the <strong>element</strong> flux or <strong>element</strong> stressescan be calculated using functions specific <strong>to</strong> the <strong>element</strong> type concerned. These functionsare identified by their last letter -s.For some <strong>element</strong>s, a function for computing the internal force vec<strong>to</strong>r is also available.These functions are identified by their last letter -f.5.1 – 1 ELEMENT


5.2 Spring <strong>element</strong>The spring <strong>element</strong>, shown below, can be used for the analysis of one-dimensional springsystems and for a variety of analogous physical problems.k●u 1 u 2●Quantities corresponding <strong>to</strong> the variables of the spring are listed in Table 1.Problem type Spring Nodal dis- Element Springstiffness placement force forceSpring k u P NBarEALu P NThermal conductionλALT ¯Q QElectrical circuit1RU Ī IGroundwater flowkALφ ¯Q QPipe networkπD 4128µLp ¯Q QTable 1: Analogous quantities5.2 – 1 ELEMENT


Interpretations of the spring <strong>element</strong>Problem type Quantities DesignationsSpringu 1 , P 1N●●k●●u 2 , P 2NkuPNspring stiffnessdisplacement<strong>element</strong> forcespring forceBaru 1 , P 1NLE, Au 2 , P 2NLEAuPNlengthmodulus of elasticityarea of cross sectiondisplacement<strong>element</strong> forcenormal forceThermalconductionQ 1T 1●λQLT 2●Q 2LλT¯QQlengththermal conductivitytemperature<strong>element</strong> heat flowinternal heat flowElectricalcircuitI 1U 1●IRU 2●I 2RŪIIresistancepotential<strong>element</strong> currentinternal currentGroundwaterflowLQ 1 φ 1Q φ 2 Q 2 k●kL●φ¯QQlengthpermeabilitypiezometric head<strong>element</strong> water flowinternal water flowPipenetwork(laminarflow)Q 1p 1 D, µp 2QLQ 2LDµp¯QQlengthpipe diameterviscositypressure<strong>element</strong> fluid flowinternal fluid flowTable 2: Quantities used in different types of problemsELEMENT 5.2 – 2


The following functions are available for the spring <strong>element</strong>:spring1espring1sSpring functionsCompute <strong>element</strong> matrixCompute spring force5.2 – 3 ELEMENT


spring1eSpring <strong>element</strong>Purpose:Compute <strong>element</strong> stiffness matrix for a spring <strong>element</strong>.k●u 1●u2Syntax:Ke=spring1e(ep)Description:spring1e provides the <strong>element</strong> stiffness matrix Ke for a spring <strong>element</strong>.The input variableep = [ k ]supplies the spring stiffness k or the analog quantity defined in Table 1.Theory:The <strong>element</strong> stiffness matrix K e , s<strong>to</strong>red in Ke, is computed according <strong>to</strong>[]K e k −k=−k kwhere k is defined by ep.ELEMENT 5.2 – 4


Spring <strong>element</strong>spring1sPurpose:Compute spring force in a spring <strong>element</strong>.N●●NSyntax:es=spring1s(ep,ed)Description:Theory:spring1s computes the spring force es in a spring <strong>element</strong>.The input variable ep is defined in spring1e and the <strong>element</strong> nodal displacements edare obtained by the function extract.The output variablees = [ N ]contains the spring force N, or the analog quantity.The spring force N, or analog quantity, is computed according <strong>to</strong>N = k [ u 2 − u 1 ]5.2 – 5 ELEMENT


Spring <strong>element</strong>spring1s5.3 Bar <strong>element</strong>sBar <strong>element</strong>s are available for one, two, and three dimensional analysis.dimensional <strong>element</strong>, see the spring <strong>element</strong>.For the oneBar <strong>element</strong>su 4u 2u 3u 5u 4u 6u 2u 3 u 1u 1bar2ebar2gbar3ebar2ebar2gbar2sbar3ebar3sTwo dimensional bar functionsCompute <strong>element</strong> matrixCompute <strong>element</strong> matrix for geometric nonlinear <strong>element</strong>Compute normal forceThree dimensional bar functionsCompute <strong>element</strong> matrixCompute normal force5.3 – 1 ELEMENT


ar2eTwo dimensional bar <strong>element</strong>Purpose:Compute <strong>element</strong> stiffness matrix for a two dimensional bar <strong>element</strong>.u 4yu 3(x 2 ,y 2 )u x2E, A(x 1 ,y 1 )xu 1Syntax:Ke=bar2e(ex,ey,ep)Description:Theory:bar2e provides the global <strong>element</strong> stiffness matrix Ke for a two dimensional bar <strong>element</strong>.The input variablesex = [ x 1 x 2 ]ey = [ y 1 y 2 ]ep = [ E A ]supply the <strong>element</strong> nodal coordinates x 1 , y 1 , x 2 , and y 2 , the modulus of elasticity E,and the cross section area A.The <strong>element</strong> stiffness matrix K e , s<strong>to</strong>red in Ke, is computed according <strong>to</strong>K e = G T¯Ke Gwhere¯K e = EAL[1 −1−1 1]G =[ ]nx¯x n y¯x 0 00 0 n x¯x n y¯xThe transformation matrix G contains the direction cosinesn x¯x = x 2 − x 1Ln y¯x = y 2 − y 1Lwhere the lengthL =√(x 2 − x 1 ) 2 + (y 2 − y 1 ) 2ELEMENT 5.3 – 2


Two dimensional bar <strong>element</strong>bar2gPurpose:Compute <strong>element</strong> stiffness matrix for a two dimensional geometric nonlinear bar.u 4yu 3(x 2 ,y 2 )u x2E, A, N(x 1 ,y 1 )xu 1Syntax:Ke=bar2g(ex,ey,ep,N)Description:Theory:bar2g provides the <strong>element</strong> stiffness matrix Ke for a two dimensional geometric nonlinearbar <strong>element</strong>.The input variables ex, ey and ep are described in bar2e. The input variableN = [ N ]contains the value of the normal force, which is positive in tension.The global <strong>element</strong> stiffness matrix K e , s<strong>to</strong>red in Ke, is computed according <strong>to</strong>K e = G T¯Ke Gwhere¯K e = EAL⎡⎢⎣1 0 −1 00 0 0 0−1 0 1 00 0 0 0⎤⎥⎦ + N L⎡⎢⎣0 0 0 00 1 0 −10 0 0 00 −1 0 1⎤⎥⎦⎡G = ⎢⎣⎤n x¯x n y¯x 0 0n xȳ n yȳ 0 0⎥0 0 n x¯x n y¯x ⎦0 0 n xȳ n yȳ5.3 – 3 ELEMENT


ar2gTwo dimensional bar <strong>element</strong>The transformation matrix G contains the direction cosinesn x¯x = n yȳ = x 2 − x 1Lwhere the length√L = (x 2 − x 1 ) 2 + (y 2 − y 1 ) 2n y¯x = −n xȳ = y 2 − y 1LELEMENT 5.3 – 4


Two dimensional bar <strong>element</strong>bar2sPurpose:Compute normal force in a two dimensional bar <strong>element</strong>.yNNxSyntax:es=bar2s(ex,ey,ep,ed)Description:Theory:bar2s computes the normal force in the two dimensional bar <strong>element</strong>s bar2e and bar2g.The input variables ex, ey, and ep are defined in bar2e and the <strong>element</strong> nodal displacements,s<strong>to</strong>red in ed, are obtained by the function extract.The output variablees = [ N ]contains the normal force N.The normal force N is computed fromN = EAL [ −11 ] G aewhere E, A, L, and the transformation matrix G are defined in bar2e. The nodaldisplacements in global coordinatesa e = [ u 1 u 2 u 3 u 4 ] Tare also shown in bar2e. Note that the transpose of a e is s<strong>to</strong>red in ed.5.3 – 5 ELEMENT


ar3eThree dimensional bar <strong>element</strong>Purpose:Compute <strong>element</strong> stiffness matrix for a three dimensional bar <strong>element</strong>.u 5yu 4u (x 2 ,y 2 ,z 2 )6u xE, A2u 3u 1(x 1 ,y 1 ,z 1 )zxSyntax:Ke=bar3e(ex,ey,ez,ep)Description:bar3e provides the <strong>element</strong> stiffness matrix Ke for a three dimensional bar <strong>element</strong>.The input variablesex = [ x 1 x 2 ]ey = [ y 1 y 2 ]ez = [ z 1 z 2 ]ep = [ E A ]Theory:supply the <strong>element</strong> nodal coordinates x 1 , y 1 , z 1 , x 2 etc, the modulus of elasticity E,and the cross section area A.The global <strong>element</strong> stiffness matrix K e is computed according <strong>to</strong>K e = G T¯Ke Gwhere¯K e = EAL[1 −1−1 1]G =[ ]nx¯x n y¯x n z¯x 0 0 00 0 0 n x¯x n y¯x n z¯xThe transformation matrix G contains the direction cosinesn x¯x = x 2 − x 1Lwhere the length L =n y¯x = y 2 − y 1Ln z¯x = z 2 − z 1L√(x 2 − x 1 ) 2 + (y 2 − y 1 ) 2 + (z 2 − z 1 ) 2 .ELEMENT 5.3 – 6


Three dimensional bar <strong>element</strong>bar3sPurpose:Compute normal force in a three dimensional bar <strong>element</strong>.yNNzxSyntax:es=bar3s(ex,ey,ez,ep,ed)Description:Theory:bar3s computes the normal force in a three dimensional bar <strong>element</strong>.The input variables ex, ey, ez, and ep are defined in bar3e, and the <strong>element</strong> nodaldisplacements, s<strong>to</strong>red in ed, are obtained by the function extract.The output variablees = [ N ]contains the normal force N of the bar.The normal force N is computed fromN = EAL [ −11 ] G aewhere E, A, L, and the transformation matrix G are defined in bar3e. The nodaldisplacements in global coordinatesa e = [ u 1 u 2 u 3 u 4 u 5 u 6 ] Tare also shown in bar3e. Note that the transpose of a e is s<strong>to</strong>red in ed.5.3 – 7 ELEMENT


5.4 Heat flow <strong>element</strong>sHeat flow <strong>element</strong>s are available for one, two, and three dimensional analysis. For onedimensional heat flow the spring <strong>element</strong> spring1 is used.A variety of important physical phenomena are described by the same differential equationas the heat flow problem. The heat flow <strong>element</strong> is thus applicable in modelling differentphysical applications. Table 3 below shows the relation between the primary variablea, the constitutive matrix D, and the load vec<strong>to</strong>r f l for a chosen set of two dimensionalphysical problems.Problem type a D f l DesignationHeat flow T λ x , λ y Q T = temperatureλ x , λ y = thermalconductivityQ = heat supplyGroundwater flow φ k x , k y , Q φ = piezometricheadk x , k y = permeabilitiesQ = fluid supplySt. Venant <strong>to</strong>rsionφ1G zy,1G zx2Θφ = stress functionG zy , G zx = shearmoduliΘ = angle of <strong>to</strong>rsionper unit lengthTable 3: Problem dependent parameters5.4 – 1 ELEMENT


Heat flow <strong>element</strong>s●T 3T 4 T 3●●T 2●T 1●T 1●T 2●flw2teflw2qeflw2i4eT 7T 6T 3●●T 4●T 8●T 4●T 3●●T 7T 6T 8T 5●●●●●●T 5●T 1●●T2T 1T 2flw2i8eflw3i8eflw2teflw2tsflw2qeflw2qsflw2i4eflw2i4sflw2i8eflw2i8sflw3i8eflw3i8s2D heat flow functionsCompute <strong>element</strong> matrices for a triangular <strong>element</strong>Compute temperature gradients and fluxCompute <strong>element</strong> matrices for a quadrilateral <strong>element</strong>Compute temperature gradients and fluxCompute <strong>element</strong> matrices, 4 node isoparametric <strong>element</strong>Compute temperature gradients and fluxCompute <strong>element</strong> matrices, 8 node isoparametric <strong>element</strong>Compute temperature gradients and flux3D heat flow functionsCompute <strong>element</strong> matrices, 8 node isoparametric <strong>element</strong>Compute temperature gradients and fluxELEMENT 5.4 – 2


Two dimensional heat flow <strong>element</strong>sflw2tePurpose:Compute <strong>element</strong> stiffness matrix for a triangular heat flow <strong>element</strong>.(x 3 ,y 3 )●T 3yT 1●(x 1 ,y 1 )T 2●(x 2 ,y 2 )Syntax:Ke=flw2te(ex,ey,ep,D)[Ke,fe]=flw2te(ex,ey,ep,D,eq)xDescription:Theory:flw2te provides the <strong>element</strong> stiffness (conductivity) matrix Ke and the <strong>element</strong> loadvec<strong>to</strong>r fe for a triangular heat flow <strong>element</strong>.The <strong>element</strong> nodal coordinates x 1 , y 1 , x 2 etc, are supplied <strong>to</strong> the function by exand ey, the <strong>element</strong> thickness t is supplied by ep and the thermal conductivities (orcorresponding quantities) k xx , k xy etc are supplied by D.ex = [ x 1 x 2 x 3 ]ey = [ y 1 y 2 y 3 ]ep = [ t ] D =[ ]kxx k xyk yx k yyIf the scalar variable eq is given in the function, the <strong>element</strong> load vec<strong>to</strong>r fe is computed,usingeq = [ Q ]where Q is the heat supply per unit volume.The <strong>element</strong> stiffness matrix K e and the <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in Ke and fe,respectively, are computed according <strong>to</strong>∫K e = (C −1 ) T ¯B T D ¯B t dA C −1A ∫f e l = (C −1 ) T ¯N T Q t dAAwith the constitutive matrix D defined by D.The evaluation of the integrals for the triangular <strong>element</strong> is based on the lineartemperature approximation T (x, y) and is expressed in terms of the nodal variablesT 1 , T 2 and T 3 asT (x, y) = N e a e = ¯N C −1 a e 5.4 – 3 ELEMENT


flw2teTwo dimensional heat flow <strong>element</strong>swhere¯N = [ 1 x y ] C =⎡⎢⎣⎤1 x 1 y 1⎥1 x 2 y 21 x 3 y 3⎦ a e =⎡⎢⎣⎤T 1⎥T 2 ⎦T 3and hence it follows that¯B = ∇ ¯N =[0 1 00 0 1]⎡∇ = ⎢⎣∂∂x∂∂y⎤⎥⎦Evaluation of the integrals for the triangular <strong>element</strong> yieldsK e = (C −1 ) T¯BT D ¯B C −1 t Af e l = QAt3 [ 1 1 1 ]Twhere the <strong>element</strong> area A is determined asA = 1 2 det CELEMENT 5.4 – 4


Two dimensional heat flow <strong>element</strong>sflw2tsPurpose:Syntax:Compute heat flux and temperature gradients in a triangular heat flow <strong>element</strong>.[es,et]=flw2ts(ex,ey,D,ed)Description:flw2ts computes the heat flux vec<strong>to</strong>r es and the temperature gradient et (or correspondingquantities) in a triangular heat flow <strong>element</strong>.The input variables ex, ey and the matrix D are defined in flw2te. The vec<strong>to</strong>r edcontains the nodal temperatures a e of the <strong>element</strong> and is obtained by the functionextract ased = (a e ) T = [ T 1 T 2 T 3 ]The output variableses = q T = [ q x q y ]et = (∇T ) T =[ ∂T∂x∂T∂y]Theory:contain the components of the heat flux and the temperature gradient computed inthe directions of the coordinate axis.The temperature gradient and the heat flux are computed according <strong>to</strong>∇T = ¯B C −1 a eq = −D∇Twhere the matrices D, ¯B, and C are described in flw2te. Note that both the temperaturegradient and the heat flux are constant in the <strong>element</strong>.5.4 – 5 ELEMENT


flw2qeTwo dimensional heat flow <strong>element</strong>sPurpose:Compute <strong>element</strong> stiffness matrix for a quadrilateral heat flow <strong>element</strong>.(x 4 ,y 4 )T 4●T 3● (x 3 ,y 3 )y(x 1 ,y 1 )●T 1●T 5●(x 2 ,y 2 )xT 2Syntax:Ke=flw2qe(ex,ey,ep,D)[Ke,fe]=flw2qe(ex,ey,ep,D,eq)Description:Theory:flw2qe provides the <strong>element</strong> stiffness (conductivity) matrix Ke and the <strong>element</strong> loadvec<strong>to</strong>r fe for a quadrilateral heat flow <strong>element</strong>.The <strong>element</strong> nodal coordinates x 1 , y 1 , x 2 etc, are supplied <strong>to</strong> the function by exand ey, the <strong>element</strong> thickness t is supplied by ep and the thermal conductivities (orcorresponding quantities) k xx , k xy etc are supplied by D.ex = [ x 1 x 2 x 3 x 4 ]ey = [ y 1 y 2 y 3 y 4 ]ep = [ t ] D =[ ]kxx k xyk yx k yyIf the scalar variable eq is given in the function, the <strong>element</strong> load vec<strong>to</strong>r fe is computed,usingeq = [ Q ]where Q is the heat supply per unit volume.In computing the <strong>element</strong> matrices, a fifth degree of freedom is introduced. Thelocation of this extra degree of freedom is defined by the mean value of the coordinatesin the corner points. Four sets of <strong>element</strong> matrices are calculated using flw2te. Thesematrices are then assembled and the fifth degree of freedom is eliminated by staticcondensation.ELEMENT 5.4 – 6


Two dimensional heat flow <strong>element</strong>sflw2qsPurpose:Syntax:Compute heat flux and temperature gradients in a quadrilateral heat flow <strong>element</strong>.[es,et]=flw2qs(ex,ey,ep,D,ed)[es,et]=flw2qs(ex,ey,ep,D,ed,eq)Description:flw2qs computes the heat flux vec<strong>to</strong>r es and the temperature gradient et (or correspondingquantities) in a quadrilateral heat flow <strong>element</strong>.The input variables ex, ey, eq and the matrix D are defined in flw2qe. The vec<strong>to</strong>r edcontains the nodal temperatures a e of the <strong>element</strong> and is obtained by the functionextract ased = (a e ) T = [ T 1 T 2 T 3 T 4 ]The output variableses = q T = [ q x q y ]et = (∇T ) T =[ ∂T∂x∂T∂y]Theory:contain the components of the heat flux and the temperature gradient computed inthe directions of the coordinate axis.By assembling four triangular <strong>element</strong>s as described in flw2te a system of equationscontaining 5 degrees of freedom is obtained. From this system of equations theunknown temperature at the center of the <strong>element</strong> is computed. Then according <strong>to</strong>the description in flw2ts the temperature gradient and the heat flux in each of thefour triangular <strong>element</strong>s are produced. Finally the temperature gradient and theheat flux of the quadrilateral <strong>element</strong> are computed as area weighted mean valuesfrom the values of the four triangular <strong>element</strong>s. If heat is supplied <strong>to</strong> the <strong>element</strong>,the <strong>element</strong> load vec<strong>to</strong>r eq is needed for the calculations.5.4 – 7 ELEMENT


flw2i4eTwo dimensional heat flow <strong>element</strong>sPurpose:Compute <strong>element</strong> stiffness matrix for a 4 node isoparametric heat flow <strong>element</strong>.T 4●T 3(x 4 ,y 4 ) ●(x 3 ,y 3 )yT 1●(x 1 ,y 1 )x●T 2(x 2 ,y 2 )Syntax:Ke=flw2i4e(ex,ey,ep,D)[Ke,fe]=flw2i4e(ex,ey,ep,D,eq)Description:flw2i4e provides the <strong>element</strong> stiffness (conductivity) matrix Ke and the <strong>element</strong> loadvec<strong>to</strong>r fe for a 4 node isoparametric heat flow <strong>element</strong>.The <strong>element</strong> nodal coordinates x 1 , y 1 , x 2 etc, are supplied <strong>to</strong> the function by ex andey. The <strong>element</strong> thickness t and the number of Gauss points n(n × n) integration points, n = 1, 2, 3are supplied <strong>to</strong> the function by ep and the thermal conductivities (or correspondingquantities) k xx , k xy etc are supplied by D.ex = [ x 1 x 2 x 3 x 4 ]ey = [ y 1 y 2 y 3 y 4 ]ep = [ t n ] D =[ ]kxx k xyk yx k yyIf the scalar variable eq is given in the function, the <strong>element</strong> load vec<strong>to</strong>r fe is computed,usingeq = [ Q ]where Q is the heat supply per unit volume.ELEMENT 5.4 – 8


Two dimensional heat flow <strong>element</strong>sflw2i4eTheory:The <strong>element</strong> stiffness matrix K e and the <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in Ke and fe,respectively, are computed according <strong>to</strong>∫K e = B eT D B e t dA∫ Af e l = N eT Q t dAAwith the constitutive matrix D defined by D.The evaluation of the integrals for the isoparametric 4 node <strong>element</strong> is based on atemperature approximation T (ξ, η), expressed in a local coordinates system in termsof the nodal variables T 1 , T 2 , T 3 and T 4 aswhereT (ξ, η) = N e a eN e = [ N e 1 N e 2 N e 3 N e 4 ] a e = [ T 1 T 2 T 3 T 4 ] TThe <strong>element</strong> shape functions are given byN1 e = 1 4 (1 − ξ)(1 − η) N 2 e = 1 (1 + ξ)(1 − η)4N3 e = 1 4 (1 + ξ)(1 + η) N 4 e = 1 (1 − ξ)(1 + η)4The B e -matrix is given by⎡B e = ∇N e = ⎢⎣∂∂x∂∂ywhere J is the Jacobian matrix⎡⎤∂x ∂x∂ξ ∂ηJ = ⎢⎥⎣ ∂y ∂y ⎦∂ξ ∂η⎤⎡⎥⎦ Ne = (J T ) −1 ⎢⎣∂∂ξ∂∂η⎤⎥⎦ NeEvaluation of the integrals is done by Gauss integration.5.4 – 9 ELEMENT


flw2i4sTwo dimensional heat flow <strong>element</strong>sPurpose:Syntax:Compute heat flux and temperature gradients in a 4 node isoparametric heat flow<strong>element</strong>.[es,et,eci]=flw2i4s(ex,ey,ep,D,ed)Description:flw2i4s computes the heat flux vec<strong>to</strong>r es and the temperature gradient et (or correspondingquantities) in a 4 node isoparametric heat flow <strong>element</strong>.The input variables ex, ey, ep and the matrix D are defined in flw2i4e. The vec<strong>to</strong>r edcontains the nodal temperatures a e of the <strong>element</strong> and is obtained by extract ased = (a e ) T = [ T 1 T 2 T 3 T 4 ]The output variables⎡es = ¯q T =⎢⎣q 1 xq 2 x.q n2xq 1 yq 2 y.q n2y⎤⎥⎦Theory:⎡et = ( ¯∇T ) T =⎢⎣∂T∂x∂T∂x.12n∂T2∂x∂T∂y∂T∂y.12n∂T2∂y⎤⎥⎦⎡eci =⎢⎣x 1 y 1x 2 y 2. .x n 2 y n 2contain the heat flux, the temperature gradient, and the coordinates of the integrationpoints. The index n denotes the number of integration points used within the<strong>element</strong>, cf. flw2i4e.The temperature gradient and the heat flux are computed according <strong>to</strong>∇T = B e a eq = −D∇Twhere the matrices D, B e , and a e are described in flw2i4e, and where the integrationpoints are chosen as evaluation points.⎤⎥⎦ELEMENT 5.4 – 10


Two dimensional heat flow <strong>element</strong>sflw2i8ePurpose:Compute <strong>element</strong> stiffness matrix for an 8 node isoparametric heat flow <strong>element</strong>.T 7T 6T 3●●T 4●y●●T 8T 5●●T 1 ●T 2xSyntax:Ke=flw2i8e(ex,ey,ep,D)[Ke,fe]=flw2i8e(ex,ey,ep,D,eq)Description:flw2i8e provides the <strong>element</strong> stiffness (conductivity) matrix Ke and the <strong>element</strong> loadvec<strong>to</strong>r fe for an 8 node isoparametric heat flow <strong>element</strong>.The <strong>element</strong> nodal coordinates x 1 , y 1 , x 2 etc, are supplied <strong>to</strong> the function by ex andey. The <strong>element</strong> thickness t and the number of Gauss points n(n × n) integration points, n = 1, 2, 3are supplied <strong>to</strong> the function by ep and the thermal conductivities (or correspondingquantities) k xx , k xy etc are supplied by D.ex = [ x 1 x 2 x 3 . . . x 8 ]ey = [ y 1 y 2 y 3 . . . y 8 ]ep = [ t n ] D =[ ]kxx k xyk yx k yyIf the scalar variable eq is given in the function, the vec<strong>to</strong>r fe is computed, usingeq = [ Q ]where Q is the heat supply per unit volume.5.4 – 11 ELEMENT


flw2i8eTwo dimensional heat flow <strong>element</strong>sTheory:The <strong>element</strong> stiffness matrix K e and the <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in Ke and fe,respectively, are computed according <strong>to</strong>∫K e = B eT D B e t dA∫ Af e l = N eT Q t dAAwith the constitutive matrix D defined by D.The evaluation of the integrals for the 2D isoparametric 8 node <strong>element</strong> is based on atemperature approximation T (ξ, η), expressed in a local coordinates system in termsof the nodal variables T 1 <strong>to</strong> T 8 aswhereT (ξ, η) = N e a eN e = [ N e 1 N e 2 N e 3 . . . N e 8 ] a e = [ T 1 T 2 T 3 . . . T 8 ] TThe <strong>element</strong> shape functions are given byN e 1 = − 1 4 (1 − ξ)(1 − η)(1 + ξ + η) N e 5 = 1 2 (1 − ξ2 )(1 − η)N e 2 = − 1 4 (1 + ξ)(1 − η)(1 − ξ + η) N e 6 = 1 2 (1 + ξ)(1 − η2 )N e 3 = − 1 4 (1 + ξ)(1 + η)(1 − ξ − η) N e 7 = 1 2 (1 − ξ2 )(1 + η)N e 4 = − 1 4 (1 − ξ)(1 + η)(1 + ξ − η) N e 8 = 1 2 (1 − ξ)(1 − η2 )The B e -matrix is given by⎡B e = ∇N e = ⎢⎣∂∂x∂∂ywhere J is the Jacobian matrix⎡⎤∂x ∂x∂ξ ∂ηJ = ⎢⎥⎣ ∂y ∂y ⎦∂ξ ∂η⎤⎡⎥⎦ Ne = (J T ) −1 ⎢⎣∂∂ξ∂∂η⎤⎥⎦ NeEvaluation of the integrals is done by Gauss integration.ELEMENT 5.4 – 12


Two dimensional heat flow <strong>element</strong>sflw2i8sPurpose:Syntax:Compute heat flux and temperature gradients in an 8 node isoparametric heat flow<strong>element</strong>.[es,et,eci]=flw2i8s(ex,ey,ep,D,ed)Description:flw2i8s computes the heat flux vec<strong>to</strong>r es and the temperature gradient et (or correspondingquantities) in an 8 node isoparametric heat flow <strong>element</strong>.The input variables ex, ey, ep and the matrix D are defined in flw2i8e. The vec<strong>to</strong>r edcontains the nodal temperatures a e of the <strong>element</strong> and is obtained by the functionextract ased = (a e ) T = [ T 1 T 2 T 3 . . . T 8 ]The output variables⎡es = ¯q T =⎢⎣q 1 xq 2 x.q n2xq 1 yq 2 y.q n2y⎤⎥⎦Theory:⎡et = ( ¯∇T ) T =⎢⎣∂T∂x∂T∂x.12n∂T2∂x∂T∂y∂T∂y.12n∂T2∂y⎤⎥⎦⎡eci =⎢⎣x 1 y 1x 2 y 2. .x n 2 y n 2contain the heat flux, the temperature gradient, and the coordinates of the integrationpoints. The index n denotes the number of integration points used within the<strong>element</strong>, cf. flw2i8e.The temperature gradient and the heat flux are computed according <strong>to</strong>∇T = B e a eq = −D∇Twhere the matrices D, B e , and a e are described in flw2i8e, and where the integrationpoints are chosen as evaluation points.⎤⎥⎦5.4 – 13 ELEMENT


flw3i8eThree dimensional heat flow <strong>element</strong>sPurpose:Compute <strong>element</strong> stiffness matrix for an 8 node isoparametric <strong>element</strong>.yT 8●T 4●T 3●●●T 5●T 1T 7T 6●●T2zxSyntax:Ke=flw3i8e(ex,ey,ez,ep,D)[Ke,fe]=flw3i8e(ex,ey,ez,ep,D,eq)Description:Theory:flw3i8e provides the <strong>element</strong> stiffness (conductivity) matrix Ke and the <strong>element</strong> loadvec<strong>to</strong>r fe for an 8 node isoparametric heat flow <strong>element</strong>.The <strong>element</strong> nodal coordinates x 1 , y 1 , z 1 x 2 etc, are supplied <strong>to</strong> the function by ex,ey and ez. The number of Gauss points n(n × n × n) integration points, n = 1, 2, 3are supplied <strong>to</strong> the function by ep and the thermal conductivities (or correspondingquantities) k xx , k xy etc are supplied by D.⎡⎤ex = [ x 1 x 2 x 3 . . . x 8 ]k xx k xy k xz⎢⎥ey = [ y 1 y 2 y 3 . . . y 8 ] ep = [ n ] D = ⎣ k yx k yy k yz ⎦ez = [ z 1 z 2 z 3 . . . z 8 ]k zx k zy k zzIf the scalar variable eq is given in the function, the <strong>element</strong> load vec<strong>to</strong>r fe is computed,usingeq = [ Q ]where Q is the heat supply per unit volume.The <strong>element</strong> stiffness matrix K e and the <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in Ke and fe,respectively, are computed according <strong>to</strong>∫K e = B eT D B e dVV ∫f e l = N eT Q dVVELEMENT 5.4 – 14


Three dimensional heat flow <strong>element</strong>sflw3i8ewith the constitutive matrix D defined by D.The evaluation of the integrals for the 3D isoparametric 8 node <strong>element</strong> is based ona temperature approximation T (ξ, η, ζ), expressed in a local coordinates system interms of the nodal variables T 1 <strong>to</strong> T 8 aswhereT (ξ, η, ζ) = N e a eN e = [ N e 1 N e 2 N e 3 . . . N e 8 ] a e = [ T 1 T 2 T 3 . . . T 8 ] TThe <strong>element</strong> shape functions are given byN1 e = 1 8 (1 − ξ)(1 − η)(1 − ζ) N 2 e = 1 (1 + ξ)(1 − η)(1 − ζ)8N3 e = 1 8 (1 + ξ)(1 + η)(1 − ζ) N 4 e = 1 (1 − ξ)(1 + η)(1 − ζ)8N5 e = 1 8 (1 − ξ)(1 − η)(1 + ζ) N 6 e = 1 (1 + ξ)(1 − η)(1 + ζ)8N7 e = 1 8 (1 + ξ)(1 + η)(1 + ζ) N 8 e = 1 (1 − ξ)(1 + η)(1 + ζ)8The B e -matrix is given by⎡B e = ∇N e =⎢⎣∂∂x∂∂y∂∂zwhere J is the Jacobian matrix⎡⎤∂x ∂x ∂x∂ξ ∂η ∂ζ∂y ∂y ∂yJ =∂ξ ∂η ∂ζ⎢⎥⎣ ∂z ∂z ∂z ⎦∂ξ ∂η ∂ζ⎤⎡N e = (J T ) −1 ⎥⎢⎦⎣∂∂ξ∂∂η∂∂ζ⎤N e⎥⎦Evaluation of the integrals is done by Gauss integration.5.4 – 15 ELEMENT


flw3i8sThree dimensional heat flow <strong>element</strong>sPurpose:Syntax:Compute heat flux and temperature gradients in an 8 node isoparametric heat flow<strong>element</strong>.[es,et,eci]=flw3i8s(ex,ey,ez,ep,D,ed)Description:flw3i8s computes the heat flux vec<strong>to</strong>r es and the temperature gradient et (or correspondingquantities) in an 8 node isoparametric heat flow <strong>element</strong>.The input variables ex, ey, ez, ep and the matrix D are defined in flw3i8e. The vec<strong>to</strong>red contains the nodal temperatures a e of the <strong>element</strong> and is obtained by the functionextract ased = (a e ) T = [ T 1 T 2 T 3 . . . T 8 ]The output variables⎡es = ¯q T =⎢⎣q 1 x q 1 y q 1 zq 2 x q 2 y q 2 z.q n3x.q n3y.q n3z⎤⎥⎦⎡et = ( ¯∇T ) T =⎢⎣∂T∂x∂T∂x.12n∂T3∂x∂T∂y∂T∂y.12n∂T3∂y∂T∂z∂T∂z.12n∂T3∂z⎤⎥⎦⎡eci =⎢⎣x 1 y 1 z 1x 2 y 2 z 2. . .x n 3 y n 3 z n 3⎤⎥⎦Theory:contain the heat flux, the temperature gradient, and the coordinates of the integrationpoints. The index n denotes the number of integration points used within the<strong>element</strong>, cf. flw3i8e.The temperature gradient and the heat flux are computed according <strong>to</strong>∇T = B e a eq = −D∇Twhere the matrices D, B e , and a e are described in flw3i8e, and where the integrationpoints are chosen as evaluation points.ELEMENT 5.4 – 16


5.5 Solid <strong>element</strong>sSolid <strong>element</strong>s are available for two dimensional analysis in plane stress (panels) and planestrain, and for general three dimensional analysis. In the two dimensional case there area triangular three node <strong>element</strong>, a quadrilateral four node <strong>element</strong>, two rectangular fournode <strong>element</strong>s, and quadrilateral isoparametric four and eight node <strong>element</strong>s. For threedimensional analysis there is an eight node isoparametric <strong>element</strong>.The <strong>element</strong>s are able <strong>to</strong> deal with both isotropic and anisotropic materials. The triangular<strong>element</strong> and the three isoparametric <strong>element</strong>s can also be used <strong>to</strong>gether with a nonlinearmaterial model. The material properties are specified by supplying the constitutive matrixD as an input variable <strong>to</strong> the <strong>element</strong> functions. This matrix can be formed by the functionsdescribed in Section 4.5.5 – 1 ELEMENT


Solid <strong>element</strong>s●u 5●u 2u 1u 6u 4u 3plante●●u 7u 5●●u 2u 1planqeu 6u 4u 3●u 8u 7u 5●●u 2 u 4●u 8u 1planreplantce●u 6u 3●u 8u 7●u 5●u 2u 1plani4eu 6u 4u 3●u 2●1●●48●●u 1plani8e75●3●●26●●●u 2u 3u 1●soli8e●●●●ELEMENT 5.5 – 2


planteplantsplantfplanqeplanqsplanreplanrsplantceplantcsplani4eplani4splani4fplani8eplani8splani8fsoli8esoli8ssoli8f2D solid functionsCompute <strong>element</strong> matrices for a triangular <strong>element</strong>Compute stresses and strainsCompute internal <strong>element</strong> forcesCompute <strong>element</strong> matrices for a quadrilateral <strong>element</strong>Compute stresses and strainsCompute <strong>element</strong> matrices for a rectangular Melosh <strong>element</strong>Compute stresses and strainsCompute <strong>element</strong> matrices for a rectangular Turner-Clough <strong>element</strong>Compute stresses and strainsCompute <strong>element</strong> matrices, 4 node isoparametric <strong>element</strong>Compute stresses and strainsCompute internal <strong>element</strong> forcesCompute <strong>element</strong> matrices, 8 node isoparametric <strong>element</strong>Compute stresses and strainsCompute internal <strong>element</strong> forces3D solid functionsCompute <strong>element</strong> matrices, 8 node isoparametric <strong>element</strong>Compute stresses and strainsCompute internal <strong>element</strong> forces5.5 – 3 ELEMENT


planteTwo dimensional solid <strong>element</strong>sPurpose:Compute <strong>element</strong> matrices for a triangular <strong>element</strong> in plane strain or plane stress.y(x 3 ,y 3 )●(x 1 ,y 1 )u 5●u 2u 1u 6u 4u 3●(x 2 ,y 2 )xSyntax:Ke=plante(ex,ey,ep,D)[Ke,fe]=plante(ex,ey,ep,D,eq)Description:plante provides an <strong>element</strong> stiffness matrix Ke and an <strong>element</strong> load vec<strong>to</strong>r fe for atriangular <strong>element</strong> in plane strain or plane stress.The <strong>element</strong> nodal coordinates x 1 , y 1 , x 2 etc. are supplied <strong>to</strong> the function by ex andey. The type of analysis ptype and the <strong>element</strong> thickness t are supplied by ep,ptype = 1ptype = 2plane stressplane strainand the material properties are supplied by the constitutive matrix D. Any arbitraryD-matrix with dimensions from (3 × 3) <strong>to</strong> (6 × 6) may be given. For an isotropicelastic material the constitutive matrix can be formed by the function hooke, seeSection 4.ex = [ x 1 x 2 x 3 ]ey = [ y 1 y 2 y 3 ]D =⎡⎢⎣⎤D 11 D 12 D 13⎥D 21 D 22 D 23D 31 D 32 D 33ep = [ ptype t ]⎡⎦ or D =⎢⎣D 11 D 12 D 13 D 14 [D 15 ] [D 16 ]D 21 D 22 D 23 D 24 [D 25 ] [D 26 ]D 31 D 32 D 33 D 34 [D 35 ] [D 36 ]D 41 D 42 D 43 D 44 [D 45 ] [D 46 ][D 51 ] [D 52 ] [D 53 ] [D 54 ] [D 55 ] [D 56 ][D 61 ] [D 62 ] [D 63 ] [D 64 ] [D 65 ] [D 66 ]⎤⎥⎦ELEMENT 5.5 – 4


Two dimensional solid <strong>element</strong>splanteTheory:If uniformly distributed loads are applied <strong>to</strong> the <strong>element</strong>, the <strong>element</strong> load vec<strong>to</strong>r feis computed. The input variable[ ]bxeq =b ycontaining loads per unit volume, b x and b y , is then given.The <strong>element</strong> stiffness matrix K e and the <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in Ke and fe,respectively, are computed according <strong>to</strong>∫K e = (C −1 ) T ¯B T D ¯B t dA C −1∫ Af e l = (C −1 ) T ¯N T b t dAAwith the constitutive matrix D defined by D, and the body force vec<strong>to</strong>r b defined byeq.The evaluation of the integrals for the triangular <strong>element</strong> is based on a linear displacementapproximation u(x, y) and is expressed in terms of the nodal variables u 1 ,u 2 , . . . , u 6 asu(x, y) = N e a e = ¯N C −1 a ewhereu =[uxu y]¯N =[1 x y 0 0 00 0 0 1 x y]⎡C =⎢⎣⎤1 x 1 y 1 0 0 00 0 0 1 x 1 y 11 x 2 y 2 0 0 00 0 0 1 x 2 y 2⎥1 x 3 y 3 0 0 0 ⎦0 0 0 1 x 3 y 3⎡a e =⎢⎣⎤u 1u 2u 3u 4⎥u 5 ⎦u 6The matrix ¯B is obtained as¯B = ˜∇ ¯Nc where ˜∇ =⎢⎣⎡∂∂x0∂∂y⎤0∂∂y⎥∂ ⎦∂xIf a larger D-matrix than (3 × 3) is used for plane stress (ptype = 1), the D-matrixis reduced <strong>to</strong> a (3 × 3) matrix by static condensation using σ zz = σ xz = σ yz = 0.These stress components are connected with the rows 3, 5 and 6 in the D-matrixrespectively.5.5 – 5 ELEMENT


planteTwo dimensional solid <strong>element</strong>sIf a larger D-matrix than (3 × 3) is used for plane strain (ptype = 2), the D-matrixis reduced <strong>to</strong> a (3 × 3) matrix using ε zz = γ xz = γ yz = 0. This implies that a(3 × 3) D-matrix is created by the rows and the columns 1, 2 and 4 from the originalD-matrix.Evaluation of the integrals for the triangular <strong>element</strong> yieldsK e = (C −1 ) T¯BT D ¯B C −1 t Af e l= A t3 [ b x b y b x b y b x b y ] Twhere the <strong>element</strong> area A is determined as⎡⎤A = 1 1 x 1 y 12 det ⎢⎥⎣ 1 x 2 y 2 ⎦1 x 3 y 3ELEMENT 5.5 – 6


Two dimensional solid <strong>element</strong>splantsPurpose:Compute stresses and strains in a triangular <strong>element</strong> in plane strain or plane stress.yu 5●u 2u 6u 4u 3●σ xxσ xyσ yyσ xyσ xx●u 1xσ yySyntax:[es,et]=plants(ex,ey,ep,D,ed)Description:plants computes the stresses es and the strains et in a triangular <strong>element</strong> in planestrain or plane stress.The input variables ex, ey, ep and D are defined in plante. The vec<strong>to</strong>r ed containsthe nodal displacements a e of the <strong>element</strong> and is obtained by the function extract ased = (a e ) T = [ u 1 u 2 . . . u 6 ]The output variableses = σ T = [ σ xx σ yy [σ zz ] σ xy [σ xz ] [σ yz ] ]Theory:et = ε T = [ ε xx ε yy [ε zz ] γ xy [γ xz ] [γ yz ] ]contain the stress and strain components. The size of es and et follows the size of D.Note that for plane stress ε zz ≠ 0, and for plane strain σ zz ≠ 0.The strains and stresses are computed according <strong>to</strong>ε = ¯B C −1 a eσ = D εwhere the matrices D, ¯B, C and a e are described in plante. Note that both thestrains and the stresses are constant in the <strong>element</strong>.5.5 – 7 ELEMENT


plantfTwo dimensional solid <strong>element</strong>sPurpose:Syntax:Compute internal <strong>element</strong> force vec<strong>to</strong>r in a triangular <strong>element</strong> in plane strain orplane stress.ef=plantf(ex,ey,ep,es)Description:Theory:plantf computes the internal <strong>element</strong> forces ef in a triangular <strong>element</strong> in plane strainor plane stress.The input variables ex, ey and ep are defined in plante, and the input variable es isdefined in plants.The output variableef = f T i = [ f i1 f i2 . . . f i6 ]contains the components of the internal force vec<strong>to</strong>r.The internal force vec<strong>to</strong>r is computed according <strong>to</strong>∫f i = B T σ t dAAwhere the matrices B and σ are defined in plante and plants, respectively.Evaluation of the integral for the triangular <strong>element</strong> yieldsf i = ¯B C −1 σ t AELEMENT 5.5 – 8


Two dimensional solid <strong>element</strong>splanqePurpose:Compute <strong>element</strong> matrices for a quadrilateral <strong>element</strong> in plane strain or plane stress.●(x 1 ,y 1 )u 1xu 6u 4u 3●2yu 83 u 5u●4 7●u 2Syntax:Ke=planqe(ex,ey,ep,D)[Ke,fe]=planqe(ex,ey,ep,D,eq)Description:planqe provides an <strong>element</strong> stiffness matrix Ke and an <strong>element</strong> load vec<strong>to</strong>r fe for aquadrilateral <strong>element</strong> in plane strain or plane stress.The <strong>element</strong> nodal coordinates x 1 , y 1 , x 2 etc. are supplied <strong>to</strong> the function by ex andey. The type of analysis ptype and the <strong>element</strong> thickness t are supplied by ep,ptype = 1ptype = 2plane stressplane strainand the material properties are supplied by the constitutive matrix D. Any arbitraryD-matrix with dimensions from (3 × 3) <strong>to</strong> (6 × 6) may be given. For an isotropicelastic material the constitutive matrix can be formed by the function hooke, seeSection 4.ex = [ x 1 x 2 x 3 x 4 ]ey = [ y 1 y 2 y 3 y 4 ]D =⎡⎢⎣⎤D 11 D 12 D 13⎥D 21 D 22 D 23D 31 D 32 D 33⎦ or D =⎢⎣ep = [ ptype t ]⎡D 11 D 12 D 13 D 14 [D 15 ] [D 16 ]D 21 D 22 D 23 D 24 [D 25 ] [D 26 ]D 31 D 32 D 33 D 34 [D 35 ] [D 36 ]D 41 D 42 D 43 D 44 [D 45 ] [D 46 ][D 51 ] [D 52 ] [D 53 ] [D 54 ] [D 55 ] [D 56 ][D 61 ] [D 62 ] [D 63 ] [D 64 ] [D 65 ] [D 66 ]⎤⎥⎦5.5 – 9 ELEMENT


planqeTwo dimensional solid <strong>element</strong>sTheory:If uniformly distributed loads are applied on the <strong>element</strong>, the <strong>element</strong> load vec<strong>to</strong>r feis computed. The input variable[ ]bxeq =b ycontaining loads per unit volume, b x and b y , is then given.In computing the <strong>element</strong> matrices, two more degrees of freedom are introduced.The location of these two degrees of freedom is defined by the mean value of thecoordinates at the corner points. Four sets of <strong>element</strong> matrices are calculated usingplante. These matrices are then assembled and the two extra degrees of freedom areeliminated by static condensation.ELEMENT 5.5 – 10


Two dimensional solid <strong>element</strong>splanqsPurpose:Compute stresses and strains in a quadrilateral <strong>element</strong> in plane strain or planestress.y●u 8u 7●u 5●u 2u 1u 6u 4u 3σ xxσ xyσ yyσ xyσ xx●xσ yySyntax:[es,et]=planqs(ex,ey,ep,D,ed)[es,et]=planqs(ex,ey,ep,D,ed,eq)Description:planqs computes the stresses es and the strains et in a quadrilateral <strong>element</strong> in planestrain or plane stress.The input variables ex, ey, ep, D and eq are defined in planqe. The vec<strong>to</strong>r ed containsthe nodal displacements a e of the <strong>element</strong> and is obtained by the function extract ased = (a e ) T = [ u 1 u 2 . . . u 8 ]If body forces are applied <strong>to</strong> the <strong>element</strong> the variable eq must be included.The output variableses = σ T = [ σ xx σ yy [σ zz ] σ xy [σ xz ] [σ yz ] ]Theory:et = ε T = [ ε xx ε yy [ε zz ] γ xy [γ xz ] [γ yz ] ]contain the stress and strain components. The size of es and et follows the size of D.Note that for plane stress ε zz ≠ 0, and for plane strain σ zz ≠ 0.By assembling triangular <strong>element</strong>s as described in planqe a system of equations containing10 degrees of freedom is obtained. From this system of equations the twounknown displacements at the center of the <strong>element</strong> are computed. Then according<strong>to</strong> the description in plants the strain and stress components in each of the four triangular<strong>element</strong>s are produced. Finally the quadrilateral <strong>element</strong> strains and stressesare computed as area weighted mean values from the values of the four triangular<strong>element</strong>s. If uniformly distributed loads are applied on the <strong>element</strong>, the <strong>element</strong> loadvec<strong>to</strong>r eq is needed for the calculations.5.5 – 11 ELEMENT


planreTwo dimensional solid <strong>element</strong>sPurpose:Compute <strong>element</strong> matrices for a rectangular (Melosh) <strong>element</strong> in plane strain orplane stress.u 8u 1u 6u 3y(x 4 ,y 4 )●u 7u 5●(x 3 ,y 3 )u 2u 4(x 1 ,y 1 )●●(x 2 ,y 2 )xSyntax:Ke=planre(ex,ey,ep,D)[Ke,fe]=planre(ex,ey,ep,D,eq)Description:planre provides an <strong>element</strong> stiffness matrix Ke and an <strong>element</strong> load vec<strong>to</strong>r fe for arectangular (Melosh) <strong>element</strong> in plane strain or plane stress. This <strong>element</strong> can onlybe used if the <strong>element</strong> edges are parallel <strong>to</strong> the coordinate axis.The <strong>element</strong> nodal coordinates (x 1 , y 1 ) and (x 3 , y 3 ) are supplied <strong>to</strong> the function byex and ey. The type of analysis ptype and the <strong>element</strong> thickness t are supplied by ep,ptype = 1ptype = 2plane stressplane strainand the material properties are supplied by the constitutive matrix D. Any arbitraryD-matrix with dimensions from (3 × 3) <strong>to</strong> (6 × 6) may be given. For an isotropicelastic material the constitutive matrix can be formed by the function hooke, seeSection 4.ex = [ x 1 x 3 ]ey = [ y 1 y 3 ]D =⎡⎢⎣⎤D 11 D 12 D 13⎥D 21 D 22 D 23D 31 D 32 D 33ep = [ ptype t ]⎡⎦ or D =⎢⎣D 11 D 12 D 13 D 14 [D 15 ] [D 16 ]D 21 D 22 D 23 D 24 [D 25 ] [D 26 ]D 31 D 32 D 33 D 34 [D 35 ] [D 36 ]D 41 D 42 D 43 D 44 [D 45 ] [D 46 ][D 51 ] [D 52 ] [D 53 ] [D 54 ] [D 55 ] [D 56 ][D 61 ] [D 62 ] [D 63 ] [D 64 ] [D 65 ] [D 66 ]⎤⎥⎦ELEMENT 5.5 – 12


Two dimensional solid <strong>element</strong>splanreTheory:If uniformly distributed loads are applied on the <strong>element</strong>, the <strong>element</strong> load vec<strong>to</strong>r feis computed. The input variable[ ]bxeq =b ycontaining loads per unit volume, b x and b y , is then given.The <strong>element</strong> stiffness matrix K e and the <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in Ke and fe,respectively, are computed according <strong>to</strong>∫K e = B eT D B e t dA∫ Af e l = N eT b t dAAwith the constitutive matrix D defined by D, and the body force vec<strong>to</strong>r b defined byeq.The evaluation of the integrals for the rectangular <strong>element</strong> is based on a bilineardisplacement approximation u(x, y) and is expressed in terms of the nodal variablesu 1 , u 2 , . . ., u 8 asu(x, y) = N e a ewhereu =[uxu y]N e =[Ne1 0 N e 2 0 N e 3 0 N e 4 00 N e 1 0 N e 2 0 N e 3 0 N e 4]⎡a e =⎢⎣⎤u 1u 2⎥. ⎦u 8With a local coordinate system located at the center of the <strong>element</strong>, the <strong>element</strong>shape functions N e 1 − N e 4 are obtained aswhereN1 e 1=4ab (x − x 2)(y − y 4 )N2 e = − 14ab (x − x 1)(y − y 3 )N3 e 1=4ab (x − x 4)(y − y 2 )N e 4 = − 14ab (x − x 3)(y − y 1 )a = 1 2 (x 3 − x 1 ) and b = 1 2 (y 3 − y 1 )5.5 – 13 ELEMENT


planreTwo dimensional solid <strong>element</strong>sThe matrix ¯B is obtained asB = ˜∇N where⎡˜∇ =⎢⎣∂∂x0∂∂y0∂∂y∂∂x⎤⎥⎦If a larger D-matrix than (3 × 3) is used for plane stress (ptype = 1), the D-matrixis reduced <strong>to</strong> a (3 × 3) matrix by static condensation using σ zz = σ xz = σ yz = 0.These stress components are connected with the rows 3, 5 and 6 in the D-matrixrespectively.If a larger D-matrix than (3 × 3) is used for plane strain (ptype = 2), the D-matrixis reduced <strong>to</strong> a (3 × 3) matrix using ε zz = γ xz = γ yz = 0. This implies that a(3 × 3) D-matrix is created by the rows and the columns 1, 2 and 4 from the originalD-matrix.Evaluation of the integrals for the rectangular <strong>element</strong> can be done either analyticallyor numerically by use of a 2 × 2 point Gauss integration. The <strong>element</strong> load vec<strong>to</strong>r fleyieldsf e l⎡= abt⎢⎣⎤b xb yb xb yb xb y⎥b x ⎦b yELEMENT 5.5 – 14


Two dimensional solid <strong>element</strong>splanrsPurpose:Compute stresses and strains in a rectangular (Melosh) <strong>element</strong> in plane strain orplane stress.yu 8u 1u 6u 3u 7u 5●●u 2 u 4σ xxσ xyσ yyσ xyσ xx●●xσ yySyntax:[es,et]=planrs(ex,ey,ep,D,ed)Description:planrs computes the stresses es and the strains et in a rectangular (Melosh) <strong>element</strong>in plane strain or plane stress. The stress and strain components are computed atthe center of the <strong>element</strong>.The input variables ex, ey, ep and D are defined in planre. The vec<strong>to</strong>r ed containsthe nodal displacements a e of the <strong>element</strong> and is obtained by the function extract ased = (a e ) T = [ u 1 u 2 . . . u 8 ]The output variableses = σ T = [ σ xx σ yy [σ zz ] σ xy [σ xz ] [σ yz ] ]Theory:et = ε T = [ ε xx ε yy [ε zz ] γ xy [γ xz ] [γ yz ] ]contain the stress and strain components. The size of es and et follows the size of D.Note that for plane stress ε zz ≠ 0, and for plane strain σ zz ≠ 0.The strains and stresses are computed according <strong>to</strong>ε = B e a eσ = D εwhere the matrices D, B e , and a e are described in planre, and where the evaluationpoint (x, y) is chosen <strong>to</strong> be at the center of the <strong>element</strong>.5.5 – 15 ELEMENT


plantceTwo dimensional solid <strong>element</strong>sPurpose:Compute <strong>element</strong> matrices for a rectangular (Turner-Clough) <strong>element</strong> in plane strainor plane stress.u 8u 1u 6u 3y(x 4 ,y 4 )●u 7u 5●(x 3 ,y 3 )u 2u 4(x 1 ,y 1 )●●(x 2 ,y 2 )xSyntax:Ke=plantce(ex,ey,ep)[Ke,fe]=plantce(ex,ey,ep,eq)Description:plantce provides an <strong>element</strong> stiffness matrix Ke and an <strong>element</strong> load vec<strong>to</strong>r fe for arectangular (Turner-Clough) <strong>element</strong> in plane strain or plane stress. This <strong>element</strong>can only be used if the material is isotropic and if the <strong>element</strong> edges are parallel <strong>to</strong>the coordinate axis.The <strong>element</strong> nodal coordinates (x 1 , y 1 ) and (x 3 , y 3 ) are supplied <strong>to</strong> the function by exand ey. The state of stress ptype, the <strong>element</strong> thickness t and the material propertiesE and ν are supplied by ep. For plane stress ptype = 1 and for plane strain ptype = 2.ex = [ x 1 x 3 ]ey = [ y 1 y 3 ]ep = [ ptype t E ν ]If uniformly distributed loads are applied <strong>to</strong> the <strong>element</strong>, the <strong>element</strong> load vec<strong>to</strong>r feis computed. The input variable[ ]bxeq =b ycontaining loads per unit volume, b x and b y , is then given.ELEMENT 5.5 – 16


Two dimensional solid <strong>element</strong>splantceTheory:The <strong>element</strong> stiffness matrix K e and the <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in Ke and fe,respectively, are computed according <strong>to</strong>∫K e = B eT D B e t dA∫ Af e l = N eT b t dAAwhere the constitutive matrix D is described in hooke, see Section 4, and the bodyforce vec<strong>to</strong>r b is defined by eq.The evaluation of the integrals for the Turner-Clough <strong>element</strong> is based on a displacementfield u(x, y) built up of a bilinear displacement approximation superposedby bubble functions in order <strong>to</strong> create a linear stress field over the <strong>element</strong>. Thedisplacement field is expressed in terms of the nodal variables u 1 , u 2 , . . ., u 8 asu(x, y) = N e a ewhereu =[uxu y]N e =[Ne1 N e 5 N e 2 N e 5 N e 3 N e 5 N e 4 N e 5N e 6 N e 1 N e 6 N e 2 N e 6 N e 3 N e 6 N e 4]⎡a e =⎢⎣⎤u 1u 2⎥. ⎦u 8With a local coordinate system located at the center of the <strong>element</strong>, the <strong>element</strong>shape functions N e 1 − N e 6 are obtained aswhereN1 e = 1 (a − x)(b − y)4abN2 e = 1 (a + x)(b − y)4abN3 e = 1 (a + x)(b + y)4abN e 4 = 14abN e 5 = 18abN e 6 = 18ab(a − x)(b + y)[(b 2 − y 2 ) + ν(a 2 − x 2 ) ][(a 2 − x 2 ) + ν(b 2 − y 2 ) ]a = 1 2 (x 3 − x 1 ) and b = 1 2 (y 3 − y 1 )5.5 – 17 ELEMENT


plantceTwo dimensional solid <strong>element</strong>sThe matrix ¯B is obtained asB = ˜∇N where⎡˜∇ =⎢⎣∂∂x0∂∂y0∂∂y∂∂x⎤⎥⎦Evaluation of the integrals for the Turner-Clough <strong>element</strong> can be done either analyticallyor numerically by use of a 2 × 2 point Gauss integration. The <strong>element</strong> loadvec<strong>to</strong>r fle yields⎡ ⎤b xb yb xfle b = abt yb xb y⎢ ⎥⎣ b x ⎦b yELEMENT 5.5 – 18


Two dimensional solid <strong>element</strong>splantcsPurpose:Compute stresses and strains in a Turner-Clough <strong>element</strong> in plane strain or planestress.yu 8u 1u 6u 3u 7u 5●●u 2 u 4σ xxσ xyσ yyσ xyσ xx●●xσ yySyntax:[es,et]=plantcs(ex,ey,ep,ed)Description:plantcs computes the stresses es and the strains et in a rectangular Turner-Clough <strong>element</strong>in plane strain or plane stress. The stress and strain components are computedat the center of the <strong>element</strong>.The input variables ex, ey, and ep are defined in plantce. The vec<strong>to</strong>r ed contains thenodal displacements a e of the <strong>element</strong> and is obtained by the function extract ased = (a e ) T = [ u 1 u 2 . . . u 8 ]The output variableses = σ T = [ σ xx σ yy [σ zz ] σ xy [σ xz ] [σ yz ] ]Theory:et = ε T = [ ε xx ε yy [ε zz ] γ xy [γ xz ] [γ yz ] ]contain the stress and strain components. The size of es and et follows the size of D.Note that for plane stress ε zz ≠ 0, and for plane strain σ zz ≠ 0.The strains and stresses are computed according <strong>to</strong>ε = B e a eσ = D εwhere the matrices D, B e , and a e are described in plantce, and where the evaluationpoint (x, y) is chosen <strong>to</strong> be at the center of the <strong>element</strong>.5.5 – 19 ELEMENT


plani4eTwo dimensional solid <strong>element</strong>sPurpose:uCompute <strong>element</strong> matrices for a 4 node isoparametric <strong>element</strong> in plane strain orplane stress.u 6u 83y u 2u●4 7●5u 4u 3Syntax:●(x 1 ,y 1 )Ke=plani4e(ex,ey,ep,D)[Ke,fe]=plani4e(ex,ey,ep,D,eq)u 1x●2Description:plani4e provides an <strong>element</strong> stiffness matrix Ke and an <strong>element</strong> load vec<strong>to</strong>r fe for a 4node isoparametric <strong>element</strong> in plane strain or plane stress.The <strong>element</strong> nodal coordinates x 1 , y 1 , x 2 etc. are supplied <strong>to</strong> the function by ex andey. The type of analysis ptype, the <strong>element</strong> thickness t, and the number of Gausspoints n are supplied by ep.ptype = 1 plane stress (n × n) integration pointsptype = 2 plane strain n = 1, 2, 3The material properties are supplied by the constitutive matrix D. Any arbitrary D-matrix with dimensions from (3 × 3) <strong>to</strong> (6 × 6) maybe given. For an isotropic elasticmaterial the constitutive matrix can be formed by the function hooke, see Section 4.ex = [ x 1 x 2 x 3 x 4 ]ey = [ y 1 y 2 y 3 y 4 ]D =⎡⎢⎣⎤D 11 D 12 D 13⎥D 21 D 22 D 23D 31 D 32 D 33⎦ or D =⎢⎣ep = [ ptype t n ]⎡D 11 D 12 D 13 D 14 [D 15 ] [D 16 ]D 21 D 22 D 23 D 24 [D 25 ] [D 26 ]D 31 D 32 D 33 D 34 [D 35 ] [D 36 ]D 41 D 42 D 43 D 44 [D 45 ] [D 46 ][D 51 ] [D 52 ] [D 53 ] [D 54 ] [D 55 ] [D 56 ][D 61 ] [D 62 ] [D 63 ] [D 64 ] [D 65 ] [D 66 ]If different D i -matrices are used in the Gauss points these D i -matrices are s<strong>to</strong>redin a global vec<strong>to</strong>r D. For numbering of the Gauss points, see eci in plani4s.⎡ ⎤D 1D 2D =⎢ ⎥⎣ . ⎦D n 2ELEMENT 5.5 – 20⎤⎥⎦


Two dimensional solid <strong>element</strong>splani4eTheory:If uniformly distributed loads are applied <strong>to</strong> the <strong>element</strong>, the <strong>element</strong> load vec<strong>to</strong>r feis computed. The input variable[ ]bxeq =b ycontaining loads per unit volume, b x and b y , is then given.The <strong>element</strong> stiffness matrix K e and the <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in Ke and fe,respectively, are computed according <strong>to</strong>∫K e = B eT D B e t dA∫ Af e l = N eT b t dAAwith the constitutive matrix D defined by D, and the body force vec<strong>to</strong>r b defined byeq.The evaluation of the integrals for the isoparametric 4 node <strong>element</strong> is based on adisplacement approximation u(ξ, η), expressed in a local coordinates system in termsof the nodal variables u 1 , u 2 , . . ., u 8 aswhereu(ξ, η) = N e a eu =[uxu y]N e =The <strong>element</strong> shape functions are given by[Ne1 0 N e 2 0 N e 3 0 N e 4 00 N e 1 0 N e 2 0 N e 3 0 N e 4N1 e = 1 4 (1 − ξ)(1 − η) N 2 e = 1 (1 + ξ)(1 − η)4N3 e = 1 4 (1 + ξ)(1 + η) N 4 e = 1 (1 − ξ)(1 + η)4]⎡a e =⎢⎣⎤u 1u 2⎥. ⎦u 8The matrix ¯B is obtained asB = ˜∇N where ˜∇ =⎢⎣and where⎡ ⎤⎡∂∂x⎢ ⎥⎣ ∂ ⎦ = (JT ) −1 ⎢⎣∂y∂∂ξ∂∂η⎤⎥⎦⎡∂∂x0∂∂y⎤0∂∂y⎥∂ ⎦∂x⎡J = ⎢⎣∂x∂ξ∂y∂ξ∂x∂η∂y∂η⎤⎥⎦5.5 – 21 ELEMENT


plani4eTwo dimensional solid <strong>element</strong>sIf a larger D-matrix than (3 × 3) is used for plane stress (ptype = 1), the D-matrixis reduced <strong>to</strong> a (3 × 3) matrix by static condensation using σ zz = σ xz = σ yz = 0.These stress components are connected with the rows 3, 5 and 6 in the D-matrixrespectively.If a larger D-matrix than (3 × 3) is used for plane strain (ptype = 2), the D-matrixis reduced <strong>to</strong> a (3 × 3) matrix using ε zz = γ xz = γ yz = 0. This implies that a(3 × 3) D-matrix is created by the rows and the columns 1, 2 and 4 from the originalD-matrix.Evaluation of the integrals is done by Gauss integration.ELEMENT 5.5 – 22


Two dimensional solid <strong>element</strong>splani4sPurpose:Compute stresses and strains in a 4 node isoparametric <strong>element</strong> in plane strain orplane stress.y●u 8u 7●u 5●u 2u 1u 6u 4u 3σ xxσ xyσ yyσ xyσ xx●xσ yySyntax:[es,et,eci]=plani4s(ex,ey,ep,D,ed)Description:plani4s computes stresses es and the strains et in a 4 node isoparametric <strong>element</strong> inplane strain or plane stress.The input variables ex, ey, ep and the matrix D are defined in plani4e. The vec<strong>to</strong>r edcontains the nodal displacements a e of the <strong>element</strong> and is obtained by the functionextract ased = (a e ) T = [ u 1 u 2 . . . u 8 ]The output variables⎡[ ]σ xx 1 σyy 1 [σzz] 1 σxy 1 [σxz]1 σ1yz [ ]es = σ T σxx 2 σyy 2 [σ=zz] 2 σxy 2 [σxz]2 σ2yz ⎢⎣. . [ . ] . [ . ] [ . ]σxxn2 σyyn2 σn 2zz σxyn2 σn 2xz σn 2yz⎤⎥⎦⎡et = ε T =⎢⎣ε 1 xx ε 1 yy [ε 1 zz] γ 1 xy [γ 1 xz]ε 2 xx ε 2 yy [ε 2 zz] γ 2 xy [γ 2 xz].ε n2xx.ε n2yy[ . ]εn 2zz.γ n2xy[γ1yz][γ2yz][ . ] [ . ]γn 2xz γn 2yz⎤⎥⎦⎡eci =⎢⎣x 1 y 1x 2 y 2. .x n 2 y n 2⎤⎥⎦contain the stress and strain components, and the coordinates of the integrationpoints. The index n denotes the number of integration points used within the <strong>element</strong>,cf. plani4e. The number of columns in es and et follows the size of D. Notethat for plane stress ε zz ≠ 0, and for plane strain σ zz ≠ 0.5.5 – 23 ELEMENT


plani4sTwo dimensional solid <strong>element</strong>sTheory:The strains and stresses are computed according <strong>to</strong>ε = B e a eσ = D εwhere the matrices D, B e , and a e are described in plani4e, and where the integrationpoints are chosen as evaluation points.ELEMENT 5.5 – 24


Two dimensional solid <strong>element</strong>splani4fPurpose:Syntax:Compute internal <strong>element</strong> force vec<strong>to</strong>r in a 4 node isoparametric <strong>element</strong> in planestrain or plane stress.ef=plani4f(ex,ey,ep,es)Description:Theory:plani4f computes the internal <strong>element</strong> forces ef in a 4 node isoparametric <strong>element</strong> inplane strain or plane stress.The input variables ex, ey and ep are defined in plani4e, and the input variable es isdefined in plani4s.The output variableef = f T i = [ f i1 f i2 . . . f i8 ]contains the components of the internal force vec<strong>to</strong>r.The internal force vec<strong>to</strong>r is computed according <strong>to</strong>∫f i = B T σ t dAAwhere the matrices B and σ are defined in plani4e and plani4s, respectively.Evaluation of the integral is done by Gauss integration.5.5 – 25 ELEMENT


plani8eTwo dimensional solid <strong>element</strong>sPurpose:Compute <strong>element</strong> matrices for an 8 node isoparametric <strong>element</strong> in plane strain orplane stress.73●●4yu 2●1●●8(x 1 ,y 1 ) u 1●5●●26Syntax:Ke=plani8e(ex,ey,ep,D)[Ke,fe]=plani8e(ex,ey,ep,D,eq)Description:xplani8e provides an <strong>element</strong> stiffness matrix Ke and an <strong>element</strong> load vec<strong>to</strong>r fe for an8 node isoparametric <strong>element</strong> in plane strain or plane stress.The <strong>element</strong> nodal coordinates x 1 , y 1 , x 2 etc. are supplied <strong>to</strong> the function by ex andey. The type of analysis ptype, the <strong>element</strong> thickness t, and the number of Gausspoints n are supplied by ep.ptype = 1 plane stress (n × n) integration pointsptype = 2 plane strain n = 1, 2, 3The material properties are supplied by the constitutive matrix D. Any arbitraryD-matrix with dimensions from (3 × 3) <strong>to</strong> (6 × 6) may be given. For an isotropicelastic material the constitutive matrix can be formed by the function hooke, seeSection 4.ex = [ x 1 x 2 . . . x 8 ]ep = [ ptype t n ]ey = [ y 1 y 2 . . . y 8 ]D =⎡⎢⎣⎤D 11 D 12 D 13⎥D 21 D 22 D 23D 31 D 32 D 33⎡⎦ or D =⎢⎣D 11 D 12 D 13 D 14 [D 15 ] [D 16 ]D 21 D 22 D 23 D 24 [D 25 ] [D 26 ]D 31 D 32 D 33 D 34 [D 35 ] [D 36 ]D 41 D 42 D 43 D 44 [D 45 ] [D 46 ][D 51 ] [D 52 ] [D 53 ] [D 54 ] [D 55 ] [D 56 ][D 61 ] [D 62 ] [D 63 ] [D 64 ] [D 65 ] [D 66 ]If different D i -matrices are used in the Gauss points these D i -matrices are s<strong>to</strong>redin a global vec<strong>to</strong>r D. For numbering of the Gauss points, see eci in plani8s.⎡ ⎤D 1D 2D =⎢ ⎥⎣ . ⎦D n 2ELEMENT 5.5 – 26⎤⎥⎦


Two dimensional solid <strong>element</strong>splani8eTheory:If uniformly distributed loads are applied <strong>to</strong> the <strong>element</strong>, the <strong>element</strong> load vec<strong>to</strong>r feis computed. The input variable[ ]bxeq =b ycontaining loads per unit volume, b x and b y , is then given.The <strong>element</strong> stiffness matrix K e and the <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in Ke and fe,respectively, are computed according <strong>to</strong>∫K e = B eT D B e t dAA∫f e l = N eT b t dAAwith the constitutive matrix D defined by D, and the body force vec<strong>to</strong>r b defined byeq.The evaluation of the integrals for the isoparametric 8 node <strong>element</strong> is based on adisplacement approximation u(ξ, η), expressed in a local coordinates system in termsof the nodal variables u 1 , u 2 , . . ., u 16 asu(ξ, η) = N e a ewhereu =[uxu y]N e =[Ne1 0 N e 2 0 . . . N e 8 00 N e 1 0 N e 2 . . . 0 N e 8]⎡a e =⎢⎣⎤u 1u 2⎥. ⎦u 16The <strong>element</strong> shape functions are given byN1 e = − 1 4 (1 − ξ)(1 − η)(1 + ξ + η) N 5 e = 1 2 (1 − ξ2 )(1 − η)N2 e = − 1 4 (1 + ξ)(1 − η)(1 − ξ + η) N 6 e = 1 2 (1 + ξ)(1 − η2 )N3 e = − 1 4 (1 + ξ)(1 + η)(1 − ξ − η) N 7 e = 1 2 (1 − ξ2 )(1 + η)N4 e = − 1 4 (1 − ξ)(1 + η)(1 + ξ − η) N 8 e = 1 2 (1 − ξ)(1 − η2 )The matrix ¯B is obtained asB = ˜∇N where⎡˜∇ =⎢⎣∂∂x0∂∂y0∂∂y∂∂x⎤⎥⎦5.5 – 27 ELEMENT


plani8eTwo dimensional solid <strong>element</strong>sand where⎡∂∂x⎢⎣ ∂∂y⎤⎡⎥⎦ = (JT ) −1 ⎢⎣∂∂ξ∂∂η⎤⎥⎦⎡J = ⎢⎣∂x∂ξ∂y∂ξ∂x∂η∂y∂η⎤⎥⎦If a larger D-matrix than (3 × 3) is used for plane stress (ptype = 1), the D-matrixis reduced <strong>to</strong> a (3 × 3) matrix by static condensation using σ zz = σ xz = σ yz = 0.These stress components are connected with the rows 3, 5 and 6 in the D-matrixrespectively.If a larger D-matrix than (3 × 3) is used for plane strain (ptype = 2), the D-matrixis reduced <strong>to</strong> a (3 × 3) matrix using ε zz = γ xz = γ yz = 0. This implies that a(3 × 3) D-matrix is created by the rows and the columns 1, 2 and 4 from the originalD-matrix.Evaluation of the integrals is done by Gauss integration.ELEMENT 5.5 – 28


Two dimensional solid <strong>element</strong>splani8sPurpose:Compute stresses and strains in an 8 node isoparametric <strong>element</strong> in plane strain orplane stress.yu 2●1●●48u 1●●75●3●●26σ xxσ xyσ yyσ xyσ xxxσ yySyntax:[es,et,eci]=plani8s(ex,ey,ep,D,ed)Description:plani8s computes stresses es and the strains et in an 8 node isoparametric <strong>element</strong> inplane strain or plane stress.The input variables ex, ey, ep and the matrix D are defined in plani8e. The vec<strong>to</strong>r edcontains the nodal displacements a e of the <strong>element</strong> and is obtained by the functionextract ased = (a e ) T = [ u 1 u 2 . . . u 16 ]The output variables⎡[ ]σ xx 1 σyy 1 [σzz] 1 σxy 1 [σxz]1 σ1yz [ ]es = σ T σxx 2 σyy 2 [σ=zz] 2 σxy 2 [σxz]2 σ2yz ⎢⎣. . [ . ] . [ . ] [ . ]σxxn2 σyyn2 σn 2zz σxyn2 σn 2xz σn 2yz⎤⎥⎦⎡et = ε T =⎢⎣ε 1 xx ε 1 yy [ε 1 zz] γ 1 xy [γ 1 xz]ε 2 xx ε 2 yy [ε 2 zz] γ 2 xy [γ 2 xz].ε n2xx.ε n2yy[ . ]εn 2zz.γ n2xy[γ1yz][γ2yz][ . ] [ . ]γn 2xz γn 2yz⎤⎥⎦⎡eci =⎢⎣x 1 y 1x 2 y 2. .x n 2 y n 2⎤⎥⎦contain the stress and strain components, and the coordinates of the integrationpoints. The index n denotes the number of integration points used within the <strong>element</strong>,cf. plani8e. The number of columns in es and et follows the size of D. Notethat for plane stress ε zz ≠ 0, and for plane strain σ zz ≠ 0.5.5 – 29 ELEMENT


plani8sTwo dimensional solid <strong>element</strong>sTheory:The strains and stresses are computed according <strong>to</strong>ε = B e a eσ = D εwhere the matrices D, B e , and a e are described in plani8e, and where the integrationpoints are chosen as evaluation points.ELEMENT 5.5 – 30


Two dimensional solid <strong>element</strong>splani8fPurpose:Syntax:Compute internal <strong>element</strong> force vec<strong>to</strong>r in an 8 node isoparametric <strong>element</strong> in planestrain or plane stress.ef=plani8f(ex,ey,ep,es)Description:Theory:plani8f computes the internal <strong>element</strong> forces ef in an 8 node isoparametric <strong>element</strong>in plane strain or plane stress.The input variables ex, ey and ep are defined in plani8e, and the input variable es isdefined in plani8s.The output variableef = f T i = [ f i1 f i2 . . . f i16 ]contains the components of the internal force vec<strong>to</strong>r.The internal force vec<strong>to</strong>r is computed according <strong>to</strong>∫f i = B T σ t dAAwhere the matrices B and σ are defined in plani8e and plani8s, respectively.Evaluation of the integral is done by Gauss integration.5.5 – 31 ELEMENT


soli8eThree dimensional solid <strong>element</strong>sPurpose:Compute <strong>element</strong> matrices for an 8 node isoparametric solid <strong>element</strong>.zy8●4●u 2u 1u 3 ●(x 1 ,y 1 ,z 1 ) ●●25●6x7●3●Syntax:Ke=soli8e(ex,ey,ez,ep,D)[Ke,fe]=soli8e(ex,ey,ez,ep,D,eq)Description:soli8e provides an <strong>element</strong> stiffness matrix Ke and an <strong>element</strong> load vec<strong>to</strong>r fe for an 8node isoparametric solid <strong>element</strong>.The <strong>element</strong> nodal coordinates x 1 , y 1 , z 1 , x 2 etc. are supplied <strong>to</strong> the function by ex,ey and ez, and the number of Gauss points n are supplied by ep.(n × n) integration points, n = 1, 2, 3The material properties are supplied by the constitutive matrix D. Any arbitraryD-matrix with dimensions (6 × 6) may be given. For an isotropic elastic material theconstitutive matrix can be formed by the function hooke, see Section 4.⎡ex = [ x 1 x 2 . . . x 8 ]ey = [ y 1 y 2 . . . y 8 ]ez = [ z 1 z 2 . . . z 8 ]⎤D 11 D 12 · · · D 16D 21 D 22 · · · D 26ep = [ n ] D =⎢.⎣ . . .. ⎥ . ⎦D 61 D 62 · · · D 66If different D i -matrices are used in the Gauss points these D i -matrices are s<strong>to</strong>redin a global vec<strong>to</strong>r D. For numbering of the Gauss points, see eci in soli8s.⎡ ⎤D 1D 2D =⎢ ⎥⎣ . ⎦D n 3If uniformly distributed loads are applied <strong>to</strong> the <strong>element</strong>, the <strong>element</strong> load vec<strong>to</strong>r feis computed. The input variable⎡ ⎤b x⎢ ⎥eq = ⎣ b y ⎦b zELEMENT 5.5 – 32


Three dimensional solid <strong>element</strong>ssoli8econtaining loads per unit volume, b x , b y , and b z , is then given.Theory:The <strong>element</strong> stiffness matrix K e and the <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in Ke and fe,respectively, are computed according <strong>to</strong>∫K e = B eT D B e dV∫ Vf e l = N eT b dVVwith the constitutive matrix D defined by D, and the body force vec<strong>to</strong>r b defined byeq.The evaluation of the integrals for the isoparametric 8 node solid <strong>element</strong> is basedon a displacement approximation u(ξ, η, ζ), expressed in a local coordinates systemin terms of the nodal variables u 1 , u 2 , . . ., u 24 asu(ξ, η, ζ) = N e a ewhereu =⎡⎢⎣u xu yu z⎤⎥⎦ N e =⎡⎢⎣N e 1 0 0 N e 2 0 0 . . . N e 8 0 00 N e 1 0 0 N e 2 0 . . . 0 N e 8 00 0 N e 1 0 0 N e 2 . . . 0 0 N e 8⎤⎥⎦ a e =⎡⎢⎣⎤u 1u 2⎥. ⎦u 24The <strong>element</strong> shape functions are given byN1 e = 1 8 (1 − ξ)(1 − η)(1 − ζ) N 5 e = 1 (1 − ξ)(1 − η)(1 + ζ)8N2 e = 1 8 (1 + ξ)(1 − η)(1 − ζ) N 6 e = 1 (1 + ξ)(1 − η)(1 + ζ)8N3 e = 1 8 (1 + ξ)(1 + η)(1 − ζ) N 7 e = 1 (1 + ξ)(1 + η)(1 + ζ)8N4 e = 1 8 (1 − ξ)(1 + η)(1 − ζ) N 8 e = 1 (1 − ξ)(1 + η)(1 + ζ)8The B e -matrix is obtained asB e = ˜∇N e 5.5 – 33 ELEMENT


soli8eThree dimensional solid <strong>element</strong>swhere⎡˜∇ =⎢⎣∂∂x00 0∂∂y0 0∂∂y∂∂z0∂∂x0∂∂z0∂∂z0∂∂x∂∂y⎤⎥⎦⎡⎢⎣∂∂x∂∂y∂∂z⎤⎡= (J T ) −1 ⎥⎢⎦⎣∂∂ξ∂∂η∂∂ζ⎤⎥⎦J =⎡⎢⎣∂x∂ξ∂y∂ξ∂z∂ξ∂x∂η∂y∂η∂z∂η∂x∂ζ∂y∂ζ∂z∂ζ⎤⎥⎦Evaluation of the integrals is done by Gauss integration.ELEMENT 5.5 – 34


Three dimensional solid <strong>element</strong>ssoli8sPurpose:Compute stresses and strains in an 8 node isoparametric solid <strong>element</strong>.zy8●4●u 1u 2u 3 ●(x 1 ,y 1 ,z 1 ) ●●25●6x7●3●σ yyσ yxσ yzσ xyσ zy σ xxσ zz σ xzσ zxSyntax:[es,et,eci]=soli8s(ex,ey,ez,ep,D,ed)Description:soli8s computes stresses es and the strains et in an 8 node isoparametric solid <strong>element</strong>.The input variables ex, ey, ez, ep and the matrix D are defined in soli8e. The vec<strong>to</strong>red contains the nodal displacements a e of the <strong>element</strong> and is obtained by the functionextract ased = (a e ) T = [ u 1 u 2 . . . u 24 ]The output variables⎡σxx 1 σyy 1 σzz 1 σxy 1 σxz 1 σyz1 es = σ T σxx =2 σyy 2 σzz 2 σxy 2 σxz 2 σyz2 ⎢⎣ . . . . . .σ n3xxσ n3yyσ n3zzσ n3xyσ n3xzσ n3yz⎤⎥⎦⎡ε 1 xx ε 1 yy ε 1 zz γxy 1 γxz 1 γ 1 ⎤yzet = ε T ε=2 xx ε 2 yy ε 2 zz γxy 2 γxz 2 γ 2 yz⎢⎥⎣ . . . . . . ⎦ε n3xxε n3yyε n3zzγ n3xyγ n3xzγ n3yz⎡eci =⎢⎣x 1 y 1 z 1x 2 y 2 z 2. . .x n 3 y n 3 z n 3contain the stress and strain components, and the coordinates of the integrationpoints. The index n denotes the number of integration points used within the <strong>element</strong>,cf. soli8e.⎤⎥⎦5.5 – 35 ELEMENT


soli8sThree dimensional solid <strong>element</strong>sTheory:The strains and stresses are computed according <strong>to</strong>ε = B e a eσ = D εwhere the matrices D, B e , and a e are described in soli8e, and where the integrationpoints are chosen as evaluation points.ELEMENT 5.5 – 36


Three dimensional solid <strong>element</strong>ssoli8fPurpose:Syntax:Compute internal <strong>element</strong> force vec<strong>to</strong>r in an 8 node isoparametric solid <strong>element</strong>.ef=soli8f(ex,ey,ez,ep,es)Description:Theory:soli8f computes the internal <strong>element</strong> forces ef in an 8 node isoparametric solid <strong>element</strong>.The input variables ex, ey, ez and ep are defined in soli8e, and the input variable esis defined in soli8s.The output variableef = f T i = [ f i1 f i2 . . . f i24 ]contains the components of the internal force vec<strong>to</strong>r.The internal force vec<strong>to</strong>r is computed according <strong>to</strong>∫f i = B T σ dVVwhere the matrices B and σ are defined in soli8e and soli8s, respectively.Evaluation of the integral is done by Gauss integration.5.5 – 37 ELEMENT


5.6 Beam <strong>element</strong>sBeam <strong>element</strong>s are available for two, and three dimensional linear static analysis. Twodimensional beam <strong>element</strong>s for nonlinear geometric and dynamic analysis are also available.Beam <strong>element</strong>su 3u 2u 4u 1beam2ebeam2tbeam2wbeam2gbeam2du 6u 5u 11u 7uu 95u 12u 2u 1 u 4u 3u 6beam3eu 8u 10beam2ebeam2sbeam2tbeam2tsbeam2wbeam2wsbeam2gbeam2gsbeam2dbeam2dsbeam3ebeam3s2D beam <strong>element</strong>sCompute <strong>element</strong> matricesCompute section forcesCompute <strong>element</strong> matrices for Timoshenko beam <strong>element</strong>Compute section forces for Timoshenko beam <strong>element</strong>Compute <strong>element</strong> matrices for beam <strong>element</strong> on elastic foundationCompute section forces for beam <strong>element</strong> on elastic foundationCompute <strong>element</strong> matrices with respect <strong>to</strong> geometric nonlinearityCompute section forces for geometric nonlinear beam <strong>element</strong>Compute <strong>element</strong> matrices, dynamic analysisCompute section forces, dynamic analysis3D beam <strong>element</strong>sCompute <strong>element</strong> matricesCompute section forces5.6 – 1 ELEMENT


eam2eTwo dimensional beam <strong>element</strong>Purpose:Compute <strong>element</strong> stiffness matrix for a two dimensional beam <strong>element</strong>.u 5yu 6u 4(x 2 ,y 2 )u x2 E, A, Iu 3(x 1 ,y 1 )u 1xSyntax:Ke=beam2e(ex,ey,ep)[Ke,fe]=beam2e(ex,ey,ep,eq)Description:beam2e provides the global <strong>element</strong> stiffness matrix Ke for a two dimensional beam<strong>element</strong>.The input variablesex = [ x 1 x 2 ]ey = [ y 1 y 2 ]ep = [ E A I ]supply the <strong>element</strong> nodal coordinates x 1 , y 1 , x 2 , and y 2 , the modulus of elasticity E,the cross section area A, and the moment of inertia I.The <strong>element</strong> load vec<strong>to</strong>r fe can also be computed if uniformly distributed loads areapplied <strong>to</strong> the <strong>element</strong>. The optional input variableeq = [ ]q¯x qȳthen contains the distributed loads per unit length, q¯x and qȳ.ELEMENT 5.6 – 2


Two dimensional beam <strong>element</strong>beam2eq y2yq x1xTheory:The <strong>element</strong> stiffness matrix K e , s<strong>to</strong>red in Ke, is computed according <strong>to</strong>K e = G T ¯Ke Gwhere⎡¯K e =⎢⎣EAL0 0 − EAL0 0012EIL 306EIL 26EI0 − 12EIL 2 L 34EI0 − 6EIL L 26EIL 22EIL− EAL0 0EAL0 00 − 12EIL 306EIL 2− 6EI12EI0L 2 L 32EI0 − 6EIL L 2− 6EIL 24EIL⎤⎥⎦⎡G =⎢⎣n x¯x n y¯x 0 0 0 0n xȳ n yȳ 0 0 0 00 0 1 0 0 00 0 0 n x¯x n y¯x 00 0 0 n xȳ n yȳ 00 0 0 0 0 1The transformation matrix G contains the direction cosines⎤⎥⎦n x¯x = n yȳ = x 2 − x 1Ln y¯x = −n xȳ = y 2 − y 1Lwhere the length√L = (x 2 − x 1 ) 2 + (y 2 − y 1 ) 2The <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in fe, is computed according <strong>to</strong>f e l = G T¯f el5.6 – 3 ELEMENT


eam2eTwo dimensional beam <strong>element</strong>where⎡e ¯f l =⎢⎣q¯x L2qȳL2qȳL 212q¯x L2qȳL2− q ȳL 212⎤⎥⎦ELEMENT 5.6 – 4


Two dimensional beam <strong>element</strong>beam2sPurpose:Compute section forces in a two dimensional beam <strong>element</strong>.N nyMV nM nM VNV 1N 1M 1xNVSyntax:es=beam2s(ex,ey,ep,ed)es=beam2s(ex,ey,ep,ed,eq)[es,edi,eci]=beam2s(ex,ey,ep,ed,eq,n)Description:Theory:beam2s computes the section forces and displacements in local directions along thebeam <strong>element</strong> beam2e.The input variables ex, ey, ep and eq are defined in beam2e, and the <strong>element</strong> displacements,s<strong>to</strong>red in ed, are obtained by the function extract. If distributed loads areapplied <strong>to</strong> the <strong>element</strong>, the variable eq must be included. The number of evaluationpoints for section forces and displacements are determined by n. If n is omitted, onlythe ends of the beam are evaluated.The output variableses = [ N V M ] edi = [ ū ¯v ] eci = [ ¯x ]consist of column matrices that contain the section forces, the displacements, andthe evaluation points on the local x-axis. The explicit matrix expressions are⎡es =⎢⎣⎤N 1 V 1 M 1N 2 V 2 M 2⎥. . . ⎦N n V n M n⎡ ⎤ū 1 ¯v 1ū 2 ¯v 2edi =⎢ ⎥⎣ . . ⎦¯v nū nwhere L is the length of the beam <strong>element</strong>.⎡eci =⎢⎣0¯x 2.¯x n−1L5.6 – 5 ELEMENT⎤⎥⎦


eam2sTwo dimensional beam <strong>element</strong>The evaluation of the section forces is based on the solutions of the basic equationsEA d2 ūd¯x 2 + q¯x = 0EI d4¯vd¯x 4 − q ȳ = 0From these equations, the displacements along the beam <strong>element</strong> are obtained as thesum of the homogeneous and the particular solutionswhereandu =[ū(¯x)¯v(¯x)]= u h + u pu h = ¯N C −1 G a e u p =¯N =[ ]1 ¯x 0 0 0 00 0 1 ¯x ¯x 2 ¯x 3[ūp (¯x)¯v p (¯x)⎡C =⎢⎣⎡]= ⎢⎣⎤q¯x L¯x24EI (1 − ¯x ⎥⎦L )22EA (1 − ¯x L )qȳL 2¯x 2⎤1 0 0 0 0 00 0 1 0 0 00 0 0 1 0 01 L 0 0 0 00 0 1 L L 2 L 3 ⎥⎦0 0 0 1 2L 3L 2⎡a e =⎢⎣⎤u 1u 2⎥. ⎦u 6The transformation matrix G e and nodal displacements a e are described in beam2e.Note that the transpose of a e is s<strong>to</strong>red in ed.Finally the section forces are obtained fromN = EA dūd¯xV = −EI d3¯vd¯x 3M = EI d2¯vd¯x 2Examples:Section forces or <strong>element</strong> displacements can easily be plotted. The bending momentM along the beam is plotted by>> plot(eci,es(:,3))ELEMENT 5.6 – 6


Two dimensional Timoshenko beam <strong>element</strong>beam2tPurpose:Compute <strong>element</strong> stiffness matrix for a two dimensional Timoshenko beam <strong>element</strong>.u 5yu 6u 4(x 2 ,y 2 )u x2 E, A, G, IA, I, k su 3(x 1 ,y 1 )u 1xSyntax:Ke=beam2t(ex,ey,ep)[Ke,fe]=beam2t(ex,ey,ep,eq)Description:beam2t provides the global <strong>element</strong> stiffness matrix Ke for a two dimensional Timoshenkobeam <strong>element</strong>.The input variablesex = [ x 1 x 2 ]ey = [ y 1 y 2 ]ep = [ E G A I k s ]supply the <strong>element</strong> nodal coordinates x 1 , y 1 , x 2 , and y 2 , the modulus of elasticityE, the shear modulus G, the cross section area A, the moment of inertia I and theshear correction fac<strong>to</strong>r k s .The <strong>element</strong> load vec<strong>to</strong>r fe can also be computed if uniformly distributed loads areapplied <strong>to</strong> the <strong>element</strong>. The optional input variableeq = [ ]q¯x qȳthen contains the distributed loads per unit length, q¯x and qȳ.5.6 – 7 ELEMENT


eam2tTwo dimensional Timoshenko beam <strong>element</strong>q y2yq x1Theory:xThe <strong>element</strong> stiffness matrix K e , s<strong>to</strong>red in Ke, is computed according <strong>to</strong>K e = G T ¯Ke Gwhere G is described in beam2e, and ¯K e is given bywith⎡¯K e =⎢⎣µ = 12EIL 2 GAk sEAL0 0 − EAL0 0012EIL 3 (1+µ)06EIL 2 (1+µ)6EI0 − 12EIL 2 (1+µ) L 3 (1+µ)4EI(1+ µ 4 )L(1+µ)0 − 6EIL 2 (1+µ)6EIL 2 (1+µ)2EI(1− µ 2 )L(1+µ)− EAL0 0EAL0 00 − 12EIL 3 (1+µ)− 6EIL 2 (1+µ)012EIL 3 (1+µ)− 6EIL 2 (1+µ)06EIL 2 (1+µ)2EI(1− µ 2 )L(1+µ)0 − 6EIL 2 (1+µ)4EI(1+ µ 4 )L(1+µ)⎤⎥⎦ELEMENT 5.6 – 8


Two dimensional Timoshenko beam <strong>element</strong>beam2tsPurpose:Compute section forces in a two dimensional Timoshenko beam <strong>element</strong>.N nyMV nM nM VNV 1N 1M 1xNVSyntax:es=beam2ts(ex,ey,ep,ed)es=beam2ts(ex,ey,ep,ed,eq)[es,edi,eci]=beam2ts(ex,ey,ep,ed,eq,n)Description:Theory:beam2ts computes the section forces and displacements in local directions along thebeam <strong>element</strong> beam2t.The input variables ex, ey, ep and eq are defined in beam2t. The <strong>element</strong> displacements,s<strong>to</strong>red in ed, are obtained by the function extract. If distributed loads areapplied <strong>to</strong> the <strong>element</strong>, the variable eq must be included. The number of evaluationpoints for section forces and displacements are determined by n. If n is omitted, onlythe ends of the beam are evaluated.The output variableses = [ N V M ] edi = [ ū ¯v ] eci = [¯x]consist of column matrices that contain the section forces, the displacements androtation of the cross section (note that the rotation θ is not equal <strong>to</strong> d¯v ), and thed¯xevaluation points on the local x-axis. The explicit matrix expressions are⎡ ⎤⎡⎤⎡⎤0N 1 V 1 M 1ū 1 ¯v 1 θ 1¯x N 2 V 2 M 2ū 2 ¯v 2 θ 22es =⎢⎥ edi =⎢⎥ eci =⎣ . . . ⎦⎣ . . . ⎦.⎢⎣ ¯x⎥N n V n M n ū n ¯v n θ n−1 ⎦nLwhere L is the length of the beam <strong>element</strong>.5.6 – 9 ELEMENT


eam2tsTwo dimensional Timoshenko beam <strong>element</strong>The evaluation of the section forces is based on the solutions of the basic equationsEA d2 ūd¯x 2 + q¯x = 0EI d3 θd¯x 3 − q ȳ = 0EI d4¯vd¯x 4 − q ȳ = 0(The equations are valid if qȳ is not more than a linear function of ¯x). From theseequations, the displacements along the beam <strong>element</strong> are obtained as the sum of thehomogeneous and the particular solutionswhereandu =⎡⎢⎣ū(¯x)¯v(¯x)θ(¯x)⎤⎥⎦ = u h + u pu h = ¯N C −1 G a e u p =¯N =⎡⎢⎣⎡⎢⎣ū p (¯x)¯v p (¯x)θ p (¯x)1 ¯x 0 0 0 00 0 1 ¯x ¯x 2 ¯x 30 0 0 1 2x 3(x 2 + 2α)⎤⎤⎥⎦ =⎡⎢⎣q¯x L¯x2EA (1 − ¯x L )qȳL 2¯x 224EI (1 − ¯x L )2 +q ȳL¯x(1 − ¯x 2GA k s L )⎥⎦ α = EIGA k sqȳL 2¯x12EI (1 − 2¯x L )(1 − ¯x L )⎤⎥⎦⎡C =⎢⎣1 0 0 0 0 00 0 1 0 0 00 0 0 1 0 6α1 L 0 0 0 00 0 1 L L 2 L 30 0 0 1 2L 3(L 2 + 2α)⎤⎥⎦⎡a e =⎢⎣⎤u 1u 2⎥. ⎦u 6The transformation matrix G and nodal displacements a e are described in beam2e.Note that the transpose of a e is s<strong>to</strong>red in ed.Finally the section forces are obtained fromN = EA dūd¯xV = GA k s ( d¯vd¯x − θ)dθM = EId¯xELEMENT 5.6 – 10


Two dimensional beam <strong>element</strong>beam2wPurpose:Compute <strong>element</strong> stiffness matrix for a two dimensional beam <strong>element</strong> on elasticfoundation.yk ak txSyntax:Ke=beam2w(ex,ey,ep)[Ke,fe]=beam2w(ex,ey,ep,eq)Description:beam2w provides the global <strong>element</strong> stiffness matrix Ke for a two dimensional beam<strong>element</strong> on elastic foundation.The input variables ex and ey are described in beam2e, andep = [ E A I k a k t ]contains the modulus of elasticity E, the cross section area A, the moment of inertia I,the spring stiffness in the axial direction k a , and the spring stiffness in the transversedirection k t .The <strong>element</strong> load vec<strong>to</strong>r fe can also be computed if uniformly distributed loads areapplied <strong>to</strong> the <strong>element</strong>. The optional input variable eq, described in beam2e, containsthe distributed loads.5.6 – 11 ELEMENT


eam2wTwo dimensional beam <strong>element</strong>Theory:The <strong>element</strong> stiffness matrix K e , s<strong>to</strong>red in Ke, is computed according <strong>to</strong>K e = G T ( ¯K e + ¯K e s)Gwhere G and ¯K e are described in beam2e.The matrix ¯K e s is given by¯K e s =L420⎡⎢⎣where the length√L = (x 2 − x 1 ) 2 + (y 2 − y 1 ) 2⎤140k a 0 0 70k a 0 00 156k t 22k t L 0 54k t −13k t L0 22k t L 4k t L 2 0 13k t L −3k t L 270k a 0 0 140k a 0 0⎥0 54k t 13k t L 0 156k t −22k t L ⎦0 −13k t L −3k t L 2 0 −22k t L 4k t L 2ELEMENT 5.6 – 12


Two dimensional beam <strong>element</strong>beam2wsPurpose:Compute section forces in a two dimensional beam <strong>element</strong> on elastic foundation.yM 2V 2N 2M 1N V 1 1xSyntax:es=beam2ws(ex,ey,ep,ed)es=beam2ws(ex,ey,ep,ed,eq)Description:beam2ws computes the section forces at the ends of the beam <strong>element</strong> on elasticfoundation beam2w.The input variables ex, ey, ep and eq are defined in beam2w, and the <strong>element</strong> displacements,s<strong>to</strong>red in ed, are obtained by the function extract. If distributed loadsare applied <strong>to</strong> the <strong>element</strong> the variable eq must be included.The output variable[ ]N1 Ves =1 M 1N 2 V 2 M 2contains the section forces at the ends of the beam.5.6 – 13 ELEMENT


eam2wsTwo dimensional beam <strong>element</strong>Theory:The section forces at the ends of the beam are obtained from the <strong>element</strong> force vec<strong>to</strong>r¯P = [ −N 1 − V 1 − M 1 N 2 V 2 M 2 ] Tcomputed according <strong>to</strong>¯P = ( ¯K e + ¯K e s) G a e − ¯f lThe matrices ¯K e and G, are described in beam2e, and the matrix ¯K e s is described inbeam2w. The nodal displacementsa e = [ u 1 u 2 u 3 u 4 u 5 u 6 ] Tare shown in beam2e. Note that the transpose of a e is s<strong>to</strong>red in ed.ELEMENT 5.6 – 14


Two dimensional beam <strong>element</strong>beam2gPurpose:Compute <strong>element</strong> stiffness matrix for a two dimensional nonlinear beam <strong>element</strong>.u 5yu 6u 4(x 2 ,y 2 )u x2 E, A, I, Nu 3u 1(x 1 ,y 1 )xSyntax:Ke=beam2g(ex,ey,ep,N)[Ke,fe]=beam2g(ex,ey,ep,N,eq)Description:beam2g provides the global <strong>element</strong> stiffness matrix Ke for a two dimensional beam<strong>element</strong> with respect <strong>to</strong> geometrical nonlinearity.The input variables ex, ey, and ep are described in beam2e, andN = [ N ]contains the value of the predefined normal force N, which is positive in tension.The <strong>element</strong> load vec<strong>to</strong>r fe can also be computed if a uniformly distributed transverseload is applied <strong>to</strong> the <strong>element</strong>. The optional input variableeq = [ qȳ ]then contains the distributed transverse load per unit length, qȳ. Note that eq is ascalar and not a vec<strong>to</strong>r as in beam2e5.6 – 15 ELEMENT


eam2gTwo dimensional beam <strong>element</strong>Theory:The <strong>element</strong> stiffness matrix K e , s<strong>to</strong>red in the variable Ke, is computed according <strong>to</strong>K e = G T ¯Ke Gwhere G is described in beam2e, and ¯K e is given by⎡EA0 0 − EA⎤0 0L L 12EI 6EI0 φL 3 5 φL 2 2 0 − 12EI 6EIφL 3 5 φL 2 26EI 4EI0 φ¯K e L=2 2 φ L 3 0 − 6EI 2EIφL 2 2 φ L 4− EAEA0 0 0 0L L ⎢ 0 − 12EI φL⎣3 5 − 6EI12EIφL 2 2 0 φL 3 5 − 6EIφ L 2 2 ⎥⎦6EI 2EI0 φL 2 2 φ L 4 0 − 6EI 4EIφL 2 2 φ L 3For axial compression (N < 0), we haveφ 1 = kL 2 cot kL 2φ 2 = 1 k 2 L 212 (1 − φ 1 )φ 3 = 1 4 φ 1 + 3 4 φ 2φ 4 = − 1 2 φ 1 + 3 2 φ 2 φ 5 = φ 1 φ 2withk = π L√ ρFor axial tension (N > 0), we haveφ 1 = kL 2 coth kL 2φ 2 = − 1 k 2 L 212 (1 − φ 1 )φ 3 = 1 4 φ 1 + 3 4 φ 2φ 4 = − 1 2 φ 1 + 3 2 φ 2 φ 5 = φ 1 φ 2withk = π L√ −ρThe parameter ρ is given byρ = − NL2π 2 EIELEMENT 5.6 – 16


Two dimensional beam <strong>element</strong>beam2gThe equivalent nodal loads f e ls<strong>to</strong>red in the variable fe are computed according <strong>to</strong>f e l= G T¯f ewhere[¯f e = qL 012L12 ψ 0 12For an axial compressive force, we have( )2 1 + cos kLψ = 6 −(kL)2kL sin kLand for an axial tensile force( 1 + cosh kLψ = 6kL sinh kL − 2 )(kL) 2− L 12 ψ ] T5.6 – 17 ELEMENT


eam2gsTwo dimensional beam <strong>element</strong>Purpose:Compute section forces in a two dimensional nonlinear beam <strong>element</strong>.yM 2V 2N 2M 1N V 1 1xSyntax:es=beam2gs(ex,ey,ep,ed,N)es=beam2gs(ex,ey,ep,ed,N,eq)Description:beam2gs computes the section forces at the ends of the nonlinear beam <strong>element</strong>beam2g.The input variables ex, ey, and ep are defined in beam2e, and the variables N and eqin beam2g. The <strong>element</strong> displacements, s<strong>to</strong>red in ed, are obtained by the functionextract. If a distributed transversal load is applied <strong>to</strong> the <strong>element</strong>, the variable eqmust be included.The output variable[ ]N1 Ves =1 M 1N 2 V 2 M 2contains the section forces at the ends of the beam.ELEMENT 5.6 – 18


Two dimensional beam <strong>element</strong>beam2gsTheory:The section forces at the ends of the beam are obtained from the <strong>element</strong> force vec<strong>to</strong>r¯P = [ −N 1 − V 1 − M 1 N 2 V 2 M 2 ] Tcomputed according <strong>to</strong>¯P = ¯K e G a e − ¯f lThe matrix G is described in beam2e. The matrix ¯K e and the nodal displacementsa e = [ u 1 u 2 u 3 u 4 u 5 u 6 ] Tare described in beam2g. Note that the transpose of a e is s<strong>to</strong>red in ed.5.6 – 19 ELEMENT


eam2dTwo dimensional beam <strong>element</strong>Purpose:Compute <strong>element</strong> stiffness, mass and damping matrices for a two dimensional beam<strong>element</strong>.u 5yu 6u 4(x 2 ,y 2 )u x2 E, A, I, mu 3u 1(x 1 ,y 1 )xSyntax:[Ke,Me]=beam2d(ex,ey,ep)[Ke,Me,Ce]=beam2d(ex,ey,ep)Description:beam2d provides the global <strong>element</strong> stiffness matrix Ke, the global <strong>element</strong> massmatrix Me, and the global <strong>element</strong> damping matrix Ce, for a two dimensional beam<strong>element</strong>.The input variables ex and ey are described in beam2e, andep = [ E A I m [ a 0 a 1 ] ]contains the modulus of elasticity E, the cross section area A, the moment of inertiaI, the mass per unit length m, and the Raleigh damping coefficients a 0 and a 1 . If a 0and a 1 are omitted, the <strong>element</strong> damping matrix Ce is not computed.ELEMENT 5.6 – 20


Two dimensional beam <strong>element</strong>beam2dTheory:The <strong>element</strong> stiffness matrix K e , the <strong>element</strong> mass matrix M e and the <strong>element</strong>damping matrix C e , s<strong>to</strong>red in the variables Ke, Me and Ce, respectively, are computedaccording <strong>to</strong>K e = G T ¯Ke G M e = G T ¯Me G C e = G T ¯Ce Gwhere G and ¯K e are described in beam2e.The matrix ¯M e is given by¯M e = mL420⎡⎢⎣⎤140 0 0 70 0 00 156 22L 0 54 −13L0 22L 4L 2 0 13L −3L 270 0 0 140 0 0⎥0 54 13L 0 156 −22L ⎦0 −13L −3L 2 0 −22L 4L 2and the matrix ¯C e is computed by combining ¯K e and ¯M e¯C e = a 0 ¯Me + a 1 ¯Ke5.6 – 21 ELEMENT


eam2dsTwo dimensional beam <strong>element</strong>Purpose:Compute section forces for a two dimensional beam <strong>element</strong> in dynamic analysis.yM 2V 2N 2M 1N V 1 1xSyntax:es=beam2ds(ex,ey,ep,ed,ev,ea)Description:beam2ds computes the section forces at the ends of the dynamic beam <strong>element</strong>beam2d.The input variables ex, ey, and ep are defined in beam2d. The <strong>element</strong> displacements,the <strong>element</strong> velocities, and the <strong>element</strong> accelerations, s<strong>to</strong>red in ed, ev, and earespectively, are obtained by the function extract.The output variable[ ]N1 Ves =1 M 1N 2 V 2 M 2contains the section forces at the ends of the beam.ELEMENT 5.6 – 22


Two dimensional beam <strong>element</strong>beam2dsTheory:The section forces at the ends of the beam are obtained from the <strong>element</strong> force vec<strong>to</strong>r¯P = [ −N 1 − V 1 − M 1 N 2 V 2 M 2 ] Tcomputed according <strong>to</strong>¯P = ¯K e G a e + ¯C e G ȧ e + ¯M e G ä eThe matrices ¯K e and G are described in beam2e, and the matrices ¯M e and ¯C e aredescribed in beam2d. The nodal displacementsa e = [ u 1 u 2 u 3 u 4 u 5 u 6 ] Tshown in beam2d also define the directions of the nodal velocitiesȧ e = [ ˙u 1 ˙u 2 ˙u 3 ˙u 4 ˙u 5 ˙u 6 ] Tand the nodal accelerationsä e = [ ü 1 ü 2 ü 3 ü 4 ü 5 ü 6 ] TNote that the transposes of a e , ȧ e , and ä e are s<strong>to</strong>red in ed, ev, and ea respectively.5.6 – 23 ELEMENT


Three dimensional beam <strong>element</strong>beam3eTheory:The <strong>element</strong> load vec<strong>to</strong>r fe can also be computed if uniformly distributed loads areapplied <strong>to</strong> the <strong>element</strong>. The optional input variableeq = [ q¯x qȳ q¯z q¯ω ]then contains the distributed loads. The positive directions of q¯x , qȳ, and q¯z followthe local beam coordinate system. The distributed <strong>to</strong>rque q¯ω is positive if directedin the local ¯x-direction, i.e. from local ȳ <strong>to</strong> local ¯z. All the loads are per unit length.The <strong>element</strong> stiffness matrix K e is computed according <strong>to</strong>whereK e = G T ¯Ke G⎡¯K e =⎢⎣in which k 1 = EAL⎡G =⎢⎣k 1 0 0 0 0 0 −k 1 0 0 0 0 00 12EI¯z6EI¯z0 0 0 0 − 12EI¯z6EI¯z0 0 0L 3 L 2L 3 L 212EIȳ0 0 0 − 6EIȳ 0 0 0 − 12EIȳ 0 − 6EIȳ 0L 3L 2 L 3 L 20 0 0 k 2 0 0 0 0 0 −k 2 0 00 0 − 6EIȳ 0 4EIȳ6EIȳ0 0 0 0 2EIȳ 0L 2 L L 2 L6EI¯z4EI¯z0 0 0 0 0 − 6EI¯z2EI¯z0 0 0L 2 LL 2 L−k 1 0 0 0 0 0 k 1 0 0 0 0 00 − 12EI¯z 0 0 0 − 6EI¯z 0 12EI¯z 0 0 0 − 6EI¯zL 3 L 2 L 3 L 20 0 − 12EIȳ 0 6EIȳ12EIȳ0 0 0 0 6EIȳ 0L 3 L 2 L 3 L 20 0 0 −k 2 0 0 0 0 0 k 2 0 00 0 − 6EIȳ 0 2EIȳ6EIȳ0 0 0 0 4EIȳ 0L 2 L L 2 L6EI¯z2EI¯z0 0 0 0 0 − 6EI¯z4EI¯z0 0 0L 2 LL 2 Land k 2 = GKv , and whereL⎤n x¯x n y¯x n z¯x 0 0 0 0 0 0 0 0 0n xȳ n yȳ n zȳ 0 0 0 0 0 0 0 0 0n x¯z n y¯z n z¯z 0 0 0 0 0 0 0 0 00 0 0 n x¯x n y¯x n z¯x 0 0 0 0 0 00 0 0 n xȳ n yȳ n zȳ 0 0 0 0 0 00 0 0 n x¯z n y¯z n z¯z 0 0 0 0 0 00 0 0 0 0 0 n x¯x n y¯x n z¯x 0 0 00 0 0 0 0 0 n xȳ n yȳ n zȳ 0 0 00 0 0 0 0 0 n x¯z n y¯z n z¯z 0 0 00 0 0 0 0 0 0 0 0 n x¯x n y¯x n z¯x⎥0 0 0 0 0 0 0 0 0 n xȳ n yȳ n zȳ ⎦0 0 0 0 0 0 0 0 0 n x¯z n y¯z n z¯z⎤⎥⎦5.6 – 25 ELEMENT


eam3eThree dimensional beam <strong>element</strong>The <strong>element</strong> length L is computed according <strong>to</strong>√L = (x 2 − x 1 ) 2 + (y 2 − y 1 ) 2 + (z 2 − z 1 ) 2In the transformation matrix G, n x¯x specifies the cosine of the angle between the xaxis and ¯x axis, and so on.The <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in fe, is computed according <strong>to</strong>f e l= G T¯f elwhere⎡e ¯f l =⎢⎣q¯x L2qȳL2q¯z L2q¯ω L2− q¯zL 212qȳL 212q¯x L2qȳL2q¯z L2q¯ω L2q¯z L 212− q ȳL 212⎤⎥⎦ELEMENT 5.6 – 26


Three dimensional beam <strong>element</strong>beam3sPurpose:Compute section forces in a three dimensional beam <strong>element</strong>.M y,nV y,nTnN nV z,nM z,1M z,nzyT1V z,1yNx1z V y,1xM y,1TNM yV yV zM zM zV z TNV yM ySyntax:es=beam3s(ex,ey,ez,eo,ep,ed)es=beam3s(ex,ey,ez,eo,ep,ed,eq)[es,edi,eci]=beam3s(ex,ey,ez,eo,ep,ed,eq,n)Description:beam3s computes the section forces and displacements in local directions along thebeam <strong>element</strong> beam3e.The input variables ex, ey, ez, eo, and ep are defined in beam3e, and the <strong>element</strong>displacements, s<strong>to</strong>red in ed, are obtained by the function extract. If distributedloads are applied <strong>to</strong> the <strong>element</strong>, the variable eq must be included. The number ofevaluation points for section forces and displacements are determined by n. If n isomitted, only the ends of the beam are evaluated.The output variableses = [ N Vȳ V¯z T Mȳ M¯z ] edi = [ ū ¯v ¯w ¯ϕ ] eci = [ ¯x ]consist of column matrices that contain the section forces, the displacements, andthe evaluation points on the local ¯x-axis. The explicit matrix expressions are⎡es =⎢⎣⎤N 1 Vȳ1 V¯z1 T Mȳ1 M¯z1N 2 Vȳ2 V¯z2 T Mȳ2 M¯z2⎥. . . . . . ⎦N n Vȳn V¯zn T Mȳn M¯zn5.6 – 27 ELEMENT


eam3sThree dimensional beam <strong>element</strong>⎡edi =⎢⎣⎤ū 1 ¯v 1 ¯w 1 ¯ϕ 1ū 2 ¯v 2 ¯w 2 ¯ϕ 2⎥. . . . ⎦ū n ¯v n ¯w n ¯ϕ n⎡eci =⎢⎣0¯x 2.¯x n−1L⎤⎥⎦where L is the length of the beam <strong>element</strong>.Theory:The evaluation of the section forces is based on the solutions of the basic equationsEA d2 ūd¯x 2 + q¯x = 0EI yd 4 ¯wd¯x 4 − q¯z = 0EI zd 4¯vd¯x 4 − q ȳ = 0GK vd 2 ¯ϕd¯x 2 + q¯ω = 0From these equations, the displacements along the beam <strong>element</strong> are obtained as thesum of the homogeneous and the particular solutions⎡u = ⎢⎣ū(¯x)¯v(¯x)¯w(¯x)¯ϕ(¯x)⎤⎥⎦ = u h + u pwhere⎡u h = ¯N C −1 G a e u p = ⎢⎣andū p (¯x)¯v p (¯x)¯w p (¯x)¯ϕ p (¯x)⎡⎤⎥⎦ = ⎢⎣q¯x L¯x2EA (1 − ¯x L )qȳL 2¯x 224EI z(1 − ¯x L )2q¯z L 2¯x 224EI y(1 − ¯x L )2q¯ω L¯x2GK v(1 − ¯x L )⎤⎥⎦⎡¯N = ⎢⎣1 ¯x 0 0 0 0 0 0 0 0 0 00 0 1 ¯x ¯x 2 ¯x 3 0 0 0 0 0 00 0 0 0 0 0 1 ¯x ¯x 2 ¯x 3 0 00 0 0 0 0 0 0 0 0 0 1 ¯xELEMENT 5.6 – 28⎤⎥⎦


Three dimensional beam <strong>element</strong>beam3s⎡C =⎢⎣1 0 0 0 0 0 0 0 0 0 0 00 0 1 0 0 0 0 0 0 0 0 00 0 0 0 0 0 1 0 0 0 0 00 0 0 0 0 0 0 0 0 0 1 00 0 0 0 0 0 0 1 0 0 0 00 0 0 1 0 0 0 0 0 0 0 01 L 0 0 0 0 0 0 0 0 0 00 0 1 L L 2 L 3 0 0 0 0 0 00 0 0 0 0 0 1 L L 2 L 3 0 00 0 0 0 0 0 0 0 0 0 1 L0 0 0 0 0 0 0 1 2L 3L 2 0 00 0 0 1 2L 3L 2 0 0 0 0 0 0⎤⎥⎦⎡a e =⎢⎣⎤u 1u 2⎥. ⎦u 12The transformation matrix G e and nodal displacements a e are described in beam3e.Note that the transpose of a e is s<strong>to</strong>red in ed.Finally the section forces are obtained fromN = EA dūd¯xT = GK vd ¯ϕd¯xVȳ = −EI zd 3¯vd¯x 3Mȳ = EI yd 2 ¯wd¯x 2V¯z = −EI yd 3 ¯wd¯x 3M¯z = EI zd 2¯vd¯x 2Examples:Section forces or <strong>element</strong> displacements can easily be plotted. The bending momentMȳ along the beam is plotted by>> plot(eci,es(:,5))5.6 – 29 ELEMENT


5.7 Plate <strong>element</strong>Only one plate <strong>element</strong> is currently available, a rectangular 12 dof <strong>element</strong>. The <strong>element</strong>presumes a linear elastic material which can be isotropic or anisotropic.Plate <strong>element</strong>su 9u 11u 8u 10u 12platreu 7u 3 u 6u 2u 5u 1u 4platreplatrsPlate functionsCompute <strong>element</strong> matricesCompute section forces5.7 – 1 ELEMENT


platrePlate <strong>element</strong>Purpose:Compute <strong>element</strong> stiffness matrix for a rectangular plate <strong>element</strong>.u 12(x 4 ,y 4 ) u 11u 10u 7u 9u 8(x 3 ,y 3 )yu 3 u 6u 2u(x 1 ,y 1 )5u (x 2 ,y 2 )1u 4zxtSyntax:Ke=platre(ex,ey,ep,D)[Ke,fe]=platre(ex,ey,ep,D,eq)Description:platre provides an <strong>element</strong> stiffness matrix Ke, and an <strong>element</strong> load vec<strong>to</strong>r fe, for arectangular plate <strong>element</strong>. This <strong>element</strong> can only be used if the <strong>element</strong> edges areparallel <strong>to</strong> the coordinate axis.The <strong>element</strong> nodal coordinates x 1 , y 1 , x 2 etc. are supplied <strong>to</strong> the function by ex andey, the <strong>element</strong> thickness t by ep, and the material properties by the constitutivematrix D. Any arbitrary D-matrix with dimensions (3 × 3) and valid for plane stressmay be given. For an isotropic elastic material the constitutive matrix can be formedby the function hooke, see Section 4.ex = [ x 1 x 2 x 3 x 4 ]ey = [ y 1 y 2 y 3 y 4 ]ep = [ t ] D =⎡⎢⎣⎤D 11 D 12 D 13⎥D 21 D 22 D 23 ⎦D 31 D 32 D 33If a uniformly distributed load is applied <strong>to</strong> the <strong>element</strong>, the <strong>element</strong> load vec<strong>to</strong>r feis computed. The input variableeq = [ q z ]then contains the load q z per unit area in the z-direction.ELEMENT 5.7 – 2


Plate <strong>element</strong>platreTheory:The <strong>element</strong> stiffness matrix K e and the <strong>element</strong> load vec<strong>to</strong>r f e l , s<strong>to</strong>red in Ke and ferespectively, are computed according <strong>to</strong>∫K e = (C −1 ) T ¯B T ˜D ¯B dA C −1∫ Af e l = (C −1 ) T ¯N T q z dAwhere the constitutive matrix˜D = t312 Dand where D is defined by D.AThe evaluation of the integrals for the rectangular plate <strong>element</strong> is based on thedisplacement approximation w(x, y) and is expressed in terms of the nodal variablesu 1 , u 2 , ... , u 12 aswherew(x, y) = N e a e = ¯N C −1 a e¯N = [ 1 x y x 2 xy y 2 x 3 x 2 y xy 2 y 3 x 3 y xy 3 ]⎡C =⎢⎣and where1 −a −b a 2 ab b 2 −a 3 −a 2 b −ab 2 −b 3 a 3 b ab 3 ⎤0 0 1 0 −a −2b 0 a 2 2ab 3b 2 −a 3 −3ab 20 −1 0 2a b 0 −3a 2 −2ab −b 2 0 3a 2 b b 31 a −b a 2 −ab b 2 a 3 −a 2 b ab 2 −b 3 −a 3 b −ab 30 0 1 0 a −2b 0 a 2 −2ab 3b 2 a 3 3ab 20 −1 0 −2a b 0 −3a 2 2ab −b 2 0 3a 2 b b 31 a b a 2 ab b 2 a 3 a 2 b ab 2 b 3 a 3 b ab 30 0 1 0 a 2b 0 a 2 2ab 3b 2 a 3 3ab 20 −1 0 −2a −b 0 −3a 2 −2ab −b 2 0 −3a 2 b −b 31 −a b a 2 −ab b 2 −a 3 a 2 b −ab 2 b 3 −a 3 b −ab 30 0 1 0 −a 2b 0 a 2 −2ab 3b 2 −a 3 −3ab 2 ⎥⎦0 −1 0 2a −b 0 −3a 2 2ab −b 2 0 −3a 2 b −b 3a e = [ u 1 u 2 ... u 12 ] Ta = 1 2 (x 3 − x 1 ) and b = 1 2 (y 3 − y 1 )The matrix ¯B is obtained as⎡¯B = ∗ ∇ ¯N =⎢⎣⎤0 0 0 2 0 0 6x 2y 0 0 6xy 0⎥0 0 0 0 0 2 0 0 2x 6y 0 6xy ⎦0 0 0 0 2 0 0 4x 4y 0 6x 2 6y 25.7 – 3 ELEMENT


platrePlate <strong>element</strong>where∗∇ =⎡⎢⎣∂ 2∂x 2∂ 2∂y 22 ∂2∂x∂y⎤⎥⎦Evaluation of the integrals for the rectangular plate <strong>element</strong> is done analytically.Computation of the integrals for the <strong>element</strong> load vec<strong>to</strong>r fle yieldsf e l = q z L x L y[ 14L y24 − L x2414L y24L x2414 − L y24L x2414 − L y24 − L x24] TwhereL x = x 3 − x 1 and L y = y 3 − y 1ELEMENT 5.7 – 4


Plate <strong>element</strong>platrsPurpose:Compute section forces in a rectangular plate <strong>element</strong>.yu 12(x 4 ,y 4 ) u 11u 10(x 3 ,y 3 )u 3 u 6u 2u(x 1 ,y 1 )5u (x 2 ,y 2 )1u 7u 4u 9u 8VM yz xyM yyV xzM xy M xxM xyVM xxxzM yyV yzM xyzxtSyntax:[es,et]=platrs(ex,ey,ep,D,ed)Description:platrs computes the section forces es and the curvature matrix et in a rectangularplate <strong>element</strong>. The section forces and the curvatures are computed at the center ofthe <strong>element</strong>.The input variables ex, ey, ep and D are defined in platre. The vec<strong>to</strong>r ed contains thenodal displacements a e of the <strong>element</strong> and is obtained by the function extract ased = (a e ) T = [ u 1 u 2 ... u 12 ]The output variableses = [ M T V T ] = [ M xx M yy M xy V xz V yz ]et = κ T = [ κ xx κ yy κ xy ]contain the section forces and curvatures in global directions.5.7 – 5 ELEMENT


platrsPlate <strong>element</strong>Theory:The curvatures and the section forces are computed according <strong>to</strong>⎡ ⎤κ xx⎢ ⎥κ = ⎣ κ yy ⎦ = ¯B C −1 a eκ xyM =V =⎡⎢⎣⎤M xx⎥M yyM xy[ ]VxzV yz⎦ = ˜D κ= ˜∇ Mwhere the matrices ˜D, ¯B, C and a e are described in platre, and where⎡˜∇ = ⎢⎣∂∂x00∂∂y⎤∂∂y⎥∂ ⎦∂xELEMENT 5.7 – 6


6 System functions6.1 IntroductionThe group of system functions comprises functions for the setting up, solving, and eliminationof systems of equations. The functions are separated in two groups:Static system functionsDynamic system functionsStatic system functions concern the linear system of equationsKa = fwhere K is the global stiffness matrix and f is the global load vec<strong>to</strong>r. Often used staticsystem functions are assem and solveq. The function assem assembles the global stiffnessmatrix and solveq computes the global displacement vec<strong>to</strong>r a considering the boundaryconditions. It should be noted that K, f, and a also represent analogous quantities insystems others than structural mechanical systems. For example, in a heat flow problemK represents the conductivity matrix, f the heat flow, and a the temperature.Dynamic system functions are related <strong>to</strong> different aspects of linear dynamic systems ofcoupled ordinary differential equations according <strong>to</strong>for first-order systems andC ḋ + K d = fM¨d + Cḋ + Kd = ffor second-order systems. First-order systems occur typically in transient heat conductionand second-order systems occur in structural dynamics.6.1 – 1 SYSTEM


6.2 Static system functionsThe group of static system functions comprises functions for setting up and solving theglobal system of equations. It also contains a function for eigenvalue analysis, a functionfor static condensation, a function for extraction of <strong>element</strong> displacements from the globaldisplacement vec<strong>to</strong>r and a function for extraction of <strong>element</strong> coordinates.The following functions are available for static analysis:assemcoordxtreigenextractinsertsolveqstatconStatic system functionsAssemble <strong>element</strong> matricesExtract <strong>element</strong> coordinates from a global coordinate matrix.Solve a generalized eigenvalue problemExtract values from a global vec<strong>to</strong>rAssemble <strong>element</strong> internal force vec<strong>to</strong>rSolve a system of equationsPerform static condensation6.2 – 1 SYSTEM


assemStatic system functionsPurpose:Assemble <strong>element</strong> matrices.ijiek iiek jieKjek ijek jji = dof ij = dof jijk 21ek ii + k iik 11 k 12. ...... ......ek ji + k ji.ek ij + k ij.. ...... .....ek jj + k jj.k nnijSyntax:K=assem(edof,K,Ke)[K,f]=assem(edof,K,Ke,f,fe)KDescription:assem adds the <strong>element</strong> stiffness matrix K e , s<strong>to</strong>red in Ke, <strong>to</strong> the structure stiffnessmatrix K, s<strong>to</strong>red in K, according <strong>to</strong> the <strong>to</strong>pology matrix edof.The <strong>element</strong> <strong>to</strong>pology matrix edof is defined asedof = [el dof 1 dof 2 . . . dof} {{ ned ]}global dof.where the first column contains the <strong>element</strong> number, and the columns 2 <strong>to</strong> (ned + 1)contain the corresponding global degrees of freedom (ned = number of <strong>element</strong> degreesof freedom).In the case where the matrix K e is identical for several <strong>element</strong>s, assembling of thesecan be carried out simultaneously. Each row in Edof then represents one <strong>element</strong>,i.e. nel is the <strong>to</strong>tal number of considered <strong>element</strong>s.Edof =⎡⎢⎣⎤⎫el 1 dof 1 dof 2 . . . dof nedel 2 dof 1 dof 2 . . . dof ned⎪⎬⎥ one row for each <strong>element</strong>. . .. ⎦⎪⎭el nel dof 1 dof 2 . . . dof nedIf fe and f are given in the function, the <strong>element</strong> load vec<strong>to</strong>r f e is also added <strong>to</strong> theglobal load vec<strong>to</strong>r f.SYSTEM 6.2 – 2


Static system functionscoordxtrPurpose:Extract <strong>element</strong> coordinates from a global coordinate matrix.l n●●●●●k n(x n ,y n )nel●●●●●Ex = x 1 x 2 x 7 x 6.(x 6 , y 6 )●●5●l 6k 6l 2k 2l 5k 5●l 1 21k 1●●3●●4●●Ey = y 1 y 2 y 7 y 6.Syntax:●●●(x 1 , y 1 ) (x 2 , y 2 )(x 5 , y 5 )nen =4[Ex,Ey,Ez]=coordxtr(Edof,Coord,Dof,nen)Description:●coordxtr extracts <strong>element</strong> nodal coordinates from the global coordinate matrix Coordfor <strong>element</strong>s with equal numbers of <strong>element</strong> nodes and dof’s.Input variables are the <strong>element</strong> <strong>to</strong>pology matrix Edof, defined in assem, the globalcoordinate matrix Coord, the global <strong>to</strong>pology matrix Dof, and the number of <strong>element</strong>nodes nen in each <strong>element</strong>.⎡Coord =⎢⎣x 1 y 1 [z 1 ]x 2 y 2 [z 2 ]x 3 y 3 [z 3 ]. . .x n y n [z n ]⎤⎥⎦⎡Dof =⎢⎣●⎤k 1 l 1 ... m 1k 2 l 2 ... m 2k 3 l 3 ... m 3. . ... .⎥⎦k n l n ... m nnen = [ nen ]The nodal coordinates defined in row i of Coord correspond <strong>to</strong> the degrees of freedomof row i in Dof. The components k i , l i and m i define the degrees of freedom of nodei, and n is the number of global nodes for the considered part of the FE-model.6.2 – 3 SYSTEM


coordxtrStatic system functionsThe output variables Ex, Ey, and Ez are matrices defined according <strong>to</strong>⎡Ex =⎢⎣1x 11x 21x 3 ...1x nen2x 12x 22x 3 ...2x nen. . . . .nelx 1nelx 2nelx 3 ...nelx nenwhere row i gives the x-coordinates of the <strong>element</strong> defined in row i of Edof, andwhere nel is the number of considered <strong>element</strong>s.The <strong>element</strong> coordinate data extracted by the function coordxtr can be used forplotting purposes and <strong>to</strong> create input data for the <strong>element</strong> stiffness functions.⎤⎥⎦SYSTEM 6.2 – 4


Static system functionseigenPurpose:Syntax:Solve the generalized eigenvalue problem.L=eigen(K,M)L=eigen(K,M,b)[L,X]=eigen(K,M)[L,X]=eigen(K,M,b)Description:eigen solves the eigenvalue problem| K − λM |= 0where K and M are square matrices. The eigenvalues λ are s<strong>to</strong>red in the vec<strong>to</strong>r Land the corresponding eigenvec<strong>to</strong>rs in the matrix X.If certain rows and columns in matrices K and M are <strong>to</strong> be eliminated in computingthe eigenvalues, b must be given in the function. The rows (and columns) that are<strong>to</strong> be eliminated are described in the vec<strong>to</strong>r b defined as⎡ ⎤dof 1dof 2b =⎢ ⎥⎣ . ⎦dof nbThe computed eigenvalues are given in order ranging from the smallest <strong>to</strong> the largest.The eigenvec<strong>to</strong>rs are normalized in order thatX T MX = Iwhere I is the identity matrix.6.2 – 5 SYSTEM


extractStatic system functionsPurpose:Extract <strong>element</strong> nodal quantities from a global solution vec<strong>to</strong>r..a ia j.a ma n.a iu 1=a j u 2edof = [eln i j m n ]a m u 3ed = [ u 1 u 2 u 3 u 4 ]a n u 4Syntax:ed=extract(edof,a)Description:extract extracts <strong>element</strong> displacements or corresponding quantities a e from the globalsolution vec<strong>to</strong>r a, s<strong>to</strong>red in a.Input variables are the <strong>element</strong> <strong>to</strong>pology matrix edof, defined in assem, and the globalsolution vec<strong>to</strong>r a.The output variableed = (a e ) Tcontains the <strong>element</strong> displacement vec<strong>to</strong>r.If Edof contains more than one <strong>element</strong>, Ed will be a matrix⎡(a e ) T ⎤1Ed =(a e ) T 2⎢ ⎥⎣ . ⎦(a e ) T nelwhere row i gives the <strong>element</strong> displacements for the <strong>element</strong> defined in row i of Edof,and nel is the <strong>to</strong>tal number of considered <strong>element</strong>s.SYSTEM 6.2 – 6


Static system functionsextractExample:For the two dimensional beam <strong>element</strong>, the extract function will extract six nodaldisplacements for each <strong>element</strong> given in Edof, and create a matrix Ed of size (nel × 6).⎡Ed =⎢⎣⎤u 1 u 2 u 3 u 4 u 5 u 6u 1 u 2 u 3 u 4 u 5 u 6⎥. . . . . . ⎦u 1 u 2 u 3 u 4 u 5 u 66.2 – 7 SYSTEM


insertStatic system functionsPurpose:Assemble internal <strong>element</strong> forces in a global force vec<strong>to</strong>r.f 1f 2....Syntax:f=insert(edof,f,ef)ef ief jf ei = dof ij = dofjf i + f ief j + f je..f nfDescription:insert adds the internal <strong>element</strong> load vec<strong>to</strong>r f e i , s<strong>to</strong>red in ef, <strong>to</strong> the global internalforce vec<strong>to</strong>r f, s<strong>to</strong>red in f, according <strong>to</strong> the <strong>to</strong>pology matrix edof. The function is foruse in nonlinear analysis.The <strong>element</strong> <strong>to</strong>pology matrix edof is defined in assem. The vec<strong>to</strong>r f is the globalinternal force vec<strong>to</strong>r, and the vec<strong>to</strong>r ef is the internal <strong>element</strong> force vec<strong>to</strong>r computedfrom the <strong>element</strong> stresses, see for example plani4f.SYSTEM 6.2 – 8


Static system functionssolveqPurpose:Syntax:Solve equation system.a=solveq(K,f)a=solveq(K,f,bc)[a,Q]=solveq(K,f,bc)Description:solveq solves the equation systemK a = fwhere K is a matrix and a and f are vec<strong>to</strong>rs.The matrix K and the vec<strong>to</strong>r f must be predefined. The solution of the system ofequations is s<strong>to</strong>red in a vec<strong>to</strong>r a which is created by the function.If some values of a are <strong>to</strong> be prescribed, the row number and the corresponding valuesare given in the boundary condition matrix⎡bc =⎢⎣⎤dof 1 u 1dof 2 u 2⎥. . ⎦dof nbc u nbcwhere the first column contains the row numbers and the second column the correspondingprescribed values.If Q is given in the function, reaction forces are computed according <strong>to</strong>Q = K a − f6.2 – 9 SYSTEM


statconStatic system functionsPurpose:Reduce system of equations by static condensation.Syntax:[K1,f1]=statcon(K,f,b)Description:statcon reduces a system of equationsK a = fby static condensation.The degrees of freedom <strong>to</strong> be eliminated are supplied <strong>to</strong> the function by the vec<strong>to</strong>r⎡b =⎢⎣⎤dof 1dof 2⎥. ⎦dof nbwhere each row in b contains one degree of freedom <strong>to</strong> be eliminated.The elimination gives the reduced system of equationsK 1 a 1 = f 1where K 1 and f 1 are s<strong>to</strong>red in K1 and f1 respectively.SYSTEM 6.2 – 10


6.3 Dynamic system functionsThe group of system functions comprises functions for solving linear dynamic systems bytime stepping or modal analysis, functions for frequency domain analysis, etc.dyna2dyna2ffftfreqrespgfuncifftritzspectrastep1step2sweepDynamic system functionsSolve a set of uncoupled second-order differential equationsSolve a set of uncoupled second-order differential equations in thefrequency domainFast Fourier transformCompute frequency responseLinear interpolation between equally spaced pointsInverse Fast Fourier transformCompute approximative eigenvalues and eigenvec<strong>to</strong>rs by the LanczosmethodCompute seismic response spectraCarry out step-by-step integration in first-order systemsCarry out step-by-step integration in second-order systemsCompute frequency response functionNote: Eigenvalue analysis is performed by using the function eigen; see static systemfunctions.6.3 – 1 SYSTEM


dyna2Dynamic system functionsPurpose:Syntax:Compute the dynamic solution <strong>to</strong> a set of uncoupled second-order differential equations.X=dyna2(w2,xi,f,g,dt)Description:dyna2 computes the solution <strong>to</strong> the setẍ i + 2ξ i ω i ẋ i + ω 2 i x i = f i g(t),i = 1, ..., mNote:See also:of differential equations, where g(t) is a piecewise linear time function.The set of vec<strong>to</strong>rs w2, xi and f contains the squared circular frequencies ω 2 i , thedamping ratios ξ i and the applied forces f i , respectively. The vec<strong>to</strong>r g defines theload function in terms of straight line segments between equally spaced points intime. This function may have been formed by the command gfunc.The dynamic solution is computed at equal time increments defined by dt. Includingthe initial zero vec<strong>to</strong>r as the first column vec<strong>to</strong>r, the result is s<strong>to</strong>red in the m-by-nmatrix X, n − 1 being the number of time steps.The accuracy of the solution is not a function of the output time increment dt, sincethe command produces the exact solution for straight line segments in the loadingtime function.gfuncSYSTEM 6.3 – 2


Dynamic system functionsdyna2fPurpose:Syntax:Compute the dynamic solution <strong>to</strong> a set of uncoupled second-order differential equations.Y=dyna2f(w2,xi,f,p,dt)Description:dyna2f computes the solution <strong>to</strong> the setẍ i + 2ξ i ω i ẋ i + ω 2 i x i = f i g(t),i = 1, ..., mof differential equations in the frequency domain.The vec<strong>to</strong>rs w2, xi and f are the squared circular frequencies ω 2 i , the damping ratiosξ i and the applied forces f i , respectively. The force vec<strong>to</strong>r p contains the Fouriercoefficients p(k) formed by the command fft.The solution in the frequency domain is computed at equal time increments definedby dt. The result is s<strong>to</strong>red in the m-by-n matrix Y, where m is the number ofequations and n is the number of frequencies resulting from the fft command. Thedynamic solution in the time domain is achieved by the use of the command ifft.Example:See also:The dynamic solution <strong>to</strong> a set of uncoupled second-order differential equations canbe computed by the following sequence of commands:>> g=gfunc(G,dt);>> p=fft(g);>> Y=dyna2f(w2,xi,f,p,dt);>> X=(real(ifft(Y.’)))’;where it is assumed that the input variables G, dt, w2, xi and f are properly defined.Note that the ifft command operates on column vec<strong>to</strong>rs if Y is a matrix; thereforeuse the transpose of Y. The output from the ifft command is complex. Thereforeuse Y.’ <strong>to</strong> transpose rows and columns in Y in order <strong>to</strong> avoid the complex conjugatetranspose of Y; see Section 3. The time response is represented by the real part ofthe output from the ifft command. If the transpose is used and the result is s<strong>to</strong>redin a matrix X, each row will represent the time response for each equation as theoutput from the command dyna2.gfunc, fft, ifft6.3 – 3 SYSTEM


fftDynamic system functionsPurpose:Syntax:Transform functions in time domain <strong>to</strong> frequency domain.p=fft(g)p=fft(g,N)Description:Note:fft transforms a time dependent function <strong>to</strong> the frequency domain.The function <strong>to</strong> be transformed is s<strong>to</strong>red in the vec<strong>to</strong>r g. Each row in g containsthe value of the function at equal time intervals. The function represents a span−∞ ≤ t ≤ +∞ ; however, only the values within a typical period are specified by g.The fft command can be used with one or two input arguments. If N is not specified,the numbers of frequencies used in the transformation is equal <strong>to</strong> the the numbersof points in the time domain, i.e. the length of the variable g, and the output willbe a vec<strong>to</strong>r of the same size containing complex values representing the frequencycontent of the input signal.The scalar variable N can be used <strong>to</strong> specify the numbers of frequencies used in theFourier transform. The size of the output vec<strong>to</strong>r in this case will be equal <strong>to</strong> N.It should be remembered that the highest harmonic component in the time signalthat can be identified by the Fourier transform corresponds <strong>to</strong> half the samplingfrequency. The sampling frequency is equal <strong>to</strong> 1/dt, where dt is the time incremen<strong>to</strong>f the time signal.The complex Fourier coefficients p(k) are s<strong>to</strong>red in the vec<strong>to</strong>r p, and are computedaccording <strong>to</strong>wherep(k) =N∑j=1ω N = e −2πi/N .x(j)ω (j−1)(k−1)N ,This is a <strong>MATLAB</strong> built-in function.SYSTEM 6.3 – 4


Dynamic system functionsfreqrespPurpose:Syntax:Compute frequency response of a known discrete time response.[Freq,Resp] = freqresp(D,dt)Description:Example:freqresp computes the frequency response of a discrete dynamic system.D is the time his<strong>to</strong>ry function and dt is the sampling time increment, i.e. the timeincrement used in the time integration procedure.Resp contains the computed response as a function of frequency. Freq contains thecorresponding frequencies.The result can be visualized by>> plot(Freq,Resp)>> xlabel(’frequency (Hz)’)or>> semilogy(Freq,Resp)>> xlabel(’frequency (Hz)’)Note:The dimension of Resp is the same as that of the original time his<strong>to</strong>ry function.The time his<strong>to</strong>ry function of a discrete system computed by direct integration behavesoften in an unstructured manner. The reason for this is that the time his<strong>to</strong>ry is amixture of several participating eigenmodes at different eigenfrequencies. By using aFourier transform, however, the response as a function of frequency can be computedefficiently. In particular it is possible <strong>to</strong> identify the participating frequencies.6.3 – 5 SYSTEM


gfuncDynamic system functionsPurpose:Form vec<strong>to</strong>r with function values at equally spaced points by linear interpolation.g(t)(t 2 ,g(t 2 ))●(t 4 ,g(t 4 ))●●●(t 1 ,g(t 1 ))●(t 3 ,g(t 3 ))t●(t N ,g(t N ))●(t 5 ,g(t 5 ))Syntax:[t,g]=gfunc(G,dt)Description:gfunc uses linear interpolation <strong>to</strong> compute values at equally spaced points for adiscrete function g given by⎡G =⎢⎣t 1 g(t 1 )t 2 g(t 2 ).t N g(t N )⎤⎥ , ⎦as shown in the figure above.Function values are computed in the range t 1 ≤ t ≤ t N , at equal increments, dt beingdefined by the variable dt. The number of linear segments (steps) is (t N − t 1 )/dt.The corresponding vec<strong>to</strong>r t is also computed. The result can be plotted by using thecommand plot(t,g).SYSTEM 6.3 – 6


Dynamic system functionsifftPurpose:Syntax:Transform function in frequency domain <strong>to</strong> time domain.x=ifft(y)x=ifft(y,N)Description:Note:ifft transforms a function in the frequency domain <strong>to</strong> a function in the time domain.The function <strong>to</strong> be transformed is given in the vec<strong>to</strong>r y. Each row in y containsFourier terms in the interval −∞ ≤ ω ≤ +∞.The fft command can be used with one or two input arguments. The scalar variableN can be used <strong>to</strong> specify the numbers of frequencies used in the Fourier transform.The size of the output vec<strong>to</strong>r in this case will be equal <strong>to</strong> N. See also the descriptionof the command fft.The inverse Fourier coefficients x(j), s<strong>to</strong>red in the variable x, are computed according<strong>to</strong>whereSee also:x(j) = (1/N)ω N = e −2πi/N .N∑k=1y(k)ω −(j−1)(k−1)N ,This is a <strong>MATLAB</strong> built-in function.fft6.3 – 7 SYSTEM


itzDynamic system functionsPurpose:Syntax:Compute approximative eigenvalues and eigenvec<strong>to</strong>rs by the Lanczos method.L=ritz(K,M,f,m)L=ritz(K,M,f,m,b)[L,X]=ritz(K,M,f,m)[L,X]=ritz(K,M,f,m,b)Description:Note:ritz computes, by the use of the Lanczos algorithm, m approximative eigenvalues andm corresponding eigenvec<strong>to</strong>rs for a given pair of n-by-n matrices K and M and agiven non-zero starting vec<strong>to</strong>r f.If certain rows and columns in matrices K and M are <strong>to</strong> be eliminated in computingthe eigenvalues, b must be given in the command. The rows (and columns) <strong>to</strong> beeliminated are described in the vec<strong>to</strong>r b defined as⎡ ⎤dof 1dof 2b =⎢ ⎥⎣ .. ⎦dof nbIf the number of vec<strong>to</strong>rs, m, is chosen less than the <strong>to</strong>tal number of degrees-offreedom,n, only about the first m/2 Ritz vec<strong>to</strong>rs are good approximations of thetrue eigenvec<strong>to</strong>rs. Recall that the Ritz vec<strong>to</strong>rs satisfy the M-orthonormality conditionX T M X = I,where I is the identity matrix.SYSTEM 6.3 – 8


Dynamic system functionsspectraPurpose:Syntax:Compute seismic response spectra for elastic design.s=spectra(a,xi,dt,f)Description:Example:spectra computes the seismic response spectrum for a known acceleration his<strong>to</strong>ryfunction.The computation is based on the vec<strong>to</strong>r a, that contains an acceleration time his<strong>to</strong>ryfunction defined at equal time steps. The time step is specified by the variable dt.The value of the damping ratio is given by the variable xi.Output from the computation, s<strong>to</strong>red in the vec<strong>to</strong>r s, is achieved at frequenciesspecified by the column vec<strong>to</strong>r f.The following procedure can be used <strong>to</strong> produce a seismic response spectrum for adamping ratio ξ = 0.05, defined at 34 logarithmicly spaced frequency points. Theacceleration time his<strong>to</strong>ry a has been sampled at a frequency of 50 Hz, corresponding<strong>to</strong> a time increment dt = 0.02 between collected points:>> freq=logspace(0,log10(2^(33/6)),34);>> xi=0.05;>> dt=0.02;>> s=spectra(a,xi,dt,freq’);The resulting spectrum can be plotted by the command>> loglog(freq,s,’*’)6.3 – 9 SYSTEM


step1Dynamic system functionsPurpose:Syntax:Compute the dynamic solution <strong>to</strong> a set of first order differential equations.Tsnap=step1(K,C,d0,ip,f,pbound)[Tsnap,D,V]=step1(K,C,d0,ip,f,pbound)Description:step1 computes at equal time steps the solution <strong>to</strong> a set of first order differentialequations of the formCḋ + Kd = f(x, t),d(0) = d 0 .The command solves transient field problems. In the case of heat conduction, K andC represent the n × n conductivity and capacity matrices, respectively.The initial conditions are given by the vec<strong>to</strong>r d0 containing initial values of d. Thetime integration procedure is governed by the parameters given in the vec<strong>to</strong>r ipdefined asip = [dt T α [nsnap nhist time i ... dof i ... ]] ,} {{ } } {{ }list ofnsnapmomentslist ofnhistdofswhere dt specifies the time increment in the time stepping scheme, T <strong>to</strong>tal time andα a time integration constant; see [1]. The parameter nsnap denotes the number ofsnapshots s<strong>to</strong>red in Tsnap. The selected elapsed times are specified in (time i ... ),whereas nhist is the number of time his<strong>to</strong>ries s<strong>to</strong>red in D and V. The selected degreesof-freedomare specified in (dof i ... ). The following table lists frequently used valuesof α:α = 0α = 1 2α = 1Forward difference; forward Euler,Trapezoidal rule; Crank-Nicholson,Backward difference; backward Euler.The matrix f contains the time-dependent load vec<strong>to</strong>rs. If no external loads areactive, the matrix corresponding <strong>to</strong> f should be replaced by []. The matrix f containsthe time-dependent prescribed values of the field variable. If no field variables areprescribed the matrix corresponding <strong>to</strong> pbound should be replaced by []. Matrix f isorganized in the following manner:SYSTEM 6.3 – 10


Dynamic system functionsstep1⎡f =⎢⎣The dimension of f is⎤time his<strong>to</strong>ry of the load at dof 1time his<strong>to</strong>ry of the load at dof 2⎥.time his<strong>to</strong>ry of the load at dof n(number of degrees-of-freedom) × (number of timesteps + 1).⎦ .The matrix pbound is organized in the following manner:⎡dof 1 time his<strong>to</strong>ry of the field variabledof 2 time his<strong>to</strong>ry of the field variablepbound =⎢⎣ . .dof m2 time his<strong>to</strong>ry of the field variable⎤⎥ . ⎦The dimension of pbound is(number of dofs with prescribed field values) × (number of timesteps + 2).The time his<strong>to</strong>ry functions can be generated using the command gfunc. If all thevalues of the time his<strong>to</strong>ries of f or pbound are kept constant, these values need <strong>to</strong> bestated only once. In this case the number of columns in f is one and in pbound two.It is highly recommended <strong>to</strong> define f as sparse (a <strong>MATLAB</strong> built-in function). Inmost cases only a few degrees-of-freedom are affected by the exterior load, and hencethe matrix contains only few non-zero entries.The computed snapshots are s<strong>to</strong>red in Tsnap, one column for each requested snapshotaccording <strong>to</strong> ip, i.e. the dimension of Tsnap is (number of dofs) × nsnap. Thecomputed time his<strong>to</strong>ries of d and ḋ are s<strong>to</strong>red in D and V, respectively, one linefor each requested degree-of-freedom according <strong>to</strong> ip. The dimension of D is nhist ×(number of timesteps + 1).6.3 – 11 SYSTEM


step2Dynamic system functionsPurpose:Syntax:Compute the dynamic solution <strong>to</strong> a set of second order differential equations.Dsnap=step2(K,C,M,d0,v0,ip,f,pdisp)[Dsnap,D,V,A]=step2(K,C,M,d0,v0,ip,f,pdisp)Description:step2 computes at equal time steps the solution <strong>to</strong> a second order differential equationsof the formM¨d + Cḋ + Kd = f(x, t),d(0) = d 0 ,ḋ(0) = v 0 .In structural mechanics problems, K , C and M represent the n×n stiffness, dampingand mass matrices, respectively.The initial conditions are given by the vec<strong>to</strong>rs d0 and v0, containing initial displacementsand initial velocities. The time integration procedure is governed by theparameters given in the vec<strong>to</strong>r ip defined asip = [dt T α δ [nsnap nhist time i ... dof i ... ]] ,} {{ }list ofnsnapmoments} {{ }list ofnhistdofswhere dt specifies the time increment in the time stepping scheme, T the <strong>to</strong>tal timeand α and δ time integration constants for the Newmark family of methods; see[1]. The parameter nsnap denotes the number of snapshots s<strong>to</strong>red in Dsnap. Theselected elapsed times are specified in (time i ... ), whereas nhist is the number oftime his<strong>to</strong>ries s<strong>to</strong>red in D, V and A. The selected degrees-of-freedom are specified in(dof i ... ). The following table lists frequently used values of α and δ:α = 1 4δ = 1 2Average acceleration (trapezoidal) rule,α = 1 6δ = 1 2Linear acceleration,α = 0 δ = 1 2Central difference.The matrix f contains the time-dependent load vec<strong>to</strong>rs. If no external loads are active,the matrix corresponding <strong>to</strong> f should be replaced by []. The matrix pdisp containsthe time-dependent prescribed displacement. If no displacements are prescribed thematrix corresponding <strong>to</strong> pdisp should be replaced by [].The matrix f is organized in the following manner:SYSTEM 6.3 – 12


Dynamic system functionsstep2⎡f =⎢⎣The dimension of f is⎤time his<strong>to</strong>ry of the load at dof 1time his<strong>to</strong>ry of the load at dof 2⎥.time his<strong>to</strong>ry of the load at dof n(number of degrees-of-freedom) × (number of timesteps + 1).⎦ .The matrix pdisp is organized in the following manner⎡dof 1 time his<strong>to</strong>ry of the displacementdof 2 time his<strong>to</strong>ry of the displacementpdisp =⎢⎣ . .dof m2 time his<strong>to</strong>ry of the displacement⎤⎥ . ⎦The dimension of pdisp is(number of dofs with prescribed displacement) × (number of timesteps + 2).The time his<strong>to</strong>ry functions can be generated using the command gfunc. If all thevalues of the time his<strong>to</strong>ries of f or pdisp are kept constant, these values need <strong>to</strong> bestated only once. In this case the number of columns in f is one and in pdisp two.It is highly recommended <strong>to</strong> define f as sparse (a <strong>MATLAB</strong> built-in function). Inmost cases only a few degrees-of-freedom are affected by the exterior load, and hencethe matrix contains only few non-zero entries.The computed displacement snapshots are s<strong>to</strong>red in Dsnap, one column for eachrequested snapshot according <strong>to</strong> ip, i.e. the dimension of Dsnap is (number of dofs)×nsnap. The computed time his<strong>to</strong>ries of d, ḋ and ¨d are s<strong>to</strong>red in D, V and A,respectively, one line for each requested degree-of-freedom according <strong>to</strong> ip. Thedimension of D is nhist × (number of timesteps + 1).6.3 – 13 SYSTEM


sweepDynamic system functionsPurpose:Syntax:Compute complex frequency response functions.Y=sweep(K,C,M,p,w)Description:Example:sweep computes the complex frequency response function for a system of the form[K + iωC − ω 2 M]y(ω) = p.Here K, C and M represent the m-by-m stiffness, damping and mass matrices, respectively.The vec<strong>to</strong>r p defines the amplitude of the force. The frequency responsefunction is computed for the values of ω given by the vec<strong>to</strong>r w.The complex frequency response function is s<strong>to</strong>red in the matrix Y with dimensionm-by-n, where n is equal <strong>to</strong> the number of circular frequencies defined in w.The steady-state response can be computed by>> X=real(Y*exp(i*w*t));and the amplitude by>> Z=abs(Y);SYSTEM 6.3 – 14


7 Statements and macrosStatements describe algorithmic actions that can be executed. There are two differenttypes of control statements, conditional and repetitive. The first group defines conditionaljumps whereas the latter one defines repetition until a conditional statement is fulfilled.Macros are used <strong>to</strong> define new functions <strong>to</strong> the <strong>MATLAB</strong> or CALFEM structure, or <strong>to</strong>s<strong>to</strong>re a sequence of statements in an .m-file.ifforwhileControl statementsConditional jumpInitiate a loopDefine a conditional loopfunctionscriptMacrosDefine a new functionS<strong>to</strong>re a sequence of statements7 – 1 STATEMENTS


ifPurpose:Syntax:Conditional jump.if logical expression.elseif logical expression.else.endDescription:if initiates a conditional jump. If logical expression produces the value True thestatements following if are executed. If logical expression produces the value Falsethe next conditional statement elseif is checked.elseif works like if. One or more of the conditional statement elseif can be added afterthe initial conditional statement if.If else is present, the statements following else are executed if the logical expressionsin all if and elseif statements produce the value False. The if loop is closed by end <strong>to</strong>define the loop sequence.The following relation opera<strong>to</strong>rs can be used== equal>= greater than or equal <strong>to</strong>> greater than


forPurpose:Syntax:Initiate a loop.for i = start : inc : s<strong>to</strong>p.endDescription:for initiates a loop which terminates when i>s<strong>to</strong>p. The for loop is closed by end <strong>to</strong>define the loop sequence.Examples:Note:for i = 1 : 10 i takes values from 1 <strong>to</strong> 10.for i = 1 : 2 : 10 i equals 1, 3, 5, 7, 9.for i = 20 : -1 : 1 i equals 20, 19 ... 2, 1.This is <strong>MATLAB</strong> built-in language.7 – 3 STATEMENTS


whilePurpose:Syntax:Define a conditional loop.while logical expression.endDescription:while initiates a conditional loop which terminates when logical expression equalsFalse. The while loop is closed by end <strong>to</strong> define the loop sequence.Examples:The different relation opera<strong>to</strong>rs that can be used can be found under the if command.A loop continuing until a equals bwhile a∼=b.endNote:This is <strong>MATLAB</strong> built-in language.STATEMENTS 7 – 4


functionPurpose:Syntax:Define a new function.function[ out1 , out2 , ... ]=name( in1 , in2 , ... )Description:Example:name is replaced by the name of the function. The input variables in1, in2, ... can bescalars, vec<strong>to</strong>rs or matrices, and the same holds for the output variables out1, out2,... .To define the CALFEM function spring1e a file named spring1e.m is created. The filecontains the following statements:function [Ke]=spring1e(k)% Define the stiffness matrix% for a one dimensional spring% with spring stiffness kKe=[ k, -k; -k, k ]Note:i.e. the function spring1e is defined <strong>to</strong> return a stiffness matrix.This is <strong>MATLAB</strong> built-in language.7 – 5 STATEMENTS


scriptPurpose:Syntax:Execute a s<strong>to</strong>red sequence of statements.nameDescription:Example:name is replaced by the name of the script.The statements below are s<strong>to</strong>red in a file named spring.m and executed by typingspring in the <strong>MATLAB</strong> command window.% Stiffness matrix for a one dimensional% spring with stiffness k=10k=10;[Ke]=spring1e(k);Note:This is <strong>MATLAB</strong> built-in language.STATEMENTS 7 – 6


8 Graphics functionsThe group of graphics functions comprises functions for <strong>element</strong> based graphics. Meshplots, displacements, section forces, flows, iso lines and principal stresses can be displayed.The functions are divided in<strong>to</strong> two dimensional, and general graphics functions.plotfilleldraw2eldisp2eldia2elflux2eliso2elprinc2axisclffiguregridholdprinttexttitlexlabel,ylabel,zlabelTwo dimensional graphics functionsPlot lines and points in 2D spaceDraw filled 2D polygonsDraw undeformed <strong>finite</strong> <strong>element</strong> meshDraw deformed <strong>finite</strong> <strong>element</strong> meshDraw section force diagramPlot flux vec<strong>to</strong>rsDraw isolines for nodal quantitiesPlot principal stressesGeneral graphics functionsAxis scaling and appearanceClear current figureCreate figuresGrid linesHold current graphPrint graph or save graph <strong>to</strong> fileAdd text <strong>to</strong> current plotTitles for 2D and 3D plotsAxis labels for 2D and 3D plots8 – 1 GRAPHICS


axisPurpose:Syntax:Plot axis scaling and appearance.axis([xmin xmax ymin ymax])axis([xmin xmax ymin ymax zmin zmax])axis au<strong>to</strong>axis squareaxis equalaxis offaxis onDescription:Note:axis([xmin xmax ymin ymax]) sets scaling for the x- and y-axes on the current 2D plot.axis([xmin xmax ymin ymax zmin zmax]) sets the scaling for the x-, y- and z-axes onthe current 3D plot.axis au<strong>to</strong> returns the axis scaling <strong>to</strong> its default au<strong>to</strong>matic mode where, for each plot,xmin = min(x), xmax = max(x), etc.axis square makes the current axis box square in shape.axis equal changes the current axis box size so that equal tick mark increments onthe x- and y-axes are equal in size. This makes plot(sin(x),cos(x)) look like a circle,instead of an oval.axis normal res<strong>to</strong>res the current axis box <strong>to</strong> full size and removes any restrictions onthe scaling of the units. This undoes the effects of axis square and axis equal.axis off turns off all axis labeling and tick marks.axis on turns axis labeling and tick marks back on.This is a <strong>MATLAB</strong> built-in function. For more information about the axis function,type help axis.GRAPHICS 8 – 2


clfPurpose:Syntax:Clear current figure (graph window).clfDescription:Note:clf deletes all objects (axes) from the current figure.This is a <strong>MATLAB</strong> built-in function. For more information about the clf function,type help clf.8 – 3 GRAPHICS


eldraw2Purpose:Syntax:Draw the undeformed mesh for a two dimensional structure.eldraw2(Ex,Ey)eldraw2(Ex,Ey,plotpar)eldraw2(Ex,Ey,plotpar,elnum)Description:eldraw2 displays the undeformed mesh for a two dimensional structure.Input variables are the coordinate matrices Ex and Ey formed by the function coordxtr.The variable plotpar sets plot parameters for linetype, linecolor and node marker.plotpar = [ linetype linecolor nodemark ]linetype = 1 solid line linecolor = 1 black2 dashed line 2 blue3 dotted line 3 magenta4 rednodemark = 1 circle2 star0 no markDefault is solid black lines with circles at nodes.Element numbers can be displayed at the center of the <strong>element</strong> if a column vec<strong>to</strong>relnum with the <strong>element</strong> numbers is supplied. This column vec<strong>to</strong>r can be derived fromthe <strong>element</strong> <strong>to</strong>pology matrix Edof,elnum=Edof(:,1)i.e. the first column of the <strong>to</strong>pology matrix.Limitations:Supported <strong>element</strong>s are bar, beam, triangular three node, and quadrilateral fournode <strong>element</strong>s.GRAPHICS 8 – 4


eldisp2Purpose:Syntax:Draw the deformed mesh for a two dimensional structure.[magnfac]=eldisp2(Ex,Ey,Ed)[magnfac]=eldisp2(Ex,Ey,Ed,plotpar)eldisp2(Ex,Ey,Ed,plotpar,magnfac)Description:eldisp2 displays the deformed mesh for a two dimensional structure.Input variables are the coordinate matrices Ex and Ey formed by the function coordxtr,and the <strong>element</strong> displacements Ed formed by the function extract.The variable plotpar sets plot parameters for linetype, linecolor and node marker.plotpar=[ linetype linecolor nodemark ]linetype = 1 solid line linecolor = 1 black2 dashed line 2 blue3 dotted line 3 magenta4 rednodemark = 1 circle2 star0 no markDefault is dashed black lines with circles at nodes.The magnification fac<strong>to</strong>r magnfac is a scalar that magnifies the <strong>element</strong> displacementsfor visibility. The magnification fac<strong>to</strong>r is set au<strong>to</strong>matically if it is omitted in the inputlist.Limitations:Supported <strong>element</strong>s are bar, beam, triangular three node, and quadrilateral fournode <strong>element</strong>s.8 – 5 GRAPHICS


eldia2Purpose:Draw the section force diagrams of a two dimensional beam <strong>element</strong>.yyxxyyxxSyntax:[magnfac]=eldia2(ex,ey,es,eci)eldia2(ex,ey,es,eci,magnfac)eldia2(ex,ey,es,eci,magnfac,magnitude)Description:eldia2 plots a section force diagram of a two dimensional beam <strong>element</strong> in its globalposition.The input variables ex and ey are defined in beam2e and the input variables⎡es =⎢⎣⎤S 1S 2 ⎥. ⎦S n⎡eci =⎢⎣⎤¯x 1¯x 2 ⎥. ⎦¯x nconsist of column matrices that contain section forces and corresponding local x-coordinates respectively. The values in es and eci are computed in beam2s. It shouldbe noted, however, that whereas all three section forces are computed in beam2s onlyone of them shall be given as input <strong>to</strong> eldia2 by es.GRAPHICS 8 – 6


eldia2The magnification fac<strong>to</strong>r magnfac is a scalar that magnifies the diagram for visibility.magnfac is set au<strong>to</strong>matically if it is omitted in the input list.The optional inputmagnitude = [ S x y ]adds a scaled bar, with length equivalent <strong>to</strong> a reference force S, starting at coordinates(x, y). If no coordinates are given the starting point will be (0,-0.5).Limitations:Supported <strong>element</strong>s are two dimensional beam <strong>element</strong>s.8 – 7 GRAPHICS


elflux2Purpose:Syntax:Draw <strong>element</strong> flow arrows for two dimensional <strong>element</strong>s.[magnfac]=elflux2(Ex,Ey,Es)[magnfac]=elflux2(Ex,Ey,Es,plotpar)elflux2(Ex,Ey,Es,plotpar,magnfac)Description:elflux2 displays <strong>element</strong> heat flux vec<strong>to</strong>rs (or corresponding quantities) for a numberof <strong>element</strong>s of the same type. The flux vec<strong>to</strong>rs are displayed as arrows at the <strong>element</strong>centroids. Note that only the flux vec<strong>to</strong>rs are displayed. To display the <strong>element</strong> mesh,use eldraw2.Input variables are the coordinate matrices Ex and Ey, and the <strong>element</strong> flux matrixEs defined in flw2ts or flw2qs.The variable plotpar sets plot parameters for the flux arrows.plotpar=[ arrowtype arrowcolor ]arrowtype = 1 solid arrowcolor = 1 black2 dashed 2 blue3 dotted 3 magenta4 redDefault, if plotpar is omitted, is solid black arrows.The magnification fac<strong>to</strong>r magnfac is a scalar that magnifies the arrows in relation <strong>to</strong>the <strong>element</strong> size. The magnification fac<strong>to</strong>r is set au<strong>to</strong>matically if it is omitted in theinput list.Limitations:Supported <strong>element</strong>s are triangular 3 node and quadrilateral 4 node <strong>element</strong>s.GRAPHICS 8 – 8


eliso2Purpose:Syntax:Display <strong>element</strong> iso lines for two dimensional <strong>element</strong>s.eliso2(Ex,Ey,Ed,isov)eliso2(Ex,Ey,Ed,isov,plotpar)Description:eliso2 displays <strong>element</strong> iso lines for a number of <strong>element</strong>s of the same type. Note tha<strong>to</strong>nly the iso lines are displayed. To display the <strong>element</strong> mesh, use eldraw2.Input variables are the coordinate matrices Ex and Ey formed by the function coordxtr,and the <strong>element</strong> nodal quantities (e.g displacement or energy potential) matrixEd defined in extract.If isov is a scalar it determines the number of iso lines <strong>to</strong> be displayed. If isov is avec<strong>to</strong>r it determines the values of the iso lines <strong>to</strong> be displayed (number of iso linesequal <strong>to</strong> length of vec<strong>to</strong>r isov).isov = [ isolines]isov = [ isovalue(1) ... isovalue(n) ]The variable plotpar sets plot parameters for the iso lines.plotpar=[ linetype linecolor textfcn ]arrowtype = 1 solid arrowcolor = 1 black2 dashed 2 blue3 dotted 3 magenta4 redtextfcn = 0 the iso values of the lines will not be printed1 the iso values of the lines will be printed at the iso lines2 the iso values of the lines will be printed where the cursor indicatesDefault is solid, black lines and no iso values printed.Limitations:Supported <strong>element</strong>s are triangular 3 node and quadrilateral 4 node <strong>element</strong>s.8 – 9 GRAPHICS


elprinc2Purpose:Syntax:Draw <strong>element</strong> principal stresses as arrows for two dimensional <strong>element</strong>s.[magnfac]=elprinc2(Ex,Ey,Es)[magnfac]=elprinc2(Ex,Ey,Es,plotpar)elprinc2(Ex,Ey,Es,plotpar,magnfac)Description:elprinc2 displays <strong>element</strong> principal stresses for a number of <strong>element</strong>s of the same type.The principal stresses are displayed as arrows at the <strong>element</strong> centroids. Note tha<strong>to</strong>nly the principal stresses are displayed. To display the <strong>element</strong> mesh, use eldraw2.Input variables are the coordinate matrices Ex and Ey, and the <strong>element</strong> stressesmatrix Es defined in plants or planqsThe variable plotpar sets plot parameters for the principal stress arrows.plotpar=[ arrowtype arrowcolor ]arrowtype = 1 solid arrowcolor = 1 black2 dashed 2 blue3 dotted 3 magenta4 redDefault, if plotpar is omitted, is solid black arrows.The magnification fac<strong>to</strong>r magnfac is a scalar that magnifies the arrows in relation <strong>to</strong>the <strong>element</strong> size. The magnification fac<strong>to</strong>r is set au<strong>to</strong>matically if it is omitted in theinput list.Limitations:Supported <strong>element</strong>s are triangular 3 node and quadrilateral 4 node <strong>element</strong>s.GRAPHICS 8 – 10


figurePurpose:Syntax:Create figures (graph windows).figure(h)Description:Note:figure(h) makes the h’th figure the current figure for subsequent plotting functions.If figure h does not exist, a new one is created using the first available figure handle.This is a <strong>MATLAB</strong> built-in function. For more information about the figure function,type help figure.8 – 11 GRAPHICS


fillPurpose:Syntax:Filled 2D polygons.fill(x,y,c)fill(X,Y,C)Description:Example:Note:fill(x,y,c) fills the 2D polygon defined by vec<strong>to</strong>rs x and y with the color specified byc. The vertices of the polygon are specified by pairs of components of x and y. Ifnecessary, the polygon is closed by connecting the last vertex <strong>to</strong> the first.If c is a vec<strong>to</strong>r of the same length as x and y, its <strong>element</strong>s are used <strong>to</strong> specify colorsat the vertices. The color within the polygon is obtained by bilinear interpolation inthe vertex colors.If X, Y and C are matrices of the same size, fill(X,Y,C) draws one polygon per columnwith interpolated colors.The solution of a heat conduction problem results in a vec<strong>to</strong>r d with nodal temperatures.The temperature distribution in a group of triangular 3 node (nen=3)or quadrilateral 4 node (nen=4) <strong>element</strong>s, with <strong>to</strong>pology defined by edof, can bedisplayed by[ex,ey]=coordxtr(edof,Coord,Dof,nen)ed=extract(edof,d)colormap(hot)fill(ex’,ey’,ed’)This is a <strong>MATLAB</strong> built-in function. For more information about the fill function,type help fill.GRAPHICS 8 – 12


gridPurpose:Syntax:Grid lines for 2D and 3D plots.grid ongrid offgridDescription:Note:grid on adds grid lines on the current axes.grid off takes them off.grid by itself, <strong>to</strong>ggles the grid state.This is a <strong>MATLAB</strong> built-in function. For more information about the grid function,type help grid.8 – 13 GRAPHICS


holdPurpose:Syntax:Hold the current graph.hold onhold offholdDescription:Note:hold on holds the current graph.hold off returns <strong>to</strong> the default mode where plot functions erase previous plots.hold by itself, <strong>to</strong>ggles the hold state.This is a <strong>MATLAB</strong> built-in function. For more information about the hold function,type help hold.GRAPHICS 8 – 14


plotPurpose:Syntax:Linear two dimensional plot.plot(x,y)plot(x,y,’linetype’)Description:Example:Note:plot(x,y) plots vec<strong>to</strong>r x versus vec<strong>to</strong>r y. Straight lines are drawn between each pairof values.Various line types, plot symbols and colors may be obtained with plot(x,y,s) where sis a 1, 2, or 3 character string made from the following characters:– solid line . point y yellow: dotted line o circle m magenta-. dashdot line x x-mark c cyan- - dashed line + plus r red* star g greenb bluew whitek blackDefault is solid blue lines.The statementplot(x,y,’-’,x,y,’ro’)plots the data twice, giving a solid blue line with red circles at the data points.This is a <strong>MATLAB</strong> built-in function. For more information about the plot function,type help plot.8 – 15 GRAPHICS


printPurpose:Syntax:Create hardcopy output of current figure window.print [filename]Description:Note:print with no arguments sends the contents of the current figure window <strong>to</strong> thedefault printer. print filename creates a PostScript file of the current figure windowand writes it <strong>to</strong> the specified file.This is a <strong>MATLAB</strong> built-in function. For more information about the print function,type help print.GRAPHICS 8 – 16


textPurpose:Syntax:Add text <strong>to</strong> current plot.text(x,y,’string’)Description:Note:text adds the text in the quotes <strong>to</strong> location (x,y) on the current axes, where (x,y)is in units from the current plot. If x and y are vec<strong>to</strong>rs, text writes the text at alllocations given. If ’string’ is an array with the same number of rows as the length ofx and y, text marks each point with the corresponding row of the ’string’ array.This is a <strong>MATLAB</strong> built-in function. For more information about the text function,type help text.8 – 17 GRAPHICS


titlePurpose:Syntax:Titles for 2D and 3D plots.title(’text’)Description:Note:title adds the text string ’text’ at the <strong>to</strong>p of the current plot.This is a <strong>MATLAB</strong> built-in function. For more information about the title function,type help title.GRAPHICS 8 – 18


xlabel, ylabel, zlabelPurpose:Syntax:x-, y-, and z-axis labels for 2D and 3D plots.xlabel(’text’)ylabel(’text’)zlabel(’text’)Description:Note:xlabel adds text beside the x-axis on the current plot.ylabel adds text beside the y-axis on the current plot.zlabel adds text beside the z-axis on the current plot.This is a <strong>MATLAB</strong> built-in function. For more information about the functions,type help xlabel, help ylabel, or help zlabel.8 – 19 GRAPHICS


9 User’s Manual, examples9.1 IntroductionThis set of examples is defined with the ambition <strong>to</strong> serve as a User’s Manual. Theexamples, except the introduc<strong>to</strong>ry ones, are written as .m-files (script files) and supplied<strong>to</strong>gether with the CALFEM functions.The User’s Manual examples are separated in<strong>to</strong> four groups:<strong>MATLAB</strong> introductionStatic analysisDynamic analysisNonlinear analysisThe <strong>MATLAB</strong> introduction examples explain some basic concepts and introduce a se<strong>to</strong>f standard <strong>MATLAB</strong> functions usable in the <strong>finite</strong> <strong>element</strong> context. The static linearexamples illustrate <strong>finite</strong> <strong>element</strong> analysis of different structures loaded by stationary loads.The dynamic linear examples illustrate some basic features in dynamics, such as modalanalysis and time stepping procedures. The examples of nonlinear analysis cover subjectssuch as second order theory and buckling.9.1 – 1 EXAMPLES


9.2 <strong>MATLAB</strong> introductionThe examples in this section illustrate basic <strong>MATLAB</strong> concepts such as handling ofworkspace, variables and functions. The examples are:exi1exi2exi3exi4exi5exi6<strong>MATLAB</strong> introductionHandling matricesMatrix and array operationsCreate and handle .m-filesDisplay formatsCreate a session .log-fileGraphic display of vec<strong>to</strong>rs9.2 – 1 EXAMPLES


exi1<strong>MATLAB</strong> introductionPurpose:Show how <strong>to</strong> create and handle matrices in <strong>MATLAB</strong>.Description:The following commands create a scalar x, two vec<strong>to</strong>rs u and v and two matrices Aand B.Lines starting with the <strong>MATLAB</strong> prompt >> are command lines while the other linesshow the results from these commands.>> x=7x =7>> u=[1 2 3 4]u =1 2 3 4>> v=[0:0.4:2]v =0 0.4000 0.8000 1.2000 1.6000 2.0000>> A=[1 2; 3 4]A =1 23 4>> B=[5 6; 7 8]B =5 67 8Both brief and detailed listing of variables is possible>> whoYour variables are:A B u v xEXAMPLES 9.2 – 2


<strong>MATLAB</strong> introductionexi1>> whosName Size Bytes ClassA 2x2 32 double arrayB 2x2 32 double arrayu 1x4 32 double arrayv 1x6 48 double arrayx 1x1 8 double arrayGrand <strong>to</strong>tal is 19 <strong>element</strong>s using 152 bytesThe value of a variable is displayed by writing the variable name,>> uu =1 2 3 4and the dimension (m×n) of a variable is obtained by>> size(u)ans =1 4where the answer is temporarily s<strong>to</strong>red in the vec<strong>to</strong>r ans.The variable x is removed from workspace by>> clear xTo remove all variables from workspace, clear without argument is used.Assignment of a value <strong>to</strong> an <strong>element</strong> in a matrix is made as>> A(2,2)=9A =1 23 99.2 – 3 EXAMPLES


exi1<strong>MATLAB</strong> introductionTo select a complete row or column colon notation is used.>> s=A(:,1)s =13>> t=A(2,:)t =3 9A zero matrix K (4×4) is generated by>> K=zeros(4,4)K =0 0 0 00 0 0 00 0 0 00 0 0 0Similarly an (m×n) matrix of all ones can be generated by ones(m,n).Expand an already defined matrix>> H=[A;B]H =1 23 95 67 8>> J=[A B]J =1 2 5 63 9 7 8EXAMPLES 9.2 – 4


<strong>MATLAB</strong> introductionexi2Purpose:Show some examples of basic matrix and <strong>element</strong>-by-<strong>element</strong> operations.Description:Consider the following matricesa = [ 5 12 3 ] b = [ 1 0 4 ]A =[1 6 32 8 4]B =[2 5 47 2 0]The transpose of a matrix is generated by>> A’ans =1 26 83 4>> a’ans =5123Addition and subtraction of matrices>> A+Bans =3 11 79 10 4>> A-Bans =-1 1 -1-5 6 4Note that if the result of an operation is not assigned <strong>to</strong> a specific variable, theanswer is temporarily s<strong>to</strong>red in the variable ans.9.2 – 5 EXAMPLES


exi2<strong>MATLAB</strong> introductionMultiplication of matrices>> a*b’ans =17>> a’*bans =5 0 2012 0 483 0 12>> A’*Bans =16 9 468 46 2434 23 12>> C=B*A’C =44 6019 30To perform arithmetic operations, matrix dimensions must agree>> D=A*B??? Error using ==> *Inner matrix dimensions must agree.The inverse of a square matrix>> inv(C)ans =0.1667 -0.3333-0.1056 0.2444EXAMPLES 9.2 – 6


<strong>MATLAB</strong> introductionexi2The determinant of a square matrix>> det(C)ans =180An array or <strong>element</strong>-by-<strong>element</strong> arithmetic operation is denoted by a period (.) precedingan opera<strong>to</strong>r. Examples are <strong>element</strong>-by-<strong>element</strong> multiplication (.*), division(./), and powers (.^).>> a.*bans =5 0 12>> A.*Bans =2 30 1214 16 0Matrices in <strong>element</strong>-by-<strong>element</strong> operations must obviously have the same dimensions.Mathematical functions applied <strong>to</strong> arrays are also evaluated <strong>element</strong>-by-<strong>element</strong>.>> sin([0 1 2 3 4]*pi/2)ans =0 1 0 -1 09.2 – 7 EXAMPLES


exi3<strong>MATLAB</strong> introductionPurpose:Show how <strong>to</strong> handle script files and function files.Description:When starting a <strong>MATLAB</strong> session the default working direc<strong>to</strong>ry is according <strong>to</strong>initial settings, for example C:\USER. A new working direc<strong>to</strong>ry can be chosen bytyping for example>> cd A:which makes the root direc<strong>to</strong>ry in drive A the working direc<strong>to</strong>ry.Files containing <strong>MATLAB</strong> and/or CALFEM statements are characterized by thesuffix .m. For example the file bar2e.m contains statements <strong>to</strong> evaluate the <strong>element</strong>stiffness matrix for a two dimensional bar <strong>element</strong>. An .m-file is allowed <strong>to</strong> includereferences <strong>to</strong> other .m-files, and also <strong>to</strong> call itself recursively.Two types of .m-files can be used, script files and function files. Script files collect asequence of statements under one command name. Function files allow new functionswith input and/or output variables <strong>to</strong> be defined. Both script files and function filesare ordinary ASCII text files and can therefore be created in an arbitrary edi<strong>to</strong>r.In the <strong>MATLAB</strong> environment an .m-file edi<strong>to</strong>r can be activated from the pull downmenu on <strong>to</strong>p of the <strong>MATLAB</strong> window.An example of a script file is given below. The following sequence of statements istyped in the .m-file edi<strong>to</strong>r, and saved as test.m.% ----- Script file test.m -----A=[0 4;2 8]B=[3 9;5 7]C=A*B% ------------ end -------------A line starting with an % is regarded as a comment line.The statements are executed by writing the file name (without the suffix .m) in thecommand window>> testA =0 42 8EXAMPLES 9.2 – 8


<strong>MATLAB</strong> introductionexi3B =C =3 95 720 2846 74The second type of .m-files is the function file. The first line of these files containsthe word function. The example below is a function that computes the second andthird power of a scalar.function [b,c]=func1(a)% ----- function file ’func1.m’ -----b=a*a;c=a*a*a;% ------------- end -----------------The semi-colon prohibits the echo display of the variables on the screen.The file can be created using an ordinary edi<strong>to</strong>r, and it must be saved as func1.m i.e.the file name without extension must be the same as the function name.The second and third power of 2 are calculated by typing>> [b,c]=func1(2)producingb =c =48See also function and script in Section 7.9.2 – 9 EXAMPLES


exi4<strong>MATLAB</strong> introductionPurpose:Show different display formats.Description:Consider the following matrix operation>> A=[0 4;2 8];>> B=[3 9;5 7];>> C=A*B/2537C =0.0079 0.01100.0181 0.0292The result from the computation of C above is shown in the default format, displayingfour significant decimal digits.Other formats can be defined by the command format>> format long>> CC =0.00788332676389 0.011036657469450.01813165155696 0.02916830902641>> format short e>> CC =7.8833e-031.8132e-021.1037e-022.9168e-02>> format long e>> CC =7.883326763894364e-031.813165155695703e-021.103665746945211e-022.916830902640915e-02EXAMPLES 9.2 – 10


<strong>MATLAB</strong> introductionexi5Purpose:How <strong>to</strong> make a command window session .log-file.Description:The diary and echo commands are useful for presentation purposes since the completeset of statements can be saved <strong>to</strong>gether with some selected results.The command>> diary filenamesaves all subsequent terminal input and resulting output in the file named filenameon the default device. The file is closed using>> diary offConsider the script file test.m.% ----- Script file test.m -----diary testlogecho onA=[0 4;2 8];B=[3 9;5 7];C=A*B/2537echo offdiary off% ------------- end ------------Normally, the statements in an .m-file do not display during execution. The commandsecho on and echo off allow the statements <strong>to</strong> be viewed as they execute.Execution of test.m yields>>testA=[0 4;2 8];B=[3 9;5 7];C=A*B/2537C =0.0079 0.01100.0181 0.0292in the command window and on the file testlog as well.9.2 – 11 EXAMPLES


exi6<strong>MATLAB</strong> introductionPurpose:How <strong>to</strong> display vec<strong>to</strong>rs and handle the graphics window.Description:The contents of a vec<strong>to</strong>r versus the vec<strong>to</strong>r index or a vec<strong>to</strong>r versus another vec<strong>to</strong>rcan be displayed in the graphics window. Consider the vec<strong>to</strong>rsx = [ 1 2 5 ] y = [ 5 22 16 ]The function>> plot(y)plots the contents of the vec<strong>to</strong>r y versus vec<strong>to</strong>r index and>> plot(x,y)plots the contents of the vec<strong>to</strong>r y versus the vec<strong>to</strong>r x.The commandstitle(’text’ )xlabel(’xlabel’ )ylabel(’ylabel’ )write text as a title of the current plot, and xlabel and ylabel as labels of the coordinateaxis.Grid lines are added withgridandclfclears the current figure.EXAMPLES 9.2 – 12


9.3 Static analysisThis section illustrates some linear static <strong>finite</strong> <strong>element</strong> calculations. The examples dealwith structural problems as well as field problems such as heat conduction.exs1exs2exs3exs4exs5exs6exs7Static analysisLinear spring systemOne-dimensional heat flowSimply supported beamPlane trussPlane frameGeometry based frame analysisTwo dimensional diffusionThe introduc<strong>to</strong>ry example exs1 illustrates the basic steps in the <strong>finite</strong> <strong>element</strong> method fora simple structure of one-dimensional linear springs. The linear spring or analogy <strong>element</strong>is also used in example exs2 <strong>to</strong> solve a problem of heat conduction through a wall. Asimply supported beam is analysed in example exs3. Element forces and reactions at thesupports are calculated. A two dimensional plane truss is analysed in example exs4 anda two dimensional plane frame is analysed in example exs5. A frame built up from bothbeams and bars is analysed in example exs6. The <strong>finite</strong> <strong>element</strong> model is defined from thegeometry. Graphics facilities are also explained in example exs5 and exs6.Note: The examples listed above are supplied as .m-files on the CALFEM diskette underthe direc<strong>to</strong>ry examples. The example files are named according <strong>to</strong> the table.9.3 – 1 EXAMPLES


exs1Static analysisPurpose:Show the basic steps in a <strong>finite</strong> <strong>element</strong> calculation.Description:The general procedure in linear <strong>finite</strong> <strong>element</strong> calculations is carried out for a simplestructure. The steps are• define the model• generate <strong>element</strong> matrices• assemble <strong>element</strong> matrices in<strong>to</strong> the global system of equations• solve the global system of equations• evaluate <strong>element</strong> forcesConsider the system of three linear elastic springs, and the corresponding <strong>finite</strong><strong>element</strong> model. The system of springs is fixed in its ends and loaded by a single loadF .2kFk2k2●11●2●33The computation is initialized by defining the <strong>to</strong>pology matrix Edof, containing <strong>element</strong>numbers and global <strong>element</strong> degrees of freedom,>> Edof=[1 1 2;2 2 3;3 2 3];the global stiffness matrix K (3×3) of zeros,>> K=zeros(3,3)K =0 0 00 0 00 0 0EXAMPLES 9.3 – 2


Static analysisexs1and the load vec<strong>to</strong>r f (3×1) with the load F = 100 in position 2.>> f=zeros(3,1); f(2)=100f =01000Element stiffness matrices are generated by the function spring1e. The <strong>element</strong> propertyep for the springs contains the spring stiffnesses k and 2k respectively, wherek = 1500.>> k=1500; ep1=k; ep2=2*k;>> Ke1=spring1e(ep1)Ke1 =1500 -1500-1500 1500>> Ke2=spring1e(ep2)Ke2 =3000 -3000-3000 3000The <strong>element</strong> stiffness matrices are assembled in<strong>to</strong> the global stiffness matrix K according<strong>to</strong> the <strong>to</strong>pology.>> K=assem(Edof(1,:),K,Ke2)K =3000 -3000 0-3000 3000 00 0 0>> K=assem(Edof(2,:),K,Ke1)K =3000 -3000 0-3000 4500 -15000 -1500 15009.3 – 3 EXAMPLES


exs1Static analysis>> K=assem(Edof(3,:),K,Ke2)K =3000 -3000 0-3000 7500 -45000 -4500 4500The global system of equations is solved considering the boundary conditions givenin bc.>> bc= [1 0; 3 0];>> a=solveq(K,f,bc)a =00.01330Element forces are evaluated from the <strong>element</strong> displacements. These are obtainedfrom the global displacements a using the function extract.>> ed1=extract(Edof(1,:),a)ed1 =0 0.0133>> ed2=extract(Edof(2,:),a)ed2 =0.0133 0>> ed3=extract(Edof(3,:),a)ed3 =0.0133 0EXAMPLES 9.3 – 4


Static analysisexs1The spring forces are evaluated using the function spring1s.>> es1=spring1s(ep2,ed1)es1 =40>> es2=spring1s(ep1,ed2)es2 =-20>> es3=spring1s(ep2,ed3)es3 =-409.3 – 5 EXAMPLES


exs2Static analysisPurpose:Analysis of one-dimensional heat flow.Description:Consider a wall built up of concrete and thermal insulation. The outdoor temperatureis −17 ◦ C and the temperature inside is 20 ◦ CT 0 = -17 o CT i = 20 o Csurface thermal resistance, m = 0.18 m 2 K/Wconcrete, λ = 1.7 W/mKthermal insulation, λ = 0.04 W/mKconcrete, λ = 1.7 W/mKsurface thermal resistance, m = 0.07 m 2 K/W0.070 m0.100 m0.100 mT 1 T 2 T 3 T 4 T 5 T 6●● ●● ● ●1 2 3 4 5The wall is subdivided in<strong>to</strong> five <strong>element</strong>s and the one-dimensional spring (analogy)<strong>element</strong> spring1e is used. Equivalent spring stiffnesses are k i = λA/L for thermalconductivity and k i = A/m for thermal surface resistance. Corresponding springstiffnesses per m 2 of the wall are:k 1 = 1/0.07 = 14.2857 W/ ◦ Ck 2 = 1.7/0.070 = 24.2857 W/ ◦ Ck 3 = 0.040/0.100 = 0.4000 W/ ◦ Ck 4 = 1.7/0.100 = 17.0000 W/ ◦ Ck 5 = 1/0.18 = 5.5555 W/ ◦ CA global stiffness matrix K and a load vec<strong>to</strong>r f are defined. The <strong>element</strong> matrices Keare computed using spring1e, and the function assem assembles the global stiffnessmatrix.The system of equations is solved using solveq with considerations <strong>to</strong> the boundaryconditions in bc. The prescribed temperatures are T 1 = −17 ◦ C and T 6 = 20 ◦ C.EXAMPLES 9.3 – 6


Static analysisexs2>> Edof=[1 1 22 2 3;3 3 4;4 4 5;5 5 6];>> K=zeros(6);>> f=zeros(6,1);>> ep1=[ 1/0.07 ]; ep2=[ 1.7/0.07 ];>> ep3=[ 0.040/0.10 ]; ep4=[ 1.7/0.10 ];>> ep5=[ 1/0.18 ];>> Ke1=spring1e(ep1); Ke2=spring1e(ep2);>> Ke3=spring1e(ep3); Ke4=spring1e(ep4);>> Ke5=spring1e(ep5);>> K=assem(Edof(1,:),K,Ke1); K=assem(Edof(2,:),K,Ke2);>> K=assem(Edof(3,:),K,Ke3); K=assem(Edof(4,:),K,Ke4);>> K=assem(Edof(5,:),K,Ke5);>> bc=[1 -17; 6 20];>> T=solveq(K,f,bc)T =-17.0000-16.0912-15.556716.899517.663220.0000The temperature values in the node points are given in the vec<strong>to</strong>r T.After solving the system of equations, the heat flow through the wall is computedusing extract and spring1s.>> ed1=extract(Edof(1,:),T);>> ed2=extract(Edof(2,:),T);>> ed3=extract(Edof(3,:),T);>> ed4=extract(Edof(4,:),T);>> ed5=extract(Edof(5,:),T);9.3 – 7 EXAMPLES


exs2Static analysis>> q1=spring1s(ep1,ed1)q1 =12.9825>> q2=spring1s(ep2,ed2)q2 =12.9825>> q3=spring1s(ep3,ed3)q3 =12.9825>> q4=spring1s(ep4,ed4)q4 =12.9825>> q5=spring1s(ep5,ed5)q5 =12.9825The heat flow through the wall, equal for all <strong>element</strong>s, is q = 13.0 W/m 2 .EXAMPLES 9.3 – 8


Static analysisexs3Purpose:Analysis of a simply supported beam.Description:Consider the simply supported beam loaded by a single load f = 10000 N, appliedat a point 1 meter from the left support. The corresponding <strong>finite</strong> <strong>element</strong> mesh isalso shown. The following data apply <strong>to</strong> the beamYoung’s modulus E = 2.10e 11 N/m 2Cross section area A = 45.3e −4 m 2Moment of inertia I = 2510e −8 m 4f = 10 kN9 m3216549871211101 2 3The <strong>element</strong> <strong>to</strong>pology is defined by the <strong>to</strong>pology matrix>> Edof=[1 1 2 3 4 5 62 4 5 6 7 8 93 7 8 9 10 11 12];The system matrices, i.e. the stiffness matrix K and the load vec<strong>to</strong>r f, are defined by>> K=zeros(12); f=zeros(12,1); f(5)=-10000;The <strong>element</strong> property vec<strong>to</strong>r ep, the <strong>element</strong> coordinate vec<strong>to</strong>rs ex and ey, and the<strong>element</strong> stiffness matrix Ke, are generated. Note that the same coordinate vec<strong>to</strong>rsare applicable for all <strong>element</strong>s because they are identical.9.3 – 9 EXAMPLES


exs3Static analysis>> E=2.1e11; A=45.3e-4; I=2510e-8; ep=[E A I];>> ex=[0 3]; ey=[0 0];>> Ke=beam2e(ex,ey,ep)Ke =1.0e+08 *3.1710 0 0 -3.1710 0 00 0.0234 0.0351 0 -0.0234 0.03510 0.0351 0.0703 0 -0.0351 0.0351-3.1710 0 0 3.1710 0 00 -0.0234 -0.0351 0 0.0234 -0.03510 0.0351 0.0351 0 -0.0351 0.0703Based on the <strong>to</strong>pology information, the global stiffness matrix can be generated byassembling the <strong>element</strong> stiffness matrices>> K=assem(Edof,K,Ke);Finally, the solution can be calculated by defining the boundary conditions in bc andsolving the system of equations. Displacements a and reaction forces Q are computedby the function solveq.>> bc=[1 0; 2 0; 11 0]; [a,Q]=solveq(K,f,bc);The section forces es are calculated from <strong>element</strong> displacements Ed>> Ed=extract(Edof,a);>> es1=beam2s(ex,ey,ep,Ed(1,:));>> es2=beam2s(ex,ey,ep,Ed(2,:));>> es3=beam2s(ex,ey,ep,Ed(3,:));EXAMPLES 9.3 – 10


Static analysisexs3Resultsa = Q =0 1.0e+03 *0-0.0095 00 6.6667-0.0228 -0.0000-0.0038 00 -0.0000-0.0199 -0.00000.0047 00 -0.00000 -0.00000.0076 0<strong>3.3</strong>3330.0000es1 =1.0e+04 *0 -0.6667 0.00000 -0.6667 2.0000es2 =1.0e+04 *0 0.3333 2.00000 0.3333 1.0000es3 =1.0e+04 *0 0.3333 1.00000 0.3333 0.00009.3 – 11 EXAMPLES


exs4Static analysisPurpose:Analysis of a plane truss.Description:Consider a plane truss, loaded by a single force P = 0.5 MN.2 mA = 25.0e −4 m 2E = 2.10e 5 MPa2 m 2 m30 oP = 0.5 MNThe corresponding <strong>finite</strong> <strong>element</strong> model consists of ten <strong>element</strong>s and twelve degreesof freedom.y2610●11●53●9785649.81012●32●74●11xThe <strong>to</strong>pology is defined by the matrix>> Edof=[1 1 2 5 6;2 3 4 7 8;3 5 6 9 10;4 7 8 11 12;5 7 8 5 6;6 11 12 9 10;7 3 4 5 6;8 7 8 9 10;9 1 2 7 8;10 5 6 11 12];EXAMPLES 9.3 – 12


Static analysisexs4A global stiffness matrix K and a load vec<strong>to</strong>r f are defined. The load P is dividedin<strong>to</strong> x and y components and inserted in the load vec<strong>to</strong>r f.>> K=zeros(12);>> f=zeros(12,1); f(11)=0.5e6*sin(pi/6); f(12)=-0.5e6*cos(pi/6);The <strong>element</strong> matrices Ke are computed by the function bar2e. These matrices arethen assembled in the global stiffness matrix using the function assem.>> A=25.0e-4; E=2.1e11; ep=[E A];>> ex1=[0 2]; ex2=[0 2]; ex3=[2 4]; ex4=[2 4]; ex5=[2 2];>> ex6=[4 4]; ex7=[0 2]; ex8=[2 4]; ex9=[0 2]; ex10=[2 4];>> ey1=[2 2]; ey2=[0 0]; ey3=[2 2]; ey4=[0 0]; ey5=[0 2];>> ey6=[0 2]; ey7=[0 2]; ey8=[0 2]; ey9=[2 0]; ey10=[2 0];>> Ke1=bar2e(ex1,ey1,ep); Ke2=bar2e(ex2,ey2,ep);>> Ke3=bar2e(ex3,ey3,ep); Ke4=bar2e(ex4,ey4,ep);>> Ke5=bar2e(ex5,ey5,ep); Ke6=bar2e(ex6,ey6,ep);>> Ke7=bar2e(ex7,ey7,ep); Ke8=bar2e(ex8,ey8,ep);>> Ke9=bar2e(ex9,ey9,ep); Ke10=bar2e(ex10,ey10,ep);>> K=assem(Edof(1,:),K,Ke1); K=assem(Edof(2,:),K,Ke2);>> K=assem(Edof(3,:),K,Ke3); K=assem(Edof(4,:),K,Ke4);>> K=assem(Edof(5,:),K,Ke5); K=assem(Edof(6,:),K,Ke6);>> K=assem(Edof(7,:),K,Ke7); K=assem(Edof(8,:),K,Ke8);>> K=assem(Edof(9,:),K,Ke9); K=assem(Edof(10,:),K,Ke10);The system of equations is solved considering the boundary conditions in bc.>> bc=[1 0;2 0;3 0;4 0];>> a=solveq(K,f,bc)a =00000.0024-0.0045-0.0016-0.00420.0030-0.0107-0.0017-0.01139.3 – 13 EXAMPLES


exs4Static analysisThe displacement at the point of loading is −1.7 · 10 −3 m in the x-direction and−11.3 · 10 −3 m in the y-direction.Normal forces are evaluated from <strong>element</strong> displacements. These are obtained fromthe global displacements a using the function extract. The normal forces are evaluatedusing the function bar2s.>> ed1=extract(Edof(1,:),a); ed2=extract(Edof(2,:),a);>> ed3=extract(Edof(3,:),a); ed4=extract(Edof(4,:),a);>> ed5=extract(Edof(5,:),a); ed6=extract(Edof(6,:),a);>> ed7=extract(Edof(7,:),a); ed8=extract(Edof(8,:),a);>> ed9=extract(Edof(9,:),a); ed10=extract(Edof(10,:),a);>> N1=bar2s(ex1,ey1,ep,ed1)N1 =6.2594e+05>> N2=bar2s(ex2,ey2,ep,ed2)N2 =-4.2310e+05>> N3=bar2s(ex3,ey3,ep,ed3)N3 =1.7064e+05>> N4=bar2s(ex4,ey4,ep,ed4)N4 =-1.2373e+04>> N5=bar2s(ex5,ey5,ep,ed5)N5 =-6.9447e+04>> N6=bar2s(ex6,ey6,ep,ed6)N6 =1.7064e+05>> N7=bar2s(ex7,ey7,ep,ed7)N7 =-2.7284e+05EXAMPLES 9.3 – 14


Static analysisexs4>> N8=bar2s(ex8,ey8,ep,ed8)N8 =-2.4132e+05>> N9=bar2s(ex9,ey9,ep,ed9)N9 =<strong>3.3</strong>953e+05>> N10=bar2s(ex10,ey10,ep,ed10)N10 =3.7105e+05The largest normal force N = 0.62 MN is obtained in <strong>element</strong> 1 and is equivalent <strong>to</strong>a normal stress σ = 250 MPa.9.3 – 15 EXAMPLES


exs5Static analysisPurpose:Analysis of a plane frame.Description:A frame consists of one horizontal and two vertical beams according <strong>to</strong> the figurebelow.Pq 0A 1 , I 1 , EA 2 , I 2 , E6.0 mA 1 , I 1 , E4.0 mA 1 = 45.3e −4 m 2I 1 = 2510e −8 m 4A 2 = 142.8e −4 m 2I 2 = 33090e −8 m 4E = 2.10e 5 MPaP = 0.001 MNq 0 = 0.075 MN/mThe corresponding <strong>finite</strong> <strong>element</strong> model consists of three beam <strong>element</strong>s and twelvedegrees of freedom.6●5439●871 23 ●21111012 ●A <strong>to</strong>pology matrix Edof, a global stiffness matrix K and load vec<strong>to</strong>r f are defined. The<strong>element</strong> matrices Ke and fe are computed by the function beam2e. These matricesare then assembled in the global matrices using the function assem.>> Edof=[1 1 2 3 4 5 6;2 10 11 12 7 8 9;3 4 5 6 7 8 9];>> K=zeros(12); f=zeros(12,1); f(4)=1000;>> A1=45.3e-4; A2=142.8e-4;EXAMPLES 9.3 – 16


Static analysisexs5>> I1=2510e-8; I2=33090e-8;>> E=2.1e11;>> ep1=[E A1 I1]; ep3=[E A2 I2];>> ex1=[0 0]; ex2=[6 6]; ex3=[0 6];>> ey1=[0 4]; ey2=[0 4]; ey3=[4 4];>> eq1=[0 0];>> eq2=[0 0];>> eq3=[0 -75000];>> Ke1=beam2e(ex1,ey1,ep1);>> Ke2=beam2e(ex2,ey2,ep1);>> [Ke3,fe3]=beam2e(ex3,ey3,ep3,eq3);>> K=assem(Edof(1,:),K,Ke1);>> K=assem(Edof(2,:),K,Ke2);>> [K,f]=assem(Edof(3,:),K,Ke3,f,fe3);The system of equations are solved considering the boundary conditions in bc.>> bc=[1 0;2 0;3 0;10 0;11 0;12 0];>> a=solveq(K,f,bc)a =0000.0006-0.0009-0.00790.0005-0.00090.00790009.3 – 17 EXAMPLES


exs5Static analysisThe <strong>element</strong> displacements are obtained from the function extract, and the functionbeam2s computes the section forces.>> Ed=extract(Edof,a);>> es1=beam2s(ex1,ey1,ep1,Ed(1,:),eq1,20)es1 =1.0e+05 *-2.2467 0.1513 0.1981-2.2467 0.1513 0.1662: : :-2.2467 0.1513 -0.4070>> es2=beam2s(ex2,ey2,ep1,Ed(2,:),eq2,20)es2 =1.0e+05 *-2.2533 -0.1613 -0.2185-2.2533 -0.1613 -0.1845: : :-2.2533 -0.1613 0.4266>> es3=beam2s(ex3,ey3,ep3,Ed(3,:),eq3,20)es3 =1.0e+05 *-0.1613 -2.2467 -0.4070-0.1613 -2.0099 0.2651: : :-0.1613 2.2533 -0.4266EXAMPLES 9.3 – 18


Static analysisexs5Section force diagrams are displayed using the function eldia2.>> figure(1)>> magnfac=eldia2(ex1,ey1,es1(:,1),eci1);>> magnitude=[3e5 0.5 0];>> eldia2(ex1,ey1,es1(:,1),eci1,magnfac);>> eldia2(ex2,ey2,es2(:,1),eci2,magnfac);>> eldia2(ex3,ey3,es3(:,1),eci3,magnfac,magnitude);>> axis([-1.5 7 -0.5 5.5])>> figure(2)>> magnfac=eldia2(ex3,ey3,es3(:,2),eci3);>> magnitude=[3e5 0.5 0];>> eldia2(ex1,ey1,es1(:,2),eci1,magnfac);>> eldia2(ex2,ey2,es2(:,2),eci2,magnfac);>> eldia2(ex3,ey3,es3(:,2),eci3,magnfac,magnitude);>> axis([-1.5 7 -0.5 5.5])>> figure(3)>> magnfac=eldia2(ex3,ey3,es3(:,3),eci3);>> magnitude=[3e5 0.5 0];>> eldia2(ex1,ey1,es1(:,3),eci1,magnfac);>> eldia2(ex2,ey2,es2(:,3),eci2,magnfac);>> eldia2(ex3,ey3,es3(:,3),eci3,magnfac,magnitude);>> axis([-1.5 7 -0.5 5.5])9.3 – 19 EXAMPLES


exs5Static analysis543210300000−1 0 1 2 3 4 5 6 7EXAMPLES 9.3 – 20


Static analysisexs5543210300000−1 0 1 2 3 4 5 6 79.3 – 21 EXAMPLES


exs5Static analysis543210300000−1 0 1 2 3 4 5 6 7EXAMPLES 9.3 – 22


Static analysisexs6Purpose:Set up a frame, consisting of both beams and bars, and illustrate the calculations byuse of graphics functions.Description:A frame consists of horizontal and vertical beams, and is stabilized with diagonalbars.y2 P15141361817162 48810111975121013729.50316401xThe frame with its coordinates and loading is shown in the left figure, and the <strong>finite</strong><strong>element</strong> model in the right. In the following, the statements for analysing the frameare given as an .m-file.The matrices of the global system i.e. the stiffness matrix K, the load vec<strong>to</strong>r f, thecoordinate matrix Coord, and the corresponding degrees of freedom matrix Dof aredefined by% ----- System matrices -----K=zeros(18,18);f=zeros(18,1);f(13)=1;Coord=[0 0;1 0;0 1;1 1;0 2;1 2];9.3 – 23 EXAMPLES


exs6Static analysisDof=[1 2 3;4 5 6;7 8 9;10 11 12;13 14 15;16 17 18];The material properties, the <strong>to</strong>pology, and the <strong>element</strong> coordinates for the beamsand bars respectively, are defined by% ----- Element properties, <strong>to</strong>pology and coordinates -----ep1=[1 1 1];Edof1=[1 1 2 3 7 8 9;2 7 8 9 13 14 15;3 4 5 6 10 11 12;4 10 11 12 16 17 18;5 7 8 9 10 11 12;6 13 14 15 16 17 18];[Ex1,Ey1]=coordxtr(Edof1,Coord,Dof,2);ep2=[1 1];Edof2=[7 1 2 10 11;8 7 8 16 17;9 7 8 4 5;10 13 14 10 11];[Ex2,Ey2]=coordxtr(Edof2,Coord,Dof,2);To check the model, the <strong>finite</strong> <strong>element</strong> mesh can be drawn.eldraw2(Ex1,Ey1,[1 3 1]);eldraw2(Ex2,Ey2,[1 2 1]);The <strong>element</strong> stiffness matrices are generated and assembled in two loops, one for thebeams and one for the bars. The <strong>element</strong> stiffness functions beam2e and bar2e usethe <strong>element</strong> coordinate matrices ex and ey. These matrices are extracted from theglobal coordinates Coord by the function coordxtr above.EXAMPLES 9.3 – 24


Static analysisexs6% ----- Create and assemble <strong>element</strong> matrices -----for i=1:6Ke=beam2e(Ex1(i,:),Ey1(i,:),ep1);K=assem(Edof1(i,:),K,Ke);endfor i=1:4Ke=bar2e(Ex2(i,:),Ey2(i,:),ep2);K=assem(Edof2(i,:),K,Ke);endThe global system of equations is solved considering the boundary conditions in bc,% ----- Solve equation system -----bc= [1 0; 2 0; 3 0; 4 0; 5 0; 6 0];[a,Q]=solveq(K,f,bc);and the deformed frame is displayed by the function eldisp2, where the displacementsare scaled by the variable magnfac.Ed1=extract(Edof1,a);Ed2=extract(Edof2,a);[magnfac]=eldisp2(Ex1,Ey1,Ed1);eldisp2(Ex2,Ey2,Ed2,[2 1 1],magnfac);grid9.3 – 25 EXAMPLES


exs6Static analysis21.5y10.50-1 -0.5 0 0.5 1 1.5xEXAMPLES 9.3 – 26


Static analysisexs7Purpose:Analysis of two dimensional diffusion.Description:y0.1 m13 14 157 810 11 12c = 10 -3 kg/m 3 c = 0c = 05 67 8 93 44 5 6c = 00.1 mx1 21 2 3Description:Consider a filter paper of square shape. Three sides are in contact with pure waterand the fourth side is in contact with a solution of concentration c = kg/m 3 . Thelength of each side is 0.100 m. Using symmetry, only half of the paper has <strong>to</strong> beanalyzed. The paper and the corresponding <strong>finite</strong> <strong>element</strong> mesh are shown. Thefollowing boundary conditions are appliedc(0, y) = c(x, 0) = c(0.1, y) = 0c(x, 0.1) = 10 −3The <strong>element</strong> <strong>to</strong>pology is defined by the <strong>to</strong>pology matrix>> Edof=[1 1 2 5 42 2 3 6 53 4 5 8 74 5 6 9 85 7 8 11 106 8 9 12 117 10 11 14 138 11 12 15 14];9.3 – 27 EXAMPLES


exs7Static analysisThe system matrices, i.e. the stiffness matrix K and the load vec<strong>to</strong>r f, are defined by>> K=zeros(15); f=zeros(15,1);Because of the same geometry, orientation, and constitutive matrix for all <strong>element</strong>s,only one <strong>element</strong> stiffness matrix Ke has <strong>to</strong> be computed. This is done by the functionflw2qe.>> ep=1; D=[1 0; 0 1];>> ex=[0 0.025 0.025 0]; ey=[0 0 0.025 0.025];>> Ke=flw2qe(ex,ey,ep,D)>> Ke =0.7500 -0.2500 -0.2500 -0.2500-0.2500 0.7500 -0.2500 -0.2500-0.2500 -0.2500 0.7500 -0.2500-0.2500 -0.2500 -0.2500 0.7500Based on the <strong>to</strong>pology information, the global stiffness matrix is generated by assemblingthis <strong>element</strong> stiffness matrix Ke in the global stiffness matrix K>> K=assem(Edof,K,Ke);Finally, the solution is calculated by defining the boundary conditions bc and solvingthe system of equations. The boundary condition at dof 13 is set <strong>to</strong> 0.5×10 3 as anaverage of the concentrations at the neighbouring boundaries. Displacements a andreaction forces Q are computed by the function solveq.>> bc=[1 0;2 0;3 0;4 0;7 0;10 0;13 0.5e-3;14 1e-3;15 1e-3];>> [a,Q]=solveq(K,f,bc);The <strong>element</strong> flows q are calculated from <strong>element</strong> concentration Ed>> Ed=extract(Edof,a);>> for i=1:8>> es=flw2qs(ex,ey,ep,D,Ed(i,:));>> endEXAMPLES 9.3 – 28


Static analysisexs7Resultsa= Q=1.0e-03 * 1.0e+03 *0 -0.01650 -0.05650 -0.03990 -0.07770.0662 0.00000.0935 00 -0.21430.1786 0.00000.2500 0.00000 -0.63660.4338 0.00000.5494 -0.00000.5000 0.01651.0000 0.77071.0000 0.2542Es =-0.0013 -0.0013-0.0005 -0.0032-0.0049 -0.0022-0.0020 -0.0054-0.0122 -0.0051-0.0037 -0.0111-0.0187 -0.0213-0.0023 -0.02039.3 – 29 EXAMPLES


exs7Static analysisThe following .m-file shows an alternative set of commands <strong>to</strong> perform the diffusionanalysis of exs7. By use of global coordinates, an FE-mesh is generated. Also plotswith flux-vec<strong>to</strong>rs and con<strong>to</strong>ur lines are created.% ----- System matrices -----K=zeros(15); f=zeros(15,1);Coord=[0 0 ; 0.025 0 ; 0.05 00 0.025; 0.025 0.025; 0.05 0.0250 0.05 ; 0.025 0.05 ; 0.05 0.050 0.075; 0.025 0.075; 0.05 0.0750 0.1 ; 0.025 0.1 ; 0.05 0.1 ];Dof=[1; 2; 34; 5; 67; 8; 910;11;1213;14;15];% ----- Element properties, <strong>to</strong>pology and coordinates -----ep=1; D=[1 0;0 1];Edof=[1 1 2 5 42 2 3 6 53 4 5 8 74 5 6 9 85 7 8 11 106 8 9 12 117 10 11 14 138 11 12 15 14];[Ex,Ey]=coordxtr(Edof,Coord,Dof,4);% ----- Generate FE-mesh -----eldraw2(Ex,Ey,[1 3 0],Edof(:,1));pause; clf;% ----- Create and assemble <strong>element</strong> matrices -----for i=1:8Ke=flw2qe(Ex(i,:),Ey(i,:),ep,D);K=assem(Edof(i,:),K,Ke);end;% ----- Solve equation system -----bc=[1 0;2 0;3 0;4 0;7 0;10 0;13 0.5e-3;14 1e-3;15 1e-3];EXAMPLES 9.3 – 30


Static analysisexs7[a,Q]=solveq(K,f,bc)% ----- Compute <strong>element</strong> flux vec<strong>to</strong>rs -----Ed=extract(Edof,a);for i=1:8Es(i,:)=flw2qs(Ex(i,:),Ey(i,:),ep,D,Ed(i,:))end% ----- Draw flux vec<strong>to</strong>rs and con<strong>to</strong>ur lines -----eldraw2(Ex,Ey); elflux2(Ex,Ey,Es); pause; clf;eldraw2(Ex,Ey); eliso2(Ex,Ey,Ed,5);0.10.090.080.070.06y0.050.040.030.020.010−0.02 0 0.02 0.04 0.06 0.08xFlux vec<strong>to</strong>rs9.3 – 31 EXAMPLES


exs7Static analysis0.10.090.080.070.06y0.050.040.030.020.010−0.02 0 0.02 0.04 0.06 0.08xCon<strong>to</strong>ur linesTwo comments concerning the con<strong>to</strong>ur lines:In the upper left corner, the con<strong>to</strong>ur lines should physically have met at the cornerpoint. However, the drawing of the con<strong>to</strong>ur lines for the planqe <strong>element</strong> follows thenumerical approximation along the <strong>element</strong> boundaries, i.e. a linear variation. Afiner <strong>element</strong> mesh will bring the con<strong>to</strong>ur lines closer <strong>to</strong> the corner point.Along the symmetry line, the con<strong>to</strong>ur lines should physically be perpendicular <strong>to</strong> theboundary. This will also be improved with a finer <strong>element</strong> mesh.With the <strong>MATLAB</strong> functions colormap and fill a color plot of the concentrations canbe obtained.colormap(’jet’)fill(Ex’,Ey’,Ed’)axis equalEXAMPLES 9.3 – 32


9.4 Dynamic analysisThis section concerns linear dynamic <strong>finite</strong> <strong>element</strong> calculations. The examples illustratesome basic features in dynamics such as modal analysis and time stepping procedures.exd1exd2exd3exd4Dynamic analysisModal analysis of frameTransient analysisReduced system transient analysisTime varying boundary conditionNote: The examples listed above are supplied as .m-files on the CALFEM diskette underthe direc<strong>to</strong>ry examples. The example files are named according <strong>to</strong> the table.9.4 – 1 EXAMPLES


exd1Dynamic analysisPurpose:Set up the <strong>finite</strong> <strong>element</strong> model and perform eigenvalue analysis for a simple framestructure.Description:Consider the two dimensional frame shown below. A vertical beam is fixed at itslower end, and connected <strong>to</strong> a horizontal beam at its upper end. The horizontalbeam is simply supported at the right end. The length of the vertical beam is 3 mand of the horizontal beam 2 m. The following data apply <strong>to</strong> the beamsvertical beam horizontal beamYoung’s modulus (N/m 2 ) 3e10 3e10Cross section area (m 2 ) 0.1030e-2 0.0764e-2Moment of inertia (m 4 ) 0.171e-5 0.0801e-5Density (kg/m 3 ) 2500 25002 m9871211101514133 423 m6541321a) b)The structure is divided in<strong>to</strong> 4 <strong>element</strong>s. The numbering of <strong>element</strong>s and degrees-offreedomare apparent from the figure. The following .m-file defines the <strong>finite</strong> <strong>element</strong>model.% --- material data ------------------------------------------E=3e10;rho=2500;Av=0.1030e-2; Iv=0.0171e-4; % IPE100Ah=0.0764e-2; Ih=0.00801e-4; % IPE80epv=[E Av Iv rho*Av]; eph=[E Ah Ih rho*Ah];EXAMPLES 9.4 – 2


Dynamic analysisexd1% --- <strong>to</strong>pology ----------------------------------------------Edof=[1 1 2 3 4 5 62 4 5 6 7 8 93 7 8 9 10 11 124 10 11 12 13 14 15];% --- list of coordinates -----------------------------------Coord=[0 0; 0 1.5; 0 3; 1 3; 2 3];% --- list of degrees-of-freedom ----------------------------Dof=[1 2 3; 4 5 6; 7 8 9; 10 11 12; 13 14 15];% --- generate <strong>element</strong> matrices, assemble in global matrices -K=zeros(15); M=zeros(15);[Ex,Ey]=coordxtr(Edof,Coord,Dof,2);for i=1:2[k,m,c]=beam2d(Ex(i,:),Ey(i,:),epv);K=assem(Edof(i,:),K,k);M=assem(Edof(i,:),M,m);endfor i=3:4[k,m,c]=beam2d(Ex(i,:),Ey(i,:),eph);K=assem(Edof(i,:),K,k); M=assem(Edof(i,:),M,m);endThe <strong>finite</strong> <strong>element</strong> mesh is plotted, using the following commandsclf;eldraw2(Ex,Ey,[1 2 2],Edof);grid; title(’2D Frame Structure’);pause;32-D Frame Structure3 42.522y1.5110.50-0.5 0 0.5 1 1.5 2 2.5xFinite <strong>element</strong> mesh9.4 – 3 EXAMPLES


exd1Dynamic analysisThis is accom-A standard procedure in dynamic analysis is eigenvalue analysis.plished by the following set of commands.b=[1 2 3 14]’;[La,Egv]=eigen(K,M,b);Freq=sqrt(La)/(2*pi);Note that the boundary condition matrix, b, only lists the degrees-of-freedom thatare zero. The results of these commands are the eigenvalues, s<strong>to</strong>red in La, and theeigenvec<strong>to</strong>rs, s<strong>to</strong>red in Egv. The corresponding frequencies in Hz are calculated ands<strong>to</strong>red in the column matrix Freq.Freq = [6.9826 43.0756 66.5772 162.7453 230.2709 295.6136426.2271 697.7628 877.2765 955.9809 1751.3] TThe eigenvec<strong>to</strong>rs can be plotted by entering the commands below.figure(1), clf, grid, title(’The first eigenmode’),eldraw2(Ex,Ey,[2 3 1]);Edb=extract(Edof,Egv(:,1)); eldisp2(Ex,Ey,Edb,[1 2 2]);FreqText=num2str(Freq(1)); text(.5,1.75,FreqText);pause;3The first eigenmode2.526.983y1.510.50-0.5 0 0.5 1 1.5 2 2.5xThe first eigenmode, 6.98 HzEXAMPLES 9.4 – 4


Dynamic analysisexd1An attractive way of displaying the eigenmodes is shown in the figure below. Theresult is accomplished by translating the different eigenmodes in the x-direction, seethe Ext-matrix defined below, and in the y-direction, see the Eyt-matrix.clf, axis(’equal’), hold on, axis offmagnfac=0.5;title(’The first eight eigenmodes (Hz)’ )for i=1:4;Ext=Ex+(i-1)*3; eldraw2(Ext,Ey,[2 3 1]);Edb=extract(Edof,Egv(:,i));eldisp2(Ext,Ey,Edb,[1 2 2],magnfac);FreqText=num2str(Freq(i)); text(3*(i-1)+.5,1.5,FreqText);end;Eyt=Ey-4;for i=5:8;Ext=Ex+(i-5)*3; eldraw2(Ext,Eyt,[2 3 1]);Edb=extract(Edof,Egv(:,i));eldisp2(Ext,Eyt,Edb,[1 2 2],magnfac);FreqText=num2str(Freq(i)); text(3*(i-5)+.5,-2.5,FreqText);endThe first eight eigenmodes (Hz)6.983 43.08 66.58 162.7230.3 295.6 426.2 697.8The first eight eigenmodes. Frequencies are given in Hz.9.4 – 5 EXAMPLES


exd2Dynamic analysisPurpose:The frame structure defined in exd1 is exposed in this example <strong>to</strong> a transient load.The structural response is determined by a time stepping procedure.Description:The structure is exposed <strong>to</strong> a transient load, impacting on the center of the verticalbeam in horizontal direction, i.e. at the 4th degree-of-freedom. The time his<strong>to</strong>ry ofthe load is shown below. The result shall be displayed as time his<strong>to</strong>ry plots of the4th degree-of-freedom and the 11th degree-of-freedom. At time t = 0 the frame is atrest. The timestep is chosen as ∆t = 0.001 seconds and the integration is performedfor T = 1.0 second. At every 0.1 second the deformed shape of the whole structureshall be displayed.3The first eigenmode2.526.983y1.510.50-0.5 0 0.5 1 1.5 2 2.5xTime his<strong>to</strong>ry of the impact loadThe load is generated using the gfunc-function. The time integration is performedby the step2-function. Because there is no damping present, the C-matrix is enteredas [ ].dt=0.005; T=1;% --- the load -----------------------------------------------G=[0 0; 0.15 1; 0.25 0; T 0]; [t,g]=gfunc(G,dt);f=zeros(15, length(g)); f(4,:)=1000*g;% --- boundary condition, initial condition ------------------bc=[1 0; 2 0; 3 0; 14 0];d0=zeros(15,1);v0=zeros(15,1);% --- output parameters --------------------------------------ntimes=[0.1:0.1:1]; nhist=[4 11];% --- time integration parameters ----------------------------ip=[dt T 0.25 0.5 10 2 ntimes nhist];% --- time integration ---------------------------------------k=sparse(K);m=sparse(M);EXAMPLES 9.4 – 6


Dynamic analysis2exd2[Dsnap,D,V,A]=step2(k,[],m,d0,v0,ip,f,bc);The requested time his<strong>to</strong>ry plots are generated by the following commandsfigure(1), plot(t,D(1,:),’-’,t,D(2,:),’--’)grid, xlabel(’time (sec)’), ylabel(’displacement (m)’)title(’Displacement(time) for the 4th and 11th’...’ degree-of-freedom’)text(0.3,0.009,’solid line = impact point, x-direction’)text(0.3,0.007,’dashed line = center, horizontal beam,’...’ y-direction’)displacement (m)0.020.0150.010.0050Displacement(time) at the 4th and 11th degree-of-freedomsolid line = impact point, x-directiondashed line = center, horizontal beam, y-direction-0.005-0.010 0.2 0.4 0.6 0.8 1time (sec)Time his<strong>to</strong>ry at DOF 4 and DOF 11.The deformed shapes at time increment 0.1 sec are s<strong>to</strong>red in Dsnap. They are visualizedby the following commands:figure(2),clf, axis(’equal’), hold on, axis offmagnfac=25;title(’Snapshots (sec), magnification = 25’);for i=1:5;Ext=Ex+(i-1)*3; eldraw2(Ext,Ey,[2 3 0]);Edb=extract(Edof,Dsnap(:,i));eldisp2(Ext,Ey,Edb,[1 2 2],magnfac);Time=num2str(ntimes(i)); text(3*(i-1)+.5,1.5,Time);end;Eyt=Ey-4;for i=6:10;Ext=Ex+(i-6)*3; eldraw2(Ext,Eyt,[2 3 0]);9.4 – 7 EXAMPLES


exd2Dynamic analysisEdb=extract(Edof,Dsnap(:,i));eldisp2(Ext,Eyt,Edb,[1 2 2],magnfac);Time=num2str(ntimes(i)); text(3*(i-6)+.5,-2.5,Time);endSnapshots (sec), magnification = 250.1 0.2 0.3 0.4 0.50.6 0.7 0.8 0.9 1Snapshots of the deformed geometry for every 0.1 sec.EXAMPLES 9.4 – 8


Dynamic analysisexd3Purpose:This example concerns reduced system analysis for the frame structure defined inexd1. Transient analysis on modal coordinates is performed for the reduced system.Description:In the previous example the transient analysis was based on the original <strong>finite</strong> <strong>element</strong>model. Transient analysis can also be employed on some type of reduced system,commonly a subset of the eigenvec<strong>to</strong>rs. The commands below pick out the first twoeigenvec<strong>to</strong>rs for a subsequent time integration, see constant nev. The result in thefigure below shall be compared <strong>to</strong> the result in exd2.0.02Displacement(time) at the 4th and 11th degree−of−freedomsolid line = impact point, x−direction0.015dashed line = center, horizontal beam, y−direction0.01displacement (m)0.0050−0.005TWO EIGENVECTORS ARE USED−0.010 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1time (sec)Time his<strong>to</strong>ry at DOF 4 and DOF 11 using two eigenvec<strong>to</strong>rs.dt=0.002; T=1; nev=2;% --- the load -----------------------------------------------G=[0 0; 0.15 1; 0.25 0; T 0]; [t,g]=gfunc(G,dt);f=zeros(15, length(g));f(4,:)=9000*g;fr=sparse([[1:1:nev]’ Egv(:,1:nev)’*f]);% --- reduced system matrices --------------------------------kr=sparse(diag(diag(Egv(:,1:nev)’*K*Egv(:,1:nev))));mr=sparse(diag(diag(Egv(:,1:nev)’*M*Egv(:,1:nev))));% --- initial condition --------------------------------------dr0=zeros(nev,1);vr0=zeros(nev,1);% --- output parameters --------------------------------------ntimes=[0.1:0.1:1];nhistr=[1:1:nev];% --- time integration parameters ----------------------------ip=[dt T 0.25 0.5 10 nev ntimes nhistr];% --- time integration ---------------------------------------[Dsnapr,Dr,Vr,Ar]=step2(kr,[],mr,dr0,vr0,ip,fr,[]);% --- mapping back <strong>to</strong> original coordinate system -------------9.4 – 9 EXAMPLES


exd3Dynamic analysisDsnapR=Egv(:,1:nev)*Dsnapr; DR=Egv(nhist,1:nev)*Dr;% --- plot time his<strong>to</strong>ry for two DOF:s ------------------------figure(1), plot(t,DR(1,:),’-’,t,DR(2,:),’--’)axis([0 1.0000 -0.0100 0.0200])grid, xlabel(’time (sec)’), ylabel(’displacement (m)’)title(’Displacement(time) at the 4th and 11th’...’ degree-of-freedom’)text(0.3,0.017,’solid line = impact point, x-direction’)text(0.3,0.012,’dashed line = center, horizontal beam,’...’ y-direction’)text(0.3,-0.007,’2 EIGENVECTORS ARE USED’)EXAMPLES 9.4 – 10


Dynamic analysisexd4Purpose:This example deals with a time varying boundary condition and time integration forthe frame structure defined in exd1.Description:Suppose that the support of the vertical beam is moving in the horizontal direction.The commands below prepare the model for time integration. Note that the structureof the boundary condition matrix bc differs from the structure of the load matrix fdefined in exd2.The first eight eigenmodes (Hz)6.983 43.08 66.58 162.7230.3 295.6 426.2 697.8Time dependent boundary condition at the support, DOF 1.dt=0.002; T=1;% --- boundary condition, initial condition ------------------G=[0 0; 0.1 0.02; 0.2 -0.01; 0.3 0.0; T 0]; [t,g]=gfunc(G,dt);bc=zeros(4, 1 + length(g));bc(1,:)=[1 g]; bc(2,1)=2; bc(3,1)=3; bc(4,1)=14;d0=zeros(15,1);v0=zeros(15,1);% --- output parameters --------------------------------------ntimes=[0.1:0.1:1]; nhist=[1 4 11];% --- time integration parameters ----------------------------ip=[dt T 0.25 0.5 10 3 ntimes nhist];% --- time integration ---------------------------------------k=sparse(K);m=sparse(M);[Dsnap,D,V,A]=step2(k,[],m,d0,v0,ip,[],bc);% --- plot time his<strong>to</strong>ry for two DOF:s ------------------------figure(1), plot(t,D(1,:),’-’,t,D(2,:),’--’,t,D(3,:),’-.’)grid, xlabel(’time (sec)’), ylabel(’displacement (m)’)title(’Displacement(time) at the 1st, 4th and 11th’...’ degree-of-freedom’)text(0.2,0.022,’solid line = bot<strong>to</strong>m, vertical beam,’...9.4 – 11 EXAMPLES


exd4Dynamic analysis’ x-direction’)text(0.2,0.017,’dashed line = center, vertical beam,’...’ x-direction’)text(0.2,0.012,’dashed-dotted line = center,’...’ horizontal beam, y-direction’)% --- plot displacement for some time increments -------------figure(2),clf, axis(’equal’), hold on, axis offmagnfac=20;title(’Snapshots (sec), magnification = 20’);for i=1:5;Ext=Ex+(i-1)*3; eldraw2(Ext,Ey,[2 3 0]);Edb=extract(Edof,Dsnap(:,i));eldisp2(Ext,Ey,Edb,[1 2 2],magnfac);Time=num2str(ntimes(i)); text(3*(i-1)+.5,1.5,Time);end;Eyt=Ey-4;for i=6:10;Ext=Ex+(i-6)*3; eldraw2(Ext,Eyt,[2 3 0]);Edb=extract(Edof,Dsnap(:,i));eldisp2(Ext,Eyt,Edb,[1 2 2],magnfac);Time=num2str(ntimes(i)); text(3*(i-6)+.5,-2.5,Time);end0.0250.020.0150.01Displacement(time) at the 1st, 4th and 11th degree-of-freedomsolid line = bot<strong>to</strong>m, vertical beam, x-directiondashed line = center, vertical beam, x-directiondashed-dotted line = center, horizontal beam, y-direction0.0050-0.005-0.01-0.015-0.020 0.2 0.4 0.6 0.8 1Time his<strong>to</strong>ry at DOF 1, DOF 4 and DOF 11.EXAMPLES 9.4 – 12


Dynamic analysisexd4Snapshots (sec), magnification = 200.1 0.2 0.3 0.4 0.50.6 0.7 0.8 0.9 1Snapshots of the deformed geometry for every 0.1 sec.9.4 – 13 EXAMPLES


9.5 Nonlinear analysisThis section illustrates some nonlinear <strong>finite</strong> <strong>element</strong> calculations.exN1exN2Nonlinear analysisSecond order theory analysis of a frameBuckling analysis of a frameNote: The examples listed above are supplied as .m-files on the CALFEM diskette underthe direc<strong>to</strong>ry examples. The example files are named according <strong>to</strong> the table.9.5 – 1 EXAMPLES


exn1Nonlinear analysisPurpose:Analysis of a plane frame using second order theory.Description:The frame of exs5 is analysed again, but it is now subjected <strong>to</strong> a load case includinga horizontal load and two vertical point loads. Second order theory is used.PPHA 2 , I 2 , EA 1 , I 1 , EA 1 , I 1 , E4.0 mA6.0 mBA 1 = 45.3e −4 m 2I 1 = 2510e −8 m 4A 2 = 142.8e −4 m 2I 2 = 33090e −8 m 4E = 2.10e 5 MPaP = 1 MNH = 0.001 MNThe <strong>finite</strong> <strong>element</strong> model consisting of three beam <strong>element</strong>s and twelve degrees offreedom is repeated here.6●5439●871 23 ●21111012 ●The following .m-file defines the <strong>finite</strong> <strong>element</strong> model.% ----- Topology -----Edof=[1 1 2 3 4 5 6;2 10 11 12 7 8 9;3 4 5 6 7 8 9];EXAMPLES 9.5 – 2


Nonlinear analysisexn1% ----- Element properties and global coordinates -----E=2.1e11;A1=45.3e-4;I1=2510e-8;ep1=[E A1 I1];A2=142.8e-4;I2=33090e-8;ep3=[E A2 I2];Ex=[0 0;6 6;0 6]; Ey=[0 4;0 4;4 4];% ----- Load vec<strong>to</strong>r -----f=zeros(12,1);f(4)=1000; f(5)=-1000000; f(8)=-1000000;The beam <strong>element</strong> function of the second order theory beam2g requires a normalforce as input variable. In the first iteration this normal force is chosen <strong>to</strong> zero.This means that the first iteration is equivalent <strong>to</strong> a linear first order analysis usingbeam2e. Since the normal forces are not known initially, an iterative procedure has<strong>to</strong> be applied, where the normal forces N are updated according <strong>to</strong> the results ofthe former iteration. The iterations continue until the difference in normal force ofthe two last iteration steps is less than an accepted error eps, (N−N0)/N0 < eps.The small value given <strong>to</strong> the initial normal force N(1) is <strong>to</strong> avoid division by zeroin the second convergence check. If N does not converge in 20 steps the analysis isinterrupted.% ----- Initial values for the iteration -----eps=0.01;N=[0.01 0 0];N0=[1 1 1];n=0;% Error norm% Initial normal forces% Normal forces of the initial former iteration% Iteration counter% ----- Iteration procedure -----while(abs((N(1)-N0(1))/N0(1)) > eps)n=n+1;K=zeros(12,12);Ke1=beam2g(Ex(1,:),Ey(1,:),ep1,N(1));Ke2=beam2g(Ex(2,:),Ey(2,:),ep1,N(2));Ke3=beam2g(Ex(3,:),Ey(3,:),ep3,N(3));K=assem(Edof(1,:),K,Ke1);K=assem(Edof(2,:),K,Ke2);K=assem(Edof(3,:),K,Ke3);9.5 – 3 EXAMPLES


exn1Nonlinear analysisbc=[1 0;2 0;3 0;10 0;11 0;12 0];a=solveq(K,f,bc)Ed=extract(Edof,a);es1=beam2gs(Ex(1,:),Ey(1,:),ep1,Ed(1,:),N(1))es2=beam2gs(Ex(2,:),Ey(2,:),ep1,Ed(2,:),N(2))es3=beam2gs(Ex(3,:),Ey(3,:),ep3,Ed(3,:),N(3))N0=N;N=[es1(1,1) es2(1,1) es3(1,1)];if (n>20)disp(’The solution doesn’’t converge’)returnendendDisplacements and <strong>element</strong> forces from the linear elastic analysis and from the secondorder theory analysis respectively:a = a =0 00 00 00.0005 0.0008-0.0042 -0.0042-0.0000 -0.00000.0005 0.0008-0.0042 -0.0042-0.0000 -0.00000 00 00 0EXAMPLES 9.5 – 4


Nonlinear analysisexn1es1 = es1 =1.0e+05 * 1.0e+05 *-9.9967 -0.0050 -0.0102 -9.9954 -0.0050 -0.0142-9.9967 -0.0050 0.0098 -9.9954 -0.0050 0.0138es2 = es2 =1.0e+06 * 1.0e+06 *-1.0003 -0.0005 -0.0010 -1.0005 -0.0005 -0.0014-1.0003 -0.0005 0.0010 -1.0005 -0.0005 0.0014es3 = es3 =-499.5747 326.9323 981.6016 1.0e+03 *-499.5747 326.9323 -979.9922-0.4996 0.4595 1.3793-0.4996 0.4595 -1.3777Using the second order theory, the horizontal displacement of the upper left cornerof the frame increases from 0.5 <strong>to</strong> 0.8 mm. Both moments M A and M B are increasedfrom 1.0 <strong>to</strong> 1.4 kNm.9.5 – 5 EXAMPLES


exn2Nonlinear analysisPurpose:Buckling analysis of a plane frame.Description:The frame of exn1 is in this example analysed with respect <strong>to</strong> security against bucklingfor a case when all loads are increased proportionally. The initial load distributionof exn1 is increased by a loading fac<strong>to</strong>r alpha until buckling occurs, i.e. the determinan<strong>to</strong>f the stiffness matrix K passes zero. For each value of alpha a second ordertheory calculation of type exn1 is performed. The horizontal displacement a 4 andthe moment M A are plotted against alpha. The shape of the buckling mode is alsoplotted using the last computed displacement vec<strong>to</strong>r before buckling occurs.The <strong>finite</strong> <strong>element</strong> model, i.e. the vec<strong>to</strong>rs Edof, ep1, ep3, Ex, and Ey, defined in exn1is used.% ----- Initial loads -----f0=zeros(12,1);f0(4)=1000; f0(5)=-1000000; f0(8)=-1000000;% ----- Increase loads until det(K)=0 -----j=0;for alpha=1:0.1:20j=j+1;N=[0.1 0 0];N0=[1 1 1];% ----- Iteration for convergence -----eps=0.00001;n=0;while(abs((N(1)-N0(1))/N0(1)) > eps)n=n+1;K=zeros(12,12);f=f0*alpha;Ke1=beam2g(Ex(1,:),Ey(1,:),ep1,N(1));Ke2=beam2g(Ex(2,:),Ey(2,:),ep1,N(2));Ke3=beam2g(Ex(3,:),Ey(3,:),ep3,N(3));EXAMPLES 9.5 – 6


Nonlinear analysisexn2K=assem(Edof(1,:),K,Ke1);K=assem(Edof(2,:),K,Ke2);K=assem(Edof(3,:),K,Ke3);bc=[1 0;2 0;3 0;10 0;11 0;12 0];[a,Q]=solveq(K,f,bc);Ed=extract(Edof,a);es1=beam2gs(Ex(1,:),Ey(1,:),ep1,Ed(1,:),N(1));es2=beam2gs(Ex(2,:),Ey(2,:),ep1,Ed(2,:),N(2));es3=beam2gs(Ex(3,:),Ey(3,:),ep3,Ed(3,:),N(3));N0=N;N=[es1(1,1) es2(1,1) es3(1,1)];if (n>20)disp(’The solution doesn’’t converge’)returnendend% ----- Check the determinant for buckling -----Kred=red(K,bc(:,1));if (det(Kred)


exn2Nonlinear analysisThe following text strings are produced by the .m-file.Alpha= 1 is OK! 3 iterations are performed.Alpha= 1.1 is OK! 3 iterations are performed.Alpha= 1.2 is OK! 3 iterations are performed.Alpha= 1.3 is OK! 3 iterations are performed....Alpha= 2.4 is OK! 3 iterations are performed.Alpha= 2.5 is OK! 3 iterations are performed.Alpha= 2.6 is OK! 3 iterations are performed.Alpha= 2.7 is OK! 3 iterations are performed.Alpha= 2.8 is OK! 3 iterations are performed.Alpha= 2.9 is OK! 3 iterations are performed.Alpha= 3 is OK! 3 iterations are performed.Alpha= 3.1 is OK! 4 iterations are performed.Determinant


Nonlinear analysisexn23.5Displacement(alpha) for the upper left corner32.5alpha21.510 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1horizontal displacement (m)3.5Supporting moment M−A(alpha)32.5alpha21.510 1 2 3 4 5 6 7 8 9 10Moment in A (Nm)x 10 4Shape of buckling mode9.5 – 9 EXAMPLES


Indexabs . . . . . . . . . . . . 3 – 6assem . . . . . . . . . 6.2 – 2axis . . . . . . . . . . . 8 – 2bar2e . . . . . . . . . . 5.3 – 2bar2g . . . . . . . . . . 5.3 – 3bar2s . . . . . . . . . . 5.3 – 5bar3e . . . . . . . . . . 5.3 – 6bar3s . . . . . . . . . . 5.3 – 7beam2d . . . . . . . 5.6 – 20beam2ds . . . . . . . 5.6 – 22beam2e . . . . . . . . 5.6 – 2beam2g . . . . . . . . 5.6 – 15beam2gs . . . . . . . 5.6 – 18beam2s . . . . . . . . 5.6 – 5beam2t . . . . . . . . 5.6 – 7beam2ts . . . . . . . 5.6 – 9beam2w . . . . . . . 5.6 – 11beam2ws . . . . . . 5.6 – 13beam3e . . . . . . . . 5.6 – 24beam3s . . . . . . . . 5.6 – 27clear . . . . . . . . . . . 2 – 2clf . . . . . . . . . . . . . 8 – 3coordxtr . . . . . . . 6.2 – 3det . . . . . . . . . . . . 3 – 7diag . . . . . . . . . . . 3 – 8diary . . . . . . . . . . 2 – 3disp . . . . . . . . . . . 2 – 4dmises . . . . . . . . . 4 – 4dyna2 . . . . . . . . . 6.3 – 2dyna2f . . . . . . . . . 6.3 – 3echo . . . . . . . . . . . 2 – 5eigen . . . . . . . . . . 6.2 – 5eldisp2 . . . . . . . . 8 – 5eldraw2 . . . . . . . . 8 – 4eldia2 . . . . . . . . . 8 – 6elflux2 . . . . . . . . . 8 – 8eliso2 . . . . . . . . . . 8 – 9elprinc2 . . . . . . . 8 – 10extract . . . . . . . . 6.2 – 6fft . . . . . . . . . . . . . 6.3 – 4figure . . . . . . . . . . 8 – 11fill . . . . . . . . . . . . . 8 – 12flw2i4e . . . . . . . . 5.4 – 8flw2i4s . . . . . . . . . 5.4 – 10flw2i8e . . . . . . . . 5.4 – 11flw2i8s . . . . . . . . . 5.4 – 13flw2qe . . . . . . . . . 5.4 – 6flw2qs . . . . . . . . . 5.4 – 7flw2te . . . . . . . . . 5.4 – 3flw2ts . . . . . . . . . 5.4 – 5flw3i8e . . . . . . . . 5.4 – 14flw3i8s . . . . . . . . . 5.4 – 16for . . . . . . . . . . . . . 7 – 3format . . . . . . . . . 2 – 6freqresp . . . . . . . 6.3 – 5full . . . . . . . . . . . . 3 – 9gfunc . . . . . . . . . . 6.3 – 6grid . . . . . . . . . . . 8 – 13help . . . . . . . . . . . 2 – 7hold . . . . . . . . . . . 8 – 14hooke . . . . . . . . . . 4 – 2if . . . . . . . . . . . . . . 7 – 2ifft . . . . . . . . . . . . 6.3 – 7insert . . . . . . . . . . 6.2 – 8inv . . . . . . . . . . . . 3 – 10length . . . . . . . . . 3 – 11load . . . . . . . . . . . 2 – 8max . . . . . . . . . . . 3 – 12min . . . . . . . . . . . 3 – 13mises . . . . . . . . . . 4 – 3ones . . . . . . . . . . . 3 – 14plani4e . . . . . . . . 5.5 – 20plani4f . . . . . . . . 5.5 – 25plani4s . . . . . . . . 5.5 – 23plani8e . . . . . . . . 5.5 – 26plani8f . . . . . . . . 5.5 – 31plani8s . . . . . . . . 5.5 – 29planqe . . . . . . . . . 5.5 – 9planqs . . . . . . . . . 5.5 – 11


Indexplanre . . . . . . . . . 5.5 – 12planrs . . . . . . . . . 5.5 – 15plantce . . . . . . . . 5.5 – 16plantcs . . . . . . . . 5.5 – 19plante . . . . . . . . . 5.5 – 4plantf . . . . . . . . . 5.5 – 8plants . . . . . . . . . 5.5 – 7platre . . . . . . . . . 5.7 – 2platrs . . . . . . . . . . 5.7 – 5plot . . . . . . . . . . . 8 – 15print . . . . . . . . . . 8 – 16function . . . . . . . 7 – 5script . . . . . . . . . . 7 – 6quit . . . . . . . . . . . 2 – 9red . . . . . . . . . . . . 3 – 15ritz . . . . . . . . . . . . 6.3 – 8save . . . . . . . . . . . 2 – 10size . . . . . . . . . . . . 3 – 16soli8e . . . . . . . . . . 5.5 – 32soli8f . . . . . . . . . . 5.5 – 37soli8s . . . . . . . . . . 5.5 – 35solveq . . . . . . . . . 6.2 – 9sparse . . . . . . . . . 3 – 17spectra . . . . . . . . 6.3 – 9spring1e . . . . . . . 5.2 – 4spring1s . . . . . . . 5.2 – 5spy . . . . . . . . . . . . 3 – 18sqrt . . . . . . . . . . . 3 – 19statcon . . . . . . . . 6.2 – 10step1 . . . . . . . . . . 6.3 – 10step2 . . . . . . . . . . 6.3 – 12sum . . . . . . . . . . . 3 – 20sweep . . . . . . . . . 6.3 – 14text . . . . . . . . . . . 8 – 17title . . . . . . . . . . . 8 – 18type . . . . . . . . . . . 2 – 11what . . . . . . . . . . 2 – 12while . . . . . . . . . . 7 – 4who . . . . . . . . . . . 2 – 13whos . . . . . . . . . . 2 – 13xlabel . . . . . . . . . 8 – 19ylabel . . . . . . . . . 8 – 19zeros . . . . . . . . . . 3 – 21zlabel . . . . . . . . . . 8 – 19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!