diff --git a/aerosandbox/geometry/airfoil/airfoil_database/Zone-21.dat b/aerosandbox/geometry/airfoil/airfoil_database/Zone-21.dat index 707ade66..cff43392 100644 --- a/aerosandbox/geometry/airfoil/airfoil_database/Zone-21.dat +++ b/aerosandbox/geometry/airfoil/airfoil_database/Zone-21.dat @@ -253,7 +253,4 @@ Zone-21 for DLG wings (c) Gerald Taylor 0.99747 -0.00025 0.99864 -0.00028 0.99949 -0.00032 - 0.99999 -0.00035 - 1.00000 -0.00036 - -26/10/2001 http://www.rcgroups.com/forums/showthread.php?t=1050398 \ No newline at end of file + 1.00000 -0.00036 \ No newline at end of file diff --git a/studies/AirfoilDatabaseQuality/compute_airfoil_quality.py b/studies/AirfoilDatabaseQuality/compute_airfoil_quality.py index 885dcffb..73c0ac5f 100644 --- a/studies/AirfoilDatabaseQuality/compute_airfoil_quality.py +++ b/studies/AirfoilDatabaseQuality/compute_airfoil_quality.py @@ -52,27 +52,29 @@ def compute_airfoil_quality(af: asb.Airfoil): if np.any(ds > 0.18): raise QualityError(f"Airfoil has abnormally long edge lengths ({np.max(ds)}).") - angles = np.arctan2d(dy, dx) - d_angles = np.abs(np.diff(angles, period=360)) - # if np.any(d_angles > 120): - # i = np.argmax(d_angles) - # raise QualityError(f"Airfoil has abnormally large changes in angle at (" - # f"{af.x()[i]}, " - # f"{af.y()[i]}" - # f"), {d_angles[i]:.3g} deg.") - - # is_mid_section = af.x() > 0.05 - is_mid_section = np.logical_and( - af.x() > 0.05, - af.x() < 0.99 + d_angles = np.concatenate([ # Angle changes between adjacent edges at each point + [0], + np.abs(np.diff(np.arctan2d(dy, dx), period=360)), + [0], + ], axis=0 ) - if np.any(d_angles[is_mid_section[1:-1]] > 30): - i = np.argmax(d_angles[is_mid_section[1:-1]]) - raise QualityError(f"Airfoil has abnormally large changes in angle in mid-section at (" - f"{af.x()[is_mid_section][i - 1]}, " - f"{af.y()[is_mid_section][i - 1]}" - f"), {d_angles[is_mid_section[1:-1]][i]:.3g} deg.") + allowable_d_angle = np.where( + af.x() < 0.05, + 160, # At the leading edge + np.where( + af.x() < 0.98, + 20, # In the middle + 45 # At the trailing edge + ) + ) + + if np.any(d_angles > allowable_d_angle): + i = np.argmax(d_angles - allowable_d_angle) + raise QualityError(f"Airfoil has abnormally large changes in angle at (" + f"{af.x()[i]:.6g}, " + f"{af.y()[i]:.6g}" + f"), {d_angles[i]:.3g} deg.") # Normalize the airfoil af = af.normalize()