コード例 #1
0
def bar1():
    print('---------------------------------------------------------------')
    print('Clamped bar loaded at the right end with unit displacement')
    print('[00]-[01]-[02]-[03]-[04]-[05]-[06]-[07]-[08]-[09]-[10]')
    print('u[0] = 0, u[10] = 1')
    K = SysMtxAssembly()
    dof_map, mtx_arr = get_bar_mtx_array(shape=10)
    K.add_mtx_array(dof_map_arr=dof_map, mtx_arr=mtx_arr)
    K.register_constraint(a=0, u_a=0.)  # clamped end
    K.register_constraint(a=10, u_a=1.)
    K.register_constraint(a=10, u_a=1.)
    K_dense = DenseMtx(assemb=K)
    R = zeros(K.n_dofs)
    print('K\n', K_dense)
    print('R\n', R)
    print('K_arrays')
    for i, sys_mtx_array in enumerate(K.sys_mtx_arrays):
        print('i\n', sys_mtx_array.mtx_arr)
    K.apply_constraints(R)
    K_dense = DenseMtx(assemb=K)
    print('K\n', K_dense)
    print('R\n', R)
    print('K_arrays')
    for i, sys_mtx_array in enumerate(K.sys_mtx_arrays):
        print('i\n', sys_mtx_array.mtx_arr)
    print('u =', K.solve(R))
    print()
コード例 #2
0
ファイル: tstepper_service.py プロジェクト: rosoba/simvisage
    def plot_stiffness(self, editor, object):
        '''This method gets the input data from the current tstepper
        which is the root of the tree. Sets up the context and 
        gets the stiffness matrix.
        '''
        K = self._get_stiffness(editor, object)
        K_dense = DenseMtx(assemb=K)

        # prepare plotting of the matrix in Mayavi
        #
        z_data = K_dense.mtx.flatten()
        z_max = max(z_data)
        n_dofs = K.n_dofs

        spoints = tvtk.StructuredPoints(origin=(0, 0, 0),
                                        spacing=(1, -1, 1),
                                        dimensions=(n_dofs, n_dofs, 1))
        spoints.point_data.scalars = z_data
        spoints.point_data.scalars.name = 'Stiffness'

        e = get_engine()
        src = VTKDataSource(data=spoints)
        e.add_source(src)
        scale_factor = .1 / float(z_max) * n_dofs
        ws = WarpScalar()
        ws.filter.scale_factor = scale_factor
        e.add_filter(ws)
        e.add_filter(PolyDataNormals())
        s = Surface()
        e.add_module(s)
コード例 #3
0
def bar1():
    print '---------------------------------------------------------------'
    print 'Clamped bar loaded at the right end with unit displacement'
    print '[00]-[01]-[02]-[03]-[04]-[05]-[06]-[07]-[08]-[09]-[10]'
    print 'u[0] = 0, u[10] = 1'
    K = SysMtxAssembly()
    dof_map, mtx_arr = get_bar_mtx_array(shape=10)
    K.add_mtx_array(dof_map_arr=dof_map, mtx_arr=mtx_arr)
    K.register_constraint(a=0, u_a=0.)  # clamped end
    K.register_constraint(a=10, u_a=1.)
    K.register_constraint(a=10, u_a=1.)
    DenseMtx(assemb=K).configure_traits()
    R = zeros(K.n_dofs)
    print 'u =', K.solve(R)
    print
コード例 #4
0
 def show_stiffness( self, editor, object ):
     K = self._get_stiffness( editor, object )
     K_dense = DenseMtx( assemb = K )
     K_dense.configure_traits()
コード例 #5
0
ファイル: tstepper_service.py プロジェクト: rosoba/simvisage
 def show_stiffness(self, editor, object):
     K = self._get_stiffness(editor, object)
     K_dense = DenseMtx(assemb=K)
     K_dense.configure_traits()