diff --git a/openconcept/aerodynamics/__init__.py b/openconcept/aerodynamics/__init__.py index 113ac1f5..8f405a75 100644 --- a/openconcept/aerodynamics/__init__.py +++ b/openconcept/aerodynamics/__init__.py @@ -1,2 +1,6 @@ from .aerodynamics import PolarDrag, StallSpeed, Lift -from .openaerostruct import VLMDragPolar, AerostructDragPolar + +try: + from .openaerostruct import VLMDragPolar, AerostructDragPolar +except ImportError: + pass diff --git a/openconcept/aerodynamics/openaerostruct/tests/test_aerostructural.py b/openconcept/aerodynamics/openaerostruct/tests/test_aerostructural.py index 07e98c10..9b35748b 100644 --- a/openconcept/aerodynamics/openaerostruct/tests/test_aerostructural.py +++ b/openconcept/aerodynamics/openaerostruct/tests/test_aerostructural.py @@ -176,7 +176,7 @@ def test_surf_options(self): p.run_model() # Ensure they're all the same - assert_near_equal(p.get_val("drag", units="N"), 33112.3426245 * np.ones(nn), tolerance=1e-10) + assert_near_equal(p.get_val("drag", units="N"), 33058.43316461 * np.ones(nn), tolerance=1e-10) def test_vectorized(self): nn = 7 @@ -218,7 +218,7 @@ def test_vectorized(self): p.run_model() # Ensure they're all the same - assert_near_equal(p.get_val("drag", units="N"), 35911.23954369 * np.ones(nn), tolerance=1e-10) + assert_near_equal(p.get_val("drag", units="N"), 35692.26543182 * np.ones(nn), tolerance=1e-10) @unittest.skipIf(not OAS_installed, "OpenAeroStruct is not installed") @@ -272,7 +272,7 @@ def test_defaults(self): ] ) CD = np.array( - [[[0.0423459, 0.04473217], [0.07565092, 0.0781007]], [[0.03668226, 0.04308131], [0.11930142, 0.15852171]]] + [[[0.04196198, 0.04421198], [0.07526711, 0.07758053]], [[0.03631444, 0.04259311], [0.11894307, 0.158035]]] ) assert_near_equal(p.get_val("CL_train"), CL, tolerance=1e-7) @@ -338,7 +338,7 @@ def test_defaults(self): # Use values computed offline from an OAS wingbox case with the same inputs assert_near_equal(p.get_val("fltcond|CL"), 0.22369546, tolerance=1e-6) - assert_near_equal(p.get_val("fltcond|CD"), 0.01664464, tolerance=1e-6) + assert_near_equal(p.get_val("fltcond|CD"), 0.015608634462089457, tolerance=1e-6) assert_near_equal(p.get_val("failure"), -0.64781499, tolerance=1e-6) assert_near_equal(p.get_val("ac|weights|W_wing", units="kg"), 29322.10058108, tolerance=1e-6) @@ -348,7 +348,7 @@ def test_wave_drag(self): # Use values computed offline from an OAS wingbox case with the same inputs assert_near_equal(p.get_val("fltcond|CL"), 0.22369546, tolerance=1e-6) - assert_near_equal(p.get_val("fltcond|CD"), 0.0164930472, tolerance=1e-6) + assert_near_equal(p.get_val("fltcond|CD"), 0.015457034121371742, tolerance=1e-6) assert_near_equal(p.get_val("failure"), -0.64781499, tolerance=1e-6) assert_near_equal(p.get_val("ac|weights|W_wing", units="kg"), 29322.10058108, tolerance=1e-6) @@ -397,7 +397,7 @@ def test_defaults(self): p.run_model() # Use values computed offline from an OAS wingbox case with the same inputs - CD = CD0 + np.array([0.015167035551253, 0.015746642643445, 0.016644647603543]) + CD = CD0 + np.array([0.014130134503259, 0.014710068221375, 0.015608634461878]) assert_near_equal(p.get_val("drag"), q * S * CD, tolerance=1e-6) assert_near_equal(p.get_val("failure"), np.array([-0.89649433, -0.77578479, -0.64781499]), tolerance=1e-6) assert_near_equal(p.get_val("ac|weights|W_wing", units="kg"), 29322.10058108, tolerance=1e-6) diff --git a/openconcept/aerodynamics/openaerostruct/tests/test_drag_polar.py b/openconcept/aerodynamics/openaerostruct/tests/test_drag_polar.py index 9e255186..428599ab 100644 --- a/openconcept/aerodynamics/openaerostruct/tests/test_drag_polar.py +++ b/openconcept/aerodynamics/openaerostruct/tests/test_drag_polar.py @@ -97,7 +97,7 @@ def test(self): mesh.get_val("fltcond|CL"), p.get_val("aero_surrogate.CL"), tolerance=1e-10 ) # check convergence assert_near_equal(6, p.get_val("alpha_bal.alpha", units="deg"), tolerance=1e-2) - assert_near_equal(mesh.get_val("fltcond|CD") + 0.01, p.get_val("aero_surrogate.CD"), tolerance=5e-2) + assert_near_equal(mesh.get_val("fltcond|CD") + 0.01, p.get_val("aero_surrogate.CD"), tolerance=6e-2) assert_near_equal(p.get_val("drag", units="N"), p.get_val("aero_surrogate.CD") * 100 * 5e3, tolerance=5e-2) def test_surf_options(self): @@ -132,7 +132,7 @@ def test_surf_options(self): p.run_model() # Ensure they're all the same - assert_near_equal(p.get_val("drag", units="N"), 34962.6043231 * np.ones(nn), tolerance=1e-10) + assert_near_equal(p.get_val("drag", units="N"), 34905.69308752 * np.ones(nn), tolerance=1e-10) def test_vectorized(self): nn = 7 @@ -165,7 +165,7 @@ def test_vectorized(self): p.run_model() # Ensure they're all the same - assert_near_equal(p.get_val("drag", units="N"), 37845.94053713 * np.ones(nn), tolerance=1e-10) + assert_near_equal(p.get_val("drag", units="N"), 37615.14285108 * np.ones(nn), tolerance=1e-10) @unittest.skipIf(not OAS_installed, "OpenAeroStruct is not installed") @@ -209,7 +209,7 @@ def test_defaults(self): ] ) CD = np.array( - [[[0.03465792, 0.03701483], [0.06816224, 0.07051915]], [[0.03455214, 0.03648223], [0.20238882, 0.20431891]]] + [[[0.03425776, 0.03647253], [0.06776208, 0.06997685]], [[0.03415836, 0.03597205], [0.20199504, 0.20380873]]] ) assert_near_equal(CL, p.get_val("CL_train"), tolerance=1e-7) diff --git a/openconcept/examples/tests/test_example_aircraft.py b/openconcept/examples/tests/test_example_aircraft.py index 5621b596..0d9b812a 100644 --- a/openconcept/examples/tests/test_example_aircraft.py +++ b/openconcept/examples/tests/test_example_aircraft.py @@ -170,9 +170,9 @@ def tearDown(self): def test_values_B738(self): prob = self.prob # block fuel - assert_near_equal(prob.get_val("descent.fuel_used_final", units="lbm"), 28443.39604559, tolerance=1e-5) + assert_near_equal(prob.get_val("descent.fuel_used_final", units="lbm"), 27841.06640683, tolerance=1e-5) # total fuel - assert_near_equal(prob.get_val("loiter.fuel_used_final", units="lbm"), 34075.30721371, tolerance=1e-5) + assert_near_equal(prob.get_val("loiter.fuel_used_final", units="lbm"), 33412.41922187, tolerance=1e-5) @unittest.skipIf(not OAS_installed, "OpenAeroStruct is not installed") @@ -192,7 +192,7 @@ def tearDown(self): def test_values_B738(self): prob = self.prob # block fuel - assert_near_equal(prob.get_val("descent.fuel_used_final", units="lbm"), 34310.44045734, tolerance=1e-5) + assert_near_equal(prob.get_val("descent.fuel_used_final", units="lbm"), 33611.18277099, tolerance=1e-5) class N3HSATestCase(unittest.TestCase):