From 0c28e5ffa1f8e2b986d1e4e066dc386aa9715f97 Mon Sep 17 00:00:00 2001 From: Joshua Anibal Date: Mon, 9 Feb 2026 18:22:13 -0800 Subject: [PATCH 1/2] fix bug --- examples/plot_airfoils.py | 2 +- optvl/optvl_class.py | 10 ++++------ src/ainput.f | 4 ++++ src/amake.f | 1 + src/includes/AVL.INC | 3 ++- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/plot_airfoils.py b/examples/plot_airfoils.py index ba0ebae1..1956c930 100644 --- a/examples/plot_airfoils.py +++ b/examples/plot_airfoils.py @@ -3,7 +3,7 @@ from optvl import OVLSolver import matplotlib.pyplot as plt -ovl = OVLSolver(geo_file="../geom_files/aircraft.avl", debug=True) +ovl = OVLSolver(geo_file="../geom_files/aircraft.avl", debug=False) surf_data = ovl.get_surface_params(include_geom=True, include_airfoils=True) colors = plt.rcParams["axes.prop_cycle"].by_key()["color"] diff --git a/optvl/optvl_class.py b/optvl/optvl_class.py index cdcf7ae9..d2478fdc 100644 --- a/optvl/optvl_class.py +++ b/optvl/optvl_class.py @@ -2469,12 +2469,10 @@ def get_surface_params( naca = self.__fort_char_array_to_str(self.avl.CASE_C.NACA[idx_sec, idx_surf]) nacas.append(naca) - airfoilx = np.trim_zeros( - self.get_avl_fort_arr("SURF_GEOM_R", "XSEC")[idx_surf, idx_sec, slice(None)] - ) - airfoily = np.trim_zeros( - self.get_avl_fort_arr("SURF_GEOM_R", "YSEC")[idx_surf, idx_sec, slice(None)] - ) + npts = self.get_avl_fort_arr("SURF_GEOM_I", "NAPTSSEC", slicer=(idx_surf,idx_sec)) + + airfoilx = self.get_avl_fort_arr("SURF_GEOM_R", "XSEC", slicer=(idx_surf, idx_sec, slice(0, npts))) + airfoily = self.get_avl_fort_arr("SURF_GEOM_R", "YSEC", slicer=(idx_surf, idx_sec, slice(0, npts))) airfoils.append(np.array([airfoilx, airfoily])) diff --git a/src/ainput.f b/src/ainput.f index ae22e956..93c42cb2 100644 --- a/src/ainput.f +++ b/src/ainput.f @@ -595,6 +595,7 @@ SUBROUTINE INPUT(LUN,FNAME,FERR) C------ default section... C ...flat camberline NASEC(ISEC,ISURF) = 2 + NAPTSSEC(ISEC,ISURF) = 0 XASEC(1,ISEC, ISURF) = 0.0 XASEC(2,ISEC, ISURF) = 1.0 SASEC(1,ISEC, ISURF) = 0.0 @@ -677,6 +678,7 @@ SUBROUTINE INPUT(LUN,FNAME,FERR) T = FLOAT(ITHK) / 100.0 C NASEC(ISEC,ISURF) = MIN( 50 , IBX ) + NAPTSSEC(ISEC,ISURF) = NASEC(ISEC,ISURF)*2 DO I = 1, NASEC(ISEC,ISURF) XF = XFMIN + & (XFMAX-XFMIN)*FLOAT(I-1)/FLOAT(NASEC(ISEC,ISURF)-1) @@ -812,6 +814,7 @@ SUBROUTINE INPUT(LUN,FNAME,FERR) C C------ store airfoil only if surface and section are active NASEC(ISEC,ISURF) = NIN + NAPTSSEC(ISEC,ISURF) = NB DO I = 1, NIN XF = XFMIN + & (XFMAX-XFMIN)*FLOAT(I-1)/FLOAT(NASEC(ISEC,ISURF)-1) @@ -934,6 +937,7 @@ SUBROUTINE INPUT(LUN,FNAME,FERR) C C------- camberline slopes at specified locations from spline NASEC(ISEC,ISURF) = NIN + NAPTSSEC(ISEC,ISURF) = NB DO I = 1, NIN XF = XFMIN + & (XFMAX-XFMIN)*FLOAT(I-1)/FLOAT(NASEC(ISEC,ISURF)-1) diff --git a/src/amake.f b/src/amake.f index 99874a70..ed537ea3 100644 --- a/src/amake.f +++ b/src/amake.f @@ -871,6 +871,7 @@ subroutine set_section_coordinates(isec,isurf,x,y,n,nin,xfmin, call GETCAM(x,y,n,xin,yin,tin,nin,.true.) NASEC(isec,isurf) = nin + NAPTSSEC(isec,isurf) = n do i = 1, nin xf = xfmin + diff --git a/src/includes/AVL.INC b/src/includes/AVL.INC index b0a76395..8f09c5dc 100644 --- a/src/includes/AVL.INC +++ b/src/includes/AVL.INC @@ -439,7 +439,8 @@ c & NVC(NFMAX), ! number of chordwise elements & NVS(NFMAX), ! number of spanwise elements & NSPANS(NSECMAX, NFMAX), ! number of spanwise elements vector - & NASEC(NSECMAX, NFMAX), + & NASEC(NSECMAX, NFMAX), ! number of points used to represent section geometry + & NAPTSSEC(NSECMAX, IBX), ! number of points of input airfoil geometry & ICONTD(ICONX, NSECMAX, NFMAX), ! control variable index & NSCON(NSECMAX, NFMAX), ! number of control variables & IDESTD(ICONX, NSECMAX, NFMAX), ! design variable index From ccc15f3c49a54b07296c86de47841901a10eec97 Mon Sep 17 00:00:00 2001 From: Joshua Anibal Date: Mon, 9 Feb 2026 18:24:56 -0800 Subject: [PATCH 2/2] bump version --- meson.build | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 660c23c4..a6f45658 100644 --- a/meson.build +++ b/meson.build @@ -2,7 +2,7 @@ project( 'optvl', 'c', # don't forget to change the value in pyproject.toml - version: '2.2.3', + version: '2.2.4', license: 'GPL-3.0', meson_version: '>= 0.64.0', default_options: [ diff --git a/pyproject.toml b/pyproject.toml index da2e7dbe..e347a17f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ dependencies = [ "numpy>=1.19", ] readme = "README.md" -version = "2.2.3" # this automatically updates __init__.py and setup_deprecated.py +version = "2.2.4" # this automatically updates __init__.py and setup_deprecated.py # don't forget to change the value in meson.build!