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, take 2 #278

Merged
merged 17 commits into from
May 24, 2023
Merged

Conversation

anilyil
Copy link
Contributor

@anilyil anilyil commented Mar 29, 2023

Purpose

This PR completely changes the CL solver in ADflow. The new features are documented as docstrings in the new method, so I won't bother duplicating the explanations here. There are some tests that test the new capability.

Expected time until merged

2-4 weeks

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 anilyil requested a review from a team as a code owner March 29, 2023 08:07
@anilyil anilyil marked this pull request as draft March 29, 2023 08:08
@codecov
Copy link

codecov bot commented Mar 29, 2023

Codecov Report

Merging #278 (7de057a) into main (11e7091) will increase coverage by 1.64%.
The diff coverage is 97.22%.

@@            Coverage Diff             @@
##             main     #278      +/-   ##
==========================================
+ Coverage   40.86%   42.51%   +1.64%     
==========================================
  Files          13       13              
  Lines        3901     3952      +51     
==========================================
+ Hits         1594     1680      +86     
+ Misses       2307     2272      -35     
Impacted Files Coverage Δ
adflow/pyADflow.py 68.94% <97.22%> (+2.23%) ⬆️

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

@anilyil anilyil marked this pull request as ready for review May 11, 2023 18:11
@anilyil
Copy link
Contributor Author

anilyil commented May 11, 2023

I just updated the PR description to reflect the current changes that I want to merge.

@anilyil anilyil requested review from lamkina and sseraj May 12, 2023 00:40
Copy link
Collaborator

@sseraj sseraj left a comment

Choose a reason for hiding this comment

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

The solver changes look good. I left some minor comments

adflow/pyADflow.py Outdated Show resolved Hide resolved
adflow/pyADflow.py Outdated Show resolved Hide resolved
resultsDict : dictionary
Dictionary that contains various results from the cl solve. The
dictionary contains the following data:
>>> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't render correctly. I think using bullets instead of >>> should work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How do I use bullets?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Something like:

 * converged : bool
      Flag ...
 * iterations : int

adflow/pyADflow.py Show resolved Hide resolved
tests/reg_tests/test_cl_solve.py Outdated Show resolved Hide resolved
@anilyil
Copy link
Contributor Author

anilyil commented May 23, 2023

Thanks for the review, @sseraj. After our discussion with you and @lamkina the other day, I decided to remove as many of the ADflow options we were overwriting in the CL solver. This just results in some confusing behavior I think. Right now, I am only changing the relative L2 target, because that does need to be modified between each iteration. Other than this, if anybody wants a different ADflow option, they will need to make that change before going into the CL solver.

I doubt many people are using the solver right now. Also, I think removing these options and defaults will cause less headache down the line when we want to change some defaults etc.

@anilyil anilyil requested a review from sseraj May 23, 2023 06:38

# put back the modified options
for option, value in modifiedOptions.items():
self.setOption(option, value)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree that removing the options as arguments is cleaner. This part of finalizeSolver can also be removed, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now, I am only modifying the relative L2 tolerance. However, keeping that finalize call there might be good because if we want to modify any other option down the line, we can easily track it the same way. The previous implementation had individual resets for each modified option. I say we keep it but I am also fine with changing it to an relL2 specific reset.

adflow/pyADflow.py Show resolved Hide resolved
adflow/pyADflow.py Outdated Show resolved Hide resolved
resultsDict : dictionary
Dictionary that contains various results from the cl solve. The
dictionary contains the following data:
>>> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something like:

 * converged : bool
      Flag ...
 * iterations : int

@anilyil anilyil requested a review from sseraj May 24, 2023 06:30
@lamkina lamkina merged commit f9d093d into mdolab:main May 24, 2023
@anilyil anilyil deleted the clsolve_improvements branch June 4, 2023 21:09
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.

3 participants