Not Everything Should Be a Direct Translation

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

Multi-Threaded SDF Analysis

A previous post showed that, when compared to a couple of brute force approaches, using the sdfResponse command is the most computationally efficient approach to generating an earthquake response spectrum. During an OpenSees Cafe, Dr. Silvia Mazzoni suggested taking a more intelligent approach by "batching" the brute force SDF analyses. Instead of analyzing one oscillator … Continue reading Multi-Threaded SDF Analysis

Single Quotes or Double?

Python, like many other languages, uses single (') and double quotes (") for multi-character strings. This was a bit for me to digest coming from the C++ world where single and double quotes have distinct uses: single quotes for a character and double quotes for strings. Functionally, there's no difference between single and double quotes … Continue reading Single Quotes or Double?

OpenSeesPy List Comprehensions

OpenSees was always meant to be an API and you can use various helper functions like ops.eleResponse() and ops.nodeDisp() to get selected response quantities. You will find, however, that the values returned by these commands are not always congruent with what you want. In many cases, Python list comprehensions give an easy one-liner for morphing … Continue reading OpenSeesPy List Comprehensions

How Many Clicks Does It Take?

Coding single degree of freedom (SDF) response in order to generate earthquake response spectra is a rite of passage in earthquake engineering research and education. I wrote my first response spectrum in MATLAB. Nowadays, people are likely to use Python. To generate response spectra in OpenSees, you can create a simple one-dimensional model of SDF … Continue reading How Many Clicks Does It Take?