-
Notifications
You must be signed in to change notification settings - Fork 60
Add method for least-squares fitting of DVGeos #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
A-CGray
wants to merge
30
commits into
main
Choose a base branch
from
DVGeoFit
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #274 +/- ##
==========================================
+ Coverage 67.00% 67.42% +0.41%
==========================================
Files 47 47
Lines 12331 12315 -16
==========================================
+ Hits 8262 8303 +41
+ Misses 4069 4012 -57 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Least Squares Fitting
I added two methods for least squares fitting, i.e finding the design variables that get as close as possible to some target geometry:
fitPointSet
attempts to match the coordinates of one pointset already added to the DVGeo to a supplied set of coordinatesfitDVGeo
is a wrapper aroundfitPointSet
that allows you to do the same least squares fit based on a pointset coming from another DVGeoBoth these methods are implemented in, and only use methods from,
BaseDVGeometry
, so they should work with any of our parameterisations. This opens up the possibility of doing things like fitting an ESP CAD model to a geometry optimised with an FFD.Here is an example of me fitting a wing shape generated by one FFD (black) to the shape I got from an optimization using a different FFD (orange)
New
BaseDVGeomgetry
MethodsTo implement the fitting methods above, I had to implement two new methods in
BaseDVGeometry
:getDVBounds
getOrigPoints
Renamed
getValues
getValues
is a vague name that doesn't explain what the method actually does (return the current DV values). So I renamed itgetDesignVars
, to matchsetDesignVars
. I keptgetValues
around for now, it simply raises a deprecation warning and then callsgetDesignVars
DVGeometry Improvements
There were a bunch of places in the FFD implementation where the same code was copied 4 times to do the same thing with the 4 different types of DV (
self.DV_listGlobal
,self.DV_listLocal
,self.DV_listSectionLocal
,self.DV_listSpanwiseLocal
).addVariablesPyOpt
had a nicer implementation that loops over the 4, so I just copied that approach to a bunch of other parts of the code.Additionally, the forward jacvec product method,
totalSensitivityProd
, was not correctly reshaping it's output, so I fixed that, and a part of the MPhys wrapper that was relying on this incorrect behaviour.ToDos
Expected time until merged
Type of change
Testing
Checklist
flake8
andblack
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable