Source code for RCAIDE.Framework.Analyses.Aerodynamics.Athena_Vortex_Lattice

# RCAIDE/Framework/Analyses/Aerodynamics/Athena_Vortex_Lattice.py
#  
# Created:  Jul 2023, M. Clarke

# ----------------------------------------------------------------------------------------------------------------------
#  IMPORT
# ----------------------------------------------------------------------------------------------------------------------

# RCAIDE imports   
from RCAIDE.Framework.Core                                      import Data, Units
from RCAIDE.Framework.Analyses                                  import Process 
from RCAIDE.Library.Methods.Aerodynamics                        import Common
from .Aerodynamics                                              import Aerodynamics 
from RCAIDE.Framework.Analyses.Common.Process_Geometry          import Process_Geometry 
from RCAIDE.Library.Methods.Aerodynamics.Athena_Vortex_Lattice  import * 
from RCAIDE.Library.Methods.Aerodynamics.Athena_Vortex_Lattice.AVL_Objects.Run_Case     import Run_Case

# package imports 
import numpy as np 

# ----------------------------------------------------------------------------------------------------------------------
#  Vortex_Lattice_Method
# ---------------------------------------------------------------------------------------------------------------------- 
[docs] class Athena_Vortex_Lattice(Aerodynamics): """This is a subsonic aerodynamic buildup analysis based on the vortex lattice method Assumptions: Stall effects are negligible Source: N/A Inputs: None Outputs: None Properties Used: N/A """ def __defaults__(self): """This sets the default values and methods for the analysis. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A """ self.tag = 'Athena_Vortex_Lattice' self.vehicle = Data() self.process = Process() self.process.initialize = Process() # correction factors settings = self.settings settings.run_cases = Run_Case.Container() settings.flow_symmetry = Data() settings.flow_symmetry.xz_plane = 0 # Symmetry across the xz-plane, y=0 settings.flow_symmetry.xy_parallel = 0 # Symmetry across the z=z_symmetry_plane plane settings.flow_symmetry.z_symmetry_plane = 0.0 settings.vortex_distribution = None settings.number_of_control_surfaces = 0 settings.filenames = Data() settings.filenames.avl_bin_name = 'avl' # to call avl from command line. If avl is not on the system path, include absolute path to the avl binary i.e. '/your/path/to/avl' settings.filenames.run_folder = 'avl_files' settings.filenames.features = 'aircraft.avl' settings.filenames.mass_file = 'aircraft.mass' settings.filenames.batch_template = 'batch_{0:04d}.run' settings.filenames.deck_template = 'commands_{0:04d}.deck' settings.filenames.aero_output_template_1 = 'stability_axis_derivatives_{}.txt' settings.filenames.aero_output_template_2 = 'surface_forces_{}.txt' settings.filenames.aero_output_template_3 = 'strip_forces_{}.txt' settings.filenames.aero_output_template_4 = 'body_axis_derivatives_{}.txt' settings.filenames.dynamic_output_template_1 = 'eigen_mode_{}.txt' settings.filenames.dynamic_output_template_2 = 'system_matrix_{}.txt' settings.filenames.case_template = 'case_{0:04d}_{1:04d}' settings.filenames.log_filename = 'avl_log.txt' settings.filenames.err_filename = 'avl_err.txt' settings.number_of_spanwise_vortices = 30 settings.number_of_chordwise_vortices = 10 settings.control_surface_tags = [] settings.trim_aircraft = False settings.print_output = False settings.keep_files = False settings.new_regression_results = False settings.side_slip_angle = 0.0 settings.roll_rate_coefficient = 0.0 settings.pitch_rate_coefficient = 0.0 settings.lift_coefficient = None # conditions table, used for surrogate model training self.training = Data() self.training.angle_of_attack = np.array([-2.,0., 2.,5., 7., 10.])*Units.degrees self.training.Mach = np.array([0.05,0.15,0.25, 0.45,0.65,0.85]) self.training_file = None self.current_status = Data() self.current_status.batch_index = 0 self.current_status.batch_file = None self.current_status.deck_file = None self.current_status.cases = None # surrogoate models self.surrogates = Data() # build the evaluation process compute = Process() compute.lift = Process() compute.lift.inviscid_wings = None compute.lift.fuselage = Common.Lift.fuselage_correction compute.drag = Process() compute.drag.parasite = Process() compute.drag.parasite.wings = Process_Geometry('wings') compute.drag.parasite.wings.wing = Common.Drag.parasite_drag_wing compute.drag.parasite.fuselages = Process_Geometry('fuselages') compute.drag.parasite.fuselages.fuselage = Common.Drag.parasite_drag_fuselage compute.drag.parasite.booms = Process_Geometry('booms') compute.drag.parasite.booms.boom = Common.Drag.parasite_drag_fuselage compute.drag.parasite.nacelles = Common.Drag.parasite_drag_nacelle compute.drag.parasite.pylons = Common.Drag.parasite_drag_pylon compute.drag.parasite.total = Common.Drag.parasite_total compute.drag.induced = Common.Drag.induced_drag compute.drag.cooling = Common.Drag.cooling_drag compute.drag.compressibility = Common.Drag.compressibility_drag compute.drag.miscellaneous = Common.Drag.miscellaneous_drag compute.drag.form = Common.Drag.form_drag compute.drag.trim = Common.Drag.trim_drag compute.drag.total = Common.Drag.total_drag self.process.compute = compute
[docs] def initialize(self, vehicle): use_surrogate = self.settings.use_surrogate # If we are using the surrogate if use_surrogate == True: print("\n Creating aerodynamic surrogate ...") # sample training data train_AVL_surrogates(self, vehicle) # build surrogate build_AVL_surrogates(self) # build the evaluation process compute = self.process.compute if use_surrogate == True: compute.lift.inviscid_wings = evaluate_AVL_surrogate else: compute.lift.inviscid_wings = evaluate_AVL_no_surrogate return
[docs] def evaluate(self,state, vehicle): """The default evaluate function. Assumptions: None Source: N/A Inputs: None Outputs: results <RCAIDE data class> Properties Used: self.settings self.vehicle """ settings = self.settings results = self.process.compute(state,settings,vehicle) return results