Skip to content

Commit e01ca8a

Browse files
authored
Merge pull request #2760 from bjonkman/b/AeroMap_orientation
bug fix: Adjust steady-state solver small angle assumptions
2 parents 6508efb + 9117b35 commit e01ca8a

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

modules/openfast-library/src/FAST_SS_Solver.f90

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,11 @@ SUBROUTINE SteadyStateSolve_Residual(caseData, p_FAST, y_FAST, m_FAST, ED, BD, A
586586
INTEGER(IntKi) , INTENT( OUT) :: ErrStat !< Error status of the operation
587587
CHARACTER(*) , INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None
588588

589+
REAL(R8Ki) :: Orientation(3,3)
590+
INTEGER(IntKi) :: k, node
589591
INTEGER(IntKi) :: ErrStat2
590592
INTEGER(IntKi) :: Indx_u_start
593+
INTEGER(IntKi) :: Indx_u_angle_start(p_FAST%NumBl_Lin)
591594
CHARACTER(ErrMsgLen) :: ErrMsg2
592595
CHARACTER(*), PARAMETER :: RoutineName = 'SteadyStateSolve_Residual'
593596

@@ -608,12 +611,23 @@ SUBROUTINE SteadyStateSolve_Residual(caseData, p_FAST, y_FAST, m_FAST, ED, BD, A
608611
!..................
609612
! Pack the output "residual vector" with these state derivatives and new inputs:
610613
!..................
611-
CALL Create_SS_Vector( p_FAST, y_FAST, U_Resid, AD, ED, BD, InputIndex, STATE_PRED )
614+
CALL Create_SS_Vector( p_FAST, y_FAST, U_Resid, AD, ED, BD, InputIndex, STATE_PRED, Indx_u_angle_start )
612615

613616
! Make the inputs a residual (subtract from previous inputs)
614617
Indx_u_start = y_FAST%Lin%Glue%SizeLin(LIN_ContSTATE_COL) + 1
615618
U_Resid(Indx_u_start : ) = u_in(Indx_u_start : ) - U_Resid(Indx_u_start : )
616619

620+
! we need to make a special case for the orientation matrices
621+
do k=1,p_FAST%NumBl_Lin
622+
Indx_u_start = Indx_u_angle_start(k)
623+
do node=1, AD%Input(InputIndex)%rotors(1)%BladeMotion(k)%NNodes
624+
Orientation = EulerConstruct( u_in( Indx_u_start:Indx_u_start+2 ) )
625+
Orientation = MATMUL(TRANSPOSE( AD%Input(InputIndex)%rotors(1)%BladeMotion(k)%Orientation(:,:,node)), Orientation)
626+
U_Resid(Indx_u_start:Indx_u_start+2) = EulerExtract(Orientation)
627+
Indx_u_start = Indx_u_start + 3
628+
end do
629+
end do
630+
617631
END SUBROUTINE SteadyStateSolve_Residual
618632
!----------------------------------------------------------------------------------------------------------------------------------
619633
!> This subroutine saves the current states so they can be used to compute the residual.
@@ -794,7 +808,7 @@ END SUBROUTINE Precondition_Jmat
794808

795809
!----------------------------------------------------------------------------------------------------------------------------------
796810
!> This routine basically packs the relevant parts of the modules' inputs and states for use in the steady-state solver.
797-
SUBROUTINE Create_SS_Vector( p_FAST, y_FAST, u, AD, ED, BD, InputIndex, StateIndex )
811+
SUBROUTINE Create_SS_Vector( p_FAST, y_FAST, u, AD, ED, BD, InputIndex, StateIndex, IndxOrientStart )
798812
!..................................................................................................................................
799813
TYPE(FAST_ParameterType) , INTENT(IN ) :: p_FAST !< Glue-code simulation parameters
800814
TYPE(FAST_OutputFileType), INTENT(IN ) :: y_FAST !< Output variables for the glue code
@@ -804,6 +818,7 @@ SUBROUTINE Create_SS_Vector( p_FAST, y_FAST, u, AD, ED, BD, InputIndex, StateInd
804818
TYPE(AeroDyn_Data), INTENT(INOUT) :: AD !< AeroDyn data
805819
INTEGER(IntKi), INTENT(IN ) :: InputIndex
806820
INTEGER(IntKi), INTENT(IN ) :: StateIndex
821+
INTEGER(IntKi), optional, INTENT( OUT) :: IndxOrientStart(p_FAST%NumBl_Lin)
807822

808823
! local variables:
809824
INTEGER :: n
@@ -904,8 +919,9 @@ SUBROUTINE Create_SS_Vector( p_FAST, y_FAST, u, AD, ED, BD, InputIndex, StateInd
904919
end do
905920
end do
906921

922+
if (PRESENT(IndxOrientStart)) IndxOrientStart(k) = n ! keep track of index for AD orientation
907923
do node = 1, AD%Input(InputIndex)%rotors(1)%BladeMotion(k)%NNodes
908-
CALL DCM_LogMap( AD%Input(InputIndex)%rotors(1)%BladeMotion(k)%Orientation(:,:,node), u(n:n+2), ErrStat2, ErrMsg2 )
924+
u(n:n+2) = EulerExtract( AD%Input(InputIndex)%rotors(1)%BladeMotion(k)%Orientation(:,:,node) )
909925
n = n+3
910926
end do
911927

0 commit comments

Comments
 (0)