Beruflich Dokumente
Kultur Dokumente
DEPARTMENT
DEPARTMENT OF CIVIL ENGINEERING
STRUCTURAL MECHANICS
KASTEELPARK
KASTEELPARK ARENBERG 40 B-3001 LEUVEN
KATHOLIEKE
UNIVERSITEIT
LEUVEN
VERSION 3.0
USER’S GUIDE
Report BWM-2014-***
September 2014
Contents
1 Functio
unctions
ns — By cate
categor
gory
y 1
1.1 Genera
Generall functio
functions
ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Postp
Postproce
rocessi
ssing
ng . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3
1.3 Dyna
Dynami
mics
cs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.4
1.4 Beam
Beam funct
functio
ions
ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.5 Truss functio
functions
ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.6 Genera
Generall shel
shelll functio
functions
ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
1.7 Shell4
Shell4 functio
functions
ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
1.8 Shell8
Shell8 functio
functions
ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
1.9 Nonline
Nonlinear
ar anal
analysi
ysiss functi
functions
ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
2 Tutor
utoria
iall 71
2.1 Tutorial
utorial:: static
static anal
analysi
ysiss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
2.2 Tutorial
utorial:: dynamic
dynamic analysi
analysiss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
2.2.
2.2.11 Eige
Eigenm
nmode
odess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
2.2.2 Modal superposition
superposition:: time domain:
domain: piecewise
piecewise exact
exact integrat
integration
ion . . . . . . . . . 79
2.2.3
2.2.3 Modal superpos
superpositi
ition:
on: transform
transform to freq
frequen
uency
cy domai
domain
n. . . . . . . . . . . . . . . 81
2.2.4
2.2.4 Direct
Direct time
time integ
integrat
ration
ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
2.2.5
2.2.5 Direct
Direct solu
solutio
tion
n in the frequenc
frequency
y domain
domain . . . . . . . . . . . . . . . . . . . . . . 85
2.2.
2.2.66 Compa
Compari
riso
son
n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
2.3 Tutorial
utorial:: shell analys
analysis
is . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
2.4 Tutorial
utorial:: nonline
nonlinear
ar anal
analysi
ysiss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
3 Ex
Exam
ampl
ples
es 97
3.1
3.1 Exam
Exampl
plee 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
3.2
3.2 Exam
Exampl
plee 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
3.3
3.3 Exam
Exampl
plee 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
3.4
3.4 Exam
Exampl
plee 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
ii Contents
3.5
3.5 Exam
Exampl
plee 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
3.6
3.6 Exam
Exampl
plee 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
3.7
3.7 Exam
Exampl
plee 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
4 Functions
unctions — Alpha
Alphabetica
beticall list
list 127
Chapter 1
Functions — By category
getdof Get the vector with the degrees of freedom of the model. p.2
asmkm Assemble stiffness and mass matrix. p.2
removedof Remove DOF with Dirichlet boundary conditions equal to zero. p.2
addconstr Add constraint equations to the stiffness matrix and load vector. p.3
tconstr Return matrices to apply constraint equations. p.3
nodalvalues Construct a vector with the values at the selected DOF. p.4
elemloads Equivalent nodal forces. p.4
accel Compute the distributed loads due to an acceleration. p.4
elemforces Compute the element forces. p.5
elemdisp Select the element displacements from the global displacement vector. p.5
selectdof Select degrees of freedom. p.6
unselectdof Unselect degrees of freedom. p.7
selectnode Select nodes by location. p.7
reprow Replicate rows from a matrix. p.7
multdloads Combine distributed loads. p.8
2 Functions — By category
getdof
GETDOF Get the vector with the degrees of freedom of the model.
removedof
asmkm
[K,M] = asmkm(Nodes,Elements,Types,Sections,Materials,DOF)
K = asmkm(Nodes,Elements,Types,Sections,Materials,DOF)
K = asmkm(Nodes,Elements,Types,Sections,Materials)
assembles the stiffness and the mass matrix using the finite element method.
addconstr
ADDCONSTR Add constraint equations to the stiffness matrix and load vector.
[K,F]=addconstr(Constr,DOF,K,F)
[K,F,M]=addconstr(Constr,DOF,K,[],M)
[K,F,M]=addconstr(Constr,DOF,K,F,M)
modifies the stiffness matrix, the mass matrix and the load vector according
to the applied constraint equations. The dimensions of the stiffness matrix,
the mass matrix and the load vector are kept the same. The resulting
stiffness and mass matrix are not symmetric anymore. This function can be
used as well to apply imposed displacements.
tconstr
[T,Q0,MasterDOF]=tconstr(Constr,DOF)
returns matrices to apply constraint equations to the stiffness and mass
matrix and the load vector: Kr=T.’*K*T, Mr=T.’*M*T and Fr=T.’*(F-K*Q0).
The original displacement vector is computed using U=T*Ur+Q0.
nodalvalues
F=nodalvalues(DOF,seldof,values)
constructs a vector with the values at the selected DOF. This function can
be used to obtain a load vector, initial displacements, velocities or
accelerations.
elemloads
F=elemloads(DLoads,Nodes,Elements,Types,DOF)
computes the equivalent nodal forces of a distributed load
(in the global coordinate system).
accel
DLoads=accel(Accelxyz,Elements,Types,Sections,Materials)
computes the distributed loads due to an acceleration.
In order to simulate gravity, accelerate the structure in the direction
opposite to gravity.
General functions 5
elemforces
[ForcesLCS,ForcesGCS]
=elemforces(Nodes,Elements,Types,Sections,Materials,DOF,U,DLoads)
[ForcesLCS,ForcesGCS]
=elemforces(Nodes,Elements,Types,Sections,Materials,DOF,U)
computes the element forces in the local (beam convention) and the
global (algebraic convention) coordinate system.
elemdisp
ELEMDISP Select the element displacements from the global displacement vector.
N j
y V yj
x M yj
T j
z
j V zj
M zj
V zi
M yi
T i i
V yi
N i M zi
selectdof
L=selectdof(DOF,seldof)
[L,I]=selectdof(DOF,seldof)
L=selectdof(DOF,seldof,’Ordering’,ordering)
creates the matrix to extract degrees of freedom from the global degrees of
freedom by matrix multiplication.
unselectdof
L=unselectdof(DOF,seldof)
[L,I]=unselectdof(DOF,seldof)
creates the matrix to unselect degrees of freedom from the global degrees of
freedom.
selectnode
Nodesel=selectnode(Nodes,x,y,z)
Nodesel=selectnode(Nodes,xmin,ymin,zmin,xmax,ymax,zmax)
selects nodes by location.
reprow
Matrix=reprow(Matrix,RowSel,nTime,RowInc)
replicates the selected rows from a matrix a number of times and adds them
below the existing rows. The k-th time the increment RowInc is added k times
to the copied rows.
8 Functions — By category
multdloads
DLoads=multdloads(DLoads_1,DLoads_2,...,DLoads_k)
combines the distributed loads of multiple load cases into one 3D array.
Each plane corresponds to one load case.
1.2 Postprocessing
plotnodes
plotnodes(Nodes)
plots the nodes.
plotelem
plotelem(Nodes,Elements,Types)
plots the elements.
plotdisp
plotdisp(Nodes,Elements,Types,DOF,U,DLoads,Sections,Materials)
plotdisp(Nodes,Elements,Types,DOF,U,[],Sections,Materials)
plotdisp(Nodes,Elements,Types,DOF,U)
DispScal=plotdisp(Nodes,Elements,Types,DOF,U,DLoads,Sections,Materials)
plots the displacements. If DLoads, Sections and Materials are supplied, the
displacements that occur due to the distributed loads if all nodes are fixed,
are superimposed.
plotforc
plotforc(ftype,Nodes,Elements,Types,Forces,DLoads)
plotforc(ftype,Nodes,Elements,Types,Forces)
plots the forces (in beam convention).
12 Functions — By category
plotlcs
[h,vLCS] = plotlcs(Nodes,Elements,Types)
[h,vLCS] = plotlcs(Nodes,Elements,Types,[],varargin)
plotlcs(Nodes,Elements,Types,vLCS,varargin)
plotstress
plotstress(stype,Nodes,Elements,Types,Sections,Forces,DLoads)
plotstress(stype,Nodes,Elements,Types,Sections,Forces)
plots the stresses.
plotstresscontourf
plotstresscontourf(stype,Nodes,Elements,Types,S)
plotstresscontourf(stype,Nodes,Elements,Types,S,DOF,U)
plots stress contours (output from ELEMSTRESS).
animdisp
DispScal=animdisp(Nodes,Elements,Types,DOF,U)
animates the displacements.
getmovie
GETMOVIE Get the movie from a figure where an animation has been played.
mov=getmovie(h)
gets the movie from the userdata of the axis of a figure where an animation
has been played. In order to save the movie in the userdata the animation
should have been played using animdisp(...,’CreateMovie’,’on’). This
function blocks the command prompt until the movie has become available.
printdisp
printdisp(Nodes,DOF,U)
displays the displacements in the command window.
printforc
printforc(Elements,Forces)
displays the forces in the command window.
1.3 Dynamics
eigfem Compute the eigenmodes and eigenfrequencies of the finite element model. p.18
msupt Modal superposition in the time domain. p.18
msupf Modal superposition in the frequency domain. p.18
cdiff Direct time integration for dynamic systems - central diff. method. p.19
newmark Direct time integration for dynamic systems - Newmark method p.19
wilson Direct time integration for dynamic systems - Wilson-theta method p.20
ldlt LDL Gauss factorization of symmetric matrices. p.20
18 Functions — By category
eigfem
EIGFEM Compute the eigenmodes and eigenfrequencies of the finite element model.
[phi,omega]=eigfem(K,M,nMode)
[phi,omega]=eigfem(K,M)
computes the eigenmodes and eigenfrequencies of the finite element model.
msupt
msupf
cdiff
CDIFF Direct time integration for dynamic systems - central diff. method.
[u,t] = CDIFF(M,C,K,dt,p,u0,u1) applies the central difference method for
the calculation of the nodal displacements u of the dynamic system with
the system matrices M, C and K due to the excitation p.
newmark
wilson
ldlt
[L,D] = LDL(A) returns the triangle matrix L and the vector D so that
A = L.’ * diag(D) * L. You should consider renumbering A with SYMRCM before
factoring the matrix. See details in K.J. Bathe, ’Finite Element Procedures
in Engineering Analysis’, Prentice-Hall, 1982, p. 442
Beam functions 21
dof beam
ke beam
KE_BEAM Beam element stiffness and mass matrix in global coordinate system.
kelcs beam
KELCS_BEAM Beam element stiffness and mass matrix in local coordinate system.
[KeLCS,MeLCS] = kelcs_beam(L,A,ky,kz,Ixx,Iyy,Izz,E,nu,rho,Options)
[KeLCS,MeLCS] = kelcs_beam(L,A,ky,kz,Ixx,Iyy,Izz,E,nu,rho)
KeLCS = kelcs_beam(L,A,ky,kz,Ixx,Iyy,Izz,E,nu)
returns the element stiffness and mass matrix in the local coordinate system
for a two node beam element (isotropic material)
L Beam length
A Beam cross section
Beam functions 23
trans beam
t = trans_beam(Node)
computes the transformation matrix between the local and the global
coordinate system for the beam element.
loads beam
F = loads_beam(DLoad,Node)
computes the equivalent nodal forces of a distributed load
(in the global coordinate system).
loadslcs beam
FLCS = loadslcs_beam(DLoadLCS,L)
computes the equivalent nodal forces of a distributed load
(in the local coordinate system).
accel beam
DLoads=accel_beam(Accelxyz,Elements,Sections,Materials,Options)
computes the distributed loads for a beam due to an acceleration.
In order to simulate gravity, accelerate the structure in the direction
opposite to gravity.
forces beam
[ForcesLCS,ForcesGCS]=forces_beam(Node,Section,Material,UeGCS,DLoad,Options)
[ForcesLCS,ForcesGCS]=forces_beam(Node,Section,Material,UeGCS,DLoad)
[ForcesLCS,ForcesGCS]=forces_beam(Node,Section,Material,UeGCS)
computes the element forces for the beam element in the local and the
global coordinate system (algebraic convention).
Beam functions 25
forceslcs beam
FORCESLCS_BEAM Compute the element forces for a beam element in the LCS.
Forces=forceslcs_beam(KeLCS,UeLCS,DLoadLCS,L)
Forces=forceslcs_beam(KeLCS,UeLCS)
computes the element forces for the beam element in the local coordinate
system (algebraic convention).
nelcs beam
NeLCS = nelcs_beam(Points)
NeLCS = nelcs_beam(Points,phi_y,phi_z)
determines the values of the shape functions in the specified points.
nedloadlcs beam
NeLCS = nedloadlcs_beam(Points)
NeLCS = nedloadlcs_beam(Points,phi_y,phi_z)
determines the values of the shape functions for a distributed load in
the specified points. These are used to compute the displacements that
occur due to the distributed loads if all nodes are fixed.
coord beam
coord_beam(Nodes,NodeNum)
returns the coordinates of the beam elements for plotting.
disp beam
[Ax,Ay,Az,B,Cx,Cy,Cz]
=disp_beam(Nodes,Elements,DOF,EltIDDLoad,Sections,Materials,Points)
[Ax,Ay,Az,B,Cx,Cy,Cz]
=disp_beam(Nodes,Elements,DOF,EltIDDLoad,Sections,Materials)
[Ax,Ay,Az,B]
=disp_beam(Nodes,Elements,DOF,[],Sections,Materials)
[Ax,Ay,Az,B]
=disp_beam(Nodes,Elements,DOF)
dispgcs2lcs beam
UeLCS=dispgcs2lcs_beam(UeGCS,Node)
transforms the element displacements from the GCS to the LCS for a beam
element.
fdiagrgcs beam
[ElemGCS,FdiagrGCS,ElemExtGCS,ExtremaGCS,Extrema]
= fdiagrgcs_beam(ftype,Forces,Node,DLoad,Points)
[ElemGCS,FdiagrGCS,ElemExtGCS,ExtremaGCS,Extrema]
= fdiagrgcs_beam(ftype,Forces,Node,DLoad)
returns the coordinates of the points along the beam in the global
coordinate system and the coordinates of the forces with respect to the beam
in the global coordinate system. These can be added in order to plot the
forces: ElemGCS+FdiagrGCS. The coordinates of the points with extreme values
and the coordinates of the extreme values with respect to the beam are given
as well and can be similarly added: ElemExtGCS+ExtremaGCS. Extrema is the
list with the correspondig extreme values.
fdiagrlcs beam
[FdiagrLCS,loc,Extrema] = fdiagrlcs_beam(ftype,Forces,DLoadLCS,L,Points)
computes the elements forces at the specified points. The extreme values are
analytically determined.
sdiagrgcs beam
[ElemGCS,SdiagrGCS,ElemExtGCS,ExtremaGCS,Extrema]
= sdiagrgcs_beam(stype,Forces,Node,DLoad,Section,Points)
[ElemGCS,SdiagrGCS,ElemExtGCS,ExtremaGCS,Extrema]
= sdiagrgcs_beam(stype,Forces,Node,DLoad,Section)
returns the coordinates of the points along the beam in the global
coordinate system and the coordinates of the stresses with respect to the beam
in the global coordinate system. These can be added in order to plot the
stresses: ElemGCS+SdiagrGCS. The coordinates of the points with extreme values
and the coordinates of the extreme values with respect to the beam are given
as well and can be similarly added: ElemExtGCS+ExtremaGCS. Extrema is the
list with the correspondig extreme values.
sdiagrlcs beam
[SdiagrLCS,loc,Extrema] = sdiagrlcs_beam(ftype,Forces,DLoadLCS,L,Points)
computes the stresses at the specified points. The extreme values are
analytically determined.
dof truss
ke truss
KE_TRUSS Truss element stiffness and mass matrix in global coordinate system.
kelcs truss
KELCS_TRUSS Truss element stiffness and mass matrix in local coordinate system.
[KeLCS,MeLCS] = kelcs_truss(L,A,E,rho,Options)
KeLCS = kelcs_truss(L,A,E)
returns the element stiffness and mass matrix in the local coordinate system
for a two node truss element (isotropic material)
L Truss length
A Truss cross section
E Young’s modulus
Truss functions 33
trans truss
t = trans_truss(Node)
computes the transformation matrix between the local and the global
coordinate system for the truss element.
loads truss
F = loads_truss(DLoad,Node)
computes the equivalent nodal forces of a distributed load
(in the global coordinate system).
accel truss
DLoads=accel_truss(Accelxyz,Elements,Sections,Materials,Options)
computes the distributed loads for a truss due to an acceleration.
In order to simulate gravity, accelerate the structure in the direction
opposite to gravity.
forces truss
[ForcesLCS,ForcesGCS]=forces_truss(Node,Section,Material,UeGCS)
computes the element forces for the truss element in the local and the
global coordinate system (algebraic convention).
forceslcs truss
FORCESLCS_TRUSS Compute the element forces for a truss element in the LCS.
Forces=forceslcs_truss(KeLCS,UeLCS)
computes the element forces for the truss element in the local coordinate
system (algebraic convention).
UeLCS Displacements (6 * 1)
Forces Element forces [N; 0; 0](6 * 1)
coord truss
coord_truss(Nodes,NodeNum)
returns the coordinates of the truss elements for plotting.
disp truss
[Ax,Ay,Az,B]=disp_truss(Nodes,Elements,DOF,[],[],[],Points)
[Ax,Ay,Az,B]=disp_truss(Nodes,Elements,DOF)
returns the matrices to compute the displacements of the deformed trusses.
The coordinates of the specified points along the deformed beams element are
computed using X=Ax*U+B(:,1); Y=Ay*U+B(:,2) and Z=Az*U+B(:,3).
dispgcs2lcs truss
UeLCS=dispgcs2lcs_truss(UeGCS,Node)
transforms the element displacements from the GCS to the LCS for a truss
element.
fdiagrgcs truss
[ElemGCS,FdiagrGCS,ElemExtGCS,ExtremaGCS,Extrema]
= fdiagrgcs_truss(ftype,Forces,Node,[],Points)
[ElemGCS,FdiagrGCS,ElemExtGCS,ExtremaGCS,Extrema]
= fdiagrgcs_truss(ftype,Forces,Node)
returns the coordinates of the points along the truss in the global
coordinate system and the coordinates of the forces with respect to the truss
in the global coordinate system. These can be added in order to plot the
forces: ElemGCS+FdiagrGCS. The coordinates of the points with extreme values
and the coordinates of the extreme values with respect to the truss are given
as well and can be similarly added: ElemExtGCS+ExtremaGCS. Extrema is the
list with the correspondig extreme values.
sdiagrgcs truss
[ElemGCS,SdiagrGCS,ElemExtGCS,ExtremaGCS,Extrema]
= sdiagrgcs_truss(stype,Forces,Node,[],Section,Points)
[ElemGCS,SdiagrGCS,ElemExtGCS,ExtremaGCS,Extrema]
= sdiagrgcs_truss(stype,Forces,Node,[],Section)
returns the coordinates of the points along the truss in the global
coordinate system and the coordinates of the stresses with respect to the truss
in the global coordinate system. These can be added in order to plot the
stresses: ElemGCS+SdiagrGCS. The coordinates of the points with extreme values
and the coordinates of the extreme values with respect to the truss are given
as well and can be similarly added: ElemExtGCS+ExtremaGCS. Extrema is the
list with the correspondig extreme values.
elempressure
F = elempressure(Pressures,Nodes,Elements,Types,DOF)
computes the equivalent nodal forces of a distributed pressure
(in the local coordinate system xyz, with z perpendicular to the surface).
elemshellf
ELEMSHELLF Compute the shell forces and moments per unit length for shell elements
(element solution).
[FeLCS] = elemshellf(Elements,Sections,SeLCS)
computes the element forces/moments per unit length in the local coordinate system.
elemstress
[SeGCS,SeLCS,vLCS] = elemstress(Nodes,Elements,Types,Sections,Materials,DOF,U)
[SeGCS,SeLCS] = elemstress(Nodes,Elements,Types,Sections,Materials,DOF,U)
SeGCS = elemstress(Nodes,Elements,Types,Sections,Materials,DOF,U)
40 Functions — By category
computes the element stresses in the global and the local coordinate system.
gaussq
makemesh
[Nodes,Elements,Edge1,Edge2,Edge3,Edge4] =
makemesh(Line1,Line2,Line3,Line4,m,n,Type,Section,Material)
nodalshellf
NODALSHELLF Compute the nodal shell forces/moments per unit length from the element solutio
[FnLCS,FnLCS2] = nodalshellf(Nodes,Elements,Types,FeLCS)
FnLCS = nodalshellf(Nodes,Elements,Types,FeLCS)
computes the nodal forces from the element solution.
nodalstress
[Sn,Sn2] = nodalstress(Nodes,Elements,Types,Se)
Sn = nodalstress(Nodes,Elements,Types,Se)
computes the nodal stresses from the element solution.
plotprincstress
plotprincstress(Nodes,Elements,Types,Spr,Vpr)
plots the principal stresses in shell elements with a vector plot.
plotshellfcontour
plotshellfcontour(ftype,Nodes,Elements,Types,F)
plots force contours (output from ELEMSHELLF/NODALSHELLF).
plotstresscontour
plotstresscontour(stype,Nodes,Elements,Types,S)
plots stress contours (output from ELEMSTRESS/NODALSTRESS).
plotshellfcontourf
plotshellfcontourf(stype,Nodes,Elements,Types,F)
plotshellfcontourf(stype,Nodes,Elements,Types,F,DOF,U)
plots force contours (output from ELEMSTRESS).
General shell functions 45
principalstress
[Spr,Vpr] = principalstress(Elements,SeGCS)
computes the principal stresses and directions.
printshellf
printshellf(Elements,F)
displays shell forces in command window.
printstress
printstress(Elements,S,location)
printstress(Elements,S)
displays stress in command window.
dof shell4
ke shell4
KE_SHELL4 shell element stiffness and mass matrix in global coordinate system.
[Ke,Me] = ke_shell4(Node,Section,Material,Options)
Ke = ke_shell4(Node,Section,Material,Options)
returns the element stiffness and mass matrix in the global coordinate system
for a four node shell element (isotropic material).
kelcs shell4
[Ke,Me] = kelcs_shell4(Node_lc,h,E,nu,rho)
Ke = kelcs_shell4(Node_lc,h,E,nu)
returns the element stiffness and mass matrix in the element
coordinate system for a four node shell element (isotropic material).
h Shell thickness
E Young’s modulus
nu Poisson coefficient
rho Mass density
Options Element options [NOT available yet] {Option1 Option2 ...}
KeLCS Element stiffness matrix (24 * 24)
MeLCS Element mass matrix (24 * 24)
trans shell4
[t,Node_lc,W] = trans_shell4(Node)
[t,Node_lc] = trans_shell4(Node)
t = trans_shell4(Node)
computes the transformation matrix between the local and the global
coordinate system and the correction matrix for non-coplanar nodes
for the shell4 element.
ke dkt
[Ke,Me] = ke_dkt(Node,h,E,nu,rho)
Ke = ke_dkt(Node,h,E,nu)
returns the element stiffness and mass matrix in the global coordinate system
for a three node plate element (isotropic material) in the xy-plane.
q dkt
sh qs4
sh t
accel shell4
acceleration.
DLoads = accel_shell4(Accelxyz,Elements,Sections,Materials,Options)
computes the distributed loads for shell4 elements due to an acceleration.
In order to simulate gravity, accelerate the structure in the direction
opposite to gravity.
loads shell4
F = loads_shell4(DLoad,Node)
computes the equivalent nodal forces of a distributed load
(in the global coordinate system).
loadslcs shell4
F = loadslcs_shell4(DLoadLCS,Node)
computes the equivalent nodal forces of a distributed load
(in the local coordinate system).
pressure shell4
F = pressure_shell4(Pressure,Node)
computes the equivalent nodal forces of a pressure load normal to the
elements surface.
se shell4
[SeGCS,SeLCS,vLCS] = se_shell4(Node,Section,Material,UeGCS,Options,GCS)
[SeGCS,SeLCS] = se_shell4(Node,Section,Material,UeGCS,Options,GCS)
SeGCS = se_shell4(Node,Section,Material,UeGCS,Options,GCS)
computes the element stresses in the global and the
local coordinate system for the shell4 element.
selcs shell4
[SeLCS] = selcs_shell4(Node,Section,Material,UeGCS,Options)
computes the element stresses in the global and the
local coordinate system for the shell4 element.
coord shell4
[X,Y,Z] = coord_shell4(Nodes,NodeNum)
returns the coordinates of the shell4 elements for plotting.
disp shell4
[Ax,Ay,Az,B] = disp_shell4(Nodes,Elements,DOF,U)
returns the matrices to compute the displacements of the deformed shell4.
The coordinates of the nodes of the shell4 element are
computed using X=Ax*U+B(:,1); Y=Ay*U+B(:,2) and
Z=Az*U+B(:,3).
scontour shell4
patch shell4
grid shell4
[s,t,NodeNum,Elements] = grid_shell4(m,n,Type,Section,Material)
returns matrices of a grid in the natural coordinate system, which can
be used for mapped meshing.
dof shell8
ke shell8
KE_SHELL8 shell element stiffness and mass matrix in global coordinate system.
[Ke,Me] = ke_shell8(Node,Section,Material,Options)
Ke = ke_shell8(Node,Section,Material,Options)
returns the element stiffness and mass matrix in the global coordinate system
for an eight node shell element.
Zienkiewicz (2005).
sh qs8
SH_Q
SH_QS8
S8 Shap
Shape
e func
functi
tion
ons
s for
for an 8 node
node quadr
quadril
ilat
ater
eral
al ser
seren
endi
dipi
pity
ty ele
eleme
ment
nt.
.
[Ni,dN_dx
[Ni,dN_dxi,dN
i,dN_deta
_deta]
] = sh_qs8(xi
sh_qs8(xi,eta
,eta)
) returns
returns the shape functions
functions and
its deriva
derivativ
tives
es with
with respec
respect
t to the natura
natural
l coordi
coordinat
nates
es in the point
point (xi,et
(xi,eta).
a).
xi n at u ra l co o rd i na t e (s c al a r)
et a n at u ra l co o rd i na t e (s c al a r)
Ni s ha p e f u nc t io n s i n p oi n t ( x i, e ta ) (8 * 1)
dN _ dx i de
d erivative of Ni to xi (8 * 1)
dN _ de t a derivative of Ni to eta (8 * 1)
b shell8
B_SH
B_SHEL
ELL8
L8 b matr
matrix
ix for a shel
shell8
l8 eleme
element
nt in glob
global
al coord
coordin
inat
ate
e system
system.
.
[Bg,J] = b_shell8(Ni,dN_dxi,dN_deta,z
b_shell8(Ni,dN_dxi,dN_deta,zetar,Node,
etar,Node,h,v1i,v2i,v
h,v1i,v2i,v3i)
3i) returns
the element
element b matrix
matrix in the global
global coordina
coordinate
te system
system and the Jacobian
Jacobian
of the parame
parametri
tric
c transf
transform
ormati
ation.
on. Both
Both are evalua
evaluated
ted in the natura
natural
l
coordi
coordinat
nates
es (xi,et
(xi,eta
a and zetar)
zetar) which
which were
were used
used to calcul
calculate
ate
Ni,dN_dxi
Ni,dN_dxi,dN_
,dN_deta
deta and zetar.
zetar.
No d e Node definitions [x y z] (8 * 3)
Nodes
Nodes should
should have
have the follow
following
ing order:
order:
4----7----3
| |
8 6
| |
1----5----2
Ni Shape functions for quadratic serendipity element (8 * 1)
dN _ dx i first derivatives of shape functions Ni (8 * 1)
dN _ de t a first derivatives of shape functions Ni (8 * 1)
h scalar or vector containing thickness sc a la r o r ( 8 * 1)
v(1,
v(1,2,2,3)3)i
i comp
compon
onen
ents
ts of the local
local coord
coordin
inat
ate
e syste
system
m in node
node i (8 * 3)
d Nodal offset from shell mid plane sc a la r ( d ef a ul t = 0)
60 Functions — By category
se shell8
SE_S
SE_SHE
HELL
LL8
8 Comp
Comput
ute
e the
the elem
elemen
ent
t stre
stress
sses
es for a shel
shell8
l8 elemen
element.
t.
[SeGCS,SeLCS,vLCS]
[SeGCS,SeLCS,vLCS] = se_shell8(Node,Section,Materi
se_shell8(Node,Section,Material,UeGCS,O
al,UeGCS,Options,gc
ptions,gcs)
s)
[SeGCS
[SeGCS,Se
,SeLCS
LCS]
] = se_she
se_shell8
ll8(No
(Node,
de,Sec
Sectio
tion,
n,Mat
Materi
erial,
al,UeG
UeGCS,
CS,Opt
Option
ions,g
s,gcs
cs)
)
SeG
SeGCS = se_s
se_sh
hell
ell8(N
8(Node
ode,Se
,Secti
ction,
on,Mat
Materi
erial,U
l,UeGCS
eGCS,O
,Opt
ptiions
ons,gc
,gcs)
comput
computes
es the elemen
element
t stress
stresses
es in the global
global and the
local
local coordi
coordinat
nate
e system
system for the shell8
shell8 elemen
element.
t.
No d e Node definitions [x y z] (8 * 3)
Nodes
Nodes should
should have
have the follow
following
ing order:
order:
4----7----3
| |
8 6
| |
1----5----2
Se c ti o n Section definition [h ] o r [ h 1 h 2 h 3 h 4 ]
(uniform
(uniform thickness
thickness or defined
defined in corner
corner nodes(1,2
nodes(1,2,3,4,3,4))
))
Mate
ateria
rial Mat
Materi
erial def
defini
initio
tion [E nu rho]
rho] or [Ex[Exx Eyy nux nuxy muxy
muxy muy
muyz muzx
uzx thet
theta
a rho
rho
UeGC
eGCS Dis
Displa
placem
cement
ents (48
(48 * nTim
nTimeeSte
Steps)
ps)
Opti
Option
onss Elem
Elemen
ent
t opti
option
ons
s stru
struct
ct.. Fiel
Fields
ds::
-LCSType:
-LCSType: determine
determine the reference
reference local element
element
coordinate
coordinate system.
system. Values:
Values:
’element’
’element’ (default)
(default) or ’global’
’global’
-MatType:
-MatType: ’isotropic
’isotropic’’ (default)
(default) or ’orthotrop
’orthotropic’ ic’
-Offse
-Offset:
t: nodal
nodal offset
offset from
from shell
shell midpla
midplane.ne. Values
Values: :
’top’,
’top’, ’mid’
’mid’ (defau
(default)
lt),, ’bot’
’bot’ or numeri
numericalcal value
value
GCS Glo
Global
bal coor
coorddina
inate syst
ystem in whi
which str
stress
esses are ret return
urned
’cart’|’cyl’|’sph’
SeGC
eGCS Ele
Elemen
ment str
streesse
sses in
in GC
GCS in
in cor
cornner nod
nodes IJKLJKL anand
at top/mi
top/mid/b
d/bot
ot of shell
shell (72 * nTimeS
nTimeStepteps)
s)
72 = 6 stress comp. * 4 nodes * 3 locations
[sxx
[sxx syy
syy szz
szz sxy
sxy syz
syz sxz]
sxz]
SeLC
eLCS Ele
Elemen
ment str
streesse
sses in
in LC
LCS in
in cor
cornner nod
nodes IJKLJKL anand
at top/mi
top/mid/b
d/bot
ot of shell
shell (72 * nTimeS
nTimeStepteps)
s)
[sxx
[sxx syy
syy szz
szz sxy
sxy syz
syz sxz]
sxz]
vL C S Unit vectors of LCS (3 * 3)
accel shell8
ACCEL_
ACCEL_SHE
SHELL8
LL8 Comput
Compute
e the distri
distribut
buted
ed loads
loads for shell8
shell8 elemen
elements
ts due to an accelera
acceleratio
tion.
n.
DLoads = accel_shell8(Accelxyz,Elemen
accel_shell8(Accelxyz,Elements,Section
ts,Sections,Materials
s,Materials,Options)
,Options)
comput
computes
es the distri
distribut
buted
ed loads
loads for shell8
shell8 elemen
elements
ts due to an accele
accelerat
ration
ion.
.
In order
order to simula
simulate
te gravit
gravity,
y, accele
accelerat
rate
e the struct
structure
ure in the direct
direction
ion
opposite
opposite to gravity.
gravity.
Accelxyz A c ce l er a ti o n [A x A y A z ] ( 1 * 3)
Elem
Elemen
ents
ts Elem
Elemen entt defi
defini niti
tion
ons
s [Elt
[EltID
ID TypI
TypID D SecI
SecID
D MatI
MatIDD n1
n1 n2
n2 ...
...]
]
Sect
Sectio
ions
ns Sect
Sectio ionn defi
defini niti
tion
ons
s [Sec
[SecID
ID SecP
SecProrop1
p1 SecP
SecPro
rop2
p2 ...]
...]
Mate
Materi
rial
alss Mate
Materi rial
al defi
defininiti
tion
onss [Mat
[MatID
ID MatP
MatProrop1
p1 MatP
MatPro
rop2
p2 ...
... ]
Opti
Option
ons
s Elem
Elemenent t opti
option ons
s stru
struct
ct.
. Fiel
Fields
ds::
-MatType:
-MatType: ’isotropic
’isotropic’ ’ (default)
(default) or ’orthotrop
’orthotropic’
ic’
DLoa
Loads Dis
Distri
tribut
buted loa loads [Elt
EltID n1g
n1glob
lobalX
alX n1g
n1glob
lobalY
alY n1gl
n1gloobal
balZ ...]
...]
loads shell8
LOAD
LOADS_
S_SH
SHEL
ELL8
L8 Equi
Equiva
vale
lent
nt nodal
nodal forces
forces for a shel
shell8
l8 eleme
element
nt in the
the GCS.
GCS.
F = loads_she
loads_shell8(D
ll8(DLoad
Load,Node
,Node)
)
comput
computes
es the equiva
equivalen
lent
t nodal
nodal forces
forces of a distri
distribut
buted
ed load
load
(in the global
global coordinate
coordinate system).
system).
DLoa
Load Dis
Distri
tribut
buted loaloads [n1g
[n1glloba
obalX;
lX; n1gl
n1glo
obal
balY; n1gl
1globa
obalZ;
lZ; ...
...]
i n c o rn e r N od e s (1 2 * 1)
No d e Node definitions [x y z] (8 * 3)
F Load vector (4 (48 * 1)
pressure shell8
PRES
PRESSU
SURE
RE_S
_SHE
HELL
LL8
8 Equi
Equiva
vale
lent
nt nodal
nodal forc
forces
es for
for a shel
shell8
l8 elemen
element
t in the
the GCS
GCS
due to a pressu
pressure
re normal
normal to the element
element surfac
surface.
e.
F = pressure_
pressure_shell
shell(Pre
(Pressure
ssure,Nod
,Node)
e)
comput
computes
es the equiva
equivalen
lent
t nodal
nodal forces
forces of a pressu
pressure
re load
load normal
normal to
the elements
elements surface.
surface.
62 Functions — By category
coord shell8
[X,Y,Z] = coord_shell8(Nodes,NodeNum)
returns the coordinates of the shell8 elements for plotting.
disp shell8
[Ax,Ay,Az,B] = disp_shell8(Nodes,Elements,DOF,U)
returns the matrices to compute the displacements of the deformed shell.
The coordinates of the nodes of the shell8 element are
computed using X=Ax*U+B(:,1); Y=Ay*U+B(:,2) and
Z=Az*U+B(:,3).
scontour shell8
patch shell8
[pxyz,pind,pvalue] = patch_shell8(Nodes,NodeNum,Values)
returns matrices to plot patches of shell8 elements.
grid shell8
[s,t,NodeNum,Elements] = grid_shell8(m,n,Type,Section,Material)
returns matrices of a grid in the natural coordinate system, which can
64 Functions — By category
nlsolver
[U,K,lambda] = nlsolver(Nodes,Elements,Types,Sections,Materials,DOF,Pf);
[U,K,lambda,ds,HistPar,crpoint_info] = nlsolver(Nodes,Elements,Types,...
Sections,Materials,DOF,Pf,U0,Options,HistPar,Constr,P0);
This function contains several algorithms for solving nonlinear problems
of the form R(U)-lambda*Pf = 0
The standard algorithm uses a load control strategy with Newton-Raphson as
nonlinear solver
INPUT:
Nodes Node definitions [NodID x y z]
Elements Element definitions [EltID TypID SecID MatID n1 n2 ...]
Types Element type definitions {TypID EltName Option1 ... }
Sections Section definitions [SecID SecProp1 SecProp2 ...]
Materials Material definitions [MatID MatProp1 MatProp2 ... ]
DOF Degrees of freedom (nDOF * 1)
Pf External load vector (nDOF * 1)
Contains the final load vector
(i.e. multiplier lambda varies from 0 to 1 in load control steps)
U0 Initial displacement vector (nDOF * 1)
Options Struct containing optional parameters. Fiels:
.nloadincrem Number of load increments in load control strategy
.method Solver for nonlinear system:
’NR’: Newton-Raphson (default)
’MNR’: Modified Newton-Raphson
’QN’: Quasi-Newton (BGFS)
.tolerance Convergence tolerance on residual for nonlinear solvers (default: 1e-4)
.arclength Use arclength control
{’off’: load control (default) |’on’: arclength control}
.arclength_strategy Select arclength strategy/constraint type:
{’hyperplane’ (default)| ’cylinder’}
.adapt_arclength Use heuristic scheme to adapt arclength during
iterations {true (default)| false}
.maxiter Maximum number of sub-iterations in each load or arclength
substep
.maxoiter Maximum number of outer iterations in arclength methods
.lsmethod Add line-search method to load control strategy:
{’no’ (default) | ’energy’ | ’armijo’}
.initdl Initial arclength (default = 0)
when set to 0 an initial arclength is estimated based on the
equivalent number of load steps (nloadincrem)
.ksym Assume symmetric tangent stiffness matrix {true | false (default)}
.check_crpoint Check whether a critical point is passed in each step
(true | false (default))
.printiter Print information during each iteration of the algorithm
(true (default)| false)
HistPar Element related history parameters
Constr Impose linear constraint equations (see ADDCONSTR function)
Nonlinear analysis functions 67
lincrpoint
[lambda,phi] = lincrpoint(Nodes,Elements,Types,Sections,Materials,DOF,P);
[lambda,phi] = lincrpoint(Nodes,Elements,Types,Sections,Materials,DOF,P,...
nmode,lambda0,U0,Options);
estimates the critical load factor (e.g. buckling/bifurcation load factor)
by linear interpolation of the tangent stiffness matrix of two distinct
equilibrium points (see p.630 Bathe and p.362 Belytschko).
Input:
Nodes Node definitions [NodID x y z]
Elements Element definitions [EltID TypID SecID MatID n1 n2 ...]
Types Element type definitions {TypID EltName Option1 ... }
Sections Section definitions [SecID SecProp1 SecProp2 ...]
Materials Material definitions [MatID MatProp1 MatProp2 ... ]
DOF Degrees of freedom (nDOF * 1)
P Load vector (nDOF * 1)
Optional input:
nmode number of modes (default: 10)
lambda0 load factors of the two reference equilibrium points (default: [0 1])
U0 Initial displacements used in finding the equilibrium points (nDOF x 2)
Options Options struct (passed to nlsolver function)
nlincrpoint
[lambda,phi] = nlincrpoint(Nodes,Elements,Types,Sections,Materials,DOF,P,...
lambda0,U0,Options,HistPar,Constr);
locate nonlinear critical point between two states using a simple
68 Functions — By category
bracketing algorithm.
Input:
Nodes Node definitions [NodID x y z]
Elements Element definitions [EltID TypID SecID MatID n1 n2 ...]
Types Element type definitions {TypID EltName Option1 ... }
Sections Section definitions [SecID SecProp1 SecProp2 ...]
Materials Material definitions [MatID MatProp1 MatProp2 ... ]
DOF Degrees of freedom (nDOF * 1)
P Load vector (nDOF * 1)
lambda0 Load factors of the two reference equilibrium points (nDOF x 2)
U0 Displacements of the reference equilibrium points (nDOF x 2)
Options Options struct. Fields:
.nlsolver Nonlinear solver strategy (loadcontrol (default)| arclength)
.tolerance Convergence tolerance bisection algorithm (default: 1e-3)
.maxiter Maximum number of iterations (default: 20)
.verbose Print information during iterations (true (default)| false)
HistPar Element related history parameters
Constr Impose linear constraint equations (see ADDCONSTR function)
nlincrpoint2
[lambda,phi] = lincrpoint2(Nodes,Elements,Types,Sections,Materials,DOF,P);
[lambda,phi] = lincrpoint2(Nodes,Elements,Types,Sections,Materials,DOF,P,...
nmode,lambda0,U0,phi0,Options);
locates a nonlinear critical point by directly solving the extended
system of equations. Not applicable to elasto-plastic problems. More
information on this algorithm can be found in e.g. Wriggers (2008),
Nonlinear Finite Element Methods (p.262).
Input:
Nodes Node definitions [NodID x y z]
Elements Element definitions [EltID TypID SecID MatID n1 n2 ...]
Types Element type definitions {TypID EltName Option1 ... }
Sections Section definitions [SecID SecProp1 SecProp2 ...]
Materials Material definitions [MatID MatProp1 MatProp2 ... ]
DOF Degrees of freedom (nDOF * 1)
P Load vector (nDOF * 1)
lambda0 Initial guess of critical load factor (scalar)
U0 Initial displacements used the equilibrium points (nDOF x 2)
phi0 Initial gueess of critical mode (nDOF x 1)
Options Options struct. Fields:
.nphi0iters Number of iterations to estimate initial critical mode (default: 3)
.tolerance Convergence tolerance on residual (default: 1e-7)
Nonlinear analysis functions 69
Output:
lambda critical point load factor estimates (scalar)
phi buckling modes (ndof x 1)
kenl truss
[Re,Ke] = kenl_truss(Node,Section,Material,Ue,Options)
returns the internal force vector, the element stiffness and mass matrix in the
global coordinate system for a two node truss element (isotropic
material)
kenl plane4
[Re,Ke] = kenl_plane4(Node,Section,Material,Ue,Options)
Re = kenl_plane4(Node,Section,Material,Ue,Options)
returns internal force vector and tangent stiffness matrix of
the element in the global coordinate system for a four
node plane element (isotropic material).
70 Functions — By category
kenl kbeam
[Re,Ke] = kenl_beam(Node,Section,Material,Ue,Options)
returns the internal force vector, the element stiffness and mass matrix in the
global coordinate system for a two node beam element (isotropic
material)
Tutorial
72 Tutorial
A frame is clamped at node 1 and has a hinge at node 5. An internal hinge is present at nodes 2
and 3. At node 4 a point load F = 5 kN is applied and the vertical beam on the left is loaded by a
distributed load p = 2 kN/m.
The frame consists of rectangular concrete beams (Young’s modulus E = 30 × 106 kN/m2 and Poisson
coefficient ν = 0.2) with a height of 0.25m and a width of 0.1 m. A diagonal steel cable (Young’s
modulus E = 210 × 106 kN/m2 and Poisson coefficient ν = 0.3) with a radius of 0.004 m, supports the
frame.
% StaBIL manual
% Tutorial: static analysis
% Units: m, kN
% Nodes=[NodID X Y Z]
Nodes= [1 0 0 0;
2 0 4 0;
3 0 4 0;
4 4 4 0;
5 4 0 0;
6 1 5 0]; % reference node
b=0.10;
Tutorial: static analysis 73
h=0.25;
r=0.004;
% Materials=[MatID E nu];
Materials= [ 1 30e6 0.2; % concrete
2 210e6 0.3]; % steel
% Degrees of freedom
% Assemble a column matrix containing all DOFs at which stiffness is
% present in the model:
DOF=getdof(Elements,Types);
P=P+elemloads(DLoads,Nodes,Elements,Types,DOF);
[K,P]=addconstr(Constr,DOF,K,P);
% Solve K * U = P
U=K\P;
% Plot displacements
figure
plotdisp(Nodes,Elements,Types,DOF,U,DLoads,Sections,Materials)
figure
plotforc( sheary ,Nodes,Elements,Types,Forces,DLoads)
title( Shear forces )
figure
plotforc( momz ,Nodes,Elements,Types,Forces,DLoads)
title( Bending moments )
% Plot stresses
figure
plotstress( snorm ,Nodes,Elements,Types,Sections,Forces,DLoads)
title( Normal stresses due to normal forces )
figure
plotstress( smomzt ,Nodes,Elements,Types,Sections,Forces,DLoads)
title( Normal stresses due to bending moments around z: top )
figure
plotstress( smomzb ,Nodes,Elements,Types,Sections,Forces,DLoads)
title( Normal stresses due to bending moments around z: bottom )
figure
plotstress( smax ,Nodes,Elements,Types,Sections,Forces,DLoads)
title( Maximal normal stresses )
figure
plotstress( smin ,Nodes,Elements,Types,Sections,Forces,DLoads)
title( Minimal normal stresses )
76 Tutorial
173714
−71
24 −271
−71
173714
24 −271
(a) normal forces
2325
0 −2325 0 2325
−2325
760 −760
−8525 0 8525 0
(b) b ending moments around z: top (c) b ending moments around z: b ottom
173714 173714
−71
24 2254
2054 −71
24 −2597
−2397
785 −736
173714 173714
A dynamic analysis is made of the frame that was treated in section 2.1.
% StaBIL manual
% Tutorial: dynamic analysis: model
% Units: m, N
L=4;
H=4;
nElemCable=8;
% Nodes=[NodID X Y Z]
Nodes= [1 0 0 0;
2 L 0 0];
Nodes=reprow(Nodes,1:2,4,[2 0 H/4 0]);
Nodes= [Nodes;
11 0 H 0];
Nodes=reprow(Nodes,11,3,[1 L/4 0 0]);
Nodes= [Nodes;
15 1 5 0]; % reference node
Nodes= [Nodes;
16 0 0 0];
Nodes=reprow(Nodes,16,nElemCable,[1 L/nElemCable H/nElemCable 0]);
b=0.10;
h=0.25;
r=0.004;
% Materials=[MatID E nu];
Materials= [1 30e9 0.2 2500; % concrete
2 210e9 0.3 7850]; % steel
% Degrees of freedom
DOF=getdof(Elements,Types);
% Boundary conditions
seldof=[0.03; 0.04; 0.05; 1.01; 1.02; 1.06; 2.01; 2.02; 16.01; 16.02];
DOF=removedof(DOF,seldof);
[K,b,M]=addconstr(Constr,DOF,K,b,M);
2.2.1 Eigenmodes
% StaBIL manual
% Tutorial: dynamic analysis: eigenvalue problem
% Units: m, N
% Assembly of M and K
tutorialdyna;
% Eigenvalue problem
nMode=12;
[phi,omega]=eigfem(K,M,nMode);
% Display eigenfrequenties
disp( Lowest eigenfrequencies [Hz] );
disp(omega/2/pi);
% Plot eigenmodes
figure;
plotdisp(Nodes,Elements,Types,DOF,phi(:,1), DispMax , off )
figure;
plotdisp(Nodes,Elements,Types,DOF,phi(:,2), DispMax , off )
figure;
Tutorial: dynamic analysis 79
% Animate eigenmodes
figure;
animdisp(Nodes,Elements,Types,DOF,phi(:,1))
title( Eigenmode 1 )
figure;
animdisp(Nodes,Elements,Types,DOF,phi(:,2))
title( Eigenmode 2 )
figure;
animdisp(Nodes,Elements,Types,DOF,phi(:,5))
title( Eigenmode 5 )
figure;
animdisp(Nodes,Elements,Types,DOF,phi(:,8))
title( Eigenmode 8 )
figure;
animdisp(Nodes,Elements,Types,DOF,phi(:,11))
title( Eigenmode 11 )
figure;
animdisp(Nodes,Elements,Types,DOF,phi(:,12))
title( Eigenmode 12 )
% StaBIL manual
% Tutorial: dynamic analysis: modal superposition: piecewise exact integration
% Units: m, N
% Assembly of M and K
tutorialdyna;
% Sampling parameters
T=2.5; % Time window
dt=0.002; % Time step
N=T/dt; % Number of samples
t=[0:N-1]*dt; % Time axis
% Eigenvalue analysis
nMode=12; % Number of modes to take into account
[phi,omega]=eigfem(K,M,nMode); % Calculate eigenmodes and eigenfrequencies
xi=0.07; % Constant modal damping ratio
% Excitation
bm=phi. *b; % Spatial distribution, modal (nMode * 1)
80 Tutorial
% Modal analysis
x= msupt(omega,xi,t,pm, zoh );
% Figures
figure;
plot(t,x);
title( Modal response (piecewise linear exact integration) );
xlabel( Time [s] );
xlim([0 4.1])
ylabel( Displacement [m kg^{0.5}] );
legend([repmat( Mode ,nMode,1) num2str([1:nMode]. )]);
figure;
c=selectdof(DOF,[9.01; 13.02; 17.02]);
plot(t,c*u);
title( Nodal response (piecewise linear exact integration) );
xlabel( Time [s] );
xlim([0 4.1])
ylabel( Displacement [m] );
legend( 9.01 , 13.02 , 17.02 );
% Movie
figure;
animdisp(Nodes,Elements,Types,DOF,u);
% Display
disp( Maximum modal response );
disp( max(abs(x),[],2));
% StaBIL manual
% Tutorial: dynamic analysis: direct method: frequency domain
% Units: m, N
% Assembly of M and K
tutorialdyna;
% Sampling parameters
N=2048; % Number of samples
dt=0.002; % Time step
T=N*dt; % Period
F=N/T; % Sampling frequency
df=1/T; % Frequency resolution
t=[0:N-1]*dt; % Time axis
82 Tutorial
f=[0:N/2-1]*df; % Pos
Positiv
itive
e fre
freque
quenci
ncies
es cor
corres
respon
pondin
ding
g to FFT [Hz
[Hz]
]
Omega=2*pi
Omega=2*pi*f;
*f; % Ide
Idem
m [ra
[rad/
d/s]
s]
% Eigenv
Eigenvalue
alue analysis
nMode=12; % Numb
Number
er of mo
mode
des
s to ta
take
ke in
into
to ac
acco
coun
unt
t
[phi,omega]=eigfem
[phi,omega]=eigfem(K,M,nMode);
(K,M,nMode); % Calcula
Calculate
te eigenmodes
eigenmodes and eigenf
eigenfrequen
requencies
cies
xi=0.07; % Con
Constan
stant
t mod
modal
al dam
dampin
ping
g rat
ratio
io
% Excita
Excitation
tion
bm=phi. *b; % Spatial dis
Spatial distri
tribut
bution
ion,
, mod
modal
al (nM
(nMode
ode * 1)
q=zeros
q=zeros(1,N);
(1,N); % Time
Time hi
hist
stor
ory
y (1 * N)
q((t>=0.50)
q((t>=0.50) & (t<0.60))=1;
(t<0.60))=1; % Time
Time hi
hist
stor
ory
y (1 * N)
Q=fft
Q=fft(q);
(q); % Freq
Frequen
uency
cy co
cont
nten
ent
t (1 * N)
Q=Q(1:N/2); % Frequen
Frequency
cy con
conten
tent,
t, pos
positi
itive
ve fre
freqq (1 * N/2
N/2)
)
Pm=bm*Q; % Modal
Modal exc
excita
itatio
tion
n, pos
positiv
itive
e fre
freq
q (nM
(nMode
ode * N/2
N/2)
)
% Mod
Modal
al ana
analys
lysis
is
[X,H]= msupf
msupf(omega,xi,Omega,Pm);
(omega,xi,Omega,Pm); % Mod
Modal
al res
respon
ponse
se,
, pos
positiv
itive
e fre
freq
q (nM
(nMode
ode * N/2
N/2)
)
% F-
F-do
dom m -> t-
t-do
dom
m
X=[X, zeros(nMode,1),
zeros(nMode,1), conj(X(:,
conj(X(:,end
end:-1:2))];
:-1:2))];
x=ifft
x=ifft(X,[],2);
(X,[],2); % Mo
Moda
dal
l re
resp
spon
onse
se (n
(nMo
Mode
de * N)
% Mod
Modal
al dis
displa
placem
cement
ents
s -> nod
nodal
al dis
displa
placem
cements
ents
u=phi*x; % No
Noda
dal
l re
resp
spon
onse
se (n
(nDO
DOF
F * N)
% Fig
Figure
ures s
figure;
figure ;
subplot(3,2,1);
subplot (3,2,1);
plot(t,q,
plot(t,q, .- );
xlim([0
xlim([0 4.1])
ylim([0
ylim([0 1.2]);
title(
title( Excitation
Excitation time histor
history
y );
xlabel(
xlabel ( Time [s] );
ylabel(
ylabel ( Force [N/m] );
subplot(3,2,2);
subplot(3,2,2);
plot(f,
plot(f,abs
abs(Q)/F,
(Q)/F, .- );
title(
title( Excitation
Excitation frequen
frequency
cy conten
content
t );
xlabel(
xlabel( Frequency
Frequency [Hz] );
ylabel(
ylabel( Force [N/m/
[N/m/Hz]
Hz] );
subplot(3,2,4);
subplot(3,2,4);
plot(f,
plot(f,abs
abs(H),
(H), .- );
title(
title( Modal transf
transfer
er functi
function
on );
xlabel(
xlabel( Frequency
Frequency [Hz] );
ylabel(
ylabel( Displacement
Displacement [m/N] );
legend([repmat(
legend([repmat( Mode ,nMode,1) num2str([1:nMode].
num2str([1:nMode]. )]);
subplot(3,2,6);
subplot(3,2,6);
plot(f,
plot(f,abs
abs(X(:,1:N/2))/F,
(X(:,1:N/2))/F, .- );
title(
title( Modal respon
response
se );
xlabel(
xlabel( Frequency
Frequency [Hz] );
ylabel(
ylabel( Displacement
Displacement [m kg^{0
kg^{0.5}/
.5}/Hz]
Hz] );
subplot(3,2,5);
subplot(3,2,5);
Tutorial: dynamic analysis 83
plot(t,x);
plot(t,x);
title(
title( Modal response (calculation
(calculation in f-dom
f-dom)
) );
xlabel(
xlabel( Time [s] );
xlim([0
xlim([0 4.1])
ylabel(
ylabel( Displacement
Displacement [m kg^{0
kg^{0.5}]
.5}] );
figure;
figure;
plot(t,x);
plot(t,x);
title(
title( Modal response (calculation
(calculation in f-dom
f-dom)
) );
xlabel(
xlabel( Time [s] );
xlim([0
xlim([0 4.1])
ylabel(
ylabel( Displacement
Displacement [m kg^{0
kg^{0.5}]
.5}] );
legend([repmat(
legend([repmat( Mode ,nMode,1) num2str([1:nMode].
num2str([1:nMode]. )]);
figure;
figure;
c=selectdof
c=selectdof(DOF
(DOF,[9.01
,[9.01;
; 13.02; 17.02]);
17.02]);
plot(t,c*u);
plot(t,c*u);
title(
title( Nodal response (calculation
(calculation in f-dom
f-dom)
) );
xlabel(
xlabel( Time [s] );
xlim([0
xlim([0 4.1])
ylabel(
ylabel( Displacement
Displacement [m] );
legend(
legend( 9.01 , 13.02 , 17.02 );
% Mo
Movi
viee
figure;
figure;
animdisp(Nodes,Elements,Types,DOF,u);
animdisp (Nodes,Elements,Types,DOF,u);
% Dis
Displa
playy
disp(
disp( Maximum
Maximum modal respon
response
se );
disp(
disp( max
max((abs
abs(x),[],2));
(x),[],2));
disp( Maximum
disp( Maximum nod
nodal
al res
respon
ponse
se 9.0
9.01
1 13.
13.02
02 17.
17.02
02 );
disp(
disp( max
max((abs
abs(c*u),[],2));
(c*u),[],2));
2.2.4
2.2.4 Direc
Directt tim
time
e int
integr
egrati
ation
on
% StaBIL
StaBIL manual
% Tutori
Tutorial:
al: dynamic analys
analysis:
is: direct time integration:
integration: trapez
trapezium
ium rule
% Un
Unit
its
s: m, N
% Assembly of M, K and C
tutorialdyna;
[phi,omega]=eigfem
[phi,omega]=eigfem(K,M);
(K,M); % Calcul
Calculate
ate eigenm
eigenmodes
odes and eigenf
eigenfrequen
requencies
cies
xi=0.07; % Dam
Dampin
ping
g rat
ratio
io
nModes=length
nModes=length(K)-
(K)-size
size(Constr,1);
(Constr,1);
C=M. *phi(:,1:nModes)*diag
*phi(:,1:nModes)*diag(2*xi*omega(1:nModes))*phi(:,1:nModes).
(2*xi*omega(1:nModes))*phi(:,1:nModes). *M;
% Mo
Moda
dal
l -> fu
full
ll da
damp
mpin
ing
g ma
matr
trix
ix C
% Sampli
Sampling
ng parame
parameters
ters
T=2.5; % Time win
Time window
dow
dt=0.002; % Time
Time st
step
ep
N=T/dt; % Number
Number of sam
sample
ples
s
t=[0:N-1]*dt; % Time
Time ax
axis
is
% Excita
Excitation
tion
84 Tutorial
1 0.08
]
] z
m
0.8 H
/
/
N m0.06
/
[
e 0.6 N
[
c
r e 0.04
o c
r
F 0.4 o
F
0.2 0.02
0 0
0 1 2 3 4 0 10 20 30 40 50
Time [s] Frequency [Hz]
q=zeros
q=zeros(1,N);
(1,N); % Ti
Time
me hi
hist
stor
ory
y (1 * N)
q((t>=0.50)
q((t>=0.50) & (t<0.60))=1;
(t<0.60))=1; % Ti
Time
me hi
hist
stor
ory
y (1 * N)
p=b*q; % No
Noda
dal
l ex
exci
cita
tati
tion
on (n
(nDO
DOF
F * N)
% Dir
Direct
ect time int
integr
egrati
ation
on - tra
trapez
pezium
ium rule
alpha=1/4;
delta=1/2;
theta=1;
u=wilson
u=wilson(M,C
(M,C,K,dt
,K,dt,p,[a
,p,[alpha
lpha delta theta]);
theta]);
Tutorial: dynamic analysis 85
0.1 0.1
Mode 1 Mode 1
Mode 2 Mode 2
0.08 0.08
Mode 3 Mode 3
Mode 4 Mode 4
] ]
5
. 0.06 Mode 5 5
. 0.06 Mode 5
0 0
g Mode 6 g Mode 6
k k
m
[
Mode 7 m
[
Mode 7
t
0.04 t
0.04
n Mode 8 n Mode 8
e Mode 9 e Mode 9
m m
e 0.02 Mode 10 e 0.02 Mode 10
c c
a
l Mode 11 a
l Mode 11
p p
s
i Mode 12 s
i Mode 12
D 0 D 0
−0.02 −0.02
−0.04 −0.04
0 0.5 1 1.5 2 2.5 3 3.5 4 0 0.5 1 1.5 2 2.5 3 3.5 4
Time [s] Time [s]
(a) Modal superposition in time domain (b) Modal superposition in frequency domain
% Figures
figure;
c=selectdof(DOF,[9.01; 13.02; 17.02]);
plot(t,c*u);
title([ Nodal response (direct time integration) ]);
xlabel( Time [s] );
xlim([0 4.1])
ylabel( Nodal displacements [m] );
legend( 9.01 , 13.02 , 17.02 );
% Movie
figure;
animdisp(Nodes,Elements,Types,DOF,u);
% Display
disp( Maximum nodal response 9.01 13.02 17.02 );
disp( max(abs(c*u),[],2));
% StaBIL manual
% Tutorial: dynamic analysis: modal superposition: transform to f-dom
% Units: m, N
% Assembly of M, K and C
tutorialdyna;
[phi,omega]=eigfem(K,M); % Calculate eigenmodes and eigenfrequencies
xi=0.07; % Damping ratio
nModes=length(K)-size(Constr,1);
C=M. *phi(:,1:nModes)*diag(2*xi*omega(1:nModes))*phi(:,1:nModes). *M;
% Modal -> full damping matrix C
% Sampling parameters
86 Tutorial
% Excitation
q=zeros(1,N); % Time history (1 * N)
q((t>=0.50) & (t<0.60))=1; % Time history (1 * N)
Q=fft(q); % Frequency content (1 * N)
Q=Q(1:N/2); % Frequency content, positive freq (1 * N/2)
Pd=b*Q; % Nodal excitation, positive freq (nDOF * N/2)
% Figures
figure;
c=selectdof(DOF,[9.01; 13.02; 17.02]);
plot(t,c*u);
title( Nodal response (direct method in f-dom) );
xlabel( Time [s] );
xlim([0 4.1])
ylabel( Displacement [m] );
legend( 9.01 , 13.02 , 17.02 );
% Movie
figure;
animdisp(Nodes,Elements,Types,DOF,u);
% Display
disp( Maximum nodal response 9.01 13.02 17.02 );
disp( max(abs(c*u),[],2));
2.2.6 Comparison
−3 −3
x 10 x 10
5 5
9.01 9.01
13.02 13.02
4 4
17.02 17.02
3 3
] ]
m
[ m
[
t t
n 2 n 2
e e
m m
e e
c c
a
l 1 a
l 1
p p
s
i s
i
D D
0 0
−1 −1
−2 −2
0 0.5 1 1.5 2 2.5 3 3.5 4 0 0.5 1 1.5 2 2.5 3 3.5 4
Time [s] Time [s]
(a) Modal superposition in time domain (b) Modal superposition in frequency domain
−3 −3
x 10 x 10
5 5
9.01 9.01
13.02 13.02
4 4
17.02 17.02
]
m
[ 3 3
s ]
t m
n [
e t
m 2 n 2
e e
c m
a
l e
p c
s
i 1 a
l 1
d p
l s
i
a D
d
o 0 0
N
−1 −1
−2 −2
0 0.5 1 1.5 2 2.5 3 3.5 4 0 0.5 1 1.5 2 2.5 3 3.5 4
Time [s] Time [s]
(b) Direct time integration (c) Direct method in frequency domain
A barrel vault roof subjected to its self weight is analysed. The curved edges are simply supported
and the straight edges are free. Due to symmetry only a quarter of the roof is modelled and symmetry
boundary conditions are applied.
Edge 1:
symmetry
Edge 3: conditions
free
boundary
zy
x
%% Parameters
R=25; % Radius of cylindrical roof
L=50; % Length of cylindrical roof
t=0.25; % Thickness of roof
theta = 40*pi/180; % Angle of cylindrical roof
E = 4.32*10^8; % Youngs modulus
nu = 0; % Poisson coefficient
rho = 36.7347; % Density
N = 8; % Number of elements
%% Mesh
% Mesh the area between lines 1,2,3,4 with N * N elements of type shell8,
% section number 1 and material number 1.
[Nodes,Elements,Edge1,Edge2,Edge3,Edge4] = ...
makemesh(Line1,Line2,Line3,Line4,N,N,Types(1,:),1,1);
% Check mesh:
figure;
plotnodes(Nodes, numbering , off );
hold( on )
plotelem(Nodes,Elements,Types, numbering , off );
title( Nodes and elements );
% Assemble K:
K = asmkm(Nodes,Elements,Types,Sections,Materials,DOF);
%% Solution
% Solve K * U = P:
U = K\P;
% Plot displacements:
figure;
plotdisp(Nodes,Elements,Types,DOF,U)
title( Displacements )
%% Stress
90 Tutorial
% print stress:
printstress(Elements,SeGCS)
figure;
plotstresscontour( sx ,Nodes,Elements,Types,SeLCS, location , bot )
title( sx in lcs )
% Stress ratios:
ratio_sz = SnGCS2(intersect(Edge3,Edge4),16)/358420
ratio_st = SnGCS2(intersect(Edge4,Edge1),14)/(-213400)
%% Shell forces
% Nodal solution:
[FnLCS,FnLCS2]=nodalshellf(Nodes,Elements,Types,FeLCS);
figure;
plotshellfcontour( my ,Nodes,Elements,Types,FnLCS)
title( my (nodal solution) )
%% Principal stress
% Principal stresses:
[Spr,Vpr]=principalstress(Elements,SnGCS);
Tutorial: shell analysis 91
figure;
plotstresscontour( s1 ,Nodes,Elements,Types,Spr, location , bot );
title( s1 )
% plot principal stresses:
figure;
plotprincstress(Nodes,Elements,Types,Spr,Vpr)
title( principal stress directions )
92 Tutorial
zy
x
−0.1401 3.2082
−0.3401 2.8323
−0.5401 2.4564
−0.7401 2.0804
−0.9401 1.7045
−1.1401 1.3286
−1.3401 0.9527
−1.5401 zy 0.5768 zy
x x
MIN
−1.7401 0.2008 MIN
−1.9401 −0.1751
MAX
MAX
−2.1401 −0.551
(c) σxx at bottom of shell in GCS (element solution) (d) σxx at bottom of shell in LCS (element solution)
2079.965
1881.9048
1683.8446
1485.7844
1287.7242
1089.6639
891.6037
693.5435
495.4833 zy
zy
x
MAX x
297.4231
99.3629
MIN
−98.6973
This tutorial performs a geometric nonlinear analysis of an arc loaded by a point force. Several
methods are used to compute the critical buckling load.
clear
%% GEOMETRIC NONLINEAR ARC
% (Example based on p268 of Nonlinear Finite Element Methods, Wriggers (2008))
Rin = 100; % Inner radius arc
Rout = 103; % Outer radius arc
alpha = 60*pi/180; % Arc angle
E = 40000; % Young s modulus
nu = 0.2; % Poisson s coefficient
m = 6; % number of elements in radial direction
n = 150; % number of elements in tangential direction
Types = {1 plane4 }; % {EltTypID EltName}
Sections = [1 1]; % [SecID t]
Materials = [1 E nu]; % [MatID E nu]
%% MESH
npoints = 100;
theta = linspace(-alpha/2+pi/2,alpha/2+pi/2,npoints). ;
[Xin,Yin] = pol2cart(flipud(theta),Rin*ones(npoints,1));
[Xout,Yout] = pol2cart(theta,Rout*ones(npoints,1));
Yin = Yin-Rin*cos(alpha/2);
Yout = Yout-Rin*cos(alpha/2);
Z = zeros(npoints,1);
Line1 = [Xin(end) Yin(end) 0;Xout(1) Yout(1) 0];
Line2 = [Xout Yout Z];
Line3 = [Xout(end) Yout(end) 0;Xin(1) Yin(1) 0];
Line4 = [Xin Yin Z];
[Nodes,Elements,Edge1,Edge2,Edge3,Edge4] = makemesh(Line1,Line2,Line3,Line4,n,m,Types(1,:),1,1);
figure;
plotelem(Nodes,Elements,Types, numbering , off );
title( Elements );
%% DOF
DOF = getdof(Elements,Types);
sdof = [Edge1((end-1)/2+1);Edge3((end-1)/2+1)];
sdof = [sdof+0.01;sdof+0.02];
DOF = removedof(DOF,sdof);
%% LOAD
pdof = Edge2((end-1)/2+1)+0.02;
Lp = selectdof(DOF,pdof);
pmax = 1000;
P = -pmax*Lp. ;
%% LINEAR ANALYSIS
K = asmkm(Nodes,Elements,Types,Sections,Materials,DOF);
U = K\P;
%% Newton Raphson
Options.method = nr ; % Nonlinear solver: Newton-Raphson
Options.nloadincrem = 50; % Number of load increments
Tutorial: nonlinear analysis 95
hold on;
plot(-Lp*Ual,lambda_al*pmax);
plot(-Lp*Ual(:,alstability.nonpositivepivots>0),lambda_al(alstability.nonpositivepivots>0)*pmax, x- )
xlabel( U ); ylabel( P );axis tight; ax = axis;
plot([ax(1),ax(2)],[lambda(1) lambda(1)], k-- );
plot(-Lp*Unlcr,lambdanlcr*pmax, rx );
plot(-Lp*Ual2,lambda_al2*pmax, r-- )
legend( Stable path , Unstable path , Linear critical load ,...
Nonlinear critical load , Bifurcated path );
title( Load-displacement curve );
hold off;
1000
Stable path
800 Unstable path
Linear critical load
600 Nonlinear critical load
Bifurcated path
400
200
P
y 0
z x −200
−400
−600
−800
0 5 10 15 20 25 30
U
(a) Mesh (b) Nonlinear load-displacement curve
Examples
98 Examples
3.1 Example 1
A frame is clamped
clamped at node 1 and has a hinge
hinge at node 8. An intern
internal
al hinge is presen
presentt at nodes 2 and
3. At node 4 a point load
load of −20 kN is applied and at node 7 a bending
b ending momen
momentt of −1 kNm is applied.
applied.
At node 8 a vertical displacement of −0.02m is imposed.
The frame consists
consists of rectangular
rectangular concrete beams (Young’s
(Young’s modulus E = 30 × 106 kN
modulus E = kN//m2 and Poisson
coefficient ν
coefficient ν =
= 0.2) with a height of 0.
0 .4m and a width of 0.
0 .2 m.
2
3 4 5
2 3
6 7
5
9
1
1z x 8
% StaBIL
StaBIL manual
% Ex
Exam
ampl
ple
e 1
% Un
Unit
its
s: m, kN
% Nod
Nodes
es=[
=[No
NodI
dID
D X Y Z]
Nodes= [1
[1 0 0 0;
0;
2 0 4 0;
3 0 4 0;
4 4 4 0;
5 6 4 0;
6 6 3 0;
7 7 3 0;
8 6 0 0;
9 2 2 0]; % ref
refere
erence
nce nod
node
e
% Che
Check
ck the nod
node
e coo
coordin
rdinate
ates
s as fol
follow
lows:
s:
figure
plotnodes(Nodes);
plotnodes(Nodes);
% Ele
Elemen
ment
t typ
types
es -> {El
{EltTy
tTypID
pID EltName}
EltName}
Type
Types=
s= {1 beam };
b=0.20;
h=0.40;
% Mat
Materi
erials
als=[M
=[MatI
atID
D E nu]
nu];
;
Materials= [1 30e6 0.2]; % con
concre
crete
te
% Ele
Elemen
ments
ts=[E
=[EltI
ltID
D TypID
TypID SecID
SecID MatID
MatID n1 n2 n3]
Elements= [1 1 1 1 1 2 9;
2 1 1 1 3 4 9;
3 1 1 1 4 5 9;
4 1 1 1 5 6 9;
5 1 1 1 6 7 9;
6 1 1 1 6 8 9];
% Che
Check
ck ele
elemen
ment
t def
defini
initio
tions
ns as fol
follow
lows:
s:
hold(
hold( on );
plotelem(Nodes,Elements,Types);
plotelem (Nodes,Elements,Types);
title(
title( Nodes and ele
element
ments
s );
% Deg
Degree
rees
s of fre
freedo
edom
m
% Ass
Assemb
emble
le a col
column
umn matrix containi
containing
ng all DOF
DOFs
s at whi
which
ch sti
stiffn
ffness
ess is
% pr
pres
esen
ent
t in th
the
e mo
mode
del:
l:
DOF=getdof
DOF=getdof(Elements,Types);
(Elements,Types);
% Re
Remo
move
ve al
all
l DO
DOFs
Fs eq
equal
ual to ze
zero
ro fr
from
om th
the
e ve
vect
ctor
or:
:
% - 2D analys
analysis
is:
: se
selec
lect
t on
only
ly UX,UY
UX,UY,R
,ROT
OTZ
Z
% - cla
clamp no
n ode 1
% - re
remo
move
ve the horizo
horizont
ntal
al displ
displac
acem
emen
ent
t at no
node
de 8
seldof=[0.03
seldof=[0.03;; 0.04; 0.05; 1.00; 8.01];
DOF=removedof
DOF=removedof(DOF,seldof);
(DOF,seldof);
% Ass
Assemb
embly
ly of sti
stiffn
ffness
ess matrix
matrix K
K=asmkm
K=asmkm(Nodes,Elements,Types
(Nodes,Elements,Types,Sections,Materials
,Sections,Materials,DOF);
,DOF);
% No
Noda
dal
l lo
load
ads:
s: -2
-20
0 kN vert
vertic
ical
ally
ly on no
node
de 4
% -1 kNm on node 7.
seldof=[4.02
seldof=[4.02;
; 7.06];
PLoad=[-20;
PLoad=[-20; -1];
% Ass
Assemb
embly
ly of the load vec
vector
tors:
s:
P=nodalvalues
P=nodalvalues(DOF,seldof,PLoad);
(DOF,seldof,PLoad);
% Constr
Constraint
aint equati
equations
ons:
: Consta
Constant=
nt=Coef1
Coef1*DOF1
*DOF1+Coef2
+Coef2*DOF2
*DOF2+
+ ...
% Constra
Constraint
ints
s=[C
=[Cons
onstan
tant
t Coe
Coef1
f1 DOF1
DOF1 CoeCoef2
f2 DOF2
DOF2 ...]
...]
% Imp
Impose
osed
d dis
displa
placem
cement
ent -0.02 m ver
vertic
ticall
allyy in nod
nodee 8.
Constr= [0 1 2.01 -1 3.01;
0 1 2.02 -1 3.02;
-0.02 1 8 . 02 Na
N aN NaN];
% Add con
constr
strain
aintt equ
equatio
ations
ns
[K,P]=addconstr
[K,P]=addconstr(Constr,DOF,K,P);
(Constr,DOF,K,P);
% Solve K * U = P
U=K\P;
% Plot displacements
displacements
figure
plotdisp(Nodes,Elements,Types,DOF,U)
plotdisp(Nodes,Elements,Types,DOF,U)
100 Examples
% The dis
displa
placem
cement
ents
s can be dis
displa
played
yed as fol
follow
lows:
s:
printdisp(Nodes,DOF,U);
printdisp(Nodes,DOF,U);
% Com
Comput
pute
e ele
elemen
ment
t for
forces
ces
Forces=elemforces
Forces=elemforces(Nodes,Elements,Types
(Nodes,Elements,Types,Sections,Materials
,Sections,Materials,DOF,U);
,DOF,U);
% Th
The
e el
elem
emen
ent
t fo
forc
rces
es ca
can
n be di
disp
spla
laye
yed
d in a or
orde
derl
rly
y ta
tabl
ble:
e:
printforc(Elements,Forces);
printforc(Elements,Forces);
% Plo
Plott ele
elemen
ment
t for
forces
ces
figure
plotforc(
plotforc ( norm ,Nodes,Elements,Types,Forces)
title(
title( Normal forces )
figure
plotforc(
plotforc ( sheary ,Nodes,Elements,Types,Forces)
title(
title( Shear forces )
figure
plotforc(
plotforc ( momz ,Nodes,Elements,Types,Forces)
title(
title( Bending moment
moments
s )
Example 1 101
−8.823 −11.177
3.485 3.485 3.485
0.000 −11.177
0.000
−8.823 −11.177
3.2 Example 2
y
1z x 2 3 6
1 2 5
3 4
4 5
% StaBIL manual
% Example 2
% Units: m, kN
% Nodes=[NodID X Y Z]
Nodes= [1 0 0 0;
2 0.5 0 0;
3 1 0 0;
4 0 -0.25 0;
5 1 -0.25 0;
6 1.25 0 0;
7 0.3 0.4 0]; % reference node
b=0.02;
h=0.05;
A=0.0002;
% Materials=[MatID E nu];
Materials= [1 210e6 0.3]; % steel
3 2 2 1 1 4 NaN;
4 2 2 1 3 5 NaN;
5 2 2 1 3 6 NaN];
% Degrees of freedom
% Assemble a column matrix containing all DOFs at which stiffness is
% present in the model:
DOF=getdof(Elements,Types);
P=elemloads(DLoads,Nodes,Elements,Types,DOF);
% Solve K * U = P
U=K\P;
% Plot displacements
figure
plotdisp(Nodes,Elements,Types,DOF,U,DLoads,Sections,Materials)
title( Displacements )
figure
plotforc( sheary ,Nodes,Elements,Types,Forces,DLoads)
title( Shear forces )
104 Examples
figure
plotforc( momz ,Nodes,Elements,Types,Forces,DLoads)
title( Bending moments )
−5000e−6 −5000e−6
−5000e−6 −1667e−6
−1667e−6
3.3 Example 3
The frame consists of rectangular concrete beams (Young’s modulus E = 30 × 106 kN/m2 and Poisson
coefficient ν = 0.2) with a height of 0.2m and a width of 0.1 m.
6
11
8
10
12
3
15 7
5
14
7 9 6
13 10
4 2
2
8 3
z
y 5 1
9
x
4
1
% StaBIL manual
% Example 3
% Units: m, kN
% Nodes=[NodID X Y Z]
Nodes= [1 2.5 0 0;
2 2.5 5 0;
3 2.5 5 2.5;
4 2.5 0 2.5;
5 1.25 0 3.75;
6 1.25 5 3.75;
7 0 0 2.5;
8 0 5 2.5;
9 0 0 0;
10 0 5 0]; % reference node
plotnodes(Nodes);
b=0.1;
h=0.2;
% Materials=[MatID E nu];
Materials= [1 30e6 0.2]; % concrete
DOF=getdof(Elements,Types);
% Solve K * U = P
U=K\P;
% Plot displacements
figure
plotdisp(Nodes,Elements,Types,DOF,U)
title( Displacements )
figure
plotforc( sheary ,Nodes,Elements,Types,Forces(:,:,1))
title( Shear forces along the y-axis )
figure
plotforc( shearz ,Nodes,Elements,Types,Forces(:,:,1))
title( Shear forces along the z-axis )
figure
plotforc( momx ,Nodes,Elements,Types,Forces(:,:,1))
title( Torsional moments )
figure
plotforc( momy ,Nodes,Elements,Types,Forces(:,:,1))
title( Bending moments around the y-axis )
figure
plotforc( momz ,Nodes,Elements,Types,Forces(:,:,1))
title( Bending moments around the z-axis )
figure
plotforc( norm ,Nodes,Elements,Types,Forces(:,:,2))
title( Normal forces )
figure
plotforc( sheary ,Nodes,Elements,Types,Forces(:,:,2))
title( Shear forces along the y-axis )
figure
plotforc( shearz ,Nodes,Elements,Types,Forces(:,:,2))
title( Shear forces along the z-axis )
108 Examples
figure
plotforc( momx ,Nodes,Elements,Types,Forces(:,:,2))
title( Torsional moments )
figure
plotforc( momy ,Nodes,Elements,Types,Forces(:,:,2))
title( Bending moments around the y-axis )
figure
plotforc( momz ,Nodes,Elements,Types,Forces(:,:,2))
title( Bending moments around the z-axis )
3.4 Example 4
The frame consists of rectangular concrete beams (Young’s modulus E = 35 × 109 N/m2 and Poisson
coefficient ν = 0.2) with a height of 0.5m and a width of 0.2 m and concrete columns of 0.3m by
0.2 m.
205
307 206
105 206
203
303 106 308
5 203 106
103 204
6305 304 205
103 6 201 204
3 104
210
301 105310
309 306
3 201 104
101 1104 202
5 302
101 4 202
1 10 102
z
y 102
1 x
2
% StaBIL manual
% Example 4
% Units: m, kN
% Types={EltTypID EltName}
Types= {1 beam ;
2 truss };
% Sections
bCol=0.2; % Column section width
hCol=0.3; % Column section height
bBeam=0.2; % Beam section width
hBeam=0.5; % Beam section height
Atruss=0.001;
112 Examples
% Materials=[MatID E nu rho];
Materials= [1 35e9 0.2 2500; %concrete
2 210e9 0.3 7850]; %steel
L=5;
H=3.5;
B=4;
% Nodes=[NodID X Y Z]
Nodes= [1 0 0 0;
2 L 0 0]
Nodes=reprow(Nodes,1:2,2,[2 0 0 H])
Nodes=[Nodes;
10 2 0 2] % reference node
Nodes=reprow(Nodes,1:7,2,[100 0 B 0])
figure
plotnodes(Nodes);
hold( on );
plotelem(Nodes,Elements,Types);
title( Nodes and elements );
% Degrees of freedom
DOF=getdof(Elements,Types);
Example 4 113
DOF=removedof(DOF,seldof);
% Loads
% Own weight
DLoadsOwn=accel([0 0 9.81],Elements,Types,Sections,Materials);
% Wind load
DLoads= multdloads(DLoadsOwn,DLoadsWind);
P=elemloads(DLoads,Nodes,Elements,Types,DOF);
% Solve K * U = P
U=K\P;
figure
plotdisp(Nodes,Elements,Types,DOF,U(:,1),DLoads(:,:,1),Sections,Materials)
title( Displacements: own weight )
figure
plotdisp(Nodes,Elements,Types,DOF,U(:,2),DLoads(:,:,2),Sections,Materials)
title( Displacements: wind )
% Compute forces
[ForcesLCS,ForcesGCS]=elemforces(Nodes,Elements,Types,Sections,Materials,DOF,U,DLoads);
% Load combinations
% Safety factors
gamma_own=1.35;
gamma_wind=1.5;
% Combination factors
psi_wind=1;
% Load combination
U_UGT=gamma_own*U(:,1)+gamma_wind*psi_wind*U(:,2);
Forces_UGT=gamma_own*ForcesLCS(:,:,1)+gamma_wind*psi_wind*ForcesLCS(:,:,2);
DLoads_UGT(:,1)=DLoads(:,1,1)
DLoads_UGT(:,2:7)=gamma_own*DLoads(:,2:7,1)+gamma_wind*psi_wind*DLoads(:,2:7,2);
figure
plotdisp(Nodes,Elements,Types,DOF,U_UGT,DLoads_UGT,Sections,Materials)
printdisp(Nodes,DOF,U_UGT);
printforc(Elements,Forces_UGT);
% Plot stresses
figure
plotstress( snorm ,Nodes,Elements,Types,Sections,Forces_UGT,DLoads_UGT)
title( Normal stresses due to normal forces )
figure
plotstress( smomyt ,Nodes,Elements,Types,Sections,Forces_UGT,DLoads_UGT)
title( Normal stresses due to bending moments around y: top )
figure
plotstress( smomyb ,Nodes,Elements,Types,Sections,Forces_UGT,DLoads_UGT)
title( Normal stresses due to bending moments around y: bottom )
figure
plotstress( smomzt ,Nodes,Elements,Types,Sections,Forces_UGT,DLoads_UGT)
title( Normal stresses due to bending moments around z: top )
figure
plotstress( smomzb ,Nodes,Elements,Types,Sections,Forces_UGT,DLoads_UGT)
title( Normal stresses due to bending moments around z: bottom )
figure
plotstress( smax ,Nodes,Elements,Types,Sections,Forces_UGT,DLoads_UGT)
title( Maximal normal stresses )
figure
plotstress( smin ,Nodes,Elements,Types,Sections,Forces_UGT,DLoads_UGT)
title( Minimal normal stresses )
116 Examples
(a) Displacements
(a) Displacements
(a) Displacements
(b) bending moments around y: top (c) bending moments around y: bottom
(d) bending moments around z: top (e) bending moments around z: bottom
3.5 Example 5
In this example the eigenfrequencies of a simply supported rectangular plate are calculated using shell4
and compared with the theoretical solution.
% parameters
% mesh
[Nodes,Elements,Edge1,Edge2,Edge3,Edge4] = makemesh(Line1,Line2,Line3,Line4,n,m,Types(1,:),1,1);
figure;
plotnodes(Nodes);
figure;
plotelem(Nodes,Elements,Types);
DOF = getdof(Elements,Types);
sdof = [0.01;0.02;0.06;[Edge1;Edge2;Edge3;Edge4]+0.03;[Edge1;Edge3]+0.05;[Edge2;Edge4]+0.04];
DOF = removedof(DOF,sdof);
% K & M
[K,M] = asmkm(Nodes,Elements,Types,Sections,Materials,DOF);
% eigenmodes
nMode = 10;
[phi,omega] = eigfem(K,M,nMode);
figure;
animdisp(Nodes,Elements,Types,DOF,phi(:,1));
% analytical solution
[mm,nn] = meshgrid((1:m),(1:n));
aomega = sqrt(E*t^2/(12*(1-nu^2)*rho))*((mm*pi/Lx).^2+(nn*pi/Ly).^2);
Example 5 121
aomega = reshape(aomega,numel(aomega),1);
aomega = sort(aomega);
ratio = omega./aomega(1:nMode)
3.6 Example 6
A thin disk with a circular hole is subjected to uniaxial tension. The stress concentration around the
hole is examined.
% define lines
Line1 = [r 0 0;L/2 0 0];
Line2 = [L/2 0 0;L/2 L/2 0;0 L/2 0];
Line3 = [0 L/2 0;0 r 0];
Line4 = [r*sin((0:5). *pi/10) r*cos((0:5). *pi/10) zeros(6,1)];
[Nodes,Elements,Edge1,Edge2,Edge3,Edge4] = makemesh(Line1,Line2,Line3,Line4,...
m,n,Types(1,:),Sections(1,1),Materials(1,1), L2method , linear );
% Check mesh:
figure;
plotnodes(Nodes, numbering , off );
hold( on )
plotelem(Nodes,Elements,Types, numbering , off );
title( Nodes and elements );
% Assemble K:
K = asmkm(Nodes,Elements,Types,Sections,Materials,DOF);
% plot results
figure;
Example 6 123
plotstresscontourf( sx ,Nodes,Elements,Types,SnGCS)
title( \sigma_{r} )
figure;
plotstresscontourf( sy ,Nodes,Elements,Types,SnGCS)
title( \sigma_{\theta} )
figure;
plotstresscontourf( sxy ,Nodes,Elements,Types,SnGCS)
title( \sigma_{r\theta} )
(a) σθ (b) σr
(c) σrθ
3.7 Example 7
clear;
%% Geometric nonlinear truss with multiple snap-throughs
% based on example on p281 of Non-linear Modeling and Analysis of Solids
% and Structures, Krenk (2008)
h = 1; % Height truss
ll = 1.697; % Lower length
hl = 1.414; % Upper length
w = 2; % Width
Sections = [1 1];
Materials = [1 1 1 1];
Types = {1 truss };
nElem = size(Elements,1);
Elements = [(1:nElem). ,ones(nElem,3),Elements];
figure;
plotnodes(Nodes);
hold on;
plotelem(Nodes,Elements,Types);
hold off;
title( Nodes and Elements );
% BOUNDARY CONDITIONS
DOF = getdof(Elements,Types);
seldof = [(1:6)+0.01,(1:6)+0.02,(1:6)+0.03]. ;
DOF = removedof(DOF,seldof);
% POINT LOAD
seldof = (7:9)+0.03;
L = selectdof(DOF,seldof);
P = L . *[-1.5;-1;-1.5];
% LINEAR ANALYSIS
K = asmkm(Nodes,Elements,Types,Sections,Materials,DOF);
U = K\P;
% ARC-LENGTH CONTROL
Options.arclength = on ;
Options.maxoiter = 3000; % maximum number of arc-length steps
Options.initdl = 0.05; % Initial arc-length
[Ual,K,lambda_al] = nlsolver(Nodes,Elements,Types,Sections,Materials,DOF,P,[],Options);
% PLOT RESULTS
figure
plotdisp(Nodes,Elements,Types,DOF,U, dispscal ,1);
title( Linear small displacements )
figure
plotdisp(Nodes,Elements,Types,DOF,Unr(:,end), dispscal ,1);
title( Nonlinear large displacements )
v=axis;
figure
subplot(2,2,1)
plotdisp(Nodes,Elements,Types,DOF,[Ual(:,end),Unr(:,end)], dispscal ,1, dispmax , off );
subplot(2,2,2)
plot(-Lw*Ual,lambda_al,-Lw*Unr,lambda_nr);
axis([-0.5 2.5 -0.1 0.1]);xlabel( w );ylabel( P );
subplot(2,2,3)
plot(-Lv*Ual,lambda_al,-Lv*Unr,lambda_nr);
axis([-0.5 2.5 -0.1 0.1]);xlabel( v );ylabel( P );
subplot(2,2,4)
plot(-Lw*Ual,-Lv*Ual,-Lw*Unr,-Lv*Unr);
axis([-0.5 2.5 0 2]);xlabel( w );ylabel( v );
7
11 18
4 8
16
8 3 12 19
5 14 5 9
17
1 9
4 13
6 15 6
1 z
y 10
2 x
7
2
3
0.08
0.06
0.04
0.02
λ 0
−0.02
−0.04
−0.06
−0.08
−0.1
−0.5 0 0.5 1 1.5 2 2.5
w
(c) Vertical load-displacement curve
accel.tex p. 4
accel_beam.tex p. 24
accel_shell4.tex p. 51
accel_shell8.tex p. 61
accel_truss.tex p. 33
addconstr.tex p. 3
animdisp.tex p. 14
asmkm.tex p. 2
b_shell8.tex p. 59
cdiff.tex p. 19
coord_beam.tex p. 26
coord_shell4.tex p. 54
coord_shell8.tex p. 62
coord_truss.tex p. 35
disp_beam.tex p. 26
disp_shell4.tex p. 55
disp_shell8.tex p. 62
disp_truss.tex p. 35
dispgcs2lcs_beam.tex p. 27
dispgcs2lcs_truss.tex p. 36
dof_beam.tex p. 22
dof_shell4.tex p. 48
dof_shell8.tex p. 58
dof_truss.tex p. 32
eigfem.tex p. 18
elemdisp.tex p. 5
elemforces.tex p. 5
elemloads.tex p. 4
elempressure.tex p. 39
elemshellf.tex p. 39
elemstress.tex p. 39
fdiagrgcs_beam.tex p. 28
fdiagrgcs_truss.tex p. 36
fdiagrlcs_beam.tex p. 28
128 Functions — Alphabetical list
forces_beam.tex p. 24
forces_truss.tex p. 34
forceslcs_beam.tex p. 25
forceslcs_truss.tex p. 34
gaussq.tex p. 40
getdof.tex p. 2
getmovie.tex p. 15
grid_shell4.tex p. 56
grid_shell8.tex p. 63
ke_beam.tex p. 22
ke_dkt.tex p. 50
ke_shell4.tex p. 48
ke_shell8.tex p. 58
ke_truss.tex p. 32
kelcs_beam.tex p. 22
kelcs_shell4.tex p. 49
kelcs_truss.tex p. 32
kenl_kbeam.tex p. 70
kenl_plane4.tex p. 69
kenl_truss.tex p. 69
ldlt.tex p. 20
lincrpoint.tex p. 67
loads_beam.tex p. 23
loads_shell4.tex p. 52
loads_shell8.tex p. 61
loads_truss.tex p. 33
loadslcs_beam.tex p. 24
loadslcs_shell4.tex p. 52
makemesh.tex p. 41
msupf.tex p. 18
msupt.tex p. 18
nedloadlcs_beam.tex p. 26
nelcs_beam.tex p. 25
newmark.tex p. 19
nlincrpoint.tex p. 67
nlincrpoint2.tex p. 68
nlsolver.tex p. 66
nodalshellf.tex p. 42
nodalstress.tex p. 42
nodalvalues.tex p. 4
patch_shell4.tex p. 56
patch_shell8.tex p. 63
plotdisp.tex p. 11
plotelem.tex p. 10
plotforc.tex p. 11
plotlcs.tex p. 12
plotnodes.tex p. 10
plotprincstress.tex p. 43
plotshellfcontour.tex p. 43
plotshellfcontourf.tex p. 44