Exemplo n.º 1
0
def getCmatrix(node_list, mesh):
    log.info('---starting getCmatrix---')
    D = 1.
    piD16 = pi * D * 16.

    nNodes = len(node_list)
    i = 3
    #C = memmap('Cmatrix.map', dtype='float64', mode='write', shape=(3+nNodes, 3+nNodes) )
    log.info('nNodes=%s' % nNodes)
    sys.stdout.flush()
    C = matrix(zeros((3 + nNodes, 3 + nNodes), 'float64'))
    for inode in node_list:
        nodeI = mesh.Node(inode)
        #i = inode+3
        (xi, yi, zi) = nodeI.get_position()
        #x,y,z = p

        C[0, i] = 1.
        C[1, i] = xi
        C[2, i] = yi

        C[i, 0] = 1.
        C[i, 1] = xi
        C[i, 2] = yi

        j = 3
        for jNode in node_list:
            #j = 3+jNode
            nodeJ = mesh.Node(jNode)
            xj, yj, zj = nodeJ.get_position()
            if i == j:
                C[i, j] = 0.
            else:
                Rij2 = (xi-xj)**2. + (yi-yj)**2  # Rij^2
                if Rij2 == 0.:
                    C[i, j] = 0.
                else:
                    Kij = Rij2 * naturalLog(Rij2) / piD16
                    C[i, j] = Kij
                    #msg = "i=%s j=%s xi=%s xj=%s yi=%s yj=%s Rij2=%s Kij=%s" %(i,j,xi,xj,yi,yj,Rij2,Kij)
                    #assert isinstance(Kij,float64), msg
            j += 1
        i += 1
    log.info('---finished getCmatrix---')
    sys.stdout.flush()
    return C
Exemplo n.º 2
0
def getCmatrix(nodeList, mesh):
    log.info('---starting getCmatrix---')
    D = 1.
    piD16 = pi*D*16.

    nNodes = len(nodeList)
    i = 3
    #C = memmap('Cmatrix.map',dtype='float64',mode='write',shape=(3+nNodes,3+nNodes) )
    log.info('nNodes=%s' % nNodes)
    sys.stdout.flush()
    C = matrix(zeros((3+nNodes,3+nNodes), 'float64'))
    for iNode in nodeList:
        nodeI = mesh.Node(iNode)
        #i = iNode+3
        (xi, yi, zi) = nodeI.Position()
        #x,y,z = p

        C[0,i] = 1.
        C[1,i] = xi
        C[2,i] = yi

        C[i,0] = 1.
        C[i,1] = xi
        C[i,2] = yi

        j = 3
        for jNode in nodeList:
            #j = 3+jNode
            nodeJ = mesh.Node(jNode)
            (xj,yj,zj) = nodeJ.Position()
            if i==j:
                C[i,j] = 0.
            else:
                Rij2 = (xi-xj)**2. + (yi-yj)**2  # Rij^2
                if Rij2==0.:
                    C[i,j] = 0.
                else:
                    Kij = Rij2 * naturalLog(Rij2) / piD16
                    C[i,j] = Kij
                    #msg = "i=%s j=%s xi=%s xj=%s yi=%s yj=%s Rij2=%s Kij=%s" %(i,j,xi,xj,yi,yj,Rij2,Kij)
                    #assert isinstance(Kij,float64), msg
            j += 1
        i += 1
    log.info('---finished getCmatrix---')
    sys.stdout.flush()
    return C
Exemplo n.º 3
0
def getXK_Matrix(Cws, nodeList, mesh, aero_points):
    log.info('---starting getXK_matrix---')
    D = 1.
    piD16 = pi * D * 16.

    nNodes = len(nodeList)
    #nPoints = len(aero_points.keys())
    wa = {}
    #i = 0
    for iAero, aNode in sorted(iteritems(aero_points)):
        xK = zeros(nNodes+3, 'd')
        #nodeI = mesh.Node(iNode)

        xa, ya, za = aNode

        xK[0] = 1.
        xK[1] = xa
        xK[2] = ya

        j = 3
        for jNode in nodeList:
            sNode = mesh.Node(jNode)
            (xs, ys, zs) = sNode.get_position()

            Rij2 = (xa-xs)**2. + (ya-ys)**2  # Rij^2
            if Rij2 == 0.:
                xK[j] = 0.
            else:
                Kij = Rij2 * naturalLog(Rij2) / piD16
                xK[j] = Kij
            j += 1

        wai = xK * Cws
        wa[iAero] = wai[0, 0]
        #print("w[%s]=%s" % (iAero, wi[0, 0]))
        #i += 1
    #print('---wa---')
    #print('wa = ', wa)
    log.info('---finished getXK_matrix---')
    sys.stdout.flush()
    return wa
Exemplo n.º 4
0
def getXK_Matrix(Cws, nodeList, mesh, aPoints):
    log.info('---starting getXK_matrix---')
    D = 1.
    piD16 = pi*D*16.

    nNodes = len(nodeList)
    nPoints = len(aPoints.keys())
    wa = {}
    i = 0
    for (iAero, aNode) in sorted(aPoints.iteritems()):
        xK = zeros(nNodes+3, 'd')
        #nodeI = mesh.Node(iNode)

        xa,ya,za = aNode

        xK[0] = 1.
        xK[1] = xa
        xK[2] = ya

        j = 3
        for jNode in nodeList:
            sNode = mesh.Node(jNode)
            (xs, ys, zs) = sNode.Position()

            Rij2 = (xa-xs)**2. + (ya-ys)**2  # Rij^2
            if Rij2==0.:
                xK[j] = 0.
            else:
                Kij = Rij2 * naturalLog(Rij2) / piD16
                xK[j] = Kij
            j += 1

        wai = xK*Cws
        wa[iAero] = wai[0,0]
        #print "w[%s]=%s" % (iAero, wi[0,0])
        i += 1
    #print '---wa---'
    #print 'wa = ',wa
    log.info('---finished getXK_matrix---')
    sys.stdout.flush()
    return wa