airfoil module

Classes for generation of airfoil parametrically.

Revision:

1.0.0 $Date: 27/01/2023 09:33$

History:
  1. 1.0.0 - Initial Class Creation

Todo

Add method from

Salunke, N. P. & Juned Ahamad, R. A. Airfoil parameterization techniques: A review. American (2014)

class airfoil.AIRFOIL(xu=array([0.0]), yu=array([0.0]), xl=array([0.0]), yl=array([0.0]), name='myfoil')[source]

Bases: object

Class for reading, writing, plotting airfoil files.

Examples:

Example of modle generation

>>> myfoil = AIRFOIL()
>>> myfoil.read('database/rae2822.dat', 'Selig')
>>> airfoil.export('png')
__init__(xu=array([0.0]), yu=array([0.0]), xl=array([0.0]), yl=array([0.0]), name='myfoil')[source]

AIRFOIL Class Initialization.

Parameters
  • xu (ndarray) – horizontal coordinate on upper surface

  • yu (ndarray) – vertical coordinate on upper surface

  • xl (ndarray) – horizontal coordinate on lower surface

  • yl (ndarray) – vertical coordinate on lower surface

  • name (string) – name of airfoil

Returns

None

Documentation last updated: Jan. 27, 2023 - Shugo Date

read(f, format)[source]

read airfoil from file.

Parameters
  • f (string) – path to the file

  • format (string) – format of airfoil file

Returns

None

Documentation last updated: Jan. 27, 2023 - Shugo Date

show(camber=False)[source]
Parameters
  • n (int) – number of points

  • camber (bool) – True -> show camber

Returns

functino on upper surface ll (function?): functino on lower surface

Return type

lu (function?)

Documentation last updated: Jan. 27, 2023 - Shugo Date

savefig(ext, camber=False)[source]

save figure

Parameters
  • ext (string) – extension of file (pdf, png, …)

  • camber (bool) – True -> show camber

Returns

function on upper surface ll (function?): function on lower surface

Return type

lu (function?)

Output files:
  • ‘“airfoil_name”.png’ (binary): figure

Documentation last updated: Jan. 27, 2023 - Shugo Date

_get_line()[source]

get cubic spline curve of airfoil

Parameters

None

Returns

functino on upper surface ll (function?): functino on lower surface

Return type

lu (function?)

Documentation last updated: Jan. 27, 2023 - Shugo Date

_setlayout(ymin, ymax)[source]

get layouted fig and ax

Parameters
  • ymin (float) – lower limit of y

  • ymax (float) – upper limit of y

Returns

layouted figure ax (axes): layouted axes

Return type

fig (plt.figure)

Documentation last updated: Jan. 27, 2023 - Shugo Date

savetxt(path, format, ext)[source]

export airfoil file

Parameters
  • path (string) – path to the output directory

  • format (string) – format of file (selig, xml, …)

  • ext (string) – extension of file (dat, txt, …)

Returns

None

Output files:
  • ‘“name”.”ext”’ (ASCII): airfoil file

Documentation last updated: Jan. 27, 2023 - Shugo Date

class airfoil.CST(mu=4, ml=4, beta_u=[0.1277, 0.1399, 0.1903, 0.1927, 0.2019], beta_l=[-0.1299, -0.1345, -0.2247, -0.0783, 0.0412])[source]

Bases: AIRFOIL

Class for airfoils by CST method. Examples:

Example of modle generation

>>> airfoil = CST()
>>> airfoil.generate_airfoil(65)
>>> airfoil.savefig('png', camber=True)
>>> airfoil.show(camber=True)
>>> airfoil.savetxt('selig', 'dat')
Author:

Ryosuke Kano

Shugo Date

__init__(mu=4, ml=4, beta_u=[0.1277, 0.1399, 0.1903, 0.1927, 0.2019], beta_l=[-0.1299, -0.1345, -0.2247, -0.0783, 0.0412])[source]

CST Class Initialization.

Parameters
  • mu (int) – polynomial degree on upper surface

  • ml (int) – polynomial degree on lower surface

  • beta_u (ndarray) – coefficients of Bernstein polynomial on upper surface

  • beta_l (ndarray) – coefficients of Bernstein polynomial on lower surface

Returns

None

Documentation last updated: Jan. 27, 2023 - Shugo Date

read_coef_from_csv(file)[source]

read coefficient of Bernstein polynomial from csv file

Parameters

file (string) – file name of csv

Returns

None

Documentation last updated: Jan. 27, 2023 - Shugo Date

cst_curve(m, beta, x)[source]

generate airfoil

Parameters
  • m (int) – polynomial degree

  • beta (array) – coefficients of Bernstein polynomial

  • x (ndarray) – chord wise coordinates

Returns

vertical coordinates

Return type

y (ndarray)

Documentation last updated: Jan. 27, 2023 - Shugo Date

generate_airfoil(n)[source]

generate airfoil

Parameters

n (int) – nubmer of point

Returns

None

Documentation last updated: Jan. 27, 2023 - Shugo Date

class airfoil.NACA4(digits='0012')[source]

Bases: AIRFOIL

Class for NSCA 4-digit airfoils.

Examples:

Example of modle generation

>>> airfoil = NACA4()
>>> airfoil.generate_airfoil(65)
>>> airfoil.savefig('png', camber=True)
>>> airfoil.show(camber=True)
>>> airfoil.savetxt('selig', 'dat')
__init__(digits='0012')[source]

NACA4 Class Initialization.

Parameters

digits (string) – 4-digits to generate airfoil

1st digit: max. camber (%) 2nd digit: max. camber position (%) * 10 3-4th digit: max. wing thickness ratio (%)

Returns

None

Documentation last updated: Jan. 27, 2023 - Shugo Date

generate_airfoil(n)[source]

generate airfoil

Parameters

n (int) – nubmer of point

Returns

None

Documentation last updated: Jan. 27, 2023 - Shugo Date

y_camb1(x)[source]

calc camber before max camber

Parameters

x (float) – chordwise coordinate

Returns

vertical coordinate of camber

Return type

y (float)

Documentation last updated: Jan. 27, 2023 - Shugo Date

y_camb2(x)[source]

calc camber after max camber

Parameters

x (float) – chordwise coordinate

Returns

vertical coordinate of camber

Return type

y (float)

Documentation last updated: Jan. 27, 2023 - Shugo Date

calc_thick(x)[source]

calc thickness distribution

Parameters

x (float) – chordwise coordinate

Returns

thickness distribution

Return type

y (float)

Documentation last updated: Jan. 27, 2023 - Shugo Date