Repository navigation
Speed up the stability check and buckling factor - #500
Open
mitchell-tesch wants to merge 1 commit into
Open
mitchell-tesch wants to merge 1 commit into
mitchell-tesch wants to merge 1 commit into
Conversation
…ng factor SystemElements.validate() ran np.linalg.eig (eigenvalues and eigenvectors) on the reduced stiffness matrix at every solve(); a geometrically non-linear solve calls it four times. It only needs to know whether every eigenvalue exceeds min_eigen. For a symmetric matrix, that holds exactly when k - min_eigen * I is positive definite, which a Cholesky factorisation finds about 90x faster than eig at 1200 DOFs. A non-symmetric matrix still uses its eigenvalues. det_linear_buckling: when k0 is symmetric positive definite (k0 = L L^T) and kg symmetric, the eigenvalues of inv(k0) kg are those of the symmetric L^-1 kg L^-T, found with eigvalsh; otherwise the general path as before. Stable structures and buckling factors are unchanged. Tests are added for a mechanism being rejected, the min_eigen threshold, and the Euler load of a fixed-pinned member.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #490 and a comment I made there.
validate()runs on everysolve(), and four times in a second-order solve. It usednp.linalg.eig, which was most of the solve time on larger models. The stiffness matrix is symmetric, so there are much faster options:validate()only needs to know whether all the eigenvalues are abovemin_eigen. That's the same ask - min_eigen * Ihaving a Cholesky factorisation, which is much quicker to check.det_linear_buckling()uses the Cholesky factor ofk0to turn the buckling problem into a symmetric one, so it can usenp.linalg.eigvalsh.If a matrix isn't symmetric, or
k0isn't positive definite, both fall back to the previous code.One thing I noticed while testing:
validate()compares against a fixedmin_eigen = 1e-9. For a mechanism with very stiff members, the smallest eigenvalue comes out as rounding noise well above that, so it can be reported as stable. This already happens on master; in my tests Cholesky got about the same number of these cases wrong, just not always the same ones. A threshold relative to the stiffness would likely be the best fix, what are your thoughts?