Пример #1
0
    def sourceVortexPanel_solve(self, Vinduced, evaluationPoint='self'):
        '''
        '''

        # Defining collocation Point        
        self.source_collocationPoint = collocationPoint(self.panelStart, self.panelEnd, self.normal)
        self.vortex_collocationPoint = collocationPoint(self.panelStart, self.panelEnd, -self.normal)
        
        # Number of collocation points
        n = np.shape(self.collocationPoint)[1]
        
        # Calculate the RHS - Neumann B.C [normal and tangent]
        self.sourceVortex_RHS_normal   = source2D.RightHandSide(Vinduced, self.normal)
        self.sourceVortex_RHS_tangent  = vortex2D.RightHandSide(Vinduced, self.tangent)
        #   Total RHS
        self.sourceVortex_RHS          = np.concatenate([self.sourceVortex_RHS_normal, self.sourceVortex_RHS_tangent])
         
        # Calculate the influence Matrix
        #   normal
        self.sourceVortex_A_normal = source2D.solve(self.source_collocationPoint, self.panelStart, self.panelEnd, self.normal)
        self.sourceVortex_B_normal = vortex2D.solve(self.vortex_collocationPoint, self.panelStart, self.panelEnd, self.normal)
        #   tangent
        self.sourceVortex_A_tangent = source2D.solve(self.source_collocationPoint, self.panelStart, self.panelEnd, self.tangent)
        self.sourceVortex_B_tangent = vortex2D.solve(self.vortex_collocationPoint, self.panelStart, self.panelEnd, self.tangent)
        
        # Combined influence matrix
        self.sourceVortex_C = np.zeros((n*2,n*2)) #[[1,2],[3,4]]
        
        self.sourceVortex_C[:n,:n] = self.sourceVortex_A_normal # 1
        self.sourceVortex_C[:n,n:] = self.sourceVortex_B_normal # 2
        self.sourceVortex_C[n:,:n] = self.sourceVortex_A_tangent # 3 
        self.sourceVortex_C[n:,n:] = self.sourceVortex_B_tangent # 4
    
        #start = time.time()

        # Solve the panel Menthod, combined B.Cs
        self.sourceVortex_SigmaGamma = np.linalg.solve(self.sourceVortex_C, self.sourceVortex_RHS)
        
        #print 'sourceVortexPanel:' + str(time.time() - start)

        #self.sourceVortex_SigmaGamma = np.linalg.lstsq(self.sourceVortex_C, self.sourceVortex_RHS)
        
        self.sourceVortex_sigma = self.sourceVortex_SigmaGamma[:n]
        self.sourceVortex_gamma = self.sourceVortex_SigmaGamma[n:]
        
        # To show no transpiration    
        if evaluationPoint is 'self':
            evaluationPoint_source = self.source_collocationPoint
            evaluationPoint_vortex = self.vortex_collocationPoint
            
        else:
            evaluationPoint_source = evaluationPoint
            evaluationPoint_vortex = evaluationPoint
            
        # Calculate induced velocity on body
        self.sourceVortex_Vsorc = source2D.evaluate(self.sourceVortex_sigma, evaluationPoint_source, self.panelStart, self.panelEnd)        
        self.sourceVortex_Vvort = vortex2D.evaluate(self.sourceVortex_gamma, evaluationPoint_vortex, self.panelStart, self.panelEnd)
        self.sourceVortex_V = self.sourceVortex_Vsorc + self.sourceVortex_Vvort
Пример #2
0
    def vortexPanel_solve(self, Vinduced, evaluationPoint = 'self'):
        '''
        Solve potential flow using vortex panels
        '''
        
        # Defining collocationPoints: slightly inside
        self.vortex_collocationPoint = collocationPoint(self.panelStart,self.panelEnd, -self.normal) # inside the body
        
        # Calculate RHS - zero tangential
        self.vortex_RHS = vortex2D.RightHandSide(Vinduced,
                                                 self.tangent)
        #start = time.time()
                                         
        # Calculate the influence matrix
        self.vortex_A   = vortex2D.solve(self.vortex_collocationPoint,
                                         self.panelStart,
                                         self.panelEnd,
                                         self.tangent)
                                         
        #print 'vortex:' + str(time.time() - start)
        #start = time.time()
        
        # Solve the vortex Method. Ax=RHS
        self.vortex_gamma = np.linalg.solve(self.vortex_A, self.vortex_RHS)
        
        #print 'vortex:' + str(time.time() - start)
        #start = time.time()

        # To show no transpiration    
        if evaluationPoint is 'self':
            evaluationPoint = self.vortex_collocationPoint
            
        # Calculate induced velocity on body
        self.vortex_V = vortex2D.evaluate(self.vortex_gamma,
                                          evaluationPoint,
                                          self.panelStart,
                                          self.panelEnd)