Fix bug in BD linearization resulting from reference rotation change #2063
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.
This pull request is ready to be merged
Feature or improvement description
This PR fixes a bug in the BeamDyn Jacobian calculations related to rotating the states. When RotStates (input file) and ChangeRefFrame (BeamDyn.f90) were both True, the state Jacobians were rotated by the wrong amount leading to incorrect linearization results. This has been updated by setting RotStates to True when ChangeRefFrame is True and updating the way the difference in rotation is calculated for rotating the state Jacobians.
Impacted areas of the software
BeamDyn.f90
Additional supporting information
When the change in reference frame was implemented in v3.5.0, it effectively changed the states to be in the rotating frame. The existing method for putting the state Jacobians into the rotating frame involved calculating the difference in rotation between the root mesh reference orientation and the root mesh current orientation. Originally, the reference orientation always aligned with the blade root reference orientation inside BeamDyn. However, this is not a valid assumption when ChangeRefFrame = .true. as the blade root reference is updated by UpdateStates at every step.
This commit changes two things: first, if ChangeRefFrame is true, then p%RotStates is also set to true because the states are in the rotating frame; second, the Jacobian is now rotated by the difference between the root mesh current orientation and BeamDyn's root reference orientation. These orientations will be the same after UpdateStates, but the correction is still applied in case the Jacobian routines are called with a different root mesh orientation.
Test results, if applicable
This PR changes the
5MW_Land_BD_Linear
regression test to linearize at 1 second instead of 0 so the blades have a chance to move away from their reference position/orientation. This issue was not discovered sooner because the tests passed since there was no difference between the root orientation and the reference orientation. The results for5MW_Land_BD_Linear_Aero
also changed now that BeamDyn is producing the correct Jacobians.