def test_airfoilshape(self): af = AirfoilShape(afs[0]) aff = af.redistribute(20, even=True) self.assertEqual( np.testing.assert_array_almost_equal(af.LE, np.array([-1.76645007e-05, -2.90461132e-04]), decimal=6), None ) self.assertAlmostEqual(af.sLE, 0.49898457668804924, places=6) self.assertEqual(np.testing.assert_array_almost_equal(aff.points, aff_data, decimal=6), None)
def test_airfoilshape(self): af = AirfoilShape(afs[0]) aff = af.redistribute(20, even=True) self.assertEqual( np.testing.assert_array_almost_equal( af.LE, np.array([-1.76645007e-05, -2.90461132e-04]), decimal=6), None) self.assertAlmostEqual(af.sLE, 0.49898457668804924, places=6) self.assertEqual( np.testing.assert_array_almost_equal(aff.points, aff_data, decimal=6), None)
def redistribute(self, points, pos_z): if self.redistribute_flag == False: return points airfoil = AirfoilShape(points=points) try: dist_LE = np.interp(pos_z, self.dist_LE[:, 0], self.dist_LE[:, 1]) except: dist_LE = None # pass airfoil to user defined routine to allow for additional configuration airfoil = self.set_airfoil(airfoil, pos_z) if self.x_chordwise.shape[0] > 0: airfoil = airfoil.redistribute_chordwise(self.x_chordwise) else: airfoil = airfoil.redistribute(ni=self.chord_ni, dLE=dist_LE) return airfoil.points
def redistribute_airfoil_example(): af = AirfoilShape(np.loadtxt('data/ffaw3301.dat')) print 'number of points, ni: ', af.ni print 'Airfoil leading edge (x, y): ', af.LE print 'Airfoil leading edge curve fraction (s): ', af.sLE plt.figure() plt.plot(af.points[:, 0], af.points[:, 1], '-x', label='original') # redistribute 200 points along the surface # and let the LE cell size be determined based on curvature aff = af.redistribute(200, dLE=True) plt.plot(aff.points[:, 0], aff.points[:, 1], '-<', label='redistributed') plt.plot(aff.LE[0], aff.LE[1], 'o', label='LE') plt.legend(loc='best') plt.axis('equal') plt.show()