Introduction to OpenSees: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 106: | Line 106: | ||
**[http://dev.scriptics.com/scripting/primer.html dev.scriptics.com/scripting/primer.html] | **[http://dev.scriptics.com/scripting/primer.html dev.scriptics.com/scripting/primer.html] | ||
**Practical Programming in Tcl and Tk, Brent B. Welch. | **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 |
Revision as of 07:18, 29 November 2009
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.
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)
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
What is in a Domain
- Element
- Node
- MPConstraint
- SPConstraint
- LoadPattern
- ElementalLoad
- NodalLoad
- SPConstraint
- TimeSeries
Other Classes Associated with Elements
- Material
- Uniaxial
- nD
- Section
- GeomTransformation
- Linear,Pdelta or Corotational
- Convert element force and deforamtion quantities from the global coordinate system to the element basic system (local coordinates)
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
- 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