From 39a2165b7da5a431d3ba999983a180d33a5ee7d0 Mon Sep 17 00:00:00 2001 From: Roger Bergua Date: Thu, 24 Sep 2026 16:27:13 -0600 Subject: [PATCH 1/4] Only WrVTK=2 enforces final write --- modules/aerodyn/src/FVW.f90 | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/modules/aerodyn/src/FVW.f90 b/modules/aerodyn/src/FVW.f90 index 4df398a6d6..03447840e1 100644 --- a/modules/aerodyn/src/FVW.f90 +++ b/modules/aerodyn/src/FVW.f90 @@ -504,16 +504,11 @@ subroutine FVW_FinalWrite(u, p, x, z, OtherState, m, ErrStat, ErrMsg) ErrStat = ErrID_None ErrMsg = "" ! Place any last minute operations or calculations here: - if (p%WrVTK>0 .and. m%VTKstep Date: Thu, 24 Sep 2026 16:30:06 -0600 Subject: [PATCH 2/4] Decouple grid outputs from WrVTK --- modules/aerodyn/src/FVW.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/aerodyn/src/FVW.f90 b/modules/aerodyn/src/FVW.f90 index 03447840e1..e4a97c86d2 100644 --- a/modules/aerodyn/src/FVW.f90 +++ b/modules/aerodyn/src/FVW.f90 @@ -1612,7 +1612,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 From 0873538dbc5cfb22b50a29f2f7b3eccb91040331 Mon Sep 17 00:00:00 2001 From: Roger Bergua Date: Fri, 25 Sep 2026 11:47:27 -0600 Subject: [PATCH 3/4] OLAF: fix missing VTK output at final time step for WrVTK=1 --- modules/aerodyn/src/FVW.f90 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/aerodyn/src/FVW.f90 b/modules/aerodyn/src/FVW.f90 index e4a97c86d2..59d0292555 100644 --- a/modules/aerodyn/src/FVW.f90 +++ b/modules/aerodyn/src/FVW.f90 @@ -504,11 +504,18 @@ subroutine FVW_FinalWrite(u, p, x, z, OtherState, m, ErrStat, ErrMsg) ErrStat = ErrID_None ErrMsg = "" ! Place any last minute operations or calculations here: - if (p%WrVTK==2 .and. m%VTKstep0 .and. m%VTKstep= p%DTvtk - 0.25_DbKi*p%DTaero) then + ! WrVTK=1: only write the final step if it wasn't caught yet and it lines up with VTK_fps + call WriteVTKOutputs(t, .true., m%iStep+1, u, p, x, z, m, ErrStat, ErrMsg) + endif m%VTKstep = FINAL_STEP ! We make sure we don't write again endif end subroutine FVW_FinalWrite From 23edb8f282f9a4a4e26c53e35552313883f5c244 Mon Sep 17 00:00:00 2001 From: Roger Bergua Date: Thu, 8 Oct 2026 18:15:17 -0600 Subject: [PATCH 4/4] OLAF: fix final-step grid VTK output --- modules/aerodyn/src/FVW.f90 | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/aerodyn/src/FVW.f90 b/modules/aerodyn/src/FVW.f90 index 59d0292555..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,22 +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: ! NOTE: the driver's main loop calls CalcOutput one step behind UpdateStates, so the very last - ! simulated state is never seen by CalcOutput. Force it here if it wasn't written yet. - if (p%WrVTK>0 .and. m%VTKstep0 .or. p%nGridOut>0) .and. m%VTKstep= p%DTvtk - 0.25_DbKi*p%DTaero) then - ! WrVTK=1: only write the final step if it wasn't caught yet and it lines up with VTK_fps - call WriteVTKOutputs(t, .true., m%iStep+1, u, p, x, z, m, ErrStat, ErrMsg) - endif + if (p%WrVTK==2) call WrScr('OLAF: writing final VTK outputs') + ! WrVTK=2 forces the wake output regardless of VTK_fps. Grids never use force, only their own schedule. + call WriteVTKOutputs(t, p%WrVTK==2, m%iStep+1, u, p, x, z, m, ErrStat, ErrMsg) m%VTKstep = FINAL_STEP ! We make sure we don't write again endif end subroutine FVW_FinalWrite @@ -1569,6 +1564,7 @@ subroutine WriteVTKOutputs(t, force, VTKstep, u, p, x, z, m, ErrStat, ErrMsg) character(*), parameter :: RoutineName = 'WriteVTKOutputs' integer(IntKi) :: iW, iGrid integer(IntKi) :: nSeg, nSegP + integer(IntKi) :: VTKstepWake logical, allocatable :: bDoGrid(:) ! Flag per output grid: .true. if it needs to be written now type(T_Tree) :: Tree type(T_Panl) :: Panl @@ -1578,6 +1574,9 @@ subroutine WriteVTKOutputs(t, force, VTKstep, u, p, x, z, m, ErrStat, ErrMsg) ! --- Write VTK of wake/blade filaments/panels if (p%WrVTK>0) 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 @@ -1596,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