Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] incorrect init of aggregated output index arrays in FAST.Farm #895

Merged
merged 4 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmake/OpenfastFortranOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ macro(set_fast_intel_fortran_posix)

# debug flags
if(CMAKE_BUILD_TYPE MATCHES Debug)
set( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -check all,no-array-temps -traceback" )
set( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -check all,noarg_temp_created -traceback -init=huge,infinity" )
endif()

# OPENMP
Expand Down Expand Up @@ -221,7 +221,7 @@ macro(set_fast_intel_fortran_windows)

# debug flags
if(CMAKE_BUILD_TYPE MATCHES Debug)
set( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} /check:all /traceback" )
set( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} /check:all,noarg_temp_created /traceback /Qinit=huge,infinity" )
endif()

# OPENMP
Expand Down
46 changes: 26 additions & 20 deletions glue-codes/fast-farm/src/FAST_Farm_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9939,26 +9939,8 @@ SUBROUTINE Farm_PrintSum( farm, WD_InputFileData, ErrStat, ErrMsg )
RETURN
END SUBROUTINE Farm_PrintSum

!----------------------------------------------------------------------------------------------------------------------------------
!> This routine initializes the output for the glue code, including writing the header for the primary output file.
SUBROUTINE Farm_InitOutput( farm, ErrStat, ErrMsg )

IMPLICIT NONE

! Passed variables
type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data
INTEGER(IntKi), INTENT(OUT) :: ErrStat !< Error status
CHARACTER(*), INTENT(OUT) :: ErrMsg !< Error message corresponding to ErrStat


! Local variables.

INTEGER(IntKi) :: I, J ! Generic index for DO loops.
INTEGER(IntKi) :: indxLast ! The index of the last value to be written to an array
INTEGER(IntKi) :: indxNext ! The index of the next value to be written to an array
INTEGER(IntKi) :: NumOuts ! number of channels to be written to the output file(s)


! These must be set prior to usage in the SetOutParam routine
SUBROUTINE Farm_SetAggregatedChannelOutArrays()
WkDfVxTND(:,:,1) = RESHAPE( &
(/WkDfVxT1N01D1,WkDfVxT1N02D1,WkDfVxT1N03D1,WkDfVxT1N04D1,WkDfVxT1N05D1,WkDfVxT1N06D1,WkDfVxT1N07D1,WkDfVxT1N08D1,WkDfVxT1N09D1,WkDfVxT1N10D1, &
WkDfVxT1N11D1,WkDfVxT1N12D1,WkDfVxT1N13D1,WkDfVxT1N14D1,WkDfVxT1N15D1,WkDfVxT1N16D1,WkDfVxT1N17D1,WkDfVxT1N18D1,WkDfVxT1N19D1,WkDfVxT1N20D1, &
Expand Down Expand Up @@ -10828,7 +10810,28 @@ SUBROUTINE Farm_InitOutput( farm, ErrStat, ErrMsg )
EddShrT9N11D8,EddShrT9N12D8,EddShrT9N13D8,EddShrT9N14D8,EddShrT9N15D8,EddShrT9N16D8,EddShrT9N17D8,EddShrT9N18D8,EddShrT9N19D8,EddShrT9N20D8, &
EddShrT9N01D9,EddShrT9N02D9,EddShrT9N03D9,EddShrT9N04D9,EddShrT9N05D9,EddShrT9N06D9,EddShrT9N07D9,EddShrT9N08D9,EddShrT9N09D9,EddShrT9N10D9, &
EddShrT9N11D9,EddShrT9N12D9,EddShrT9N13D9,EddShrT9N14D9,EddShrT9N15D9,EddShrT9N16D9,EddShrT9N17D9,EddShrT9N18D9,EddShrT9N19D9,EddShrT9N20D9/), (/20,9/) )
END SUBROUTINE Farm_SetAggregatedChannelOutArrays



!----------------------------------------------------------------------------------------------------------------------------------
!> This routine initializes the output for the glue code, including writing the header for the primary output file.
SUBROUTINE Farm_InitOutput( farm, ErrStat, ErrMsg )

IMPLICIT NONE

! Passed variables
type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data
INTEGER(IntKi), INTENT(OUT) :: ErrStat !< Error status
CHARACTER(*), INTENT(OUT) :: ErrMsg !< Error message corresponding to ErrStat


! Local variables.

INTEGER(IntKi) :: I, J ! Generic index for DO loops.
INTEGER(IntKi) :: indxLast ! The index of the last value to be written to an array
INTEGER(IntKi) :: indxNext ! The index of the next value to be written to an array
INTEGER(IntKi) :: NumOuts ! number of channels to be written to the output file(s)

if ( (farm%p%NumOuts == 0) ) then ! .or. .not. ( (farm%p%WrTxtOutFile) .or. (farm%p%WrBinOutFile) ) ) then
return
Expand Down Expand Up @@ -14756,6 +14759,9 @@ SUBROUTINE Farm_SetOutParam(OutList, farm, ErrStat, ErrMsg )
ErrMsg = ""
InvalidOutput = .FALSE.

! Setup the aggregated channel arrays used below
call Farm_SetAggregatedChannelOutArrays()

! ..... Developer must add checking for invalid inputs here: .....


Expand Down