Expand description
§wind-profile
Vertical wind-profile extrapolation for wind energy: take the wind a weather model gives you at its fixed output heights and move it to the height a turbine actually harvests at, then correct for what the air weighs when it gets there.
§Why hub height is a first-class problem
Numerical weather models publish wind at a handful of fixed heights: 10 m always, and depending on the model an 80 m or 100 m level (GFS carries 80 m, the ECMWF open data carries 100 m). Modern turbine hubs sit at 80-160 m and climbing. Turbine power goes with the cube of wind speed below rated, so a relative error in extrapolated speed shows up three times as large in energy: 5% short on wind is roughly 15% short on generation. The vertical profile is not a rounding step, it is where the money is.
§Which law, when
- Power law,
wind_speed_m_s_power_law: the wind-energy engineering standard,u(z) = u_ref * (z / z_ref)^alpha. Useshear_exponent_from_two_levelsto derivealphafrom two model heights when the model provides them; that locality beats any tabulated exponent. With only one height,SHEAR_EXPONENT_ONE_SEVENTHis the classic neutral-onshore default (offshore shear is typically nearer 0.10). - Log law,
wind_speed_m_s_log_law: the surface-layer similarity form,u(z) = u_ref * ln(z / z0) / ln(z_ref / z0). Use it when you know the terrain and can pick a roughness length; theZ0_*constants carry the Davenport-Wieringa classification from open sea to city centre.
Both are neutral-stability forms, the honest baseline when all you have is model output. Diabatic (Monin-Obukhov) corrections need surface-flux inputs the target user rarely has and are deliberately out of scope for now.
use wind_profile as wp;
// A GFS-style pair: 6.2 m/s at 10 m, 8.9 m/s at 80 m. Derive the local shear...
let alpha = wp::shear_exponent_from_two_levels(6.2, 10.0, 8.9, 80.0);
assert!((alpha - 0.1738).abs() < 1e-3);
// ...and carry the 80 m wind up to a 120 m hub.
let u_hub = wp::wind_speed_m_s_power_law(8.9, 80.0, 120.0, alpha);
assert!((u_hub - 9.55).abs() < 0.01);§Air density, the other half of the power calculation
Power also scales linearly with air density, and density at a warm low-pressure site
is easily 10% off the 1.225 kg/m^3 reference that power curves are quoted at.
air_density_kg_m3 is the IEC 61400-12-1 equation (humidity-corrected, via the
standard’s own vapor-pressure fit), and density_corrected_wind_speed_m_s is the
standard’s (rho / rho_ref)^(1/3) wind-speed normalization that makes a measured
speed comparable against a reference-density power curve.
use wind_profile as wp;
// Dry air at ISA sea level is the IEC reference density exactly.
let rho = wp::air_density_kg_m3(288.15, 101_325.0, 0.0);
assert!((rho - wp::REFERENCE_AIR_DENSITY_KG_M3).abs() < 1e-3);Units are explicit in every function name: _m_s metres per second, _m metres,
_k kelvin, _pa pascals, _kg_m3 kilograms per cubic metre. Inputs are physical
quantities (heights above ground positive and above the roughness length, speeds
positive where a ratio is taken); outside that domain the arithmetic yields NaN or
infinity rather than a guess. No dependencies, no unsafe.
Constants§
- REFERENCE_
AIR_ DENSITY_ KG_ M3 - The reference air density power curves are quoted at (kg/m^3): ISA sea level.
- R_
DRY_ AIR - Specific gas constant of dry air (J/(kg*K)), the value fixed by IEC 61400-12-1.
- R_
WATER_ VAPOR - Specific gas constant of water vapor (J/(kg*K)), per IEC 61400-12-1.
- SHEAR_
EXPONENT_ ONE_ SEVENTH - The classic neutral-stability onshore shear exponent, 1/7. A default for when the
model gives only one wind height; prefer
shear_exponent_from_two_levelswhenever two heights exist. Offshore shear is typically nearer 0.10. - Z0_
CHAOTIC_ M - Roughness length (m), Davenport-Wieringa class 8 “chaotic”: city centre, high-rise.
- Z0_
CLOSED_ M - Roughness length (m), Davenport-Wieringa class 7 “closed”: forest, suburb.
- Z0_
OPEN_ M - Roughness length (m), Davenport-Wieringa class 3 “open”: flat grassland, few obstacles.
- Z0_
ROUGHLY_ OPEN_ M - Roughness length (m), Davenport-Wieringa class 4 “roughly open”: low crops, scattered obstacles.
- Z0_
ROUGH_ M - Roughness length (m), Davenport-Wieringa class 5 “rough”: high crops, obstacle rows.
- Z0_
SEA_ M - Roughness length (m), Davenport-Wieringa class 1 “sea”: open water, tidal flat.
- Z0_
SMOOTH_ M - Roughness length (m), Davenport-Wieringa class 2 “smooth”: featureless land, ice.
- Z0_
VERY_ ROUGH_ M - Roughness length (m), Davenport-Wieringa class 6 “very rough”: orchards, bushland.
Functions§
- air_
density_ kg_ m3 - Air density (kg/m^3) from temperature (K), pressure (Pa), and relative humidity (0 to 1), by the IEC 61400-12-1 equation.
- density_
corrected_ wind_ speed_ m_ s - Wind speed normalized to a reference air density, per IEC 61400-12-1:
u * (rho / rho_ref)^(1/3). - shear_
exponent_ from_ two_ levels - The shear exponent
alphaimplied by wind speeds observed at two heights:alpha = ln(u_hi / u_lo) / ln(z_hi / z_lo). - wind_
speed_ m_ s_ log_ law - Wind speed at height
z_mby the neutral log law:u_ref * ln(z / z0) / ln(z_ref / z0). - wind_
speed_ m_ s_ power_ law - Wind speed at height
z_mby the power law:u_ref * (z / z_ref)^alpha.