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

Add methods for retreiving number of iterations and residual norm from KSM linear solvers #185

Merged
merged 9 commits into from
Mar 7, 2023

Conversation

A-CGray
Copy link
Contributor

@A-CGray A-CGray commented Feb 18, 2023

In my nonlinear solver, I wanted to be able to check the final residual and the number of iterations from each linear solve (e.g to decide whether the preconditioner needs to be updated), this PR adds this functionality for all solvers that inherit from TACSKsm

PR Summary:

  • Adds protected iterCount and resNorm attributes to the abstract TACSKsm class, iterCount is the total number of iterations taken for the last linear solve and resNorm is the residual norm from the end of the last linear solve.
  • Adds default constructor to TACSKsm that initialises iterCount and resNorm to 0
  • Adds getter methods for iterCount and resNorm to TACSKsm and their python interfaces
  • Adds code to update iterCount and resNorm to the end of the solve methods of the PCG, GMRES and GCROT classes that inherit from TACSKsm
  • Adds basic convergence tests that rely on iterCount and resNorm to StaticTestCase.test_solve

Closes #4

Copy link
Collaborator

@gjkennedy gjkennedy left a comment

Choose a reason for hiding this comment

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

A few minor corrections

src/bpmat/KSM.cpp Outdated Show resolved Hide resolved
src/bpmat/KSM.cpp Outdated Show resolved Hide resolved
@A-CGray A-CGray requested a review from gjkennedy March 2, 2023 16:32
@A-CGray
Copy link
Contributor Author

A-CGray commented Mar 2, 2023

@gjkennedy are you happy with merging this now?

@gjkennedy gjkennedy merged commit 7c231b1 into master Mar 7, 2023
@gjkennedy gjkennedy deleted the addKSMOutputs branch March 7, 2023 14:16
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.

KSM Solver choice and iteration count
3 participants