Skip to content

Commit

Permalink
Merge pull request OpenFAST#2287 from bjonkman/b/AD_Driver_output
Browse files Browse the repository at this point in the history
Bug Fix: AeroDyn driver output files contained wrong channel names
  • Loading branch information
andrew-platt authored Jun 29, 2024
2 parents 3d476c5 + 360c976 commit 580e346
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions modules/aerodyn/src/AeroDyn_Driver_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ usefrom AeroDyn_Registry.txt
usefrom AeroDyn_Inflow_Registry.txt
#
# ..... Table of combined cases to run .......................................................................................................
typedef AeroDyn_Driver/AD_Dvr Dvr_Case ReKi HWindSpeed - - - "Hub wind speed" "m/s"
typedef AeroDyn_Driver/AD_Dvr Dvr_Case ReKi HWindSpeed - - - "Hub wind speed" "m/s"
typedef ^ ^ ReKi PLExp - - - "Power law wind-shear exponent" "-"
typedef ^ ^ ReKi rotSpeed - - - "Rotor speed" "rad/s"
typedef ^ ^ ReKi bldPitch - - - "Pitch angle" "rad"
Expand All @@ -36,7 +36,7 @@ typedef ^ DvrVTK_SurfaceType SiKi BaseBox {3}{8} - -
# typedef ^ DvrVTK_SurfaceType DvrVTK_BLSurfaceType BladeShape {:} - - "AirfoilCoords for each blade" m

# ..... Data for driver output file .......................................................................................................
typedef AeroDyn_Driver/AD_Dvr Dvr_Outputs ProgDesc AD_ver - - - "AeroDyn version information" -
typedef AeroDyn_Driver/AD_Dvr Dvr_Outputs ProgDesc AD_ver - - - "AeroDyn version information" -
typedef ^ ^ IntKi unOutFile : - - "unit number for writing output file for each rotor" "-"
typedef ^ ^ IntKi ActualChanLen - - - "Actual length of channels written to text file (less than or equal to ChanLen)" "-"
typedef ^ ^ IntKi nDvrOutputs - - - "Number of outputs for the driver (without AD and IW)" "-"
Expand Down
15 changes: 8 additions & 7 deletions modules/aerodyn/src/AeroDyn_Driver_Subs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ subroutine Dvr_EndCase(dvr, ADI, initialized, errStat, errMsg)
else
sWT = ''
endif
call WrBinFAST(trim(dvr%out%Root)//trim(sWT)//'.outb', FileFmtID_ChanLen_In, 'AeroDynDriver', dvr%out%WriteOutputHdr, dvr%out%WriteOutputUnt, (/0.0_DbKi, dvr%dt/), dvr%out%storage(:,:,iWT), errStat2, errMsg2)
call WrBinFAST(trim(dvr%out%Root)//trim(sWT)//'.outb', FileFmtID_ChanLen_In, GetVersion(version), dvr%out%WriteOutputHdr, dvr%out%WriteOutputUnt, (/0.0_DbKi, dvr%dt/), dvr%out%storage(:,:,iWT), errStat2, errMsg2)
call SetErrStat(errStat2, errMsg2, errStat, errMsg, RoutineName)
enddo
endif
Expand Down Expand Up @@ -516,7 +516,8 @@ subroutine Init_ADI_ForDriver(iCase, ADI, dvr, FED, dt, errStat, errMsg)
enddo

call ADI_Init(InitInp, ADI%u(1), ADI%p, ADI%x(1), ADI%xd(1), ADI%z(1), ADI%OtherState(1), ADI%y, ADI%m, dt, InitOut, errStat, errMsg)

dvr%out%AD_ver = InitOut%Ver

! Set output headers
if (iCase==1) then
call concatOutputHeaders(dvr%out%WriteOutputHdr, dvr%out%WriteOutputUnt, InitOut%WriteOutputHdr, InitOut%WriteOutputUnt, errStat2, errMsg2); if(Failed()) return
Expand Down Expand Up @@ -548,7 +549,7 @@ logical function Failed0(txt)
if (errStat /= 0) then
ErrStat2 = ErrID_Fatal
ErrMsg2 = "Could not allocate "//trim(txt)
call SetErrStat(errStat2, errMsg2, errStat, errMsg, 'Dvr_InitCase')
call SetErrStat(errStat2, errMsg2, errStat, errMsg, 'Init_ADI_ForDriver')
endif
Failed0 = errStat >= AbortErrLev
if(Failed0) call cleanUp()
Expand Down Expand Up @@ -1451,7 +1452,7 @@ subroutine Dvr_InitializeOutputs(nWT, out, numSteps, errStat, errMsg)
end if
call OpenFOutFile ( out%unOutFile(iWT), trim(out%Root)//trim(sWT)//'.out', errStat, errMsg )
if ( errStat >= AbortErrLev ) return
write (out%unOutFile(iWT),'(/,A)') 'Predictions were generated on '//CurDate()//' at '//CurTime()//' using '//trim( version%Name )
write (out%unOutFile(iWT),'(/,A)') 'Predictions were generated on '//CurDate()//' at '//CurTime()//' using '//trim( GetVersion(version) )
write (out%unOutFile(iWT),'(1X,A)') trim(GetNVD(out%AD_ver))
write (out%unOutFile(iWT),'()' ) !print a blank line
write (out%unOutFile(iWT),'()' ) !print a blank line
Expand Down Expand Up @@ -1667,8 +1668,8 @@ subroutine Dvr_WriteOutputs(nt, t, dvr, out, yADI, errStat, errMsg)
out%outLine(1:nDV) = dvr%wt(iWT)%WriteOutput(1:nDV) ! Driver Write Outputs
! out%outLine(11) = dvr%WT(iWT)%hub%azimuth ! azimuth already stored a nt-1

out%outLine(nDV+1:nDV+nAD) = yADI%AD%rotors(iWT)%WriteOutput ! AeroDyn WriteOutputs
out%outLine(nDV+nAD+1:) = yADI%IW_WriteOutput ! InflowWind WriteOutputs
out%outLine(nDV+1:nDV+nIW) = yADI%IW_WriteOutput ! InflowWind WriteOutputs
out%outLine(nDV+nIW+1:) = yADI%AD%rotors(iWT)%WriteOutput ! AeroDyn WriteOutputs

if (out%fileFmt==idFmtBoth .or. out%fileFmt == idFmtAscii) then
! ASCII
Expand All @@ -1681,7 +1682,7 @@ subroutine Dvr_WriteOutputs(nt, t, dvr, out, yADI, errStat, errMsg)
endif
if (out%fileFmt==idFmtBoth .or. out%fileFmt == idFmtBinary) then
! Store for binary
out%storage(1:nDV+nAD+nIW, nt, iWT) = out%outLine(1:nDV+nAD+nIW)
out%storage(1:nDV+nIW+nAD, nt, iWT) = out%outLine(1:nDV+nIW+nAD)
endif
endif
enddo
Expand Down

0 comments on commit 580e346

Please sign in to comment.