diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a3a4c1790..e7775a430 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.9.4-dev +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 cd237761c..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.4-dev" + placeholder: "0.9.7-dev" 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 7f33873b3..b336982d3 100644 --- a/aviary/__init__.py +++ b/aviary/__init__.py @@ -1 +1 @@ -__version__ = "0.9.4-dev" +__version__ = "0.9.7-dev" 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..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." @@ -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/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, 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..47fa42488 --- /dev/null +++ b/aviary/examples/external_subsystems/custom_aero/run_simple_aero.py @@ -0,0 +1,60 @@ +""" +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() + + # Note, SLSQP might have troubles here. + prob.add_driver("SLSQP") + + 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..23a146bf8 --- /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], + ) 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 d56a97715..0039d4416 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..e613c03fe --- /dev/null +++ b/aviary/subsystems/aerodynamics/test/test_external_mission_aero.py @@ -0,0 +1,67 @@ +from copy import deepcopy +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 + +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. + """ + + @require_pyoptsparse(optimizer="IPOPT") + 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() 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( diff --git a/aviary/subsystems/geometry/flops_based/characteristic_lengths.py b/aviary/subsystems/geometry/flops_based/characteristic_lengths.py index ef9ce92dc..14396c9d8 100644 --- a/aviary/subsystems/geometry/flops_based/characteristic_lengths.py +++ b/aviary/subsystems/geometry/flops_based/characteristic_lengths.py @@ -21,66 +21,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() diff --git a/aviary/subsystems/geometry/flops_based/fuselage.py b/aviary/subsystems/geometry/flops_based/fuselage.py index 2b73da704..ca87a6266 100644 --- a/aviary/subsystems/geometry/flops_based/fuselage.py +++ b/aviary/subsystems/geometry/flops_based/fuselage.py @@ -16,12 +16,12 @@ class FuselagePrelim(om.ExplicitComponent): """ 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], diff --git a/aviary/subsystems/geometry/flops_based/nacelle.py b/aviary/subsystems/geometry/flops_based/nacelle.py index c8c9adf97..4b2c5fab7 100644 --- a/aviary/subsystems/geometry/flops_based/nacelle.py +++ b/aviary/subsystems/geometry/flops_based/nacelle.py @@ -18,16 +18,13 @@ def initialize(self): def setup(self): num_engine_type = len(self.options[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.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, - val=np.zeros(num_engine_type)) + shape=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_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 diff --git a/aviary/subsystems/geometry/flops_based/prep_geom.py b/aviary/subsystems/geometry/flops_based/prep_geom.py index 37cf27e1b..49ac2ed27 100644 --- a/aviary/subsystems/geometry/flops_based/prep_geom.py +++ b/aviary/subsystems/geometry/flops_based/prep_geom.py @@ -116,27 +116,25 @@ def initialize(self): add_aviary_option(self, Aircraft.Wing.SPAN_EFFICIENCY_REDUCTION) 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.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.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.Wing.AREA, 0.0) - add_aviary_input(self, Aircraft.Wing.GLOVE_AND_BAT, 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) + add_aviary_input(self, Aircraft.HorizontalTail.ASPECT_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) + 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) + 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') @@ -492,10 +490,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( @@ -567,19 +565,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( @@ -727,27 +723,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( diff --git a/aviary/subsystems/geometry/flops_based/wetted_area_total.py b/aviary/subsystems/geometry/flops_based/wetted_area_total.py index 63b2a4fab..f787fb4a6 100644 --- a/aviary/subsystems/geometry/flops_based/wetted_area_total.py +++ b/aviary/subsystems/geometry/flops_based/wetted_area_total.py @@ -11,14 +11,14 @@ class TotalWettedArea(om.ExplicitComponent): """ 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_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, 0.0) + add_aviary_output(self, Aircraft.Design.TOTAL_WETTED_AREA) def setup_partials(self): self.declare_partials('*', '*', val=1.0) diff --git a/aviary/subsystems/geometry/flops_based/wing.py b/aviary/subsystems/geometry/flops_based/wing.py index f6c7c09e2..4f945ff49 100644 --- a/aviary/subsystems/geometry/flops_based/wing.py +++ b/aviary/subsystems/geometry/flops_based/wing.py @@ -14,11 +14,11 @@ class WingPrelim(om.ExplicitComponent): """ 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('*', '*') diff --git a/aviary/subsystems/geometry/gasp_based/electric.py b/aviary/subsystems/geometry/gasp_based/electric.py index 07d423edd..ac58a4a0b 100644 --- a/aviary/subsystems/geometry/gasp_based/electric.py +++ b/aviary/subsystems/geometry/gasp_based/electric.py @@ -17,13 +17,11 @@ def setup(self): total_num_wing_engines = self.options[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, diff --git a/aviary/subsystems/geometry/gasp_based/empennage.py b/aviary/subsystems/geometry/gasp_based/empennage.py index 5cdb6aa03..c1446c86b 100644 --- a/aviary/subsystems/geometry/gasp_based/empennage.py +++ b/aviary/subsystems/geometry/gasp_based/empennage.py @@ -33,23 +33,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") @@ -90,37 +86,28 @@ class TailSize(om.ExplicitComponent): 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" - ) - - 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("vol_coef", 1.189, units="unitless", + 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.") + ) + self.add_input("ar", 0.0, units="unitless", + desc="ARHT | ARVT: Tail aspect ratio.") + 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") self.add_output("span", units="ft", desc="BHT | BVT: Tail span") @@ -307,11 +294,6 @@ 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) + self.set_input_defaults(Aircraft.VerticalTail.TAPER_RATIO, 0.0) diff --git a/aviary/subsystems/geometry/gasp_based/engine.py b/aviary/subsystems/geometry/gasp_based/engine.py index 545427ac7..2c9657ca0 100644 --- a/aviary/subsystems/geometry/gasp_based/engine.py +++ b/aviary/subsystems/geometry/gasp_based/engine.py @@ -18,18 +18,18 @@ def setup(self): num_engine_type = len(self.options[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 diff --git a/aviary/subsystems/geometry/gasp_based/fuselage.py b/aviary/subsystems/geometry/gasp_based/fuselage.py index f525118f1..ce1b1e241 100644 --- a/aviary/subsystems/geometry/gasp_based/fuselage.py +++ b/aviary/subsystems/geometry/gasp_based/fuselage.py @@ -34,10 +34,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") @@ -112,19 +112,17 @@ class FuselageSize(om.ExplicitComponent): """ 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, @@ -267,6 +265,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/non_dimensional_conversion.py b/aviary/subsystems/geometry/gasp_based/non_dimensional_conversion.py index c8da2494b..bdb03ae32 100644 --- a/aviary/subsystems/geometry/gasp_based/non_dimensional_conversion.py +++ b/aviary/subsystems/geometry/gasp_based/non_dimensional_conversion.py @@ -14,16 +14,16 @@ 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, 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): @@ -70,14 +70,14 @@ 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, 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): diff --git a/aviary/subsystems/geometry/gasp_based/strut.py b/aviary/subsystems/geometry/gasp_based/strut.py index 2c3fd83f0..8e80f290f 100644 --- a/aviary/subsystems/geometry/gasp_based/strut.py +++ b/aviary/subsystems/geometry/gasp_based/strut.py @@ -13,20 +13,17 @@ class StrutGeom(om.ExplicitComponent): """ 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): diff --git a/aviary/subsystems/geometry/gasp_based/test/test_empennage.py b/aviary/subsystems/geometry/gasp_based/test/test_empennage.py index aa77dbeab..6cb29add1 100644 --- a/aviary/subsystems/geometry/gasp_based/test/test_empennage.py +++ b/aviary/subsystems/geometry/gasp_based/test/test_empennage.py @@ -49,9 +49,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) @@ -75,7 +72,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") @@ -86,6 +82,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() @@ -101,7 +98,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_size_group.py b/aviary/subsystems/geometry/gasp_based/test/test_size_group.py index 90ad3170a..4c2849d73 100644 --- a/aviary/subsystems/geometry/gasp_based/test/test_size_group.py +++ b/aviary/subsystems/geometry/gasp_based/test/test_size_group.py @@ -242,6 +242,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( diff --git a/aviary/subsystems/geometry/gasp_based/test/test_wing.py b/aviary/subsystems/geometry/gasp_based/test/test_wing.py index 5cb91f101..dd2f74811 100644 --- a/aviary/subsystems/geometry/gasp_based/test/test_wing.py +++ b/aviary/subsystems/geometry/gasp_based/test/test_wing.py @@ -59,6 +59,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") @@ -580,6 +589,32 @@ 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.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" + ) setup_model_options(self.prob, options) diff --git a/aviary/subsystems/geometry/gasp_based/wing.py b/aviary/subsystems/geometry/gasp_based/wing.py index 85ce6cf1b..bd7e759ad 100644 --- a/aviary/subsystems/geometry/gasp_based/wing.py +++ b/aviary/subsystems/geometry/gasp_based/wing.py @@ -17,12 +17,12 @@ class WingSize(om.ExplicitComponent): 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] @@ -83,19 +83,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[Aircraft.Wing.HAS_FOLD]: - 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, @@ -111,12 +111,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, @@ -517,12 +516,8 @@ def initialize(self): def setup(self): if not self.options[Aircraft.Wing.CHOOSE_FOLD_LOCATION]: - self.add_input( - "strut_y", - val=25, - units="ft", - desc="YSTRUT: attachment location of strut", - ) + self.add_input("strut_y", val=25, units="ft", + desc="YSTRUT: attachment location of strut") self.declare_partials("nonfolded_taper_ratio", "strut_y") self.declare_partials(Aircraft.Wing.FOLDING_AREA, "strut_y") @@ -540,44 +535,32 @@ 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.Fuel.WING_FUEL_FRACTION, val=0.6) + 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) - self.add_output( - "nonfolded_taper_ratio", - val=0.1, - units="unitless", - desc="SLM_NF: taper ratio between wing root and fold location", - ) + 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) + 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", - ) - 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", - desc="AR_NF: aspect ratio of non-folding part of wing", - ) + 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", + 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", + ) - 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", @@ -1008,12 +991,3 @@ def setup(self): check_fold_location_definition(choose_fold_location, has_strut) 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" - ) diff --git a/aviary/subsystems/mass/flops_based/air_conditioning.py b/aviary/subsystems/mass/flops_based/air_conditioning.py index 4e2db1cfe..be41e8fc4 100644 --- a/aviary/subsystems/mass/flops_based/air_conditioning.py +++ b/aviary/subsystems/mass/flops_based/air_conditioning.py @@ -19,15 +19,12 @@ def initialize(self): add_aviary_option(self, Mission.Constraints.MAX_MACH) 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('*', '*') @@ -83,9 +80,9 @@ def initialize(self): add_aviary_option(self, Aircraft.CrewPayload.Design.NUM_PASSENGERS) 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 9d7a485da..038b8e36b 100644 --- a/aviary/subsystems/mass/flops_based/anti_icing.py +++ b/aviary/subsystems/mass/flops_based/anti_icing.py @@ -23,18 +23,13 @@ def initialize(self): def setup(self): num_engine_type = len(self.options[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 d71b2ac38..6a36e2f46 100644 --- a/aviary/subsystems/mass/flops_based/apu.py +++ b/aviary/subsystems/mass/flops_based/apu.py @@ -15,11 +15,10 @@ def initialize(self): add_aviary_option(self, Aircraft.CrewPayload.Design.NUM_PASSENGERS) 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 1f7e75f7d..e681baf7d 100644 --- a/aviary/subsystems/mass/flops_based/avionics.py +++ b/aviary/subsystems/mass/flops_based/avionics.py @@ -16,13 +16,11 @@ def initialize(self): add_aviary_option(self, Aircraft.CrewPayload.NUM_FLIGHT_CREW) 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 e40b374d3..980e2960b 100644 --- a/aviary/subsystems/mass/flops_based/canard.py +++ b/aviary/subsystems/mass/flops_based/canard.py @@ -12,12 +12,12 @@ class CanardMass(om.ExplicitComponent): ''' 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 dd388e067..ef5311d80 100644 --- a/aviary/subsystems/mass/flops_based/cargo.py +++ b/aviary/subsystems/mass/flops_based/cargo.py @@ -22,15 +22,13 @@ def initialize(self): add_aviary_option(self, Aircraft.CrewPayload.NUM_PASSENGERS) 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 18460dcaf..8f0b11d11 100644 --- a/aviary/subsystems/mass/flops_based/cargo_containers.py +++ b/aviary/subsystems/mass/flops_based/cargo_containers.py @@ -14,14 +14,11 @@ class TransportCargoContainersMass(om.ExplicitComponent): ''' 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 924840101..1afd6e217 100644 --- a/aviary/subsystems/mass/flops_based/crew.py +++ b/aviary/subsystems/mass/flops_based/crew.py @@ -18,10 +18,9 @@ def initialize(self): add_aviary_option(self, Aircraft.CrewPayload.NUM_GALLEY_CREW) 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( @@ -75,10 +74,9 @@ def initialize(self): add_aviary_option(self, Aircraft.LandingGear.CARRIER_BASED) 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 7ba6ee967..6dfc06288 100644 --- a/aviary/subsystems/mass/flops_based/electrical.py +++ b/aviary/subsystems/mass/flops_based/electrical.py @@ -20,11 +20,11 @@ def initialize(self): add_aviary_option(self, Aircraft.Propulsion.TOTAL_NUM_ENGINES) 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='*') @@ -81,9 +81,9 @@ def initialize(self): add_aviary_option(self, Aircraft.CrewPayload.Design.NUM_PASSENGERS) 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 43fca2b20..5b2ce8b2c 100644 --- a/aviary/subsystems/mass/flops_based/empty_margin.py +++ b/aviary/subsystems/mass/flops_based/empty_margin.py @@ -10,15 +10,12 @@ class EmptyMassMargin(om.ExplicitComponent): """ 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 93740cccb..169ff1179 100644 --- a/aviary/subsystems/mass/flops_based/engine.py +++ b/aviary/subsystems/mass/flops_based/engine.py @@ -24,16 +24,12 @@ def initialize(self): def setup(self): num_engine_type = len(self.options[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): options = self.options diff --git a/aviary/subsystems/mass/flops_based/engine_controls.py b/aviary/subsystems/mass/flops_based/engine_controls.py index 17058a821..d8a121fd3 100644 --- a/aviary/subsystems/mass/flops_based/engine_controls.py +++ b/aviary/subsystems/mass/flops_based/engine_controls.py @@ -27,11 +27,9 @@ def initialize(self): add_aviary_option(self, Aircraft.Propulsion.TOTAL_NUM_ENGINES) 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 14fc7f429..8ad1e5ea2 100644 --- a/aviary/subsystems/mass/flops_based/engine_oil.py +++ b/aviary/subsystems/mass/flops_based/engine_oil.py @@ -24,11 +24,10 @@ def initialize(self): add_aviary_option(self, Aircraft.Propulsion.TOTAL_NUM_ENGINES) 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('*', '*') @@ -70,9 +69,9 @@ def initialize(self): add_aviary_option(self, Aircraft.CrewPayload.Design.NUM_PASSENGERS) 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 c1c262481..c53be1554 100644 --- a/aviary/subsystems/mass/flops_based/engine_pod.py +++ b/aviary/subsystems/mass/flops_based/engine_pod.py @@ -22,21 +22,20 @@ def initialize(self): def setup(self): num_engine_type = len(self.options[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 b4e9f79ab..280a943dc 100644 --- a/aviary/subsystems/mass/flops_based/fin.py +++ b/aviary/subsystems/mass/flops_based/fin.py @@ -15,12 +15,12 @@ def initialize(self): add_aviary_option(self, Aircraft.Fins.NUM_FINS) 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 d1d2009b6..76e83dbef 100644 --- a/aviary/subsystems/mass/flops_based/fuel_capacity.py +++ b/aviary/subsystems/mass/flops_based/fuel_capacity.py @@ -38,9 +38,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( @@ -62,10 +62,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( @@ -91,10 +91,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( @@ -120,20 +120,18 @@ class WingFuelCapacity(om.ExplicitComponent): """ 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.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_output(self, Aircraft.Fuel.WING_FUEL_CAPACITY, 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) + 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) 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 78dfe92bc..61162104e 100644 --- a/aviary/subsystems/mass/flops_based/fuel_system.py +++ b/aviary/subsystems/mass/flops_based/fuel_system.py @@ -19,11 +19,10 @@ def initialize(self): add_aviary_option(self, Mission.Constraints.MAX_MACH) 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('*', '*') @@ -65,11 +64,10 @@ def initialize(self): add_aviary_option(self, Aircraft.Fuel.NUM_TANKS) 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 edba25346..4c931fc68 100644 --- a/aviary/subsystems/mass/flops_based/furnishings.py +++ b/aviary/subsystems/mass/flops_based/furnishings.py @@ -20,15 +20,12 @@ def initialize(self): add_aviary_option(self, Aircraft.Fuselage.NUM_FUSELAGES) 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='*') @@ -103,19 +100,15 @@ def initialize(self): add_aviary_option(self, Aircraft.Fuselage.MILITARY_CARGO_FLOOR) 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.BWB.CABIN_AREA, val=100.0) + add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH) - add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, val=30.0) + add_aviary_input(self, Aircraft.Fuselage.MAX_HEIGHT) + add_aviary_input(self, Aircraft.BWB.PASSENGER_LEADING_EDGE_SWEEP) - 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='*') @@ -239,9 +232,9 @@ def initialize(self): add_aviary_option(self, Aircraft.CrewPayload.Design.NUM_PASSENGERS) 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='*') @@ -272,15 +265,12 @@ class AltFurnishingsGroupMass(om.ExplicitComponent): ''' 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 dc0ad71ec..00a757fb6 100644 --- a/aviary/subsystems/mass/flops_based/fuselage.py +++ b/aviary/subsystems/mass/flops_based/fuselage.py @@ -20,13 +20,11 @@ def initialize(self): add_aviary_option(self, Aircraft.Propulsion.TOTAL_NUM_FUSELAGE_ENGINES) 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, "*") @@ -81,15 +79,12 @@ class AltFuselageMass(om.ExplicitComponent): """ 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='*') diff --git a/aviary/subsystems/mass/flops_based/horizontal_tail.py b/aviary/subsystems/mass/flops_based/horizontal_tail.py index a647ebd8f..91f7125db 100644 --- a/aviary/subsystems/mass/flops_based/horizontal_tail.py +++ b/aviary/subsystems/mass/flops_based/horizontal_tail.py @@ -12,15 +12,12 @@ class HorizontalTailMass(om.ExplicitComponent): ''' 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) + add_aviary_input(self, Mission.Design.GROSS_MASS) + add_aviary_input(self, Aircraft.HorizontalTail.MASS_SCALER) - add_aviary_input(self, Aircraft.HorizontalTail.TAPER_RATIO, val=0.352) - - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) - - 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("*", "*") @@ -65,11 +62,10 @@ class AltHorizontalTailMass(om.ExplicitComponent): ''' 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 e2f5ca58c..74aee4af8 100644 --- a/aviary/subsystems/mass/flops_based/hydraulics.py +++ b/aviary/subsystems/mass/flops_based/hydraulics.py @@ -27,17 +27,13 @@ def initialize(self): add_aviary_option(self, Mission.Constraints.MAX_MACH) 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) + 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.Hydraulics.SYSTEM_PRESSURE, val=0.0) - - add_aviary_input(self, Aircraft.Hydraulics.MASS_SCALER, val=1.0) - - 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('*', '*') @@ -105,17 +101,13 @@ class AltHydraulicsGroupMass(om.ExplicitComponent): ''' 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 04bcda862..1b7ca0bd9 100644 --- a/aviary/subsystems/mass/flops_based/instruments.py +++ b/aviary/subsystems/mass/flops_based/instruments.py @@ -23,8 +23,8 @@ def initialize(self): add_aviary_option(self, Mission.Constraints.MAX_MACH) 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 97f03615f..2bcda12cc 100644 --- a/aviary/subsystems/mass/flops_based/landing_gear.py +++ b/aviary/subsystems/mass/flops_based/landing_gear.py @@ -19,19 +19,14 @@ class LandingGearMass(om.ExplicitComponent): # equations def setup(self): - add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, 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, Aircraft.Design.TOUCHDOWN_MASS) - 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.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') @@ -131,19 +126,14 @@ class AltLandingGearMass(om.ExplicitComponent): ''' 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_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.NOSE_GEAR_MASS, val=0.0) + 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, [ @@ -245,8 +235,8 @@ class NoseGearLength(om.ExplicitComponent): """ 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, @@ -271,20 +261,20 @@ def setup(self): num_engine_type = len(self.options[Aircraft.Engine.NUM_ENGINES]) num_wing_engines = self.options[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) if any(num_wing_engines) > 0: + # 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)))) else: add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, val=[[0.0]]) - 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 b809b51dc..721ac1b73 100644 --- a/aviary/subsystems/mass/flops_based/landing_mass.py +++ b/aviary/subsystems/mass/flops_based/landing_mass.py @@ -11,11 +11,10 @@ class LandingTakeoffMassRatio(om.ExplicitComponent): ''' 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('*', '*') @@ -53,11 +52,10 @@ class LandingMass(om.ExplicitComponent): ''' 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 2a3ae8103..30570ca34 100644 --- a/aviary/subsystems/mass/flops_based/mass_summation.py +++ b/aviary/subsystems/mass/flops_based/mass_summation.py @@ -80,18 +80,18 @@ def initialize(self): def setup(self): num_engine_type = len(self.options[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[Aircraft.Engine.NUM_ENGINES]) @@ -120,13 +120,12 @@ def compute(self, inputs, outputs): class PropulsionMass(om.ExplicitComponent): 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 = [ @@ -150,18 +149,18 @@ def compute(self, inputs, outputs): class SystemsEquipMass(om.ExplicitComponent): 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) @@ -187,18 +186,18 @@ def compute(self, inputs, outputs): class AltSystemsEquipMassBase(om.ExplicitComponent): 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) @@ -224,11 +223,11 @@ def compute(self, inputs, outputs): class AltSystemsEquipMass(om.ExplicitComponent): 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( @@ -256,12 +255,12 @@ def compute(self, inputs, outputs): class EmptyMass(om.ExplicitComponent): 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) @@ -279,12 +278,12 @@ def compute(self, inputs, outputs): class AltEmptyMass(om.ExplicitComponent): 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, @@ -309,15 +308,15 @@ def compute(self, inputs, outputs): class OperatingMass(om.ExplicitComponent): 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) @@ -339,12 +338,12 @@ def compute(self, inputs, outputs): class ZeroFuelMass(om.ExplicitComponent): 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) @@ -362,10 +361,10 @@ def compute(self, inputs, outputs): class FuelMass(om.ExplicitComponent): 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 a77ca24c9..94b7bd11f 100644 --- a/aviary/subsystems/mass/flops_based/misc_engine.py +++ b/aviary/subsystems/mass/flops_based/misc_engine.py @@ -24,13 +24,12 @@ def initialize(self): def setup(self): num_engine_type = len(self.options[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 7ec531053..7ed085d9a 100644 --- a/aviary/subsystems/mass/flops_based/nacelle.py +++ b/aviary/subsystems/mass/flops_based/nacelle.py @@ -25,19 +25,12 @@ def initialize(self): def setup(self): num_engine_type = len(self.options[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 4781a13e6..6e866ae98 100644 --- a/aviary/subsystems/mass/flops_based/paint.py +++ b/aviary/subsystems/mass/flops_based/paint.py @@ -10,11 +10,10 @@ class PaintMass(om.ExplicitComponent): ''' 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 f333b4011..b7f23cfde 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): add_aviary_option(self, Mission.Constraints.MAX_MACH) 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 2bf04fb07..0a2bc5a04 100644 --- a/aviary/subsystems/mass/flops_based/starter.py +++ b/aviary/subsystems/mass/flops_based/starter.py @@ -24,10 +24,9 @@ def initialize(self): def setup(self): num_engine_type = len(self.options[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 fb109e427..462e9c6e1 100644 --- a/aviary/subsystems/mass/flops_based/surface_controls.py +++ b/aviary/subsystems/mass/flops_based/surface_controls.py @@ -15,12 +15,12 @@ def initialize(self): add_aviary_option(self, Mission.Constraints.MAX_MACH) 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 7dab4cc72..cc0e10d18 100644 --- a/aviary/subsystems/mass/flops_based/test/test_furnishings.py +++ b/aviary/subsystems/mass/flops_based/test/test_furnishings.py @@ -151,6 +151,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") 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 5652de62c..4ddd4103c 100644 --- a/aviary/subsystems/mass/flops_based/test/test_wing_common.py +++ b/aviary/subsystems/mass/flops_based/test/test_wing_common.py @@ -223,6 +223,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 6821f182b..5193d6005 100644 --- a/aviary/subsystems/mass/flops_based/thrust_reverser.py +++ b/aviary/subsystems/mass/flops_based/thrust_reverser.py @@ -28,14 +28,14 @@ def setup(self): num_engine_type = len(self.options[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 8913549ee..9aa6c5406 100644 --- a/aviary/subsystems/mass/flops_based/unusable_fuel.py +++ b/aviary/subsystems/mass/flops_based/unusable_fuel.py @@ -25,19 +25,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 0f95fb3da..007218103 100644 --- a/aviary/subsystems/mass/flops_based/vertical_tail.py +++ b/aviary/subsystems/mass/flops_based/vertical_tail.py @@ -16,14 +16,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 a932a4e49..b82b1c347 100644 --- a/aviary/subsystems/mass/flops_based/wing_common.py +++ b/aviary/subsystems/mass/flops_based/wing_common.py @@ -16,23 +16,23 @@ def initialize(self): add_aviary_option(self, Aircraft.Fuselage.NUM_FUSELAGES) 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_MATERIAL_FACTOR, val=0.0) - add_aviary_input(self, Aircraft.Wing.BENDING_MATERIAL_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_MATERIAL_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_MATERIAL_FACTOR) + add_aviary_input(self, Aircraft.Wing.BENDING_MATERIAL_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_MATERIAL_MASS) self.A1 = 8.80 self.A2 = 6.25 @@ -212,15 +212,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') @@ -289,13 +286,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') @@ -339,17 +334,13 @@ class WingTotalMass(om.ExplicitComponent): """ def setup(self): - add_aviary_input(self, Aircraft.Wing.BENDING_MATERIAL_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_MATERIAL_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 ba7a01c48..f18c75ea7 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -33,52 +33,30 @@ def setup(self): # wing_location_default = np.empty(num_engine_type, object) # 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), - ) - - add_aviary_input( - self, - Aircraft.Wing.THICKNESS_TO_CHORD_DIST, - val=np.zeros(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) + add_aviary_input(self, Aircraft.Wing.LOAD_PATH_SWEEP_DIST, + shape=num_input_stations - 1) + add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_DIST, + shape=num_input_stations) + add_aviary_input(self, Aircraft.Wing.CHORD_PER_SEMISPAN_DIST, + 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) if total_num_wing_engines > 0: - add_aviary_input( - self, - Aircraft.Engine.WING_LOCATIONS, - val=np.zeros(int(total_num_wing_engines / 2)), - ) + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, + shape=int(total_num_wing_engines/2)) else: - add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, val=[[0.0]]) - - 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_input(self, Aircraft.Engine.WING_LOCATIONS) - add_aviary_output(self, Aircraft.Wing.BENDING_MATERIAL_FACTOR, val=0.0) + 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_MATERIAL_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 04808ebdb..05779757a 100644 --- a/aviary/subsystems/mass/flops_based/wing_simple.py +++ b/aviary/subsystems/mass/flops_based/wing_simple.py @@ -15,25 +15,17 @@ def initialize(self): add_aviary_option(self, Aircraft.Propulsion.TOTAL_NUM_WING_ENGINES) 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_MATERIAL_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_MATERIAL_FACTOR) + add_aviary_output(self, Aircraft.Wing.ENG_POD_INERTIA_FACTOR) def setup_partials(self): self.declare_partials( diff --git a/aviary/subsystems/mass/gasp_based/design_load.py b/aviary/subsystems/mass/gasp_based/design_load.py index 3312b5642..bdb90094a 100644 --- a/aviary/subsystems/mass/gasp_based/design_load.py +++ b/aviary/subsystems/mass/gasp_based/design_load.py @@ -39,25 +39,16 @@ 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", - ) - 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", - desc="EMLF: maximum maneuver load factor, units are in g`s", - ) + self.add_output("max_airspeed", val=0, units="kn", + 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", + ) + 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") self.declare_partials("*", "*") 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) diff --git a/aviary/subsystems/mass/gasp_based/fuel.py b/aviary/subsystems/mass/gasp_based/fuel.py index 8a202aece..4092e3bb3 100644 --- a/aviary/subsystems/mass/gasp_based/fuel.py +++ b/aviary/subsystems/mass/gasp_based/fuel.py @@ -55,12 +55,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, 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/doctape.py b/aviary/utils/doctape.py index 149469570..bef803ff4 100644 --- a/aviary/utils/doctape.py +++ b/aviary/utils/doctape.py @@ -1,8 +1,8 @@ import inspect import subprocess import tempfile -import os import numpy as np +import re """ @@ -89,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,8 +108,20 @@ 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()) + 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) + + # # 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: @@ -295,6 +308,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 @@ -314,9 +328,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: @@ -325,7 +344,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: @@ -352,6 +371,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 @@ -377,13 +398,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: @@ -400,7 +426,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__': diff --git a/aviary/variable_info/functions.py b/aviary/variable_info/functions.py index 9961ae891..fa385de2a 100644 --- a/aviary/variable_info/functions.py +++ b/aviary/variable_info/functions.py @@ -59,13 +59,22 @@ 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 @@ -91,6 +100,8 @@ def add_aviary_output(comp, varname, val, units=None, desc=None, shape_by_conn=F 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: @@ -104,6 +115,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) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index b0c71ccfc..f84ce4db5 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, ) add_meta_data( @@ -122,7 +122,7 @@ }, units='lbm', desc='mass of anti-icing system (auxiliary gear)', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -163,7 +163,7 @@ }, units='lbm', desc='mass of auxiliary power unit', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -204,7 +204,7 @@ }, units='lbm', desc='avionics mass', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -418,7 +418,7 @@ }, units='unitless', desc='canard theoretical aspect ratio', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -434,6 +434,7 @@ }, units='ft', desc='Reynolds characteristic length for the canard', + default_value=0.0 ) add_meta_data( @@ -449,6 +450,7 @@ }, units='unitless', desc='canard fineness ratio', + default_value=0.0 ) add_meta_data( @@ -493,7 +495,7 @@ }, units='lbm', desc='mass of canards', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -519,7 +521,7 @@ }, units='unitless', desc='canard theoretical taper ratio', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -553,7 +555,7 @@ }, units='ft**2', desc='canard wetted area', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -645,6 +647,7 @@ }, units='lbm', desc='mass of passenger baggage', + default_value=0.0, ) add_meta_data( @@ -677,7 +680,7 @@ }, units='lbm', desc='mass of cargo containers', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -708,6 +711,7 @@ }, units='lbm', desc='total mass of cargo', + default_value=0.0, ) add_meta_data( @@ -803,7 +807,7 @@ }, units='lbm', desc='total mass of the flight crew and their baggage', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -863,7 +867,7 @@ }, units='lbm', desc='total mass of the non-flight crew and their baggage', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -1010,6 +1014,7 @@ }, units='lbm', desc='TBD: total mass of all passengers without their baggage', + default_value=0.0, ) add_meta_data( @@ -1030,6 +1035,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, ) add_meta_data( @@ -1048,7 +1054,7 @@ }, units='lbm', desc='mass of passenger service equipment', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -1242,7 +1248,7 @@ }, units='lbm', desc='empty mass margin', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -1270,6 +1276,7 @@ meta_data=_MetaData, units='lbm', desc='total mass of all user-defined external subsystems', + default_value=0.0, ) add_meta_data( @@ -1350,7 +1357,7 @@ }, units='unitless', desc='ratio of maximum landing mass to maximum takeoff mass', - default_value=0.9, + default_value=0.0, ) add_meta_data( @@ -1438,6 +1445,7 @@ }, units='lbm', desc='operating mass empty of the aircraft', + default_value=0.0, ) add_meta_data( @@ -1517,6 +1525,7 @@ }, units='lbm', desc='Total structural group mass', + default_value=0.0, ) add_meta_data( @@ -1567,6 +1576,7 @@ }, units='lbm', desc='Total systems & equipment group mass', + default_value=0.0, ) add_meta_data( @@ -1578,6 +1588,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, ) add_meta_data( @@ -1602,6 +1613,7 @@ }, units='ft**2', desc='total aircraft wetted area', + default_value=0.0, ) add_meta_data( @@ -1623,7 +1635,7 @@ }, units='lbm', desc='design landing mass', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -1684,6 +1696,7 @@ }, units='lbm', desc='zero fuel mass', + default_value=0.0, ) add_meta_data( @@ -1725,6 +1738,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, ) add_meta_data( @@ -1743,7 +1757,7 @@ }, units='lbm', desc='mass of the electrical system', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -2605,7 +2619,7 @@ }, units='lbm', desc='mass of vertical fins', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -2646,7 +2660,7 @@ }, units='unitless', desc='vertical fin theoretical taper ratio', - default_value=None, + default_value=0.0, ) # ______ _ @@ -2667,7 +2681,7 @@ }, units='lbm', desc='fuel capacity of the auxiliary tank', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -2688,7 +2702,7 @@ }, units='unitless', desc='fuel capacity factor', - default_value=23.0, + default_value=1.0, ) add_meta_data( @@ -2742,7 +2756,7 @@ }, units='lbm', desc='fuel system mass', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -2781,7 +2795,7 @@ }, units='lbm', desc='fuel capacity of the fuselage', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -2814,7 +2828,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, ) add_meta_data( @@ -2832,6 +2846,7 @@ }, units='galUS', # need to check this desc='Total fuel volume', + default_value=0.0, ) add_meta_data( @@ -2850,7 +2865,7 @@ }, units='lbm', desc='unusable fuel mass', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -2886,7 +2901,7 @@ }, units='lbm', desc='fuel capacity of the auxiliary tank', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -2895,6 +2910,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, ) add_meta_data( @@ -2977,6 +2993,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, ) add_meta_data( @@ -3015,7 +3032,7 @@ }, units='lbm', desc='Total furnishings system mass', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -3024,6 +3041,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, ) add_meta_data( @@ -3072,6 +3090,7 @@ }, units='ft', desc='average fuselage diameter', + default_value=0.0, ) add_meta_data( @@ -3087,6 +3106,7 @@ }, units='ft', desc='Reynolds characteristic length for the fuselage', + default_value=0.0, ) add_meta_data( @@ -3107,7 +3127,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, ) add_meta_data( @@ -3120,6 +3140,7 @@ }, units='unitless', desc='fuselage diameter to wing span ratio', + default_value=0.0, ) add_meta_data( @@ -3135,6 +3156,7 @@ }, units='unitless', desc='fuselage fineness ratio', + default_value=0.0, ) add_meta_data( @@ -3216,6 +3238,7 @@ }, units='unitless', desc='fuselage length to diameter ratio', + default_value=0.0, ) add_meta_data( @@ -3234,7 +3257,7 @@ }, units='lbm', desc='mass of the fuselage structure', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -3269,6 +3292,7 @@ }, units='ft', desc='maximum fuselage height', + default_value=0.0, ) add_meta_data( @@ -3386,6 +3410,7 @@ historical_name={"GASP": 'INGASP.ELPC', "FLOPS": None, "LEAPS1": None}, units='ft', desc='length of the pilot compartment', + default_value=0.0, ) add_meta_data( @@ -3398,6 +3423,7 @@ }, units='ft**2', desc='fuselage planform area', + default_value=0.0, ) add_meta_data( @@ -3455,7 +3481,7 @@ }, units='ft**2', desc='fuselage wetted area', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -3506,7 +3532,7 @@ }, units='unitless', desc='horizontal tail theoretical aspect ratio', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -3530,6 +3556,7 @@ }, units='ft', desc='Reynolds characteristic length for the horizontal tail', + default_value=0.0, ) add_meta_data( @@ -3545,6 +3572,7 @@ }, units='unitless', desc='horizontal tail fineness ratio', + default_value=0.0, ) add_meta_data( @@ -3598,7 +3626,7 @@ }, units='lbm', desc='mass of horizontal tail', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -3680,7 +3708,7 @@ }, units='unitless', desc='horizontal tail theoretical taper ratio', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -3710,7 +3738,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, ) add_meta_data( @@ -3738,7 +3766,7 @@ }, units='ft**2', desc='horizontal tail wetted area', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -3798,7 +3826,7 @@ }, units='lbm', desc='mass of hydraulic system', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -3825,7 +3853,7 @@ }, units='psi', desc='hydraulic system pressure', - default_value=3000.0, + default_value=0.0, ) # @@ -3853,7 +3881,7 @@ }, units='lbm', desc='instrument group mass', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -3954,6 +3982,7 @@ }, units='lbm', desc='mass of main landing gear', + default_value=0, ) add_meta_data( @@ -4015,7 +4044,7 @@ }, units='lbm', desc='mass of nose landing gear', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -4093,6 +4122,7 @@ }, units='ft', desc='Average diameter of engine nacelles for each engine model', + default_value=0.0, ) add_meta_data( @@ -4107,6 +4137,7 @@ }, units='ft', desc='Average length of nacelles for each engine model', + default_value=0.0, ) add_meta_data( @@ -4122,6 +4153,7 @@ }, units='ft', desc='Reynolds characteristic length for nacelle for each engine model', + default_value=0.0, ) add_meta_data( @@ -4155,6 +4187,7 @@ }, units='unitless', desc='nacelle fineness ratio', + default_value=0.0, ) add_meta_data( @@ -4208,7 +4241,7 @@ }, units='lbm', desc='estimated mass of the nacelles for each engine model', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -4252,6 +4285,7 @@ }, units='ft**2', desc='total nacelles wetted area', + default_value=0.0, ) add_meta_data( @@ -4267,6 +4301,7 @@ }, units='ft**2', desc='wetted area of a single nacelle for each engine model', + default_value=0.0, ) add_meta_data( @@ -4303,6 +4338,7 @@ }, units='lbm', desc='mass of paint for all wetted area', + default_value=0.0, ) add_meta_data( @@ -4357,6 +4393,7 @@ }, units='lbm', desc='Total propulsion group mass', + default_value=0.0, ) # TODO clash with per-engine scaling, need to resolve w/ heterogeneous engine @@ -4381,6 +4418,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, ) add_meta_data( @@ -4389,6 +4427,7 @@ historical_name={"GASP": 'INGASP.WEP', "FLOPS": None, "LEAPS1": None}, units='lbm', desc='total mass of all engines on aircraft', + default_value=0.0, ) add_meta_data( @@ -4407,7 +4446,7 @@ }, units='lbm', desc='engine oil mass', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -4427,7 +4466,7 @@ units='lbm', desc='sum of engine control, starter, and additional mass for all engines ' 'on aircraft', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -4499,7 +4538,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, ) # _____ _ _ @@ -4525,6 +4564,7 @@ historical_name={"GASP": 'INGASP.SSTQSW', "FLOPS": None, "LEAPS1": None}, units='unitless', desc='ratio of strut area to wing area', + default_value=0.0, ) add_meta_data( @@ -4537,6 +4577,7 @@ }, units='ft', desc='attachment location of strut the full attachment-to-attachment span', + default_value=0.0, ) # related to Aircraft.Strut.ATTACHMENT_LOCATION @@ -4546,6 +4587,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, ) add_meta_data( @@ -4554,6 +4596,7 @@ historical_name={"GASP": 'INGASP.STRTCHD', "FLOPS": None, "LEAPS1": None}, units='ft', desc='chord of the strut', + default_value=0.0, ) add_meta_data( @@ -4671,7 +4714,7 @@ }, units='unitless', desc='vertical tail theoretical aspect ratio', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -4695,6 +4738,7 @@ }, units='ft', desc='Reynolds characteristic length for the vertical tail', + default_value=0.0, ) add_meta_data( @@ -4710,6 +4754,7 @@ }, units='unitless', desc='vertical tail fineness ratio', + default_value=0.0, ) add_meta_data( @@ -4763,7 +4808,7 @@ }, units='lbm', desc='mass of vertical tail', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -4860,7 +4905,7 @@ }, units='unitless', desc='vertical tail theoretical taper ratio', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -4903,7 +4948,7 @@ }, units='ft**2', desc='vertical tails wetted area', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -5032,6 +5077,7 @@ }, units='unitless', desc='Reference aspect ratio, used for detailed wing mass estimation.', + default_value=0.0, ) add_meta_data( @@ -5040,6 +5086,7 @@ historical_name={"GASP": 'INGASP.CBARW', "FLOPS": None, "LEAPS1": None}, units='ft', desc='mean aerodynamic chord of the wing', + default_value=0.0, ) add_meta_data( @@ -5053,6 +5100,7 @@ units='unitless', desc='Wing bending material factor with sweep adjustment. Used to compute ' 'Aircraft.Wing.BENDING_MATERIAL_MASS', + default_value=0.0, ) add_meta_data( @@ -5067,7 +5115,7 @@ }, units='lbm', desc='wing mass breakdown term 1', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -5095,7 +5143,7 @@ }, units='lbm', desc='wing mass breakdown term 4', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -5117,6 +5165,7 @@ historical_name={"GASP": 'INGASP.CRCLW', "FLOPS": None, "LEAPS1": None}, units='ft', desc='wing chord at fuselage centerline', + default_value=0.0, ) add_meta_data( @@ -5141,6 +5190,7 @@ }, units='ft', desc='Reynolds characteristic length for the wing', + default_value=0.0, ) add_meta_data( @@ -5167,7 +5217,7 @@ units='unitless', desc='chord lengths as fractions of semispan at station locations; ' 'overwrites station_chord_lengths', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -5202,6 +5252,7 @@ }, units='ft**2', desc='area of wing control surfaces', + default_value=0.0, ) add_meta_data( @@ -5216,7 +5267,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, ) add_meta_data( @@ -5258,6 +5309,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, ) add_meta_data( @@ -5273,6 +5325,7 @@ }, units='unitless', desc='wing fineness ratio', + default_value=0.0, ) add_meta_data( @@ -5374,7 +5427,7 @@ historical_name={"GASP": 'INGASP.YWFOLD', "FLOPS": None, "LEAPS1": None}, units='ft', desc='folded wingspan', - default_value=118, + default_value=0, ) add_meta_data( @@ -5533,6 +5586,7 @@ historical_name={"GASP": 'INGASP.SWPLE', "FLOPS": None, "LEAPS1": None}, units='rad', desc='sweep angle at leading edge of wing', + default_value=0.0, ) add_meta_data( @@ -5574,7 +5628,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, ) add_meta_data( @@ -5587,6 +5641,7 @@ }, units='lbf/ft**2', desc='wing loading', + default_value=0.0, ) add_meta_data( @@ -5616,7 +5671,7 @@ }, units='lbm', desc='wing total mass', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -5725,7 +5780,7 @@ }, units='lbm', desc='wing mass breakdown term 3', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -5803,6 +5858,7 @@ }, units='ft', desc='wing chord length at wing root', + default_value=0.0, ) add_meta_data( @@ -5817,7 +5873,7 @@ }, units='lbm', desc='wing mass breakdown term 2', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -5944,7 +6000,7 @@ }, units='lbm', desc='mass of surface controls', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -5992,7 +6048,7 @@ }, units='deg', desc='quarter-chord sweep angle of the wing', - default_value=0.0, # TODO required + default_value=0.0, # TODO required. ) add_meta_data( @@ -6017,7 +6073,7 @@ }, units='unitless', desc='taper ratio of the wing', - default_value=0.0, # TODO required + default_value=0.0, # TODO required. ) add_meta_data( @@ -6056,7 +6112,7 @@ }, units='unitless', desc='the thickeness-chord ratios at station locations', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -6078,6 +6134,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, ) add_meta_data( @@ -6086,6 +6143,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, ) add_meta_data( @@ -6094,6 +6152,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, ) add_meta_data( @@ -6141,7 +6200,7 @@ }, units='ft**2', desc='wing wetted area', - default_value=None, + default_value=0.0, ) add_meta_data( @@ -6745,6 +6804,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, ) add_meta_data( @@ -6775,7 +6835,7 @@ }, units='lbm', desc='design gross mass of the aircraft', - default_value=None, + default_value=0.0, ) add_meta_data( diff --git a/setup.py b/setup.py index 143676dd5..89835c49e 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"], } @@ -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', - ] - } + ], + }, )