STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
engine.pipeline.vehicle_drag Namespace Reference

Classes

class  VehicleGeometry
class  DragCurves

Functions

Tuple[float, float, float, float, float] isa_troposphere (float h_m)
float skin_friction_cf (float Re, float mach, float roughness_m, float length_m)
float stagnation_cd (float mach)
float base_cd (float mach)
float _subsonic_fit (float M, float m_lo, float value, float slope, float cd0)
str _nose_key (str kind)
float _haack_wave_cd (float mach, float fineness, str key)
float _cone_wave_cd (float mach, float fineness, float cd0, float shape_factor)
float nose_pressure_cd (float mach, str kind, float fineness)
float fin_pressure_cd (float mach, str profile, float le_sweep_rad)
np.ndarray nose_profile (str kind, float length_m, float radius_m, np.ndarray x)
float nose_wetted_area (str kind, float length_m, float radius_m, int n=20001)
float _tank_height (Any section, str h_attr, str r_attr)
Dict[str, float] built_stack (Any config)
VehicleGeometry vehicle_geometry (Any config, float nozzle_exit_area_m2, Optional[Dict[str, float]] stack=None)
Dict[str, float] drag_components (VehicleGeometry geom, float mach, *, float a_m_s, float nu_m2_s, bool thrusting)
DragCurves buildup_curves (VehicleGeometry geom, float reference_altitude_m, Sequence[float] mach_grid=MACH_GRID)
DragCurves table_curves (Sequence[Sequence[float]] power_off, Sequence[Sequence[float]] power_on, str source)
DragCurves resolve_drag_curves (Any config, float nozzle_exit_area_m2, Optional[Dict[str, float]] stack=None, **Any overrides)

Variables

float GAMMA_AIR = 1.4
float R_AIR = 287.05287
tuple FIN_PROFILES = ("square", "rounded", "airfoil")
str MODEL_NAME = "openrocket_barrowman"
 MACH_GRID = tuple(round(0.01 * i, 2) for i in range(1, 201))
dict _STONEY_FN3

Detailed Description

Axial drag of the vehicle the flight sim builds: Cd(M), motor off and motor on.

Component build-up of the OpenRocket technical documentation (S. Niskanen, "OpenRocket
technical documentation", v13.05, 2013, sec. 3.4 and app. B), which is Barrowman's method
(TIR-33, 1967) with Hoerner's (Fluid-Dynamic Drag, 1965) and Stoney's (NASA TR R-100, 1961)
data:

  friction  (3.78)-(3.85)   fully turbulent Cf, roughness-limited Cf, compressibility,
                            body-fineness and fin-thickness corrections on the wetted area
  nose      (3.86)-(3.87), (B.1)-(B.9)   0.8 sin^2(phi) at M = 0, wave drag from Stoney's
                            fineness-3 curves scaled to this nose's fineness
  fins      (3.89)-(3.93)   leading edge by profile with the cos^2 sweep correction, trailing
                            edge as base drag, on the fin frontal area N*t*s
  base      (3.94)          0.12 + 0.13 M^2 below M 1, 0.25/M above; while thrusting the
                            nozzle exit is taken out of the base area (sec. 3.4.5)

Where the document and OpenRocket's source (BarrowmanCalculator, SymmetricComponentCalc)
differ, the source is followed and the line says so. Not modelled: launch lugs and rail
buttons (3.95), fin-body interference, boattails (the built body has none), laminar runs
(the doc assumes turbulent from the tip, sec. 3.4.1).

RocketPy takes Cd as a function of Mach alone, so each row's Reynolds number is taken in the
ISA at one reference altitude, the launch site. At 1.5 km MSL the smooth-wall Cf is ~2 % higher;
a roughness-limited Cf does not depend on Re at all.

Function Documentation

◆ _cone_wave_cd()

float engine.pipeline.vehicle_drag._cone_wave_cd ( float mach,
float fineness,
float cd0,
float shape_factor )
protected
Conical wave drag (B.4)-(B.6), times the ogive shape factor (B.8) at and above M 1.

Definition at line 209 of file vehicle_drag.py.

References _subsonic_fit().

Referenced by nose_pressure_cd().

◆ _haack_wave_cd()

float engine.pipeline.vehicle_drag._haack_wave_cd ( float mach,
float fineness,
str key )
protected

Definition at line 193 of file vehicle_drag.py.

References _subsonic_fit(), and stagnation_cd().

Referenced by nose_pressure_cd().

◆ _nose_key()

str engine.pipeline.vehicle_drag._nose_key ( str kind)
protected

Definition at line 189 of file vehicle_drag.py.

Referenced by nose_pressure_cd(), and nose_profile().

◆ _subsonic_fit()

float engine.pipeline.vehicle_drag._subsonic_fit ( float M,
float m_lo,
float value,
float slope,
float cd0 )
protected
(3.87): a M^b + cd0, fitted to the value and slope at the transonic lower bound.

Definition at line 180 of file vehicle_drag.py.

Referenced by _cone_wave_cd(), and _haack_wave_cd().

◆ _tank_height()

float engine.pipeline.vehicle_drag._tank_height ( Any section,
str h_attr,
str r_attr )
protected
Tank cylinder height from the volume the caps and the ullage use (tank_capacity).

Definition at line 295 of file vehicle_drag.py.

Referenced by built_stack().

◆ base_cd()

float engine.pipeline.vehicle_drag.base_cd ( float mach)
(3.94), on the base area.

Definition at line 174 of file vehicle_drag.py.

Referenced by drag_components(), and fin_pressure_cd().

◆ buildup_curves()

DragCurves engine.pipeline.vehicle_drag.buildup_curves ( VehicleGeometry geom,
float reference_altitude_m,
Sequence[float] mach_grid = MACH_GRID )

Definition at line 395 of file vehicle_drag.py.

References drag_components(), and isa_troposphere().

Referenced by resolve_drag_curves().

◆ built_stack()

Dict[str, float] engine.pipeline.vehicle_drag.built_stack ( Any config)
The stack ui/flight_sim.py assembles, tail at z = 0 (RocketPy tail_to_nose).

Tank tops sit at motor_position + tank centre + h/2; the nose TIP is avionics_payload_length_m
above the highest of them (RocketPy's add_nose position is the tip). So the avionics length
includes the nose, and the body is a plain cylinder from the tail to the nose base.

Definition at line 303 of file vehicle_drag.py.

References _tank_height(), and max.

Referenced by vehicle_geometry().

◆ drag_components()

Dict[str, float] engine.pipeline.vehicle_drag.drag_components ( VehicleGeometry geom,
float mach,
* ,
float a_m_s,
float nu_m2_s,
bool thrusting )
Cd on the body cross-section, by component, (3.97).

Definition at line 370 of file vehicle_drag.py.

References base_cd(), fin_pressure_cd(), max, nose_pressure_cd(), nose_wetted_area(), and skin_friction_cf().

Referenced by buildup_curves().

◆ fin_pressure_cd()

float engine.pipeline.vehicle_drag.fin_pressure_cd ( float mach,
str profile,
float le_sweep_rad )
Leading plus trailing edge drag on the fin frontal area N*t*s, (3.89)-(3.93).

Definition at line 249 of file vehicle_drag.py.

References base_cd(), and stagnation_cd().

Referenced by drag_components().

◆ isa_troposphere()

Tuple[float, float, float, float, float] engine.pipeline.vehicle_drag.isa_troposphere ( float h_m)
(T [K], p [Pa], rho [kg/m3], a [m/s], nu [m2/s]) of the 1976 US Standard Atmosphere at a
geometric altitude, layers 0-2 (to 32 km geopotential). Sutherland viscosity, the standard's
1.458e-6 / 110.4 K.

Definition at line 59 of file vehicle_drag.py.

Referenced by buildup_curves().

◆ nose_pressure_cd()

float engine.pipeline.vehicle_drag.nose_pressure_cd ( float mach,
str kind,
float fineness )
Nose pressure (wave) drag on the nose base area, for a nose flush with the body.

Definition at line 232 of file vehicle_drag.py.

References _cone_wave_cd(), _haack_wave_cd(), and _nose_key().

Referenced by drag_components().

◆ nose_profile()

np.ndarray engine.pipeline.vehicle_drag.nose_profile ( str kind,
float length_m,
float radius_m,
np.ndarray x )
Nose radius at distance x from the tip (the shapes RocketPy draws).

Definition at line 271 of file vehicle_drag.py.

References _nose_key().

Referenced by nose_wetted_area().

◆ nose_wetted_area()

float engine.pipeline.vehicle_drag.nose_wetted_area ( str kind,
float length_m,
float radius_m,
int n = 20001 )
Surface of revolution, summed as frusta (exact for the polyline).

Definition at line 288 of file vehicle_drag.py.

References nose_profile().

Referenced by drag_components().

◆ resolve_drag_curves()

DragCurves engine.pipeline.vehicle_drag.resolve_drag_curves ( Any config,
float nozzle_exit_area_m2,
Optional[Dict[str, float]] stack = None,
**Any overrides )
The user's tables when given, else the build-up of the vehicle the sim assembles.

``overrides`` replaces build-up inputs by VehicleGeometry field name, e.g. the ceiling check's
``surface_roughness_m=0.0`` (hydraulically smooth: the low-drag end of the finish).

Definition at line 437 of file vehicle_drag.py.

References buildup_curves(), table_curves(), and vehicle_geometry().

◆ skin_friction_cf()

float engine.pipeline.vehicle_drag.skin_friction_cf ( float Re,
float mach,
float roughness_m,
float length_m )
Compressibility-corrected Cf on the wetted area, (3.78)-(3.84).

Definition at line 141 of file vehicle_drag.py.

References max.

Referenced by drag_components().

◆ stagnation_cd()

float engine.pipeline.vehicle_drag.stagnation_cd ( float mach)
Blunt-cylinder front drag on its frontal area, (B.1)-(B.2).

Definition at line 164 of file vehicle_drag.py.

Referenced by _haack_wave_cd(), and fin_pressure_cd().

◆ table_curves()

DragCurves engine.pipeline.vehicle_drag.table_curves ( Sequence[Sequence[float]] power_off,
Sequence[Sequence[float]] power_on,
str source )
A user's Cd(M) tables, put on one Mach grid (the union of both, linear in between).

Definition at line 422 of file vehicle_drag.py.

Referenced by resolve_drag_curves().

◆ vehicle_geometry()

VehicleGeometry engine.pipeline.vehicle_drag.vehicle_geometry ( Any config,
float nozzle_exit_area_m2,
Optional[Dict[str, float]] stack = None )

Definition at line 341 of file vehicle_drag.py.

References built_stack().

Referenced by resolve_drag_curves().

Variable Documentation

◆ _STONEY_FN3

dict engine.pipeline.vehicle_drag._STONEY_FN3
protected
Initial value:
1= {
2 "vonkarman": (
3 (0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 1.4, 1.6, 2.0, 3.0),
4 (0.0, 0.010, 0.027, 0.055, 0.070, 0.081, 0.095, 0.097, 0.091, 0.083),
5 ),
6 "lvhaack": (
7 (0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 1.4, 1.6, 2.0),
8 (0.0, 0.010, 0.024, 0.066, 0.084, 0.100, 0.114, 0.117, 0.113),
9 ),
10}

Definition at line 47 of file vehicle_drag.py.

◆ FIN_PROFILES

tuple engine.pipeline.vehicle_drag.FIN_PROFILES = ("square", "rounded", "airfoil")

Definition at line 38 of file vehicle_drag.py.

◆ GAMMA_AIR

float engine.pipeline.vehicle_drag.GAMMA_AIR = 1.4

Definition at line 36 of file vehicle_drag.py.

◆ MACH_GRID

engine.pipeline.vehicle_drag.MACH_GRID = tuple(round(0.01 * i, 2) for i in range(1, 201))

Definition at line 43 of file vehicle_drag.py.

◆ MODEL_NAME

str engine.pipeline.vehicle_drag.MODEL_NAME = "openrocket_barrowman"

Definition at line 39 of file vehicle_drag.py.

◆ R_AIR

float engine.pipeline.vehicle_drag.R_AIR = 287.05287

Definition at line 37 of file vehicle_drag.py.