OpenSees Cloud

OpenSees AMI

OpenSeesPy Is Not Terrible for the Environment

Original Post - 04 Nov 2020 - Michael H. Scott

Visit Structural Analysis Is Simple on Substack.


This tweet made the rounds in late September, early October. Those new to OpenSeesPy, or unaware of how it works, might have been alarmed. I’m here to reassure you that OpenSeesPy is not a huge CO2 producer like native Python code.

Tweet

OpenSeesPy is C++ code that calls the Python C/C++ API so that you can build and analyze OpenSees models in a Python script. The computational engine of the OpenSees framework is written in C++ and FORTRAN. So, all the finite element state determination, assembly, iterating, solving, and time stepping is fast–and light on the CO2.

Although the graph in the tweet is based on astronomy simulations, the trend carries over to finite element analysis. I’ve seen and run structural FEA code written in native Python, and it is brutally slow. But, the comparisons of Python with C++ or FORTRAN for number crunching are unfair because Python is interpreted while C++ and FORTRAN are compiled.

Of course, what you do in your Python scripts, e.g., with numpy, pandas, TensorFlow, etc., after you import openseespy.opensees can lead to larger amounts of CO2 production. But you have to weigh that against the CO2 footprint associated with prolonged development time when not using all those nice Python packages.

By the way, where’s Tcl on that graph? Although it has other strengths, for number crunching, native Tcl has to be way worse than native Python.