14.2.12. 2D Portal Frame with Units- Multiple Support Dynamic EQ Ground Motion-acctimeseries

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

  2. First import the InelasticFiberSectionPortal2Dframe.py

  3. Upto gravity loading is already in this script and run the current script

  4. To run EQ ground-motion analysis (ReadRecord.py, H-E12140.AT2 needs to be downloaded into the same directory)

  5. MultipleSupport Earthquake ground motion (different acceleration input at specified support nodes) – two nodes here

  6. The problem description can be found here (example:4)

  7. 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-- multiple-support excitation using acceleration timeseries
 11
 12#To run Uniaxial Inelastic Material, Fiber Section, Nonlinear Mode, MultipleSupport Earthquake ground motion: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# MultipleSupport Earthquake ground motion (different acceleration input at specified support nodes) -- two nodes here
 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# execute this file after you have built the model, and after you apply gravity
 30#
 31
 32# MultipleSupport Earthquake ground motion (different displacement input at spec'd support nodes) -- two nodes here
 33
 34#applying Dynamic Ground motion analysis
 35iSupportNode = [1, 2]
 36iGMfact = [1.5, 1.5]
 37iGMdirection = [1, 1]
 38iGMfile = ['H-E12140', 'H-E12140']
 39DtAnalysis = 0.01*sec # time-step Dt for lateral analysis
 40TmaxAnalysis = 10.0*sec # maximum duration of ground-motion analysis
 41Tol = 1e-8
 42
 43# define DAMPING--------------------------------------------------------------------------------------
 44# apply Rayleigh DAMPING from $xDamp
 45# D=$alphaM*M + $betaKcurr*Kcurrent + $betaKcomm*KlastCommit + $beatKinit*$Kinitial
 46Lambda = op.eigen('-fullGenLapack', 1) # eigenvalue mode 1
 47Omega = math.pow(Lambda, 0.5)
 48betaKcomm = 2 * (0.02/Omega)
 49
 50xDamp = 0.02				# 2% damping ratio
 51alphaM = 0.0				# M-prop. damping; D = alphaM*M	
 52betaKcurr = 0.0		# K-proportional damping;      +beatKcurr*KCurrent
 53betaKinit = 0.0 # initial-stiffness proportional damping      +beatKinit*Kini
 54
 55op.rayleigh(alphaM,betaKcurr, betaKinit, betaKcomm) # RAYLEIGH damping
 56#--------------------------------------------------------------------------------------
 57#  ---------------------------------    perform Dynamic Ground-Motion Analysis
 58# the following commands are unique to the Multiple-Support Earthquake excitation
 59# Set some parameters
 60IDloadTag = 400			# load tag
 61IDgmSeries = 500 # for multipleSupport Excitation
 62
 63# read a PEER strong motion database file, extracts dt from the header and converts the file 
 64# to the format OpenSees expects for Uniform/multiple-support ground motions
 65record = ['H-E12140', 'H-E12140']
 66#dt =[]
 67#nPts = []
 68
 69import ReadRecord
 70# Permform the conversion from SMD record to OpenSees record
 71#dt, nPts = ReadRecord.ReadRecord(record+'.at2', record+'.dat')
 72#print(dt, nPts)
 73count = 2
 74#use displacement series, create time series('Path'), then create multi-support excitation patter (gmtag, 'Plain'), then create imposed ground motion 
 75#using groundmotion('nodetag', gmtag), run this in a loop for each support or node where the earthquake load is going to be applied.
 76op.pattern('MultipleSupport', IDloadTag)
 77for i in range(len(iSupportNode)):
 78    record_single = record[i]
 79    GMfatt = (iGMfact[i])*g
 80    dt, nPts = ReadRecord.ReadRecord(record_single+'.AT2', record_single+'.dat')    
 81    op.timeSeries('Path', count, '-dt', dt, '-filePath', record_single+'.dat', '-factor', GMfatt)
 82    op.groundMotion(IDgmSeries+count, 'Plain', '-accel', count)
 83    op.imposedMotion(iSupportNode[i], iGMdirection[i], IDgmSeries+count)
 84    count = count + 1
 85
 86maxNumIter = 10
 87op.wipeAnalysis()
 88op.constraints('Transformation')
 89op.numberer('RCM')
 90op.system('BandGeneral')
 91#op.test('EnergyIncr', Tol, maxNumIter)
 92#op.algorithm('ModifiedNewton')
 93#NewmarkGamma = 0.5
 94#NewmarkBeta = 0.25
 95#op.integrator('Newmark', NewmarkGamma, NewmarkBeta)
 96#op.analysis('Transient')
 97#
 98#
 99#Nsteps =  int(TmaxAnalysis/ DtAnalysis)
100#
101#ok = op.analyze(Nsteps, DtAnalysis)
102
103tCurrent = op.getTime()
104
105# for gravity analysis, load control is fine, 0.1 is the load factor increment (http://opensees.berkeley.edu/wiki/index.php/Load_Control)
106
107test = {1:'NormDispIncr', 2: 'RelativeEnergyIncr', 3:'EnergyIncr', 4: 'RelativeNormUnbalance',5: 'RelativeNormDispIncr', 6: 'NormUnbalance'}
108algorithm = {1:'KrylovNewton', 2: 'SecantNewton' , 3:'ModifiedNewton' , 4: 'RaphsonNewton',5: 'PeriodicNewton', 6: 'BFGS', 7: 'Broyden', 8: 'NewtonLineSearch'}
109
110#tFinal = TmaxAnalysis
111tFinal = nPts*dt
112time = [tCurrent]
113u3 = [0.0]
114u4 = [0.0]
115ok = 0
116
117while tCurrent < tFinal:
118#    ok = op.analyze(1, .01)     
119    for i in test:
120        for j in algorithm: 
121            if j < 4:
122                op.algorithm(algorithm[j], '-initial')
123                
124            else:
125                op.algorithm(algorithm[j])
126            while ok == 0 and tCurrent < tFinal:
127                    
128                op.test(test[i], Tol, maxNumIter)        
129                NewmarkGamma = 0.5
130                NewmarkBeta = 0.25
131                op.integrator('Newmark', NewmarkGamma, NewmarkBeta)
132                op.analysis('Transient')
133                ok = op.analyze(1, .01)
134                
135                if ok == 0 :
136                    tCurrent = op.getTime()                
137                    time.append(tCurrent)
138                    u3.append(op.nodeDisp(3,1))
139                    u4.append(op.nodeDisp(4,1))
140                    print(test[i], algorithm[j], 'tCurrent=', tCurrent)
141                             
142import matplotlib.pyplot as plt
143plt.figure(figsize=(8,8))
144plt.plot(time, u3)
145plt.ylabel('Horizontal Displacement of node 3 (in)')
146plt.xlabel('Time (s)')
147plt.savefig('Horizontal Disp at Node 3 vs time-multiple support excitation-acctime.jpeg', dpi = 500)
148plt.show()
149
150plt.figure(figsize=(8,8))
151plt.plot(time, u4)
152plt.ylabel('Horizontal Displacement of node 4 (in)')
153plt.xlabel('Time (s)')
154plt.savefig('Horizontal Disp at Node 4 vs time-multiple support excitation-acctime.jpeg', dpi = 500)
155plt.show() 
156
157
158op.wipe()