aerosandbox.aerodynamics.aero_3D.avl ==================================== .. py:module:: aerosandbox.aerodynamics.aero_3D.avl Attributes ---------- .. autoapisummary:: aerosandbox.aerodynamics.aero_3D.avl.avl Classes ------- .. autoapisummary:: aerosandbox.aerodynamics.aero_3D.avl.AVL Module Contents --------------- .. py:class:: AVL(airplane, op_point, xyz_ref = None, avl_command = 'avl', verbose = False, timeout = 5, working_directory = None, ground_effect = False, ground_effect_height = 0) Bases: :py:obj:`aerosandbox.common.ExplicitAnalysis` An interface to AVL, a 3D vortex lattice aerodynamics code developed by Mark Drela at MIT. Requires AVL to be on your computer; AVL is available here: https://web.mit.edu/drela/Public/web/avl/ It is recommended (but not required) that you add AVL to your system PATH environment variable such that it can be called with the command `avl`. If this is not the case, you need to specify the path to your AVL executable using the `avl_command` argument of the constructor. Usage example: >>> avl = asb.AVL( >>> airplane=my_airplane, >>> op_point=asb.OperatingPoint( >>> velocity=100, # m/s >>> alpha=5, # deg >>> beta=4, # deg >>> p=0.01, # rad/sec >>> q=0.02, # rad/sec >>> r=0.03, # rad/sec >>> ) >>> ) >>> outputs = avl.run() .. py:attribute:: default_analysis_specific_options This is part of AeroSandbox's "analysis-specific options" feature, which lets you "tag" geometry objects with flags that change how different analyses act on them. This variable, `default_analysis_specific_options`, allows you to specify default values for options that can be used for specific problems. This should be a dictionary, where: * keys are the geometry-like types that you might be interested in defining parameters for. * values are dictionaries, where: * keys are strings that label a given option * values are anything. These are used as the default values, in the event that the associated geometry doesn't override those. An example of what this variable might look like, for a vortex-lattice method aerodynamic analysis: >>> default_analysis_specific_options = { >>> Airplane: dict( >>> profile_drag_coefficient=0 >>> ), >>> Wing : dict( >>> wing_level_spanwise_spacing=True, >>> spanwise_resolution=12, >>> spanwise_spacing="cosine", >>> chordwise_resolution=12, >>> chordwise_spacing="cosine", >>> component=None, # type: int >>> no_wake=False, >>> no_alpha_beta=False, >>> no_load=False, >>> drag_polar=dict( >>> CL1=0, >>> CD1=0, >>> CL2=0, >>> CD2=0, >>> CL3=0, >>> CD3=0, >>> ), >>> ) >>> } .. py:attribute:: AVL_spacing_parameters .. py:attribute:: airplane .. py:attribute:: op_point .. py:attribute:: xyz_ref :value: None .. py:attribute:: avl_command :value: 'avl' .. py:attribute:: verbose :value: False .. py:attribute:: timeout :value: 5 .. py:attribute:: working_directory :value: None .. py:attribute:: ground_effect :value: False .. py:attribute:: ground_effect_height :value: 0 .. py:method:: __repr__() .. py:method:: open_interactive() Opens a new terminal window and runs AVL interactively. This is useful for detailed analysis or debugging. Returns: None .. py:method:: run(run_command = None) Private function to run AVL. Args: run_command: A string with any AVL keystroke inputs that you'd like. By default, you start off within the OPER menu. All of the inputs indicated in the constructor have been set already, but you can override them here ( for this run only) if you want. Returns: A dictionary containing all of your results. .. py:method:: _default_keystroke_file_contents() .. py:method:: write_avl(filepath = None) Writes a .avl file corresponding to this airplane to a filepath. For use with the AVL vortex-lattice-method aerodynamics analysis tool by Mark Drela at MIT. AVL is available here: https://web.mit.edu/drela/Public/web/avl/ :param filepath: filepath (including the filename and .avl extension) [string] If None, this function returns the .avl file as a string. Returns: None .. py:method:: write_avl_bfile(fuselage, filepath = None, include_name = True) :staticmethod: Writes an AVL-compatible BFILE corresponding to this fuselage to a filepath. For use with the AVL vortex-lattice-method aerodynamics analysis tool by Mark Drela at MIT. AVL is available here: https://web.mit.edu/drela/Public/web/avl/ :param filepath: filepath (including the filename and .avl extension) [string] If None, this function returns the would-be file contents as a string. :param include_name: Should the name of the fuselage be included in the .dat file? (This should be True for use with AVL.) Returns: .. py:method:: parse_unformatted_data_output(s, data_identifier = ' = ', cast_outputs_to_float = True, overwrite = None) :staticmethod: Parses a (multiline) string of unformatted data into a nice and tidy dictionary. The expected input string looks like what you might get as an output from AVL (or many other Drela codes), which may list data in ragged order. An example input `s` that you might want to parse could look like the following: ``` Standard axis orientation, X fwd, Z down Run case: -unnamed- Alpha = 0.43348 pb/2V = -0.00000 p'b/2V = -0.00000 Beta = 0.00000 qc/2V = 0.00000 Mach = 0.003 rb/2V = -0.00000 r'b/2V = -0.00000 CXtot = -0.02147 Cltot = 0.00000 Cl'tot = 0.00000 CYtot = 0.00000 Cmtot = 0.28149 CZtot = -1.01474 Cntot = -0.00000 Cn'tot = -0.00000 CLtot = 1.01454 CDtot = 0.02915 CDvis = 0.00000 CDind = 0.0291513 CLff = 1.00050 CDff = 0.0297201 | Trefftz CYff = 0.00000 e = 0.9649 | Plane ``` Here, this function will go through this string and extract each key-value pair, as denoted by the data identifier (by default, " = "). It will pull the next whole word without spaces to the left as the key, and it will pull the next whole word without spaces to the right as the value. Together, these will be returned as a Dict. So, the output for the input above would be: { 'Alpha' : 0.43348, 'pb/2V' : -0.00000, 'p'b/2V' : -0.00000, 'Beta' : 0.00000, # and so on... } :param s: The input string to identify. Can be multiline. :param data_identifier: The triggering substring for a new key-value pair. By default, it's " = ", :param which is convention in many output files from Mark Drela's codes. Be careful if you decide to change this: :param to "=": :type to "=": '=======' :param as you could pick up on heading separators: :type as you could pick up on heading separators: '=======' :param cast_outputs_to_float: If this boolean flag is set true, the values of the key-value pairs are cast to :param floating-point numbers before returning: :type floating-point numbers before returning: as opposed to the default type, string :param cast: :param a NaN is returned (guaranteeing that you can do floating-point math with the outputs in downstream: :param applications.): :param overwrite: Determines the behavior if you find a key that's already in the dictionary. * By default, value is None. In this case, an error is raised. * If you set it to True, the new value will overwrite the old one. Thus, your dictionary will have the last matching value from the string. * If you set it to False, the new value will be discarded. Thus, your dictionary will have the first matching value from the string. Returns: A dictionary of key-value pairs, corresponding to the unformatted data in the input string. Keys are strings, values are floats if `cast_outputs_to_float` is True, otherwise also strings. .. py:data:: avl