From a0cb2434517dfa9e76e912d8c19bdb54e0ee4933 Mon Sep 17 00:00:00 2001 From: Josh Anibal Date: Mon, 4 Mar 2024 21:20:22 -0800 Subject: [PATCH] fixed bugs with bodies (#28) * fixed bugs with bodies * adding missing files for test * Update .cirrus.yml for new brew behavior --------- Co-authored-by: Joshua Anibal --- .cirrus.yml | 2 +- meson.build | 2 +- pyproject.toml | 2 +- src/ainput.f | 12 ++- src/amake.f | 3 +- tests/fuseSupra.dat | 151 ++++++++++++++++++++++++++ tests/supra.avl | 239 +++++++++++++++++++++++++++++++++++++++++ tests/test_analysis.py | 12 +++ 8 files changed, 414 insertions(+), 9 deletions(-) create mode 100644 tests/fuseSupra.dat create mode 100644 tests/supra.avl diff --git a/.cirrus.yml b/.cirrus.yml index 8955b50..d9fe474 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -43,7 +43,7 @@ cirrus_wheels_macos_arm64_task: install_pre_requirements_script: - brew install python@3.10 - - ln -s python3 /opt/homebrew/opt/python@3.10/bin/python + - ln -s python3.10 /opt/homebrew/opt/python@3.10/bin/python build_script: - which python diff --git a/meson.build b/meson.build index 528547a..dc802c1 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'pyavl', 'c', - version: '1.6.0', + version: '1.6.1', license: 'GPL-2.0', meson_version: '>= 0.64.0', default_options: [ diff --git a/pyproject.toml b/pyproject.toml index cd1df8f..3f08cb2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ dependencies = [ "numpy>=1.19", ] readme = "README.md" -version = "1.6.0" # this automatically updates __init__.py +version = "1.6.1" # this automatically updates __init__.py [tool.cibuildwheel] diff --git a/src/ainput.f b/src/ainput.f index a3c39c8..9a6184c 100644 --- a/src/ainput.f +++ b/src/ainput.f @@ -191,7 +191,7 @@ SUBROUTINE INPUT(LUN,FNAME,FERR) C IF(IBODY.NE.0) THEN C------- "old" body is still active, so build it before finishing - CALL MAKEBODY(IBODY, IBX, + CALL MAKEBODY(IBODY, & NVB, BSPACE, & XBOD,YBOD,TBOD,NBOD) C @@ -223,7 +223,7 @@ SUBROUTINE INPUT(LUN,FNAME,FERR) C IF(IBODY.NE.0) THEN C------- "old" body is still active, so build it before finishing - CALL MAKEBODY(IBODY, IBX, + CALL MAKEBODY(IBODY, & NVB, BSPACE, & XBOD,YBOD,TBOD,NBOD) C @@ -309,7 +309,7 @@ SUBROUTINE INPUT(LUN,FNAME,FERR) C IF(IBODY.NE.0) THEN C------- "old" body is still active, so build it before finishing - CALL MAKEBODY(IBODY, IBX, + CALL MAKEBODY(IBODY, & NVB, BSPACE, & XBOD,YBOD,TBOD,NBOD) C @@ -341,8 +341,10 @@ SUBROUTINE INPUT(LUN,FNAME,FERR) C CALL RDLINE(LUN,LINE,NLINE,ILINE) BTITLE(IBODY) = LINE(1:NLINE) -C WRITE(*,*) -C WRITE(*,*) ' Building body: ', BTITLE(IBODY) + if (lverbose)then + WRITE(*,*) + WRITE(*,*) ' Building body: ', BTITLE(IBODY) + endif C CALL RDLINE(LUN,LINE,NLINE,ILINE) READ(LINE,*,ERR=990) NVB, BSPACE diff --git a/src/amake.f b/src/amake.f index 770a74c..74a3055 100644 --- a/src/amake.f +++ b/src/amake.f @@ -677,7 +677,8 @@ SUBROUTINE MAKEBODY(IBODY, RL(3,NLNODE) = XYZTRAN_B(3,IBODY) + XYZSCAL_B(3,IBODY)*YVB C CALL AKIMA(XBOD,TBOD,NBOD,XVB,TVB,DRDX) - RADL(NLNODE) = SQRT(XYZSCAL_B(2,IBODY)*XYZSCAL_B(3,IBODY)) * 0.5*TVB + RADL(NLNODE) = SQRT(XYZSCAL_B(2,IBODY)*XYZSCAL_B(3,IBODY)) + & * 0.5*TVB ENDDO C---- get surface length, area and volume VOLB = 0.0 diff --git a/tests/fuseSupra.dat b/tests/fuseSupra.dat new file mode 100644 index 0000000..4c8c776 --- /dev/null +++ b/tests/fuseSupra.dat @@ -0,0 +1,151 @@ +_F3J Fuse + 51.000000 0.25000 + 13.000000 0.425000 + 12.501041 0.434002 + 11.990128 0.443781 + 11.478845 0.454163 + 10.967545 0.465166 + 10.456449 0.476816 + 9.945508 0.489164 + 9.434667 0.502230 + 8.924276 0.516016 + 8.414670 0.530521 + 7.905219 0.545773 + 7.393825 0.561850 + 6.881531 0.578732 + 6.370838 0.596348 + 5.862354 0.614687 + 5.355287 0.633804 + 4.851635 0.653665 + 4.352912 0.674271 + 3.858706 0.695758 + 3.368415 0.718316 + 2.881808 0.742113 + 2.398904 0.767263 + 1.919983 0.793793 + 1.444396 0.821570 + 0.970269 0.850538 + 0.494324 0.880483 + 0.013164 0.910930 + -0.468628 0.940743 + -0.935865 0.968177 + -1.396374 0.993016 + -1.860864 1.015271 + -2.330851 1.034715 + -2.805569 1.051226 + -3.284462 1.064855 + -3.767800 1.075773 + -4.255929 1.084174 + -4.748588 1.090193 + -5.244974 1.093912 + -5.744011 1.095392 + -6.244473 1.094675 + -6.745889 1.091778 + -7.247806 1.086690 + -7.749820 1.079381 + -8.251549 1.069816 + -8.752742 1.057956 + -9.253112 1.043752 + -9.752414 1.027130 + -10.250331 1.008005 + -10.746588 0.986211 + -11.240778 0.961574 + -11.732254 0.933896 + -12.220179 0.902944 + -12.703416 0.868430 + -13.180237 0.830006 + -13.647286 0.787385 + -14.098492 0.740514 + -14.522828 0.690019 + -14.903724 0.637788 + -15.225227 0.586807 + -15.482801 0.539601 + -15.684700 0.497024 + -15.843814 0.458580 + -15.970662 0.423582 + -16.074086 0.390942 + -16.160914 0.359408 + -16.234984 0.328024 + -16.298600 0.295593 + -16.353098 0.260978 + -16.398832 0.223523 + -16.436125 0.183130 + -16.464678 0.139332 + -16.484758 0.093422 + -16.496397 0.046702 + -16.500000 0.000000 + -16.496397 -0.046702 + -16.484758 -0.093422 + -16.464678 -0.139332 + -16.436125 -0.183130 + -16.398832 -0.223523 + -16.353098 -0.260978 + -16.298600 -0.295593 + -16.234984 -0.328024 + -16.160914 -0.359408 + -16.074086 -0.390942 + -15.970662 -0.423582 + -15.843814 -0.458580 + -15.684700 -0.497024 + -15.482801 -0.539601 + -15.225227 -0.586807 + -14.903724 -0.637788 + -14.522828 -0.690019 + -14.098492 -0.740514 + -13.647286 -0.787385 + -13.180237 -0.830006 + -12.703416 -0.868430 + -12.220179 -0.902944 + -11.732254 -0.933896 + -11.240778 -0.961574 + -10.746588 -0.986211 + -10.250331 -1.008005 + -9.752414 -1.027130 + -9.253112 -1.043752 + -8.752742 -1.057956 + -8.251549 -1.069816 + -7.749820 -1.079381 + -7.247806 -1.086690 + -6.745889 -1.091778 + -6.244473 -1.094675 + -5.744011 -1.095392 + -5.244974 -1.093912 + -4.748588 -1.090193 + -4.255929 -1.084174 + -3.767800 -1.075773 + -3.284462 -1.064855 + -2.805569 -1.051226 + -2.330851 -1.034715 + -1.860864 -1.015271 + -1.396374 -0.993016 + -0.935865 -0.968177 + -0.468628 -0.940743 + 0.013164 -0.910930 + 0.494324 -0.880483 + 0.970269 -0.850538 + 1.444396 -0.821570 + 1.919983 -0.793793 + 2.398904 -0.767263 + 2.881808 -0.742113 + 3.368415 -0.718316 + 3.858706 -0.695758 + 4.352912 -0.674271 + 4.851635 -0.653665 + 5.355287 -0.633804 + 5.862354 -0.614687 + 6.370838 -0.596348 + 6.881531 -0.578732 + 7.393825 -0.561850 + 7.905219 -0.545773 + 8.414670 -0.530521 + 8.924276 -0.516016 + 9.434667 -0.502230 + 9.945508 -0.489164 + 10.456449 -0.476816 + 10.967545 -0.465166 + 11.478845 -0.454163 + 11.990128 -0.443781 + 12.501041 -0.434002 + 13.000000 -0.425000 + 13.000000 -0.425000 + 51.000000 -0.25000 diff --git a/tests/supra.avl b/tests/supra.avl new file mode 100644 index 0000000..1336aba --- /dev/null +++ b/tests/supra.avl @@ -0,0 +1,239 @@ +Supra 3.4m F3J +0.0 Mach +0 0 0.0 iYsym iZsym Zsym +# +1034.0 7.60 133.86 Sref Cref Bref reference area, chord, span +3.750 0.0 1.5 Xref Yref Zref moment reference location +0.015 CDo +# +# +# +# #============================================= +BODY +Fuse pod +28 2.0 +# +TRANSLATE +0.0 0.0 -1.75 +# +BFIL +fuseSupra.dat + +#============================================================== +SURFACE +Inner Wing + 7 1.0 8 -2.9 ! Nchord Cspace Nspan Sspace + +INDEX +1 + +ANGLE + 1.0 twist angle bias for whole surface + +YDUPLICATE +0.0 + +SCALE +1.0 1.0 0.0437 ! 2.5 deg dihedral + +TRANSLATE +0.0 0.0 0.0 + +#--------------------------------------------- +SECTION + 0.0 0.0 0.0 9.75 0.0 1 0 + + +CONTROL +flap 1.0 0.75 0. 0. 0. 1. + +CONTROL +aileron -1.00 0.75 0. 0. 0. -1. + +#--------------------- +SECTION + 0.25 31.5 31.5 8.75 0.0 1 0 + + +CONTROL +flap 1.0 0.75 0. 0. 0. 1. + +CONTROL +aileron -1.00 0.75 0. 0. 0. -1. + +#============================================================== +SURFACE +Outer Wing + 7 1.0 18 -2.0 ! Nchord Cspace Nspan Sspace + +INDEX +1 + +ANGLE + 1.0 twist angle bias for whole surface + +YDUPLICATE +0.0 + +SCALE +1.0 1.0 0.13165 ! 7.5 deg dihedral + +TRANSLATE +0.25 31.5 1.37655 + +#--------------------------------------------- +SECTION + 0.0 0.0 0.0 8.75 0.0 1 0 + + +CONTROL +flap 1.0 0.75 0. 0. 0. 1. + +CONTROL +aileron -1.0 0.75 0. 0. 0. -1. + +#--------------------- +SECTION + 1.0 23.5 23.5 6.25 -0.5 1 0 + + +CONTROL +flap 1.0 0.75 0. 0. 0. 1. + +CONTROL +aileron -1.0 0.75 0. 0. 0. -1. + +DESIGN +twist 1.0 +#--------------------- +SECTION + 1.72 29.5 29.5 5.00 -0.5 1 0 + + +CONTROL +flap 1.0 0.75 0. 0. 0. 1. + +CONTROL +aileron -1.0 0.75 0. 0. 0. -1. + +DESIGN +twist 1.0 + +#--------------------- +SECTION + 2.75 34.0 34.0 3.40 -0.5 1 0 + + +CONTROL +flap 1.0 0.75 0. 0. 0. 1. + +CONTROL +aileron -1.0 0.75 0. 0. 0. -1. + +DESIGN +twist 1.0 + +#--------------------- +SECTION + 3.50 35.50 35.50 2.3 -0.5 1 0 + + +CONTROL +flap 1.0 0.75 0. 0. 0. 1. + +CONTROL +aileron -1.0 0.75 0. 0. 0. -1. + +DESIGN +twist 1.0 + +#============================================================== +SURFACE +Stab + 5 1.0 12 -1.0 ! Nchord Cspace Nspan Sspace + +ANGLE + 0.0 twist angle bias for whole surface + +YDUPLICATE +0.0 + +SCALE +1.0 1.0 1.0 + +TRANSLATE +37.5 0.0 2.1 + +#--------------------------------------------- +SECTION + 0.0 0.0 0. 4.40 0.000000 +CONTROL +elevator 1.0 0. 0. 0. 0. 1. + +#--------------------- +SECTION + 0.15385 2.0 0. 4.1154 0.000000 +CONTROL +elevator 1.0 0. 0. 0. 0. 1. + +#--------------------- +SECTION + 0.7692 10.0 0. 2.577 0.000000 +CONTROL +elevator 1.0 0. 0. 0. 0. 1. + +#--------------------- +SECTION + 1.173 12.0 0. 1.942 0.000000 +CONTROL +elevator 1.0 0. 0. 0. 0. 1. + +#--------------------- +SECTION + 1.50 12.7 0. 1.52 0.000000 +CONTROL +elevator 1.0 0. 0. 0. 0. 1. + +#--------------------- +SECTION + 2.00 13.0 0. 1.0 0.000000 +CONTROL +elevator 1.0 0. 0. 0. 0. 1. +#============================================================== +SURFACE +Fin +10 1.0 12 -1.0 ! Nchord Cspace Nspan Sspace + +ANGLE + 0.0 twist angle bias for whole surface + +SCALE +1.15 1.15 1.1 + +TRANSLATE +42.5 0.0 0.0 + +#--------------------------------------------- +SECTION + 0.0 0.0 0. 7.0 0.000000 +CONTROL +rudder 1.0 0.43 0. 0. 0. 1. + +#--------------------- +SECTION + 1.125 0.0 9.0 4.0 0.000000 +CONTROL +rudder 1.0 0.50 0. 0. 0. 1. + +#--------------------- +SECTION + 1.875 0.0 11.25 2.8333 0.000000 +CONTROL +rudder 1.0 0.50 0. 0. 0. 1. + +#--------------------- +SECTION + 2.5 0.0 12.0 2.0 0.000000 +CONTROL +rudder 1.0 0.50 0. 0. 0. 1. + diff --git a/tests/test_analysis.py b/tests/test_analysis.py index 22dd0b3..0be0eca 100644 --- a/tests/test_analysis.py +++ b/tests/test_analysis.py @@ -121,6 +121,18 @@ def test_constrained_cl_sweep(self): ) +class TestBodyAnalysis(unittest.TestCase): + def setUp(self): + self.avl_solver = AVLSolver(geo_file="supra.avl",debug=True) + + def test_coefs(self): + self.avl_solver.add_constraint("alpha", 5.00) + self.avl_solver.execute_run() + coef_data = self.avl_solver.get_case_total_data() + np.testing.assert_allclose(coef_data["CL"], 0.5974623446784538, rtol=1e-8) + np.testing.assert_allclose(coef_data["CD"], 0.02198757641085098, rtol=1e-8) + np.testing.assert_allclose(coef_data["CM"],-0.020404687950051428, rtol=1e-8) + class TestHingeMom(unittest.TestCase): def setUp(self): self.avl_solver = AVLSolver(geo_file=geom_file, mass_file=mass_file)