Class AirfoilSection
Represents one spanwise section of an airfoil that calculates local aerodynamic forces. Each section independently computes lift, drag, and moment based on local flow conditions.
Namespace: NWH.Aerodynamics.Airfoils
Assembly: NWH.Aerodynamics.dll
Syntax
[Serializable]
public class AirfoilSection
Remarks
The finite wing is divided into multiple sections along the span. Each section evaluates the airfoil profile curves at its local angle of attack and applies forces at its aerodynamic center. Control surface deflections are integrated by combining the main airfoil section with its attached control section.
Constructors
| Edit this page View SourceAirfoilSection()
Declaration
public AirfoilSection()
AirfoilSection(string, Airfoil, FinitePlane, int)
Declaration
public AirfoilSection(string name, Airfoil parentAirfoil, FinitePlane fPlane, int subIndex = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| Airfoil | parentAirfoil | |
| FinitePlane | fPlane | |
| int | subIndex |
Fields
| Edit this page View SourceaT
Reference to the parent airfoil's transform system.
Declaration
public AirfoilTransform aT
Field Value
| Type | Description |
|---|---|
| AirfoilTransform |
aerodynamicCenter
Local position of the aerodynamic center in the parent airfoil's coordinate system.
Declaration
public Vector3 aerodynamicCenter
Field Value
| Type | Description |
|---|---|
| Vector3 |
aoa
Current angle of attack in degrees. Angle between the relative wind and the chord line. Positive when wind comes from below the chord line.
Declaration
public float aoa
Field Value
| Type | Description |
|---|---|
| float |
area
Planform area of this section in square meters. Used to scale aerodynamic forces.
Declaration
public float area
Field Value
| Type | Description |
|---|---|
| float |
cd
Current drag coefficient evaluated from the airfoil profile at the current angle of attack.
Declaration
public float cd
Field Value
| Type | Description |
|---|---|
| float |
chordLength
Average chord length of this section in meters. Distance from leading edge to trailing edge.
Declaration
public float chordLength
Field Value
| Type | Description |
|---|---|
| float |
cl
Current lift coefficient evaluated from the airfoil profile at the current angle of attack.
Declaration
public float cl
Field Value
| Type | Description |
|---|---|
| float |
cm
Current moment coefficient evaluated from the airfoil profile at the current angle of attack.
Declaration
public float cm
Field Value
| Type | Description |
|---|---|
| float |
controlAirfoil
Reference to the control surface airfoil attached to this section, if any.
Declaration
public Airfoil controlAirfoil
Field Value
| Type | Description |
|---|---|
| Airfoil |
controlAirfoilSectionIndex
Index of the control surface section that corresponds to this main wing section.
Declaration
public int controlAirfoilSectionIndex
Field Value
| Type | Description |
|---|---|
| int |
dragCenter
Local position where drag force is applied in the parent airfoil's coordinate system.
Declaration
public Vector3 dragCenter
Field Value
| Type | Description |
|---|---|
| Vector3 |
dragForce
Drag force vector in world space. Points opposite to the relative wind direction.
Declaration
public Vector3 dragForce
Field Value
| Type | Description |
|---|---|
| Vector3 |
dragMagnitude
Magnitude of drag force in Newtons.
Declaration
public float dragMagnitude
Field Value
| Type | Description |
|---|---|
| float |
fPlane
Defines the geometry of this section as a quadrilateral planform segment.
Declaration
public FinitePlane fPlane
Field Value
| Type | Description |
|---|---|
| FinitePlane |
liftForce
Lift force vector in world space. Perpendicular to both relative wind and span direction.
Declaration
public Vector3 liftForce
Field Value
| Type | Description |
|---|---|
| Vector3 |
liftMagnitude
Magnitude of lift force in Newtons.
Declaration
public float liftMagnitude
Field Value
| Type | Description |
|---|---|
| float |
momentMagnitude
Magnitude of pitching moment in Newton-meters.
Declaration
public float momentMagnitude
Field Value
| Type | Description |
|---|---|
| float |
momentTorque
Moment torque vector in world space. Positive creates nose-up pitching moment.
Declaration
public Vector3 momentTorque
Field Value
| Type | Description |
|---|---|
| Vector3 |
name
Display name of this section for debugging purposes.
Declaration
public string name
Field Value
| Type | Description |
|---|---|
| string |
parentAirfoil
Reference to the parent Airfoil that owns this section.
Declaration
public Airfoil parentAirfoil
Field Value
| Type | Description |
|---|---|
| Airfoil |
subIndex
Section index within the parent airfoil's sections list.
Declaration
public int subIndex
Field Value
| Type | Description |
|---|---|
| int |
Properties
| Edit this page View SourceAerodynamicCenter
Declaration
public Vector3 AerodynamicCenter { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
ControlAirfoilSection
Declaration
public AirfoilSection ControlAirfoilSection { get; }
Property Value
| Type | Description |
|---|---|
| AirfoilSection |
DragCenter
Declaration
public Vector3 DragCenter { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Methods
| Edit this page View SourceDrawGizmos()
Declaration
public void DrawGizmos()
Initialize(Airfoil, Atmosphere)
Initializes the section's geometry and calculates its area, chord length, and force application points.
Declaration
public void Initialize(Airfoil inParentAirfoil, Atmosphere atmosphere)
Parameters
| Type | Name | Description |
|---|---|---|
| Airfoil | inParentAirfoil | The Airfoil that owns this section. |
| Atmosphere | atmosphere | Optional Atmosphere component for altitude-dependent air density. |
Remarks
Computes the aerodynamic center and drag center positions along the chord line based on the parent airfoil's specified chord position ratios. Calculates the average chord length from the leading and trailing edge lengths.
OnPhysicsSubstep(float)
Calculates and applies lift, drag, and moment forces to the parent rigidbody.
Declaration
public void OnPhysicsSubstep(float dt)
Parameters
| Type | Name | Description |
|---|---|---|
| float | dt | Physics timestep in seconds. |
Remarks
Evaluates the airfoil profile curves at the current angle of attack to obtain Cl, Cd, and Cm. Forces are calculated using the standard aerodynamic equations with dynamic pressure (0.5 * rho * v^2 * area). Lift is applied at the aerodynamic center, drag at the drag center. Moment is applied as a force couple perpendicular to the chord line.
OnPrePhysicsSubstep(float)
Pre-calculates flow conditions and control surface effects before force calculation.
Declaration
public void OnPrePhysicsSubstep(float dt)
Parameters
| Type | Name | Description |
|---|---|---|
| float | dt | Physics timestep in seconds. |
Remarks
Computes the relative airflow velocity by combining the rigidbody's velocity at the aerodynamic center with wind velocity. If the relative velocity is below 0.1 m/s, skips force calculation for performance. When a control surface is attached, calculates the effective angle of attack and chord length based on the control surface deflection angle.
SetWindVelocity(Vector3)
Sets the ambient wind velocity affecting this section.
Declaration
public void SetWindVelocity(Vector3 vel)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | vel | Wind velocity vector in world space. |