2D Portal Frame 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 InelasticFiberSectionPortal2Dframe.py

  3. To run EQ ground-motion analysis (ReadRecord.py, H-E12140.AT2 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:4)

  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# Example4. 2D Portal Frame--  Dynamic EQ input analysis
 11
 12#To run Uniaxial Inelastic Material, Fiber Section, Nonlinear Mode, Uniform Earthquake Excitation:First import the InelasticFiberSectionPortal2Dframe.py
 13#(upto gravity loading is already in this script) and run the current script
 14#To run EQ ground-motion analysis (ReadRecord.py, H-E12140.AT2 needs to be downloaded into the same directory)
 15#Same acceleration input at all nodes restrained in specified direction (uniform acceleration input at all support nodes)
 16#the problem description can be found here: 
 17#http://opensees.berkeley.edu/wiki/index.php/Examples_Manual and http://opensees.berkeley.edu/wiki/index.php/OpenSees_Example_4._Portal_Frame(example: 4)
 18# --------------------------------------------------------------------------------------------------
 19#	OpenSees (Tcl) code by:	Silvia Mazzoni & Frank McKenna, 2006
 20##########################################################################################################################################################################
 21import openseespy.opensees as op
 22#import the os module
 23#import os
 24import math
 25op.wipe()
 26##########################################################################################################################################################################
 27
 28from InelasticFiberSectionPortal2Dframe import *
 29#applying Dynamic Ground motion analysis
 30Tol = 1e-8
 31maxNumIter = 10
 32GMdirection = 1
 33GMfact = 1.5
 34GMfatt = g*GMfact
 35DtAnalysis = 0.01*sec # time-step Dt for lateral analysis
 36TmaxAnalysis = 10.0*sec # maximum duration of ground-motion analysis
 37
 38
 39Lambda = op.eigen('-fullGenLapack', 1) # eigenvalue mode 1
 40Omega = math.pow(Lambda, 0.5)
 41betaKcomm = 2 * (0.02/Omega)
 42
 43xDamp = 0.02				# 2% damping ratio
 44alphaM = 0.0				# M-prop. damping; D = alphaM*M	
 45betaKcurr = 0.0		# K-proportional damping;      +beatKcurr*KCurrent
 46betaKinit = 0.0 # initial-stiffness proportional damping      +beatKinit*Kini
 47
 48op.rayleigh(alphaM,betaKcurr, betaKinit, betaKcomm) # RAYLEIGH damping
 49
 50# Set some parameters
 51record = 'H-E12140'
 52
 53import ReadRecord
 54# Permform the conversion from SMD record to OpenSees record
 55dt, nPts = ReadRecord.ReadRecord(record+'.at2', record+'.dat')
 56#print(dt, nPts)
 57
 58# Uniform EXCITATION: acceleration input
 59IDloadTag = 400			# load tag
 60op.timeSeries('Path', 2, '-dt', dt, '-filePath', record+'.dat', '-factor', GMfatt)
 61op.pattern('UniformExcitation', IDloadTag, GMdirection, '-accel', 2) 
 62
 63op.wipeAnalysis()
 64op.constraints('Transformation')
 65op.numberer('RCM')
 66op.system('BandGeneral')
 67#op.test('EnergyIncr', Tol, maxNumIter)
 68#op.algorithm('ModifiedNewton')
 69#NewmarkGamma = 0.5
 70#NewmarkBeta = 0.25
 71#op.integrator('Newmark', NewmarkGamma, NewmarkBeta)
 72#op.analysis('Transient')
 73
 74
 75#Nsteps =  int(TmaxAnalysis/ DtAnalysis)
 76#
 77#ok = op.analyze(Nsteps, DtAnalysis)
 78
 79tCurrent = op.getTime()
 80
 81# for gravity analysis, load control is fine, 0.1 is the load factor increment (http://opensees.berkeley.edu/wiki/index.php/Load_Control)
 82
 83test = {1:'NormDispIncr', 2: 'RelativeEnergyIncr', 3:'EnergyIncr', 4: 'RelativeNormUnbalance',5: 'RelativeNormDispIncr', 6: 'NormUnbalance'}
 84algorithm = {1:'KrylovNewton', 2: 'SecantNewton' , 3:'ModifiedNewton' , 4: 'RaphsonNewton',5: 'PeriodicNewton', 6: 'BFGS', 7: 'Broyden', 8: 'NewtonLineSearch'}
 85
 86tFinal = nPts*dt
 87
 88#tFinal = 10.0*sec
 89time = [tCurrent]
 90u3 = [0.0]
 91u4 = [0.0]
 92ok = 0
 93while tCurrent < tFinal:
 94#    ok = op.analyze(1, .01)     
 95    for i in test:
 96        for j in algorithm: 
 97            if j < 4:
 98                op.algorithm(algorithm[j], '-initial')
 99                
100            else:
101                op.algorithm(algorithm[j])
102            while ok == 0 and tCurrent < tFinal:
103                    
104                op.test(test[i], Tol, maxNumIter)        
105                NewmarkGamma = 0.5
106                NewmarkBeta = 0.25
107                op.integrator('Newmark', NewmarkGamma, NewmarkBeta)
108                op.analysis('Transient')
109                ok = op.analyze(1, .01)
110                
111                if ok == 0 :
112                    tCurrent = op.getTime()                
113                    time.append(tCurrent)
114                    u3.append(op.nodeDisp(3,1))
115                    u4.append(op.nodeDisp(4,1))
116                    print(test[i], algorithm[j], 'tCurrent=', tCurrent)
117
118        
119import matplotlib.pyplot as plt
120plt.figure(figsize=(8,8))
121plt.plot(time, u3)
122plt.ylabel('Horizontal Displacement of node 3 (in)')
123plt.xlabel('Time (s)')
124plt.savefig('Horizontal Disp at Node 3 vs time.jpeg', dpi = 500)
125plt.show()
126
127plt.figure(figsize=(8,8))
128plt.plot(time, u4)
129plt.ylabel('Horizontal Displacement of node 4 (in)')
130plt.xlabel('Time (s)')
131plt.savefig('Horizontal Disp at Node 4 vs time.jpeg', dpi = 500)
132plt.show() 
133
134
135op.wipe()