0020
OpenSeesPy {#0020-openseespy}
This notebook is adapted from the OpenSeesPy example at this link.
from openseespy.opensees import *
import openseespy.opensees as ops
import openseespy.postprocessing.ops_vis as opsv
import matplotlib.pyplot as plt
# Create ModelBuilder (with two-dimensions and 3 DOF/node)
ops.wipe()'basic', '-ndm', 2, '-ndf', 3)
ops.model(
# Create nodes
# ------------
# Set parameters for overall model geometry
= 360.0
width = 144.0
height
# Create nodes
# tag, X, Y
1, 0.0, 0.0)
ops.node(2, width, 0.0)
ops.node(3, 0.0, height)
ops.node(4, width, height)
ops.node(
# Fix supports at base of columns
# tag, DX, DY, RZ
1, 1, 1, 1)
ops.fix(2, 1, 1, 1)
ops.fix(
# Define materials for nonlinear columns
# ------------------------------------------
# CONCRETE tag f'c ec0 f'cu ecu
# Core concrete (confined)
'Concrete01', 1, -6.0, -0.004, -5.0, -0.014)
uniaxialMaterial(
# Cover concrete (unconfined)
'Concrete01', 2, -5.0, -0.002, 0.0, -0.006)
uniaxialMaterial(
# STEEL
# Reinforcing steel
= 60.0; # Yield stress
fy = 30000.0; # Young's modulus
E # tag fy E0 b
'Steel01', 3, fy, E, 0.01)
uniaxialMaterial(
# Define cross-section for nonlinear columns
# ------------------------------------------
# some parameters
= 15
colWidth = 24
colDepth
= 1.5
cover = 0.60 # area of no. 7 bars
As
# some variables derived from the parameters
= colDepth / 2.0
y1 = colWidth / 2.0
z1
'Fiber', 1)
section(
# Create the concrete core fibers
'rect', 1, 10, 1, cover - y1, cover - z1, y1 - cover, z1 - cover)
patch(
# Create the concrete cover fibers (top, bottom, left, right)
'rect', 2, 10, 1, -y1, z1 - cover, y1, z1)
patch('rect', 2, 10, 1, -y1, -z1, y1, cover - z1)
patch('rect', 2, 2, 1, -y1, cover - z1, cover - y1, z1 - cover)
patch('rect', 2, 2, 1, y1 - cover, cover - z1, y1, z1 - cover)
patch(
# Create the reinforcing fibers (left, middle, right)
'straight', 3, 3, As, y1 - cover, z1 - cover, y1 - cover, cover - z1)
layer('straight', 3, 2, As, 0.0, z1 - cover, 0.0, cover - z1)
layer('straight', 3, 3, As, cover - y1, z1 - cover, cover - y1, cover - z1)
layer(
# Define column elements
# ----------------------
# Geometry of column elements
# tag
'PDelta', 1)
geomTransf(
# Number of integration points along length of element
= 5
np
# Lobatto integratoin
'Lobatto', 1, 1, np)
beamIntegration(
# Create the coulumns using Beam-column elements
# e tag ndI ndJ transfTag integrationTag
= 'forceBeamColumn'
eleType 1, 1, 3, 1, 1)
element(eleType, 2, 2, 4, 1, 1)
element(eleType,
# Define beam elment
# -----------------------------
# Geometry of column elements
# tag
'Linear', 2)
geomTransf(
# Create the beam element
# tag, ndI, ndJ, A, E, Iz, transfTag
'elasticBeamColumn', 3, 3, 4, 360.0, 4030.0, 8640.0, 2)
element(
# Define gravity loads
# --------------------
# a parameter for the axial load
= 180.0; # 10% of axial capacity of columns
P
# Create a Plain load pattern with a Linear TimeSeries
'Linear', 1)
timeSeries('Plain', 1, 1)
pattern(
# Create nodal loads at nodes 3 & 4
# nd FX, FY, MZ
3, 0.0, -P, 0.0)
load(4, 0.0, -P, 0.0)
load(
opsv.plot_model()
# ------------------------------
# Start of analysis generation
# ------------------------------
# Create the system of equation, a sparse solver with partial pivoting
'BandGeneral')
ops.system(
# Create the constraint handler, the transformation method
'Transformation')
ops.constraints(
# Create the DOF numberer, the reverse Cuthill-McKee algorithm
'RCM')
ops.numberer(
# Create the convergence test, the norm of the residual with a tolerance of
# 1e-12 and a max number of iterations of 10
'NormDispIncr', 1.0e-12, 10, 3)
ops.test(
# Create the solution algorithm, a Newton-Raphson algorithm
'Newton')
ops.algorithm(
# Create the integration scheme, the LoadControl scheme using steps of 0.1
'LoadControl', 0.1)
ops.integrator(
# Create the analysis object
'Static')
ops.analysis(
# ------------------------------
# End of analysis generation
# ------------------------------
# ------------------------------
# perform the analysis
# ------------------------------
# perform the gravity load analysis, requires 10 steps to reach the load level
10)
ops.analyze(
# Print out the state of nodes 3 and 4
# print node 3 4
# Print out the state of element 1
# print ele 1
= nodeDisp(3, 2)
u3 = nodeDisp(4, 2)
u4
if abs(u3 + 0.0183736) < 1e-6 and abs(u4 + 0.0183736) < 1e-6:
print("Passed!")
else:
print("Failed!")
Passed!
100) opsv.plot_defo(
100