diff --git a/aviary/docs/examples_unreviewed/OAS_subsystem.ipynb b/aviary/docs/examples_unreviewed/OAS_subsystem.ipynb index cf65d9303f..9936e7ce5b 100644 --- a/aviary/docs/examples_unreviewed/OAS_subsystem.ipynb +++ b/aviary/docs/examples_unreviewed/OAS_subsystem.ipynb @@ -42,7 +42,7 @@ "## External Dependencies\n", "\n", "The user must install [OpenAeroStruct](https://github.com/mdolab/OpenAeroStruct) into their Python environment using the command 'pip install openaerostruct'.\n", - "The user must also install the [ambiance](https://ambiance.readthedocs.io/en/latest/) package using the command 'pip install ambiance'.\n", + "Atmospheric properties (speed of sound, density, and dynamic viscosity) are computed using Aviary's own `Atmosphere` subsystem, so no additional atmosphere package is required.\n", "\n", "## Subsystem Details\n", "\n", diff --git a/aviary/docs/getting_started/installation.ipynb b/aviary/docs/getting_started/installation.ipynb index 0176842e3e..2bbfd0833f 100644 --- a/aviary/docs/getting_started/installation.ipynb +++ b/aviary/docs/getting_started/installation.ipynb @@ -223,10 +223,9 @@ "## Packages For Running Tests\n", "In order to run Aviary's test suite, you will need the following packages:\n", "- *testflo*\n", - "- *ambiance*\n", "- *openaerostruct*\n", "\n", - "`testflo` is the core package that automates testing. The other two packages, `ambiance` and `openaerostruct`, are needed to run example cases that incorporate them as external subsystems. It is useful to be able to run these cases even if you have no interest in those specific tools to ensure that the interface for external subsystems is working correctly.\n", + "`testflo` is the core package that automates testing. The other package, `openaerostruct`, is needed to run example cases that incorporate it as an external subsystem. It is useful to be able to run these cases even if you have no interest in that specific tool to ensure that the interface for external subsystems is working correctly.\n", "\n", "(contribution-packages)=\n", "## Packages For Contributing Code\n", diff --git a/aviary/models/external_subsystems/open_aero_struct/OAS_wing_mass_analysis.py b/aviary/models/external_subsystems/open_aero_struct/OAS_wing_mass_analysis.py index d8a9f158aa..aac5b60abc 100644 --- a/aviary/models/external_subsystems/open_aero_struct/OAS_wing_mass_analysis.py +++ b/aviary/models/external_subsystems/open_aero_struct/OAS_wing_mass_analysis.py @@ -27,13 +27,6 @@ import numpy as np import openmdao.api as om -try: - import ambiance -except ImportError: - raise ImportError( - "ambiance package not found. You can install it by running 'pip install ambiance'." - ) - try: import openaerostruct except ImportError: @@ -41,10 +34,35 @@ "openaerostruct package not found. You can install it by running 'pip install openaerostruct'." ) -from ambiance import Atmosphere from openaerostruct.integration.aerostruct_groups import AerostructGeometry, AerostructPoint from openaerostruct.structures.wingbox_fuel_vol_delta import WingboxFuelVolDelta +from aviary.subsystems.atmosphere.atmosphere import Atmosphere +from aviary.variable_info.variables import Dynamic + + +def _get_atmospheric_properties(altitude): + """ + Compute speed of sound, density, and dynamic viscosity at the given + altitude(s) [m] using Aviary's own Atmosphere group, in place of the + external ambiance package. + """ + atmos_prob = om.Problem() + atmos_prob.model.add_subsystem( + name='atmosphere', + subsys=Atmosphere(num_nodes=len(altitude)), + promotes=['*'], + ) + atmos_prob.setup() + atmos_prob.set_val(Dynamic.Mission.ALTITUDE, altitude, units='m') + atmos_prob.run_model() + + speed_of_sound = atmos_prob.get_val(Dynamic.Atmosphere.SPEED_OF_SOUND, units='m/s') + density = atmos_prob.get_val(Dynamic.Atmosphere.DENSITY, units='kg/m**3') + dynamic_viscosity = atmos_prob.get_val(Dynamic.Atmosphere.DYNAMIC_VISCOSITY, units='Pa*s') + + return speed_of_sound, density, dynamic_viscosity + def user_mesh(): """Generate a user defined mesh which is model specific.""" @@ -305,11 +323,7 @@ def compute(self, inputs, outputs): altitude = np.array([inputs['cruise_altitude'][0], 0.0]) cruise_range = inputs['cruise_range'][0] - atmos = Atmosphere(altitude) - - speed_of_sound = atmos.speed_of_sound - rho = atmos.density - dynamic_viscosity = atmos.dynamic_viscosity + speed_of_sound, rho, dynamic_viscosity = _get_atmospheric_properties(altitude) velocity = np.array([mach[0] * speed_of_sound[0], mach[1] * speed_of_sound[1]]) diff --git a/aviary/models/external_subsystems/open_aero_struct/test/test_OAS_wing_mass_builder.py b/aviary/models/external_subsystems/open_aero_struct/test/test_OAS_wing_mass_builder.py index fdadfdad7b..31c4a9e8b8 100644 --- a/aviary/models/external_subsystems/open_aero_struct/test/test_OAS_wing_mass_builder.py +++ b/aviary/models/external_subsystems/open_aero_struct/test/test_OAS_wing_mass_builder.py @@ -1,4 +1,3 @@ -import importlib.util import unittest import aviary.api as av @@ -9,7 +8,6 @@ @skipIfMissingDependencies(OASWingWeightBuilder) -@unittest.skipUnless(importlib.util.find_spec('ambiance'), "'ambiance' is not installed") class TestStructures(av.TestSubsystemBuilder): """Test OAS structure builder.""" diff --git a/pyproject.toml b/pyproject.toml index 616fe33dfb..4c6c73de9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,6 @@ docs = [ dev = [ "pre-commit", "testflo", - "ambiance", "openaerostruct", ] all = [