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

inverse_operator() objects should not be stored or reused #12737

Closed
bangerth opened this issue Sep 2, 2021 · 2 comments
Closed

inverse_operator() objects should not be stored or reused #12737

bangerth opened this issue Sep 2, 2021 · 2 comments
Milestone

Comments

@bangerth
Copy link
Member

bangerth commented Sep 2, 2021

I think that we have identified an issue with the inverse_operator() function and resulting object in a code by @juleoc02 . If I see this right, then the inverse_operator() object stores references to a linear solver object, and that linear solver will generally store a reference to a SolverControl object. The problem is that linear solvers generally do not reset the iteration counter to zero every time you call a solve() function. As a consequence, if you allow yourself 1,000 iterations in the SolverControl object, and if each invokation of the inverse operator requires 100 iterations, then after the tenth invokation of the inverse operator you get a convergence failure simply because you've exhausted the total number of iterations.

We should at the very least document this, but it would probably also be good if we made sure that our iterative solvers reset the control object every time they start a linear solve.

Ideas?

@bangerth bangerth added this to the Release 10.0 milestone Sep 2, 2021
@peterrum
Copy link
Member

peterrum commented Sep 2, 2021

The problem is that linear solvers generally do not reset the iteration counter to zero every time you call a solve() function.

But they should. SolverCG does it if I am not mistaken:

conv = this->iteration_status(0, res, x);

@bangerth
Copy link
Member Author

bangerth commented Sep 3, 2021

You are right. I had neglected the fact that we pass down the number of the iteration when calling iteration_status.

@bangerth bangerth closed this as completed Sep 3, 2021
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

No branches or pull requests

2 participants