Class Atmosphere
Standard atmosphere model implementing ISA (International Standard Atmosphere). Calculates atmospheric properties as functions of altitude including density, pressure, temperature, and speed of sound. Used by aerodynamic components to adjust lift, drag, and engine performance based on altitude.
Namespace: NWH.Aerodynamics.Environment
Assembly: NWH.Aerodynamics.dll
Syntax
[Serializable]
public class Atmosphere : MonoBehaviour
Remarks
Model is accurate up to 10,800 meters (troposphere). Uses standard day conditions at sea level:
- Temperature: 288.15 K (15 C)
- Pressure: 101,325 Pa
- Density: 1.225 kg/m3 Temperature decreases with altitude at standard lapse rate of 6.5 K/km. Density and pressure decrease exponentially with altitude affecting aerodynamic forces quadratically.
Fields
| Edit this page View SourceAs
Atmospheric constant computed from gravity, molecular weight, and gas constant. Used in exponential pressure formula.
Declaration
[Tooltip("Constant.")]
public float As
Field Value
| Type | Description |
|---|---|
| float |
Cs
Speed of sound in m/s at current atmospheric conditions. Decreases with altitude as temperature drops. Used to calculate Mach number from airspeed.
Declaration
[Tooltip("Speed of sound [m/s]")]
public float Cs
Field Value
| Type | Description |
|---|---|
| float |
Gamma
Ratio of specific heats (Cp/Cv) for ideal diatomic gas. Used for speed of sound calculations.
Declaration
public const float Gamma = 1.4
Field Value
| Type | Description |
|---|---|
| float |
H
Geopotential height in meters. Accounts for gravitational variation with altitude. Used in atmospheric calculations.
Declaration
[Tooltip("Geopotential height [m]")]
public float H
Field Value
| Type | Description |
|---|---|
| float |
M
Mach number (ratio of airspeed to speed of sound). Dimensionless. Critical for compressibility effects above M 0.3.
Declaration
[Tooltip("Mach number")]
public float M
Field Value
| Type | Description |
|---|---|
| float |
M0
Mean molecular weight of air in kg/kmol. Assumes standard dry air composition.
Declaration
public const float M0 = 28.9644
Field Value
| Type | Description |
|---|---|
| float |
P
Current atmospheric pressure in Pascals. Decreases exponentially with altitude affecting engine performance and airspeed indicators.
Declaration
[Tooltip("Air pressure [Pa]")]
public float P
Field Value
| Type | Description |
|---|---|
| float |
P0
Sea level standard atmospheric pressure in Pascals (1 atm). Reference value for ISA calculations.
Declaration
[Tooltip("Air pressure at g0 [Pa]")]
public float P0
Field Value
| Type | Description |
|---|---|
| float |
R0
Earth radius at standard gravity location in meters. Used for geopotential height calculations.
Declaration
public const float R0 = 6356766
Field Value
| Type | Description |
|---|---|
| float |
Rs
Universal gas constant in Nm/(kmol K). Used in ideal gas law calculations.
Declaration
public const float Rs = 8314.32
Field Value
| Type | Description |
|---|---|
| float |
T
Current air temperature in Kelvin. Decreases linearly with altitude in troposphere at standard lapse rate.
Declaration
[Tooltip("Air temperature [K]")]
public float T
Field Value
| Type | Description |
|---|---|
| float |
T0
Sea level standard temperature in Kelvin (15 C). Reference value for ISA calculations.
Declaration
[Tooltip("Sea level temperature [K]")]
public float T0
Field Value
| Type | Description |
|---|---|
| float |
TL
Temperature lapse rate in K/m (6.5 K per 1000m). Rate at which temperature decreases with altitude in troposphere.
Declaration
[Tooltip("Temperature lapse rate [K]")]
public float TL
Field Value
| Type | Description |
|---|---|
| float |
Tc
Current air temperature in Celsius. Computed from T by subtracting Td (273.15 K).
Declaration
[Tooltip("Air temperature [C]")]
public float Tc
Field Value
| Type | Description |
|---|---|
| float |
Td
Zero degrees Celsius expressed in Kelvin (273.15). Used for temperature unit conversions.
Declaration
[Tooltip("Zero degrees C [K]")]
public float Td
Field Value
| Type | Description |
|---|---|
| float |
V
Free stream velocity (true airspeed) in m/s. Aircraft velocity relative to surrounding air mass. Used with speed of sound to compute Mach number.
Declaration
[Tooltip("Free stream velocity [m/s]")]
public float V
Field Value
| Type | Description |
|---|---|
| float |
Z
Geometric height (altitude) in meters above reference level. Input parameter for atmospheric calculations.
Declaration
[Tooltip("Geometric height [m]")]
public float Z
Field Value
| Type | Description |
|---|---|
| float |
g0
Gravitational acceleration in m/s^2. Defaults to standard gravity at 45 degrees latitude but reads from Physics.gravity at runtime.
Declaration
[Tooltip("Gravity at 45 deg lat [m/s^2]")]
public float g0
Field Value
| Type | Description |
|---|---|
| float |
rho
Current air density in kg/m3. Critical for all aerodynamic force calculations (varies quadratically with force). Decreases with altitude reducing lift, drag, and engine thrust.
Declaration
[Tooltip("Air density [kg/m^3]")]
public float rho
Field Value
| Type | Description |
|---|---|
| float |
rho0
Sea level standard air density in kg/m3. Reference value for ISA calculations and density ratio computations.
Declaration
[Tooltip("Air density at sea level [kg/m^3]")]
public float rho0
Field Value
| Type | Description |
|---|---|
| float |
rhoDefault
Default air density in kg/m3 used when Atmosphere component is not present. Represents sea level ISA conditions.
Declaration
public static float rhoDefault
Field Value
| Type | Description |
|---|---|
| float |
Methods
| Edit this page View SourceCalculate(float, float)
Updates all atmospheric properties based on current elevation and airspeed. Computes density, pressure, temperature, speed of sound, and Mach number using ISA model.
Declaration
public void Calculate(float elevation, float airspeed)
Parameters
| Type | Name | Description |
|---|---|---|
| float | elevation | Geometric altitude in meters above reference level |
| float | airspeed | True airspeed in m/s (velocity relative to air mass) |