here is a useful script for doing static analysis, with some useful options.
It may seem complicated, but i think it is pretty handy.
This script requires careful review, you may need to modify it to satisfy your model. i used it for a single degree-of-freedom problem (see bottom).
The script should be self explanatory. As you can see, you need to define variables ahead of time.
here is the main script, I call the file analysisStatic.tcl:
as you can see, this file calls the procedure-defining file: libStaticAnalysis.tcl, please note that there are two procedure in this file:# ------------------------------------------------------------------
# AnalysisStatic.tcl
# Silvia Mazzoni, 2006
#
source libStaticAnalysis.tcl
if {$AnalysisTypeTXT=="Push" } {
set iDmaxCycl 0.11
set fact $Lcol
set CycleType Push
set Ncycles 1
} elseif {$AnalysisTypeTXT=="Cycl" } {
set iDmaxCycl "[expr 0.001] [expr 0.005] [expr 0.01] [expr 0.025] [expr 0.05] [expr 0.075] [expr 0.09] [expr 0.11]"
set fact $Lcol
set CycleType Full
set Ncycles 1
} else {
puts "No Analysis Type Specified"
return
}
# create load pattern for lateral loads
pattern Plain $loadIDstatic Linear {
foreach IDpushNode $iIDpushNode PushNodeFact $iPushNodeFact {
set Hload [expr $Weight*$PushNodeFact]
load $IDpushNode $Hload 0.0 0.0 0.0 0.0 0.0
}
}
procStaticAnalysis $iDmaxCycl $IDctrlNode $IDctrlDOF $CycleType $Ncycles $fact
here is an example of where i use it for a cantilever column:# ------------------------------------------------------------------
# libStaticAnalysis.tcl: static push or cyclic lateral-load cycles
# Silvia Mazzoni, 2006
proc procGenPeaks {Dmax Nsteps {CycleType "Full"} {Fact 1} } {; # generate peaks for full Cycles
file mkdir data
set outFileID [open data/tmpDsteps.tcl w]
set Disp 0.
puts $outFileID "set iDstep { "
puts $outFileID $Disp
puts $outFileID $Disp
set Dmax [expr $Dmax*$Fact]; # scale value
set dx [expr $Dmax/$Nsteps]
for {set i 1} {$i <= $Nsteps} {incr i 1} {; # zero to one
set Disp [expr $Disp + $dx]
puts $outFileID $Disp
}
if {$CycleType !="Push"} {
for {set i 1} {$i <= $Nsteps} {incr i 1} {; # one to zero
set Disp [expr $Disp - $dx]
puts $outFileID $Disp
}
if {$CycleType !="HalfCycle"} {
for {set i 1} {$i <= $Nsteps} {incr i 1} {; # zero to minus one
set Disp [expr $Disp - $dx]
puts $outFileID $Disp
}
for {set i 1} {$i <= $Nsteps} {incr i 1} {; # minus one to zero
set Disp [expr $Disp + $dx]
puts $outFileID $Disp
}
}
}
puts $outFileID " }"
close $outFileID
source data/tmpDsteps.tcl
return $iDstep
}
# ------------------------------------------------------------------
# run different analyses to find convergence for displacement-driven analysis
proc procConvergeStatic {ok} {
# if analysis fails, we try some other stuff
# performance is slower inside this loop
if {$ok != 0} {
puts "Trying Newton with Initial Tangent .."
test NormDispIncr 1.0e-6 200 0
algorithm Newton -initial
set ok [analyze 1]
test NormDispIncr 1.0e-6 20 0
algorithm Newton
}
if {$ok != 0} {
puts "Trying NewtonWithLineSearch .."
algorithm NewtonLineSearch .8
set ok [analyze 1]
algorithm Newton
}
return $ok
}
#--------------------------------------------------------------------------------------#
proc procStaticAnalysis {iDmaxCycl IDctrlNode IDdof {CycleType "Full"} {Ncycles 1} {Fact 1} } {
foreach Dmax $iDmaxCycl {
set iDstep [procGenPeaks $Dmax [set Nsteps 50] $CycleType $Fact]; # this proc is defined above
for {set i 1} {$i <= $Ncycles} {incr i 1} {
set zeroD 0
set D0 0.0
foreach Dstep $iDstep {
set D1 $Dstep
set Dincr [expr $D1 - $D0]
# set up analysis parameters
set Tol 1.0e-6
constraints Plain; # how it handles boundary conditions
numberer Plain; # renumber dof's to minimize band-width (optimization), if you want to
system BandGeneral
test NormDispIncr $Tol 6; # tolerance, max no. of iterations, and print code , 1: every iteration
algorithm Newton;# use Newton's solution algorithm: updates tangent stiffness at every iteration
integrator LoadControl 0.1 1 0.1 0.1; # variable load-stepping: Do initial incr., desred no. of iterations to converge, Dmax, Dmin
analysis Static
integrator DisplacementControl $IDctrlNode $IDdof $Dincr
set ok [analyze 1]
if {$ok != 0} {
# set inFileIDa [open Data/Log.txt a]; puts $inFileIDa FailedToConverge;close $inFileIDa
set ok [procConvergeStatic $ok]; # this proc is defined above
if {$ok != 0} {
return -1
}
}; # end if statement
set D0 $D1
}; # end Dstep
}; # end i
}; # end of iDmaxCycl
return $ok
}
# --------------------------------------------------------------------------------------------------
# buildCantilever.tcl: generates frame nodes/materials/sections/elements
# by Silvia Mazzoni, 2005
#
# ^Y
# |
# _ node 2
# | |
# | |
# | |
# | Lcol
# | |
# | |
# | |
# === - node 1 ---------->X
#
#
wipe; # clear memory of all past model definitions
# Define the model builder
model BasicBuilder -ndm 2 -ndf 3
# define element geometry
set Lcol [expr 36*$ft]; # column length
# Define nodes
# tag X Y
node 1 0 0
node 2 0 $Lcol
set IDdispNode 2; # define displacement output node
set IDbaseNode 1; # define base node
set IDctrlNode 2; # define control node for pushover analysis and stuff
set iIDpushNode {2}; # define control node for pushover analysis -- lateral load application
set iPushNodeFact { 1.0 }; # scale factor for lateral load at this story.
set Lpush $Lcol; # define building height for pushover drift
set IDctrlDOF 1; # lateral dof
# Single point constraints -- Boundary Conditions
# node DX DY RZ
fix 1 1 1 1
...... define elements and such....
source AnalysisStatic.tcl