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
def sourcePanel_solve(self, Vinduced, evaluationPoint='self'): ''' Solve the panel problem ''' # Defining collocationPoint self.source_collocationPoint = collocationPoint(self.panelStart, self.panelEnd, self.normal) # + normal # Calculate RHS - Neumann B.C self.source_RHS = source2D.RightHandSide(Vinduced, self.normal) #start = time.time() # Calculate the influence matrix self.source_A = source2D.solve(self.source_collocationPoint, self.panelStart, self.panelEnd, self.normal) # Solve the panel Method. Equation: Ax = RHS. Solve for x self.source_sigma = np.linalg.solve(self.source_A, self.source_RHS) #print 'sourcePanel:' + str(time.time() - start) # To show no transpiration if evaluationPoint is 'self': evaluationPoint = self.source_collocationPoint start = time.time() # Calculate induced velocity on body self.source_V = source2D.evaluate(self.source_sigma, evaluationPoint, self.panelStart, self.panelEnd) print str(time.time() - start)