Example #1
0
	def velocityAndPressure(self):
		startTime = time.clock()
		# Calculate velocity
		for i in range(self.nrPanelObjects):
			# For each ctrl point on each mesh
			p = self.panelObjects[i].mesh.face_center
			u = np.zeros((self.panelObjects[i].mesh.nrFaces, 3), dtype=np.double)

			for j in range(self.nrPanelObjects):
				# Calculate influence from all panel objects
				mesh = self.panelObjects[j].mesh

				strength = self.panelObjects[j].source_strength
				u += Computation.velocity(p, strength, mesh, 'sourceVelocity')

				if self.panelObjects[j].liftingSurface:
					strength      = self.panelObjects[j].doublet_strength
					wake_strength = self.panelObjects[j].wake_strength
					wake_mesh     = self.panelObjects[j].wake_mesh
					u += Computation.velocity(p, strength, mesh, 'doubletVelocity')
					u += Computation.velocity(p, wake_strength, wake_mesh, 'doubletVelocity') 

			self.panelObjects[i].u = u[:, 0] + self.Uinf[0]
			self.panelObjects[i].v = u[:, 1] + self.Uinf[1]
			self.panelObjects[i].w = u[:, 2] + self.Uinf[2]

			self.panelObjects[i].U = np.sqrt(self.panelObjects[i].u**2 + self.panelObjects[i].v**2 + self.panelObjects[i].w**2)

			UinfMag = np.sqrt(np.sum(self.Uinf**2))
			self.panelObjects[i].Cp = 1 - self.panelObjects[i].U**2/UinfMag**2

		stopTime = time.clock()
		print('Velocity and pressure calculation time:', stopTime - startTime, 's')
Example #2
0
	def velocityAtPoint(self, p, inducedOnly = False):
		u = np.zeros(3)

		for i in range(self.nrPanelObjects):
			panelObject = self.panelObjects[i]

			u += Computation.velocity(np.array([p]), panelObject.source_strength, panelObject.mesh, 'sourceVelocity')[0]

			if panelObject.liftingSurface:
				u += Computation.velocity(np.array([p]), panelObject.doublet_strength, panelObject.mesh, 'doubletVelocity')[0]
				u += Computation.velocity(np.array([p]), panelObject.wake_strength, panelObject.wake_mesh, 'doubletVelocity')[0]

		if not(inducedOnly):
			u += self.Uinf

		return u