diff --git a/modules/aerodyn/src/FVW.f90 b/modules/aerodyn/src/FVW.f90 index 4df398a6d6..2e3e84710c 100644 --- a/modules/aerodyn/src/FVW.f90 +++ b/modules/aerodyn/src/FVW.f90 @@ -23,6 +23,7 @@ module FVW PRIVATE type(ProgDesc), parameter :: FVW_Ver = ProgDesc( 'OLAF', '', '' ) + integer(IntKi), parameter :: FINAL_STEP = 999999999 ! VTK file index used for the forced wake output at the end of the simulation public :: FVW_Init ! Initialization routine public :: FVW_End @@ -500,20 +501,16 @@ subroutine FVW_FinalWrite(u, p, x, z, OtherState, m, ErrStat, ErrMsg) integer(IntKi), intent( out) :: ErrStat !< Error status of the operation character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None real(DbKi) :: t - integer, parameter :: FINAL_STEP = 999999999 ErrStat = ErrID_None ErrMsg = "" ! Place any last minute operations or calculations here: - if (p%WrVTK>0 .and. m%VTKstep0 .or. p%nGridOut>0) .and. m%VTKstep0) then + ! A forced wake write (WrVTK=2, end of simulation) uses the FINAL_STEP index. Grids are not affected. + VTKstepWake = VTKstep + if (force) VTKstepWake = FINAL_STEP if (m%FirstCall .or. force) then call MKDIR(p%VTK_OutFileRoot) endif @@ -1594,14 +1595,14 @@ subroutine WriteVTKOutputs(t, force, VTKstep, u, p, x, z, m, ErrStat, ErrMsg) call SetErrStat(ErrID_Warn, ErrMsg2, ErrStat, ErrMsg, RoutineName) endif ! We ouput in first rotor frame - call WrVTK_FVW(p, x, z, m, trim(p%VTK_OutFileBase)//'FVW_Hub', VTKstep, 9, bladeFrame=.TRUE., & + call WrVTK_FVW(p, x, z, m, trim(p%VTK_OutFileBase)//'FVW_Hub', VTKstepWake, 9, bladeFrame=.TRUE., & HubOrientation=real(u%rotors(1)%HubOrientation,ReKi),HubPosition=real(u%rotors(1)%HubPosition,ReKi)) endif if ((p%VTKCoord==1).or.(p%VTKCoord==3)) then ! Global coordinate system, ALL VTK will be exported in global - call WrVTK_FVW(p, x, z, m, trim(p%VTK_OutFileBase)//'FVW_Glb', VTKstep, 9, bladeFrame=.FALSE.) + call WrVTK_FVW(p, x, z, m, trim(p%VTK_OutFileBase)//'FVW_Glb', VTKstepWake, 9, bladeFrame=.FALSE.) endif - m%VTKstep=VTKstep ! We save the step at which writing occurred + m%VTKstep=VTKstepWake ! We save the step at which writing occurred endif endif ! --- Write VTK grids @@ -1617,7 +1618,7 @@ subroutine WriteVTKOutputs(t, force, VTKstep, u, p, x, z, m, ErrStat, ErrMsg) do iGrid=1,p%nGridOut bWithinTime = t>=m%GridOutputs(iGrid)%tStart-p%DTaero/2. .and. t<= m%GridOutputs(iGrid)%tEnd+p%DTaero/2. bTimeToOutput = ( t - m%GridOutputs(iGrid)%tLastOutput) >= m%GridOutputs(iGrid)%DTout - 0.25_DbKi*p%DTaero - bDoGrid(iGrid) = force .or. (bWithinTime .and. bTimeToOutput) + bDoGrid(iGrid) = bWithinTime .and. bTimeToOutput enddo if (any(bDoGrid)) then ! Build the wake segments/tree once and reuse it for all grids below