Class AirfoilProfile
ScriptableObject containing aerodynamic performance data for an airfoil cross-section. Stores lift, drag, and moment coefficient curves as functions of angle of attack.
Namespace: NWH.Aerodynamics.Airfoils
Assembly: NWH.Aerodynamics.dll
Syntax
[CreateAssetMenu(fileName = "AirfoilProfile", menuName = "NWH/Aerodynamics/AirfoilProfile", order = 1)]
public class AirfoilProfile : ScriptableObject
Remarks
Polar data is typically generated from airfoil analysis tools like XFOIL or wind tunnel testing. The ParsePolarData() method converts raw XFOIL output into Unity AnimationCurves for runtime evaluation. Over 1500 airfoil profiles are available in the UIUC Airfoil Database and compatible with this system.
Fields
| Edit this page View SourceaoaIndex
Angle of attack column index.
Declaration
[Tooltip("Angle of attack column index.")]
public int aoaIndex
Field Value
| Type | Description |
|---|---|
| int |
cdCoefficient
Multiplier for drag coefficient values from the curve. Scales all Cd values. Values below 1.0 reduce drag, above 1.0 increase drag. Default 1.0.
Declaration
[Tooltip("Coefficient of drag for this profile.")]
public float cdCoefficient
Field Value
| Type | Description |
|---|---|
| float |
cdCurve
Drag coefficient as a function of angle of attack in degrees. X-axis: angle of attack (-180 to +180 degrees), Y-axis: coefficient of drag (Cd).
Declaration
[Tooltip("Drag curve.")]
public AnimationCurve cdCurve
Field Value
| Type | Description |
|---|---|
| AnimationCurve |
cdIndex
Coefficient of drag column index.
Declaration
[Tooltip("Coefficient of drag column index.")]
public int cdIndex
Field Value
| Type | Description |
|---|---|
| int |
clCoefficient
Multiplier for lift coefficient values from the curve. Scales all Cl values. Values below 1.0 reduce lift, above 1.0 increase lift. Default 1.0.
Declaration
[Tooltip("Coefficient of lift for this profile.")]
public float clCoefficient
Field Value
| Type | Description |
|---|---|
| float |
clCurve
Lift coefficient as a function of angle of attack in degrees. X-axis: angle of attack (-180 to +180 degrees), Y-axis: coefficient of lift (Cl).
Declaration
[Tooltip("Lift curve.")]
public AnimationCurve clCurve
Field Value
| Type | Description |
|---|---|
| AnimationCurve |
clIndex
Coefficient of lift column index.
Declaration
[Tooltip("Coefficient of lift column index.")]
public int clIndex
Field Value
| Type | Description |
|---|---|
| int |
cmCoefficient
Multiplier for moment coefficient values from the curve. Scales all Cm values. Values below 1.0 reduce moment, above 1.0 increase moment. Default 1.0.
Declaration
[Tooltip("Moment coefficient for this profile.")]
public float cmCoefficient
Field Value
| Type | Description |
|---|---|
| float |
cmCurve
Pitching moment coefficient as a function of angle of attack in degrees. X-axis: angle of attack (-180 to +180 degrees), Y-axis: coefficient of moment (Cm). Positive values create nose-up pitching moment.
Declaration
[Tooltip("Moment curve.")]
public AnimationCurve cmCurve
Field Value
| Type | Description |
|---|---|
| AnimationCurve |
cmIndex
Moment coefficient column index.
Declaration
[Tooltip("Moment coefficient column index.")]
public int cmIndex
Field Value
| Type | Description |
|---|---|
| int |
headerLines
Number of lines in polar string before the data starts. 12 for XFOIL.
Declaration
[Tooltip("Number of lines in polar string before the data starts.\r\n12 for XFOIL.")]
public int headerLines
Field Value
| Type | Description |
|---|---|
| int |
polarString
Raw polar data text from XFOIL or similar airfoil analysis tool. Contains tabulated Cl, Cd, and Cm values at various angles of attack. Parsed by ParsePolarData() to generate coefficient curves.
Declaration
[TextArea(3, 8)]
[Tooltip("Raw simulation output for the airfoil shape.")]
public string polarString
Field Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceMakeSmooth(AnimationCurve)
Smooths out scripting-generated AnimationCurve. Runs only in editor.
Declaration
public static AnimationCurve MakeSmooth(AnimationCurve inCurve)
Parameters
| Type | Name | Description |
|---|---|---|
| AnimationCurve | inCurve |
Returns
| Type | Description |
|---|---|
| AnimationCurve |
ParsePolarData(string)
Parses raw polar data text and generates AnimationCurves for lift, drag, and moment coefficients.
Declaration
public bool ParsePolarData(string @string)
Parameters
| Type | Name | Description |
|---|---|---|
| string | string | Raw polar data string from XFOIL or similar tool. |
Returns
| Type | Description |
|---|---|
| bool | True if parsing succeeded, false otherwise. |
Remarks
Expects tabulated data with columns for angle of attack, Cl, Cd, and Cm. Column indices are specified by aoaIndex, clIndex, cdIndex, and cmIndex properties. Header lines (typically 12 for XFOIL) are skipped based on headerLines property. The resulting curves are automatically smoothed and extrapolated to ±90 degrees.