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

NWTC Library and WriteOutput updates #1254

Merged
merged 5 commits into from
Sep 20, 2022
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: 0 additions & 4 deletions modules/aerodyn/src/AeroAcoustics_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ MODULE AeroAcoustics_IO

INTEGER(IntKi), PARAMETER :: Time = 0

! Parameters related to output length (number of characters allowed in the output data headers):

INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1

INTEGER(IntKi), PARAMETER :: MaxBl = 3 ! Maximum number of blades allowed in simulation

! model identifiers
Expand Down
24 changes: 12 additions & 12 deletions modules/aerodyn/src/AeroDyn_AllBldNdOuts_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ MODULE AeroDyn_AllBldNdOuts_IO

! Parameters related to output length (number of characters allowed in the output data headers):

INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 6 ! The NREL allowed channel name length is usually 20. We are making these of the form B#N##namesuffix
! INTEGER(IntKi), PARAMETER :: OutStrLenM1_Msuffix = ChanLen - 6 ! The NREL allowed channel name length is usually 20. We are making these of the form B#N##namesuffix


! ===================================================================================================
! NOTE: The following lines of code were generated by a Matlab script called "Write_ChckOutLst.m"
! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these
! lines should be modified in the Matlab script and/or Excel worksheet as necessary.
! ===================================================================================================
! This code was generated by Write_ChckOutLst.m at 02-Mar-2022 11:12:19.

! This code was generated by "Write_ChckOutLst.m" at 07-Sep-2022 16:16:13.

! Indices for computing output channels:
! NOTES:
! (1) These parameters are in the order stored in "OutListParameters.xlsx"

Expand Down Expand Up @@ -103,7 +103,7 @@ MODULE AeroDyn_AllBldNdOuts_IO
! The maximum number of output channels which can be output by the code.
INTEGER(IntKi), PARAMETER, PUBLIC :: BldNd_MaxOutPts = 62

!End of code generated by Matlab script
!End of code generated by Matlab script Write_ChckOutLst
! ===================================================================================================

CONTAINS
Expand Down Expand Up @@ -1319,7 +1319,7 @@ END SUBROUTINE AllBldNdOuts_SetParameters
!! the sign is set to 0 if the channel is invalid.
!! It sets assumes the value p%NumOuts has been set before this routine has been called, and it sets the values of p%OutParam here.
!!
!! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 02-Mar-2022 11:12:19.
!! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 07-Sep-2022 16:16:13.
SUBROUTINE BldNdOuts_SetOutParam(BldNd_OutList, p, p_AD, ErrStat, ErrMsg )
!..................................................................................................................................

Expand All @@ -1341,7 +1341,6 @@ SUBROUTINE BldNdOuts_SetOutParam(BldNd_OutList, p, p_AD, ErrStat, ErrMsg )
INTEGER :: INDX ! Index for valid arrays

LOGICAL :: InvalidOutput(1:BldNd_MaxOutPts) ! This array determines if the output channel is valid for this configuration
CHARACTER(ChanLen) :: OutListTmp ! A string to temporarily hold OutList(I)
CHARACTER(*), PARAMETER :: RoutineName = "BldNdOuts_SetOutParam"

CHARACTER(OutStrLenM1), PARAMETER :: ValidParamAry(62) = (/ & ! This lists the names of the allowed parameters, which must be sorted alphabetically
Expand All @@ -1362,7 +1361,7 @@ SUBROUTINE BldNdOuts_SetOutParam(BldNd_OutList, p, p_AD, ErrStat, ErrMsg )
BldNd_UA_x1 , BldNd_UA_x2 , BldNd_UA_x3 , BldNd_UA_x4 , BldNd_UA_x5 , BldNd_Uin , BldNd_Uir , BldNd_Uit , &
BldNd_VDisx , BldNd_VDisy , BldNd_VDisz , BldNd_Vindx , BldNd_Vindy , BldNd_VRel , BldNd_VUndx , BldNd_Vundxi , &
BldNd_VUndy , BldNd_Vundyi , BldNd_VUndz , BldNd_Vundzi , BldNd_Vx , BldNd_Vy /)
CHARACTER(ChanLen), PARAMETER :: ParamUnitsAry(62) = (/ & ! This lists the units corresponding to the allowed parameters
CHARACTER(ChanLen), PARAMETER :: ParamUnitsAry(62) = (/ character(ChanLen) :: & ! This lists the units corresponding to the allowed parameters
"(deg) ","(-) ","(-) ","(-) ","(deg) ","(-) ","(m) ","(-) ", &
"(-) ","(-) ","(-) ","(-) ","(-) ","(deg) ","(-) ","(-) ", &
"(-) ","(-) ","(-) ","(Pa) ","(N/m) ","(N/m) ","(N/m) ","(N/m) ", &
Expand Down Expand Up @@ -1424,13 +1423,14 @@ SUBROUTINE BldNdOuts_SetOutParam(BldNd_OutList, p, p_AD, ErrStat, ErrMsg )
DO I = 1,p%BldNd_NumOuts

p%BldNd_OutParam(I)%Name = BldNd_OutList(I)
OutListTmp = BldNd_OutList(I)
p%BldNd_OutParam(I)%SignM = 1 ! this won't be used

CALL Conv2UC( OutListTmp ) ! Convert OutListTmp to upper case

Indx = FindValidChannelIndx(BldNd_OutList(I), ValidParamAry, p%BldNd_OutParam(I)%SignM)

Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry )
if (p%BldNd_OutParam(I)%SignM /= 1) then ! this won't be used
CALL SetErrStat(ErrID_Severe, "Negative channels not allowed for nodal outputs. Resetting channel name.", ErrStat, ErrMsg, RoutineName)
p%BldNd_OutParam(I)%SignM = 1
p%BldNd_OutParam(I)%Name = p%BldNd_OutParam(I)%Name(2:) ! remove the first character that makes this a negative value
end if

IF ( Indx > 0 ) THEN ! we found the channel name
IF ( InvalidOutput( ParamIndxAry(Indx) ) ) THEN ! but, it isn't valid for these settings
Expand Down
55 changes: 7 additions & 48 deletions modules/aerodyn/src/AeroDyn_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ MODULE AeroDyn_IO
! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these
! lines should be modified in the Matlab script and/or Excel worksheet as necessary.
! ===================================================================================================
! This code was generated by Write_ChckOutLst.m at 01-Mar-2022 11:16:33.


! Parameters related to output length (number of characters allowed in the output data headers):

INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1

! This code was generated by "Write_ChckOutLst.m" at 07-Sep-2022 16:15:54.

! Indices for computing output channels:
! NOTES:
Expand Down Expand Up @@ -1345,7 +1339,7 @@ MODULE AeroDyn_IO
! The maximum number of output channels which can be output by the code.
INTEGER(IntKi), PARAMETER :: MaxOutPts = 1270

!End of code generated by Matlab script
!End of code generated by Matlab script Write_ChckOutLst
! ===================================================================================================

INTEGER, PARAMETER :: TwNVUnd(3, 9) = RESHAPE( (/ & ! Undisturbed wind velocity
Expand Down Expand Up @@ -2409,8 +2403,7 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InitInp, InputFile, RootName, NumBlade

if ( InputFileData%Echo ) WRITE(UnEc, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo
CurLine = CurLine + 1
call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%OutList, &
InputFileData%NumOuts, 'OutList', "List of user-requested output channels", ErrStat2, ErrMsg2, UnEc )
call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%OutList, InputFileData%NumOuts, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;

!====== Nodal Outputs ==============================================================================
Expand Down Expand Up @@ -2438,8 +2431,7 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InitInp, InputFile, RootName, NumBlade
if ( InputFileData%Echo ) WRITE(UnEc, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo
CurLine = CurLine + 1

call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%BldNd_OutList, &
InputFileData%BldNd_NumOuts, 'BldNd_OutList', "List of user-requested output nodal channel groups", ErrStat2, ErrMsg2, UnEc )
call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%BldNd_OutList, InputFileData%BldNd_NumOuts, ErrStat2, ErrMsg2, UnEc )
if (FailedNodal()) return;

RETURN
Expand Down Expand Up @@ -2888,7 +2880,7 @@ END SUBROUTINE AD_PrintSum
!! the sign is set to 0 if the channel is invalid.
!! It sets assumes the value p%NumOuts has been set before this routine has been called, and it sets the values of p%OutParam here.
!!
!! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 01-Mar-2022 11:16:33.
!! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 07-Sep-2022 16:15:55.
SUBROUTINE SetOutParam(OutList, p, p_AD, ErrStat, ErrMsg )
!..................................................................................................................................

Expand All @@ -2909,9 +2901,7 @@ SUBROUTINE SetOutParam(OutList, p, p_AD, ErrStat, ErrMsg )
INTEGER :: J ! Generic loop-counting index
INTEGER :: INDX ! Index for valid arrays

LOGICAL :: CheckOutListAgain ! Flag used to determine if output parameter starting with "M" is valid (or the negative of another parameter)
LOGICAL :: InvalidOutput(0:MaxOutPts) ! This array determines if the output channel is valid for this configuration
CHARACTER(ChanLen) :: OutListTmp ! A string to temporarily hold OutList(I)
CHARACTER(*), PARAMETER :: RoutineName = "SetOutParam"

CHARACTER(OutStrLenM1), PARAMETER :: ValidParamAry(1270) = (/ & ! This lists the names of the allowed parameters, which must be sorted alphabetically
Expand Down Expand Up @@ -3234,7 +3224,7 @@ SUBROUTINE SetOutParam(OutList, p, p_AD, ErrStat, ErrMsg )
TwN8Fdy , TwN8M , TwN8Re , TwN8STVx , TwN8STVy , TwN8STVz , TwN8Vrel , TwN8VUndx , &
TwN8VUndy , TwN8VUndz , TwN9DynP , TwN9Fdx , TwN9Fdy , TwN9M , TwN9Re , TwN9STVx , &
TwN9STVy , TwN9STVz , TwN9Vrel , TwN9VUndx , TwN9VUndy , TwN9VUndz /)
CHARACTER(ChanLen), PARAMETER :: ParamUnitsAry(1270) = (/ & ! This lists the units corresponding to the allowed parameters
CHARACTER(ChanLen), PARAMETER :: ParamUnitsAry(1270) = (/ character(ChanLen) :: & ! This lists the units corresponding to the allowed parameters
"(N) ","(N) ","(N) ","(N) ","(N) ","(N) ","(N-m) ","(N-m) ", &
"(N-m) ","(N-m) ","(N-m) ","(N-m) ","(W) ","(deg) ","(deg) ","(-) ", &
"(-) ","(-) ","(m) ","(-) ","(-) ","(-) ","(-) ","(deg) ", &
Expand Down Expand Up @@ -3558,39 +3548,8 @@ SUBROUTINE SetOutParam(OutList, p, p_AD, ErrStat, ErrMsg )
DO I = 1,p%NumOuts

p%OutParam(I)%Name = OutList(I)
OutListTmp = OutList(I)

! Reverse the sign (+/-) of the output channel if the user prefixed the
! channel name with a "-", "_", "m", or "M" character indicating "minus".


CheckOutListAgain = .FALSE.

IF ( INDEX( "-_", OutListTmp(1:1) ) > 0 ) THEN
p%OutParam(I)%SignM = -1 ! ex, "-TipDxc1" causes the sign of TipDxc1 to be switched.
OutListTmp = OutListTmp(2:)
ELSE IF ( INDEX( "mM", OutListTmp(1:1) ) > 0 ) THEN ! We'll assume this is a variable name for now, (if not, we will check later if OutListTmp(2:) is also a variable name)
CheckOutListAgain = .TRUE.
p%OutParam(I)%SignM = 1
ELSE
p%OutParam(I)%SignM = 1
END IF

CALL Conv2UC( OutListTmp ) ! Convert OutListTmp to upper case


Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry )


! If it started with an "M" (CheckOutListAgain) we didn't find the value in our list (Indx < 1)

IF ( CheckOutListAgain .AND. Indx < 1 ) THEN ! Let's assume that "M" really meant "minus" and then test again
p%OutParam(I)%SignM = -1 ! ex, "MTipDxc1" causes the sign of TipDxc1 to be switched.
OutListTmp = OutListTmp(2:)

Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry )
END IF

Indx = FindValidChannelIndx(OutList(I), ValidParamAry, p%OutParam(I)%SignM)

IF ( Indx > 0 ) THEN ! we found the channel name
IF ( InvalidOutput( ParamIndxAry(Indx) ) ) THEN ! but, it isn't valid for these settings
Expand Down
2 changes: 1 addition & 1 deletion modules/beamdyn/src/BeamDyn_BldNdOuts_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ MODULE BeamDyn_BldNdOuts_IO

! Parameters related to output length (number of characters allowed in the output data headers):

INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen-6 ! We are making these of the form B1Z###quantity, but note that the glue code adds the "B1" (turbine component) part
! INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen-6 ! We are making these of the form B1Z###quantity, but note that the glue code adds the "B1" (turbine component) part

! ===================================================================================================
! NOTE: The following lines of code were generated by a Matlab script called "Write_ChckOutLst.m"
Expand Down
5 changes: 0 additions & 5 deletions modules/beamdyn/src/BeamDyn_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ MODULE BeamDyn_IO
! This code was generated by Write_ChckOutLst.m at 29-Sep-2015 10:23:41.


! Parameters related to output length (number of characters allowed in the output data headers):

INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1


! Indices for computing output channels:
! NOTES:
! (1) These parameters are in the order stored in "OutListParameters.xlsx"
Expand Down
2 changes: 1 addition & 1 deletion modules/elastodyn/src/ElastoDyn_AllBldNdOuts_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MODULE ElastoDyn_AllBldNdOuts_IO

! Parameters related to output length (number of characters allowed in the output data headers):

INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen-6 ! The NREL allowed channel name length is usually 20. We are making these of the form B#N###namesuffix
! INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen-6 ! The NREL allowed channel name length is usually 20. We are making these of the form B#N###namesuffix


! ===================================================================================================
Expand Down
5 changes: 0 additions & 5 deletions modules/elastodyn/src/ElastoDyn_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ MODULE ElastoDyn_Parameters
! This code was generated by Write_ChckOutLst.m at 25-Jan-2021 13:23:51.


! Parameters related to output length (number of characters allowed in the output data headers):

INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1


! Indices for computing output channels:
! NOTES:
! (1) These parameters are in the order stored in "OutListParameters.xlsx"
Expand Down
1 change: 0 additions & 1 deletion modules/extptfm/src/ExtPtfm_MCKF_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ MODULE ExtPtfm_MCKF_Parameters
! Variables for output channels
INTEGER(IntKi), PARAMETER :: MaxOutChs = 9 + 3*200 ! Maximum number of output channels
! Harcoded to outputs of 200 CB modes
INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1
INTEGER(IntKi), PARAMETER :: ID_Time = 0
INTEGER(IntKi), PARAMETER :: ID_PtfFx = 1
INTEGER(IntKi), PARAMETER :: ID_PtfFy = 2
Expand Down
5 changes: 0 additions & 5 deletions modules/feamooring/src/FEAM.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ MODULE FEAMooring
! This code was generated by Write_ChckOutLst.m at 09-Dec-2014 14:03:37.


! Parameters related to output length (number of characters allowed in the output data headers):

INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1


! Indices for computing output channels:
! NOTES:
! (1) These parameters are in the order stored in "OutListParameters.xlsx"
Expand Down
3 changes: 1 addition & 2 deletions modules/hydrodyn/src/HydroDyn_Input.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1262,8 +1262,7 @@ SUBROUTINE HydroDyn_ParseInput( InputFileName, OutRootName, defWtrDens, defWtrDp
call AllocAry( InputFileData%UserOutputs, MaxUserOutputs, 'InputFileData%UserOutputs', ErrStat2, ErrMsg2 ) ! MaxUserOutputs is set in registry
if (Failed()) return;

call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%UserOutputs, &
InputFileData%NUserOutputs, 'OutList', "List of user-requested output channels", ErrStat2, ErrMsg2, UnEc )
call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%UserOutputs, InputFileData%NUserOutputs, ErrStat2, ErrMsg2, UnEc )
if (Failed()) return;


Expand Down
20 changes: 7 additions & 13 deletions modules/hydrodyn/src/HydroDyn_Output.f90
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@ MODULE HydroDyn_Output
! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these
! lines should be modified in the Matlab script and/or Excel worksheet as necessary.
! ===================================================================================================
! This code was generated by Write_ChckOutLst.m at 05-Jan-2021 06:02:16.


! Parameters related to output length (number of characters allowed in the output data headers):

INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1

! This code was generated by "Write_ChckOutLst.m" at 07-Sep-2022 15:24:58.

! Indices for computing output channels:
! NOTES:
Expand Down Expand Up @@ -612,8 +606,8 @@ MODULE HydroDyn_Output
! The maximum number of output channels which can be output by the code.
INTEGER(IntKi), PARAMETER :: MaxOutPts = 537

!End of code generated by Matlab script
! ===================================================================================================
!End of code generated by Matlab script Write_ChckOutLst
! ===================================================================================================

REAL(ReKi) :: AllOuts(MaxHDOutputs) ! Array of all possible outputs

Expand Down Expand Up @@ -1232,7 +1226,7 @@ SUBROUTINE HDOut_WriteOutputs( Time, y, p, Decimate, ErrStat, ErrMsg )
INTEGER :: I ! Generic loop counter
CHARACTER(200) :: Frmt ! a string to hold a format statement
integer(IntKi) :: ErrStat2
character(ErrMsgLen) :: ErrMsg2
! character(ErrMsgLen) :: ErrMsg2


IF (p%UnOutFile < 0 ) RETURN
Expand Down Expand Up @@ -1343,7 +1337,7 @@ SUBROUTINE HDOUT_Init( HydroDyn_ProgDesc, OutRootName, InputFileData, y, p, m,


CALL HDOUT_ChkOutLst( InputFileData%OutList(1:p%NumOuts), y, p, ErrStat, ErrMsg )
IF ( ErrStat /= 0 ) RETURN
IF ( ErrStat >= AbortErrLev ) RETURN

! Aggregate the sub-module initialization outputs for the glue code

Expand Down Expand Up @@ -1597,13 +1591,13 @@ FUNCTION HDOut_GetChannels ( NUserOutputs, UserOutputs, OutList, foundMask,
CALL Conv2UC( OutListTmp ) ! Convert OutListTmp to upper case


Indx = IndexCharAry( OutListTmp(1:9), ValidParamAry )
Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry )

IF ( CheckOutListAgain .AND. Indx < 1 ) THEN ! Let's assume that "M" really meant "minus" and then test again
! ex, 'MTipDxc1' causes the sign of TipDxc1 to be switched.
OutListTmp = OutListTmp(2:)

Indx = IndexCharAry( OutListTmp(1:9), ValidParamAry )
Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry )
END IF

IF ( Indx > 0 ) THEN
Expand Down
Loading