Skip to content

Commit

Permalink
Merge branch 'main' into issue233
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbenne3 authored Oct 2, 2024
2 parents 444ee49 + ffe1e9b commit 9a9649d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 21 deletions.
8 changes: 5 additions & 3 deletions aviary/subsystems/geometry/gasp_based/fuselage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import openmdao.api as om

from aviary.utils.aviary_values import AviaryValues
from aviary.variable_info.options import get_option_defaults
from aviary.variable_info.enums import Verbosity
from aviary.variable_info.functions import add_aviary_input, add_aviary_output
from aviary.variable_info.variables import Aircraft
from aviary.variable_info.variables import Aircraft, Settings


def sigX(x):
Expand Down Expand Up @@ -51,6 +51,7 @@ def setup(self):
)

def compute(self, inputs, outputs):
verbosity = self.options['aviary_options'].get_val(Settings.VERBOSITY)
aviary_options: AviaryValues = self.options['aviary_options']
seats_abreast = aviary_options.get_val(Aircraft.Fuselage.NUM_SEATS_ABREAST)
seat_width = aviary_options.get_val(Aircraft.Fuselage.SEAT_WIDTH, units='inch')
Expand All @@ -64,7 +65,8 @@ def compute(self, inputs, outputs):
cabin_width = seats_abreast * seat_width + num_aisle * aisle_width + 12

if PAX < 1:
print("Warning: you have not specified at least one passenger")
if verbosity >= Verbosity.BRIEF:
print("Warning: you have not specified at least one passenger")

# single seat across
cabin_len_a = PAX * seat_pitch / 12
Expand Down
13 changes: 8 additions & 5 deletions aviary/subsystems/mass/gasp_based/fuel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

from aviary.constants import GRAV_ENGLISH_LBM
from aviary.utils.aviary_values import AviaryValues
from aviary.variable_info.enums import Verbosity
from aviary.variable_info.functions import add_aviary_input, add_aviary_output
from aviary.variable_info.variables import Aircraft, Mission
from aviary.variable_info.variables import Aircraft, Mission, Settings

check = 1

Expand Down Expand Up @@ -136,10 +137,12 @@ def compute(self, inputs, outputs):
design_fuel_vol - geometric_fuel_vol
)

if (req_fuel_wt > max_wingfuel_wt) and (design_fuel_vol > max_wingfuel_vol):
print("Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank")
if (req_fuel_wt < max_wingfuel_wt) and (design_fuel_vol > max_wingfuel_vol):
print("Warning: design_fuel_vol > max_wingfuel_vol, adding a body tank")
verbosity = self.options['aviary_options'].get_val(Settings.VERBOSITY)
if verbosity >= Verbosity.BRIEF:
if (req_fuel_wt > max_wingfuel_wt) and (design_fuel_vol > max_wingfuel_vol):
print("Warning: req_fuel_mass > max_wingfuel_mass, adding a body tank")
if (req_fuel_wt < max_wingfuel_wt) and (design_fuel_vol > max_wingfuel_vol):
print("Warning: design_fuel_vol > max_wingfuel_vol, adding a body tank")

extra_fuel_wt = req_fuel_wt - max_wingfuel_wt
if smooth:
Expand Down
16 changes: 9 additions & 7 deletions aviary/subsystems/propulsion/propeller/hamilton_standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ def compute(self, inputs, outputs):
CP_CLi_table[CL_tab_idx][:cli_len], XPCLI[CL_tab_idx], CPE1X)
if (run_flag == 1):
ichck = ichck + 1
if verbosity == Verbosity.DEBUG or ichck <= Verbosity.BRIEF:
if verbosity >= Verbosity.DEBUG or ichck <= 1:
if (run_flag == 1):
warnings.warn(
f"Mach,VTMACH,J,power_coefficient,CP_Eff =: {inputs[Dynamic.Mission.MACH][i_node]},{inputs['tip_mach'][i_node]},{inputs['advance_ratio'][i_node]},{power_coefficient},{CP_Eff}")
Expand Down Expand Up @@ -756,10 +756,11 @@ def compute(self, inputs, outputs):
except IndexError:
raise om.AnalysisError(
"interp failed for CTT (thrust coefficient) in hamilton_standard.py")
if (run_flag > 1):
if run_flag > 1:
NERPT = 2
print(
f"ERROR IN PROP. PERF.-- NERPT={NERPT}, run_flag={run_flag}")
if verbosity >= Verbosity.DEBUG:
print(
f"ERROR IN PROP. PERF.-- NERPT={NERPT}, run_flag={run_flag}")

BLLL[ibb], run_flag = _unint(
advance_ratio_array[J_begin:J_begin+4], BLL[J_begin:J_begin+4], inputs['advance_ratio'][i_node])
Expand Down Expand Up @@ -793,8 +794,9 @@ def compute(self, inputs, outputs):
NERPT = 5
if (run_flag == 1):
# off lower bound only.
print(
f"ERROR IN PROP. PERF.-- NERPT={NERPT}, run_flag={run_flag}, il = {il}, kl = {kl}")
if verbosity >= Verbosity.DEBUG:
print(
f"ERROR IN PROP. PERF.-- NERPT={NERPT}, run_flag={run_flag}, il = {il}, kl = {kl}")
if (inputs['advance_ratio'][i_node] != 0.0):
ZMCRT, run_flag = _unint(
advance_ratio_array2, mach_corr_table[CL_tab_idx], inputs['advance_ratio'][i_node])
Expand Down Expand Up @@ -848,7 +850,7 @@ def compute(self, inputs, outputs):
xft, run_flag = _unint(num_blades_arr, XXXFT, num_blades)

# NOTE this could be handled via the metamodel comps (extrapolate flag)
if ichck > 0:
if verbosity >= Verbosity.DEBUG and ichck > 0:
print(f" table look-up error = {ichck} (if you go outside the tables.)")

outputs['thrust_coefficient'][i_node] = ct
Expand Down
17 changes: 11 additions & 6 deletions aviary/variable_info/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from openmdao.core.component import Component

from aviary.utils.aviary_values import AviaryValues
from aviary.variable_info.variables import Settings
from aviary.variable_info.variable_meta_data import _MetaData

# ---------------------------
Expand Down Expand Up @@ -144,14 +145,18 @@ def name_filter(name):
group.promotes(comp.name, inputs=in_var_names, outputs=comp_promoted_outputs)

if overridden_outputs:
print("\nThe following variables have been overridden:")
for prom_name in sorted(overridden_outputs):
print(f" '{prom_name}")
if aviary_inputs.get_val(Settings.VERBOSITY).value >= 1: # Verbosity.BRIEF
print("\nThe following variables have been overridden:")
for prom_name in sorted(overridden_outputs):
val, units = aviary_inputs.get_item(prom_name)
print(f" '{prom_name} {val} {units}")

if external_overridden_outputs:
print("\nThe following variables have been overridden by an external subsystem:")
for prom_name in sorted(external_overridden_outputs):
print(f" '{prom_name}")
if aviary_inputs.get_val(Settings.VERBOSITY).value >= 1:
print("\nThe following variables have been overridden by an external subsystem:")
for prom_name in sorted(external_overridden_outputs):
# do not print values because they will be updated by an external subsystem later.
print(f" '{prom_name}")

return overridden_outputs

Expand Down

0 comments on commit 9a9649d

Please sign in to comment.