anchor.diff:  
      END SUBROUTINE BD_GenerateDynamicElementGA2
   
  -   SUBROUTINE BD_InputGlobalLocal( p, u, flag, ErrStat, ErrMsg)
  -
  +   SUBROUTINE BD_InputGlobalLocal( p, u, ErrStat, ErrMsg)
  +   !-----------------------------------------------------------------------------
  +   ! This subroutine tranforms the folloing quantities in Input data structure
  +   ! from global frame to local (blade) frame:
  +   ! 1 Displacements; 2 Linear/Angular velocities; 3 Linear/Angular accelerations
  +   ! 4 Piont forces/moments; 5 Distributed forces/moments
  +   ! It also transforms the DCM to rotation tensor in the input data structure
  +   !-----------------------------------------------------------------------------
      TYPE(BD_ParameterType), INTENT(IN   ):: p
      TYPE(BD_InputType),     INTENT(INOUT):: u
  -   INTEGER(IntKi),         INTENT(IN   ):: flag            ! 0: Global to Blade;
      INTEGER(IntKi),         INTENT(  OUT):: ErrStat       ! Error status of the operation
      CHARACTER(*),           INTENT(  OUT):: ErrMsg        ! Error message if ErrStat /= ErrID_None
                                                              ! 1: Blade to Global
  
positive.code:    call BD_Input_extrapinterp( u, utimes, u_interp, t+p%dt, ErrStat2, ErrMsg2 )
        call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
           
     CALL BD_InputGlobalLocal(p,u_interp,0,ErrStat2,ErrMsg2)
        call SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg, RoutineName)
     ! Incorporate boundary conditions
     CALL BD_BoundaryGA2(x,p,u_interp,t,OtherState,ErrStat2,ErrMsg2)
  
negative.code:    ErrMsg  = ""
  
     RotTen(1:3,1:3) = p%GlbRot(:,:)
     ! Transform Root Motion from Global to Local (Blade) frame
     u%RootMotion%TranslationDisp(:,1) = MATMUL(TRANSPOSE(RotTen),u%RootMotion%TranslationDisp(:,1))
     u%RootMotion%TranslationVel(:,1)  = MATMUL(TRANSPOSE(RotTen),u%RootMotion%TranslationVel(:,1))
     u%RootMotion%RotationVel(:,1)     = MATMUL(TRANSPOSE(RotTen),u%RootMotion%RotationVel(:,1))
     u%RootMotion%TranslationAcc(:,1)  = MATMUL(TRANSPOSE(RotTen),u%RootMotion%TranslationAcc(:,1))
     u%RootMotion%RotationAcc(:,1)     = MATMUL(TRANSPOSE(RotTen),u%RootMotion%RotationAcc(:,1))
     ! Transform DCM to Rotation Tensor (RT)
     u%RootMotion%Orientation(:,:,1) = TRANSPOSE(u%RootMotion%Orientation(:,:,1))
     ! Transform Applied Forces from Global to Local (Blade) frame
     DO i=1,p%node_total
         u%PointLoad%Force(1:3,i)  = MATMUL(TRANSPOSE(RotTen),u%PointLoad%Force(:,i))
         u%PointLoad%Moment(1:3,i) = MATMUL(TRANSPOSE(RotTen),u%PointLoad%Moment(:,i))
     ENDDO
     DO i=1,p%ngp * p%elem_total + 2
         u%DistrLoad%Force(1:3,i)  = MATMUL(TRANSPOSE(RotTen),u%DistrLoad%Force(:,i))
         u%DistrLoad%Moment(1:3,i) = MATMUL(TRANSPOSE(RotTen),u%DistrLoad%Moment(:,i))
     ENDDO
  
     END SUBROUTINE BD_InputGlobalLocal
  
  