Ejemplo n.º 1
0
def main():

    truss = Domain(3,3,'test03')

    truss.add_mat(Material1D.Material_Elastic,1,2.e5)
    truss.add_sec(Section.Elastic_Truss,1,truss.mat[1],100.)

    L = 1000.0
    mass = [200.,200.,200.]
    truss.add_node(1,(0.0,0.,0.),mass)
    truss.add_node(2,(L  ,0.,0.),mass)
    
    truss.add_refpoint(1,(1.,1.,0.))
        
    truss.add_ele(Element.Truss3D,1,truss.sec[1],(truss.node[1],truss.node[2]),truss.refp[1])
    F = -4.e4*np.linspace(0.1,1,10)
    truss.add_load(1,truss.node[2],[1],[F])

    truss.add_cons(1,truss.node[1],[1,2,3],[0.0,0.0,0.0])
    truss.add_cons(2,truss.node[2],[2,3],[0.0,0.0])

    truss.build_model()
    truss.apply_cons(0)

    analyse = Analysis.Analysis_Eigen(truss)
    analyse.execute(1)
    analyse = Analysis.Analysis_Linear_Static(truss)
    analyse.execute(10)
    
    return truss
Ejemplo n.º 2
0
def main():

    truss = Domain(2,2,'test01')

    truss.add_mat(Material1D.Material_Elastic,1,2.e5)
    truss.add_sec(Section.Elastic_Truss,1,truss.mat[1],100.)

    L = 1000.0
    mass = [200.,200.,0.]
    
    truss.add_node(1,(0.0,0.,0.),mass)
    truss.add_node(2,(L  ,0.,0.),mass)
        
    truss.add_ele(Element.Truss2D,1,truss.sec[1],(truss.node[1],truss.node[2]))
    F = -4.e4*np.linspace(0.1,1,10)
    truss.add_load(1,truss.node[2],[1],[F])

    truss.add_cons(1,truss.node[1],[1,2],[0.0,0.0])
    truss.add_cons(2,truss.node[2],[2],[0.0])

    truss.build_model()
    truss.apply_cons(0)

    analyse = Analysis.Analysis_Eigen(truss)
    analyse.execute(1)
    analyse = Analysis.Analysis_Linear_Static(truss)
    analyse.execute(10)

    print 'T = ',truss.T[0],'s.'
    print 'Element Disp = ',truss.ele[1].local_deformation[0],'mm.'
    
    return truss
Ejemplo n.º 3
0
def main():

    frame = Domain(2,3,'test06')

    frame.add_mat(Material1D.Material_Elastic,1,2.e5)

    b = 200.
    h = 400.
    A = b*h
    I = b*h**3/12.
    frame.add_sec(Section.Elastic_Frame2D,1,frame.mat[1],A,I)

    L = 3000.0
    nmass = [200.0,200.0,0.0]
    
    frame.add_node(1,(0.0,0.,0.),nmass)
    frame.add_node(2,(L  ,0.,0.),nmass)

    frame.add_ele(Element.Frame2D_Elastic,1,frame.sec[1],(frame.node[1],frame.node[2]))

    t = np.linspace(0.1,1,10)
    F1 = -10.e3*t
    
    # F1 = -8.e3*np.sin(2.*np.pi/4.*t)
    # F2 = -6.e3*np.sin(2.*np.pi/4.*t)

    frame.add_load(1,frame.node[2],[2],[F1],t-.1)
    frame.add_cons(1,frame.node[1],[1,2,3],[0.0,0.0,0.0])

    frame.build_model()
    # frame.apply_cons(0)

    # analyse = Analysis.Analysis_Linear_Eigen(frame)
    # analyse.execute(1)

    analyse = Analysis.Analysis_Linear_Static(frame)
    # analyse = Analysis.Analysis_NonLinear_Static(frame)
    analyse.execute(len(t))
    
    u = F1*L**3/2.e5/I/3.
    
    print '            Disp          Moment'
    print 'nsapy    %.6f    %.6f'%(frame.U[-2], -frame.UF[2])
    print 'Theory   %.6f    %.6f'%( u[-1], F1[-1]*L)
    
    return frame
Ejemplo n.º 4
0
def main():

    truss = Domain(2,2,'test04')

    truss.add_mat(Material1D.Bilinear,1,2.e5,200.,0.02)
    truss.add_sec(Section.Truss,1,truss.mat[1],100.)

    L = 1000.0
    mass = [200.,200.,1e-9]
    
    truss.add_node(1,(0.0,0.,0.),mass)
    truss.add_node(2,(L  ,0.,0.),mass)
    
    truss.add_ele(Element.Truss2D,1,truss.sec[1],(truss.node[1],truss.node[2]))
    dt = 0.01
    t = np.linspace(dt,1.,int(1./dt))
    F = -2.e4*1.2*np.sin(2.*np.pi/1.*t)
    truss.add_load(1,truss.node[2],[1],[F],t)

    truss.add_cons(1,truss.node[1],[1,2],[0.0,0.0])
    truss.add_cons(2,truss.node[2],[2],[0.0])

    truss.build_model()
    # truss.apply_cons(0)
    # analyse = Analysis.Analysis_Eigen(truss)
    # analyse.execute(1)
    
    analyse = Analysis.Analysis_NonLinear_Static(truss)
    disp = NodeResult(truss,2,'deformation',1)
    react = NodeResult(truss,1,'reaction',1)
    analyse.results.append(disp)
    analyse.results.append(react)

    analyse.execute(len(F))

    # print 'T = ',truss.T[0],'s.'
    plot(disp.values,react.values,'-o');grid(1)
    show()

    return truss
Ejemplo n.º 5
0
Archivo: test.py Proyecto: nsapy/nsapy
def main():

    truss = Domain(2,2)

    truss.add_mat(Material1D.Material_Elastic,1,1.)
    truss.add_sec(Section.Section_Elastic,1,truss.mat[1],1.)

    d = 1000.0

    for i in range(7):
        truss.add_node(11+i,(i*d,0,0),1.)
        truss.add_node(21+i,(i*d,d,0),1.)
        truss.add_ele(Element.Truss2D,'V-%d'%(1+i),truss.sec[1],(truss.node[11+i],truss.node[21+i]))
        truss.add_load(1+i,truss.node[21+i],[2],[-1.])

    truss.load[1].dof_value[0] = -.5
    truss.load[7].dof_value[0] = -.5

    truss.add_cons(1,truss.node[11],[1,2],[0.0,0.0])
    truss.add_cons(2,truss.node[17],[1,2],[0.0,0.0])

    for i in range(6):
        truss.add_ele(Element.Truss2D,'H1-%d'%(1+i),truss.sec[1],(truss.node[11+i],truss.node[12+i]))
        truss.add_ele(Element.Truss2D,'H2-%d'%(1+i),truss.sec[1],(truss.node[21+i],truss.node[22+i]))
        if i < 3:
            truss.add_ele(Element.Truss2D,'DL-%d'%(1+i),truss.sec[1],(truss.node[12+i],truss.node[21+i]))
        else:
            truss.add_ele(Element.Truss2D,'DR-%d'%(1+i),truss.sec[1],(truss.node[11+i],truss.node[22+i]))     

    truss.build_model()
    truss.export_gmsh_scr_2d('truss')

    analyse = Analysis.Analysis_Linear_Static(truss)
    analyse.execute()

    post = PostProcessor(truss)
    post.get_all()
    
    return truss
Ejemplo n.º 6
0
def main():

    frame = Domain(2,3,'test07')

    frame.add_mat(Material1D.Bilinear,1,2.e5,200.,0.01)

    b = 200.
    h = 400.
    A = b*h
    I = b*h**3/12.
    frame.add_sec(Section.FiberSection2D,1)
    frame.sec[1].add_rect(b,h,nb=1,nh=10,mat=frame.mat[1])

    L = 3000.0
    nmass = [200.0,200.0,1.e-9]
    
    frame.add_node(1,(0.0,0.,0.),nmass)
    frame.add_node(2,(L  ,0.,0.),nmass)
    nintp = 10

    frame.add_ele(Element.Frame2D,1,frame.sec[1],(frame.node[1],frame.node[2]),nintp)

    N = 10
    t = np.linspace(1./N,1.,N)
    F1 = -700.e3*t
    
    # F1 = -8.e3*np.sin(2.*np.pi/4.*t)
    # F2 = -6.e3*np.sin(2.*np.pi/4.*t)

    frame.add_load(1,frame.node[2],[2],[F1],t)
    frame.add_cons(1,frame.node[1],[1,2,3],[0.0,0.0,0.0])

    frame.build_model()
    # frame.apply_cons(0)

    # analyse = Analysis.Analysis_Linear_Eigen(frame)
    # analyse.execute(1)

    # analyse = Analysis.Analysis_Linear_Static(frame)
    analyse = Analysis.Analysis_NonLinear_Static(frame)
    analyse.tol = 1e-6
    analyse.maxiter = 10

    disp = NodeResult(frame,2,'deformation',2)
    react = NodeResult(frame,1,'reaction',2)
    analyse.results.append(disp)
    analyse.results.append(react)

    # analyse.execute(6)
    analyse.execute(len(t))
    
    u = F1*L**3/2.e5/I/3.
    
    # print '            Disp          Moment'
    # print 'nsapy    %.6f    %.6f'%(frame.U[-2], -frame.UF[2])
    # print 'Theory   %.6f    %.6f'%( u[-1], F1[-1]*L)

    for i in xrange(len(t)):
        print t[i],disp.values[i]

    pl.plot(disp.values,react.values,'-')
    pl.plot(disp.values,-F1,'-')
    pl.grid(1)
    pl.show()
    return frame
Ejemplo n.º 7
0
def main():

    truss = Domain(2,2,'test05')

    # truss.add_mat(Material1D.Material_Elastic,1,2.e5)
    truss.add_mat(Material1D.Bilinear,1,2.e5,200.,0.05)
    # truss.add_sec(Section.Section_Elastic_Truss,1,truss.mat[1],100.)
    truss.add_sec(Section.Truss,1,truss.mat[1],100.)

    L = 4500.0
    l1 = 1500.0
    l2 = 750.0
    h = 500.0
    nmass = [200.0,200.0,0.0]
    
    truss.add_node(1,(0.0,0.,0.),nmass)
    truss.add_node(2,(L,0.,0.),nmass)
    truss.add_node(3,(l1,0.,0.),nmass)
    truss.add_node(4,(l1+l2,0.,0.),nmass)
    truss.add_node(5,(l1+2*l2,0.,0.),nmass)
    truss.add_node(6,(l1,-h,0.),nmass)
    truss.add_node(7,(l1+2*l2,-h,0.),nmass)

    truss.add_ele(Element.Truss2D,1,truss.sec[1],(truss.node[1],truss.node[3]))
    truss.add_ele(Element.Truss2D,2,truss.sec[1],(truss.node[3],truss.node[4]))
    truss.add_ele(Element.Truss2D,3,truss.sec[1],(truss.node[4],truss.node[5]))
    truss.add_ele(Element.Truss2D,4,truss.sec[1],(truss.node[5],truss.node[2]))
    truss.add_ele(Element.Truss2D,5,truss.sec[1],(truss.node[1],truss.node[6]))
    truss.add_ele(Element.Truss2D,6,truss.sec[1],(truss.node[6],truss.node[7]))
    truss.add_ele(Element.Truss2D,7,truss.sec[1],(truss.node[7],truss.node[2]))
    truss.add_ele(Element.Truss2D,8,truss.sec[1],(truss.node[3],truss.node[6]))
    truss.add_ele(Element.Truss2D,9,truss.sec[1],(truss.node[6],truss.node[4]))
    truss.add_ele(Element.Truss2D,10,truss.sec[1],(truss.node[4],truss.node[7]))
    truss.add_ele(Element.Truss2D,11,truss.sec[1],(truss.node[7],truss.node[5]))
    

    t = np.linspace(0.01,1,100)
    # F1 = -8.e3*t*0.65
    # F2 = -6.e3*t*0.65
    F1 = -8.e3*np.sin(2.*np.pi/0.5*t)*0.65
    F2 = -6.e3*np.sin(2.*np.pi/0.5*t)*0.65

    truss.add_load(1,truss.node[3],[2],[F1],t-0.01)
    truss.add_load(2,truss.node[4],[2],[F2],t-0.01)
    truss.add_load(3,truss.node[5],[2],[F1],t-0.01)

    truss.add_cons(1,truss.node[1],[1,2],[0.0,0.0])
    truss.add_cons(2,truss.node[2],[2],[0.0,])

    truss.build_model()
    # truss.apply_cons(0)

    # analyse = Analysis.Analysis_Linear_Eigen(truss)
    # analyse.execute(1)
    # analyse = Analysis.Analysis_Linear_Static(truss)
    analyse = Analysis.Analysis_NonLinear_Static(truss)
    disp = NodeResult(truss,6,'deformation',2)
    react1 = NodeResult(truss,1,'reaction',2)
    react2 = NodeResult(truss,2,'reaction',2)
    analyse.results.append(disp)
    analyse.results.append(react1)
    analyse.results.append(react2)

    analyse.tol = 1e-9
    analyse.execute(len(t))

    react = react1 + react2
    pl.plot(disp.values,react.values,'-o')
    pl.grid(1)
    pl.show()
    
    return truss
Ejemplo n.º 8
0
def main():

    truss = Domain(2,2,'test02')

    truss.add_mat(Material1D.Material_Elastic,1,2.e5)
    # truss.add_mat(Material1D.Bilinear,1,2.e5,200.,0.02)
    truss.add_sec(Section.Elastic_Truss,1,truss.mat[1],100.)

    L = 4500.0
    l1 = 1500.0
    l2 = 750.0
    h = 500.0
    nmass = [200.0,200.0,200.0]
    
    truss.add_node(1,(0.0,0.,0.),nmass)
    truss.add_node(2,(L,0.,0.),nmass)
    truss.add_node(3,(l1,0.,0.),nmass)
    truss.add_node(4,(l1+l2,0.,0.),nmass)
    truss.add_node(5,(l1+2*l2,0.,0.),nmass)
    truss.add_node(6,(l1,-h,0.),nmass)
    truss.add_node(7,(l1+2*l2,-h,0.),nmass)

    truss.add_ele(Element.Truss2D,1,truss.sec[1],(truss.node[1],truss.node[3]))
    truss.add_ele(Element.Truss2D,2,truss.sec[1],(truss.node[3],truss.node[4]))
    truss.add_ele(Element.Truss2D,3,truss.sec[1],(truss.node[4],truss.node[5]))
    truss.add_ele(Element.Truss2D,4,truss.sec[1],(truss.node[5],truss.node[2]))
    truss.add_ele(Element.Truss2D,5,truss.sec[1],(truss.node[1],truss.node[6]))
    truss.add_ele(Element.Truss2D,6,truss.sec[1],(truss.node[6],truss.node[7]))
    truss.add_ele(Element.Truss2D,7,truss.sec[1],(truss.node[7],truss.node[2]))
    truss.add_ele(Element.Truss2D,8,truss.sec[1],(truss.node[3],truss.node[6]))
    truss.add_ele(Element.Truss2D,9,truss.sec[1],(truss.node[6],truss.node[4]))
    truss.add_ele(Element.Truss2D,10,truss.sec[1],(truss.node[4],truss.node[7]))
    truss.add_ele(Element.Truss2D,11,truss.sec[1],(truss.node[7],truss.node[5]))
    

    t = np.linspace(0.01,1,100)
    F1 = -8.e3*t
    F2 = -6.e3*t
    
    # F1 = -8.e3*np.sin(2.*np.pi/4.*t)
    # F2 = -6.e3*np.sin(2.*np.pi/4.*t)

    truss.add_load(1,truss.node[3],[2],[F1],t-0.01)
    truss.add_load(2,truss.node[4],[2],[F2],t-0.01)
    truss.add_load(3,truss.node[5],[2],[F1],t-0.01)

    truss.add_cons(1,truss.node[1],[1,2],[0.0,0.0])
    truss.add_cons(2,truss.node[2],[2],[0.0,])

    truss.build_model()
    # truss.apply_cons(0)

    # analyse = Analysis.Analysis_Linear_Eigen(truss)
    # analyse.execute(1)
    analyse = Analysis.Analysis_Linear_Static(truss)
    # analyse = Analysis.Analysis_NonLinear_Static(truss)
    analyse.execute(len(t))
    
    return truss