aerosandbox.library.aerodynamics ================================ .. py:module:: aerosandbox.library.aerodynamics Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/aerosandbox/library/aerodynamics/components/index /autoapi/aerosandbox/library/aerodynamics/inviscid/index /autoapi/aerosandbox/library/aerodynamics/normal_shock_relations/index /autoapi/aerosandbox/library/aerodynamics/transonic/index /autoapi/aerosandbox/library/aerodynamics/unsteady/index /autoapi/aerosandbox/library/aerodynamics/viscous/index Attributes ---------- .. autoapisummary:: aerosandbox.library.aerodynamics.machs aerosandbox.library.aerodynamics.mc Functions --------- .. autoapisummary:: aerosandbox.library.aerodynamics.CDA_control_linkage aerosandbox.library.aerodynamics.CDA_control_surface_gaps aerosandbox.library.aerodynamics.CDA_protruding_bolt_or_rivet aerosandbox.library.aerodynamics.CDA_perpendicular_sheet_metal_joint aerosandbox.library.aerodynamics.induced_drag aerosandbox.library.aerodynamics.oswalds_efficiency aerosandbox.library.aerodynamics.optimal_taper_ratio aerosandbox.library.aerodynamics.CL_over_Cl aerosandbox.library.aerodynamics.induced_drag_ratio_from_ground_effect aerosandbox.library.aerodynamics.mach_number_after_normal_shock aerosandbox.library.aerodynamics.density_ratio_across_normal_shock aerosandbox.library.aerodynamics.temperature_ratio_across_normal_shock aerosandbox.library.aerodynamics.pressure_ratio_across_normal_shock aerosandbox.library.aerodynamics.total_pressure_ratio_across_normal_shock aerosandbox.library.aerodynamics.q_ratio aerosandbox.library.aerodynamics.cubic_hermite_patch aerosandbox.library.aerodynamics.sears_haack_drag aerosandbox.library.aerodynamics.sears_haack_drag_from_volume aerosandbox.library.aerodynamics.mach_crit_Korn aerosandbox.library.aerodynamics.Cd_wave_Korn aerosandbox.library.aerodynamics.approximate_CD_wave aerosandbox.library.aerodynamics.Cd_cylinder aerosandbox.library.aerodynamics.Cf_flat_plate aerosandbox.library.aerodynamics.Cl_flat_plate aerosandbox.library.aerodynamics.Cd_flat_plate_normal aerosandbox.library.aerodynamics.Cl_2412 aerosandbox.library.aerodynamics.Cd_profile_2412 aerosandbox.library.aerodynamics.Cl_e216 aerosandbox.library.aerodynamics.Cd_profile_e216 aerosandbox.library.aerodynamics.Cd_wave_e216 aerosandbox.library.aerodynamics.Cl_rae2822 aerosandbox.library.aerodynamics.Cd_profile_rae2822 aerosandbox.library.aerodynamics.Cd_wave_rae2822 aerosandbox.library.aerodynamics.fuselage_upsweep_drag_area Package Contents ---------------- .. py:function:: CDA_control_linkage(Re_l, linkage_length, is_covered = False, is_top = False) Computes the drag area (CDA) of a typical control usage as used on a well-manufactured RC airplane. The drag area (CDA) is defined as: CDA == D / q, where: - D is the drag force (dimensionalized, e.g., in Newtons) - q is the freestream dynamic pressure (dimensionalized, e.g., in Pascals) See study with original data at `AeroSandbox/studies/LinkageDrag`. Data from: * Hepperle, Martin. "Drag of Linkages". https://www.mh-aerotools.de/airfoils/linkage.htm * Summarizes data from "Werner Würz, published in the papers of the ISF-Seminar in December 1989 in Baden, Switzerland." :param Re_l: Reynolds number, with reference length as the length of the linkage. :param linkage_length: The length of the linkage. [m] :param is_covered: A boolean of whether an aerodynamic fairing is placed around the linkage. :param is_top: A boolean of whether the linkage is on the top surface of the wing (True) or the bottom surface ( False). Differences in local boundary layer and inviscid effects cause local velocity changes. Returns: The drag area [m^2] of the control linkage. .. py:function:: CDA_control_surface_gaps(local_chord, control_surface_span, local_thickness_over_chord = 0.12, control_surface_hinge_x = 0.75, n_side_gaps = 2, side_gap_width = None, hinge_gap_width = None) Computes the drag area (CDA) of the gaps associated with a typical wing control surface. (E.g., aileron, flap, elevator, rudder). The drag area (CDA) is defined as: CDA == D / q, where: - D is the drag force (dimensionalized, e.g., in Newtons) - q is the freestream dynamic pressure (dimensionalized, e.g., in Pascals) This drag area consists of two sources: 1. Chordwise gaps at the side edges of the control surface ("side gaps") 2. Spanwise gaps at the hinge line of the control surface ("hinge gap") :param local_chord: The local chord of the wing at the midpoint of the control surface. [meters] :param control_surface_span: The span of the control surface. [meters] :param local_thickness_over_chord: The local thickness-to-chord ratio of the wing at the midpoint of the control surface. [nondimensional] For example, this is 0.12 for a NACA0012 airfoil. :param control_surface_hinge_x: The x-location of the hinge line of the control surface, as a fraction of the local chord. [nondimensional] Defaults to x_hinge / c = 0.75, which is typical for an aileron. :param n_side_gaps: The number of "side gaps" to count on this control surface when computing drag. Defaults to 2 ( i.e., one inboard gap, one outboard gap), which is the simplest case of a wing with a single partial-span aileron. However, there may be cases where it is best to reduce this to 1 or 0. For example: * A wing with a single full-span aileron would have 1 side gap (at the wing root, but not at the tip). * A wing with a flap and aileron that share a chordwise gap would be best modeled by setting n_side_gaps = 1 ( so that no double-counting occurs). :param side_gap_width: The width of the chordwise gaps at the side edges of the control surface [meters]. If this is left as the default (None), then a typical value will be computed based on the local chord and control surface span. :param hinge_gap_width: The width of the spanwise gap at the hinge line of the control surface [meters]. If this is left as the default (None), then a typical value will be computed based on the local chord. Returns: The drag area [m^2] of the gaps associated with the control surface. This should be added to the "clean" wing drag to get a more realistic drag estimate. .. py:function:: CDA_protruding_bolt_or_rivet(diameter, kind = 'flush_rivet') Computes the drag area (CDA) of a protruding bolt or rivet. The drag area (CDA) is defined as: CDA == D / q, where: - D is the drag force (dimensionalized, e.g., in Newtons) - q is the freestream dynamic pressure (dimensionalized, e.g., in Pascals) :param diameter: The diameter of the bolt or rivet. [meters] :param kind: The type of bolt or rivet. Valid options are: - "flush_rivet" - "round_rivet" - "flat_head_bolt" - "round_head_bolt" - "cylindrical_bolt" - "hex_bolt" Returns: The drag area [m^2] of the bolt or rivet. .. py:function:: CDA_perpendicular_sheet_metal_joint(joint_width, sheet_metal_thickness, kind = 'butt_joint_with_inside_joiner') Computes the drag area (CDA) of a sheet metal joint that is perpendicular to the flow. (E.g., spanwise on the wing, or circumferential on the fuselage). The drag area (CDA) is defined as: CDA == D / q, where: - D is the drag force (dimensionalized, e.g., in Newtons) - q is the freestream dynamic pressure (dimensionalized, e.g., in Pascals) :param joint_width: The width of the joint (perpendicular to the airflow, e.g., spanwise on a wing). [meters] :param sheet_metal_thickness: The thickness of the sheet metal. [meters] :param kind: The type of joint. Valid options are: - "butt_joint_with_inside_joiner" - "butt_joint_with_inside_weld" - "butt_joint_with_outside_joiner" - "butt_joint_with_outside_weld" - "lap_joint_forward_facing_step" - "lap_joint_backward_facing_step" - "lap_joint_forward_facing_step_with_bevel" - "lap_joint_backward_facing_step_with_bevel" - "lap_joint_forward_facing_step_with_rounded_bevel" - "lap_joint_backward_facing_step_with_rounded_bevel" - "flush_lap_joint_forward_facing_step" - "flush_lap_joint_backward_facing_step" Returns: The drag area [m^2] of the sheet metal joint. .. py:function:: induced_drag(lift, span, dynamic_pressure, oswalds_efficiency=1) Computes the induced drag associated with a lifting planar wing. :param lift: Lift force [Newtons] :param span: Wing span [meters] :param dynamic_pressure: Dynamic pressure [Pascals] :param oswalds_efficiency: Oswald's efficiency factor [-] Returns: Induced drag force [Newtons] .. py:function:: oswalds_efficiency(taper_ratio, aspect_ratio, sweep = 0.0, fuselage_diameter_to_span_ratio = 0.0, method='nita_scholz') Computes the Oswald's efficiency factor for a planar, tapered, swept wing. Based on "Estimating the Oswald Factor from Basic Aircraft Geometrical Parameters" by M. Nita, D. Scholz; Hamburg Univ. of Applied Sciences, 2012. https://www.fzt.haw-hamburg.de/pers/Scholz/OPerA/OPerA_PUB_DLRK_12-09-10.pdf Implementation of Section 5 from the above paper. Only valid for backwards-swept wings; i.e. 0 <= sweep < 90. :param taper_ratio: Taper ratio of the wing (tip_chord / root_chord) [-] :param aspect_ratio: Aspect ratio of the wing (b^2 / S) [-] :param sweep: Wing quarter-chord sweep angle [deg] Returns: Oswald's efficiency factor [-] .. py:function:: optimal_taper_ratio(sweep=0.0) Computes the optimal (minimum-induced-drag) taper ratio for a given quarter-chord sweep angle. Based on "Estimating the Oswald Factor from Basic Aircraft Geometrical Parameters" by M. Nita, D. Scholz; Hamburg Univ. of Applied Sciences, 2012. Only valid for backwards-swept wings; i.e. 0 <= sweep < 90. :param sweep: Wing quarter-chord sweep angle [deg] Returns: Optimal taper ratio .. py:function:: CL_over_Cl(aspect_ratio, mach = 0.0, sweep = 0.0, Cl_is_compressible = True) Returns the ratio of 3D lift coefficient (with compressibility) to the 2D lift coefficient. Specifically: CL_3D / CL_2D :param aspect_ratio: The aspect ratio of the wing. :param mach: The freestream Mach number. :param sweep: The sweep of the wing, in degrees. To be most accurate, this should be the sweep at the locus of :param thickest points along the wing.: :param Cl_is_compressible: This flag indicates whether the 2D airfoil data already has compressibility effects :param modeled.: For example: * If this flag is True, this function returns: CL_3D / CL_2D, where CL_2D is the sectional lift coefficient based on the local profile at the freestream mach number. * If this flag is False, this function returns: CL_3D / CL_2D_at_mach_zero, where CL_2D_... is the sectional lift coefficient based on the local profile at mach zero. For most accurate results, set this flag to True, and then model profile characteristics separately. .. py:function:: induced_drag_ratio_from_ground_effect(h_over_b) Gives the ratio of actual induced drag to free-flight induced drag experienced by a wing in ground effect. Artificially smoothed below around h/b == 0.05 to retain differentiability and practicality. Source: W. F. Phillips, D. F. Hunsaker, "Lifting-Line Predictions for Induced Drag and Lift in Ground Effect". Using Equation 5 from the paper, which is modified from a model from Torenbeek: Torenbeek, E. "Ground Effects", 1982. :param h_over_b: (Height above ground) divided by (wingspan). :return: Ratio of induced drag in ground effect to induced drag out of ground effect [unitless] .. py:data:: machs .. py:function:: mach_number_after_normal_shock(mach_upstream, gamma=1.4) Computes the mach number immediately after a normal shock wave. :param mach_upstream: The mach number immediately before the normal shock wave. :param gamma: The ratio of specific heats of the fluid. 1.4 for air. Returns: The mach number immediately after the normal shock wave. .. py:function:: density_ratio_across_normal_shock(mach_upstream, gamma=1.4) Computes the ratio of fluid density across a normal shock. Specifically, returns: rho_after_shock / rho_before_shock :param mach_upstream: The mach number immediately before the normal shock wave. :param gamma: The ratio of specific heats of the fluid. 1.4 for air. Returns: rho_after_shock / rho_before_shock .. py:function:: temperature_ratio_across_normal_shock(mach_upstream, gamma=1.4) Computes the ratio of fluid temperature across a normal shock. Specifically, returns: T_after_shock / T_before_shock :param mach_upstream: The mach number immediately before the normal shock wave. :param gamma: The ratio of specific heats of the fluid. 1.4 for air. Returns: T_after_shock / T_before_shock .. py:function:: pressure_ratio_across_normal_shock(mach_upstream, gamma=1.4) Computes the ratio of fluid static pressure across a normal shock. Specifically, returns: P_after_shock / P_before_shock :param mach_upstream: The mach number immediately before the normal shock wave. :param gamma: The ratio of specific heats of the fluid. 1.4 for air. Returns: P_after_shock / P_before_shock .. py:function:: total_pressure_ratio_across_normal_shock(mach_upstream, gamma=1.4) Computes the ratio of fluid total pressure across a normal shock. Specifically, returns: Pt_after_shock / Pt_before_shock :param mach_upstream: The mach number immediately before the normal shock wave. :param gamma: The ratio of specific heats of the fluid. 1.4 for air. Returns: Pt_after_shock / Pt_before_shock .. py:function:: q_ratio(mach) .. py:function:: cubic_hermite_patch(x, x_a, x_b, f_a, f_b, dfdx_a, dfdx_b, extrapolation = 'continue') Computes the cubic Hermite polynomial patch that passes through the given endpoints and endpoint derivatives. :param x: Scalar or array of values at which to evaluate the patch. :param x_a: The x-coordinate of the first endpoint. :param x_b: The x-coordinate of the second endpoint. :param f_a: The function value at the first endpoint. :param f_b: The function value at the second endpoint. :param dfdx_a: The derivative of the function with respect to x at the first endpoint. :param dfdx_b: The derivative of the function with respect to x at the second endpoint. :param extrapolation: A string indicating how to handle extrapolation outside of the domain [x_a, x_b]. Valid values are "continue", which continues the patch beyond the endpoints, and "clip", which clips the patch at the endpoints. Default is "continue". :returns: The value of the patch evaluated at the input x. Returns a scalar if x is a scalar, or an array if x is an array. .. py:function:: sears_haack_drag(radius_max, length) Yields the idealized drag area (denoted CDA, or equivalently, D/q) of a Sears-Haack body. Assumes linearized supersonic (Prandtl-Glauert) flow. https://en.wikipedia.org/wiki/Sears%E2%80%93Haack_body Note that drag coefficient and drag area are independent of Mach number for this case (assuming linearized supersonic aero). :param radius_max: The maximum radius of the Sears-Haack body. :param length: The length of the Sears-Haack body. Returns: The drag area (CDA, or D/q) of the body. To get the drag force, multiply by the dynamic pressure. .. py:function:: sears_haack_drag_from_volume(volume, length) See documentation for sears_haack_drag() in this same file. Identical, except takes volume as an input rather than max radius. Also returns a drag area (denoted CDA, or equivalently, D/q). .. py:function:: mach_crit_Korn(CL, t_over_c, sweep=0, kappa_A=0.95) Wave drag_force coefficient prediction using the low-fidelity Korn Equation method; derived in "Configuration Aerodynamics" by W.H. Mason, Sect. 7.5.2, pg. 7-18 :param CL: Sectional lift coefficient :param t_over_c: thickness-to-chord ratio :param sweep: sweep angle, in degrees :param kappa_A: Airfoil technology factor (0.95 for supercritical section, 0.87 for NACA 6-series) Returns: .. py:function:: Cd_wave_Korn(Cl, t_over_c, mach, sweep=0, kappa_A=0.95) Wave drag_force coefficient prediction using the low-fidelity Korn Equation method; derived in "Configuration Aerodynamics" by W.H. Mason, Sect. 7.5.2, pg. 7-18 :param Cl: Sectional lift coefficient :param t_over_c: thickness-to-chord ratio :param sweep: sweep angle, in degrees :param kappa_A: Airfoil technology factor (0.95 for supercritical section, 0.87 for NACA 6-series) :return: Wave drag coefficient .. py:function:: approximate_CD_wave(mach, mach_crit, CD_wave_at_fully_supersonic) An approximate relation for computing transonic wave drag, based on an object's Mach number. Considered reasonably valid from Mach 0 up to around Mach 2 or 3-ish. Methodology is a combination of: * The methodology described in Raymer, "Aircraft Design: A Conceptual Approach", Section 12.5.10 Transonic Parasite Drag (pg. 449 in Ed. 2) and * The methodology described in W.H. Mason's Configuration Aerodynamics, Chapter 7. Transonic Aerodynamics of Airfoils and Wings. :param mach: Mach number at the operating point to be evaluated :param mach_crit: Critical mach number, a function of the body geometry :param CD_wave_at_fully_supersonic: The wave drag coefficient of the body at the speed that it first goes ( :param effectively) fully supersonic.: Here, that is taken to mean at the Mach 1.2 case. This value should probably be derived using something similar to a Sears-Haack relation for the body in question, with a markup depending on geometry smoothness. The CD_wave predicted by this function will match this value exactly at M=1.2 and M=1.05. The peak CD_wave that is predicted is ~1.23 * this value, which occurs at M=1.10. In the high-Mach limit, this function asymptotes at 0.80 * this value, as empirically stated by Raymer. However, this model is only approximate and is likely not valid for high-supersonic flows. Returns: The approximate wave drag coefficient at the specified Mach number. The reference area is whatever the reference area used in the `CD_wave_at_fully_supersonic` parameter is. .. py:data:: mc :value: 0.6 .. py:function:: Cd_cylinder(Re_D, mach = 0.0, include_mach_effects=True, subcritical_only=False) Returns the drag coefficient of a cylinder in crossflow as a function of its Reynolds number and Mach. :param Re_D: Reynolds number, referenced to diameter :param mach: Mach number :param include_mach_effects: If this is set False, it assumes Mach = 0, which simplifies the computation. :param subcritical_only: Determines whether the model models purely subcritical (Re < 300k) cylinder flows. Useful, since this model is now convex and can be more well-behaved. Returns: # TODO rework this function to use tanh blending, which will mitigate overflows .. py:function:: Cf_flat_plate(Re_L, method='hybrid-sharpe-convex') Returns the mean skin friction coefficient over a flat plate. Don't forget to double it (two sides) if you want a drag coefficient. :param Re_L: Reynolds number, normalized to the length of the flat plate. :param method: The method of computing the skin friction coefficient. One of: * "blasius": Uses the Blasius solution. Citing Cengel and Cimbala, "Fluid Mechanics: Fundamentals and Applications", Table 10-4. Valid approximately for Re_L <= 5e5. * "turbulent": Uses turbulent correlations for smooth plates. Citing Cengel and Cimbala, "Fluid Mechanics: Fundamentals and Applications", Table 10-4. Valid approximately for 5e5 <= Re_L <= 1e7. * "hybrid-cengel": Uses turbulent correlations for smooth plates, but accounts for a non-negligible laminar run at the beginning of the plate. Citing Cengel and Cimbala, "Fluid Mechanics: Fundamentals and Applications", Table 10-4. Returns: Mean skin friction coefficient over a flat plate. Valid approximately for 5e5 <= Re_L <= 1e7. * "hybrid-schlichting": Schlichting's model, that roughly accounts for a non-negligtible laminar run. Citing "Boundary Layer Theory" 7th Ed., pg. 644 * "hybrid-sharpe-convex": A hybrid model that blends the Blasius and Schlichting models. Convex in log-log space; however, it may overlook some truly nonconvex behavior near transitional Reynolds numbers. * "hybrid-sharpe-nonconvex": A hybrid model that blends the Blasius and Cengel models. Nonconvex in log-log-space; however, it may capture some truly nonconvex behavior near transitional Reynolds numbers. :returns: The skin friction coefficient, normalized to the length of the plate. :rtype: C_f You can view all of these functions graphically using `aerosandbox.library.aerodynamics.test_aerodynamics.test_Cf_flat_plate.py` .. py:function:: Cl_flat_plate(alpha, Re_c=None) Returns the approximate lift coefficient of a flat plate, following thin airfoil theory. :param alpha: Angle of attack [deg] :param Re_c: Reynolds number, normalized to the length of the flat plate. :return: Approximate lift coefficient. .. py:function:: Cd_flat_plate_normal() Returns the drag coefficient of a flat plat oriented normal to the flow (i.e., alpha = 90 deg). Uses results from Tian, Xinliang, Muk Chen Ong, Jianmin Yang, and Dag Myrhaug. “Large-Eddy Simulation of the Flow Normal to a Flat Plate Including Corner Effects at a High Reynolds Number.” Journal of Fluids and Structures 49 ( August 2014): 149–69. https://doi.org/10.1016/j.jfluidstructs.2014.04.008. Note: Cd for this case is effectively invariant of Re. Returns: Drag coefficient .. py:function:: Cl_2412(alpha, Re_c) .. py:function:: Cd_profile_2412(alpha, Re_c) .. py:function:: Cl_e216(alpha, Re_c) .. py:function:: Cd_profile_e216(alpha, Re_c) .. py:function:: Cd_wave_e216(Cl, mach, sweep=0.0) A curve fit I did to Eppler 216 airfoil data. Within -0.4 < CL < 0.75 and 0 < mach < ~0.9, has R^2 = 0.9982. See: C:\Projects\GitHub\firefly_aerodynamics\MSES Interface\analysis\e216 :param Cl: Lift coefficient :param mach: Mach number :param sweep: Sweep angle, in deg :return: Wave drag coefficient. .. py:function:: Cl_rae2822(alpha, Re_c) .. py:function:: Cd_profile_rae2822(alpha, Re_c) .. py:function:: Cd_wave_rae2822(Cl, mach, sweep=0.0) A curve fit I did to RAE2822 airfoil data. Within -0.4 < CL < 0.75 and 0 < mach < ~0.9, has R^2 = 0.9982. See: C:\Projects\GitHub\firefly_aerodynamics\MSES Interface\analysis\rae2822 :param Cl: Lift coefficient :param mach: Mach number :param sweep: Sweep angle, in deg :return: Wave drag coefficient. .. py:function:: fuselage_upsweep_drag_area(upsweep_angle_rad, fuselage_xsec_area_max) Calculates the drag area (in m^2) of the aft end of a fuselage with a given upsweep angle. Upsweep is the characteristic shape seen on the aft end of many fuselages in transport aircraft, where the centerline of the fuselage is angled upwards near the aft end. This is done to reduce the required landing gear height for adequate takeoff rotation, which in turn reduces mass. This nonzero centerline angle can cause some separation drag, which is predicted here. Equation is from Raymer, Aircraft Design: A Conceptual Approach, 5th Ed., Eq. 12.36, pg. 440. :param upsweep_angle_rad: The upsweep angle of the aft end of the fuselage relative to the centerline, in radians. :param fuselage_xsec_area_max: The maximum cross-sectional area of the fuselage, in m^2. Returns: The drag area of the aft end of the fuselage [m^2]. This is equivalent to D/q, where D is the drag force and q is the dynamic pressure.