Openseespy Documentation Release 3.3.0.0
Total Page:16
File Type:pdf, Size:1020Kb
OpenSeesPy Documentation Release 3.3.0.0 Minjie Zhu Sep 04, 2021 Contents 1 Developer 3 Index 447 i ii OpenSeesPy Documentation, Release 3.3.0.0 Important: Version 3.3.0.0 is released! OpenSeesPy is on PyPi (Windows, Linux, Mac). The latest version of this document can be found at https://openseespydoc.readthedocs.io/en/latest/. Note: Questions including modeling issues and the use of OpenSeesPy, please post on OpenSeesPy Forum. You are very welcome to contribute to OpenSeesPy with new command documents and examples by sending pull requests through github pulls. For errors in this document, submit on github issues. OpenSeesPy is a Python 3 interpreter of OpenSees. A minimum script is shown below: # import OpenSeesPy import openseespy.opensees as ops # import OpenSeesPy plotting commands import openseespy.postprocessing.Get_Rendering as opsplt # wipe model ops.wipe() # create model ops.model('basic','-ndm',2,'-ndf',3) # plot model opsplt.plot_model() To run a test of the pip installation: pytest--pyargs openseespy.test Contents 1 OpenSeesPy Documentation, Release 3.3.0.0 2 Contents CHAPTER 1 Developer Minjie Zhu Research Associate Civil and Construction Engineering Oregon State University 1.1 Installation 1. PyPi (Windows, Linux, Mac) 2. Other Instalation 1.1.1 PyPi (Windows, Linux, Mac) 1. PyPi (Windows) 2. PyPi (Linux) 3. PyPi (Mac) PyPi (Windows) Install Anaconda • Install Anaconda 3 OpenSeesPy Documentation, Release 3.3.0.0 Install In Jupyter Notebook • Start Jupyter Notebook • run install command in the notebook Install In command line • Start Anaconda Prompt 4 Chapter 1. Developer OpenSeesPy Documentation, Release 3.3.0.0 • To install python-m pip install openseespy python-m pip install--user openseespy • To upgrade python-m pip install--upgrade openseespy python-m pip install--user--upgrade openseespy • To import import openseespy.opensees as ops PyPi (Linux) Install Python • Install Python 3 using your Linux’s package manager – Ubuntu/Debian: sudo apt install python3 python3-pip – Centos/Redhat: sudo yum install python3 python3-pip Install in terminal • To install python3-m pip install openseespy python3-m pip install--user openseespy • To upgrade 1.1. Installation 5 OpenSeesPy Documentation, Release 3.3.0.0 python3-m pip install--upgrade openseespy python3-m pip install--user--upgrade openseespy • To import import openseespy.opensees as ops PyPi (Mac) Install Python • Install Python 3.8 Install in terminal • To install python3.8-m pip install openseespy python3.8-m pip install--user openseespy • To upgrade python3.8-m pip install--upgrade openseespy python3.8-m pip install--user--upgrade openseespy • To import import openseespy.opensees as ops 1.1.2 Other Instalation 1. DesignSafe (Web-based) 2. Windows Subsystem for Linux (Windows) DesignSafe (Web-based) OpenSeesPy has been offical in DesignSafe. 1. OpenSeesPy in DesignSafe 2. Paraview in DesignSafe OpenSeesPy in DesignSafe Follow steps below to run OpenSeesPy in DesignSafe. Tip: 6 Chapter 1. Developer OpenSeesPy Documentation, Release 3.3.0.0 • Go To DesignSafe website and click register Tip: • Register an account for free and log in 1.1. Installation 7 OpenSeesPy Documentation, Release 3.3.0.0 Tip: • Land on your own portal and go to workspace 8 Chapter 1. Developer OpenSeesPy Documentation, Release 3.3.0.0 Tip: • In your workspace, select Jupyter, launch it, and start my server 1.1. Installation 9 OpenSeesPy Documentation, Release 3.3.0.0 Tip: • Now you should be in the Jupyter Notebook • Go to mydata and alwasy save your data under this folder 10 Chapter 1. Developer OpenSeesPy Documentation, Release 3.3.0.0 Tip: • In the mydata folder, select New and then Python 3 Tip: • The OpenSeesPy version on DesignSafe is not the latest. • To update to the latest and import: 1.1. Installation 11 OpenSeesPy Documentation, Release 3.3.0.0 Tip: • Now you can write OpenSeesPy script in Jupyter Notebook, run the script, and show results • To show figure in the Notebook, you should include %matplotlib inline at the beginning 12 Chapter 1. Developer OpenSeesPy Documentation, Release 3.3.0.0 Paraview in DesignSafe DesignSafe provides paraview for viewing OpenSeesPy results: Tip: • Make sure the steps in OpenSeesPy in DesignSafe are completed. Tip: • Go to Workspace and select Visualizaion and Paraview. Tip: • In the Job Submission windows, you should select Working Directory, Maximum job runtime, Job name, and Node Count, and click Run. 1.1. Installation 13 OpenSeesPy Documentation, Release 3.3.0.0 Tip: • You can see the job status on the right 14 Chapter 1. Developer OpenSeesPy Documentation, Release 3.3.0.0 Tip: • Wait until see this windows and connect to Paraview 1.1. Installation 15 OpenSeesPy Documentation, Release 3.3.0.0 Tip: • Now open the pvd file in Paraview 16 Chapter 1. Developer OpenSeesPy Documentation, Release 3.3.0.0 Tip: • Initially, you see nothing • Check the Pipeline Browser • Click on the eye left to the file in Pipeline Browser Tip: • Change the Solid Color to other variables • Change Surface to Surface With Edges 1.1. Installation 17 OpenSeesPy Documentation, Release 3.3.0.0 Windows Subsystem for Linux (Windows) This is a real Linux subsystem for you to run OpenSeesPy Linux version on Windows. Install the Windows Subsystem for Linux Follow the instruction on here to install Windows Subsystem for Linux on Windows 10. There are a couple of Linux distributions available and Ubuntu is recommended. Once the Linux is installed, it will show as an application in the start menu. 18 Chapter 1. Developer OpenSeesPy Documentation, Release 3.3.0.0 Install Anaconda and start Jupyter Notebook • Run the subsystem from start menu and a terminal window will show. • Download Anaconda Linux version with command ~$ wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh • Install Anconda Linux version with commands ~$ bash Anaconda3-2021.05-Linux-x86_64.sh >>> Please answer 'yes' or 'no': >>> yes >>> Anaconda3 will not be installed into this location: [/home/username/anaconda3] >>> (enter) • Start Jupyter Notebook ~$ /home/username/anaconda3/bin/jupyter-notebook • Copy the address in red box to a web browser 1.1. Installation 19 OpenSeesPy Documentation, Release 3.3.0.0 In Jupyter Notebook Start a new notebook and then 20 Chapter 1. Developer OpenSeesPy Documentation, Release 3.3.0.0 In the command line (optional) • Run Anaconda with following command, where username is your username of your computer. Please use the username shown in last step ~$ /home/username/anaconda3/bin/python3.8 • Install or Upgrade OpenSeesPy with commands ~$ /home/username/anaconda3/bin/python3.8 -m pip install openseespy ~$ /home/username/anaconda3/bin/python3.8 -m pip install --upgrade openseespy 1.1. Installation 21 OpenSeesPy Documentation, Release 3.3.0.0 • Run OpenSeesPy First run Anaconda with ~$ /home/username/anaconda3/bin/python3.8 Then import OpenSeesPy with import openseespy.opensees as ops ops.printModel() • run OpenSeesPy scripts /home/username/anaconda3/bin/python3.8 script.py 1.2 Compilation 1. Compilation for Windows 2. Compilation for MacOS 3. Compilation using QT 22 Chapter 1. Developer OpenSeesPy Documentation, Release 3.3.0.0 1.2.1 Compilation for Windows 1.2.2 Compilation for MacOS This is a suggestive guide for MacOS. • Download OpenSees Source code git clone https://github.com/OpenSees/OpenSees.git • Install MacPorts for your macOs. • Install gcc8 sudo port install gcc8 • Install Python 3.8 using MacPorts sudo port install python38 python38-devel • Install boost using Macports sudo port install boost • Create Makefile.def – Copy one of MAKES/Makefile.def.MacOS10.x to the root and rename to Makefile.def – Change the path and variables for your system • Compile – Run make python -j from root – The library file will be at SRC/interpreter/opensees.so 1.2.3 Compilation using QT Following is the OpenSees Compilation using QT by Stevan Gavrilovic github PhD Candidate University of British Columbia Original instructions can be found at here. A Qt build environment for OpenSees OpenSeesQt A Qt build environment for OpenSees – Open System For Earthquake Engineering Simulation Pacific Earthquake Engineering Research Center(http://opensees.berkeley.edu). Qt is an open source, cross-platform development environment that is free for many uses. Please see the license. 1.2. Compilation 23 OpenSeesPy Documentation, Release 3.3.0.0 Dependency The purpose of this project is to create a package that will allow aspiring developers to get started on writing code without having to worry about the compilation environment. A program as large as OpenSees relies on many third- party libraries, often referred to as dependencies. It can be a daunting task assembling, compiling, and linking these libraries. Many times, these libraries depend on other libraries, and so on. The current list of dependencies includes: • MUMPS (5.1.2) • Scalapack (2.0.2.13) • UMFPACK (5.7.7) contained in Suite-Sparse (5.3.0) • SUPERLU (5.2.1) • SUPERLUMT (3.0) • SUPERLUDIST (5.1.0) • Openblas (0.3.5) • Parmetis (4.0.3) • ARPACK (3.6.3) • Libevent (2.1.8) • GCC(8.2.0) • TCL (8.6.9)** Tcl only • Python(3.7.2)** OpenSeesPy only Please ensure that your project complies with each library’s licensing requirements. Another feature of this build platform is modularity. Developers can select from a list of build options that can be turned on and off as required. The basic configuration builds the structural analysis core. Other build options include parallel processing, reliability, and the particle finite element method (PFEM) modules. Python and Tcl interpreters are additional build options. These options are located in single configuration file called qmake.conf. By default, the environment is configured to build the core along with the parallel processing module. Other options can be turned on by deleting the ‘#’symbol that precedes the option; this includes the option into the build environment.