Skip to content

Commit f2f974f

Browse files
lucaeroseytanadler
andauthored
Added a new option for ref axis position for geometry manipulation
* add reference axis for aero design variable * remove warnings * Update oas.yml * Small edits to docs and comments * Update __init__.py --------- Co-authored-by: Eytan Adler <eytana@umich.edu>
1 parent 5ebabd1 commit f2f974f

10 files changed

Lines changed: 146 additions & 113 deletions

File tree

.github/workflows/oas.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
# we need OpenVSP to run vsp tests.
5252
- name: Install OpenVSP
5353
run: |
54+
sudo apt-get update
5455
export PYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")
5556
export PYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
5657
export INST_PREFIX=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('prefix'))")

openaerostruct/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.6.2"
1+
__version__ = "2.7.0"

openaerostruct/docs/user_reference/mesh_surface_dict.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ The surface dict will be provided to Groups, including ``Geometry``, ``AeroPoint
9595
- np.array([0.1, 5])
9696
- m
9797
- B-spline control points for chord distribution. Array convention is the same than ``twist_cp``.
98-
* - chord_scaling_pos
98+
* - ref_axis_pos
9999
- 0.25
100100
-
101-
- Chord position at which the chord scaling factor is applied. 1 is the trailing edge, 0 is the leading edge.
101+
- Position of reference axis along the chord about which to apply twist, chord, taper, and span geometry transformations. 1 is the trailing edge, 0 is the leading edge.
102102

103103
.. list-table:: Aerodynamics definitions
104104
:widths: 20 20 5 55

openaerostruct/examples/rectangular_wing/mphys_opt_chord.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def setup(self):
3131
"S_ref_type": "wetted", # how we compute the wing area,
3232
# can be 'wetted' or 'projected'
3333
"twist_cp": np.zeros(3), # Define twist using 3 B-spline cp's
34+
"ref_axis_pos": 0.25, # Define the reference axis position. 0 is the leading edge, 1 is the trailing edge.
3435
# Aerodynamic performance of the lifting surface at
3536
# an angle of attack of 0 (alpha=0).
3637
# These CL0 and CD0 values are added to the CL and CD

openaerostruct/examples/rectangular_wing/mphys_opt_twist.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def setup(self):
3131
"S_ref_type": "wetted", # how we compute the wing area,
3232
# can be 'wetted' or 'projected'
3333
"twist_cp": np.zeros(3), # Define twist using 3 B-spline cp's
34+
"ref_axis_pos": 0.25, # Define the reference axis position. 0 is the leading edge, 1 is the trailing edge.
3435
# Aerodynamic performance of the lifting surface at
3536
# an angle of attack of 0 (alpha=0).
3637
# These CL0 and CD0 values are added to the CL and CD

openaerostruct/examples/rectangular_wing/opt_chord.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"S_ref_type": "projected", # how we compute the wing area,
5858
# can be 'wetted' or 'projected'
5959
"chord_cp": np.ones(3), # Define chord using 3 B-spline cp's
60-
"chord_scaling_pos": 0.25, # Define the chord scaling position. 0 is the leading edge, 1 is the trailing edge.
60+
"ref_axis_pos": 0.25, # Define the reference axis position. 0 is the leading edge, 1 is the trailing edge.
6161
# distributed along span
6262
"mesh": mesh,
6363
# Aerodynamic performance of the lifting surface at

openaerostruct/examples/rectangular_wing/opt_twist.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"S_ref_type": "projected", # how we compute the wing area,
5757
# can be 'wetted' or 'projected'
5858
"twist_cp": np.zeros(3), # Define twist using 3 B-spline cp's
59+
"ref_axis_pos": 0.25, # Define the reference axis position. 0 is the leading edge, 1 is the trailing edge.
5960
# distributed along span
6061
"mesh": mesh,
6162
# Aerodynamic performance of the lifting surface at

openaerostruct/geometry/geometry_mesh.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
ShearZ,
1616
Rotate,
1717
)
18-
import warnings
1918

2019

2120
class GeometryMesh(om.Group):
@@ -55,6 +54,11 @@ def initialize(self):
5554
def setup(self):
5655
surface = self.options["surface"]
5756

57+
if "ref_axis_pos" in surface:
58+
ref_axis_pos = surface["ref_axis_pos"]
59+
else:
60+
ref_axis_pos = 0.25 # if no reference axis line is specified : it is the quarter-chord
61+
5862
mesh = surface["mesh"]
5963
ny = mesh.shape[1]
6064
mesh_shape = mesh.shape
@@ -73,26 +77,21 @@ def setup(self):
7377
val = 1.0
7478
promotes = []
7579

76-
self.add_subsystem("taper", Taper(val=val, mesh=mesh, symmetry=symmetry), promotes_inputs=promotes)
80+
self.add_subsystem(
81+
"taper", Taper(val=val, mesh=mesh, symmetry=symmetry, ref_axis_pos=ref_axis_pos), promotes_inputs=promotes
82+
)
7783

7884
# 2. Scale X
7985

8086
val = np.ones(ny)
81-
chord_scaling_pos = 0.25 # if no scaling position is specified : chord scaling w.r.t quarter of chord
8287
if "chord_cp" in surface:
8388
promotes = ["chord"]
84-
if "chord_scaling_pos" in surface:
85-
chord_scaling_pos = surface["chord_scaling_pos"]
8689
else:
87-
if "chord_scaling_pos" in surface:
88-
warnings.warn(
89-
"Chord_scaling_pos has been specified but no chord design variable available", stacklevel=2
90-
)
9190
promotes = []
9291

9392
self.add_subsystem(
9493
"scale_x",
95-
ScaleX(val=val, mesh_shape=mesh_shape, chord_scaling_pos=chord_scaling_pos),
94+
ScaleX(val=val, mesh_shape=mesh_shape, ref_axis_pos=ref_axis_pos),
9695
promotes_inputs=promotes,
9796
)
9897

@@ -124,15 +123,17 @@ def setup(self):
124123
val = surface["span"]
125124
else:
126125
# Compute span. We need .real to make span to avoid OpenMDAO warnings.
127-
quarter_chord = 0.25 * mesh[-1, :, :] + 0.75 * mesh[0, :, :]
128-
span = max(quarter_chord[:, 1]).real - min(quarter_chord[:, 1]).real
126+
ref_axis = ref_axis_pos * mesh[-1, :, :] + (1 - ref_axis_pos) * mesh[0, :, :]
127+
span = max(ref_axis[:, 1]).real - min(ref_axis[:, 1]).real
129128
if symmetry:
130129
span *= 2.0
131130
val = span
132131
promotes = []
133132

134133
self.add_subsystem(
135-
"stretch", Stretch(val=val, mesh_shape=mesh_shape, symmetry=symmetry), promotes_inputs=promotes
134+
"stretch",
135+
Stretch(val=val, mesh_shape=mesh_shape, symmetry=symmetry, ref_axis_pos=ref_axis_pos),
136+
promotes_inputs=promotes,
136137
)
137138

138139
# 6. Shear Y
@@ -179,7 +180,7 @@ def setup(self):
179180

180181
self.add_subsystem(
181182
"rotate",
182-
Rotate(val=val, mesh_shape=mesh_shape, symmetry=symmetry),
183+
Rotate(val=val, mesh_shape=mesh_shape, symmetry=symmetry, ref_axis_pos=ref_axis_pos),
183184
promotes_inputs=promotes,
184185
promotes_outputs=["mesh"],
185186
)

0 commit comments

Comments
 (0)