Cantilever 2D Column with Units- Dynamic EQ Ground MotionΒΆ

Converted to openseespy by: Pavan Chigullapally
                      University of Auckland
                      Email: pchi893@aucklanduni.ac.nz
  1. To run Uniaxial Inelastic Material, Fiber Section, Nonlinear Mode, Uniform Earthquake Excitation

  2. First import the InelasticFiberSection.py (upto gravity loading is already in this script) and run the current script

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

  4. Same acceleration input at all nodes restrained in specified direction (uniform acceleration input at all support nodes)

  5. The problem description can be found here (example:3)

  6. The source code is shown below, which can be downloaded here.

 1# -*- coding: utf-8 -*-
 2"""
 3Created on Mon Apr 22 15:12:06 2019
 4
 5@author: pchi893
 6"""
 7# Converted to openseespy by: Pavan Chigullapally       
 8#                         University of Auckland  
 9#                         Email: pchi893@aucklanduni.ac.nz 
10# Example 3. 2D Cantilever -- EQ ground motion
11#To run Uniaxial Inelastic Material, Fiber Section, Nonlinear Mode, Uniform Earthquake Excitation:First import the InelasticFiberSection.py(upto gravity loading is already in this script)
12#and run the current script
13#To run EQ ground-motion analysis (BM68elc.acc needs to be downloaded into the same directory)
14# Same acceleration input at all nodes restrained in specified direction (uniform acceleration input at all support nodes)
15#the detailed problem description can be found here: http://opensees.berkeley.edu/wiki/index.php/Examples_Manual  (example: 3)
16# --------------------------------------------------------------------------------------------------
17#	OpenSees (Tcl) code by:	Silvia Mazzoni & Frank McKenna, 2006
18##########################################################################################################################################################################
19import openseespy.opensees as op
20#import the os module
21#import os
22import math
23op.wipe()
24#########################################################################################################################################################################
25import InelasticFiberSection
26#applying Dynamic Ground motion analysis
27Tol = 1e-8
28GMdirection = 1
29GMfile = 'BM68elc.acc'
30GMfact = 1.0
31Lambda = op.eigen('-fullGenLapack', 1) # eigenvalue mode 1
32Omega = math.pow(Lambda, 0.5)
33betaKcomm = 2 * (0.02/Omega)
34
35xDamp = 0.02				# 2% damping ratio
36alphaM = 0.0				# M-prop. damping; D = alphaM*M	
37betaKcurr = 0.0		# K-proportional damping;      +beatKcurr*KCurrent
38betaKinit = 0.0 # initial-stiffness proportional damping      +beatKinit*Kini
39
40op.rayleigh(alphaM,betaKcurr, betaKinit, betaKcomm) # RAYLEIGH damping
41
42# Uniform EXCITATION: acceleration input
43IDloadTag = 400			# load tag
44dt = 0.01			# time step for input ground motion
45GMfatt = 1.0			# data in input file is in g Unifts -- ACCELERATION TH
46maxNumIter = 10
47op.timeSeries('Path', 2, '-dt', dt, '-filePath', GMfile, '-factor', GMfact)
48op.pattern('UniformExcitation', IDloadTag, GMdirection, '-accel', 2) 
49
50op.wipeAnalysis()
51op.constraints('Transformation')
52op.numberer('Plain')
53op.system('BandGeneral')
54op.test('EnergyIncr', Tol, maxNumIter)
55op.algorithm('ModifiedNewton')
56
57NewmarkGamma = 0.5
58NewmarkBeta = 0.25
59op.integrator('Newmark', NewmarkGamma, NewmarkBeta)
60op.analysis('Transient')
61
62DtAnalysis = 0.01 # time-step Dt for lateral analysis
63TmaxAnalysis = 10.0 # maximum duration of ground-motion analysis
64
65Nsteps =  int(TmaxAnalysis/ DtAnalysis)
66
67ok = op.analyze(Nsteps, DtAnalysis)
68
69tCurrent = op.getTime()
70
71# for gravity analysis, load control is fine, 0.1 is the load factor increment (http://opensees.berkeley.edu/wiki/index.php/Load_Control)
72
73test = {1:'NormDispIncr', 2: 'RelativeEnergyIncr', 4: 'RelativeNormUnbalance',5: 'RelativeNormDispIncr', 6: 'NormUnbalance'}
74algorithm = {1:'KrylovNewton', 2: 'SecantNewton' , 4: 'RaphsonNewton',5: 'PeriodicNewton', 6: 'BFGS', 7: 'Broyden', 8: 'NewtonLineSearch'}
75
76for i in test:
77    for j in algorithm:
78
79        if ok != 0:
80            if j < 4:
81                op.algorithm(algorithm[j], '-initial')
82                
83            else:
84                op.algorithm(algorithm[j])
85                
86            op.test(test[i], Tol, 1000)
87            ok = op.analyze(Nsteps, DtAnalysis)                            
88            print(test[i], algorithm[j], ok)             
89            if ok == 0:
90                break
91        else:
92            continue
93
94u2 = op.nodeDisp(2, 1)
95print("u2 = ", u2)
96
97op.wipe()