aerosandbox.aerodynamics.aero_3D.avl#

Module Contents#

Classes#

AVL

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

Attributes#

avl

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)[source]#

Bases: 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()
Parameters:
default_analysis_specific_options[source]#
AVL_spacing_parameters[source]#
__repr__()[source]#

Return repr(self).

open_interactive()[source]#

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)[source]#

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()[source]#
Return type:

List[str]

write_avl(filepath=None)[source]#

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)[source]#

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)[source]#

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…

}

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[source]#