예제 #1
0
def test_beam_integration_mid_point_w_steel01():
    lp_i = 0.1
    lp_j = 0.2
    op.wipe()
    op.model('basic', '-ndm', 2, '-ndf', 3)  # 2 dimensions, 3 dof per node
    section1_id = 1
    section2_id = 2
    section3_id = 3
    uniaxial_steel01_section(section1_id)
    uniaxial_steel01_section(section2_id)
    uniaxial_steel01_section(section3_id)
    integ_tag = 1
    op.beamIntegration('HingeMidpoint', integ_tag, section1_id, lp_i,
                       section2_id, lp_j, section3_id)
    with_force_beam_column = 1
    if with_force_beam_column:
        # Establish nodes
        bot_node = 1
        top_node = 2
        transf_tag = 1
        op.geomTransf('Linear', transf_tag, *[])
        op.node(bot_node, 0., 0.)
        op.node(top_node, 0., 5.)
        ele_i = 1
        op.element('forceBeamColumn', ele_i, bot_node, top_node, transf_tag,
                   integ_tag)
예제 #2
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
예제 #3
0
def test_beam_integration_lobatto_w_steel01():
    op.wipe()
    op.model('basic', '-ndm', 2, '-ndf', 3)  # 2 dimensions, 3 dof per node
    section_id = 1
    uniaxial_steel01_material(section_id)
    int_tag = 1
    op.beamIntegration('Lobatto', int_tag, section_id, 8)
    assert 1 == 1  # This pass
예제 #4
0
def define_beam_integration(integ_tag):
    lp_i = 0.1
    lp_j = 0.2
    section1_id = 1
    section2_id = 2
    section3_id = 3
    uniaxial_steel01_section(section1_id)
    uniaxial_steel01_section(section2_id)
    uniaxial_steel01_section(section3_id)
    op.beamIntegration('HingeMidpoint', integ_tag, section1_id, lp_i, section2_id, lp_j, section3_id)
예제 #5
0
def test_beam_integration_mid_point_w_elastic():
    lp_i = 0.1
    lp_j = 0.2
    op.wipe()
    op.model('basic', '-ndm', 2, '-ndf', 3)  # 2 dimensions, 3 dof per node
    section_id = 1
    elastic_section(section_id)
    integ_tag = 1
    op.beamIntegration('HingeMidpoint', integ_tag, section_id, lp_i,
                       section_id, lp_j, section_id)
예제 #6
0
def section_create():
    ''' section create
    '''
    ops.section('Fiber', 1, '-GJ', 1)
    ops.fiber(-1.250E+002, -2.500E+002, 5.000E+003, 2)
    ops.fiber(-7.500E+001, -2.500E+002, 5.000E+003, 2)
    ops.fiber(-2.500E+001, -2.500E+002, 5.000E+003, 2)
    ops.fiber(2.500E+001, -2.500E+002, 5.000E+003, 2)
    ops.fiber(7.500E+001, -2.500E+002, 5.000E+003, 2)
    ops.fiber(1.250E+002, -2.500E+002, 5.000E+003, 2)
    ops.fiber(-1.250E+002, -1.500E+002, 5.000E+003, 2)
    ops.fiber(-7.500E+001, -1.500E+002, 5.000E+003, 2)
    ops.fiber(-2.500E+001, -1.500E+002, 5.000E+003, 2)
    ops.fiber(2.500E+001, -1.500E+002, 5.000E+003, 2)
    ops.fiber(7.500E+001, -1.500E+002, 5.000E+003, 2)
    ops.fiber(1.250E+002, -1.500E+002, 5.000E+003, 2)
    ops.fiber(-1.250E+002, -5.000E+001, 5.000E+003, 2)
    ops.fiber(-7.500E+001, -5.000E+001, 5.000E+003, 2)
    ops.fiber(-2.500E+001, -5.000E+001, 5.000E+003, 2)
    ops.fiber(2.500E+001, -5.000E+001, 5.000E+003, 2)
    ops.fiber(7.500E+001, -5.000E+001, 5.000E+003, 2)
    ops.fiber(1.250E+002, -5.000E+001, 5.000E+003, 2)
    ops.fiber(-1.250E+002, 5.000E+001, 5.000E+003, 2)
    ops.fiber(-7.500E+001, 5.000E+001, 5.000E+003, 2)
    ops.fiber(-2.500E+001, 5.000E+001, 5.000E+003, 2)
    ops.fiber(2.500E+001, 5.000E+001, 5.000E+003, 2)
    ops.fiber(7.500E+001, 5.000E+001, 5.000E+003, 2)
    ops.fiber(1.250E+002, 5.000E+001, 5.000E+003, 2)
    ops.fiber(-1.250E+002, 1.500E+002, 5.000E+003, 2)
    ops.fiber(-7.500E+001, 1.500E+002, 5.000E+003, 2)
    ops.fiber(-2.500E+001, 1.500E+002, 5.000E+003, 2)
    ops.fiber(2.500E+001, 1.500E+002, 5.000E+003, 2)
    ops.fiber(7.500E+001, 1.500E+002, 5.000E+003, 2)
    ops.fiber(1.250E+002, 1.500E+002, 5.000E+003, 2)
    ops.fiber(-1.250E+002, 2.500E+002, 5.000E+003, 2)
    ops.fiber(-7.500E+001, 2.500E+002, 5.000E+003, 2)
    ops.fiber(-2.500E+001, 2.500E+002, 5.000E+003, 2)
    ops.fiber(2.500E+001, 2.500E+002, 5.000E+003, 2)
    ops.fiber(7.500E+001, 2.500E+002, 5.000E+003, 2)
    ops.fiber(1.250E+002, 2.500E+002, 5.000E+003, 2)
    ops.fiber(-1.150E+002, 2.650E+002, 3.900E+002, 1)
    ops.fiber(1.150E+002, 2.650E+002, 3.900E+002, 1)
    ops.fiber(-1.150E+002, -2.650E+002, 4.900E+002, 1)
    ops.fiber(0.000E+000, -2.650E+002, 4.900E+002, 1)
    ops.fiber(1.150E+002, -2.650E+002, 4.900E+002, 1)

    ops.beamIntegration('Legendre', 1, 1, 10)
    logger.info("section created")
예제 #7
0
def ops_section():
    ''' define section '''
    # 保护层壳
    ops.section('LayeredShell', 1, 4, 2, 50/1000,
                2, 50/1000, 2, 50/1000, 2, 50/1000)
    # 加强区壳
    ops.section('LayeredShell', 2, 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', 3, 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', 4, '-GJ', 1)
    # 端部 GFRP 拉锁
    ops.patch('circ', 3, 10, 10, 0, 0, 0, 0.01414, 0, 360)
    # 端部 SFCB 纵筋
    ops.patch('circ', 4, 10, 10, 0, 0.015, 0, 0.01414, 0, 360)
    ops.beamIntegration('Legendre', 1, 1, 9)
    # 0 1 0

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

    ops.geomTransf('Linear', 1, 0, 1, 0)
예제 #8
0
def ops_element():
    ops.beamIntegration('Legendre', 1, 2, 9)
    ops.geomTransf('Linear', 1, 0, -1, 0)
    i = 1
    for _i in range(0, 56, 6):
        for _j in range(_i + 2, _i + 5):
            # print(f'element = {i}, node = {_j},{_j + 1},{_j + 7},{_j + 6 }')
            ops.element("ShellNLDKGQ", i, _j, _j + 1, _j + 7, _j + 6, 1)
            i = i + 1
    for _k in range(1, 61, 6):
        # print(f'element = {i}, node = {_k},{_k + 6}')
        ops.element('dispBeamColumn', i, _k, _k + 6, 1, 1)
        i = i + 1
    for _l in range(6, 66, 6):
        # print(f'element = {i}, node = {_l},{_l + 6}')
        ops.element('dispBeamColumn', i, _l, _l + 6, 1, 1)
        i = i + 1
    def define_geometry(self, nodes, elements, fixities, num_integ=10):
        '''
        Define geometry of the structure (all dimensions are in mm).
        
        Args:
            nodes: A list of nodes in a form [node_tag, coord1, coord2].
            elements: A list of elements in a form 
                [ele_tag, node1, node2, disc].
            fixities: A list of fixities in a form [node, x, y, z].
            num_integ: Number of integration points along each element 
                (default=10)
        '''
        self.nodes = nodes
        self.elements = elements
        self.fixities = fixities

        if self.section == None:
            raise Exception('No section is defined.')

        ops.geomTransf('PDelta', 1)
        ops.beamIntegration('Lobatto', 1, 1, num_integ)

        for nd in self.nodes:
            ops.node(*nd)

        for el in self.elements:
            ele_tag, node1, node2, disc = el
            DiscretizeMember.DiscretizeMember(node1,
                                              node2,
                                              disc,
                                              'forceBeamColumn',
                                              1,
                                              1,
                                              nodeTag=len(ops.getNodeTags()) +
                                              1,
                                              eleTag=len(ops.getEleTags()) + 1)

        for fx in self.fixities:
            ops.fix(*fx)
예제 #10
0
# create combined 3D section
secTag3D = 3
op.section('Aggregator', secTag3D, 3000, 'T', '-section', 1)

#########################################################################################################################################################################

##########################################################################################################################################################################

# elastic pile section
#import elasticPileSection

#----------------------------------------------------------
#  create pile elements
#----------------------------------------------------------
op.beamIntegration(
    'Legendre', 1, secTag3D, 3
)  # we are using gauss-Legendre  integration as it is the default integration scheme used in opensees tcl (check dispBeamColumn)

for i in range(201, 201 + nElePile):
    op.element('dispBeamColumn', i, i, i + 1, 1, 1)

print("Finished creating all pile elements...")

#----------------------------------------------------------
#  create recorders
#----------------------------------------------------------

# record information at specified increments
timeStep = 0.5

# record displacements at pile nodes
ops.section("WFSection2d", colSecTag, matTag, *WSection["W14X90"], 20,
            4)  # Column section
ops.section("WFSection2d", beamSecTag, matTag, *WSection["W18x76"], 20,
            4)  # Beam section

# Define elements
# ---------------
colTransTag, beamTransTag = 1, 2
# Linear, PDelta, Corotational
ops.geomTransf("Corotational", colTransTag)
ops.geomTransf("Linear", beamTransTag)

colIntTag, beamIntTag = 1, 2
nip = 5
# Lobatto, Legendre, NewtonCotes, Radau, Trapezoidal, CompositeSimpson
ops.beamIntegration("Lobatto", colIntTag, colSecTag, nip),
ops.beamIntegration("Lobatto", beamIntTag, beamSecTag, nip)

# Column elements
ops.element("forceBeamColumn", 10, 1, 3, colTransTag, colIntTag, "-mass", 0.0)
ops.element("forceBeamColumn", 11, 3, 5, colTransTag, colIntTag, "-mass", 0.0)
ops.element("forceBeamColumn", 12, 2, 4, colTransTag, colIntTag, "-mass", 0.0)
ops.element("forceBeamColumn", 13, 4, 6, colTransTag, colIntTag, "-mass", 0.0)

# Beam elements
ops.element("forceBeamColumn", 14, 3, 4, beamTransTag, beamIntTag, "-mass",
            0.0)
ops.element("forceBeamColumn", 15, 5, 6, beamTransTag, beamIntTag, "-mass",
            0.0)

# Create a Plain load pattern with a Linear TimeSeries
예제 #12
0
def runAnalysis(k):
    """
    Tests and individual and returns the result of that test.
    
    The user should consider if it's possible for the test not to work.
    
    """

    Fu = 21.1 * 10**3
    # k = 2.6*10**6
    b = 0.015
    R0 = 19
    cR1 = .95
    cR2 = .15

    Fu = 22.3 * 10**3
    # k = 2.6*10**6
    b = 0.0129
    R0 = 3.1
    cR1 = .3
    cR2 = .01
    # 21.1*10**3, 2.6*10**6, 0.015, 19, .95, .15]
    # 2.25427928e+04 3.33339323e+06 1.96273081e-02 5.46515829e+00
    #  6.98429661e-01 5.28210755e-02
    # 2.20833537e+04 3.03336982e+06 1.28872130e-02 3.13990345e+00
    #  3.36067251e-01 1.04312516e-01
    op.wipe()

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

    ## Analysis Parameters material(s)
    ## ------------------
    LoadProtocol = np.array([
        0.0017, 0.005, 0.0075, 0.012, 0.018, 0.027, 0.04, 0.054, 0.068, 0.072,
        0.
    ])

    # Step size
    dx = 0.0001

    op.uniaxialMaterial('Steel02', 1, Fu, k, b, R0, cR1, cR2, 0., 1., 0., 1.)

    ERelease = 1.
    op.uniaxialMaterial('Elastic', 2, ERelease, 0.0)

    ## Define geometric transformation(s)
    ## ----------------------------------
    #geomTransf('Linear',1)
    op.geomTransf('PDelta', 1)
    op.beamIntegration('Lobatto', 1, 1, 3)

    # Define geometry
    # ---------------
    op.node(1, 0., 0., '-ndf', 3)
    op.node(2, 0., 0., '-ndf', 3)
    op.fix(1, 1, 1, 1)

    # Define element(s)
    # -----------------
    op.element("zeroLength", 1, 1, 2, '-mat', 1, 2, 2, '-dir', 1, 2, 3,
               '-orient', 1., 0., 0., 0., 1., 0.)

    # Define Recorder(s)
    # -----------------
    op.recorder('Node', '-file', 'RFrc.out', '-time', '-nodeRange', 1, 1,
                '-dof', 1, 'reaction')
    op.recorder('Node', '-file', 'Disp.out', '-time', '-nodeRange', 2, 2,
                '-dof', 1, 'disp')

    # Define Analysis Parameters
    # -----------------
    op.timeSeries('Linear', 1, '-factor', 1.0)
    op.pattern('Plain', 1, 1, '-fact', 1.)
    op.load(2, 1., 0.0, 0.0)

    # op.initialize()
    op.constraints("Plain")
    op.numberer("Plain")
    # System of Equations
    op.system("UmfPack", '-lvalueFact', 10)
    # Convergence Test
    op.test('NormDispIncr', 1. * 10**-8, 25, 0, 2)
    # Solution Algorithm
    op.algorithm('Newton')
    # Integrator
    op.integrator('DisplacementControl', 2, 1, dx)
    # Analysis Type
    op.analysis('Static')

    ControlNode = 2
    ControlNodeDof = 1

    op.record()

    ok = 0
    # Define Analysis
    for x in LoadProtocol:
        for ii in range(0, 2):

            # op.
            op.integrator('DisplacementControl', ControlNode, ControlNodeDof,
                          dx)
            while (op.nodeDisp(2, 1) < x):
                ok = op.analyze(1)
                if ok != 0:
                    print('Ending analysis')
                    op.wipe()
                    return np.array([0, 0])

            op.integrator('DisplacementControl', ControlNode, ControlNodeDof,
                          -dx)
            while (op.nodeDisp(2, 1) > -x):
                ok = op.analyze(1)
                if ok != 0:
                    print('Ending analysis')
                    op.wipe()
                    return np.array([0, 0])

    op.wipe()

    fileDispName = os.path.join('Disp.out')
    fileForceName = os.path.join('RFrc.out')

    disp = np.loadtxt(fileDispName)
    RFrc = np.loadtxt(fileForceName)

    # try:
    x = disp[:, 1]
    y = -RFrc[:, 1]

    xy = np.column_stack([x, y])
    return xy
    #   geomTransf('PDelta', transfTag, *vecxz, '-jntOffset', *dI, *dJ)
    # Transf beamL and beamB
    ops.geomTransf("PDelta", 1, *[0, 0, 1])
    # Transf columns
    ops.geomTransf("PDelta", 2, *[1, 0, 0])

    print("\n已创建局部坐标系下的定位向量")
    # =============================================================================
    # create Gauss-Legendre integration points alone the element
    # =============================================================================

    #    beamIntegration('Legendre', tag, secTag, N)

    #   Integration for columns from level 01 to 05
    ops.beamIntegration("Legendre", 1, 1, 5)

    #   Integration for columns from level 06 to 10
    ops.beamIntegration("Legendre", 2, 2, 5)

    #   Integration for columns from level 11 to 14
    ops.beamIntegration("Legendre", 3, 3, 5)

    #   Integration for beam from L direction
    ops.beamIntegration("Legendre", 4, 4, 5)

    #   Integration for beam from B direction
    ops.beamIntegration("Legendre", 5, 4, 5)

    print("\n已创建积分")
    # =============================================================================
예제 #14
0
def RunAnalysis():
    AnalysisType = 'Pushover'
    #  Pushover  Gravity

    ## ------------------------------
    ## Start of model generation
    ## -----------------------------
    # remove existing model
    ops.wipe()

    # set modelbuilder
    ops.model('basic', '-ndm', 2, '-ndf', 3)

    import math

    ############################################
    ### Units and Constants  ###################
    ############################################

    inch = 1
    kip = 1
    sec = 1

    # Dependent units
    sq_in = inch * inch
    ksi = kip / sq_in
    ft = 12 * inch

    # Constants
    g = 386.2 * inch / (sec * sec)
    pi = math.acos(-1)

    #######################################
    ##### Dimensions
    #######################################

    # Dimensions Input
    H_story = 10.0 * ft
    W_bayX = 16.0 * ft
    W_bayY_ab = 5.0 * ft + 10.0 * inch
    W_bayY_bc = 8.0 * ft + 4.0 * inch
    W_bayY_cd = 5.0 * ft + 10.0 * inch

    # Calculated dimensions
    W_structure = W_bayY_ab + W_bayY_bc + W_bayY_cd

    ################
    ### Material
    ################

    # Steel02 Material

    matTag = 1
    matConnAx = 2
    matConnRot = 3

    Fy = 60.0 * ksi
    # Yield stress
    Es = 29000.0 * ksi
    # Modulus of Elasticity of Steel
    v = 0.2
    # Poisson's ratio
    Gs = Es / (1 + v)
    # Shear modulus
    b = 0.10
    # Strain hardening ratio
    params = [18.0, 0.925, 0.15]  # R0,cR1,cR2
    R0 = 18.0
    cR1 = 0.925
    cR2 = 0.15
    a1 = 0.05
    a2 = 1.00
    a3 = 0.05
    a4 = 1.0
    sigInit = 0.0
    alpha = 0.05

    ops.uniaxialMaterial('Steel02', matTag, Fy, Es, b, R0, cR1, cR2, a1, a2,
                         a3, a4, sigInit)

    # ##################
    # ## Sections
    # ##################

    colSecTag1 = 1
    colSecTag2 = 2
    beamSecTag1 = 3
    beamSecTag2 = 4
    beamSecTag3 = 5

    # COMMAND: section('WFSection2d', secTag, matTag, d, tw, bf, tf, Nfw, Nff)

    ops.section('WFSection2d', colSecTag1, matTag, 10.5 * inch, 0.26 * inch,
                5.77 * inch, 0.44 * inch, 15, 16)  # outer Column
    ops.section('WFSection2d', colSecTag2, matTag, 10.5 * inch, 0.26 * inch,
                5.77 * inch, 0.44 * inch, 15, 16)  # Inner Column

    ops.section('WFSection2d', beamSecTag1, matTag, 8.3 * inch, 0.44 * inch,
                8.11 * inch, 0.685 * inch, 15, 15)  # outer Beam
    ops.section('WFSection2d', beamSecTag2, matTag, 8.2 * inch, 0.40 * inch,
                8.01 * inch, 0.650 * inch, 15, 15)  # Inner Beam
    ops.section('WFSection2d', beamSecTag3, matTag, 8.0 * inch, 0.40 * inch,
                7.89 * inch, 0.600 * inch, 15, 15)  # Inner Beam

    # Beam size - W10x26
    Abeam = 7.61 * inch * inch
    IbeamY = 144. * (inch**4)
    # Inertia along horizontal axis
    IbeamZ = 14.1 * (inch**4)
    # inertia along vertical axis

    # BRB input data
    Acore = 2.25 * inch
    Aend = 10.0 * inch
    LR_BRB = 0.55

    # ###########################
    # ##### Nodes
    # ###########################

    # Create All main nodes
    ops.node(1, 0.0, 0.0)
    ops.node(2, W_bayX, 0.0)
    ops.node(3, 2 * W_bayX, 0.0)

    ops.node(11, 0.0, H_story)
    ops.node(12, W_bayX, H_story)
    ops.node(13, 2 * W_bayX, H_story)

    ops.node(21, 0.0, 2 * H_story)
    ops.node(22, W_bayX, 2 * H_story)
    ops.node(23, 2 * W_bayX, 2 * H_story)

    ops.node(31, 0.0, 3 * H_story)
    ops.node(32, W_bayX, 3 * H_story)
    ops.node(33, 2 * W_bayX, 3 * H_story)

    # Beam Connection nodes

    ops.node(1101, 0.0, H_story)
    ops.node(1201, W_bayX, H_story)
    ops.node(1202, W_bayX, H_story)
    ops.node(1301, 2 * W_bayX, H_story)

    ops.node(2101, 0.0, 2 * H_story)
    ops.node(2201, W_bayX, 2 * H_story)
    ops.node(2202, W_bayX, 2 * H_story)
    ops.node(2301, 2 * W_bayX, 2 * H_story)

    ops.node(3101, 0.0, 3 * H_story)
    ops.node(3201, W_bayX, 3 * H_story)
    ops.node(3202, W_bayX, 3 * H_story)
    ops.node(3301, 2 * W_bayX, 3 * H_story)

    # ###############
    #  Constraints
    # ###############

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

    # #######################
    # ### Elements
    # #######################

    # ### Assign beam-integration tags

    ColIntTag1 = 1
    ColIntTag2 = 2
    BeamIntTag1 = 3
    BeamIntTag2 = 4
    BeamIntTag3 = 5

    ops.beamIntegration('Lobatto', ColIntTag1, colSecTag1, 4)
    ops.beamIntegration('Lobatto', ColIntTag2, colSecTag2, 4)
    ops.beamIntegration('Lobatto', BeamIntTag1, beamSecTag1, 4)
    ops.beamIntegration('Lobatto', BeamIntTag2, beamSecTag2, 4)
    ops.beamIntegration('Lobatto', BeamIntTag3, beamSecTag3, 4)

    # Assign geometric transformation

    ColTransfTag = 1
    BeamTranfTag = 2

    ops.geomTransf('PDelta', ColTransfTag)
    ops.geomTransf('Linear', BeamTranfTag)

    # Assign Elements  ##############

    # ## Add non-linear column elements
    ops.element('forceBeamColumn', 1, 1, 11, ColTransfTag, ColIntTag1, '-mass',
                0.0)
    ops.element('forceBeamColumn', 2, 2, 12, ColTransfTag, ColIntTag2, '-mass',
                0.0)
    ops.element('forceBeamColumn', 3, 3, 13, ColTransfTag, ColIntTag1, '-mass',
                0.0)

    ops.element('forceBeamColumn', 11, 11, 21, ColTransfTag, ColIntTag1,
                '-mass', 0.0)
    ops.element('forceBeamColumn', 12, 12, 22, ColTransfTag, ColIntTag2,
                '-mass', 0.0)
    ops.element('forceBeamColumn', 13, 13, 23, ColTransfTag, ColIntTag1,
                '-mass', 0.0)

    ops.element('forceBeamColumn', 21, 21, 31, ColTransfTag, ColIntTag1,
                '-mass', 0.0)
    ops.element('forceBeamColumn', 22, 22, 32, ColTransfTag, ColIntTag2,
                '-mass', 0.0)
    ops.element('forceBeamColumn', 23, 23, 33, ColTransfTag, ColIntTag1,
                '-mass', 0.0)

    #  ### Add linear main beam elements, along x-axis
    #element('elasticBeamColumn', 101, 1101, 1201, Abeam, Es, Gs, Jbeam, IbeamY, IbeamZ, beamTransfTag, '-mass', 0.0)

    ops.element('forceBeamColumn', 101, 1101, 1201, BeamTranfTag, BeamIntTag1,
                '-mass', 0.0)
    ops.element('forceBeamColumn', 102, 1202, 1301, BeamTranfTag, BeamIntTag1,
                '-mass', 0.0)

    ops.element('forceBeamColumn', 201, 2101, 2201, BeamTranfTag, BeamIntTag2,
                '-mass', 0.0)
    ops.element('forceBeamColumn', 202, 2202, 2301, BeamTranfTag, BeamIntTag2,
                '-mass', 0.0)

    ops.element('forceBeamColumn', 301, 3101, 3201, BeamTranfTag, BeamIntTag3,
                '-mass', 0.0)
    ops.element('forceBeamColumn', 302, 3202, 3301, BeamTranfTag, BeamIntTag3,
                '-mass', 0.0)

    # Assign constraints between beam end nodes and column nodes (RIgid beam column connections)
    ops.equalDOF(11, 1101, 1, 2, 3)
    ops.equalDOF(12, 1201, 1, 2, 3)
    ops.equalDOF(12, 1202, 1, 2, 3)
    ops.equalDOF(13, 1301, 1, 2, 3)

    ops.equalDOF(21, 2101, 1, 2, 3)
    ops.equalDOF(22, 2201, 1, 2, 3)
    ops.equalDOF(22, 2202, 1, 2, 3)
    ops.equalDOF(23, 2301, 1, 2, 3)

    ops.equalDOF(31, 3101, 1, 2, 3)
    ops.equalDOF(32, 3201, 1, 2, 3)
    ops.equalDOF(32, 3202, 1, 2, 3)
    ops.equalDOF(33, 3301, 1, 2, 3)

    AllNodes = ops.getNodeTags()
    massX = 0.49

    for nodes in AllNodes:
        ops.mass(nodes, massX, massX, 0.00001)

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

    # create a plain load pattern
    ops.pattern("Plain", 1, 1)

    # Create the nodal load
    ops.load(11, 0.0, -5.0 * kip, 0.0)
    ops.load(12, 0.0, -6.0 * kip, 0.0)
    ops.load(13, 0.0, -5.0 * kip, 0.0)

    ops.load(21, 0., -5. * kip, 0.0)
    ops.load(22, 0., -6. * kip, 0.0)
    ops.load(23, 0., -5. * kip, 0.0)

    ops.load(31, 0., -5. * kip, 0.0)
    ops.load(32, 0., -6. * kip, 0.0)
    ops.load(33, 0., -5. * kip, 0.0)

    ###############################
    ### PUSHOVER ANALYSIS
    ###############################

    if (AnalysisType == "Pushover"):

        print("<<<< Running Pushover Analysis >>>>")

        # Create load pattern for pushover analysis
        # create a plain load pattern
        ops.pattern("Plain", 2, 1)

        ops.load(11, 1.61, 0.0, 0.0)
        ops.load(21, 3.22, 0.0, 0.0)
        ops.load(31, 4.83, 0.0, 0.0)

        ControlNode = 31
        ControlDOF = 1
        MaxDisp = 0.15 * H_story
        DispIncr = 0.1
        NstepsPush = int(MaxDisp / DispIncr)

        Model = 'test'
        LoadCase = 'Pushover'
        dt = 0.2
        opp.createODB(Model, LoadCase, Nmodes=3)

        ops.system("ProfileSPD")
        ops.numberer("Plain")
        ops.constraints("Plain")
        ops.integrator("DisplacementControl", ControlNode, ControlDOF,
                       DispIncr)
        ops.algorithm("Newton")
        ops.test('NormUnbalance', 1e-8, 10)
        ops.analysis("Static")

        # 	analyze(NstepsPush)
        ops.analyze(100)

        print("Pushover analysis complete")
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)
예제 #16
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
예제 #17
0
beam_id = 2
water_bound_id = -1
water_body_id = -2

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

# section
secTag = 1
ops.section('Elastic', secTag, E, A, Iz)

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

# beam mesh
beamTag = 6
ndf = 3
ops.mesh('line', beamTag, 2, 12, 13, beam_id, ndf, h, 'dispBeamColumn',
         transfTag, inteTag)

ndmass = bmass / len(ops.getNodeTags('-mesh', beamTag))

for nd in ops.getNodeTags('-mesh', beamTag):
    ops.mass(nd, ndmass, ndmass, 0.0)

# fluid mesh
fluidTag = 4
ndf = 2
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
예제 #19
0
# Sections defined with "canned" section ("WFSection2d"), otherwise use a FiberSection object (ops.section("Fiber",...))
beamSecTag = 1
beamWidth, beamDepth = 10 * cm, 50 * cm
#                          secTag,     matTag, d,         tw,        bf,       tf, Nfw, Nff
ops.section("WFSection2d", beamSecTag, matTag, beamDepth, beamWidth, beamWidth,
            0, 20, 0)  # Beam section

# Define elements
# ---------------
beamTransTag, beamIntTag = 1, 1
# Linear, PDelta, Corotational
ops.geomTransf("Corotational", beamTransTag)

nip = 5
# Lobatto, Legendre, NewtonCotes, Radau, Trapezoidal, CompositeSimpson
ops.beamIntegration("Legendre", beamIntTag, beamSecTag, nip)

# Beam elements
numEle = 5
meshSize = L / numEle  # mesh size

eleType = "dispBeamColumn"  # forceBeamColumn, "dispBeamColumn"
#           tag, Npts, nodes, type, dofs, size, eleType, transfTag,    beamIntTag
ops.mesh("line", 1, 2, *[1, 2], 0, 3, meshSize, eleType, beamTransTag,
         beamIntTag)

# Create a Plain load pattern with a Sine/Trig TimeSeries
# -------------------------------------------------------
#                 tag, tStart, tEnd, period, factor
ops.timeSeries("Trig", 1, 0.0, 1.0, 1.0, "-factor",
               1.0)  # "Sine", "Trig" or "Triangle"
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))
예제 #21
0
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
예제 #22
0
def element_create():
    ''' create element
    '''

    ops.element('nonlinearBeamColumn', 1, 1, 2, 4, 1001, 1, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 2, 3, 4, 4, 1001, 2, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 3, 5, 6, 4, 1001, 3, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 4, 7, 8, 4, 1001, 4, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 5, 6, 8, 4, 1003, 5, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 6, 4, 2, 4, 1003, 6, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 7, 8, 2, 4, 1004, 7, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 8, 6, 4, 4, 1004, 8, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 9, 9, 3, 4, 1001, 9, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 10, 10, 1, 4, 1001, 10, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 11, 11, 5, 4, 1002, 11, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 12, 12, 7, 4, 1002, 12, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 13, 13, 14, 4, 1002, 13, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 14, 15, 16, 4, 1002, 14, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 15, 7, 1, 4, 1004, 15, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 16, 1, 16, 4, 1004, 16, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 17, 3, 14, 4, 1004, 17, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 18, 5, 3, 4, 1004, 18, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 19, 3, 1, 4, 1003, 19, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 20, 14, 16, 4, 1003, 20, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 21, 5, 7, 4, 1003, 21, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 22, 17, 9, 4, 1001, 22, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 23, 18, 10, 4, 1001, 23, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 24, 19, 11, 4, 1002, 24, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 25, 20, 12, 4, 1002, 25, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 26, 21, 13, 4, 1002, 26, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 27, 22, 15, 4, 1002, 27, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 28, 12, 10, 4, 1004, 28, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 29, 10, 15, 4, 1004, 29, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 30, 9, 13, 4, 1004, 30, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 31, 11, 9, 4, 1004, 31, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 32, 9, 10, 4, 1003, 32, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 33, 13, 15, 4, 1003, 33, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 34, 11, 12, 4, 1003, 34, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 35, 23, 17, 4, 1001, 35, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 36, 24, 18, 4, 1001, 36, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 37, 25, 19, 4, 1002, 37, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 38, 26, 20, 4, 1002, 38, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 39, 27, 21, 4, 1002, 39, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 40, 28, 22, 4, 1002, 40, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 41, 20, 18, 4, 1004, 41, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 42, 18, 22, 4, 1004, 42, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 43, 17, 21, 4, 1004, 43, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 44, 19, 17, 4, 1004, 44, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 45, 17, 18, 4, 1003, 45, "-integration",
                'Legendre')
    ops.element('nonlinearBeamColumn', 46, 21, 22, 4, 1003, 46, "-integration",
                'Legendre')

    ops.beamIntegration('Legendre', 1, 1003, 10)
    ops.element('dispBeamColumn', 47, 19, 20, 47, 1)
    logger.info("element created")