Airfoil 2D
- class pyturbo.aero.airfoil2D.Airfoil2D(alpha1: float, alpha2: float, axial_chord: float, stagger: float, left_to_right: bool = False)[source]
Bases:
objectDesign a 2D Airfoil using bezier curves
- add_le_thickness(thickness: float, counter_rotation: bool = False)[source]
- Adds thickness to leading edge either on pressure side or suction side.
If counter rotation is false, thickness is added to the suction side
- Parameters:
thickness (float) – float value for defining a bezier curve thickness
counter_rotation (bool, optional) – switches the side for the bezier curve initial thickness. Defaults to False.
- add_pitch(x_pitch: float)[source]
Adds extra pitch by shifting the turbine blade over by a x direction
- Parameters:
x_pitch (float) – amount to shift in the pitch direction
- add_ps_thickness(thicknessArray: List[float], expansion_ratio: float = 1.2, camberPercent: float = 0.95, aft_loaded: bool = False)[source]
Add thickness to the pressure side
- Parameters:
thicknessArray (List[float]) – thickness along the pressure side. Example: [0.2400, 0.2000, 0.1600, 0.1400]
expansion_ratio (float, optional) – determines the spacing of the thickness array from leading edge. Defaults to 1.2.
camberPercent (float, optional) – Percent camber over which the thickness points are distributed. Defaults to 0.95.
aft_loaded (bool, optional) – If True, cluster thickness control points near the trailing edge (compressor-style aft-loaded). If False, cluster near the leading edge (turbine-style front-loaded). Defaults to False.
- add_ss_flow_guidance(n: int = 8)[source]
This function straightens out the suction side by specifying n bezier control points instead of a straight line.
- Parameters:
n (int) – number of control points, increase this to make straightening more aggressive. Defaults to 8.
- add_ss_flow_guidance_2(s_c: float, n: int)[source]
Straightens out the suction side. Computes the intersection point of the throat and draws a line, adds bezier points along the line
- Parameters:
s_c (float) – pitch-to-chord ratio
n (int) – number of bezier control points
- add_ss_thickness(thicknessArray: List[float], camberPercent: float = 0.8, expansion_ratio: float = 1.2, aft_loaded: bool = False)[source]
Adds thickness to the suction side by specifying bezier control points
- Parameters:
thicknessArray (List[float]) – thickness along the suction side. Example: [0.2400, 0.2000, 0.1600, 0.1400]
camberPercent (float, optional) – Percent camber where straightening of the suction side happens. Defaults to 1.
expansion_ratio (float, optional) – If thickness location is specified then this is not necessary otherwise thickness_loc is calculated by the expansion ratio. Defaults to 1.2.
aft_loaded (bool, optional) – If True, cluster thickness control points near the trailing edge (compressor-style aft-loaded). If False, cluster near the leading edge (turbine-style front-loaded). Defaults to False.
- alpha1: float
- alpha2: float
- cambBezierX: List[float]
- cambBezierY: List[float]
- center_le()[source]
Shifts the airfoil so the leading edge is at (0,0) instead of the trailing edge.
- chord: float
- custom_camber(x: float, y: float)[source]
- Creates a custom bezier curve camberline from 3 points [LEPoint, (x,y), TEPoint]
- Usage:
Example profile.custom_camber(0.5,0.5)
- Parameters:
x (float) – arbitrary x coordinate
y (float) – arbitrary y coordinate
- flip_cw()[source]
Flips the airfoil from counter-clockwise (CCW) to clockwise (CW) design by mirroring across the X-axis.
- get_centroid()[source]
Returns the centroid of the airfoil
- Returns:
centroid x and y coordinates (x,y)
- Return type:
float,float
- get_points(n: int = 100) Tuple[ndarray[tuple[int, ...], dtype[_ScalarType_co]], ndarray[tuple[int, ...], dtype[_ScalarType_co]]][source]
Returns n points defining the suction side and pressure side.
- Parameters:
n (int, optional) – Number of points. Defaults to 100.
- Returns:
suction side and pressure side point arrays, each of shape (n, 2)
- Return type:
Tuple[npt.NDArray,npt.NDArray]
- match_le_thickness()[source]
Matches the leading edge second derivative curvature. Convenience wrapper for match_thickness(‘LE’).
- match_thickness(location: str = 'LE')[source]
Matches the second derivative curvature at the leading or trailing edge by adjusting the opposite side thickness.
- Parameters:
location (str) – ‘LE’ to match leading edge (default), ‘TE’ to match trailing edge.
- Returns:
None
- plot2D()[source]
Plots the airfoil.
- Returns:
- The figure object. Caller can
fig.show(), fig.savefig(...), or pass it toplt.close(fig)when done.
- The figure object. Caller can
- Return type:
matplotlib.figure.Figure
- plot2D_channel(pitchChordRatio: float)[source]
plots the 2D airfoil in a channel with another airfoil given a pitch to chord ratio
- Parameters:
pitchChordRatio (float) – pitch to chord ratio (spacing between airfoils relative to the chord)
- Returns:
matplotlib figure containing the channel plot
- Return type:
plt.figure
- plot_camber()[source]
Plots the camber of the airfoil.
- Returns:
- The figure object. Caller can
fig.show(), fig.savefig(...), or pass it toplt.close(fig)when done.
- The figure object. Caller can
- Return type:
matplotlib.figure.Figure
- plot_derivative2(xlim=[0, 1], ylim=[-400, 400])[source]
Plots the second derivative of the airfoil.
References
https://mathformeremortals.wordpress.com/2013/01/12/a-numerical-second-derivative-from-three-points/
- Parameters:
xlim (list, optional) – Plot x-axis. Defaults to [0,1].
ylim (list, optional) – Plot y-axis. Defaults to [-400,400].
- psBezierX: List[float]
- psBezierY: List[float]
- psBezier_pw: pw_bezier2D | None
- rotate(angle: float)[source]
Rotates the airfoil around the origin by angle degrees (CCW positive).
- Parameters:
angle (float) – rotation angle in degrees
- shift(x: float, y: float)[source]
Shifts the blade over by x or y direction. LE points +y where TE is at (0,0) Be sure to take into account the rotation of the blade
- Parameters:
x (float) – amount to shift the blade by in x direction
y (float) – amount to shift the blade by in y direction
- ssBezierX: List[float]
- ssBezierY: List[float]
- ssBezier_pw: pw_bezier2D | None
- stagger: float
- te_create(radius: float, wedge_ss: float, wedge_ps: float)[source]
Creates the trailing edge using a semi-circle
- Parameters:
radius (float) – circle radius
wedge_ss (float) – wedge angle on the suction side
wedge_ps (float) – wedge angle on the pressure side
- pyturbo.aero.airfoil2D.channel_get(airfoil: Airfoil2D, s_c: float)[source]
Gets adjacent airfoil
- Parameters:
airfoil (Airfoil2D) – airfoil 2D object
s_c (float) – pitch to chord ratio
- Returns:
pitch in between airfoils numpy.ndarray: x coordinate of the suction side numpy.ndarray: x coordinate of the pressure side numpy.ndarray: y coordinate of the suction side numpy.ndarray: y coordinate of the pressure side airfoil2D: the adjacent airfoil
- Return type:
List[float]
- pyturbo.aero.airfoil2D.plot2D_compare(airfoils: List[Airfoil2D], labels: List[str] | None = None)[source]
Plots multiple 2D airfoils overlaid on the same figure for comparison.
- Parameters:
airfoils (List[Airfoil2D]) – list of Airfoil2D objects to plot
labels (Optional[List[str]]) – optional labels for each airfoil in the legend