https://portwooddigital.com/2021/05/05/ ... eam-loads/
Code: Select all
import openseespy.opensees as ops
import numpy as np
import matplotlib.pyplot as plt
from math import asin, sqrt
# Create ModelBuilder (with two-dimensions and 3 DOF/node)
model('basic', '-ndm', 2, '-ndf', 3)
L=10.0;
wipe() # clear opensees model
# Create nodes
node(1, 0.0, 0.0)
node(2, L, 0.0)
# Fix supports at base of columns
fix(1, 1, 1, 1)
# define materials
E = 1.0;I=1.0;A=1.0;
geomTag = 1
# Geometry of column elements
# tag
geomTransf('Linear', geomTag)
eleType = 'elasticBeamColumn'
element(eleType, 1, 1, 2,A, E, I, geomTag)
(wya,wxa,aOverL,bOverL,wyb,wxb) = (3.0, 0.0, 0.0, 1.0,0.0, 0.0)
ops.timeSeries('Constant', 1)
ops.pattern('Plain', 1, 1)
#ops.load(2, 0.0, 1000.0, 0.0)
ops.eleLoad('-ele',1,'-type','beamUniform',wya,wxa,aOverL,bOverL,wyb,wxb)
#ops.eleLoad('-ele',1,'-type','beamUniform',3,0,0,1,0,0)
#ops.eleLoad('-ele',1,'-type', '-beamUniform', 3.0, 0.0, 0.0)
# Start of analysis generation
# Create the system of equation, a sparse solver with partial pivoting
(Tol, MaxIter) = (1.0e-12, 10) # Tolerance and Maximum iteration
(controlNode, controlDOF) =(2, 2) # Control node and control DOF
system ('BandGeneral')
constraints ('Plain')
numberer ('RCM')
test ('NormDispIncr', Tol, 10, 3)
algorithm ('Newton')
integrator ('LoadControl', 1.0)
algorithm ('Linear')
analysis ('Static')
analyze (1)
currentDisp = nodeDisp(controlNode, controlDOF)
print('Displacement at node 2',currentDisp)
print('Displacement at node 1',nodeDisp(1, controlDOF))
reactions('-dynamic', '-rayleigh')
print("Reaction at node 1",nodeReaction(1))
print("Reaction at node 2",nodeReaction(2))
print("Element force",eleForce(1))