Skip to content

[WIP] Newton accelaration and stabilization for adjoint runs (including multiphysics)#1217

Closed
oleburghardt wants to merge 33 commits intodevelopfrom
feature_discadj_spectrum_analyzer
Closed

[WIP] Newton accelaration and stabilization for adjoint runs (including multiphysics)#1217
oleburghardt wants to merge 33 commits intodevelopfrom
feature_discadj_spectrum_analyzer

Conversation

@oleburghardt
Copy link
Contributor

@oleburghardt oleburghardt commented Mar 2, 2021

Proposed Changes

Similar to the quasi-Newton acceleration provided by CQuasiNewtonInvLeastSquares, the proposed toolbox class CNewtonUpdateOnSubspace performs a correction on adjoint solution updates by keeping track of past iterates. Here, they are used to identify eigenvectors with large eigenvalues which slow down the overall convergence and to form a (small) subspace basis from them. Each fixed-point solution update is then projected onto that subspace and the projected part will be additionally corrected via a "real" Newton step (a.k.a. "RPM") using the computational graph for precise derivative information.

This preliminary result with one basis vector indicates that the procedure can be effective at very low additional cost (for n basis vectors, it mainly reduces to n scalar products of the current fixed-point iterate with the basis vectors, the Newton step is cheap as n is small). The residuals are obtained from a fully coupled adjoint CHT problem (2d heated cylinder in laminar flow) with a heatflux objective function.

plot

(Purple: No correction applied, Green/Blue: Usage of 1-dim. basis after extraction of one basis vector at around 500 iterations, Yellow: MPI run with two processes using the manual but MPI-compatible Gram-Schmidt-QR-decomposition for identification of basis vectors.)

The code is WIP. It needs a lot of additions, changes and testing, though the overall structure should be clear from what's already implemented.

ToDo's:

  • Remove Eigen dependencies, not needed anymore
  • Add a meaningful testcase
  • Add eigenvalue estimation / QR criterion values to screen and history output fields
  • Implement a basisMaintenance()-routine
  • Figure out a proper base class for both CQuasiNewtonInvLeastSquares and CNewtonUpdateOnSubspace
  • Figure out further algorithmic strategies for multiphysics problems, now the default is to create the basis in the outer loop, and to apply it for corrections in the inner

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with the '-Wall -Wextra -Wno-unused-parameter -Wno-empty-body' compiler flags, or simply --warnlevel=2 when using meson).
  • My contribution is commented and consistent with SU2 style.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp) , if necessary.

@pr-triage pr-triage bot added the PR: draft label Mar 2, 2021
@oleburghardt oleburghardt changed the title Newton accelaration and stabilization for (multiphysics) adjoint runs Newton accelaration and stabilization for (multiphysics) adjoint computations Mar 2, 2021
@oleburghardt oleburghardt changed the title Newton accelaration and stabilization for (multiphysics) adjoint computations Newton accelaration and stabilization for (multiphysics) adjoint runs Mar 2, 2021
* data structure (R) of similar size to construct a (quasi-) Newton scheme.
* Have to identify a proper common base class. ---*/
template<class Scalar_t>
class CNewtonUpdateOnSubspace : public CQuasiNewtonInvLeastSquares<Scalar_t> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Stroff the reference for this? Or are there modifications to the original RPM?

Copy link
Contributor Author

@oleburghardt oleburghardt Mar 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is very close to the original paper by Shroff. They didn't have access to AD derivatives of course, but apart from that, it's an implementation of the RPM algorithm proposed there (forgot to mention "RPM" above, thanks for the hint).

As a next step, I'd like to try out how keeping some "slow" basis vectors across outer loops works out, so that the whole multiphysics thing will hopefully have any gain from identifying them. (Doing it for inner iterations won't help as much, as it takes some iterations before a proper subspace can be formed.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I recently found out I should have named the other one "Anderson Acceleration"... 1965 such a hipster method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:O Great. There's even a Wiki article on that.. the chapter on relations to other classes of methods is quite interesting, too. Potentially this becomes a corrector toolbox family soon :)

@pcarruscag pcarruscag changed the title Newton accelaration and stabilization for (multiphysics) adjoint runs [WIP] Newton accelaration and stabilization for (multiphysics) adjoint runs Mar 31, 2021
@oleburghardt oleburghardt changed the title [WIP] Newton accelaration and stabilization for (multiphysics) adjoint runs [WIP] Newton accelaration and stabilization for adjoint runs (including multiphysics) Apr 19, 2021
@su2code su2code deleted a comment from lgtm-com bot May 19, 2021
@su2code su2code deleted a comment from lgtm-com bot May 19, 2021
@su2code su2code deleted a comment from lgtm-com bot May 19, 2021
@su2code su2code deleted a comment from lgtm-com bot May 19, 2021
@lgtm-com
Copy link

lgtm-com bot commented Jun 15, 2021

This pull request introduces 1 alert when merging 418aa7a into 295485c - view on LGTM.com

new alerts:

  • 1 for Expression has no effect

@lgtm-com
Copy link

lgtm-com bot commented Jun 16, 2021

This pull request introduces 1 alert when merging 56f4893 into 295485c - view on LGTM.com

new alerts:

  • 1 for Expression has no effect

@oleburghardt
Copy link
Contributor Author

oleburghardt commented Jun 17, 2021

@pcarruscag Coming back to our discussion a while ago, it should do MPI now (at least for my testcases it does). I'll clean it up and probably remove Eigen completely.

@stale
Copy link

stale bot commented Aug 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still a relevant issue please comment on it to restart the discussion. Thank you for your contributions.

@stale stale bot added the stale label Aug 21, 2021
@oleburghardt
Copy link
Contributor Author

WIP

@stale stale bot removed the stale label Aug 23, 2021
@stale
Copy link

stale bot commented Mar 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still a relevant issue please comment on it to restart the discussion. Thank you for your contributions.

@stale stale bot added the stale label Mar 2, 2022
@stale stale bot closed this Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants