diff --git a/docs/World/Aerodynamic/coefficients_data.md b/docs/World/Aerodynamic/coefficients_data.md new file mode 100644 index 0000000..45cf2d3 --- /dev/null +++ b/docs/World/Aerodynamic/coefficients_data.md @@ -0,0 +1,49 @@ +# coefficients_data + +This file contains several functions for calculating the lift, drag and moment coefficients for a fictional airfoil based on the Selig1223. It also contains the same functions for calculating the coefficient of the inverted version of the airfoil (usually used on horizontal stabilizers). + +This fictional airfoil stalls for 15 degrees and -5 degrees of AoA. + +One just need to call the corresponding function with the desired angle-of-attack as argument: +```python +from adr.World.Aerodynamic.coefficients_data import get_CL, get_CD, get_CM, get_CL_inv, get_CD_inv, get_CM_inv + +print(get_CL(18)) +>>> 0 +print(get_CL(12)) +>>> 1.8 +print(get_CL(-2)) +>>> 0.399 +print(get_CL(-12)) +>>> 0 + + +print(get_CD(18)) +>>> 2.1 +print(get_CD(12)) +>>> 0.18 + + +print(get_CM(18)) +>>> 0 +print(get_CM(12)) +>>> -0.251 + + +print(get_CL_inv(18)) +>>> 0 +print(get_CL_inv(-12)) +>>> -1.8 + + +print(get_CD_inv(12)) +>>> 2.1 +print(get_CD_inv(-18)) +>>> 2.1 + + +print(get_CM_inv(18)) +>>> 0 +print(get_CM_inv(-12)) +>>> 0.251 +``` \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 4992d03..c078e07 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -10,6 +10,8 @@ nav: World: Ambient: World/Ambient.md constants: World/constants.md + Aerodynamic: + coefficients_data: World/Aerodynamic/coefficients_data.md helper funtions: algebric: helper functions/algebric.md diff --git a/tests/World/Aerodynamic/test_coefficients_data.py b/tests/World/Aerodynamic/test_coefficients_data.py new file mode 100644 index 0000000..69afaca --- /dev/null +++ b/tests/World/Aerodynamic/test_coefficients_data.py @@ -0,0 +1,63 @@ +import numpy.testing as npt + +from adr.World.Aerodynamic.coefficients_data import get_CL, get_CD, get_CM, get_CL_inv, get_CD_inv, get_CM_inv + + +def test_get_CL(): + npt.assert_almost_equal(get_CL(18), 0) + npt.assert_almost_equal(get_CL(12), 1.8) + npt.assert_almost_equal(get_CL(2), 0.8) + npt.assert_almost_equal(get_CL(0), 0.6) + npt.assert_almost_equal(get_CL(-2), 0.399, decimal=3) + npt.assert_almost_equal(get_CL(-12), 0) + npt.assert_almost_equal(get_CL(-18), 0) + + +def test_get_CD(): + npt.assert_almost_equal(get_CD(18), 2.1) + npt.assert_almost_equal(get_CD(12), 0.18) + npt.assert_almost_equal(get_CD(2), 0.08) + npt.assert_almost_equal(get_CD(0), 0.06, decimal=3) + npt.assert_almost_equal(get_CD(-2), 0.04, decimal=3) + npt.assert_almost_equal(get_CD(-12), 2.1) + npt.assert_almost_equal(get_CD(-18), 2.1) + + +def test_get_CM(): + npt.assert_almost_equal(get_CM(18), 0) + npt.assert_almost_equal(get_CM(12), -0.251, decimal=3) + npt.assert_almost_equal(get_CM(2), -0.260, decimal=3) + npt.assert_almost_equal(get_CM(0), -0.232, decimal=3) + npt.assert_almost_equal(get_CM(-2), -0.195, decimal=3) + npt.assert_almost_equal(get_CM(-12), 0) + npt.assert_almost_equal(get_CM(-18), 0) + + +def test_get_CL_inv(): + npt.assert_almost_equal(get_CL_inv(18), 0) + npt.assert_almost_equal(get_CL_inv(12), 0) + npt.assert_almost_equal(get_CL_inv(2), -0.399, decimal=3) + npt.assert_almost_equal(get_CL_inv(0), -0.6) + npt.assert_almost_equal(get_CL_inv(-2), -0.8) + npt.assert_almost_equal(get_CL_inv(-12), -1.8) + npt.assert_almost_equal(get_CL_inv(-18), 0) + + +def test_get_CD_inv(): + npt.assert_almost_equal(get_CD_inv(18), 2.1) + npt.assert_almost_equal(get_CD_inv(12), 2.1) + npt.assert_almost_equal(get_CD_inv(2), 0.04, decimal=3) + npt.assert_almost_equal(get_CD_inv(0), 0.06, decimal=3) + npt.assert_almost_equal(get_CD_inv(-2), 0.08) + npt.assert_almost_equal(get_CD_inv(-12), 0.18) + npt.assert_almost_equal(get_CD_inv(-18), 2.1) + + +def test_get_CM_inv(): + npt.assert_almost_equal(get_CM_inv(18), 0) + npt.assert_almost_equal(get_CM_inv(12), 0) + npt.assert_almost_equal(get_CM_inv(2), 0.195, decimal=3) + npt.assert_almost_equal(get_CM_inv(0), 0.232, decimal=3) + npt.assert_almost_equal(get_CM_inv(-2), 0.260, decimal=3) + npt.assert_almost_equal(get_CM_inv(-12), 0.251, decimal=3) + npt.assert_almost_equal(get_CM_inv(-18), 0)