Esempio n. 1
0
def create_sample_profile():
    """
    xup_coordinates, yup_coordinates, xdown_coordinates, ydown_coordinates
    """
    profile = pb.ProfileBase()
    profile.xup_coordinates = np.linspace(-1.0, 1.0, 5)
    profile.yup_coordinates = np.array([0.0, 0.75, 1.0, 0.75, 0.0])
    profile.xdown_coordinates = np.linspace(-1.0, 1.0, 5)
    profile.ydown_coordinates = np.zeros(5)
    return profile
Esempio n. 2
0
def create_sample_profile_3():
    """
    Coordinates of unit circle (i.e. x^2+y^2=1)
    """
    profile = pb.ProfileBase()
    profile.xup_coordinates = np.linspace(-1.0, 1.0, num=250)
    profile.yup_coordinates = np.sqrt(1 - np.power(profile.xup_coordinates, 2))
    profile.xdown_coordinates = np.linspace(-1.0, 1.0, num=250)
    profile.ydown_coordinates = -np.sqrt(1 -
                                         np.power(profile.xup_coordinates, 2))
    return profile
Esempio n. 3
0
def create_sample_profile_2():
    """
    xup_coordinates != xdown_coordinates elementwise
    """
    profile = pb.ProfileBase()
    profile.xup_coordinates = np.linspace(-1.0, 1.0, 5)
    profile.yup_coordinates = np.array([0.0, 0.75, 1.0, 0.75, 0.0])
    profile.xdown_coordinates = np.linspace(-1.0, 1.0, 5)
    profile.xdown_coordinates[2] = 0.1
    profile.ydown_coordinates = np.zeros(5)
    return profile
Esempio n. 4
0
 def test_trailing_edge_init(self):
     profile = pb.ProfileBase()
     np.testing.assert_equal(profile.trailing_edge, np.zeros(2))
Esempio n. 5
0
 def test_trailing_edge_size(self):
     profile = pb.ProfileBase()
     assert profile.trailing_edge.size == 2
Esempio n. 6
0
 def test_leading_edge_size(self):
     profile = pb.ProfileBase()
     assert profile.leading_edge.size == 2
Esempio n. 7
0
 def test_camber_init(self):
     profile = pb.ProfileBase()
     assert profile.camber_line is None
Esempio n. 8
0
 def test_chord_init(self):
     profile = pb.ProfileBase()
     assert profile.chord_line is None
Esempio n. 9
0
 def test_ydown_init(self):
     profile = pb.ProfileBase()
     assert profile.ydown_coordinates is None
Esempio n. 10
0
 def test_xup_init(self):
     profile = pb.ProfileBase()
     assert profile.xup_coordinates is None
Esempio n. 11
0
 def test_scale_exceptions(self):
     profile = pb.ProfileBase()
     with self.assertRaises(TypeError):
         profile.scale()
Esempio n. 12
0
 def test_translate_exceptions(self):
     profile = pb.ProfileBase()
     with self.assertRaises(TypeError):
         profile.translate()
Esempio n. 13
0
 def test_rotate_exceptions_2(self):
     profile = pb.ProfileBase()
     with self.assertRaises(ValueError):
         profile.rotate(rad_angle=np.pi, deg_angle=180)
Esempio n. 14
0
 def test_interpolate_crds_exceptions_3(self):
     profile = pb.ProfileBase()
     with self.assertRaises(ValueError):
         profile.interpolate_coordinates(num=500, radius=-1.0)
Esempio n. 15
0
 def test_interpolate_crds_exceptions_1(self):
     profile = pb.ProfileBase()
     with self.assertRaises(TypeError):
         profile.interpolate_coordinates(num=500.5, radius=1.0)