Skip to content

Commit

Permalink
IfW: improve error handling on XY plane export
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-platt committed Jun 21, 2023
1 parent 83c7e89 commit efa2dc6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/inflowwind/src/InflowWind_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2948,6 +2948,9 @@ subroutine Grid3D_WriteVTKsliceXY(G3D, FileRootName, XYslice_height, unit, ErrSt
integer(IntKi) :: ErrStat2
character(ErrMsgLen) :: ErrMsg2

ErrStat = ErrID_None
ErrMsg = ""

call GetPath(FileRootName, RootPathName)
RootPathName = trim(RootPathName)//PathSep//"vtk"
call MkDir(trim(RootPathName)) ! make this directory if it doesn't already exist
Expand All @@ -2958,7 +2961,7 @@ subroutine Grid3D_WriteVTKsliceXY(G3D, FileRootName, XYslice_height, unit, ErrSt
write(ht_str,'(i3)') nint(ht)

! check for errors in slice height
if (iz <= 0_IntKi) then
if (iz <= 0_IntKi .or. iz > G3D%NZGrids) then
call SetErrStat(ErrID_Warn,"No grid points near XY slice height of "//trim(num2lstr(XYslice_height))//". Skipping writing slice file.",ErrStat,ErrMsg,RoutineName)
return
endif
Expand Down Expand Up @@ -2995,9 +2998,9 @@ subroutine Grid3D_WriteVTKsliceXY(G3D, FileRootName, XYslice_height, unit, ErrSt
end do
end do

close (unit)
enddo

close (unit)
end subroutine Grid3D_WriteVTKsliceXY

end module InflowWind_IO

0 comments on commit efa2dc6

Please sign in to comment.