Skip to content
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

CL solver improvements #246

Closed
wants to merge 125 commits into from
Closed

Conversation

anilyil
Copy link
Contributor

@anilyil anilyil commented Nov 28, 2022

Purpose

This PR overhauls the CL solver in ADflow. Several features are added with the goal of increasing solver robustness and performance. The solver used to take about 3 times the cost of a standalone analysis for a CL solve with 1e-6 tolerance. Now it takes about 1.1-1.5 times a standalone analysis cost. We also print more information during iterations.

The features added to the solver is relatively easy to understand, so I won't explain them here. The biggest change is the ability to provide a relative convergence target, or a list of relative convergence targets that are used at each iteration. Besides checking for CL convergence, solver also checks if CFD L2 convergence is achieved. If not, we keep running more iterations. This is responsible from bulk of the performance improvements.

One major change separate from the CL solver is the modifications to the ANK solver to handle restarts better. Originally, we were setting ANK CFL to the initial ANKCFL0 value at each restart. The default is 5.0. Based on nonlinear convergence, ANK CFL would usually end up slightly higher than this and this has been working well enough for most optimization cases.

However, when we do a CL solve type iteration, there is no point to dump the last ANK CFL. The results now jump only due to the change in AoA, and the flowfield correction. As a result, we should be able to just keep whatever ANK CFL we had in the last iteration.

To do this, I am now saving the ANK_CFL in aero problems' adflowData attribute, which is a small object to keep some ADflow data. If the ADflow option ANKCFLReset is set to False, then we replace the ANK CFL from what it was in the last iteration. The default value of ANKCFLReset is True, and this recovers the original ANK behavior where we initialize the ANK CFL every time the solver restarts.

Expected time until merged

After #231 is merged, I need to update this PR. Currently it looks like there are tons of changes but in reality this is a standalone feature. I also need to add tests.

Once I do these, it should be ready to be merged within a week after reviews.

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

anilyil and others added 30 commits January 30, 2022 20:07
…rgence. also fixed the mgpc setup for ank turb ksp
@anilyil anilyil marked this pull request as ready for review December 16, 2022 17:42
@anilyil anilyil requested a review from a team as a code owner December 16, 2022 17:42
@anilyil anilyil requested review from joanibal, ArshSaja and sseraj and removed request for joanibal December 16, 2022 17:42
@anilyil anilyil marked this pull request as draft February 5, 2023 20:41
@anilyil anilyil mentioned this pull request Mar 27, 2023
13 tasks
@anilyil
Copy link
Contributor Author

anilyil commented Mar 29, 2023

Closing this PR to create a separate one with a clean history for the cl solver

@anilyil anilyil closed this Mar 29, 2023
@anilyil anilyil deleted the clsolve_improvements branch March 29, 2023 08:01
@anilyil anilyil mentioned this pull request Mar 29, 2023
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants