def wave_drag(conditions,configuration,main_fuselage,propulsor,wing,num_engines,i_wing,Sref_main,flag105):
    # Use wave drag to determine compressibility drag for supersonic speeds

    # Unpack mach number
    mach       = conditions.freestream.mach_number
    
    # Create a copy that can be modified
    Mc         = copy.copy(mach)
    
    # This flag is for the interpolation mode
    if flag105 is True:
	# Change conditions and short hand for calculations
        conditions.freestream.mach_number = np.array([[1.05]] * len(Mc))
	mach = conditions.freestream.mach_number
    
    # Initalize cd array
    cd_c = np.array([[0.0]] * len(mach))
    
    # Calculate wing values at all mach numbers
    # Note that these functions arrange the supersonic values at the beginning of the array
    cd_lift_wave = wave_drag_lift(conditions,configuration,wing)
    cd_volume_wave = wave_drag_volume(conditions,configuration,wing)
    
    # Pack supersonic results into correct elements
    cd_c[mach >= 1.05] = cd_lift_wave[0:len(mach[mach >= 1.05]),0] + cd_volume_wave[0:len(mach[mach >= 1.05]),0]
    
    # Convert coefficient to full aircraft value
    if i_wing != 0:
        cd_c = cd_c*wing.areas.reference/Sref_main
	
    # Include fuselage and propulsors for one iteration
    if i_wing == 0:
	
	# Initialize arrays
	prop_drag = np.array([[0.0]] * len(mach))
	fuse_drag = np.array([[0.0]] * len(mach))
	
	# Fuselage wave drag
        if len(main_fuselage) > 0:
            fuse_drag[mach >= 1.05] = wave_drag_body_of_rev(main_fuselage.lengths.total,main_fuselage.effective_diameter/2.0,Sref_main)
        else:
            raise ValueError('Main fuselage does not have a total length')
	    
	# Propulsor wave drag	
        prop_drag[mach >= 1.05] = wave_drag_body_of_rev(propulsor.lengths.engine_total,propulsor.nacelle_dia/2.0,Sref_main)*propulsor.number_of_engines
        
        # Pack values
        cd_c[mach >= 1.05] = cd_c[mach >= 1.05] + fuse_drag[mach >= 1.05]
        cd_c[mach >= 1.05] = cd_c[mach >= 1.05] + prop_drag[mach >= 1.05]
    
    # Return dummy values for mcc and MDiv
    mcc = np.array([[0.0]] * len(mach))
    MDiv = np.array([[0.0]] * len(mach))

    # Reset mach number to real values
    conditions.freestream.mach_number = Mc
    
    return (cd_c,mcc,MDiv)
Exemplo n.º 2
0
def wave_drag(conditions, configuration, main_fuselage, propulsor, wing,
              num_engines, k, Sref_main, flag105):
    # Use wave drag to determine compressibility drag for supersonic speeds

    # Unpack mach number
    mach = conditions.freestream.mach_number

    # Create a copy that can be modified
    Mc = copy.copy(mach)

    # This flag is for the interpolation mode
    if flag105 is True:
        # Change conditions and short hand for calculations
        conditions.freestream.mach_number = np.array([[1.05]] * len(Mc))
        mach = conditions.freestream.mach_number

    # Initalize cd array
    cd_c = np.array([[0.0]] * len(mach))

    # Calculate wing values at all mach numbers
    # Note that these functions arrange the supersonic values at the beginning of the array
    cd_lift_wave = wave_drag_lift(conditions, configuration, wing)
    cd_volume_wave = wave_drag_volume(conditions, configuration, wing)

    # Pack supersonic results into correct elements
    cd_c[mach >= 1.05] = cd_lift_wave[0:len(mach[
        mach >= 1.05]), 0] + cd_volume_wave[0:len(mach[mach >= 1.05]), 0]

    # Convert coefficient to full aircraft value
    if k != 'main_wing':
        cd_c = cd_c * wing.areas.reference / Sref_main

    # Include fuselage and propulsors for one iteration

    # Return dummy values for mcc and MDiv
    mcc = np.array([[0.0]] * len(mach))
    MDiv = np.array([[0.0]] * len(mach))

    # Reset mach number to real values
    conditions.freestream.mach_number = Mc

    return (cd_c, mcc, MDiv)
def compressibility_drag_wing(conditions, configuration, geometry):
    """ SUAVE.Methods.compressibility_drag_wing(conditions,configuration,geometry)
        computes the induced drag associated with a wing 
        
        Inputs:
        
        Outputs:
        
        Assumptions:
            based on a set of fits
            
    """

    # unpack
    wings = geometry.Wings
    fuselages = geometry.Fuselages
    wing_lifts = conditions.aerodynamics.lift_breakdown.compressible_wings  # currently the total aircraft lift
    mach = conditions.freestream.mach_number
    drag_breakdown = conditions.aerodynamics.drag_breakdown

    # start result
    total_compressibility_drag = 0.0
    drag_breakdown.compressible = Results()

    # go go go
    for i_wing, wing, in enumerate(wings.values()):

        # unpack wing
        t_c_w = wing.t_c
        sweep_w = wing.sweep
        Mc = copy.copy(mach)

        for ii in range(len(Mc)):
            if Mc[ii] > 0.95 and Mc[ii] < 1.05:
                Mc[ii] = 0.95

            if Mc[ii] <= 0.95:

                if i_wing == 0:
                    cl_w = wing_lifts
                else:
                    cl_w = 0

                # get effective Cl and sweep
                tc = t_c_w / (np.cos(sweep_w))
                cl = cl_w / (np.cos(sweep_w))**2

                # compressibility drag based on regressed fits from AA241
                mcc_cos_ws = 0.922321524499352       \
                           - 1.153885166170620*tc    \
                           - 0.304541067183461*cl    \
                           + 0.332881324404729*tc**2 \
                           + 0.467317361111105*tc*cl \
                           + 0.087490431201549*cl**2

                # crest-critical mach number, corrected for wing sweep
                mcc = mcc_cos_ws / np.cos(sweep_w)

                # divergence mach number
                MDiv = mcc * (1.02 + 0.08 * (1 - np.cos(sweep_w)))

                # divergence ratio
                mo_mc = mach / mcc

                # compressibility correlation, Shevell
                dcdc_cos3g = 0.0019 * mo_mc**14.641

                # compressibility drag
                cd_c = dcdc_cos3g * (np.cos(sweep_w))**3

            else:
                cd_lift_wave = wave_drag_lift(conditions, configuration, wing)
                cd_volume_wave = wave_drag_volume(conditions, configuration,
                                                  wing)
                cd_c = cd_lift_wave + cd_volume_wave
                tc = 0
                sweep_w = 0
                mcc = 0
                MDiv = 0

            # increment
            #total_compressibility_drag += cd_c  ## todo when there is a lift break down by wing

            # dump data to conditions
            wing_results = Results(
                compressibility_drag=cd_c,
                thickness_to_chord=tc,
                wing_sweep=sweep_w,
                crest_critical=mcc,
                divergence_mach=MDiv,
            )
            #drag_breakdown.compressible[wing.tag] = wing_results

    #: for each wing

    # dump total comp drag
    total_compressibility_drag = drag_breakdown.compressible[
        1 + 0].compressibility_drag
    drag_breakdown.compressible.total = total_compressibility_drag

    return total_compressibility_drag, wing_results
Exemplo n.º 4
0
def wave_drag(conditions, configuration, main_fuselage, propulsor, wing,
              num_engines, i_wing, Sref_main, flag105):
    # Use wave drag to determine compressibility drag for supersonic speeds

    # Unpack mach number
    mach = conditions.freestream.mach_number

    # Create a copy that can be modified
    Mc = copy.copy(mach)

    # This flag is for the interpolation mode
    if flag105 is True:
        # Change conditions and short hand for calculations
        conditions.freestream.mach_number = np.array([[1.05]] * len(Mc))
        mach = conditions.freestream.mach_number

    # Initalize cd array
    cd_c = np.array([[0.0]] * len(mach))

    # Calculate wing values at all mach numbers
    # Note that these functions arrange the supersonic values at the beginning of the array
    cd_lift_wave = wave_drag_lift(conditions, configuration, wing)
    cd_volume_wave = wave_drag_volume(conditions, configuration, wing)

    # Pack supersonic results into correct elements
    cd_c[mach >= 1.05] = cd_lift_wave[0:len(mach[
        mach >= 1.05]), 0] + cd_volume_wave[0:len(mach[mach >= 1.05]), 0]

    # Convert coefficient to full aircraft value
    if i_wing != 0:
        cd_c = cd_c * wing.areas.reference / Sref_main

    # Include fuselage and propulsors for one iteration
    if i_wing == 0:

        # Initialize arrays
        prop_drag = np.array([[0.0]] * len(mach))
        fuse_drag = np.array([[0.0]] * len(mach))

        # Fuselage wave drag
        if len(main_fuselage) > 0:
            fuse_drag[mach >= 1.05] = wave_drag_body_of_rev(
                main_fuselage.lengths.total,
                main_fuselage.effective_diameter / 2.0, Sref_main)
        else:
            raise ValueError('Main fuselage does not have a total length')

        # Propulsor wave drag
        prop_drag[mach >= 1.05] = wave_drag_body_of_rev(
            propulsor.lengths.engine_total, propulsor.nacelle_dia / 2.0,
            Sref_main) * propulsor.number_of_engines

        # Pack values
        cd_c[mach >= 1.05] = cd_c[mach >= 1.05] + fuse_drag[mach >= 1.05]
        cd_c[mach >= 1.05] = cd_c[mach >= 1.05] + prop_drag[mach >= 1.05]

    # Return dummy values for mcc and MDiv
    mcc = np.array([[0.0]] * len(mach))
    MDiv = np.array([[0.0]] * len(mach))

    # Reset mach number to real values
    conditions.freestream.mach_number = Mc

    return (cd_c, mcc, MDiv)
def compressibility_drag_wing(conditions,configuration,geometry):
    """ SUAVE.Methods.compressibility_drag_wing(conditions,configuration,geometry)
        computes the induced drag associated with a wing 
        
        Inputs:
        
        Outputs:
        
        Assumptions:
            based on a set of fits
            
    """

    # unpack
    wings      = geometry.Wings
    fuselages   = geometry.Fuselages
    wing_lifts = conditions.aerodynamics.lift_breakdown.compressible_wings # currently the total aircraft lift
    mach       = conditions.freestream.mach_number
    drag_breakdown = conditions.aerodynamics.drag_breakdown
    
    # start result
    total_compressibility_drag = 0.0
    drag_breakdown.compressible = Results()

    # go go go
    for i_wing, wing, in enumerate(wings.values()):
        
        # unpack wing
        t_c_w   = wing.t_c
        sweep_w = wing.sweep
        Mc = copy.copy(mach)
        
        for ii in range(len(Mc)):
            if Mc[ii] > 0.95 and Mc[ii] < 1.05:
                Mc[ii] = 0.95
            
            
            if Mc[ii] <= 0.95:
        
        
                if i_wing == 0:
                    cl_w = wing_lifts
                else:
                    cl_w = 0
            
                # get effective Cl and sweep
                tc = t_c_w /(np.cos(sweep_w))
                cl = cl_w / (np.cos(sweep_w))**2
            
                # compressibility drag based on regressed fits from AA241
                mcc_cos_ws = 0.922321524499352       \
                           - 1.153885166170620*tc    \
                           - 0.304541067183461*cl    \
                           + 0.332881324404729*tc**2 \
                           + 0.467317361111105*tc*cl \
                           + 0.087490431201549*cl**2
                    
                # crest-critical mach number, corrected for wing sweep
                mcc = mcc_cos_ws / np.cos(sweep_w)
                
                # divergence mach number
                MDiv = mcc * ( 1.02 + 0.08*(1 - np.cos(sweep_w)) )
                
                # divergence ratio
                mo_mc = mach/mcc
                
                # compressibility correlation, Shevell
                dcdc_cos3g = 0.0019*mo_mc**14.641
                
                # compressibility drag
                cd_c = dcdc_cos3g * (np.cos(sweep_w))**3
                
            else:
                cd_lift_wave = wave_drag_lift(conditions,configuration,wing)
                cd_volume_wave = wave_drag_volume(conditions,configuration,wing)
                cd_c = cd_lift_wave + cd_volume_wave
                tc = 0
                sweep_w = 0
                mcc = 0
                MDiv = 0
        
            
            # increment
            #total_compressibility_drag += cd_c  ## todo when there is a lift break down by wing
            
            # dump data to conditions
            wing_results = Results(
                compressibility_drag      = cd_c    ,
                thickness_to_chord        = tc      , 
                wing_sweep                = sweep_w , 
                crest_critical            = mcc     ,
                divergence_mach           = MDiv    ,
            )
            #drag_breakdown.compressible[wing.tag] = wing_results

    #: for each wing
    
    # dump total comp drag
    total_compressibility_drag = drag_breakdown.compressible[1+0].compressibility_drag
    drag_breakdown.compressible.total = total_compressibility_drag

    return total_compressibility_drag, wing_results
Exemplo n.º 6
0
def wave_drag(conditions,configuration,main_fuselage,propulsor,wing,num_engines,k,Sref_main,flag105):
    """Use wave drag to determine compressibility drag for supersonic speeds

    Assumptions:
    Basic fit

    Source:
    adg.stanford.edu (Stanford AA241 A/B Course Notes)

    Inputs:
    conditions.freestream.mach_number            [Unitless]
    configuration
    main_fuselage (unused)
    propulsor     (unused)
    wing.areas.reference                         [m^2]
    num_engines   (unused)
    k             (tag for wing)                 [String]
    Sref_main (main reference area)              [m^2]
    flag105   (check if calcs are for Mach 1.05) [Boolean]
    

    Outputs:
    cd_c                    [Unitless]
    mcc                     [Unitless]
    MDiv                    [Unitless]

    Properties Used:
    N/A
    """    

    # Unpack mach number
    mach       = conditions.freestream.mach_number

    # Create a copy that can be modified
    Mc         = copy.copy(mach)

    # This flag is for the interpolation mode
    if flag105 is True:
        # Change conditions and short hand for calculations
        conditions.freestream.mach_number = np.array([[1.05]] * len(Mc))
        mach = conditions.freestream.mach_number

    # Initalize cd arrays
    cd_c   = np.array([[0.0]] * len(mach))
    cd_c_l = np.array([[0.0]] * len(mach)) # lift wave drag
    cd_c_v = np.array([[0.0]] * len(mach)) # vol wave drag

    # Calculate wing values at all mach numbers
    # Note that these functions arrange the supersonic values at the beginning of the array
    cd_lift_wave = wave_drag_lift(conditions,configuration,wing)
    cd_volume_wave = wave_drag_volume(conditions,configuration,wing)

    # Pack supersonic results into correct elements
    cd_c[mach >= 1.05] = cd_lift_wave[0:len(mach[mach >= 1.05]),0] + cd_volume_wave[0:len(mach[mach >= 1.05]),0]
    cd_c_l[mach >= 1.05] = cd_lift_wave[0:len(mach[mach >= 1.05]),0]
    cd_c_v[mach >= 1.05] = cd_volume_wave[0:len(mach[mach >= 1.05]),0]

    # Convert coefficient to full aircraft value
    cd_c = cd_c*wing.areas.reference/Sref_main
    cd_c_l = cd_c_l*wing.areas.reference/Sref_main
    cd_c_v = cd_c_v*wing.areas.reference/Sref_main

    # Include fuselage and propulsors for one iteration

    # Return dummy values for mcc and MDiv
    mcc = np.array([[0.0]] * len(mach))
    MDiv = np.array([[0.0]] * len(mach))

    # Reset mach number to real values
    conditions.freestream.mach_number = Mc

    return (cd_c,mcc,MDiv,cd_c_l,cd_c_v)