-
Notifications
You must be signed in to change notification settings - Fork 160
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
Eigensolver #2985
Eigensolver #2985
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Left some comments. Thanks!
firedrake/eigensolver.py
Outdated
amount. It is the user's responsibility to ensure that the shift is not | ||
close to an actual eigenvalue of the system. | ||
""" | ||
def __init__(self, A, M=None, bcs=None, bc_shift=666.0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the bc_shift
by default, not zero? This would give an Inf eigenvalue for each bc node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You answered your own question. If bc_shift
is zero then the boundary eigenvalues are mathematically undefined. Expecting a numerical algorithm to do something sensible in those circumstances is optimistic, to say the least. In particular, the way SLEPc will solve the generalised eigenvalue problem is bc_shift==0
then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me be more precise, my understanding is that if the bc_shift
is zero only on the mass matrix there are no boundary eigenvalues, since the only
If a matrix in the pencil of the generalised eigenvalue problem is singular this doesn't mean that the pencil itself is singular.
Indeed SLEPc will solve the generalised eigenvalue problem as
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made this change, however you still don't get a particularly nice system, because of the 0 eigenvalues in the inverted system. If you want to see this, change the test to not shift the eigenvalues and you'll see that the error in the non-boundary eigenvalues increases by a lot.
self.M = M | ||
else: | ||
from ufl import inner, dx | ||
self.M = inner(u, v) * dx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very specific. One might be interested in using the eigensolver to compute the eigenvalues of a saddle point problem, which usually has a different mass matrix with a 0 block on the diagonal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only a default, and one that is correct in the straightforward case. The user can always provide a different M
.
Added docstrings, added a line to make sure compared values are sorted
Co-authored-by: ksagiyam <[email protected]>
Co-authored-by: ksagiyam <[email protected]>
Co-authored-by: ksagiyam <[email protected]>
Description
This PR introduces
LinearEigenproblem
andLinearEigensolver
as analogous classes toLinearVariationalProblem
andLinearVariationalSolver
.This enables high-level programming of Finite Element Eigenproblems. The API is documented and the existing Eigenproblem demo has been ported to the new API.
Dirichlet Boundary conditions are supported, currently by shifting the consequential nullspace to a user-specified eigenvalue.