From a2c0c052325f783f0194e75cc26086aceac4a2c8 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Mon, 2 Dec 2024 15:13:21 -0800 Subject: [PATCH 01/89] Improvements to DocTAPE Added support for objects like the Aircraft and Mission hierarchies to get_all_keys, get_value, and glue_keys. Fixed a bug where setting display=False for glue_variable would display instead of nothing Added support for including parentheses in the arguments for get_variable_name --- aviary/docs/developer_guide/doctape.ipynb | 24 ------- .../developer_guide/doctape_examples.ipynb | 65 +++++++++++++++++++ aviary/utils/doctape.py | 29 +++++++-- aviary/utils/test/test_doctape.py | 12 ++-- 4 files changed, 95 insertions(+), 35 deletions(-) diff --git a/aviary/docs/developer_guide/doctape.ipynb b/aviary/docs/developer_guide/doctape.ipynb index b4db14ae8..4fc24a74c 100644 --- a/aviary/docs/developer_guide/doctape.ipynb +++ b/aviary/docs/developer_guide/doctape.ipynb @@ -82,41 +82,17 @@ " doctape.glue_variable(key, md_code=True)\n", " class_list += f'- `{key}` {val}\\n'\n", "\n", - "# testing_list = ''\n", - "# for key,val in testing_functions.items():\n", - "# testing_list += f'- `{key}` {val}\\n'\n", - "\n", "utility_list = '```{eval-rst}\\n'\n", "for key in utility_functions:\n", " doctape.glue_variable(key, md_code=True)\n", " utility_list += ' '*4+f'.. autofunction:: aviary.utils.doctape.{key}\\n{\" \"*8}:noindex:\\n\\n'\n", "utility_list += '```'\n", "\n", - "# testing_list = '```{eval-rst}\\n'\n", - "# for key in testing_functions:\n", - "# utils.glue_variable(key, md_code=True)\n", - "# testing_list += ' '*4+f'.. autofunction:: aviary.utils.doctape.{key}\\n{\" \"*8}:noindex:\\n\\n'\n", - "# testing_list += '```'\n", - "\n", - "# testing_list = '
\\n\\nFunction Docs\\n\\n'\n", "testing_list = '```{eval-rst}\\n'\n", "for key in testing_functions:\n", " doctape.glue_variable(key, md_code=True)\n", " testing_list += ' '*4+f'.. autofunction:: aviary.utils.doctape.{key}\\n{\" \"*8}:noindex:\\n\\n'\n", "testing_list += '```'\n", - "# testing_list += '\\n\\n
'\n", - "\n", - "# glue_list = ''\n", - "# for key,val in glue_functions.items():\n", - "# glue_list += f'- `{key}` {key}\\n'\n", - "\n", - "# glue_list = ''\n", - "# for key in glue_functions:\n", - "# # doc_str = inspect.getdoc(imported_functions[key])\n", - "# doc_str = imported_functions[key].__doc__.split('\\n')[1]\n", - "# # doc_str = '\\n'.join([s+' ' for s in imported_functions[key].__doc__.split('\\n')])\n", - "# print(doc_str)\n", - "# glue_list += f'- `{key}`: {doc_str}\\n'\n", "\n", "glue_list = '```{eval-rst}\\n'\n", "for key in glue_functions:\n", diff --git a/aviary/docs/developer_guide/doctape_examples.ipynb b/aviary/docs/developer_guide/doctape_examples.ipynb index 378bfe52e..24edcdfe6 100644 --- a/aviary/docs/developer_guide/doctape_examples.ipynb +++ b/aviary/docs/developer_guide/doctape_examples.ipynb @@ -482,6 +482,71 @@ "p1_alt = get_value(simplified_dict, 'phase1.altitude.val')\n", "print(p1_alt)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "# Testing Cell\n", + "from aviary.utils.doctape import glue_variable, check_args, get_all_keys, get_previous_line\n", + "from aviary.api import Aircraft, Mission\n", + "\n", + "glue_variable(Aircraft.__name__)\n", + "glue_variable(Mission.__name__)\n", + "\n", + "track_layers = 'track_layers'\n", + "check_args(get_all_keys, track_layers)\n", + "glue_variable(track_layers)\n", + "\n", + "get_all_keys(Mission, track_layers='Mission')\n", + "track_layers_with_name = get_previous_line().split(', ')[1].split(')')[0]\n", + "glue_variable('track_layers_with_Mission', track_layers_with_name, display=False)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "These can also be used to recursively get all of the attributes from a complex object, like the {glue:md}`Aircraft` or {glue:md}`Mission` hierarchies.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from aviary.utils.doctape import get_all_keys, get_value, glue_keys\n", + "from aviary.api import Mission\n", + "\n", + "k1=get_all_keys(Mission)\n", + "print(k1[:5]) # Display the first 5 keys in Mission\n", + "k2=get_all_keys(Mission, track_layers=True)\n", + "print(k2[:5]) # Display the first 5 keys in Mission\n", + "k3=get_all_keys(Mission, track_layers='Mission')\n", + "print(k3[:5]) # Display the first 5 keys in Mission\n", + "\n", + "glue_keys(Mission, False)\n", + "\n", + "print(get_value(Mission,'Constraints.GEARBOX_SHAFT_POWER_RESIDUAL'))\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "If {glue:md}`get_all_keys` is used on an object like {glue:md}`Mission` without specifying a value for {glue:md}`track_layers` will return all of the uniquely named attributes of the object (such as {glue:md}GEARBOX_SHAFT_POWER_RESIDUAL). Setting {glue:md}`track_layers` to `True` will get all of the attributes in dot notation, but will not include the name of the original object ({glue:md}Constraints.GEARBOX_SHAFT_POWER_RESIDUAL). If you want the full name of the attribute, including the name of the original object, you can use that name as the value of {glue:md}`track_layers` (using {glue:md}track_layers_with_Mission gives us access to {glue:md}Mission.Constraints.GEARBOX_SHAFT_POWER_RESIDUAL)\n", + "\n", + "Using {glue:md}`glue_keys` handles this for us automatically by using the `__name__` attribute of the object passed to it as the value of {glue:md}`track_layers`.\n", + "\n", + "As with the dict_of_dicts, we can recusively get the value of an attribute using the full path along with {glue:md}`get_value`." + ] } ], "metadata": { diff --git a/aviary/utils/doctape.py b/aviary/utils/doctape.py index 13f129410..3900e9632 100644 --- a/aviary/utils/doctape.py +++ b/aviary/utils/doctape.py @@ -1,7 +1,6 @@ import inspect import subprocess import tempfile -import os import numpy as np @@ -107,8 +106,8 @@ def get_variable_name(*variables) -> str: # get the line number that called this function lineno = pframe.f_lineno - first_line if first_line else pframe.f_lineno - 1 # extract the argument and remove all whitespace - arg: str = ''.join(lines[lineno].split( - 'get_variable_name(')[1].split(')')[0].split()) + pre_arg, arg = ''.join(lines[lineno].split()).split('get_variable_name(', 1) + arg = ')'.join(arg.split(')')[:-(1+pre_arg.count('('))]) if ',' in arg: return arg.split(',') else: @@ -290,6 +289,7 @@ def get_attribute_name(object: object, attribute, error_type=AttributeError) -> def get_all_keys(dict_of_dicts: dict, track_layers=False, all_keys=None) -> list: """ Recursively get all of the keys from a dict of dicts + This can also be used to recursively get all of the attributes from a complex object, like the Aircraft hierarchy Note: this will not add duplicates of keys, but will continue deeper even if a key is duplicated @@ -309,9 +309,14 @@ def get_all_keys(dict_of_dicts: dict, track_layers=False, all_keys=None) -> list all_keys : list A list of all the keys in the dict_of_dicts """ + if not isinstance(dict_of_dicts, dict): + dict_of_dicts = dict_of_dicts.__dict__ if all_keys is None: all_keys = [] + for key, val in dict_of_dicts.items(): + if key.startswith('__') and key.endswith('__'): + continue if track_layers is True: current_layer = '' elif track_layers: @@ -320,7 +325,7 @@ def get_all_keys(dict_of_dicts: dict, track_layers=False, all_keys=None) -> list key = current_layer+'.'+key if key not in all_keys: all_keys.append(key) - if isinstance(val, dict): + if isinstance(val, dict) or hasattr(val, '__dict__'): if track_layers: current_layer = key else: @@ -347,6 +352,8 @@ def get_value(dict_of_dicts: dict, comlpete_key: str): """ for key in comlpete_key.split('.'): + if not isinstance(dict_of_dicts, dict): + dict_of_dicts = dict_of_dicts.__dict__ dict_of_dicts = dict_of_dicts[key] return dict_of_dicts @@ -372,13 +379,18 @@ def glue_variable(name: str, val=None, md_code=False, display=True): # local import so myst isn't required unless glue is being used from myst_nb import glue from IPython.display import Markdown + from IPython.utils import io if val is None: val = name if md_code: val = Markdown('`'+val+'`') else: val = Markdown(val) - glue(name, val, display) + + with io.capture_output() as captured: + glue(name, val, display) + if display: + captured.show() def glue_keys(dict_of_dicts: dict, display=True) -> list: @@ -395,7 +407,12 @@ def glue_keys(dict_of_dicts: dict, display=True) -> list: all_keys : list A list of all the keys that were glued """ - all_keys = get_all_keys(dict_of_dicts) + if not isinstance(dict_of_dicts, dict): + track_layers = dict_of_dicts.__name__ + else: + track_layers = False + all_keys = get_all_keys(dict_of_dicts, track_layers) + for key in all_keys: glue_variable(key, md_code=True, display=display) return all_keys diff --git a/aviary/utils/test/test_doctape.py b/aviary/utils/test/test_doctape.py index d13b8d1c1..6e9db35c4 100644 --- a/aviary/utils/test/test_doctape.py +++ b/aviary/utils/test/test_doctape.py @@ -3,7 +3,9 @@ from openmdao.utils.assert_utils import assert_near_equal, assert_equal_numstrings, assert_equal_arrays -from aviary.utils.doctape import gramatical_list, check_value, check_contains, check_args, run_command_no_file_error, get_attribute_name, get_all_keys, get_value, get_previous_line, get_variable_name +from aviary.utils.doctape import (gramatical_list, check_value, check_contains, check_args, + run_command_no_file_error, get_attribute_name, get_all_keys, get_value, get_previous_line, + get_variable_name, glue_variable, glue_keys) class DocTAPETests(unittest.TestCase): @@ -55,12 +57,12 @@ def test_get_variable_name(self): assert_equal_numstrings(name, 'var') # requires IPython shell - # def test_glue_variable(self): - # glue_variable('plain_text') + def test_glue_variable(self): + glue_variable('plain_text', display=False) # requires IPython shell - # def test_glue_keys(self): - # glue_keys({'d1':{'d2':2}}) + def test_glue_keys(self): + glue_keys({'d1': {'d2': 2}}, display=False) if __name__ == '__main__': From ba6f558eef6752ec679d7a06196b697dd1292950 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Mon, 2 Dec 2024 17:40:45 -0800 Subject: [PATCH 02/89] fix for parentheses matching --- aviary/utils/doctape.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/aviary/utils/doctape.py b/aviary/utils/doctape.py index 3900e9632..45932b903 100644 --- a/aviary/utils/doctape.py +++ b/aviary/utils/doctape.py @@ -2,6 +2,7 @@ import subprocess import tempfile import numpy as np +import re """ @@ -88,6 +89,7 @@ def get_previous_line(n=1) -> str: def get_variable_name(*variables) -> str: """ returns the name of the variable passed to the function as a string + # NOTE: You cannot call this function multiple times on one line Parameters ---------- @@ -107,7 +109,14 @@ def get_variable_name(*variables) -> str: lineno = pframe.f_lineno - first_line if first_line else pframe.f_lineno - 1 # extract the argument and remove all whitespace pre_arg, arg = ''.join(lines[lineno].split()).split('get_variable_name(', 1) - arg = ')'.join(arg.split(')')[:-(1+pre_arg.count('('))]) + + num_paren = 1 + for ind, el in enumerate(arg.split(')')): + num_paren += el.count('(')-1 + if num_paren == 0: + break + arg = ')'.join(arg.split(')')[:ind+1]) + if ',' in arg: return arg.split(',') else: From d03c0839f62878062654a42f410c94f914b2aeed Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Mon, 2 Dec 2024 17:41:41 -0800 Subject: [PATCH 03/89] trying regex --- aviary/utils/doctape.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/aviary/utils/doctape.py b/aviary/utils/doctape.py index 45932b903..1ca223117 100644 --- a/aviary/utils/doctape.py +++ b/aviary/utils/doctape.py @@ -108,14 +108,12 @@ def get_variable_name(*variables) -> str: # get the line number that called this function lineno = pframe.f_lineno - first_line if first_line else pframe.f_lineno - 1 # extract the argument and remove all whitespace - pre_arg, arg = ''.join(lines[lineno].split()).split('get_variable_name(', 1) - - num_paren = 1 - for ind, el in enumerate(arg.split(')')): - num_paren += el.count('(')-1 - if num_paren == 0: - break - arg = ')'.join(arg.split(')')[:ind+1]) + arg = ''.join(lines[lineno].split()).split('get_variable_name(', 1)[1] + + # Use regex to match balanced parentheses + match = re.match(r'([^()]*\([^()]*\))*[^()]*', arg) + if match: + arg = match.group(0) if ',' in arg: return arg.split(',') From c4a7bc736973f8588d2edc8db16630be7cc826e3 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Tue, 3 Dec 2024 08:49:01 -0800 Subject: [PATCH 04/89] adding myst-nb to test dependencies --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 143676dd5..465292ffd 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ pkgname = "aviary" extras_require = { - "test": ["testflo", "pre-commit", "sphinx_book_theme==1.1.0"], + "test": ["testflo", "pre-commit", "sphinx_book_theme==1.1.0", "myst-nb"], "examples": ["openaerostruct", "ambiance", "itables"], } From 5c390bf6cf7adc325ca39c8d1c09842f109f4792 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Tue, 3 Dec 2024 15:09:51 -0800 Subject: [PATCH 05/89] fix for CI capturing the output of glue without running RichOutput(**kargs).display() prevents myst from finding the glued variable --- aviary/utils/doctape.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/aviary/utils/doctape.py b/aviary/utils/doctape.py index 1ca223117..a63282041 100644 --- a/aviary/utils/doctape.py +++ b/aviary/utils/doctape.py @@ -115,6 +115,13 @@ def get_variable_name(*variables) -> str: if match: arg = match.group(0) + # # Requires Python 3.11, but allows this to be called multiple times on one line + # positions = inspect.getframeinfo(pframe).positions + # calling_lines = lines[positions.lineno-1:positions.end_lineno] + # calling_lines[-1] = calling_lines[-1][:positions.end_col_offset-1] + # calling_lines[0] = calling_lines[0][positions.col_offset:].removeprefix('get_variable_name(') + # arg = ''.join([l.strip() for l in calling_lines]) + if ',' in arg: return arg.split(',') else: @@ -396,8 +403,8 @@ def glue_variable(name: str, val=None, md_code=False, display=True): with io.capture_output() as captured: glue(name, val, display) - if display: - captured.show() + # if display: + captured.show() def glue_keys(dict_of_dicts: dict, display=True) -> list: From 0b9605a890822606e829bddc316cf6889578bf0e Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Tue, 3 Dec 2024 15:48:54 -0800 Subject: [PATCH 06/89] fix for CI --- aviary/docs/developer_guide/doctape_examples.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aviary/docs/developer_guide/doctape_examples.ipynb b/aviary/docs/developer_guide/doctape_examples.ipynb index 24edcdfe6..4fb7f3006 100644 --- a/aviary/docs/developer_guide/doctape_examples.ipynb +++ b/aviary/docs/developer_guide/doctape_examples.ipynb @@ -407,12 +407,12 @@ "outputs": [], "source": [ "# Testing Cell\n", - "from aviary.api import Mission\n", + "from aviary.api import Aircraft\n", "from aviary.utils.doctape import glue_variable, get_previous_line, get_variable_name\n", "\n", - "glue_variable('value', Mission.Design.MACH, md_code=True)\n", + "glue_variable('value', Aircraft.Design.EMPTY_MASS, md_code=True)\n", "glue_variable('var_value_code', get_previous_line(), md_code=True)\n", - "glue_variable(get_variable_name(Mission.Design.MACH), md_code=True)\n", + "glue_variable(get_variable_name(Aircraft.Design.EMPTY_MASS), md_code=True)\n", "glue_variable('var_name_code', get_previous_line(), md_code=True)\n" ] }, @@ -423,7 +423,7 @@ "If you want to glue the name of a variable, instead of the value that variable holds, you can use the {glue:md}`get_variable_name` to extract it.\n", "\n", "For example:\n", - "Using {glue:md}`var_value_code` will result in {glue:md}`value`, whereas using {glue:md}`var_name_code` will result in {glue:md}`Mission.Design.MACH`\n", + "Using {glue:md}`var_value_code` will result in {glue:md}`value`, whereas using {glue:md}`var_name_code` will result in {glue:md}`Aircraft.Design.EMPTY_MASS`\n", "\n", "### {glue:md}`get_attribute_name`\n", "allows users to get the name of object attributes in order to glue them into documentation. This works well for Enums or Class Variables that have unique values." From 157e986fde625f323a5e6a1bc81c734a71fd7401 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Wed, 18 Dec 2024 19:49:47 -0800 Subject: [PATCH 07/89] In add_aviary_input and add_aviary_output, set val = 0.0 if val is None. --- aviary/variable_info/functions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/aviary/variable_info/functions.py b/aviary/variable_info/functions.py index 8c28147a0..9f96833ff 100644 --- a/aviary/variable_info/functions.py +++ b/aviary/variable_info/functions.py @@ -1,4 +1,5 @@ import dymos as dm +import numpy as np import openmdao.api as om from dymos.utils.misc import _unspecified from openmdao.core.component import Component @@ -34,6 +35,11 @@ def add_aviary_input(comp, varname, val=None, units=None, desc=None, shape_by_co input_desc = meta['desc'] if val is None: val = meta['default_value'] + if val is None: + if shape is None: + val = 0.0 + else: + val = np.zeros(shape) comp.add_input(varname, val=val, units=input_units, desc=input_desc, shape_by_conn=shape_by_conn, shape=shape) @@ -58,6 +64,10 @@ def add_aviary_output(comp, varname, val, units=None, desc=None, shape_by_conn=F output_desc = desc else: output_desc = meta['desc'] + if val is None: + val = meta['default_value'] + if val is None: + val = 0.0 comp.add_output(varname, val=val, units=output_units, desc=output_desc, shape_by_conn=shape_by_conn) From 6bf20659fc91a9bb47f22e3296d2cf10314ecfa1 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Wed, 18 Dec 2024 19:51:44 -0800 Subject: [PATCH 08/89] set Aircraft.Hydraulics.SYSTEM_PRESSURE = 0 instead of 3000 as default. --- aviary/variable_info/variable_meta_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index 6ef0e83de..ea20de153 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -3778,7 +3778,7 @@ }, units='psi', desc='hydraulic system pressure', - default_value=3000.0, + default_value=0.0, ) # From 03b14b62711151d1fb912cf86fe111662d00c424 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Wed, 18 Dec 2024 19:56:06 -0800 Subject: [PATCH 09/89] work in progress: Remove value from setup() so that the value is taken from default in metadata. --- .../mass/flops_based/air_conditioning.py | 17 +++---- .../subsystems/mass/flops_based/anti_icing.py | 17 +++---- aviary/subsystems/mass/flops_based/apu.py | 7 ++- .../subsystems/mass/flops_based/avionics.py | 10 ++-- aviary/subsystems/mass/flops_based/canard.py | 10 ++-- aviary/subsystems/mass/flops_based/cargo.py | 17 ++++--- .../mass/flops_based/cargo_containers.py | 11 ++--- aviary/subsystems/mass/flops_based/crew.py | 10 ++-- .../subsystems/mass/flops_based/electrical.py | 12 ++--- .../mass/flops_based/empty_margin.py | 13 ++--- aviary/subsystems/mass/flops_based/engine.py | 14 ++---- .../mass/flops_based/engine_controls.py | 6 +-- .../subsystems/mass/flops_based/engine_oil.py | 11 ++--- .../subsystems/mass/flops_based/engine_pod.py | 25 +++++----- aviary/subsystems/mass/flops_based/fin.py | 10 ++-- .../mass/flops_based/fuel_capacity.py | 42 ++++++++-------- .../mass/flops_based/fuel_system.py | 14 +++--- .../mass/flops_based/furnishings.py | 48 +++++++------------ .../subsystems/mass/flops_based/fuselage.py | 10 ++-- .../mass/flops_based/horizontal_tail.py | 18 ++++--- .../subsystems/mass/flops_based/hydraulics.py | 30 +++++------- .../mass/flops_based/instruments.py | 4 +- .../mass/flops_based/landing_gear.py | 40 ++++++---------- 23 files changed, 167 insertions(+), 229 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/air_conditioning.py b/aviary/subsystems/mass/flops_based/air_conditioning.py index 894ca14dd..a20a32214 100644 --- a/aviary/subsystems/mass/flops_based/air_conditioning.py +++ b/aviary/subsystems/mass/flops_based/air_conditioning.py @@ -21,15 +21,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.AirConditioning.MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.AirConditioning.MASS_SCALER) + add_aviary_input(self, Aircraft.Avionics.MASS) + add_aviary_input(self, Aircraft.Fuselage.MAX_HEIGHT) + add_aviary_input(self, Aircraft.Fuselage.PLANFORM_AREA) - add_aviary_input(self, Aircraft.Avionics.MASS, val=0.0) - - add_aviary_input(self, Aircraft.Fuselage.MAX_HEIGHT, val=0.0) - - add_aviary_input(self, Aircraft.Fuselage.PLANFORM_AREA, val=0.0) - - add_aviary_output(self, Aircraft.AirConditioning.MASS, val=0.0) + add_aviary_output(self, Aircraft.AirConditioning.MASS) def setup_partials(self): self.declare_partials('*', '*') @@ -91,9 +88,9 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.AirConditioning.MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.AirConditioning.MASS_SCALER) - add_aviary_output(self, Aircraft.AirConditioning.MASS, val=0.0) + add_aviary_output(self, Aircraft.AirConditioning.MASS) def setup_partials(self): self.declare_partials(of=Aircraft.AirConditioning.MASS, wrt='*') diff --git a/aviary/subsystems/mass/flops_based/anti_icing.py b/aviary/subsystems/mass/flops_based/anti_icing.py index 779fc3ca0..ae82a546a 100644 --- a/aviary/subsystems/mass/flops_based/anti_icing.py +++ b/aviary/subsystems/mass/flops_based/anti_icing.py @@ -26,18 +26,13 @@ def setup(self): num_engine_type = len(self.options['aviary_options'].get_val( Aircraft.Engine.NUM_ENGINES)) - add_aviary_input(self, Aircraft.AntiIcing.MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.AntiIcing.MASS_SCALER) + add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH) + add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, shape=num_engine_type) + add_aviary_input(self, Aircraft.Wing.SPAN) + add_aviary_input(self, Aircraft.Wing.SWEEP) - add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, val=0.0) - - add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, - val=np.zeros(num_engine_type)) - - add_aviary_input(self, Aircraft.Wing.SPAN, val=0.0) - - add_aviary_input(self, Aircraft.Wing.SWEEP, val=0.0) - - add_aviary_output(self, Aircraft.AntiIcing.MASS, val=0.0) + add_aviary_output(self, Aircraft.AntiIcing.MASS) def setup_partials(self): self.declare_partials("*", "*") diff --git a/aviary/subsystems/mass/flops_based/apu.py b/aviary/subsystems/mass/flops_based/apu.py index 3a8fec051..217f553a7 100644 --- a/aviary/subsystems/mass/flops_based/apu.py +++ b/aviary/subsystems/mass/flops_based/apu.py @@ -18,11 +18,10 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.APU.MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.APU.MASS_SCALER) + add_aviary_input(self, Aircraft.Fuselage.PLANFORM_AREA) - add_aviary_input(self, Aircraft.Fuselage.PLANFORM_AREA, val=0.0) - - add_aviary_output(self, Aircraft.APU.MASS, val=0.0) + add_aviary_output(self, Aircraft.APU.MASS) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/avionics.py b/aviary/subsystems/mass/flops_based/avionics.py index 0c6e54522..9b2b2d61b 100644 --- a/aviary/subsystems/mass/flops_based/avionics.py +++ b/aviary/subsystems/mass/flops_based/avionics.py @@ -19,13 +19,11 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Avionics.MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Avionics.MASS_SCALER) + add_aviary_input(self, Aircraft.Fuselage.PLANFORM_AREA) + add_aviary_input(self, Mission.Design.RANGE) - add_aviary_input(self, Aircraft.Fuselage.PLANFORM_AREA, val=0.0) - - add_aviary_input(self, Mission.Design.RANGE, val=0.0) - - add_aviary_output(self, Aircraft.Avionics.MASS, val=0.0) + add_aviary_output(self, Aircraft.Avionics.MASS) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/canard.py b/aviary/subsystems/mass/flops_based/canard.py index 9223872f1..a8ea05f47 100644 --- a/aviary/subsystems/mass/flops_based/canard.py +++ b/aviary/subsystems/mass/flops_based/canard.py @@ -18,12 +18,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) - add_aviary_input(self, Aircraft.Canard.AREA, val=0.0) - add_aviary_input(self, Aircraft.Canard.TAPER_RATIO, val=00) - add_aviary_input(self, Aircraft.Canard.MASS_SCALER, val=1.0) + add_aviary_input(self, Mission.Design.GROSS_MASS) + add_aviary_input(self, Aircraft.Canard.AREA) + add_aviary_input(self, Aircraft.Canard.TAPER_RATIO) + add_aviary_input(self, Aircraft.Canard.MASS_SCALER) - add_aviary_output(self, Aircraft.Canard.MASS, val=0.0) + add_aviary_output(self, Aircraft.Canard.MASS) def setup_partials(self): self.declare_partials("*", "*") diff --git a/aviary/subsystems/mass/flops_based/cargo.py b/aviary/subsystems/mass/flops_based/cargo.py index 8ac83f493..ad047f6e7 100644 --- a/aviary/subsystems/mass/flops_based/cargo.py +++ b/aviary/subsystems/mass/flops_based/cargo.py @@ -22,15 +22,14 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_output(self, Aircraft.CrewPayload.PASSENGER_MASS, 0.) - add_aviary_output(self, Aircraft.CrewPayload.BAGGAGE_MASS, 0.) - add_aviary_output(self, Aircraft.CrewPayload.PASSENGER_PAYLOAD_MASS, 0.) - - add_aviary_input(self, Aircraft.CrewPayload.WING_CARGO, 0.) - add_aviary_input(self, Aircraft.CrewPayload.MISC_CARGO, 0.) - - add_aviary_output(self, Aircraft.CrewPayload.CARGO_MASS, 0.) - add_aviary_output(self, Aircraft.CrewPayload.TOTAL_PAYLOAD_MASS, 0.) + add_aviary_input(self, Aircraft.CrewPayload.WING_CARGO) + add_aviary_input(self, Aircraft.CrewPayload.MISC_CARGO) + + add_aviary_output(self, Aircraft.CrewPayload.PASSENGER_MASS) + add_aviary_output(self, Aircraft.CrewPayload.BAGGAGE_MASS) + add_aviary_output(self, Aircraft.CrewPayload.PASSENGER_PAYLOAD_MASS) + add_aviary_output(self, Aircraft.CrewPayload.CARGO_MASS) + add_aviary_output(self, Aircraft.CrewPayload.TOTAL_PAYLOAD_MASS) def setup_partials(self): diff --git a/aviary/subsystems/mass/flops_based/cargo_containers.py b/aviary/subsystems/mass/flops_based/cargo_containers.py index df0967439..74639c5ec 100644 --- a/aviary/subsystems/mass/flops_based/cargo_containers.py +++ b/aviary/subsystems/mass/flops_based/cargo_containers.py @@ -20,14 +20,11 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input( - self, Aircraft.CrewPayload.CARGO_CONTAINER_MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.CrewPayload.CARGO_CONTAINER_MASS_SCALER) + add_aviary_input(self, Aircraft.CrewPayload.CARGO_MASS) + add_aviary_input(self, Aircraft.CrewPayload.BAGGAGE_MASS) - add_aviary_input(self, Aircraft.CrewPayload.CARGO_MASS, val=0.0) - - add_aviary_input(self, Aircraft.CrewPayload.BAGGAGE_MASS, val=0.0) - - add_aviary_output(self, Aircraft.CrewPayload.CARGO_CONTAINER_MASS, val=0.0) + add_aviary_output(self, Aircraft.CrewPayload.CARGO_CONTAINER_MASS) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/crew.py b/aviary/subsystems/mass/flops_based/crew.py index 60030710b..491567189 100644 --- a/aviary/subsystems/mass/flops_based/crew.py +++ b/aviary/subsystems/mass/flops_based/crew.py @@ -20,10 +20,9 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input( - self, Aircraft.CrewPayload.NON_FLIGHT_CREW_MASS_SCALER, 1.) + add_aviary_input(self, Aircraft.CrewPayload.NON_FLIGHT_CREW_MASS_SCALER) - add_aviary_output(self, Aircraft.CrewPayload.NON_FLIGHT_CREW_MASS, 0) + add_aviary_output(self, Aircraft.CrewPayload.NON_FLIGHT_CREW_MASS) def setup_partials(self): self.declare_partials( @@ -84,10 +83,9 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input( - self, Aircraft.CrewPayload.FLIGHT_CREW_MASS_SCALER, 1.) + add_aviary_input(self, Aircraft.CrewPayload.FLIGHT_CREW_MASS_SCALER) - add_aviary_output(self, Aircraft.CrewPayload.FLIGHT_CREW_MASS, 0.) + add_aviary_output(self, Aircraft.CrewPayload.FLIGHT_CREW_MASS) def setup_partials(self): self.declare_partials( diff --git a/aviary/subsystems/mass/flops_based/electrical.py b/aviary/subsystems/mass/flops_based/electrical.py index 1430945f7..b76f53b22 100644 --- a/aviary/subsystems/mass/flops_based/electrical.py +++ b/aviary/subsystems/mass/flops_based/electrical.py @@ -20,11 +20,11 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Fuselage.LENGTH, 0.0) - add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, 0.0) - add_aviary_input(self, Aircraft.Electrical.MASS_SCALER, 1.0) + add_aviary_input(self, Aircraft.Fuselage.LENGTH) + add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH) + add_aviary_input(self, Aircraft.Electrical.MASS_SCALER) - add_aviary_output(self, Aircraft.Electrical.MASS, 1.0) + add_aviary_output(self, Aircraft.Electrical.MASS) def setup_partials(self): self.declare_partials(of='*', wrt='*') @@ -85,9 +85,9 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Electrical.MASS_SCALER, 1.0) + add_aviary_input(self, Aircraft.Electrical.MASS_SCALER) - add_aviary_output(self, Aircraft.Electrical.MASS, 1.0) + add_aviary_output(self, Aircraft.Electrical.MASS) def setup_partials(self): self.declare_partials(of='*', wrt='*') diff --git a/aviary/subsystems/mass/flops_based/empty_margin.py b/aviary/subsystems/mass/flops_based/empty_margin.py index 4c4b5cf33..91fee5fe4 100644 --- a/aviary/subsystems/mass/flops_based/empty_margin.py +++ b/aviary/subsystems/mass/flops_based/empty_margin.py @@ -16,15 +16,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Propulsion.MASS, val=0.) + add_aviary_input(self, Aircraft.Propulsion.MASS) + add_aviary_input(self, Aircraft.Design.STRUCTURE_MASS) + add_aviary_input(self, Aircraft.Design.SYSTEMS_EQUIP_MASS) + add_aviary_input(self, Aircraft.Design.EMPTY_MASS_MARGIN_SCALER) - add_aviary_input(self, Aircraft.Design.STRUCTURE_MASS, val=0.) - - add_aviary_input(self, Aircraft.Design.SYSTEMS_EQUIP_MASS, val=0.) - - add_aviary_input(self, Aircraft.Design.EMPTY_MASS_MARGIN_SCALER, val=0.0) - - add_aviary_output(self, Aircraft.Design.EMPTY_MASS_MARGIN, val=0.0) + add_aviary_output(self, Aircraft.Design.EMPTY_MASS_MARGIN) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/engine.py b/aviary/subsystems/mass/flops_based/engine.py index ac9644327..613abf343 100644 --- a/aviary/subsystems/mass/flops_based/engine.py +++ b/aviary/subsystems/mass/flops_based/engine.py @@ -24,16 +24,12 @@ def setup(self): num_engine_type = len(self.options['aviary_options'].get_val( Aircraft.Engine.NUM_ENGINES)) - add_aviary_input(self, Aircraft.Engine.SCALED_SLS_THRUST, - val=np.zeros(num_engine_type)) + add_aviary_input(self, Aircraft.Engine.SCALED_SLS_THRUST, shape=num_engine_type) + add_aviary_input(self, Aircraft.Engine.MASS_SCALER, shape=num_engine_type) - add_aviary_input(self, Aircraft.Engine.MASS_SCALER, - val=np.zeros(num_engine_type)) - - add_aviary_output(self, Aircraft.Engine.MASS, val=np.zeros(num_engine_type)) - add_aviary_output(self, Aircraft.Engine.ADDITIONAL_MASS, - val=np.zeros(num_engine_type)) - add_aviary_output(self, Aircraft.Propulsion.TOTAL_ENGINE_MASS, val=0.0) + add_aviary_output(self, Aircraft.Engine.MASS, shape=num_engine_type) + add_aviary_output(self, Aircraft.Engine.ADDITIONAL_MASS, shape=num_engine_type) + add_aviary_output(self, Aircraft.Propulsion.TOTAL_ENGINE_MASS) def compute(self, inputs, outputs): aviary_options: AviaryValues = self.options['aviary_options'] diff --git a/aviary/subsystems/mass/flops_based/engine_controls.py b/aviary/subsystems/mass/flops_based/engine_controls.py index c17868c1f..1a4931b74 100644 --- a/aviary/subsystems/mass/flops_based/engine_controls.py +++ b/aviary/subsystems/mass/flops_based/engine_controls.py @@ -30,11 +30,9 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input( - self, Aircraft.Propulsion.TOTAL_SCALED_SLS_THRUST, val=0.0, units='lbf') + add_aviary_input(self, Aircraft.Propulsion.TOTAL_SCALED_SLS_THRUST) - add_aviary_output( - self, Aircraft.Propulsion.TOTAL_ENGINE_CONTROLS_MASS, val=0.0, units='lbm') + add_aviary_output(self, Aircraft.Propulsion.TOTAL_ENGINE_CONTROLS_MASS) def setup_partials(self): self.declare_partials(Aircraft.Propulsion.TOTAL_ENGINE_CONTROLS_MASS, diff --git a/aviary/subsystems/mass/flops_based/engine_oil.py b/aviary/subsystems/mass/flops_based/engine_oil.py index d82cd8e63..8af91bd3b 100644 --- a/aviary/subsystems/mass/flops_based/engine_oil.py +++ b/aviary/subsystems/mass/flops_based/engine_oil.py @@ -27,11 +27,10 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Propulsion.ENGINE_OIL_MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Propulsion.ENGINE_OIL_MASS_SCALER) + add_aviary_input(self, Aircraft.Propulsion.TOTAL_SCALED_SLS_THRUST) - add_aviary_input(self, Aircraft.Propulsion.TOTAL_SCALED_SLS_THRUST, val=0.0) - - add_aviary_output(self, Aircraft.Propulsion.TOTAL_ENGINE_OIL_MASS, val=0.0) + add_aviary_output(self, Aircraft.Propulsion.TOTAL_ENGINE_OIL_MASS) def setup_partials(self): self.declare_partials('*', '*') @@ -77,9 +76,9 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Propulsion.ENGINE_OIL_MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Propulsion.ENGINE_OIL_MASS_SCALER) - add_aviary_output(self, Aircraft.Propulsion.TOTAL_ENGINE_OIL_MASS, val=0.0) + add_aviary_output(self, Aircraft.Propulsion.TOTAL_ENGINE_OIL_MASS) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/engine_pod.py b/aviary/subsystems/mass/flops_based/engine_pod.py index 256c26d26..393daaab3 100644 --- a/aviary/subsystems/mass/flops_based/engine_pod.py +++ b/aviary/subsystems/mass/flops_based/engine_pod.py @@ -26,21 +26,20 @@ def setup(self): num_engine_type = len(self.options['aviary_options'].get_val( Aircraft.Engine.NUM_ENGINES)) - add_aviary_input(self, Aircraft.Electrical.MASS, val=0.0) - add_aviary_input(self, Aircraft.Fuel.FUEL_SYSTEM_MASS, val=0.0) - add_aviary_input(self, Aircraft.Hydraulics.MASS, val=0.0) - add_aviary_input(self, Aircraft.Instruments.MASS, val=0.0) - add_aviary_input(self, Aircraft.Nacelle.MASS, val=np.zeros(num_engine_type)) - add_aviary_input(self, Aircraft.Propulsion.TOTAL_ENGINE_CONTROLS_MASS, val=0.0) - add_aviary_input(self, Aircraft.Engine.MASS, val=np.zeros(num_engine_type)) - add_aviary_input(self, Aircraft.Propulsion.TOTAL_STARTER_MASS, val=0.0) + add_aviary_input(self, Aircraft.Electrical.MASS) + add_aviary_input(self, Aircraft.Fuel.FUEL_SYSTEM_MASS) + add_aviary_input(self, Aircraft.Hydraulics.MASS) + add_aviary_input(self, Aircraft.Instruments.MASS) + add_aviary_input(self, Aircraft.Nacelle.MASS, shape=num_engine_type) + add_aviary_input(self, Aircraft.Propulsion.TOTAL_ENGINE_CONTROLS_MASS) + add_aviary_input(self, Aircraft.Engine.MASS, shape=num_engine_type) + add_aviary_input(self, Aircraft.Propulsion.TOTAL_STARTER_MASS) add_aviary_input(self, Aircraft.Engine.THRUST_REVERSERS_MASS, - val=np.zeros(num_engine_type)) - add_aviary_input(self, Aircraft.Engine.SCALED_SLS_THRUST, - val=np.zeros(num_engine_type)) - add_aviary_input(self, Aircraft.Propulsion.TOTAL_SCALED_SLS_THRUST, val=0.0) + shape=num_engine_type) + add_aviary_input(self, Aircraft.Engine.SCALED_SLS_THRUST, shape=num_engine_type) + add_aviary_input(self, Aircraft.Propulsion.TOTAL_SCALED_SLS_THRUST) - add_aviary_output(self, Aircraft.Engine.POD_MASS, val=np.zeros(num_engine_type)) + add_aviary_output(self, Aircraft.Engine.POD_MASS, shape=num_engine_type) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/fin.py b/aviary/subsystems/mass/flops_based/fin.py index 989ee1ee2..5eef4aac8 100644 --- a/aviary/subsystems/mass/flops_based/fin.py +++ b/aviary/subsystems/mass/flops_based/fin.py @@ -18,12 +18,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) - add_aviary_input(self, Aircraft.Fins.AREA, val=0.0) - add_aviary_input(self, Aircraft.Fins.TAPER_RATIO, val=0.0) - add_aviary_input(self, Aircraft.Fins.MASS_SCALER, val=1.0) + add_aviary_input(self, Mission.Design.GROSS_MASS) + add_aviary_input(self, Aircraft.Fins.AREA) + add_aviary_input(self, Aircraft.Fins.TAPER_RATIO) + add_aviary_input(self, Aircraft.Fins.MASS_SCALER) - add_aviary_output(self, Aircraft.Fins.MASS, val=0.0) + add_aviary_output(self, Aircraft.Fins.MASS) def setup_partials(self): self.declare_partials("*", "*") diff --git a/aviary/subsystems/mass/flops_based/fuel_capacity.py b/aviary/subsystems/mass/flops_based/fuel_capacity.py index 98d50b2e9..dca9358ad 100644 --- a/aviary/subsystems/mass/flops_based/fuel_capacity.py +++ b/aviary/subsystems/mass/flops_based/fuel_capacity.py @@ -45,9 +45,9 @@ class FuselageFuelCapacity(om.ExplicitComponent): """ def setup(self): - add_aviary_input(self, Aircraft.Fuel.TOTAL_CAPACITY, 0.0), - add_aviary_input(self, Aircraft.Fuel.WING_FUEL_CAPACITY, 0.0), - add_aviary_output(self, Aircraft.Fuel.FUSELAGE_FUEL_CAPACITY, 0.0), + add_aviary_input(self, Aircraft.Fuel.TOTAL_CAPACITY), + add_aviary_input(self, Aircraft.Fuel.WING_FUEL_CAPACITY), + add_aviary_output(self, Aircraft.Fuel.FUSELAGE_FUEL_CAPACITY), def setup_partials(self): self.declare_partials( @@ -69,10 +69,10 @@ class AuxFuelCapacity(om.ExplicitComponent): """ def setup(self): - add_aviary_input(self, Aircraft.Fuel.TOTAL_CAPACITY, 0.0), - add_aviary_input(self, Aircraft.Fuel.WING_FUEL_CAPACITY, 0.0), - add_aviary_input(self, Aircraft.Fuel.FUSELAGE_FUEL_CAPACITY, 0.0), - add_aviary_output(self, Aircraft.Fuel.AUXILIARY_FUEL_CAPACITY, 0.0), + add_aviary_input(self, Aircraft.Fuel.TOTAL_CAPACITY), + add_aviary_input(self, Aircraft.Fuel.WING_FUEL_CAPACITY), + add_aviary_input(self, Aircraft.Fuel.FUSELAGE_FUEL_CAPACITY), + add_aviary_output(self, Aircraft.Fuel.AUXILIARY_FUEL_CAPACITY), def setup_partials(self): self.declare_partials( @@ -98,10 +98,10 @@ class TotalFuelCapacity(om.ExplicitComponent): """ def setup(self): - add_aviary_input(self, Aircraft.Fuel.WING_FUEL_CAPACITY, 0.0), - add_aviary_input(self, Aircraft.Fuel.FUSELAGE_FUEL_CAPACITY, 0.0), - add_aviary_input(self, Aircraft.Fuel.AUXILIARY_FUEL_CAPACITY, 0.0), - add_aviary_output(self, Aircraft.Fuel.TOTAL_CAPACITY, 0.0), + add_aviary_input(self, Aircraft.Fuel.WING_FUEL_CAPACITY), + add_aviary_input(self, Aircraft.Fuel.FUSELAGE_FUEL_CAPACITY), + add_aviary_input(self, Aircraft.Fuel.AUXILIARY_FUEL_CAPACITY), + add_aviary_output(self, Aircraft.Fuel.TOTAL_CAPACITY), def setup_partials(self): self.declare_partials( @@ -132,20 +132,20 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Fuel.DENSITY_RATIO, 1.0) - add_aviary_input(self, Aircraft.Fuel.WING_REF_CAPACITY, 0.0) - add_aviary_input(self, Aircraft.Fuel.WING_REF_CAPACITY_AREA, 0.0) - add_aviary_input(self, Aircraft.Fuel.WING_REF_CAPACITY_TERM_A, 0.0) - add_aviary_input(self, Aircraft.Fuel.WING_REF_CAPACITY_TERM_B, 0.0) + add_aviary_input(self, Aircraft.Fuel.DENSITY_RATIO) + add_aviary_input(self, Aircraft.Fuel.WING_REF_CAPACITY) + add_aviary_input(self, Aircraft.Fuel.WING_REF_CAPACITY_AREA) + add_aviary_input(self, Aircraft.Fuel.WING_REF_CAPACITY_TERM_A) + add_aviary_input(self, Aircraft.Fuel.WING_REF_CAPACITY_TERM_B) add_aviary_input(self, Aircraft.Fuel.CAPACITY_FACTOR, 23.0) - add_aviary_input(self, Aircraft.Wing.AREA, 0.0) - add_aviary_input(self, Aircraft.Wing.SPAN, 0.0) - add_aviary_input(self, Aircraft.Wing.TAPER_RATIO, 0.0) - add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD, 0.0) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.SPAN) + add_aviary_input(self, Aircraft.Wing.TAPER_RATIO) + add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD) - add_aviary_output(self, Aircraft.Fuel.WING_FUEL_CAPACITY, 0.0) + add_aviary_output(self, Aircraft.Fuel.WING_FUEL_CAPACITY) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/fuel_system.py b/aviary/subsystems/mass/flops_based/fuel_system.py index a78851fe2..6a3f5c978 100644 --- a/aviary/subsystems/mass/flops_based/fuel_system.py +++ b/aviary/subsystems/mass/flops_based/fuel_system.py @@ -21,11 +21,10 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Fuel.FUEL_SYSTEM_MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Fuel.FUEL_SYSTEM_MASS_SCALER) + add_aviary_input(self, Aircraft.Fuel.TOTAL_CAPACITY) - add_aviary_input(self, Aircraft.Fuel.TOTAL_CAPACITY, 0.0) - - add_aviary_output(self, Aircraft.Fuel.FUEL_SYSTEM_MASS, val=0.0) + add_aviary_output(self, Aircraft.Fuel.FUEL_SYSTEM_MASS) def setup_partials(self): self.declare_partials('*', '*') @@ -71,11 +70,10 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Fuel.TOTAL_CAPACITY, val=0.0) - - add_aviary_input(self, Aircraft.Fuel.FUEL_SYSTEM_MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Fuel.TOTAL_CAPACITY) + add_aviary_input(self, Aircraft.Fuel.FUEL_SYSTEM_MASS_SCALER) - add_aviary_output(self, Aircraft.Fuel.FUEL_SYSTEM_MASS, val=0.0) + add_aviary_output(self, Aircraft.Fuel.FUEL_SYSTEM_MASS) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/furnishings.py b/aviary/subsystems/mass/flops_based/furnishings.py index 3dfa8416b..b70b5af2d 100644 --- a/aviary/subsystems/mass/flops_based/furnishings.py +++ b/aviary/subsystems/mass/flops_based/furnishings.py @@ -19,15 +19,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Furnishings.MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Furnishings.MASS_SCALER) + add_aviary_input(self, Aircraft.Fuselage.PASSENGER_COMPARTMENT_LENGTH) + add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH) + add_aviary_input(self, Aircraft.Fuselage.MAX_HEIGHT) - add_aviary_input(self, Aircraft.Fuselage.PASSENGER_COMPARTMENT_LENGTH, val=0.0) - - add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, val=0.0) - - add_aviary_input(self, Aircraft.Fuselage.MAX_HEIGHT, val=0.0) - - add_aviary_output(self, Aircraft.Furnishings.MASS, val=0.0) + add_aviary_output(self, Aircraft.Furnishings.MASS) def setup_partials(self): self.declare_partials(of=Aircraft.Furnishings.MASS, wrt='*') @@ -114,19 +111,13 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Furnishings.MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Furnishings.MASS_SCALER) + add_aviary_input(self, Aircraft.BWB.CABIN_AREA) + add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH) + add_aviary_input(self, Aircraft.Fuselage.MAX_HEIGHT) + add_aviary_input(self, Aircraft.BWB.PASSENGER_LEADING_EDGE_SWEEP) - add_aviary_input(self, Aircraft.BWB.CABIN_AREA, val=100.0) - - add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, val=30.0) - - add_aviary_input(self, Aircraft.Fuselage.MAX_HEIGHT, val=15.0) - - add_aviary_input( - self, Aircraft.BWB.PASSENGER_LEADING_EDGE_SWEEP, val=45.0 - ) - - add_aviary_output(self, Aircraft.Furnishings.MASS, val=0.0) + add_aviary_output(self, Aircraft.Furnishings.MASS) def setup_partials(self): self.declare_partials(of=Aircraft.Furnishings.MASS, wrt='*') @@ -267,9 +258,9 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Furnishings.MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Furnishings.MASS_SCALER) - add_aviary_output(self, Aircraft.Furnishings.MASS_BASE, val=0.0) + add_aviary_output(self, Aircraft.Furnishings.MASS_BASE) def setup_partials(self): self.declare_partials(of=Aircraft.Furnishings.MASS_BASE, wrt='*') @@ -309,15 +300,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Furnishings.MASS_BASE, val=0.0) - - add_aviary_input(self, Aircraft.Design.STRUCTURE_MASS, val=0.0) - - add_aviary_input(self, Aircraft.Propulsion.MASS, val=0.0) - - add_aviary_input(self, Aircraft.Design.SYSTEMS_EQUIP_MASS_BASE, val=0.0) + add_aviary_input(self, Aircraft.Furnishings.MASS_BASE) + add_aviary_input(self, Aircraft.Design.STRUCTURE_MASS) + add_aviary_input(self, Aircraft.Propulsion.MASS) + add_aviary_input(self, Aircraft.Design.SYSTEMS_EQUIP_MASS_BASE) - add_aviary_output(self, Aircraft.Furnishings.MASS, val=0.0) + add_aviary_output(self, Aircraft.Furnishings.MASS) def setup_partials(self): self.declare_partials( diff --git a/aviary/subsystems/mass/flops_based/fuselage.py b/aviary/subsystems/mass/flops_based/fuselage.py index 6b349ec20..61d6b5216 100644 --- a/aviary/subsystems/mass/flops_based/fuselage.py +++ b/aviary/subsystems/mass/flops_based/fuselage.py @@ -21,13 +21,11 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Fuselage.LENGTH, val=0.0) + add_aviary_input(self, Aircraft.Fuselage.LENGTH) + add_aviary_input(self, Aircraft.Fuselage.MASS_SCALER) + add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER) - add_aviary_input(self, Aircraft.Fuselage.MASS_SCALER, val=1.0) - - add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER, val=0.0) - - add_aviary_output(self, Aircraft.Fuselage.MASS, val=0.0) + add_aviary_output(self, Aircraft.Fuselage.MASS) def setup_partials(self): self.declare_partials(Aircraft.Fuselage.MASS, "*") diff --git a/aviary/subsystems/mass/flops_based/horizontal_tail.py b/aviary/subsystems/mass/flops_based/horizontal_tail.py index 3c182a5b2..9c0a2595a 100644 --- a/aviary/subsystems/mass/flops_based/horizontal_tail.py +++ b/aviary/subsystems/mass/flops_based/horizontal_tail.py @@ -18,15 +18,14 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.HorizontalTail.AREA, val=0.0) + add_aviary_input(self, Aircraft.HorizontalTail.AREA) - add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO, val=0.352) + add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO) - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) + add_aviary_input(self, Mission.Design.GROSS_MASS) + add_aviary_input(self, Aircraft.HorizontalTail.MASS_SCALER) - add_aviary_input(self, Aircraft.HorizontalTail.MASS_SCALER, val=1.0) - - add_aviary_output(self, Aircraft.HorizontalTail.MASS, val=0.0) + add_aviary_output(self, Aircraft.HorizontalTail.MASS) def setup_partials(self): self.declare_partials("*", "*") @@ -76,11 +75,10 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.HorizontalTail.AREA, val=0.0) - - add_aviary_input(self, Aircraft.HorizontalTail.MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.HorizontalTail.AREA) + add_aviary_input(self, Aircraft.HorizontalTail.MASS_SCALER) - add_aviary_output(self, Aircraft.HorizontalTail.MASS, val=0.0) + add_aviary_output(self, Aircraft.HorizontalTail.MASS) def setup_partials(self): self.declare_partials("*", "*") diff --git a/aviary/subsystems/mass/flops_based/hydraulics.py b/aviary/subsystems/mass/flops_based/hydraulics.py index aed93313f..ff1527e3d 100644 --- a/aviary/subsystems/mass/flops_based/hydraulics.py +++ b/aviary/subsystems/mass/flops_based/hydraulics.py @@ -28,17 +28,15 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Fuselage.PLANFORM_AREA, val=0.0) + add_aviary_input(self, Aircraft.Fuselage.PLANFORM_AREA) - add_aviary_input(self, Aircraft.Hydraulics.SYSTEM_PRESSURE, val=0.0) + add_aviary_input(self, Aircraft.Hydraulics.SYSTEM_PRESSURE) - add_aviary_input(self, Aircraft.Hydraulics.MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Hydraulics.MASS_SCALER) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.VAR_SWEEP_MASS_PENALTY) - add_aviary_input(self, Aircraft.Wing.AREA, val=0.0) - - add_aviary_input(self, Aircraft.Wing.VAR_SWEEP_MASS_PENALTY, val=0.0) - - add_aviary_output(self, Aircraft.Hydraulics.MASS, val=0.0) + add_aviary_output(self, Aircraft.Hydraulics.MASS) def setup_partials(self): self.declare_partials('*', '*') @@ -117,17 +115,13 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Wing.AREA, val=0.0) - - add_aviary_input(self, Aircraft.HorizontalTail.WETTED_AREA, val=0.0) - - add_aviary_input(self, Aircraft.HorizontalTail.THICKNESS_TO_CHORD, val=0.0) - - add_aviary_input(self, Aircraft.VerticalTail.AREA, val=0.0) - - add_aviary_input(self, Aircraft.Hydraulics.MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.HorizontalTail.WETTED_AREA) + add_aviary_input(self, Aircraft.HorizontalTail.THICKNESS_TO_CHORD) + add_aviary_input(self, Aircraft.VerticalTail.AREA) + add_aviary_input(self, Aircraft.Hydraulics.MASS_SCALER) - add_aviary_output(self, Aircraft.Hydraulics.MASS, val=0.0) + add_aviary_output(self, Aircraft.Hydraulics.MASS) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/instruments.py b/aviary/subsystems/mass/flops_based/instruments.py index 3b0c50f84..db0efd247 100644 --- a/aviary/subsystems/mass/flops_based/instruments.py +++ b/aviary/subsystems/mass/flops_based/instruments.py @@ -23,8 +23,8 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Fuselage.PLANFORM_AREA, 0.0) - add_aviary_input(self, Aircraft.Instruments.MASS_SCALER, 1.0) + add_aviary_input(self, Aircraft.Fuselage.PLANFORM_AREA) + add_aviary_input(self, Aircraft.Instruments.MASS_SCALER) add_aviary_output(self, Aircraft.Instruments.MASS, 0.0) diff --git a/aviary/subsystems/mass/flops_based/landing_gear.py b/aviary/subsystems/mass/flops_based/landing_gear.py index db87a4aee..e5adedee2 100644 --- a/aviary/subsystems/mass/flops_based/landing_gear.py +++ b/aviary/subsystems/mass/flops_based/landing_gear.py @@ -25,19 +25,14 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, val=0.0) - - add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER, val=1.0) - - add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, val=0.0) - - add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH) + add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER) + add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH) + add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER) + add_aviary_input(self, Aircraft.Design.TOUCHDOWN_MASS) - add_aviary_input(self, Aircraft.Design.TOUCHDOWN_MASS, val=0.0) - - add_aviary_output(self, Aircraft.LandingGear.MAIN_GEAR_MASS, val=0.0) - - add_aviary_output(self, Aircraft.LandingGear.NOSE_GEAR_MASS, val=0.0) + add_aviary_output(self, Aircraft.LandingGear.MAIN_GEAR_MASS) + add_aviary_output(self, Aircraft.LandingGear.NOSE_GEAR_MASS) # TODO landing weight is not a landing_gear component level variable # self.add_input('aircraft:landing_gear:weights:landing_weight', val=0.0, desc='design landing weight', units='lbf') @@ -142,19 +137,14 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, val=0.0) - - add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER, val=1.0) - - add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, val=0.0) - - add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER, val=1.0) - - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) - - add_aviary_output(self, Aircraft.LandingGear.MAIN_GEAR_MASS, val=0.0) - - add_aviary_output(self, Aircraft.LandingGear.NOSE_GEAR_MASS, val=0.0) + add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH) + add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER) + add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH) + add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER) + add_aviary_input(self, Mission.Design.GROSS_MASS) + + add_aviary_output(self, Aircraft.LandingGear.MAIN_GEAR_MASS) + add_aviary_output(self, Aircraft.LandingGear.NOSE_GEAR_MASS) def setup_partials(self): self.declare_partials(Aircraft.LandingGear.MAIN_GEAR_MASS, [ From d3de229f68c8eca0af51b0d18503f5365e7d8cb8 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 20 Dec 2024 15:54:21 -0800 Subject: [PATCH 10/89] update add_aviary_input and add_aviary_output functions. --- aviary/variable_info/functions.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/aviary/variable_info/functions.py b/aviary/variable_info/functions.py index 9f96833ff..a214a2e13 100644 --- a/aviary/variable_info/functions.py +++ b/aviary/variable_info/functions.py @@ -34,17 +34,21 @@ def add_aviary_input(comp, varname, val=None, units=None, desc=None, shape_by_co else: input_desc = meta['desc'] if val is None: - val = meta['default_value'] - if val is None: - if shape is None: + if shape is None: + val = meta['default_value'] + if val is None: val = 0.0 - else: + else: + val = meta['default_value'] + if val is None: val = np.zeros(shape) + else: + val = np.ones(shape) * val comp.add_input(varname, val=val, units=input_units, desc=input_desc, shape_by_conn=shape_by_conn, shape=shape) -def add_aviary_output(comp, varname, val, units=None, desc=None, shape_by_conn=False, meta_data=_MetaData): +def add_aviary_output(comp, varname, val=None, units=None, desc=None, shape_by_conn=False, meta_data=_MetaData, shape=None): ''' This function provides a clean way to add variables from the variable hierarchy into components as Aviary outputs. It takes @@ -65,9 +69,16 @@ def add_aviary_output(comp, varname, val, units=None, desc=None, shape_by_conn=F else: output_desc = meta['desc'] if val is None: - val = meta['default_value'] - if val is None: - val = 0.0 + if shape is None: + val = meta['default_value'] + if val is None: + val = 0.0 + else: + val = meta['default_value'] + if val is None: + val = np.zeros(shape) + else: + val = np.ones(shape) * val comp.add_output(varname, val=val, units=output_units, desc=output_desc, shape_by_conn=shape_by_conn) From 670b545427cac07f7d2202cb158cec9609d3fda9 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 20 Dec 2024 15:54:46 -0800 Subject: [PATCH 11/89] update variable_meta_data.py --- aviary/variable_info/variable_meta_data.py | 126 +++++++++++++-------- 1 file changed, 77 insertions(+), 49 deletions(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index ea20de153..37be4b91d 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -70,7 +70,7 @@ }, units='lbm', desc='air conditioning system mass', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -122,7 +122,7 @@ }, units='lbm', desc='mass of anti-icing system (auxiliary gear)', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -163,7 +163,7 @@ }, units='lbm', desc='mass of auxiliary power unit', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -204,7 +204,7 @@ }, units='lbm', desc='avionics mass', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -493,7 +493,7 @@ }, units='lbm', desc='mass of canards', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -519,7 +519,7 @@ }, units='unitless', desc='canard theoretical taper ratio', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -645,6 +645,7 @@ }, units='lbm', desc='mass of passenger baggage', + default_value=0.0, # added ) add_meta_data( @@ -677,7 +678,7 @@ }, units='lbm', desc='mass of cargo containers', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -708,6 +709,7 @@ }, units='lbm', desc='total mass of cargo', + default_value=0.0, # added ) add_meta_data( @@ -799,7 +801,7 @@ }, units='lbm', desc='total mass of the flight crew and their baggage', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -859,7 +861,7 @@ }, units='lbm', desc='total mass of the non-flight crew and their baggage', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -1006,6 +1008,7 @@ }, units='lbm', desc='TBD: total mass of all passengers without their baggage', + default_value=0.0, # added ) add_meta_data( @@ -1029,6 +1032,7 @@ }, units='lbm', desc='mass of passenger payload, including passengers, passenger baggage', + default_value=0.0, # added ) add_meta_data( @@ -1047,7 +1051,7 @@ }, units='lbm', desc='mass of passenger service equipment', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -1241,7 +1245,7 @@ }, units='lbm', desc='empty mass margin', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -1256,7 +1260,7 @@ }, units='unitless', desc='empty mass margin scaler', - default_value=0.0, + default_value=0.0, # Note: not 1.0 here ) add_meta_data( @@ -1269,6 +1273,7 @@ meta_data=_MetaData, units='lbm', desc='total mass of all user-defined external subsystems', + default_value=0.0, # added ) add_meta_data( @@ -1347,7 +1352,7 @@ }, units='unitless', desc='ratio of maximum landing mass to maximum takeoff mass', - default_value=0.9, + default_value=0.0, ) add_meta_data( @@ -1413,6 +1418,7 @@ }, units='lbm', desc='operating mass empty of the aircraft', + default_value=0.0, # added ) add_meta_data( @@ -1489,6 +1495,7 @@ }, units='lbm', desc='Total structural group mass', + default_value=0.0, # added ) add_meta_data( @@ -1539,6 +1546,7 @@ }, units='lbm', desc='Total systems & equipment group mass', + default_value=0.0, # added ) add_meta_data( @@ -1550,6 +1558,7 @@ historical_name={"GASP": None, "FLOPS": None, "LEAPS1": None}, units='lbm', desc='Total systems & equipment group mass without additional 1% of ' 'empty mass', + default_value=0.0, # added ) add_meta_data( @@ -1574,6 +1583,7 @@ }, units='ft**2', desc='total aircraft wetted area', + default_value=0.0, # added ) add_meta_data( @@ -1595,7 +1605,7 @@ }, units='lbm', desc='design landing mass', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -1656,6 +1666,7 @@ }, units='lbm', desc='zero fuel mass', + default_value=0.0, # added ) add_meta_data( @@ -1715,7 +1726,7 @@ }, units='lbm', desc='mass of the electrical system', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -2558,7 +2569,7 @@ }, units='lbm', desc='mass of vertical fins', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -2599,7 +2610,7 @@ }, units='unitless', desc='vertical fin theoretical taper ratio', - default_value=None, + default_value=0.0, # changed from None ) # ______ _ @@ -2620,7 +2631,7 @@ }, units='lbm', desc='fuel capacity of the auxiliary tank', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -2641,7 +2652,7 @@ }, units='unitless', desc='fuel capacity factor', - default_value=23.0, + default_value=1.0, # changed from 23.0 ) add_meta_data( @@ -2695,7 +2706,7 @@ }, units='lbm', desc='fuel system mass', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -2734,7 +2745,7 @@ }, units='lbm', desc='fuel capacity of the fuselage', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -2767,7 +2778,7 @@ desc='Total fuel capacity of the aircraft including wing, fuselage and ' 'auxiliary tanks. Used in generating payload-range diagram (Default = ' 'wing_capacity + fuselage_capacity + aux_capacity)', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -2785,6 +2796,7 @@ }, units='galUS', # need to check this desc='Total fuel volume', + default_value=0.0, # added ) add_meta_data( @@ -2803,7 +2815,7 @@ }, units='lbm', desc='unusable fuel mass', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -2839,7 +2851,7 @@ }, units='lbm', desc='fuel capacity of the auxiliary tank', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -2968,7 +2980,7 @@ }, units='lbm', desc='Total furnishings system mass', - default_value=None, + default_value=0.0, # changed form None ) add_meta_data( @@ -2977,6 +2989,7 @@ historical_name={"GASP": None, "FLOPS": None, "LEAPS1": None}, units='lbm', desc='Base furnishings system mass without additional 1% empty mass', + default_value=0.0, # added ) add_meta_data( @@ -3025,6 +3038,7 @@ }, units='ft', desc='average fuselage diameter', + default_value=0.0, # added ) add_meta_data( @@ -3187,7 +3201,7 @@ }, units='lbm', desc='mass of the fuselage structure', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -3222,6 +3236,7 @@ }, units='ft', desc='maximum fuselage height', + default_value=0.0, # added ) add_meta_data( @@ -3351,6 +3366,7 @@ }, units='ft**2', desc='fuselage planform area', + default_value=0.0, # added ) add_meta_data( @@ -3408,7 +3424,7 @@ }, units='ft**2', desc='fuselage wetted area', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -3551,7 +3567,7 @@ }, units='lbm', desc='mass of horizontal tail', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -3691,7 +3707,7 @@ }, units='ft**2', desc='horizontal tail wetted area', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -3751,7 +3767,7 @@ }, units='lbm', desc='mass of hydraulic system', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -3806,7 +3822,7 @@ }, units='lbm', desc='instrument group mass', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -3907,6 +3923,7 @@ }, units='lbm', desc='mass of main landing gear', + default_value=0, # added ) add_meta_data( @@ -3968,7 +3985,7 @@ }, units='lbm', desc='mass of nose landing gear', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -4046,6 +4063,7 @@ }, units='ft', desc='Average diameter of engine nacelles for each engine model', + default_value=0.0, # added ) add_meta_data( @@ -4060,6 +4078,7 @@ }, units='ft', desc='Average length of nacelles for each engine model', + default_value=0.0, # added ) add_meta_data( @@ -4161,7 +4180,7 @@ }, units='lbm', desc='estimated mass of the nacelles for each engine model', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -4256,6 +4275,7 @@ }, units='lbm', desc='mass of paint for all wetted area', + default_value=0.0, # added ) add_meta_data( @@ -4310,6 +4330,7 @@ }, units='lbm', desc='Total propulsion group mass', + default_value=0.0, # added ) # TODO clash with per-engine scaling, need to resolve w/ heterogeneous engine @@ -4334,6 +4355,7 @@ historical_name={"GASP": None, "FLOPS": None, "LEAPS1": None}, units='lbm', desc='total estimated mass of the engine controls for all engines on aircraft', + default_value=0.0, # added ) add_meta_data( @@ -4342,6 +4364,7 @@ historical_name={"GASP": 'INGASP.WEP', "FLOPS": None, "LEAPS1": None}, units='lbm', desc='total mass of all engines on aircraft', + default_value=0.0, # added ) add_meta_data( @@ -4360,7 +4383,7 @@ }, units='lbm', desc='engine oil mass', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -4380,7 +4403,7 @@ units='lbm', desc='sum of engine control, starter, and additional mass for all engines ' 'on aircraft', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -4452,7 +4475,7 @@ historical_name={"GASP": None, "FLOPS": None, "LEAPS1": None}, units='lbm', desc='total mass of thrust reversers for all engines on aircraft', - default_value=None, + default_value=0.0, # changed from None ) # _____ _ _ @@ -4716,7 +4739,7 @@ }, units='lbm', desc='mass of vertical tail', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -4813,7 +4836,7 @@ }, units='unitless', desc='vertical tail theoretical taper ratio', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -4984,6 +5007,7 @@ }, units='unitless', desc='Reference aspect ratio, used for detailed wing bending.', + default_value=0.0, # added ) add_meta_data( @@ -5004,6 +5028,7 @@ }, units='unitless', desc='wing bending factor', + default_value=0.0, # added ) add_meta_data( @@ -5018,7 +5043,7 @@ }, units='lbm', desc='wing mass breakdown term 1', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -5046,7 +5071,7 @@ }, units='lbm', desc='wing mass breakdown term 4', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -5118,7 +5143,7 @@ units='unitless', desc='chord lengths as fractions of semispan at station locations; ' 'overwrites station_chord_lengths', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -5153,6 +5178,7 @@ }, units='ft**2', desc='area of wing control surfaces', + default_value=0.0, # added ) add_meta_data( @@ -5167,7 +5193,7 @@ units='unitless', desc='Defines the ratio of total moveable wing control surface areas ' '(flaps, elevators, spoilers, etc.) to reference wing area.', - default_value=0.333, + default_value=0.0, # changed from 0.333 ) add_meta_data( @@ -5208,6 +5234,7 @@ }, units='unitless', desc='engine inertia relief factor', + default_value=0.0, # added ) add_meta_data( @@ -5523,7 +5550,7 @@ desc='Define the sweep of load path at station locations. Typically ' 'parallel to rear spar tending toward max t/c of airfoil. The Ith value ' 'is used between wing stations I and I+1.', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -5565,7 +5592,7 @@ }, units='lbm', desc='wing total mass', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -5674,7 +5701,7 @@ }, units='lbm', desc='wing mass breakdown term 3', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -5766,7 +5793,7 @@ }, units='lbm', desc='wing mass breakdown term 2', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -5893,7 +5920,7 @@ }, units='lbm', desc='mass of surface controls', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -6005,7 +6032,7 @@ }, units='unitless', desc='the thickeness-chord ratios at station locations', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -6703,6 +6730,7 @@ units='lbm', desc='fuel carried by the aircraft when it is on the ramp at the ' 'beginning of the design mission', + default_value=0.0, # added ) add_meta_data( @@ -6733,7 +6761,7 @@ }, units='lbm', desc='design gross mass of the aircraft', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( From a8b5456d0e07988e5ba3ca06c24273897cb9ce80 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 20 Dec 2024 15:56:58 -0800 Subject: [PATCH 12/89] work in progress. --- aviary/subsystems/mass/flops_based/cargo.py | 3 +- .../mass/flops_based/fuel_capacity.py | 4 +- .../mass/flops_based/furnishings.py | 2 + .../mass/flops_based/horizontal_tail.py | 4 +- .../subsystems/mass/flops_based/hydraulics.py | 2 - .../mass/flops_based/landing_gear.py | 18 +-- .../mass/flops_based/landing_mass.py | 14 +- .../mass/flops_based/mass_summation.py | 143 +++++++++--------- .../mass/flops_based/misc_engine.py | 12 +- aviary/subsystems/mass/flops_based/nacelle.py | 17 +-- aviary/subsystems/mass/flops_based/paint.py | 7 +- .../mass/flops_based/passenger_service.py | 19 +-- aviary/subsystems/mass/flops_based/starter.py | 5 +- .../mass/flops_based/surface_controls.py | 10 +- .../mass/flops_based/test/test_furnishings.py | 17 ++- .../mass/flops_based/test/test_wing_common.py | 1 + .../mass/flops_based/thrust_reverser.py | 8 +- .../mass/flops_based/unusable_fuel.py | 21 +-- .../mass/flops_based/vertical_tail.py | 9 +- .../mass/flops_based/wing_common.py | 73 ++++----- .../mass/flops_based/wing_detailed.py | 40 ++--- .../mass/flops_based/wing_simple.py | 30 ++-- 22 files changed, 202 insertions(+), 257 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/cargo.py b/aviary/subsystems/mass/flops_based/cargo.py index ad047f6e7..6d0e4738c 100644 --- a/aviary/subsystems/mass/flops_based/cargo.py +++ b/aviary/subsystems/mass/flops_based/cargo.py @@ -7,7 +7,7 @@ from aviary.utils.aviary_values import AviaryValues from aviary.variable_info.functions import add_aviary_input, add_aviary_output -from aviary.variable_info.variables import Aircraft, Mission +from aviary.variable_info.variables import Aircraft class CargoMass(om.ExplicitComponent): @@ -24,7 +24,6 @@ def initialize(self): def setup(self): add_aviary_input(self, Aircraft.CrewPayload.WING_CARGO) add_aviary_input(self, Aircraft.CrewPayload.MISC_CARGO) - add_aviary_output(self, Aircraft.CrewPayload.PASSENGER_MASS) add_aviary_output(self, Aircraft.CrewPayload.BAGGAGE_MASS) add_aviary_output(self, Aircraft.CrewPayload.PASSENGER_PAYLOAD_MASS) diff --git a/aviary/subsystems/mass/flops_based/fuel_capacity.py b/aviary/subsystems/mass/flops_based/fuel_capacity.py index dca9358ad..02db66343 100644 --- a/aviary/subsystems/mass/flops_based/fuel_capacity.py +++ b/aviary/subsystems/mass/flops_based/fuel_capacity.py @@ -137,9 +137,7 @@ def setup(self): add_aviary_input(self, Aircraft.Fuel.WING_REF_CAPACITY_AREA) add_aviary_input(self, Aircraft.Fuel.WING_REF_CAPACITY_TERM_A) add_aviary_input(self, Aircraft.Fuel.WING_REF_CAPACITY_TERM_B) - - add_aviary_input(self, Aircraft.Fuel.CAPACITY_FACTOR, 23.0) - + add_aviary_input(self, Aircraft.Fuel.CAPACITY_FACTOR) add_aviary_input(self, Aircraft.Wing.AREA) add_aviary_input(self, Aircraft.Wing.SPAN) add_aviary_input(self, Aircraft.Wing.TAPER_RATIO) diff --git a/aviary/subsystems/mass/flops_based/furnishings.py b/aviary/subsystems/mass/flops_based/furnishings.py index b70b5af2d..5bc5d22b2 100644 --- a/aviary/subsystems/mass/flops_based/furnishings.py +++ b/aviary/subsystems/mass/flops_based/furnishings.py @@ -113,7 +113,9 @@ def initialize(self): def setup(self): add_aviary_input(self, Aircraft.Furnishings.MASS_SCALER) add_aviary_input(self, Aircraft.BWB.CABIN_AREA) + add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH) + add_aviary_input(self, Aircraft.Fuselage.MAX_HEIGHT) add_aviary_input(self, Aircraft.BWB.PASSENGER_LEADING_EDGE_SWEEP) diff --git a/aviary/subsystems/mass/flops_based/horizontal_tail.py b/aviary/subsystems/mass/flops_based/horizontal_tail.py index 9c0a2595a..9665aac32 100644 --- a/aviary/subsystems/mass/flops_based/horizontal_tail.py +++ b/aviary/subsystems/mass/flops_based/horizontal_tail.py @@ -19,9 +19,7 @@ def initialize(self): def setup(self): add_aviary_input(self, Aircraft.HorizontalTail.AREA) - - add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO) - + add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO, val=0.352) add_aviary_input(self, Mission.Design.GROSS_MASS) add_aviary_input(self, Aircraft.HorizontalTail.MASS_SCALER) diff --git a/aviary/subsystems/mass/flops_based/hydraulics.py b/aviary/subsystems/mass/flops_based/hydraulics.py index ff1527e3d..60b699237 100644 --- a/aviary/subsystems/mass/flops_based/hydraulics.py +++ b/aviary/subsystems/mass/flops_based/hydraulics.py @@ -29,9 +29,7 @@ def initialize(self): def setup(self): add_aviary_input(self, Aircraft.Fuselage.PLANFORM_AREA) - add_aviary_input(self, Aircraft.Hydraulics.SYSTEM_PRESSURE) - add_aviary_input(self, Aircraft.Hydraulics.MASS_SCALER) add_aviary_input(self, Aircraft.Wing.AREA) add_aviary_input(self, Aircraft.Wing.VAR_SWEEP_MASS_PENALTY) diff --git a/aviary/subsystems/mass/flops_based/landing_gear.py b/aviary/subsystems/mass/flops_based/landing_gear.py index e5adedee2..0f1313b12 100644 --- a/aviary/subsystems/mass/flops_based/landing_gear.py +++ b/aviary/subsystems/mass/flops_based/landing_gear.py @@ -251,8 +251,8 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, val=0.0) - add_aviary_output(self, Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, val=0.0) + add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH) + add_aviary_output(self, Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH) def setup_partials(self): self.declare_partials(Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, @@ -280,16 +280,16 @@ def setup(self): num_wing_engines = self.options['aviary_options'].get_val( Aircraft.Engine.NUM_WING_ENGINES) - add_aviary_input(self, Aircraft.Fuselage.LENGTH, val=0.0) - add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, val=0.0) - add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, - val=np.zeros(num_engine_type)) + add_aviary_input(self, Aircraft.Fuselage.LENGTH) + add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH) + add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, shape=num_engine_type) + # XJ: shape=(num_engine_type, int(num_wing_engines[0]/2)) add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, val=np.zeros((num_engine_type, int(num_wing_engines[0]/2)))) - add_aviary_input(self, Aircraft.Wing.DIHEDRAL, val=0.0) - add_aviary_input(self, Aircraft.Wing.SPAN, val=0.0) + add_aviary_input(self, Aircraft.Wing.DIHEDRAL) + add_aviary_input(self, Aircraft.Wing.SPAN) - add_aviary_output(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, val=0.0) + add_aviary_output(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/landing_mass.py b/aviary/subsystems/mass/flops_based/landing_mass.py index c34686fbe..d24324a79 100644 --- a/aviary/subsystems/mass/flops_based/landing_mass.py +++ b/aviary/subsystems/mass/flops_based/landing_mass.py @@ -17,11 +17,10 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Mission.Summary.CRUISE_MACH, val=0.0) + add_aviary_input(self, Mission.Summary.CRUISE_MACH) + add_aviary_input(self, Mission.Design.RANGE) - add_aviary_input(self, Mission.Design.RANGE, val=0.0) - - add_aviary_output(self, Aircraft.Design.LANDING_TO_TAKEOFF_MASS_RATIO, val=0.0) + add_aviary_output(self, Aircraft.Design.LANDING_TO_TAKEOFF_MASS_RATIO) def setup_partials(self): self.declare_partials('*', '*') @@ -64,11 +63,10 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) - - add_aviary_input(self, Aircraft.Design.LANDING_TO_TAKEOFF_MASS_RATIO, val=0.0) + add_aviary_input(self, Mission.Design.GROSS_MASS) + add_aviary_input(self, Aircraft.Design.LANDING_TO_TAKEOFF_MASS_RATIO) - add_aviary_output(self, Aircraft.Design.TOUCHDOWN_MASS, val=0.0) + add_aviary_output(self, Aircraft.Design.TOUCHDOWN_MASS) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/mass_summation.py b/aviary/subsystems/mass/flops_based/mass_summation.py index d1294985e..0fdab13c3 100644 --- a/aviary/subsystems/mass/flops_based/mass_summation.py +++ b/aviary/subsystems/mass/flops_based/mass_summation.py @@ -87,18 +87,18 @@ def setup(self): num_engine_type = len(self.options['aviary_options'].get_val( Aircraft.Engine.NUM_ENGINES)) - add_aviary_input(self, Aircraft.Canard.MASS, val=0.0) - add_aviary_input(self, Aircraft.Fins.MASS, val=0.0) - add_aviary_input(self, Aircraft.Fuselage.MASS, val=0.0) - add_aviary_input(self, Aircraft.HorizontalTail.MASS, val=0.0) - add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_MASS, val=0.0) - add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_MASS, val=0.0) - add_aviary_input(self, Aircraft.Nacelle.MASS, val=np.zeros(num_engine_type)) - add_aviary_input(self, Aircraft.Paint.MASS, val=0.0) - add_aviary_input(self, Aircraft.VerticalTail.MASS, val=0.0) - add_aviary_input(self, Aircraft.Wing.MASS, val=0.0) - - add_aviary_output(self, Aircraft.Design.STRUCTURE_MASS, val=0.0) + add_aviary_input(self, Aircraft.Canard.MASS) + add_aviary_input(self, Aircraft.Fins.MASS) + add_aviary_input(self, Aircraft.Fuselage.MASS) + add_aviary_input(self, Aircraft.HorizontalTail.MASS) + add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_MASS) + add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_MASS) + add_aviary_input(self, Aircraft.Nacelle.MASS, shape=num_engine_type) + add_aviary_input(self, Aircraft.Paint.MASS) + add_aviary_input(self, Aircraft.VerticalTail.MASS) + add_aviary_input(self, Aircraft.Wing.MASS) + + add_aviary_output(self, Aircraft.Design.STRUCTURE_MASS) def setup_partials(self): num_engine_type = len(self.options['aviary_options'].get_val( @@ -133,13 +133,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Fuel.FUEL_SYSTEM_MASS, val=0.0) - add_aviary_input(self, Aircraft.Propulsion.TOTAL_MISC_MASS, val=0.0) - add_aviary_input( - self, Aircraft.Propulsion.TOTAL_THRUST_REVERSERS_MASS, val=0.0) - add_aviary_input(self, Aircraft.Propulsion.TOTAL_ENGINE_MASS, val=0.0) + add_aviary_input(self, Aircraft.Fuel.FUEL_SYSTEM_MASS) + add_aviary_input(self, Aircraft.Propulsion.TOTAL_MISC_MASS) + add_aviary_input(self, Aircraft.Propulsion.TOTAL_THRUST_REVERSERS_MASS) + add_aviary_input(self, Aircraft.Propulsion.TOTAL_ENGINE_MASS) - add_aviary_output(self, Aircraft.Propulsion.MASS, val=0.0) + add_aviary_output(self, Aircraft.Propulsion.MASS) def setup_partials(self): prop_wrt = [ @@ -168,18 +167,18 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.AirConditioning.MASS, val=0.0) - add_aviary_input(self, Aircraft.AntiIcing.MASS, val=0.0) - add_aviary_input(self, Aircraft.APU.MASS, val=0.0) - add_aviary_input(self, Aircraft.Avionics.MASS, val=0.0) - add_aviary_input(self, Aircraft.Electrical.MASS, val=0.0) - add_aviary_input(self, Aircraft.Furnishings.MASS, val=0.0) - add_aviary_input(self, Aircraft.Hydraulics.MASS, val=0.0) - add_aviary_input(self, Aircraft.Instruments.MASS, val=0.0) - add_aviary_input(self, Aircraft.Wing.SURFACE_CONTROL_MASS, val=0.0) - add_aviary_input(self, Aircraft.Design.EXTERNAL_SUBSYSTEMS_MASS, val=0.0) - - add_aviary_output(self, Aircraft.Design.SYSTEMS_EQUIP_MASS, val=0.0) + add_aviary_input(self, Aircraft.AirConditioning.MASS) + add_aviary_input(self, Aircraft.AntiIcing.MASS) + add_aviary_input(self, Aircraft.APU.MASS) + add_aviary_input(self, Aircraft.Avionics.MASS) + add_aviary_input(self, Aircraft.Electrical.MASS) + add_aviary_input(self, Aircraft.Furnishings.MASS) + add_aviary_input(self, Aircraft.Hydraulics.MASS) + add_aviary_input(self, Aircraft.Instruments.MASS) + add_aviary_input(self, Aircraft.Wing.SURFACE_CONTROL_MASS) + add_aviary_input(self, Aircraft.Design.EXTERNAL_SUBSYSTEMS_MASS) + + add_aviary_output(self, Aircraft.Design.SYSTEMS_EQUIP_MASS) def setup_partials(self): self.declare_partials(Aircraft.Design.SYSTEMS_EQUIP_MASS, '*', val=1) @@ -210,18 +209,18 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.AirConditioning.MASS, val=0.0) - add_aviary_input(self, Aircraft.AntiIcing.MASS, val=0.0) - add_aviary_input(self, Aircraft.APU.MASS, val=0.0) - add_aviary_input(self, Aircraft.Avionics.MASS, val=0.0) - add_aviary_input(self, Aircraft.Electrical.MASS, val=0.0) - add_aviary_input(self, Aircraft.Furnishings.MASS_BASE, val=0.0) - add_aviary_input(self, Aircraft.Hydraulics.MASS, val=0.0) - add_aviary_input(self, Aircraft.Instruments.MASS, val=0.0) - add_aviary_input(self, Aircraft.Wing.SURFACE_CONTROL_MASS, val=0.0) - add_aviary_input(self, Aircraft.Design.EXTERNAL_SUBSYSTEMS_MASS, val=0.0) - - add_aviary_output(self, Aircraft.Design.SYSTEMS_EQUIP_MASS_BASE, val=0.0) + add_aviary_input(self, Aircraft.AirConditioning.MASS) + add_aviary_input(self, Aircraft.AntiIcing.MASS) + add_aviary_input(self, Aircraft.APU.MASS) + add_aviary_input(self, Aircraft.Avionics.MASS) + add_aviary_input(self, Aircraft.Electrical.MASS) + add_aviary_input(self, Aircraft.Furnishings.MASS_BASE) + add_aviary_input(self, Aircraft.Hydraulics.MASS) + add_aviary_input(self, Aircraft.Instruments.MASS) + add_aviary_input(self, Aircraft.Wing.SURFACE_CONTROL_MASS) + add_aviary_input(self, Aircraft.Design.EXTERNAL_SUBSYSTEMS_MASS) + + add_aviary_output(self, Aircraft.Design.SYSTEMS_EQUIP_MASS_BASE) def setup_partials(self): self.declare_partials(Aircraft.Design.SYSTEMS_EQUIP_MASS_BASE, '*', val=1) @@ -252,11 +251,11 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Design.SYSTEMS_EQUIP_MASS_BASE, val=0.0) - add_aviary_input(self, Aircraft.Design.STRUCTURE_MASS, val=0.0) - add_aviary_input(self, Aircraft.Propulsion.MASS, val=0.0) + add_aviary_input(self, Aircraft.Design.SYSTEMS_EQUIP_MASS_BASE) + add_aviary_input(self, Aircraft.Design.STRUCTURE_MASS) + add_aviary_input(self, Aircraft.Propulsion.MASS) - add_aviary_output(self, Aircraft.Design.SYSTEMS_EQUIP_MASS, val=0.0) + add_aviary_output(self, Aircraft.Design.SYSTEMS_EQUIP_MASS) def setup_partials(self): self.declare_partials( @@ -289,12 +288,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Design.EMPTY_MASS_MARGIN, val=0.0) - add_aviary_input(self, Aircraft.Design.STRUCTURE_MASS, val=0.0) - add_aviary_input(self, Aircraft.Propulsion.MASS, val=0.0) - add_aviary_input(self, Aircraft.Design.SYSTEMS_EQUIP_MASS, val=0.0) + add_aviary_input(self, Aircraft.Design.EMPTY_MASS_MARGIN) + add_aviary_input(self, Aircraft.Design.STRUCTURE_MASS) + add_aviary_input(self, Aircraft.Propulsion.MASS) + add_aviary_input(self, Aircraft.Design.SYSTEMS_EQUIP_MASS) - add_aviary_output(self, Aircraft.Design.EMPTY_MASS, val=0.0) + add_aviary_output(self, Aircraft.Design.EMPTY_MASS) def setup_partials(self): self.declare_partials(Aircraft.Design.EMPTY_MASS, '*', val=1) @@ -317,12 +316,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Design.EMPTY_MASS_MARGIN, val=0.0) - add_aviary_input(self, Aircraft.Design.STRUCTURE_MASS, val=0.0) - add_aviary_input(self, Aircraft.Propulsion.MASS, val=0.0) - add_aviary_input(self, Aircraft.Design.SYSTEMS_EQUIP_MASS_BASE, val=0.0) + add_aviary_input(self, Aircraft.Design.EMPTY_MASS_MARGIN) + add_aviary_input(self, Aircraft.Design.STRUCTURE_MASS) + add_aviary_input(self, Aircraft.Propulsion.MASS) + add_aviary_input(self, Aircraft.Design.SYSTEMS_EQUIP_MASS_BASE) - add_aviary_output(self, Aircraft.Design.EMPTY_MASS, val=0.0) + add_aviary_output(self, Aircraft.Design.EMPTY_MASS) def setup_partials(self): self.declare_partials(Aircraft.Design.EMPTY_MASS, @@ -352,15 +351,15 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.CrewPayload.CARGO_CONTAINER_MASS, val=0.0) - add_aviary_input(self, Aircraft.CrewPayload.NON_FLIGHT_CREW_MASS, val=0.0) - add_aviary_input(self, Aircraft.CrewPayload.FLIGHT_CREW_MASS, val=0.0) - add_aviary_input(self, Aircraft.CrewPayload.PASSENGER_SERVICE_MASS, val=0.0) - add_aviary_input(self, Aircraft.Design.EMPTY_MASS, val=0.0) - add_aviary_input(self, Aircraft.Fuel.UNUSABLE_FUEL_MASS, val=0.0) - add_aviary_input(self, Aircraft.Propulsion.TOTAL_ENGINE_OIL_MASS, val=0.0) + add_aviary_input(self, Aircraft.CrewPayload.CARGO_CONTAINER_MASS) + add_aviary_input(self, Aircraft.CrewPayload.NON_FLIGHT_CREW_MASS) + add_aviary_input(self, Aircraft.CrewPayload.FLIGHT_CREW_MASS) + add_aviary_input(self, Aircraft.CrewPayload.PASSENGER_SERVICE_MASS) + add_aviary_input(self, Aircraft.Design.EMPTY_MASS) + add_aviary_input(self, Aircraft.Fuel.UNUSABLE_FUEL_MASS) + add_aviary_input(self, Aircraft.Propulsion.TOTAL_ENGINE_OIL_MASS) - add_aviary_output(self, Aircraft.Design.OPERATING_MASS, val=0.0) + add_aviary_output(self, Aircraft.Design.OPERATING_MASS) def setup_partials(self): self.declare_partials(Aircraft.Design.OPERATING_MASS, '*', val=1) @@ -387,12 +386,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.CrewPayload.PASSENGER_MASS, val=0.0) - add_aviary_input(self, Aircraft.CrewPayload.BAGGAGE_MASS, val=0.0) - add_aviary_input(self, Aircraft.CrewPayload.CARGO_MASS, val=0.0) - add_aviary_input(self, Aircraft.Design.OPERATING_MASS, val=0.0) + add_aviary_input(self, Aircraft.CrewPayload.PASSENGER_MASS) + add_aviary_input(self, Aircraft.CrewPayload.BAGGAGE_MASS) + add_aviary_input(self, Aircraft.CrewPayload.CARGO_MASS) + add_aviary_input(self, Aircraft.Design.OPERATING_MASS) - add_aviary_output(self, Aircraft.Design.ZERO_FUEL_MASS, val=0.0) + add_aviary_output(self, Aircraft.Design.ZERO_FUEL_MASS) def setup_partials(self): self.declare_partials(Aircraft.Design.ZERO_FUEL_MASS, '*', val=1) @@ -415,10 +414,10 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) - add_aviary_input(self, Aircraft.Design.ZERO_FUEL_MASS, val=0.0) + add_aviary_input(self, Mission.Design.GROSS_MASS) + add_aviary_input(self, Aircraft.Design.ZERO_FUEL_MASS) - add_aviary_output(self, Mission.Design.FUEL_MASS, val=0.0) + add_aviary_output(self, Mission.Design.FUEL_MASS) def setup_partials(self): self.declare_partials(Mission.Design.FUEL_MASS, diff --git a/aviary/subsystems/mass/flops_based/misc_engine.py b/aviary/subsystems/mass/flops_based/misc_engine.py index dba079072..9d2436515 100644 --- a/aviary/subsystems/mass/flops_based/misc_engine.py +++ b/aviary/subsystems/mass/flops_based/misc_engine.py @@ -1,6 +1,5 @@ import numpy as np import openmdao.api as om -import numpy as np from aviary.utils.aviary_values import AviaryValues from aviary.variable_info.functions import add_aviary_input, add_aviary_output @@ -28,13 +27,12 @@ def setup(self): num_engine_type = len(self.options['aviary_options'].get_val( Aircraft.Engine.NUM_ENGINES)) - add_aviary_input( - self, Aircraft.Engine.ADDITIONAL_MASS, val=np.zeros(num_engine_type)) - add_aviary_input(self, Aircraft.Propulsion.MISC_MASS_SCALER, val=0.0) - add_aviary_input(self, Aircraft.Propulsion.TOTAL_ENGINE_CONTROLS_MASS, val=0.0) - add_aviary_input(self, Aircraft.Propulsion.TOTAL_STARTER_MASS, val=0.0) + add_aviary_input(self, Aircraft.Engine.ADDITIONAL_MASS, shape=num_engine_type) + add_aviary_input(self, Aircraft.Propulsion.MISC_MASS_SCALER) + add_aviary_input(self, Aircraft.Propulsion.TOTAL_ENGINE_CONTROLS_MASS) + add_aviary_input(self, Aircraft.Propulsion.TOTAL_STARTER_MASS) - add_aviary_output(self, Aircraft.Propulsion.TOTAL_MISC_MASS, val=0.0) + add_aviary_output(self, Aircraft.Propulsion.TOTAL_MISC_MASS) self.declare_partials( of=Aircraft.Propulsion.TOTAL_MISC_MASS, diff --git a/aviary/subsystems/mass/flops_based/nacelle.py b/aviary/subsystems/mass/flops_based/nacelle.py index 398d8f0af..7cf64d7d9 100644 --- a/aviary/subsystems/mass/flops_based/nacelle.py +++ b/aviary/subsystems/mass/flops_based/nacelle.py @@ -29,19 +29,12 @@ def setup(self): num_engine_type = len(self.options['aviary_options'].get_val( Aircraft.Engine.NUM_ENGINES)) - add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, - val=np.zeros(num_engine_type)) + add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, shape=num_engine_type) + add_aviary_input(self, Aircraft.Nacelle.AVG_LENGTH, shape=num_engine_type) + add_aviary_input(self, Aircraft.Nacelle.MASS_SCALER, shape=num_engine_type) + add_aviary_input(self, Aircraft.Engine.SCALED_SLS_THRUST, shape=num_engine_type) - add_aviary_input(self, Aircraft.Nacelle.AVG_LENGTH, - val=np.zeros(num_engine_type)) - - add_aviary_input(self, Aircraft.Nacelle.MASS_SCALER, - val=np.ones(num_engine_type)) - - add_aviary_input(self, Aircraft.Engine.SCALED_SLS_THRUST, - val=np.zeros(num_engine_type)) - - add_aviary_output(self, Aircraft.Nacelle.MASS, val=np.zeros(num_engine_type)) + add_aviary_output(self, Aircraft.Nacelle.MASS, shape=num_engine_type) def setup_partials(self): # derivatives w.r.t vectorized engine inputs have known sparsity pattern diff --git a/aviary/subsystems/mass/flops_based/paint.py b/aviary/subsystems/mass/flops_based/paint.py index 7e1df471a..211287d0c 100644 --- a/aviary/subsystems/mass/flops_based/paint.py +++ b/aviary/subsystems/mass/flops_based/paint.py @@ -16,11 +16,10 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Design.TOTAL_WETTED_AREA, val=0.0) + add_aviary_input(self, Aircraft.Design.TOTAL_WETTED_AREA) + add_aviary_input(self, Aircraft.Paint.MASS_PER_UNIT_AREA) - add_aviary_input(self, Aircraft.Paint.MASS_PER_UNIT_AREA, val=0.0) - - add_aviary_output(self, Aircraft.Paint.MASS, val=0.0) + add_aviary_output(self, Aircraft.Paint.MASS) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/passenger_service.py b/aviary/subsystems/mass/flops_based/passenger_service.py index 7d1688085..ceddd868d 100644 --- a/aviary/subsystems/mass/flops_based/passenger_service.py +++ b/aviary/subsystems/mass/flops_based/passenger_service.py @@ -23,23 +23,10 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input( - self, - Aircraft.CrewPayload.PASSENGER_SERVICE_MASS_SCALER, - val=1., - ) + add_aviary_input(self, Aircraft.CrewPayload.PASSENGER_SERVICE_MASS_SCALER) + add_aviary_input(self, Mission.Design.RANGE) - add_aviary_input( - self, - Mission.Design.RANGE, - val=0.0, - ) - - add_aviary_output( - self, - Aircraft.CrewPayload.PASSENGER_SERVICE_MASS, - val=0.0, - ) + add_aviary_output(self, Aircraft.CrewPayload.PASSENGER_SERVICE_MASS) def setup_partials(self): self.declare_partials('*', '*') diff --git a/aviary/subsystems/mass/flops_based/starter.py b/aviary/subsystems/mass/flops_based/starter.py index e7b06a4d9..49eec2bc9 100644 --- a/aviary/subsystems/mass/flops_based/starter.py +++ b/aviary/subsystems/mass/flops_based/starter.py @@ -25,10 +25,9 @@ def setup(self): num_engine_type = len(self.options['aviary_options'].get_val( Aircraft.Engine.NUM_ENGINES)) - add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, - val=np.zeros(num_engine_type)) + add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, shape=num_engine_type) - add_aviary_output(self, Aircraft.Propulsion.TOTAL_STARTER_MASS, val=0.0) + add_aviary_output(self, Aircraft.Propulsion.TOTAL_STARTER_MASS) def setup_partials(self): self.declare_partials("*", "*") diff --git a/aviary/subsystems/mass/flops_based/surface_controls.py b/aviary/subsystems/mass/flops_based/surface_controls.py index 441a7fcde..b3207eda0 100644 --- a/aviary/subsystems/mass/flops_based/surface_controls.py +++ b/aviary/subsystems/mass/flops_based/surface_controls.py @@ -18,12 +18,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Wing.SURFACE_CONTROL_MASS_SCALER, val=1.0) - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) - add_aviary_input(self, Aircraft.Wing.CONTROL_SURFACE_AREA_RATIO, val=0.0) - add_aviary_input(self, Aircraft.Wing.AREA, val=0.0) + add_aviary_input(self, Aircraft.Wing.SURFACE_CONTROL_MASS_SCALER) + add_aviary_input(self, Mission.Design.GROSS_MASS) + add_aviary_input(self, Aircraft.Wing.CONTROL_SURFACE_AREA_RATIO) + add_aviary_input(self, Aircraft.Wing.AREA) - add_aviary_output(self, Aircraft.Wing.SURFACE_CONTROL_MASS, val=10) + add_aviary_output(self, Aircraft.Wing.SURFACE_CONTROL_MASS) add_aviary_output(self, Aircraft.Wing.CONTROL_SURFACE_AREA, val=2) self.declare_partials(Aircraft.Wing.SURFACE_CONTROL_MASS, '*') diff --git a/aviary/subsystems/mass/flops_based/test/test_furnishings.py b/aviary/subsystems/mass/flops_based/test/test_furnishings.py index b6885b17b..7d64c6388 100644 --- a/aviary/subsystems/mass/flops_based/test/test_furnishings.py +++ b/aviary/subsystems/mass/flops_based/test/test_furnishings.py @@ -127,7 +127,10 @@ def test_case(self): flops_inputs = get_flops_inputs("N3CC", preprocess=True) flops_inputs.update({ Aircraft.Fuselage.MILITARY_CARGO_FLOOR: (False, 'unitless'), - Aircraft.BWB.NUM_BAYS: (5, 'unitless') + Aircraft.BWB.NUM_BAYS: (5, 'unitless'), + Aircraft.BWB.CABIN_AREA: (100, 'ft**2'), + Aircraft.Fuselage.MAX_WIDTH: (30, 'ft'), + Aircraft.Fuselage.MAX_HEIGHT: (15, 'ft'), }) prob.model.add_subsystem( 'furnishings', @@ -135,6 +138,12 @@ def test_case(self): promotes_outputs=['*'], promotes_inputs=['*'] ) + prob.model.set_input_defaults( + Aircraft.BWB.CABIN_AREA, val=100., units="ft**2") + prob.model.set_input_defaults( + Aircraft.Fuselage.MAX_WIDTH, val=30., units="ft") + prob.model.set_input_defaults( + Aircraft.Fuselage.MAX_HEIGHT, val=15., units="ft") prob.setup(check=False, force_alloc_complex=True) partial_data = prob.check_partials(out_stream=None, method="cs") @@ -215,4 +224,8 @@ def test_IO(self): if __name__ == '__main__': - unittest.main() + #unittest.main() + test = BWBFurnishingsGroupMassTest2() + test.setUp() + test.test_case() + diff --git a/aviary/subsystems/mass/flops_based/test/test_wing_common.py b/aviary/subsystems/mass/flops_based/test/test_wing_common.py index 69134fa47..0469987b4 100644 --- a/aviary/subsystems/mass/flops_based/test/test_wing_common.py +++ b/aviary/subsystems/mass/flops_based/test/test_wing_common.py @@ -215,6 +215,7 @@ def test_case(self): prob.set_val(Aircraft.Wing.SHEAR_CONTROL_MASS, 4000, 'lbm') prob.set_val(Aircraft.Wing.SPAN, 100, 'ft') prob.set_val(Aircraft.Wing.SWEEP, 20, 'deg') + prob.set_val(Aircraft.Wing.ULTIMATE_LOAD_FACTOR, 3.75, 'unitless') partial_data = prob.check_partials(out_stream=None, method="cs") assert_check_partials(partial_data, atol=1e-12, rtol=1e-12) diff --git a/aviary/subsystems/mass/flops_based/thrust_reverser.py b/aviary/subsystems/mass/flops_based/thrust_reverser.py index 028c2969c..b8cea8872 100644 --- a/aviary/subsystems/mass/flops_based/thrust_reverser.py +++ b/aviary/subsystems/mass/flops_based/thrust_reverser.py @@ -32,14 +32,14 @@ def setup(self): Aircraft.Engine.NUM_ENGINES)) add_aviary_input( - self, Aircraft.Engine.THRUST_REVERSERS_MASS_SCALER, val=np.zeros(num_engine_type)) + self, Aircraft.Engine.THRUST_REVERSERS_MASS_SCALER, shape=num_engine_type) add_aviary_input( - self, Aircraft.Engine.SCALED_SLS_THRUST, val=np.zeros(num_engine_type)) + self, Aircraft.Engine.SCALED_SLS_THRUST, shape=num_engine_type) add_aviary_output( - self, Aircraft.Engine.THRUST_REVERSERS_MASS, val=np.zeros(num_engine_type)) + self, Aircraft.Engine.THRUST_REVERSERS_MASS, shape=num_engine_type) add_aviary_output( - self, Aircraft.Propulsion.TOTAL_THRUST_REVERSERS_MASS, val=0) + self, Aircraft.Propulsion.TOTAL_THRUST_REVERSERS_MASS) def setup_partials(self): # derivatives w.r.t vectorized engine inputs have known sparsity pattern diff --git a/aviary/subsystems/mass/flops_based/unusable_fuel.py b/aviary/subsystems/mass/flops_based/unusable_fuel.py index 6b994718a..8e0f927b1 100644 --- a/aviary/subsystems/mass/flops_based/unusable_fuel.py +++ b/aviary/subsystems/mass/flops_based/unusable_fuel.py @@ -27,19 +27,14 @@ def initialize(self): def setup(self): add_aviary_input( - self, Aircraft.Fuel.UNUSABLE_FUEL_MASS_SCALER, val=1.0) - - add_aviary_input(self, Aircraft.Fuel.DENSITY_RATIO, 1.0) - - add_aviary_input(self, Aircraft.Fuel.TOTAL_CAPACITY, 0.0) - - add_aviary_input(self, Aircraft.Propulsion.TOTAL_SCALED_SLS_THRUST, val=0.0) - - add_aviary_input(self, Aircraft.Wing.AREA, val=0.0) - - add_aviary_output(self, Aircraft.Fuel.TOTAL_VOLUME, val=0.0) - - add_aviary_output(self, Aircraft.Fuel.UNUSABLE_FUEL_MASS, val=0.0) + self, Aircraft.Fuel.UNUSABLE_FUEL_MASS_SCALER) + add_aviary_input(self, Aircraft.Fuel.DENSITY_RATIO) + add_aviary_input(self, Aircraft.Fuel.TOTAL_CAPACITY) + add_aviary_input(self, Aircraft.Propulsion.TOTAL_SCALED_SLS_THRUST) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_output(self, Aircraft.Fuel.TOTAL_VOLUME) + + add_aviary_output(self, Aircraft.Fuel.UNUSABLE_FUEL_MASS) def setup_partials(self): diff --git a/aviary/subsystems/mass/flops_based/vertical_tail.py b/aviary/subsystems/mass/flops_based/vertical_tail.py index 68df78b73..a43b51ca6 100644 --- a/aviary/subsystems/mass/flops_based/vertical_tail.py +++ b/aviary/subsystems/mass/flops_based/vertical_tail.py @@ -19,14 +19,11 @@ def initialize(self): def setup(self): add_aviary_input(self, Aircraft.VerticalTail.AREA, val=0.0) - add_aviary_input(self, Aircraft.VerticalTail.TAPER_RATIO, val=0.0) + add_aviary_input(self, Aircraft.VerticalTail.MASS_SCALER) + add_aviary_input(self, Mission.Design.GROSS_MASS) - add_aviary_input(self, Aircraft.VerticalTail.MASS_SCALER, val=1.0) - - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) - - add_aviary_output(self, Aircraft.VerticalTail.MASS, val=0.0) + add_aviary_output(self, Aircraft.VerticalTail.MASS) def setup_partials(self): self.declare_partials("*", "*") diff --git a/aviary/subsystems/mass/flops_based/wing_common.py b/aviary/subsystems/mass/flops_based/wing_common.py index e810dad45..744374201 100644 --- a/aviary/subsystems/mass/flops_based/wing_common.py +++ b/aviary/subsystems/mass/flops_based/wing_common.py @@ -19,23 +19,23 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) - add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, val=0.0) - add_aviary_input(self, Aircraft.Wing.BENDING_FACTOR, val=0.0) - add_aviary_input(self, Aircraft.Wing.BENDING_MASS_SCALER, val=1.0) - add_aviary_input(self, Aircraft.Wing.COMPOSITE_FRACTION, val=0.0) - add_aviary_input(self, Aircraft.Wing.ENG_POD_INERTIA_FACTOR, val=0.0) - add_aviary_input(self, Aircraft.Wing.LOAD_FRACTION, val=0.0) - add_aviary_input(self, Aircraft.Wing.MISC_MASS, val=0.0) - add_aviary_input(self, Aircraft.Wing.MISC_MASS_SCALER, val=1.0) - add_aviary_input(self, Aircraft.Wing.SHEAR_CONTROL_MASS, val=0.0) - add_aviary_input(self, Aircraft.Wing.SHEAR_CONTROL_MASS_SCALER, val=1.0) - add_aviary_input(self, Aircraft.Wing.SPAN, val=0.0) - add_aviary_input(self, Aircraft.Wing.SWEEP, val=0.0) - add_aviary_input(self, Aircraft.Wing.ULTIMATE_LOAD_FACTOR, val=3.75) - add_aviary_input(self, Aircraft.Wing.VAR_SWEEP_MASS_PENALTY, val=0.0) - - add_aviary_output(self, Aircraft.Wing.BENDING_MASS, val=0.0) + add_aviary_input(self, Mission.Design.GROSS_MASS) + add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR) + add_aviary_input(self, Aircraft.Wing.BENDING_FACTOR) + add_aviary_input(self, Aircraft.Wing.BENDING_MASS_SCALER) + add_aviary_input(self, Aircraft.Wing.COMPOSITE_FRACTION) + add_aviary_input(self, Aircraft.Wing.ENG_POD_INERTIA_FACTOR) + add_aviary_input(self, Aircraft.Wing.LOAD_FRACTION) + add_aviary_input(self, Aircraft.Wing.MISC_MASS) + add_aviary_input(self, Aircraft.Wing.MISC_MASS_SCALER) + add_aviary_input(self, Aircraft.Wing.SHEAR_CONTROL_MASS) + add_aviary_input(self, Aircraft.Wing.SHEAR_CONTROL_MASS_SCALER) + add_aviary_input(self, Aircraft.Wing.SPAN) + add_aviary_input(self, Aircraft.Wing.SWEEP) + add_aviary_input(self, Aircraft.Wing.ULTIMATE_LOAD_FACTOR) + add_aviary_input(self, Aircraft.Wing.VAR_SWEEP_MASS_PENALTY) + + add_aviary_output(self, Aircraft.Wing.BENDING_MASS) self.A1 = 8.80 self.A2 = 6.25 @@ -200,15 +200,12 @@ def initialize(self): desc='Aircfaft type: Tranpsport, HWB, or GA') def setup(self): - add_aviary_input(self, Aircraft.Wing.COMPOSITE_FRACTION, val=0.0) + add_aviary_input(self, Aircraft.Wing.COMPOSITE_FRACTION) + add_aviary_input(self, Aircraft.Wing.CONTROL_SURFACE_AREA) + add_aviary_input(self, Mission.Design.GROSS_MASS) + add_aviary_input(self, Aircraft.Wing.SHEAR_CONTROL_MASS_SCALER) - add_aviary_input(self, Aircraft.Wing.CONTROL_SURFACE_AREA, val=0.0) - - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) - - add_aviary_input(self, Aircraft.Wing.SHEAR_CONTROL_MASS_SCALER, val=1.0) - - add_aviary_output(self, Aircraft.Wing.SHEAR_CONTROL_MASS, val=0.0) + add_aviary_output(self, Aircraft.Wing.SHEAR_CONTROL_MASS) if ( (self.options['aircraft_type'] == 'Transport') @@ -281,13 +278,11 @@ def initialize(self): desc='Aircfaft type: Tranpsport, HWB, or GA') def setup(self): - add_aviary_input(self, Aircraft.Wing.COMPOSITE_FRACTION, val=0.0) - - add_aviary_input(self, Aircraft.Wing.AREA, val=0.0) - - add_aviary_input(self, Aircraft.Wing.MISC_MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Wing.COMPOSITE_FRACTION) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.MISC_MASS_SCALER) - add_aviary_output(self, Aircraft.Wing.MISC_MASS, val=0.0) + add_aviary_output(self, Aircraft.Wing.MISC_MASS) if ( (self.options['aircraft_type'] == 'Transport') @@ -336,17 +331,13 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Wing.BENDING_MASS, val=0.0) - - add_aviary_input(self, Aircraft.Wing.SHEAR_CONTROL_MASS, val=0.0) - - add_aviary_input(self, Aircraft.Wing.MISC_MASS, val=0.0) - - add_aviary_input(self, Aircraft.Wing.BWB_AFTBODY_MASS, val=0.0) - - add_aviary_input(self, Aircraft.Wing.MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Wing.BENDING_MASS) + add_aviary_input(self, Aircraft.Wing.SHEAR_CONTROL_MASS) + add_aviary_input(self, Aircraft.Wing.MISC_MASS) + add_aviary_input(self, Aircraft.Wing.BWB_AFTBODY_MASS) + add_aviary_input(self, Aircraft.Wing.MASS_SCALER) - add_aviary_output(self, Aircraft.Wing.MASS, val=0) + add_aviary_output(self, Aircraft.Wing.MASS) def setup_partials(self): self.declare_partials("*", "*") diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index 521f3c9d0..7b7cb5f21 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -34,36 +34,24 @@ def setup(self): # wing_location_default[:] = [np.array([0]*int(num)) for num in num_wing_engines/2] add_aviary_input(self, Aircraft.Wing.LOAD_PATH_SWEEP_DIST, - val=np.zeros(num_input_stations - 1)) - + shape=num_input_stations - 1) add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_DIST, - val=np.zeros(num_input_stations)) - + shape=num_input_stations) add_aviary_input(self, Aircraft.Wing.CHORD_PER_SEMISPAN_DIST, - val=np.zeros(num_input_stations)) - - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) - - add_aviary_input(self, Aircraft.Engine.POD_MASS, val=np.zeros(num_engine_type)) - - add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO, val=0.0) - - add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO_REF, val=0.0) - - add_aviary_input(self, Aircraft.Wing.STRUT_BRACING_FACTOR, val=0.0) - - add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, val=0.0) - + shape=num_input_stations) + add_aviary_input(self, Mission.Design.GROSS_MASS) + add_aviary_input(self, Aircraft.Engine.POD_MASS, shape=num_engine_type) + add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO) + add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO_REF) + add_aviary_input(self, Aircraft.Wing.STRUT_BRACING_FACTOR) + add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR) add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=np.zeros(int(total_num_wing_engines/2))) - - add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD, val=0.0) - - add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_REF, val=0.0) - - add_aviary_output(self, Aircraft.Wing.BENDING_FACTOR, val=0.0) + shape=int(total_num_wing_engines/2)) + add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD) + add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_REF) - add_aviary_output(self, Aircraft.Wing.ENG_POD_INERTIA_FACTOR, val=0.0) + add_aviary_output(self, Aircraft.Wing.BENDING_FACTOR) + add_aviary_output(self, Aircraft.Wing.ENG_POD_INERTIA_FACTOR) def setup_partials(self): # TODO: Analytic derivs will be challenging, but possible. diff --git a/aviary/subsystems/mass/flops_based/wing_simple.py b/aviary/subsystems/mass/flops_based/wing_simple.py index 180c8f3de..2c3d1d283 100644 --- a/aviary/subsystems/mass/flops_based/wing_simple.py +++ b/aviary/subsystems/mass/flops_based/wing_simple.py @@ -18,25 +18,17 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Wing.AREA, val=0.0) - - add_aviary_input(self, Aircraft.Wing.SPAN, val=0.0) - - add_aviary_input(self, Aircraft.Wing.TAPER_RATIO, val=0.0) - - add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD, val=0.0) - - add_aviary_input(self, Aircraft.Wing.STRUT_BRACING_FACTOR, val=0.0) - - add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, val=0.0) - - add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO, val=0.0) - - add_aviary_input(self, Aircraft.Wing.SWEEP, val=0.0) - - add_aviary_output(self, Aircraft.Wing.BENDING_FACTOR, val=0.0) - - add_aviary_output(self, Aircraft.Wing.ENG_POD_INERTIA_FACTOR, val=0.0) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.SPAN) + add_aviary_input(self, Aircraft.Wing.TAPER_RATIO) + add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD) + add_aviary_input(self, Aircraft.Wing.STRUT_BRACING_FACTOR) + add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR) + add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO) + add_aviary_input(self, Aircraft.Wing.SWEEP) + + add_aviary_output(self, Aircraft.Wing.BENDING_FACTOR) + add_aviary_output(self, Aircraft.Wing.ENG_POD_INERTIA_FACTOR) def setup_partials(self): self.declare_partials(of=Aircraft.Wing.BENDING_FACTOR, From 4530aba50c9a5b74ae6e52dc1c0af484c4e4a540 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 20 Dec 2024 15:58:04 -0800 Subject: [PATCH 13/89] work in progress. --- aviary/subsystems/mass/flops_based/fuselage.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/fuselage.py b/aviary/subsystems/mass/flops_based/fuselage.py index 61d6b5216..d1852b417 100644 --- a/aviary/subsystems/mass/flops_based/fuselage.py +++ b/aviary/subsystems/mass/flops_based/fuselage.py @@ -88,15 +88,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Fuselage.MASS_SCALER, 1.0) - - add_aviary_input(self, Aircraft.Fuselage.WETTED_AREA, 0.0) - - add_aviary_input(self, Aircraft.Fuselage.MAX_HEIGHT, 0.0) - - add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, 0.0) + add_aviary_input(self, Aircraft.Fuselage.MASS_SCALER) + add_aviary_input(self, Aircraft.Fuselage.WETTED_AREA) + add_aviary_input(self, Aircraft.Fuselage.MAX_HEIGHT) + add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH) - add_aviary_output(self, Aircraft.Fuselage.MASS, 1.0) + add_aviary_output(self, Aircraft.Fuselage.MASS) def setup_partials(self): self.declare_partials(of='*', wrt='*') From 3dbec3a89ff10ce0ea1a7888deeb86456398cbe0 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 23 Dec 2024 09:45:20 -0800 Subject: [PATCH 14/89] Change TAPER_RATIO to 0.0 from 0.352 in horizontal_tail.py --- aviary/subsystems/mass/flops_based/horizontal_tail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/subsystems/mass/flops_based/horizontal_tail.py b/aviary/subsystems/mass/flops_based/horizontal_tail.py index 9665aac32..5df097acb 100644 --- a/aviary/subsystems/mass/flops_based/horizontal_tail.py +++ b/aviary/subsystems/mass/flops_based/horizontal_tail.py @@ -19,7 +19,7 @@ def initialize(self): def setup(self): add_aviary_input(self, Aircraft.HorizontalTail.AREA) - add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO, val=0.352) + add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO) add_aviary_input(self, Mission.Design.GROSS_MASS) add_aviary_input(self, Aircraft.HorizontalTail.MASS_SCALER) From 9e6ca82b27f11cc5b34a3d80578683c331860e82 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 23 Dec 2024 09:45:54 -0800 Subject: [PATCH 15/89] minor update --- aviary/subsystems/mass/flops_based/test/test_furnishings.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/test/test_furnishings.py b/aviary/subsystems/mass/flops_based/test/test_furnishings.py index 7d64c6388..d1da0a395 100644 --- a/aviary/subsystems/mass/flops_based/test/test_furnishings.py +++ b/aviary/subsystems/mass/flops_based/test/test_furnishings.py @@ -224,8 +224,5 @@ def test_IO(self): if __name__ == '__main__': - #unittest.main() - test = BWBFurnishingsGroupMassTest2() - test.setUp() - test.test_case() + unittest.main() From bea43565a16ebacba9c3a171688b949a832c9331 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 23 Dec 2024 09:47:30 -0800 Subject: [PATCH 16/89] autopep8 --- aviary/subsystems/mass/flops_based/test/test_furnishings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/aviary/subsystems/mass/flops_based/test/test_furnishings.py b/aviary/subsystems/mass/flops_based/test/test_furnishings.py index d1da0a395..d519ac77c 100644 --- a/aviary/subsystems/mass/flops_based/test/test_furnishings.py +++ b/aviary/subsystems/mass/flops_based/test/test_furnishings.py @@ -225,4 +225,3 @@ def test_IO(self): if __name__ == '__main__': unittest.main() - From 0f455eb4b5f2ccc4d385e8775907fd7768f88955 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 23 Dec 2024 10:31:30 -0800 Subject: [PATCH 17/89] have to set Aircraft.HorizontalTail.TAPER_RATIO, val=0.352 in horizontal_tail.py for now because it generates conflicts with other subsystem. --- aviary/subsystems/mass/flops_based/horizontal_tail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/subsystems/mass/flops_based/horizontal_tail.py b/aviary/subsystems/mass/flops_based/horizontal_tail.py index 5df097acb..9665aac32 100644 --- a/aviary/subsystems/mass/flops_based/horizontal_tail.py +++ b/aviary/subsystems/mass/flops_based/horizontal_tail.py @@ -19,7 +19,7 @@ def initialize(self): def setup(self): add_aviary_input(self, Aircraft.HorizontalTail.AREA) - add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO) + add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO, val=0.352) add_aviary_input(self, Mission.Design.GROSS_MASS) add_aviary_input(self, Aircraft.HorizontalTail.MASS_SCALER) From 18d9819cf74f7a77c7ee2875405b48986e2e74c8 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 09:12:42 -0800 Subject: [PATCH 18/89] inputs Aircraft.Canard.AREA, Aircraft.Canard.THICKNESS_TO_CHORD, Aircraft.Canard.WETTED_AREA_SCALER to default in metadata. output Aircraft.Canard.WETTED_AREA to default in metadata. --- aviary/subsystems/geometry/flops_based/canard.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aviary/subsystems/geometry/flops_based/canard.py b/aviary/subsystems/geometry/flops_based/canard.py index b9ca8d92a..0542dc5fa 100644 --- a/aviary/subsystems/geometry/flops_based/canard.py +++ b/aviary/subsystems/geometry/flops_based/canard.py @@ -18,11 +18,11 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Canard.AREA, 0.0) - add_aviary_input(self, Aircraft.Canard.THICKNESS_TO_CHORD, 0.0) - add_aviary_input(self, Aircraft.Canard.WETTED_AREA_SCALER, 1.0) + add_aviary_input(self, Aircraft.Canard.AREA) + add_aviary_input(self, Aircraft.Canard.THICKNESS_TO_CHORD) + add_aviary_input(self, Aircraft.Canard.WETTED_AREA_SCALER) - add_aviary_output(self, Aircraft.Canard.WETTED_AREA, 0.0) + add_aviary_output(self, Aircraft.Canard.WETTED_AREA) def setup_partials(self): self.declare_partials( From b5397ab9a214a69c5ea57fc190bed46d6fde6876 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 09:29:04 -0800 Subject: [PATCH 19/89] Set inputs Aircraft.Canard.AREA, Aircraft.Canard.ASPECT_RATIO, Aircraft.Canard.THICKNESS_TO_CHORD, Aircraft.Fuselage.AVG_DIAMETER, Aircraft.Fuselage.LENGTH, Aircraft.HorizontalTail.AREA, Aircraft.HorizontalTail.THICKNESS_TO_CHORD, Aircraft.VerticalTail.AREA, Aircraft.VerticalTail.ASPECT_RATIO, Aircraft.VerticalTail.THICKNESS_TO_CHORD, Aircraft.Wing.AREA, Aircraft.Wing.ASPECT_RATIO, Aircraft.Wing.GLOVE_AND_BAT, Aircraft.Wing.TAPER_RATIO, Aircraft.Wing.THICKNESS_TO_CHORD, Aircraft.Canard.CHARACTERISTIC_LENGTH, Aircraft.Canard.FINENESS, Aircraft.Fuselage.CHARACTERISTIC_LENGTH, Aircraft.Fuselage.FINENESS, Aircraft.HorizontalTail.CHARACTERISTIC_LENGTH, Aircraft.HorizontalTail.FINENESS to metadata values (0.0). Set inputs Aircraft.Nacelle.AVG_DIAMETER, Aircraft.Nacelle.AVG_LENGTH to metadata values ([0.0]) with shape (num_engine_type). Set input Aircraft.HorizontalTail.ASPECT_RATIO to to metadata values (4.75) for now. Set outputs Aircraft.VerticalTail.CHARACTERISTIC_LENGTH, Aircraft.Nacelle.FINENESS to metadata values ([0.0]) with shape (num_engine_type). Set outputs Aircraft.VerticalTail.CHARACTERISTIC_LENGTH, Aircraft.Wing.CHARACTERISTIC_LENGTH, Aircraft.Wing.FINENESS to metadata values (0.0). --- .../flops_based/characteristic_lengths.py | 66 +++++++++---------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/aviary/subsystems/geometry/flops_based/characteristic_lengths.py b/aviary/subsystems/geometry/flops_based/characteristic_lengths.py index 474fa7381..dfe6c68f4 100644 --- a/aviary/subsystems/geometry/flops_based/characteristic_lengths.py +++ b/aviary/subsystems/geometry/flops_based/characteristic_lengths.py @@ -24,66 +24,60 @@ def setup(self): self.add_input(Names.CROOT, 0.0, units='unitless') - add_aviary_input(self, Aircraft.Canard.AREA, 0.0) - add_aviary_input(self, Aircraft.Canard.ASPECT_RATIO, 0.0) + add_aviary_input(self, Aircraft.Canard.AREA) + add_aviary_input(self, Aircraft.Canard.ASPECT_RATIO) # add_aviary_input(self, Aircraft.Canard.LAMINAR_FLOW_LOWER, 0.0) # add_aviary_input(self, Aircraft.Canard.LAMINAR_FLOW_UPPER, 0.0) - add_aviary_input(self, Aircraft.Canard.THICKNESS_TO_CHORD, 0.0) + add_aviary_input(self, Aircraft.Canard.THICKNESS_TO_CHORD) - add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER, 0.0) + add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER) # add_aviary_input(self, Aircraft.Fuselage.LAMINAR_FLOW_LOWER, 0.0) # add_aviary_input(self, Aircraft.Fuselage.LAMINAR_FLOW_UPPER, 0.0) - add_aviary_input(self, Aircraft.Fuselage.LENGTH, 0.0) + add_aviary_input(self, Aircraft.Fuselage.LENGTH) - add_aviary_input(self, Aircraft.HorizontalTail.AREA, 0.0) - add_aviary_input(self, Aircraft.HorizontalTail.ASPECT_RATIO, 4.75) + add_aviary_input(self, Aircraft.HorizontalTail.AREA) + add_aviary_input(self, Aircraft.HorizontalTail.ASPECT_RATIO) # add_aviary_input(self, Aircraft.HorizontalTail.LAMINAR_FLOW_LOWER, 0.0) # add_aviary_input(self, Aircraft.HorizontalTail.LAMINAR_FLOW_UPPER, 0.0) - add_aviary_input(self, Aircraft.HorizontalTail.THICKNESS_TO_CHORD, 0.0) + add_aviary_input(self, Aircraft.HorizontalTail.THICKNESS_TO_CHORD) - add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, np.zeros(num_engine_type)) - add_aviary_input(self, Aircraft.Nacelle.AVG_LENGTH, np.zeros(num_engine_type)) + add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, shape=num_engine_type) + add_aviary_input(self, Aircraft.Nacelle.AVG_LENGTH, shape=num_engine_type) # add_aviary_input(self, Aircraft.Nacelle.LAMINAR_FLOW_LOWER, 0.0) # add_aviary_input(self, Aircraft.Nacelle.LAMINAR_FLOW_UPPER, 0.0) - add_aviary_input(self, Aircraft.VerticalTail.AREA, 0.0) - add_aviary_input(self, Aircraft.VerticalTail.ASPECT_RATIO, 0.0) + add_aviary_input(self, Aircraft.VerticalTail.AREA) + add_aviary_input(self, Aircraft.VerticalTail.ASPECT_RATIO) # add_aviary_input(self, Aircraft.VerticalTail.LAMINAR_FLOW_LOWER, 0.0) # add_aviary_input(self, Aircraft.VerticalTail.LAMINAR_FLOW_UPPER, 0.0) - add_aviary_input(self, Aircraft.VerticalTail.THICKNESS_TO_CHORD, 0.0) + add_aviary_input(self, Aircraft.VerticalTail.THICKNESS_TO_CHORD) - add_aviary_input(self, Aircraft.Wing.AREA, 0.0) - add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO, 0.0) - add_aviary_input(self, Aircraft.Wing.GLOVE_AND_BAT, 0.0) - add_aviary_input(self, Aircraft.Wing.TAPER_RATIO, 0.0) - add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD, 0.0) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO) + add_aviary_input(self, Aircraft.Wing.GLOVE_AND_BAT) + add_aviary_input(self, Aircraft.Wing.TAPER_RATIO) + add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD) # add_aviary_input(self, Aircraft.Wing.LAMINAR_FLOW_LOWER, 0.0) # add_aviary_input(self, Aircraft.Wing.LAMINAR_FLOW_UPPER, 0.0) - add_aviary_output(self, Aircraft.Canard.CHARACTERISTIC_LENGTH, 0.0) - add_aviary_output(self, Aircraft.Canard.FINENESS, 0.0) + add_aviary_output(self, Aircraft.Canard.CHARACTERISTIC_LENGTH) + add_aviary_output(self, Aircraft.Canard.FINENESS) - add_aviary_output(self, Aircraft.Fuselage.CHARACTERISTIC_LENGTH, 0.0) - add_aviary_output(self, Aircraft.Fuselage.FINENESS, 0.0) + add_aviary_output(self, Aircraft.Fuselage.CHARACTERISTIC_LENGTH) + add_aviary_output(self, Aircraft.Fuselage.FINENESS) - add_aviary_output( - self, Aircraft.HorizontalTail.CHARACTERISTIC_LENGTH, 0.0 - ) - - add_aviary_output(self, Aircraft.HorizontalTail.FINENESS, 0.0) + add_aviary_output(self, Aircraft.HorizontalTail.CHARACTERISTIC_LENGTH) + add_aviary_output(self, Aircraft.HorizontalTail.FINENESS) add_aviary_output(self, Aircraft.Nacelle.CHARACTERISTIC_LENGTH, - np.zeros(num_engine_type)) - add_aviary_output(self, Aircraft.Nacelle.FINENESS, np.zeros(num_engine_type)) - - add_aviary_output( - self, Aircraft.VerticalTail.CHARACTERISTIC_LENGTH, 0.0 - ) + shape=num_engine_type) + add_aviary_output(self, Aircraft.Nacelle.FINENESS, shape=num_engine_type) - add_aviary_output(self, Aircraft.VerticalTail.FINENESS, 0.0) + add_aviary_output(self, Aircraft.VerticalTail.CHARACTERISTIC_LENGTH) + add_aviary_output(self, Aircraft.VerticalTail.FINENESS) - add_aviary_output(self, Aircraft.Wing.CHARACTERISTIC_LENGTH, 0.0) - add_aviary_output(self, Aircraft.Wing.FINENESS, 0.0) + add_aviary_output(self, Aircraft.Wing.CHARACTERISTIC_LENGTH) + add_aviary_output(self, Aircraft.Wing.FINENESS) def setup_partials(self): self._setup_partials_wing() From d87ca643822289d00232e96f579df5032ba43772 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 09:31:50 -0800 Subject: [PATCH 20/89] set inputs Aircraft.Fuselage.LENGTH, Aircraft.Fuselage.MAX_HEIGHT, Aircraft.Fuselage.MAX_WIDTH to metadata value (0.0). Set outputs Aircraft.Fuselage.AVG_DIAMETER, Aircraft.Fuselage.PLANFORM_AREA to metadata value (0.0). --- aviary/subsystems/geometry/flops_based/fuselage.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aviary/subsystems/geometry/flops_based/fuselage.py b/aviary/subsystems/geometry/flops_based/fuselage.py index ff2f87c48..86cc4d807 100644 --- a/aviary/subsystems/geometry/flops_based/fuselage.py +++ b/aviary/subsystems/geometry/flops_based/fuselage.py @@ -22,12 +22,12 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Fuselage.LENGTH, val=0.0) - add_aviary_input(self, Aircraft.Fuselage.MAX_HEIGHT, val=0.0) - add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, val=0.0) + add_aviary_input(self, Aircraft.Fuselage.LENGTH) + add_aviary_input(self, Aircraft.Fuselage.MAX_HEIGHT) + add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH) - add_aviary_output(self, Aircraft.Fuselage.AVG_DIAMETER, val=0.0) - add_aviary_output(self, Aircraft.Fuselage.PLANFORM_AREA, val=0.0) + add_aviary_output(self, Aircraft.Fuselage.AVG_DIAMETER) + add_aviary_output(self, Aircraft.Fuselage.PLANFORM_AREA) def setup_partials(self): self.declare_partials(of=[Aircraft.Fuselage.AVG_DIAMETER], From 88aa347df758df831ac143cc15dc7e0f4e4ae0ee Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 09:45:15 -0800 Subject: [PATCH 21/89] Set inputs Aircraft.Nacelle.AVG_DIAMETER, Aircraft.Nacelle.AVG_LENGTH, Aircraft.Nacelle.WETTED_AREA_SCALER to metadata values ([0.0]) with shape (num_engine_type). Set Aircraft.Nacelle.TOTAL_WETTED_AREA to metadata values (0.0). Set Aircraft.Nacelle.WETTED_AREA to metadata values ([0.0]) with shape (num_engine_type). --- .../subsystems/geometry/flops_based/nacelle.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/aviary/subsystems/geometry/flops_based/nacelle.py b/aviary/subsystems/geometry/flops_based/nacelle.py index a2f0d58ba..e40fe74e6 100644 --- a/aviary/subsystems/geometry/flops_based/nacelle.py +++ b/aviary/subsystems/geometry/flops_based/nacelle.py @@ -22,16 +22,12 @@ def initialize(self): def setup(self): num_engine_type = len(self.options['aviary_options'].get_val( Aircraft.Engine.NUM_ENGINES)) - add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, - val=np.zeros(num_engine_type)) - add_aviary_input(self, Aircraft.Nacelle.AVG_LENGTH, - val=np.zeros(num_engine_type)) - add_aviary_input(self, Aircraft.Nacelle.WETTED_AREA_SCALER, - val=np.zeros(num_engine_type)) - - add_aviary_output(self, Aircraft.Nacelle.TOTAL_WETTED_AREA, 0.0) - add_aviary_output(self, Aircraft.Nacelle.WETTED_AREA, - val=np.zeros(num_engine_type)) + add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, shape=num_engine_type) + add_aviary_input(self, Aircraft.Nacelle.AVG_LENGTH, shape=num_engine_type) + add_aviary_input(self, Aircraft.Nacelle.WETTED_AREA_SCALER, shape=num_engine_type) + + add_aviary_output(self, Aircraft.Nacelle.TOTAL_WETTED_AREA) + add_aviary_output(self, Aircraft.Nacelle.WETTED_AREA, shape=num_engine_type) def setup_partials(self): # derivatives w.r.t vectorized engine inputs have known sparsity pattern From 53dd6dd048767a55d248d4b9197c57ee9e3a3347 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 10:30:14 -0800 Subject: [PATCH 22/89] set inputs Aircraft.Fuselage.AVG_DIAMETER, Aircraft.Fuselage.MAX_WIDTH, Aircraft.HorizontalTail.AREA, Aircraft.HorizontalTail.ASPECT_RATIO, Aircraft.HorizontalTail.THICKNESS_TO_CHORD, Aircraft.VerticalTail.AREA, Aircraft.VerticalTail.ASPECT_RATIO, Aircraft.VerticalTail.THICKNESS_TO_CHORD, Aircraft.Wing.AREA, Aircraft.Wing.GLOVE_AND_BAT, Aircraft.Wing.SPAN, Aircraft.Wing.TAPER_RATIO, Aircraft.Wing.THICKNESS_TO_CHORD to metadata values (0.0). Keep input Aircraft.HorizontalTail.TAPER_RATIO to 0.352 for now because in gasp based empennage, 'tr' is set to 0.352. --- .../geometry/flops_based/prep_geom.py | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/aviary/subsystems/geometry/flops_based/prep_geom.py b/aviary/subsystems/geometry/flops_based/prep_geom.py index 2d54dab22..896ac70b7 100644 --- a/aviary/subsystems/geometry/flops_based/prep_geom.py +++ b/aviary/subsystems/geometry/flops_based/prep_geom.py @@ -124,27 +124,25 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER, 0.0) - add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, 0.0) + add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER) + add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH) - add_aviary_input(self, Aircraft.HorizontalTail.AREA, 0.0) - add_aviary_input(self, Aircraft.HorizontalTail.ASPECT_RATIO, - 4.75, units="unitless") - add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO, - 0.352, units="unitless") - add_aviary_input(self, Aircraft.HorizontalTail.THICKNESS_TO_CHORD, 0.0) + add_aviary_input(self, Aircraft.HorizontalTail.AREA) + add_aviary_input(self, Aircraft.HorizontalTail.ASPECT_RATIO) + add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO, 0.352) + add_aviary_input(self, Aircraft.HorizontalTail.THICKNESS_TO_CHORD) - add_aviary_input(self, Aircraft.VerticalTail.AREA, 0.0) - add_aviary_input(self, Aircraft.VerticalTail.ASPECT_RATIO, 0.0) - add_aviary_input(self, Aircraft.VerticalTail.TAPER_RATIO, 0.0) - add_aviary_input(self, Aircraft.VerticalTail.THICKNESS_TO_CHORD, 0.0) + add_aviary_input(self, Aircraft.VerticalTail.AREA) + add_aviary_input(self, Aircraft.VerticalTail.ASPECT_RATIO) + add_aviary_input(self, Aircraft.VerticalTail.TAPER_RATIO) + add_aviary_input(self, Aircraft.VerticalTail.THICKNESS_TO_CHORD) - add_aviary_input(self, Aircraft.Wing.AREA, 0.0) - add_aviary_input(self, Aircraft.Wing.GLOVE_AND_BAT, 0.0) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.GLOVE_AND_BAT) # NOTE: FLOPS/aviary1 calculate span locally - add_aviary_input(self, Aircraft.Wing.SPAN, 0.0) - add_aviary_input(self, Aircraft.Wing.TAPER_RATIO, 0.0) - add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD, 0.0) + add_aviary_input(self, Aircraft.Wing.SPAN) + add_aviary_input(self, Aircraft.Wing.TAPER_RATIO) + add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD) self.add_output(Names.CROOT, 1.0, units='unitless') self.add_output(Names.CROOTB, 1.0, units='unitless') From 1dc89deb5a7b39468b3a291d5ad262d0ebbb63ad Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 10:32:23 -0800 Subject: [PATCH 23/89] set inputs Aircraft.Canard.WETTED_AREA, Aircraft.Fuselage.WETTED_AREA, Aircraft.HorizontalTail.WETTED_AREA, Aircraft.Nacelle.TOTAL_WETTED_AREA, Aircraft.VerticalTail.WETTED_AREA, Aircraft.Wing.WETTED_AREA to metadata values (0.0). Set output Aircraft.Design.TOTAL_WETTED_AREA to to metadata values (0.0). --- .../geometry/flops_based/wetted_area_total.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/aviary/subsystems/geometry/flops_based/wetted_area_total.py b/aviary/subsystems/geometry/flops_based/wetted_area_total.py index 4bb08d3e8..82e27a2ac 100644 --- a/aviary/subsystems/geometry/flops_based/wetted_area_total.py +++ b/aviary/subsystems/geometry/flops_based/wetted_area_total.py @@ -17,14 +17,14 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Canard.WETTED_AREA, 0.0) - add_aviary_input(self, Aircraft.Fuselage.WETTED_AREA, 0.0) - add_aviary_input(self, Aircraft.HorizontalTail.WETTED_AREA, 0.0) - add_aviary_input(self, Aircraft.Nacelle.TOTAL_WETTED_AREA, 0.0) - add_aviary_input(self, Aircraft.VerticalTail.WETTED_AREA, 0.0) - add_aviary_input(self, Aircraft.Wing.WETTED_AREA, 0.0) - - add_aviary_output(self, Aircraft.Design.TOTAL_WETTED_AREA, 0.0) + add_aviary_input(self, Aircraft.Canard.WETTED_AREA) + add_aviary_input(self, Aircraft.Fuselage.WETTED_AREA) + add_aviary_input(self, Aircraft.HorizontalTail.WETTED_AREA) + add_aviary_input(self, Aircraft.Nacelle.TOTAL_WETTED_AREA) + add_aviary_input(self, Aircraft.VerticalTail.WETTED_AREA) + add_aviary_input(self, Aircraft.Wing.WETTED_AREA) + + add_aviary_output(self, Aircraft.Design.TOTAL_WETTED_AREA) def setup_partials(self): self.declare_partials('*', '*', val=1.0) From 5041a5816191c308e0cbacdcbccca7cf4929f7b2 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 10:34:01 -0800 Subject: [PATCH 24/89] set inputs Aircraft.Wing.AREA, Aircraft.Wing.GLOVE_AND_BAT, Aircraft.Wing.SPAN to metadata values (0.0). Set output Aircraft.Wing.ASPECT_RATIO to metadata values (0.0). --- aviary/subsystems/geometry/flops_based/wing.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aviary/subsystems/geometry/flops_based/wing.py b/aviary/subsystems/geometry/flops_based/wing.py index 7eb02513c..8aa06e325 100644 --- a/aviary/subsystems/geometry/flops_based/wing.py +++ b/aviary/subsystems/geometry/flops_based/wing.py @@ -20,11 +20,11 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Wing.AREA, val=0.0) - add_aviary_input(self, Aircraft.Wing.GLOVE_AND_BAT, val=0.0) - add_aviary_input(self, Aircraft.Wing.SPAN, val=0.0) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.GLOVE_AND_BAT) + add_aviary_input(self, Aircraft.Wing.SPAN) - add_aviary_output(self, Aircraft.Wing.ASPECT_RATIO, val=0.0) + add_aviary_output(self, Aircraft.Wing.ASPECT_RATIO) def setup_partials(self): self.declare_partials('*', '*') From 7765e5c3e7f6d3831c73bed44cf641cad4f647c8 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 11:13:18 -0800 Subject: [PATCH 25/89] Set input Aircraft.Engine.WING_LOCATIONS to metadata values [0.0] (was [0.35]) with shape total_num_wing_engines/2. Set input Aircraft.Wing.SPAN to metadata values (0.0) (was 128). Set input Fuselage.AVG_DIAMETER to metadata values (0.0) (was 10). Set output Aircraft.Electrical.HYBRID_CABLE_LENGTH to metadata values (0.0). --- aviary/subsystems/geometry/gasp_based/electric.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/electric.py b/aviary/subsystems/geometry/gasp_based/electric.py index 3196bb92b..8fc5a6409 100644 --- a/aviary/subsystems/geometry/gasp_based/electric.py +++ b/aviary/subsystems/geometry/gasp_based/electric.py @@ -24,13 +24,11 @@ def setup(self): Aircraft.Propulsion.TOTAL_NUM_WING_ENGINES) add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=np.full(int(total_num_wing_engines/2), 0.35)) + shape=int(total_num_wing_engines/2)) + add_aviary_input(self, Aircraft.Wing.SPAN) + add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER) - add_aviary_input(self, Aircraft.Wing.SPAN, val=128) - - add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER, val=10) - - add_aviary_output(self, Aircraft.Electrical.HYBRID_CABLE_LENGTH, val=0) + add_aviary_output(self, Aircraft.Electrical.HYBRID_CABLE_LENGTH) self.declare_partials( Aircraft.Electrical.HYBRID_CABLE_LENGTH, From 6dab166bf12e4dbb8f9dc00d6cd8d5c847f6ba2f Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 11:29:53 -0800 Subject: [PATCH 26/89] set input Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION to metadata values (0.0). Set Aircraft.Fuselage.LENGTH to metadata values (0.0) (was 129.4). Set Aircraft.Wing.AREA to metadata values (0.0) (was 1370). --- aviary/subsystems/geometry/gasp_based/empennage.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index c0133bc54..71a5d5f1e 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -38,13 +38,13 @@ def setup(self): else: self.k = [0.43, 0.38, 0.85] - add_aviary_input(self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION, val=0) + add_aviary_input(self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION) - add_aviary_input(self, Aircraft.Fuselage.LENGTH, val=129.4) + add_aviary_input(self, Aircraft.Fuselage.LENGTH) self.add_input("cab_w", 13.1, units="ft", desc="SWF: Cabin width") - add_aviary_input(self, Aircraft.Wing.AREA, val=1370) + add_aviary_input(self, Aircraft.Wing.AREA) self.add_input( "wing_ref", @@ -107,7 +107,7 @@ def setup(self): desc="VBARH | VBARV: Horizontal tail volume coefficient" ) - add_aviary_input(self, Aircraft.Wing.AREA, val=1370) + add_aviary_input(self, Aircraft.Wing.AREA) self.add_input( "r_arm", From e6674ca28544732a8f5b911b805edf3026053b93 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 11:46:45 -0800 Subject: [PATCH 27/89] set input Aircraft.Engine.REFERENCE_DIAMETER to metadata values ([0.0]) (was 5.8) with shape (num_engine_type). Set input Aircraft.Engine.SCALE_FACTOR to metadata values ([0.0]) with shape (num_engine_type). Set input Aircraft.Nacelle.CORE_DIAMETER_RATIO to metadata values ([0.0]) (was 1.25) with shape (num_engine_type). Set input Aircraft.Nacelle.FINENESS to metadata values ([0.0]) (was 2) with shape (num_engine_type). Set ouputs Aircraft.Nacelle.AVG_DIAMETER, Aircraft.Nacelle.AVG_LENGTH, and Aircraft.Nacelle.SURFACE_AREA with shape (num_engine_type). --- aviary/subsystems/geometry/gasp_based/engine.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/engine.py b/aviary/subsystems/geometry/gasp_based/engine.py index b39c7f836..9ff20403b 100644 --- a/aviary/subsystems/geometry/gasp_based/engine.py +++ b/aviary/subsystems/geometry/gasp_based/engine.py @@ -24,18 +24,18 @@ def setup(self): Aircraft.Engine.NUM_ENGINES)) add_aviary_input(self, Aircraft.Engine.REFERENCE_DIAMETER, - np.full(num_engine_type, 5.8)) - add_aviary_input(self, Aircraft.Engine.SCALE_FACTOR, np.ones(num_engine_type)) + shape=num_engine_type) + add_aviary_input(self, Aircraft.Engine.SCALE_FACTOR, shape=num_engine_type) add_aviary_input(self, Aircraft.Nacelle.CORE_DIAMETER_RATIO, - np.full(num_engine_type, 1.25)) - add_aviary_input(self, Aircraft.Nacelle.FINENESS, np.full(num_engine_type, 2)) + shape=num_engine_type) + add_aviary_input(self, Aircraft.Nacelle.FINENESS, shape=num_engine_type) add_aviary_output(self, Aircraft.Nacelle.AVG_DIAMETER, - val=np.zeros(num_engine_type)) + shape=num_engine_type) add_aviary_output(self, Aircraft.Nacelle.AVG_LENGTH, - val=np.zeros(num_engine_type)) + shape=num_engine_type) add_aviary_output(self, Aircraft.Nacelle.SURFACE_AREA, - val=np.zeros(num_engine_type)) + shape=num_engine_type) def setup_partials(self): # derivatives w.r.t vectorized engine inputs have known sparsity pattern From 4cf0b21a1ed5746db73197e9b0ec2be1542709aa Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 12:38:13 -0800 Subject: [PATCH 28/89] set input Aircraft.Fuselage.DELTA_DIAMETER to metadata values (0.0) (was 4.5). Set input Aircraft.Fuselage.PILOT_COMPARTMENT_LENGTH to metadata values (0.0) (was 9.5). Set output Aircraft.Fuselage.AVG_DIAMETER to default 0.0 with units='inch' for now. --- aviary/subsystems/geometry/gasp_based/fuselage.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/fuselage.py b/aviary/subsystems/geometry/gasp_based/fuselage.py index 9e6c3ffd0..051099bba 100644 --- a/aviary/subsystems/geometry/gasp_based/fuselage.py +++ b/aviary/subsystems/geometry/gasp_based/fuselage.py @@ -33,10 +33,10 @@ def initialize(self): def setup(self): - add_aviary_input(self, Aircraft.Fuselage.DELTA_DIAMETER, val=4.5) - add_aviary_input(self, Aircraft.Fuselage.PILOT_COMPARTMENT_LENGTH, val=9.5) + add_aviary_input(self, Aircraft.Fuselage.DELTA_DIAMETER) + add_aviary_input(self, Aircraft.Fuselage.PILOT_COMPARTMENT_LENGTH) - add_aviary_output(self, Aircraft.Fuselage.AVG_DIAMETER, val=0, units='inch') + add_aviary_output(self, Aircraft.Fuselage.AVG_DIAMETER, units='inch') self.add_output("cabin_height", val=0, units="ft", desc="HC: height of cabin") self.add_output("cabin_len", val=0, units="ft", desc="LC: length of cabin") self.add_output("nose_height", val=0, units="ft", desc="HN: height of nose") From 7703e4b3303153d0529d98244fdf512ef8de711d Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 12:49:05 -0800 Subject: [PATCH 29/89] set input/output Aircraft.Strut.ATTACHMENT_LOCATION, Aircraft.Strut.ATTACHMENT_LOCATION_DIMENSIONLESS to metadata values (0.0). Set input Aircraft.Wing.FOLDED_SPAN to metadata values (0.0) (was 25). Set input add_aviary_input(self, Aircraft.Wing.FOLDED_SPAN_DIMENSIONLESS to metadata values (0.0). --- .../gasp_based/non_dimensional_conversion.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/non_dimensional_conversion.py b/aviary/subsystems/geometry/gasp_based/non_dimensional_conversion.py index 0fd18fdc9..a9edf63cd 100644 --- a/aviary/subsystems/geometry/gasp_based/non_dimensional_conversion.py +++ b/aviary/subsystems/geometry/gasp_based/non_dimensional_conversion.py @@ -20,13 +20,13 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.SPAN, val=0) if self.options["aviary_options"].get_val(Aircraft.Strut.DIMENSIONAL_LOCATION_SPECIFIED, units='unitless'): - add_aviary_input(self, Aircraft.Strut.ATTACHMENT_LOCATION, val=0) + add_aviary_input(self, Aircraft.Strut.ATTACHMENT_LOCATION) add_aviary_output( - self, Aircraft.Strut.ATTACHMENT_LOCATION_DIMENSIONLESS, val=0) + self, Aircraft.Strut.ATTACHMENT_LOCATION_DIMENSIONLESS) else: add_aviary_input( - self, Aircraft.Strut.ATTACHMENT_LOCATION_DIMENSIONLESS, val=0) - add_aviary_output(self, Aircraft.Strut.ATTACHMENT_LOCATION, val=0) + self, Aircraft.Strut.ATTACHMENT_LOCATION_DIMENSIONLESS) + add_aviary_output(self, Aircraft.Strut.ATTACHMENT_LOCATION) def setup_partials(self): @@ -79,11 +79,11 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.SPAN, val=0) if self.options["aviary_options"].get_val(Aircraft.Wing.FOLD_DIMENSIONAL_LOCATION_SPECIFIED, units='unitless'): - add_aviary_input(self, Aircraft.Wing.FOLDED_SPAN, val=25) - add_aviary_output(self, Aircraft.Wing.FOLDED_SPAN_DIMENSIONLESS, val=0) + add_aviary_input(self, Aircraft.Wing.FOLDED_SPAN) + add_aviary_output(self, Aircraft.Wing.FOLDED_SPAN_DIMENSIONLESS) else: - add_aviary_input(self, Aircraft.Wing.FOLDED_SPAN_DIMENSIONLESS, val=0) - add_aviary_output(self, Aircraft.Wing.FOLDED_SPAN, val=0) + add_aviary_input(self, Aircraft.Wing.FOLDED_SPAN_DIMENSIONLESS) + add_aviary_output(self, Aircraft.Wing.FOLDED_SPAN) def setup_partials(self): From 34bbcd8db535ff737e8be21b9c191b17551170f3 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 12:52:44 -0800 Subject: [PATCH 30/89] update unit tests --- .../gasp_based/test/test_empennage.py | 6 +---- .../geometry/gasp_based/test/test_wing.py | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/test/test_empennage.py b/aviary/subsystems/geometry/gasp_based/test/test_empennage.py index d5eb4e813..0d40b291e 100644 --- a/aviary/subsystems/geometry/gasp_based/test/test_empennage.py +++ b/aviary/subsystems/geometry/gasp_based/test/test_empennage.py @@ -48,9 +48,6 @@ def setUp(self): Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION, val=0, units="unitless" ) self.prob.model.set_input_defaults("vvc.cab_w", val=13.1, units="ft") - self.prob.model.set_input_defaults( - Aircraft.Wing.AREA, val=1370.3, units="ft**2" - ) self.prob.model.set_input_defaults("vvc.wing_ref", 117.8054, units="ft") self.prob.setup(check=False, force_alloc_complex=True) @@ -74,7 +71,6 @@ class TestTailComp( def setUp(self): self.prob = om.Problem() self.prob.model.add_subsystem("tail", TailSize(), promotes=["*"]) - self.prob.setup(check=False, force_alloc_complex=True) # values for horizontal tail self.prob.model.set_input_defaults("vol_coef", val=1.189, units="unitless") @@ -85,6 +81,7 @@ def setUp(self): self.prob.model.set_input_defaults("wing_ref", val=12.615, units="ft") self.prob.model.set_input_defaults("ar", val=4.75, units="unitless") self.prob.model.set_input_defaults("tr", val=0.352, units="unitless") + self.prob.setup(check=False, force_alloc_complex=True) def test_large_sinle_aisle_1_htail(self): self.prob.run_model() @@ -100,7 +97,6 @@ def test_large_sinle_aisle_1_htail(self): def test_large_sinle_aisle_1_vtail(self): # override horizontal tail defaults for vertical tail self.prob.set_val("vol_coef", 0.145, units="unitless") - self.prob.set_val(Aircraft.Wing.AREA, 1370.3, units="ft**2") self.prob.set_val("r_arm", 2.362, units="unitless") self.prob.set_val("wing_ref", 117.8, units="ft") self.prob.set_val("ar", 1.67, units="unitless") diff --git a/aviary/subsystems/geometry/gasp_based/test/test_wing.py b/aviary/subsystems/geometry/gasp_based/test/test_wing.py index 0bbd89fbc..64bb9d789 100644 --- a/aviary/subsystems/geometry/gasp_based/test/test_wing.py +++ b/aviary/subsystems/geometry/gasp_based/test/test_wing.py @@ -58,6 +58,15 @@ def tearDown(self): def test_case1(self): self.prob = om.Problem() self.prob.model.add_subsystem("size", WingSize(), promotes=["*"]) + self.prob.model.set_input_defaults( + Mission.Design.GROSS_MASS, 175400, units="lbm" + ) + self.prob.model.set_input_defaults( + Aircraft.Wing.LOADING, 128, units="lbf/ft**2" + ) + self.prob.model.set_input_defaults( + Aircraft.Wing.ASPECT_RATIO, 10.13, units="unitless" + ) self.prob.setup(check=False, force_alloc_complex=True) partial_data = self.prob.check_partials(out_stream=None, method="cs") @@ -579,6 +588,21 @@ def setUp(self): self.prob.model.set_input_defaults( Aircraft.Strut.ATTACHMENT_LOCATION, val=0, units="ft" ) + self.prob.model.set_input_defaults( + Aircraft.Strut.AREA_RATIO, val=.2, units='unitless' + ) + self.prob.model.set_input_defaults( + Aircraft.Fuselage.AVG_DIAMETER, val=10.0, units='ft' + ) + self.prob.model.set_input_defaults( + Mission.Design.GROSS_MASS, val=152000.0, units='lbm' + ) + self.prob.model.set_input_defaults( + Aircraft.Wing.LOADING, 128, units="lbf/ft**2" + ) + self.prob.model.set_input_defaults( + Aircraft.Fuel.WING_FUEL_FRACTION, val=.6, units='unitless' + ) self.prob.setup(check=False, force_alloc_complex=True) From f04b4dc1e036e601727ffac52ea93065651b9bb6 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 13:04:55 -0800 Subject: [PATCH 31/89] set input Aircraft.Wing.AREA to metadata values (0.0) (was 150). Set input Aircraft.Strut.AREA_RATIO to metadata values (0.0) (was .2). Set input to metadata values (0.0). Set input Aircraft.Fuselage.AVG_DIAMETER to metadata values (0.0) (was 10.0). Set outputs Aircraft.Strut.LENGTH, Aircraft.Strut.AREA, and Aircraft.Strut.CHORD to metadata values (0.0). --- aviary/subsystems/geometry/gasp_based/strut.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/strut.py b/aviary/subsystems/geometry/gasp_based/strut.py index c6443cc4d..3fc58043f 100644 --- a/aviary/subsystems/geometry/gasp_based/strut.py +++ b/aviary/subsystems/geometry/gasp_based/strut.py @@ -21,19 +21,17 @@ def initialize(self): def setup(self): - add_aviary_input(self, Aircraft.Wing.AREA, val=150) - add_aviary_input(self, Aircraft.Strut.AREA_RATIO, val=.2) - - add_aviary_input(self, Aircraft.Strut.ATTACHMENT_LOCATION, val=0, units="ft") - - add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER, val=10.0) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Strut.AREA_RATIO) + add_aviary_input(self, Aircraft.Strut.ATTACHMENT_LOCATION) + add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER) self.add_output( "strut_y", val=30, units="ft", desc="YSTRUT: attachment location of strut" ) - add_aviary_output(self, Aircraft.Strut.LENGTH, val=1.0) - add_aviary_output(self, Aircraft.Strut.AREA, val=30) - add_aviary_output(self, Aircraft.Strut.CHORD, val=1.0) + add_aviary_output(self, Aircraft.Strut.LENGTH) + add_aviary_output(self, Aircraft.Strut.AREA) + add_aviary_output(self, Aircraft.Strut.CHORD) def setup_partials(self): From c623bd3d30222b699bb279c4c55f6ba0f9d0302a Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 13:33:25 -0800 Subject: [PATCH 32/89] set input Mission.Design.GROSS_MASS to metadata values (0.0) (was 152000). Set input Aircraft.Wing.LOADING to metadata values (0.0) (was 128). Set input Aircraft.Wing.ASPECT_RATIO to metadata values (0.0) (was 10.13). Set input Aircraft.Wing.AREA to metadata values (0.0) (was 2). Set input Aircraft.Wing.SPAN to metadata values (0.0) (was 2). Set input Aircraft.Wing.TAPER_RATIO to metadata values (0.0) (was 0.33). Set input Aircraft.Wing.SWEEP to metadata values (0.0) (was 25). Set input Aircraft.Wing.THICKNESS_TO_CHORD_ROOT to metadata values (0.0) (was 0.11). Set input Aircraft.Fuselage.AVG_DIAMETER to metadata values (0.0) (was 10). Set input Aircraft.Wing.THICKNESS_TO_CHORD_TIP to metadata values (0.0) (was 0.1). Set input Aircraft.Fuel.WING_FUEL_FRACTION to metadata values (0.0) (was 0.6). Set input Aircraft.Fuel.WING_VOLUME_GEOMETRIC_MAX to metadata values (0.0). Set input Aircraft.Wing.FOLDED_SPAN to metadata values (0.0) (was 25). Set input Aircraft.Wing.AREA to metadata values (0.0) (was 200). Set input Aircraft.Wing.SPAN to metadata values (0.0) (was 118). Set outputs to metadata values (0.0). --- aviary/subsystems/geometry/gasp_based/wing.py | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/wing.py b/aviary/subsystems/geometry/gasp_based/wing.py index 122938c2d..809051474 100644 --- a/aviary/subsystems/geometry/gasp_based/wing.py +++ b/aviary/subsystems/geometry/gasp_based/wing.py @@ -24,12 +24,12 @@ def initialize(self): def setup(self): - add_aviary_input(self, Mission.Design.GROSS_MASS, val=152000) - add_aviary_input(self, Aircraft.Wing.LOADING, val=128) - add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO, val=10.13) + add_aviary_input(self, Mission.Design.GROSS_MASS) + add_aviary_input(self, Aircraft.Wing.LOADING) + add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO) - add_aviary_output(self, Aircraft.Wing.AREA, val=0) - add_aviary_output(self, Aircraft.Wing.SPAN, val=0) + add_aviary_output(self, Aircraft.Wing.AREA) + add_aviary_output(self, Aircraft.Wing.SPAN) self.declare_partials( Aircraft.Wing.AREA, [Mission.Design.GROSS_MASS, Aircraft.Wing.LOADING] @@ -94,19 +94,19 @@ def initialize(self): def setup(self): - add_aviary_input(self, Aircraft.Wing.AREA, val=2) - add_aviary_input(self, Aircraft.Wing.SPAN, val=2) - add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO, val=10.13) - add_aviary_input(self, Aircraft.Wing.TAPER_RATIO, val=0.33) - add_aviary_input(self, Aircraft.Wing.SWEEP, val=25) - add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_ROOT, val=0.11) - add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER, val=10) - add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_TIP, val=0.1) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.SPAN) + add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO) + add_aviary_input(self, Aircraft.Wing.TAPER_RATIO) + add_aviary_input(self, Aircraft.Wing.SWEEP) + add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_ROOT) + add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER) + add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_TIP) if not self.options["aviary_options"].get_val(Aircraft.Wing.HAS_FOLD, units='unitless'): - add_aviary_input(self, Aircraft.Fuel.WING_FUEL_FRACTION, val=0.6) - add_aviary_output(self, Aircraft.Fuel.WING_VOLUME_GEOMETRIC_MAX, val=0) + add_aviary_input(self, Aircraft.Fuel.WING_FUEL_FRACTION) + add_aviary_output(self, Aircraft.Fuel.WING_VOLUME_GEOMETRIC_MAX) self.declare_partials( Aircraft.Fuel.WING_VOLUME_GEOMETRIC_MAX, @@ -122,12 +122,11 @@ def setup(self): ], ) - add_aviary_output(self, Aircraft.Wing.CENTER_CHORD, val=0) - add_aviary_output(self, Aircraft.Wing.AVERAGE_CHORD, val=0) - add_aviary_output(self, Aircraft.Wing.ROOT_CHORD, val=0) - add_aviary_output(self, Aircraft.Wing.THICKNESS_TO_CHORD_UNWEIGHTED, val=0) - add_aviary_output(self, Aircraft.Wing.LEADING_EDGE_SWEEP, - val=0.4763948, units="rad") + add_aviary_output(self, Aircraft.Wing.CENTER_CHORD) + add_aviary_output(self, Aircraft.Wing.AVERAGE_CHORD) + add_aviary_output(self, Aircraft.Wing.ROOT_CHORD) + add_aviary_output(self, Aircraft.Wing.THICKNESS_TO_CHORD_UNWEIGHTED) + add_aviary_output(self, Aircraft.Wing.LEADING_EDGE_SWEEP) self.declare_partials( Aircraft.Wing.CENTER_CHORD, @@ -555,13 +554,13 @@ def setup(self): self.declare_partials(Aircraft.Fuel.WING_VOLUME_GEOMETRIC_MAX, Aircraft.Wing.FOLDED_SPAN) - add_aviary_input(self, Aircraft.Wing.FOLDED_SPAN, val=25, units='ft') + add_aviary_input(self, Aircraft.Wing.FOLDED_SPAN) - add_aviary_input(self, Aircraft.Wing.AREA, val=200) - add_aviary_input(self, Aircraft.Wing.SPAN, val=118) - add_aviary_input(self, Aircraft.Wing.TAPER_RATIO, val=0.33) - add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_ROOT, val=0.11) - add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_TIP, val=0.1) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.SPAN) + add_aviary_input(self, Aircraft.Wing.TAPER_RATIO) + add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_ROOT) + add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_TIP) add_aviary_input(self, Aircraft.Fuel.WING_FUEL_FRACTION, val=0.6) self.add_output( From 414bb7a7d24416fdac85305369bf2cc595a34102 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 14:27:41 -0800 Subject: [PATCH 33/89] set values when val is None in add_aviary_input/add_aviary_output. --- aviary/variable_info/functions.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/aviary/variable_info/functions.py b/aviary/variable_info/functions.py index 8c28147a0..a214a2e13 100644 --- a/aviary/variable_info/functions.py +++ b/aviary/variable_info/functions.py @@ -1,4 +1,5 @@ import dymos as dm +import numpy as np import openmdao.api as om from dymos.utils.misc import _unspecified from openmdao.core.component import Component @@ -33,12 +34,21 @@ def add_aviary_input(comp, varname, val=None, units=None, desc=None, shape_by_co else: input_desc = meta['desc'] if val is None: - val = meta['default_value'] + if shape is None: + val = meta['default_value'] + if val is None: + val = 0.0 + else: + val = meta['default_value'] + if val is None: + val = np.zeros(shape) + else: + val = np.ones(shape) * val comp.add_input(varname, val=val, units=input_units, desc=input_desc, shape_by_conn=shape_by_conn, shape=shape) -def add_aviary_output(comp, varname, val, units=None, desc=None, shape_by_conn=False, meta_data=_MetaData): +def add_aviary_output(comp, varname, val=None, units=None, desc=None, shape_by_conn=False, meta_data=_MetaData, shape=None): ''' This function provides a clean way to add variables from the variable hierarchy into components as Aviary outputs. It takes @@ -58,6 +68,17 @@ def add_aviary_output(comp, varname, val, units=None, desc=None, shape_by_conn=F output_desc = desc else: output_desc = meta['desc'] + if val is None: + if shape is None: + val = meta['default_value'] + if val is None: + val = 0.0 + else: + val = meta['default_value'] + if val is None: + val = np.zeros(shape) + else: + val = np.ones(shape) * val comp.add_output(varname, val=val, units=output_units, desc=output_desc, shape_by_conn=shape_by_conn) From f8f9b46594a8782b4d1c0f4959c89f4aa8390d42 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 14:31:56 -0800 Subject: [PATCH 34/89] set default_values for geometry subsystem. --- aviary/variable_info/variable_meta_data.py | 82 ++++++++++++++++------ 1 file changed, 59 insertions(+), 23 deletions(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index 6ef0e83de..8acf45fe1 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -418,7 +418,7 @@ }, units='unitless', desc='canard theoretical aspect ratio', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -434,6 +434,7 @@ }, units='ft', desc='Reynolds characteristic length for the canard', + default_value=0.0, # added ) add_meta_data( @@ -449,6 +450,7 @@ }, units='unitless', desc='canard fineness ratio', + default_value=0.0, # added ) add_meta_data( @@ -553,7 +555,7 @@ }, units='ft**2', desc='canard wetted area', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -1574,6 +1576,7 @@ }, units='ft**2', desc='total aircraft wetted area', + default_value=0.0, # added ) add_meta_data( @@ -1697,6 +1700,7 @@ historical_name={"GASP": 'INGASP.LCABLE', "FLOPS": None, "LEAPS1": None}, units='ft', desc='length of cable for hybrid electric augmented system', + default_value=0.0, # added ) add_meta_data( @@ -2127,7 +2131,7 @@ historical_name={"GASP": 'INGASP.DIAM_REF', "FLOPS": None, "LEAPS1": None}, units='ft', desc='engine reference diameter', - default_value=0.0, + default_value=0.0, # In geometry/gasp_based/engine.py, it was 5.8 ) # NOTE This unscaled turbine (engine) weight is an input provided by the user, and is not @@ -2331,7 +2335,7 @@ units='unitless', desc='Engine wing mount locations as fractions of semispan; (NUM_WING_ENGINES)/2 values ' 'are input', - default_value=np.array([0.0]), + default_value=np.array([0.0]), # In mass/gasp_based/fixed.py and geometry/gasp_based/electric.py, default was [0.35] ) # ___ _ @@ -2848,6 +2852,7 @@ historical_name={"GASP": 'INGASP.SKWF', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='fraction of total theoretical wing volume used for wing fuel', + default_value=0.0, # added. In geometry/gasp_based/wing.py, it was 0.6. In /mass/gasp_based/equipment_and_useful_load.py, it was 0.5. ) add_meta_data( @@ -2930,6 +2935,7 @@ historical_name={"GASP": 'INGASP.FVOLW_GEOM', "FLOPS": None, "LEAPS1": None}, units='ft**3', desc='wing tank fuel volume based on geometry', + default_value=0.0, # added ) add_meta_data( @@ -3025,6 +3031,7 @@ }, units='ft', desc='average fuselage diameter', + default_value=0.0, # added. In several components, it was set to 10 or 13.1. ) add_meta_data( @@ -3040,6 +3047,7 @@ }, units='ft', desc='Reynolds characteristic length for the fuselage', + default_value=0.0, # added ) add_meta_data( @@ -3060,7 +3068,7 @@ historical_name={"GASP": 'INGASP.HCK', "FLOPS": None, "LEAPS1": None}, units='ft', desc='mean fuselage cabin diameter minus mean fuselage nose diameter', - default_value=4.5, + default_value=0.0, # In geometry/gasp_based/fuselage.py, it was 4.5. ) add_meta_data( @@ -3088,6 +3096,7 @@ }, units='unitless', desc='fuselage fineness ratio', + default_value=0.0, # added ) add_meta_data( @@ -3156,7 +3165,7 @@ desc='Define the Fuselage total length. If total_length is not input for a ' 'passenger transport, LEAPS will calculate the fuselage length, width and ' 'depth and the length of the passenger compartment.', - default_value=0.0, + default_value=0.0, # in several components, it was set to 129.4 or 200. ) add_meta_data( @@ -3222,6 +3231,7 @@ }, units='ft', desc='maximum fuselage height', + default_value=0.0, # added ) add_meta_data( @@ -3339,6 +3349,7 @@ historical_name={"GASP": 'INGASP.ELPC', "FLOPS": None, "LEAPS1": None}, units='ft', desc='length of the pilot compartment', + default_value=0.0, # added. # In geometry/gasp_based/fuselage.py, it was 9.5 ) add_meta_data( @@ -3351,6 +3362,7 @@ }, units='ft**2', desc='fuselage planform area', + default_value=0.0, # added ) add_meta_data( @@ -3408,7 +3420,7 @@ }, units='ft**2', desc='fuselage wetted area', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -3459,7 +3471,7 @@ }, units='unitless', desc='horizontal tail theoretical aspect ratio', - default_value=None, + default_value=4.75, # changed from None ) add_meta_data( @@ -3483,6 +3495,7 @@ }, units='ft', desc='Reynolds characteristic length for the horizontal tail', + default_value=0.0, # added ) add_meta_data( @@ -3498,6 +3511,7 @@ }, units='unitless', desc='horizontal tail fineness ratio', + default_value=0.0, # added ) add_meta_data( @@ -3633,7 +3647,7 @@ }, units='unitless', desc='horizontal tail theoretical taper ratio', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -3663,7 +3677,7 @@ 'tail is mounted. Defaults: 0.0 == for body mounted (default for ' 'transport with all engines on wing); 1.0 == for T tail ' '(default for transport with multiple engines on fuselage)', - default_value=None, + default_value=0.0, # added ) add_meta_data( @@ -3691,7 +3705,7 @@ }, units='ft**2', desc='horizontal tail wetted area', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -4046,6 +4060,7 @@ }, units='ft', desc='Average diameter of engine nacelles for each engine model', + default_value=0.0, # added ) add_meta_data( @@ -4060,6 +4075,7 @@ }, units='ft', desc='Average length of nacelles for each engine model', + default_value=0.0, # added ) add_meta_data( @@ -4075,6 +4091,7 @@ }, units='ft', desc='Reynolds characteristic length for nacelle for each engine model', + default_value=0.0, # added ) add_meta_data( @@ -4092,7 +4109,7 @@ historical_name={"GASP": 'INGASP.DNQDE', "FLOPS": None, "LEAPS1": None}, units="unitless", desc='ratio of nacelle diameter to engine core diameter', - default_value=1.25, + default_value=1.25, # In geometry/gasp_based/engine.py, it was 1.25 ) add_meta_data( @@ -4108,6 +4125,7 @@ }, units='unitless', desc='nacelle fineness ratio', + default_value=0.0, # added. # In geometry/gasp_based/engine.py, it was 2. ) add_meta_data( @@ -4205,6 +4223,7 @@ }, units='ft**2', desc='total nacelles wetted area', + default_value=0.0, # added ) add_meta_data( @@ -4220,6 +4239,7 @@ }, units='ft**2', desc='wetted area of a single nacelle for each engine model', + default_value=0.0, # added ) add_meta_data( @@ -4478,6 +4498,7 @@ historical_name={"GASP": 'INGASP.SSTQSW', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='ratio of strut area to wing area', + default_value=0.0, # added. In geometry/gasp_based/strut.py, it was set to .2. ) add_meta_data( @@ -4490,6 +4511,7 @@ }, units='ft', desc='attachment location of strut the full attachment-to-attachment span', + default_value=0.0, # added ) # related to Aircraft.Strut.ATTACHMENT_LOCATION @@ -4499,6 +4521,7 @@ historical_name={"GASP": None, "FLOPS": None, "LEAPS1": None}, units='unitless', desc='attachment location of strut as fraction of the half-span', + default_value=0.0, # added ) add_meta_data( @@ -4507,6 +4530,7 @@ historical_name={"GASP": 'INGASP.STRTCHD', "FLOPS": None, "LEAPS1": None}, units='ft', desc='chord of the strut', + default_value=0.0, # added ) add_meta_data( @@ -4624,7 +4648,7 @@ }, units='unitless', desc='vertical tail theoretical aspect ratio', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -4648,6 +4672,7 @@ }, units='ft', desc='Reynolds characteristic length for the vertical tail', + default_value=0.0, # added ) add_meta_data( @@ -4663,6 +4688,7 @@ }, units='unitless', desc='vertical tail fineness ratio', + default_value=0.0, # added ) add_meta_data( @@ -4813,7 +4839,7 @@ }, units='unitless', desc='vertical tail theoretical taper ratio', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -4856,7 +4882,7 @@ }, units='ft**2', desc='vertical tails wetted area', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -4945,7 +4971,7 @@ }, units='ft**2', desc='reference wing area', - default_value=0.0, + default_value=0.0, # In several components, it was set to 100, 150, 200, 1370.3 or other values. ) add_meta_data( @@ -4971,7 +4997,7 @@ }, units='unitless', desc='ratio of the wing span to its mean chord', - default_value=0.0, + default_value=0.0, # in several components, it was 1 or 10.13. ) add_meta_data( @@ -4992,6 +5018,7 @@ historical_name={"GASP": 'INGASP.CBARW', "FLOPS": None, "LEAPS1": None}, units='ft', desc='mean aerodynamic chord of the wing', + default_value=0.0, # added ) add_meta_data( @@ -5068,6 +5095,7 @@ historical_name={"GASP": 'INGASP.CRCLW', "FLOPS": None, "LEAPS1": None}, units='ft', desc='wing chord at fuselage centerline', + default_value=0.0, # added ) add_meta_data( @@ -5092,6 +5120,7 @@ }, units='ft', desc='Reynolds characteristic length for the wing', + default_value=0.0, # added ) add_meta_data( @@ -5223,6 +5252,7 @@ }, units='unitless', desc='wing fineness ratio', + default_value=0.0, # added ) add_meta_data( @@ -5323,7 +5353,7 @@ historical_name={"GASP": 'INGASP.YWFOLD', "FLOPS": None, "LEAPS1": None}, units='ft', desc='folded wingspan', - default_value=118, + default_value=0, # In geometry/gasp_based/non_dimensional_conversion.py and geometry/gasp_based/wing.py, it was 25. ) add_meta_data( @@ -5482,6 +5512,7 @@ historical_name={"GASP": 'INGASP.SWPLE', "FLOPS": None, "LEAPS1": None}, units='rad', desc='sweep angle at leading edge of wing', + default_value=0.0, # added ) add_meta_data( @@ -5536,6 +5567,7 @@ }, units='lbf/ft**2', desc='wing loading', + default_value=0.0, # added. In several components, it was 128. ) add_meta_data( @@ -5752,6 +5784,7 @@ }, units='ft', desc='wing chord length at wing root', + default_value=0.0, # added ) add_meta_data( @@ -5827,7 +5860,7 @@ }, units='ft', desc='span of main wing', - default_value=0.0, + default_value=0.0, # in several components, it was set to 128, or 117.8 but there are other values. ) add_meta_data( @@ -5941,7 +5974,7 @@ }, units='deg', desc='quarter-chord sweep angle of the wing', - default_value=0.0, # TODO required + default_value=0.0, # TODO required. In several components, it was 0.436 (rad) or 25 (deg). ) add_meta_data( @@ -5966,7 +5999,7 @@ }, units='unitless', desc='taper ratio of the wing', - default_value=0.0, # TODO required + default_value=0.0, # TODO required. In several components, it was .33. ) add_meta_data( @@ -6027,6 +6060,7 @@ historical_name={"GASP": 'INGASP.TCR', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='thickness-to-chord ratio at the root of the wing', + default_value=0.0, # added. In several components, it was 0.11 or 0.15. ) add_meta_data( @@ -6035,6 +6069,7 @@ historical_name={"GASP": 'INGASP.TCT', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='thickness-to-chord ratio at the tip of the wing', + default_value=0.0, # added. In geometry/gasp_based/wing.py, it was 0.1 ) add_meta_data( @@ -6043,6 +6078,7 @@ historical_name={"GASP": 'INGASP.TC', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='wing thickness-chord ratio at the wing station of the mean aerodynamic chord', + default_value=0.0, # added. In geometry/gasp_based/wing.py, it was 0.1. ) add_meta_data( @@ -6090,7 +6126,7 @@ }, units='ft**2', desc='wing wetted area', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -6733,7 +6769,7 @@ }, units='lbm', desc='design gross mass of the aircraft', - default_value=None, + default_value=0.0, # changed form None. In several components, it was set to 20000, 152000 or 175400. ) add_meta_data( From 25268f049c81868859be7f62db0c9792215dd545 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 14:46:00 -0800 Subject: [PATCH 35/89] autopep8 --- aviary/variable_info/variable_meta_data.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index 8acf45fe1..5f15937c6 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -2335,7 +2335,8 @@ units='unitless', desc='Engine wing mount locations as fractions of semispan; (NUM_WING_ENGINES)/2 values ' 'are input', - default_value=np.array([0.0]), # In mass/gasp_based/fixed.py and geometry/gasp_based/electric.py, default was [0.35] + # In mass/gasp_based/fixed.py and geometry/gasp_based/electric.py, default was [0.35] + default_value=np.array([0.0]), ) # ___ _ @@ -2852,7 +2853,8 @@ historical_name={"GASP": 'INGASP.SKWF', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='fraction of total theoretical wing volume used for wing fuel', - default_value=0.0, # added. In geometry/gasp_based/wing.py, it was 0.6. In /mass/gasp_based/equipment_and_useful_load.py, it was 0.5. + # added. In geometry/gasp_based/wing.py, it was 0.6. In /mass/gasp_based/equipment_and_useful_load.py, it was 0.5. + default_value=0.0, ) add_meta_data( @@ -3068,7 +3070,7 @@ historical_name={"GASP": 'INGASP.HCK', "FLOPS": None, "LEAPS1": None}, units='ft', desc='mean fuselage cabin diameter minus mean fuselage nose diameter', - default_value=0.0, # In geometry/gasp_based/fuselage.py, it was 4.5. + default_value=0.0, # In geometry/gasp_based/fuselage.py, it was 4.5. ) add_meta_data( @@ -4971,7 +4973,7 @@ }, units='ft**2', desc='reference wing area', - default_value=0.0, # In several components, it was set to 100, 150, 200, 1370.3 or other values. + default_value=0.0, # In several components, it was set to 100, 150, 200, 1370.3 etc. ) add_meta_data( @@ -5353,7 +5355,8 @@ historical_name={"GASP": 'INGASP.YWFOLD', "FLOPS": None, "LEAPS1": None}, units='ft', desc='folded wingspan', - default_value=0, # In geometry/gasp_based/non_dimensional_conversion.py and geometry/gasp_based/wing.py, it was 25. + # In geometry/gasp_based/non_dimensional_conversion.py and geometry/gasp_based/wing.py, it was 25. + default_value=0, ) add_meta_data( @@ -5860,7 +5863,8 @@ }, units='ft', desc='span of main wing', - default_value=0.0, # in several components, it was set to 128, or 117.8 but there are other values. + # in several components, it was set to 128, or 117.8 but there are other values. + default_value=0.0, ) add_meta_data( @@ -5974,7 +5978,8 @@ }, units='deg', desc='quarter-chord sweep angle of the wing', - default_value=0.0, # TODO required. In several components, it was 0.436 (rad) or 25 (deg). + # In several components, it was 0.436 (rad) or 25 (deg). + default_value=0.0, # TODO required. ) add_meta_data( @@ -6769,7 +6774,8 @@ }, units='lbm', desc='design gross mass of the aircraft', - default_value=0.0, # changed form None. In several components, it was set to 20000, 152000 or 175400. + # changed form None. In several components, it was set to 20000, 152000 or 175400. + default_value=0.0, ) add_meta_data( From 9e79199ebd3edbf396b0122cad817270049f1ab2 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 14:46:56 -0800 Subject: [PATCH 36/89] autopep8 --- aviary/subsystems/geometry/flops_based/nacelle.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aviary/subsystems/geometry/flops_based/nacelle.py b/aviary/subsystems/geometry/flops_based/nacelle.py index e40fe74e6..010949f9d 100644 --- a/aviary/subsystems/geometry/flops_based/nacelle.py +++ b/aviary/subsystems/geometry/flops_based/nacelle.py @@ -24,7 +24,8 @@ def setup(self): Aircraft.Engine.NUM_ENGINES)) add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, shape=num_engine_type) add_aviary_input(self, Aircraft.Nacelle.AVG_LENGTH, shape=num_engine_type) - add_aviary_input(self, Aircraft.Nacelle.WETTED_AREA_SCALER, shape=num_engine_type) + add_aviary_input(self, Aircraft.Nacelle.WETTED_AREA_SCALER, + shape=num_engine_type) add_aviary_output(self, Aircraft.Nacelle.TOTAL_WETTED_AREA) add_aviary_output(self, Aircraft.Nacelle.WETTED_AREA, shape=num_engine_type) From faaa1bab991c617c6d7e17190c5bd2dc66833930 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 30 Dec 2024 17:15:26 -0800 Subject: [PATCH 37/89] minor updates --- .../geometry/gasp_based/empennage.py | 16 +++--------- .../geometry/gasp_based/fuselage.py | 1 - .../subsystems/geometry/gasp_based/strut.py | 1 - aviary/subsystems/geometry/gasp_based/wing.py | 26 ++++--------------- .../subsystems/mass/gasp_based/design_load.py | 15 +++-------- 5 files changed, 11 insertions(+), 48 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index 71a5d5f1e..6fd2b9d11 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -46,11 +46,7 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.AREA) - self.add_input( - "wing_ref", - 12.615, - units="ft", - desc=( + self.add_input("wing_ref", 12.615, units="ft", desc=( "CBARW | B: Wing reference parameter. Wing chord for a " "horizontal tail. Wing span for a vertical tail." ), @@ -109,20 +105,14 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.AREA) - self.add_input( - "r_arm", - 0.2307, - units="unitless", + self.add_input("r_arm", 0.2307, units="unitless", desc=( "COELTH | BOELTV: For a horizontal tail, the ratio of " "wing chord to tail moment arm. For a vertical tail, the " "ratio of wing span to vertical tail moment arm." ), ) - self.add_input( - "wing_ref", - 12.615, - units="ft", + self.add_input("wing_ref", 12.615, units="ft", desc=( "CBARW | B: Reference wing parameter for tail moment arm. " "For a horizontal tail, the mean wing chord. For a " diff --git a/aviary/subsystems/geometry/gasp_based/fuselage.py b/aviary/subsystems/geometry/gasp_based/fuselage.py index 051099bba..1239b431c 100644 --- a/aviary/subsystems/geometry/gasp_based/fuselage.py +++ b/aviary/subsystems/geometry/gasp_based/fuselage.py @@ -117,7 +117,6 @@ def initialize(self): ) def setup(self): - add_aviary_input(self, Aircraft.Fuselage.NOSE_FINENESS, val=1) self.add_input("nose_height", val=0, units="ft", desc="HN: height of nose") add_aviary_input(self, Aircraft.Fuselage.PILOT_COMPARTMENT_LENGTH, val=9.5) diff --git a/aviary/subsystems/geometry/gasp_based/strut.py b/aviary/subsystems/geometry/gasp_based/strut.py index 3fc58043f..5fac67f92 100644 --- a/aviary/subsystems/geometry/gasp_based/strut.py +++ b/aviary/subsystems/geometry/gasp_based/strut.py @@ -20,7 +20,6 @@ def initialize(self): ) def setup(self): - add_aviary_input(self, Aircraft.Wing.AREA) add_aviary_input(self, Aircraft.Strut.AREA_RATIO) add_aviary_input(self, Aircraft.Strut.ATTACHMENT_LOCATION) diff --git a/aviary/subsystems/geometry/gasp_based/wing.py b/aviary/subsystems/geometry/gasp_based/wing.py index 809051474..cb79f2755 100644 --- a/aviary/subsystems/geometry/gasp_based/wing.py +++ b/aviary/subsystems/geometry/gasp_based/wing.py @@ -529,12 +529,8 @@ def initialize(self): ) def setup(self): - if not self.options["aviary_options"].get_val(Aircraft.Wing.CHOOSE_FOLD_LOCATION, units='unitless'): - self.add_input( - "strut_y", - val=25, - units="ft", + self.add_input("strut_y", val=25, units="ft", desc="YSTRUT: attachment location of strut", ) @@ -563,31 +559,19 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_TIP) add_aviary_input(self, Aircraft.Fuel.WING_FUEL_FRACTION, val=0.6) - self.add_output( - "nonfolded_taper_ratio", - val=0.1, - units="unitless", + self.add_output("nonfolded_taper_ratio", val=0.1, units="unitless", desc="SLM_NF: taper ratio between wing root and fold location", ) add_aviary_output(self, Aircraft.Wing.FOLDING_AREA, val=50) - self.add_output( - "nonfolded_wing_area", - val=150, - units="ft**2", + self.add_output("nonfolded_wing_area", val=150, units="ft**2", desc="SW_NF: wing area of part of wings that does not fold", ) - self.add_output( - "tc_ratio_mean_folded", - val=0.12, - units="unitless", + self.add_output("tc_ratio_mean_folded", val=0.12, units="unitless", desc="TCM: mean value of thickess to chord ratio between root and fold", ) - self.add_output( - "nonfolded_AR", - val=10, - units="unitless", + self.add_output("nonfolded_AR", val=10, units="unitless", desc="AR_NF: aspect ratio of non-folding part of wing", ) diff --git a/aviary/subsystems/mass/gasp_based/design_load.py b/aviary/subsystems/mass/gasp_based/design_load.py index d88a41ea2..a80e482f1 100644 --- a/aviary/subsystems/mass/gasp_based/design_load.py +++ b/aviary/subsystems/mass/gasp_based/design_load.py @@ -41,23 +41,14 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.LOADING, val=128) - self.add_output( - "max_airspeed", - val=0, - units="kn", + self.add_output("max_airspeed", val=0, units="kn", desc="VM0: maximum operating equivalent airspeed", ) - self.add_output( - "vel_c", - val=0, - units="kn", + self.add_output("vel_c", val=0, units="kn", desc="VGC: Velocity used in Gust Load Factor calculation at cruise conditions.\ This is Minimum Design Cruise Speed for Part 23 aircraft and VM0 for Part 25 aircraft", ) - self.add_output( - "max_maneuver_factor", - val=0, - units="unitless", + self.add_output("max_maneuver_factor", val=0, units="unitless", desc="EMLF: maximum maneuver load factor, units are in g`s", ) self.add_output("min_dive_vel", val=0, units="kn", desc="VDMIN: dive velocity") From eac7d8a48d0a0f0058827426c9022c74e5112438 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 08:32:01 -0800 Subject: [PATCH 38/89] Replace self.add_output(Aircraft.Fuel.AUXILIARY_FUEL_CAPACITY) by add_aviary_output(self, Aircraft.Fuel.AUXILIARY_FUEL_CAPACITY) --- aviary/subsystems/mass/gasp_based/fuel.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/aviary/subsystems/mass/gasp_based/fuel.py b/aviary/subsystems/mass/gasp_based/fuel.py index b9b973fc9..2b1a94708 100644 --- a/aviary/subsystems/mass/gasp_based/fuel.py +++ b/aviary/subsystems/mass/gasp_based/fuel.py @@ -58,12 +58,12 @@ def setup(self): add_aviary_input(self, Mission.Design.FUEL_MASS, val=3000) add_aviary_input(self, Aircraft.Design.OPERATING_MASS, val=94417) - self.add_output( - Aircraft.Fuel.AUXILIARY_FUEL_CAPACITY, - val=0, - units="lbm", - desc="WFXTRA: extra amount of fuel that is required but does not fit in wings", - ) + add_aviary_output(self, Aircraft.Fuel.AUXILIARY_FUEL_CAPACITY, val=0, + desc="WFXTRA: extra amount of fuel that is required but does not fit in wings") + # self.add_output( + # Aircraft.Fuel.AUXILIARY_FUEL_CAPACITY, val=0, units="lbm", + # desc="WFXTRA: extra amount of fuel that is required but does not fit in wings", + # ) self.add_output( "extra_fuel_volume", val=0, From 0b36676e3bb25bcd22aca9a6ab59932740b38a78 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 08:37:47 -0800 Subject: [PATCH 39/89] autopep8 --- aviary/subsystems/mass/gasp_based/design_load.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/aviary/subsystems/mass/gasp_based/design_load.py b/aviary/subsystems/mass/gasp_based/design_load.py index a80e482f1..b18353c21 100644 --- a/aviary/subsystems/mass/gasp_based/design_load.py +++ b/aviary/subsystems/mass/gasp_based/design_load.py @@ -42,15 +42,15 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.LOADING, val=128) self.add_output("max_airspeed", val=0, units="kn", - desc="VM0: maximum operating equivalent airspeed", - ) + desc="VM0: maximum operating equivalent airspeed", + ) self.add_output("vel_c", val=0, units="kn", - desc="VGC: Velocity used in Gust Load Factor calculation at cruise conditions.\ - This is Minimum Design Cruise Speed for Part 23 aircraft and VM0 for Part 25 aircraft", - ) + desc="VGC: Velocity used in Gust Load Factor calculation at cruise conditions.\ + This is Minimum Design Cruise Speed for Part 23 aircraft and VM0 for Part 25 aircraft", + ) self.add_output("max_maneuver_factor", val=0, units="unitless", - desc="EMLF: maximum maneuver load factor, units are in g`s", - ) + desc="EMLF: maximum maneuver load factor, units are in g`s", + ) self.add_output("min_dive_vel", val=0, units="kn", desc="VDMIN: dive velocity") self.declare_partials("*", "*") From 2fda6d7a4a6aaa42e5293931b3f6eacf0cabd514 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 08:46:49 -0800 Subject: [PATCH 40/89] autopep8 --- .../geometry/gasp_based/empennage.py | 27 ++++++++----------- aviary/subsystems/geometry/gasp_based/wing.py | 20 +++++++------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index 6fd2b9d11..b8f68746e 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -47,10 +47,9 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.AREA) self.add_input("wing_ref", 12.615, units="ft", desc=( - "CBARW | B: Wing reference parameter. Wing chord for a " - "horizontal tail. Wing span for a vertical tail." - ), - ) + "CBARW | B: Wing reference parameter. Wing chord for a " + "horizontal tail. Wing span for a vertical tail."), + ) self.add_output( "vol_coef", units="unitless", desc="VBARH | VBARV: Tail volume coefficient") @@ -106,19 +105,15 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.AREA) self.add_input("r_arm", 0.2307, units="unitless", - desc=( - "COELTH | BOELTV: For a horizontal tail, the ratio of " - "wing chord to tail moment arm. For a vertical tail, the " - "ratio of wing span to vertical tail moment arm." - ), - ) + desc=("COELTH | BOELTV: For a horizontal tail, the ratio of " + "wing chord to tail moment arm. For a vertical tail, the " + "ratio of wing span to vertical tail moment arm."), + ) self.add_input("wing_ref", 12.615, units="ft", - desc=( - "CBARW | B: Reference wing parameter for tail moment arm. " - "For a horizontal tail, the mean wing chord. For a " - "vertical tail, the wing span." - ), - ) + desc=("CBARW | B: Reference wing parameter for tail moment arm. " + "For a horizontal tail, the mean wing chord. For a " + "vertical tail, the wing span."), + ) self.add_input( "ar", 4.75, units="unitless", desc="ARHT | ARVT: Tail aspect ratio.") self.add_input( diff --git a/aviary/subsystems/geometry/gasp_based/wing.py b/aviary/subsystems/geometry/gasp_based/wing.py index cb79f2755..5b0058c79 100644 --- a/aviary/subsystems/geometry/gasp_based/wing.py +++ b/aviary/subsystems/geometry/gasp_based/wing.py @@ -531,8 +531,8 @@ def initialize(self): def setup(self): if not self.options["aviary_options"].get_val(Aircraft.Wing.CHOOSE_FOLD_LOCATION, units='unitless'): self.add_input("strut_y", val=25, units="ft", - desc="YSTRUT: attachment location of strut", - ) + desc="YSTRUT: attachment location of strut", + ) self.declare_partials("nonfolded_taper_ratio", "strut_y") self.declare_partials(Aircraft.Wing.FOLDING_AREA, "strut_y") @@ -560,20 +560,20 @@ def setup(self): add_aviary_input(self, Aircraft.Fuel.WING_FUEL_FRACTION, val=0.6) self.add_output("nonfolded_taper_ratio", val=0.1, units="unitless", - desc="SLM_NF: taper ratio between wing root and fold location", - ) + desc="SLM_NF: taper ratio between wing root and fold location", + ) add_aviary_output(self, Aircraft.Wing.FOLDING_AREA, val=50) self.add_output("nonfolded_wing_area", val=150, units="ft**2", - desc="SW_NF: wing area of part of wings that does not fold", - ) + desc="SW_NF: wing area of part of wings that does not fold", + ) self.add_output("tc_ratio_mean_folded", val=0.12, units="unitless", - desc="TCM: mean value of thickess to chord ratio between root and fold", - ) + desc="TCM: mean value of thickess to chord ratio between root and fold", + ) self.add_output("nonfolded_AR", val=10, units="unitless", - desc="AR_NF: aspect ratio of non-folding part of wing", - ) + desc="AR_NF: aspect ratio of non-folding part of wing", + ) add_aviary_output(self, Aircraft.Fuel.WING_VOLUME_GEOMETRIC_MAX, val=0) From f44f6c348f126916a08554a8711c056080f69813 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 09:18:57 -0800 Subject: [PATCH 41/89] set Aircraft.HorizontalTail.TAPER_RATIO = 0 in prep_geom.py and set tr = 0 in empennage.py --- aviary/subsystems/geometry/flops_based/prep_geom.py | 2 +- aviary/subsystems/geometry/gasp_based/empennage.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aviary/subsystems/geometry/flops_based/prep_geom.py b/aviary/subsystems/geometry/flops_based/prep_geom.py index 896ac70b7..260ba3aeb 100644 --- a/aviary/subsystems/geometry/flops_based/prep_geom.py +++ b/aviary/subsystems/geometry/flops_based/prep_geom.py @@ -129,7 +129,7 @@ def setup(self): add_aviary_input(self, Aircraft.HorizontalTail.AREA) add_aviary_input(self, Aircraft.HorizontalTail.ASPECT_RATIO) - add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO, 0.352) + add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO) add_aviary_input(self, Aircraft.HorizontalTail.THICKNESS_TO_CHORD) add_aviary_input(self, Aircraft.VerticalTail.AREA) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index b8f68746e..36470e3bf 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -117,7 +117,7 @@ def setup(self): self.add_input( "ar", 4.75, units="unitless", desc="ARHT | ARVT: Tail aspect ratio.") self.add_input( - "tr", 0.352, units="unitless", desc="SLMH | SLMV: Tail taper ratio.") + "tr", 0.0, units="unitless", desc="SLMH | SLMV: Tail taper ratio.") self.add_output("area", units="ft**2", desc="SHT | SVT: Tail area") self.add_output("span", units="ft", desc="BHT | BVT: Tail span") From 638318c13f2c72bc61703148e49227c9c8479ac0 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 09:20:44 -0800 Subject: [PATCH 42/89] autopep8 --- aviary/subsystems/geometry/flops_based/prep_geom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/subsystems/geometry/flops_based/prep_geom.py b/aviary/subsystems/geometry/flops_based/prep_geom.py index 260ba3aeb..d06e33c33 100644 --- a/aviary/subsystems/geometry/flops_based/prep_geom.py +++ b/aviary/subsystems/geometry/flops_based/prep_geom.py @@ -129,7 +129,7 @@ def setup(self): add_aviary_input(self, Aircraft.HorizontalTail.AREA) add_aviary_input(self, Aircraft.HorizontalTail.ASPECT_RATIO) - add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO) + add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO) add_aviary_input(self, Aircraft.HorizontalTail.THICKNESS_TO_CHORD) add_aviary_input(self, Aircraft.VerticalTail.AREA) From 37f846388e0d632dec94b852c19300b38850c855 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 10:54:42 -0800 Subject: [PATCH 43/89] update a comment. --- aviary/variable_info/variable_meta_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index 5f15937c6..ee8de1af7 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -3649,7 +3649,7 @@ }, units='unitless', desc='horizontal tail theoretical taper ratio', - default_value=0.0, # changed from None + default_value=0.0, # changed from None. In geometry/flops_based/prep_geom.py and mass/gasp_based/empennage.py, it was 0.352. ) add_meta_data( From 38fd95e2862863b19dfa002b37a2418e9a37431b Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 10:55:30 -0800 Subject: [PATCH 44/89] set Aircraft.HorizontalTail.TAPER_RATIO = 0.352 in unit test. --- aviary/subsystems/geometry/gasp_based/test/test_size_group.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aviary/subsystems/geometry/gasp_based/test/test_size_group.py b/aviary/subsystems/geometry/gasp_based/test/test_size_group.py index dc7c1bb1f..2d6aaa732 100644 --- a/aviary/subsystems/geometry/gasp_based/test/test_size_group.py +++ b/aviary/subsystems/geometry/gasp_based/test/test_size_group.py @@ -243,6 +243,9 @@ def setUp(self): self.prob.model.set_input_defaults( Aircraft.HorizontalTail.MOMENT_RATIO, val=0.2307, units="unitless" ) + self.prob.model.set_input_defaults( + Aircraft.HorizontalTail.TAPER_RATIO, val=0.352, units="unitless" + ) self.prob.model.set_input_defaults( Aircraft.VerticalTail.MOMENT_RATIO, 2.362, units="unitless") self.prob.model.set_input_defaults( From f5955fcd74545cd04110b711b18459ce6ccc00dc Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 10:57:02 -0800 Subject: [PATCH 45/89] roll back Aircraft.HorizontalTail.TAPER_RATIO = 0.352 for now. --- aviary/subsystems/geometry/flops_based/prep_geom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/subsystems/geometry/flops_based/prep_geom.py b/aviary/subsystems/geometry/flops_based/prep_geom.py index d06e33c33..896ac70b7 100644 --- a/aviary/subsystems/geometry/flops_based/prep_geom.py +++ b/aviary/subsystems/geometry/flops_based/prep_geom.py @@ -129,7 +129,7 @@ def setup(self): add_aviary_input(self, Aircraft.HorizontalTail.AREA) add_aviary_input(self, Aircraft.HorizontalTail.ASPECT_RATIO) - add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO) + add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO, 0.352) add_aviary_input(self, Aircraft.HorizontalTail.THICKNESS_TO_CHORD) add_aviary_input(self, Aircraft.VerticalTail.AREA) From 65e81497f18c175f845ac48147236b652feebe81 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 10:58:14 -0800 Subject: [PATCH 46/89] roll back tr = 0.352 in empennage.py --- aviary/subsystems/geometry/gasp_based/empennage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index 36470e3bf..b8f68746e 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -117,7 +117,7 @@ def setup(self): self.add_input( "ar", 4.75, units="unitless", desc="ARHT | ARVT: Tail aspect ratio.") self.add_input( - "tr", 0.0, units="unitless", desc="SLMH | SLMV: Tail taper ratio.") + "tr", 0.352, units="unitless", desc="SLMH | SLMV: Tail taper ratio.") self.add_output("area", units="ft**2", desc="SHT | SVT: Tail area") self.add_output("span", units="ft", desc="BHT | BVT: Tail span") From 3f70dc09781b42e2ad0eb4005366ca391a5e0bb4 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 11:14:13 -0800 Subject: [PATCH 47/89] autopep8 --- aviary/variable_info/variable_meta_data.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index ee8de1af7..222ec9e3a 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -3649,7 +3649,8 @@ }, units='unitless', desc='horizontal tail theoretical taper ratio', - default_value=0.0, # changed from None. In geometry/flops_based/prep_geom.py and mass/gasp_based/empennage.py, it was 0.352. + # In geometry/flops_based/prep_geom.py and mass/gasp_based/empennage.py, it was 0.352. + default_value=0.0, # changed from None. ) add_meta_data( From b35ef64f61dbf1702c9860c9923d608d6b12f401 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 13:52:37 -0800 Subject: [PATCH 48/89] replace 'tr' by Aircraft.HorizontalTail.TAPER_RATIO --- .../geometry/gasp_based/empennage.py | 67 ++++++++++++------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index b8f68746e..be5c6de1c 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -38,18 +38,23 @@ def setup(self): else: self.k = [0.43, 0.38, 0.85] - add_aviary_input(self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION) + add_aviary_input(self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION, val=0) - add_aviary_input(self, Aircraft.Fuselage.LENGTH) + add_aviary_input(self, Aircraft.Fuselage.LENGTH, val=129.4) self.add_input("cab_w", 13.1, units="ft", desc="SWF: Cabin width") - add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.AREA, val=1370) - self.add_input("wing_ref", 12.615, units="ft", desc=( - "CBARW | B: Wing reference parameter. Wing chord for a " - "horizontal tail. Wing span for a vertical tail."), - ) + self.add_input( + "wing_ref", + 12.615, + units="ft", + desc=( + "CBARW | B: Wing reference parameter. Wing chord for a " + "horizontal tail. Wing span for a vertical tail." + ), + ) self.add_output( "vol_coef", units="unitless", desc="VBARH | VBARV: Tail volume coefficient") @@ -102,22 +107,32 @@ def setup(self): desc="VBARH | VBARV: Horizontal tail volume coefficient" ) - add_aviary_input(self, Aircraft.Wing.AREA) - - self.add_input("r_arm", 0.2307, units="unitless", - desc=("COELTH | BOELTV: For a horizontal tail, the ratio of " - "wing chord to tail moment arm. For a vertical tail, the " - "ratio of wing span to vertical tail moment arm."), - ) - self.add_input("wing_ref", 12.615, units="ft", - desc=("CBARW | B: Reference wing parameter for tail moment arm. " - "For a horizontal tail, the mean wing chord. For a " - "vertical tail, the wing span."), - ) + add_aviary_input(self, Aircraft.Wing.AREA, val=1370) + + self.add_input( + "r_arm", + 0.2307, + units="unitless", + desc=( + "COELTH | BOELTV: For a horizontal tail, the ratio of " + "wing chord to tail moment arm. For a vertical tail, the " + "ratio of wing span to vertical tail moment arm." + ), + ) + self.add_input( + "wing_ref", + 12.615, + units="ft", + desc=( + "CBARW | B: Reference wing parameter for tail moment arm. " + "For a horizontal tail, the mean wing chord. For a " + "vertical tail, the wing span." + ), + ) self.add_input( "ar", 4.75, units="unitless", desc="ARHT | ARVT: Tail aspect ratio.") self.add_input( - "tr", 0.352, units="unitless", desc="SLMH | SLMV: Tail taper ratio.") + Aircraft.HorizontalTail.TAPER_RATIO, 0.352, units="unitless", desc="SLMH | SLMV: Tail taper ratio.") self.add_output("area", units="ft**2", desc="SHT | SVT: Tail area") self.add_output("span", units="ft", desc="BHT | BVT: Tail span") @@ -131,10 +146,10 @@ def setup_partials(self): self.declare_partials("area", ["vol_coef", Aircraft.Wing.AREA, "r_arm"]) self.declare_partials("span", ["vol_coef", Aircraft.Wing.AREA, "r_arm", "ar"]) self.declare_partials( - "rchord", ["vol_coef", Aircraft.Wing.AREA, "r_arm", "ar", "tr"] + "rchord", ["vol_coef", Aircraft.Wing.AREA, "r_arm", "ar", Aircraft.HorizontalTail.TAPER_RATIO] ) self.declare_partials( - "chord", ["vol_coef", Aircraft.Wing.AREA, "r_arm", "ar", "tr"] + "chord", ["vol_coef", Aircraft.Wing.AREA, "r_arm", "ar", Aircraft.HorizontalTail.TAPER_RATIO] ) self.declare_partials("arm", ["r_arm", "wing_ref"]) @@ -171,14 +186,14 @@ def compute_partials(self, inputs, J): J["rchord", Aircraft.Wing.AREA] = vol_coef * r_arm / cse2 J["rchord", "r_arm"] = wing_area * vol_coef / cse2 J["rchord", "ar"] = -vol_coef * wing_area * r_arm / (ar * cse2) - J["rchord", "tr"] = -2 * vol_coef * wing_area * r_arm / (cse2 * (tr + 1)) + J["rchord", Aircraft.HorizontalTail.TAPER_RATIO] = -2 * vol_coef * wing_area * r_arm / (cse2 * (tr + 1)) cse3 = tr - (tr / (tr + 1)) + 1 J["chord", "vol_coef"] = 2 / 3.0 * wing_area * r_arm * cse3 / cse2 J["chord", Aircraft.Wing.AREA] = 2 / 3.0 * vol_coef * r_arm * cse3 / cse2 J["chord", "r_arm"] = 2 / 3.0 * vol_coef * wing_area * cse3 / cse2 J["chord", "ar"] = -2 / 3.0 * vol_coef * wing_area * r_arm * cse3 / (ar * cse2) - J["chord", "tr"] = 4 / 3.0 * cse1 * (tr - 1) / (ar * (tr + 1) ** 3) + J["chord", Aircraft.HorizontalTail.TAPER_RATIO] = 4 / 3.0 * cse1 * (tr - 1) / (ar * (tr + 1) ** 3) J["arm", "r_arm"] = -wing_ref / r_arm**2 J["arm", "wing_ref"] = 1.0 / r_arm @@ -218,7 +233,7 @@ def setup(self): ] higher_level_inputs_htail = [ ("wing_ref", Aircraft.Wing.AVERAGE_CHORD), - ("tr", Aircraft.HorizontalTail.TAPER_RATIO), + # ("tr", Aircraft.HorizontalTail.TAPER_RATIO), ] higher_level_inputs_vtail = [ ("wing_ref", Aircraft.Wing.SPAN), @@ -232,7 +247,7 @@ def setup(self): ] rename_inputs_vtail = [ ("r_arm", Aircraft.VerticalTail.MOMENT_RATIO), - ("tr", Aircraft.VerticalTail.TAPER_RATIO), + # ("tr", Aircraft.VerticalTail.TAPER_RATIO), ] # outputs that are used in groups other than this one From 71dcb326958b4cfdb69b28df0e0d3388e65b7913 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 14:00:51 -0800 Subject: [PATCH 49/89] autopep8 --- aviary/subsystems/geometry/gasp_based/empennage.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index be5c6de1c..57c8210a8 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -146,10 +146,12 @@ def setup_partials(self): self.declare_partials("area", ["vol_coef", Aircraft.Wing.AREA, "r_arm"]) self.declare_partials("span", ["vol_coef", Aircraft.Wing.AREA, "r_arm", "ar"]) self.declare_partials( - "rchord", ["vol_coef", Aircraft.Wing.AREA, "r_arm", "ar", Aircraft.HorizontalTail.TAPER_RATIO] + "rchord", ["vol_coef", Aircraft.Wing.AREA, "r_arm", + "ar", Aircraft.HorizontalTail.TAPER_RATIO] ) self.declare_partials( - "chord", ["vol_coef", Aircraft.Wing.AREA, "r_arm", "ar", Aircraft.HorizontalTail.TAPER_RATIO] + "chord", ["vol_coef", Aircraft.Wing.AREA, "r_arm", + "ar", Aircraft.HorizontalTail.TAPER_RATIO] ) self.declare_partials("arm", ["r_arm", "wing_ref"]) @@ -186,14 +188,16 @@ def compute_partials(self, inputs, J): J["rchord", Aircraft.Wing.AREA] = vol_coef * r_arm / cse2 J["rchord", "r_arm"] = wing_area * vol_coef / cse2 J["rchord", "ar"] = -vol_coef * wing_area * r_arm / (ar * cse2) - J["rchord", Aircraft.HorizontalTail.TAPER_RATIO] = -2 * vol_coef * wing_area * r_arm / (cse2 * (tr + 1)) + J["rchord", Aircraft.HorizontalTail.TAPER_RATIO] = - \ + 2 * vol_coef * wing_area * r_arm / (cse2 * (tr + 1)) cse3 = tr - (tr / (tr + 1)) + 1 J["chord", "vol_coef"] = 2 / 3.0 * wing_area * r_arm * cse3 / cse2 J["chord", Aircraft.Wing.AREA] = 2 / 3.0 * vol_coef * r_arm * cse3 / cse2 J["chord", "r_arm"] = 2 / 3.0 * vol_coef * wing_area * cse3 / cse2 J["chord", "ar"] = -2 / 3.0 * vol_coef * wing_area * r_arm * cse3 / (ar * cse2) - J["chord", Aircraft.HorizontalTail.TAPER_RATIO] = 4 / 3.0 * cse1 * (tr - 1) / (ar * (tr + 1) ** 3) + J["chord", Aircraft.HorizontalTail.TAPER_RATIO] = 4 / \ + 3.0 * cse1 * (tr - 1) / (ar * (tr + 1) ** 3) J["arm", "r_arm"] = -wing_ref / r_arm**2 J["arm", "wing_ref"] = 1.0 / r_arm From 6ecc24c73848fb4cb8422e77ea1a061adc702122 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 14:55:39 -0800 Subject: [PATCH 50/89] try again: replace 'tr' by Aircraft.HorizontalTail.TAPER_RATIO in empennage.py --- .../geometry/gasp_based/empennage.py | 58 ++++++++----------- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index 57c8210a8..f0f607ee8 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -38,23 +38,18 @@ def setup(self): else: self.k = [0.43, 0.38, 0.85] - add_aviary_input(self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION, val=0) + add_aviary_input(self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION) - add_aviary_input(self, Aircraft.Fuselage.LENGTH, val=129.4) + add_aviary_input(self, Aircraft.Fuselage.LENGTH) self.add_input("cab_w", 13.1, units="ft", desc="SWF: Cabin width") - add_aviary_input(self, Aircraft.Wing.AREA, val=1370) + add_aviary_input(self, Aircraft.Wing.AREA) - self.add_input( - "wing_ref", - 12.615, - units="ft", - desc=( - "CBARW | B: Wing reference parameter. Wing chord for a " - "horizontal tail. Wing span for a vertical tail." - ), - ) + self.add_input("wing_ref", 12.615, units="ft", desc=( + "CBARW | B: Wing reference parameter. Wing chord for a " + "horizontal tail. Wing span for a vertical tail."), + ) self.add_output( "vol_coef", units="unitless", desc="VBARH | VBARV: Tail volume coefficient") @@ -107,32 +102,23 @@ def setup(self): desc="VBARH | VBARV: Horizontal tail volume coefficient" ) - add_aviary_input(self, Aircraft.Wing.AREA, val=1370) - - self.add_input( - "r_arm", - 0.2307, - units="unitless", - desc=( - "COELTH | BOELTV: For a horizontal tail, the ratio of " - "wing chord to tail moment arm. For a vertical tail, the " - "ratio of wing span to vertical tail moment arm." - ), - ) - self.add_input( - "wing_ref", - 12.615, - units="ft", - desc=( - "CBARW | B: Reference wing parameter for tail moment arm. " - "For a horizontal tail, the mean wing chord. For a " - "vertical tail, the wing span." - ), - ) + add_aviary_input(self, Aircraft.Wing.AREA) + + self.add_input("r_arm", 0.2307, units="unitless", + desc=("COELTH | BOELTV: For a horizontal tail, the ratio of " + "wing chord to tail moment arm. For a vertical tail, the " + "ratio of wing span to vertical tail moment arm."), + ) + self.add_input("wing_ref", 12.615, units="ft", + desc=("CBARW | B: Reference wing parameter for tail moment arm. " + "For a horizontal tail, the mean wing chord. For a " + "vertical tail, the wing span."), + ) self.add_input( "ar", 4.75, units="unitless", desc="ARHT | ARVT: Tail aspect ratio.") self.add_input( - Aircraft.HorizontalTail.TAPER_RATIO, 0.352, units="unitless", desc="SLMH | SLMV: Tail taper ratio.") + Aircraft.HorizontalTail.TAPER_RATIO, 0.352, units="unitless", + desc="SLMH | SLMV: Tail taper ratio.") self.add_output("area", units="ft**2", desc="SHT | SVT: Tail area") self.add_output("span", units="ft", desc="BHT | BVT: Tail span") @@ -238,6 +224,7 @@ def setup(self): higher_level_inputs_htail = [ ("wing_ref", Aircraft.Wing.AVERAGE_CHORD), # ("tr", Aircraft.HorizontalTail.TAPER_RATIO), + Aircraft.HorizontalTail.TAPER_RATIO, ] higher_level_inputs_vtail = [ ("wing_ref", Aircraft.Wing.SPAN), @@ -252,6 +239,7 @@ def setup(self): rename_inputs_vtail = [ ("r_arm", Aircraft.VerticalTail.MOMENT_RATIO), # ("tr", Aircraft.VerticalTail.TAPER_RATIO), + Aircraft.HorizontalTail.TAPER_RATIO, ] # outputs that are used in groups other than this one From c6e41a5b32d1d784808ae47dc248e31544e37006 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 14:57:11 -0800 Subject: [PATCH 51/89] autopep8 --- aviary/subsystems/geometry/gasp_based/empennage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index f0f607ee8..fbcb6f080 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -117,7 +117,7 @@ def setup(self): self.add_input( "ar", 4.75, units="unitless", desc="ARHT | ARVT: Tail aspect ratio.") self.add_input( - Aircraft.HorizontalTail.TAPER_RATIO, 0.352, units="unitless", + Aircraft.HorizontalTail.TAPER_RATIO, 0.352, units="unitless", desc="SLMH | SLMV: Tail taper ratio.") self.add_output("area", units="ft**2", desc="SHT | SVT: Tail area") From a28ed810aeb12321d5c22c85a5c5886587cb8e12 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 15:20:25 -0800 Subject: [PATCH 52/89] roll back empennage.py --- .../geometry/gasp_based/empennage.py | 74 ++++++++++--------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index fbcb6f080..c0133bc54 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -38,18 +38,23 @@ def setup(self): else: self.k = [0.43, 0.38, 0.85] - add_aviary_input(self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION) + add_aviary_input(self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION, val=0) - add_aviary_input(self, Aircraft.Fuselage.LENGTH) + add_aviary_input(self, Aircraft.Fuselage.LENGTH, val=129.4) self.add_input("cab_w", 13.1, units="ft", desc="SWF: Cabin width") - add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.AREA, val=1370) - self.add_input("wing_ref", 12.615, units="ft", desc=( - "CBARW | B: Wing reference parameter. Wing chord for a " - "horizontal tail. Wing span for a vertical tail."), - ) + self.add_input( + "wing_ref", + 12.615, + units="ft", + desc=( + "CBARW | B: Wing reference parameter. Wing chord for a " + "horizontal tail. Wing span for a vertical tail." + ), + ) self.add_output( "vol_coef", units="unitless", desc="VBARH | VBARV: Tail volume coefficient") @@ -102,23 +107,32 @@ def setup(self): desc="VBARH | VBARV: Horizontal tail volume coefficient" ) - add_aviary_input(self, Aircraft.Wing.AREA) - - self.add_input("r_arm", 0.2307, units="unitless", - desc=("COELTH | BOELTV: For a horizontal tail, the ratio of " - "wing chord to tail moment arm. For a vertical tail, the " - "ratio of wing span to vertical tail moment arm."), - ) - self.add_input("wing_ref", 12.615, units="ft", - desc=("CBARW | B: Reference wing parameter for tail moment arm. " - "For a horizontal tail, the mean wing chord. For a " - "vertical tail, the wing span."), - ) + add_aviary_input(self, Aircraft.Wing.AREA, val=1370) + + self.add_input( + "r_arm", + 0.2307, + units="unitless", + desc=( + "COELTH | BOELTV: For a horizontal tail, the ratio of " + "wing chord to tail moment arm. For a vertical tail, the " + "ratio of wing span to vertical tail moment arm." + ), + ) + self.add_input( + "wing_ref", + 12.615, + units="ft", + desc=( + "CBARW | B: Reference wing parameter for tail moment arm. " + "For a horizontal tail, the mean wing chord. For a " + "vertical tail, the wing span." + ), + ) self.add_input( "ar", 4.75, units="unitless", desc="ARHT | ARVT: Tail aspect ratio.") self.add_input( - Aircraft.HorizontalTail.TAPER_RATIO, 0.352, units="unitless", - desc="SLMH | SLMV: Tail taper ratio.") + "tr", 0.352, units="unitless", desc="SLMH | SLMV: Tail taper ratio.") self.add_output("area", units="ft**2", desc="SHT | SVT: Tail area") self.add_output("span", units="ft", desc="BHT | BVT: Tail span") @@ -132,12 +146,10 @@ def setup_partials(self): self.declare_partials("area", ["vol_coef", Aircraft.Wing.AREA, "r_arm"]) self.declare_partials("span", ["vol_coef", Aircraft.Wing.AREA, "r_arm", "ar"]) self.declare_partials( - "rchord", ["vol_coef", Aircraft.Wing.AREA, "r_arm", - "ar", Aircraft.HorizontalTail.TAPER_RATIO] + "rchord", ["vol_coef", Aircraft.Wing.AREA, "r_arm", "ar", "tr"] ) self.declare_partials( - "chord", ["vol_coef", Aircraft.Wing.AREA, "r_arm", - "ar", Aircraft.HorizontalTail.TAPER_RATIO] + "chord", ["vol_coef", Aircraft.Wing.AREA, "r_arm", "ar", "tr"] ) self.declare_partials("arm", ["r_arm", "wing_ref"]) @@ -174,16 +186,14 @@ def compute_partials(self, inputs, J): J["rchord", Aircraft.Wing.AREA] = vol_coef * r_arm / cse2 J["rchord", "r_arm"] = wing_area * vol_coef / cse2 J["rchord", "ar"] = -vol_coef * wing_area * r_arm / (ar * cse2) - J["rchord", Aircraft.HorizontalTail.TAPER_RATIO] = - \ - 2 * vol_coef * wing_area * r_arm / (cse2 * (tr + 1)) + J["rchord", "tr"] = -2 * vol_coef * wing_area * r_arm / (cse2 * (tr + 1)) cse3 = tr - (tr / (tr + 1)) + 1 J["chord", "vol_coef"] = 2 / 3.0 * wing_area * r_arm * cse3 / cse2 J["chord", Aircraft.Wing.AREA] = 2 / 3.0 * vol_coef * r_arm * cse3 / cse2 J["chord", "r_arm"] = 2 / 3.0 * vol_coef * wing_area * cse3 / cse2 J["chord", "ar"] = -2 / 3.0 * vol_coef * wing_area * r_arm * cse3 / (ar * cse2) - J["chord", Aircraft.HorizontalTail.TAPER_RATIO] = 4 / \ - 3.0 * cse1 * (tr - 1) / (ar * (tr + 1) ** 3) + J["chord", "tr"] = 4 / 3.0 * cse1 * (tr - 1) / (ar * (tr + 1) ** 3) J["arm", "r_arm"] = -wing_ref / r_arm**2 J["arm", "wing_ref"] = 1.0 / r_arm @@ -223,8 +233,7 @@ def setup(self): ] higher_level_inputs_htail = [ ("wing_ref", Aircraft.Wing.AVERAGE_CHORD), - # ("tr", Aircraft.HorizontalTail.TAPER_RATIO), - Aircraft.HorizontalTail.TAPER_RATIO, + ("tr", Aircraft.HorizontalTail.TAPER_RATIO), ] higher_level_inputs_vtail = [ ("wing_ref", Aircraft.Wing.SPAN), @@ -238,8 +247,7 @@ def setup(self): ] rename_inputs_vtail = [ ("r_arm", Aircraft.VerticalTail.MOMENT_RATIO), - # ("tr", Aircraft.VerticalTail.TAPER_RATIO), - Aircraft.HorizontalTail.TAPER_RATIO, + ("tr", Aircraft.VerticalTail.TAPER_RATIO), ] # outputs that are used in groups other than this one From b317a4c8f67555e71c361a01a72610e99a1b5f6a Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 16:19:22 -0800 Subject: [PATCH 53/89] autopep8 --- aviary/subsystems/mass/flops_based/wing_detailed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index b3aee85d0..d42920eda 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -57,7 +57,7 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD) add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_REF) - + add_aviary_output(self, Aircraft.Wing.BENDING_MATERIAL_FACTOR) add_aviary_output(self, Aircraft.Wing.BENDING_FACTOR) add_aviary_output(self, Aircraft.Wing.ENG_POD_INERTIA_FACTOR) From 9984e255622290a03059e91713f5a8897dead483 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 31 Dec 2024 16:30:28 -0800 Subject: [PATCH 54/89] remove BENDING_FACTOR --- aviary/subsystems/mass/flops_based/wing_detailed.py | 1 - 1 file changed, 1 deletion(-) diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index d42920eda..af6b5861a 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -59,7 +59,6 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_REF) add_aviary_output(self, Aircraft.Wing.BENDING_MATERIAL_FACTOR) - add_aviary_output(self, Aircraft.Wing.BENDING_FACTOR) add_aviary_output(self, Aircraft.Wing.ENG_POD_INERTIA_FACTOR) def setup_partials(self): From 4534b1fb18987f87fcffc2f8d713029b1588e37e Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 2 Jan 2025 11:23:09 -0800 Subject: [PATCH 55/89] set more variables to defaults in prep_geom.py --- .../geometry/flops_based/prep_geom.py | 53 +++++++++---------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/aviary/subsystems/geometry/flops_based/prep_geom.py b/aviary/subsystems/geometry/flops_based/prep_geom.py index 896ac70b7..5e2520f46 100644 --- a/aviary/subsystems/geometry/flops_based/prep_geom.py +++ b/aviary/subsystems/geometry/flops_based/prep_geom.py @@ -501,10 +501,10 @@ def setup(self): self.add_input(Names.XDX, 0.0, units='unitless') self.add_input(Names.XMULT, 0.0, units='unitless') - add_aviary_input(self, Aircraft.Wing.AREA, 0.0) - add_aviary_input(self, Aircraft.Wing.WETTED_AREA_SCALER, 1.0) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.WETTED_AREA_SCALER) - add_aviary_output(self, Aircraft.Wing.WETTED_AREA, 0.0) + add_aviary_output(self, Aircraft.Wing.WETTED_AREA) def setup_partials(self): self.declare_partials( @@ -579,19 +579,17 @@ def setup(self): self.add_input(Names.XMULTH, 0.0, units='unitless') self.add_input(Names.XMULTV, 0.0, units='unitless') - add_aviary_input(self, Aircraft.HorizontalTail.AREA, 0.0) + add_aviary_input(self, Aircraft.HorizontalTail.AREA) - add_aviary_input( - self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION, 0.0 - ) + add_aviary_input(self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION) - add_aviary_input(self, Aircraft.HorizontalTail.WETTED_AREA_SCALER, 1.0) + add_aviary_input(self, Aircraft.HorizontalTail.WETTED_AREA_SCALER) - add_aviary_input(self, Aircraft.VerticalTail.AREA, 0.0) - add_aviary_input(self, Aircraft.VerticalTail.WETTED_AREA_SCALER, 1.0) + add_aviary_input(self, Aircraft.VerticalTail.AREA) + add_aviary_input(self, Aircraft.VerticalTail.WETTED_AREA_SCALER) - add_aviary_output(self, Aircraft.HorizontalTail.WETTED_AREA, 0.0) - add_aviary_output(self, Aircraft.VerticalTail.WETTED_AREA, 0.0) + add_aviary_output(self, Aircraft.HorizontalTail.WETTED_AREA) + add_aviary_output(self, Aircraft.VerticalTail.WETTED_AREA) def setup_partials(self): self.declare_partials( @@ -743,27 +741,24 @@ def setup(self): self.add_input(Names.CROTVT, 0.0, units='unitless') self.add_input(Names.CRTHTB, 0.0, units='unitless') - add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER, 0.0) - add_aviary_input(self, Aircraft.Fuselage.LENGTH, 0.0) - add_aviary_input(self, Aircraft.Fuselage.WETTED_AREA_SCALER, 1.0) - - add_aviary_input(self, Aircraft.HorizontalTail.THICKNESS_TO_CHORD, 0.0) + add_aviary_input(self, Aircraft.Fuselage.AVG_DIAMETER) + add_aviary_input(self, Aircraft.Fuselage.LENGTH) + add_aviary_input(self, Aircraft.Fuselage.WETTED_AREA_SCALER) - add_aviary_input( - self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION, 0.0 - ) + add_aviary_input(self, Aircraft.HorizontalTail.THICKNESS_TO_CHORD) + add_aviary_input(self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION) - add_aviary_input(self, Aircraft.VerticalTail.THICKNESS_TO_CHORD, 0.0) + add_aviary_input(self, Aircraft.VerticalTail.THICKNESS_TO_CHORD) - add_aviary_input(self, Aircraft.Wing.AREA, 0.0) - add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO, 0.0) - add_aviary_input(self, Aircraft.Wing.GLOVE_AND_BAT, 0.0) - add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD, 0.0) + add_aviary_input(self, Aircraft.Wing.AREA) + add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO) + add_aviary_input(self, Aircraft.Wing.GLOVE_AND_BAT) + add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD) - add_aviary_output(self, Aircraft.Fuselage.CROSS_SECTION, 0.0) - add_aviary_output(self, Aircraft.Fuselage.DIAMETER_TO_WING_SPAN, 0.0) - add_aviary_output(self, Aircraft.Fuselage.LENGTH_TO_DIAMETER, 0.0) - add_aviary_output(self, Aircraft.Fuselage.WETTED_AREA, 0.0) + add_aviary_output(self, Aircraft.Fuselage.CROSS_SECTION) + add_aviary_output(self, Aircraft.Fuselage.DIAMETER_TO_WING_SPAN) + add_aviary_output(self, Aircraft.Fuselage.LENGTH_TO_DIAMETER) + add_aviary_output(self, Aircraft.Fuselage.WETTED_AREA) def setup_partials(self): self.declare_partials( From 944930ef4d6c86dab5870567faf10eacdcbb7f64 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 2 Jan 2025 11:25:19 -0800 Subject: [PATCH 56/89] Changed Aircraft.Fuselage.LENGTH from 129.4 to 0.0. Changed Aircraft.Wing.AREA from 1370 to 0.0. --- .../geometry/gasp_based/empennage.py | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index c0133bc54..db9bdd0a5 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -38,23 +38,19 @@ def setup(self): else: self.k = [0.43, 0.38, 0.85] - add_aviary_input(self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION, val=0) + add_aviary_input(self, Aircraft.HorizontalTail.VERTICAL_TAIL_FRACTION) - add_aviary_input(self, Aircraft.Fuselage.LENGTH, val=129.4) + add_aviary_input(self, Aircraft.Fuselage.LENGTH) self.add_input("cab_w", 13.1, units="ft", desc="SWF: Cabin width") - add_aviary_input(self, Aircraft.Wing.AREA, val=1370) + add_aviary_input(self, Aircraft.Wing.AREA) - self.add_input( - "wing_ref", - 12.615, - units="ft", - desc=( - "CBARW | B: Wing reference parameter. Wing chord for a " - "horizontal tail. Wing span for a vertical tail." - ), - ) + self.add_input("wing_ref", 12.615, units="ft", + desc=( + "CBARW | B: Wing reference parameter. Wing chord for a " + "horizontal tail. Wing span for a vertical tail.") + ) self.add_output( "vol_coef", units="unitless", desc="VBARH | VBARV: Tail volume coefficient") From 15fd751c67d2b2a52f7e25618cb59398bb11bf83 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 2 Jan 2025 11:32:00 -0800 Subject: [PATCH 57/89] Changed Aircraft.Fuselage.PILOT_COMPARTMENT_LENGTH from 9.5 to 0.0. Changed Aircraft.Fuselage.TAIL_FINENESS from 3 to default(1). --- aviary/subsystems/geometry/gasp_based/fuselage.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/fuselage.py b/aviary/subsystems/geometry/gasp_based/fuselage.py index 1239b431c..bd9527d79 100644 --- a/aviary/subsystems/geometry/gasp_based/fuselage.py +++ b/aviary/subsystems/geometry/gasp_based/fuselage.py @@ -117,18 +117,17 @@ def initialize(self): ) def setup(self): - add_aviary_input(self, Aircraft.Fuselage.NOSE_FINENESS, val=1) + add_aviary_input(self, Aircraft.Fuselage.NOSE_FINENESS) self.add_input("nose_height", val=0, units="ft", desc="HN: height of nose") - add_aviary_input(self, Aircraft.Fuselage.PILOT_COMPARTMENT_LENGTH, val=9.5) + add_aviary_input(self, Aircraft.Fuselage.PILOT_COMPARTMENT_LENGTH) self.add_input("cabin_len", val=0, units="ft", desc="LC: length of cabin") - add_aviary_input(self, Aircraft.Fuselage.TAIL_FINENESS, val=3) + add_aviary_input(self, Aircraft.Fuselage.TAIL_FINENESS) self.add_input("cabin_height", val=0, units="ft", desc="HC: height of cabin") - add_aviary_input(self, Aircraft.Fuselage.WETTED_AREA_SCALER, - val=1, units="unitless") + add_aviary_input(self, Aircraft.Fuselage.WETTED_AREA_SCALER) - add_aviary_output(self, Aircraft.Fuselage.LENGTH, val=0) - add_aviary_output(self, Aircraft.Fuselage.WETTED_AREA, val=0) - add_aviary_output(self, Aircraft.TailBoom.LENGTH, val=0) + add_aviary_output(self, Aircraft.Fuselage.LENGTH) + add_aviary_output(self, Aircraft.Fuselage.WETTED_AREA) + add_aviary_output(self, Aircraft.TailBoom.LENGTH) self.declare_partials( Aircraft.Fuselage.LENGTH, From 2502fec980730a4d666c30a470e56d023234e906 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 2 Jan 2025 11:32:57 -0800 Subject: [PATCH 58/89] added a couple of default_value=0.0 --- aviary/variable_info/variable_meta_data.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index 24b47761c..bbc6a88b4 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -3097,6 +3097,7 @@ }, units='unitless', desc='fuselage diameter to wing span ratio', + default_value=0.0, # added ) add_meta_data( @@ -3194,6 +3195,7 @@ }, units='unitless', desc='fuselage length to diameter ratio', + default_value=0.0, # added ) add_meta_data( From 1edb4ec2b47b75888abe94c26b5c395ccfb48ccf Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 2 Jan 2025 12:00:53 -0800 Subject: [PATCH 59/89] commented out set_input_defaults(Aircraft.Fuselage.PILOT_COMPARTMENT_LENGTH, val=9.5) for testing --- aviary/subsystems/geometry/gasp_based/fuselage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/fuselage.py b/aviary/subsystems/geometry/gasp_based/fuselage.py index bd9527d79..7968ebeb4 100644 --- a/aviary/subsystems/geometry/gasp_based/fuselage.py +++ b/aviary/subsystems/geometry/gasp_based/fuselage.py @@ -282,5 +282,5 @@ def setup(self): promotes_outputs=["aircraft:*"], ) - self.set_input_defaults( - Aircraft.Fuselage.PILOT_COMPARTMENT_LENGTH, val=9.5, units="ft") + # self.set_input_defaults( + # Aircraft.Fuselage.PILOT_COMPARTMENT_LENGTH, val=9.5, units="ft") From ace57d227d0b49db57d295261791290b0897a73b Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 2 Jan 2025 12:18:30 -0800 Subject: [PATCH 60/89] commented out four set_input_defaults() lines for testing. --- aviary/subsystems/geometry/gasp_based/wing.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/wing.py b/aviary/subsystems/geometry/gasp_based/wing.py index 5b0058c79..65d14771b 100644 --- a/aviary/subsystems/geometry/gasp_based/wing.py +++ b/aviary/subsystems/geometry/gasp_based/wing.py @@ -1011,11 +1011,11 @@ def setup(self): self.promotes("strut", outputs=["strut_y"]) self.promotes("fold", inputs=["strut_y"]) - self.set_input_defaults(Aircraft.Wing.ASPECT_RATIO, val=10.13, units="unitless") - self.set_input_defaults(Aircraft.Wing.TAPER_RATIO, val=0.33, units="unitless") - self.set_input_defaults( - Aircraft.Wing.THICKNESS_TO_CHORD_ROOT, val=0.11, units="unitless" - ) - self.set_input_defaults( - Aircraft.Wing.THICKNESS_TO_CHORD_TIP, val=0.1, units="unitless" - ) + # self.set_input_defaults(Aircraft.Wing.ASPECT_RATIO, val=10.13, units="unitless") + # self.set_input_defaults(Aircraft.Wing.TAPER_RATIO, val=0.33, units="unitless") + # self.set_input_defaults( + # Aircraft.Wing.THICKNESS_TO_CHORD_ROOT, val=0.11, units="unitless" + # ) + # self.set_input_defaults( + # Aircraft.Wing.THICKNESS_TO_CHORD_TIP, val=0.1, units="unitless" + # ) From fd4fa9f70cc3c66839ecb8ea201c6dc28189d452 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 2 Jan 2025 13:28:53 -0800 Subject: [PATCH 61/89] moved set_input_defaults to unit test (WingGroupTestCase4). --- aviary/subsystems/geometry/gasp_based/test/test_wing.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/aviary/subsystems/geometry/gasp_based/test/test_wing.py b/aviary/subsystems/geometry/gasp_based/test/test_wing.py index 64bb9d789..5fc5028c4 100644 --- a/aviary/subsystems/geometry/gasp_based/test/test_wing.py +++ b/aviary/subsystems/geometry/gasp_based/test/test_wing.py @@ -604,6 +604,15 @@ def setUp(self): Aircraft.Fuel.WING_FUEL_FRACTION, val=.6, units='unitless' ) + self.prob.model.set_input_defaults(Aircraft.Wing.ASPECT_RATIO, val=10.13, units="unitless") + self.prob.model.set_input_defaults(Aircraft.Wing.TAPER_RATIO, val=0.33, units="unitless") + self.prob.model.set_input_defaults( + Aircraft.Wing.THICKNESS_TO_CHORD_ROOT, val=0.11, units="unitless" + ) + self.prob.model.set_input_defaults( + Aircraft.Wing.THICKNESS_TO_CHORD_TIP, val=0.1, units="unitless" + ) + self.prob.setup(check=False, force_alloc_complex=True) def test_case1(self): From a67e11cfb442b75181ff0b31b4e2ed867acfcd35 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 2 Jan 2025 13:35:59 -0800 Subject: [PATCH 62/89] commented out set_input_defaults() lines in EmpennageSize. --- aviary/subsystems/geometry/gasp_based/empennage.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index db9bdd0a5..85ca5f502 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -319,11 +319,11 @@ def setup(self): promotes_outputs=higher_level_outputs_vtail + rename_outputs_vtail, ) - self.set_input_defaults(Aircraft.Wing.AVERAGE_CHORD, 12.615, units="ft") - self.set_input_defaults(Aircraft.Wing.SPAN, 117.8054, units="ft") + # self.set_input_defaults(Aircraft.Wing.AVERAGE_CHORD, 12.615, units="ft") + # self.set_input_defaults(Aircraft.Wing.SPAN, 117.8054, units="ft") # override horizontal tail defaults - self.set_input_defaults(Aircraft.VerticalTail.VOLUME_COEFFICIENT, 0.145) - self.set_input_defaults(Aircraft.VerticalTail.MOMENT_RATIO, 2.362) - self.set_input_defaults(Aircraft.VerticalTail.ASPECT_RATIO, 1.67) - self.set_input_defaults(Aircraft.VerticalTail.TAPER_RATIO, 0.801) + # self.set_input_defaults(Aircraft.VerticalTail.VOLUME_COEFFICIENT, 0.145) + # self.set_input_defaults(Aircraft.VerticalTail.MOMENT_RATIO, 2.362) + # self.set_input_defaults(Aircraft.VerticalTail.ASPECT_RATIO, 1.67) + # self.set_input_defaults(Aircraft.VerticalTail.TAPER_RATIO, 0.801) From 82496efd99bc2968fac35cc87660c79ec23a8a18 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 2 Jan 2025 13:38:52 -0800 Subject: [PATCH 63/89] autopep8 --- aviary/subsystems/geometry/gasp_based/test/test_wing.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/test/test_wing.py b/aviary/subsystems/geometry/gasp_based/test/test_wing.py index 5fc5028c4..b1af68a1f 100644 --- a/aviary/subsystems/geometry/gasp_based/test/test_wing.py +++ b/aviary/subsystems/geometry/gasp_based/test/test_wing.py @@ -604,8 +604,10 @@ def setUp(self): Aircraft.Fuel.WING_FUEL_FRACTION, val=.6, units='unitless' ) - self.prob.model.set_input_defaults(Aircraft.Wing.ASPECT_RATIO, val=10.13, units="unitless") - self.prob.model.set_input_defaults(Aircraft.Wing.TAPER_RATIO, val=0.33, units="unitless") + self.prob.model.set_input_defaults( + Aircraft.Wing.ASPECT_RATIO, val=10.13, units="unitless") + self.prob.model.set_input_defaults( + Aircraft.Wing.TAPER_RATIO, val=0.33, units="unitless") self.prob.model.set_input_defaults( Aircraft.Wing.THICKNESS_TO_CHORD_ROOT, val=0.11, units="unitless" ) From 61bacadeae8dc91c4157b3a64c1295291f5d79fe Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 2 Jan 2025 15:09:33 -0800 Subject: [PATCH 64/89] set_input_defaults(Aircraft.VerticalTail.ASPECT_RATIO, 0.0) and set_input_defaults(Aircraft.VerticalTail.TAPER_RATIO, 0.0) --- aviary/subsystems/geometry/gasp_based/empennage.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index 85ca5f502..d73efa5c0 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -319,11 +319,7 @@ def setup(self): promotes_outputs=higher_level_outputs_vtail + rename_outputs_vtail, ) - # self.set_input_defaults(Aircraft.Wing.AVERAGE_CHORD, 12.615, units="ft") - # self.set_input_defaults(Aircraft.Wing.SPAN, 117.8054, units="ft") - - # override horizontal tail defaults - # self.set_input_defaults(Aircraft.VerticalTail.VOLUME_COEFFICIENT, 0.145) - # self.set_input_defaults(Aircraft.VerticalTail.MOMENT_RATIO, 2.362) - # self.set_input_defaults(Aircraft.VerticalTail.ASPECT_RATIO, 1.67) - # self.set_input_defaults(Aircraft.VerticalTail.TAPER_RATIO, 0.801) + + # override vertical tail defaults + self.set_input_defaults(Aircraft.VerticalTail.ASPECT_RATIO, 0.0) # 1.67 + self.set_input_defaults(Aircraft.VerticalTail.TAPER_RATIO, 0.0) # 0.801 From 43b6a4c884860700a518ddf9817da1d13824ff80 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 2 Jan 2025 15:11:58 -0800 Subject: [PATCH 65/89] autopep8 --- aviary/subsystems/geometry/gasp_based/empennage.py | 1 - 1 file changed, 1 deletion(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index d73efa5c0..994ed25ec 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -319,7 +319,6 @@ def setup(self): promotes_outputs=higher_level_outputs_vtail + rename_outputs_vtail, ) - # override vertical tail defaults self.set_input_defaults(Aircraft.VerticalTail.ASPECT_RATIO, 0.0) # 1.67 self.set_input_defaults(Aircraft.VerticalTail.TAPER_RATIO, 0.0) # 0.801 From f4c2e6b00c81b3a6a7fbbf6ac7aed21776a5e472 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 2 Jan 2025 15:47:38 -0800 Subject: [PATCH 66/89] minor updates --- .../geometry/gasp_based/empennage.py | 47 ++++++++----------- .../geometry/gasp_based/fuselage.py | 3 -- aviary/subsystems/geometry/gasp_based/wing.py | 9 ---- 3 files changed, 19 insertions(+), 40 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index 994ed25ec..e6f75250b 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -98,37 +98,28 @@ def initialize(self): def setup(self): # defaults here for Large Single Aisle 1 horizontal tail - self.add_input( - "vol_coef", 1.189, units="unitless", - desc="VBARH | VBARV: Horizontal tail volume coefficient" - ) + self.add_input("vol_coef", 1.189, units="unitless", + desc="VBARH | VBARV: Horizontal tail volume coefficient" + ) add_aviary_input(self, Aircraft.Wing.AREA, val=1370) - self.add_input( - "r_arm", - 0.2307, - units="unitless", - desc=( - "COELTH | BOELTV: For a horizontal tail, the ratio of " - "wing chord to tail moment arm. For a vertical tail, the " - "ratio of wing span to vertical tail moment arm." - ), - ) - self.add_input( - "wing_ref", - 12.615, - units="ft", - desc=( - "CBARW | B: Reference wing parameter for tail moment arm. " - "For a horizontal tail, the mean wing chord. For a " - "vertical tail, the wing span." - ), - ) - self.add_input( - "ar", 4.75, units="unitless", desc="ARHT | ARVT: Tail aspect ratio.") - self.add_input( - "tr", 0.352, units="unitless", desc="SLMH | SLMV: Tail taper ratio.") + self.add_input("r_arm", 0.2307, units="unitless", + desc=( + "COELTH | BOELTV: For a horizontal tail, the ratio of " + "wing chord to tail moment arm. For a vertical tail, the " + "ratio of wing span to vertical tail moment arm.") + ) + self.add_input("wing_ref", 12.615, units="ft", + desc=( + "CBARW | B: Reference wing parameter for tail moment arm. " + "For a horizontal tail, the mean wing chord. For a " + "vertical tail, the wing span.") + ) + self.add_input("ar", 4.75, units="unitless", + desc="ARHT | ARVT: Tail aspect ratio.") + self.add_input("tr", 0.352, units="unitless", + desc="SLMH | SLMV: Tail taper ratio.") self.add_output("area", units="ft**2", desc="SHT | SVT: Tail area") self.add_output("span", units="ft", desc="BHT | BVT: Tail span") diff --git a/aviary/subsystems/geometry/gasp_based/fuselage.py b/aviary/subsystems/geometry/gasp_based/fuselage.py index 7968ebeb4..17a6d2c89 100644 --- a/aviary/subsystems/geometry/gasp_based/fuselage.py +++ b/aviary/subsystems/geometry/gasp_based/fuselage.py @@ -281,6 +281,3 @@ def setup(self): promotes_inputs=connected_input_outputs + ["aircraft:*"], promotes_outputs=["aircraft:*"], ) - - # self.set_input_defaults( - # Aircraft.Fuselage.PILOT_COMPARTMENT_LENGTH, val=9.5, units="ft") diff --git a/aviary/subsystems/geometry/gasp_based/wing.py b/aviary/subsystems/geometry/gasp_based/wing.py index 65d14771b..5ea9be16d 100644 --- a/aviary/subsystems/geometry/gasp_based/wing.py +++ b/aviary/subsystems/geometry/gasp_based/wing.py @@ -1010,12 +1010,3 @@ def setup(self): check_fold_location_definition(None, aviary_options) self.promotes("strut", outputs=["strut_y"]) self.promotes("fold", inputs=["strut_y"]) - - # self.set_input_defaults(Aircraft.Wing.ASPECT_RATIO, val=10.13, units="unitless") - # self.set_input_defaults(Aircraft.Wing.TAPER_RATIO, val=0.33, units="unitless") - # self.set_input_defaults( - # Aircraft.Wing.THICKNESS_TO_CHORD_ROOT, val=0.11, units="unitless" - # ) - # self.set_input_defaults( - # Aircraft.Wing.THICKNESS_TO_CHORD_TIP, val=0.1, units="unitless" - # ) From 31bbd86b6433b4ad0442836c1d99b3e49f15510c Mon Sep 17 00:00:00 2001 From: jkirk5 Date: Tue, 7 Jan 2025 18:12:23 -0500 Subject: [PATCH 67/89] increment to 0.9.6 --- .bumpversion.cfg | 2 +- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- aviary/__init__.py | 2 +- setup.py | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a3a4c1790..7a9118486 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.9.4-dev +current_version = 0.9.6 commit = False tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\-(?P[a-z]+))? diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index cd237761c..f8fa1143e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -21,7 +21,7 @@ body: attributes: label: Aviary Version description: What version of Aviary is being used. - placeholder: "0.9.4-dev" + placeholder: "0.9.6" validations: required: true - type: textarea diff --git a/aviary/__init__.py b/aviary/__init__.py index 7f33873b3..50533e307 100644 --- a/aviary/__init__.py +++ b/aviary/__init__.py @@ -1 +1 @@ -__version__ = "0.9.4-dev" +__version__ = "0.9.6" diff --git a/setup.py b/setup.py index 143676dd5..e6b14555c 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ version=__version__, packages=find_packages(), install_requires=[ - "openmdao>=3.33.0", + "openmdao>=3.36.0", "dymos>=1.8.1", "hvplot", "importlib_resources", @@ -68,7 +68,7 @@ "models/small_single_aisle/*", "models/test_aircraft/*", "visualization/assets/*", - "visualization/assets/aviary_vars/*" + "visualization/assets/aviary_vars/*", ], f"{pkgname}.docs": [ "*.py", @@ -87,6 +87,6 @@ ], 'openmdao_report': [ 'aviary_reports=aviary.interface.reports:register_custom_reports', - ] - } + ], + }, ) From 8f1c884e6a13ea5f1fab888cdbe26d679b7f1d79 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 9 Jan 2025 14:12:23 -0800 Subject: [PATCH 68/89] in add_aviary_output, set val=None by default --- aviary/variable_info/functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/variable_info/functions.py b/aviary/variable_info/functions.py index 26cae4acb..fbdd77a53 100644 --- a/aviary/variable_info/functions.py +++ b/aviary/variable_info/functions.py @@ -73,7 +73,7 @@ def add_aviary_input(comp, varname, val=None, units=None, desc=None, shape_by_co desc=input_desc, shape_by_conn=shape_by_conn, shape=shape) -def add_aviary_output(comp, varname, val, units=None, desc=None, shape_by_conn=False, +def add_aviary_output(comp, varname, val=None, units=None, desc=None, shape_by_conn=False, meta_data=_MetaData, shape=None): """ This function provides a clean way to add variables from the From 89c3424041ac87a89a2100ba7e00f8c0410c1023 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 9 Jan 2025 14:21:39 -0800 Subject: [PATCH 69/89] minor update --- aviary/variable_info/functions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aviary/variable_info/functions.py b/aviary/variable_info/functions.py index fbdd77a53..fa385de2a 100644 --- a/aviary/variable_info/functions.py +++ b/aviary/variable_info/functions.py @@ -100,6 +100,8 @@ def add_aviary_output(comp, varname, val=None, units=None, desc=None, shape_by_c meta_data: dict (Optional) Aviary metadata dictionary. If unspecified, the built-in metadata will be used. + shape: tuple + (Optional) shape for this input. """ meta = meta_data[varname] if units: From 773ebb3f23f84c803f02e3c072998b0b76df81e6 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 9 Jan 2025 19:14:59 -0800 Subject: [PATCH 70/89] minor update --- aviary/variable_info/variable_meta_data.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index 4c5984b80..46018b3c4 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -619,6 +619,7 @@ historical_name={"GASP": 'INGASP.WFC', "FLOPS": None, "LEAPS1": None}, units='lbm', desc='total mass of cockpit controls, fixed wing controls, and SAS', + default_value=0.0, # added ) # _____ _____ _ _ From 27e0d84318f1ad2dd05d028608d143ec28dafb29 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 9 Jan 2025 19:40:46 -0800 Subject: [PATCH 71/89] minor update again. --- aviary/variable_info/variable_meta_data.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index 46018b3c4..f61783840 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -1170,6 +1170,7 @@ historical_name={"GASP": 'INGASP.SKCC', "FLOPS": None, "LEAPS1": None}, units="unitless", desc='mass trend coefficient of cockpit controls', + default_value=0.0, # added ) add_meta_data( From 972f2062ee0e7a3d7fd05d763d46d476604269ee Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 10 Jan 2025 08:24:23 -0800 Subject: [PATCH 72/89] testing --- aviary/variable_info/variable_meta_data.py | 86 ++++++++++++++++------ 1 file changed, 63 insertions(+), 23 deletions(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index f61783840..af25ed5b6 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -418,7 +418,7 @@ }, units='unitless', desc='canard theoretical aspect ratio', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -434,6 +434,7 @@ }, units='ft', desc='Reynolds characteristic length for the canard', + default_value=0.0, # added ) add_meta_data( @@ -449,6 +450,7 @@ }, units='unitless', desc='canard fineness ratio', + default_value=0.0, # added ) add_meta_data( @@ -553,7 +555,7 @@ }, units='ft**2', desc='canard wetted area', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -1253,7 +1255,7 @@ add_meta_data( # Note users must enable this feature, or the associated calculation is - # discarded + # discarded. Default to 0.0 Aircraft.Design.EMPTY_MASS_MARGIN_SCALER, meta_data=_MetaData, historical_name={ @@ -1263,7 +1265,7 @@ }, units='unitless', desc='empty mass margin scaler', - default_value=0.0, # Note: not 1.0 here + default_value=0.0, ) add_meta_data( @@ -1716,6 +1718,7 @@ historical_name={"GASP": 'INGASP.LCABLE', "FLOPS": None, "LEAPS1": None}, units='ft', desc='length of cable for hybrid electric augmented system', + default_value=0.0, # added ) add_meta_data( @@ -2160,7 +2163,7 @@ historical_name={"GASP": 'INGASP.DIAM_REF', "FLOPS": None, "LEAPS1": None}, units='ft', desc='engine reference diameter', - default_value=0.0, + default_value=0.0, # In geometry/gasp_based/engine.py, it was 5.8 ) # NOTE This unscaled turbine (engine) weight is an input provided by the user, and is not @@ -2367,6 +2370,7 @@ units='unitless', desc='Engine wing mount locations as fractions of semispan; (NUM_WING_ENGINES)/2 values ' 'are input', + # In mass/gasp_based/fixed.py and geometry/gasp_based/electric.py, default was [0.35] default_value=np.array([0.0]), ) @@ -2887,6 +2891,8 @@ historical_name={"GASP": 'INGASP.SKWF', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='fraction of total theoretical wing volume used for wing fuel', + # added. In geometry/gasp_based/wing.py, it was 0.6. In /mass/gasp_based/equipment_and_useful_load.py, it was 0.5. + default_value=0.0, ) add_meta_data( @@ -2969,6 +2975,7 @@ historical_name={"GASP": 'INGASP.FVOLW_GEOM', "FLOPS": None, "LEAPS1": None}, units='ft**3', desc='wing tank fuel volume based on geometry', + default_value=0.0, # added ) add_meta_data( @@ -3065,7 +3072,7 @@ }, units='ft', desc='average fuselage diameter', - default_value=0.0, # added + default_value=0.0, # added. In several components, it was set to 10 or 13.1. ) add_meta_data( @@ -3081,6 +3088,7 @@ }, units='ft', desc='Reynolds characteristic length for the fuselage', + default_value=0.0, # added ) add_meta_data( @@ -3101,7 +3109,7 @@ historical_name={"GASP": 'INGASP.HCK', "FLOPS": None, "LEAPS1": None}, units='ft', desc='mean fuselage cabin diameter minus mean fuselage nose diameter', - default_value=4.5, + default_value=0.0, # In geometry/gasp_based/fuselage.py, it was 4.5. ) add_meta_data( @@ -3114,6 +3122,7 @@ }, units='unitless', desc='fuselage diameter to wing span ratio', + default_value=0.0, # added ) add_meta_data( @@ -3129,6 +3138,7 @@ }, units='unitless', desc='fuselage fineness ratio', + default_value=0.0, # added ) add_meta_data( @@ -3197,7 +3207,7 @@ desc='Define the Fuselage total length. If total_length is not input for a ' 'passenger transport, LEAPS will calculate the fuselage length, width and ' 'depth and the length of the passenger compartment.', - default_value=0.0, + default_value=0.0, # in several components, it was set to 129.4 or 200. ) add_meta_data( @@ -3210,6 +3220,7 @@ }, units='unitless', desc='fuselage length to diameter ratio', + default_value=0.0, # added ) add_meta_data( @@ -3381,6 +3392,7 @@ historical_name={"GASP": 'INGASP.ELPC', "FLOPS": None, "LEAPS1": None}, units='ft', desc='length of the pilot compartment', + default_value=0.0, # added. # In geometry/gasp_based/fuselage.py, it was 9.5 ) add_meta_data( @@ -3502,7 +3514,7 @@ }, units='unitless', desc='horizontal tail theoretical aspect ratio', - default_value=None, + default_value=4.75, # changed from None ) add_meta_data( @@ -3526,6 +3538,7 @@ }, units='ft', desc='Reynolds characteristic length for the horizontal tail', + default_value=0.0, # added ) add_meta_data( @@ -3541,6 +3554,7 @@ }, units='unitless', desc='horizontal tail fineness ratio', + default_value=0.0, # added ) add_meta_data( @@ -3676,7 +3690,8 @@ }, units='unitless', desc='horizontal tail theoretical taper ratio', - default_value=None, + # In geometry/flops_based/prep_geom.py and mass/gasp_based/empennage.py, it was 0.352. + default_value=0.0, # changed from None. ) add_meta_data( @@ -3706,7 +3721,7 @@ 'tail is mounted. Defaults: 0.0 == for body mounted (default for ' 'transport with all engines on wing); 1.0 == for T tail ' '(default for transport with multiple engines on fuselage)', - default_value=None, + default_value=0.0, # added ) add_meta_data( @@ -3821,7 +3836,7 @@ }, units='psi', desc='hydraulic system pressure', - default_value=0.0, + default_value=0.0, # changed from 3000.0 ) # @@ -4121,6 +4136,7 @@ }, units='ft', desc='Reynolds characteristic length for nacelle for each engine model', + default_value=0.0, # added ) add_meta_data( @@ -4138,7 +4154,7 @@ historical_name={"GASP": 'INGASP.DNQDE', "FLOPS": None, "LEAPS1": None}, units="unitless", desc='ratio of nacelle diameter to engine core diameter', - default_value=1.25, + default_value=1.25, # In geometry/gasp_based/engine.py, it was 1.25 ) add_meta_data( @@ -4154,6 +4170,7 @@ }, units='unitless', desc='nacelle fineness ratio', + default_value=0.0, # added. # In geometry/gasp_based/engine.py, it was 2. ) add_meta_data( @@ -4251,6 +4268,7 @@ }, units='ft**2', desc='total nacelles wetted area', + default_value=0.0, # added ) add_meta_data( @@ -4266,6 +4284,7 @@ }, units='ft**2', desc='wetted area of a single nacelle for each engine model', + default_value=0.0, # added ) add_meta_data( @@ -4528,6 +4547,7 @@ historical_name={"GASP": 'INGASP.SSTQSW', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='ratio of strut area to wing area', + default_value=0.0, # added. In geometry/gasp_based/strut.py, it was set to .2. ) add_meta_data( @@ -4540,6 +4560,7 @@ }, units='ft', desc='attachment location of strut the full attachment-to-attachment span', + default_value=0.0, # added ) # related to Aircraft.Strut.ATTACHMENT_LOCATION @@ -4549,6 +4570,7 @@ historical_name={"GASP": None, "FLOPS": None, "LEAPS1": None}, units='unitless', desc='attachment location of strut as fraction of the half-span', + default_value=0.0, # added ) add_meta_data( @@ -4557,6 +4579,7 @@ historical_name={"GASP": 'INGASP.STRTCHD', "FLOPS": None, "LEAPS1": None}, units='ft', desc='chord of the strut', + default_value=0.0, # added ) add_meta_data( @@ -4674,7 +4697,7 @@ }, units='unitless', desc='vertical tail theoretical aspect ratio', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -4698,6 +4721,7 @@ }, units='ft', desc='Reynolds characteristic length for the vertical tail', + default_value=0.0, # added ) add_meta_data( @@ -4713,6 +4737,7 @@ }, units='unitless', desc='vertical tail fineness ratio', + default_value=0.0, # added ) add_meta_data( @@ -4906,7 +4931,7 @@ }, units='ft**2', desc='vertical tails wetted area', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -4996,7 +5021,7 @@ }, units='ft**2', desc='reference wing area', - default_value=0.0, + default_value=0.0, # In several components, it was set to 100, 150, 200, 1370.3 etc. ) add_meta_data( @@ -5022,7 +5047,7 @@ }, units='unitless', desc='ratio of the wing span to its mean chord', - default_value=0.0, + default_value=0.0, # in several components, it was 1 or 10.13. ) add_meta_data( @@ -5044,6 +5069,7 @@ historical_name={"GASP": 'INGASP.CBARW', "FLOPS": None, "LEAPS1": None}, units='ft', desc='mean aerodynamic chord of the wing', + default_value=0.0, # added ) add_meta_data( @@ -5055,7 +5081,8 @@ "LEAPS1": 'aircraft.outputs.L0_wing.bending_material_factor', }, units='unitless', - desc='Wing bending material factor with sweep adjustment. Used to compute', + desc='Wing bending material factor with sweep adjustment. Used to compute ', + 'Aircraft.Wing.BENDING_MATERIAL_MASS', default_value=0.0, # added ) @@ -5121,6 +5148,7 @@ historical_name={"GASP": 'INGASP.CRCLW', "FLOPS": None, "LEAPS1": None}, units='ft', desc='wing chord at fuselage centerline', + default_value=0.0, # added ) add_meta_data( @@ -5145,6 +5173,7 @@ }, units='ft', desc='Reynolds characteristic length for the wing', + default_value=0.0, # added ) add_meta_data( @@ -5279,6 +5308,7 @@ }, units='unitless', desc='wing fineness ratio', + default_value=0.0, # added ) add_meta_data( @@ -5380,7 +5410,8 @@ historical_name={"GASP": 'INGASP.YWFOLD', "FLOPS": None, "LEAPS1": None}, units='ft', desc='folded wingspan', - default_value=118, + # In geometry/gasp_based/non_dimensional_conversion.py and geometry/gasp_based/wing.py, it was 25. + default_value=0, # changed from 118 ) add_meta_data( @@ -5539,6 +5570,7 @@ historical_name={"GASP": 'INGASP.SWPLE', "FLOPS": None, "LEAPS1": None}, units='rad', desc='sweep angle at leading edge of wing', + default_value=0.0, # added ) add_meta_data( @@ -5593,6 +5625,7 @@ }, units='lbf/ft**2', desc='wing loading', + default_value=0.0, # added. In several components, it was 128. ) add_meta_data( @@ -5809,6 +5842,7 @@ }, units='ft', desc='wing chord length at wing root', + default_value=0.0, # added ) add_meta_data( @@ -5884,6 +5918,7 @@ }, units='ft', desc='span of main wing', + # in several components, it was set to 128, or 117.8 but there are other values. default_value=0.0, ) @@ -5998,7 +6033,8 @@ }, units='deg', desc='quarter-chord sweep angle of the wing', - default_value=0.0, # TODO required + # In several components, it was 0.436 (rad) or 25 (deg). + default_value=0.0, # TODO required. ) add_meta_data( @@ -6023,7 +6059,7 @@ }, units='unitless', desc='taper ratio of the wing', - default_value=0.0, # TODO required + default_value=0.0, # TODO required. In several components, it was .33. ) add_meta_data( @@ -6084,6 +6120,7 @@ historical_name={"GASP": 'INGASP.TCR', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='thickness-to-chord ratio at the root of the wing', + default_value=0.0, # added. In several components, it was 0.11 or 0.15. ) add_meta_data( @@ -6092,6 +6129,7 @@ historical_name={"GASP": 'INGASP.TCT', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='thickness-to-chord ratio at the tip of the wing', + default_value=0.0, # added. In geometry/gasp_based/wing.py, it was 0.1 ) add_meta_data( @@ -6100,6 +6138,7 @@ historical_name={"GASP": 'INGASP.TC', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='wing thickness-chord ratio at the wing station of the mean aerodynamic chord', + default_value=0.0, # added. In geometry/gasp_based/wing.py, it was 0.1. ) add_meta_data( @@ -6147,7 +6186,7 @@ }, units='ft**2', desc='wing wetted area', - default_value=None, + default_value=0.0, # changed from None ) add_meta_data( @@ -6782,7 +6821,8 @@ }, units='lbm', desc='design gross mass of the aircraft', - default_value=0.0, # changed from None + # changed form None. In several components, it was set to 20000, 152000 or 175400. + default_value=0.0, ) add_meta_data( From e4d4802d148c4bb336fc9f6db7d1764e7c5969fa Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 10 Jan 2025 08:34:33 -0800 Subject: [PATCH 73/89] roll back --- aviary/variable_info/variable_meta_data.py | 88 ++++++---------------- 1 file changed, 23 insertions(+), 65 deletions(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index af25ed5b6..4c5984b80 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -418,7 +418,7 @@ }, units='unitless', desc='canard theoretical aspect ratio', - default_value=0.0, # changed from None + default_value=None, ) add_meta_data( @@ -434,7 +434,6 @@ }, units='ft', desc='Reynolds characteristic length for the canard', - default_value=0.0, # added ) add_meta_data( @@ -450,7 +449,6 @@ }, units='unitless', desc='canard fineness ratio', - default_value=0.0, # added ) add_meta_data( @@ -555,7 +553,7 @@ }, units='ft**2', desc='canard wetted area', - default_value=0.0, # changed from None + default_value=None, ) add_meta_data( @@ -621,7 +619,6 @@ historical_name={"GASP": 'INGASP.WFC', "FLOPS": None, "LEAPS1": None}, units='lbm', desc='total mass of cockpit controls, fixed wing controls, and SAS', - default_value=0.0, # added ) # _____ _____ _ _ @@ -1172,7 +1169,6 @@ historical_name={"GASP": 'INGASP.SKCC', "FLOPS": None, "LEAPS1": None}, units="unitless", desc='mass trend coefficient of cockpit controls', - default_value=0.0, # added ) add_meta_data( @@ -1255,7 +1251,7 @@ add_meta_data( # Note users must enable this feature, or the associated calculation is - # discarded. Default to 0.0 + # discarded Aircraft.Design.EMPTY_MASS_MARGIN_SCALER, meta_data=_MetaData, historical_name={ @@ -1265,7 +1261,7 @@ }, units='unitless', desc='empty mass margin scaler', - default_value=0.0, + default_value=0.0, # Note: not 1.0 here ) add_meta_data( @@ -1718,7 +1714,6 @@ historical_name={"GASP": 'INGASP.LCABLE', "FLOPS": None, "LEAPS1": None}, units='ft', desc='length of cable for hybrid electric augmented system', - default_value=0.0, # added ) add_meta_data( @@ -2163,7 +2158,7 @@ historical_name={"GASP": 'INGASP.DIAM_REF', "FLOPS": None, "LEAPS1": None}, units='ft', desc='engine reference diameter', - default_value=0.0, # In geometry/gasp_based/engine.py, it was 5.8 + default_value=0.0, ) # NOTE This unscaled turbine (engine) weight is an input provided by the user, and is not @@ -2370,7 +2365,6 @@ units='unitless', desc='Engine wing mount locations as fractions of semispan; (NUM_WING_ENGINES)/2 values ' 'are input', - # In mass/gasp_based/fixed.py and geometry/gasp_based/electric.py, default was [0.35] default_value=np.array([0.0]), ) @@ -2891,8 +2885,6 @@ historical_name={"GASP": 'INGASP.SKWF', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='fraction of total theoretical wing volume used for wing fuel', - # added. In geometry/gasp_based/wing.py, it was 0.6. In /mass/gasp_based/equipment_and_useful_load.py, it was 0.5. - default_value=0.0, ) add_meta_data( @@ -2975,7 +2967,6 @@ historical_name={"GASP": 'INGASP.FVOLW_GEOM', "FLOPS": None, "LEAPS1": None}, units='ft**3', desc='wing tank fuel volume based on geometry', - default_value=0.0, # added ) add_meta_data( @@ -3072,7 +3063,7 @@ }, units='ft', desc='average fuselage diameter', - default_value=0.0, # added. In several components, it was set to 10 or 13.1. + default_value=0.0, # added ) add_meta_data( @@ -3088,7 +3079,6 @@ }, units='ft', desc='Reynolds characteristic length for the fuselage', - default_value=0.0, # added ) add_meta_data( @@ -3109,7 +3099,7 @@ historical_name={"GASP": 'INGASP.HCK', "FLOPS": None, "LEAPS1": None}, units='ft', desc='mean fuselage cabin diameter minus mean fuselage nose diameter', - default_value=0.0, # In geometry/gasp_based/fuselage.py, it was 4.5. + default_value=4.5, ) add_meta_data( @@ -3122,7 +3112,6 @@ }, units='unitless', desc='fuselage diameter to wing span ratio', - default_value=0.0, # added ) add_meta_data( @@ -3138,7 +3127,6 @@ }, units='unitless', desc='fuselage fineness ratio', - default_value=0.0, # added ) add_meta_data( @@ -3207,7 +3195,7 @@ desc='Define the Fuselage total length. If total_length is not input for a ' 'passenger transport, LEAPS will calculate the fuselage length, width and ' 'depth and the length of the passenger compartment.', - default_value=0.0, # in several components, it was set to 129.4 or 200. + default_value=0.0, ) add_meta_data( @@ -3220,7 +3208,6 @@ }, units='unitless', desc='fuselage length to diameter ratio', - default_value=0.0, # added ) add_meta_data( @@ -3392,7 +3379,6 @@ historical_name={"GASP": 'INGASP.ELPC', "FLOPS": None, "LEAPS1": None}, units='ft', desc='length of the pilot compartment', - default_value=0.0, # added. # In geometry/gasp_based/fuselage.py, it was 9.5 ) add_meta_data( @@ -3514,7 +3500,7 @@ }, units='unitless', desc='horizontal tail theoretical aspect ratio', - default_value=4.75, # changed from None + default_value=None, ) add_meta_data( @@ -3538,7 +3524,6 @@ }, units='ft', desc='Reynolds characteristic length for the horizontal tail', - default_value=0.0, # added ) add_meta_data( @@ -3554,7 +3539,6 @@ }, units='unitless', desc='horizontal tail fineness ratio', - default_value=0.0, # added ) add_meta_data( @@ -3690,8 +3674,7 @@ }, units='unitless', desc='horizontal tail theoretical taper ratio', - # In geometry/flops_based/prep_geom.py and mass/gasp_based/empennage.py, it was 0.352. - default_value=0.0, # changed from None. + default_value=None, ) add_meta_data( @@ -3721,7 +3704,7 @@ 'tail is mounted. Defaults: 0.0 == for body mounted (default for ' 'transport with all engines on wing); 1.0 == for T tail ' '(default for transport with multiple engines on fuselage)', - default_value=0.0, # added + default_value=None, ) add_meta_data( @@ -3836,7 +3819,7 @@ }, units='psi', desc='hydraulic system pressure', - default_value=0.0, # changed from 3000.0 + default_value=0.0, ) # @@ -4136,7 +4119,6 @@ }, units='ft', desc='Reynolds characteristic length for nacelle for each engine model', - default_value=0.0, # added ) add_meta_data( @@ -4154,7 +4136,7 @@ historical_name={"GASP": 'INGASP.DNQDE', "FLOPS": None, "LEAPS1": None}, units="unitless", desc='ratio of nacelle diameter to engine core diameter', - default_value=1.25, # In geometry/gasp_based/engine.py, it was 1.25 + default_value=1.25, ) add_meta_data( @@ -4170,7 +4152,6 @@ }, units='unitless', desc='nacelle fineness ratio', - default_value=0.0, # added. # In geometry/gasp_based/engine.py, it was 2. ) add_meta_data( @@ -4268,7 +4249,6 @@ }, units='ft**2', desc='total nacelles wetted area', - default_value=0.0, # added ) add_meta_data( @@ -4284,7 +4264,6 @@ }, units='ft**2', desc='wetted area of a single nacelle for each engine model', - default_value=0.0, # added ) add_meta_data( @@ -4547,7 +4526,6 @@ historical_name={"GASP": 'INGASP.SSTQSW', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='ratio of strut area to wing area', - default_value=0.0, # added. In geometry/gasp_based/strut.py, it was set to .2. ) add_meta_data( @@ -4560,7 +4538,6 @@ }, units='ft', desc='attachment location of strut the full attachment-to-attachment span', - default_value=0.0, # added ) # related to Aircraft.Strut.ATTACHMENT_LOCATION @@ -4570,7 +4547,6 @@ historical_name={"GASP": None, "FLOPS": None, "LEAPS1": None}, units='unitless', desc='attachment location of strut as fraction of the half-span', - default_value=0.0, # added ) add_meta_data( @@ -4579,7 +4555,6 @@ historical_name={"GASP": 'INGASP.STRTCHD', "FLOPS": None, "LEAPS1": None}, units='ft', desc='chord of the strut', - default_value=0.0, # added ) add_meta_data( @@ -4697,7 +4672,7 @@ }, units='unitless', desc='vertical tail theoretical aspect ratio', - default_value=0.0, # changed from None + default_value=None, ) add_meta_data( @@ -4721,7 +4696,6 @@ }, units='ft', desc='Reynolds characteristic length for the vertical tail', - default_value=0.0, # added ) add_meta_data( @@ -4737,7 +4711,6 @@ }, units='unitless', desc='vertical tail fineness ratio', - default_value=0.0, # added ) add_meta_data( @@ -4931,7 +4904,7 @@ }, units='ft**2', desc='vertical tails wetted area', - default_value=0.0, # changed from None + default_value=None, ) add_meta_data( @@ -5021,7 +4994,7 @@ }, units='ft**2', desc='reference wing area', - default_value=0.0, # In several components, it was set to 100, 150, 200, 1370.3 etc. + default_value=0.0, ) add_meta_data( @@ -5047,7 +5020,7 @@ }, units='unitless', desc='ratio of the wing span to its mean chord', - default_value=0.0, # in several components, it was 1 or 10.13. + default_value=0.0, ) add_meta_data( @@ -5069,7 +5042,6 @@ historical_name={"GASP": 'INGASP.CBARW', "FLOPS": None, "LEAPS1": None}, units='ft', desc='mean aerodynamic chord of the wing', - default_value=0.0, # added ) add_meta_data( @@ -5081,8 +5053,7 @@ "LEAPS1": 'aircraft.outputs.L0_wing.bending_material_factor', }, units='unitless', - desc='Wing bending material factor with sweep adjustment. Used to compute ', - 'Aircraft.Wing.BENDING_MATERIAL_MASS', + desc='Wing bending material factor with sweep adjustment. Used to compute', default_value=0.0, # added ) @@ -5148,7 +5119,6 @@ historical_name={"GASP": 'INGASP.CRCLW', "FLOPS": None, "LEAPS1": None}, units='ft', desc='wing chord at fuselage centerline', - default_value=0.0, # added ) add_meta_data( @@ -5173,7 +5143,6 @@ }, units='ft', desc='Reynolds characteristic length for the wing', - default_value=0.0, # added ) add_meta_data( @@ -5308,7 +5277,6 @@ }, units='unitless', desc='wing fineness ratio', - default_value=0.0, # added ) add_meta_data( @@ -5410,8 +5378,7 @@ historical_name={"GASP": 'INGASP.YWFOLD', "FLOPS": None, "LEAPS1": None}, units='ft', desc='folded wingspan', - # In geometry/gasp_based/non_dimensional_conversion.py and geometry/gasp_based/wing.py, it was 25. - default_value=0, # changed from 118 + default_value=118, ) add_meta_data( @@ -5570,7 +5537,6 @@ historical_name={"GASP": 'INGASP.SWPLE', "FLOPS": None, "LEAPS1": None}, units='rad', desc='sweep angle at leading edge of wing', - default_value=0.0, # added ) add_meta_data( @@ -5625,7 +5591,6 @@ }, units='lbf/ft**2', desc='wing loading', - default_value=0.0, # added. In several components, it was 128. ) add_meta_data( @@ -5842,7 +5807,6 @@ }, units='ft', desc='wing chord length at wing root', - default_value=0.0, # added ) add_meta_data( @@ -5918,7 +5882,6 @@ }, units='ft', desc='span of main wing', - # in several components, it was set to 128, or 117.8 but there are other values. default_value=0.0, ) @@ -6033,8 +5996,7 @@ }, units='deg', desc='quarter-chord sweep angle of the wing', - # In several components, it was 0.436 (rad) or 25 (deg). - default_value=0.0, # TODO required. + default_value=0.0, # TODO required ) add_meta_data( @@ -6059,7 +6021,7 @@ }, units='unitless', desc='taper ratio of the wing', - default_value=0.0, # TODO required. In several components, it was .33. + default_value=0.0, # TODO required ) add_meta_data( @@ -6120,7 +6082,6 @@ historical_name={"GASP": 'INGASP.TCR', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='thickness-to-chord ratio at the root of the wing', - default_value=0.0, # added. In several components, it was 0.11 or 0.15. ) add_meta_data( @@ -6129,7 +6090,6 @@ historical_name={"GASP": 'INGASP.TCT', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='thickness-to-chord ratio at the tip of the wing', - default_value=0.0, # added. In geometry/gasp_based/wing.py, it was 0.1 ) add_meta_data( @@ -6138,7 +6098,6 @@ historical_name={"GASP": 'INGASP.TC', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='wing thickness-chord ratio at the wing station of the mean aerodynamic chord', - default_value=0.0, # added. In geometry/gasp_based/wing.py, it was 0.1. ) add_meta_data( @@ -6186,7 +6145,7 @@ }, units='ft**2', desc='wing wetted area', - default_value=0.0, # changed from None + default_value=None, ) add_meta_data( @@ -6821,8 +6780,7 @@ }, units='lbm', desc='design gross mass of the aircraft', - # changed form None. In several components, it was set to 20000, 152000 or 175400. - default_value=0.0, + default_value=0.0, # changed from None ) add_meta_data( From f613fdf5103c18103bc89f44f88c29168710b85e Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 10 Jan 2025 11:54:51 -0800 Subject: [PATCH 74/89] remove temperary comments. --- aviary/variable_info/variable_meta_data.py | 117 ++++++++++----------- 1 file changed, 55 insertions(+), 62 deletions(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index a71ba424b..34be30a99 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -418,7 +418,7 @@ }, units='unitless', desc='canard theoretical aspect ratio', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -434,7 +434,7 @@ }, units='ft', desc='Reynolds characteristic length for the canard', - default_value=0.0, # added + default_value=0.0 ) add_meta_data( @@ -450,7 +450,7 @@ }, units='unitless', desc='canard fineness ratio', - default_value=0.0, # added + default_value=0.0 ) add_meta_data( @@ -555,7 +555,7 @@ }, units='ft**2', desc='canard wetted area', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -1582,7 +1582,7 @@ }, units='ft**2', desc='total aircraft wetted area', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -1706,7 +1706,7 @@ historical_name={"GASP": 'INGASP.LCABLE', "FLOPS": None, "LEAPS1": None}, units='ft', desc='length of cable for hybrid electric augmented system', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -2151,7 +2151,7 @@ historical_name={"GASP": 'INGASP.DIAM_REF', "FLOPS": None, "LEAPS1": None}, units='ft', desc='engine reference diameter', - default_value=0.0, # In geometry/gasp_based/engine.py, it was 5.8 + default_value=0.0, ) # NOTE This unscaled turbine (engine) weight is an input provided by the user, and is not @@ -2358,7 +2358,6 @@ units='unitless', desc='Engine wing mount locations as fractions of semispan; (NUM_WING_ENGINES)/2 values ' 'are input', - # In mass/gasp_based/fixed.py and geometry/gasp_based/electric.py, default was [0.35] default_value=np.array([0.0]), ) @@ -2878,7 +2877,6 @@ historical_name={"GASP": 'INGASP.SKWF', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='fraction of total theoretical wing volume used for wing fuel', - # added. In geometry/gasp_based/wing.py, it was 0.6. In /mass/gasp_based/equipment_and_useful_load.py, it was 0.5. default_value=0.0, ) @@ -2962,7 +2960,7 @@ historical_name={"GASP": 'INGASP.FVOLW_GEOM', "FLOPS": None, "LEAPS1": None}, units='ft**3', desc='wing tank fuel volume based on geometry', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3058,7 +3056,7 @@ }, units='ft', desc='average fuselage diameter', - default_value=0.0, # added. In several components, it was set to 10 or 13.1. + default_value=0.0, ) add_meta_data( @@ -3074,7 +3072,7 @@ }, units='ft', desc='Reynolds characteristic length for the fuselage', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3095,7 +3093,7 @@ historical_name={"GASP": 'INGASP.HCK', "FLOPS": None, "LEAPS1": None}, units='ft', desc='mean fuselage cabin diameter minus mean fuselage nose diameter', - default_value=0.0, # In geometry/gasp_based/fuselage.py, it was 4.5. + default_value=0.0, ) add_meta_data( @@ -3108,7 +3106,7 @@ }, units='unitless', desc='fuselage diameter to wing span ratio', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3124,7 +3122,7 @@ }, units='unitless', desc='fuselage fineness ratio', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3193,7 +3191,7 @@ desc='Define the Fuselage total length. If total_length is not input for a ' 'passenger transport, LEAPS will calculate the fuselage length, width and ' 'depth and the length of the passenger compartment.', - default_value=0.0, # in several components, it was set to 129.4 or 200. + default_value=0.0, ) add_meta_data( @@ -3206,7 +3204,7 @@ }, units='unitless', desc='fuselage length to diameter ratio', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3260,7 +3258,7 @@ }, units='ft', desc='maximum fuselage height', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3378,7 +3376,7 @@ historical_name={"GASP": 'INGASP.ELPC', "FLOPS": None, "LEAPS1": None}, units='ft', desc='length of the pilot compartment', - default_value=0.0, # added. # In geometry/gasp_based/fuselage.py, it was 9.5 + default_value=0.0, ) add_meta_data( @@ -3391,7 +3389,7 @@ }, units='ft**2', desc='fuselage planform area', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3449,7 +3447,7 @@ }, units='ft**2', desc='fuselage wetted area', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -3500,7 +3498,7 @@ }, units='unitless', desc='horizontal tail theoretical aspect ratio', - default_value=4.75, # changed from None + default_value=4.75, ) add_meta_data( @@ -3524,7 +3522,7 @@ }, units='ft', desc='Reynolds characteristic length for the horizontal tail', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3540,7 +3538,7 @@ }, units='unitless', desc='horizontal tail fineness ratio', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3676,8 +3674,7 @@ }, units='unitless', desc='horizontal tail theoretical taper ratio', - # In geometry/flops_based/prep_geom.py and mass/gasp_based/empennage.py, it was 0.352. - default_value=0.0, # changed from None. + default_value=0.0, ) add_meta_data( @@ -3707,7 +3704,7 @@ 'tail is mounted. Defaults: 0.0 == for body mounted (default for ' 'transport with all engines on wing); 1.0 == for T tail ' '(default for transport with multiple engines on fuselage)', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3735,7 +3732,7 @@ }, units='ft**2', desc='horizontal tail wetted area', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -4090,7 +4087,7 @@ }, units='ft', desc='Average diameter of engine nacelles for each engine model', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4105,7 +4102,7 @@ }, units='ft', desc='Average length of nacelles for each engine model', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4121,7 +4118,7 @@ }, units='ft', desc='Reynolds characteristic length for nacelle for each engine model', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4139,7 +4136,7 @@ historical_name={"GASP": 'INGASP.DNQDE', "FLOPS": None, "LEAPS1": None}, units="unitless", desc='ratio of nacelle diameter to engine core diameter', - default_value=1.25, # In geometry/gasp_based/engine.py, it was 1.25 + default_value=1.25, ) add_meta_data( @@ -4155,7 +4152,7 @@ }, units='unitless', desc='nacelle fineness ratio', - default_value=0.0, # added. # In geometry/gasp_based/engine.py, it was 2. + default_value=0.0, ) add_meta_data( @@ -4253,7 +4250,7 @@ }, units='ft**2', desc='total nacelles wetted area', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4269,7 +4266,7 @@ }, units='ft**2', desc='wetted area of a single nacelle for each engine model', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4528,7 +4525,7 @@ historical_name={"GASP": 'INGASP.SSTQSW', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='ratio of strut area to wing area', - default_value=0.0, # added. In geometry/gasp_based/strut.py, it was set to .2. + default_value=0.0, ) add_meta_data( @@ -4541,7 +4538,7 @@ }, units='ft', desc='attachment location of strut the full attachment-to-attachment span', - default_value=0.0, # added + default_value=0.0, ) # related to Aircraft.Strut.ATTACHMENT_LOCATION @@ -4551,7 +4548,7 @@ historical_name={"GASP": None, "FLOPS": None, "LEAPS1": None}, units='unitless', desc='attachment location of strut as fraction of the half-span', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4560,7 +4557,7 @@ historical_name={"GASP": 'INGASP.STRTCHD', "FLOPS": None, "LEAPS1": None}, units='ft', desc='chord of the strut', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4678,7 +4675,7 @@ }, units='unitless', desc='vertical tail theoretical aspect ratio', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -4702,7 +4699,7 @@ }, units='ft', desc='Reynolds characteristic length for the vertical tail', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4718,7 +4715,7 @@ }, units='unitless', desc='vertical tail fineness ratio', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4869,7 +4866,7 @@ }, units='unitless', desc='vertical tail theoretical taper ratio', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -4912,7 +4909,7 @@ }, units='ft**2', desc='vertical tails wetted area', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -5002,7 +4999,7 @@ }, units='ft**2', desc='reference wing area', - default_value=0.0, # In several components, it was set to 100, 150, 200, 1370.3 etc. + default_value=0.0, ) add_meta_data( @@ -5028,7 +5025,7 @@ }, units='unitless', desc='ratio of the wing span to its mean chord', - default_value=0.0, # in several components, it was 1 or 10.13. + default_value=0.0, ) add_meta_data( @@ -5049,7 +5046,7 @@ historical_name={"GASP": 'INGASP.CBARW', "FLOPS": None, "LEAPS1": None}, units='ft', desc='mean aerodynamic chord of the wing', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -5127,7 +5124,7 @@ historical_name={"GASP": 'INGASP.CRCLW', "FLOPS": None, "LEAPS1": None}, units='ft', desc='wing chord at fuselage centerline', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -5152,7 +5149,7 @@ }, units='ft', desc='Reynolds characteristic length for the wing', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -5285,7 +5282,7 @@ }, units='unitless', desc='wing fineness ratio', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -5387,7 +5384,6 @@ historical_name={"GASP": 'INGASP.YWFOLD', "FLOPS": None, "LEAPS1": None}, units='ft', desc='folded wingspan', - # In geometry/gasp_based/non_dimensional_conversion.py and geometry/gasp_based/wing.py, it was 25. default_value=0, ) @@ -5547,7 +5543,7 @@ historical_name={"GASP": 'INGASP.SWPLE', "FLOPS": None, "LEAPS1": None}, units='rad', desc='sweep angle at leading edge of wing', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -5602,7 +5598,7 @@ }, units='lbf/ft**2', desc='wing loading', - default_value=0.0, # added. In several components, it was 128. + default_value=0.0, ) add_meta_data( @@ -5819,7 +5815,7 @@ }, units='ft', desc='wing chord length at wing root', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -5895,7 +5891,6 @@ }, units='ft', desc='span of main wing', - # in several components, it was set to 128, or 117.8 but there are other values. default_value=0.0, ) @@ -6010,7 +6005,6 @@ }, units='deg', desc='quarter-chord sweep angle of the wing', - # In several components, it was 0.436 (rad) or 25 (deg). default_value=0.0, # TODO required. ) @@ -6036,7 +6030,7 @@ }, units='unitless', desc='taper ratio of the wing', - default_value=0.0, # TODO required. In several components, it was .33. + default_value=0.0, # TODO required. ) add_meta_data( @@ -6097,7 +6091,7 @@ historical_name={"GASP": 'INGASP.TCR', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='thickness-to-chord ratio at the root of the wing', - default_value=0.0, # added. In several components, it was 0.11 or 0.15. + default_value=0.0, ) add_meta_data( @@ -6106,7 +6100,7 @@ historical_name={"GASP": 'INGASP.TCT', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='thickness-to-chord ratio at the tip of the wing', - default_value=0.0, # added. In geometry/gasp_based/wing.py, it was 0.1 + default_value=0.0, ) add_meta_data( @@ -6115,7 +6109,7 @@ historical_name={"GASP": 'INGASP.TC', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='wing thickness-chord ratio at the wing station of the mean aerodynamic chord', - default_value=0.0, # added. In geometry/gasp_based/wing.py, it was 0.1. + default_value=0.0, ) add_meta_data( @@ -6163,7 +6157,7 @@ }, units='ft**2', desc='wing wetted area', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -6797,7 +6791,6 @@ }, units='lbm', desc='design gross mass of the aircraft', - # changed form None. In several components, it was set to 20000, 152000 or 175400. default_value=0.0, ) From 1ee5445b4855bc89f88cd89be7a9ce93c57a8ea8 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 10 Jan 2025 12:10:10 -0800 Subject: [PATCH 75/89] remove temperary comments. --- aviary/variable_info/variable_meta_data.py | 151 +++++++++++---------- 1 file changed, 76 insertions(+), 75 deletions(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index 4c5984b80..8b8919fb4 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -70,7 +70,7 @@ }, units='lbm', desc='air conditioning system mass', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -122,7 +122,7 @@ }, units='lbm', desc='mass of anti-icing system (auxiliary gear)', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -163,7 +163,7 @@ }, units='lbm', desc='mass of auxiliary power unit', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -204,7 +204,7 @@ }, units='lbm', desc='avionics mass', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -493,7 +493,7 @@ }, units='lbm', desc='mass of canards', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -519,7 +519,7 @@ }, units='unitless', desc='canard theoretical taper ratio', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -645,7 +645,7 @@ }, units='lbm', desc='mass of passenger baggage', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -678,7 +678,7 @@ }, units='lbm', desc='mass of cargo containers', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -709,7 +709,7 @@ }, units='lbm', desc='total mass of cargo', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -805,7 +805,7 @@ }, units='lbm', desc='total mass of the flight crew and their baggage', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -865,7 +865,7 @@ }, units='lbm', desc='total mass of the non-flight crew and their baggage', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -1012,7 +1012,7 @@ }, units='lbm', desc='TBD: total mass of all passengers without their baggage', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -1033,7 +1033,7 @@ historical_name={"GASP": 'INGASP.WPL', "FLOPS": None, "LEAPS1": None}, units='lbm', desc='mass of passenger payload, including passengers, passenger baggage', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -1052,7 +1052,7 @@ }, units='lbm', desc='mass of passenger service equipment', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -1246,7 +1246,7 @@ }, units='lbm', desc='empty mass margin', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -1261,7 +1261,7 @@ }, units='unitless', desc='empty mass margin scaler', - default_value=0.0, # Note: not 1.0 here + default_value=0.0, ) add_meta_data( @@ -1274,7 +1274,7 @@ meta_data=_MetaData, units='lbm', desc='total mass of all user-defined external subsystems', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -1421,7 +1421,7 @@ }, units='lbm', desc='operating mass empty of the aircraft', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -1501,7 +1501,7 @@ }, units='lbm', desc='Total structural group mass', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -1552,7 +1552,7 @@ }, units='lbm', desc='Total systems & equipment group mass', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -1564,7 +1564,7 @@ historical_name={"GASP": None, "FLOPS": None, "LEAPS1": None}, units='lbm', desc='Total systems & equipment group mass without additional 1% of ' 'empty mass', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -1589,7 +1589,7 @@ }, units='ft**2', desc='total aircraft wetted area', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -1611,7 +1611,7 @@ }, units='lbm', desc='design landing mass', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -1672,7 +1672,7 @@ }, units='lbm', desc='zero fuel mass', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -1732,7 +1732,7 @@ }, units='lbm', desc='mass of the electrical system', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -2594,7 +2594,7 @@ }, units='lbm', desc='mass of vertical fins', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -2635,7 +2635,7 @@ }, units='unitless', desc='vertical fin theoretical taper ratio', - default_value=0.0, # changed from None + default_value=0.0, ) # ______ _ @@ -2656,7 +2656,7 @@ }, units='lbm', desc='fuel capacity of the auxiliary tank', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -2677,7 +2677,7 @@ }, units='unitless', desc='fuel capacity factor', - default_value=1.0, # changed from 23.0 + default_value=1.0, ) add_meta_data( @@ -2731,7 +2731,7 @@ }, units='lbm', desc='fuel system mass', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -2770,7 +2770,7 @@ }, units='lbm', desc='fuel capacity of the fuselage', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -2803,7 +2803,7 @@ desc='Total fuel capacity of the aircraft including wing, fuselage and ' 'auxiliary tanks. Used in generating payload-range diagram (Default = ' 'wing_capacity + fuselage_capacity + aux_capacity)', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -2821,7 +2821,7 @@ }, units='galUS', # need to check this desc='Total fuel volume', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -2840,7 +2840,7 @@ }, units='lbm', desc='unusable fuel mass', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -2876,7 +2876,7 @@ }, units='lbm', desc='fuel capacity of the auxiliary tank', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -3005,7 +3005,7 @@ }, units='lbm', desc='Total furnishings system mass', - default_value=0.0, # changed form None + default_value=0.0, ) add_meta_data( @@ -3014,7 +3014,7 @@ historical_name={"GASP": None, "FLOPS": None, "LEAPS1": None}, units='lbm', desc='Base furnishings system mass without additional 1% empty mass', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3063,7 +3063,7 @@ }, units='ft', desc='average fuselage diameter', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3226,7 +3226,7 @@ }, units='lbm', desc='mass of the fuselage structure', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -3261,7 +3261,7 @@ }, units='ft', desc='maximum fuselage height', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3391,7 +3391,7 @@ }, units='ft**2', desc='fuselage planform area', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -3449,7 +3449,7 @@ }, units='ft**2', desc='fuselage wetted area', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -3592,7 +3592,7 @@ }, units='lbm', desc='mass of horizontal tail', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -3732,7 +3732,7 @@ }, units='ft**2', desc='horizontal tail wetted area', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -3792,7 +3792,7 @@ }, units='lbm', desc='mass of hydraulic system', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -3948,7 +3948,7 @@ }, units='lbm', desc='mass of main landing gear', - default_value=0, # added + default_value=0, ) add_meta_data( @@ -4010,7 +4010,7 @@ }, units='lbm', desc='mass of nose landing gear', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -4088,7 +4088,7 @@ }, units='ft', desc='Average diameter of engine nacelles for each engine model', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4103,7 +4103,7 @@ }, units='ft', desc='Average length of nacelles for each engine model', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4300,7 +4300,7 @@ }, units='lbm', desc='mass of paint for all wetted area', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4355,7 +4355,7 @@ }, units='lbm', desc='Total propulsion group mass', - default_value=0.0, # added + default_value=0.0, ) # TODO clash with per-engine scaling, need to resolve w/ heterogeneous engine @@ -4380,7 +4380,7 @@ historical_name={"GASP": None, "FLOPS": None, "LEAPS1": None}, units='lbm', desc='total estimated mass of the engine controls for all engines on aircraft', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4389,7 +4389,7 @@ historical_name={"GASP": 'INGASP.WEP', "FLOPS": None, "LEAPS1": None}, units='lbm', desc='total mass of all engines on aircraft', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -4408,7 +4408,7 @@ }, units='lbm', desc='engine oil mass', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -4428,7 +4428,7 @@ units='lbm', desc='sum of engine control, starter, and additional mass for all engines ' 'on aircraft', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -4500,7 +4500,7 @@ historical_name={"GASP": None, "FLOPS": None, "LEAPS1": None}, units='lbm', desc='total mass of thrust reversers for all engines on aircraft', - default_value=0.0, # changed from None + default_value=0.0, ) # _____ _ _ @@ -4764,7 +4764,7 @@ }, units='lbm', desc='mass of vertical tail', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -4861,7 +4861,7 @@ }, units='unitless', desc='vertical tail theoretical taper ratio', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -5033,7 +5033,7 @@ }, units='unitless', desc='Reference aspect ratio, used for detailed wing mass estimation.', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -5053,8 +5053,9 @@ "LEAPS1": 'aircraft.outputs.L0_wing.bending_material_factor', }, units='unitless', - desc='Wing bending material factor with sweep adjustment. Used to compute', - default_value=0.0, # added + desc='Wing bending material factor with sweep adjustment. Used to compute ' + 'Aircraft.Wing.BENDING_MATERIAL_MASS', + default_value=0.0, ) add_meta_data( @@ -5069,7 +5070,7 @@ }, units='lbm', desc='wing mass breakdown term 1', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -5097,7 +5098,7 @@ }, units='lbm', desc='wing mass breakdown term 4', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -5169,7 +5170,7 @@ units='unitless', desc='chord lengths as fractions of semispan at station locations; ' 'overwrites station_chord_lengths', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -5204,7 +5205,7 @@ }, units='ft**2', desc='area of wing control surfaces', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -5219,7 +5220,7 @@ units='unitless', desc='Defines the ratio of total moveable wing control surface areas ' '(flaps, elevators, spoilers, etc.) to reference wing area.', - default_value=0.0, # changed from 0.333 + default_value=0.0, ) add_meta_data( @@ -5261,7 +5262,7 @@ units='unitless', desc='Engine inertia relief factor for wingspan inboard of engine locations. Used ' 'to compute Aircraft.Wing.BENDING_MATERIAL_MASS', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -5578,7 +5579,7 @@ desc='Define the sweep of load path at station locations. Typically ' 'parallel to rear spar tending toward max t/c of airfoil. The Ith value ' 'is used between wing stations I and I+1.', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -5620,7 +5621,7 @@ }, units='lbm', desc='wing total mass', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -5729,7 +5730,7 @@ }, units='lbm', desc='wing mass breakdown term 3', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -5821,7 +5822,7 @@ }, units='lbm', desc='wing mass breakdown term 2', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -5948,7 +5949,7 @@ }, units='lbm', desc='mass of surface controls', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -6060,7 +6061,7 @@ }, units='unitless', desc='the thickeness-chord ratios at station locations', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( @@ -6749,7 +6750,7 @@ units='lbm', desc='fuel carried by the aircraft when it is on the ramp at the ' 'beginning of the design mission', - default_value=0.0, # added + default_value=0.0, ) add_meta_data( @@ -6780,7 +6781,7 @@ }, units='lbm', desc='design gross mass of the aircraft', - default_value=0.0, # changed from None + default_value=0.0, ) add_meta_data( From 97f19bbb1035eef35f1ac9e8f917c145c6a621b6 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 10 Jan 2025 13:33:24 -0800 Subject: [PATCH 76/89] remove two comments --- aviary/subsystems/geometry/gasp_based/empennage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index dddcc35ee..1b6b922ab 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -295,5 +295,5 @@ def setup(self): ) # override vertical tail defaults - self.set_input_defaults(Aircraft.VerticalTail.ASPECT_RATIO, 0.0) # 1.67 - self.set_input_defaults(Aircraft.VerticalTail.TAPER_RATIO, 0.0) # 0.801 + self.set_input_defaults(Aircraft.VerticalTail.ASPECT_RATIO, 0.0) + self.set_input_defaults(Aircraft.VerticalTail.TAPER_RATIO, 0.0) From 159b81c1300b77f931168b663c4f1bbc684cbeaa Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 10 Jan 2025 15:23:10 -0800 Subject: [PATCH 77/89] remove val= from individual components --- aviary/subsystems/geometry/gasp_based/empennage.py | 2 +- .../geometry/gasp_based/non_dimensional_conversion.py | 4 ++-- aviary/subsystems/geometry/gasp_based/wing.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index 1b6b922ab..336b369dc 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -90,7 +90,7 @@ def setup(self): desc="VBARH | VBARV: Horizontal tail volume coefficient" ) - add_aviary_input(self, Aircraft.Wing.AREA, val=1370) + add_aviary_input(self, Aircraft.Wing.AREA) self.add_input("r_arm", 0.2307, units="unitless", desc=( diff --git a/aviary/subsystems/geometry/gasp_based/non_dimensional_conversion.py b/aviary/subsystems/geometry/gasp_based/non_dimensional_conversion.py index 9d905d987..bdb03ae32 100644 --- a/aviary/subsystems/geometry/gasp_based/non_dimensional_conversion.py +++ b/aviary/subsystems/geometry/gasp_based/non_dimensional_conversion.py @@ -14,7 +14,7 @@ def initialize(self): add_aviary_option(self, Aircraft.Wing.HAS_STRUT) def setup(self): - add_aviary_input(self, Aircraft.Wing.SPAN, val=0) + add_aviary_input(self, Aircraft.Wing.SPAN) if self.options[Aircraft.Strut.DIMENSIONAL_LOCATION_SPECIFIED]: add_aviary_input(self, Aircraft.Strut.ATTACHMENT_LOCATION) @@ -70,7 +70,7 @@ def initialize(self): add_aviary_option(self, Aircraft.Wing.FOLD_DIMENSIONAL_LOCATION_SPECIFIED) def setup(self): - add_aviary_input(self, Aircraft.Wing.SPAN, val=0) + add_aviary_input(self, Aircraft.Wing.SPAN) if self.options[Aircraft.Wing.FOLD_DIMENSIONAL_LOCATION_SPECIFIED]: add_aviary_input(self, Aircraft.Wing.FOLDED_SPAN) diff --git a/aviary/subsystems/geometry/gasp_based/wing.py b/aviary/subsystems/geometry/gasp_based/wing.py index c2fd11e27..ed960ba01 100644 --- a/aviary/subsystems/geometry/gasp_based/wing.py +++ b/aviary/subsystems/geometry/gasp_based/wing.py @@ -548,7 +548,7 @@ def setup(self): desc="SLM_NF: taper ratio between wing root and fold location", ) - add_aviary_output(self, Aircraft.Wing.FOLDING_AREA, val=50) + add_aviary_output(self, Aircraft.Wing.FOLDING_AREA) self.add_output("nonfolded_wing_area", val=150, units="ft**2", desc="SW_NF: wing area of part of wings that does not fold", @@ -560,7 +560,7 @@ def setup(self): desc="AR_NF: aspect ratio of non-folding part of wing", ) - add_aviary_output(self, Aircraft.Fuel.WING_VOLUME_GEOMETRIC_MAX, val=0) + add_aviary_output(self, Aircraft.Fuel.WING_VOLUME_GEOMETRIC_MAX) self.declare_partials( "nonfolded_taper_ratio", From 3b083fbc50774c76961aef07fcaefc0ac5b77c73 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 10 Jan 2025 16:35:59 -0800 Subject: [PATCH 78/89] set val in two places --- aviary/subsystems/geometry/gasp_based/empennage.py | 2 +- aviary/subsystems/geometry/gasp_based/wing.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index 336b369dc..4e2dc3894 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -104,7 +104,7 @@ def setup(self): "For a horizontal tail, the mean wing chord. For a " "vertical tail, the wing span.") ) - self.add_input("ar", 4.75, units="unitless", + self.add_input("ar", 0.0, units="unitless", desc="ARHT | ARVT: Tail aspect ratio.") self.add_input("tr", 0.352, units="unitless", desc="SLMH | SLMV: Tail taper ratio.") diff --git a/aviary/subsystems/geometry/gasp_based/wing.py b/aviary/subsystems/geometry/gasp_based/wing.py index ed960ba01..bd7e759ad 100644 --- a/aviary/subsystems/geometry/gasp_based/wing.py +++ b/aviary/subsystems/geometry/gasp_based/wing.py @@ -542,7 +542,7 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.TAPER_RATIO) add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_ROOT) add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_TIP) - add_aviary_input(self, Aircraft.Fuel.WING_FUEL_FRACTION, val=0.6) + add_aviary_input(self, Aircraft.Fuel.WING_FUEL_FRACTION) self.add_output("nonfolded_taper_ratio", val=0.1, units="unitless", desc="SLM_NF: taper ratio between wing root and fold location", From f871e3a5adee939c66d79b6f788249f193ca64a9 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 10 Jan 2025 16:36:49 -0800 Subject: [PATCH 79/89] set a few default values to 0.0. --- aviary/variable_info/variable_meta_data.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index 34be30a99..6ea264d43 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -521,7 +521,7 @@ }, units='unitless', desc='canard theoretical taper ratio', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -2628,7 +2628,7 @@ }, units='unitless', desc='vertical fin theoretical taper ratio', - default_value=None, + default_value=0.0, ) # ______ _ @@ -3498,7 +3498,7 @@ }, units='unitless', desc='horizontal tail theoretical aspect ratio', - default_value=4.75, + default_value=0.0, ) add_meta_data( From ccef2a80b9862f61370196c075cfa8f8936d1f84 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 13 Jan 2025 09:03:58 -0800 Subject: [PATCH 80/89] set Aircraft.HorizontalTail.TAPER_RATIO = 0.0 --- aviary/subsystems/geometry/flops_based/prep_geom.py | 2 +- aviary/subsystems/geometry/gasp_based/empennage.py | 2 +- aviary/subsystems/mass/flops_based/horizontal_tail.py | 2 +- aviary/subsystems/mass/gasp_based/fixed.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aviary/subsystems/geometry/flops_based/prep_geom.py b/aviary/subsystems/geometry/flops_based/prep_geom.py index dfabcfa13..49ac2ed27 100644 --- a/aviary/subsystems/geometry/flops_based/prep_geom.py +++ b/aviary/subsystems/geometry/flops_based/prep_geom.py @@ -121,7 +121,7 @@ def setup(self): add_aviary_input(self, Aircraft.HorizontalTail.AREA) add_aviary_input(self, Aircraft.HorizontalTail.ASPECT_RATIO) - add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO, 0.352) + add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO) add_aviary_input(self, Aircraft.HorizontalTail.THICKNESS_TO_CHORD) add_aviary_input(self, Aircraft.VerticalTail.AREA) diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index 4e2dc3894..c1446c86b 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -106,7 +106,7 @@ def setup(self): ) self.add_input("ar", 0.0, units="unitless", desc="ARHT | ARVT: Tail aspect ratio.") - self.add_input("tr", 0.352, units="unitless", + self.add_input("tr", 0.0, units="unitless", desc="SLMH | SLMV: Tail taper ratio.") self.add_output("area", units="ft**2", desc="SHT | SVT: Tail area") diff --git a/aviary/subsystems/mass/flops_based/horizontal_tail.py b/aviary/subsystems/mass/flops_based/horizontal_tail.py index a647ebd8f..e67cd313f 100644 --- a/aviary/subsystems/mass/flops_based/horizontal_tail.py +++ b/aviary/subsystems/mass/flops_based/horizontal_tail.py @@ -14,7 +14,7 @@ class HorizontalTailMass(om.ExplicitComponent): def setup(self): add_aviary_input(self, Aircraft.HorizontalTail.AREA, val=0.0) - add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO, val=0.352) + add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO) add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) diff --git a/aviary/subsystems/mass/gasp_based/fixed.py b/aviary/subsystems/mass/gasp_based/fixed.py index 84fd865a0..5c46b3680 100644 --- a/aviary/subsystems/mass/gasp_based/fixed.py +++ b/aviary/subsystems/mass/gasp_based/fixed.py @@ -957,7 +957,7 @@ def setup(self): add_aviary_input(self, Aircraft.Fuselage.LENGTH, val=200) add_aviary_input(self, Aircraft.HorizontalTail.SPAN, val=7) add_aviary_input(self, Aircraft.LandingGear.TAIL_HOOK_MASS_SCALER, val=1) - add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO, val=0.352) + add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO) add_aviary_input(self, Aircraft.VerticalTail.MASS_COEFFICIENT, val=0.289) add_aviary_input(self, Aircraft.Wing.SPAN, val=118) add_aviary_input(self, Aircraft.HorizontalTail.AREA, val=15) From 7fbd0f39e1d18c5f90beb14a39243feb54481f60 Mon Sep 17 00:00:00 2001 From: Kenneth-T-Moore Date: Tue, 14 Jan 2025 16:36:14 -0500 Subject: [PATCH 81/89] Added example for working in-mission drag calculations. --- .../custom_aero/__init__.py | 0 .../custom_aero/custom_aero_builder.py | 107 ++++++++++++++++++ .../custom_aero/run_simple_aero.py | 59 ++++++++++ .../custom_aero/simple_drag.py | 104 +++++++++++++++++ aviary/mission/flops_based/ode/mission_ODE.py | 5 +- .../aerodynamics/aerodynamics_builder.py | 4 + .../subsystems/aerodynamics/test/__init__.py | 0 .../test/test_external_mission_aero.py | 65 +++++++++++ 8 files changed, 343 insertions(+), 1 deletion(-) create mode 100644 aviary/examples/external_subsystems/custom_aero/__init__.py create mode 100644 aviary/examples/external_subsystems/custom_aero/custom_aero_builder.py create mode 100644 aviary/examples/external_subsystems/custom_aero/run_simple_aero.py create mode 100644 aviary/examples/external_subsystems/custom_aero/simple_drag.py create mode 100644 aviary/subsystems/aerodynamics/test/__init__.py create mode 100644 aviary/subsystems/aerodynamics/test/test_external_mission_aero.py diff --git a/aviary/examples/external_subsystems/custom_aero/__init__.py b/aviary/examples/external_subsystems/custom_aero/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/aviary/examples/external_subsystems/custom_aero/custom_aero_builder.py b/aviary/examples/external_subsystems/custom_aero/custom_aero_builder.py new file mode 100644 index 000000000..482bcf39b --- /dev/null +++ b/aviary/examples/external_subsystems/custom_aero/custom_aero_builder.py @@ -0,0 +1,107 @@ +""" +Builder for a simple drag calculation that replaces Aviary's calculation. +""" +import openmdao.api as om + +from aviary.examples.external_subsystems.custom_aero.simple_drag import SimpleAeroGroup +from aviary.subsystems.subsystem_builder_base import SubsystemBuilderBase +from aviary.variable_info.variables import Aircraft, Dynamic + + +class CustomAeroBuilder(SubsystemBuilderBase): + """ + Prototype of a subsystem that overrides an aviary internally computed var. + + It also provides a method to build OpenMDAO systems for the pre-mission and mission computations of the subsystem. + + Attributes + ---------- + name : str ('simple_aero') + object label + """ + + def __init__(self, name='simple_aero'): + super().__init__(name) + + def build_mission(self, num_nodes, aviary_inputs, **kwargs): + """ + Build an OpenMDAO system for the mission computations of the subsystem. + + Returns + ------- + Returns + ------- + mission_sys : openmdao.core.System + An OpenMDAO system containing all computations that need to happen + during the mission. This includes time-dependent states that are + being integrated as well as any other variables that vary during + the mission. + """ + aero_group = SimpleAeroGroup( + num_nodes=num_nodes, + ) + return aero_group + + def mission_inputs(self, **kwargs): + promotes = [ + Dynamic.Atmosphere.STATIC_PRESSURE, + Dynamic.Atmosphere.MACH, + Dynamic.Vehicle.MASS, + 'aircraft:*', + ] + return promotes + + def mission_outputs(self, **kwargs): + promotes = [ + Dynamic.Vehicle.DRAG, + Dynamic.Vehicle.LIFT, + ] + return promotes + + def get_parameters(self, aviary_inputs=None, phase_info=None): + """ + Return a dictionary of fixed values for the subsystem. + + Optional, used if subsystems have fixed values. + + Used in the phase builders (e.g. cruise_phase.py) when other parameters are added to the phase. + + This is distinct from `get_design_vars` in a nuanced way. Design variables + are variables that are optimized by the problem that are not at the phase level. + An example would be something that occurs in the pre-mission level of the problem. + Parameters are fixed values that are held constant throughout a phase, but if + `opt=True`, they are able to change during the optimization. + + Parameters + ---------- + phase_info : dict + The phase_info subdict for this phase. + + Returns + ------- + fixed_values : dict + A dictionary where the keys are the names of the fixed variables + and the values are dictionaries with the following keys: + + - 'value': float or array + The fixed value for the variable. + - 'units': str + The units for the fixed value (optional). + - any additional keyword arguments required by OpenMDAO for the fixed + variable. + """ + params = {} + params[Aircraft.Wing.AREA] = { + 'shape': (1, ), + 'static_target': True, + 'units': 'ft**2', + } + return params + + def needs_mission_solver(self, aviary_inputs): + """ + Return True if the mission subsystem needs to be in the solver loop in mission, otherwise + return False. Aviary will only place it in the solver loop when True. The default is + True. + """ + return False diff --git a/aviary/examples/external_subsystems/custom_aero/run_simple_aero.py b/aviary/examples/external_subsystems/custom_aero/run_simple_aero.py new file mode 100644 index 000000000..056335d3b --- /dev/null +++ b/aviary/examples/external_subsystems/custom_aero/run_simple_aero.py @@ -0,0 +1,59 @@ +""" +Run the a mission with a simple external component that computes the wing +and horizontal tail mass. +""" +from copy import deepcopy + +import aviary.api as av +from aviary.examples.external_subsystems.custom_aero.custom_aero_builder import CustomAeroBuilder + + +phase_info = deepcopy(av.default_height_energy_phase_info) + +# Just do cruise in this example. +phase_info.pop('climb') +phase_info.pop('descent') + +# Add custom aero. +# TODO: This API for replacing aero will be changed an upcoming release. +phase_info['cruise']['external_subsystems'] = [CustomAeroBuilder()] + +# Disable internal aero +# TODO: This API for replacing aero will be changed an upcoming release. +phase_info['cruise']['subsystem_options']['core_aerodynamics'] = { + 'method': 'external', +} + + +if __name__ == '__main__': + prob = av.AviaryProblem() + + # Load aircraft and options data from user + # Allow for user overrides here + prob.load_inputs('models/test_aircraft/aircraft_for_bench_FwFm.csv', phase_info) + + # Preprocess inputs + prob.check_and_preprocess_inputs() + + prob.add_pre_mission_systems() + + prob.add_phases() + + prob.add_post_mission_systems() + + # Link phases and variables + prob.link_phases() + + prob.add_driver("IPOPT") + + prob.add_design_variables() + + prob.add_objective() + + prob.setup() + + prob.set_initial_guesses() + + prob.run_aviary_problem(suppress_solver_print=True) + + print('done') diff --git a/aviary/examples/external_subsystems/custom_aero/simple_drag.py b/aviary/examples/external_subsystems/custom_aero/simple_drag.py new file mode 100644 index 000000000..da515d147 --- /dev/null +++ b/aviary/examples/external_subsystems/custom_aero/simple_drag.py @@ -0,0 +1,104 @@ +import numpy as np + +import openmdao.api as om + +from aviary.subsystems.aerodynamics.aero_common import DynamicPressure +from aviary.subsystems.aerodynamics.flops_based.lift import LiftEqualsWeight +from aviary.subsystems.aerodynamics.flops_based.drag import SimpleDrag +from aviary.variable_info.variables import Aircraft, Dynamic, Mission + + +class SimplestDragCoeff(om.ExplicitComponent): + """ + Simple representation of aircraft drag as CD = CD_zero + k * CL**2 + + Values are fictional. Typically, some higher fidelity method will go here instead. + """ + + def initialize(self): + self.options.declare( + "num_nodes", default=1, types=int, + desc="Number of nodes along mission segment" + ) + + self.options.declare("CD_zero", default=0.01) + self.options.declare("k", default=0.065) + + def setup(self): + nn = self.options["num_nodes"] + + self.add_input('cl', val=np.zeros(nn)) + + self.add_output('CD', val=np.zeros(nn)) + + def setup_partials(self): + nn = self.options["num_nodes"] + arange = np.arange(nn) + + self.declare_partials('CD', 'cl', rows=arange, cols=arange) + + def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): + CD_zero = self.options["CD_zero"] + k = self.options["k"] + + cl = inputs['cl'] + + outputs['CD'] = CD_zero + k * cl**2 + + def compute_partials(self, inputs, partials, discrete_inputs=None): + k = self.options["k"] + + cl = inputs['cl'] + + partials['CD', 'cl'] = 2.0 * k * cl + + +class SimpleAeroGroup(om.Group): + + def initialize(self): + self.options.declare( + "num_nodes", default=1, types=int, + desc="Number of nodes along mission segment" + ) + + def setup(self): + nn = self.options["num_nodes"] + + self.add_subsystem( + 'DynamicPressure', + DynamicPressure(num_nodes=nn), + promotes_inputs=[ + Dynamic.Atmosphere.MACH, + Dynamic.Atmosphere.STATIC_PRESSURE, + ], + promotes_outputs=[Dynamic.Atmosphere.DYNAMIC_PRESSURE], + ) + + self.add_subsystem( + "Lift", + LiftEqualsWeight(num_nodes=nn), + promotes_inputs=[ + Aircraft.Wing.AREA, + Dynamic.Vehicle.MASS, + Dynamic.Atmosphere.DYNAMIC_PRESSURE, + ], + promotes_outputs=['cl', Dynamic.Vehicle.LIFT], + ) + + self.add_subsystem( + "SimpleDragCoeff", + SimplestDragCoeff(num_nodes=nn), + promotes_inputs=['cl'], + promotes_outputs=['CD'], + ) + + self.add_subsystem( + "SimpleDrag", + SimpleDrag(num_nodes=nn), + promotes_inputs=[ + 'CD', + Dynamic.Atmosphere.DYNAMIC_PRESSURE, + Aircraft.Wing.AREA, + ], + promotes_outputs=[Dynamic.Vehicle.DRAG], + ) \ No newline at end of file diff --git a/aviary/mission/flops_based/ode/mission_ODE.py b/aviary/mission/flops_based/ode/mission_ODE.py index 389ce80a5..f78b08f40 100644 --- a/aviary/mission/flops_based/ode/mission_ODE.py +++ b/aviary/mission/flops_based/ode/mission_ODE.py @@ -165,7 +165,10 @@ def setup(self): target = external_subsystem_group target.add_subsystem( - subsystem.name, subsystem_mission + subsystem.name, + subsystem_mission, + promotes_inputs=subsystem.mission_inputs(**kwargs), + promotes_outputs=subsystem.mission_outputs(**kwargs), ) # Only add the external subsystem group if it has at least one subsystem. diff --git a/aviary/subsystems/aerodynamics/aerodynamics_builder.py b/aviary/subsystems/aerodynamics/aerodynamics_builder.py index 0dd98dfd8..52a82d710 100644 --- a/aviary/subsystems/aerodynamics/aerodynamics_builder.py +++ b/aviary/subsystems/aerodynamics/aerodynamics_builder.py @@ -143,6 +143,10 @@ def build_mission(self, num_nodes, aviary_inputs, **kwargs): CDI_data=kwargs.pop('CDI_data'), **kwargs) + elif method == 'external': + # Aero completely replaced by external group. + aero_group = None + else: raise ValueError('FLOPS-based aero method is not one of the following: ' '(computed, low_speed, solved_alpha, tabular)') diff --git a/aviary/subsystems/aerodynamics/test/__init__.py b/aviary/subsystems/aerodynamics/test/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/aviary/subsystems/aerodynamics/test/test_external_mission_aero.py b/aviary/subsystems/aerodynamics/test/test_external_mission_aero.py new file mode 100644 index 000000000..44a7bdaff --- /dev/null +++ b/aviary/subsystems/aerodynamics/test/test_external_mission_aero.py @@ -0,0 +1,65 @@ +from copy import deepcopy +import unittest + +from openmdao.utils.assert_utils import assert_near_equal + +import aviary.api as av +from aviary.examples.external_subsystems.custom_aero.custom_aero_builder import CustomAeroBuilder + +phase_info = deepcopy(av.default_height_energy_phase_info) + + +class TestBattery(av.TestSubsystemBuilderBase): + """ + Test replacing internal drag calculation with an external subsystem. + + Mainly, this shows that the "external" method works, and that the external + subsystems in mission are correctly promoting inputs/outputs. + """ + + def test_external_drag(self): + + # Just do cruise in this example. + phase_info.pop('climb') + phase_info.pop('descent') + + # Add custom aero. + # TODO: This API for replacing aero will be changed an upcoming release. + phase_info['cruise']['external_subsystems'] = [CustomAeroBuilder()] + + # Disable internal aero + # TODO: This API for replacing aero will be changed an upcoming release. + phase_info['cruise']['subsystem_options']['core_aerodynamics'] = { + 'method': 'external', + } + + prob = av.AviaryProblem() + + # Load aircraft and options data from user + prob.load_inputs('models/test_aircraft/aircraft_for_bench_FwFm.csv', phase_info) + + prob.check_and_preprocess_inputs() + prob.add_pre_mission_systems() + prob.add_phases() + prob.add_post_mission_systems() + + prob.link_phases() + + # SLSQP didn't work so well here. + prob.add_driver("IPOPT") + + prob.add_design_variables() + prob.add_objective() + + prob.setup() + + prob.set_initial_guesses() + + prob.run_aviary_problem(suppress_solver_print=True) + + drag = prob.get_val("traj.cruise.rhs_all.drag", units='lbf') + assert_near_equal(drag[0], 7272.0265, tolerance=1e-3) + + +if __name__ == '__main__': + unittest.main() From 22f2651ede487146de6fe38a8f93c747bb7205a7 Mon Sep 17 00:00:00 2001 From: Kenneth-T-Moore Date: Tue, 14 Jan 2025 18:03:10 -0500 Subject: [PATCH 82/89] Reworked a bit, since I forgot the configure method was being used to specify promtoes. --- aviary/subsystems/subsystem_builder_base.py | 14 ++++++++++++++ aviary/utils/functions.py | 1 + 2 files changed, 15 insertions(+) diff --git a/aviary/subsystems/subsystem_builder_base.py b/aviary/subsystems/subsystem_builder_base.py index 9d4fa20fb..b651529a8 100644 --- a/aviary/subsystems/subsystem_builder_base.py +++ b/aviary/subsystems/subsystem_builder_base.py @@ -219,6 +219,20 @@ def build_mission(self, num_nodes, aviary_inputs, **kwargs): """ return None + def mission_inputs(self, **kwargs): + """ + Returns list of mission inputs to be promoted out of the external subsystem. By + default, all aircraft:* and mission:* inputs are promoted. + """ + return [] + + def mission_outputs(self, **kwargs): + """ + Returns list of mission outputs to be promoted out of the external subsystem. By + default, all aircraft:* and mission:* outputs are promoted. + """ + return [] + def define_order(self): """ Return a list of subsystem names that must be defined before this one. E.g., must go before or after aero or prop. diff --git a/aviary/utils/functions.py b/aviary/utils/functions.py index 0f34cb662..54161d89c 100644 --- a/aviary/utils/functions.py +++ b/aviary/utils/functions.py @@ -361,6 +361,7 @@ def promote_aircraft_and_mission_vars(group): break group.promotes(comp.name, outputs=promote_out, inputs=promote_in) + print(comp.name, promote_in, promote_out) return external_outputs From 69c4a078e4b19a474e8fa00de51fd569da4cc9db Mon Sep 17 00:00:00 2001 From: Kenneth-T-Moore Date: Wed, 15 Jan 2025 11:50:32 -0500 Subject: [PATCH 83/89] cleanup --- aviary/utils/functions.py | 1 - 1 file changed, 1 deletion(-) diff --git a/aviary/utils/functions.py b/aviary/utils/functions.py index 54161d89c..0f34cb662 100644 --- a/aviary/utils/functions.py +++ b/aviary/utils/functions.py @@ -361,7 +361,6 @@ def promote_aircraft_and_mission_vars(group): break group.promotes(comp.name, outputs=promote_out, inputs=promote_in) - print(comp.name, promote_in, promote_out) return external_outputs From 8238f82dbeb8194f17951e9f974ac65653450359 Mon Sep 17 00:00:00 2001 From: Kenneth-T-Moore Date: Wed, 15 Jan 2025 12:19:10 -0500 Subject: [PATCH 84/89] cleanup and merge out --- aviary/examples/external_subsystems/custom_aero/simple_drag.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/examples/external_subsystems/custom_aero/simple_drag.py b/aviary/examples/external_subsystems/custom_aero/simple_drag.py index da515d147..23a146bf8 100644 --- a/aviary/examples/external_subsystems/custom_aero/simple_drag.py +++ b/aviary/examples/external_subsystems/custom_aero/simple_drag.py @@ -101,4 +101,4 @@ def setup(self): Aircraft.Wing.AREA, ], promotes_outputs=[Dynamic.Vehicle.DRAG], - ) \ No newline at end of file + ) From 39a1c465872c7fe2cbf9cae0cbc01318c63b8dc5 Mon Sep 17 00:00:00 2001 From: Kenneth-T-Moore Date: Wed, 15 Jan 2025 12:42:38 -0500 Subject: [PATCH 85/89] Fix for testing on our minimal machine --- .../external_subsystems/custom_aero/run_simple_aero.py | 3 ++- .../subsystems/aerodynamics/test/test_external_mission_aero.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/aviary/examples/external_subsystems/custom_aero/run_simple_aero.py b/aviary/examples/external_subsystems/custom_aero/run_simple_aero.py index 056335d3b..47fa42488 100644 --- a/aviary/examples/external_subsystems/custom_aero/run_simple_aero.py +++ b/aviary/examples/external_subsystems/custom_aero/run_simple_aero.py @@ -44,7 +44,8 @@ # Link phases and variables prob.link_phases() - prob.add_driver("IPOPT") + # Note, SLSQP might have troubles here. + prob.add_driver("SLSQP") prob.add_design_variables() diff --git a/aviary/subsystems/aerodynamics/test/test_external_mission_aero.py b/aviary/subsystems/aerodynamics/test/test_external_mission_aero.py index 44a7bdaff..7e7ce190b 100644 --- a/aviary/subsystems/aerodynamics/test/test_external_mission_aero.py +++ b/aviary/subsystems/aerodynamics/test/test_external_mission_aero.py @@ -2,6 +2,7 @@ import unittest from openmdao.utils.assert_utils import assert_near_equal +from openmdao.utils.testing_utils import require_pyoptsparse import aviary.api as av from aviary.examples.external_subsystems.custom_aero.custom_aero_builder import CustomAeroBuilder @@ -17,6 +18,7 @@ class TestBattery(av.TestSubsystemBuilderBase): subsystems in mission are correctly promoting inputs/outputs. """ + @require_pyoptsparse(optimizer="SNOPT") def test_external_drag(self): # Just do cruise in this example. From d3b603c2fc9f602c43733da03ca2133ebb3d54e9 Mon Sep 17 00:00:00 2001 From: Kenneth-T-Moore Date: Wed, 15 Jan 2025 12:42:57 -0500 Subject: [PATCH 86/89] Fix for testing on our minimal machine --- .../subsystems/aerodynamics/test/test_external_mission_aero.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/subsystems/aerodynamics/test/test_external_mission_aero.py b/aviary/subsystems/aerodynamics/test/test_external_mission_aero.py index 7e7ce190b..e613c03fe 100644 --- a/aviary/subsystems/aerodynamics/test/test_external_mission_aero.py +++ b/aviary/subsystems/aerodynamics/test/test_external_mission_aero.py @@ -18,7 +18,7 @@ class TestBattery(av.TestSubsystemBuilderBase): subsystems in mission are correctly promoting inputs/outputs. """ - @require_pyoptsparse(optimizer="SNOPT") + @require_pyoptsparse(optimizer="IPOPT") def test_external_drag(self): # Just do cruise in this example. From 352e99983b1bad181ae7442cac646fd5b7695cb4 Mon Sep 17 00:00:00 2001 From: jkirk5 Date: Thu, 16 Jan 2025 15:10:52 -0500 Subject: [PATCH 87/89] update internal version to 0.9.7 --- .bumpversion.cfg | 2 +- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- CITATION.cff | 2 +- aviary/__init__.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 7a9118486..7540c21bd 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.9.6 +current_version = 0.9.7 commit = False tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\-(?P[a-z]+))? diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index f8fa1143e..4669664c0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -21,7 +21,7 @@ body: attributes: label: Aviary Version description: What version of Aviary is being used. - placeholder: "0.9.6" + placeholder: "0.9.7" validations: required: true - type: textarea diff --git a/CITATION.cff b/CITATION.cff index c44eee143..4a174317b 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -27,4 +27,4 @@ identifiers: repository-code: 'https://github.com/OpenMDAO/Aviary' repository: 'https://github.com/OpenMDAO/Aviary_Community' license: Apache-2.0 -version: 0.9.3 +version: 0.9.7 diff --git a/aviary/__init__.py b/aviary/__init__.py index 50533e307..f5b77301f 100644 --- a/aviary/__init__.py +++ b/aviary/__init__.py @@ -1 +1 @@ -__version__ = "0.9.6" +__version__ = "0.9.7" From 87c488c06686b84fc564bc3c72296f6188ca1caa Mon Sep 17 00:00:00 2001 From: jkirk5 Date: Thu, 16 Jan 2025 15:24:16 -0500 Subject: [PATCH 88/89] 0.9.7-dev increment --- .bumpversion.cfg | 2 +- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- aviary/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 7540c21bd..e7775a430 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.9.7 +current_version = 0.9.7-dev commit = False tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\-(?P[a-z]+))? diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 4669664c0..ef04da1be 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -21,7 +21,7 @@ body: attributes: label: Aviary Version description: What version of Aviary is being used. - placeholder: "0.9.7" + placeholder: "0.9.7-dev" validations: required: true - type: textarea diff --git a/aviary/__init__.py b/aviary/__init__.py index f5b77301f..b336982d3 100644 --- a/aviary/__init__.py +++ b/aviary/__init__.py @@ -1 +1 @@ -__version__ = "0.9.7" +__version__ = "0.9.7-dev" From 4eaebaacbea6d562d39d4447af9790b99ca9b424 Mon Sep 17 00:00:00 2001 From: jkirk5 Date: Fri, 17 Jan 2025 18:05:34 -0500 Subject: [PATCH 89/89] Added documentation of external aerodynamics methods --- aviary/docs/user_guide/aerodynamics.ipynb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/aviary/docs/user_guide/aerodynamics.ipynb b/aviary/docs/user_guide/aerodynamics.ipynb index 023e8883a..e8504ef81 100644 --- a/aviary/docs/user_guide/aerodynamics.ipynb +++ b/aviary/docs/user_guide/aerodynamics.ipynb @@ -112,6 +112,7 @@ "- `computed`: uses regression-based techniques to estimate lift and drag\n", "- `low_speed`: for use in detailed takeoff analysis, and includes high-lift devices and considers angle-of-attack\n", "- `tabular`: allows the user to substitute the lift and drag coefficient calculations in `computed` with data tables\n", + "- `external`: disables Aviary's core aerodynamics computation, intended for use with external subsystems to replace all aerodynamic calculations.\n", "\n", "### Computed Aerodynamics\n", "The FLOPS based aerodynamics subsystem uses a modified version of algorithms from the EDET (Empirical Drag Estimation Technique) program [^edet] to internally compute drag polars. FLOPS improvements to EDET as implemented in Aviary include smoothing of drag polars, more accurate Reynolds number calculations, and use of the Sommer and Short T' method [^tprime] for skin friction calculations.\n", @@ -124,7 +125,10 @@ "- The lift-dependent drag coefficient table must include Mach number and lift coefficient as independent variables.\n", "- The zero-lift drag coefficient table must include altitude and Mach number as independent variables.\n", "\n", - "Tabular aerodynamics uses Aviary's [data_interpolator_builder](../_srcdocs/packages/utils/data_interpolator_builder) interface. This component is unique as it requires two data tables to be provided. All configuration options, such as the choice to use a structured metamodel or training data, are applied to both tables." + "Tabular aerodynamics uses Aviary's [data_interpolator_builder](../_srcdocs/packages/utils/data_interpolator_builder) interface. This component is unique as it requires two data tables to be provided. All configuration options, such as the choice to use a structured metamodel or training data, are applied to both tables.\n", + "\n", + "### External Aerodynamics\n", + "Selecting the `external` aerodynamics method disables Aviary's core aerodynamics group. This allows for external subsystems to completely replace these calculations." ] }, { @@ -142,7 +146,7 @@ "cab = CoreAerodynamicsBuilder(code_origin=LegacyCode.FLOPS)\n", "# here we are only checking that the CoreAerodynamicsBuilder has a build_mission for a given method\n", "# we know this will fail when it attempts to build the aero groups\n", - "for method in (None,'computed','low_speed','tabular','solved_alpha'):\n", + "for method in (None,'computed','low_speed','tabular','solved_alpha','external'):\n", " try:\n", " cab.build_mission(1,AviaryValues(),method=method)\n", " except ValueError as e:\n", @@ -191,7 +195,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.1.-1" + "version": "3.12.3" } }, "nbformat": 4,