Beispiel #1
0
def get_disp(GRS):

    ops.timeSeries('Linear', 1)
    ops.pattern('Plain', 1, 1)
    for i in range(GRS.nbnBns):
        if GRS.LoadType == 0 \
                or (GRS.GeomType in {0, 1, 2} and GRS.LoadType == 1 and GRS.nsAll.x[GRS.nbn[i]] <= 0) \
                or (GRS.GeomType in {0, 1, 2} and GRS.LoadType == 2 and GRS.nsAll.y[GRS.nbn[i]] <= 0) \
                or (GRS.GeomType in {4} and GRS.LoadType == 1 and GRS.nsAll.x[GRS.nbn[i]] <= GRS.span / 2) \
                or (GRS.GeomType in {4} and GRS.LoadType == 2 and GRS.nsAll.y[GRS.nbn[i]] <= GRS.span / 2):
            ops.load(int(100 + GRS.nbn[i]), 0., 0., -1., 0., 0., 0.)

    ops.algorithm("Linear")
    ops.integrator("LoadControl", 1)
    ops.analysis('Static')

    ops.analyze(1)

    NDisp = np.zeros([GRS.nbNsAll, 3])
    for j in range(GRS.nbNsAll):
        NDisp[j, 0] = ops.nodeDisp(int(j + 100), 1)
        NDisp[j, 1] = ops.nodeDisp(int(j + 100), 2)
        NDisp[j, 2] = ops.nodeDisp(int(j + 100), 3)

    return NDisp
Beispiel #2
0
def test_recorder_time_step_can_handle_fp_precision():
    import tempfile
    opy.model('basic', '-ndm', 2, '-ndf', 3)
    opy.node(1, 0.0, 0.0)
    opy.node(2, 0.0, 5.0)
    opy.fix(2, 0, 1, 0)
    opy.fix(1, 1, 1, 1)
    opy.equalDOF(2, 1, 2)
    opy.mass(2, 1.0, 0.0, 0.0)
    opy.geomTransf('Linear', 1, '-jntOffset')
    opy.element('elasticBeamColumn', 1, 1, 2, 1.0, 1e+06, 0.00164493, 1)
    opy.timeSeries('Path', 1, '-dt', 0.1, '-values', 0.0, -0.001, 0.001,
                   -0.015, 0.033, 0.105, 0.18)
    opy.pattern('UniformExcitation', 1, 1, '-accel', 1)
    opy.rayleigh(0.0, 0.0159155, 0.0, 0.0)
    opy.wipeAnalysis()
    opy.algorithm('Newton')
    opy.system('SparseSYM')
    opy.numberer('RCM')
    opy.constraints('Transformation')
    opy.integrator('Newmark', 0.5, 0.25)
    opy.analysis('Transient')
    opy.test('EnergyIncr', 1e-07, 10, 0, 2)
    node_rec_ffp = tempfile.NamedTemporaryFile(delete=False).name
    ele_rec_ffp = tempfile.NamedTemporaryFile(delete=False).name
    rdt = 0.01
    adt = 0.001
    opy.recorder('Node', '-file', node_rec_ffp, '-precision', 16, '-dT', rdt,
                 '-rTolDt', 0.00001, '-time', '-node', 1, '-dof', 1, 'accel')
    opy.recorder('Element', '-file', ele_rec_ffp, '-precision', 16, '-dT', rdt,
                 '-rTolDt', 0.00001, '-time', '-ele', 1, 'force')

    opy.record()
    for i in range(1100):
        opy.analyze(1, adt)
        opy.getTime()
    opy.wipe()

    a = open(node_rec_ffp).read().splitlines()
    for i in range(len(a) - 1):
        dt = float(a[i + 1].split()[0]) - float(a[i].split()[0])
        assert abs(dt - 0.01) < adt * 0.1, (i, dt)
    a = open(ele_rec_ffp).read().splitlines()
    for i in range(len(a) - 1):
        dt = float(a[i + 1].split()[0]) - float(a[i].split()[0])
        assert abs(dt - 0.01) < adt * 0.1, (i, dt)
Beispiel #3
0
def RunIterations2(GRS, Fz, printOn):

    ops.timeSeries('Linear', 1)
    ops.pattern('Plain', 1, 1)
    for i in range(GRS.nbnBns):
        ops.load(int(100 + GRS.nbn[i]), 0., 0., Fz * un.kN, 0., 0., 0.)
    GRS.GetTopNode()
    # ops.load(int(100+GRS.maxNsID), 0., 0., Fz * kN, 0., 0., 0.)  # mid-point

    # create SOE
    ops.system('UmfPack')
    # create DOF number
    ops.numberer('RCM')
    # create constraint handler
    ops.constraints('Transformation')
    # create integrator
    ops.integrator("LoadControl", 1.0 / GRS.Steps)
    # create algorithm
    ops.algorithm("Newton")
    # create test
    ops.test('EnergyIncr', 1.e-10, 100)

    ops.analysis('Static')

    NDisp = np.zeros([GRS.Steps + 1, GRS.nbNsAll, 3])
    # EDisp = np.zeros([GRS.Steps + 1, GRS.nbElAll, 6])
    EForce = np.zeros([GRS.Steps + 1, GRS.nbElAll, 12])
    reI = 0

    reI = 0
    lefutott = 1
    for i in range(1, GRS.Steps + 1):
        hiba = ops.analyze(1)
        if hiba == 0:
            if i == 1:
                if printOn: print('analysis step 1 completed successfully')
            for j in range(GRS.nbNsAll):
                NDisp[i, j, 0] = -ops.nodeDisp(int(j + 100),
                                               1) / un.mm  # mm displacement
                NDisp[i, j, 1] = -ops.nodeDisp(int(j + 100),
                                               2) / un.mm  # mm displacement
                NDisp[i, j, 2] = -ops.nodeDisp(int(j + 100),
                                               3) / un.mm  # mm displacement
            for j in range(GRS.nbElAll):
                EForce[i, j] = ops.eleResponse(int(j + 1000), 'localForce')
                # EDisp[i, j] = ops.eleResponse(int(j + 1000), 'basicDeformation')
        else:
            lefutott = 0
            reI = i
            if reI == 1:
                if printOn: print('analysis failed to converge in step ', i)
            break

    return lefutott, NDisp, EForce, reI
Beispiel #4
0
def get_normal_force(GRS):

    ops.timeSeries('Linear', 1)
    ops.pattern('Plain', 1, 1)
    for i in range(GRS.nbnBns):
        if GRS.LoadType == 0 \
                or (GRS.GeomType in {0, 1, 2} and GRS.LoadType == 1 and GRS.nsAll.x[GRS.nbn[i]] <= 0) \
                or (GRS.GeomType in {0, 1, 2} and GRS.LoadType == 2 and GRS.nsAll.y[GRS.nbn[i]] <= 0) \
                or (GRS.GeomType in {4} and GRS.LoadType == 1 and GRS.nsAll.x[GRS.nbn[i]] <= GRS.span / 2) \
                or (GRS.GeomType in {4} and GRS.LoadType == 2 and GRS.nsAll.y[GRS.nbn[i]] <= GRS.span / 2):
            ops.load(int(100 + GRS.nbn[i]), 0., 0., -1., 0., 0., 0.)

    ops.algorithm("Linear")
    ops.integrator("LoadControl", 1)
    ops.analysis('Static')

    ops.analyze(1)

    EForce = np.zeros([GRS.nbElAll])
    for j in range(GRS.nbElAll):
        EForce[j] = ops.eleResponse(int(j + 1000), 'localForce')[0]
    return EForce
Beispiel #5
0
ops.fix(1, 1)

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

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

ops.analyze(5, 0.0001, 0.00001, 0.001, 10)
time = ops.getTime()
print(f'time: ', ops.getTime())
approx_vtime = 0.0001 + 0.001  # One step at target, then one step at maximum
assert 0.99 < time / approx_vtime < 1.01, (time, approx_vtime)
ops.setTime(0.0)
# Can still run a non-variable analysis - since analyze function has multiple dispatch.
ops.analyze(5, 0.0001)
time = ops.getTime()
print(f'time: ', ops.getTime())
approx_vtime = 0.0001 * 5  # variable transient is not active so time should be dt * 5
# If variable transient is not active then time would be 0.0005
assert 0.99 < time / approx_vtime < 1.01, (time, approx_vtime)
Beispiel #6
0
# create the integration scheme, the LoadControl scheme using steps of 0.1
ops.integrator("LoadControl", 0.1)

# create the analysis object
ops.analysis("Static")

# ------------------------------
# End of analysis generation
# ------------------------------

# ------------------------------
# Finally perform the analysis
# ------------------------------

# perform the gravity load analysis, requires 10 steps to reach the load level
ops.analyze(10)

print("Gravity load analysis completed\n")

# Set the gravity loads to be constant & reset the time in the domain
ops.loadConst("-time", 0.0)

# ----------------------------------------------------
# End of Model Generation & Initial Gravity Analysis
# ----------------------------------------------------

# ----------------------------------------------------
# Start of additional modelling for lateral loads
# ----------------------------------------------------

# Define lateral loads
Beispiel #7
0
import sys
TEST_DIR = os.path.dirname(os.path.abspath(__file__)) + "/"
INTERPRETER_PATH = TEST_DIR + "../SRC/interpreter/"
sys.path.append(INTERPRETER_PATH)

import opensees as opy
opy.wipe()
opy.model('basic', '-ndm', 2, '-ndf', 2)
opy.node(1, 0.0, 0.0)
opy.node(2, 1.0, 0.0)
opy.node(3, 1.0, 1.0)
opy.node(4, 0.0, 1.0)
for i in range(4):
    opy.fix(1 + 1 * i, 1, 1)
opy.nDMaterial('stressDensity', 1, 1.8, 0.7, 250.0, 0.6, 0.2, 0.592, 0.021, 291.0, 55.0, 98.0, 13.0, 4.0, 0.22, 0.0, 0.0055, 0.607, 98.1)
opy.nDMaterial('InitStressNDMaterial', 2, 1, -100.0, 2)
opy.element('SSPquad', 1, 1, 2, 3, 4, 2, 'PlaneStrain', 1.0, 0.0, 0.0)
opy.constraints('Penalty', 1e+15, 1e+15)
opy.algorithm('Linear', False, False, False)
opy.numberer('RCM')
opy.system('FullGeneral')
opy.integrator('LoadControl', 0.1, 1)
opy.analysis('Static')
opy.timeSeries('Path', 1, '-values', 0, 0, 0, 0.1, '-time', 0.0, 1.0, 2.0, 1002.0, '-factor', 1.0)
opy.pattern('Plain', 1, 1)
opy.sp(3, 1, 1)
opy.sp(4, 1, 1)
opy.analyze(1)
opy.setParameter('-val', 1, '-ele', 1, 'materialState')
opy.analyze(1)
Beispiel #8
0
ops.fix(6, 1, 1)
ops.fix(11, 1, 1)
ops.fix(16, 1, 1)
ops.fix(21, 1, 1)

ops.equalDOF(2, 22, 1, 2)
ops.equalDOF(3, 23, 1, 2)
ops.equalDOF(4, 24, 1, 2)
ops.equalDOF(5, 25, 1, 2)

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

ops.analysis('Static')
ops.analyze(1)

# - plot model
opsv.plot_model()
plt.axis('equal')

# - plot deformation
plt.figure()
opsv.plot_defo()
plt.axis('equal')

# get values at OpenSees nodes
sig_out = opsv.sig_out_per_node()
print(f'sig_out:\n{sig_out}')

# !!! select from sig_out: e.g. vmises
# create SOE
op.system('UmfPack')
# create DOF number
op.numberer('RCM')
# create constraint handler
op.constraints('Transformation')
# create integrator
op.integrator('LoadControl', timeStep, NumSteps)
# create algorithm
op.algorithm('Newton')
# create test
op.test('NormUnbalance', 1, 1000, 1)
# create analysis object
op.analysis('Static')
# perform the analysis
op.analyze(NumSteps)
op.loadConst('-time', 1.00)
op.wipeAnalysis()

#----------------------------------------------------------------------------------
###################################################################################
# Stage 2 : Perform Dynamic analysis with excess pore pressure generation in soil
###################################################################################

Total_Time = 30
#total time of simulation
dt = 0.01
#time step increment
numIncr = int(Total_Time / dt) - 1
#number of analysis steps to perform
Beispiel #10
0
# create a Recorder object for the nodal displacements at node 4
ops.recorder("Node", "-file", "example.out", "-time", "-node", 4, "-dof", 1, 2, "disp")

# create a recorder for element forces, one in global and the other local system
ops.recorder("Element", "-file", "eleGlobal.out", "-time", "-ele", 1, 2, 3, "forces")
ops.recorder("Element", "-file", "eleLocal.out", "-time", "-ele", 1, 2, 3, "basicForces")

# ------------------------------
# End of recorder generation
# ------------------------------


# ------------------------------
# Finally perform the analysis
# ------------------------------

# perform the analysis
ops.analyze(1)


# ------------------------------
# Print Stuff to Screen
# ------------------------------

# print the current state at node 4 and at all elements
#print("node 4 displacement: ", ops.nodeDisp(4))
ops.printModel("node", 4)
ops.printModel("ele")
ops.wipe()
Beispiel #11
0
# ----------------------------
# Start of recorder generation
# ----------------------------

# Record DOF 1 and 2 displacements at nodes 9, 14, and 19
ops.recorder("Node", "-file", "Node51.out", "-time", "-node", 9, 14, 19, "-dof", 1, 2, "disp")
#ops.recorder("plot", "Node51.out", "Node9_14_19_Xdisp", 10, 340, 300, 300, "-columns", 1, 2, "-columns", 1, 4, "-columns", 1, 6, "-dT", 1.0)

# --------------------------
# End of recorder generation
# --------------------------


# --------------------
# Perform the analysis
# --------------------

# record once at time 0
ops.record()

# Analysis duration of 20 seconds
#              numSteps dt
ok = ops.analyze(2000, 0.01)

if (ok != 0):
    print("analysis FAILED")
else:
    print("analysis SUCCESSFUL")

ops.wipe()
Beispiel #12
0
# DOF numberer
ops.numberer("RCM")

# Cosntraint handler
ops.constraints("Plain") 

# System of equations solver
ops.system("SparseGeneral", "-piv")
#ops.system("ProfileSPD")

# Analysis for gravity load
ops.analysis("Static") 

# Perform the gravity load analysis
ops.analyze(5)

# --------------------------
# End of static analysis
# --------------------------


# ----------------------------
# Start of recorder generation
# ----------------------------

ops.recorder("Node", "-file", "Node.out", "-time", "-node", mid, "-dof", 2, "disp")
#ops.recorder("plot", "Node.out", "CenterNodeDisp", 625, 10, 625, 450, "-columns", 1, 2)

# create the display
#ops.recorder("display", "shellDynamics", 10, 10, 600, 600, "-wipe")
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
Beispiel #14
0
# ----------------------------
# Start of recorder generation
# ----------------------------

# Record DOF 1 and 2 displacements at nodes 9, 14, and 19
ops.recorder("Node", "-file", "Node51.out", "-time", "-node", 9, 14, 19,
             "-dof", 1, 2, "disp")
#ops.recorder("plot", "Node51.out", "Node9_14_19_Xdisp", 10, 340, 300, 300, "-columns", 1, 2, "-columns", 1, 4, "-columns", 1, 6, "-dT", 1.0)

# --------------------------
# End of recorder generation
# --------------------------

# --------------------
# Perform the analysis
# --------------------

# record once at time 0
ops.record()

# Analysis duration of 20 seconds
#              numSteps dt
ok = ops.analyze(2000, 0.01)

if (ok != 0):
    print("analysis FAILED")
else:
    print("analysis SUCCESSFUL")

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

    a = open('time_0_01.txt').read().splitlines()
    for i in range(len(a) - 1):
        dt = float(a[i + 1].split()[0]) - float(a[i].split()[0])
        assert abs(dt - 0.01) < 0.0001, (i, dt)
Beispiel #16
0
# DOF numberer
ops.numberer("RCM")

# Cosntraint handler
ops.constraints("Plain")

# System of equations solver
ops.system("SparseGeneral", "-piv")
#ops.system("ProfileSPD")

# Analysis for gravity load
ops.analysis("Static")

# Perform the gravity load analysis
ops.analyze(5)

# --------------------------
# End of static analysis
# --------------------------

# ----------------------------
# Start of recorder generation
# ----------------------------

ops.recorder("Node", "-file", "Node.out", "-time", "-node", mid, "-dof", 2,
             "disp")
#ops.recorder("plot", "Node.out", "CenterNodeDisp", 625, 10, 625, 450, "-columns", 1, 2)

# create the display
#ops.recorder("display", "shellDynamics", 10, 10, 600, 600, "-wipe")
Beispiel #17
0
ops.algorithm("Newton")

# DOF numberer
ops.numberer("RCM")

# Cosntraint handler
ops.constraints("Plain")

# System of equations solver
ops.system("ProfileSPD")

# Analysis for gravity load
ops.analysis("Static")

# Perform the analysis
ops.analyze(5)

# --------------------------
# End of static analysis
# --------------------------


# ----------------------------
# Start of recorder generation
# ----------------------------

ops.recorder("Node", "-file", "Node.out", "-time", "-node", nn, "-dof", 1, "disp")
ops.recorder("Element", "-file", "Elem.out", "-time", "-eleRange", 1, 10, "material", "1", "strains")
#ops.recorder("plot", "Node.out", "CenterNodeDisp", 625, 10, 625, 450, "-columns", 1, 2)

# create the display
Beispiel #18
0
ops.analysis("Static")

# ------------------------------------------------
# End of analysis generation for gravity analysis
# ------------------------------------------------


# ------------------------------
# Perform gravity load analysis
# ------------------------------

# initialize the model, done to set initial tangent
ops.initialize()

# perform the gravity load analysis, requires 10 steps to reach the load level
ops.analyze(10)

print("Gravity load analysis completed\n")

# set gravity loads to be const and set pseudo time to be 0.0
# for start of lateral load analysis
ops.loadConst("-time", 0.0)


# ------------------------------
# Add lateral loads 
# ------------------------------

# Reference lateral load for pushover analysis
H = 10.0
Beispiel #19
0
ops.integrator("LoadControl", 0.1)

# create the analysis object 
ops.analysis("Static")

# ------------------------------
# End of analysis generation
# ------------------------------


# ------------------------------
# Finally perform the analysis
# ------------------------------

# perform the gravity load analysis, requires 10 steps to reach the load level
ops.analyze(10)

print("Gravity load analysis completed\n")

# Set the gravity loads to be constant & reset the time in the domain
ops.loadConst("-time", 0.0)

# ----------------------------------------------------
# End of Model Generation & Initial Gravity Analysis
# ----------------------------------------------------


# ----------------------------------------------------
# Start of additional modelling for dynamic loads
# ----------------------------------------------------
Beispiel #20
0
#-----------------------------------------------------------------------------------------
# update materials to ensure elastic behavior
op.updateMaterialStage('-material', 1, '-stage', 0)
op.updateMaterialStage('-material', 2, '-stage', 0)
op.updateMaterialStage('-material', 3, '-stage', 0)

op.constraints('Penalty', 1.0E14, 1.0E14)
op.test('NormDispIncr', 1e-4, 35, 1)
op.algorithm('KrylovNewton')
op.numberer('RCM')
op.system('ProfileSPD')
op.integrator('Newmark', gamma, beta)
op.analysis('Transient')

startT = tt.time()
op.analyze(10, 5.0E2)
print('Finished with elastic gravity analysis...')

# update material to consider elastoplastic behavior
op.updateMaterialStage('-material', 1, '-stage', 1)
op.updateMaterialStage('-material', 2, '-stage', 1)
op.updateMaterialStage('-material', 3, '-stage', 1)

# plastic gravity loading
op.analyze(40, 5.0e2)

print('Finished with plastic gravity analysis...')

#-----------------------------------------------------------------------------------------
#  10. UPDATE ELEMENT PERMEABILITY VALUES FOR POST-GRAVITY ANALYSIS
#-----------------------------------------------------------------------------------------
Beispiel #21
0
# create the analysis object
ops.analysis("Static")

# ------------------------------------------------
# End of analysis generation for gravity analysis
# ------------------------------------------------

# ------------------------------
# Perform gravity load analysis
# ------------------------------

# initialize the model, done to set initial tangent
ops.initialize()

# perform the gravity load analysis, requires 10 steps to reach the load level
ops.analyze(10)

print("Gravity load analysis completed\n")

# set gravity loads to be const and set pseudo time to be 0.0
# for start of lateral load analysis
ops.loadConst("-time", 0.0)

# ------------------------------
# Add lateral loads
# ------------------------------

# Reference lateral load for pushover analysis
H = 10.0

# Set lateral load pattern with a Linear TimeSeries
Beispiel #22
0
op.algorithm('Newton')
# create test
tol = 1.0E-8
Iter = 25
pFlag = 0
op.test('NormDispIncr', tol, Iter, pFlag)
# create analysis object
op.analysis('VariableTransient')
# perform the analysis
dtMin = dt / 100
#Minimum time steps. (required for VariableTransient analysis)
dtMax = dt / 10
#Maximum time steps (required for VariableTransient analysis)
Jd = 1000
#Number of iterations user would like performed at each step. The variable transient analysis will change current time step if last analysis step took more or less iterations than this to converge (required for VariableTransient analysis)
op.analyze(numIncr, dt, dtMin, dtMax, Jd)
op.wipe()

#################################################################
# Plot the results
#################################################################
Node_Disp = np.loadtxt('Node_Disp_Liq.txt', delimiter=' ')
TZ1 = np.loadtxt('TZ1_Liq.txt', delimiter=' ')
Time = Node_Disp[:, 0]

Figure = plt.figure(figsize=(10, 8))
Ru_Axis = Figure.add_subplot(311)
U_Axis = Figure.add_subplot(312)
TZ_Axis = Figure.add_subplot(313)

Ru_Axis.plot(MNS_Time, 1 - MeanStress, '-k', linewidth=2)
Beispiel #23
0
def RunIterations(GRS, Fz, printOn):
    ops.timeSeries('Linear', 1)
    ops.pattern('Plain', 1, 1)
    loadA = np.linspace(0, -Fz, GRS.Steps + 1)  # kN
    for i in range(GRS.nbnBns):
        if GRS.LoadType == 0 \
                or (GRS.GeomType in {0, 1, 2} and GRS.LoadType == 1 and GRS.nsAll.x[GRS.nbn[i]] <= 0) \
                or (GRS.GeomType in {0, 1, 2} and GRS.LoadType == 2 and GRS.nsAll.y[GRS.nbn[i]] <= 0) \
                or (GRS.GeomType in {4} and GRS.LoadType == 1 and GRS.nsAll.x[GRS.nbn[i]] <= GRS.span / 2) \
                or (GRS.GeomType in {4} and GRS.LoadType == 2 and GRS.nsAll.y[GRS.nbn[i]] <= GRS.span / 2):
            ops.load(int(100 + GRS.nbn[i]), 0., 0., Fz * un.kN, 0., 0., 0.)
    GRS.GetTopNode()
    # ops.load(int(100+GRS.maxNsID), 0., 0., Fz * kN, 0., 0., 0.)  # mid-point

    # create SOE
    ops.system('UmfPack')
    # create DOF number
    ops.numberer('RCM')
    # create constraint handler
    ops.constraints('Transformation')
    # create test
    ops.test('EnergyIncr', 1.e-12, 10)
    # create algorithm
    ops.algorithm("Newton")

    NDisp = np.zeros([GRS.Steps + 1, GRS.nbNsAll, 3])
    # EDisp = np.zeros([GRS.Steps + 1, GRS.nbElAll, 6])
    EForce = np.zeros([GRS.Steps + 1, GRS.nbElAll, 12])
    reI=0

    reI = 0
    lefutott = 1
    i=0
    load = 0
    stepSize = 1.0 / GRS.Steps
    ops.integrator("LoadControl", stepSize)
    ops.analysis('Static')
    while ((-stepSize*Fz > GRS.MinStepSize) and (i<GRS.Steps)):
        hiba = ops.analyze(1)
        if hiba == 0:
            load += -stepSize * Fz
            i += 1
            loadA[i] = load
            if i == 1:
                if printOn: print('analysis step 1 completed successfully')
            for j in range(GRS.nbNsAll):
                NDisp[i, j, 0] = - ops.nodeDisp(int(j + 100), 1) / un.mm  # mm displacement
                NDisp[i, j, 1] = - ops.nodeDisp(int(j + 100), 2) / un.mm  # mm displacement
                NDisp[i, j, 2] = - ops.nodeDisp(int(j + 100), 3) / un.mm  # mm displacement
            for j in range(GRS.nbElAll):
                EForce[i, j] = ops.eleResponse(int(j+1000), 'localForce')
                # EDisp[i, j] = ops.eleResponse(int(j + 1000), 'basicDeformation')
        else:
            stepSize = stepSize/2
            if printOn: print('analysis failed to converge in step ', i)
            ops.integrator("LoadControl", stepSize)
            lefutott = 0
            reI = i

    if i == GRS.Steps:
        if reI == 1:
            if printOn: print('analysis failed to converge')

    return lefutott, NDisp, EForce, loadA, reI
Beispiel #24
0
ops.constraints("Plain")

# create the convergence test
ops.test("EnergyIncr", 1.0E-12, 10)

# create the solution algorithm, a Newton-Raphson algorithm
ops.algorithm("Newton")

# create the load control with variable load steps
ops.integrator("LoadControl", 1.0, 1, 1.0, 10.0)

# create the analysis object
ops.analysis("Static")

# Perform the analysis
ops.analyze(10)

# --------------------------
# End of static analysis
# --------------------------

# ----------------------------
# Start of recorder generation
# ----------------------------

ops.recorder("Node", "-file", "Node.out", "-time", "-node", l1, "-dof", 2,
             "disp")
#ops.recorder("plot", "Node.out", "CenterNodeDisp", 625, 10, 625, 450, "-columns", 1, 2)

# create the display
#ops.recorder("display", g3, 10, 10, 800, 200, "-wipe")
Beispiel #25
0
ops.integrator("LoadControl", 0.1)

# create the analysis object 
ops.analysis("Static")

# ------------------------------
# End of analysis generation
# ------------------------------


# ------------------------------
# Finally perform the analysis
# ------------------------------

# perform the gravity load analysis, requires 10 steps to reach the load level
ops.analyze(10)

print("Gravity load analysis completed\n")

# Set the gravity loads to be constant & reset the time in the domain
ops.loadConst("-time", 0.0)

# ----------------------------------------------------
# End of Model Generation & Initial Gravity Analysis
# ----------------------------------------------------


# ----------------------------------------------------
# Start of additional modelling for lateral loads
# ----------------------------------------------------
Beispiel #26
0
# Create the convergence test, the norm of the residual with a tolerance of
# 1e-12 and a max number of iterations of 10
ops.test("NormDispIncr", 1.0E-12, 10, 3)

# create the solution algorithm, a Newton-Raphson algorithm
ops.algorithm("Newton")

# create the integration scheme, the LoadControl scheme using steps of 0.1
ops.integrator("LoadControl", 0.1)

# create the analysis object
ops.analysis("Static")

# ------------------------------
# End of analysis generation
# ------------------------------

# ------------------------------
# Finally perform the analysis
# ------------------------------

# perform the gravity load analysis, requires 10 steps to reach the load level
ops.analyze(10)

# Print out the state of nodes 3 and 4
ops.printModel("node", 3, 4)

# Print out the state of element 1
ops.printModel("ele", 1)
ops.wipe()
    ops.fix(2, 1, 1)
    ops.fix(3, 1, 1)
    ops.mass(4, 100.0, 100.0)

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

ops.constraints('Transformation')
ops.numberer('ParallelPlain')
ops.test('NormDispIncr', 1e-6, 6, 2)
ops.algorithm('Linear')
etype = 'central_difference'
etype = 'explicit_difference'  # Comment out this line to run with central difference
if etype == 'central_difference':
    ops.system('Mumps')
    ops.integrator('CentralDifference')
else:
    # ops.system('Mumps')
    ops.system(
        'MPIDiagonal')  # Can use Mumps here but not sure if it scales as well
    ops.integrator('ExplicitDifference')
ops.analysis('Transient')
for i in range(30):
    print(f'######################################## run {i} ##')
    ops.analyze(1, 0.000001)
print('PPP')
ops.analyze(20, 0.00001)

print(pid, ' Node 4: ', [ops.nodeCoord(4), ops.nodeDisp(4)])
print(pid, " COMPLETED")
Beispiel #28
0
# 1e-12 and a max number of iterations of 10
ops.test("NormDispIncr", 1.0E-12, 10, 3)

# create the solution algorithm, a Newton-Raphson algorithm
ops.algorithm("Newton")

# create the integration scheme, the LoadControl scheme using steps of 0.1
ops.integrator("LoadControl", 0.1)

# create the analysis object 
ops.analysis("Static")

# ------------------------------
# End of analysis generation
# ------------------------------


# ------------------------------
# Finally perform the analysis
# ------------------------------

# perform the gravity load analysis, requires 10 steps to reach the load level
ops.analyze(10)

# Print out the state of nodes 3 and 4
ops.printModel("node", 3, 4)

# Print out the state of element 1
ops.printModel("ele", 1)
ops.wipe()
Beispiel #29
0
print("Finished creating loading object...")

#----------------------------------------------------------
#  create the analysis
#----------------------------------------------------------
op.integrator('LoadControl', 0.05)
op.numberer('RCM')
op.system('SparseGeneral')
op.constraints('Transformation')
op.test('NormDispIncr', 1e-5, 20, 1)
op.algorithm('Newton')
op.analysis('Static')

print("Starting Load Application...")
op.analyze(201)

print("Load Application finished...")
#print("Loading Analysis execution time: [expr $endT-$startT] seconds.")

#op.wipe

op.reactions()
Nodereactions = dict()
Nodedisplacements = dict()
for i in range(201,nodeTag+1):
    Nodereactions[i] = op.nodeReaction(i)
    Nodedisplacements[i] = op.nodeDisp(i)
print('Node Reactions are: ', Nodereactions)    
print('Node Displacements are: ', Nodedisplacements)