Last active
April 2, 2024 02:39
-
-
Save terjehaukaas/752086f1c8642075234affb1da6d9581 to your computer and use it in GitHub Desktop.
G2 Example 12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from G2AnalysisNonlinearDynamic import * | |
from G2Model import * | |
from GroundMotionHalfSineWave import * | |
font = {'family' : 'Times New Roman','size' : 12} | |
plt.rc('font', **font) | |
# This example takes features from Figure 3 in the paper by John F. Hall entitled | |
# Problems encountered from the use (or misuse) of Rayleigh damping, published in | |
# 2006 in Earthquake Engineering & Structural Dynamics, Volume 35. | |
materialType = 'Bilinear' | |
nel = 10 | |
doFDMcheck = False | |
plotFlag = False | |
plotPause = 0.001 | |
testConvergence = False | |
groundMotionFile = 'GroundMotionElCentro.txt' | |
gmdt = 0.02 | |
dtAnalysis = 0.01 | |
duration = 1 | |
gmScaling = 1 | |
L = 1 | |
A = 1 | |
M = 10000 | |
baseE = 1.07e7 | |
alpha = 0.03 | |
eta = 3 | |
gamma = 0.5 | |
beta = 0.5 | |
targetDamping = 0.05 | |
basefy = 0.12 * 10 * M * 9.81 | |
floorVariation = [1.0, 0.984, 0.951, 0.902, 0.837, 0.755, 0.657, 0.542, 0.411, 0.264] | |
maxIter = 100 | |
tol = 1e-6 | |
trackNode = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11] | |
trackDOF = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
NODES = [] | |
for i in range(nel+1): | |
NODES.append([i*L, 0.0]) | |
CONSTRAINTS = [[1, 1]] | |
for i in range(nel): | |
CONSTRAINTS.append([0, 1]) | |
ELEMENTS = [] | |
for i in range(nel): | |
ELEMENTS.append([2, 0.0, i+1, i+2]) | |
SECTIONS = [] | |
for i in range(nel): | |
SECTIONS.append(['Truss', A]) | |
MATERIALS = [] | |
for i in range(nel): | |
if materialType == 'Bilinear': | |
MATERIALS.append(['Bilinear', baseE*floorVariation[i], basefy*floorVariation[i], alpha]) | |
elif materialType == 'BoucWen': | |
MATERIALS.append(['BoucWen', baseE*floorVariation[i], basefy*floorVariation[i], alpha, eta, beta, gamma]) | |
else: | |
print('\n'"Cannot understand the material type") | |
import sys | |
sys.exit() | |
LOADS = np.zeros((nel+1, 2)) | |
MASS = [[0, 0]] | |
for i in range(nel): | |
MASS.append([M, 0]) | |
dM1 = [[0, 0], | |
[1, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0]] | |
dM2 = [[0, 0], | |
[0, 0], | |
[1, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0]] | |
dM3 = [[0, 0], | |
[0, 0], | |
[0, 0], | |
[1, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0]] | |
dM4 = [[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[1, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0]] | |
dM5 = [[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[1, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0]] | |
dM6 = [[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[1, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0]] | |
dM7 = [[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[1, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0]] | |
dM8 = [[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[1, 0], | |
[0, 0], | |
[0, 0]] | |
dM9 = [[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[1, 0], | |
[0, 0]] | |
dM10 = [[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[0, 0], | |
[1, 0]] | |
# ******************************************* | |
# RESPONSE & DDM SENSITIVITIES | |
# ******************************************* | |
DDMparameters = [['Element', 'E', [1]], | |
['Element', 'E', [2]], | |
['Element', 'E', [3]], | |
['Element', 'E', [4]], | |
['Element', 'E', [5]], | |
['Element', 'E', [6]], | |
['Element', 'E', [7]], | |
['Element', 'E', [8]], | |
['Element', 'E', [9]], | |
['Element', 'E', [10]], | |
['Element', 'fy', [1]], | |
['Element', 'fy', [2]], | |
['Element', 'fy', [3]], | |
['Element', 'fy', [4]], | |
['Element', 'fy', [5]], | |
['Element', 'fy', [6]], | |
['Element', 'fy', [7]], | |
['Element', 'fy', [8]], | |
['Element', 'fy', [9]], | |
['Element', 'fy', [10]], | |
['Node', 'M', dM1], | |
['Node', 'M', dM2], | |
['Node', 'M', dM3], | |
['Node', 'M', dM4], | |
['Node', 'M', dM5], | |
['Node', 'M', dM6], | |
['Node', 'M', dM7], | |
['Node', 'M', dM8], | |
['Node', 'M', dM9], | |
['Node', 'M', dM10], | |
['Model', 'targetDamping']] | |
parameterNames = ['K1', 'K2', 'K3', 'K4', 'K5', 'K6', 'K7', 'K8', 'K9', 'K10', 'fy1', 'fy2', 'fy3', 'fy4', 'fy5', 'fy6', 'fy7', 'fy8', 'fy9', 'fy10', 'M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'M8', 'M9', 'M10', 'Damping'] | |
a = [NODES, CONSTRAINTS, ELEMENTS, SECTIONS, MATERIALS, LOADS, MASS] | |
m = model(a) | |
dampingModel = ['Rayleigh', 'Initial', 'Initial', 1, 2, targetDamping] | |
t, gm, u, v, acc, dudx, dvdx, dadx, dnl1, dnl2 = nonlinearDynamicAnalysis(m, dampingModel, groundMotionFile, gmScaling, gmdt, dtAnalysis, duration, trackNode, trackDOF, DDMparameters, plotFlag) | |
isdr1 = u[0,:] | |
isdr2 = u[1,:]-u[0,:] | |
isdr3 = u[2,:]-u[1,:] | |
isdr4 = u[3,:]-u[2,:] | |
isdr5 = u[4,:]-u[3,:] | |
isdr6 = u[5,:]-u[4,:] | |
isdr7 = u[6,:]-u[5,:] | |
isdr8 = u[7,:]-u[6,:] | |
isdr9 = u[8,:]-u[7,:] | |
isdr10 = u[9,:]-u[8,:] | |
plt.ion() | |
figure, axis = plt.subplots(11, 1) | |
myMarkerSize = 3 | |
myLineWidth = 0.5 | |
myLabelSize = 9 | |
cov = 0.01 | |
topTen = 10 | |
floorCount = 10 | |
maxIndex = np.argmax(np.abs(isdr10)) | |
uMax = isdr10[maxIndex] | |
sensitivityVector = [] | |
counter = 0 | |
floorCount -= 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * baseE * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * basefy * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * M * cov) | |
counter += 1 | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * targetDamping * cov) | |
ranking = np.argsort(np.multiply(np.abs(sensitivityVector), -1)) | |
sensSum = np.sum(np.abs(sensitivityVector)) | |
percentChange = sensSum/np.abs(uMax)*100 | |
for i in range(topTen): | |
print("%8s: %.1f" % (parameterNames[ranking[i]], np.abs(sensitivityVector[ranking[i]])/sensSum*100 )) | |
print('\n'"Change in %.4fm for one percent perturbations: %.5fm (%.3f%%)" % (uMax, sensSum, percentChange)) | |
myLabel = '%.3fm (%.1f%%)' % (uMax, percentChange) | |
axis[0].plot(t, isdr10, 'k-', label=myLabel, linewidth=myLineWidth) | |
axis[0].plot(dtAnalysis*maxIndex, uMax, 'ko', markersize=myMarkerSize) | |
axis[0].get_xaxis().set_visible(False) | |
axis[0].get_yaxis().set_visible(False) | |
axis[0].legend(loc='upper left', prop={'size':myLabelSize}, handlelength=0.1, handletextpad=None) | |
maxIndex = np.argmax(np.abs(isdr9)) | |
uMax = isdr9[maxIndex] | |
sensitivityVector = [] | |
counter = 0 | |
floorCount -= 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * baseE * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * basefy * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * M * cov) | |
counter += 1 | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * targetDamping * cov) | |
ranking = np.argsort(np.multiply(np.abs(sensitivityVector), -1)) | |
sensSum = np.sum(np.abs(sensitivityVector)) | |
percentChange = sensSum/np.abs(uMax)*100 | |
for i in range(topTen): | |
print("%8s: %.1f" % (parameterNames[ranking[i]], np.abs(sensitivityVector[ranking[i]])/sensSum*100 )) | |
print('\n'"Change in %.4fm for one percent perturbations: %.5fm (%.3f%%)" % (uMax, sensSum, percentChange)) | |
myLabel = '%.3fm (%.1f%%)' % (uMax, percentChange) | |
axis[1].plot(t, isdr9, 'k-', label=myLabel, linewidth=myLineWidth) | |
axis[1].plot(dtAnalysis*maxIndex, uMax, 'ko', markersize=myMarkerSize) | |
axis[1].get_xaxis().set_visible(False) | |
axis[1].get_yaxis().set_visible(False) | |
axis[1].legend(loc='upper left', prop={'size':myLabelSize}, handlelength=0.1, handletextpad=None) | |
maxIndex = np.argmax(np.abs(isdr8)) | |
uMax = isdr8[maxIndex] | |
sensitivityVector = [] | |
counter = 0 | |
floorCount -= 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * baseE * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * basefy * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * M * cov) | |
counter += 1 | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * targetDamping * cov) | |
ranking = np.argsort(np.multiply(np.abs(sensitivityVector), -1)) | |
sensSum = np.sum(np.abs(sensitivityVector)) | |
percentChange = sensSum/np.abs(uMax)*100 | |
for i in range(topTen): | |
print("%8s: %.1f" % (parameterNames[ranking[i]], np.abs(sensitivityVector[ranking[i]])/sensSum*100 )) | |
print('\n'"Change in %.4fm for one percent perturbations: %.5fm (%.3f%%)" % (uMax, sensSum, percentChange)) | |
myLabel = '%.3fm (%.1f%%)' % (uMax, percentChange) | |
axis[2].plot(t, isdr8, 'k-', label=myLabel, linewidth=myLineWidth) | |
axis[2].plot(dtAnalysis*maxIndex, uMax, 'ko', markersize=myMarkerSize) | |
axis[2].get_xaxis().set_visible(False) | |
axis[2].get_yaxis().set_visible(False) | |
axis[2].legend(loc='upper left', prop={'size':myLabelSize}, handlelength=0.1, handletextpad=None) | |
maxIndex = np.argmax(np.abs(isdr7)) | |
uMax = isdr7[maxIndex] | |
sensitivityVector = [] | |
counter = 0 | |
floorCount -= 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * baseE * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * basefy * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * M * cov) | |
counter += 1 | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * targetDamping * cov) | |
ranking = np.argsort(np.multiply(np.abs(sensitivityVector), -1)) | |
sensSum = np.sum(np.abs(sensitivityVector)) | |
percentChange = sensSum/np.abs(uMax)*100 | |
for i in range(topTen): | |
print("%8s: %.1f" % (parameterNames[ranking[i]], np.abs(sensitivityVector[ranking[i]])/sensSum*100 )) | |
print('\n'"Change in %.4fm for one percent perturbations: %.5fm (%.3f%%)" % (uMax, sensSum, percentChange)) | |
myLabel = '%.3fm (%.1f%%)' % (uMax, percentChange) | |
axis[3].plot(t, isdr7, 'k-', label=myLabel, linewidth=myLineWidth) | |
axis[3].plot(dtAnalysis*maxIndex, uMax, 'ko', markersize=myMarkerSize) | |
axis[3].get_xaxis().set_visible(False) | |
axis[3].get_yaxis().set_visible(False) | |
axis[3].legend(loc='upper left', prop={'size':myLabelSize}, handlelength=0.1, handletextpad=None) | |
maxIndex = np.argmax(np.abs(isdr6)) | |
uMax = isdr6[maxIndex] | |
sensitivityVector = [] | |
counter = 0 | |
floorCount -= 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * baseE * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * basefy * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * M * cov) | |
counter += 1 | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * targetDamping * cov) | |
ranking = np.argsort(np.multiply(np.abs(sensitivityVector), -1)) | |
sensSum = np.sum(np.abs(sensitivityVector)) | |
percentChange = sensSum/np.abs(uMax)*100 | |
for i in range(topTen): | |
print("%8s: %.1f" % (parameterNames[ranking[i]], np.abs(sensitivityVector[ranking[i]])/sensSum*100 )) | |
print('\n'"Change in %.4fm for one percent perturbations: %.5fm (%.3f%%)" % (uMax, sensSum, percentChange)) | |
myLabel = '%.3fm (%.1f%%)' % (uMax, percentChange) | |
axis[4].plot(t, isdr6, 'k-', label=myLabel, linewidth=myLineWidth) | |
axis[4].plot(dtAnalysis*maxIndex, uMax, 'ko', markersize=myMarkerSize) | |
axis[4].get_xaxis().set_visible(False) | |
axis[4].get_yaxis().set_visible(False) | |
axis[4].legend(loc='upper left', prop={'size':myLabelSize}, handlelength=0.1, handletextpad=None) | |
maxIndex = np.argmax(np.abs(isdr5)) | |
uMax = isdr5[maxIndex] | |
sensitivityVector = [] | |
counter = 0 | |
floorCount -= 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * baseE * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * basefy * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * M * cov) | |
counter += 1 | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * targetDamping * cov) | |
ranking = np.argsort(np.multiply(np.abs(sensitivityVector), -1)) | |
sensSum = np.sum(np.abs(sensitivityVector)) | |
percentChange = sensSum/np.abs(uMax)*100 | |
for i in range(topTen): | |
print("%8s: %.1f" % (parameterNames[ranking[i]], np.abs(sensitivityVector[ranking[i]])/sensSum*100 )) | |
print('\n'"Change in %.4fm for one percent perturbations: %.5fm (%.3f%%)" % (uMax, sensSum, percentChange)) | |
myLabel = '%.3fm (%.1f%%)' % (uMax, percentChange) | |
axis[5].plot(t, isdr5, 'k-', label=myLabel, linewidth=myLineWidth) | |
axis[5].plot(dtAnalysis*maxIndex, uMax, 'ko', markersize=myMarkerSize) | |
axis[5].get_xaxis().set_visible(False) | |
axis[5].get_yaxis().set_visible(False) | |
axis[5].legend(loc='upper left', prop={'size':myLabelSize}, handlelength=0.1, handletextpad=None) | |
maxIndex = np.argmax(np.abs(isdr4)) | |
uMax = isdr4[maxIndex] | |
sensitivityVector = [] | |
counter = 0 | |
floorCount -= 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * baseE * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * basefy * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * M * cov) | |
counter += 1 | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * targetDamping * cov) | |
ranking = np.argsort(np.multiply(np.abs(sensitivityVector), -1)) | |
sensSum = np.sum(np.abs(sensitivityVector)) | |
percentChange = sensSum/np.abs(uMax)*100 | |
for i in range(topTen): | |
print("%8s: %.1f" % (parameterNames[ranking[i]], np.abs(sensitivityVector[ranking[i]])/sensSum*100 )) | |
print('\n'"Change in %.4fm for one percent perturbations: %.5fm (%.3f%%)" % (uMax, sensSum, percentChange)) | |
myLabel = '%.3fm (%.1f%%)' % (uMax, percentChange) | |
axis[6].plot(t, isdr4, 'k-', label=myLabel, linewidth=myLineWidth) | |
axis[6].plot(dtAnalysis*maxIndex, uMax, 'ko', markersize=myMarkerSize) | |
axis[6].get_xaxis().set_visible(False) | |
axis[6].get_yaxis().set_visible(False) | |
axis[6].legend(loc='upper left', prop={'size':myLabelSize}, handlelength=0.1, handletextpad=None) | |
maxIndex = np.argmax(np.abs(isdr3)) | |
uMax = isdr3[maxIndex] | |
sensitivityVector = [] | |
counter = 0 | |
floorCount -= 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * baseE * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * basefy * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * M * cov) | |
counter += 1 | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * targetDamping * cov) | |
ranking = np.argsort(np.multiply(np.abs(sensitivityVector), -1)) | |
sensSum = np.sum(np.abs(sensitivityVector)) | |
percentChange = sensSum/np.abs(uMax)*100 | |
for i in range(topTen): | |
print("%8s: %.1f" % (parameterNames[ranking[i]], np.abs(sensitivityVector[ranking[i]])/sensSum*100 )) | |
print('\n'"Change in %.4fm for one percent perturbations: %.5fm (%.3f%%)" % (uMax, sensSum, percentChange)) | |
myLabel = '%.3fm (%.1f%%)' % (uMax, percentChange) | |
axis[7].plot(t, isdr3, 'k-', label=myLabel, linewidth=myLineWidth) | |
axis[7].plot(dtAnalysis*maxIndex, uMax, 'ko', markersize=myMarkerSize) | |
axis[7].get_xaxis().set_visible(False) | |
axis[7].get_yaxis().set_visible(False) | |
axis[7].legend(loc='upper left', prop={'size':myLabelSize}, handlelength=0.1, handletextpad=None) | |
maxIndex = np.argmax(np.abs(isdr2)) | |
uMax = isdr2[maxIndex] | |
sensitivityVector = [] | |
counter = 0 | |
floorCount -= 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * baseE * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * basefy * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * M * cov) | |
counter += 1 | |
sensitivityVector.append((dudx[floorCount, counter, maxIndex] - dudx[floorCount-1, counter, maxIndex]) * targetDamping * cov) | |
ranking = np.argsort(np.multiply(np.abs(sensitivityVector), -1)) | |
sensSum = np.sum(np.abs(sensitivityVector)) | |
percentChange = sensSum/np.abs(uMax)*100 | |
for i in range(topTen): | |
print("%8s: %.1f" % (parameterNames[ranking[i]], np.abs(sensitivityVector[ranking[i]])/sensSum*100 )) | |
print('\n'"Change in %.4fm for one percent perturbations: %.5fm (%.3f%%)" % (uMax, sensSum, percentChange)) | |
myLabel = '%.3fm (%.1f%%)' % (uMax, percentChange) | |
axis[8].plot(t, isdr2, 'k-', label=myLabel, linewidth=myLineWidth) | |
axis[8].plot(dtAnalysis*maxIndex, uMax, 'ko', markersize=myMarkerSize) | |
axis[8].get_xaxis().set_visible(False) | |
axis[8].get_yaxis().set_visible(False) | |
axis[8].legend(loc='upper left', prop={'size':myLabelSize}, handlelength=0.1, handletextpad=None) | |
maxIndex = np.argmax(np.abs(isdr1)) | |
uMax = isdr1[maxIndex] | |
sensitivityVector = [] | |
counter = 0 | |
for i in range(10): | |
sensitivityVector.append(dudx[0, counter, maxIndex] * baseE * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append(dudx[0, counter, maxIndex] * basefy * floorVariation[i] * cov) | |
counter += 1 | |
for i in range(10): | |
sensitivityVector.append(dudx[0, counter, maxIndex] * M * cov) | |
counter += 1 | |
sensitivityVector.append(dudx[0, counter, maxIndex] * targetDamping * cov) | |
ranking = np.argsort(np.multiply(np.abs(sensitivityVector), -1)) | |
sensSum = np.sum(np.abs(sensitivityVector)) | |
percentChange = sensSum/np.abs(uMax)*100 | |
for i in range(topTen): | |
print("%8s: %.1f" % (parameterNames[ranking[i]], np.abs(sensitivityVector[ranking[i]])/sensSum*100 )) | |
print('\n'"Change in %.4fm for one percent perturbations: %.5fm (%.3f%%)" % (uMax, sensSum, percentChange)) | |
myLabel = '%.3fm (%.1f%%)' % (uMax, percentChange) | |
axis[9].plot(t, isdr1, 'k-', label=myLabel, linewidth=myLineWidth) | |
axis[9].plot(dtAnalysis*maxIndex, uMax, 'ko', markersize=myMarkerSize) | |
axis[9].get_xaxis().set_visible(False) | |
plt.xlabel("Time [sec.]") | |
axis[9].get_yaxis().set_visible(False) | |
axis[9].legend(loc='upper left', prop={'size':myLabelSize}, handlelength=0.1, handletextpad=None) | |
axis[10].plot(t, dnl1, 'k-', label='1st mode nonlinearity', linewidth=myLineWidth) | |
axis[10].plot(t, dnl2, 'k--', label='2nd mode nonlinearity', linewidth=myLineWidth) | |
axis[10].get_xaxis().set_visible(True) | |
axis[10].get_yaxis().set_visible(False) | |
axis[10].legend(loc='upper left', prop={'size':6}) | |
print('\n'"Click somewhere in the plot to continue...") | |
plt.waitforbuttonpress() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment