Skip to content

Commit

Permalink
Added a new option for ref axis position for geometry manipulation
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
lucaeros and eytanadler authored Jul 29, 2023
1 parent 5ebabd1 commit f2f974f
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 113 deletions.
1 change: 1 addition & 0 deletions .github/workflows/oas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
# we need OpenVSP to run vsp tests.
- name: Install OpenVSP
run: |
sudo apt-get update
export PYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")
export PYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
export INST_PREFIX=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('prefix'))")
Expand Down
2 changes: 1 addition & 1 deletion openaerostruct/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.6.2"
__version__ = "2.7.0"
4 changes: 2 additions & 2 deletions openaerostruct/docs/user_reference/mesh_surface_dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ The surface dict will be provided to Groups, including ``Geometry``, ``AeroPoint
- np.array([0.1, 5])
- m
- B-spline control points for chord distribution. Array convention is the same than ``twist_cp``.
* - chord_scaling_pos
* - ref_axis_pos
- 0.25
-
- Chord position at which the chord scaling factor is applied. 1 is the trailing edge, 0 is the leading edge.
- 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.

.. list-table:: Aerodynamics definitions
:widths: 20 20 5 55
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def setup(self):
"S_ref_type": "wetted", # how we compute the wing area,
# can be 'wetted' or 'projected'
"twist_cp": np.zeros(3), # Define twist using 3 B-spline cp's
"ref_axis_pos": 0.25, # Define the reference axis position. 0 is the leading edge, 1 is the trailing edge.
# Aerodynamic performance of the lifting surface at
# an angle of attack of 0 (alpha=0).
# These CL0 and CD0 values are added to the CL and CD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def setup(self):
"S_ref_type": "wetted", # how we compute the wing area,
# can be 'wetted' or 'projected'
"twist_cp": np.zeros(3), # Define twist using 3 B-spline cp's
"ref_axis_pos": 0.25, # Define the reference axis position. 0 is the leading edge, 1 is the trailing edge.
# Aerodynamic performance of the lifting surface at
# an angle of attack of 0 (alpha=0).
# These CL0 and CD0 values are added to the CL and CD
Expand Down
2 changes: 1 addition & 1 deletion openaerostruct/examples/rectangular_wing/opt_chord.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"S_ref_type": "projected", # how we compute the wing area,
# can be 'wetted' or 'projected'
"chord_cp": np.ones(3), # Define chord using 3 B-spline cp's
"chord_scaling_pos": 0.25, # Define the chord scaling position. 0 is the leading edge, 1 is the trailing edge.
"ref_axis_pos": 0.25, # Define the reference axis position. 0 is the leading edge, 1 is the trailing edge.
# distributed along span
"mesh": mesh,
# Aerodynamic performance of the lifting surface at
Expand Down
1 change: 1 addition & 0 deletions openaerostruct/examples/rectangular_wing/opt_twist.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"S_ref_type": "projected", # how we compute the wing area,
# can be 'wetted' or 'projected'
"twist_cp": np.zeros(3), # Define twist using 3 B-spline cp's
"ref_axis_pos": 0.25, # Define the reference axis position. 0 is the leading edge, 1 is the trailing edge.
# distributed along span
"mesh": mesh,
# Aerodynamic performance of the lifting surface at
Expand Down
29 changes: 15 additions & 14 deletions openaerostruct/geometry/geometry_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
ShearZ,
Rotate,
)
import warnings


class GeometryMesh(om.Group):
Expand Down Expand Up @@ -55,6 +54,11 @@ def initialize(self):
def setup(self):
surface = self.options["surface"]

if "ref_axis_pos" in surface:
ref_axis_pos = surface["ref_axis_pos"]
else:
ref_axis_pos = 0.25 # if no reference axis line is specified : it is the quarter-chord

mesh = surface["mesh"]
ny = mesh.shape[1]
mesh_shape = mesh.shape
Expand All @@ -73,26 +77,21 @@ def setup(self):
val = 1.0
promotes = []

self.add_subsystem("taper", Taper(val=val, mesh=mesh, symmetry=symmetry), promotes_inputs=promotes)
self.add_subsystem(
"taper", Taper(val=val, mesh=mesh, symmetry=symmetry, ref_axis_pos=ref_axis_pos), promotes_inputs=promotes
)

# 2. Scale X

val = np.ones(ny)
chord_scaling_pos = 0.25 # if no scaling position is specified : chord scaling w.r.t quarter of chord
if "chord_cp" in surface:
promotes = ["chord"]
if "chord_scaling_pos" in surface:
chord_scaling_pos = surface["chord_scaling_pos"]
else:
if "chord_scaling_pos" in surface:
warnings.warn(
"Chord_scaling_pos has been specified but no chord design variable available", stacklevel=2
)
promotes = []

self.add_subsystem(
"scale_x",
ScaleX(val=val, mesh_shape=mesh_shape, chord_scaling_pos=chord_scaling_pos),
ScaleX(val=val, mesh_shape=mesh_shape, ref_axis_pos=ref_axis_pos),
promotes_inputs=promotes,
)

Expand Down Expand Up @@ -124,15 +123,17 @@ def setup(self):
val = surface["span"]
else:
# Compute span. We need .real to make span to avoid OpenMDAO warnings.
quarter_chord = 0.25 * mesh[-1, :, :] + 0.75 * mesh[0, :, :]
span = max(quarter_chord[:, 1]).real - min(quarter_chord[:, 1]).real
ref_axis = ref_axis_pos * mesh[-1, :, :] + (1 - ref_axis_pos) * mesh[0, :, :]
span = max(ref_axis[:, 1]).real - min(ref_axis[:, 1]).real
if symmetry:
span *= 2.0
val = span
promotes = []

self.add_subsystem(
"stretch", Stretch(val=val, mesh_shape=mesh_shape, symmetry=symmetry), promotes_inputs=promotes
"stretch",
Stretch(val=val, mesh_shape=mesh_shape, symmetry=symmetry, ref_axis_pos=ref_axis_pos),
promotes_inputs=promotes,
)

# 6. Shear Y
Expand Down Expand Up @@ -179,7 +180,7 @@ def setup(self):

self.add_subsystem(
"rotate",
Rotate(val=val, mesh_shape=mesh_shape, symmetry=symmetry),
Rotate(val=val, mesh_shape=mesh_shape, symmetry=symmetry, ref_axis_pos=ref_axis_pos),
promotes_inputs=promotes,
promotes_outputs=["mesh"],
)
Expand Down
Loading

0 comments on commit f2f974f

Please sign in to comment.