mdolab / OpenAeroStruct

OpenAeroStruct is a lightweight tool that performs aerostructural optimization using OpenMDAO.
Apache License 2.0
193 stars 118 forks source link

Import of VSP Model for aerostructural analysis #396

Closed Aviatims closed 2 years ago

Aviatims commented 2 years ago

Description

When importing a wing into openaerostruct using the generate_vsp function, the wing from OpenVSP gets overlapped with another straight unswept wing. This only happens for aerostructural optimization with a wingbox and not for an aerodynamic optimization, here the generate_vsp functionality works great.

Steps to reproduce issue

Attached you will find the code I have used for this issue.

To recreate this code:

  1. I used the test_aerostruct_wingbox_opt.py file in the test folder of openaerostruct and altered it
  2. Instead of the CRM mesh I used the generate_vsp function to import the vsp_model.vsp3
  3. I altered the name of the Wing in the vsp_model.vsp3 (found in the "tests" folder) to "wing" for the correct connection
  4. I also changed the coordinates for the wingbox to have the form of the airfoil used in the vsp_model file

Current behavior

A rectangular wing is added at the end of the wingtips connecting the originally imported wing. image

Expected behavior

The imported wing was expected to be correctly represented, just like in OpenVSP

Code versions

Code

Code file: TestWingbox.txt

kanekosh commented 2 years ago

I believe the optimization setup (i.e., whether aero or aerostruct) doesn't matter for generate_vsp_surfaces function. Thus if vsp_model.vsp3 works with aerodynamic optimization cases but not for aerostructural with wing box, then the issue might be in plot_wingbox or in runscript. I'm not sure though. Could you try plotting the surfaces by yourself using matplotlib (but not the plot_wingbox function of OAS) to see if it looks fine?

Aviatims commented 2 years ago

I will have a try at plotting the surfaces. I included the runscript in the description above. To create this I followed the steps as described. I first assumed it has something to do with the symmetry, as I noticed in the wing_box example from the documentation, that the one side of the wingbox was represented correctly while the other was displaying a sharp edge, as if some nodes of the wingbox are missing in the plotwingbox command. See the following two pictures: right side: image left side: image

And if you look closely in the picture provided in the first bug description the center of the wingbox also has a sharp edge while the other side is a rectangular cross section.

This however did not lead to an improvement. Have you tried running the attached runscript to see if you get a similar issue?

All of these observations lead me to the conclusion that the problem is probably in the file which generates the wingbox. Maybe in the wingbox_group.py file in the structures folder.

Aviatims commented 2 years ago

But I will look into the plot_wingbox file to see if it is a plotting error.

Aviatims commented 2 years ago

Hello, I just wanted to ask whether there is an update on if the problem also occurs for you/other users. I have tried a couple of things but haven't solved the issue yet.

kanekosh commented 2 years ago

Sorry Tim, we don't have time to work on this issue for a while.

Aviatims commented 2 years ago

I have figured out the issue. The mesh that is being generated in the generate_vsp_surfaces function located in the utils folder needs to be of a different convention for the aerostructural case compared to the aerodynamic case. I achieved this by including the following lines: x=x[::-1] # for aerostruct mesh y=y[::-1] # for aerostruct mesh z=z[::-1] # for aerostruct mesh

and modifying:
mesh[:, :, 1] = np.flipud(y.T)*-1 #-1 for aerostruct mesh

This creates the right mesh format needed for the aerostructural case.

kanekosh commented 2 years ago

I finally had time to reproduce the bug by myself. The generate_vsp_surfaces function generates a symmetric wing on the right-side plane (whose spanwise coordinate y is positive), whereas most of the other examples in OAS use a left-side wing (whose y is negative). And it seems that aerostructural analysis (both tubular and wingbox) only works with left-side wings and only the aero analysis can handle the right-side wing.

I consider this bug to be of aerostructural analysis rather than the VSP import. I'll close this issue and open another one. A workaround is to convert the right-side wing to the left-side wing as you posted above. Thanks for finding this out.