fortran_to_aviary.py#
Fortran_to_Aviary.py is used to read in Fortran based vehicle decks and convert them to Aviary decks.
FLOPS, GASP, or Aviary names can be used for variables (Ex WG or Mission:Design:GROSS_MASS) When specifying variables from FORTRAN, they should be in the appropriate NAMELIST. Aviary variable names should be specified outside any NAMELISTS. Names are not case-sensitive. Units can be specified using any of the openMDAO valid units. Comments can be added using ! Lists can be entered by separating values with commas. Individual list elements can be specified by adding an index after the variable name. (NOTE: 1 indexing is used inside NAMELISTS, while 0 indexing is used outside NAMELISTS)
Example inputs: aircraft:fuselage:pressure_differential = .5, atm !DELP in GASP, but using atmospheres instead of psi ARNGE(1) = 3600 !target range in nautical miles
- aviary.utils.fortran_to_aviary.create_aviary_deck(fortran_deck: str, legacy_code=None, defaults_deck=None, out_file=None, force=False, verbosity=Verbosity.BRIEF)[source]
Create an Aviary CSV file from a Fortran input deck Required input is the filepath to the input deck and legacy code. Optionally, a deck of default values can be specified, this is useful if an input deck assumes certain values for any unspecified variables If an invalid filepath is given, pre-packaged resources will be checked for input decks with a matching name.
- aviary.utils.fortran_to_aviary.generate_aviary_names(code_bases)[source]
Create a dictionary for each of the specified Fortran code bases to map to the Aviary variable names. Each dictionary of Aviary names will have a list of Fortran names for each variable
- aviary.utils.fortran_to_aviary.input_parser(fortran_deck, vehicle_data, alternate_names, unused_vars, legacy_code)[source]
input_parser will modify the values in the vehicle_data dictionary using the data in the fortran_deck. Lines are read one by one, comments are removed, and namelists are tracked. Lines with multiple variable-data pairs are supported, but the last value per variable must be followed by a trailing comma.
- aviary.utils.fortran_to_aviary.process_and_store_data(data, var_name, legacy_code, current_namelist, alternate_names, vehicle_data, unused_vars, comment='')[source]
process_and_store_data takes in a string that contains the data, the current variable’s name and namelist, the dictionary of alternate names, and the current vehicle data. It will convert the string of data into a list, get units, check whether the data specified is part of a list or a single element, and update the current name to it’s equivalent Aviary name. The variables are also sorted based on whether they will set an Aviary variable or they are for initial guessing
- aviary.utils.fortran_to_aviary.set_value(var_name, var_value, value_dict: NamedValues, var_ind=None, units=None)[source]
set_value will update the current value of a variable in a value dictionary that contains a value and it’s associated units. If units are specified for the new value, they will be used, otherwise the current units in the value dictionary or the default units from _MetaData are used. If the new variable is part of a list, the current list will be extended if needed.
- aviary.utils.fortran_to_aviary.update_aviary_options(vehicle_data)[source]
Special handling for variables that occurs for either legacy code
- aviary.utils.fortran_to_aviary.update_flops_options(vehicle_data)[source]
Handles variables that are affected by the values of others
- aviary.utils.fortran_to_aviary.update_flops_scaler_variables(var_name, input_values: NamedValues)[source]
The following parameters are used to modify or override internally computed weights and areas for various components as follows: < 0., negative of starting weight which will be modified as appropriate during optimization or parametric variation, lb or ft**2 = 0., no weight for that component > 0. but < 5., scale factor applied to internally computed weight or area > 5., actual fixed weight for component, lb or ft**2 Same rules also applied to various other FLOPS scaler parameters
- aviary.utils.fortran_to_aviary.update_gasp_options(vehicle_data)[source]
Handles variables that are affected by the values of others
- aviary.utils.fortran_to_aviary.update_gasp_scaler_variables(var_name, input_values: NamedValues)[source]
The following parameters are used to modify or override internally computed weights and areas for various components as follows: < 0., negative of starting weight which will be modified as appropriate during optimization or parametric variation, lb or ft**2 = 0., no weight/area for that component > 0. but < 10., scale factor applied to internally computed weight > 10., actual fixed weight for component, lb or ft**2 Same rules also applied to various other FLOPS scaler parameters
- aviary.utils.fortran_to_aviary.update_name(alternate_names, var_name, verbosity=Verbosity.BRIEF)[source]
update_name will convert a Fortran name to a list of equivalent Aviary names.