Skip to content

Commit

Permalink
Merge pull request #2063 from deslaughter/b/BeamDynRotStates
Browse files Browse the repository at this point in the history
Fix bug in BD linearization resulting from reference rotation change
  • Loading branch information
andrew-platt committed Mar 4, 2024
2 parents 94a51d4 + 6dac6a0 commit e5a3bbd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions modules/beamdyn/src/BeamDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,7 @@ subroutine SetParameters(InitInp, InputFileData, p, OtherState, ErrStat, ErrMsg)


p%RotStates = InputFileData%RotStates ! Rotate states in linearization?
if (ChangeRefFrame) p%RotStates = .true.
p%RelStates = InputFileData%RelStates ! Define states relative to root motion in linearization?

p%rhoinf = InputFileData%rhoinf ! Numerical damping coefficient: [0,1]. No numerical damping if rhoinf = 1; maximum numerical damping if rhoinf = 0.
Expand Down Expand Up @@ -6025,7 +6026,8 @@ SUBROUTINE BD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM
end if

if (p%RotStates) then
RotateStates = matmul( u%RootMotion%Orientation(:,:,1), transpose( u%RootMotion%RefOrientation(:,:,1) ) )
! Calculate difference between input root orientation and root reference orientation
RotateStates = matmul( u%RootMotion%Orientation(:,:,1), OtherState%GlbRot )
do i=1,size(dXdu,1),3
dXdu(i:i+2, :) = matmul( RotateStates, dXdu(i:i+2, :) )
end do
Expand Down Expand Up @@ -6121,7 +6123,8 @@ SUBROUTINE BD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat,
call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)

if (p%RotStates) then
RotateStates = matmul( u%RootMotion%Orientation(:,:,1), transpose( u%RootMotion%RefOrientation(:,:,1) ) )
! Calculate difference between input root orientation and root reference orientation
RotateStates = matmul( u%RootMotion%Orientation(:,:,1), OtherState%GlbRot )
RotateStatesTranspose = transpose( RotateStates )

if ( present(StateRotation) ) then
Expand Down
2 changes: 1 addition & 1 deletion reg_tests/r-test
Submodule r-test updated 20 files
+211 −211 glue-codes/openfast/5MW_Land_BD_Linear/5MW_Land_BD_Linear.1.BD1.lin
+211 −211 glue-codes/openfast/5MW_Land_BD_Linear/5MW_Land_BD_Linear.1.BD2.lin
+211 −211 glue-codes/openfast/5MW_Land_BD_Linear/5MW_Land_BD_Linear.1.BD3.lin
+97 −97 glue-codes/openfast/5MW_Land_BD_Linear/5MW_Land_BD_Linear.1.ED.lin
+4 −4 glue-codes/openfast/5MW_Land_BD_Linear/5MW_Land_BD_Linear.1.SrvD.lin
+835 −835 glue-codes/openfast/5MW_Land_BD_Linear/5MW_Land_BD_Linear.1.lin
+4 −4 glue-codes/openfast/5MW_Land_BD_Linear/5MW_Land_BD_Linear.fst
+19 −16 glue-codes/openfast/5MW_Land_BD_Linear/5MW_Land_BD_Linear.log
+0 −0 glue-codes/openfast/5MW_Land_BD_Linear/NRELOffshrBsline5MW_Onshore_ElastoDyn_BDoutputs.dat
+0 −0 glue-codes/openfast/5MW_Land_BD_Linear/NRELOffshrBsline5MW_Onshore_ElastoDyn_Tower.dat
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.AD.lin
+76 −76 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.BD1.lin
+76 −76 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.BD2.lin
+76 −76 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.BD3.lin
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.ED.lin
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.IfW.lin
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.SrvD.lin
+509 −509 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.1.lin
+1 −1 glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.fst
+ glue-codes/openfast/5MW_Land_BD_Linear_Aero/5MW_Land_BD_Linear_Aero.outb

0 comments on commit e5a3bbd

Please sign in to comment.