#! /usr/bin/env python # def naca4_display_test ( ): #*****************************************************************************80 # ## NACA4_DISPLAY_TEST displays symmetric and cambered NACA 4 digit airfoils. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 13 July 2018 # # Author: # # John Burkardt # import matplotlib.pyplot as plt import numpy as np from naca4_cambered import naca4_cambered from naca4_mpt import naca4_mpt from naca4_symmetric import naca4_symmetric print ( '' ) print ( 'NACA4_DISPLAY_TEST' ) print ( ' Display symmetric and cambered NACA 4 digit airfoils.' ) print ( '' ) codes = np.array ( [ \ 6, 8, 9, 10, 12, \ 15, 18, 21, 24, 1408, 1410, 1412, 2408, 2410, 2411, 2412, 2414, 2415, 2418, 2421, 2424, 4412, 4415, 4418, 4421, 4424, 6409, 6412 ] ) code_num = 28 c = 10.0 n = 51 x = np.linspace ( 0.0, c, n ) for code in codes: print ( ' NACA %04d airfoil.' % ( code ) ) m, p, t = naca4_mpt ( code ) if ( m == 0.0 ): y = naca4_symmetric ( t, c, x ) x2 = np.append ( x, np.flip ( x, 0 ) ) y2 = np.append ( y, np.flip ( -y, 0 ) ) s = 'NACA%04d symmetric airfoil' % ( code ) else: [ xu, yu, xl, yl ] = naca4_cambered ( m, p, t, c, x ) x2 = np.append ( xu, np.flip ( xl, 0 ) ) y2 = np.append ( yu, np.flip ( yl, 0 ) ) s = 'NACA%04d cambered airfoil' % ( code ) plt.plot ( x2, y2, 'b-', linewidth = 3 ) plt.axis ( 'equal' ) plt.grid ( True ) plt.xlabel ( '<---X--->', fontsize = 16 ) plt.ylabel ( '<---Y--->', fontsize = 16 ) plt.title ( s, fontsize = 24 ) plt.show ( ) return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) naca4_display_test ( ) timestamp ( )