From 624b7a0425d48b279dff11cb3115d6bd0b633ba4 Mon Sep 17 00:00:00 2001 From: andrew-platt Date: Fri, 10 Nov 2023 16:41:18 -0700 Subject: [PATCH] IfW: check that uniform wind file time vector is always increasing --- modules/inflowwind/src/InflowWind_IO.f90 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/inflowwind/src/InflowWind_IO.f90 b/modules/inflowwind/src/InflowWind_IO.f90 index 6f4a62c9a2..6a2954e14e 100644 --- a/modules/inflowwind/src/InflowWind_IO.f90 +++ b/modules/inflowwind/src/InflowWind_IO.f90 @@ -256,6 +256,7 @@ subroutine IfW_UniformWind_Init(InitInp, SumFileUnit, UF, FileDat, ErrStat, ErrM call SetErrStat(ErrID_Fatal, TmpErrMsg, ErrStat, ErrMsg, RoutineName) end if end do + if (ErrStat >= AbortErrLev) return !---------------------------------------------------------------------------- ! Find out information on the timesteps and range @@ -277,6 +278,24 @@ subroutine IfW_UniformWind_Init(InitInp, SumFileUnit, UF, FileDat, ErrStat, ErrM WindFileDT = 0.0_ReKi end if + !---------------------------------------------------------------------------- + ! Check that time is always increasing + !---------------------------------------------------------------------------- + + ! Check that last timestep is always increasing + if (UF%DataSize > 2) then + do I = 2, UF%DataSize + if (UF%Time(I)<=UF%Time(I-1)) then + TmpErrMsg = ' Time vector must always increase in the uniform wind file. Error around wind step ' & + //TRIM(Num2LStr(I))//' at time '//TRIM(Num2LStr(UF%Time(I)))//' in wind file ' & + //TRIM(InitInp%WindFileName)//'.' + call SetErrStat(ErrID_Fatal, TmpErrMsg, ErrStat, ErrMsg, RoutineName) + exit + endif + end do + if (ErrStat >= AbortErrLev) return + endif + !---------------------------------------------------------------------------- ! Store wind file metadata !----------------------------------------------------------------------------