Post · 6 min read· pp. 382–387

aerosandbox.aerodynamics.aero_3D.avl

Attributes

Classes

AVLAn interface to AVL, a 3D vortex lattice aerodynamics code developed by Mark Drela at MIT.

Module Contents

class aerosandbox.aerodynamics.aero_3D.avl.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: aerosandbox.common.ExplicitAnalysis

code
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:

```default

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()

code

    Parameters:
    :   - **airplane** ([*aerosandbox.geometry.Airplane*](/u/b315363d35db77b2#aerosandbox-geometry-airplane)) –
        - **op\_point** ([*aerosandbox.performance.OperatingPoint*](/u/ef68b15c282639e3#aerosandbox-performance-operatingpoint)) –
        - **xyz\_ref** (*List**[**float**]*) –
        - **avl\_command** (*str*) –
        - **verbose** (*bool*) –
        - **timeout** (*Union**[**float**,* *int**,* *None**]*) –
        - **working\_directory** (*str*) –
        - **ground\_effect** (*bool*) –
        - **ground\_effect\_height** (*float*) –

    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
>>> 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,
>>>         ),
>>>     )
>>> }
code
AVL\_spacing\_parameters

airplane

op\_point

xyz\_ref *= None*

avl\_command *= 'avl'*

verbose *= False*

timeout *= 5*

working\_directory *= None*

ground\_effect *= False*

ground\_effect\_height *= 0*

\_\_repr\_\_()

open\_interactive()
:   Opens a new terminal window and runs AVL interactively. This is useful for detailed analysis or debugging.

    Returns: None

    Return type:
    :   None

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.

    Parameters:
    :   **run\_command** (*str*) –

    Return type:
    :   Dict[str, float]

\_default\_keystroke\_file\_contents()
:   Return type:
    :   List[str]

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/>

    Parameters:
    :   **filepath** (*Union**[**pathlib.Path**,* *str**]*) – filepath (including the filename and .avl extension) [string]
        If None, this function returns the .avl file as a string.

    Return type:
    :   None

    Returns: None

*static* write\_avl\_bfile(*fuselage*, *filepath=None*, *include\_name=True*)
:   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/>

    Parameters:
    :   - **filepath** (*Union**[**pathlib.Path**,* *str**]*) – filepath (including the filename and .avl extension) [string]
          If None, this function returns the would-be file contents as a string.
        - **include\_name** (*bool*) – Should the name of the fuselage be included in the .dat file? (This should be True for use with AVL.)

    Return type:
    :   str

    Returns:

*static* parse\_unformatted\_data\_output(*s*, *data\_identifier=' = '*, *cast\_outputs\_to\_float=True*, *overwrite=None*)
:   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:

    [``](#id1)[`](#id3)
    :   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

    [``](#id5)[`](#id7)

    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…

    }

    Parameters:
    :   - **s** (*str*) – The input string to identify. Can be multiline.
        - **data\_identifier** (*str*) – The triggering substring for a new key-value pair. By default, it’s “ = “,
        - **this** (*which is convention in many output files from Mark Drela's codes. Be careful if you decide to change*) –
        - **"="** (*to*) –
        - **separators** (*as you could pick up on heading*) –
        - **cast\_outputs\_to\_float** (*bool*) – If this boolean flag is set true, the values of the key-value pairs are cast to
        - **returning** (*floating-point numbers before*) –
        - **cast** –
        - **downstream** (*a NaN is returned* *(**guaranteeing that you can do floating-point math with the outputs in*) –
        - **applications.****)** –
        - **overwrite** (*bool*) –

          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.

    Return type:
    :   Dict[str, float]

    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.

aerosandbox.aerodynamics.aero_3D.avl.avl