From 39072419166433065a85091582d39ad4d312f482 Mon Sep 17 00:00:00 2001 From: Kenneth-T-Moore Date: Mon, 16 Dec 2024 10:03:24 -0500 Subject: [PATCH 1/3] conflict --- aviary/interface/methods_for_level1.py | 9 +++++++++ .../geometry/test/test_flops_geom_builder.py | 3 +-- .../geometry/test/test_gasp_geom_builder.py | 3 +-- aviary/utils/doctape.py | 11 ++++++++--- .../benchmark_tests/test_bench_multiengine.py | 9 +++++++-- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/aviary/interface/methods_for_level1.py b/aviary/interface/methods_for_level1.py index b93d39c47..35b59dc61 100644 --- a/aviary/interface/methods_for_level1.py +++ b/aviary/interface/methods_for_level1.py @@ -114,6 +114,7 @@ def run_level_1( optimizer='SNOPT', phase_info=None, max_iter=50, + verbosity=1, analysis_scheme=AnalysisScheme.COLLOCATION, ): ''' @@ -131,6 +132,7 @@ def run_level_1( # kwargs['optimizer'] = 'IPOPT' # else: kwargs['optimizer'] = optimizer + kwargs['verbosity'] = Verbosity(verbosity) if isinstance(phase_info, str): phase_info_path = get_path(phase_info) @@ -185,6 +187,12 @@ def _setup_level1_parser(parser): action="store_true", help="Use shooting instead of collocation", ) + parser.add_argument( + "--verbosity", + type=int, + default=1, + help="verbosity settings: 0=quiet, 1=brief, 2=verbose, 3=debug", + choices=(0, 1, 2, 3)) def _exec_level1(args, user_args): @@ -211,5 +219,6 @@ def _exec_level1(args, user_args): optimizer=args.optimizer, phase_info=args.phase_info, max_iter=args.max_iter, + verbosity=args.verbosity, analysis_scheme=analysis_scheme, ) diff --git a/aviary/subsystems/geometry/test/test_flops_geom_builder.py b/aviary/subsystems/geometry/test/test_flops_geom_builder.py index fb8e44cde..fa2fd4bb4 100644 --- a/aviary/subsystems/geometry/test/test_flops_geom_builder.py +++ b/aviary/subsystems/geometry/test/test_flops_geom_builder.py @@ -59,8 +59,7 @@ def setUp(self): self.subsystem_builder = CoreGeometryBuilder( 'core_geometry', BaseMetaData, - use_both_geometries=False, - code_origin=FLOPS, + use_both_geometries=True, code_origin_to_prioritize=FLOPS) self.aviary_values = av.AviaryValues() self.aviary_values.set_val(Aircraft.Engine.NUM_ENGINES, [1], units='unitless') diff --git a/aviary/subsystems/geometry/test/test_gasp_geom_builder.py b/aviary/subsystems/geometry/test/test_gasp_geom_builder.py index 9443845bd..bc0e33c0c 100644 --- a/aviary/subsystems/geometry/test/test_gasp_geom_builder.py +++ b/aviary/subsystems/geometry/test/test_gasp_geom_builder.py @@ -59,8 +59,7 @@ def setUp(self): self.subsystem_builder = CoreGeometryBuilder( 'core_geometry', BaseMetaData, - use_both_geometries=False, - code_origin=GASP, + use_both_geometries=True, code_origin_to_prioritize=GASP) self.aviary_values = av.AviaryValues() self.aviary_values.set_val(Aircraft.Engine.NUM_ENGINES, [1], units='unitless') diff --git a/aviary/utils/doctape.py b/aviary/utils/doctape.py index 13f129410..149469570 100644 --- a/aviary/utils/doctape.py +++ b/aviary/utils/doctape.py @@ -222,7 +222,7 @@ def check_args(func, expected_args: tuple[list, dict, str], args_to_ignore: tupl f"the default value of {arg} is {available_args[arg]}, not {expected_args[arg]}") -def run_command_no_file_error(command: str): +def run_command_no_file_error(command: str, verbose=False): """ Executes a CLI command and handles FileNotFoundError separately. @@ -235,6 +235,8 @@ def run_command_no_file_error(command: str): ---------- command : str The CLI command to be executed. + verbose : bool + Whether or not to include the error message if FileNotFoundError is raised Raises ------ @@ -244,9 +246,12 @@ def run_command_no_file_error(command: str): with tempfile.TemporaryDirectory() as tempdir: rc = subprocess.run(command.split(), cwd=tempdir, capture_output=True, text=True) if rc.returncode: - err = rc.stderr.split('\n')[-2].split(':')[0] + err, info = rc.stderr.split('\n')[-2].split(':', 1) if err == 'FileNotFoundError': - print(err) + if verbose: + print(info) + print( + f"A file required by {command} couldn't be found, continuing anyway") else: print(rc.stderr) rc.check_returncode() diff --git a/aviary/validation_cases/benchmark_tests/test_bench_multiengine.py b/aviary/validation_cases/benchmark_tests/test_bench_multiengine.py index 4be6268fb..1302e1b2b 100644 --- a/aviary/validation_cases/benchmark_tests/test_bench_multiengine.py +++ b/aviary/validation_cases/benchmark_tests/test_bench_multiengine.py @@ -1,5 +1,6 @@ from copy import deepcopy import unittest +import numpy as np import openmdao.api as om from openmdao.core.problem import _clear_problem_names @@ -11,6 +12,7 @@ from aviary.models.multi_engine_single_aisle.multi_engine_single_aisle_data import inputs, engine_1_inputs, engine_2_inputs from aviary.subsystems.propulsion.utils import build_engine_deck from aviary.variable_info.enums import ThrottleAllocation +from aviary.variable_info.variables import Aircraft # Build problem @@ -33,6 +35,9 @@ local_phase_info['descent']['user_options']['no_climb'] = True local_phase_info['descent']['user_options']['use_polynomial_control'] = True +inputs.set_val(Aircraft.Nacelle.LAMINAR_FLOW_LOWER, np.zeros(2)) +inputs.set_val(Aircraft.Nacelle.LAMINAR_FLOW_UPPER, np.zeros(2)) + @use_tempdirs class MultiengineTestcase(unittest.TestCase): @@ -124,7 +129,7 @@ def test_multiengine_static(self): alloc_cruise = prob.get_val('traj.cruise.parameter_vals:throttle_allocations') alloc_descent = prob.get_val('traj.descent.parameter_vals:throttle_allocations') - assert_near_equal(alloc_climb[0], 0.51, tolerance=1e-2) + assert_near_equal(alloc_climb[0], 0.512, tolerance=1e-2) assert_near_equal(alloc_cruise[0], 0.747, tolerance=1e-2) assert_near_equal(alloc_descent[0], 0.999, tolerance=1e-2) @@ -166,7 +171,7 @@ def test_multiengine_dynamic(self): alloc_descent = prob.get_val('traj.descent.controls:throttle_allocations') # Cruise is pretty constant, check exact value. - assert_near_equal(alloc_cruise[0], 0.75, tolerance=1e-2) + assert_near_equal(alloc_cruise[0], 0.751, tolerance=1e-2) # Check general trend: favors engine 1. self.assertGreater(alloc_climb[2], 0.55) From 091afa0162a2233b54ce8a1b74a811f6c7180649 Mon Sep 17 00:00:00 2001 From: Kenneth-T-Moore Date: Mon, 16 Dec 2024 10:04:55 -0500 Subject: [PATCH 2/3] conflict --- aviary/utils/preprocessors.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/aviary/utils/preprocessors.py b/aviary/utils/preprocessors.py index 54f22bcee..deec2fb94 100644 --- a/aviary/utils/preprocessors.py +++ b/aviary/utils/preprocessors.py @@ -397,21 +397,6 @@ def preprocess_propulsion(aviary_options: AviaryValues, engine_models: list = No aviary_options.set_val(Aircraft.Engine.NUM_WING_ENGINES, num_wing_engines_all) aviary_options.set_val(Aircraft.Engine.NUM_FUSELAGE_ENGINES, num_fuse_engines_all) - # Update nacelle-related variables in aero to be sized to the number of - # engine types. - if num_engine_type > 1: - - keys = [ - Aircraft.Nacelle.LAMINAR_FLOW_LOWER, - Aircraft.Nacelle.LAMINAR_FLOW_UPPER - ] - - for var in keys: - try: - aviary_options.get_val(var) - except KeyError: - aviary_options.set_val(var, np.zeros(num_engine_type)) - if Mission.Summary.FUEL_FLOW_SCALER not in aviary_options: aviary_options.set_val(Mission.Summary.FUEL_FLOW_SCALER, 1.0) From 670b50ad076f37479ed4e29a05cf9329edc8f6f7 Mon Sep 17 00:00:00 2001 From: Kenneth-T-Moore Date: Wed, 8 Jan 2025 11:57:18 -0500 Subject: [PATCH 3/3] Point CI at older Ubuntu due to some incompatibility in 24. --- .github/workflows/test_benchmarks.yml | 2 +- .github/workflows/test_docs.yml | 2 +- .github/workflows/test_workflow.yml | 4 ++-- .github/workflows/test_workflow_dev_deps.yml | 2 +- .github/workflows/test_workflow_no_dev_install.yml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml index bc2a5dce3..5b18b2c2c 100644 --- a/.github/workflows/test_benchmarks.yml +++ b/.github/workflows/test_benchmarks.yml @@ -18,7 +18,7 @@ on: jobs: latest_benchmarks: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 90 steps: diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml index 31977627d..287fc9510 100644 --- a/.github/workflows/test_docs.yml +++ b/.github/workflows/test_docs.yml @@ -18,7 +18,7 @@ on: jobs: latest_docs: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 90 steps: diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml index 7f028d92d..ce705719b 100644 --- a/.github/workflows/test_workflow.yml +++ b/.github/workflows/test_workflow.yml @@ -18,7 +18,7 @@ jobs: pre_commit: # run pre-commit checks - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -28,7 +28,7 @@ jobs: - uses: pre-commit/action@v3.0.1 test_ubuntu: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: diff --git a/.github/workflows/test_workflow_dev_deps.yml b/.github/workflows/test_workflow_dev_deps.yml index 92daf1528..fed5ad912 100644 --- a/.github/workflows/test_workflow_dev_deps.yml +++ b/.github/workflows/test_workflow_dev_deps.yml @@ -14,7 +14,7 @@ on: jobs: test_ubuntu: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: diff --git a/.github/workflows/test_workflow_no_dev_install.yml b/.github/workflows/test_workflow_no_dev_install.yml index dd8f1f67e..d58ffea15 100644 --- a/.github/workflows/test_workflow_no_dev_install.yml +++ b/.github/workflows/test_workflow_no_dev_install.yml @@ -17,7 +17,7 @@ on: jobs: test_ubuntu_no_dev_install: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 90