Esempio n. 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)
Esempio n. 2
0
ops.patch("rect", 2, 10, 1, -y1, -z1, y1, cover-z1)
ops.patch("rect", 2,  2, 1, -y1, cover-z1, cover-y1, z1-cover)
ops.patch("rect", 2,  2, 1,  y1-cover, cover-z1, y1, z1-cover)
# Create the reinforcing fibers (left, middle, right)
ops.layer("straight", 3, 3, As, y1-cover, z1-cover, y1-cover, cover-z1)
ops.layer("straight", 3, 2, As, 0.0, z1-cover, 0.0, cover-z1)
ops.layer("straight", 3, 3, As, cover-y1, z1-cover, cover-y1, cover-z1)
# define beam integration
np = 5;  # number of integration points along length of element
ops.beamIntegration("Lobatto", 1, 1, np)

# Define column elements
# ----------------------
# Geometry of column elements
#                       tag 
ops.geomTransf("PDelta", 1)

# Create the coulumns using Beam-column elements
#                   tag ndI ndJ transfTag integrationTag
eleType = "forceBeamColumn"
ops.element(eleType, 1, 1, 3, 1, 1)
ops.element(eleType, 2, 2, 4, 1, 1)

# Define beam element
# -----------------------------
# Geometry of column elements
#                tag 
ops.geomTransf("Linear", 2)

# Create the beam element
#                               tag ndI ndJ  A     E       Iz   transfTag
Esempio n. 3
0
ops.patch("rect", 2, 2, 1, -y1, cover - z1, cover - y1, z1 - cover)
ops.patch("rect", 2, 2, 1, y1 - cover, cover - z1, y1, z1 - cover)
# Create the reinforcing fibers (left, middle, right)
ops.layer("straight", 3, 3, As, y1 - cover, z1 - cover, y1 - cover, cover - z1)
ops.layer("straight", 3, 2, As, 0.0, z1 - cover, 0.0, cover - z1)
ops.layer("straight", 3, 3, As, cover - y1, z1 - cover, cover - y1, cover - z1)
# define beam integration
np = 5
# number of integration points along length of element
ops.beamIntegration("Lobatto", 1, 1, np)

# Define column elements
# ----------------------
# Geometry of column elements
#                       tag
ops.geomTransf("PDelta", 1)

# Create the coulumns using Beam-column elements
#                   tag ndI ndJ transfTag integrationTag
eleType = "forceBeamColumn"
ops.element(eleType, 1, 1, 3, 1, 1)
ops.element(eleType, 2, 2, 4, 1, 1)

# Define beam element
# -----------------------------
# Geometry of column elements
#                tag
ops.geomTransf("Linear", 2)

# Create the beam element
#                               tag ndI ndJ  A     E       Iz   transfTag
# zero-length interfac elements
#----------------------------------------------------------
eleTag = 1
node1 = 5
node2 = 1
op.element('zeroLength', eleTag, node1, node2, '-mat', 1, '-dir', 2)
eleTag = 2
node1 = 4
node2 = 2
op.element('zeroLength', eleTag, node1, node2, '-mat', 2, '-dir', 2)

#----------------------------------------------------------
# create pile elements
#----------------------------------------------------------
transfTag = 1
op.geomTransf('Linear', transfTag)
#geometry transformation
eleTag = 3
node1 = 1
node2 = 2
op.element('elasticBeamColumn', eleTag, node1, node2, A, E, Iz, transfTag)
eleTag = 4
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
Esempio n. 5
0
h = 18.0
GJ = 1.0E10
colSec = 1

# Call the RCsection procedure to generate the column section
#                        id  h  b cover core cover steel nBars barArea nfCoreY nfCoreZ nfCoverY nfCoverZ GJ
RCsection.create(ops, colSec, h, h, 2.5, 1,    2,    3,    3,   0.79,     8,      8,      10,      10,   GJ)

# Define column elements
# ----------------------
PDelta = "OFF"
#PDelta = "ON"

# Geometric transformation for columns
if (PDelta == "OFF"):
   ops.geomTransf("Linear", 1, 1.0, 0.0, 0.0)
else:
   ops.geomTransf("PDelta", 1, 1.0, 0.0, 0.0)

# Number of column integration points (sections)
np = 4
ops.beamIntegration("Lobatto", colSec, colSec, np)

# Create the nonlinear column elements
eleType = "forceBeamColumn"
#                   tag ndI ndJ transfTag integrationTag
ops.element(eleType, 1, 1, 5, 1, colSec)
ops.element(eleType, 2, 2, 6, 1, colSec)
ops.element(eleType, 3, 3, 7, 1, colSec)
ops.element(eleType, 4, 4, 8, 1, colSec)
Esempio n. 6
0
ops.layer("straight", 3, 6, 0.79,  9.0, 9.0,  9.0, -9.0)
# define beam integration
ops.beamIntegration("Lobatto", 2, 2, np)

# Girder section
ops.section("Fiber", 3)
ops.patch("quad", 1, 1, 12, -12.0, 9.0, -12.0, -9.0, 12.0, -9.0, 12.0, 9.0)
ops.layer("straight", 3, 4, 1.0, -9.0, 9.0, -9.0, -9.0)
ops.layer("straight", 3, 4, 1.0,  9.0, 9.0,  9.0, -9.0)
# define beam integration
ops.beamIntegration("Lobatto", 3, 3, np)

# Define column elements
# ----------------------
# Geometric transformation
ops.geomTransf("Linear", 1)

beamID = 1
eleType = "forceBeamColumn"

# Define elements
for i in range(numBay+1):
    # set some parameters
    iNode = i*3 + 1
    jNode = i*3 + 2

    for j in range(1, 3):
        # add the column element (secId == 2 if external, 1 if internal column)
        if (i == 0):
            ops.element(eleType, beamID, iNode, jNode, 1, 2)
        elif (i == numBay):
Esempio n. 7
0
ops.fix(4, 1, 1, 1)

E = 30000.0
Ag = 25.0
Ig = 1500.0
Ac = 29.0
Ic = 2000.0

gsecTag = 1
ops.section("Elastic", gsecTag, E, Ag, Ig)

csecTag = 2
ops.section("Elastic", csecTag, E, Ac, Ic)

transfTag = 1
ops.geomTransf("Linear", transfTag)

N = 3

gbiTag = 1
ops.beamIntegration("Lobatto", gbiTag, gsecTag, N)
cbiTag = 2
ops.beamIntegration("Lobatto", cbiTag, csecTag, N)

leftColTag = 1
ops.element("forceBeamColumn", leftColTag, 1, 2, transfTag, cbiTag)
girderTag = 2
ops.element("forceBeamColumn", girderTag, 2, 3, transfTag, gbiTag)
rightColTag = 3
ops.element("forceBeamColumn", rightColTag, 3, 4, transfTag, cbiTag)
Esempio n. 8
0
#----------------------------------------------------------
#  create pile nodes
#----------------------------------------------------------

# pile nodes created with 3 dimensions, 6 degrees of freedom
op.model('basic', '-ndm', 3, '-ndf', 6) 

# create pile nodes
for i in range(1, nNodePile+1):
    zCoord = eleSize * i
    op.node(i+200, 0.0, 0.0, zCoord)

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

# create coordinate-transformation object
op.geomTransf('Linear', 1, 0.0, -1.0, 0.0)


# create fixity at pile head (location of loading)
op.fix(200+nNodePile, 0, 1, 0, 1, 0, 1)


# create fixities for remaining pile nodes
for i in range(201, 200+nNodePile): 
    op.fix(i, 0, 1, 0, 1, 0, 1)
    
print("Finished creating all pile node fixities...")

#----------------------------------------------------------
#  define equal dof between pile and spring nodes
#----------------------------------------------------------
Esempio n. 9
0
def BuildOpsModel(GRS):
    ops.wipe()
    ops.model('BasicBuilder', '-ndm', 3, '-ndf', 6)

    # material
    matID = 66
    matID1 = 67
    sY = 235. * un.MPa
    if GRS.MatNL == False:
        ops.uniaxialMaterial('Elastic', matID, GRS.Es)
    else:
        ops.uniaxialMaterial('Steel4', matID1, sY, GRS.Es, '-kin', 4e-3, 50., 0.05, 0.15, '-ult', 360.* un.MPa, 5., )
        ops.uniaxialMaterial('MinMax', matID, matID1, '-min', -0.20, '-max', 0.20)

        #ops.uniaxialMaterial('Steel4', matID, sY, GRS.Es, '-kin', 1e-2, 50., 0.05, 0.15, '-ult', 360.* un.MPa, 10., )
        #ops.uniaxialMaterial('Steel4', matID, sY, GRS.Es, '-kin', 1e-2, 50., 0.05, 0.15)
        #ops.uniaxialMaterial('ElasticBilin', matID, GRS.Es, 210. * 1e7, sY / GRS.Es)
        #ops.uniaxialMaterial('ElasticBilin', matID, GRS.Es, 210. * 1e6, sY / GRS.Es)
        #ops.uniaxialMaterial('ElasticBilin', matID, GRS.Es, 1., sY / GRS.Es) #Oldalnyomasos igy futott le

    # cross-section
    CHSid = 99
    CHSSection(CHSid, matID, GRS.secD, GRS.secT, 8, 1, GRS.Gs*GRS.secIt)

    # nodes
    for i in range(GRS.nbNsAll):
        ops.node(int(100+i), GRS.nsAll.x[i], GRS.nsAll.y[i], GRS.nsAll.z[i])

    #  ...create zeroLength element nodes...

    # end supports
    if GRS.SupType==0: # all boundary points fixed for deformations
        for i in range(GRS.nbBns):
            ops.fix(100+GRS.bn[i], 1, 1, 1, 0, 0, 0)
    elif GRS.SupType == 1: # oldalnyomasos
        for i in range(len(GRS.bnX)):
            ops.fix(100+GRS.bnX[i], 1, 0, 1, 0, 0, 0)
        for i in range(len(GRS.bnY)):
            ops.fix(100+GRS.bnY[i], 0, 1, 1, 0, 0, 0)
        for i in range(len(GRS.bnC)):
            ops.fix(100+GRS.bnC[i], 1, 1, 1, 0, 0, 0)
    elif GRS.SupType == 2: # oldalnyomasmentes
        for i in range(len(GRS.bnX)):
            ops.fix(100+GRS.bnX[i], 0, 0, 1, 0, 0, 0)
        for i in range(len(GRS.bnY)):
            ops.fix(100+GRS.bnY[i], 0, 0, 1, 0, 0, 0)
        #for i in range(len(GRS.bnC)):
        #    ops.fix(100+GRS.bnC[i], 1, 1, 1, 0, 0, 0)
        ops.fix(100 + GRS.bnC[0], 1, 1, 1, 0, 0, 0)
        ops.fix(100 + GRS.bnC[1], 0, 0, 1, 0, 0, 0)
        ops.fix(100 + GRS.bnC[2], 1, 0, 1, 0, 0, 0)
        ops.fix(100 + GRS.bnC[3], 0, 0, 1, 0, 0, 0)
    elif GRS.SupType == 3: # felmerev #NOT WORKING YET
        pass
    elif GRS.SupType == 4: # sarkok
        for i in range(len(GRS.bnC)):
            ops.fix(100+GRS.bnC[i], 1, 1, 1, 0, 0, 0)
    elif GRS.SupType == 5:  # dome oldalnyomasos
        for i in range(GRS.nbBns):
            if i==0: ops.fix(100+GRS.bn[i], 1, 1, 1, 0, 0, 0)
            elif i==10: ops.fix(100+GRS.bn[i], 0, 1, 1, 0, 0, 0)
            else: ops.fix(100+GRS.bn[i], 0, 0, 1, 0, 0, 0)
    elif GRS.SupType == 6:  # dome #NOT WORKING YET
        pass

    # transformations
    TRtag = 55
    if GRS.GeomNL == 1:
        TRType = 'Corotational'
        ops.geomTransf('Corotational', TRtag, 0., 0., 1.)
    else:
        TRType = 'Linear'
        ops.geomTransf('Linear', TRtag, 0., 0., 1.)

    # integration points
    gauss = 5
    beamIntTag=44
    ops.beamIntegration('Lobatto', beamIntTag, CHSid, gauss)

    # create elements
    for i in range(GRS.nbElAll):
        sID = GRS.lsAll.sID[i]
        eID = GRS.lsAll.eID[i]
        dx = abs(GRS.nsAll.x[sID] - GRS.nsAll.x[eID])
        dy = abs(GRS.nsAll.y[sID] - GRS.nsAll.y[eID])
        dz = abs(GRS.nsAll.z[sID] - GRS.nsAll.z[eID])
        if dx+dy+dz == 0:
            ops.equalDOF(eID, sID, 1,2,3,4,5,6)  # Grasshopper geomType=4 Zero length elements - should not come here
        else:
            ops.element('forceBeamColumn', int(1000 + i), int(100+sID), int(100+eID), TRtag, beamIntTag)
Esempio n. 10
0
ops.layer("straight", 3, 6, 0.79, 9.0, 9.0, 9.0, -9.0)
# define beam integration
ops.beamIntegration("Lobatto", 2, 2, np)

# Girder section
ops.section("Fiber", 3)
ops.patch("quad", 1, 1, 12, -12.0, 9.0, -12.0, -9.0, 12.0, -9.0, 12.0, 9.0)
ops.layer("straight", 3, 4, 1.0, -9.0, 9.0, -9.0, -9.0)
ops.layer("straight", 3, 4, 1.0, 9.0, 9.0, 9.0, -9.0)
# define beam integration
ops.beamIntegration("Lobatto", 3, 3, np)

# Define column elements
# ----------------------
# Geometric transformation
ops.geomTransf("Linear", 1)

beamID = 1
eleType = "forceBeamColumn"

# Define elements
for i in range(numBay + 1):
    # set some parameters
    iNode = i * 3 + 1
    jNode = i * 3 + 2

    for j in range(1, 3):
        # add the column element (secId == 2 if external, 1 if internal column)
        if (i == 0):
            ops.element(eleType, beamID, iNode, jNode, 1, 2)
        elif (i == numBay):
ops.node(4, Lx, Ly, Lz)

ops.fix(1, 1, 1, 1, 1, 1, 1)

lmass = 200.

ops.mass(2, lmass, lmass, lmass, 0.001, 0.001, 0.001)
ops.mass(3, lmass, lmass, lmass, 0.001, 0.001, 0.001)
ops.mass(4, lmass, lmass, lmass, 0.001, 0.001, 0.001)

gTTagz = 1
gTTagx = 2
gTTagy = 3

coordTransf = 'Linear'
ops.geomTransf(coordTransf, gTTagz, 0., -1., 0.)
ops.geomTransf(coordTransf, gTTagx, 0., -1., 0.)
ops.geomTransf(coordTransf, gTTagy, 1., 0., 0.)

ops.element('elasticBeamColumn', 1, 1, 2, A, E, G, J, Iy, Iz, gTTagz)
ops.element('elasticBeamColumn', 2, 2, 3, A, E, G, J, Iy, Iz, gTTagx)
ops.element('elasticBeamColumn', 3, 3, 4, A, E, G, J, Iy, Iz, gTTagy)

Ew = {}

Px = -4.e1
Py = -2.5e1
Pz = -3.e1

ops.timeSeries('Constant', 1)
ops.pattern('Plain', 1, 1)
Esempio n. 12
0
h = 18.0
GJ = 1.0E10
colSec = 1

# Call the RCsection procedure to generate the column section
#                        id  h  b cover core cover steel nBars barArea nfCoreY nfCoreZ nfCoverY nfCoverZ GJ
RCsection.create(ops, colSec, h, h, 2.5, 1, 2, 3, 3, 0.79, 8, 8, 10, 10, GJ)

# Define column elements
# ----------------------
PDelta = "OFF"
#PDelta = "ON"

# Geometric transformation for columns
if (PDelta == "OFF"):
    ops.geomTransf("Linear", 1, 1.0, 0.0, 0.0)
else:
    ops.geomTransf("PDelta", 1, 1.0, 0.0, 0.0)

# Number of column integration points (sections)
np = 4
ops.beamIntegration("Lobatto", colSec, colSec, np)

# Create the nonlinear column elements
eleType = "forceBeamColumn"
#                   tag ndI ndJ transfTag integrationTag
ops.element(eleType, 1, 1, 5, 1, colSec)
ops.element(eleType, 2, 2, 6, 1, colSec)
ops.element(eleType, 3, 3, 7, 1, colSec)
ops.element(eleType, 4, 4, 8, 1, colSec)