예제 #1
0
def get_inelastic_response(mass,
                           k_spring,
                           f_yield,
                           motion,
                           dt,
                           xi=0.05,
                           r_post=0.0):
    """
    Run seismic analysis of a nonlinear SDOF

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

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

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

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

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

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

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

    # Define the dynamic analysis
    load_tag_dynamic = 1
    pattern_tag_dynamic = 1

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

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

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

    # Run the dynamic analysis

    op.wipeAnalysis()

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

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

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

    return outputs
예제 #2
0
# define section geometry
HCol = 60.0  # Column Depth
BCol = 60.0  # Column Width

PCol = Weight  # nodal dead-load weight per column
g = 386.4
Mass = PCol / g

ACol = HCol * BCol * 1000  # cross-sectional area, make stiff
IzCol = (BCol * math.pow(HCol, 3)) / 12  # Column moment of inertia

op.node(1, 0.0, 0.0)
op.node(2, 0.0, LCol)

op.fix(1, 1, 1, 1)

op.mass(2, Mass, 1e-9, 0.0)

#Define Elements and Sections
ColMatTagFlex = 2
ColMatTagAxial = 3
ColSecTag = 1
BeamSecTag = 2

fc = -4.0  # CONCRETE Compressive Strength (+Tension, -Compression)
Ec = 57 * math.sqrt(
    -fc *
    1000)  # Concrete Elastic Modulus (the term in sqr root needs to be in psi

#Column Section
예제 #3
0
E = 3.2e10
rho = 2400.
muCol = rho * Acol
muGir = rho * Agir
massCol = ['-mass', muCol, '-cMass']
massGir = ['-mass', muGir, '-cMass']

ops.node(0, 0.0, 0.0)
ops.node(1, 0.0, 2.0)
ops.node(2, 0.0, 4.0)
ops.node(3, 3.0, 4.0)
ops.node(4, 6.0, 4.0)
ops.node(5, 6.0, 2.0)
ops.node(6, 6.0, 0.0)

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

gTTag = 1
ops.geomTransf('Linear', gTTag)

# 1st column
ops.element('elasticBeamColumn', 1, 0, 1, Acol, E, IzCol, gTTag, *massCol)
ops.element('elasticBeamColumn', 2, 1, 2, Acol, E, IzCol, gTTag, *massCol)
# girder
ops.element('elasticBeamColumn', 3, 2, 3, Agir, E, IzGir, gTTag, *massGir)
ops.element('elasticBeamColumn', 4, 3, 4, Agir, E, IzGir, gTTag, *massGir)
# 2nd column
ops.element('elasticBeamColumn', 5, 4, 5, Acol, E, IzCol, gTTag, *massCol)
ops.element('elasticBeamColumn', 6, 5, 6, Acol, E, IzCol, gTTag, *massCol)
예제 #4
0
def test_Ex1aCanti2DEQmodif():
    # SET UP ----------------------------------------------------------------------------
    ops.wipe()  # clear opensees model
    ops.model('basic', '-ndm', 2, '-ndf', 3)  # 2 dimensions, 3 dof per node
    # file mkdir data 				   # create data directory

    # define GEOMETRY -------------------------------------------------------------
    # nodal coordinates:
    ops.node(1, 0., 0.)  # node#, X Y
    ops.node(2, 0., 432.)

    # Single point constraints -- Boundary Conditions
    ops.fix(1, 1, 1, 1)  # node DX DY RZ

    # nodal masses:
    ops.mass(2, 5.18, 0., 0.)  # node#, Mx My Mz, Mass=Weight/g.

    # Define ELEMENTS -------------------------------------------------------------
    # define geometric transformation: performs a linear geometric transformation of beam stiffness and resisting force from the basic system to the global-coordinate system
    ops.geomTransf('Linear', 1)  # associate a tag to transformation

    # connectivity:
    ops.element('elasticBeamColumn', 1, 1, 2, 3600.0, 3225.0, 1080000.0, 1)

    # define GRAVITY -------------------------------------------------------------
    ops.timeSeries('Linear', 1)
    ops.pattern(
        'Plain',
        1,
        1,
    )
    ops.load(2, 0., -2000., 0.)  # node#, FX FY MZ --  superstructure-weight

    ops.constraints('Plain')  # how it handles boundary conditions
    ops.numberer(
        'Plain'
    )  # renumber dof's to minimize band-width (optimization), if you want to
    ops.system(
        'BandGeneral'
    )  # how to store and solve the system of equations in the analysis
    ops.algorithm('Linear')  # use Linear algorithm for linear analysis
    ops.integrator(
        'LoadControl', 0.1
    )  # determine the next time step for an analysis, # apply gravity in 10 steps
    ops.analysis('Static')  # define type of analysis static or transient
    ops.analyze(10)  # perform gravity analysis
    ops.loadConst('-time', 0.0)  # hold gravity constant and restart time

    # DYNAMIC ground-motion analysis -------------------------------------------------------------
    # create load pattern
    G = 386.0
    ops.timeSeries(
        'Path', 2, '-dt', 0.005, '-filePath', 'A10000.dat', '-factor', G
    )  # define acceleration vector from file (dt=0.005 is associated with the input file gm)
    ops.pattern(
        'UniformExcitation', 2, 1, '-accel',
        2)  # define where and how (pattern tag, dof) acceleration is applied

    # set damping based on first eigen mode
    evals = ops.eigen('-fullGenLapack', 1)
    freq = evals[0]**0.5
    dampRatio = 0.02
    ops.rayleigh(0., 0., 0., 2 * dampRatio / freq)

    # display displacement shape of the column
    # recorder display "Displaced shape" 10 10 500 500 -wipe
    # prp 200. 50. 1
    # vup  0  1 0
    # vpn  0  0 1
    # display 1 5 40

    # create the analysis
    ops.wipeAnalysis()  # clear previously-define analysis parameters
    ops.constraints('Plain')  # how it handles boundary conditions
    ops.numberer(
        'Plain'
    )  # renumber dof's to minimize band-width (optimization), if you want to
    ops.system(
        'BandGeneral'
    )  # how to store and solve the system of equations in the analysis
    ops.algorithm('Linear')  # use Linear algorithm for linear analysis
    ops.integrator('Newmark', 0.5,
                   0.25)  # determine the next time step for an analysis
    ops.analysis('Transient')  # define type of analysis: time-dependent
    ops.analyze(3995, 0.01)  # apply 3995 0.01-sec time steps in analysis

    u2 = ops.nodeDisp(2, 2)
    print("u2 = ", u2)

    assert abs(u2 + 0.07441860465116277579) < 1e-12
    ops.wipe()

    print("=========================================")
예제 #5
0
# fluid mesh
fluidTag = 4
ndf = 2
ops.mesh('line', 1, 10, 4, 5, 8, 9, 10, 11, 7, 6, 12, 2, wall_id, ndf, h)
ops.mesh('line', 2, 3, 2, 1, 4, wall_id, ndf, h)
ops.mesh('line', 3, 3, 2, 3, 4, water_bound_id, ndf, h)

eleArgs = ['PFEMElementBubble', rho, mu, b1, b2, thk, kappa]
ops.mesh('tri', fluidTag, 2, 2, 3, water_body_id, ndf, h, *eleArgs)

# wall mesh
wallTag = 5
ops.mesh('tri', wallTag, 2, 1, 2, wall_id, ndf, h)

for nd in ops.getNodeTags('-mesh', wallTag):
    ops.fix(nd, 1, 1, 1)

# save the original modal
ops.record()

# create constraint object
ops.constraints('Plain')

# create numberer object
ops.numberer('Plain')

# create convergence test object
ops.test('PFEM', 1e-5, 1e-5, 1e-5, 1e-5, 1e-15, 1e-15, 20, 3, 1, 2)

# create algorithm object
ops.algorithm('Newton')
예제 #6
0
#g = 386.4
Mass = PCol / g
MCol = ((Weight / LBeam) * math.pow(LBeam, 2)) / 12

# calculated geometry parameters
ACol = HCol * BCol  # cross-sectional area
ABeam = HBeam * BBeam
IzCol = (BCol * math.pow(HCol, 3)) / 12  # Column moment of inertia
IzBeam = (BBeam * math.pow(HBeam, 3)) / 12  # Beam moment of inertia

op.node(1, 0.0, 0.0)
op.node(2, LBeam, 0.0)
op.node(3, 0.0, LCol)
op.node(4, LBeam, LCol)

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

IDctrlNode = 2
IDctrlDOF = 1

op.mass(3, Mass, 0.0, 0.0)
op.mass(4, Mass, 0.0, 0.0)

ColSecTag = 1  # assign a tag number to the column section
BeamSecTag = 2  # assign a tag number to the beam section

coverCol = 6.0 * inch  # Column cover to reinforcing steel NA.
numBarsCol = 10  # number of longitudinal-reinforcement bars in column. (symmetric top & bot)
barAreaCol = 2.25 * inch2  # area of longitudinal-reinforcement bars
    # =============================================================================
    # create fix
    # =============================================================================

    nodes_lvl_00 = frame_lvl_14.to_columns_nth(0)
    #    print(frame_lvl_14.to_columns_nth(0))
    #
    ##    fix(nodeTag, *constrValues)
    fully_fixed = [1, 1, 1, 1, 1, 1]

    for i in nodes_lvl_00:
        #        foundation = stu.node_manager.anti_get(i[1])
        #        print(i[1])
        #        print(foundation)
        ops.fix(i[1], *fully_fixed)
#    ops.fix(nodes_lvl_00[1][1]  , *fully_fixed)

#   fixZ(z, *constrValues, '-tol', tol=1e-10)
#    ops.fixZ(0.0 , *fully_fixed)

    print("\n已创建约束")

    # =============================================================================
    # create pattern
    # =============================================================================
    #    pattern('Plain', patternTag, tsTag, '-fact', fact)
    #
    #    factor = 1.0
    #    ops.timeSeries('Linear', 1)
    #    ops.pattern("Plain" , 1 , 1)
예제 #8
0
def run_nlth_analysis_on_sdof_ops_py(capacity_curve, gmr, damping,
                                     degradation):

    cap_df = pd.DataFrame(capacity_curve)
    if any(cap_df.duplicated()):
        warnings.warn(
            "Warning: Duplicated pairs have been found in capacity curve!")

    ops.wipe()
    ops.model('basic', '-ndm', 1, '-ndf', 1)

    d_cap = capacity_curve[:, 0]
    f_cap = capacity_curve[:, 1] * 9.81

    f_vec = np.zeros([5, 1])
    d_vec = np.zeros([5, 1])
    if len(f_cap) == 3:
        #bilinear curve
        f_vec[1] = f_cap[1]
        f_vec[4] = f_cap[-1]

        d_vec[1] = d_cap[1]
        d_vec[4] = d_cap[-1]

        d_vec[2] = d_vec[1] + (d_vec[4] - d_vec[1]) / 3
        d_vec[3] = d_vec[1] + 2 * ((d_vec[4] - d_vec[1]) / 3)

        f_vec[2] = np.interp(d_vec[2], d_cap, f_cap)
        f_vec[3] = np.interp(d_vec[3], d_cap, f_cap)

    elif len(f_cap) == 4:

        f_vec[1] = f_cap[1]
        f_vec[4] = f_cap[-1]

        d_vec[1] = d_cap[1]
        d_vec[4] = d_cap[-1]

        f_vec[2] = f_cap[2]
        d_vec[2] = d_cap[2]

        d_vec[3] = np.mean([d_vec[2], d_vec[-1]])
        f_vec[3] = np.interp(d_vec[3], d_cap, f_cap)

    elif len(f_cap) == 5:
        f_vec[1] = f_cap[1]
        f_vec[4] = f_cap[-1]

        d_vec[1] = d_cap[1]
        d_vec[4] = d_cap[-1]

        f_vec[2] = f_cap[2]
        d_vec[2] = d_cap[2]

        f_vec[3] = f_cap[3]
        d_vec[3] = d_cap[3]

    matTag_pinching = 10
    if degradation == True:
        matargs = [
            f_vec[1, 0], d_vec[1, 0], f_vec[2, 0], d_vec[2, 0], f_vec[3, 0],
            d_vec[3, 0], f_vec[4, 0], d_vec[4, 0], -1 * f_vec[1, 0],
            -1 * d_vec[1, 0], -1 * f_vec[2, 0], -1 * d_vec[2, 0],
            -1 * f_vec[3, 0], -1 * d_vec[3, 0], -1 * f_vec[4, 0],
            -1 * d_vec[4, 0], 0.5, 0.25, 0.05, 0.5, 0.25, 0.05, 0, 0.1, 0, 0,
            0.2, 0, 0.1, 0, 0, 0.2, 0, 0.4, 0, 0.4, 0.9, 10, 'energy'
        ]

    else:
        matargs = [
            f_vec[1, 0], d_vec[1, 0], f_vec[2, 0], d_vec[2, 0], f_vec[3, 0],
            d_vec[3, 0], f_vec[4, 0], d_vec[4, 0], -1 * f_vec[1, 0],
            -1 * d_vec[1, 0], -1 * f_vec[2, 0], -1 * d_vec[2, 0],
            -1 * f_vec[3, 0], -1 * d_vec[3, 0], -1 * f_vec[4, 0],
            -1 * d_vec[4, 0], 0.5, 0.25, 0.05, 0.5, 0.25, 0.05, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 'energy'
        ]

    ops.uniaxialMaterial('Pinching4', matTag_pinching, *matargs)
    matTag_minmax = int(matTag_pinching / 10)
    ops.uniaxialMaterial('MinMax', matTag_minmax, matTag_pinching, '-min',
                         -1 * d_vec[4, 0], '-max', d_vec[4, 0])

    mx = 1
    kx = f_vec[1, 0] / d_vec[1, 0]
    omega = np.sqrt(kx / mx)
    dt = gmr[1, 0] - gmr[0, 0]

    ops.node(1, 0)
    ops.node(2, 0, '-mass', float(mx))
    ops.fix(1, 1)
    ops.element('zeroLength', 1, 1, 2, "-mat", matTag_minmax, "-dir", 1,
                '-doRayleigh', 1)

    gmr_values = gmr[:, 1] * 9.81
    gmr_times = gmr[:, 0]
    ops.timeSeries('Path', 2, '-values', *gmr_values, '-time', *gmr_times)
    ops.pattern('UniformExcitation', 2, 1, '-accel', 2)

    ops.constraints('Plain')
    ops.numberer('RCM')
    ops.test('NormDispIncr', 1e-6, 50)
    ops.algorithm('Newton')
    ops.system('BandGeneral')
    ops.integrator('Newmark', 0.5, 0.25)
    ops.analysis('Transient')

    t_final = gmr[-1, 0]
    t_current = ops.getTime()
    ok = 0
    #betaKinit=2*damping/omega
    alphaM = 2 * damping * omega
    time = [t_current]
    disps = [0.0]
    accels = [0.0]
    #ops.rayleigh(0,0,betaKinit,0)
    ops.rayleigh(alphaM, 0, 0, 0)  # mass proportional damping
    while ok == 0 and t_current < t_final:
        ok = ops.analyze(1, dt)
        if ok != 0:
            print(
                "regular newton failed ... lets try an initail stiffness for this step"
            )
            ops.test('NormDispIncr', 1.0e-6, 100, 0)
            ops.algorithm('ModifiedNewton', '-initial')
            ok = ops.analyze(1, dt)
            if ok != 0:
                print("reducing dt by 10")
                ndt = dt / 10
                ok = ops.analyze(10, ndt)
            if ok == 0:
                print("that worked ... back to regular settings")
                ops.test('NormDispIncr', 1e-6, 50)
                ops.test('NormDispIncr', 1e-6, 50)
        t_current = ops.getTime()
        time.append(t_current)
        disps.append(ops.nodeDisp(2, 1))
        accels.append(ops.nodeAccel(2, 1))

    if ok != 0:
        print('NLTHA did not converge!')

    return time, disps, accels
#        dl_data[floor:floor+wall.shape[0],6]= dl_data[floor:floor+wall.shape[0],1]
#        floor = floor + wall.shape[0]
#    
#    for i in range(dl_data.shape[0]):
#        ops.mass(dl_data[i,0], dl_data[i,1], dl_data[i,2], dl_data[i,3], dl_data[i,4], dl_data[i,5], dl_data[i,6])
#    
    # =============================================================================
    #     Set Boundary Condition
    # =============================================================================
    #1.node 2 to 6: 1=fixed, 0=free
    constraint_data= np.ones((wall.shape[0],7))
    
    constraint_data[:,0]= node_data[0:wall.shape[0],0]
    
    for i in range(wall.shape[0]):
        ops.fix(constraint_data[i,0], int(constraint_data[i,1]), int(constraint_data[i,2]), int(constraint_data[i,3]), int(constraint_data[i,4]), int(constraint_data[i,5]), int(constraint_data[i,6]))
    
    #constraints for mass nodes
    mass_constraint_data= np.ones((num_story,7))
    
    mass_constraint_data[:,0]= mass_node_data[0:mass_node_data.shape[0],0]
    
    mass_constraint_data[:,1:3]= 0
    mass_constraint_data[:,6]= 1
    
    for i in range(mass_constraint_data.shape[0]):
        ops.fix(mass_constraint_data[i,0], 0,0,1,1,1,0)
    
    # =============================================================================
    #     Apply Wall Constraints
    # =============================================================================
예제 #10
0
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
예제 #11
0
ops.reset()
ops.wipe()

ops.logFile('output.log')
# set model
ops.start()

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

ops.node(1, 0, 0, 0)
ops.node(2, 0, 1, 0)
ops.node(3, 1, 0, 0)
ops.node(4, 1, 1, 0)

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

ops.nDMaterial('PlaneStressUserMaterial', 3, 40, 7, 20.7e6, 2.07e6, -4.14e6,
               -0.002, -0.005, 0.001, 0.08)
ops.nDMaterial('PlateFromPlaneStress', 30, 3, 1.25e10)
ops.section('LayeredShell', 1, 3, 30, 0.015, 30, 0.015, 30, 0.015)

# ops.uniaxialMaterial('Elastic', 1, 202.7e9)
# ops.element('Truss', 1, 1, 2, 0.1, 1)
ops.element('ShellMITC4', 1, 1, 3, 4, 2, 1)

ops.recorder('Node', '-file', 'disp.out', '-node', 2, '-time', '-dof', 1,
             'disp')
ops.recorder('Node', '-file', 'reac.out', '-node', 2, '-time', '-dof', 1,
             'reaction')
예제 #12
0
#this will create just 'Data' folder    
#os.mkdir("Data-1b")
    
#detect the current working directory
#path1 = os.getcwd()
#print(path1)

h = 432.0
w  =  504.0

op.node(1, 0.0, 0.0)
op.node(2, h, 0.0)
op.node(3, 0.0, w)
op.node(4, h, w)

op.fix(1, 1,1,1)
op.fix(2, 1,1,1)
op.fix(3, 0,0,0)
op.fix(4, 0,0,0)

op.mass(3, 5.18, 0.0, 0.0)
op.mass(4, 5.18, 0.0, 0.0)  

op.geomTransf('Linear', 1)
A = 3600000000.0
E = 4227.0
Iz = 1080000.0

A1 = 5760000000.0
Iz1 = 4423680.0
op.element('elasticBeamColumn', 1, 1, 3, A, E, Iz, 1)