def parasite_drag_propulsor(state, settings, geometry): """ SUAVE.Methods.parasite_drag_propulsor(conditions,configuration,propulsor) computes the parasite drag associated with a propulsor Inputs: Outputs: Assumptions: """ # unpack inputs conditions = state.conditions configuration = settings propulsor = geometry Sref = propulsor.nacelle_diameter**2. / 4. * np.pi Swet = propulsor.areas.wetted l_prop = propulsor.engine_length d_prop = propulsor.nacelle_diameter # conditions freestream = conditions.freestream Mc = freestream.mach_number Tc = freestream.temperature re = freestream.reynolds_number # reynolds number Re_prop = re * l_prop # skin friction coefficient cf_prop, k_comp, k_reyn = compressible_turbulent_flat_plate( Re_prop, Mc, Tc) ## form factor according to Raymer equation (pg 283 of Aircraft Design: A Conceptual Approach) k_prop = 1 + 0.35 / (float(l_prop) / float(d_prop)) # find the final result propulsor_parasite_drag = k_prop * cf_prop * Swet / Sref # dump data to conditions propulsor_result = Results( wetted_area=Swet, reference_area=Sref, parasite_drag_coefficient=propulsor_parasite_drag, skin_friction_coefficient=cf_prop, compressibility_factor=k_comp, reynolds_factor=k_reyn, form_factor=k_prop, ) conditions.aerodynamics.drag_breakdown.parasite[ propulsor.tag] = propulsor_result return propulsor_parasite_drag
def parasite_drag_fuselage(state, settings, geometry): """Computes the parasite drag due to the fuselage Assumptions: Basic fit Source: adg.stanford.edu (Stanford AA241 A/B Course Notes) Inputs: state.conditions.freestream. mach_number [Unitless] temperature [K] reynolds_number [Unitless] settings.fuselage_parasite_drag_form_factor [Unitless] geometry.fuselage. areas.front_projected [m^2] areas.wetted [m^2] lengths.total [m] effective_diameter [m] Outputs: fuselage_parasite_drag [Unitless] Properties Used: N/A """ # unpack inputs configuration = settings form_factor = configuration.fuselage_parasite_drag_form_factor fuselage = geometry freestream = state.conditions.freestream Sref = fuselage.areas.front_projected Swet = fuselage.areas.wetted l_fus = fuselage.lengths.total d_fus = fuselage.effective_diameter # conditions Mc = freestream.mach_number Tc = freestream.temperature re = freestream.reynolds_number # reynolds number Re_fus = re * (l_fus) # skin friction coefficient cf_fus, k_comp, k_reyn = compressible_turbulent_flat_plate(Re_fus, Mc, Tc) # form factor for cylindrical bodies d_d = float(d_fus) / float(l_fus) D = np.array([[0.0]] * len(Mc)) a = np.array([[0.0]] * len(Mc)) du_max_u = np.array([[0.0]] * len(Mc)) k_fus = np.array([[0.0]] * len(Mc)) D[Mc < 0.95] = np.sqrt(1 - (1 - Mc[Mc < 0.95]**2) * d_d**2) a[Mc < 0.95] = 2 * (1 - Mc[Mc < 0.95]**2) * (d_d**2) * ( np.arctanh(D[Mc < 0.95]) - D[Mc < 0.95]) / (D[Mc < 0.95]**3) du_max_u[Mc < 0.95] = a[Mc < 0.95] / ((2 - a[Mc < 0.95]) * (1 - Mc[Mc < 0.95]**2)**0.5) D[Mc >= 0.95] = np.sqrt(1 - d_d**2) a[Mc >= 0.95] = 2 * (d_d**2) * (np.arctanh(D[Mc >= 0.95]) - D[Mc >= 0.95]) / (D[Mc >= 0.95]**3) du_max_u[Mc >= 0.95] = a[Mc >= 0.95] / ((2 - a[Mc >= 0.95])) k_fus = (1 + form_factor * du_max_u)**2 fuselage_parasite_drag = k_fus * cf_fus * Swet / Sref # dump data to conditions fuselage_result = Results( wetted_area=Swet, reference_area=Sref, parasite_drag_coefficient=fuselage_parasite_drag, skin_friction_coefficient=cf_fus, compressibility_factor=k_comp, reynolds_factor=k_reyn, form_factor=k_fus, ) try: state.conditions.aerodynamics.drag_breakdown.parasite[ fuselage.tag] = fuselage_result except: print("Drag Polar Mode fuse parasite") return fuselage_parasite_drag
def parasite_drag_fuselage(conditions, configuration, fuselage): """ SUAVE.Methods.parasite_drag_fuselage(conditions,configuration,fuselage) computes the parasite drag associated with a fuselage Inputs: Outputs: Assumptions: """ # unpack inputs form_factor = configuration.fuselage_parasite_drag_form_factor freestream = conditions.freestream Sref = fuselage.areas.front_projected Swet = fuselage.areas.wetted l_fus = fuselage.lengths.cabin d_fus = fuselage.width l_nose = fuselage.lengths.nose l_tail = fuselage.lengths.tail # conditions Mc = freestream.mach_number roc = freestream.density muc = freestream.viscosity Tc = freestream.temperature pc = freestream.pressure # reynolds number V = Mc * compute_speed_of_sound(Tc, pc) Re_fus = roc * V * l_fus / muc # skin friction coefficient cf_fus, k_comp, k_reyn = compressible_turbulent_flat_plate(Re_fus, Mc, Tc) # form factor for cylindrical bodies d_d = float(d_fus) / float(l_fus) D = np.sqrt(1 - (1 - Mc**2) * d_d**2) a = 2 * (1 - Mc**2) * (d_d**2) * (np.arctanh(D) - D) / (D**3) du_max_u = a / ((2 - a) * (1 - Mc**2)**0.5) k_fus = (1 + form_factor * du_max_u)**2 # -------------------------------------------------------- # find the final result fuselage_parasite_drag = k_fus * cf_fus * Swet / Sref # -------------------------------------------------------- # dump data to conditions fuselage_result = Result( wetted_area=Swet, reference_area=Sref, parasite_drag_coefficient=fuselage_parasite_drag, skin_friction_coefficient=cf_fus, compressibility_factor=k_comp, reynolds_factor=k_reyn, form_factor=k_fus, ) conditions.aerodynamics.drag_breakdown.parasite[ fuselage.tag] = fuselage_result return fuselage_parasite_drag
def parasite_drag_propulsor(state, settings, geometry): """Computes the parasite drag due to the propulsor Assumptions: Basic fit Source: adg.stanford.edu (Stanford AA241 A/B Course Notes) Inputs: state.conditions.freestream. mach_number [Unitless] temperature [K] reynolds_number [Unitless] geometry. nacelle_diameter [m^2] areas.wetted [m^2] engine_length [m] Outputs: propulsor_parasite_drag [Unitless] Properties Used: N/A """ # unpack inputs conditions = state.conditions configuration = settings propulsor = geometry Sref = propulsor.nacelle_diameter**2. / 4. * np.pi Swet = propulsor.areas.wetted l_prop = propulsor.engine_length d_prop = propulsor.nacelle_diameter # conditions freestream = conditions.freestream Mc = freestream.mach_number Tc = freestream.temperature re = freestream.reynolds_number # reynolds number Re_prop = re * l_prop # skin friction coefficient cf_prop, k_comp, k_reyn = compressible_turbulent_flat_plate( Re_prop, Mc, Tc) ## form factor according to Raymer equation (pg 283 of Aircraft Design: A Conceptual Approach) k_prop = 1 + 0.35 / (float(l_prop) / float(d_prop)) # find the final result propulsor_parasite_drag = k_prop * cf_prop * Swet / Sref # dump data to conditions propulsor_result = Results( wetted_area=Swet, reference_area=Sref, parasite_drag_coefficient=propulsor_parasite_drag, skin_friction_coefficient=cf_prop, compressibility_factor=k_comp, reynolds_factor=k_reyn, form_factor=k_prop, ) conditions.aerodynamics.drag_breakdown.parasite[ propulsor.tag] = propulsor_result return propulsor_parasite_drag
def parasite_drag_wing_supersonic(conditions,configuration,wing): """ SUAVE.Methods.parasite_drag_wing(conditions,configuration,wing) computes the parastite drag associated with a wing Inputs: Outputs: Assumptions: """ # unpack inputs C = configuration.wing_parasite_drag_form_factor freestream = conditions.freestream Sref = wing.sref # wing mac_w = wing.chord_mac t_c_w = wing.t_c sweep_w = wing.sweep arw_w = wing.ar span_w = wing.span S_exposed_w = wing.S_exposed # TODO: calculate by fuselage diameter (in Fidelity_Zero.initialize()) S_affected_w = wing.S_affected # compute wetted area # TODO: calcualte as preprocessing Swet = 2. * (1.0+ 0.2*t_c_w) * S_exposed_w # conditions Mc = freestream.mach_number roc = freestream.density muc = freestream.viscosity Tc = freestream.temperature pc = freestream.pressure # reynolds number V = Mc * compute_speed_of_sound( Tc, pc ) #input gamma and R Re_w = roc * V * mac_w/muc # skin friction coefficient cf_w, k_comp, k_reyn = compressible_turbulent_flat_plate(Re_w,Mc,Tc) # correction for airfoils k_w = np.array([[0.0]] * len(Mc)) for i in range(len(Mc)): if Mc[i] < 0.95: k_w[i] = 1. + ( 2.* C * (t_c_w * (np.cos(sweep_w))**2.) ) / ( np.sqrt(1.- Mc[i]**2. * ( np.cos(sweep_w))**2.) ) \ + ( C**2. * (np.cos(sweep_w))**2. * t_c_w**2. * (1. + 5.*(np.cos(sweep_w)**2.)) ) \ / (2.*(1.-(Mc[i]*np.cos(sweep_w))**2.)) else: k_w[i] = 1. # -------------------------------------------------------- # find the final result wing_parasite_drag = k_w * cf_w * Swet / Sref # -------------------------------------------------------- # dump data to conditions wing_result = Result( wetted_area = Swet , reference_area = Sref , parasite_drag_coefficient = wing_parasite_drag , skin_friction_coefficient = cf_w , compressibility_factor = k_comp , reynolds_factor = k_reyn , form_factor = k_w , ) try: conditions.aerodynamics.drag_breakdown.parasite[wing.tag] = wing_result except: print("Drag Polar Mode") # done! return wing_parasite_drag
def parasite_drag_propulsor(conditions,configuration,propulsor): """ SUAVE.Methods.parasite_drag_propulsor(conditions,configuration,propulsor) computes the parasite drag associated with a propulsor Inputs: Outputs: Assumptions: """ # unpack inputs try: form_factor = configuration.propulsor_parasite_drag_form_factor except(AttributeError): form_factor = 2.3 freestream = conditions.freestream Sref = propulsor.nacelle_diameter**2 / 4 * np.pi Swet = propulsor.nacelle_diameter * np.pi * propulsor.engine_length l_prop = propulsor.engine_length d_prop = propulsor.nacelle_diameter # conditions Mc = freestream.mach_number roc = freestream.density muc = freestream.viscosity Tc = freestream.temperature pc = freestream.pressure # reynolds number V = Mc * compute_speed_of_sound(Tc, pc) Re_prop = roc * V * l_prop/muc # skin friction coefficient cf_prop, k_comp, k_reyn = compressible_turbulent_flat_plate(Re_prop,Mc,Tc) # form factor for cylindrical bodies try: # Check if propulsor has an intake A_max = propulsor.nacelle_dia A_exit = propulsor.A7 A_inflow = propulsor.Ao d_d = 1/((propulsor.engine_length + propulsor.D) / np.sqrt(4/np.pi*(A_max - (A_exit+A_inflow)/2))) except: d_d = float(d_prop)/float(l_prop) D = np.sqrt(1 - (1-Mc**2) * d_d**2) a = 2 * (1-Mc**2) * (d_d**2) *(np.arctanh(D)-D) / (D**3) du_max_u = a / ( (2-a) * (1-Mc**2)**0.5 ) k_prop = (1 + form_factor*du_max_u)**2 # -------------------------------------------------------- # find the final result propulsor_parasite_drag = k_prop * cf_prop * Swet / Sref # -------------------------------------------------------- # dump data to conditions propulsor_result = Result( wetted_area = Swet , reference_area = Sref , parasite_drag_coefficient = propulsor_parasite_drag , skin_friction_coefficient = cf_prop , compressibility_factor = k_comp , reynolds_factor = k_reyn , form_factor = k_prop , ) conditions.aerodynamics.drag_breakdown.parasite[propulsor.tag] = propulsor_result return propulsor_parasite_drag
def parasite_drag_propulsor(state,settings,geometry): #def parasite_drag_propulsor(conditions,configuration,propulsor): """ SUAVE.Methods.parasite_drag_propulsor(conditions,configuration,propulsor) computes the parasite drag associated with a propulsor Inputs: Outputs: Assumptions: """ # unpack inputs conditions = state.conditions configuration = settings propulsor = geometry # unpack inputs try: form_factor = configuration.propulsor_parasite_drag_form_factor except(AttributeError): form_factor = 2.3 freestream = conditions.freestream Sref = propulsor.nacelle_diameter**2 / 4 * np.pi Swet = propulsor.nacelle_diameter * np.pi * propulsor.engine_length l_prop = propulsor.engine_length d_prop = propulsor.nacelle_diameter # conditions Mc = freestream.mach_number roc = freestream.density muc = freestream.dynamic_viscosity Tc = freestream.temperature pc = freestream.pressure # reynolds number V = Mc * compute_speed_of_sound(Tc, pc) Re_prop = roc * V * l_prop/muc # skin friction coefficient cf_prop, k_comp, k_reyn = compressible_turbulent_flat_plate(Re_prop,Mc,Tc) # form factor for cylindrical bodies try: # Check if propulsor has an intake A_max = propulsor.nacelle_diameter A_exit = propulsor.A7 A_inflow = propulsor.Ao d_d = 1/((propulsor.engine_length + propulsor.D) / np.sqrt(4/np.pi*(A_max - (A_exit+A_inflow)/2))) except: d_d = float(d_prop)/float(l_prop) D = np.array([[0.0]] * len(Mc)) a = np.array([[0.0]] * len(Mc)) du_max_u = np.array([[0.0]] * len(Mc)) k_prop = np.array([[0.0]] * len(Mc)) D[Mc < 0.95] = np.sqrt(1 - (1-Mc[Mc < 0.95]**2) * d_d**2) a[Mc < 0.95] = 2 * (1-Mc[Mc < 0.95]**2) * (d_d**2) *(np.arctanh(D[Mc < 0.95])-D[Mc < 0.95]) / (D[Mc < 0.95]**3) du_max_u[Mc < 0.95] = a[Mc < 0.95] / ( (2-a[Mc < 0.95]) * (1-Mc[Mc < 0.95]**2)**0.5 ) D[Mc >= 0.95] = np.sqrt(1 - d_d**2) a[Mc >= 0.95] = 2 * (d_d**2) *(np.arctanh(D[Mc >= 0.95])-D[Mc >= 0.95]) / (D[Mc >= 0.95]**3) du_max_u[Mc >= 0.95] = a[Mc >= 0.95] / ( (2-a[Mc >= 0.95]) ) k_prop = (1 + form_factor*du_max_u)**2 # -------------------------------------------------------- # find the final result propulsor_parasite_drag = k_prop * cf_prop * Swet / Sref # -------------------------------------------------------- # dump data to conditions propulsor_result = Results( wetted_area = Swet , reference_area = Sref , parasite_drag_coefficient = propulsor_parasite_drag , skin_friction_coefficient = cf_prop , compressibility_factor = k_comp , reynolds_factor = k_reyn , form_factor = k_prop , ) state.conditions.aerodynamics.drag_breakdown.parasite[propulsor.tag] = propulsor_result return propulsor_parasite_drag
def parasite_drag_fuselage(conditions,configuration,fuselage): """ SUAVE.Methods.parasite_drag_fuselage(conditions,configuration,fuselage) computes the parasite drag associated with a fuselage Inputs: Outputs: Assumptions: """ # unpack inputs form_factor = configuration.fuselage_parasite_drag_form_factor freestream = conditions.freestream Sref = fuselage.areas.front_projected Swet = fuselage.areas.wetted l_fus = fuselage.lengths.cabin d_fus = fuselage.width l_nose = fuselage.lengths.nose l_tail = fuselage.lengths.tail # conditions Mc = freestream.mach_number roc = freestream.density muc = freestream.viscosity Tc = freestream.temperature pc = freestream.pressure # reynolds number V = Mc * compute_speed_of_sound(Tc, pc) Re_fus = roc * V * l_fus/muc # skin friction coefficient cf_fus, k_comp, k_reyn = compressible_turbulent_flat_plate(Re_fus,Mc,Tc) # form factor for cylindrical bodies d_d = float(d_fus)/float(l_fus) D = np.array([[0.0]] * len(Mc)) a = np.array([[0.0]] * len(Mc)) du_max_u = np.array([[0.0]] * len(Mc)) k_fus = np.array([[0.0]] * len(Mc)) D[Mc < 0.95] = np.sqrt(1 - (1-Mc[Mc < 0.95]**2) * d_d**2) a[Mc < 0.95] = 2 * (1-Mc[Mc < 0.95]**2) * (d_d**2) *(np.arctanh(D[Mc < 0.95])-D[Mc < 0.95]) / (D[Mc < 0.95]**3) du_max_u[Mc < 0.95] = a[Mc < 0.95] / ( (2-a[Mc < 0.95]) * (1-Mc[Mc < 0.95]**2)**0.5 ) D[Mc >= 0.95] = np.sqrt(1 - d_d**2) a[Mc >= 0.95] = 2 * (d_d**2) *(np.arctanh(D[Mc >= 0.95])-D[Mc >= 0.95]) / (D[Mc >= 0.95]**3) du_max_u[Mc >= 0.95] = a[Mc >= 0.95] / ( (2-a[Mc >= 0.95]) ) k_fus = (1 + form_factor*du_max_u)**2 #for i in range(len(Mc)): #if Mc[i] < 0.95: #D[i] = np.sqrt(1 - (1-Mc[i]**2) * d_d**2) #a[i] = 2 * (1-Mc[i]**2) * (d_d**2) *(np.arctanh(D[i])-D[i]) / (D[i]**3) #du_max_u[i] = a[i] / ( (2-a[i]) * (1-Mc[i]**2)**0.5 ) #else: #D[i] = np.sqrt(1 - d_d**2) #a[i] = 2 * (d_d**2) *(np.arctanh(D[i])-D[i]) / (D[i]**3) #du_max_u[i] = a[i] / ( (2-a[i]) ) #k_fus[i] = (1 + cf_fus[i]*du_max_u[i])**2 # -------------------------------------------------------- # find the final result fuselage_parasite_drag = k_fus * cf_fus * Swet / Sref # -------------------------------------------------------- # dump data to conditions fuselage_result = Result( wetted_area = Swet , reference_area = Sref , parasite_drag_coefficient = fuselage_parasite_drag , skin_friction_coefficient = cf_fus , compressibility_factor = k_comp , reynolds_factor = k_reyn , form_factor = k_fus , ) try: conditions.aerodynamics.drag_breakdown.parasite[fuselage.tag] = fuselage_result except: print("Drag Polar Mode fuse parasite") return fuselage_parasite_drag
def parasite_drag_propulsor(state, settings, geometry): """Computes the parasite drag due to the propulsor Assumptions: Basic fit Source: Raymer equation (pg 283 of Aircraft Design: A Conceptual Approach) (subsonic) http://adg.stanford.edu/aa241/drag/BODYFORMFACTOR.HTML (supersonic) Inputs: state.conditions.freestream. mach_number [Unitless] temperature [K] reynolds_number [Unitless] geometry. nacelle_diameter [m^2] areas.wetted [m^2] engine_length [m] state.conditions.aerodynamics.drag_breakdown. compressible.main_wing.divergence_mach [Unitless] Outputs: propulsor_parasite_drag [Unitless] Properties Used: N/A """ # unpack inputs conditions = state.conditions configuration = settings propulsor = geometry freestream = conditions.freestream Sref = propulsor.nacelle_diameter**2 / 4 * np.pi Swet = propulsor.areas.wetted l_prop = propulsor.engine_length d_prop = propulsor.nacelle_diameter # conditions freestream = conditions.freestream Mc = freestream.mach_number Tc = freestream.temperature re = freestream.reynolds_number # reynolds number Re_prop = re * l_prop # skin friction coefficient cf_prop, k_comp, k_reyn = compressible_turbulent_flat_plate( Re_prop, Mc, Tc) k_prop = np.array([[0.0]] * len(Mc)) # assume that the drag divergence mach number of the propulsor matches the main wing Mdiv = state.conditions.aerodynamics.drag_breakdown.compressible.main_wing.divergence_mach # form factor according to Raymer equation (pg 283 of Aircraft Design: A Conceptual Approach) k_prop_sub = 1. + 0.35 / (float(l_prop) / float(d_prop)) # for supersonic flow (http://adg.stanford.edu/aa241/drag/BODYFORMFACTOR.HTML) k_prop_sup = 1. sb_mask = (Mc <= Mdiv) tn_mask = ((Mc > Mdiv) & (Mc < 1.05)) sp_mask = (Mc >= 1.05) k_prop[sb_mask] = k_prop_sub # basic interpolation for transonic k_prop[tn_mask] = (k_prop_sup - k_prop_sub) * ( Mc[tn_mask] - Mdiv[tn_mask]) / (1.05 - Mdiv[tn_mask]) + k_prop_sub k_prop[sp_mask] = k_prop_sup # -------------------------------------------------------- # find the final result propulsor_parasite_drag = k_prop * cf_prop * Swet / Sref # -------------------------------------------------------- # dump data to conditions propulsor_result = Results( wetted_area=Swet, reference_area=Sref, parasite_drag_coefficient=propulsor_parasite_drag, skin_friction_coefficient=cf_prop, compressibility_factor=k_comp, reynolds_factor=k_reyn, form_factor=k_prop, ) state.conditions.aerodynamics.drag_breakdown.parasite[ propulsor.tag] = propulsor_result return propulsor_parasite_drag
def parasite_drag_fuselage(state, settings, geometry): """ SUAVE.Methods.parasite_drag_fuselage(conditions,configuration,fuselage) computes the parasite drag associated with a fuselage Inputs: Outputs: Assumptions: """ # unpack inputs conditions = state.conditions configuration = settings fuselage = geometry form_factor = configuration.fuselage_parasite_drag_form_factor freestream = conditions.freestream Sref = fuselage.areas.front_projected Swet = fuselage.areas.wetted l_fus = fuselage.lengths.total d_fus = fuselage.effective_diameter # conditions Mc = freestream.mach_number Tc = freestream.temperature re = freestream.reynolds_number # reynolds number Re_fus = re * (l_fus) # skin friction coefficient cf_fus, k_comp, k_reyn = compressible_turbulent_flat_plate(Re_fus, Mc, Tc) # form factor for cylindrical bodies d_d = float(d_fus) / float(l_fus) D = np.sqrt(1 - (1 - Mc**2) * d_d**2) a = 2 * (1 - Mc**2) * (d_d**2) * (np.arctanh(D) - D) / (D**3) du_max_u = a / ((2 - a) * (1 - Mc**2)**0.5) k_fus = (1 + form_factor * du_max_u)**2 # find the final result fuselage_parasite_drag = k_fus * cf_fus * Swet / Sref # dump data to conditions fuselage_result = Results( wetted_area=Swet, reference_area=Sref, parasite_drag_coefficient=fuselage_parasite_drag, skin_friction_coefficient=cf_fus, compressibility_factor=k_comp, reynolds_factor=k_reyn, form_factor=k_fus, ) state.conditions.aerodynamics.drag_breakdown.parasite[ fuselage.tag] = fuselage_result return fuselage_parasite_drag
if validation_test: Re = np.logspace(5, 9, 5) ii = 0 xts = np.array([0.0, .1, .2, .3, .4, .5, .6, .8, 1.0]) cf_comp = np.zeros([9, 5]) k_comp = np.zeros_like(cf_comp) k_reyn = np.zeros_like(cf_comp) for xt in xts: (cf_comp[ii, :], k_comp[ii, :], k_reyn[ii, :]) = compressible_mixed_flat_plate( Re, 0.0, 216.0, xt) if ii == 0: (cf_comp_turb, k_comp_t, k_reyn_t) = compressible_turbulent_flat_plate(Re, 0.0, 216.0) ii = ii + 1 cf_comp_empirical = np.array([[.0073, .0045, .0031, .0022, .0016], [.0074, .0044, .0029, .0020, .0015], [.0073, .0041, .0026, .0018, .0014], [.0070, .0038, .0024, .0017, .0013], [.0067, .0036, .0021, .0015, .0011], [.0064, .0033, .0020, .0013, .0009], [.0060, .0029, .0017, .0011, .0007], [.0052, .0022, .0011, .0006, .0004], [.0041, .0013, .0004, .0001, .00005]]) plt.figure("Skin Friction Coefficient v. Reynolds Number") axes = plt.gca() for i in range(len(cf_comp[:, 0])):
def parasite_drag_fuselage(state,settings,geometry): #def parasite_drag_fuselage(conditions,configuration,fuselage): """ SUAVE.Methods.parasite_drag_fuselage(conditions,configuration,fuselage) computes the parasite drag associated with a fuselage Inputs: Outputs: Assumptions: """ # unpack inputs conditions = state.conditions configuration =settings #fuselages = geometry.fuselages fuselage = geometry form_factor = configuration.fuselage_parasite_drag_form_factor freestream = conditions.freestream fuselage_parasite_drag_total = 0.0 #for fuselage in fuselages.values(): Sref = fuselage.areas.front_projected Swet = fuselage.areas.wetted l_fus = fuselage.lengths.cabin d_fus = fuselage.effective_diameter l_nose = fuselage.lengths.nose l_tail = fuselage.lengths.tail # conditions Mc = freestream.mach_number roc = freestream.density muc = freestream.dynamic_viscosity Tc = freestream.temperature pc = freestream.pressure # reynolds number V = Mc * compute_speed_of_sound(Tc, pc) Re_fus = roc * V * (l_fus + l_nose + l_tail)/muc # skin friction coefficient cf_fus, k_comp, k_reyn = compressible_turbulent_flat_plate(Re_fus,Mc,Tc) # form factor for cylindrical bodies d_d = float(d_fus)/float(l_fus) D = np.sqrt(1 - (1-Mc**2) * d_d**2) a = 2 * (1-Mc**2) * (d_d**2) *(np.arctanh(D)-D) / (D**3) du_max_u = a / ( (2-a) * (1-Mc**2)**0.5 ) k_fus = (1 + form_factor*du_max_u)**2 # -------------------------------------------------------- # find the final result fuselage_parasite_drag = k_fus * cf_fus * Swet / Sref # dump data to conditions fuselage_result = Results( wetted_area = Swet , reference_area = Sref , parasite_drag_coefficient = fuselage_parasite_drag , skin_friction_coefficient = cf_fus , compressibility_factor = k_comp , reynolds_factor = k_reyn , form_factor = k_fus , ) state.conditions.aerodynamics.drag_breakdown.parasite[fuselage.tag] = fuselage_result return fuselage_parasite_drag
def parasite_drag_propulsor(state,settings,geometry): """ SUAVE.Methods.parasite_drag_propulsor(conditions,configuration,propulsor) computes the parasite drag associated with a propulsor Inputs: Outputs: Assumptions: """ # unpack inputs conditions = state.conditions configuration = settings propulsor = geometry # unpack inputs try: form_factor = configuration.propulsor_parasite_drag_form_factor except(AttributeError): form_factor = 2.3 freestream = conditions.freestream Sref = propulsor.nacelle_diameter**2 / 4 * np.pi Swet = propulsor.nacelle_diameter * np.pi * propulsor.engine_length l_prop = propulsor.engine_length d_prop = propulsor.nacelle_diameter # conditions freestream = conditions.freestream Mc = freestream.mach_number Tc = freestream.temperature re = freestream.reynolds_number # reynolds number Re_prop = re*l_prop # skin friction coefficient cf_prop, k_comp, k_reyn = compressible_turbulent_flat_plate(Re_prop,Mc,Tc) # form factor for cylindrical bodies try: # Check if propulsor has an intake A_max = propulsor.nacelle_diameter A_exit = propulsor.A7 A_inflow = propulsor.Ao d_d = 1/((propulsor.engine_length + propulsor.D) / np.sqrt(4/np.pi*(A_max - (A_exit+A_inflow)/2))) except: d_d = float(d_prop)/float(l_prop) D = np.array([[0.0]] * len(Mc)) a = np.array([[0.0]] * len(Mc)) du_max_u = np.array([[0.0]] * len(Mc)) k_prop = np.array([[0.0]] * len(Mc)) D[Mc < 0.95] = np.sqrt(1 - (1-Mc[Mc < 0.95]**2) * d_d**2) a[Mc < 0.95] = 2 * (1-Mc[Mc < 0.95]**2) * (d_d**2) *(np.arctanh(D[Mc < 0.95])-D[Mc < 0.95]) / (D[Mc < 0.95]**3) du_max_u[Mc < 0.95] = a[Mc < 0.95] / ( (2-a[Mc < 0.95]) * (1-Mc[Mc < 0.95]**2)**0.5 ) D[Mc >= 0.95] = np.sqrt(1 - d_d**2) a[Mc >= 0.95] = 2 * (d_d**2) *(np.arctanh(D[Mc >= 0.95])-D[Mc >= 0.95]) / (D[Mc >= 0.95]**3) du_max_u[Mc >= 0.95] = a[Mc >= 0.95] / ( (2-a[Mc >= 0.95]) ) k_prop = (1 + form_factor*du_max_u)**2 # -------------------------------------------------------- # find the final result propulsor_parasite_drag = k_prop * cf_prop * Swet / Sref # -------------------------------------------------------- # dump data to conditions propulsor_result = Results( wetted_area = Swet , reference_area = Sref , parasite_drag_coefficient = propulsor_parasite_drag , skin_friction_coefficient = cf_prop , compressibility_factor = k_comp , reynolds_factor = k_reyn , form_factor = k_prop , ) state.conditions.aerodynamics.drag_breakdown.parasite[propulsor.tag] = propulsor_result return propulsor_parasite_drag
def parasite_drag_fuselage(conditions,configuration,fuselage): """ SUAVE.Methods.parasite_drag_fuselage(conditions,configuration,fuselage) computes the parasite drag associated with a fuselage Inputs: Outputs: Assumptions: """ # unpack inputs form_factor = configuration.fuselage_parasite_drag_form_factor C_fus = configuration.fuselage_parasite_drag_form_factor freestream = conditions.freestream Sref = fuselage.reference_area Swet = fuselage.wetted_area l_fus = fuselage.length_cabin d_fus = fuselage.width l_nose = fuselage.length_nose l_tail = fuselage.length_tail # conditions Mc = freestream.mach_number roc = freestream.density muc = freestream.viscosity Tc = freestream.temperature pc = freestream.pressure # reynolds number V = Mc * compute_speed_of_sound(Tc, pc) Re_fus = roc * V * l_fus/muc # skin friction coefficient cf_fus, k_comp, k_reyn = compressible_turbulent_flat_plate(Re_fus,Mc,Tc) # form factor for cylindrical bodies d_d = float(d_fus)/float(l_fus) D = np.sqrt(1 - (1-Mc**2) * d_d**2) a = 2 * (1-Mc**2) * (d_d**2) *(np.arctanh(D)-D) / (D**3) du_max_u = a / ( (2-a) * (1-Mc**2)**0.5 ) k_fus = (1 + cf_fus*du_max_u)**2 # -------------------------------------------------------- # find the final result fuselage_parasite_drag = k_fus * cf_fus * Swet / Sref # -------------------------------------------------------- # dump data to conditions fuselage_result = Result( wetted_area = Swet , reference_area = Sref , parasite_drag_coefficient = fuselage_parasite_drag , skin_friction_coefficient = cf_fus , compressibility_factor = k_comp , reynolds_factor = k_reyn , form_factor = k_fus , ) conditions.aerodynamics.drag_breakdown.parasite[fuselage.tag] = fuselage_result return fuselage_parasite_drag
def parasite_drag_fuselage(conditions, configuration, fuselage): """ SUAVE.Methods.parasite_drag_fuselage(conditions,configuration,fuselage) computes the parasite drag associated with a fuselage Inputs: Outputs: Assumptions: """ # unpack inputs form_factor = configuration.fuselage_parasite_drag_form_factor freestream = conditions.freestream Sref = fuselage.areas.front_projected Swet = fuselage.areas.wetted l_fus = fuselage.lengths.cabin d_fus = fuselage.width l_nose = fuselage.lengths.nose l_tail = fuselage.lengths.tail # conditions Mc = freestream.mach_number roc = freestream.density muc = freestream.viscosity Tc = freestream.temperature pc = freestream.pressure # reynolds number V = Mc * compute_speed_of_sound(Tc, pc) Re_fus = roc * V * l_fus / muc # skin friction coefficient cf_fus, k_comp, k_reyn = compressible_turbulent_flat_plate(Re_fus, Mc, Tc) # form factor for cylindrical bodies d_d = float(d_fus) / float(l_fus) D = np.array([[0.0]] * len(Mc)) a = np.array([[0.0]] * len(Mc)) du_max_u = np.array([[0.0]] * len(Mc)) k_fus = np.array([[0.0]] * len(Mc)) D[Mc < 0.95] = np.sqrt(1 - (1 - Mc[Mc < 0.95]**2) * d_d**2) a[Mc < 0.95] = 2 * (1 - Mc[Mc < 0.95]**2) * (d_d**2) * ( np.arctanh(D[Mc < 0.95]) - D[Mc < 0.95]) / (D[Mc < 0.95]**3) du_max_u[Mc < 0.95] = a[Mc < 0.95] / ((2 - a[Mc < 0.95]) * (1 - Mc[Mc < 0.95]**2)**0.5) D[Mc >= 0.95] = np.sqrt(1 - d_d**2) a[Mc >= 0.95] = 2 * (d_d**2) * (np.arctanh(D[Mc >= 0.95]) - D[Mc >= 0.95]) / (D[Mc >= 0.95]**3) du_max_u[Mc >= 0.95] = a[Mc >= 0.95] / ((2 - a[Mc >= 0.95])) k_fus = (1 + form_factor * du_max_u)**2 #for i in range(len(Mc)): #if Mc[i] < 0.95: #D[i] = np.sqrt(1 - (1-Mc[i]**2) * d_d**2) #a[i] = 2 * (1-Mc[i]**2) * (d_d**2) *(np.arctanh(D[i])-D[i]) / (D[i]**3) #du_max_u[i] = a[i] / ( (2-a[i]) * (1-Mc[i]**2)**0.5 ) #else: #D[i] = np.sqrt(1 - d_d**2) #a[i] = 2 * (d_d**2) *(np.arctanh(D[i])-D[i]) / (D[i]**3) #du_max_u[i] = a[i] / ( (2-a[i]) ) #k_fus[i] = (1 + cf_fus[i]*du_max_u[i])**2 # -------------------------------------------------------- # find the final result fuselage_parasite_drag = k_fus * cf_fus * Swet / Sref # -------------------------------------------------------- # dump data to conditions fuselage_result = Result( wetted_area=Swet, reference_area=Sref, parasite_drag_coefficient=fuselage_parasite_drag, skin_friction_coefficient=cf_fus, compressibility_factor=k_comp, reynolds_factor=k_reyn, form_factor=k_fus, ) try: conditions.aerodynamics.drag_breakdown.parasite[ fuselage.tag] = fuselage_result except: print("Drag Polar Mode fuse parasite") return fuselage_parasite_drag
# ---------------------------------------------------------------------- # Module Tests # ---------------------------------------------------------------------- # this will run from command line, put simple tests for your code here if __name__ == '__main__': Re = np.logspace(5,9,5) ii = 0 xts = np.array([0.0,.1,.2,.3,.4,.5,.6,.8,1.0]) cf_comp = np.zeros([9,5]) k_comp = np.zeros_like(cf_comp) k_reyn = np.zeros_like(cf_comp) for xt in xts: (cf_comp[ii,:], k_comp[ii,:], k_reyn[ii,:]) = compressible_mixed_flat_plate(Re,0.0,216.0,xt) if ii == 0: (cf_comp_turb,k_comp_t,k_reyn_t) = compressible_turbulent_flat_plate(Re,0.0,216.0) ii = ii + 1 cf_comp_empirical = np.array([[.0073,.0045,.0031,.0022,.0016], [.0074,.0044,.0029,.0020,.0015], [.0073,.0041,.0026,.0018,.0014], [.0070,.0038,.0024,.0017,.0013], [.0067,.0036,.0021,.0015,.0011], [.0064,.0033,.0020,.0013,.0009], [.0060,.0029,.0017,.0011,.0007], [.0052,.0022,.0011,.0006,.0004], [.0041,.0013,.0004,.0001,.00005]]) plt.figure("Skin Friction Coefficient v. Reynolds Number") axes = plt.gca()