Winglet analysis on a flying wing using AeroSandbox
kikem / winglets Goto Github PK
View Code? Open in Web Editor NEWWinglet analysis on a flying wing using AeroSandbox
License: MIT License
Winglet analysis on a flying wing using AeroSandbox
License: MIT License
A user reported via email having problems to pass the tests and use the notebooks.
============================= test session starts =============================
platform win32 -- Python 3.7.9, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: D:\Software\AeroSandbox\winglets-master, configfile: pytest.ini
plugins: dash-1.10.0
collected 16 items
tests\test_model.py ...... [ 37%]
tests\test_optimizer.py F.sF [ 62%]
tests\test_solver.py FsFFsF [100%]
================================== FAILURES ===================================
__________________________ TestOptimizer.test_put_up __________________________
self = <test_optimizer.TestOptimizer object at 0x000002D286A928C8>
optimizer = <winglets.optimizer.WingletOptimizer object at 0x000002D286AF2EC8>
def test_put_up(self, optimizer):
from winglets.optimizer import NAME_CD, NAME_CM
results = optimizer.put_up()
expected = {NAME_CD: 0.005628661627242771, NAME_CM: -51.54848089843833}
> assert expected == results
E AssertionError: assert {'CDi': 0.005...4848089843833} == {'CDi': 0.005...4848089843823}
E Differing items:
E {'CDi': 0.005628661627242771} != {'CDi': 0.005628661627242648}
E {'Cm': -51.54848089843833} != {'Cm': -51.54848089843823}
E Use -v to get the full diff
tests\test_optimizer.py:163: AssertionError
__________________ TestOptimizer.test_evaluate_optimal_point __________________
self = <test_optimizer.TestOptimizer object at 0x000002D286ADB848>
optimizer = <winglets.optimizer.WingletOptimizer object at 0x000002D2871A2888>
def test_evaluate_optimal_point(self, optimizer):
result = OptimizeResult(
fun=0.9723818601228951,
hess_inv=None,
jac=np.array([7.32747193e-07]),
message=b"CONVERGENCE NORM_OF_PROJECTED_GRADIENT_<=_PGTOL",
nfev=10,
nit=4,
njev=5,
status=0,
success=True,
x=np.array([1, 1, 1, 1, 0.85397381, 1, 1]),
)
optimizer.optimum = result
targets, parameters = optimizer.evaluate_optimum()
expected_targets = {"CDi": 0.005318006823391808, "Cm": -51.93177989903035}
expected_parameters = {
0: 0.05,
2: 0.32,
1: 0.65,
3: 38,
4: 38.42882145,
5: 1.0,
6: 1.0,
"wingletAirfoil": "naca0012",
}
assert expected_parameters == parameters
> assert expected_targets == targets
E AssertionError: assert {'CDi': 0.005...3177989903035} == {'CDi': 0.005...3177989903027}
E Differing items:
E {'CDi': 0.005318006823391808} != {'CDi': 0.00531800682339165}
E {'Cm': -51.93177989903035} != {'Cm': -51.93177989903027}
E Use -v to get the full diff
tests\test_optimizer.py:232: AssertionError
______________________ TestFlyingWing.test_solver_alpha _______________________
self = <test_solver.TestFlyingWing object at 0x000002D28727F508>
flying_wing = <winglets.model.FlyingWing object at 0x000002D28727F348>
def test_solver_alpha(self, flying_wing):
solver = wl.WingSolver(model=flying_wing, altitude=ALTITUDE, mach=MACH)
problem = solver.solve_alpha(alpha=ALPHA)
results = dict(CDi=problem.CDi, CL=problem.CL, CY=problem.CY, Cm=problem.Cm)
expected = {
"CDi": 0.0007621840201544735,
"CL": 0.17823297687249956,
"CY": 1.8207861772476683e-18,
"Cm": -25.046729432809073,
}
> assert expected == results
E AssertionError: assert {'CDi': 0.000...6729432809073} == {'CDi': 0.000...4672943280919}
E Differing items:
E {'CDi': 0.0007621840201544735} != {'CDi': 0.0007621840201544504}
E {'CY': 1.8207861772476683e-18} != {'CY': -3.481723488832212e-18}
E {'CL': 0.17823297687249956} != {'CL': 0.17823297687250123}
E {'Cm': -25.046729432809073} != {'Cm': -25.04672943280919}
E Use -v to get the full diff
tests\test_solver.py:110: AssertionError
________________________ TestFlyingWing.test_solver_cl ________________________
self = <test_solver.TestFlyingWing object at 0x000002D287286A08>
flying_wing = <winglets.model.FlyingWing object at 0x000002D286ACC388>
def test_solver_cl(self, flying_wing):
solver = wl.WingSolver(model=flying_wing, altitude=ALTITUDE, mach=MACH)
problem = solver.solve_cl(cl=CL)
results = dict(CDi=problem.CDi, CL=problem.CL, CY=problem.CY, Cm=problem.Cm)
expected = {
"CDi": 0.005628661627242771,
"CL": 0.45000738453912104,
"CY": 2.271288523678805e-18,
"Cm": -51.54848089843833,
}
> assert expected == results
E AssertionError: assert {'CDi': 0.005...4848089843833} == {'CDi': 0.005...4848089843823}
E Differing items:
E {'CDi': 0.005628661627242771} != {'CDi': 0.005628661627242648}
E {'CY': 2.271288523678805e-18} != {'CY': -1.6296426590460089e-18}
E {'CL': 0.45000738453912104} != {'CL': 0.45000738453912137}
E {'Cm': -51.54848089843833} != {'Cm': -51.54848089843823}
E Use -v to get the full diff
tests\test_solver.py:136: AssertionError
__________________ TestFlyingWingWinglets.test_solver_alpha ___________________
self = <test_solver.TestFlyingWingWinglets object at 0x000002D286ADB608>
flying_wing_winglets = <winglets.model.FlyingWing object at 0x000002D2872896C8>
def test_solver_alpha(self, flying_wing_winglets):
solver = wl.WingSolver(model=flying_wing_winglets, altitude=ALTITUDE, mach=MACH)
problem = solver.solve_alpha(alpha=ALPHA)
results = dict(CDi=problem.CDi, CL=problem.CL, CY=problem.CY, Cm=problem.Cm)
expected = {
"CDi": 0.0007211988080825468,
"CL": 0.17779760329872044,
"CY": 1.9875634350427656e-19,
"Cm": -24.98033280975764,
}
> assert expected == results
E AssertionError: assert {'CDi': 0.000...8033280975764} == {'CDi': 0.000...0332809757744}
E Differing items:
E {'CDi': 0.0007211988080825468} != {'CDi': 0.0007211988080825262}
E {'CY': 1.9875634350427656e-19} != {'CY': -1.1090994354044273e-18}
E {'CL': 0.17779760329872044} != {'CL': 0.1777976032987221}
E {'Cm': -24.98033280975764} != {'Cm': -24.980332809757744}
E Use -v to get the full diff
tests\test_solver.py:155: AssertionError
____________________ TestFlyingWingWinglets.test_solver_cl ____________________
self = <test_solver.TestFlyingWingWinglets object at 0x000002D286ACE788>
flying_wing_winglets = <winglets.model.FlyingWing object at 0x000002D287297C48>
def test_solver_cl(self, flying_wing_winglets):
solver = wl.WingSolver(model=flying_wing_winglets, altitude=ALTITUDE, mach=MACH)
problem = solver.solve_cl(cl=CL)
results = dict(CDi=problem.CDi, CL=problem.CL, CY=problem.CY, Cm=problem.Cm)
expected = {
"CDi": 0.005320054099686794,
"CL": 0.4500048433740413,
"CY": 1.794018700567938e-18,
"Cm": -51.88601630585104,
}
assert np.isclose(CL, results["CL"], rtol=solver.TOL_CL, atol=solver.TOL_CL)
> assert expected == results
E AssertionError: assert {'CDi': 0.005...8601630585104} == {'CDi': 0.005...8601630585088}
E Differing items:
E {'CDi': 0.005320054099686794} != {'CDi': 0.005320054099686646}
E {'CY': 1.794018700567938e-18} != {'CY': 5.033867929681669e-19}
E {'CL': 0.4500048433740413} != {'CL': 0.4500048433740411}
E {'Cm': -51.88601630585104} != {'Cm': -51.88601630585088}
E Use -v to get the full diff
tests\test_solver.py:182: AssertionError
============================== warnings summary ===============================
c:\users\lenovo\anaconda3\lib\site-packages\pyreadline\py3k_compat.py:8
c:\users\lenovo\anaconda3\lib\site-packages\pyreadline\py3k_compat.py:8: DeprecationWarning:
Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
C:\Users\Lenovo\Anaconda3\lib\site-packages\win32\lib\pywintypes.py:2
C:\Users\Lenovo\Anaconda3\lib\site-packages\win32\lib\pywintypes.py:2: DeprecationWarning:
the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ===========================
SKIPPED [1] tests\test_optimizer.py:176: need --runslow option to run
SKIPPED [1] tests\test_solver.py:112: unconditional skip
SKIPPED [1] tests\test_solver.py:157: unconditional skip
FAILED tests/test_optimizer.py::TestOptimizer::test_put_up - AssertionError: ...
FAILED tests/test_optimizer.py::TestOptimizer::test_evaluate_optimal_point - ...
FAILED tests/test_solver.py::TestFlyingWing::test_solver_alpha - AssertionErr...
FAILED tests/test_solver.py::TestFlyingWing::test_solver_cl - AssertionError:...
FAILED tests/test_solver.py::TestFlyingWingWinglets::test_solver_alpha - Asse...
FAILED tests/test_solver.py::TestFlyingWingWinglets::test_solver_cl - Asserti...
============= 6 failed, 7 passed, 3 skipped, 2 warnings in 14.28s =============
===========================================================================
Cant angle effect.ipynb
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-fbe3f15728c6> in <module>
4
5 solver = wl.WingSolver(
----> 6 model=flying_wing, altitude=ALTITUDE, mach=MACH, design_cl=CL
7 )
8
TypeError: __init__() got an unexpected keyword argument 'design_cl'
===========================================================================
Winglet geometry (sympy).ipynb
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-7-79fdad8bfcfb> in <module>
----> 1 sy.simplify((final_vector.T * u_planform_vector)[0])
NameError: name 'u_planform_vector' is not defined
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-18-ff6c5dca814f> in <module>
2 axes = fig.add_subplot(121, projection='3d')
3
----> 4 vec_1 = numerical_vector(pi/4, pi/4)
5 vec_2 = numerical_vector(pi/4, pi/3)
6
TypeError: _lambdifygenerated() missing 1 required positional argument: 'delta'
===========================================================================
Global optimization.ipynb
---------------------------------------------------------------------------
k success iterations function_evaluations message J cd cm SPAN CHORD_ROOT TAPER_RATIO ANGLE_SWEEP ANGLE_CANT ANGLE_TWIST_ROOT ANGLE_TWIST_TIP
0 0.00 False 15 264 b'STOP: TOTAL NO. of ITERATIONS REACHED LIMIT' 0.997425 0.004427 -51.415759 0.02 1.000000 0.300000 50.0 80.0 2.788998 0.551481
1 0.25 False 15 256 b'STOP: TOTAL NO. of ITERATIONS REACHED LIMIT' 0.975069 0.004900 -52.058265 0.10 0.983453 1.000000 50.0 80.0 1.783358 1.830505
2 0.50 False 15 168 b'STOP: TOTAL NO. of ITERATIONS REACHED LIMIT' 0.925946 0.004609 -53.249979 0.10 1.000000 0.300000 0.0 15.0 2.311818 2.731971
3 0.75 False 15 168 b'STOP: TOTAL NO. of ITERATIONS REACHED LIMIT' 0.872109 0.004604 -53.339948 0.10 1.000000 0.409452 0.0 15.0 2.682065 1.773572
4 1.00 False 15 160 b'STOP: TOTAL NO. of ITERATIONS REACHED LIMIT' 0.817633 0.004602 -53.429611 0.10 1.000000 0.536835 0.0 15.0 3.001250 1.242203
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
c:\users\lenovo\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
2897 try:
-> 2898 return self._engine.get_loc(casted_key)
2899 except KeyError as err:
pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: '$\\phi$'
The above exception was the direct cause of the following exception:
KeyError Traceback (most recent call last)
<ipython-input-14-ca3b800d7406> in <module>
3 options = dict(marker="o")
4
----> 5 axes[0].plot(results_df["$\\phi$"], **options)
6 axes[0].set_ylabel("$\\phi$ [deg]")
7
c:\users\lenovo\anaconda3\lib\site-packages\pandas\core\frame.py in __getitem__(self, key)
2904 if self.columns.nlevels > 1:
2905 return self._getitem_multilevel(key)
-> 2906 indexer = self.columns.get_loc(key)
2907 if is_integer(indexer):
2908 indexer = [indexer]
c:\users\lenovo\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
2898 return self._engine.get_loc(casted_key)
2899 except KeyError as err:
-> 2900 raise KeyError(key) from err
2901
2902 if tolerance is not None:
KeyError: '$\\phi$'
===========================================================================
One-dimensional optimization.ipynb
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-9-4a7b1ea43571> in <module>
15 result = optimizer.optimize()
16
---> 17 cant_angle = get_optimized_cant_angle(result, initial_winglet)
18 J = result.fun
19 targets, parameters = optimizer.evaluate_optimum()
<ipython-input-8-346beaf4cc4a> in get_optimized_cant_angle(result, initial_winglet)
1 def get_optimized_cant_angle(result, initial_winglet):
2
----> 3 return result.x.item() * initial_winglet[WingletParameters.ANGLE_CANT.value]
ValueError: can only convert an array of size 1 to a Python scalar
Hey!
Was just curious how this project ended up working out and if you had any feedback on any unintuitive syntax, missing features, etc.!
-Peter
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.