zhuminjie / OpenSeesPyDoc

OpenSeesPy Documentation
http://openseespydoc.readthedocs.io
Other
142 stars 105 forks source link

eigen solver problem #175

Closed asaaed closed 4 years ago

asaaed commented 4 years ago

Dear Dr. Zhu,

I have a question about the eigen solver functions in the openseespy. I used them but they don work and make some error. i think i made mistake, but with the examples the error exist. I use anaconda and python 3.7.5. could it be a bug or some thing like that?

FullGenEigenSolver::solve() - the eigenvalue 3 is numerically undetermined or infinite

zhuminjie commented 4 years ago

Which example are you running

asaaed commented 4 years ago

This one and i think it is the problem with zero mass definition:

-- coding: utf-8 --

""" Created on Mon Apr 22 17:29:26 2019

@author: pchi893 """

Converted to openseespy by: Pavan Chigullapally

University of Auckland

Email: pchi893@aucklanduni.ac.nz

Example 1b. portal frame in 2D

This is a simple model of an elastic portal frame with EQ ground motion and gravity loading. Here the structure is excited using uniform excitation load pattern

all units are in kip, inch, second

To run EQ ground-motion analysis (BM68elc.acc needs to be downloaded into the same directory).

the detailed problem description can be found here: http://opensees.berkeley.edu/wiki/index.php/Examples_Manual (example: 1b)

--------------------------------------------------------------------------------------------------

elasticBeamColumn ELEMENT

OpenSees (Tcl) code by: Silvia Mazzoni & Frank McKenna, 2006

#

^Y

|

3_____(3)____4 __

| | |

| | |

| | |

(1) (2) LCol

| | |

| | |

| | |

=1= =2= | -------->X

|----------LBeam------------|

#

SET UP -----------------------------------------------------------------------------

import openseespy.opensees as op

import the os module

import os op.wipe()

#########################################################################################################################################################################

######################################################################################################################################################################### op.model('basic', '-ndm', 2, '-ndf', 3)

#########################################################################################################################################################################

######################################################################################################################################################################### op.model('basic', '-ndm', 2, '-ndf', 3)

to create a directory at specified path with name "Data"

os.chdir('C:\Opensees Python\OpenseesPy examples')

this will create the directory with name 'Data' and will update it when we rerun the analysis, otherwise we have to keep deleting the old 'Data' Folder

dir = "C:\Opensees Python\OpenseesPy examples\Data-1b" if not os.path.exists(dir): os.makedirs(dir)

this will create just 'Data' folder

os.mkdir("Data-1b")

detect the current working directory

path1 = os.getcwd()

print(path1)

h = 432.0 w = 504.0

op.node(1, 0.0, 0.0) op.node(2, h, 0.0) op.node(3, 0.0, w) op.node(4, h, w)

op.fix(1, 1,1,1) op.fix(2, 1,1,1) op.fix(3, 0,0,0) op.fix(4, 0,0,0)

op.mass(3, 5.18, 0.0, 0.0) op.mass(4, 5.18, 0.0, 0.0)

op.geomTransf('Linear', 1) A = 3600000000.0 E = 4227.0 Iz = 1080000.0

A1 = 5760000000.0 Iz1 = 4423680.0 op.element('elasticBeamColumn', 1, 1, 3, A, E, Iz, 1) op.element('elasticBeamColumn', 2, 2, 4, A, E, Iz, 1) op.element('elasticBeamColumn', 3, 3, 4, A1, E, Iz1, 1)

op.recorder('Node', '-file', 'Data-1b/DFree.out','-time', '-node', 3,4, '-dof', 1,2,3, 'disp') op.recorder('Node', '-file', 'Data-1b/DBase.out','-time', '-node', 1,2, '-dof', 1,2,3, 'disp') op.recorder('Node', '-file', 'Data-1b/RBase.out','-time', '-node', 1,2, '-dof', 1,2,3, 'reaction')

op.recorder('Drift', '-file', 'Data-1b/Drift.out','-time', '-node', 1, '-dof', 1,2,3, 'disp')

op.recorder('Element', '-file', 'Data-1b/FCol.out','-time', '-ele', 1,2, 'globalForce') op.recorder('Element', '-file', 'Data-1b/DCol.out','-time', '-ele', 3, 'deformations')

defining gravity loads

op.timeSeries('Linear', 1) op.pattern('Plain', 1, 1) op.eleLoad('-ele', 3, '-type', '-beamUniform', -7.94)

op.constraints('Plain') op.numberer('Plain') op.system('BandGeneral') op.test('NormDispIncr', 1e-8, 6) op.algorithm('Newton') op.integrator('LoadControl', 0.1) op.analysis('Static') op.analyze(10)

op.loadConst('-time', 0.0)

applying Dynamic Ground motion analysis

op.timeSeries('Path', 2, '-dt', 0.01, '-filePath', 'BM68elc.acc', '-factor', 1.0) op.pattern('UniformExcitation', 2, 1, '-accel', 2) #how to give accelseriesTag?

eigen = op. eigen('-fullGenLapack', 1) import math power = math.pow(eigen, 0.5) betaKcomm = 2 * (0.02/power)

op.rayleigh(0.0, 0.0, 0.0, betaKcomm)

op.wipeAnalysis() op.constraints('Plain') op.numberer('Plain') op.system('BandGeneral') op.test('NormDispIncr', 1e-8, 10) op.algorithm('Newton') op.integrator('Newmark', 0.5, 0.25) op.analysis('Transient') op.analyze(1000, 0.02)

u3 = op.nodeDisp(3, 1) print("u2 = ", u3)

op.wipe()

zhuminjie commented 4 years ago

eigen = op. eigen('-fullGenLapack', 1) FullGenEigenSolver::solve() - the eigenvalue 3 is numerically undetermined or infinite

You are requesting 1 eigen value, but the error shows eigenvalue 3 is not available?

Generally, you should request modes less than total free dofs of the system.

asaaed commented 4 years ago

one eigenvalue and the error is as above. whats the problem with eigen solver with zero mass in dofs?

zhuminjie commented 4 years ago

eigen values

w^2 = \sqrt{K/M}

with zero mass, the eigen values are not available

asaaed commented 4 years ago

mathematically its true but in tcl version the error does not appear.

one dof is not zero also:

op.mass(3, 5.18, 0.0, 0.0) op.mass(4, 5.18, 0.0, 0.0)

mhscott commented 4 years ago

It's true mathematically, so what does it matter if Tcl doesn't give an error?? :)

asaaed commented 4 years ago

Dear Dr Scott, there is no matter with tcl, i just ask about the python version and ask if there is a difference between the tcl and python eigensolvers. And i think the error is not straight forward as i request one eigenvalue :

eigen = op. eigen('-fullGenLapack', 1) FullGenEigenSolver::solve() - the eigenvalue 3 is numerically undetermined or infinite

zhuminjie commented 4 years ago

Okay, I just run the example you provided, here is what I get for the eigenvalue without any errors.

eigen = [75.02171297688604]

Below is the script I ran

import openseespy.opensees as op
#import the os module
import os
op.wipe()

op.model('basic', '-ndm', 2, '-ndf', 3)

h = 432.0
w = 504.0

op.node(1, 0.0, 0.0)
op.node(2, h, 0.0)
op.node(3, 0.0, w)
op.node(4, h, w)

op.fix(1, 1,1,1)
op.fix(2, 1,1,1)
op.fix(3, 0,0,0)
op.fix(4, 0,0,0)

op.mass(3, 5.18, 0.0, 0.0)
op.mass(4, 5.18, 0.0, 0.0)

op.geomTransf('Linear', 1)
A = 3600000000.0
E = 4227.0
Iz = 1080000.0

A1 = 5760000000.0
Iz1 = 4423680.0
op.element('elasticBeamColumn', 1, 1, 3, A, E, Iz, 1)
op.element('elasticBeamColumn', 2, 2, 4, A, E, Iz, 1)
op.element('elasticBeamColumn', 3, 3, 4, A1, E, Iz1, 1)

op.recorder('Node', '-file', 'Data-1b/DFree.out','-time', '-node', 3,4, '-dof', 1,2,3, 'disp')
op.recorder('Node', '-file', 'Data-1b/DBase.out','-time', '-node', 1,2, '-dof', 1,2,3, 'disp')
op.recorder('Node', '-file', 'Data-1b/RBase.out','-time', '-node', 1,2, '-dof', 1,2,3, 'reaction')
#op.recorder('Drift', '-file', 'Data-1b/Drift.out','-time', '-node', 1, '-dof', 1,2,3, 'disp')
op.recorder('Element', '-file', 'Data-1b/FCol.out','-time', '-ele', 1,2, 'globalForce')
op.recorder('Element', '-file', 'Data-1b/DCol.out','-time', '-ele', 3, 'deformations')

#defining gravity loads
op.timeSeries('Linear', 1)
op.pattern('Plain', 1, 1)
op.eleLoad('-ele', 3, '-type', '-beamUniform', -7.94)

op.constraints('Plain')
op.numberer('Plain')
op.system('BandGeneral')
op.test('NormDispIncr', 1e-8, 6)
op.algorithm('Newton')
op.integrator('LoadControl', 0.1)
op.analysis('Static')
op.analyze(10)

op.loadConst('-time', 0.0)

#applying Dynamic Ground motion analysis
#op.timeSeries('Path', 2, '-dt', 0.01, '-filePath', 'BM68elc.acc', '-factor', 1.0)
#op.pattern('UniformExcitation', 2, 1, '-accel', 2) #how to give accelseriesTag?

eigen = op. eigen('-fullGenLapack', 1)
print('eigen =', eigen)
asaaed commented 4 years ago

You are right. One of the error was here:

power = math.pow(eigen, 0.5) >>> power = math.pow(eigen[0], 0.5)

math.pow does not accept arrays

zhuminjie commented 4 years ago

That's a different problem. Do you still have that error?

asaaed commented 4 years ago

No i change the node mass as below and error disappear:

ops.mass(2, 1000.0, 0, 0)

change to:

ops.mass(2, 1000.0, 1.0e-10, 1.0e-10)

zhuminjie commented 4 years ago

I ran without error with

op.mass(3, 5.18, 0.0, 0.0)
op.mass(4, 5.18, 0.0, 0.0)

Python's math.pow only accepts numbers so you have to do

eigen[0]
asaaed commented 4 years ago

The problem appear here, i think the number of mass is not sufficient:

import openseespy.opensees as ops
# wipe model
ops.wipe()
# create model
ops.model('basic', '-ndm', 2, '-ndf', 3)

ops.node(1, 0.0, 0.0)
ops.node(2, 0.0, 5000.0)
ops.node(3, 5000.0, 5000.0)
ops.node(4, 1000.0, 0.0)

ops.fix(1, 1,1,1)
ops.fix(4, 1,1,1)

ops.mass(2, 1000, 0.0, 0.0)
ops.mass(3, 1000, 0.0, 0.0)

ops.section('Elastic', 100,210000,375000,882800000)
ops.geomTransf('Linear', 1, [])
ops.element('nonlinearBeamColumn', 1, 1, 2, 5, 100, 1)
ops.element('nonlinearBeamColumn', 2, 2, 3, 5, 100, 1)
ops.element('nonlinearBeamColumn', 3, 3, 4, 5, 100, 1)

ops.timeSeries('Linear', 100) 
patternTagGravity = 100
ops.pattern('Plain', patternTagGravity, 100)
ops.load(2, 100000,0,0)

eigens = ops.eigen('-fullGenLapack', 3)

and i should add a negligible mass to other dofs

zhuminjie commented 4 years ago

You are requesting 1 eigen value, but the error shows eigenvalue 3 is not available? Generally, you should request modes less than total free dofs of the system.

That exactly what I asked the number of eigen values do matter regarding the total dofs of the system. You only set mass in x direction, so only 1 eigen value is available. Unless, you set mass in other dofs, you can have more eigen values.

asaaed commented 4 years ago

Thanks for your help and guidance

Qingtian9426 commented 1 month ago

Hello, I am currently building a cable-stayed bridge model and only gravity load is applied, but it keeps showing eigenvalue problems. I hope to get some help about this issue. FullGenEigenSolver::solve() - the eigenvalue 10 is numerically undetermined or infinite FullGenEigenSolver::solve() - the eigenvalue 11 is numerically undetermined or infinite FullGenEigenSolver::solve() - the eigenvalue 12 is numerically undetermined or infinite