Skip to content

Commit b94fe89

Browse files
committed
added test check modified props
1 parent 71e7b52 commit b94fe89

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

tests/test_blade.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,3 +835,63 @@ def test_blade_str_method(self):
835835
string += '\nInduced rake from skew (in unit length)'\
836836
' for the sections = {}'.format(blade.induced_rake)
837837
assert blade.__str__() == string
838+
839+
def test_blade_parameters_unchanged_after_transformations_and_rotation(self):
840+
"""Test that blade parameters remain unchanged after transformations and rotation."""
841+
# Create the original parameters
842+
sections = np.asarray([NacaProfile(digits='0012') for i in range(10)])
843+
radii = np.arange(0.4, 1.31, 0.1)
844+
chord_lengths = np.concatenate((np.arange(0.55, 1.1, 0.15),
845+
np.arange(1.03, 0.9, -0.03),
846+
np.array([0.3])))
847+
pitch = np.append(np.arange(3.0, 4., 0.2), np.arange(4.1, 3.2, -0.2))
848+
rake = np.append(np.arange(5e-3, 0.08, 1e-2), np.arange(0.075, 0.02, -3e-2))
849+
skew_angles = np.append(np.arange(-4., -9., -3.), np.arange(-7., 15., 3.))
850+
851+
# Store original section data
852+
original_sections = []
853+
for section in sections:
854+
original_sections.append({
855+
'xup': section.xup_coordinates.copy(),
856+
'yup': section.yup_coordinates.copy(),
857+
'xdown': section.xdown_coordinates.copy(),
858+
'ydown': section.ydown_coordinates.copy()
859+
})
860+
861+
# Build the blade
862+
blade = bl.Blade(
863+
sections=sections,
864+
radii=radii,
865+
chord_lengths=chord_lengths,
866+
pitch=pitch,
867+
rake=rake,
868+
skew_angles=skew_angles)
869+
870+
# Apply transformations and rotate 180 degrees around z-axis
871+
blade.apply_transformations()
872+
blade.rotate(deg_angle=180)
873+
874+
# Verify parameters are unchanged
875+
for i, section in enumerate(blade.sections):
876+
np.testing.assert_array_equal(
877+
section.xup_coordinates,
878+
original_sections[i]['xup']
879+
)
880+
np.testing.assert_array_equal(
881+
section.yup_coordinates,
882+
original_sections[i]['yup']
883+
)
884+
np.testing.assert_array_equal(
885+
section.xdown_coordinates,
886+
original_sections[i]['xdown']
887+
)
888+
np.testing.assert_array_equal(
889+
section.ydown_coordinates,
890+
original_sections[i]['ydown']
891+
)
892+
893+
np.testing.assert_array_equal(blade.radii, radii)
894+
np.testing.assert_array_equal(blade.chord_lengths, chord_lengths)
895+
np.testing.assert_array_equal(blade.pitch, pitch)
896+
np.testing.assert_array_equal(blade.rake, rake)
897+
np.testing.assert_array_equal(blade.skew_angles, skew_angles)

0 commit comments

Comments
 (0)