zhuminjie / openseespy Goto Github PK
View Code? Open in Web Editor NEWOpenSeesPy versions, doc, and pip
License: Other
OpenSeesPy versions, doc, and pip
License: Other
I would like to contribute a few patches and hopefully more, but (python+git) newbie question: I forked, cloned, and installed this repo in development mode (pip install -e <local path>
) and I get the error No module named 'openseespy.opensees.win.opensees'
. I understand this is because of the separation of the OpenSees python interpreter from the OpenSeesPy-pip development, but how can I get a working development install? I guess it's a few simple steps, but Googling didn't reveal much for cases when the main package and PyPi are separated such as here. Thanks.
How about OpenSeesPy? Is this opensouce or not?
I only found https://github.com/OpenSeesPy-pip/openseespy-pip and https://github.com/zhuminjie/OpenSeesPyDoc
cheers bernd
Hi
I'm trying to run the following script using OpenSeesPy version 3.2.0:
https://gist.github.com/dact221/48e0e762e785784e10c8f5c7823da590
but Get_Rendering.py raises an exception due to inconsistent use of tabs and spaces.
Traceback (most recent call last):
File "dambreak.py", line 116, in <module>
from openseespy.postprocessing.Get_Rendering import *
File "C:\Users\user\miniconda3\envs\opensees\lib\site-packages\openseespy\postprocessing\Get_Rendering.py", line 495
eleList = getEleTags()
^
TabError: inconsistent use of tabs and spaces in indentation
With the increased pace of OpenSeesPy development along with increased interest in and development of visualization and other associated packages, some in the openseespy-pip repo and others not, it's probably time to move the current visualization packages out of the openseespy-pip package.
This will allow the "core" OpenSeesPy and the auxiliary packages to develop at their own pace and not be dependent on each other. Errors in the core will have less effect on the packages and vice versa.
Thoughts on when this should happen? @zhuminjie @sewkokot @u-anurag @millen1m @ccaprani @silviamazzoni
Dear Professor Zhu,
This is not an "issue" but it is more of an inquiry.
I was wondering whether the progressive collapse algorithm, previously developed for OpenSees in Tcl by Mousalam et al. [1-3] and implemented within an infill removal example on OpenSees wiki as a recorder, is implemented in OpenSeesPy?
Thank you very much in advance for your assistance on the matter.
Kindest Regards,
Al Mouayed Bellah Nafeh
#-------------------------------------------------------------------------------------#
Link to example model:
https://opensees.berkeley.edu/wiki/index.php/Infill_Wall_Model_and_Element_Removal)
References for the removal algorithm:
Hello,
I am using a recorder for a basic analysis. Unfortunately, the output file is not fully closed by the interpreter (Spyder and Jupyter). This leaves the text file incomplete even if the run is complete. The file is fully written by the interpreter when I close the interpreter or record the data to a different file in a new run.
My question is how do we close the recorders?
Dear Developers,
I was trying make use of OpenSeespy rendering module (Get_Rendering) after the new developments. I have put the post-processing commands into trial by using the very recent example provided by Mr. Anurag Upadhyay who is the main developer of the module I believe. I was hoping that you can help me to animate the response since I am getting an error related to matplotlib module. The example I am using and the associated error are given below. Thank you in advance.
Python File
import openseespy.postprocessing.Get_Rendering as opsplt
import openseespy.opensees as ops
#Define Nodes
ops.wipe()
ops.model('Basic', '-ndm', 3, '-ndf', 6)
ops.node(1 , 0.0, 1.0, 0.0)
ops.node(2 , 0.0, 0.5, 0.0)
ops.node(3 , 0.0, 0.0, 0.0)
ops.node(4 , 1.0, 1.0, 0.0)
ops.node(5 , 1.0, 0.5, 0.0)
ops.node(6 , 1.0, 0.0, 0.0)
ops.node(7 , 2.0, 1.0, 0.0)
ops.node(8 , 2.0, 0.5, 0.0)
ops.node(9 , 2.0, 0.0, 0.0)
ops.node(10, 3.0, 1.0, 0.0)
ops.node(11, 3.0, 0.5, 0.0)
ops.node(12, 3.0, 0.0, 0.0)
ops.node(13, 4.0, 1.0, 0.0)
ops.node(14, 4.0, 0.5, 0.0)
ops.node(15, 4.0, 0.0, 0.0)
ops.node(16, 5.0, 1.0, 0.0)
ops.node(17, 5.0, 0.5, 0.0)
ops.node(18, 5.0, 0.0, 0.0)
ops.node(19, 6.0, 1.0, 0.0)
ops.node(20, 6.0, 0.5, 0.0)
ops.node(21, 6.0, 0.0, 0.0)
ops.node(22, 7.0, 1.0, 0.0)
ops.node(23, 7.0, 0.5, 0.0)
ops.node(24, 7.0, 0.0, 0.0)
ops.node(25, 8.0, 1.0, 0.0)
ops.node(26, 8.0, 0.5, 0.0)
ops.node(27, 8.0, 0.0, 0.0)
ops.node(28, 9.0, 1.0, 0.0)
ops.node(29, 9.0, 0.5, 0.0)
ops.node(30, 9.0, 0.0, 0.0)
ops.node(31, 10.0,1.0, 0.0)
ops.node(32, 10.0,0.5, 0.0)
ops.node(33, 10.0,0.0, 0.0)
ops.fix(1,1,1,1,1,1,1)
ops.fix(2,1,1,1,1,1,1)
ops.fix(3,1,1,1,1,1,1)
#Define Materials
ops.nDMaterial('ElasticIsotropic', 2, 1.200E+006, 0.0)
ops.nDMaterial('PlateFiber',601,2)
ops.section('PlateFiber',701,601,0.1)
#Define Shell Elements
ops.element('ShellNLDKGQ', 1 , 2 , 5 , 4 , 1 ,701)
ops.element('ShellNLDKGQ', 2 , 3 , 6 , 5 , 2 ,701)
ops.element('ShellNLDKGQ', 3 , 5 , 8 , 7 , 4 ,701)
ops.element('ShellNLDKGQ', 4 , 6 , 9 , 8 , 5 ,701)
ops.element('ShellNLDKGQ', 5 , 8 , 11 , 10 , 7 ,701)
ops.element('ShellNLDKGQ', 6 , 9 , 12 , 11 , 8 ,701)
ops.element('ShellNLDKGQ', 7 , 11 , 14 , 13 , 10 ,701)
ops.element('ShellNLDKGQ', 8 , 12 , 15 , 14 , 11 ,701)
ops.element('ShellNLDKGQ', 9 , 14 , 17 , 16 , 13 ,701)
ops.element('ShellNLDKGQ', 10, 15, 18, 17, 14, 701)
ops.element('ShellNLDKGQ', 11, 17, 20, 19, 16, 701)
ops.element('ShellNLDKGQ', 12, 18, 21, 20, 17, 701)
ops.element('ShellNLDKGQ', 13, 20, 23, 22, 19, 701)
ops.element('ShellNLDKGQ', 14, 21, 24, 23, 20, 701)
ops.element('ShellNLDKGQ', 15, 23, 26, 25, 22, 701)
ops.element('ShellNLDKGQ', 16, 24, 27, 26, 23, 701)
ops.element('ShellNLDKGQ', 17, 26, 29, 28, 25, 701)
ops.element('ShellNLDKGQ', 18, 27, 30, 29, 26, 701)
ops.element('ShellNLDKGQ', 19, 29, 32, 31, 28, 701)
ops.element('ShellNLDKGQ', 20, 30, 33, 32, 29, 701)
##Create an output database to be read by opsenSeesPy visualization library
##Database name = CantiBeam_ODB, loadcase name = Push, recorded modeshapes = 0
opsplt.createODB("CantiBeam","Push",0)
#Define recorders
ops.recorder('Node', '-file', 'disp1.txt','-time','-nodeRange', 1, 33,'-dof', 1, 'disp')
ops.recorder('Node', '-file', 'disp3.txt','-time','-nodeRange', 1, 33,'-dof', 3, 'disp')
ops.recorder('Node', '-file', 'reaction1.txt',' -time','-nodeRange', 1, 3 ,'-dof', 1, 2, 3, 'reaction')
ops.record()
#Define loading
ops.timeSeries("Linear", 1)
ops.pattern('Plain', 1, 1)
ops.load(32, 0.0, 0.0, 0.0, 0,15.702963,0)
#Define analysis
ops.constraints('Plain')
ops.numberer('RCM')
ops.system('BandGeneral')
ops.test('NormDispIncr', 1e-3, 1000, 2)
ops.algorithm('KrylovNewton')
ops.integrator('LoadControl', 0.001)
ops.analysis('Static')
ops.analyze(4000)
ops.wipe()
opsplt.plot_model("node", Model="CantiBeam")
opsplt.plot_deformedshape(Model="CantiBeam",LoadCase="Push", overlap="no", tstep=2.0, scale=1.0)
opsplt.plot_deformedshape(Model="CantiBeam",LoadCase="Push", overlap="no", scale=1.0)
ani=opsplt.animate_deformedshape(Model="CantiBeam",LoadCase="Push",dt=0.01, scale=1, timeScale=10, Movie = "CantiBeam")
Error
Traceback (most recent call last):
File "C:\Users\Volkan\Desktop\trial\trial.py", line 101, in
ani=opsplt.animate_deformedshape(Model="CantiBeam",LoadCase="Push",dt=0.01, scale=1, timeScale=10, Movie = "CantiBeam")
File "C:\Users\Volkan\AppData\Roaming\Python\Python38\site-packages\openseespy\postprocessing\Get_Rendering.py", line 1070, in animate_deformedshape
ani.save(Movfile, writer='ffmpeg')
File "C:\Users\Volkan\anaconda3\lib\site-packages\matplotlib\animation.py", line 1109, in save
writer = alt_writer(
TypeError: 'str' object is not callable
Hello,
Firstly, I am very sorry to post this here if it is not an OpenSees issue. I was just not sure if this is an issue or my problem only. I tried this both on my computer and DesignSafe platform.
I was wondering if at the moment it is possible to run OpenSeespy as in OpenSeesSP (parallel processing without user-defined partitions).
Then, I found the presentation by Dr. Minjie,
https://www.youtube.com/watch?v=vjGm2kM5Ihc
I followed the examples provided in the presentation. In particular, I am using Ubuntu as Linux OS distro. In the case of an example with the auto partitioning approach (auto_partition = True
), I am getting the error below when I execute mpiexec -np 2 python parallel_truss_sp.py
. Yet this does not happen in the case of user-defined partitioning approach (auto_partition = False
). I was wondering what is the problem here and what might cause this? Can it be related to ops.partition()
command? Yet, this seemed to be working perfectly in the presentation that made me wonder if I am doing something wrong.
Operating System==Linux 5.11.0-34-generic 20.04.1-Ubuntu
OpenSeesPy==3.3.0.1.1
MPICH==3.3.2
===================================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= PID 43838 RUNNING AT volkan-GL702VMK
= EXIT CODE: 139
= CLEANING UP REMAINING PROCESSES
= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================
YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault (signal 11)
This typically refers to a problem with your application.
Please see the FAQ page for debugging suggestions>
The code inside parallel_truss_sp.py can be found here:
import openseespy.opensees as ops
# truss model
# 8 nodes and 13 elements
# 6 8 7
# -----------
# /|\ | /|\
# / | \ | / | \
# / | \ | / | \
# / | \|/ | \
# -------------------
# 1 2 3 4 5
auto_partition = True
pid = ops.getPID()
np = ops.getNP()
if np > 2:
exit()
ops.model('basic', '-ndm', 2, '-ndf', 2)
ops.uniaxialMaterial('Elastic', 1, 3000.0)
if auto_partition:
ops.node(1, 0.0, 0.0)
ops.node(2, 72.0, 0.0)
ops.node(3, 144.0, 0.0)
ops.node(6, 72.0, 96.0)
ops.node(8, 144.0, 96.0)
ops.fix(1, 1, 1)
ops.element('Truss', 1, 1, 6, 10.0, 1)
ops.element('Truss', 2, 1, 2, 10.0, 1)
ops.element('Truss', 3, 2, 6, 10.0, 1)
ops.element('Truss', 4, 2, 3, 10.0, 1)
ops.element('Truss', 5, 3, 6, 10.0, 1)
ops.element('Truss', 6, 3, 8, 10.0, 1)
ops.element('Truss', 12, 6, 8, 10.0, 1)
ops.node(4, 216.0, 0.0)
ops.node(5, 288.0, 0.0)
ops.node(7, 216.0, 96.0)
ops.fix(5, 1, 1)
ops.element('Truss', 7, 3, 7, 5.0, 1)
ops.element('Truss', 8, 4, 7, 5.0, 1)
ops.element('Truss', 9, 5, 7, 5.0, 1)
ops.element('Truss', 10, 3, 4, 5.0, 1)
ops.element('Truss', 11, 4, 5, 5.0, 1)
ops.element('Truss', 13, 7, 8, 5.0, 1)
ops.timeSeries('Linear', 1)
ops.pattern('Plain', 1, 1)
ops.load(7, 100.0, 0.0)
ops.partition()
else: # User defined partitioning
if pid ==0:
ops.node(1, 0.0, 0.0)
ops.node(2, 72.0, 0.0)
ops.node(3, 144.0, 0.0)
ops.node(6, 72.0, 96.0)
ops.node(8, 144.0, 96.0)
ops.fix(1, 1, 1)
ops.element('Truss', 1, 1, 6, 10.0, 1)
ops.element('Truss', 2, 1, 2, 10.0, 1)
ops.element('Truss', 3, 2, 6, 10.0, 1)
ops.element('Truss', 4, 2, 3, 10.0, 1)
ops.element('Truss', 5, 3, 6, 10.0, 1)
ops.element('Truss', 6, 3, 8, 10.0, 1)
ops.element('Truss', 12, 6, 8, 10.0, 1)
# common nodes (This is necessary!)
if pid ==1 or np == 1:
if pid == 1:
ops.node(3, 144.0, 0.0)
ops.node(8, 144.0, 96.0)
ops.node(4, 216.0, 0.0)
ops.node(5, 288.0, 0.0)
ops.node(7, 216.0, 96.0)
ops.fix(5, 1, 1)
ops.element('Truss', 7, 3, 7, 5.0, 1)
ops.element('Truss', 8, 4, 7, 5.0, 1)
ops.element('Truss', 9, 5, 7, 5.0, 1)
ops.element('Truss', 10, 3, 4, 5.0, 1)
ops.element('Truss', 11, 4, 5, 5.0, 1)
ops.element('Truss', 13, 7, 8, 5.0, 1)
ops.timeSeries('Linear', 1)
ops.pattern('Plain', 1, 1)
ops.load(7, 100.0, 0.0)
if pid == 0:
print('Partition 0')
print('nodes =', ops.getNodeTags())
print('eles =', ops.getEleTags())
ops.barrier()
if pid == 1:
print('Partition 1')
print('nodes =', ops.getNodeTags())
print('eles =', ops.getEleTags())
ops.constraints('Transformation')
ops.numberer('ParallelRCM')
ops.system('Mumps')
ops.test('NormDispIncr', 1e-6, 6, 0)
ops.algorithm('Newton')
ops.integrator('LoadControl', 0.1)
ops.analysis('Static')
ops.analyze(10)
print('Node 8: ', [ops.nodeCoord(8), ops.nodeDisp(8)])
What's the right syntax to use this command through the python interpreter, because the documentation only refers to the tcl interpreter.
In particular I have the following issue :
When I want to parameterize a variable (e.g. E), for element (e.g. tag=4 ) with material (e.g. tag=1 ) following the documentation documentation the tcl code would be :
parameter tag element 4 material 1 E
I'd would translate in python language in the following way :
ops.parameter(tag, 'element', 4, 'material', 1, E)
In my case, my element has two different materials. The command above parametrize E for both materials, but that's not that I want. I just want to parametrize the variable E for the material with tag 1.
thanks for your very useful library, i know that vtk recorder is implemented in opensees, how can i use that in openseespy?
Python 3.7.4 (default, Mar 8 2020, 10:34:00)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import openseespymac.opensees
[1] 15847 segmentation fault python
I am trying to install openseespy on my windows machine and am running into problems:
>>> import openseespy.opensees as ops
Traceback (most recent call last):
File "C:\Users\aboufira\AppData\Local\Continuum\miniconda3\envs\11204496_Turnkey\lib\site-packages\openseespy\opensees\__init__.py", line 21, in <module>
from openseespy.opensees.win.opensees import *
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\aboufira\AppData\Local\Continuum\miniconda3\envs\11204496_Turnkey\lib\site-packages\openseespy\opensees\__init__.py", line 26, in <module>
'Failed to import openseespy. Anaconda is recommended https://www.anaconda.com/distribution/')
RuntimeError: Failed to import openseespy. Anaconda is recommended https://www.anaconda.com/distribution/
I am using an anaconda environment with 64-bit python 3.7.6 installed. I installed openseespy as instructed by the documentation using pip. Please help?
I have added new material on the OpenSees, so how do I build OpenSeesPy using my opensess.so. in ubuntu 18.
I am using Thonny 3.3.4 and Pyhton 3.7.9 version and trying to import OpenseesPy with 'import openseespy.opensees as ops'.
My computer operating system 64 bit Windows but I have an error ‘RuntimeError: 64 bit system is required’ after run. Do I need to use another program or version to use OpenseesPy ?
Thank you so much
With my best regards.
If a recorder commands is specified as follows on a Windows machine:
ops.recorder('Node', '-file', parent_dir + '/node2_disp.out', '-node', 2, '-dof', *[1, 2, 3, 4, 5, 6], 'disp')
where parent_dir
is absolute path containing whitespaces, no recorder output files are produced.
Eliminating whitespaces from the absolute path also eliminates the issue.
I cannot seem to run opy.setParameter('-val', 0, '-ele', 1, 'FirstCall', 1)
for the PM4Sand object. Which means that all parameters that are not defined are not using their default values. I have a script in tcl and a python script with identical commands line-by-line. Line 65 on the python version opy.setParameter('-val', 0, '-ele', 1, 'FirstCall', 1)
seems to have no effect if you comment it out. While if you comment it out in the tcl version you get the result changes to the python result.
The problem also exists for the opy.setParameter('-val', 0.3, '-ele', 1, 'poissonRatio', 1)
- so most likely related to the setParameter command.
I have run it on openseespy mac and windows and then recompiled from source code and same issue.
pm4_single_tcl.txt
pm4sand_op_et_py.txt
Output from tcl:
1 update Material Stage
-42.855021 -99.995049 -0.000000
-42.855021 -99.995049 -0.000000
1 update Material Stage
1 initialize
0.00000000000000000000
-42.855021 -99.995049 -0.000000
0.00125000000000000003
-0.00059250777930314788
-48.979603 -91.582329 14.213940
Output from py:
1 update Material Stage
[-42.85502116299399, -99.99504938031912, -0.0]
[-42.85502116299399, -99.99504938031912, -0.0]
1 update Material Stage
h_disp1: 0.0
curr_stress: [-42.85502116299399, -99.99504938031912, -0.0]
h_disp: 0.00125
v_disp: -0.0005925077793031479
curr_stress: [-90.45700033601655, -153.86539845995378, 24.894213474628412]
Hi,
the 'saveFiberData2D' function in 'Get_Rendering' will not work for zeroLengthSection elements, since this type of elements and their recorder don not have integration points numbers, a simple suggestion could be like this:
if sectionNumber == 0:
ops.recorder('Element' , '-file', FiberDir, '-time', '-dT', deltaT, '-ele', eleNumber, 'section', 'fiberData')
else:
ops.recorder('Element' , '-file', FiberDir, '-time', '-dT', deltaT, '-ele', eleNumber, 'section', str(sectionNumber), 'fiberData')
Also, I have a problem when running "Get_Rendering.plot_fiberResponse2D" in the same script after performing the analysis it gives an error raise ValueError("Wrong number of columns at line %d"
, i think it happens because the file is not closed properly.
thanks for your great work
I was a little nervous to create a pull request, but I've recently published some tools that can be used to animate and plot OpenSeesPy models, as well as do some data analysis:
https://github.com/cslotboom/OpenSeesPyTools
For my model plotting functions, I've used the original plot function from @u-anurag as a base.
I'd be happy to contribute any of this code to base package, or collaborate with people using them. However, I'm not sure how receptive people are to changes in the existing plot functions. I'm also not sure what the appetite is for non plotting functions. Either way, I just thought I would get the ball rolling.
Some notable comments:
On Ubuntu 18.04 I get the following error when I 'import openseespy.opensees as ops'
ImportError: /home/mhscott/.local/lib/python3.6/site-packages/openseespy/opensees/linux/lib/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/lib/python3/dist-packages/matplotlib/_path.cpython-36m-x86_64-linux-gnu.so)
Process 0 Terminating
If before importing OpenSees, I 'import matplotlib.pyplot as plt', the import error goes away. There must be a missing library in openseespy.opensees
OS:
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
python3 install
Installed /usr/local/lib/python3.6/dist-packages/openseespy-3.2.2.5-py3.6.egg
Processing dependencies for openseespy==3.2.2.5
Finished processing dependencies for openseespy==3.2.2.5
This issue is user error, but results in a kernel restart with no warning or other graceful exit/info.
MWE follows:
import openseespy.opensees as osp
# Set up the model
osp.wipe()
osp.model("basic", "-ndm", 3)
osp.node(1, 0, 0, 0)
osp.node(2, 0, 5, 0)
osp.node(3, 0, 5, 5)
fixed = 6 * [1]
osp.fix(1, *fixed)
# Define geometry transforms
osp.geomTransf("Linear", 1, *[-1, 0, 0])
osp.geomTransf("Linear", 2, *[0, 0, 1]) # <---- note subtly wrong vecxz
# Some reasonable properties (~300x600mm RC)
A, E, G, J, Iz, Iy = 0.18, 30e9, 12e9, 0.01, 0.005, 0.005
# define elements
ele_type = "elasticBeamColumn"
# tag *[ndI ndJ] A E G Jx Iy Iz transfOBJs
osp.element(ele_type, 1, 1, 2, A, E, G, J, Iz, Iy, 1)
osp.element(ele_type, 2, 2, 3, A, E, G, J, Iz, Iy, 2) # <-- crashes
Dear Dr. Zhu,
I tried to build an openses model in a function, and then called this function multiple times in a loop.I found that if I did this, there would be a memory leak. It's as if ops.wipe() didn't work. I put the complete code below, can you help me? Thank you!
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Date: 2020/10/26
import openseespy.opensees as ops
import numpy as np
def my_function(dispy,u,T,gm,dt):
ops.wipe()
pi = np.pi
alpha = 0.16
k1 = 1.0
k2 = alpha * k1
sigAct = k1 * dispy
beta = 0.5
epsslip = 0.0
epsbear = 0.0
rbear = k1
GMfatt = 1
m = ((T ** 2) * k1) / (4 *(pi ** 2))
# GMSineAccAmpl = 0.5 * 9.8
# TPeriodSine = 0.35
# DurationSine = 3
# TmaxAnalysis = 50
###########################################################################################################
wave= np.random.random((2000,))
wavelength = wave.shape[0]
ops.model('Basic', '-ndm', 2, '-ndf', 2)
node1 = [0.0, 0.0]
node2 = [0.0, 0.0]
ops.node(1, *node1)
ops.node(2, *node2)
eleNodes = [1, 2]
ops.fix(1, 0, 1)
ops.fix(2, 1, 1)
ops.mass(1, m, 0)
matTag = 1
eleTag = 1
ops.uniaxialMaterial('SelfCentering', matTag, k1, k2, sigAct, beta, epsslip, epsbear, rbear)
ops.element('zeroLength', eleTag, *eleNodes, '-mat', matTag, '-dir', 1,'-doRayleigh', 1)
##########################################################################################################
xDamp = 0.05 # 5% damping ratio
MpropSwitch = 1.0
KcurrSwitch = 0.0
KcommSwitch = 0.0
KinitSwitch = 1.0
omega = (2 * pi) / T
alphaM = 2 * MpropSwitch * xDamp * omega
betaKcurr = (KcurrSwitch * 2 * xDamp) / omega
betaKcomm = (KcommSwitch * 2 * xDamp) / omega
betaKinit = (KinitSwitch * 2 * xDamp) / omega
ops.rayleigh(alphaM, betaKcurr, betaKinit, betaKcomm)
wave = list(wave)
# print(len(wave))
###########################################################################################################
ops.timeSeries('Path', 1, '-dt', dt, '-values', *wave, '-factor', GMfatt)
ops.pattern('UniformExcitation', 1, 1, '-accel', 1)
ops.constraints('Transformation')
ops.numberer('RCM')
ops.system('BandGeneral')
ops.test('NormDispIncr', 1.0e-12, 10, 0)
ops.algorithm('Newton')
ops.integrator('Newmark', 0.5, 0.25)
ops.analysis('Transient')
nPts = wavelength
tFinal = nPts * dt
tCurrent = ops.getTime()
ok = 0
u_1 = []
time_1 = [tCurrent]
###################Perform the transient analysis############################################################
while ok == 0 and tCurrent < tFinal:
ok = ops.analyze(1, dt)
# if the analysis fails try initial tangent iteration
if ok != 0:
print("regular newton failed .. lets try an initail stiffness for this step")
ops.test('NormDispIncr', 1.0e-12, 10, 0)
ops.algorithm('ModifiedNewton', '-initial')
ok = ops.analyze(1, dt)
if ok == 0:
print("that worked .. back to regular newton")
ops.test('NormDispIncr', 1.0e-12, 10)
ops.algorithm('Newton')
tCurrent = ops.getTime()
time_1.append(tCurrent)
# print(ops.nodeDisp(1, 1),'++++++++++++++++++++++++++')
u_1.append(ops.nodeDisp(1, 1))
ops.wipe()
###########################################################################################################
max_disp =np.max(np.abs(np.array(u_1)))
u1 = max_disp / dispy
return u1 - u
if __name__ =='__main__':
while True:
dispy = 0.001
u =2
T = 0.01
gm = 1
dt = 0.01
my_function(dispy, u, T, gm, dt)
I get the following error when attempting to use the recordNodeDisp() function with the plot_deformedshape() function. My model is a simple 2D beam with multiple elements. @u-anurag
`---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
in
49 Pplot.append(ops.getLoadFactor(1))
50
---> 51 opsplt.recordNodeDisp()
52 opsplt.plot_deformedshape()
53
~/.local/lib/python3.6/site-packages/openseespy/postprocessing/Get_Rendering.py in recordNodeDisp(filename)
508 # It can be used later in the plot_deformedshape function.
509 nodeList = getNodeTags()
--> 510 if len(nodeCoord(nodeList[0])) == 2:
511 dofList = [1, 2]
512 if len(nodeCoord(nodeList[0])) == 3:
IndexError: list index out of range`
Hi
I'm trying to run the following script using OpenSeesPy version 3.2.0:
https://gist.github.com/dact221/48e0e762e785784e10c8f5c7823da590
After replacing spaces with tabs due to issue #24, the script gets correctly interpreted, but the simulation stops after a few iterations and fails to generate the correct pvd file.
When I downgrade to version 3.1.5.12, the script runs as expected and generate pvd file with all timesteps. Also, version 3.1.5.12 is free of issue #24.
hi,
was trying out the Python bindings for opensees for mac but ran into an ImportError.
Traceback (most recent call last):
File "/Users/vanmelet/Code/compas_fem/examples/opensees/ElasticTruss.py", line 1, in <module>
from openseespymac.opensees import *
ImportError: dlopen(/Users/vanmelet/anaconda3/envs/fem/lib/python3.7/site-packages/openseespymac/opensees.so, 2): Library not loaded: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/Python
Referenced from: /Users/vanmelet/anaconda3/envs/fem/lib/python3.7/site-packages/openseespymac/opensees.so
Reason: image not found
would you have any advice on how to solve this?
thanks!
The default Mac OS Python version is 2.7. Python 3 has to be installed manually and there are several ways to do this properly on a Mac:
The right and wrong way to set Python 3 as default on a Mac
I recommend “Homebrew"
Note that this error can also occur or if Python 3 is installed in a non-standard path on the system directory. This is the case when Python 3 is installed through Conda. OpenSeesPy looks for Python in the paths where system libraries are usually found, i.e., /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/Python. If Python 3 is installed from Homebrew, or through the installer from the Python website, it should find the library. If not, then you will run into errors.
Dear Dr. Zhu,
I try to import openseespy on a linux system (ubuntu:20.04) and the following error message appeared
File "/home/labstruct/.local/lib/python3.8/site-packages/openseespy/opensees/init.py", line 12, in
from openseespy.opensees.linux.opensees import *
ImportError: /home/labstruct/.local/lib/python3.8/site-packages/openseespy/opensees/linux/lib/librt.so.1: undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
During handling of the above exception, another exception occurred:Traceback (most recent call last):
File "", line 1, in
File "/home/labstruct/.local/lib/python3.8/site-packages/openseespy/opensees/init.py", line 15, in
raise RuntimeError('Failed to import openseespy on Linux.')
RuntimeError: Failed to import openseespy on Linux.
my version of python is 3.8.5, I have a version 3.2.2.1 installed in another cluster (ubuntu) and I don't have that problem.
The second time I import the library it does it without problems.
What is wrong with this. I cant get it to run.
import openseespy.opensees as ops
import openseespy.postprocessing.Get_Rendering as opsplt
import openseespy.postprocessing.ops_vis as opsv
import numpy as np
import matplotlib.pyplot as plt
ops.wipe()
ops.model('basic', '-ndm', 3, '-ndf',6)
ops.node(1, 0.0, 0.0, 0)
ops.node(2, 8.0, 0.0, 0)
ops.node(3, 8.0, 6.0, 0.0)
ops.node(4, 0 , 6 , 0)
ops.node(5, 0.0, 0.0, 5)
ops.node(6, 8.0, 0.0, 5)
ops.node(7, 8.0, 6.0, 5)
ops.node(8, 0 , 6 , 5)
ops.fix(1, 1, 1, 1, 1, 1, 1)
ops.fix(2, 1, 1, 1, 1, 1, 1)
ops.fix(3, 1, 1, 1, 1, 1, 1)
ops.fix(4, 1, 1, 1, 1, 1, 1)
A, Iz, Iy, J = 0.04, 0.0010667, 0.0002667, 0.011721617
E = 25.0e618
G = 964.6
gTTagz = 1
gTTagx = 2
gTTagy = 3
coordTransf = 'Linear'
ops.geomTransf(coordTransf, gTTagx, -1, 0, 0)
ops.geomTransf(coordTransf, gTTagz, 0, 0, 1)
ops.element('elasticBeamColumn', 1, 1, 5, A, E, G, J, Iy, Iz, gTTagx)
ops.element('elasticBeamColumn', 2, 2, 6, A, E, G, J, Iy, Iz, gTTagx)
ops.element('elasticBeamColumn', 3, 3, 7, A, E, G, J, Iy, Iz, gTTagx)
ops.element('elasticBeamColumn', 4, 4, 8, A, E, G, J, Iy, Iz, gTTagx)
ops.element('elasticBeamColumn', 5, 5, 6, A, E, G, J, Iy, Iz, gTTagz)
ops.element('elasticBeamColumn', 6, 6, 7, A, E, G, J, Iy, Iz, gTTagz)
ops.element('elasticBeamColumn', 7, 7, 8, A, E, G, J, Iy, Iz, gTTagz)
ops.element('elasticBeamColumn', 8, 8, 5, A, E, G, J, Iy, Iz, gTTagz)
ops.timeSeries('Constant', 1)
ops.pattern('Plain', 1, 1)
ops.load(5, 1000, 1000, 1000, 0., 0., 0.)
ops.constraints('Transformation')
ops.numberer('RCM')
ops.system('BandGeneral')
ops.test('NormDispIncr', 1.0e-6, 6, 2)
ops.algorithm('Linear')
ops.integrator('LoadControl', 1)
ops.analysis('Static')
ops.analyze(1) # crashes here.
I'm running into problems importing the "compiled" openseespy version.
Before, I’ve compiled successfully the opensees project and the .exe file of the tcl interpreter works perfectly.
The compilation of the OpenSeesPy37 also succeed but I cannot import the .pyd file with my python interpreter nor install it locally with the through the setup install. The output build showed some warnings (see the screenshot below).
My operating system is Windows 10 and I’m using MVS 2019 Version 16.7.0. To compile OpenSeesPy I’ve included the libraries and folder of python 3.7.8 interpreter, the shared version included in MVS because it has already installed the debugging symbols and debug binaries.
I've also tried to compile with /Z7 to avoid the LNK4099 issue but it doesn't solve the problem.
Thank you in advance for your support.
Let's add some more features to the plotting functions. We are not trying to create a GUI. Only command-based plotting to make it easy for users. We will utilize already existing recorder functions as much as possible. Here are some thoughts.
All the recorded output to be saved in a specific folder with a unique name. I like the idea of getting the output file name as an input in plot_deformedshape() function. Instead, ask for the output folder name and add "_ODB" (e.g. TwoSpanBridge_ODB or TwoSpanBridge_ospyODB) to it. In this way, this folder will be uniquely created by OpenSeesPy and there won't be any probability of overwriting the output by another model/analysis.
Add recorders for element forces (beamColumn, shell, solid), stress-strain (shell, solid), deformation/node displacement (already there), velocity, acceleration etc. Each output should have a separate file s.a. TwoSpanBridge_ODB_NodeDisp.out, TwoSpanBridge_ODB_EleForces.out.
Commands such as plot_eleforces(output_foldername, show_values="yes") etc.
There should be mapping for the elements to distinguish between beamColumn, shell, solid while recording the output so file read error can be avoided.
We will improvise as we go. Any inputs and discussion are welcomed. Is it something you would want to collaborate on @gaaraujo?
Recently @sewkokot added some good functions to the OpenSees python interpreter that I wanted before v3.4 release (e.g. getEleClassTags()
, getEleLoadClassTags()
). So I've built both OpenSees and OpenSeesPy from scratch successfully, but the functions are not in the built module! Why could this be?
And just to be clear, the functions are in the python wrapper and seem 'wired in'!
More detail on the builds in case it helps:
opensees.so
created in the ../SRC/interpreter directorycopy_linux_library
from build_pip.py
to make sure opensees.so
is in ../openseespy-pip/openseespylinux-pip/openseespy folder and the right dependencies are in ../lib.python test_openseespylinux.py
which succeedsgetEleClassTags()
gives AttributeError: module 'openseespylinux.opensees' has no attribute 'getEleClassTags'
!pip install openseespy
Requirement already satisfied: openseespy in c:\programdata\anaconda\lib\site-packages (3.3.0.0)
Requirement already satisfied: openseespywin==3.3.0.0; platform_system == "Windows" in c:\programdata\anaconda\lib\site-packages (from openseespy) (3.3.0.0)
"""
Created on Thu May 27 18:50:06 2021
@author: karim
"""
import openseespy.opensees as ops
Traceback (most recent call last):
File "", line 7, in
import openseespy.opensees as ops
File "C:\ProgramData\Anaconda\lib\site-packages\openseespy\opensees_init_.py", line 22, in
raise RuntimeError('Failed to import openseespy on Windows.')
RuntimeError: Failed to import openseespy on Windows.
Hello. I have been facing this issue for the past couple of days trying to install openseespy on a spare laptop.
On import, I get the following mesage:
>>> import openseespy.opensees as oop
Illegal instruction (core dumped)
(from a jupyter notebook the kernel just dies)
See zip file (contains long text file)
System Info.zip
Please let me know if there is anything I could do to make this work
Thank you
Dear Dr. Zhu,
Is there any issue with regards to the implementation of the NewtonLineSearch algorithm? Or is it me who is doing something wrong?
Thanks
# Run the dynamic analysis
# Wipe any previous analysis object
op.wipeAnalysis()
# SolutionAlgorithm -- determines the sequence of steps taken to solve the non-linear equation at the current time step
# op.algorithm('Newton', '-initial')
op.algorithm('NewtonLineSearch', '-Bisection')
# DOF_Numberer -- determines the mapping between equation numbers and degrees-of-freedom
op.numberer('RCM')
# SystemOfEqn/Solver -- within the solution algorithm, it specifies how to store and solve the system of equations in the analysis
op.system('SparseGeneral')
# Constraints handler: determines how the constraint equations are enforced in the analysis -- how it handles the boundary conditions/imposed displacements
op.constraints('Transformation')
# Integrator -- determines the predictive step for time t+dt
op.integrator('Newmark', 0.5, 0.25)
# AnalysisType -- defines what type of analysis is to be performed ('Static', 'Transient' etc.)
op.analysis('Transient')
# Convergence Test -- determines when convergence has been achieved.
tol = 1.0e-8
iterations = 50
op.test('NormDispIncr', tol, iterations, 0, 2)
I would like to use OpenSeesPy on HPC JUPYTER of DesignSafe. However, I'm in trouble with installing it.
Info about HPC JUPYTER
pip install openseespy --user
ERROR: Could not find a version that satisfies the requirement openseespy
ERROR: No matching distribution found for openseespy
May I ask whether OpenSeespy supports System CUSP and GPU accelerated solution?
Should openseespy run correctly on a virtual environment? What I've done:
pip install openseespy
import openseespy.opensees
The error I get:
ImportError: DLL load failed while importing opensees: The specified module could not be found.
During handling of the above exception, another exception occurred:
File ".\run.py", line 1, in <module>
from openseespy.opensees import *
File ".\env\lib\site-packages\openseespy\opensees\__init__.py", line 39, in <module>
raise RuntimeError(
RuntimeError: Failed to import openseespy on Windows for Python 3.8
Hi, I wanted to test openseespymac
on macOS 10.15.4.
openseespymac-10.15.2019-py3-none-any.whl
This is my python console output:
Python 3.7.7 (default, Mar 26 2020, 10:32:53)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import openseespymac.opensees
[1] 20665 segmentation fault python
openseespy did not recognize Brick20N element?
https://openseespydoc.readthedocs.io/en/latest/src/Brick20N.html
this command gives me that error:
element('Brick20N', 1, [1, 10, 95, 19, 61, 105, 222, 192, 9, 93, 94, 20, 104, 220, 221, 193, 62, 103, 219, 190], 1)
thanks.
I'm trying to animate a colored line based on x-axis values. Basically I want the sine wave line to be colored differently between 0-2 seconds, 2-4 seconds 4-6 seconds, and 6-8 seconds. I can draw a line with different colors but I can't animate it. I'm just wondering how this can be done.
Thanks.
I used your best app in designsafe but I can not use it in windows (and when I called it from Matlab)
my console : vscode
Way that I import:
error:
DLL load failed: The specified module could not be found.
and I am sure I installed it correctly with pip in python it self not in conda:
and I test it too:
When trying to save the model using the database command, only the option 'File' works as expected. The lines
ops.database('MySQL', 'foo')
ops.save(1)
throw for the options MySQL and BerkeleyDB a warning:
WARNING No database type exists for database of type:BerkeleyDBvalid database type File
Note: I don't have anything for these two DB types installed on my computer. ops.version() returns 3.0.0.
Hi all,
I am going to use this repo as the center place for OpenSeesPy resources. Everything existing should be kept if we trust Github, but name will be changed to OpenSeesPy.
You won't need to do anything. It will work just like it was. One optional thing is to change the remote name, but Github should already handle it by forwarding.
Let me know if this breaks anything on your side.
Minjie
Some of the Python files uses tabs instead of spaces when defining indentation. This creates issues with some of the editors, such as Spyder. I guess, there should be standard whether to use tabs or spaces. AFAIK, it is recommended to use 4 spaces instead of tabs. Also it is a good practice to define the tabs as 8 characters just to identify the unintentionally places tabs easily.
Please see here for suggested use of spaces and tabs, particularly for Python 3.
Having said that the line 494 of the file Get_Rendering.py
seems to be off, and the file gives error for examples such as RCshearwall.py
when using Spyder. The file worked fine after I have converted the tabs into spaces and correct the indentation. Minor issue to open a new ticket tough.
I have Python 3.9.1 installed from python.org
I installed OpenseesPy with "pip install openseespy"
When running "import openseespy.opensees" I get the following RuntimeError:
"Python version 3.8 is needed for Windows"
"Failed to import openseespy on Windows."
Do I have to downgrade python to run OpenseesPy?
Or am I doing something else wrong?
Is support for higher python versions planned in the future?
The plot_model() function created by @u-anurag is very useful! Would it be possible, or is it already possible using pyplot functions, to change the window size of the rendered model and also to change the view point?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.