def Pxx(xEdge, yEdge):
            """
            no | node      | e1      | e2
            00 | i  ,j     | i  ,j   | i  ,j
            10 | i+1,j     | i  ,j   | i+1,j
            01 | i  ,j+1   | i  ,j+1 | i  ,j
            11 | i+1,j+1   | i  ,j+1 | i+1,j
            """
            posX = 0 if xEdge == 'eX0' else 1
            posY = 0 if yEdge == 'eY0' else 1

            ind1 = sub2ind(M.vnEx, np.c_[ii, jj + posX])
            ind2 = sub2ind(M.vnEy, np.c_[ii + posY, jj]) + M.nEx

            IND = np.r_[ind1, ind2].flatten()

            PXX = sp.coo_matrix((np.ones(2 * M.nC), (range(2 * M.nC), IND)),
                                shape=(2 * M.nC, M.nE)).tocsr()

            if M._meshType == 'Curv':
                I2x2 = inv2X2BlockDiagonal(getSubArray(eT1[0], [i, j + posX]),
                                           getSubArray(eT1[1], [i, j + posX]),
                                           getSubArray(eT2[0], [i + posY, j]),
                                           getSubArray(eT2[1], [i + posY, j]))
                PXX = I2x2 * PXX

            return PXX
        def Pxx(xFace, yFace):
            """
                xFace is 'fXp' or 'fXm'
                yFace is 'fYp' or 'fYm'
            """
            # no | node      | f1     | f2
            # 00 | i  ,j     | i  , j | i, j
            # 10 | i+1,j     | i+1, j | i, j
            # 01 | i  ,j+1   | i  , j | i, j+1
            # 11 | i+1,j+1   | i+1, j | i, j+1

            posFx = 0 if xFace == 'fXm' else 1
            posFy = 0 if yFace == 'fYm' else 1

            ind1 = sub2ind(M.vnFx, np.c_[ii + posFx, jj])
            ind2 = sub2ind(M.vnFy, np.c_[ii, jj + posFy]) + M.nFx

            IND = np.r_[ind1, ind2].flatten()

            PXX = sp.csr_matrix((np.ones(2 * M.nC), (range(2 * M.nC), IND)),
                                shape=(2 * M.nC, M.nF))

            if M._meshType == 'Curv':
                I2x2 = inv2X2BlockDiagonal(getSubArray(fN1[0], [i + posFx, j]),
                                           getSubArray(fN1[1], [i + posFx, j]),
                                           getSubArray(fN2[0], [i, j + posFy]),
                                           getSubArray(fN2[1], [i, j + posFy]))
                PXX = I2x2 * PXX

            return PXX
示例#3
0
        def Pxxx(xEdge, yEdge, zEdge):
            """
            no  | node        | e1          | e2          | e3
            000 | i  ,j  ,k   | i  ,j  ,k   | i  ,j  ,k   | i  ,j  ,k
            100 | i+1,j  ,k   | i  ,j  ,k   | i+1,j  ,k   | i+1,j  ,k
            010 | i  ,j+1,k   | i  ,j+1,k   | i  ,j  ,k   | i  ,j+1,k
            110 | i+1,j+1,k   | i  ,j+1,k   | i+1,j  ,k   | i+1,j+1,k
            001 | i  ,j  ,k+1 | i  ,j  ,k+1 | i  ,j  ,k+1 | i  ,j  ,k
            101 | i+1,j  ,k+1 | i  ,j  ,k+1 | i+1,j  ,k+1 | i+1,j  ,k
            011 | i  ,j+1,k+1 | i  ,j+1,k+1 | i  ,j  ,k+1 | i  ,j+1,k
            111 | i+1,j+1,k+1 | i  ,j+1,k+1 | i+1,j  ,k+1 | i+1,j+1,k
            """

            posX = [0,0] if xEdge == 'eX0' else [1, 0] if xEdge == 'eX1' else [0,1] if xEdge == 'eX2' else [1,1]
            posY = [0,0] if yEdge == 'eY0' else [1, 0] if yEdge == 'eY1' else [0,1] if yEdge == 'eY2' else [1,1]
            posZ = [0,0] if zEdge == 'eZ0' else [1, 0] if zEdge == 'eZ1' else [0,1] if zEdge == 'eZ2' else [1,1]

            ind1 = sub2ind(M.vnEx, np.c_[ii, jj + posX[0], kk + posX[1]])
            ind2 = sub2ind(M.vnEy, np.c_[ii + posY[0], jj, kk + posY[1]]) + M.nEx
            ind3 = sub2ind(M.vnEz, np.c_[ii + posZ[0], jj + posZ[1], kk]) + M.nEx + M.nEy

            IND = np.r_[ind1, ind2, ind3].flatten()

            PXXX = sp.coo_matrix((np.ones(3*M.nC), (range(3*M.nC), IND)), shape=(3*M.nC, M.nE)).tocsr()

            if M._meshType == 'Curv':
                I3x3 = inv3X3BlockDiagonal(getSubArray(eT1[0], [i, j + posX[0], k + posX[1]]), getSubArray(eT1[1], [i, j + posX[0], k + posX[1]]), getSubArray(eT1[2], [i, j + posX[0], k + posX[1]]),
                                           getSubArray(eT2[0], [i + posY[0], j, k + posY[1]]), getSubArray(eT2[1], [i + posY[0], j, k + posY[1]]), getSubArray(eT2[2], [i + posY[0], j, k + posY[1]]),
                                           getSubArray(eT3[0], [i + posZ[0], j + posZ[1], k]), getSubArray(eT3[1], [i + posZ[0], j + posZ[1], k]), getSubArray(eT3[2], [i + posZ[0], j + posZ[1], k]))
                PXXX = I3x3 * PXXX

            return PXXX
        def Pxxx(xFace, yFace, zFace):
            """
            xFace is 'fXp' or 'fXm'
            yFace is 'fYp' or 'fYm'
            zFace is 'fZp' or 'fZm'
            """

            # no  | node        | f1        | f2        | f3
            # 000 | i  ,j  ,k   | i  , j, k | i, j  , k | i, j, k
            # 100 | i+1,j  ,k   | i+1, j, k | i, j  , k | i, j, k
            # 010 | i  ,j+1,k   | i  , j, k | i, j+1, k | i, j, k
            # 110 | i+1,j+1,k   | i+1, j, k | i, j+1, k | i, j, k
            # 001 | i  ,j  ,k+1 | i  , j, k | i, j  , k | i, j, k+1
            # 101 | i+1,j  ,k+1 | i+1, j, k | i, j  , k | i, j, k+1
            # 011 | i  ,j+1,k+1 | i  , j, k | i, j+1, k | i, j, k+1
            # 111 | i+1,j+1,k+1 | i+1, j, k | i, j+1, k | i, j, k+1

            posX = 0 if xFace == 'fXm' else 1
            posY = 0 if yFace == 'fYm' else 1
            posZ = 0 if zFace == 'fZm' else 1

            ind1 = sub2ind(M.vnFx, np.c_[ii + posX, jj, kk])
            ind2 = sub2ind(M.vnFy, np.c_[ii, jj + posY, kk]) + M.nFx
            ind3 = sub2ind(M.vnFz, np.c_[ii, jj, kk + posZ]) + M.nFx + M.nFy

            IND = np.r_[ind1, ind2, ind3].flatten()

            PXXX = sp.coo_matrix((np.ones(3 * M.nC), (range(3 * M.nC), IND)),
                                 shape=(3 * M.nC, M.nF)).tocsr()

            if M._meshType == 'Curv':
                I3x3 = inv3X3BlockDiagonal(
                    getSubArray(fN1[0], [i + posX, j, k]),
                    getSubArray(fN1[1], [i + posX, j, k]),
                    getSubArray(fN1[2], [i + posX, j, k]),
                    getSubArray(fN2[0], [i, j + posY, k]),
                    getSubArray(fN2[1], [i, j + posY, k]),
                    getSubArray(fN2[2], [i, j + posY, k]),
                    getSubArray(fN3[0], [i, j, k + posZ]),
                    getSubArray(fN3[1], [i, j, k + posZ]),
                    getSubArray(fN3[2], [i, j, k + posZ]))
                PXXX = I3x3 * PXXX

            return PXXX