-
Notifications
You must be signed in to change notification settings - Fork 465
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 check for valid rotation matrix to beamdyn subroutine BD_CrvExtractCrv #31
Conversation
Couple of comments/questions based on the git diff:
|
@bjonkman - thanks for the comments. @mschmidt271 please do a check on performance with/without this feature, and please consider Bonnie's other suggestion around miscvar and improving the error handling. @bjonkman - we saw this as a robust fix where, if we're given a non-rotation matrix (e.g., when the rest of the code is run in single precision), we find the closest rotation matrix. The check should be quite efficient, but you're right that we need to demonstrate that. |
@michaelasprague - I was able to fix the problem with the rest of the code being run in single precision by changing the precision of a few more variables in ElastoDyn. It's in my openfast f/Envision-BeamDyn branch (I think I sent you an email about this a few weeks ago). I think Andy found another variable in the BD driver that needed to be double-precision--I will check that you access to this change, too. |
…k into separate subroutine
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.
Should the new subroutine, BD_CheckRotMat(), be added to a module in the NWTC library instead of residing within the BeamDyn module? If so, should an interface be built for various datatypes and should the interface be more generic so that it works for matrices of varying dimensions? Also, we shouldn't be coding ErrStat values to their numeric values but should use the parameters: ErrID_None, ErrID_Info, ErrID_Warn, etc.
@michaelasprague @bjonkman @ghaymanNREL After putting some work in on this pull request, I believe I have addressed all the relevant issues.
|
This commit modifies the subroutine to check whether R is a valid rotation matrix by checking R*R^T = 1 and det(R) = 1. If it is not a valid rotation matrix, the closest rotation matrix (closest orthogonal matrix) is computed by computing the SVD for R = USV^T, and the new matrix to be used is Rr = UV^T.
This commit also adds LAPACK_gesvd to NWTC_LAPACK to handle single/double precision.
The only issue I see at this time, which I discussed with Mike, is the error catching/return in BD_CrvExtractCrv, as the return may only kick control back to the calling subroutine, and neither currently has ErrMsg/ErrStat machinery.