pfh.glidersim.extras.airfoils#

Utility functions for loading airfoil coefficient data from text files.

Functions

load_datfile(file[, convention, center, ...])

Build an AirfoilGeometry from a .dat file using numpy.

load_datfile_set(directory[, bundled, ...])

Load a set of airfoil .dat files using numpy.

load_polar(polarname)

Load a gridded section polar from a bundled directory.

pfh.glidersim.extras.airfoils.load_polar(polarname: str) AirfoilCoefficientsInterpolator#

Load a gridded section polar from a bundled directory.

Parameters
polarnamestring

The name of a directory in pfh/glidersim/extras/airfoils/.

Returns
gsim.airfoil.AirfoilCoefficientsInterpolator
pfh.glidersim.extras.airfoils.load_datfile(file: str | Path | TextIO, convention: str = 'perpendicular', center: bool = False, derotate: bool = False, normalize: bool = False) AirfoilGeometry#

Build an AirfoilGeometry from a .dat file using numpy.

Parameters
filestring, Path, or file

The datfile with lines of airfoil ordinates.

convention{“perpendicular”, “vertical”}, optional

Whether the airfoil thickness is measured perpendicular to the mean camber line or vertically (the y-axis distance). Default: perpendicular

centerbool, optional

Translate the curve leading edge to the origin. Default: False

derotatebool, optional

Rotate the the chord parallel to the x-axis. Default: False

normalizebool, optional

Scale the curve so the chord is unit length. Default: False

Returns
gsim.airfoil.AirfoilGeometry

The instantiated AirfoilGeometry object.

pfh.glidersim.extras.airfoils.load_datfile_set(directory: str, bundled: bool = True, convention: str = 'perpendicular', center: bool = False, derotate: bool = False, normalize: bool = False) dict[float, AirfoilGeometry]#

Load a set of airfoil .dat files using numpy.

This is intended for use with a set of .dat files that represent a single airfoil geometry with deflected trailing edges. The vertical deflection distance must be the last part of the filename.

For example, the directory might contain:

naca23015_deltad0.00.dat naca23015_deltad0.10.dat naca23015_deltad0.20.dat

Parameters
directorystring

The directory containing a set of airfoil curves in the typical .dat format. The filenames must end with _delta<###>, where <###> is a floating point number

bundledbool

Whether directory is the name of a bundled profile set.

convention{“perpendicular”, “vertical”}, optional

Whether the airfoil thickness is measured perpendicular to the mean camber line or vertically (the y-axis distance). Default: perpendicular

centerbool, optional

Translate the curve leading edge to the origin. Default: False

derotatebool, optional

Rotate the the chord parallel to the x-axis. Default: False

normalizebool, optional

Scale the curve so the chord is unit length. Default: False

Returns
dict

A dictionary of {delta: gsim.airfoil.AirfoilGeometry} pairs, where delta is a float.