Exemplo n.º 1
0
    def get_weights(self, closePoint, nodes):
        # TODO: new weights?
        #(n1, n2, n3) = list(setNodes)
        #n = piercedPoint
        #(w1, w2, w3) = getTriangleWeights(n, n1, n2, n3)

        weights = shepard_weight(closePoint, nodes)
        return weights
Exemplo n.º 2
0
    def map_deflections(self, deflections, aeroNode):
        """
        determines the mapped x,y,z deflections of the aero node

        deflections - deflections at p0,p1,p2,p3
        aeroNode    - node to find the deflections at

        Solves Ax=b  where A is the nodes, x is the abc coeffs,
                     b is the deflection at the tet node points (x,y,z)
        then uses x to find the deflection at an arbitrary point m (aeroNode)
        """
        A = array([[1.]+list(self.p0),
                   [1.]+list(self.p1),
                   [1.]+list(self.p2),
                   [1.]+list(self.p3)])
        #print("m1 = ", m)
        (d1, d2, d3, d4) = deflections
        log.info('d1=%s' % d1)
        log.info('d2=%s' % d2)
        log.info('d3=%s' % d3)
        log.info('d4=%s' % d4)
        #log.info("A = \n%s" % (A))
        #condA = cond(A,2)
        #log.info("A cond=%g;  A=\n%s" % (condA, printMatrix(A)))
        #print("ID  = ",self.ID)

        #condMax = 1E6  # max allowable condition number before alternate approach
        if 1:
            nodes   = [self.p0, self.p1, self.p2, self.p3]
            weights = shepard_weight(aeroNode, nodes)
            du = array([0.,0.,0.])
            for (node, weight) in zip(nodes, weights):
                du += weight * node
        else:
            ux = self.map_deflection(A, d1, d2, d3, d4, 0, aeroNode, 'x')
            uy = self.map_deflection(A, d1, d2, d3, d4, 1, aeroNode, 'y')
            uz = self.map_deflection(A, d1, d2, d3, d4, 2, aeroNode, 'z')
            du = array([ux, uy, uz])
        log.info("vol       = %s" % self.volume())
        log.info("du        = %s" % du)
        return aeroNode + du
Exemplo n.º 3
0
    def mapDeflections(self, deflections, aeroNode):
        """
        determines the mapped x,y,z deflections of the aero node

        deflections - deflections at p0,p1,p2,p3
        aeroNode    - node to find the deflections at

        Solves Ax=b  where A is the nodes, x is the abc coeffs,
                     b is the deflection at the tet node points (x,y,z)
        then uses x to find the deflection at an arbitrary point m (aeroNode)
        """
        A = array([[1.] + list(self.p0), [1.] + list(self.p1),
                   [1.] + list(self.p2), [1.] + list(self.p3)])
        #print "m1 = ",m
        (d1, d2, d3, d4) = deflections
        log.info('d1=%s' % (d1))
        log.info('d2=%s' % (d2))
        log.info('d3=%s' % (d3))
        log.info('d4=%s' % (d4))
        #log.info("A = \n%s" %(A))
        #condA = cond(A,2)
        #log.info("A cond=%g;  A=\n%s" %(condA,printMatrix(A)))
        #print "ID  = ",self.ID

        #condMax = 1E6  # max allowable condition number before alternate approach
        if 1:
            nodes = [self.p0, self.p1, self.p2, self.p3]
            weights = shepard_weight(aeroNode, nodes)
            du = array([0., 0., 0.])
            for (node, weight) in zip(nodes, weights):
                du += weight * node
        else:
            ux = self.mapDeflection(A, d1, d2, d3, d4, 0, aeroNode, 'x')
            uy = self.mapDeflection(A, d1, d2, d3, d4, 1, aeroNode, 'y')
            uz = self.mapDeflection(A, d1, d2, d3, d4, 2, aeroNode, 'z')
            du = array([ux, uy, uz])
        log.info("vol       = %s" % (self.volume()))
        log.info("du        = %s" % (du))
        return aeroNode + du