pytornado.objects package

Submodules

pytornado.objects.aircraft module

pytornado.objects.objecttools module

Generators to facilitate looping over aircraft objects

Developed for Airinnova AB, Stockholm, Sweden.

pytornado.objects.objecttools.all_controls(aircraft)

Yield each control surface of the aircraft.

Args:
aircraft:aircraft object
Yields:
this_control:tuple containing the control surface number, name and object
this_wing:tuple containing the wing number, name and object
pytornado.objects.objecttools.all_segments(aircraft)

Yield each segment of the aircraft.

Args:
aircraft:aircraft object
Yields:
this_segment:tuple containing the segment number, name and object
this_wing:tuple containing the wing number, name and object
pytornado.objects.objecttools.all_subareas(aircraft)

Yield each subarea of the aircraft.

Args:
aircraft:aircraft object
Yields:
this_subarea:tuple containing the subarea number, name and object
this_subdivision:
 tuple containing the subdivision number, name and object
this_segment:tuple containing the segment number, name and object
this_wing:tuple containing the wing number, name and object
pytornado.objects.objecttools.all_subareas_of_control(aircraft, control_uid)

Yield each subarea belonging to a control of specified name.

Args:
aircraft:aircraft object
control_uid:name (UID) of the control
Yields:
this_subarea:tuple containing the subarea number, name and object
pytornado.objects.objecttools.all_subdivisions(aircraft)

Yield each subdivision of the aircraft.

Args:
aircraft:aircraft object
Yields:
this_subdivision:
 tuple containing the subdivision number, name and object
this_segment:tuple containing the segment number, name and object
this_wing:tuple containing the wing number, name and object
pytornado.objects.objecttools.all_wings(aircraft)

Yield each wing of the aircraft.

Args:
aircraft:aircraft object
Yields:
this_wing:tuple containing the wing number, name and object
pytornado.objects.objecttools.count_all_controls(aircraft)

Returns the number of control surfaces of the aircraft.

Args:
aircraft:aircraft object
Returns:
n:number of control surfaces
pytornado.objects.objecttools.count_all_segments(aircraft)

Returns the number of segments of the aircraft.

Args:
aircraft:aircraft object
Returns:
n:number of segments
pytornado.objects.objecttools.count_all_subareas(aircraft)

Returns the number of subareas of the aircraft.

Args:
aircraft:aircraft object
Returns:
n:number of subareas
pytornado.objects.objecttools.count_all_wings(aircraft)

Returns the number of wings of the aircraft.

Args:
aircraft:aircraft object
Returns:
n:number of wings

pytornado.objects.settings module

Data structures for execution settings.

Developed for Airinnova AB, Stockholm, Sweden.

class pytornado.objects.settings.PATHS

Bases: object

Namespace for project paths

class DIR

Bases: object

AIRCRAFT = 'aircraft'
AIRFOILS = 'airfoils'
DEFORMATION = 'deformation'
PLOTS = '_plots'
RESULTS = '_results'
SETTINGS = 'settings'
STATE = 'state'
TEMPLATE_ROOT = 'pytornado'
class FILES

Bases: object

classmethod AIRFOIL(name_airfoil)

Return relative path to a ‘blade’ file

Notes:
  • Path is relative to the project root directory
  • Will return ‘airfoils/blade.NACA1234’ if ‘NACA1234’ is given
Args:
name_airfoil:String with the airfoil name
LOG = 'log.txt'
class pytornado.objects.settings.Settings(settings_filename, project_dir, *, settings_dict=None, make_dirs=True, check_ac_file_type=True)

Bases: object

clean()

Remove old files in project directory

generate_paths()

Initialise the file structure

state_is_cpacs

Flag indicating if state is to be read from CPACS

update_from_dict(settings_dict)

Update settings from dictionary structures

Args:
settings:Dictionary with general settings
plot:Dictionary with plot settings

pytornado.objects.state module

Data structure for aircraft flight state.

Developed for Airinnova AB, Stockholm, Sweden.

class pytornado.objects.state.CurrentState

Bases: object

class pytornado.objects.state.FlightState

Bases: object

check_values()

Make sure input values have correct format

free_stream_velocity_vector

Return the free stream velocity vector (incoming flow)

iter_states()

Iterator which yields a dictionary for each flight state

update_from_dict(aero)

Update state using a dictionary

pytornado.objects.utils module

Miscellaneous data structures for PyTornado.

Developed for Airinnova AB, Stockholm, Sweden.

class pytornado.objects.utils.FixedNamespace(**kwargs)

Bases: object

Immutable SIMPLENAMESPACE variant.

Functions as a RECORD- or STRUCT-like object. Attributes of FIXEDNAMESPACE are accessed by dot notation: ‘name.attr’.

__MUTABLE controls how attributes are created and modified:

  • When TRUE, assigning a value to an undefined attribute creates it.
  • When FALSE, this instead raises an AttributeError.

__MUTABLE is TRUE by default. _FREEZE sets __MUTABLE to FALSE.

[1] https://docs.python.org/3.5/library/types.html

class pytornado.objects.utils.FixedOrderedDict(*args)

Bases: collections.abc.MutableMapping

Immutable ORDEREDDICT[1] variant, based on MUTABLEMAPPING[2].

Works as a dictionary with ordered key-value pairs. Entries of FIXEDORDEREDDICT are accessed by key: ‘obj[key]’.

__MUTABLE controls how key-value pairs are created and modified: * When TRUE, assigning a value to an undefined key creates a new entry. * When FALSE, this instead raises an KeyError.

__MUTABLE is TRUE by default. _FREEZE sets __MUTABLE to FALSE.

[1] collections.OrderedDict [2] collections.MutableMapping

pytornado.objects.utils.check_dict(template_dict, test_dict)

Check that a test dictionary looks like a template dictionary

Args:
template_dict:Template dictionary
test_dict:Test dictionary

The template dictionary must have a specific structure as outlined below:

template_dict = {
    'test_key1': ('default_value1', str),
    'test_key2': (1792, (int, float)),
}

The values have to be tuples with some default value and the expected types of the values. The follwing dictionary would pass the test:

test_dict = {
    'test_key1': 'some_string',
    'test_key2': 1111,
}

However, the follwing dictionary does not have the correct form and an error will be raised.

test_dict = {
    'test_key1': 'this is okay...',
    'test_key2': '... but a string is now allowed here',
}
Raises:
TypeError:If types of test and template dictionary don’t match
pytornado.objects.utils.get_default_dict(template_dict)

Return a default dict from a template dictionary

Args:
template_dict:Template dictionary
Returns:
default_dict:New dictionary with defaults generated from ‘template_dict’

The template dictionary must have a specific structure as outlined below:

template_dict = {
    'test_key1': ('default_value1', str),
    'test_key2': (1792, (int, float)),
}

The ‘default_dict’ will look like this:

default_dict = {
    'test_key1': 'default_value1',
    'test_key2': 1792,
}

pytornado.objects.vlm_struct module

Data structures for VLM-related data: grid and results

Developed for Airinnova AB, Stockholm, Sweden.

class pytornado.objects.vlm_struct.BookKeepingEntry(subarea, pan_idx, num_chordwise_panels, mirror)

Bases: tuple

mirror

Alias for field number 3

num_chordwise_panels

Alias for field number 2

pan_idx

Alias for field number 1

subarea

Alias for field number 0

class pytornado.objects.vlm_struct.VLMData

Bases: object

class pytornado.objects.vlm_struct.VLMLattice

Bases: object

clean_bookkeeping()

Remove all bookkeeping entries

update_bookkeeping(entry)

Add a ‘BookKeepingEntry()’ to the bookkeeping system

Args:
entry:(obj) Instance of ‘BookKeepingEntry()’

Module contents

The objects package contains the definitions of the data structures. Each data structure is equipped with properties, called attributes, and functions that operate on these attributes, called methods.