Like learning another language, not everything in OpenSees, and programming in general, is a direct translation from textbooks. Your mother tongue could be $latex {\bf x} = {\bf A}^{-1}{\bf b}$, but you should never invert the matrix then multiply. Instead, call an equation solver. For small matrices in OpenSees, use A.Solve(b, x) from the Matrix … Continue reading Not Everything Should Be a Direct Translation
Tag: Tcl
OpenSees 12345
In the early 2000s, when the Tcl interpreter was taking shape for OpenSees, Frank used a dummy tag 123456789 to determine if a load pattern had already been defined while parsing the load and sp commands. Here is the 2001 source code for TclModelBuilder.cpp--clearly written by Frank because he does not capitalize anything when he … Continue reading OpenSees 12345
OpenSees Tcl to Python Converter
Although Python is a more popular programming language than Tcl, I suspect Tcl remains the most used language for OpenSees. Python is gaining ground though as it appeals to newer users of OpenSees. I don't have data to back any of this up. To help the transition from Tcl to Python, OpenSeesPy was designed to … Continue reading OpenSees Tcl to Python Converter
Tcl as a Front End for Python
I know I'm not the only one who enjoys converting between scripting languages or between structural analysis programs. I've had fun writing bespoke Tcl middleware between OpenSees and MATLAB, but now OpenSeesPy makes all of that obsolete. But, let's say you have an OpenSees Tcl script that you'd like to run in OpenSeesPy. There's a … Continue reading Tcl as a Front End for Python
Wipe Out!
I am often reminded that what seems basic to me is not so obvious to others who use OpenSees. For example, the wipe command. What it does--and what it does not do--can be confusing. The wipe command clears out the entire OpenSees model domain (nodes, elements, materials, loads, etc.) and analysis options (algorithm, system, etc.). … Continue reading Wipe Out!
A Little Secret About OpenSees Tcl
Putting load and fiber commands inside braces {} preceded by pattern and section commands, respectively, was a conscious choice in the early days of G3/OpenSees. The intent was to enforce the same scoping rules that Tcl uses for procedures, loops, and conditional statements; however, the braces and scoping were totally unnecessary. We scrapped the scoping … Continue reading A Little Secret About OpenSees Tcl
Brace Your Tcl Code
I show Python code for most examples here on the blog, but I am frequently reminded that a majority of OpenSees users write their scripts in Tcl. Because everything's a string, there's a lot of cool stuff you can do with Tcl expressions. However, simple math expressions can take a relatively long time to execute. … Continue reading Brace Your Tcl Code
PSA: OpenSees Commands Are Case Sensitive
I recently had a conversation with an experienced OpenSees user who asked why distributed loads were not working on their elastic beam-column model. I initially thought something must have changed in GitHub, but was relieved when I looked at their input file and saw the following: pattern Plain 2 Linear { eleLoad -ele 10020001 -type … Continue reading PSA: OpenSees Commands Are Case Sensitive
Just Another Python Module
When OpenSees got off the ground, many finite element analysis software packages relied on fixed format input. So, it was important to integrate OpenSees with a fully functional scripting language to give users flexibility in creating applications without requiring users to write and compile C++ main() functions. I don't remember all the factors that went … Continue reading Just Another Python Module