Implement Adjoint for custom meshes#63
Merged
Merged
Conversation
… fixed scale and translate of custom meshes not working
…ng in common block
…fortran layer indexing bugs. runtime mesh updating still needs to be implemented
Owner
Hey this is looking good. I'm just going to change the .pkl files to just plain dictionaries that we can import. I don't like saving binary data to the repo since it makes it hard to track changes and the dictionaries have a very natural text representation. |
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
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.
This pull request implements the AD partials and adjoint for the direct mesh assignment features.
The new subroutines for the direct mesh assignment in amake.f have been differentiated in both forward and reverse mode with Tapenade. The necessary common block variables have been added to AVL_ad_seeds.inc to accommodate the AD.
In the python layer we have added the necessary routines to set, get, and clear the AD seeds for the mesh. Note the the mesh seed routines and variables are being treated separately from the geom ones. The justification for this is that meshes will use a different computational pathway through amake.f, amake_d.f, and amake_b.f than the AVL geometry variables and hence this separation should draw a clean line here.
The main workhorse routines for getting the Jacobian vector product in both the forward and reverse mode have been updated to support the mesh seeds. The forward routine also supports computing the mesh derivatives with finite difference. Lastly, the execute_run_sensitivities function will return the mesh derivatives alongside the geometric derivatives associated with each surface (this will make it intuitive to retrieve them).
I have also implemented two new test files that will test both the partial and total derivatives. These roughly follow all the other partial and total derivative test implemented for OptVL so far. However, the partial derivative tests exclusively focus on testing the mesh derivatives to avoid redundancy. The standard derivative tests use input files however input dictionaries are required to use a mesh so these test input files were converted to dictionary format as closely as possible(I can't match AVLs panel spacing in some cases). I have decided to store these dictionaries and meshes in .pkl format for convenience (the input dict test won't use these due to how extensive that test is). I have also included the scripts used to generate the .pkl files.
By itself this PR doesn't do much unless one is content with using the surface mesh coordinates as design variables in an optimization problem. However, it does set the groundwork for the upcoming PR which will include support for pyGeo and the OM wrapper allowing users to formulate more practical design optimization problem with custom meshes.