예제 #1
0
def PDelta_analysis(Nnodes, P, steps, tol, max_iter):

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

    pattTag = 1
    ops.pattern('Plain', pattTag, tsTag)

    ops.load(Nnodes, *P)

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

    ops.constraints('Plain')
    ops.numberer('RCM')
    ops.system('BandGeneral')
    ops.test('NormUnbalance', tol, max_iter)
    ops.algorithm('Newton')

    temp = 1 / steps
    ops.integrator('LoadControl', temp)

    ops.analysis('Static')

    ops.analyze(steps)

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

    opsplt.plot_model('nodes')

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

    ops.wipe()
예제 #2
0
def analysis(P, du, steps, tol, max_iter):

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

    pattTag = 1
    ops.pattern('Plain', pattTag, tsTag)

    ops.load(2, *P)

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

    ops.constraints('Plain')
    ops.numberer('RCM')
    ops.system('BandGeneral')
    ops.test('NormUnbalance', tol, max_iter)
    ops.algorithm('Newton')

    ops.integrator('DisplacementControl', 2, 2, du, max_iter)

    ops.analysis('Static')

    ops.analyze(steps)

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

    opsplt.plot_model()

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

    ops.wipe()
예제 #3
0
def main():
    log_init(flag="Author: Mengsen Wang\n", filename='test.log')
    ops_model()
    ops_node()
    ops_material()
    ops_element()
    ops.printModel()
    opsplt.plot_model('elements')
예제 #4
0
def test_plot_fn(monkeypatch):
    # repress the show plot attribute
    monkeypatch.setattr(plt, 'show', lambda: None)
    Model_2D()

    opp.plot_model()
    plt.close()
    assert True
예제 #5
0
def test_plot_model_3D_Active(monkeypatch):
    # repress the show plot attribute
    monkeypatch.setattr(plt, 'show', lambda: None)

    RunAnalysis()

    opp.plot_model('nodes', 'elements')
    plt.close()
    assert True == True
예제 #6
0
def main():
    log_init(flag="Author: Mengsen Wang\n", filename='test.log')
    logger.info("dispBeamColumn + shell")
    ops_model()
    ops_node()
    ops_material()
    ops_element()
    # ops.printModel()
    opsplt.plot_model('element')
def test_plot_model_3D_ODB(monkeypatch):
    # repress the show plot attribute
    monkeypatch.setattr(plt, 'show', lambda: None)

    RunAnalysis()
    ops.wipe()
    Model = 'test'
    opp.plot_model('nodes', 'elements', Model=Model)
    plt.close()
    assert True == True
def test_plot_modeshape_3D_Active(monkeypatch):
    # repress the show plot attribute
    monkeypatch.setattr(plt, 'show', lambda: None)

    RunAnalysis()
    opp.plot_modeshape(1, 200)
    plt.close()
    opp.plot_modeshape(2, 200)
    plt.close()
    assert True == True
예제 #9
0
def Model_Build(x, y, A, E):
    '''
    Description
    -----------
    This function is used to determine the basic parameters of the structural
    problem at hand.
    
    Parameters
    ----------
    x : LIST OF FLOATS
        The list of the coordinates of the nodes along the x-axis.
    y : LIST OF FLOATS
        The list of the coordinates of the nodes along the y-axis.
    A : LIST OF FLOATS
        The list with the materials used for the different elements.
    E : FLOAT
        The modulus of elesticity of the elements.
    Returns
    -------
    None.

    '''
    # Delete existing model.
    ops.wipe()

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

    # Define materials.
    ops.uniaxialMaterial('Elastic', 1, E)

    # Define the nodes.
    m = len(x)

    [ops.node(i + 1, *[x[i], y[i]]) for i in range(m)]

    # Fix the nodes.
    fixxity = [[0, 0, 1], [0, 1, 1], [1, 0, 1], [1, 1, 1]]

    [
        ops.fix(i +
                1, *fixxity[3]) if i + 1 != 4 else ops.fix(i + 1, *fixxity[0])
        for i in range(m)
    ]

    # Define elements.
    conn = [[1, 4], [2, 4], [3, 4]]
    [
        ops.element('Truss', i + 1, *conn[i], A[1], 1)
        if i != 0 else ops.element('Truss', i + 1, *conn[i], A[0], 1)
        for i in range(len(conn))
    ]

    # Plot model.
    opsplt.plot_model()
예제 #10
0
def test_plot_modeshape_2D(monkeypatch):
    # repress the show plot attribute
    monkeypatch.setattr(plt, 'show', lambda: None)
    Model = 'test'
    LoadCase = 'Pushover'  
       
    RunAnalysis()    
    
    ops.wipe()
    
    opp.plot_modeshape(1, 200, Model = Model)
    plt.close()
    opp.plot_modeshape(2, 200, Model = Model)  
    plt.close()

    assert True == True
예제 #11
0
def test_animation_2D(monkeypatch):
    # repress the show plot attribute
    monkeypatch.setattr(plt, 'show', lambda: None)

    Model = 'test'
    LoadCase = 'Pushover'
    dt = 0.2
    RunAnalysis()
    ops.wipe()
    ani = opp.animate_deformedshape(Model, LoadCase, dt, scale=10)
    plt.close()
예제 #12
0
def test_plot_fiberResponse2D_section_2(monkeypatch):
    # repress the show plot attribute
    monkeypatch.setattr(plt, 'show', lambda: None)

    main.RunAnalysis()

    op.wipe()

    Model = 'test'
    LoadCase = 'Pushover'
    element2 = 2
    section2 = 3

    opp.plot_fiberResponse2D(Model,
                             LoadCase,
                             element2,
                             section2,
                             InputType='stress',
                             tstep=1)
    plt.close()
    assert True == True
def test_animate_deformedshape_3D(monkeypatch):
    # repress the show plot attribute
    monkeypatch.setattr(plt, 'show', lambda: None)

    RunAnalysis()

    ops.wipe()
    dt = 0.2
    Model = 'test'
    LoadCase = 'Transient'

    ani = opp.animate_deformedshape(Model, LoadCase, dt, scale=30)
    plt.close()
    assert True == True
예제 #14
0
def test_readODB():

    [nodes, elements, NodeDisp, Reaction,
     EleForce] = opp.readODB('TestModel', 'TestLoadCase')
    # [nodes, elements, NodeDisp] = opp.readODB('TestModel', 'TestLoadCase')

    # We don't check everything, we just do a few manual tests.
    check1 = np.all(nodes == np.ones([10, 3]) * 0)
    check2 = np.all(elements[4] == np.array([1., 1., 1.]))
    check3 = np.all(EleForce == np.ones([10, 3]) * 6)
    # check4 = len(EleStress[:,0]) == 10

    check = np.all([check1, check2, check3])
    # check = np.all([check1,check2])

    assert check == True
    # return check


# test_readODB()
def test_animate_fiberResponse2D_Section1(monkeypatch):
    # repress the show plot attribute
    monkeypatch.setattr(plt, 'show', lambda: None)

    main.RunAnalysis()

    op.wipe()

    Model = 'test'
    LoadCase = 'Pushover'
    element1 = 1
    section1 = 1

    ani1 = opp.animate_fiberResponse2D(Model,
                                       LoadCase,
                                       element1,
                                       section1,
                                       InputType='stress',
                                       rFactor=4)
    plt.close()
    assert True == True
예제 #16
0
def test_plot_deformedshape_2D(monkeypatch):
    # repress the show plot attribute
    monkeypatch.setattr(plt, 'show', lambda: None)
    Model = 'test'
    LoadCase = 'Pushover' 

    RunAnalysis()
    ops.wipe()
    opp.plot_deformedshape(Model, LoadCase)
    plt.close()
    opp.plot_deformedshape(Model, LoadCase, tstep = 12, scale = 10, overlap = 'yes')
    plt.close()
    opp.plot_deformedshape(Model, LoadCase, tstep = 3.1231, overlap = 'yes')   
    plt.close()
    
    assert True == True
예제 #17
0
def RunAnalysis():
    op.wipe()

    # Build Model
    mf.getSections()
    mf.buildModel()

    # Prepare Outputs
    Model = 'test'
    LoadCase = 'Pushover'
    element1 = 1
    section1 = 1
    element2 = 2
    section2 = 3
    opp.createODB(Model, LoadCase)
    opp.saveFiberData2D(Model, LoadCase, element1, section1)
    opp.saveFiberData2D(Model, LoadCase, element2, section2)

    # Run Analysis
    af.PushoverLcD(0.001)

    op.wipe()
예제 #18
0
# Load control with Disp
# =============================================================================

op.wipe()

# Build Model
mf.getSections()
mf.buildModel()

# Show Model
# opp.plot_model('node', 'elements')

# Create Database
Model = 'Cantilever'
LoadCase = 'PushoverLcD'
opp.createODB(Model, LoadCase)

eleNumber = 1
sectionNumber = 1
opp.saveFiberData2D(Model, LoadCase, eleNumber, sectionNumber)

# Run Analysis
af.PushoverLcD(0.05)

out = op.eleResponse(1, 'section', '1', 'fiberData')

op.wipe()

opp.plot_fiberResponse2D(Model, LoadCase, eleNumber, sectionNumber)
opp.plot_fiberResponse2D(Model,
                         LoadCase,
예제 #19
0

import openseespy.postprocessing.Get_Rendering as opsplt

opsplt.plot_model("node", Model="CantiBeam")
opsplt.plot_deformedshape(Model="CantiBeam",LoadCase="Push", overlap="no", tstep=2.0, scale=1.0)
opsplt.plot_deformedshape(Model="CantiBeam",LoadCase="Push", overlap="no", scale=1.0)
ani=opsplt.animate_deformedshape(Model="CantiBeam",LoadCase="Push",dt=0.01, scale=1, timeScale=10, Movie = "CantiBeam")
예제 #20
0
def test_plot_deformedshape_3D(monkeypatch):
    # repress the show plot attribute
    monkeypatch.setattr(plt, 'show', lambda: None)

    RunAnalysis()
    ops.wipe()
    Model = 'test'
    LoadCase = 'Transient'
    LoadCase2 = 'Transient_5s'

    # Deformed shape time steps, one that uses an exact step and one that doesn't
    opp.plot_deformedshape(Model, LoadCase, tstep=3.1231, overlap='yes')
    plt.close()
    opp.plot_deformedshape(Model, LoadCase, tstep=3., overlap='yes')
    plt.close()
    opp.plot_deformedshape(Model, LoadCase, tstep=3.)
    plt.close()

    opp.plot_deformedshape(Model, LoadCase2, tstep=3.1231, overlap='yes')
    plt.close()
    opp.plot_deformedshape(Model, LoadCase2, tstep=3., overlap='yes')
    plt.close()
    opp.plot_deformedshape(Model, LoadCase2, tstep=3.)
    plt.close()
    assert True == True
예제 #21
0
    ops.analysis('Static')
    ok = ops.analyze(100)
    logger.info("gravity analyze result is %s", ok == 0)


def ops_cyclic():
    ops.remove('recorders')
    ops.wipeAnalysis()
    ops.loadConst('-time', 0.0)

    # set hysteresis
    ops.recorder('Node', '-file', 'output\\cyclic_657.out',
                 '-time', '-node', 81, '-dof', 1, 'disp')
    ops.pattern('Plain', 2, 1)
    ops.load(81, 1, 0, 0, 0, 0, 0)
    CyclicDisplace(1e-3, 80, 1e-3, 81, 1, 1, 1e6)


if __name__ == '__main__':
    ops_init()
    ops_node()
    ops_material()
    ops_section()
    ops_element()
    ops_gravity()
    ops_cyclic()
    ops.printModel()
    opsplt.plot_model('element')
    ops.stop()
    pass
예제 #22
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")
예제 #23
0
    MaxDisp = 0.15 * H_story
    DispIncr = 0.1
    NstepsPush = int(MaxDisp / DispIncr)

    Model = '2D_Steel'
    LoadCase = 'Pushover'
    dt = 0.2
    createODB(Model, LoadCase, Nmodes=3)

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

    # 	analyze(NstepsPush)
    analyze(170)
    wipe()
    print("Pushover analysis complete")

    # =============================================================================
    # Plot outputs
    # =============================================================================
    opp.plot_model('nodes', 'elements', Model=Model)
    opp.plot_modeshape(2, 200, Model=Model)
    opp.plot_deformedshape(Model, LoadCase, tstep=12, scale=10, overlap='yes')
    opp.plot_deformedshape(Model, LoadCase, tstep=3.1231, overlap='yes')
    ani = opp.animate_deformedshape(Model, LoadCase, dt, Scale=10)
예제 #24
0
# =============================================================================

op.wipe()

# Build Model
mf.getSections()
mf.buildModel()

# Prepare Outputs
Model = 'Cantilever'
LoadCase = 'Pushover'
element1 = 1
section1 = 1
element2 = 2
section2 = 3
opp.createODB(Model, LoadCase)
opp.saveFiberData2D(Model, LoadCase, element1, section1)
opp.saveFiberData2D(Model, LoadCase, element2, section2)

# # Run Analysis
af.PushoverLcD(0.05)

op.wipe()

# =============================================================================
# Animation outputs
# =============================================================================

opp.plot_fiberResponse2D(Model,
                         LoadCase,
                         element2,
    #transfTag = 10      # actual.
    integrationTag = 1  # testing.
    #integrationTag = 10 # actual.
    #    element('forceBeamColumn', eleTag,   *eleNodes, transfTag, integrationTag, '-iter', maxIter=10, tol=1e-12)
    #ops.element('forceBeamColumn',      i, *[i, i + 1], transfTag, integrationTag, '-iter',         30,     1e-12)
    [
        ops.element('forceBeamColumn', i, *[i, i + 1], transfTag,
                    integrationTag, '-iter', 30, 1e-12) for i in range(1, N)
    ]

    print('Model built.')


##############################################################################
#####                            Main Analysis                           #####
##############################################################################

# Initialization:
ops.wipe()

# Modelbuild:
ops.model('Basic', '-ndm', 2, '-ndf', 3)
get_Sections(fc, Es, fy, sec_dims, D, rebar_coords_YZ)
get_Model(coords)
opsplt.plot_model()

# Analysis:

# Close:
ops.wipe()
예제 #26
0
            iNode = ops.nodeCoord(nodeTag1)
            jNode = ops.nodeCoord(nodeTag2)
            ops.element('elasticBeamColumn', eleTag, nodeTag1, nodeTag2, 50.,
                        E, 1000., 1000., 2150., 2150., 2, '-mass', M, massType)
            eleTag += 1
            nodeTag1 += 1
        nodeTag1 += 1

# calculate eigenvalues & print results
numEigen = 7
eigenValues = ops.eigen(numEigen)
PI = 2 * asin(1.0)

###################################
#### Display the active model with node tags only
opsplt.plot_model("nodes")

####  Display specific mode shape with scale factor of 300 using the active model
opsplt.plot_modeshape(5, 300)

###################################
# To save the analysis output for deformed shape, use createODB command before running the analysis
# The following command saves the model data, and output for gravity analysis and the first 3 modes
# in a folder "3DFrame_ODB"

opsplt.createODB("3DFrame", "Gravity", Nmodes=3)

# Define Static Analysis
ops.timeSeries('Linear', 1)
ops.pattern('Plain', 1, 1)
ops.load(72, 1, 0, 0, 0, 0, 0)
예제 #27
0
def RunAnalysis():
    # ----------------------------
    # Start of model generation
    # ----------------------------
    # remove existing model
    ops.wipe()
    ops.model("BasicBuilder", "-ndm", 3, "-ndf", 6)

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

    # Define the section
    # ------------------
    #                                       secTag  E     nu     h    rho
    ops.section("ElasticMembranePlateSection", 1, 3.0E3, 0.25, 1.175, 1.27)

    # Define geometry
    # ---------------
    # these should both be even

    nx = 10
    ny = 2

    # loaded nodes
    mid = int(((nx + 1) * (ny + 1) + 1) / 2)
    side1 = int((nx + 2) / 2)
    side2 = int((nx + 1) * (ny + 1) - side1 + 1)

    # generate the nodes and elements
    #          numX numY startNode startEle eleType eleArgs? coords?
    ops.block2D(nx, ny, 1, 1, "ShellMITC4", 1, 1, -20.0, 0.0, 0.0, 2, -20.0,
                0.0, 40.0, 3, 20.0, 0.0, 40.0, 4, 20.0, 0.0, 0.0, 5, -10.0,
                10.0, 20.0, 7, 10.0, 10.0, 20.0, 9, 0.0, 10.0, 20.0)

    # define the boundary conditions
    ops.fixZ(0.0, 1, 1, 1, 0, 1, 1)
    ops.fixZ(40.0, 1, 1, 1, 0, 1, 1)

    ops.mass(20, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0)

    # create a Linear time series
    ops.timeSeries("Linear", 1)

    # add some loads
    ops.pattern("Plain", 1, 1, "-fact", 1.0)
    ops.load(mid, 0.0, -0.50, 0.0, 0.0, 0.0, 0.0)
    ops.load(side1, 0.0, -0.25, 0.0, 0.0, 0.0, 0.0)
    ops.load(side2, 0.0, -0.25, 0.0, 0.0, 0.0, 0.0)

    # ------------------------
    # Start of static analysis
    # ------------------------
    # Load control with variable load steps
    #                            init  Jd  min  max
    ops.integrator("LoadControl", 1.0, 1, 1.0, 10.0)
    ops.test("EnergyIncr", 1.0E-10, 20, 0)
    ops.algorithm("Newton")
    ops.numberer("RCM")
    ops.constraints("Plain")
    ops.system("SparseGeneral", "-piv")
    ops.analysis("Static")
    ops.analyze(5)

    # ---------------------------------------
    # Create and Perform the dynamic analysis
    # ---------------------------------------
    # Remove the static analysis & reset the time to 0.0

    ops.wipeAnalysis()
    ops.setTime(0.0)

    # Now remove the loads and let the beam vibrate
    ops.remove("loadPattern", 1)

    Model = 'test'
    LoadCase = 'Transient'
    LoadCase2 = 'Transient_5s'
    opp.createODB(Model, LoadCase, Nmodes=3, recorders=[])
    opp.createODB(Model, LoadCase2, Nmodes=3, deltaT=5., recorders=[])

    # Create the transient analysis
    ops.test("EnergyIncr", 1.0E-10, 20, 0)
    ops.algorithm("Newton")
    ops.numberer("RCM")
    ops.constraints("Plain")
    ops.system("SparseGeneral", "-piv")
    ops.integrator("Newmark", 0.50, 0.25)
    ops.analysis("Transient")

    # Perform the transient analysis (20 sec)
    ops.analyze(100, 0.2)
예제 #28
0
# ---------------------------------------
# Create and Perform the dynamic analysis
# ---------------------------------------
# Remove the static analysis & reset the time to 0.0

ops.wipeAnalysis()
ops.setTime(0.0)

# Now remove the loads and let the beam vibrate
ops.remove("loadPattern", 1)

Model = '3D_Shell'
LoadCase = 'Transient'
LoadCase2 = 'Transient_5s'
opp.createODB(Model, LoadCase, Nmodes=3, recorders=[])
opp.createODB(Model, LoadCase2, Nmodes=3, deltaT=5., recorders=[])

# Create the transient analysis
ops.test("EnergyIncr", 1.0E-10, 20, 0)
ops.algorithm("Newton")
ops.numberer("RCM")
ops.constraints("Plain")
ops.system("SparseGeneral", "-piv")
ops.integrator("Newmark", 0.50, 0.25)
ops.analysis("Transient")

# Perform the transient analysis (20 sec)
ops.analyze(100, 0.2)

####### Model Visualization
예제 #29
0
ops.analyze(5)

# ---------------------------------------
# Create and Perform the dynamic analysis
# ---------------------------------------
# Remove the static analysis & reset the time to 0.0

ops.wipeAnalysis()
ops.setTime(0.0)

# Now remove the loads and let the beam vibrate
ops.remove("loadPattern", 1)

ModelName = '3D_Shell'
LoadCaseName = 'Transient'
opp.createODB(ModelName, LoadCaseName, Nmodes=3)

LoadCaseName2 = 'Transient_2ms'
opp.createODB(ModelName, LoadCaseName2, deltaT=1 / 24, Nmodes=3)

# Create the transient analysis
ops.test("EnergyIncr", 1.0E-10, 20, 0)
ops.algorithm("Newton")
ops.numberer("RCM")
ops.constraints("Plain")
ops.system("SparseGeneral", "-piv")
ops.integrator("Newmark", 0.50, 0.25)
ops.analysis("Transient")

# Perform the transient analysis (20 sec)
ops.analyze(1000, 0.002)
예제 #30
0
def plot_opensees_mode_shapes():
    opp.plot_model()
    for i in range(1, numEigen + 1):
        opp.plot_modeshape(i, 50)
    return