OpenAeroStruct icon indicating copy to clipboard operation
OpenAeroStruct copied to clipboard

Taper Function, Problems when mesh has offset

Open berga007 opened this issue 4 years ago • 2 comments

Description

In the openaerostruct/geometry/utils.py module the Taper Function, taper, that is implemented produces wrong results when the mesh has an offset in the y (spanwise) direction.

Steps to reproduce issue

  1. Use the generate_mesh function available in the same module to produce a rectangular wing with an offset in the y direction:

from openaerostruct.geometry.utils import ( generate_mesh, taper )

mesh_dict = {'num_y' : num_y_outboard, 'num_x' : num_x, 'wing_type' : 'rect', 'symmetry' : True, 'span_cos_spacing' : 0.5, 'span' : 2.5, 'root_chord' : 0.399, 'offset' : np.array([0, -0.75, 0]) }

mesh = generate_mesh(mesh_dict)

  1. Use the taper function to change the geometry of the mesh:

mesh = taper( mesh=mesh, taper_ratio=0.55, symmetry=True )

Current behavior

mesh[0, -1, 0] returns a value for the x-coordinate of the Leading Edge root different than the original value defined when calling the generate_mesh helper function.

mesh[-1, -1, 0] also returns a different value than previously defined by the generate_function helper function.

Expected behavior

mesh[0, -1, 0] and mesh[0, -1, 0] to return the same value as given by the generate_function helper function. The x-coordinates of the wing root should be the same after calling the taper function.

Code versions

  • Python 3.9.5
  • OpenMDAO 3.6.0
  • OpenAeroStruct 2.3.0

berga007 avatar Jul 18 '21 09:07 berga007

I believe the issue is related to the way the interpolation is being defined:

taper = np.interp(x.real, xp.real, fp.real)

xp is defined as a ndarray [-span, 0] so the interpolation will use [-span, taper_ratio] as the first data point and will use [0, 1] as the 2nd data point to produce the linear interpolation function.

If there is an offset in the y-coordinate then -span and the y-coordinate at the wing tip will not match.

I believe that by defining the variable xp as:

xp = np.array([x[0], x[-1]])

The problem will be fixed.

berga007 avatar Jul 18 '21 09:07 berga007

@berga007 Thank you for opening an issue, I will take at look and fix soon.

kanekosh avatar Jul 30 '21 14:07 kanekosh