Open Sees Workshop
Open Sees Workshop
http://opensees.berkeley.edu/OpenSees/workshops/OpenSeesWorkshop.pdf
                           Frank McKenna
                            UC Berkeley
             Outline of Workshop
•    Introduction to OpenSees Framework
•    OpenSees & Tcl Interpreters
•    OpenSees & Output
•    Modeling in OpenSees
•    Nonlinear Analysis in OpenSees
•    Basic Examples
•    Parallel & Distributed Processing
•    OpenSees on NEEShub
•    Hands on Exercise
•    Adding Your Code to OpenSees
•    Advanced Model Development
•    Conclusion
  What is Purpose of Simulation?
                                             New Element
                                 New Material
                                                     Information Technology
                                                 Database, Visualization, Frameworks,
                                                                                             Building Blocks for Modern Simulation Code
350
250
200
150
                                                                     100
 Panagiotis Galanis & Jack Moehle                                    50
                                                                      0
                                                                           0   2   4   6        8      10     12   14   16   18
                                                                                           Number of processors
               As-
               built
                RC
                                   Steel Column
17
                                    Kyoto/Berkeley
                 New Directions:
1. Optimization
J. Conte & P.Gill (UCSD), Q.Gu (Xiaman)
ElementRecorder              DataOutputHandler
NodeRecorder
EnvelopeNodeRecorder
EnvelopElementRecorder
DatabaseRecorder
                                 StandardStream
                                 FileStream
                                 XML_FileStream
                                 TCP_Stream
                                 DatabaseHandler   Database
                                                   File
                                                   MySQL
                                                   Oracle
                     What is in a Domain?
                                             Domain
                                                               Aggregation/Collection-of
                                                             Plain
Truss                                                        Uniform
ZeroLength                                                   MultiSupport
ElasticBeamColumn
NonlinearBeamColumn(force, displacement)
BeamWithHinges                                                                               Constant
Quad(std, bbar, enhanced, u-p)
                                      ElementalLoad        NodalLoad        SP_Constraint
                                                                                             Linear
Shell                                                                                        Rectangular
Brick(std, bbar, 20node, u-p, u-p-U)                                                         Sine
Joint                                                                                        Path
GenericClient
                                         BeamPointLoad
(>100 element classes)                   BeamUniformLoad
                                         BeamTempLoad
 Some Other Classes associated with Elements:
Material GeomTransformation
                                                                                          AnalysisModel
                                                        StaticAnalysis
                                                        TransientAnalysis
                          sum of 2 and 3 is 5
                      What is Tcl
•  Tcl is a dynamic programming language
    •    It is a string based command language.
    •    Variables and variable substitution
    •    Expression evaluation
    •    Basic control structures (if , while, for, foreach)
    •    Procedures
    •    File manipulation
    •    Sourcing other files.
               Tcl Syntax Rules
     (rules that define combinations that
     give a correctly structured program)
                # This is a comment
•  Some people suggest writing comments
   before you write any code.
•  Judicious use of comments, try to avoid to
   comment trivial things, like:
               set a 5; # setting a to 5
 Variables & Variable Substitution
•  A variable is a symbolic name used to refer to
   some location in memory that has a value; the
   separation of name and value allows the value
   to be used independently of exact value.
•  In Tcl to create a variable use set command.
            set a 2.0
•  To use the value of the variable use a $
            set b $a
•  Use descriptive names
            set PI 3.14159
                           puts
•  puts is the command to produce output.
•  The last argument is string to be output.
•  Result sent to screen, unless the optional file id
   is provided.
            puts <$fileID> string
puts $a >2
                                          ?
         set outFile [open test.out w]
         set fileData [read $inFile]
         puts $outFile $fileData
         close $inFile; close $outFile;
•  The file command provides several operations for
   working with the file system. Of form:
  file option name $arg1 $arg2 ..
                                      StaticAnalysis
                                      TransientAnalysis
•  Developers
  http://opensees.berkeley.edu/wiki/index.php/OpenSees_Developer
  http://opensees.berkeley.edu/cgi-bin/cvsweb2.cgi/OpenSees/SRC/
             Outline of Workshop
•    Introduction to OpenSees Framework
•    OpenSees & Tcl Interpreters
•    OpenSees & Output
•    Modeling in OpenSees
•    Nonlinear Analysis in OpenSees
•    Basic Examples
•    Parallel & Distributed Processing
•    OpenSees on NEEShub
•    Hands on Exercise
•    Adding Your Code to OpenSees
•    Advanced Model Development
•    Conclusion
                   Output Options
                           When you run OpenSees:
ElementRecorder
NodeRecorder                 DataOutputHandler
EnvelopeNodeRecorder
EnvelopElementRecorder
DatabaseRecorder
                                 StandardStream
                                 FileStream
                                 XML_FileStream
                                 TCP_Stream
                                 DatabaseHandler   Database
                                                   File
     recorder $type $arg1 $arg2 $arg3 ….           MySQL
                                                   Oracle
  Element/EnvelopeElement Recorders
• To monitor what’s happening in the elements.
recorder Element <-file $fileName> <-time> <-ele $tg1 $tg2 …>    $arg1 $arg2 …
                 <-xml $fileName>          <-eleRange $tgS $tgE>
                 <-binary $fileName>       <-region $rTag>
                 <-tcp $inetAddr>
• The response you can ask vary from element to element. There are
 of course some each element will respond to, e.g. forces.
recorder Element -file ele.out -ele 1 2 forces
Example:
   recorder Node -file nodeD.out -node 2 -dof 1 2 3 disp
  recorder EnvelopeNode   <-file $fileName><-timeSeries $tsTag> <-time> <-node $tg1 $tg2 …> -dof $d1 $d2 .. disp
                          <-xml $fileName>                            <-nodeRange $tgS $tgE>                 vel
                          <-binary $fileName>                           <-region $rTag>                  accel
                          <-tcp $inetAddr>                                                             incrDisp
                                                                                                       reaction
Example using recorders(sdofExample2.tcl)
# create model & analysis
…
#create recorders
recorder Node -file node1.out -time -node 2 -dof 1 disp
recorder Element -file ele1.out -time -ele 1 material stress
#perform analysis
while {$ok == 0 && $t < $maxT} {
   set ok [analyze 1 $dT]
   set time [getTime]
   set d [nodeDisp 2 1]
   if {$d > $maxD} {
      set maxD $d
   } elseif {$d < [expr -$maxD]} {
      set maxD [expr -$d]
 }
   set t [expr $t + $dT]
}
puts "record: $record period: $Tn damping ratio: $dampRatio max disp: $maxD"
wipe
             Outline of Workshop
•    Introduction to OpenSees Framework
•    OpenSees & Tcl Interpreters
•    OpenSees & Output
•    Modeling in OpenSees
•    Nonlinear Analysis in OpenSees
•    Basic Examples
•    Parallel & Distributed Processing
•    OpenSees on NEEShub
•    Hands on Exercise
•    Adding Your Code to OpenSees
•    Advanced Model Development
•    Conclusion
To develop a model capable of producing a credible
prediction of the behavior of an existing/proposed
structure. How complicated a model is required
of our structure?
Nonlinear Structural Beam-Column Models
iNode jNode
                                         source: wikipedia
                                                                    50        100
model Basic -ndm 2 -ndf 2                                      4
#node $tag $xCrd $yCrd                           8’
node 1 0.0 0.0                                            (1)      (2)         (3)
node 2 144.0 0.0
node 3 168.0 0.0                                      1                        2          3
node 4 72.0 96.0                                          6’             6’          2’
#fix $nodeTag $xFix $yFix                                              E            A
fix 1 1 1                                                          1 3000           10
fix 2 1 1                                                          2 3000            5
fix 3 1 1                                                          3 3000            5
#uniaxialMaterial Elastic $tag $E              timeSeries Linear 1
uniaxialMaterial Elastic 1 3000.0              #pattern Plain $tag $tsTag
                                               pattern Plain 1 1 {
#element truss $tag $iNode $jNode $A $matTag     #load $nodeTag $xForce $yForce
element truss 1 1 4 10.0 1                       load 4 100.0 -50.0
element truss 2 2 4 5.0 1                      }
element truss 3 3 4 5.0 1
The SCRIPTS you are submitting
           to OpenSees
        are PROGRAMS
you are submitting to a powerful
       INTERPRETER ..
     SO LETS START
    PROGRAMMING!
THINK Before You Type
                     Steel W Sections &
                        Regular Grid
col line                                            col line
 1         2         3           4           5         6
                                                               Floor 4
           24
                                                               Floor 3
                                 43
                                 42           52               Floor 2
                                      4252
                                             5152               Floor 1
  11
# add nodes at each floor at each column line location & fix nodes if at floor 1
foreach floor {1 2 3 4} floorLoc $floorLocs massX $massesX massY $massesY {
   foreach colLine {1 2 3 4 5 6} colLoc $colLocs {
      node $colLine$floor $colLoc $floorLoc -mass $massX $massY 0.
      if {$floor == 1} {fix $colLine$floor 1 1 1}
    }
}
#uniaxialMaterial Steel02 $tag $Fy $E $b $R0 $cr1 $cr2
uniaxialMaterial Steel02 1 50.0 29000. 0.003 20 0.925 0.15; ; # material to be used for steel elements
# set some list for col and beam sizes
 set colSizes {W14X370 W14X370 W14X211}; #col sizes stories 1, 2 and 3
 set beamSizes {W33X141 W33X130 W27X102}; #beams sizes floor 1, 2, and 3
# add columns at each column line between floors
geomTransf PDelta 1
foreach colLine {1 2 3 4 5 6} {
   foreach floor1 {1 2 3} floor2 { 2 3 4} {
      set theSection [lindex $colSizes [expr $floor1 -1]]; # obtain section size for column
      ForceBeamWSection2d $colLine$floor1$colLine$floor2 $colLine$floor1 $colLine$floor2 $theSection 1 1 –nip 5
   }
 }
#add beams between column lines at each floor
geomTransf Linear 2
foreach colLine1 {1 2 3 4 5} colLine2 {2 3 4 5 6} {
    foreach floor {2 3 4} {
      set theSection [lindex $beamSizes [expr $floor -2]]; # obtain section size for floor
      ForceBeamWSection2d $colLine1$floor$colLine2$floor $colLine1$floor $colLine2$floor $theSection 1 2
   }
}
Steel2.tcl – contains a library of procedures
  #WinXlb/f "Area(in2) d(in) bf(in) tw(in) tf(in) Ixx(in4) Iyy(in4)"
  array set WSection {
     W44X335 "98.5 44.0 15.9 1.03 1.77 31100 1200 74.7"
     W44X290 "85.4 43.6 15.8 0.865 1.58 27000 1040 50.9"
     W44X262 "76.9 43.3 15.8 0.785 1.42 24100 923 37.3"
     W44X230 "67.7 42.9 15.8 0.710 1.22 20800 796 24.9"
     W40X593 "174 43.0 16.7 1.79 3.23 50400 2520 445"
     W40X503 "148 42.1 16.4 1.54 2.76 41600 2040 277”
   …
  }
 proc ElasticBeamWSection2d {eleTag iNode jNode sectType E transfTag {Orient XX}} {
    global WSection
    global in
    set found 0
    foreach {section prop} [array get WSection $sectType] {
       set propList [split $prop]
       set A [expr [lindex $propList 0]*$in*$in]
       set Ixx [expr [lindex $propList 5]*$in*$in*$in*$in]
       set Iyy [expr [lindex $propList 6]*$in*$in*$in*$in]
       if {$Orient == "YY" } {
          element elasticBeamColumn $eleTag $iNode $jNode $A $E $Iyy $transfTag
       } else {
          element elasticBeamColumn $eleTag $iNode $jNode $A $E $Ixx $transfTag
      }
    }
 }
proc ForceBeamWSection2d {eleTag iNode jNode sectType matTag transfTag args} {
    global FiberSteelWSection2d
    global ElasticSteelWSection2d
    set nWeb 4
    if {[lsearch $args "-nWeb"] != -1} {
       set loc [lsearch $args "-nWeb"]
       set nWeb [lindex $args [expr $loc+1]]
    }
    set nip 4
    if {[lsearch $args "-nip"] != -1} {
       set loc [lsearch $args "-nip"]
                  set nip [lindex $args [expr $loc+1]]
    }
                                                                                           Solver
                                               Static
                                               Transient
                                               VariableTransient
    • Plain Numberer
       nodes are assigned dof arbitrarily   numberer Plain
    • RCM Numberer
       nodes are assigned dof using the     numberer RCM
       Reverse Cuthill-McKee algorithm
   • AMD Numberer
       nodes are assigned dof using the     numberer AMD
       Approx. MinDegree algorithm
algorithm Newton
                             theIntegrator->formTangent();
                             theSOE->solve()
                             theIntegrator->update(theSOE->getX());
                             theIntegrator->formUnbalance();
  (Newton-Raphson)         } while (theTest->test() == fail)
                            MORE ITERATIONS
                            BUT ONE FACTOR
algorithm NewtonLineSearch
•  Adds line search algorithm to the search algorithm
algorithm KrylovNewton
 •  A quasi-newton method – in which
    approximations of the inverse matrix are made
    from displacement vectors of previous trial
    steps. "Nonlinear Finite Element Procedures” K.J.Bathe
               DISCLAIMER
All those functions were nice smooth continuous
functions. We model with material discontinuities,
contact, … and thus are NOT SMOOTH ..
CONVERGENCE IS NOT GAURANTEED ..
CONVERGENCE TO CORRECT SOLUTION IS
NOT GAURANTEED.
constraints command:
         - to specify how the constraints are enforced
                 Uc = Crc Ur
                CU=0                    [Cr Cc]^[Ur Uc] = 0
               T Ur = [Ur Uc]^
 • Transformation Handler
                      K*=T^KT              constraints Transformation
       K* Ur = R*
                      R*=T^R
     in OpenSees currently don’t allow retained node in one
     constraint to be a constrained node in another constraint
 • Lagrange Handler
       K C^ U       R
                                              constraints Lagrange
       C 0    λ = Q
 • Penalty Handler
     [K + C^αC] U = [R + C^αQ]               constraints Penalty αsp?αmp?
system command:
  - to specify how matrix equation KU = R is stored and solved
 • Profile Symmetric Positive Definite (SPD)
                                   system ProfileSPD
 • Banded Symmetric Positive Definite
                                   system BandSPD
  • Banded General
                                    system BandGeneral
                                                    U                         U
                    U
                                         ΔU
                 Transient Integrators
•    Explicit:
     Dn+1 = f(Pn, Dn, Vn, An, Dn-1, Vn-1, An-1, …)
     integrator CentralDifference
     integrator NewmarkExplicit $gamma
     integrator HHTExplicit $alpha
     ….
     1. all Need Linear Algorithm
      2. in absence of damping all require Positive Definite mass matrix.
•    Implicit
      Dn+1= f(Vn+1,An+1, Dn, Vn, An , Dn-1, Vn-1, An-1, …)
     integrator Newmark $gamma $beta
     integrator HHT $alpha
     integrator TRBDF2
     …
            Stability & Linear Systems
•  Stability (bounded solution) and Accuracy are the most talked
   about properties of transient integration schemes.
•  For most integration schemes, the stability and accuracy provisions
   you read about are provided FOR LINEAR DYNAMICAL
   SYSTEMS.
•  Conditionally Stable: numerical procedure leads to a BOUNDED
   solution if time step is smaller than some stability limit.
   Conditional stability requires time step to be inversely proportional
   to highest frequency.
•  Unconditionally Stable: solution is bounded regardless of the time
   step.
           Stability Limits Common
                   Integrators
Central Difference is conditionally stable if:
                                         (.318)
Newmark is unconditionally stable if:
                                                                                               }
                                                                                                          Neither Types
                2.  Enforced Conservation of Energy
                3.  Algorithmic Conservation of Energy                                                    Are Available
                                                                                                          in OpenSees
         Dissipation Algorithms
•  They were developed for large linear systems where
   typically only the low modes of response are of interest
   and the engineer wants to remove the high frequency noise
   (sometimes you don’t want to do this!)
•  These controlled dissipation of high frequency modes is
   used in an ATTEMPT to conserve energy.
•  For nonlinear systems they do not guarantee the dissipation
   of enough energy to always satisfy the conservation of
   energy.
•  EXAMPLES: Newmark (γ > 0.5), HHT, TRBDF2,
   TRBDF3
Numerical Dissipation: dT/Tn = 0.01   (ex2.tcl)
Numerical Dissipation: dT/Tn = 0.1   (ex2.tcl)
Numerical Dissipation: dT/Tn = 0.25   (ex2.tcl)
                      Example
(see “Dynamics of Structures” A.K. Chopra, section 3.1)
T/Tn = 0.1; dT/Tn = 0.01   (ex3.tcl)
T/Tn = 0.1; dT/Tn = 0.1   (ex3.tcl)
T/Tn = 0.1; dT/Tn = 0.3   (ex3.tcl)
                            Remember
•    Rayleigh Damping will can also be used to provide numerical damping
For a dT=0.001
Newmark Average Acceleration and HHT 0.9 failed
HHT 0.6, TRBDF2, and Newmark 0.6 0.3025 worked
Max recorded roof displacements: 6.03, 5.88, 5.87 respectively
analysis command:
   • Static Analysis                         analysis Static
  • Transient Analysis        analysis Transient
   - both incremental solution strategies
StaticAnalysis TransientAnalysis
analyze() analyze()
       for (int i=0; i<numIncr; i++) {                         for (int i=0; i<numIncr; i++) {
         theIntegrator->newStep();                               theIntegrator->newStep(dt);
         theAlgorithm->solveCurrentStep();                       theAlgorithm->solveCurrentStep();
         theModel->commit();                                     theModel->commit();
       }                                                       }
  • Eigenvalue
    § general eigenvalue problem
                (K-λM)Φ=0        eigen numModes? -general
    § standard eigenvalue problem
                 (K-λ)Φ=0        eigen numModes? -standard
analyze command:
             - to perform the static/transient analysis
• Static Analysis
• Transient Analysis
                        }
                          theModel->commit();                 analyze numIter? Δt?
     Example Static Analysis:
• Static Nonlinear Analysis with LoadControl
           constraints Transformation
           numberer RCM
           system BandGeneral
           test NormDispIncr 1.0e-6 6 2
           algorithm Newton
           integrator LoadControl 0.1
           analysis Static
           analyze 10
                              StaticAnalysis
DirectIntegrationAnalysis
• Email: fmckenna@ce.berkeley.edu
50
E (30000)
                           Models
       Material, Element
 Information Technology
Database, Visualization, Frameworks,
  Parallel & Grid/Network libraries
                                       Building Blocks for Simulation
                   Bell’s Law
Bell's Law of Computer Class formation
    was discovered about 1972. It states that
    technology advances in semiconductors,
    storage, user interface and networking advance
    every decade enable a new, usually lower
    priced computing platform to form. Once
    formed, each class is maintained as a quite
    independent industry structure. This explains
    mainframes, minicomputers, workstations and
    Personal computers, the web, emerging web
    services, palm and mobile devices, and
    ubiquitous interconnected networks.
                         GPU &
                       CO-Processors
STEVE JOBS KEYNOTE WWDC 2011
                              Some people think the cloud is just
                                  A hard drive in the sky!
•  Research
  –  All of the above PLUS
  –  Dedicated High Performance Computers
  –  Grid (BOINC, OPEN SCIENCE GRID, ….)
  –  NEEShub (http://nees.org)
     What is a Parallel Computer?
•  A parallel computer is a collection of processing
   elements that cooperate to solve large problems fast.
                                                            File
  CPU               CPU                         CPU        System
communication
                                                            File
                                                           System
           Memory                 Memory
            HPC Performance
              Projections                   10e6 to 100e6
                                               Cores!
1 Eflop/s
N=500
8-10 years
                                                   2019
                                                 page 163
                                 Source:Jack Dongarra, 2011
           Why should you care?
•  They will save you time
•  They will allow you to solver larger problems.
•  They are here whether you like it or not!
            HPC available through NEEShub
                                    §  Kraken (Tennessee)
                                        §  Nodes: 9,408
                                        §  Cores: 112,896
                                        §  Memory: 142TB
                                        §  Peak: 1.17PFlops
                                        §  Disk: 3.3PB
                                   §  Stampede (Texas)
                                       §    Nodes: 6,400
                                       §    Cores: 102,400
                                       §    Memory: 205TB
                                       §    Peak: 9.5PFlops
                                       §    Disk: 14PB
    BEFORE YOU GET ALL EXCITED
          Speedup & Amdahl’s Law
                                     Time(1)
                   speedupPC ( p ) =
                                     Time( p )
                             T1           1
      SpeedupPC     =                    → as n → ∞
                             (1 − α )T 1  α
                      αT 1 +
                                  n
                                                  Teraflops
●    now as little as 5-10% on parallel                                          Performance
                                                                 10
     supercomputers of today                                                         Gap
Close the gap through ...
●    Mathematical methods and algorithms that          1
     achieve high performance on a single
                                                              Real Performance
     processor and scale to thousands of
     processors                                       0.1
                                                       1996     2000      2004
●    More efficient programming models and tools
     for massively parallel supercomputers       Source: Jim Demmell, CS267
                                                                                 166"
                                                  Course Notes
              What is OpenSees?
PartitionedDomain
                                                 NonlinearBeamColumn
                                                 BeamWithHinges          Subdomain
                                                 Quad (std, bbar,)
ElementalLoad      NodalLoad   SP_Constraint     Brick (std, bbar)
                                                 Shell
GraphPartitioner DomainPartitioner
                                                   Metis                       LoadBalancer
                               Analysis Classes
  MovableObject                          Analysis
 sendSelf(Channel, ..)
 recvSelf(Channel, ..)
                                                    StaticAnalysis      DomainDecompAnalysis
                                                    TransientAnalysis
     P1       P2                  Pn-1
        Modified Commands
•  System command is modified to accept new
   parallel equation solvers
   system Mumps
   system Diagonal
Model Built and Analysis Constructed in
P0                                    #build the model
                                      source model.tcl
                                      #build the analysis
                                      system Mumps
                                      constraints Transformation
                                      numberer Plain
                                      test NormDispIncr 1.0e-12 10 3
 Single interpreter running on P0     algorithm Newton
                                      integrator LoadControl
 Interpreting the input file          analysis Static
P0                                                                     P1
                                                LoadControl
      Domain                                    Newton
                               Analysis                                P2
                                                 Mumps
                                                                       P3
     #build the model
     source modelP.tcl
     #build the analysis
     system Mumps
     constraints Transformation
     numberer Plain
     test NormDispIncr 1.0e-12 10 3
     algorithm Newton
     integrator LoadControl
     analysis Static
     analyze 10
P0             P1
                                       Analysis
                         P1
P2                                                =
       P3                         Analysis
                         P3
        Example Results:
    Humboldt Bay Bridge Model
                                                        350
250
200
150
100
50
                                                         0
                                                              0   2   4   6        8      10     12   14   16   18
100,000+ DOF Model                                                            Number of processors
 Implicit Integration
Mumps Direct Solver
      Effect of Shape of Elimination
          Tree on Performance:
* Note the fatter the elimination tree, the better the parallel
performance of the direct solver.
 OpenSeesMP: An application for
Large Models and Parameter Studies
      pid = 0         pid = 1                                   pid = n-1
      np = n          np = n                                    np = n
    source model.tcl
                                                     7200 records
    source analysis.tcl                              2 min a record
                                                     240 hours or 10 days
    set ok [doGravity]
                                                     Ran on 2000 processors
    loadConst -time 0.0                              on teragrid in less than 15 min.
    set gMotionList [split $gMotion "/"]
    set gMotionDir [lindex $gMotionList end-1]
    set gMotionNameInclAT2 [lindex $gMotionList end]
    set gMotionName [string range $gMotionNameInclAT2 0 end-4 ]
    set Gaccel "PeerDatabase $gMotionDir $gMotionName -accel 384.4 -dT dT -nPts nPts"
    pattern UniformExcitation 2 1 -accel $Gaccel
     wipe
    }
    incr count 1;
}
Concrete Building Study
        113 records, 4 intensities
        3 hour a record, 1356
        hours or 56.5 days.
                               * If more simulations
                                  than processors
                                     SpeedUp
                              With “Load Balancing”
                                 will be “Linear”
               Modified Commands
•     Some existing commands have been modified to allow analysis of
      large models in parallel:
     1.    numberer
numberer ParallelPlain
                    numberer ParallelRCM
     2.    system
if {$pid == 0} {
   pattern Plain 2 "Linear" {
     load 4 1 0
   }
}
domainChange
                     Task
      worker         Queue            worker
      worker                       worker
  Work Sharing
MRF_MP2.tcl
                            Steal!
      P              P                   P                  P
             set np [getNP]
             set pid [getPID]
             # set some parameters & open some local files
             # define some procedures for work stealing
             ….
             if {$pid == 0} {
             barrier
 Work Stealing
MRF_MP3.tcl
                                                                             #
                                                                             # done with my own queue, start stealing from others
#                                                                            #
# process my own tasks
#                                                                            set numDone 1;
                                                                             set done “NOTDONE”
set done NOT_DONE;                                                           while {$done == “NOTDONE”} {
while {$done != "DONE"} {
   set task [getTask $pid]                                                    set task [stealTask]
set tStart [clock clicks -milliseconds] set tStart [clock clicks -milliseconds]
  set GMdir [format "./GMfiles/Oak-%i-50/" $Hazard];                           set GMdir [format "./GMfiles/Oak-%i-50/" $Hazard];
  source buildModelWithGravity.tcl                                             source buildModelWithGravity.tcl
  source addRecorders.tcl                                                      source addRecorders.tcl
  source Dynamic.EQ.tcl                                                        source Dynamic.EQ.tcl
  source processResults.tcl                                                    source processResults.tcl
  set tEnd [clock clicks -milliseconds]                                        set tEnd [clock clicks –milliseconds]
  puts $timeOut "DURATION: $i $eqDir $Hazard [expr ($tEnd-$tStart)/1000.]"     puts $timeOut "DURATION: $i $eqDir $Hazard [expr ($tEnd-$tStart)/1000.]"
                                    }                                                                              }
  Work Stealing                                proc getRandomPID {np} {
                                                 if {$np == 0} {
                                                    return 0;
proc createTaskQueues {np} {                     }
  # open some files to store tasks               set maxFactor [expr $np + 1]
  for {set i 0} {$i < $np} {incr i 1} {          set value [expr int([expr rand() * 100])]
              set taskFile [open tasks.$i w]     set value [expr int([expr $value % $maxFactor])]
  }                                              return [expr $value % $np]
  close $taskFile                              }
}                                              proc stealTask {} {
                                                 global pid
proc addTask {thePID Hazard eqDir i} {           global np
  set taskFile [open tasks.$thePID a]            global numDone
  puts $taskFile "$Hazard $eqDir $i"             global processesDone
  close $taskFile                                set foundOne 0
}                                                set task ””;
                                                 while {$foundOne == 0 && $numDone < $np} {
proc getTask {thePID} {
  if {[file size tasks.$thePID] == 0} {            set otherProcess [getRandomPID [expr $np-$numDone-1]]
    return ""                                      set task [getTask [lindex $processesDone $otherProcess]]
  }                                                if {[llength $task] == 0} {
                                                     set newProcessesDone {}
  set taskFile [open tasks.$thePID r+]
                                                     for {set i 0} {$i < $np-$numDone} {incr i 1} {
  seek $taskFile 0
                                                        if {$i != $otherProcess} {
  gets $taskFile task
                                                          lappend newProcessesDone [lindex$processesDone $i]
  set restData [read $taskFile]
                                                        }
  chan truncate $taskFile 0
  seek $taskFile 0                                    }
  set data [split $restData "\n"]                     set numDone [expr $numDone+1]
  foreach line $data {                                set processesDone $newProcessesDone
     if {[llength $line] != 0} {                   } else {
                                                       set foundOne 1
        puts $taskFile $line
                                                     }
     }
                                                 }
  }
                                                 return $task
  close $taskFile
                                               }
  return $task
}
       Results using 16 Processors
                                                          Bottom of stack
               Source: Prof. Demmel, CS267, UC Berkeley
             Outline of Workshop
•    Introduction to OpenSees Framework
•    OpenSees & Tcl Interpreters
•    OpenSees & Output
•    Modeling in OpenSees
•    Nonlinear Analysis in OpenSees
•    Basic Examples
•    Parallel & Distributed Processing
•    OpenSees on NEEShub
•    Hands on Exercise
•    Adding Your Code to OpenSees
•    Advanced Model Development
•    Conclusion
      NEEShub (First Release July 2010)
Simulation
Data Management
             The OpenSeesLab tool:
       http://nees.org/resources/tools/openseeslab
To Select Application
     STRUCTURAL & Modeling
          Uncertainties
* PEER Concrete Column Blind Prediction Contest 2010
http://nees.org/resources/tools/openseeslab
Roof Displacements
Roof Accelerations
             Outline of Workshop
•    Introduction to OpenSees Framework
•    OpenSees & Tcl Interpreters
•    OpenSees & Output
•    Modeling in OpenSees
•    Nonlinear Analysis in OpenSees
•    Basic Examples
•    Parallel & Distributed Processing
•    OpenSees on NEEShub
•    Hands on Exercise
•    Adding Your Code to OpenSees
•    Advanced Model Development
•    Conclusion
                                                                    Max Roof Displacement = ?
                   120 ft           72 ft
                                                      80.5 ft  Dead Load: 95psf typical, roof 80psf
                                                                  E=29,000, Fy=50.0, b =0.003
                                                              3% Rayleigh Damping 1st and 3rd Modes
                                                          Subjected to el_centro 1940 N-S (Peknold)
         A                     Ixx
W14X193 56.8                   2400
W14X159 46.7                   1900                                                                                                 12.5 ft
W14X109 32.0                   1240                                                                               24 ft
W30X173 51.0                   8230
W27X146 43.1                   5660
W24X104 30.6                   3100
W30X99 29.1                    3990                                                                                                    18 ft
W27X94 27.7                    3270
W24X76 22.4                    2100
This figure is taken from the first paper in the SAC 95-05 report: Hall, John F. "Parameter Study of Response of Moment-Resisting Steel Frame
                                                    Buildings to Near-Source Ground Motions”
         Basic Linux Commands:
                         Output
 To Add a New Class you must:
 1) Provide Code that meets the Interface
       of the appropriate super-class
  2) you must BUILD THE LIBRARY
   3) make it accessible to the program.
svn://opensees.berkeley.edu/usr/local/svn/OpenSees/trunk/DEVELOPER
              TortoiseSVN for Windows Users
your
            Source Code Tree in
               DEVELOPER
                                                    Makefile
                                               WindowsInstructions
                                                UnixInstructions
 Trapezoidal.h
Trapezoidal.cpp          cpp      c       fortran   cpp     c   fortran
                                               material input              	
                                                                        properties
 Name ~ ElasticPPcpp();
            int setTrialStrain(double strain, double strainRate=0.0);
                                                                           	
            double getStrain(void);
            double getStress(void);
           double getTangent(void);
            double getInitialTangent(void);
                int commitState(void);
                int revertToLastCommit(void);
                int revertToStart(void);
               UniaxialMaterial *getCopy(void);
               int sendSelf(int commitTag, Channel &theChannel);
               int recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker);
               void Print(OPS_Stream &s, int flag = 0);
           private:
                double fyp, fyn; // pos & neg yield stress
                                                                     data unique to
                double ezero, E,ep; // init strain, elastic mod    material includes:
                double ep; // plastic strain at last commit      Material parameters,
                double trialStrain, trialStress, trialTangent;
                double commitStrain, commitStress, commitTangent;
                                                                   & State variables
         };
ElasticPPcpp::ElasticPPcpp(int tag, double e, double eyp)
:UniaxialMaterial(tag, 0),
 ezero(0), E(e), ep(0.0) trialStrain(0.0),trialStress(0.0),trialTangent(e),
 commitStreain(0.0),commitStress(0.0),commitTangent(e)
{
   fyp=E*eyp;
   fyn = -fyp;
}
ElasticPPcpp::ElasticPPcpp()
:UniaxialMaterial(tag, 0)
 fyp(0),fyn(0),ezero(0), E(0),ep(0),
 trialStrain(0.0),trialStress(0.0),trialTangent(0),
 commitStrain(0.0),commitStress(0.0),commitTangent(e){
 }
ElasticPPcpp::~ElasticPPcpp
{
   // does nothing .. No memory to clean up
}
UniaxialMaterial *ElasticPPcpp::getCopy(void)
{
 ElasticPPcpp *theCopy = new ElasticPPcpp(this->getTag(), E, fyp/E);
  return theCopy;
};
    Hardest Method to Write
ElasticPPcpp::setTrialStrain(double strain, double strainRate)
{
     if (fabs(trialStrain - strain) < DBL_EPSILON)
       return 0;
    trialStrain = strain;
    double sigtrial; // trial stress
    double f;         // yield function
    // compute trial stress
    sigtrial = E * ( trialStrain - ezero - ep );
    // evaluate yield function
    if ( sigtrial >= 0.0 )
       f = sigtrial - fyp;
    else
       f = -sigtrial + fyn;
    double fYieldSurface = - E * DBL_EPSILON;
    if ( f <= fYieldSurface ) {
        // elastic
        trialStress = sigtrial;
        trialTangent = E;
    } else {
        // plastic
        if ( sigtrial > 0.0 ) {
          trialStress = fyp;
        } else {
          trialStress = fyn;
        }
        trialTangent = 0.0;
    }
    return 0;
}
double
ElasticPPcpp::getStrain(void)
{
  return trialStrain;
}
double
ElasticPPcpp::getStress(void)
{
  return trialStress;
}
double
ElasticPPcpp::getTangent(void)
{
  return trialTangent;
}
int
ElasticPPcpp::revertToLastCommit(void)
{
  trialStrain = commitStrain;
  trialTangent = commitTangent;
  trialStress = commitStress;
    return 0;
}
                           Interpreter looking
                                   OPS_Export   for* this function in lib
                                              void
OPS_ElasticPPcpp()
{                                              You can give yourself some
  if (numElasticPPcpp == 0) {
    opserr << "ElasticPPcpp unaxial material KUDOS, - Writtene.g.  please
                                                              by fmk       	
 reference
                                                                     UC Berkeley\n”;
    numElasticPPcpp =1;                                 … if you used	
 this
  }
  // Pointer to a uniaxial material that will be returned
  UniaxialMaterial *theMaterial = 0;
  int iData[1];
  double dData[2];
  int numData;                                            parse the script for
    numData = 1;
                                               three material parameters
    if (OPS_GetIntInput(&numData, iData) != 0) {
      opserr << "WARNING invalid uniaxialMaterial ElasticPP tag" << endln;
      return 0;
    }
    numData = 2;
    if (OPS_GetDoubleInput(&numData, dData) != 0) {
      opserr << "WARNING invalid E & ep\n";
      return 0;
    }                                  Function returns new                  material
    theMaterial = new ElasticPPcpp(iData[0], dData[0], dData[1]);
    return theMaterial;
}
        C & Fortran Procedural
     Languages Can Also Be Used
OPS_Export void
elasticPPc (matObj *thisObj,      SUBROUTINE ELASTICPPF(matObj,model,strain,tang,stress,isw,erro
         modelState *model,
         double *strain,         !DEC$ IF DEFINED (_DLL)
         double *tang,           !DEC$ ATTRIBUTES DLLEXPORT :: ELASTICPPF
         double *stress,         !DEC$ END IF
         int *isw,                  use materialTypes
         int *result)               use materialAPI
{                                   implicit none
  *result = 0;                      IF (isw.eq.ISW_INIT) THEN
3. Select Win32
                                                                       5.	
  Select	
  OK	
  
                                    2.	
  Give	
  LocaAon	
  
Select	
  ApplicaAon	
  SeGngs	
  
  1.	
  Select	
  DLL	
  
2. Select DLL
3.	
  Select	
  Finish	
  
Add Files To Project
                                                           IT FAILS!
              4.	
  Include	
  core	
  in	
  addiAonal	
  include	
  directories	
  
                                               IT FAILS!
1.    Right	
  Click	
  on	
  Source	
  Files	
  
2.    Select	
  Add	
  ExisAng	
  
3.    Navigate	
  to	
  DEVELOPER/core	
  directory	
  
4.    Select	
  the	
  All	
  .cpp	
  and	
  .h	
  file	
  
5.    Select	
  Add	
  
1.	
  Select	
  Build	
  -‐	
  SoluAon	
  
  Copy ElasticPPcpp.dll from
location into current directory
                  2. cd DEVELOPER/material/cpp
                              3. type make
            if you type ls you should see the .so and you
              Can test it using >OpenSees example1.tcl
                         KISS is an acronym
                         for "Keep it simple,
                               stupid”
The SCRIPTS you are submitting
           to OpenSees
        are PROGRAMS
you are submitting to a powerful
       INTERPRETER ..
SO START PROGRAMMING!
                     Steel W Sections &
                        Regular Grid
col line                                            col line
 1         2         3           4           5         6
                                                               Floor 4
           24
                                                               Floor 3
                                 43
                                 42           52               Floor 2
                                      4252
                                             5152               Floor 1
  11
# add nodes at each floor at each column line location & fix nodes if at floor 1
foreach floor {1 2 3 4} floorLoc $floorLocs massX $massesX massY $massesY {
   foreach colLine {1 2 3 4 5 6} colLoc $colLocs {
      node $colLine$floor $colLoc $floorLoc -mass $massX $massY 0.
      if {$floor == 1} {fix $colLine$floor 1 1 1}
    }
}
#uniaxialMaterial Steel02 $tag $Fy $E $b $R0 $cr1 $cr2
uniaxialMaterial Steel02 1 50.0 29000. 0.003 20 0.925 0.15; ; # material to be used for steel elements
# set some list for col and beam sizes
 set colSizes {W14X370 W14X370 W14X211}; #col sizes stories 1, 2 and 3
 set beamSizes {W33X141 W33X130 W27X102}; #beams sizes floor 1, 2, and 3
# add columns at each column line between floors
geomTransf PDelta 1
foreach colLine {1 2 3 4 5 6} {
   foreach floor1 {1 2 3} floor2 { 2 3 4} {
      set theSection [lindex $colSizes [expr $floor1 -1]]; # obtain section size for column
      ForceBeamWSection2d $colLine$floor1$colLine$floor2 $colLine$floor1 $colLine$floor2 $theSection 1 1 –nip 5
   }
 }
#add beams between column lines at each floor
geomTransf Linear 2
foreach colLine1 {1 2 3 4 5} colLine2 {2 3 4 5 6} {
    foreach floor {2 3 4} {
      set theSection [lindex $beamSizes [expr $floor -2]]; # obtain section size for floor
      ForceBeamWSection2d $colLine1$floor$colLine2$floor $colLine1$floor $colLine2$floor $theSection 1 2
   }
}
Steel2.tcl – contains a library of procedures
  #WinXlb/f "Area(in2) d(in) bf(in) tw(in) tf(in) Ixx(in4) Iyy(in4)"
  array set WSection {
     W44X335 "98.5 44.0 15.9 1.03 1.77 31100 1200 74.7"
     W44X290 "85.4 43.6 15.8 0.865 1.58 27000 1040 50.9"
     W44X262 "76.9 43.3 15.8 0.785 1.42 24100 923 37.3"
     W44X230 "67.7 42.9 15.8 0.710 1.22 20800 796 24.9"
     W40X593 "174 43.0 16.7 1.79 3.23 50400 2520 445"
     W40X503 "148 42.1 16.4 1.54 2.76 41600 2040 277”
   …
  }
 proc ElasticBeamWSection2d {eleTag iNode jNode sectType E transfTag {Orient XX}} {
    global WSection
    global in
    set found 0
    foreach {section prop} [array get WSection $sectType] {
       set propList [split $prop]
       set A [expr [lindex $propList 0]*$in*$in]
       set Ixx [expr [lindex $propList 5]*$in*$in*$in*$in]
       set Iyy [expr [lindex $propList 6]*$in*$in*$in*$in]
       if {$Orient == "YY" } {
          element elasticBeamColumn $eleTag $iNode $jNode $A $E $Iyy $transfTag
       } else {
          element elasticBeamColumn $eleTag $iNode $jNode $A $E $Ixx $transfTag
      }
    }
 }
proc ForceBeamWSection2d {eleTag iNode jNode sectType matTag transfTag args} {
    global FiberSteelWSection2d
    global ElasticSteelWSection2d
    set nWeb 4
    if {[lsearch $args "-nWeb"] != -1} {
       set loc [lsearch $args "-nWeb"]
       set nWeb [lindex $args [expr $loc+1]]
    }
    set nip 4
    if {[lsearch $args "-nip"] != -1} {
       set loc [lsearch $args "-nip"]
                  set nip [lindex $args [expr $loc+1]]
    }
        wipe;
        model BasicBuilder -ndm 2 -ndf 3;
….
            ….
    # add columns at each column line between floors
     geomTransf PDelta 1
    foreach colLine {1 2 3 4 5 6} {
      foreach floor1 {1 2 3} floor2 { 2 3 4} {
        set theSection [lindex $colSizes [expr $floor1 -1]]; # obtain section size for column
        ForceBeamWSection2d $colLine$floor1$colLine$floor2 $colLine$floor1 $colLine$floor2 $theSection 1 1 –nFlange $nFlange –nWeb $nWeb
      }
    }
Results 10 % in 50year
       Time
  1-4 292sec
  2-4 302sec
  3-4 309sec
10-10 578sec
20-20 1001sec
35-30 1305sec
                # fibers flange- # fibers web
Results 2% in 50year
       Time
  1-4 254sec
  2-4 265sec
  3-4 272sec
10-10 506sec
20-20 879sec
35-30 1539sec
                 PDelta Gravity Column
•  To include PDelta effects from rest of    Gravity column
   structure on lateral system               •  Pinned base
•  Impact seen when axial forces are large   •  Gravity Column Loads
   (think medium & high-rise)                •  Truss with Pdelta
                                             •  Tied to lateral system
                                                 with MP Constraint
                                                  •  Biggest impact
                                                     possible at
                                                     bottom where
                                                     axial loads
                                                     largest.
                                                  •  The bigger
                                                     inter-story drift
                                                     the bigger the
                                                     impact.
geomTransf PDelta 3;
 set Arigid 10000.0
 set Irigid 100000.0
 set Ismall 1.0e-1;
 set gravityColsArea {806.7 806.7 477.7}; # half sum of area of gravity cols & orthogonal frame
columns
#nodes
 set col6 6; set col7 7;
 foreach floor {1 2 3 4} floorLoc {0 204. 384. 564.} {
     node $col7$floor 1900. $floorLoc
     if {$floor == 1} {fix $col7$floor 1 1 0}
 }                                                 for Pdelta Truss response, I am using
#elements                                         elastic beam with small I to get PDelta
 foreach floor1 {1 2 3} floor2 { 2 3 4} {
     set A [lindex $gravityColsArea [expr $floor1-1]]
     element elasticBeamColumn 7$floor17$floor2 7$floor1 7$floor2 $A $Es $Ismall 3;
     element Truss $col6$floor2$col7$floor2 $col6$floor2 $col7$floor2 $Arigid 3
    # equalDOF $col6$floor2 $col7$floor2 1
}
                                                   Either Works, Just wanted to look
# loads                                           At forces being transmitted to frame.
pattern Plain 3 “Linear” {
     # loads on gravity PDelta column
      load 72 0.0 -748.48 0.0;        # Floor 2
      load 73 0.0 -748.48 0.0;        # Floor 3
      load 74 0.0 -792.84 0.0;        # Floor 4
}
                                 Results 10 % in 50year
Critique It
# add nodes at each floor at each column line location & fixcalculate
                                                             nodes if at floor 1 floor
                                                        and      col locations
foreach floor {1 2 3 4} floorLoc $floorLocs massX $massesX massY $massesY {
    foreach colLine {1 2 3 4 5 6} colLoc $colLocs           {
        node $colLine$floor $colLoc $floorLoc -mass $massX $massY 0.
         if {$floor == 1} {fix $colLine$floor 1 1 1}
    }
}
#uniaxialMaterial Steel02 $tag $Fy $E $b $R0 $cr1 $cr2
uniaxialMaterial Steel02 1 50.0 29000. 0.003 20 0.925 0.15; ; # material to be used for steel elements
# set some list for col and beam sizes
                                                                     While putting numbers
 set colSizes {W14X370 W14X370 W14X211}; #col sizes stories 1, 2 and 3
 set beamSizes {W33X141 W33X130 W27X102}; #beams sizes floor 1, 2, and 3
# add columns at each column line between floors
                                                                       in lists, e.g. 1 2 3 4 are
geomTransf PDelta 1
foreach colLine {1 2 3 4 5 6} {
                                                                             easy to explain,
    foreach floor1 {1 2 3} floor2 { 2 3 4} {                             changing model for
       set theSection [lindex $colSizes [expr $floor1 -1]]; # obtain section size for column
       ForceBeamWSection2d $colLine$floor1$colLine$floor2some                  other
                                                                      $colLine$floor1      configuation
                                                                                      $colLine$floor2 $theSection 1 1 –nip 5
    }
  }                                                                      involves more work
#add beams between column lines at each floor
geomTransf Linear 2                                                          than necessary
foreach colLine1 {1 2 3 4 5} colLine2 {2 3 4 5 6} {
    foreach floor {2 3 4} {
       set theSection [lindex $beamSizes [expr $floor -2]]; # obtain section size for floor
      ForceBeamWSection2d $colLine1$floor$colLine2$floor $colLine1$floor $colLine2$floor $theSection 1 2
   }
}
source Steel2d.tcl
source ReadRecord.tcl;                                                                    MRF3.tcl
# set some variables
set floorOffsets {204. 180. 180.}
set colOffsets {360. 360. 360. 360. 360.}
set massesX     {0. 0.419 0.419 0.400}
set massesY {0. 0.105 0.105 0.096}
set colSizes    {W14X370 W14X370 W14X211};
set beamSizes {W33X141 W33X130 W27X102};
set massesX {0. 0.419 0.419 0.430};           # mass at nodes on each floor in x dirn
set massesY{0. 0.105 0.105 0.096} ;
# set some calculated variables
set numFloor [expr [llength $floorOffsets]+1]
set numCline [expr [llength $colOffsets]+1]
set roofFloor [llength $numFloor]
wipe;
model BasicBuilder -ndm 2 -ndf 3
# build the nodes
for {set floor 1; set floorLoc 0} {$floor <= $numFloor} {incr floor 1} {
   set massX [lindex $massesX [expr $floor-1]]
   set massY [lindex $massesY [expr $floor-1]]
   for {set colLine 1; set colLoc 0;} {$colLine <= $numCline} {incr colLine 1} {
      node $colLine$floor $colLoc $floorLoc -mass $massX $massY 0.
      if {$floor == 1} {fix $colLine$floor 1 1 1}
      if {$colLine < $numCline} { set colLoc [expr $colLoc + [lindex $colOffsets [expr $colLine-1]]]}
   }
   if {$floor < $numFloor} { set floorLoc [expr $floorLoc + [lindex $floorOffsets [expr $floor-1]]]}
}
# define material
#uniaxialMaterial Steel02 $tag $Fy $E $b $R0 $cr1 $cr2                                MRF3.tcl
uniaxialMaterial Steel02 1 50.0 29000 0.003 20 0.925 0.15
         A                     Ixx
W14X193 56.8                   2400
W14X159 46.7                   1900                                                                                                 12.5 ft
W14X109 32.0                   1240                                                                               24 ft
W30X173 51.0                   8230
W27X146 43.1                   5660
W24X104 30.6                   3100
W30X99 29.1                    3990                                                                                                    18 ft
W27X94 27.7                    3270
W24X76 22.4                    2100
This figure is taken from the first paper in the SAC 95-05 report: Hall, John F. "Parameter Study of Response of Moment-Resisting Steel Frame
                                                    Buildings to Near-Source Ground Motions”
source Steel2d.tcl
source ReadRecord.tcl;                                              Solution2014.tcl
# set some variables
set motion el_centro; set Fy 50.0; set E 29000; set b 0.003
set in 1.0;
set g 386.4;
set roofWeight [expr 80*120.*72./1000.]; # 80psf * 120 long * 72 wide in kips
set floorWeight [expr 95*120.*72./1000.]; # 95psf * 120 long * 72 wide in kips
set numFrameResisting 2.0; # number lateral load resisting frames
set percentLoadFrame [expr 15./120.]; # percent load carried by lateral frame
# set up my lists
set floorOffsets {216. 150. 150. 150. 150. 150.}
set colOffsets {288. 288. 288.}
set colSizes      {W30X173 W30X173 W27X146 W27X146 W24X104 W24X104};
set colExtSizes {W14X193 W14X193 W14X159 W14X159 W14X109 W14X109};
set beamSizes {W30X99 W30X99 W27X94 W27X94 W24X76 W24X76};
#calculated properties
set numFloor [expr [llength $floorOffsets]+1]
set numCline [expr [llength $colOffsets]+1]
for {set i 0; set width 0;} {$i < [expr $numCline-1]} {incr i 1} {
  set width [expr $width + [lindex $colOffsets $i]
}
set massAtFloorNode [expr $floorWeight/($g*$numFrameResisting*$numCline*1.0)]
set massAtRoofNode [expr $roofWeight/($g*$numFrameResisting*$numCline*1.0)]
set uniformRoofLoad [expr $roofWeight*$percentLoadFrame/$width]
set uniformFloorLoad [expr $floorWeight*$percentLoadFrame/$width]
                                      DON”T TOUCH BELOW LINE
wipe;
model BasicBuilder -ndm 2 -ndf 3;                                                      Solution2014.tcl
# build the nodes
for {set floor 1; set floorLoc 0} {$floor <= $numFloor} {incr floor 1} {
   if {$floor == $numFloor} {
      set mass $massAtRoofNode
   } else {
      set mass $massAtFloorNode
   }
   for {set colLine 1; set colLoc 0;} {$colLine <= $numCline} {incr colLine 1} {
      node $colLine$floor $colLoc $floorLoc -mass $mass $mass 0.
      if {$floor == 1} {fix $colLine$floor 1 1 1}
      if {$colLine < $numCline} {set colLoc [expr $colLoc + [lindex $colOffsets [expr $colLine-1]]]}
   }
   if {$floor < $numFloor} {set floorLoc [expr $floorLoc + [lindex $floorOffsets [expr $floor-1]]]}
}
# define material
uniaxialMaterial Steel02 1 $Fy $E $b 20 0.925 0.15
# build the columns
geomTransf PDelta 1
for {set colLine 1} {$colLine <= $numCline} {incr colLine 1} {
   for {set floor1 1; set floor2 2} {$floor1 < $numFloor} {incr floor1 1; incr floor2 1} {
      if {$colLine == 1 || $colLine == $numCline} {
         set theSection [lindex $colExtSizes [expr $floor1 -1]]
      } else {
         set theSection [lindex $colSizes [expr $floor1 -1]]
      }
      ForceBeamWSection2d $colLine$floor1$colLine$floor2 $colLine$floor1 $colLine$floor2 $theSection 1 1 -nip
   }
}
 Some Braced Frame
    EXAMPLES:
Typical Configurations
                                               •  Beams pinned at column
W27X84
                                                                           W14X176
                                                     HSS10X10X3/8
                                                        W30X116
                                       3@15’
                                                                           W14X176
                                                     HSS12X12X1/2
                                                      W36X210
                                                                           W14X176
  #number of beam elements                           HSS12X12X1/2
  pinned at either end
                                                          30’
  Imperfection so will buckle
proc HSSbrace $eleTag $iNode $jNode $secType $matTag $numSeg $imperfection $transfTag args
source Steel2d.tcl
# set up my structure
set in 1
                                                                                                                      CBFbase.tcl
set floorOffsets {180. 180. 180.}
set colOffsets {180. 180.}
set masses      {0. 0.419 0.419 0.400}                                                                             W27X84
set colSizes {W14X176 W14X176 W14X176};
set beamSizes {W36X210 W30X116 W27X84};                                                  Floor 4
set braceSizes {HSS12X12X1/2 HSS12X12X1/2 HSS10X10X3/8}
# build colLocations and floorLocations & set some variables                                                            W14X176
set numFloor [expr [llength $floorOffsets]+1]
set numStory [expr $numFloor-1]
                                                                                                                   W30X116
set numCline [expr [llength $colOffsets]+1]
wipe;                                                                                    Floor 3
                                                                                                                                  3@15’
model BasicBuilder -ndm 2 -ndf 3; # Define the model builder, ndm = #dimension, ndf = #dofs
# Build the Nodes
for {set floor 1; set floorLoc 0.} {$floor <= $numFloor} {incr floor 1} {                                              W14X176
   set mass [lindex $masses [expr $floor-1]]
   for {set colLine 1; set colLoc 0.} {$colLine <= $numCline} {incr colLine 1} {
                                                                                                                  W36X210
      node $colLine$floor $colLoc $floorLoc -mass $mass $mass 0.
      if {$floor == 1} { fix $colLine$floor 1 1 1}                                       Floor 2
      if {$colLine < $numCline} {set colLoc [expr $colLoc + [lindex $colOffsets [expr $colLine-1]]]}
   }
   if {$floor < $numFloor} {set floorLoc [expr $floorLoc + [lindex $floorOffsets [expr $floor-1]]]}                    W14X176
}
uniaxialMaterial Steel02 1 $Fy $Es $b 20 0.925 0.15 0.0005 0.01 0.0005 0.01
# add the columns
geomTransf PDelta 1
                                                                                         Floor 1                    2@15’
for {set colLine 1} {$colLine <= $numCline} {incr colLine 2} {
   for {set floor1 1; set floor2 2} {$floor1 < $numFloor} {incr floor1 1; incr floor2 1} {     cline 1              cline 2 cline 3
      set theSection [lindex $colSizes [expr $floor1 -1]]
      ForceBeamWSection2d $colLine$floor1$colLine$floor2 $colLine$floor1 $colLine$floor2 $theSection 1 1 -nip 5
   }
}
# add the beams, pinned connection at column end
geomTransf Linear 2
for {set floor 2} {$floor <= $numFloor} {incr floor 1} {
   set colLine1 1; set colLine2 2; set colLine3 3;
   set theSection [lindex $beamSizes [expr $floor -2]]
    DispBeamWSection2d $colLine1$floor$colLine2$floor $colLine1$floor $colLine2$floor $theSection 1 2 -release1
    DispBeamWSection2d $colLine2$floor$colLine3$floor $colLine2$floor $colLine3$floor $theSection 1 2 -release2
}
                                                                                     }
                                                                             CBF1.tcl
                                                                    (Diagonal bracing)
source CBFbase.tcl
# define
       }
         material for braces
set Fy_b 46.0;
set E0 0.095
set m -0.3
uniaxialMaterial Steel02 2 $Fy_b $Es $b 20 0.925 0.15 0.0005 0.01 0.0005 0.01
uniaxialMaterial Fatigue 3 2 -E0 $E0 -m $m -min -1.0 -max 0.04