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

Fixes for surface tracking in DVGeometryMulti #214

Closed sseraj closed 11 months ago

sseraj commented 1 year ago

Purpose

My initial implementation of surface tracking in DVGeometryMulti had a few shortcomings. This PR makes the following improvements:

1) Moved the identification of which points get projected to tracked surfaces or the component as a whole from project to addPointSet. This process only needs to happen once, not every time the projection occurs. 2) Fixed the case where a point could be associated with multiple tracked surfaces. This would previously raise a ValueError when removing points from the component-wide indices. Now the exception is caught, and the duplicate surface association is removed. This edge case can sometimes be avoided by tuning the surface tracking tolerances, but it is unavoidable in some cases. One example is if the upper and lower surfaces of a wing share points on the leading edge curve. 3) Renamed several variables related to indexing to help distinguish between indices, dictionaries of indicies, mappings to indices, and dictionaries of mappings to indices. This still may not be super clear, so suggestions are welcome.

Expected time until merged

1-2 weeks

Type of change

Testing

The current test includes surface tracking, which verifies that the refactoring did not break the primal or derivative computations. I added a separate test for shared points between tracked surfaces. This test fails without the fix and passes with the fix.

Checklist

codecov[bot] commented 1 year ago

Codecov Report

Merging #214 (2d59edc) into main (e169ab2) will increase coverage by 0.06%. The diff coverage is 98.24%.

@@            Coverage Diff             @@
##             main     #214      +/-   ##
==========================================
+ Coverage   64.72%   64.78%   +0.06%     
==========================================
  Files          47       47              
  Lines       12055    12073      +18     
==========================================
+ Hits         7802     7821      +19     
+ Misses       4253     4252       -1     
Files Coverage Δ
pygeo/parameterization/DVGeoMulti.py 91.24% <98.24%> (+0.20%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more