Пример #1
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)
Пример #2
0
ops.integrator("LoadControl", 1.0)

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

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


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

# 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
Пример #3
0
# zero-length element
eleTag = 1
node1 = 1
node2 = 2
op.element('zeroLength', eleTag, node1, node2, '-mat', 1, '-dir', 1)
eleTag = 2
node1 = 1
node2 = 2
op.element('zeroLength', eleTag, node1, node2, '-mat', 2, '-dir', 2)

# update the materials
op.updateMaterialStage('-material', 1, '-stage', 1)
op.updateMaterialStage('-material', 2, '-stage', 1)

# record element
op.recorder('Element', '-file', 'TZ1_Liq.txt', '-time', '-ele', 2, 'force')
# record nodes
op.recorder('Node', '-file', 'Node_Disp_Liq.txt', '-time', '-node', 1, '-dof',
            2, 'disp')

# define the movement time series data
Movement = np.array([
    0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
    0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.001,
    0.002, 0.003, 0.003, 0.004, 0.005, 0.006, 0.007, 0.009, 0.010, 0.012,
    0.014, 0.016, 0.018, 0.019, 0.021, 0.023, 0.026, 0.030, 0.034, 0.039,
    0.044, 0.051, 0.059, 0.069, 0.080, 0.089, 0.098, 0.120, 0.152, 0.203
])
Movement_Time = np.linspace(0, 30, len(Movement))
seriesTag = 2
op.timeSeries('Path', seriesTag, '-time', *Movement_Time, '-values', *Movement,
Пример #4
0
ops.integrator("Newmark", 0.5, 0.25) 

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

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


# ----------------------------
# 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
Пример #5
0
           '-dir', 1)

print("Finished creating dashpot material and element...")

#-----------------------------------------------------------------------------------------
#  7. CREATE GRAVITY RECORDERS
#-----------------------------------------------------------------------------------------

# create list for pore pressure nodes
load_nodeList3 = np.loadtxt('Node_record.txt')
nodeList3 = []

for i in range(len(load_nodeList3)):
    nodeList3.append(np.int(load_nodeList3[i]))
# record nodal displacment, acceleration, and porepressure
op.recorder('Node', '-file', 'Gdisplacement.txt', '-time', '-node', *nodeList3,
            '-dof', 1, 2, 'disp')
op.recorder('Node', '-file', 'Gacceleration.txt', '-time', '-node', *nodeList3,
            '-dof', 1, 2, 'accel')
op.recorder('Node', '-file', 'GporePressure.txt', '-time', '-node', *nodeList3,
            '-dof', 3, 'vel')

# record elemental stress and strain (files are names to reflect GiD gp numbering)
op.recorder('Element', '-file', 'Gstress1.txt', '-time', '-eleRange', 1,
            nElemT, 'material', '1', 'stress')
op.recorder('Element', '-file', 'Gstress2.txt', '-time', '-eleRange', 1,
            nElemT, 'material', '2', 'stress')
op.recorder('Element', '-file', 'Gstress3.txt', '-time', '-eleRange', 1,
            nElemT, 'material', '3', 'stress')
op.recorder('Element', '-file', 'Gstress4.txt', '-time', '-eleRange', 1,
            nElemT, 'material', '4', 'stress')
op.recorder('Element', '-file', 'Gstress9.txt', '-time', '-eleRange', 1,
Пример #6
0
# 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")
#prp -0 0 1000
#vup 0 1 0 
#display 2 4 100

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


# ---------------------------------------
# Create and Perform the dynamic analysis
Пример #7
0
# Reference lateral load for pushover analysis
H = 10.0

# Set lateral load pattern with a Linear TimeSeries
ops.pattern("Plain", 2, 1, "-fact", 1.0)
ops.load(2, H/2.0, 0.0, 0.0)
ops.load(3, H,     0.0, 0.0)


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

# Create a recorder which writes to Node.out and prints
# the current load factor (pseudo-time) and dof 1 displacements at node 2 & 3
ops.recorder("Node", "-file", "Node41.out", "-time", "-node", 2, 3, "-dof", 1, "disp")

# Source in some commands to display the model
# comment out one of lines
#displayMode = "displayON"
displayMode = "displayOFF"

if (displayMode == "displayON"):  
    # a window to plot the nodal displacements versus load for node 3  
    ops.recorder("plot", "Node41.out", "Node_3_Xdisp", 10, 340, 300, 300, "-columns", 3, 1, "-dT", 0.1)

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

Пример #8
0
# 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
#ops.recorder("display", "VibratingBeam", 100, 40, 500, 500, "-wipe")
#prp -100 100 120.5
#vup 0 1 0 
#display 1 4 1 

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


# ---------------------------------------
Пример #9
0
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
op.recorder('Node', '-file', 'pileDisp.out','-time', '-dT', timeStep, '-nodeRange', 201, 200 + nNodePile, '-dof', 1,2,3, 'disp')

# record reaction force in the p-y springs
op.recorder('Node', '-file', 'reaction.out','-time', '-dT', timeStep, '-nodeRange', 1, nNodePile, '-dof', 1, 'reaction')

# record element forces in pile elements
op.recorder('Element', '-file', 'pileForce.out','-time', '-dT', timeStep, '-eleRange', 201, 200+nElePile, 'globalForce')

print("Finished creating all recorders...")

#----------------------------------------------------------
#  create the loading
#----------------------------------------------------------

op.setTime(10.0) 
Пример #10
0
# Change the integration scheme to be displacement control
#                                    node dof init Jd min max
ops.integrator("DisplacementControl", 3, 1, dU, 1, dU, dU)

# ----------------------------------------------------
# End of modifications to analysis for push over
# ----------------------------------------------------


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

# Create a recorder to monitor nodal displacements
ops.recorder("Node", "-file", "node32.out", "-time", "-node", 3, 4, "-dof", 1, 2, 3, "disp")
#recorder plot node32.out hi 10 10 300 300 -columns 2 1

# Create a recorder to monitor element forces in columns
ops.recorder("EnvelopeElement", "-file", "ele32.out", "-time", "-ele", 1, 2, "localForce")

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


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

# record once at time 0
Пример #11
0
# Reference lateral load for pushover analysis
H = 10.0

# Set lateral load pattern with a Linear TimeSeries
ops.pattern("Plain", 2, 1, "-fact", 1.0)
ops.load(2, H / 2.0, 0.0, 0.0)
ops.load(3, H, 0.0, 0.0)

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

# Create a recorder which writes to Node.out and prints
# the current load factor (pseudo-time) and dof 1 displacements at node 2 & 3
ops.recorder("Node", "-file", "Node41.out", "-time", "-node", 2, 3, "-dof", 1,
             "disp")

# Source in some commands to display the model
# comment out one of lines
#displayMode = "displayON"
displayMode = "displayOFF"

if (displayMode == "displayON"):
    # a window to plot the nodal displacements versus load for node 3
    ops.recorder("plot", "Node41.out", "Node_3_Xdisp", 10, 340, 300, 300,
                 "-columns", 3, 1, "-dT", 0.1)

# ------------------------------
# End of recorder generation
# ------------------------------
Пример #12
0
ops.integrator("Newmark", 0.5, 0.25) 

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

# ---------------------------------------------------------
# End of modifications to analysis for transient analysis
# ---------------------------------------------------------


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

# Create a recorder to monitor nodal displacements
ops.recorder("Node", "-time", "-file", "disp.out", "-node", 3, 4, "-dof", 1, 2, 3, "disp")
ops.recorder("Node", "-time", "-file", "accel.out", "-node", 3, 4, "-dof", 1, 2, 3, "accel")
ops.recorder("Node", "-time", "-file", "totAccel.out", "-timeSeries", 2, 0, 0, "-node", 3, 4, "-dof", 1, 2, 3, "accel")

# Create recorders to monitor section forces and deformations
# at the base of the left column
ops.recorder("Element", "-time", "-file", "ele1secForce.out", "-ele", 1, "section", 1, "force")
ops.recorder("Element", "-time", "-file", "ele1secDef.out", "-ele", 1, "section", 1, "deformation")

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


# ------------------------------
# Finally perform the analysis
Пример #13
0
# create the integration scheme, the LoadControl scheme using steps of 1.0
ops.integrator("LoadControl", 1.0)

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

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

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

# 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
# ------------------------------
Пример #14
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)
Пример #15
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")
#prp 20 5.0 100.0
#vup 0 1 0
#viewWindow -30 30 -10 10
#display 1 4 5

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

# ---------------------------------------
# Create and Perform the dynamic analysis
Пример #16
0
# Displacement increment

# Change the integration scheme to be displacement control
#                                    node dof init Jd min max
ops.integrator("DisplacementControl", 3, 1, dU, 1, dU, dU)

# ----------------------------------------------------
# End of modifications to analysis for push over
# ----------------------------------------------------

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

# Create a recorder to monitor nodal displacements
ops.recorder("Node", "-file", "node32.out", "-time", "-node", 3, 4, "-dof", 1,
             2, 3, "disp")
#recorder plot node32.out hi 10 10 300 300 -columns 2 1

# Create a recorder to monitor element forces in columns
ops.recorder("EnvelopeElement", "-file", "ele32.out", "-time", "-ele", 1, 2,
             "localForce")

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

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

# record once at time 0
node1 = 2
node2 = 3
op.element('elasticBeamColumn', eleTag, node1, node2, A, E, Iz, transfTag)

#####################################
# Stage 1 : Apply Axial Load on Pile
#####################################
P = -200
Total_Time = 1.0
timeStep = 0.01
NumSteps = int(Total_Time / timeStep)

#----------------------------------------------------------
# record element forces and node displacements
#----------------------------------------------------------
op.recorder('Element', '-file', 'QZ_Forces_Liq.txt', '-time', '-ele', 1,
            'force')
op.recorder('Element', '-file', 'TZ_Forces_Liq.txt', '-time', '-ele', 2,
            'force')
op.recorder('Element', '-file', 'Pile_Forces_Liq.txt', '-time', '-ele', 3, 4,
            'force')
op.recorder('Node', '-file', 'Pile_Disp_Liq.txt', '-time', '-node', 1, 2, 3,
            '-dof', 2, 'disp')

# create time series
seriesTag = seriesTag + 1
op.timeSeries("Linear", seriesTag)

# create a plain load pattern
patternTag = 1
op.pattern("Plain", patternTag, seriesTag)
Пример #18
0
# create the integration scheme, the Newmark with gamma=0.5 and beta=0.25
ops.integrator("Newmark", 0.5, 0.25)

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

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

# ----------------------------
# 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