def test_naca_5_cambered_standard_xup_cosine(self): foil = pr.NacaProfile(digits='23012', n_points=240, cosine_spacing=True) xup_expected = np.load( 'tests/test_datasets/naca5_23012_xup_cosine.npy') np.testing.assert_almost_equal(foil.xup_coordinates, xup_expected)
def test_naca_4_cambered_xdown_linear(self): foil = pr.NacaProfile(digits='2412', n_points=240, cosine_spacing=False) xdown_expected = np.load( 'tests/test_datasets/naca4_2412_xdown_linear.npy') np.testing.assert_almost_equal(foil.xdown_coordinates, xdown_expected)
def test_naca_5_cambered_standard_ydown_linear(self): foil = pr.NacaProfile(digits='23012', n_points=240, cosine_spacing=False) ydown_expected = np.load( 'tests/test_datasets/naca5_23012_ydown_linear.npy') np.testing.assert_almost_equal(foil.ydown_coordinates, ydown_expected)
def create_sample_blade_NACA_10(): sections = np.asarray( [pr.NacaProfile(digits='0012', n_points=10) for i in range(2)]) radii = np.array([0.4, 0.5]) chord_lengths = np.array([0.55, 0.7]) pitch = np.array([3.0, 3.2]) rake = np.array([5e-3, 0.015]) skew_angles = np.array([-4., -7]) return bl.Blade(sections=sections, radii=radii, chord_lengths=chord_lengths, pitch=pitch, rake=rake, skew_angles=skew_angles)
def create_sample_blade_NACA(): sections = np.asarray([pr.NacaProfile(digits='0012') for i in range(10)]) radii = np.arange(0.4, 1.31, 0.1) chord_lengths = np.concatenate( (np.arange(0.55, 1.1, 0.15), np.arange(1.03, 0.9, -0.03), np.array([0.3]))) pitch = np.append(np.arange(3.0, 4., 0.2), np.arange(4.1, 3.2, -0.2)) rake = np.append(np.arange(5e-3, 0.08, 1e-2), np.arange(0.075, 0.02, -3e-2)) skew_angles = np.append(np.arange(-4., -9., -3.), np.arange(-7., 15., 3.)) return bl.Blade(sections=sections, radii=radii, chord_lengths=chord_lengths, pitch=pitch, rake=rake, skew_angles=skew_angles)
def test_naca_4_symmetric_yup(self): foil = pr.NacaProfile(digits='0012', n_points=240) yup_expected = np.load('tests/test_datasets/naca4_0012_yup.npy') np.testing.assert_almost_equal(foil.yup_coordinates, yup_expected)
def test_digits_not_string(self): with self.assertRaises(TypeError): pr.NacaProfile(digits=2412, n_points=240)
def test_naca_5_cambered_reflexed_ydown(self): foil = pr.NacaProfile(digits='23112', n_points=240) ydown_expected = np.load('tests/test_datasets/naca5_23112_ydown.npy') np.testing.assert_almost_equal(foil.ydown_coordinates, ydown_expected)
def test_naca_5_symmetric_ydown(self): foil = pr.NacaProfile(digits='00012', n_points=240) ydown_expected = np.load('tests/test_datasets/naca5_00012_ydown.npy') np.testing.assert_almost_equal(foil.ydown_coordinates, ydown_expected)
def test_npoints_float_1(self): profile = pr.NacaProfile(digits='2412', n_points=240.0) self.assertIsInstance(profile.n_points, int)
def test_npoints_float_2(self): profile = pr.NacaProfile(digits='2412', n_points=240.5) assert profile.n_points == 240
def test_naca_5_wrong_reflex(self): with self.assertRaises(ValueError): pr.NacaProfile(digits='24512', n_points=240)
def test_digits_not_entered(self): with self.assertRaises(TypeError): pr.NacaProfile()
def test_sections_list_to_ndarray(self): blade = create_sample_blade_NACA() blade.sections = [pr.NacaProfile(digits='0012') for i in range(10)] blade._check_params() self.assertIsInstance(blade.sections, np.ndarray)
def test_naca_series_not_implemented_3(self): with self.assertRaises(Exception): pr.NacaProfile(digits='712A315', n_points=240)
def test_npoints_negative(self): with self.assertRaises(ValueError): pr.NacaProfile(digits='0012', n_points=-240)
def test_npoints_not_number(self): with self.assertRaises(TypeError): pr.NacaProfile(digits='0012', n_points='240')
def test_naca_4_cambered_ydown_cosine(self): foil = pr.NacaProfile(digits='2412', n_points=240, cosine_spacing=True) ydown_expected = np.load( 'tests/test_datasets/naca4_2412_ydown_cosine.npy') np.testing.assert_almost_equal(foil.ydown_coordinates, ydown_expected)
def test_npoints_member(self): profile = pr.NacaProfile(digits='0012', n_points=240) assert profile.n_points == 240