Ejemplo n.º 1
0
    def _get_stiffness( self, editor, object ):
        tstepper = editor.object.tstepper


        if isinstance( object, TStepper ):
            U_k = tstepper.U_k
            d_U = tstepper.d_U
            K, R = tstepper.eval( 'predictor', U_k, d_U, 0, 0 )
            print 'constraints'
            K.print_constraints()
            K.apply_constraints( R )
        else:

            dots = object.dots
            U_k = tstepper.U_k
            d_U = tstepper.d_U
            sctx = tstepper.sctx

            F_int, K_mtx = dots.get_corr_pred( sctx, U_k, d_U, 0, 0 )

            # put the matrix into the system assembly
            #
            K = SysMtxAssembly()
            if isinstance( K_mtx, ndarray ):
                K.add_mtx( K_mtx )
            elif isinstance( K_mtx, SysMtxArray ):
                K.sys_mtx_arrays.append( K_mtx )
            elif isinstance( K_mtx, list ):
                K.sys_mtx_arrays = K_mtx
            elif isinstance( K_mtx, SysMtxAssembly ):
                K.sys_mtx_arrays = K_mtx.sys_mtx_arrays

            n_dofs = tstepper.sdomain.n_dofs
            K.add_mtx( zeros( ( 1, 1 ), dtype = 'float_' ), array( [n_dofs - 1], dtype = 'int_' ) )

        return K
Ejemplo n.º 2
0
    def _get_stiffness(self, editor, object):
        tstepper = editor.object.tstepper

        if isinstance(object, TStepper):
            U_k = tstepper.U_k
            d_U = tstepper.d_U
            K, R = tstepper.eval('predictor', U_k, d_U, 0, 0)
            print 'constraints'
            K.print_constraints()
            K.apply_constraints(R)
        else:

            dots = object.dots
            U_k = tstepper.U_k
            d_U = tstepper.d_U
            sctx = tstepper.sctx

            F_int, K_mtx = dots.get_corr_pred(sctx, U_k, d_U, 0, 0)

            # put the matrix into the system assembly
            #
            K = SysMtxAssembly()
            if isinstance(K_mtx, ndarray):
                K.add_mtx(K_mtx)
            elif isinstance(K_mtx, SysMtxArray):
                K.sys_mtx_arrays.append(K_mtx)
            elif isinstance(K_mtx, list):
                K.sys_mtx_arrays = K_mtx
            elif isinstance(K_mtx, SysMtxAssembly):
                K.sys_mtx_arrays = K_mtx.sys_mtx_arrays

            n_dofs = tstepper.sdomain.n_dofs
            K.add_mtx(
                zeros((1, 1), dtype='float_'), array([n_dofs - 1], dtype='int_'))

        return K