Introduction to OpenSees: Difference between revisions

From OpenSeesWiki
Jump to navigation Jump to search
No edit summary
 
(28 intermediate revisions by 3 users not shown)
Line 10: Line 10:
*A communication mechanism for exchanging and building upon research accomplishments.
*A communication mechanism for exchanging and building upon research accomplishments.
*As open-source software, it has the potential for a community code for earthquake engineering.
*As open-source software, it has the potential for a community code for earthquake engineering.
==Why is OpenSees OpenSource?==
*Linus’s Law: “Given enough eyeballs, all bugs are shallow”.
*Zero cost software attracts users!
*Prevents community from losing software. (especially true in a research community)
*Allows Community to examine new ideas. (vital in a research community were new ideas can be tested and validated by all instead of being hidden behind some theory in a paper and limited to researchers own test data)


==Simulation Framework==
==Simulation Framework==
;Computation
;Computation
**Algorithms
:Algorithms
**Solvers
:Solvers
**Parallel/distributed computing
:Parallel/distributed computing
;Information Technology
;Information Technology
**Software framework
:Software framework
**Databases
:Databases
**Visualization
:Visualization
**Internet/grid computation
:Internet/grid computation
;Models
;Models
**Simulation models
:Simulation models
**Performance models
:Performance models
**Limit state models
:Limit state models
**Material
:Material
**component
:component
**system models
:system models


==OpenSees Approach to Simulation==
==OpenSees Approach to Simulation==
Line 51: Line 57:
*Each object is of a particular type or Class. The class defines the data and methods of an object.  
*Each object is of a particular type or Class. The class defines the data and methods of an object.  
*3 basic relationships between classes
*3 basic relationships between classes
**IS-A (Truss is an Element)  
:IS-A (Truss is an Element)  
**KNOWS-A (Truss knows a Node)  
:KNOWS-A (Truss knows a Node)  
**HAS-A (Truss has a Material)
:HAS-A (Truss has a Material)
 
==How People Use OpenSees==
*Provide their own main() function in C++ and link to framework.
*Use OpenSees interpreterS. These are extensions of the Tcl interpreter for finite element analysis which are built using the OpenSees framework.
**OpenSees.exe (Sequential-computing version)
**OpseseesSP.exe (Parallel-computing version)
**OpenSeesMP.exe (Parallel-computing version)
 
==What is Tcl==
Tcl is a 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.
*Comand syntax:
::''command arg1 arg2 …''
*Help
**[http://dev.scriptics.com/scripting/primer.html dev.scriptics.com/scripting/primer.html]
**Practical Programming in Tcl and Tk, Brent B. Welch.
 
==What is an interpreter==
*Interpreters (Tcl,Perl, Matlab, Ruby) are programs that execute programs written in a programming language immediately.
*There is no separate compilation & linking.
*An interpreted program runs slower than a compiled one
 
==Example Tcl==
*Variables & variable substitution
 
>set a 1
>1
>set b a
>a
>set b $a
>1
*Expression evaluation
>expr 2 + 3
> 5
>set b [expr 2 + $b]
> 3
*File manipulation
>set fileId [open tmp w]
>??
>puts $fileId “hello”
>close $fileID
>type tmp
hello
*Sourcing files
>source Example1.tcl
*Procedures and control structures
for {set i 1} {$i < 10} {incr i 1} {
  puts “i equals $i”
} set sum 0
foreach value {1 2 3 4} {
  set sum [expr $sum + $value]
} set $
sum
>10
>proc guess {value} {
  global sum
  if {$value < $sum} {
    puts “too low”
  } else {
    if {$value > $sum} {
    puts “too high”
    } else { puts “you got it!”}
  }
}
> guess 9
too low
 
==Main Abstractions in OpenSees Framework==
;ModelBuilder
:Constructs the objects in the model and adds them to the domain.
;Domain (Central component)
:Holds the state of the model at time t and (t + dt)
;Analysis
:Moves the model from state at time t to state at time (t + dt)
;Recorder
:Monitors user defined parameters in the model during the analysis
 
==OpenSees Interpreters==
The OpenSees interpreters are tcl interpreters which have been extended to include commands for finite element analysis:
:1. Modeling – create nodes, elements, loads and constraints
:2. Analysis – specify the analysis procedure.
:3. Output specification – specify what it is you want to monitor during the analysis.
Being interpreters, this means that the files you create and submit to the OpenSees interpreters are not input files.
You are creating and submitting PROGRAMS.
The OpenSees [[model Command]] adds the OpenSees modeling commands to the Tcl interpreter.
 
==Modeling Features==
Modeling Features are used to define the model and the loads held in the domain
;Model
:The OpenSees [[model command]] enables the model definition
;Nodes
:The OpenSees [[node command]]
;Masses
:The OpenSees [[mass Command]]
;Nodal constraints & Boundary Conditions
:The OpenSees [[constraints commands]] defines the constraints between degrees of freedom.
;Materials
:There are two types of materials
::The OpenSees [[uniaxialMaterial Command]] defines materials with a unique one-dimensional stress-strain (force-deformation) relationship
::The OpenSees [[nDMaterial Command]] defines multi-dimensional materials
;Sections
:The OpenSees [[section Command]] defines different types of element cross-sections, ranging from uniaxial elastic sections to fiber sections\
;Elements
:The OpenSees [[element Command]] defines element types and element connectivity within the model
;Block-generation of elements
:The OpenSees [[block Command]] generates meshes of quadrilateral or brick finite element
;Node & Element Regions
:The OpenSees [[region Command]] labels a group of nodes and elements
;Geometric Transformation
:The OpenSees [[Geometric Transformation Command]] is used to define the relationtionship between element force and deformation quantities from the global coordinate system to the element basic system (local coordinates)
;Time Series
:The OpenSees [[Time Series Command]] defines a time series that is used within the load pattern
;Load Pattern
:The OpenSees [[pattern Command]] imposes element and/or nodal loads and/or constraints
;Damping
:The OpenSees [[Rayleigh Damping Command]] defines the mass and stiffness-proportional damping parameters
 
==Analysis definition and features==
The analysis-definition part of OpenSees allows the user to define the different linear and nonlinear analysis tools available. For each analysis, the following items need to be defined, preferably in this order:
 
;constraints : The OpenSees [[constraints Command]] is used to construct the ConstraintHandler object. Constraints enforce a relationship between degrees-of-freedom. The ConstraintHandler object determines how the constraint equations are enforced in the analysis.
;numberer : The OpenSees [[numberer Command]] is used to construct the DOF_Numberer object. The DOF_Numberer object determines the mapping between equation numbers and degrees-of-freedom -- how degrees-of-freedom are numbered.
;system : The OpenSees [[system Command]] is used to construct the LinearSOE and LinearSolver objects to store and solve the system of equations in the analysis.
;test : The OpenSees [[test Command]] is used to construct a ConvergenceTest object. Certain SolutionAlgorithm objects require a ConvergenceTest object to determine if convergence has been achieved at the end of an iteration step.
;algorithm : The OpenSees [[algorithm Command]] is used to construct a SolutionAlgorithm object, which determines the sequence of steps taken to solve the non-linear equation.
;integrator : The OpenSees [[integrator Command]] is used to construct the Integrator object. The Integrator object determines the meaning of the terms in the system of equation object. The Integrator object is used for the following:
::*determine the predictive step for time t+dt
::*specify the tangent matrix and residual vector at any iteration
::*determine the corrective step based on the displacement increment dU
;analysis : The OpenSees [[analysis Command]] is used to construct the Analysis object. This analysis object is constructed with the component objects previously created by the analyst. All currently-available analysis objects employ incremental solution strategies. There are three types of analysis currently available:
 
::*Static - for static analysis
::*Transient - for transient analysis with constant time step
::*VariableTransient - for transient analysis with variable time step
 
 
===Analysis execution===
;analyze
:The analysis is executed using the OpenSees [[analyze Command]].
:This command moves the analysis forward by the specified number of steps.
 
==Output Features==
The OpenSees output features are used to monitor the model during analysis.
There are two types of output:
;Recorders
:The OpenSees [[Recorder Command]] specifies the location (Element or Node) and response type (deformation or force) to record into a file throughtout the analysis.
:The recorder data is only available after the analysis has been terminated and the [[wipe Command]] is invoked or the OpenSees program is closed
;Real-Time data
:A series of [[RealTime Output Commands]] are used to monitor the state of the model at any time during the simulation
 
==Example OpenSees Input==
<h3>Truss Example</h3>
[[File:FranksTrussExample.JPG|link=Introduction to OpenSees|right]]
;Build Model
<source lang="Tcl">
model Basic -ndm 2 -ndf 2
node 1 0.0 0.0
node 2 144.0 0.0
node 3 168.0 0.0
node 4 72.0 96.0
fix 1 1 1
fix 2 1 1
fix 3 1 1
uniaxialMaterial Elastic 1 3000.0
element truss 1 1 4 10.0 1
element truss 2 2 4 5.0 1
element truss 3 3 4 5.0 1
pattern Plain 1 “Linear” {
  load 4 100.0 -50.0
}
</source>
;Static Nonlinear Analysis with LoadControl
<source lang="Tcl">
constraints Transformation
numberer RCM
system BandGeneral
test NormDispIncr 1.0e-6 6 2
algorithm Newton
integrator LoadControl 0.1
analysis Static
analyze 10
</source>
;Transient Nonlinear Analysis with Newmark
<source lang="Tcl">
constraints Transformation
numberer RCM
system BandGeneral
test NormDispIncr 1.0e-6 6 2
algorithm Newton
integrator Newmark 0.5 0.25
analysis Transient
analyze 2000 0.01
</source>
[[File:GettingStartedGeometry.JPG|link=Introduction to OpenSees|right]]
<h3>Plane Frame</h3>
;Build Model
<source lang="Tcl">
model Basic -ndm 2 -ndf 3
node 1 0.0 0.0
node 2 504.0 0.0
node 3 0.0 432.0
node 4 504.0 432.0
fix 1 1 1 1
fix 2 1 1 1
mass 3 5.18 0.0 0.0
mass 4 5.18 0.0 0.0
geomTransf Linear 1
element elasticBeamColumn 1 1 3 3600.0 4227.0 1080000.0 1
element elasticBeamColumn 1 4 3 3600.0 4227.0 1080000.0 1
element elasticBeamColumn 3 3 4 5760.0 4227.0 4423680.0 1
pattern Plain 1 Linear {
  load 3 0.0 -2000.0 -168074.0
  load 4 0.0 -2000.0 168074.0
}
 
</source>
;Gravity-Load Analysis
<source lang="Tcl">
# create analysis & perform analysis
constraints transformation
numberer RCM
system BandGeneral
test NormDispIncr 1.0e-6 6 2
algorithm Newton
integrator LoadControl 0.1
analysis Static
analyze 10
# look at what happened to node 3
print node 3
</source>
;Cyclic Lateral Load Analysis
<source lang="Tcl">
# set gravity loads constant & reset time in domain
loadConst -time 0.0
# create load pattern for lateral loads
pattern Plain 2 Linear {
load 3 200.0 0.0 0.0
load 4 200.0 0.0 0.0
}
# do some cyclic analysis
foreach {numSteps stepSize} {10 0.1 10 -0.1 10 -0.1 10 0.1 10 0.1} {
  integrator LoadControl $stepSize
  analyze $numSteps
  set time [getTime]
  set disp [nodeDisp 3 1]
  puts “Time: $time Displacement $disp”
}
</source>

Latest revision as of 19:33, 14 January 2010

Context for Simulation in Earthquake Engineering

  • Research and practice is moving towards Performance-Based Seismic Engineering, which depends on high-fidelity models and simulation to assess performance.
  • Simulation models capture knowledge from tests to leverage investment in limited experimentation.
  • Community-based, open-source software for simulation promotes innovation in research and advanced applications for practice.
  • NEES infrastructure is supporting OpenSees to provide simulation capability and integration with NEESit services for NEES research.

What is OpenSees?

  • A software framework for simulation applications in earthquake engineering using finite element methods. OpenSees is not a code.
  • A communication mechanism for exchanging and building upon research accomplishments.
  • As open-source software, it has the potential for a community code for earthquake engineering.

Why is OpenSees OpenSource?

  • Linus’s Law: “Given enough eyeballs, all bugs are shallow”.
  • Zero cost software attracts users!
  • Prevents community from losing software. (especially true in a research community)
  • Allows Community to examine new ideas. (vital in a research community were new ideas can be tested and validated by all instead of being hidden behind some theory in a paper and limited to researchers own test data)

Simulation Framework

Computation
Algorithms
Solvers
Parallel/distributed computing
Information Technology
Software framework
Databases
Visualization
Internet/grid computation
Models
Simulation models
Performance models
Limit state models
Material
component
system models

OpenSees Approach to Simulation

Basic approach
Modular software design for implementing and integrating modeling, numerical methods, and IT for scalable, robust simulation
Focus on capabilities needed for performance-based engineering
Programmable interfaces
Most users
a “code” for nonlinear analysis
Fully scriptable.
Generally
a software framework for developing simulation applications

Remember OpenSees is a Software Framework

  • A framework is NOT an executable.
  • A framework IS a set of cooperating software components for building applications in a specific domain.
  • The OpenSees framework is written primarily in the objectoriented language C++; though other languages namely C and Fortran are also used.
  • The abstract classes in the OpenSees framework define the interface. The concrete subclasses that exist the implementations. Other classes can be provided to extend the capabilities of the framework
  • Most users, however, will use OpenSees.exe which is, indeed, an executable.

Basics of Object-Oriented Programming

  • In object-oriented programming, the program is seen as a collection of objects. Each object is capable of receiving messages, processing data, and sending messages to other objects.
  • Each object is of a particular type or Class. The class defines the data and methods of an object.
  • 3 basic relationships between classes
IS-A (Truss is an Element)
KNOWS-A (Truss knows a Node)
HAS-A (Truss has a Material)

How People Use OpenSees

  • Provide their own main() function in C++ and link to framework.
  • Use OpenSees interpreterS. These are extensions of the Tcl interpreter for finite element analysis which are built using the OpenSees framework.
    • OpenSees.exe (Sequential-computing version)
    • OpseseesSP.exe (Parallel-computing version)
    • OpenSeesMP.exe (Parallel-computing version)

What is Tcl

Tcl is a 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.
  • Comand syntax:
command arg1 arg2 …

What is an interpreter

  • Interpreters (Tcl,Perl, Matlab, Ruby) are programs that execute programs written in a programming language immediately.
  • There is no separate compilation & linking.
  • An interpreted program runs slower than a compiled one

Example Tcl

  • Variables & variable substitution
>set a 1
>1
>set b a
>a
>set b $a
>1
  • Expression evaluation
>expr 2 + 3
> 5
>set b [expr 2 + $b]
> 3
  • File manipulation
>set fileId [open tmp w]
>??
>puts $fileId “hello”
>close $fileID
>type tmp
hello
  • Sourcing files
>source Example1.tcl
  • Procedures and control structures
for {set i 1} {$i < 10} {incr i 1} {
  puts “i equals $i”
} set sum 0
foreach value {1 2 3 4} {
  set sum [expr $sum + $value]
} set $
sum
>10
>proc guess {value} {
  global sum
  if {$value < $sum} {
    puts “too low”
  } else {
    if {$value > $sum} {
    puts “too high”
    } else { puts “you got it!”}
  }
}
> guess 9
too low

Main Abstractions in OpenSees Framework

ModelBuilder
Constructs the objects in the model and adds them to the domain.
Domain (Central component)
Holds the state of the model at time t and (t + dt)
Analysis
Moves the model from state at time t to state at time (t + dt)
Recorder
Monitors user defined parameters in the model during the analysis

OpenSees Interpreters

The OpenSees interpreters are tcl interpreters which have been extended to include commands for finite element analysis:

1. Modeling – create nodes, elements, loads and constraints
2. Analysis – specify the analysis procedure.
3. Output specification – specify what it is you want to monitor during the analysis.

Being interpreters, this means that the files you create and submit to the OpenSees interpreters are not input files. You are creating and submitting PROGRAMS. The OpenSees model Command adds the OpenSees modeling commands to the Tcl interpreter.

Modeling Features

Modeling Features are used to define the model and the loads held in the domain

Model
The OpenSees model command enables the model definition
Nodes
The OpenSees node command
Masses
The OpenSees mass Command
Nodal constraints & Boundary Conditions
The OpenSees constraints commands defines the constraints between degrees of freedom.
Materials
There are two types of materials
The OpenSees uniaxialMaterial Command defines materials with a unique one-dimensional stress-strain (force-deformation) relationship
The OpenSees nDMaterial Command defines multi-dimensional materials
Sections
The OpenSees section Command defines different types of element cross-sections, ranging from uniaxial elastic sections to fiber sections\
Elements
The OpenSees element Command defines element types and element connectivity within the model
Block-generation of elements
The OpenSees block Command generates meshes of quadrilateral or brick finite element
Node & Element Regions
The OpenSees region Command labels a group of nodes and elements
Geometric Transformation
The OpenSees Geometric Transformation Command is used to define the relationtionship between element force and deformation quantities from the global coordinate system to the element basic system (local coordinates)
Time Series
The OpenSees Time Series Command defines a time series that is used within the load pattern
Load Pattern
The OpenSees pattern Command imposes element and/or nodal loads and/or constraints
Damping
The OpenSees Rayleigh Damping Command defines the mass and stiffness-proportional damping parameters

Analysis definition and features

The analysis-definition part of OpenSees allows the user to define the different linear and nonlinear analysis tools available. For each analysis, the following items need to be defined, preferably in this order:

constraints
The OpenSees constraints Command is used to construct the ConstraintHandler object. Constraints enforce a relationship between degrees-of-freedom. The ConstraintHandler object determines how the constraint equations are enforced in the analysis.
numberer
The OpenSees numberer Command is used to construct the DOF_Numberer object. The DOF_Numberer object determines the mapping between equation numbers and degrees-of-freedom -- how degrees-of-freedom are numbered.
system
The OpenSees system Command is used to construct the LinearSOE and LinearSolver objects to store and solve the system of equations in the analysis.
test
The OpenSees test Command is used to construct a ConvergenceTest object. Certain SolutionAlgorithm objects require a ConvergenceTest object to determine if convergence has been achieved at the end of an iteration step.
algorithm
The OpenSees algorithm Command is used to construct a SolutionAlgorithm object, which determines the sequence of steps taken to solve the non-linear equation.
integrator
The OpenSees integrator Command is used to construct the Integrator object. The Integrator object determines the meaning of the terms in the system of equation object. The Integrator object is used for the following:
  • determine the predictive step for time t+dt
  • specify the tangent matrix and residual vector at any iteration
  • determine the corrective step based on the displacement increment dU
analysis
The OpenSees analysis Command is used to construct the Analysis object. This analysis object is constructed with the component objects previously created by the analyst. All currently-available analysis objects employ incremental solution strategies. There are three types of analysis currently available:
  • Static - for static analysis
  • Transient - for transient analysis with constant time step
  • VariableTransient - for transient analysis with variable time step


Analysis execution

analyze
The analysis is executed using the OpenSees analyze Command.
This command moves the analysis forward by the specified number of steps.

Output Features

The OpenSees output features are used to monitor the model during analysis. There are two types of output:

Recorders
The OpenSees Recorder Command specifies the location (Element or Node) and response type (deformation or force) to record into a file throughtout the analysis.
The recorder data is only available after the analysis has been terminated and the wipe Command is invoked or the OpenSees program is closed
Real-Time data
A series of RealTime Output Commands are used to monitor the state of the model at any time during the simulation

Example OpenSees Input

Truss Example

Build Model
model Basic -ndm 2 -ndf 2
node 1 0.0 0.0
node 2 144.0 0.0
node 3 168.0 0.0
node 4 72.0 96.0
fix 1 1 1
fix 2 1 1
fix 3 1 1
uniaxialMaterial Elastic 1 3000.0
element truss 1 1 4 10.0 1
element truss 2 2 4 5.0 1
element truss 3 3 4 5.0 1
pattern Plain 1 “Linear” {
  load 4 100.0 -50.0
}
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
Transient Nonlinear Analysis with Newmark
constraints Transformation
numberer RCM
system BandGeneral
test NormDispIncr 1.0e-6 6 2
algorithm Newton
integrator Newmark 0.5 0.25
analysis Transient
analyze 2000 0.01

Plane Frame

Build Model
model Basic -ndm 2 -ndf 3
node 1 0.0 0.0
node 2 504.0 0.0
node 3 0.0 432.0
node 4 504.0 432.0
fix 1 1 1 1
fix 2 1 1 1
mass 3 5.18 0.0 0.0
mass 4 5.18 0.0 0.0
geomTransf Linear 1
element elasticBeamColumn 1 1 3 3600.0 4227.0 1080000.0 1
element elasticBeamColumn 1 4 3 3600.0 4227.0 1080000.0 1
element elasticBeamColumn 3 3 4 5760.0 4227.0 4423680.0 1
pattern Plain 1 Linear {
  load 3 0.0 -2000.0 -168074.0
  load 4 0.0 -2000.0 168074.0
}
Gravity-Load Analysis
# create analysis & perform analysis
constraints transformation
numberer RCM
system BandGeneral
test NormDispIncr 1.0e-6 6 2
algorithm Newton
integrator LoadControl 0.1
analysis Static
analyze 10
# look at what happened to node 3
print node 3
Cyclic Lateral Load Analysis
# set gravity loads constant & reset time in domain
loadConst -time 0.0
# create load pattern for lateral loads
pattern Plain 2 Linear {
 load 3 200.0 0.0 0.0
 load 4 200.0 0.0 0.0
}
# do some cyclic analysis
foreach {numSteps stepSize} {10 0.1 10 -0.1 10 -0.1 10 0.1 10 0.1} {
  integrator LoadControl $stepSize
  analyze $numSteps
  set time [getTime]
  set disp [nodeDisp 3 1]
  puts “Time: $time Displacement $disp”
}