Пример #1
0
def Elastic(matTag, E, eta=0.0, Eneg=None):
    """Elastic uniaxial material."""
    matTag = int(matTag)
    E = float(E)
    eta = float(eta)

    if Eneg is not None:
        Eneg = float(Eneg)
    else:
        Eneg = E

    _ops.uniaxialMaterial('Elastic', matTag, E, eta, Eneg)
Пример #2
0
def ElasticPP(matTag, E, eps_yP, eps_yN=None, eps0=0.0):
    """Elastic-perfectly-plastic uniaxial material."""
    matTag = int(matTag)
    E = float(E)
    eps_yP = float(eps_yP)

    if eps_yN is not None:
        eps_yN = float(eps_yN)
    else:
        eps_yN = eps_yP

    eps0 = float(eps0)

    _ops.uniaxialMaterial('ElasticPP', matTag, E, eps_yP, eps_yN, eps0)
Пример #3
0
def ElasticPPGap(matTag, E, Fy, gap, eta=0.0, damage=False):
    """Elastic-perfectly-plastic uniaxial material with gap."""
    matTag = int(matTag)
    E = float(E)
    Fy = float(Fy)
    gap = float(gap)
    eta = float(eta)

    if damage:
        damage = 'damage'
    else:
        damage = 'noDamage'

    _ops.uniaxialMaterial('ElasticPPGap', matTag, E, Fy, gap, eta, damage)
Пример #4
0
# create nodes & add to Domain - command: node nodeId xCrd yCrd
#ops.node(1, 0.0,    0.0, "-disp",0.0,0.0, "-vel", 0.0,0.0, "-mass", 0.0,0.0)
ops.node(1, 0.0,    0.0)
ops.node(2, 144.0,  0.0)
ops.node(3, 168.0,  0.0)
ops.node(4,  72.0, 96.0)

# set the boundary conditions - command: fix nodeID xRestrnt? yRestrnt?
ops.fix(1, 1, 1)
ops.fix(2, 1, 1)
ops.fix(3, 1, 1)

# Define materials for truss elements
# -----------------------------------
# Create Elastic material prototype - command: uniaxialMaterial Elastic matID E
ops.uniaxialMaterial("Elastic", 1, 3000.0)

# Define elements
# ---------------
# Create truss elements - command: element truss trussID node1 node2 A matID
ops.element("truss", 1, 1, 4, 10.0, 1)
ops.element("truss", 2, 2, 4,  5.0, 1)
ops.element("truss", 3, 3, 4,  5.0, 1)

# Define loads
# ------------
# create a Linear TimeSeries (load factor varies linearly with time) - command: timeSeries Linear $tag
ops.timeSeries("Linear", 1)

# create a Plain load pattern - command: pattern Plain $tag $timeSeriesTag { $loads }
ops.pattern("Plain", 1, 1, "-fact", 1.0)
Пример #5
0
# p-y liq
matTag = 1
soilType = 2
#soilType = 1 Backbone of p-y curve approximates Matlock (1970) soft clay relation. soilType = 2 Backbone of p-y curve approximates API (1993) sand relation.
pult = 1.0
#Ultimate capacity of the p-y material.
y50 = 0.0001
#Displacement at which 50% of pult is mobilized in monotonic loading.
Cd = 0.3
#Variable that sets the drag resistance within a fully-mobilized gap as Cd*pult.
c = 0.0
#The viscous damping term (dashpot) on the far-field (elastic) component of the displacement rate (velocity).
pRes = 0.1
#sets the minimum (or residual) peak resistance that the material retains as the adjacent solid soil elements liquefy
op.uniaxialMaterial('PyLiq1', matTag, soilType, pult, y50, Cd, c, pRes,
                    '-timeSeries', seriesTag)

# t-z liq
matTag = 2
soilType = 2
#soilType = 1 Backbone of t-z curve approximates Reese and O’Neill (1987). soilType = 2 Backbone of t-z curve approximates Mosher (1984) relation.
tult = 1.0
#Ultimate capacity of the t-z material.
z50 = 0.0001
#Displacement at which 50% of tult is mobilized in monotonic loading.
c = 0.0
#The viscous damping term (dashpot) on the far-field (elastic) component of the displacement rate (velocity).
op.uniaxialMaterial('TzLiq1', matTag, soilType, tult, z50, c, '-timeSeries',
                    seriesTag)

# zero-length element
Пример #6
0
op.fix(2,1,1);

# Mean Stress time-series
MeanStress=np.array([1.000,0.990,0.980,0.970,0.960,0.950,0.940,0.931,0.921,0.911,0.902,0.892,0.882,0.873,0.864,0.854,0.845,0.836,0.826,0.817,0.808,0.799,0.790,0.781,0.772,0.763,0.755,0.746,0.737,0.729,0.720,0.711,0.703,0.694,0.686,0.678,0.669,0.661,0.653,0.645,0.637,0.629,0.621,0.613,0.605,0.597,0.589,0.582,0.574,0.566,0.559,0.551,0.544,0.536,0.529,0.522,0.514,0.507,0.500,0.493,0.486,0.479,0.472,0.465,0.458,0.451,0.444,0.438,0.431,0.424,0.418,0.357,0.394,0.411,0.400,0.359,0.352,0.386,0.388,0.359,0.301,0.354,0.371,0.356,0.304,0.311,0.349,0.348,0.311,0.256,0.317,0.335,0.313,0.249,0.276,0.314,0.310,0.264,0.221,0.285,0.300,0.273,0.196,0.245,0.283,0.274,0.218,0.192,0.257,0.269,0.233,0.143,0.219,0.255,0.240,0.173,0.168,0.231,0.239,0.195,0.104,0.196,0.229,0.208,0.130,0.148,0.209,0.212,0.159,0.082,0.177,0.206,0.177,0.087,0.132,0.189,0.186,0.124,0.069,0.161,0.185,0.149,0.047,0.120,0.172,0.163,0.090,0.061,0.148,0.166,0.122,0.008,0.111,0.158,0.141,0.059,0.057,0.138,0.149,0.097,0.000,0.105,0.146,0.122,0.029,0.055,0.130,0.135,0.073,0.000,0.101,0.136,0.104,0.004,0.057,0.125,0.122,0.052,0.003,0.101,0.128,0.089,0.000,0.062,0.122,0.112,0.033,0.005,0.102,0.123,0.075,0.000,0.068,0.121,0.104,0.016,0.018,0.106,0.119,0.064])
MNS_Time  =np.linspace(0,30.0,len(MeanStress));
seriesTag =1; op.timeSeries('Path', seriesTag, '-time', *MNS_Time, '-values', *MeanStress, '-factor', 1.0);

# p-y liq
matTag=1;
soilType = 2; #soilType = 1 Backbone of p-y curve approximates Matlock (1970) soft clay relation. soilType = 2 Backbone of p-y curve approximates API (1993) sand relation.
pult = 1.0; #Ultimate capacity of the p-y material.
y50 = 0.0001; #Displacement at which 50% of pult is mobilized in monotonic loading.
Cd = 0.3; #Variable that sets the drag resistance within a fully-mobilized gap as Cd*pult.
c = 0.0; #The viscous damping term (dashpot) on the far-field (elastic) component of the displacement rate (velocity).
pRes = 0.1; #sets the minimum (or residual) peak resistance that the material retains as the adjacent solid soil elements liquefy
op.uniaxialMaterial('PyLiq1', matTag, soilType, pult, y50, Cd,c,pRes,'-timeSeries', seriesTag);

# q-z liq
matTag=2;
qzType = 2; #qzType = 1 Backbone of q-z curve approximates Reese and O'Neill's (1987) relation for drilled shafts in clay. qzType = 2 Backbone of q-z curve approximates Vijayvergiya's (1977) relation for piles in sand.
qult = 100.0; #Ultimate capacity of the q-z material.
z50 = 0.0001; #Displacement at which 50% of qult is mobilized in monotonic loading.
suction = 0.0; #Uplift resistance is equal to suction*qult. Default = 0.0. The value of suction must be 0.0 to 0.1.*
c = 0.0; #The viscous damping term (dashpot) on the far-field (elastic) component of the displacement rate (velocity).
alpha = 0.55; # 
op.uniaxialMaterial('QzLiq1', matTag, qzType, qult, z50, suction, c, alpha, '-timeSeries', seriesTag);

# zero-length element
eleTag = 1; node1=1; node2=2;
op.element('zeroLength', eleTag, node1, node2, '-mat', 1,  '-dir', 1);
eleTag = 2; node1=1; node2=2;
Пример #7
0
# Constraints for rigid diaphragm master nodes
#      tag DX DY DZ RX RY RZ
ops.fix( 9, 0, 0, 1, 1, 1, 0)
ops.fix(14, 0, 0, 1, 1, 1, 0)
ops.fix(19, 0, 0, 1, 1, 1, 0)

# Define materials for nonlinear columns
# --------------------------------------
# CONCRETE
fc = 4.0
Ec = 57000.0*math.sqrt(fc*1000.0)/1000.0;

# Core concrete (confined)
#                                 tag  f'c   epsc0  f'cu  epscu
ops.uniaxialMaterial("Concrete01", 1, -5.0, -0.005, -3.5, -0.02)

# Cover concrete (unconfined)
#                                 tag  f'c   epsc0  f'cu  epscu
ops.uniaxialMaterial("Concrete01", 2, -fc, -0.002, 0.0, -0.006)

# STEEL
fy = 60.0;       # Yield stress
Es = 30000.0;    # Young's modulus
# Reinforcing steel 
#                              tag fy  E0  b
ops.uniaxialMaterial("Steel01", 3, fy, Es, 0.02)

# Column parameters
h = 18.0
GJ = 1.0E10
Пример #8
0
import opensees as ops

ops.wipe()

ops.uniaxialMaterial("Elastic", 1, 1000.)
ops.testUniaxialMaterial(1)

for strain in [0.01, 0.02, 0.03, 0.04, 0.05]:
    ops.setStrain(strain)
    print("strain: ", str(ops.getStrain()), " stress: ", str(ops.getStress()),
          " tangent: ", str(ops.getTangent()))

ops.uniaxialMaterial("Elastic", 2, 1000.)
ops.uniaxialMaterial("Parallel", 3, 1, 2)
ops.testUniaxialMaterial(3)

for strain in [0.01, 0.02, 0.03, 0.04, 0.05]:
    ops.setStrain(strain)
    print("strain: ", str(ops.getStrain()), " stress: ", str(ops.getStress()),
          " tangent: ", str(ops.getTangent()))
Пример #9
0
# remove existing model
ops.wipe()

# create ModelBuilder (with two-dimensions and 3 DOF/node)
ops.model("BasicBuilder", "-ndm", 2, "-ndf", 3)

# set default units
ops.defaultUnits("-force", "kip", "-length", "in", "-time", "sec", "-temp",
                 "F")

# Define materials for nonlinear columns
# ------------------------------------------
# CONCRETE                        tag  f'c    ec0    f'cu   ecu
# Core concrete (confined)
ops.uniaxialMaterial("Concrete01", 1, -6.0, -0.004, -5.0, -0.014)
# Cover concrete (unconfined)
ops.uniaxialMaterial("Concrete01", 2, -5.0, -0.002, -0.0, -0.006)

# STEEL
# Reinforcing steel
fy = 60.0
# Yield stress
E = 30000.0
# Young's modulus
#                              tag fy  E0  b
ops.uniaxialMaterial("Steel01", 3, fy, E, 0.01)

# Define cross-section for nonlinear columns
# ------------------------------------------
# set some parameters
Пример #10
0
import sys

sys.path.insert(0, '../SRC/interpreter/')
# sys.path.insert(0, '../build/lib/')
import opensees as ops

ops.model('basic', '-ndm', 1, '-ndf', 1)
ops.uniaxialMaterial('Elastic', 1, 3000.0)

ops.node(1, 0.0)
ops.node(2, 72.0)

ops.fix(1, 1)

ops.element('Truss', 1, 1, 2, 10.0, 1)
ops.timeSeries('Linear', 1)
ops.pattern('Plain', 1, 1)
ops.load(2, 100.0)

ops.constraints('Transformation')
ops.numberer('ParallelPlain')
ops.test('NormDispIncr', 1e-6, 6, 2)
ops.system('ProfileSPD')
ops.integrator('Newmark', 0.5, 0.25)
# ops.analysis('Transient')
ops.algorithm('Linear')
ops.analysis('VariableTransient')

ops.analyze(5, 0.0001, 0.00001, 0.001, 10)
time = ops.getTime()
print(f'time: ', ops.getTime())
Пример #11
0
ops.model('basic', '-ndm', 2, '-ndf', 2)

L = 144.0

ops.node(1, 0, 0)
ops.node(2, L, 0.0)

ops.fix(1, 1, 1)
ops.fix(2, 0, 1)

E = 30000.0
A = 25.0
fy = 50.0

ops.uniaxialMaterial("Hardening", 1, E, fy, 0, 100.0)

ops.element("truss", 1, 1, 2, A, 1)

P = 25.0

tsTag = 1
ops.timeSeries("Linear", tsTag)

patternTag = 1
ops.pattern("Plain", patternTag, tsTag)

ops.load(2, P, 0)

ops.analysis("Static")
Пример #12
0
gwtSwitch = 1

#----------------------------------------------------------
#  create spring material objects
#----------------------------------------------------------

# p-y spring material

for i in range(1 , nNodeEmbed+1):
    # depth of current py node
    pyDepth = L2 - eleSize * (i-1)
    # procedure to define pult and y50
    pyParam = get_pyParam(pyDepth, gamma, phi, diameter, eleSize, puSwitch, kSwitch, gwtSwitch)
    pult = pyParam [0]
    y50 = pyParam [1]    
    op.uniaxialMaterial('PySimple1', i, 2, pult, y50, 0.0)
    

# t-z spring material    
for i in range(2, nNodeEmbed+1):
  # depth of current tz node
    pyDepth = eleSize * (i-1)
  # vertical effective stress at current depth    
    sigV = gamma * pyDepth
  # procedure to define tult and z50
    tzParam = get_tzParam(phi, diameter, sigV, eleSize)
    tult = tzParam [0]
    z50 = tzParam [1]
    op.uniaxialMaterial('TzSimple1', i+100, 2, tult, z50, 0.0)

Пример #13
0
def BuildOpsModel(GRS):
    ops.wipe()
    ops.model('BasicBuilder', '-ndm', 3, '-ndf', 6)

    # material
    matID = 66
    matID1 = 67
    sY = 235. * un.MPa
    if GRS.MatNL == False:
        ops.uniaxialMaterial('Elastic', matID, GRS.Es)
    else:
        ops.uniaxialMaterial('Steel4', matID1, sY, GRS.Es, '-kin', 4e-3, 50., 0.05, 0.15, '-ult', 360.* un.MPa, 5., )
        ops.uniaxialMaterial('MinMax', matID, matID1, '-min', -0.20, '-max', 0.20)

        #ops.uniaxialMaterial('Steel4', matID, sY, GRS.Es, '-kin', 1e-2, 50., 0.05, 0.15, '-ult', 360.* un.MPa, 10., )
        #ops.uniaxialMaterial('Steel4', matID, sY, GRS.Es, '-kin', 1e-2, 50., 0.05, 0.15)
        #ops.uniaxialMaterial('ElasticBilin', matID, GRS.Es, 210. * 1e7, sY / GRS.Es)
        #ops.uniaxialMaterial('ElasticBilin', matID, GRS.Es, 210. * 1e6, sY / GRS.Es)
        #ops.uniaxialMaterial('ElasticBilin', matID, GRS.Es, 1., sY / GRS.Es) #Oldalnyomasos igy futott le

    # cross-section
    CHSid = 99
    CHSSection(CHSid, matID, GRS.secD, GRS.secT, 8, 1, GRS.Gs*GRS.secIt)

    # nodes
    for i in range(GRS.nbNsAll):
        ops.node(int(100+i), GRS.nsAll.x[i], GRS.nsAll.y[i], GRS.nsAll.z[i])

    #  ...create zeroLength element nodes...

    # end supports
    if GRS.SupType==0: # all boundary points fixed for deformations
        for i in range(GRS.nbBns):
            ops.fix(100+GRS.bn[i], 1, 1, 1, 0, 0, 0)
    elif GRS.SupType == 1: # oldalnyomasos
        for i in range(len(GRS.bnX)):
            ops.fix(100+GRS.bnX[i], 1, 0, 1, 0, 0, 0)
        for i in range(len(GRS.bnY)):
            ops.fix(100+GRS.bnY[i], 0, 1, 1, 0, 0, 0)
        for i in range(len(GRS.bnC)):
            ops.fix(100+GRS.bnC[i], 1, 1, 1, 0, 0, 0)
    elif GRS.SupType == 2: # oldalnyomasmentes
        for i in range(len(GRS.bnX)):
            ops.fix(100+GRS.bnX[i], 0, 0, 1, 0, 0, 0)
        for i in range(len(GRS.bnY)):
            ops.fix(100+GRS.bnY[i], 0, 0, 1, 0, 0, 0)
        #for i in range(len(GRS.bnC)):
        #    ops.fix(100+GRS.bnC[i], 1, 1, 1, 0, 0, 0)
        ops.fix(100 + GRS.bnC[0], 1, 1, 1, 0, 0, 0)
        ops.fix(100 + GRS.bnC[1], 0, 0, 1, 0, 0, 0)
        ops.fix(100 + GRS.bnC[2], 1, 0, 1, 0, 0, 0)
        ops.fix(100 + GRS.bnC[3], 0, 0, 1, 0, 0, 0)
    elif GRS.SupType == 3: # felmerev #NOT WORKING YET
        pass
    elif GRS.SupType == 4: # sarkok
        for i in range(len(GRS.bnC)):
            ops.fix(100+GRS.bnC[i], 1, 1, 1, 0, 0, 0)
    elif GRS.SupType == 5:  # dome oldalnyomasos
        for i in range(GRS.nbBns):
            if i==0: ops.fix(100+GRS.bn[i], 1, 1, 1, 0, 0, 0)
            elif i==10: ops.fix(100+GRS.bn[i], 0, 1, 1, 0, 0, 0)
            else: ops.fix(100+GRS.bn[i], 0, 0, 1, 0, 0, 0)
    elif GRS.SupType == 6:  # dome #NOT WORKING YET
        pass

    # transformations
    TRtag = 55
    if GRS.GeomNL == 1:
        TRType = 'Corotational'
        ops.geomTransf('Corotational', TRtag, 0., 0., 1.)
    else:
        TRType = 'Linear'
        ops.geomTransf('Linear', TRtag, 0., 0., 1.)

    # integration points
    gauss = 5
    beamIntTag=44
    ops.beamIntegration('Lobatto', beamIntTag, CHSid, gauss)

    # create elements
    for i in range(GRS.nbElAll):
        sID = GRS.lsAll.sID[i]
        eID = GRS.lsAll.eID[i]
        dx = abs(GRS.nsAll.x[sID] - GRS.nsAll.x[eID])
        dy = abs(GRS.nsAll.y[sID] - GRS.nsAll.y[eID])
        dz = abs(GRS.nsAll.z[sID] - GRS.nsAll.z[eID])
        if dx+dy+dz == 0:
            ops.equalDOF(eID, sID, 1,2,3,4,5,6)  # Grasshopper geomType=4 Zero length elements - should not come here
        else:
            ops.element('forceBeamColumn', int(1000 + i), int(100+sID), int(100+eID), TRtag, beamIntTag)
Пример #14
0
# set modelbuilder
ops.model('basic', '-ndm', 2, '-ndf', 2)

# create nodes
ops.node(1, 0.0, 0.0, "-disp", 0.0, 0.0, "-vel", 0.0, 0.0, "-mass", 0.0, 0.0)
ops.node(2, 144.0, 0.0)
ops.node(3, 168.0, 0.0)
ops.node(4, 72.0, 96.0)

# set boundary condition
ops.fix(1, 1, 1)
ops.fix(2, 1, 1)
ops.fix(3, 1, 1)

# define materials
ops.uniaxialMaterial("Elastic", 1, 3000)

# define elements
ops.element("Truss", 1, 1, 4, 10.0, 1)
ops.element("Truss", 2, 2, 4, 5.0, 1)
ops.element("Truss", 3, 3, 4, 5.0, 1)

# create TimeSeries
ops.timeSeries("Linear", 1)

# create a plain load pattern
ops.pattern("Plain", 1, 1, "-fact", 1.0)
ops.load(4, 100, -50)

# print model
#ops.Print()
Пример #15
0
def test_recorder_time_step_is_stable():
    opy.model('basic', '-ndm', 2, '-ndf', 2)
    opy.loadConst('-time', 1e+13)
    opy.node(1, 0.0, 0.0)
    opy.node(2, 0.5, 0.0)
    opy.node(3, 0.0, -0.5)
    opy.node(4, 0.5, -0.5)
    opy.equalDOF(3, 4, 1, 2)
    opy.node(5, 0.0, -1.0)
    opy.node(6, 0.5, -1.0)
    opy.equalDOF(5, 6, 1, 2)
    opy.node(7, 0.0, -1.5)
    opy.node(8, 0.5, -1.5)
    opy.equalDOF(7, 8, 1, 2)
    opy.node(9, 0.0, -2.0)
    opy.node(10, 0.5, -2.0)
    opy.equalDOF(9, 10, 1, 2)
    opy.node(11, 0.0, -2.5)
    opy.node(12, 0.5, -2.5)
    opy.equalDOF(11, 12, 1, 2)
    opy.node(13, 0.0, -3.0)
    opy.node(14, 0.5, -3.0)
    opy.equalDOF(13, 14, 1, 2)
    opy.fix(13, 0, 1)
    opy.fix(14, 0, 1)
    opy.node(15, 0.0, -3.0)
    opy.node(16, 0.0, -3.0)
    opy.fix(15, 1, 1)
    opy.fix(16, 0, 1)
    opy.equalDOF(13, 14, 1)
    opy.equalDOF(13, 16, 1)
    opy.nDMaterial('ElasticIsotropic', 1, 212500.0, 0.0, 1.7)
    opy.element('SSPquad', 1, 3, 4, 2, 1, 1, 'PlaneStrain', 1.0, 0.0, 16.677)
    opy.element('SSPquad', 2, 5, 6, 4, 3, 1, 'PlaneStrain', 1.0, 0.0, 16.677)
    opy.element('SSPquad', 3, 7, 8, 6, 5, 1, 'PlaneStrain', 1.0, 0.0, 16.677)
    opy.element('SSPquad', 4, 9, 10, 8, 7, 1, 'PlaneStrain', 1.0, 0.0, 16.677)
    opy.element('SSPquad', 5, 11, 12, 10, 9, 1, 'PlaneStrain', 1.0, 0.0,
                16.677)
    opy.element('SSPquad', 6, 13, 14, 12, 11, 1, 'PlaneStrain', 1.0, 0.0,
                16.677)
    opy.uniaxialMaterial('Viscous', 2, 212.5, 1.0)
    opy.element('zeroLength', 7, 15, 16, '-mat', 2, '-dir', 1)
    opy.constraints('Transformation')
    opy.test('NormDispIncr', 0.0001, 30, 0, 2)
    opy.algorithm('Newton', False, False, False)
    opy.numberer('RCM')
    opy.system('ProfileSPD')
    opy.integrator('Newmark', 0.5, 0.25)
    opy.analysis('Transient')
    opy.analyze(40, 1.0)
    opy.analyze(50, 0.5)
    opy.setTime(1.0e3)
    opy.wipeAnalysis()
    opy.recorder('Node', '-file', 'time_0_01.txt', '-precision', 16, '-dT',
                 0.01, '-rTolDt', 0.00001, '-time', '-node', 1, '-dof', 1,
                 'accel')
    opy.recorder('Element', '-file', 'etime_0_01.txt', '-precision', 16, '-dT',
                 0.01, '-rTolDt', 0.00001, '-time', '-ele', 1, 2, 'stress')
    opy.recorder('EnvelopeNode', '-file', 'entime_0_01.txt', '-precision', 16,
                 '-dT', 0.01, '-time', '-node', 1, '-dof', 1, 'accel')
    # opy.recorder('Drift', '-file', 'dtime_0_01.txt', '-precision', 16, '-dT', 0.01, '-time',
    #              '-iNode', 1, '-jNode', 2, '-dof', 1, '-perpDirn', 2)
    opy.timeSeries('Path', 1, '-dt', 0.01, '-values', -0.0, -0.0, -0.0, -0.0,
                   -0.0, -0.0, -0.0, -0.0, -7.51325e-05)
    opy.pattern('Plain', 1, 1)
    opy.load(13, 1.0, 0.0)
    opy.algorithm('Newton', False, False, False)
    opy.system('SparseGeneral')
    opy.numberer('RCM')
    opy.constraints('Transformation')
    opy.integrator('Newmark', 0.5, 0.25)
    opy.rayleigh(0.17952, 0.000909457, 0.0, 0.0)
    opy.analysis('Transient')
    opy.test('EnergyIncr', 1e-07, 10, 0, 2)
    opy.record()
    opy.analyze(1, 0.001)
    for i in range(1100):
        print(i)
        opy.analyze(1, 0.001)
        cur_time = opy.getTime()
    opy.wipe()

    a = open('time_0_01.txt').read().splitlines()
    for i in range(len(a) - 1):
        dt = float(a[i + 1].split()[0]) - float(a[i].split()[0])
        assert abs(dt - 0.01) < 0.0001, (i, dt)
def get_inelastic_response(mass,
                           k_spring,
                           f_yield,
                           motion,
                           dt,
                           xi=0.05,
                           r_post=0.0):
    """
    Run seismic analysis of a nonlinear SDOF

    :param mass: SDOF mass
    :param k_spring: spring stiffness
    :param f_yield: yield strength
    :param motion: list, acceleration values
    :param dt: float, time step of acceleration values
    :param xi: damping ratio
    :param r_post: post-yield stiffness
    :return:
    """

    op.wipe()
    op.model('basic', '-ndm', 2, '-ndf', 3)  # 2 dimensions, 3 dof per node

    # Establish nodes
    bot_node = 1
    top_node = 2
    op.node(bot_node, 0., 0.)
    op.node(top_node, 0., 0.)

    # Fix bottom node
    op.fix(top_node, opc.FREE, opc.FIXED, opc.FIXED)
    op.fix(bot_node, opc.FIXED, opc.FIXED, opc.FIXED)
    # Set out-of-plane DOFs to be slaved
    op.equalDOF(1, 2, *[2, 3])

    # nodal mass (weight / g):
    op.mass(top_node, mass, 0., 0.)

    # Define material
    bilinear_mat_tag = 1
    mat_type = "Steel01"
    mat_props = [f_yield, k_spring, r_post]
    op.uniaxialMaterial(mat_type, bilinear_mat_tag, *mat_props)

    # Assign zero length element
    beam_tag = 1
    op.element('zeroLength', beam_tag, bot_node, top_node, "-mat",
               bilinear_mat_tag, "-dir", 1, '-doRayleigh', 1)

    # Define the dynamic analysis
    load_tag_dynamic = 1
    pattern_tag_dynamic = 1

    values = list(-1 * motion)  # should be negative
    op.timeSeries('Path', load_tag_dynamic, '-dt', dt, '-values', *values)
    op.pattern('UniformExcitation', pattern_tag_dynamic, opc.X, '-accel',
               load_tag_dynamic)

    # set damping based on first eigen mode
    angular_freq = op.eigen('-fullGenLapack', 1)**0.5
    alpha_m = 0.0
    beta_k = 2 * xi / angular_freq
    beta_k_comm = 0.0
    beta_k_init = 0.0

    op.rayleigh(alpha_m, beta_k, beta_k_init, beta_k_comm)

    # Run the dynamic analysis

    op.wipeAnalysis()

    op.algorithm('Newton')
    op.system('SparseGeneral')
    op.numberer('RCM')
    op.constraints('Transformation')
    op.integrator('Newmark', 0.5, 0.25)
    op.analysis('Transient')

    tol = 1.0e-10
    iterations = 10
    op.test('EnergyIncr', tol, iterations, 0, 2)
    analysis_time = (len(values) - 1) * dt
    analysis_dt = 0.001
    outputs = {
        "time": [],
        "rel_disp": [],
        "rel_accel": [],
        "rel_vel": [],
        "force": []
    }

    while op.getTime() < analysis_time:
        curr_time = op.getTime()
        op.analyze(1, analysis_dt)
        outputs["time"].append(curr_time)
        outputs["rel_disp"].append(op.nodeDisp(top_node, 1))
        outputs["rel_vel"].append(op.nodeVel(top_node, 1))
        outputs["rel_accel"].append(op.nodeAccel(top_node, 1))
        op.reactions()
        outputs["force"].append(
            -op.nodeReaction(bot_node, 1))  # Negative since diff node
    op.wipe()
    for item in outputs:
        outputs[item] = np.array(outputs[item])

    return outputs
Пример #17
0
import opensees as ops

ops.wipe()

ops.uniaxialMaterial("Elastic", 1, 1000.);
ops.testUniaxialMaterial(1);

for strain in [0.01, 0.02, 0.03, 0.04, 0.05]:
    ops.setStrain(strain);
    print("strain: ", str(ops.getStrain()), " stress: ", str(ops.getStress()), " tangent: ", str(ops.getTangent()));

ops.uniaxialMaterial("Elastic", 2, 1000.);
ops.uniaxialMaterial("Parallel", 3, 1, 2);
ops.testUniaxialMaterial(3);

for strain in [0.01, 0.02, 0.03, 0.04, 0.05]:
    ops.setStrain(strain);
    print("strain: ", str(ops.getStrain()), " stress: ", str(ops.getStress()), " tangent: ", str(ops.getTangent()));
# q-z liq
matTag = 1
qzType = 1
#qzType = 1 Backbone of q-z curve approximates Reese and O'Neill's (1987) relation for drilled shafts in clay. qzType = 2 Backbone of q-z curve approximates Vijayvergiya's (1977) relation for piles in sand.
qult = 1000.0
#Ultimate capacity of the q-z material. (kN)
qzz50 = 0.02
#Displacement at which 50% of qult is mobilized in monotonic loading. (m)
suction = 0.0
#Uplift resistance is equal to suction*qult. Default = 0.0.
c = 0.0
#The viscous damping term (dashpot) on the far-field (elastic) component of the displacement rate (velocity).
alpha = 0.55
#The exponent defining the decreae in the tip capacity qult,ru = qult*(1-ru)^alpha where alpha=3sin(phi')/(1-3*sin(phi')) where phi'=effective friction angle of the soil.
op.uniaxialMaterial('QzLiq1', matTag, qzType, qult, qzz50, suction, c, alpha,
                    '-timeSeries', 1)

# t-z liq
matTag = 2
soilType = 2
#soilType = 1 Backbone of t-z curve approximates Reese and O’Neill (1987). soilType = 2 Backbone of t-z curve approximates Mosher (1984) relation.
tult = 50
#Ultimate capacity of the t-z material. (kN)
tzz50 = 0.001
#Displacement at which 50% of tult is mobilized in monotonic loading. (mm)
c = 0.0
#The viscous damping term (dashpot) on the far-field (elastic) component of the displacement rate (velocity).
op.uniaxialMaterial('TzLiq1', matTag, soilType, tult, tzz50, c, '-timeSeries',
                    2)

#----------------------------------------------------------
Пример #19
0
# define fixities for dashpot nodes
op.fix(dashF, 1, 1)
op.fix(dashS, 0, 1)

# define equal DOF for dashpot and base soil node
op.equalDOF(1, dashS, 1)
print('Finished creating dashpot nodes and boundary conditions...')

# define dashpot material
colArea = sElemX * thick[0]
rockVS = 700.0
rockDen = 2.5
dashpotCoeff = rockVS * rockDen

#uniaxialMaterial('Viscous', matTag, C, alpha)
op.uniaxialMaterial('Viscous', numLayers + 1, dashpotCoeff * colArea, 1)

# define dashpot element
op.element('zeroLength', nElemT + 1, dashF, dashS, '-mat', numLayers + 1,
           '-dir', 1)

print("Finished creating dashpot material and element...")

#-----------------------------------------------------------------------------------------
#  7. CREATE GRAVITY RECORDERS
#-----------------------------------------------------------------------------------------

# create list for pore pressure nodes
load_nodeList3 = np.loadtxt('Node_record.txt')
nodeList3 = []
Пример #20
0
# create nodes & add to Domain - command: node nodeId xCrd yCrd
ops.node(1, 0.0,   0.0)
ops.node(2, width, 0.0)
ops.node(3, 0.0,   height)
ops.node(4, width, height)

# set the boundary conditions - command: fix nodeID uxRestrnt? uyRestrnt? rzRestrnt?
ops.fix(1, 1, 1, 1)
ops.fix(2, 1, 1, 1)

# Define materials for nonlinear columns
# ------------------------------------------
# CONCRETE                        tag  f'c    ec0    f'cu   ecu
# Core concrete (confined)
ops.uniaxialMaterial("Concrete01", 1, -6.0, -0.004, -5.0, -0.014)
# Cover concrete (unconfined)
ops.uniaxialMaterial("Concrete01", 2, -5.0, -0.002, -0.0, -0.006)

# STEEL
# Reinforcing steel 
fy = 60.0;      # Yield stress
E = 30000.0;    # Young's modulus
#                              tag fy  E0  b
ops.uniaxialMaterial("Steel01", 3, fy, E, 0.01)

# Define cross-section for nonlinear columns
# ------------------------------------------
# set some parameters
colWidth = 15.0
colDepth = 24.0 
Пример #21
0
# Constraints for rigid diaphragm master nodes
#      tag DX DY DZ RX RY RZ
ops.fix(9, 0, 0, 1, 1, 1, 0)
ops.fix(14, 0, 0, 1, 1, 1, 0)
ops.fix(19, 0, 0, 1, 1, 1, 0)

# Define materials for nonlinear columns
# --------------------------------------
# CONCRETE
fc = 4.0
Ec = 57000.0 * math.sqrt(fc * 1000.0) / 1000.0

# Core concrete (confined)
#                                 tag  f'c   epsc0  f'cu  epscu
ops.uniaxialMaterial("Concrete01", 1, -5.0, -0.005, -3.5, -0.02)

# Cover concrete (unconfined)
#                                 tag  f'c   epsc0  f'cu  epscu
ops.uniaxialMaterial("Concrete01", 2, -fc, -0.002, 0.0, -0.006)

# STEEL
fy = 60.0
# Yield stress
Es = 30000.0
# Young's modulus
# Reinforcing steel
#                              tag fy  E0  b
ops.uniaxialMaterial("Steel01", 3, fy, Es, 0.02)

# Column parameters