Beispiel #1
0
def run(arg_1, arg_2, arg_3, arg_4):
    ops.reset()
    ops.wipe()

    ops.model('basic', '-ndm', 3, '-ndf', 6)

    ops.node(1, 0.0, 0.0, 0.0)
    ops.node(2, 0.0, 3.2, 0.0)
    ops.fix(1, 1, 1, 1, 1, 1, 1)

    ops.uniaxialMaterial('Concrete01', 1, -80.0e6, -0.002, 0.0, -0.005)

    ops.section('Fiber', 1, '-GJ', 1)
    ops.patch('rect', 1, 10, 10, -0.8, -0.1, 0.8, 0.1)

    ops.geomTransf('Linear', 1, 0, 0, 1)
    ops.beamIntegration('Legendre', 1, 1, 10)
    ops.element('dispBeamColumn', 1, 1, 2, 1, 1)

    ops.timeSeries('Linear', 1)
    ops.pattern('Plain', 1, 1)
    ops.load(2, 0, -24586.24, 0, 0, 0, 0)

    ops.constraints('Plain')
    ops.numberer('RCM')
    ops.system('UmfPack')
    ops.test('NormDispIncr', 1.0e-6, 2000)
    ops.algorithm('Newton')
    ops.integrator('LoadControl', 0.01)
    ops.analysis('Static')
    ops.analyze(100)

    ops.wipeAnalysis()
    ops.loadConst('-time', 0.0)

    ops.recorder('Node', '-file', 'disp.out', ' -time',
                 '-node',  2, '-dof', 1, 'disp')
    ops.recorder('Node', '-file', 'react.out', '-time ',
                 '-node', 2, '-dof', 1, 'reaction')

    ops.timeSeries('Linear', 2)
    ops.pattern('Plain', 2, 2)
    ops.load(2, 11500, 0, 0, 0, 0, 0)
    ops.constraints('Plain')
    ops.numberer('RCM')
    ops.system('UmfPack')
    ops.test('NormDispIncr', 1.0, 2000)
    ops.algorithm('Newton')
    ops.integrator('LoadControl',  0.01)
    ops.analysis('Static')
    # ops.analyze(100)

    step = 100
    data = np.zeros((step, 2))
    for i in range(step):
        ops.analyze(1)
        data[i, 0] = ops.nodeDisp(2, 1)
        data[i, 1] = ops.getLoadFactor(2) * 11500
    return data
    def define_fibers(self):
        '''
        Define fibers in the section.
        '''
        if self.material == None:
            raise Exception('No material is defined.')

        for p in self.section.patch_list:
            mattag, ny, nz, coord1, coord2 = p
            ops.patch('rect', mattag, ny, nz, *coord1, *coord2)
Beispiel #3
0
def ops_section():
    ''' define section '''
    # 加强区壳
    ops.section('LayeredShell', 1, 10,
                2, 20/1000,          # 保护层
                6, 1.28177/1000,     # 箍筋层
                2, 26.239/1000,      # 核心区混凝土
                2, 26.239/1000,      # 核心区混凝土
                2, 26.239/1000,      # 核心区混凝土
                2, 26.239/1000,      # 核心区混凝土
                2, 26.239/1000,      # 核心区混凝土
                2, 26.239/1000,      # 核心区混凝土
                6, 1.28177/1000,     # 箍筋层
                2, 20/1000           # 保护层
                )
    # 中部壳
    ops.section('LayeredShell', 2, 12,
                2, 20/1000,              # 保护层
                6, 0.65345127/1000,      # 箍筋层
                7, 0.6544985/1000,       # 纵筋层
                2, 26.2274/1000,         # 核心区混凝土
                2, 26.2274/1000,         # 核心区混凝土
                2, 26.2274/1000,         # 核心区混凝土
                2, 26.2274/1000,         # 核心区混凝土
                2, 26.2274/1000,         # 核心区混凝土
                2, 26.2274/1000,         # 核心区混凝土
                7, 0.6544985/1000,       # 纵筋层
                6, 0.65345127/1000,      # 箍筋层
                2, 20/1000               # 保护层
                )

    ops.section('Fiber', 3, '-GJ', 1)
    # 端部 GFRP 拉锁
    ops.patch('circ', 3, 10, 10, 0, 0, 0, 0.01414, 0, 360)
    ops.beamIntegration('Legendre', 1, 3, 9)
    # 0 1 0

    # 端部 SFCB 拉锁
    ops.section('Fiber', 4, '-GJ', 1)
    ops.patch('circ', 4, 10, 10, 0, 0, 0, 0.01414, 0, 360)
    ops.beamIntegration('Legendre', 2, 4, 9)

    ops.geomTransf('Linear', 1, 0, 1, 0)
Beispiel #4
0
#             |                       |     |
#             |                       |     |
#             |   o     o     o    |     |    -- cover
#             ---------------------     --   --
#             |-------- B --------|
#
# RC section:
coverY = HCol / 2.0  # The distance from the section z-axis to the edge of the cover concrete -- outer edge of cover concrete
coverZ = BCol / 2.0  # The distance from the section y-axis to the edge of the cover concrete -- outer edge of cover concrete
coreY = coverY - coverCol
coreZ = coverZ - coverCol
nfY = 16  # number of fibers for concrete in y-direction
nfZ = 4  # number of fibers for concrete in z-direction

op.section('Fiber', ColSecTag)
op.patch('quad', IDconcU, nfZ, nfY, -coverY, coverZ, -coverY, -coverZ, coverY,
         -coverZ, coverY, coverZ)  # Define the concrete patch
op.layer('straight', IDreinf, numBarsCol, barAreaCol, -coreY, coreZ, -coreY,
         -coreZ)
op.layer('straight', IDreinf, numBarsCol, barAreaCol, coreY, coreZ, coreY,
         -coreZ)

# BEAM section:
op.section('Elastic', BeamSecTag, Ec, ABeam, IzBeam)  # elastic beam section)

ColTransfTag = 1
BeamTransfTag = 2
op.geomTransf('Linear', ColTransfTag)
op.geomTransf('Linear', BeamTransfTag)

numIntgrPts = 5
def test_EigenFrameExtra():

    eleTypes = [
        'elasticBeam', 'forceBeamElasticSection', 'dispBeamElasticSection',
        'forceBeamFiberSectionElasticMaterial',
        'dispBeamFiberSectionElasticMaterial'
    ]

    for eleType in eleTypes:

        ops.wipe()

        ops.model('Basic', '-ndm', 2)

        #    units kip, ft

        # properties
        bayWidth = 20.0
        storyHeight = 10.0

        numBay = 10
        numFloor = 9

        A = 3.0  #area = 3ft^2
        E = 432000.0  #youngs mod = 432000 k/ft^2
        I = 1.0  #second moment of area I=1ft^4
        M = 3.0  #mas/length = 4 kip sec^2/ft^2
        coordTransf = "Linear"  # Linear, PDelta, Corotational
        massType = "-lMass"  # -lMass, -cMass

        nPts = 3  # numGauss Points

        # an elastic material
        ops.uniaxialMaterial('Elastic', 1, E)

        # an elastic section
        ops.section('Elastic', 1, E, A, I)

        # a fiber section with A=3 and I = 1 (b=1.5, d=2) 2d bending about y-y axis
        #   b 1.5 d 2.0
        y = 2.0
        z = 1.5
        numFiberY = 2000  # note we only need so many to get the required accuracy on eigenvalue 1e-7!
        numFiberZ = 1
        ops.section('Fiber', 2)
        #   patch rect 1 numFiberY numFiberZ 0.0 0.0 z y
        ops.patch('quad', 1, numFiberY, numFiberZ, -y / 2.0, -z / 2.0, y / 2.0,
                  -z / 2.0, y / 2.0, z / 2.0, -y / 2.0, z / 2.0)

        # add the nodes
        #  - floor at a time
        nodeTag = 1
        yLoc = 0.
        for j in range(0, numFloor + 1):
            xLoc = 0.
            for i in range(numBay + 1):
                ops.node(nodeTag, xLoc, yLoc)
                xLoc += bayWidth
                nodeTag += 1

            yLoc += storyHeight

        # fix base nodes
        for i in range(1, numBay + 2):
            ops.fix(i, 1, 1, 1)

        # add column element
        transfTag = 1
        ops.geomTransf(coordTransf, transfTag)
        integTag1 = 1
        ops.beamIntegration('Lobatto', integTag1, 1, nPts)
        integTag2 = 2
        ops.beamIntegration('Lobatto', integTag2, 2, nPts)
        eleTag = 1
        for i in range(numBay + 1):
            end1 = i + 1
            end2 = end1 + numBay + 1
            for j in range(numFloor):

                if eleType == "elasticBeam":
                    ops.element('elasticBeamColumn', eleTag, end1, end2, A, E,
                                I, 1, '-mass', M, massType)
                elif eleType == "forceBeamElasticSection":
                    ops.element('forceBeamColumn', eleTag, end1, end2,
                                transfTag, integTag1, '-mass', M)
                elif eleType == "dispBeamElasticSection":
                    ops.element('dispBeamColumn', eleTag, end1, end2,
                                transfTag, integTag1, '-mass', M, massType)
                elif eleType == "forceBeamFiberSectionElasticMaterial":
                    ops.element('forceBeamColumn', eleTag, end1, end2,
                                transfTag, integTag2, '-mass', M)
                elif eleType == "dispBeamFiberSectionElasticMaterial":
                    ops.element('dispBeamColumn', eleTag, end1, end2,
                                transfTag, integTag2, '-mass', M, massType)
                else:
                    print("BARF")

                end1 = end2
                end2 = end1 + numBay + 1
                eleTag += 1

        # add beam elements
        for j in range(1, numFloor + 1):
            end1 = (numBay + 1) * j + 1
            end2 = end1 + 1
            for i in range(numBay):
                if eleType == "elasticBeam":
                    ops.element('elasticBeamColumn', eleTag, end1, end2, A, E,
                                I, 1, '-mass', M, massType)
                elif eleType == "forceBeamElasticSection":
                    ops.element('forceBeamColumn', eleTag, end1, end2,
                                transfTag, integTag1, '-mass', M)
                elif eleType == "dispBeamElasticSection":
                    ops.element('dispBeamColumn', eleTag, end1, end2,
                                transfTag, integTag1, '-mass', M, massType)
                elif eleType == "forceBeamFiberSectionElasticMaterial":
                    ops.element('forceBeamColumn', eleTag, end1, end2,
                                transfTag, integTag2, '-mass', M)
                elif eleType == "dispBeamFiberSectionElasticMaterial":
                    ops.element('dispBeamColumn', eleTag, end1, end2,
                                transfTag, integTag2, '-mass', M, massType)
                else:
                    print("BARF")

    #           element(elasticBeamColumn eleTag end1 end2 A E I 1 -mass M
                end1 = end2
                end2 = end1 + 1
                eleTag += 1

        # calculate eigenvalues
        numEigen = 3
        eigenValues = ops.eigen(numEigen)
        PI = 2 * asin(1.0)

        # determine PASS/FAILURE of test
        testOK = 0

        # print table of camparsion
        #                         Bathe & Wilson               Peterson                    SAP2000                  SeismoStruct

        comparisonResults = [[0.589541, 5.52695, 16.5878],
                             [0.589541, 5.52696, 16.5879],
                             [0.589541, 5.52696, 16.5879],
                             [0.58955, 5.527, 16.588]]
        print("\n\nEigenvalue Comparisons for eleType:", eleType)
        tolerances = [9.99e-7, 9.99e-6, 9.99e-5]
        formatString = '{:>15}{:>15}{:>15}{:>15}{:>15}'
        print(
            formatString.format('OpenSees', 'Bathe&Wilson', 'Peterson',
                                'SAP2000', 'SeismoStruct'))
        formatString = '{:>15.5f}{:>15.4f}{:>15.4f}{:>15.4f}{:>15.3f}'
        for i in range(numEigen):
            lamb = eigenValues[i]
            print(
                formatString.format(lamb, comparisonResults[0][i],
                                    comparisonResults[1][i],
                                    comparisonResults[2][i],
                                    comparisonResults[3][i]))
            resultOther = comparisonResults[2][i]
            tol = tolerances[i]
            if abs(lamb - resultOther) > tol:
                testOK = -1
                print("failed->", abs(lamb - resultOther), tol)

        assert testOK == 0

    solverTypes = [
        '-genBandArpack', '-fullGenLapack', '-UmfPack', '-SuperLU',
        '-ProfileSPD'
    ]

    for solverType in solverTypes:

        eleType = 'elasticBeam'

        ops.wipe()

        ops.model('Basic', '-ndm', 2)

        #    units kip, ft

        # properties
        bayWidth = 20.0
        storyHeight = 10.0

        numBay = 10
        numFloor = 9

        A = 3.0  #area = 3ft^2
        E = 432000.0  #youngs mod = 432000 k/ft^2
        I = 1.0  #second moment of area I=1ft^4
        M = 3.0  #mas/length = 4 kip sec^2/ft^2
        coordTransf = "Linear"  # Linear, PDelta, Corotational
        massType = "-lMass"  # -lMass, -cMass

        nPts = 3  # numGauss Points

        # an elastic material
        ops.uniaxialMaterial('Elastic', 1, E)

        # an elastic section
        ops.section('Elastic', 1, E, A, I)

        # a fiber section with A=3 and I = 1 (b=1.5, d=2) 2d bending about y-y axis
        #   b 1.5 d 2.0
        y = 2.0
        z = 1.5
        numFiberY = 2000  # note we only need so many to get the required accuracy on eigenvalue 1e-7!
        numFiberZ = 1
        ops.section('Fiber', 2)
        #   patch rect 1 numFiberY numFiberZ 0.0 0.0 z y
        ops.patch('quad', 1, numFiberY, numFiberZ, -y / 2.0, -z / 2.0, y / 2.0,
                  -z / 2.0, y / 2.0, z / 2.0, -y / 2.0, z / 2.0)

        # add the nodes
        #  - floor at a time
        nodeTag = 1
        yLoc = 0.
        for j in range(0, numFloor + 1):
            xLoc = 0.
            for i in range(numBay + 1):
                ops.node(nodeTag, xLoc, yLoc)
                xLoc += bayWidth
                nodeTag += 1

            yLoc += storyHeight

        # fix base nodes
        for i in range(1, numBay + 2):
            ops.fix(i, 1, 1, 1)

        # add column element
        transfTag = 1
        ops.geomTransf(coordTransf, transfTag)
        integTag1 = 1
        ops.beamIntegration('Lobatto', integTag1, 1, nPts)
        integTag2 = 2
        ops.beamIntegration('Lobatto', integTag2, 2, nPts)
        eleTag = 1
        for i in range(numBay + 1):
            end1 = i + 1
            end2 = end1 + numBay + 1
            for j in range(numFloor):

                if eleType == "elasticBeam":
                    ops.element('elasticBeamColumn', eleTag, end1, end2, A, E,
                                I, 1, '-mass', M, massType)

                elif eleType == "forceBeamElasticSection":
                    ops.element('forceBeamColumn', eleTag, end1, end2,
                                transfTag, integTag1, '-mass', M)

                elif eleType == "dispBeamElasticSection":
                    ops.element('dispBeamColumn', eleTag, end1, end2,
                                transfTag, integTag1, '-mass', M, massType)
                elif eleType == "forceBeamFiberSectionElasticMaterial":
                    ops.element('forceBeamColumn', eleTag, end1, end2,
                                transfTag, integTag2, '-mass', M)

                elif eleType == "dispBeamFiberSectionElasticMaterial":
                    ops.element('dispBeamColumn', eleTag, end1, end2,
                                transfTag, integTag2, '-mass', M, massType)
                else:
                    print("BARF")

                end1 = end2
                end2 = end1 + numBay + 1
                eleTag += 1

        # add beam elements
        for j in range(1, numFloor + 1):
            end1 = (numBay + 1) * j + 1
            end2 = end1 + 1
            for i in range(numBay):
                if eleType == "elasticBeam":
                    ops.element('elasticBeamColumn', eleTag, end1, end2, A, E,
                                I, 1, '-mass', M, massType)
                elif eleType == "forceBeamElasticSection":
                    ops.element('forceBeamColumn', eleTag, end1, end2,
                                transfTag, integTag1, '-mass', M)
                elif eleType == "dispBeamElasticSection":
                    ops.element('dispBeamColumn', eleTag, end1, end2,
                                transfTag, integTag1, '-mass', M, massType)
                elif eleType == "forceBeamFiberSectionElasticMaterial":
                    ops.element('forceBeamColumn', eleTag, end1, end2,
                                transfTag, integTag2, '-mass', M)
                elif eleType == "dispBeamFiberSectionElasticMaterial":
                    ops.element('dispBeamColumn', eleTag, end1, end2,
                                transfTag, integTag2, '-mass', M, massType)
                else:
                    print("BARF")

    #           element(elasticBeamColumn eleTag end1 end2 A E I 1 -mass M
                end1 = end2
                end2 = end1 + 1
                eleTag += 1

        # calculate eigenvalues
        numEigen = 3
        eigenValues = ops.eigen(solverType, numEigen)
        PI = 2 * asin(1.0)

        # determine PASS/FAILURE of test
        testOK = 0

        # print table of camparsion
        #                         Bathe & Wilson               Peterson                    SAP2000                  SeismoStruct

        comparisonResults = [[0.589541, 5.52695, 16.5878],
                             [0.589541, 5.52696, 16.5879],
                             [0.589541, 5.52696, 16.5879],
                             [0.58955, 5.527, 16.588]]
        print("\n\nEigenvalue Comparisons for solverType:", solverType)
        tolerances = [9.99e-7, 9.99e-6, 9.99e-5]
        formatString = '{:>15}{:>15}{:>15}{:>15}{:>15}'
        print(
            formatString.format('OpenSees', 'Bathe&Wilson', 'Peterson',
                                'SAP2000', 'SeismoStruct'))
        formatString = '{:>15.5f}{:>15.4f}{:>15.4f}{:>15.4f}{:>15.3f}'
        for i in range(numEigen):
            lamb = eigenValues[i]
            print(
                formatString.format(lamb, comparisonResults[0][i],
                                    comparisonResults[1][i],
                                    comparisonResults[2][i],
                                    comparisonResults[3][i]))
            resultOther = comparisonResults[2][i]
            tol = tolerances[i]
            if abs(lamb - resultOther) > tol:
                testOK = -1
                print("failed->", abs(lamb - resultOther), tol)

        assert testOK == 0
Beispiel #6
0
def section_creator(sectag, matcore, matcover, matsteel, d, b, cc, fi, bartop, 
                      nsuby, nsubz, fibot=0, barbot=0, fiside = 0, barside = 0, angle = 0, print_section = False):
    """
    Introduction
    ------------
    This function generate a fiber section for openseespy framework.
    It is implemented for RC section, with the possibility to Plot the section,
    and to rotate the RcSection by a given angle.
    As output the function will generate the give section on openseespy model.
    
     Information
     -----------
        Author: Gaetano Camarda, Ph.D. Student in Structural Engineer
        Affiliation: University of Palermo
        e-mail: [email protected]
        
                                                                     V1.0 2020
    Package needed
    --------------
    - Openseespy
    - Openseespy.postprocessing
    - matplotlib
    - numpy
    
    
    Input:
    ------
        sectag, the sectiontag in the model
        matcore, material for confined core concrete
        matcover, material for concrete cover
        matsteel, material for reinforcement
        d, section depth
        b, section base length
        cc, cover length
        fi, top bar diameter
        bartop, number of top bar; if barbot is not specidied, bartop will be used
        nsuby, fiber subdivision along y axis
        nsubz, fiber subdivision along z axis
        
    Optional input:
    ---------------
        fibot, diameter of bottom reinforcement if different from top
        barbot, number of bottom reinforcement if different from top
        fiside, diameter of side bar
        barside, number of side bar (How to use:
                                     if for example you need 4 bars, you have to
                                     input barside = 2, because the other 2 bars
                                     are inserted in bartop and bottom)
        angle, angle if you need to rotate section, for example angle = 90
        print_section, plot the section defined
    """
    if fibot == 0:
        fibot = fi
    if barbot == 0:
        barbot = bartop
        
    import openseespy.opensees as ops
    import openseespy.postprocessing.ops_vis as opsv
    import matplotlib.pyplot as plt
    from numpy import power
    from numpy import pi
    ymax = b / 2
    zmax = d / 2
    ymin = ymax - cc
    zmin = zmax - cc
    Abar = pi * power(fi/2,2)
    Abarbot = pi * power(fibot/2,2)
    Abarside = pi * power(fiside/2,2)
    lside = d - (2*cc)
    bside = lside / (barside + 2) + (lside / (barside + 2))/(barside+2) # TODO: VERIFICARE COME SI COMPORTANO LE BARRE LATERAL
    angle = (angle * pi) /180
    pc = {
                        'a' : rotate_point(-ymin, -zmin, angle),
                        'b' : rotate_point(ymin, -zmin, angle),
                        'c' : rotate_point(ymin, zmin, angle),
                        'd' : rotate_point(-ymin, zmin, angle),
                        'e' : rotate_point(-ymax, -zmax, angle),
                        'f' : rotate_point(ymax, -zmax, angle),
                        'g' : rotate_point(ymax, zmax, angle),
                        'h' : rotate_point(-ymax, zmax, angle),
                        'b1': rotate_point(ymax, -zmin, angle),
                        'a1': rotate_point(-ymax, -zmin, angle),
                        'd1': rotate_point(-ymax, zmin, angle),
                        'c1': rotate_point(ymax, zmin, angle)
                        }
    fib_sec = [['section', 'Fiber', sectag],
                      ['patch','quad',matcore,nsuby, nsubz, pc['a'][0], pc['a'][1], pc['b'][0], pc['b'][1], pc['c'][0], pc['c'][1], pc['d'][0], pc['d'][1]], # core 1
                      ['patch','quad',matcover,nsuby, int(nsubz/2), pc['e'][0], pc['e'][1], pc['f'][0], pc['f'][1], pc['b1'][0], pc['b1'][1], pc['a1'][0], pc['a1'][1]], #  cover 2
                      ['patch','quad',matcover,nsuby, int(nsubz/2), pc['d1'][0], pc['d1'][1], pc['c1'][0], pc['c1'][1], pc['g'][0], pc['g'][1], pc['h'][0], pc['h'][1]], # cover 3
                      ['patch','quad',matcover,int(nsubz/2), nsuby, pc['a1'][0], pc['a1'][1], pc['a'][0], pc['a'][1], pc['d'][0], pc['d'][1], pc['d1'][0], pc['d1'][1]], # cover 4
                      ['patch','quad',matcover,int(nsubz/2), nsuby, pc['b'][0], pc['b'][1], pc['b1'][0], pc['b1'][1], pc['c1'][0], pc['c1'][1], pc['c'][0], pc['c'][1]] # cover 5
                      ]
    
    ops.section('Fiber', sectag)
    ops.patch('quad',matcore,nsuby, nsubz, pc['a'][0], pc['a'][1], pc['b'][0], pc['b'][1], pc['c'][0], pc['c'][1], pc['d'][0], pc['d'][1])
    ops.patch('quad',matcover,nsuby, int(nsubz/2), pc['e'][0], pc['e'][1], pc['f'][0], pc['f'][1], pc['b1'][0], pc['b1'][1], pc['a1'][0], pc['a1'][1])
    ops.patch('quad',matcover,nsuby, int(nsubz/2), pc['d1'][0], pc['d1'][1], pc['c1'][0], pc['c1'][1], pc['g'][0], pc['g'][1], pc['h'][0], pc['h'][1])
    ops.patch('quad',matcover,int(nsubz/2), nsuby, pc['a1'][0], pc['a1'][1], pc['a'][0], pc['a'][1], pc['d'][0], pc['d'][1], pc['d1'][0], pc['d1'][1])
    ops.patch('quad',matcover,int(nsubz/2), nsuby, pc['b'][0], pc['b'][1], pc['b1'][0], pc['b1'][1], pc['c1'][0], pc['c1'][1], pc['c'][0], pc['c'][1])
    
    if barbot == bartop:
        fib_sec.append(['layer', 'straight', matsteel, bartop, Abar, pc['d'][0], pc['d'][1], pc['c'][0], pc['c'][1]])
        fib_sec.append(['layer', 'straight', matsteel, barbot, Abarbot, pc['a'][0], pc['a'][1], pc['b'][0], pc['b'][1]])
        ops.layer('straight', matsteel, bartop, Abar, pc['d'][0], pc['d'][1], pc['c'][0], pc['c'][1]),
        ops.layer('straight', matsteel, barbot, Abarbot, pc['a'][0], pc['a'][1], pc['b'][0], pc['b'][1])
    elif bartop != barbot:
        fib_sec.append(['layer', 'straight', matsteel, bartop, Abar, pc['d'][0], pc['d'][1], pc['c'][0], pc['c'][1]])
        fib_sec.append( ['layer', 'straight', matsteel, barbot, Abarbot, pc['a'][0], pc['a'][1], pc['b'][0], pc['b'][1]])
        ops.layer('straight', matsteel, bartop, Abar, pc['d'][0], pc['d'][1], pc['c'][0], pc['c'][1]),
        ops.layer('straight', matsteel, barbot, Abarbot, pc['a'][0], pc['a'][1], pc['b'][0], pc['b'][1])
    if barside != 0:
        p1 = rotate_point(-ymin, -zmin + bside, angle)
        p2 = rotate_point(-ymin, zmin - bside, angle)
        fib_sec.append(['layer', 'straight', matsteel, barside, Abarside, p1[0], p1[1], p2[0], p2[1]])
        p3 = rotate_point(ymin, -zmin + bside, angle)
        p4 = rotate_point(ymin, zmin - bside, angle)
        fib_sec.append(['layer', 'straight', matsteel, barside, Abarside, p3[0], p3[1], p4[0], p4[1]])
        ops.layer('straight', matsteel, barside, Abarside, p1[0], p1[1], p2[0], p2[1])
        ops.layer('straight', matsteel, barside, Abarside, p3[0], p3[1], p4[0], p4[1])
    
    if print_section == True:
        # plt.style.use('classic')
        matcolor = ['r', 'darkgrey', 'lightgrey', 'w', 'w', 'w']
        opsv.plot_fiber_section(fib_sec, matcolor=matcolor)
        plt.axis('equal')
        del fib_sec
        
#### DISMISSED FOR NOW #####
# def PlotFrame(nodematrix,elementmatrix,displacement = None,scale = 1):
#     import matplotlib.pyplot as plt
#     plt.style.use('classic')
#     plt.figure()
#     if displacement is None:
#         plt.figure()
#         for i in range(len(elementmatrix[0])):
#             nodoi = elementmatrix[0][i]
#             nodoj = elementmatrix[1][i]
#             xx = (nodematrix[nodoi][0],nodematrix[nodoj][0])
#             yy = (nodematrix[nodoi][1],nodematrix[nodoj][1])
#             plt.text(nodematrix[nodoi][0], nodematrix[nodoi][1], nodoi)
#             plt.text(nodematrix[nodoj][0], nodematrix[nodoj][1], nodoj)
#             plt.text((nodematrix[nodoi][0]+nodematrix[nodoj][0])/2, (nodematrix[nodoi][1]+nodematrix[nodoj][1])/2, i, bbox=dict(facecolor='green', alpha=0.2))
#             plt.plot(xx, yy,'-k');
#     elif displacement is not None:
#             nodematrix_update = []
#             plt.figure()
#             for i in range(len(elementmatrix[0])):
#                 nodoi = elementmatrix[0][i]
#                 nodoj = elementmatrix[1][i]
#                 xx = (nodematrix[nodoi][0],nodematrix[nodoj][0])
#                 yy = (nodematrix[nodoi][1],nodematrix[nodoj][1])
#                 plt.text(nodematrix[nodoi][0], nodematrix[nodoi][1], nodoi)
#                 plt.text(nodematrix[nodoj][0], nodematrix[nodoj][1], nodoj)
#                 plt.text((nodematrix[nodoi][0]+nodematrix[nodoj][0])/2, (nodematrix[nodoi][1]+nodematrix[nodoj][1])/2, i,bbox=dict(facecolor='green', alpha=0.2))
#                 plt.plot(xx, yy,'-k');
#             txt = ('Node Displacement (Scale_factor: ' + str(scale) + ')')
#             plt.title(txt)
#             for i in range(len(nodematrix)):
#                 nodematrix_update.append([nodematrix[i][0]+displacement[i][0]*scale,nodematrix[i][1]+displacement[i][1]*scale])
#             for i in range(len(elementmatrix[0])):
#                 nodoi = elementmatrix[0][i]
#                 nodoj = elementmatrix[1][i]
#                 xx = (nodematrix_update[nodoi][0],nodematrix_update[nodoj][0])
#                 yy = (nodematrix_update[nodoi][1],nodematrix_update[nodoj][1])
#                 plt.plot(xx, yy,'-r');
                
# def PlotFrame_move(nodematrix,elementmatrix,displacement = None,scale = 1):
#     import matplotlib.pyplot as plt
#     plt.style.use('classic')
#     if displacement is None:
#         plt.figure()
#         for i in range(len(elementmatrix[0])):
#             nodoi = elementmatrix[0][i]
#             nodoj = elementmatrix[1][i]
#             xx = (nodematrix[nodoi][0],nodematrix[nodoj][0])
#             yy = (nodematrix[nodoi][1],nodematrix[nodoj][1])
#             plt.text(nodematrix[nodoi][0], nodematrix[nodoi][1], nodoi)
#             plt.text(nodematrix[nodoj][0], nodematrix[nodoj][1], nodoj)
#             plt.text((nodematrix[nodoi][0]+nodematrix[nodoj][0])/2, (nodematrix[nodoi][1]+nodematrix[nodoj][1])/2, i, bbox=dict(facecolor='green', alpha=0.2))
#             plt.plot(xx, yy,'-k');
#     elif displacement is not None:
#             nodematrix_update = []
#             plt.figure()
#             for i in range(len(elementmatrix[0])):
#                 nodoi = elementmatrix[0][i]
#                 nodoj = elementmatrix[1][i]
#                 xx = (nodematrix[nodoi][0],nodematrix[nodoj][0])
#                 yy = (nodematrix[nodoi][1],nodematrix[nodoj][1])
#                 plt.text(nodematrix[nodoi][0], nodematrix[nodoi][1], nodoi)
#                 plt.text(nodematrix[nodoj][0], nodematrix[nodoj][1], nodoj)
#                 plt.text((nodematrix[nodoi][0]+nodematrix[nodoj][0])/2, (nodematrix[nodoi][1]+nodematrix[nodoj][1])/2, i,bbox=dict(facecolor='green', alpha=0.2))
#                 plt.plot(xx, yy,'-k');
#             txt = ('Node Displacement (Scale_factor: ' + str(scale) + ')')
#             plt.title(txt)
#             for i in range(len(nodematrix)):
                nodematrix_update.append([nodematrix[i][0]+displacement[i][0]*scale,nodematrix[i][1]+displacement[i][1]*scale])
            for i in range(len(elementmatrix[0])):
                nodoi = elementmatrix[0][i]
                nodoj = elementmatrix[1][i]
                xx = (nodematrix_update[nodoi][0],nodematrix_update[nodoj][0])
                yy = (nodematrix_update[nodoi][1],nodematrix_update[nodoj][1])
                plt.plot(xx, yy,'-r');
def RectCFSTSteelHysteretic(length: float, secHeight: float, secWidth: float,
                            thickness: float, concrete_grade: float,
                            steel_grade: float, axial_load_ratio: float,
                            disp_control: Iterable[float]):
    '''Peakstress: concrete peak stress \n crushstress: concrete crush stress
    '''
    #disp input
    # dispControl=[3,-3,7,-7,14,-14,14,-14,14,-14,28,-28,28,-28,28,-28,42,-42,42,-42,42,-42,56,-56,0]
    dispControl = tuple(disp_control)
    #Geometry
    # length=740
    # secHeight=100
    # secWidth=100
    # thickness=7
    #Materials
    ##steel_tube
    point1Steel, point2Steel, point3Steel = [460, 0.00309], [460, 0.02721
                                                             ], [530, 0.26969]
    point1SteelNegative, point2SteelNegative, point3SteelNegative = [
        -460, -0.00309
    ], [-460, -0.02721], [-736, -0.26969]
    pinchX = 0.2
    pinchY = 0.7
    damagedFactor = 0.01
    densitySteel = 7.8 / 1000000000
    ##concrete
    peakPointConcrete, crushPointConcrete = [-221.76, -0.0102], [-195, -0.051]

    unloadingLambda = 0.2
    tensileStrength = 5.6
    tensilePostStiffness = 0.01
    densityConcrete = 2.4 / 1000000000
    #axialLoadRatio
    # axialLoadRatio=0.4
    #fix condition
    Fixed = 1

    #section parameter
    areaConcrete = (secHeight - 2 * thickness) * (secWidth - 2 * thickness)
    areaSteel = secWidth * secHeight - areaConcrete

    # fck,Ec,nuConcrete=128.1,4.34*10000,0.21
    # fy,epsilonSteely,Es,nuSteel=444.6,3067/1000000,1.99*100000,0.29
    fck = peakPointConcrete[0]
    fy = point1Steel[0]

    #Computate parameter
    axialLoad = (areaConcrete * fck + areaSteel * fy) * axial_load_ratio

    #loading control parameter
    # for item in dispControlPercentage:
    #     dispControl.append(item*length)
    #     dispControl.append(-item*length)
    # print('displist:'dispControl)

    #wipe and build a model
    ops.wipe()
    ops.model('basic', '-ndm', 2, '-ndf', 3)

    #node coordinates
    meshNumLength = 5
    meshVerticalSize = length / meshNumLength
    meshSteelSize = 10
    nodes = [(i + 1, meshVerticalSize * i)
             for i in range(int(length / meshVerticalSize) + 1)]
    for item in nodes:
        ops.node(item[0], 0, item[1])

    #boundary condition
    ops.fix(1, 1, 1, 1)
    # if bool(Fixed):
    #     ops.fix(int(length/meshVerticalSize)+1,0,0,1)  ##uppper constrain condition: free or no-rotation

    #mass defination(concentrate mass to nodes)
    nodeMassSteel = areaSteel * meshVerticalSize * densitySteel
    nodeMassConcrete = areaConcrete * meshVerticalSize * densityConcrete
    nodeMass = nodeMassSteel + nodeMassConcrete
    for i in range(len(nodes) - 1):
        arg = [0., nodeMass, 0.]
        ops.mass(i + 2, *arg)

    #transformation:
    ops.geomTransf('Linear', 1)

    #material defination
    ##steel

    ops.uniaxialMaterial('Hysteretic', 1001, *point1Steel, *point2Steel,
                         *point3Steel, *point1SteelNegative,
                         *point2SteelNegative, *point3SteelNegative, pinchX,
                         pinchY, damagedFactor, 0, 0.0)
    ##concrete
    ##using concrete01
    #peakPointConcrete,crushPointConcrete=[110.6,0.00544],[22.11,0.09145]
    #ops.uniaxialMaterial('Concrete01',1,*peakPointConcrete,*crushPointConcrete)
    ###using concrete02

    ops.uniaxialMaterial('Concrete02', 1, *peakPointConcrete,
                         *crushPointConcrete, unloadingLambda, tensileStrength,
                         tensilePostStiffness)

    #section defination
    ops.section('Fiber', 1)
    ##inner concrete fiber
    fiberPointI, fiberPointJ = [
        -(secHeight - 2 * thickness) / 2, -(secWidth - 2 * thickness) / 2
    ], [(secHeight - 2 * thickness) / 2, (secWidth - 2 * thickness) / 2]
    ops.patch('rect', 1, 10, 1, *fiberPointI, *fiberPointJ
              )  # https://opensees.berkeley.edu/wiki/index.php/Patch_Command
    ##outside steel fiber
    steelFiberProperty = {
        'height': meshSteelSize,
        'area': meshSteelSize * thickness
    }
    steelFiberPropertyLeftAndRight = {
        'height': secWidth,
        'area': secWidth * thickness
    }
    ###left and right
    leftEdgeFiberY, rightEdgeFiberY = -(
        secHeight - 2 * thickness) / 2 - thickness / 2, (
            secHeight -
            2 * thickness) / 2 + thickness / 2  #rightEdgeFiberY might be wrong
    leftandRightEdgeFiberZ = [
        -secWidth / 2 + steelFiberPropertyLeftAndRight['height'] * (1 / 2 + N)
        for N in range(int(secWidth /
                           steelFiberPropertyLeftAndRight['height']))
    ]
    ###up and down
    upEdgeFiberZ, downEdgeFiberZ = -(
        secWidth - 2 * thickness) / 2 - thickness / 2, (
            secWidth - 2 * thickness) / 2 + thickness / 2
    upandDownEdgeFiberY = [
        -secHeight / 2 + thickness + steelFiberProperty['height'] * (1 / 2 + N)
        for N in range(
            int((secHeight - 2 * thickness) / steelFiberProperty['height']))
    ]
    for i in leftandRightEdgeFiberZ:
        i = float(i)
        ops.fiber(float(leftEdgeFiberY), i,
                  steelFiberPropertyLeftAndRight['area'], 1001)
        ops.fiber(float(rightEdgeFiberY), i,
                  steelFiberPropertyLeftAndRight['area'], 1001)
    for j in upandDownEdgeFiberY:
        j = float(j)
        ops.fiber(j, float(upEdgeFiberZ), steelFiberProperty['area'], 1001)
        ops.fiber(j, float(downEdgeFiberZ), steelFiberProperty['area'], 1001)
    #beamInergration defination
    ops.beamIntegration('NewtonCotes', 1, 1, 5)

    #element defination
    for i in range(len(nodes) - 1):
        ops.element('dispBeamColumn', i + 1, i + 1, i + 2, 1, 1)

    #recorders
    ops.recorder('Node', '-file', 'topLateralDisp.txt', '-time', '-node',
                 int(length / meshVerticalSize + 1), '-dof', 1, 2, 'disp')
    ops.recorder('Node', '-file', 'topLateralForce.txt', '-time', '-node',
                 int(length / meshVerticalSize + 1), '-dof', 1, 2, 'reaction')
    ops.recorder('Element', '-file', 'topElementForce.txt', '-time', '-ele',
                 int(length / meshVerticalSize), 'force')

    #gravity load
    ops.timeSeries('Linear', 1)
    ops.pattern('Plain', 1, 1)
    ops.load(int(length / meshVerticalSize + 1), 0, axialLoad, 0)
    ops.constraints('Plain')
    ops.numberer('RCM')
    ops.system('BandGeneral')
    ##convertage test
    tolerant, allowedIteralStep = 1 / 1000000, 6000
    ops.test('NormDispIncr', tolerant, allowedIteralStep)
    ops.algorithm('Newton')
    ops.integrator('LoadControl', 0.1)
    ops.analysis('Static')
    ops.analyze(10)
    ops.loadConst('-time', 0)

    #lateraldisp analysis
    ops.pattern('Plain', 2, 1)
    ops.load(int(length / meshVerticalSize + 1), 100, 0, 0)
    for i in range(len(dispControl)):
        if i == 0:
            ops.integrator('DisplacementControl',
                           int(length / meshVerticalSize + 1), 1, 0.1)
            ops.analyze(int(dispControl[i] / 0.1))
            # print('Working on disp round',i)
        else:
            if dispControl[i] >= 0:
                ops.integrator('DisplacementControl',
                               int(length / meshVerticalSize + 1), 1, 0.1)
                ops.analyze(int(
                    abs(dispControl[i] - dispControl[i - 1]) / 0.1))
                # print('Working on disp round',i)
            else:
                ops.integrator('DisplacementControl',
                               int(length / meshVerticalSize + 1), 1, -0.1)
                ops.analyze(int(
                    abs(dispControl[i] - dispControl[i - 1]) / 0.1))
def main():
    """
    Create a Cantilever Problem
    """

    ops.wipe()
    ops.model('basic', '-ndm', 2, '-ndf', 3)
    height = 5.0
    nElem = 20

    ElemLength = height / nElem
    nodeID = []
    Ycoord = 0
    for i in range(nElem + 1):
        nodeID.append(i)
        ops.node(i, 0.0, Ycoord)
        Ycoord += ElemLength
    IDctrlNode = i

    ops.fix(0, 1, 1, 1)
    ops.geomTransf('Linear', 1)

    concrete = 'Concrete04'
    steel = 'Steel02'

    matTAGConc = 319
    matTAGSteel = 312
    fcc = -20000
    ec2c = -0.002
    ecu2c = -0.0035
    Ec = 30000000
    fct = 2200
    et = 0.001
    fy = 500000
    E0 = 200000000
    b = 0.01
    ops.uniaxialMaterial(concrete, matTAGConc, fcc, ec2c, ecu2c, Ec, fct, et)
    ops.uniaxialMaterial(steel, matTAGSteel, fy, E0, b, 20, 0.925, 0.15, 0, 1, 0, 1, 0)

    # Core Fibers
    ops.section('Fiber', 105)
    ops.patch('rect', 319, 11, 11, -0.20, -0.20, 0.20, 0.20)
    # Cover Fibers
    ops.patch('rect', 319, 15, 2, 0.250000, 0.200000, -0.250000, 0.250000)
    ops.patch('rect', 319, 15, 2, 0.250000, -0.250000, -0.250000, -0.200000)
    ops.patch('rect', 319, 2, 11, -0.250000, -0.200000, -0.200000, 0.200000)
    ops.patch('rect', 319, 2, 11, 0.200000, -0.200000, 0.250000, 0.200000)
    # create corner bars
    ops.layer('straight', 312, 4, 0.00025450, 0.200000, 0.200000, -0.200000, 0.200000)
    ops.layer('straight', 312, 4, 0.00025450, 0.200000, -0.200000, -0.200000, -0.200000)
    ops.beamIntegration('Lobatto', 100, 105, 3)

    for i in range(len(nodeID) - 1):
        ops.element('forceBeamColumn', i, nodeID[i], nodeID[i + 1], 1, 100, '-iter', 10, 1e-6)

    # Add Vertical Load at Top
    ops.timeSeries('Linear', 101)
    ops.pattern('Plain', 100, 101)
    ops.load(IDctrlNode, 0, -500, 0)

    # Solve Gravity First
    ops.system('UmfPack')
    ops.numberer('Plain')
    ops.constraints('Transformation')
    ops.integrator('LoadControl', 0.1)
    ops.test('RelativeTotalNormDispIncr', 0.001, 100, 2)
    ops.algorithm('Newton')
    ops.analysis('Static')
    LoadControlSubStep(10, 0.1, True)

    # Displacement Control Analysis(Pushover)
    ops.pattern('Plain', 200, 101)
    ops.load(IDctrlNode, 1, 0, 0)
    ops.system('UmfPack')
    ops.numberer('Plain')
    ops.constraints('Transformation')
    ops.test('RelativeTotalNormDispIncr', 1e-2, 500, 2)
    ops.algorithm('Newton')
    ops.analysis('Static')
    DispControlSubStep(100, IDctrlNode, 1, 1.0)
Beispiel #9
0
def getSections():

    op.model('Basic', '-ndm', 2, '-ndf', 3)

    # Get material prorpeties
    Esteel = 200. * GPa
    Eflex = 1.
    Erigid = 100. * 10**12

    # define materials
    op.uniaxialMaterial('Elastic', 1, Esteel)
    op.uniaxialMaterial('Elastic', 10, Eflex)
    op.uniaxialMaterial('Elastic', 20, Erigid)

    # Define Steel Material
    Fy = 350. * MPa
    E0 = 200. * GPa
    b = 0.0005

    #  uniaxialMaterial('Steel02', matTag, Fy, E0, b)
    op.uniaxialMaterial('Steel02', 2, Fy, E0, b)

    fpc = -30. * 10**6
    fpcu = fpc * 0.1
    epsc0 = -0.002
    epsU = epsc0 * 8
    lam = 0.2
    ft = -fpc / 30
    Ets = 2 * fpc / (epsc0 * 20)

    # Define Concrete Material
    #  uniaxialMaterial('Concrete02', matTag, fpc, epsc0, fpcu, epsU, lambda, ft, Ets)
    op.uniaxialMaterial('Concrete02', 3, fpc, epsc0, fpcu, epsU, lam, ft, Ets)

    # Geometry preprocessing
    # Get Verticies
    h = 600 * mm
    w = 400 * mm
    vertices = np.array(
        [-h / 2, w / 2, -h / 2, -w / 2, h / 2, -w / 2, h / 2, w / 2])

    # Define Rebar Info
    rebarZ = np.array([-150, 0, 150]) * mm
    rebarY = np.array([150, 225]) * mm
    Abar = np.pi * (30 * mm / 2)**2

    Nbar = len(rebarZ) * len(rebarY)
    rebarYZ = np.zeros([Nbar, 2])

    for ii, Y in enumerate(rebarY):
        for jj, Z in enumerate(rebarZ):
            rebarYZ[ii * len(rebarZ) + jj, :] = [Y, Z]

    NfibeZ = 1
    NfibeY = 100

    # Define Sections
    # Test Sections
    #  section('Fiber', secTag)
    op.section('Fiber', 1)

    #  patch('quad', matTag, numSubdivIJ, numSubdivJK, *crdsI, *crdsJ, *crdsK, *crdsL)
    op.patch('quad', 1, NfibeZ, NfibeY, *vertices)

    for YZ in rebarYZ:
        #  fiber(yloc, zloc, A, matTag)
        op.fiber(*YZ, Abar, 1)

    # Actual Section
    #  section('Fiber', secTag)
    op.section('Fiber', 2)

    #  patch('quad', matTag, numSubdivIJ, numSubdivJK, *crdsI, *crdsJ, *crdsK, *crdsL)
    op.patch('quad', 3, NfibeZ, NfibeY, *vertices)

    for YZ in rebarYZ:
        #  fiber(yloc, zloc, A, matTag)
        op.fiber(*YZ, Abar, 2)

    # Define transform and integration
    op.geomTransf('Linear', 1)
    op.geomTransf('PDelta', 2)

    #  beamIntegration('Lobatto', tag, secTag, N)
    op.beamIntegration('Lobatto', 1, 1, 4)
    op.beamIntegration('Lobatto', 2, 2, 4)

    return rebarYZ
def test_MomentCurvature():
    ops.wipe()

    # Define model builder
    # --------------------
    ops.model('basic', '-ndm', 2, '-ndf', 3)

    # 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 paramaters
    colWidth = 15
    colDepth = 24

    cover = 1.5
    As = 0.60
    # area of no. 7 bars

    # some variables derived from the parameters
    y1 = colDepth / 2.0
    z1 = colWidth / 2.0

    ops.section('Fiber', 1)

    # Create the concrete core fibers
    ops.patch('rect', 1, 10, 1, cover - y1, cover - z1, y1 - cover, z1 - cover)

    # Create the concrete cover fibers (top, bottom, left, right)
    ops.patch('rect', 2, 10, 1, -y1, z1 - cover, y1, z1)
    ops.patch('rect', 2, 10, 1, -y1, -z1, y1, cover - z1)
    ops.patch('rect', 2, 2, 1, -y1, cover - z1, cover - y1, z1 - cover)
    ops.patch('rect', 2, 2, 1, y1 - cover, cover - z1, y1, z1 - cover)

    # Create the reinforcing fibers (left, middle, right)
    ops.layer('straight', 3, 3, As, y1 - cover, z1 - cover, y1 - cover,
              cover - z1)
    ops.layer('straight', 3, 2, As, 0.0, z1 - cover, 0.0, cover - z1)
    ops.layer('straight', 3, 3, As, cover - y1, z1 - cover, cover - y1,
              cover - z1)

    # Estimate yield curvature
    # (Assuming no axial load and only top and bottom steel)
    # d -- from cover to rebar
    d = colDepth - cover
    # steel yield strain
    epsy = fy / E
    Ky = epsy / (0.7 * d)

    # Print estimate to standard output
    print("Estimated yield curvature: ", Ky)

    # Set axial load
    P = -180.0

    # Target ductility for analysis
    mu = 15.0

    # Number of analysis increments
    numIncr = 100

    # Call the section analysis procedure
    MomentCurvature(1, P, Ky * mu, numIncr)

    u = ops.nodeDisp(2, 3)
    assert abs(u - 0.00190476190476190541) < 1e-12
def get_Sections(fc, Es, fy, sec_dims, D, rebar_coords_YZ):
    '''
    Summary
    -------
    
    
    Parameters
    ----------
    fc : TYPE
        DESCRIPTION.
    Es : TYPE
        DESCRIPTION.
    fy : TYPE
        DESCRIPTION.
    sec_dims : TYPE
        DESCRIPTION.
    D : TYPE
        DESCRIPTION.
    rebar_coords_YZ : TYPE
        DESCRIPTION.

    Returns
    -------
    None.

    '''

    # Define standard materials:
    E_flex = 1.0
    E_rigid = 100.0 * 10**12

    ops.uniaxialMaterial('Elastic', 1, Es)
    ops.uniaxialMaterial('Elastic', 10, E_flex)
    ops.uniaxialMaterial('Elastic', 20, E_rigid)

    # Rebar material:

    b = 0.02
    params = [18.0, 0.925,
              0.15]  # Recommended values for the Menegotto-Pinto model.
    #   uniaxialMaterial('Steel02', matTag, Fy, E0, b, *params)
    ops.uniaxialMaterial('Steel02', 101, fy, Es, b, *params)

    # Concrete material:

    fc *= -1  # Value from concrete lab, NTUA.
    fcu = 0.2 * fc  # Value from concrete lab, NTUA.
    eps_c0 = -2 / 10**3  # Value from concrete lab, NTUA.
    eps_u = -3.5 / 10**3  # Value from concrete lab, NTUA.

    #   uniaxialMaterial('Concrete01', matTag, fpc,  epsc0, fpcu,  epsU)
    ops.uniaxialMaterial('Concrete01', 201, fc, eps_c0, fcu, eps_u)

    # Geometry preprocessing:
    vertices = np.zeros((4, 2))
    vertices[:2, :] = -sec_dims / 2
    vertices[2:, :] = sec_dims / 2
    vertices[0, 0] *= -1
    vertices[2, 0] *= -1

    N_fiber_Y = 50
    N_fiber_Z = 1

    A_bar = np.pi * D**2 / 4

    #print(vertices)
    # Define sections:
    #   For the rebar/concrete part we use the fiber/patch command
    # Define test sections:

    #   section('Fiber', secTag)
    ops.section('Fiber', 1)

    #   patch('quad', matTag, numSubdivIJ, numSubdivJK,          *crdsI,          *crdsJ,          *crdsK,          *crdsL)
    ops.patch('quad', 1, N_fiber_Z, N_fiber_Y, *vertices[0, :],
              *vertices[1, :], *vertices[2, :], *vertices[3, :])

    n = rebar_coords_YZ.shape[0]
    #    fiber(                 yloc,                  zloc,     A, matTag)
    #ops.fiber(rebar_coords_YZ[i, 0], rebar_coords_YZ[i, 1], A_bar,      1)
    [
        ops.fiber(rebar_coords_YZ[i, 0], rebar_coords_YZ[i, 1], A_bar, 1)
        for i in range(n)
    ]

    # Define actual sections:

    #   section('Fiber', secTag)
    ops.section('Fiber', 10)

    #   patch('quad', matTag, numSubdivIJ, numSubdivJK,          *crdsI,          *crdsJ,          *crdsK,          *crdsL)
    ops.patch('quad', 201, N_fiber_Z, N_fiber_Y, *vertices[0, :],
              *vertices[1, :], *vertices[2, :], *vertices[3, :])

    n = rebar_coords_YZ.shape[0]
    #    fiber(                 yloc,                  zloc,     A, matTag)
    #ops.fiber(rebar_coords_YZ[i, 0], rebar_coords_YZ[i, 1], A_bar,    101)
    [
        ops.fiber(rebar_coords_YZ[i, 0], rebar_coords_YZ[i, 1], A_bar, 101)
        for i in range(n)
    ]

    # Geometric tranformation:
    #   geomTransf(transfType, transfTag, *transfArgs)
    ops.geomTransf('Linear', 1)  # test
    ops.geomTransf('PDelta', 10)  # actual

    # Integrator:
    N = 4
    #   beamIntegration('Lobatto', tag, secTag, N)
    ops.beamIntegration('Lobatto', 1, 1, N)  # test
    ops.beamIntegration('Lobatto', 10, 10, N)  # actual
    #   get main point for top flange
    lvl_01_05_col_point_top_I = lvl_01_05_col.top_flange_main_point_1
    lvl_01_05_col_point_top_J = lvl_01_05_col.top_flange_main_point_2

    #   get main point for left web
    lvl_01_05_col_point_web_left_I = lvl_01_05_col.web_main_left_point_1
    lvl_01_05_col_point_web_left_J = lvl_01_05_col.web_main_left_point_2

    #   get main point for right web
    lvl_01_05_col_point_web_right_I = lvl_01_05_col.web_main_right_point_1
    lvl_01_05_col_point_web_right_J = lvl_01_05_col.web_main_right_point_2

    #   opensees section:
    ops.section('Fiber', 1, '-torsion', 1)

    ops.patch("rect", 1, 5, 1, *lvl_01_05_col_point_bottom_I,
              *lvl_01_05_col_point_bottom_J)
    ops.patch("rect", 1, 5, 1, *lvl_01_05_col_point_top_I,
              *lvl_01_05_col_point_top_J)
    ops.patch("rect", 1, 1, 5, *lvl_01_05_col_point_web_left_I,
              *lvl_01_05_col_point_web_left_J)
    ops.patch("rect", 1, 1, 5, *lvl_01_05_col_point_web_right_I,
              *lvl_01_05_col_point_web_right_J)

    print("\n01-05层柱截面创建完毕")

    # =============================================================================
    # create section for columns from level 06 to level 10
    # =============================================================================

    #   patch('rect', matTag, numSubdivY, numSubdivZ, *crdsI, *crdsJ)
    #   section('Fiber', secTag, '-torsion', torsionMatTag)
def test_PlanarTrussExtra():
    A = 10.0
    E = 3000.
    L = 200.0
    alpha = 30.0
    P = 200.0

    sigmaYP = 60.0

    pi = 2.0*asin(1.0)
    alphaRad = alpha*pi/180.
    cosA = cos(alphaRad)
    sinA = sin(alphaRad)


    # EXACT RESULTS per Popov
    F1 = P/(2*cosA*cosA*cosA + 1)
    F2 = F1*cosA*cosA
    disp = -F1*L/(A*E)


    b = 1.0
    d = A
    z = A
    y = 1.0

    numFiberY = 10  # note we only need so many to get the required accuracy on eigenvalue 1e-7!
    numFiberZ = 1

    # create the finite element model
    for sectType in ['Fiber', 'Uniaxial']:

        print("  - Linear (Example 2.14) sectType: ", sectType)
        
        testOK = 0

        ops.wipe()
        
        ops.model( 'Basic', '-ndm', 2, '-ndf', 2)
        
        dX = L*tan(alphaRad)
        
        ops.node(1,    0.0,          0.0)
        ops.node(2,    dX ,         0.0)
        ops.node(3,  2.0*dX,  0.0)
        ops.node(4,    dX,         -L     )
        
        ops.fix(1, 1, 1)
        ops.fix(2, 1, 1)
        ops.fix(3, 1, 1)
        
        if sectType == "Uniaxial":
            ops.uniaxialMaterial( 'Elastic', 1, A*E)
            ops.section( 'Uniaxial', 1, 1, 'P')
        else:
            ops.uniaxialMaterial( 'Elastic', 1, E)
            ops.section('Fiber', 1) 	
        #	    patch rect 1 numFiberY numFiberZ [expr -z/2.0] [expr -y/2.0] [expr z/2.0] [expr y/2.0]	    
            ops.patch( 'rect', 1, numFiberY, numFiberZ, -z, -y, 0., 0.)
        

        ops.element('Truss', 1, 1, 4, 1)
        ops.element('Truss', 2, 2, 4, 1)
        ops.element('Truss', 3, 3, 4, 1)
        
        ops.timeSeries( 'Linear', 1)
        ops.pattern( 'Plain', 1, 1) 
        ops.load( 4, 0., -P)
        
        
        ops.numberer( 'Plain')
        ops.constraints( 'Plain')
        ops.algorithm('Linear')
        ops.system('ProfileSPD')
        ops.integrator('LoadControl', 1.0)
        ops.analysis('Static')
        ops.analyze(1)
        
        #
        # print table of camparsion
        #          
        
        comparisonResults = F2, F1, F2
        print("\nElement Force Comparison:")
        tol = 1.0e-6
        print('{:>10}{:>15}{:>15}'.format('Element','OpenSees','Popov'))

        for i in range(1,4):
            exactResult = comparisonResults[i-1]
            eleForce =ops.eleResponse( i, 'axialForce')
            print('{:>10d}{:>15.4f}{:>15.4f}'.format(i, eleForce[0], exactResult))
            if abs(eleForce[0]-exactResult) > tol:
                testOK = -1
                print("failed force-> ", abs(eleForce[0]-exactResult), " ", tol)
        
        print("\nDisplacement Comparison:")
        osDisp = ops.nodeDisp( 4, 2)
        print('{:>10}{:>15.8f}{:>10}{:>15.8f}'.format('OpenSees:',osDisp,'Exact:', disp))
        if abs(osDisp-disp) > tol:
            testOK = -1
            print("failed linear disp")
        
        print("\n\n  - NonLinear (Example2.23) sectType: ", sectType)
        
        #EXACT
        # Exact per Popov
        
        PA =  (sigmaYP*A) * (1.0+2*cosA*cosA*cosA)
        dispA = PA/P*disp
        
        PB = (sigmaYP*A) * (1.0+2*cosA)
        dispB = dispA / (cosA*cosA)
        
        # create the new finite element model for nonlinear case
        #   will apply failure loads and calculate displacements
        
        ops.wipe()
        
        ops.model('Basic', '-ndm', 2, '-ndf', 2)

        ops.node( 1,    0.0,          0.0)
        ops.node( 2,    dX,          0.0)
        ops.node( 3, 2.0*dX,  0.0)
        ops.node( 4,    dX,         -L     )

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


        if sectType == "Uniaxial":
            ops.uniaxialMaterial( 'ElasticPP', 1, A*E, sigmaYP/E)
            ops.section( 'Uniaxial', 1, 1, 'P')
        else:
            ops.uniaxialMaterial( 'ElasticPP', 1, E, sigmaYP/E)
            ops.section( 'Fiber', 1) 	
            ops.patch( 'rect', 1, numFiberY, numFiberZ, -z/2.0, -y/2.0, z/2.0, y/2.0)


        ops.element('Truss', 1, 1, 4, 1)
        ops.element('Truss', 2, 2, 4, 1)
        ops.element('Truss', 3, 3, 4, 1)

        ops.timeSeries( 'Path', 1, '-dt', 1.0, '-values', 0.0, PA, PB, PB)
        ops.pattern('Plain', 1, 1)
        ops.load( 4, 0., -1.0)
        
        ops.numberer('Plain')
        ops.constraints('Plain')
        ops.algorithm('Linear')
        ops.system('ProfileSPD')
        ops.integrator('LoadControl', 1.0)
        ops.analysis('Static')
        ops.analyze(1)

        osDispA = ops.nodeDisp( 4, 2)
        
        ops.analyze(1)
        osDispB = ops.nodeDisp( 4, 2)
        
        print("\nDisplacement Comparison:")
        print("elastic limit state:")
        osDisp = ops.nodeDisp( 4, 2)
        print('{:>10}{:>15.8f}{:>10}{:>15.8f}'.format('OpenSees:',osDispA,'Exact:',dispA))

        if abs(osDispA-dispA) > tol:
            testOK = -1
            print("failed nonlineaer elastic limit disp")

        print("collapse limit state:")
        print('{:>10}{:>15.8f}{:>10}{:>15.8f}'.format('OpenSees:',osDispB,'Exact:',dispB))

        if abs(osDispB-dispB) > tol:
            testOK = -1
            print("failed nonlineaer collapse limit disp")



    assert testOK == 0
Beispiel #14
0
    ops.fix(nd, 1, 1, 1)

# structural mesh

# transformation
transfTag = 1
ops.geomTransf('Corotational', transfTag)

# section
secTag = 1
if nonlinear:
    matTag = 1
    ops.uniaxialMaterial('Steel01', matTag, Fy, E0, hardening)
    numfiber = 5
    ops.section('Fiber', secTag)
    ops.patch('rect', matTag, numfiber, numfiber, 0.0, 0.0, thk, thk)
else:
    ops.section('Elastic', secTag, E, A, Iz)

# beam integration
inteTag = 1
numpts = 2
ops.beamIntegration('Legendre', inteTag, secTag, numpts)

coltag = 3
eleArgs = ['dispBeamColumn', transfTag, inteTag]
ops.mesh('line', coltag, 2, 1, 2, sid, ndf, h, *eleArgs)

# mass
sNodes = ops.getNodeTags('-mesh', coltag)
bmass = bmass / len(sNodes)