Profile

class hotwing_core.Profile(*args)[source]

A Profile holds a representation of an airfoil, consisting of two Surface objects defining the top and bottom. The job of the Profile is to load a profile depending on the input the user initialized it with and maintain the Surfaces.

The Profile __init__ method can take a variety of different inputs using method overloading.

Initialization Method Overloading:

Profile(filepath):
filepath: String-like object containing the file path to dat file to load
Profile(url):
url: String-like object containing a URL to the dat file to load
Profile(coordinates)
coordinates: List of Coordinate Objects to create Profile from
Profile(top_surface, bottom_surface)
top_surface: Surface - top surface to create Profile from bottom_surface: Surface - bottom surface to create Profile from
Variables:
  • top – Surface object that makes up the top of the Profile
  • bottom – Surface object that makes up the bottom of the Profile
__add__(other)[source]
__eq__(other)[source]
__mul__(other)[source]
__ne__(other)[source]
__sub__(other)[source]
classmethod copy(profile)[source]

Create a copy of a Profile

Parameters:profile (Profile) – object to copy
Returns:new copied Profile object
Return type:Profile
classmethod interpolate_new_profile(p1, p2, dist_between, dist_interp, points=200)[source]

Create a new Profile interpolated from two other Profiles.

Delagates to the Surface objects.

Parameters:
  • p1 (Profile) – first profile to interpolate from
  • p2 (Profile) – second profile to interpolate from
  • dist_between (Float) – Distance between profiles
  • dist_interp (Float) – Distance from s1 where new profile should be interpolated
  • points (Int) – Number of points to use for interpolating each surface of the profile
Returns:

New Profile interpolated from s1 and s2

Return type:

Profile

classmethod offset_around_profile(profile, top_offset, bottom_offset)[source]

Offset each of a Profile’s Surfaces around itself. It can be thought of as scaling the Profile’s Surfaces inward or outward around the Surfaces.

Delagates to the Surface objects’ offset_around_surface method

Parameters:
  • profile (Profile) – object to offset
  • top_offset (Float) –
    • Positive value expands profile (offsets upwards/outwards),

    negative value contracs profile (offsets downwards/inwards).

  • bottom_offset (Float) –
    • Positive value expands profile (offsets downwards/outwards),

    negative value contracs profile (offsets upwards/inwards).

Returns:

new offset Profile

Return type:

Profile

classmethod rotate(origin, profile, angle)[source]

Rotate a Profile around a point.

Parameters:
  • origin (Coordinate) – object that defines the point to rotate profile around
  • profile (Profile) – object to rotate
  • angle (Float) – degrees to rotate profile.
Returns:

New rotated Profile

Return type:

Profile

classmethod scale(profile, scale)[source]

Scale a Profile

Delagates to the Surface objects’ scale method

Parameters:
  • profile (Profile) – object to scale
  • scale (Float) –
    • value to scale profile by. Value of 1 will produce no effect; 2 will double

    the size; 0.5 will reduce to half the size.

Returns:

new scaled Profile

Return type:

Profile

classmethod translate(profile, offset)[source]

Offset a Profile left, right, up or down.

Delagates to the Surface objects’ translate method

Parameters:
  • profile (Profile) – object to offset
  • offset (Coordinate) –
    • Amount to offset the Profile in the x and y directions - this value is

    simply added to each of the coordinates in the Profile’s Surfaces.

Returns:

new offset Profile

Return type:

Profile

classmethod trim(profile, x_min=None, x_max=None)[source]

Trim a Profile’s Surfaces to new starting and ending x values.

IMPORTANT - If you specify a value smaller than the min or larger than the max, by default those values will be interpolated and may actually make the width of the surface larger.

Delagates trim to the Surface objects

Parameters:
  • profile (Profile) – object to trim
  • x_min (Float) – left-most value to trim the profile to.
  • x_max (Float) – right-most value to trim the profile to.
Returns:

Profile - new trimmed Profile

classmethod trim_overlap(profile)[source]

Trims a Profiles Surfaces where they overlap.

After manipulating Surfaces, the profiles may now overlap. This method finds this point using the class’ _find_convergence_points method and then trims the profiles based on the results. If no over lap(s) is/are found, not trimming will occur.

Parameters:profile (Profile) – object to trim.
Returns:new trimmed Profile
Return type:Profile
left_midpoint

Find an XY position at the left-most value of the Profile half way vertically between the two Surfaces

  1. Finds the X value for the leftmost point in the Profile
  2. Finds/Interpolates the Coordinates on the top and bottom Surfaces for X
  3. Finds the point in between the Coordinates, which is a coordinate vertically mid-way
    between the points
Returns:
Return type:Coordinate
right_midpoint

Find a XY position at the right-most value of the Profile half way between vertically the two Surfaces

  1. Finds the X value for the right most point in the Profile
  2. Finds/Interpolates the Coordinates on the top and bottom Surfaces for X
  3. Finds the point in between the Coordinates, which is a coordinate vertically mid-way
    between the points
Returns:
Return type:Coordinate
x_bounds

Get the min and max X values in the Profile.

Returns:(min_x,max_x) - containing the min and max X values in the profile.
Return type:Tuple of Floats
y_bounds

Get the min and max Y values in the Profile.

Returns:(min_y,max_y) - containing the min and max y values in the profile.
Return type:Tuple of Floats