mdolab / pygeo

pyGeo provides geometric design variables and constraints suitable for gradient-based optimization.
https://mdolab-pygeo.readthedocs-hosted.com/en/latest/?badge=latest
Apache License 2.0
122 stars 54 forks source link

Add dvs as real to optimization problem #236

Closed eirikurj closed 6 months ago

eirikurj commented 6 months ago

Purpose

DVs should be real before adding to pyOptSparse, otherwise implicit casting might fail and hang the optimization process, as happens with SLSQP described in https://github.com/mdolab/MACH-Aero/issues/96. This was initially caused by a change in pyOptSparse (see this PR and comment).

This PR addresses this issue. Additionally, made a small refactor to reduce multiple raise Error calls.

Ideally, DVGeo DVs should not be allocated by default as complex, but cast as needed. This is however a more fundamental change. This PR is intended to get SLSQP working again quickly, as it has been broken for months, and allow SLSQP MACH-Aero integration tests to be added.

Expected time until merged

ASAP as MACH-Aero and SLSQP do not work past pyOptSparse 2.10

Type of change

Testing

Run MACH-Aero tests

Checklist

codecov[bot] commented 6 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (86caa3b) 65.30% compared to head (8e8cf55) 65.32%.

Files Patch % Lines
pygeo/parameterization/DVGeo.py 75.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #236 +/- ## ========================================== + Coverage 65.30% 65.32% +0.02% ========================================== Files 47 47 Lines 12122 12121 -1 ========================================== + Hits 7916 7918 +2 + Misses 4206 4203 -3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.