diff --git a/modules/inflowwind/src/Lidar.f90 b/modules/inflowwind/src/Lidar.f90 index ec35b2a3f7..9a83c4ce9b 100644 --- a/modules/inflowwind/src/Lidar.f90 +++ b/modules/inflowwind/src/Lidar.f90 @@ -118,7 +118,7 @@ SUBROUTINE Lidar_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init RETURN ENDIF - CALL AllocAry(p%lidar%MsrPosition , 3, p%lidar%NumBeam, 'Array for measurement coordinates', TmpErrStat, TmpErrMsg ) + CALL AllocAry(p%lidar%MsrPosition , 3, max(1,p%lidar%NumBeam), 'Array for measurement coordinates', TmpErrStat, TmpErrMsg ) CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName) IF ( ErrStat>= AbortErrLev ) RETURN @@ -362,7 +362,8 @@ SUBROUTINE Lidar_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMs MeasurementCurrentStep = INT(t / p%lidar%MeasurementInterval) IF ( (p%lidar%MeasurementInterval * MeasurementCurrentStep) /= t ) THEN - Output%VelocityUVW(:,1) = 0 +!This isn't returned, so don't set it. +! Output%VelocityUVW(:,1) = 0 RETURN ENDIF diff --git a/modules/servodyn/src/BladedInterface_EX.f90 b/modules/servodyn/src/BladedInterface_EX.f90 index 5775ffa6a3..4604a787fe 100644 --- a/modules/servodyn/src/BladedInterface_EX.f90 +++ b/modules/servodyn/src/BladedInterface_EX.f90 @@ -375,25 +375,33 @@ end subroutine InitStCCtrl subroutine InitLidarMeas() integer :: I,J if (p%NumBeam == 0) return ! Nothing to set - ! Allocate arrays for inputs - if (allocated(InitInp%LidSpeed)) then ! make sure we have the array allocated before setting it - CALL AllocAry(u%LidSpeed, size(InitInp%LidSpeed), 'u%LidSpeed', errStat2, ErrMsg2) - if (Failed()) return + ! Allocate arrays for inputs -- these may have been set in ServoDyn already + if (allocated(InitInp%LidSpeed)) then ! make sure we have the array allocated before setting it + if (.not. allocated(u%LidSpeed)) then + CALL AllocAry(u%LidSpeed, size(InitInp%LidSpeed), 'u%LidSpeed', errStat2, ErrMsg2) + if (Failed()) return + endif u%LidSpeed = InitInp%LidSpeed endif if (allocated(InitInp%MsrPositionsX)) then ! make sure we have the array allocated before setting it - CALL AllocAry(u%MsrPositionsX, size(InitInp%MsrPositionsX), 'u%MsrPositionsX', errStat2, ErrMsg2) - if (Failed()) return + if (.not. allocated(u%MsrPositionsX)) then + CALL AllocAry(u%MsrPositionsX, size(InitInp%MsrPositionsX), 'u%MsrPositionsX', errStat2, ErrMsg2) + if (Failed()) return + endif u%MsrPositionsX = InitInp%MsrPositionsX endif if (allocated(InitInp%MsrPositionsY)) then ! make sure we have the array allocated before setting it - CALL AllocAry(u%MsrPositionsY, size(InitInp%MsrPositionsY), 'u%MsrPositionsY', errStat2, ErrMsg2) - if (Failed()) return + if (.not. allocated(u%MsrPositionsY)) then + CALL AllocAry(u%MsrPositionsY, size(InitInp%MsrPositionsY), 'u%MsrPositionsY', errStat2, ErrMsg2) + if (Failed()) return + endif u%MsrPositionsY = InitInp%MsrPositionsY endif if (allocated(InitInp%MsrPositionsZ)) then ! make sure we have the array allocated before setting it - CALL AllocAry(u%MsrPositionsZ, size(InitInp%MsrPositionsZ), 'u%MsrPositionsZ', errStat2, ErrMsg2) - if (Failed()) return + if (.not. allocated(u%MsrPositionsZ)) then + CALL AllocAry(u%MsrPositionsZ, size(InitInp%MsrPositionsZ), 'u%MsrPositionsZ', errStat2, ErrMsg2) + if (Failed()) return + endif u%MsrPositionsZ = InitInp%MsrPositionsZ endif ! Write summary info to summary file