def plot_deformed_shape(self,
                            xlim,
                            ylim,
                            scale=1,
                            arrow_len=10,
                            arrow_width=2,
                            save=''):
        '''
        Plot deformed shape of the model.
        
        Args:
            xlim: A list of left and right limits of the x axis.
            ylim: A list of bottom and top limits of the y axis.
            scale: A float scale of the displayed deformations (default=1).
            arrow_len: An integer length of the load arrows displayed 
                (default=10).
            arrow_width: An integer head width of the load arrows displayed 
                (default=2).
            save: A string indicating save path for the figure (default='',
                meaning that the figure will NOT be saved by default).
        '''

        fig, ax = plt.subplots(dpi=75)
        ax.set_axis_off()
        ax.grid(True, which='both', alpha=0.5)
        ax.axhline(y=0, color='k', lw=1)

        opsv.plot_defo(scale, fmt_undefo='k-', fmt_interp='k--')

        ax.axis('equal')
        ax.set(xlim=xlim, ylim=ylim)

        node_list = ops.getNodeTags()
        node_disp = np.array([ops.nodeDisp(n) for n in node_list])
        node_coord = np.array([ops.nodeCoord(n) for n in node_list])
        new_coord = node_disp[:, :-1] * scale + node_coord

        for node, Px, Py, M in self.loads:
            c = new_coord[node_list.index(node), :]
            ax.annotate('',
                        xytext=(c[0] + abs(Px) * arrow_len,
                                c[1] + abs(Py) * arrow_len),
                        xy=(c[0], c[1]),
                        arrowprops=dict(arrowstyle=f'-|>, \
                                          head_width={arrow_width/5},\
                                          head_length={arrow_width/2}',
                                        lw=arrow_width,
                                        fc='orangered',
                                        ec='orangered'))
        if save:
            fig.savefig(save, transparent=True)
        plt.show()
Exemplo n.º 2
0
tf = 0.2 * s
fr = 10 * Hz
prd = 1 / fr
ops.timeSeries('Trig', 1, ti, tf, prd)
# https://openseespydoc.readthedocs.io/en/latest/src/pathTs.html
ops.pattern('UniformExcitation', 1, 1, '-accel', 1)
# https://openseespydoc.readthedocs.io/en/latest/src/uniformExcitation.html

# amortiguamiento de rayleigh
ops.rayleigh(*setRayParam(0.05, 0.05, 0.2, 20))

# analysis commands
ops.constraints('Plain')
ops.numberer('Plain')
ops.system('UmfPack')
ops.algorithm('Linear')
ops.integrator('Newmark', 0.5, 0.25)
ops.analysis('Transient')

# analisis
# ops.analyze(400,0.001)
ops.start()
for i in range(400):
    ops.analyze(1, 0.001)
    print(i)
ops.stop()

# Grafico de la deformada
fig = plt.figure(figsize=(25, 5))
opsv.plot_defo(500)
plt.show()
Exemplo n.º 3
0
ops.timeSeries('Linear', 1)
ops.pattern('Plain', 1, 1)
ops.load(15, 0., -1.)

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

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

# - plot deformation
plt.figure()
opsv.plot_defo()
# opsv.plot_defo(sfac, unDefoFlag=1, fmt_undefo='g:')
plt.axis('equal')

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

# - visu stress map

# !!! select from sig_out: e.g. vmises
# j, jstr = 0, 'sxx'
# j, jstr = 1, 'syy'
# j, jstr = 2, 'sxy'
j, jstr = 3, 'vmis'
# j, jstr = 4, 's1'
Exemplo n.º 4
0
ops.fix(4,*[1,1,1,1,1,1])

# definir cargas (Neumann)
ops.timeSeries('Linear',1)
ops.pattern('Plain',1,1)
ops.load(2,0.0,-100.0,0.0,0.0,0.0,0.0)

fig = plt.figure(figsize=(4,4))
opsv.plot_model()
#plt.show()

ops.system('FullGeneral')
ops.numberer('Plain')
ops.constraints('Plain')
ops.integrator('LoadControl',1)
ops.algorithm('Linear')
ops.analysis('Static')
ops.analyze(1)

# Desplazamiento
disp = ops.nodeDisp(2)
print(disp)

# Fuerzas Internas
forceEle = ops.eleForce(1)
print(forceEle)

# Grafico de la deformada
fig = plt.figure(figsize=(4,4))
opsv.plot_defo(200)
plt.show()
Exemplo n.º 5
0
szer, wys = 16., 10.

fig = plt.figure(figsize=(szer/2.54, wys/2.54))
fig.subplots_adjust(left=.08, bottom=.08, right=.985, top=.94)
ax1 = plt.subplot(111)

opsv.plot_model()

# 2. plot deformed model

sfac = 80.

plt.figure()
# opsv.plot_defo(sfac)
opsv.plot_defo(sfac, fmt_interp='b.-')
opsv.plot_defo(sfac, 5, interpFlag=0, fmt_nodes='bo-')
opsv.plot_defo(sfac, 3, endDispFlag=0, fmt_interp='r.--')
opsv.plot_defo(sfac, 2, fmt_interp='g.-')

# 3. plot N, V, M forces diagrams

sfacN, sfacV, sfacM = 5.e-5, 5.e-5, 5.e-5

plt.figure()
minVal, maxVal = opsv.section_force_diagram_2d('N', Ew, sfacN)
plt.title(f'Axial forces, max = {maxVal:.2f}, min = {minVal:.2f}')

plt.figure()
minVal, maxVal = opsv.section_force_diagram_2d('T', Ew, sfacV)
plt.title(f'Shear forces, max = {maxVal:.2f}, min = {minVal:.2f}')
Exemplo n.º 6
0
ops.mesh('line', 3, 2, 3, 4, 1, 2, 0.25)
ops.mesh('line', 4, 2, 4, 1, 1, 2, 0.25)
ops.mesh('quad', 5, 4, 1, 2, 3, 4, 1, 2, 0.25, *eleArgs)

fig = plt.figure(figsize=(4, 4))
opsv.plot_model()
plt.show()

# condiciones de frontera
ops.fixX(0.0, *[1, 1], '-tol', 1e-10)

ops.timeSeries('Linear', 1)
ops.pattern('Plain', 1, 1)
fx = 0
fy = -10000
ops.load(2, *[fx, fy])
ops.load(3, *[fx, fy])
ops.load(24, *[fx, fy])

ops.system('FullGeneral')
ops.numberer('Plain')
ops.constraints('Plain')
ops.integrator('LoadControl', 1)
ops.algorithm('Linear')
ops.analysis('Static')
ops.analyze(1)

# Grafico de la deformada
fig = plt.figure(figsize=(25, 5))
opsv.plot_defo(2)
plt.show()