diff --git a/modules/inflowwind/CMakeLists.txt b/modules/inflowwind/CMakeLists.txt index 7e7005d9b3..ce3b31d57b 100644 --- a/modules/inflowwind/CMakeLists.txt +++ b/modules/inflowwind/CMakeLists.txt @@ -19,6 +19,7 @@ if (GENERATE_TYPES) generate_f90_types(src/InflowWind_IO.txt ${CMAKE_CURRENT_LIST_DIR}/src/InflowWind_IO_Types.f90 -noextrap) generate_f90_types(src/Lidar.txt ${CMAKE_CURRENT_LIST_DIR}/src/Lidar_Types.f90) generate_f90_types(src/InflowWind.txt ${CMAKE_CURRENT_LIST_DIR}/src/InflowWind_Types.f90) + generate_f90_types(src/InflowWind_Driver_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/InflowWind_Driver_Types.f90 -noextrap) endif() # InflowWind object library diff --git a/modules/inflowwind/src/InflowWind_Driver.f90 b/modules/inflowwind/src/InflowWind_Driver.f90 index 0a20b2e333..2091bda00f 100644 --- a/modules/inflowwind/src/InflowWind_Driver.f90 +++ b/modules/inflowwind/src/InflowWind_Driver.f90 @@ -412,25 +412,10 @@ PROGRAM InflowWind_Driver ! Set flag to calculate accelerations if requested InflowWind_InitInp%OutputAccel = SettingsFlags%OutputAccel - CALL InflowWind_Init( InflowWind_InitInp, InflowWind_u1, InflowWind_p, & + CALL inflowwind_init( InflowWind_InitInp, InflowWind_u1, InflowWind_p, & InflowWind_x, InflowWind_xd, InflowWind_z, InflowWind_OtherState, & InflowWind_y1, InflowWind_MiscVars, Settings%DT, InflowWind_InitOut, ErrStat, ErrMsg ) - - - ! Make sure no errors occured that give us reason to terminate now. - IF ( ErrStat >= AbortErrLev ) THEN - CALL DriverCleanup() - CALL ProgAbort( ErrMsg ) - ELSEIF ( ErrStat /= ErrID_None ) THEN - IF ( IfWDriver_Verbose >= 7_IntKi ) THEN - CALL WrScr(NewLine//' InflowWind_Init returned: ErrStat: '//TRIM(Num2LStr(ErrStat))// & - NewLine//' ErrMsg: '//TRIM(ErrMsg)//NewLine) - ELSEIF ( ErrStat >= ErrID_Warn ) THEN - CALL ProgWarn( ErrMsg ) - ELSE - CALL WrScr(TRIM(ErrMsg)) - ENDIF - ENDIF + call CheckCallErr('InflowWind_Init') @@ -441,68 +426,53 @@ PROGRAM InflowWind_Driver ! Convert InflowWind file to HAWC format IF (SettingsFlags%WrHAWC) THEN CALL IfW_WriteHAWC( InflowWind_p%FlowField, InflowWind_InitInp%RootName, ErrStat, ErrMsg ) - IF (ErrStat > ErrID_None) THEN - CALL WrScr( TRIM(ErrMsg) ) - IF ( ErrStat >= AbortErrLev ) THEN - CALL DriverCleanup() - CALL ProgAbort( ErrMsg ) - ELSEIF ( IfWDriver_Verbose >= 7_IntKi ) THEN - CALL WrScr(NewLine//' IfW_WriteHAWC returned: ErrStat: '//TRIM(Num2LStr(ErrStat))) - END IF - ELSE IF ( IfWDriver_Verbose >= 5_IntKi ) THEN - CALL WrScr(NewLine//'IfW_WriteHAWC CALL returned without errors.'//NewLine) - END IF + call CheckCallErr('IfW_WriteHAWC') END IF ! Convert InflowWind file to Native Bladed format IF (SettingsFlags%WrBladed) THEN CALL IfW_WriteBladed( InflowWind_p%FlowField, InflowWind_InitInp%RootName, ErrStat, ErrMsg ) - IF (ErrStat > ErrID_None) THEN - CALL WrScr( TRIM(ErrMsg) ) - IF ( ErrStat >= AbortErrLev ) THEN - CALL DriverCleanup() - CALL ProgAbort( ErrMsg ) - ELSEIF ( IfWDriver_Verbose >= 7_IntKi ) THEN - CALL WrScr(NewLine//' InflowWind_Convert2Bladed returned: ErrStat: '//TRIM(Num2LStr(ErrStat))) - END IF - ELSE IF ( IfWDriver_Verbose >= 5_IntKi ) THEN - CALL WrScr(NewLine//'InflowWind_Convert2Bladed CALL returned without errors.'//NewLine) - END IF + call CheckCallErr('IfW_WriteBladed') END IF + IF (SettingsFlags%WrVTK) THEN CALL IfW_WriteVTK( InflowWind_p%FlowField, InflowWind_InitInp%RootName, ErrStat, ErrMsg ) - IF (ErrStat > ErrID_None) THEN - CALL WrScr( TRIM(ErrMsg) ) - IF ( ErrStat >= AbortErrLev ) THEN - CALL DriverCleanup() - CALL ProgAbort( ErrMsg ) - ELSEIF ( IfWDriver_Verbose >= 7_IntKi ) THEN - CALL WrScr(NewLine//' IfW_WriteVTK returned: ErrStat: '//TRIM(Num2LStr(ErrStat))) - END IF - ELSE IF ( IfWDriver_Verbose >= 5_IntKi ) THEN - CALL WrScr(NewLine//'IfW_WriteVTK CALL returned without errors.'//NewLine) - END IF - + call CheckCallErr('IfW_WriteVTK') END IF IF (SettingsFlags%WrUniform) THEN CALL IfW_WriteUniform( InflowWind_p%FlowField, InflowWind_InitInp%RootName, ErrStat, ErrMsg ) - IF (ErrStat > ErrID_None) THEN - CALL WrScr( TRIM(ErrMsg) ) - IF ( ErrStat >= AbortErrLev ) THEN - CALL DriverCleanup() - CALL ProgAbort( ErrMsg ) - ELSEIF ( IfWDriver_Verbose >= 7_IntKi ) THEN - CALL WrScr(NewLine//' IfW_WriteUniform returned: ErrStat: '//TRIM(Num2LStr(ErrStat))) - END IF - ELSE IF ( IfWDriver_Verbose >= 5_IntKi ) THEN - CALL WrScr(NewLine//'IfW_WriteUniform CALL returned without errors.'//NewLine) - END IF + call CheckCallErr('IfW_WriteUniform') END IF + + IF (Settings%NOutWindXY>0) THEN + do i=1,Settings%NOutWindXY + CALL IfW_WriteXYslice( InflowWind_p%FlowField, InflowWind_InitInp%RootName, Settings%OutWindZ(i), ErrStat, ErrMsg ) + call CheckCallErr('IfW_WriteXYslice'//trim(Num2LStr(i))) + enddo + END IF + + + IF (Settings%NOutWindXZ>0) THEN + do i=1,Settings%NOutWindXZ +! CALL IfW_WriteXZslice( InflowWind_p%FlowField, InflowWind_InitInp%RootName, Settings%OutWindY(i), ErrStat, ErrMsg ) +! call CheckCallErr('IfW_WriteXZslice'//trim(Num2LStr(i))) + enddo + END IF + + + IF (Settings%NOutWindYZ>0) THEN + do i=1,Settings%NOutWindYZ +! CALL IfW_WriteYZslice( InflowWind_p%FlowField, InflowWind_InitInp%RootName, Settings%OutWindX(i), ErrStat, ErrMsg ) +! call CheckCallErr('IfW_WriteYZslice'//trim(Num2LStr(i))) + enddo + END IF + + !-------------------------------------------------------------------------------------------------------------------------------- !-=-=- Other Setup -=-=- !-------------------------------------------------------------------------------------------------------------------------------- @@ -941,6 +911,22 @@ SUBROUTINE DriverCleanup() END SUBROUTINE DriverCleanup + subroutine CheckCallErr(RoutineName) + character(*), intent(in) :: RoutineName + if (ErrStat > ErrID_None) then + call WrScr( trim(ErrMsg) ) + if ( ErrStat >= AbortErrLev ) then + call DriverCleanup() + call ProgAbort( ErrMsg ) + elseif ( IfWDriver_Verbose >= 7_IntKi ) then + call WrScr(NewLine//' '//trim(RoutineName)//' returned: ErrStat: '//TRIM(Num2LStr(ErrStat))) + endif + elseif ( IfWDriver_Verbose >= 5_IntKi ) then + CALL WrScr(NewLine//trim(RoutineName)//' CALL returned without errors.'//NewLine) + endif + end subroutine CheckCallErr + + END PROGRAM InflowWind_Driver diff --git a/modules/inflowwind/src/InflowWind_Driver_Registry.txt b/modules/inflowwind/src/InflowWind_Driver_Registry.txt new file mode 100644 index 0000000000..3863019d77 --- /dev/null +++ b/modules/inflowwind/src/InflowWind_Driver_Registry.txt @@ -0,0 +1,91 @@ +#---------------------------------------------------------------------------------------------------------------------------------- +# Registry for IfW_Interp, creates MODULE IfW_Interp_Types +# Module IfW_Interp_Types contains all of the user-defined types needed in IfW_FF. It also contains copy, destroy, pack, and +# unpack routines associated with each defined data types. +#---------------------------------------------------------------------------------------------------------------------------------- +# keyword +#---------------------------------------------------------------------------------------------------------------------------------- + +include Registry_NWTC_Library.txt + +#---------------------------------------------------------------------------------------------------------------------------------- +typedef InflowWind_Driver OutputFile character(1024) Name - "" - "Filename for output from points read in from points file" - +typedef ^ ^ integer Unit - -1 - "Unit number for the output file for the Points file output" - +typedef ^ ^ logical Initialized - .false. - "Flag indicating that file has been initialized" - + +# This contains flags to note if the settings were made. This same data structure is +# used both during the driver input file and the command line options. +# +# NOTE: The WindFileType is only set if it is given as a command line option. Otherwise +# it is handled internally by InflowWInd. +# +# NOTE: The wind direction is specified by the InflowWind input file. +#---------------------------------------------------------------------------------------------------------------------------------- +typedef InflowWind_Driver IfWDriver_Flags logical DvrIptFile - .false. - "Was an input file name given on the command line?" - +typedef ^ ^ logical IfWIptFile - .false. - "Was an InflowWind input file requested?" - +typedef ^ ^ logical Summary - .false. - "create a summary at command line? (data extents in the wind file)" - +typedef ^ ^ logical SummaryFile - .false. - "create a summary file of the output?" - +typedef ^ ^ logical TStart - .false. - "specified a start time" - +typedef ^ ^ logical NumTimeSteps - .false. - "specified a number of timesteps to process" - +typedef ^ ^ logical NumTimeStepsDefault - .false. - "specified a 'DEFAULT' for number of timesteps to process" - +typedef ^ ^ logical DT - .false. - "specified a resolution in time" - +typedef ^ ^ logical DTDefault - .false. - "specified a 'DEFAULT' for the time resolution" - + +typedef ^ ^ logical FFTcalc - .false. - "do an FFT" - + +typedef ^ ^ logical WindGrid - .false. - "Requested output of wind data on a grid -- input file option only" - +typedef ^ ^ logical XRange - .false. - "specified a range of x -- command line option only -- stored as GridCtrCoord and GridDelta" - +typedef ^ ^ logical YRange - .false. - "specified a range of y -- command line option only -- stored as GridCtrCoord and GridDelta" - +typedef ^ ^ logical ZRange - .false. - "specified a range of z -- command line option only -- stored as GridCtrCoord and GridDelta" - +typedef ^ ^ logical Dx - .false. - "specified a resolution in x -- command line option only, 0.0 otherwise" - +typedef ^ ^ logical Dy - .false. - "speficied a resolution in y" - +typedef ^ ^ logical Dz - .false. - "specified a resolution in z" - + +typedef ^ ^ logical PointsFile - .false. - "points filename to read in" - +typedef ^ ^ logical OutputAccel - .false. - "flag to calculate and output wind acceleration in addition to velocity" - + +typedef ^ ^ logical Verbose - .false. - "Verbose error reporting" - +typedef ^ ^ logical VVerbose - .false. - "Very Verbose error reporting" - +typedef ^ ^ logical BoxExceedAllowF - .false. - "set flag to allow exceeding wind box boundaries for FF files (for diagnostic purposes)" - + +typedef ^ ^ logical WrHAWC - .false. - "Requested file conversion to HAWC2 format?" - +typedef ^ ^ logical WrBladed - .false. - "Requested file conversion to Bladed format?" - +typedef ^ ^ logical WrVTK - .false. - "Requested file output as VTK?" - +typedef ^ ^ logical WrUniform - .false. - "Requested file output as Uniform wind format?" - + +typedef ^ ^ logical XYslice - .false. - "Take XY slice at one elevation" - + + + +# This contains all the settings (possible passed in arguments). +#---------------------------------------------------------------------------------------------------------------------------------- +typedef InflowWind_Driver IfWDriver_Settings character(1024) DvrIptFileName - "" - "Driver input file name" - +typedef ^ ^ character(1024) IfWIptFileName - "" - "Filename of InflowWind input file to read (if no driver input file)" - +typedef ^ ^ character(1024) SummaryFileName - "" - "Filename for the summary information output" - + +typedef ^ ^ character(1024) PointsFileName - "" - "Filename of points file to read in" - + +typedef ^ ^ IntKi NumTimeSteps - 0 - "Number of timesteps" - +typedef ^ ^ DbKi DT - 0.0_DbKi - "resolution of time" s +typedef ^ ^ DbKi TStart - 0.0_DbKi - "range of time -- end time converted from TRange (command line option only)" s + +typedef ^ ^ ReKi FFTcoord(1:3) - 0.0_ReKi - "(x,y,z) coordinate to do an FFT at" (m) + +typedef ^ ^ ReKi GridDelta(1:3) - 0.0_ReKi - "(GridDx,GridDy,GridDz) -- grid point spacing" (m) +typedef ^ ^ IntKi GridN(1:3) - 1_IntKi - "(GridNx,GridNy,GridNz) -- number of grid points" - + +typedef ^ ^ ReKi XRange(1:2) - 0.0_ReKi - "Range in the x-direction for the gridded data" (m) +typedef ^ ^ ReKi YRange(1:2) - 0.0_ReKi - "Range in the y-direction for the gridded data" (m) +typedef ^ ^ ReKi ZRange(1:2) - 0.0_ReKi - "Range in the z-direction for the gridded data" (m) + +typedef ^ ^ ProgDesc ProgInfo - - - "Program info" - +typedef ^ ^ OutputFile WindGridOutput - - - "Wind grid file handling" - +typedef ^ ^ OutputFile FFTOutput - - - "FFT file handling" - +typedef ^ ^ OutputFile PointsVelOutput - - - "Points output velocity file handling" - + +typedef ^ ^ IntKi NOutWindXY - 0 - "Number of XY planes for output .XY.t.vtk [0 to 9]" - +typedef ^ ^ ReKi OutWindZ : - - "Z coordinates of XY planes for output [1 to NOutWindXY] [unused for NOutWindXY=0]" (m) +typedef ^ ^ IntKi NOutWindXZ - 0 - "Number of YZ planes for output .YZ.t.vtk [0 to 9]" - +typedef ^ ^ ReKi OutWindY : - - "Y coordinates of YZ planes for output [1 to NOutWindYZ] [unused for NOutWindYZ=0]" (m) +typedef ^ ^ IntKi NOutWindYZ - 0 - "Number of YZ planes for output .YZ.t.vtk [0 to 9]" - +typedef ^ ^ ReKi OutWindX : - - "X coordinates of YZ planes for output [1 to NOutWindYZ] [unused for NOutWindYZ=0]" (m) diff --git a/modules/inflowwind/src/InflowWind_Driver_Subs.f90 b/modules/inflowwind/src/InflowWind_Driver_Subs.f90 index d7033445b2..b3f68c99f2 100644 --- a/modules/inflowwind/src/InflowWind_Driver_Subs.f90 +++ b/modules/inflowwind/src/InflowWind_Driver_Subs.f90 @@ -734,18 +734,12 @@ SUBROUTINE ReadDvrIptFile( DvrFileName, DvrFlags, DvrSettings, ProgInfo, ErrStat ! Initialize the echo file unit to -1 which is the default to prevent echoing, we will alter this based on user input UnEchoLocal = -1 - FileName = TRIM(DvrFileName) + ErrStat = ErrID_None + ErrMsg = "" CALL GetNewUnit( UnIn ) - CALL OpenFInpFile( UnIn, FileName, ErrStatTmp, ErrMsgTmp ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,' Failed to open InflowWind Driver input file: '//FileName, & - ErrStat,ErrMsg,RoutineName) - CLOSE( UnIn ) - RETURN - ENDIF - + CALL OpenFInpFile( UnIn, FileName, ErrStatTmp, ErrMsgTmp ); if (Failed()) return CALL WrScr( 'Opening InflowWind Driver input file: '//FileName ) @@ -754,30 +748,9 @@ SUBROUTINE ReadDvrIptFile( DvrFileName, DvrFlags, DvrSettings, ProgInfo, ErrStat !------------------------------------------------------------------------------------------------- ! File header !------------------------------------------------------------------------------------------------- - - CALL ReadCom( UnIn, FileName,' InflowWind Driver input file header line 1', ErrStatTmp, ErrMsgTmp ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CLOSE( UnIn ) - RETURN - ENDIF - - - CALL ReadCom( UnIn, FileName, 'InflowWind Driver input file header line 2', ErrStatTmp, ErrMsgTmp ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CLOSE( UnIn ) - RETURN - ENDIF - - - ! Echo Input Files. - CALL ReadVar ( UnIn, FileName, EchoFileContents, 'Echo', 'Echo Input', ErrStatTmp, ErrMsgTmp ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadCom( UnIn, FileName,' InflowWind Driver input file header line 1', ErrStatTmp, ErrMsgTmp ); if (Failed()) return + CALL ReadCom( UnIn, FileName, 'InflowWind Driver input file header line 2', ErrStatTmp, ErrMsgTmp ); if (Failed()) return + CALL ReadVar ( UnIn, FileName, EchoFileContents, 'Echo', 'Echo Input', ErrStatTmp, ErrMsgTmp ); if (Failed()) return ! If we are Echoing the input then we should re-read the first three lines so that we can echo them @@ -788,44 +761,15 @@ SUBROUTINE ReadDvrIptFile( DvrFileName, DvrFlags, DvrSettings, ProgInfo, ErrStat EchoFileName = TRIM(FileName)//'.ech' CALL GetNewUnit( UnEchoLocal ) - CALL OpenEcho ( UnEchoLocal, EchoFileName, ErrStatTmp, ErrMsgTmp, ProgInfo ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CLOSE( UnIn ) - RETURN - ENDIF - + CALL OpenEcho ( UnEchoLocal, EchoFileName, ErrStatTmp, ErrMsgTmp, ProgInfo ); if (Failed()) return REWIND(UnIn) ! Reread and echo - CALL ReadCom( UnIn, FileName,' InflowWind Driver input file header line 1', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal, ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF - - - CALL ReadCom( UnIn, FileName, 'InflowWind Driver input file header line 2', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF - - - ! Echo Input Files. - CALL ReadVar ( UnIn, FileName, EchoFileContents, 'Echo', 'Echo Input', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadCom( UnIn, FileName,' InflowWind Driver input file header line 1', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return + CALL ReadCom( UnIn, FileName, 'InflowWind Driver input file header line 2', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return + CALL ReadVar ( UnIn, FileName, EchoFileContents, 'Echo', 'Echo Input', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return @@ -835,78 +779,30 @@ SUBROUTINE ReadDvrIptFile( DvrFileName, DvrFlags, DvrSettings, ProgInfo, ErrStat !------------------------------------------------------------------------------------------------- ! Driver setup section !------------------------------------------------------------------------------------------------- - - ! Header - CALL ReadCom( UnIn, FileName,' Driver setup section, comment line', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF - + CALL ReadCom( UnIn, FileName,' Driver setup section, comment line', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return ! Name of InflowWind input file - CALL ReadVar( UnIn, FileName,DvrSettings%IfWIptFileName,'IfWIptFileName',' InflowWind input filename', & - ErrStatTmp,ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ELSE - DvrFlags%IfWIptFile = .TRUE. - ENDIF - + CALL ReadVar( UnIn, FileName,DvrSettings%IfWIptFileName,'IfWIptFileName',' InflowWind input filename', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return + DvrFlags%IfWIptFile = .TRUE. IF ( PathIsRelative( DvrSettings%IfWIptFileName ) ) DvrSettings%IfWIptFileName = TRIM(PriPath)//TRIM(DvrSettings%IfWIptFileName) !------------------------------------------------------------------------------------------------- ! File Conversion Options section !------------------------------------------------------------------------------------------------- - - ! Header - CALL ReadCom( UnIn, FileName,'File Conversion Options Section Header', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - CALL SetErrStat(ErrStatTmp, ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - - ! WrHAWC - CALL ReadVar( UnIn, FileName, DvrFlags%WrHAWC, 'WrHAWC', 'Convert wind data to HAWC2 format?', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - CALL SetErrStat(ErrStatTmp, ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - - ! WrBladed - CALL ReadVar( UnIn, FileName, DvrFlags%WrBladed, 'WrBladed', 'Convert wind data to Bladed format?', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - CALL SetErrStat(ErrStatTmp, ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - - ! WrVTK - CALL ReadVar( UnIn, FileName, DvrFlags%WrVTK, 'WrVTK', 'Convert wind data to VTK format?', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - CALL SetErrStat(ErrStatTmp, ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - - ! WrUniform - CALL ReadVar( UnIn, FileName, DvrFlags%WrUniform, 'WrUniform', 'Convert wind data to Uniform Wind format?', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - CALL SetErrStat(ErrStatTmp, ErrMsgTmp,ErrStat,ErrMsg,RoutineName) + CALL ReadCom( UnIn, FileName,'File Conversion Options Section Header', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return + CALL ReadVar( UnIn, FileName, DvrFlags%WrHAWC, 'WrHAWC', 'Convert wind data to HAWC2 format?', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return + CALL ReadVar( UnIn, FileName, DvrFlags%WrBladed, 'WrBladed', 'Convert wind data to Bladed format?', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return + CALL ReadVar( UnIn, FileName, DvrFlags%WrVTK, 'WrVTK', 'Convert wind data to VTK format?', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return + CALL ReadVar( UnIn, FileName, DvrFlags%WrUniform, 'WrUniform','Convert wind data to Uniform Wind format?', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return - IF ( ErrStat >= AbortErrLev ) THEN - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF - !------------------------------------------------------------------------------------------------- ! Tests of Interpolation Options section !------------------------------------------------------------------------------------------------- - CALL ReadCom( UnIn, FileName,'Tests of Interpolation Options Section Header', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - CALL SetErrStat(ErrStatTmp, ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - + CALL ReadCom( UnIn, FileName,'Tests of Interpolation Options Section Header', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return ! Number of timesteps - CALL ReadVar( UnIn, FileName,NumTimeStepsChr,'NumTimeStepsChr',' Character string for number of timesteps to read.', & - ErrStatTmp,ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadVar( UnIn, FileName,NumTimeStepsChr,'NumTimeStepsChr',' Number of timesteps to read.', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return ! Check if we asked for the DEFAULT (use what is in the file) CALL Conv2UC( NumTimeStepsChr ) @@ -918,8 +814,7 @@ SUBROUTINE ReadDvrIptFile( DvrFileName, DvrFlags, DvrSettings, ProgInfo, ErrStat ! make sure that it was appropriately interpretted. READ (NumTimeStepsChr,*,IOSTAT=IOS) DvrSettings%NumTimeSteps IF ( IOS /= 0 ) THEN ! problem in the read, so parse the error. - CALL CheckIOS ( IOS, '', 'NumTimeSteps',NumType, ErrStatTmp, ErrMsgTmp ) - RETURN + CALL CheckIOS ( IOS, '', 'NumTimeSteps',NumType, ErrStatTmp, ErrMsgTmp ); if (Failed()) return ELSE ! Was ok, so set the flags DvrFlags%NumTimeSteps = .TRUE. DvrFlags%NumTimeStepsDefault = .FALSE. @@ -928,27 +823,11 @@ SUBROUTINE ReadDvrIptFile( DvrFileName, DvrFlags, DvrSettings, ProgInfo, ErrStat ! TStart -- start time - CALL ReadVar( UnIn, FileName,DvrSettings%TStart,'TStart',' Time in wind file to start parsing.', & - ErrStatTmp,ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ELSE - DvrFlags%TStart = .TRUE. - ENDIF - + CALL ReadVar( UnIn, FileName,DvrSettings%TStart,'TStart',' Time in wind file to start parsing.', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return + DvrFlags%TStart = .TRUE. ! DT -- Timestep size for the driver to take (or DEFAULT for what the file contains) - CALL ReadVar( UnIn, FileName,DTChr,'DTChr',' Character string for Timestep size for the driver to take (or DEFAULT for what the file contains).', & - ErrStatTmp,ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadVar( UnIn, FileName,DTChr,'DTChr',' Character string for Timestep', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return ! Check if we asked for the DEFAULT (use what is in the file) CALL Conv2UC( DTChr ) @@ -960,8 +839,7 @@ SUBROUTINE ReadDvrIptFile( DvrFileName, DvrFlags, DvrSettings, ProgInfo, ErrStat ! make sure that it was appropriately interpretted. READ (DTChr,*,IOSTAT=IOS) DvrSettings%DT IF ( IOS /= 0 ) THEN ! problem in the read, so parse the error. - CALL CheckIOS ( IOS, '', 'DT',NumType, ErrStatTmp, ErrMsgTmp ) - RETURN + CALL CheckIOS ( IOS, '', 'DT',NumType, ErrStatTmp, ErrMsgTmp ); if (Failed()) return ELSE ! Was ok, so set the flags DvrFlags%DT = .TRUE. DvrFlags%DTDefault = .FALSE. @@ -969,213 +847,75 @@ SUBROUTINE ReadDvrIptFile( DvrFileName, DvrFlags, DvrSettings, ProgInfo, ErrStat ENDIF - ! Summarize the extents in the windfile - CALL ReadVar( UnIn, FileName,DvrFlags%Summary,'Summary',' Summarize data extents in the windfile', & - ErrStatTmp,ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN -! ELSE -! DvrFlags%Summary = .TRUE. - ENDIF - - - ! Summarize everything in a summary file/ - CALL ReadVar( UnIn, FileName,DvrFlags%SummaryFile,'SummaryFile',' Summarize the results in a .sum file', & - ErrStatTmp,ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN -! ELSE -! DvrFlags%SummaryFile = .TRUE. - ENDIF + ! Summary info + CALL ReadVar( UnIn, FileName,DvrFlags%Summary, 'Summary', ' Summarize data extents in the windfile', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return + CALL ReadVar( UnIn, FileName,DvrFlags%SummaryFile,'SummaryFile',' Summarize the results in a .sum file', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return ! Flag to allow sampling outside grid - CALL ReadVar( UnIn, FileName,DvrFlags%BoxExceedAllowF,'BoxExceedAllow',' Allow point sampling outside grid', & - ErrStatTmp,ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadVar( UnIn, FileName,DvrFlags%BoxExceedAllowF,'BoxExceedAllow',' Allow point sampling outside grid', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return + #ifdef UNUSED_INPUTFILE_LINES !------------------------------------------------------------------------------------------------- ! FFT calculations !------------------------------------------------------------------------------------------------- - - ! Header - CALL ReadCom( UnIn, FileName,' FFT calculations, comment line', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF - - - ! FFTcalc -- FFTcalc of the windfield needed. - CALL ReadVar( UnIn, FileName,DvrFlags%FFTcalc,'FFTcalc',' Perform an FFT?', & - ErrStatTmp,ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF - + CALL ReadCom( UnIn, FileName,' FFT calculations, comment line', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return + CALL ReadVar( UnIn, FileName,DvrFlags%FFTcalc,'FFTcalc',' Perform an FFT?', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return ! Read the coordinate for the FFT if the flag is set, otherwise skip the line IF ( DvrFlags%FFTcalc ) THEN ! FFTcoord -- The coordinates to perform the FFT at - CALL ReadAry ( UnIn, FileName, DvrSettings%FFTcoord, 3, 'FFTcoord', & - 'FFT coordinate', ErrStatTmp, ErrMsgTmp, UnEchoLocal) - IF ( ErrStat /= ErrID_None ) THEN - CALL SetErrStat( ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadAry ( UnIn, FileName, DvrSettings%FFTcoord, 3, 'FFTcoord', 'FFT coordinate', ErrStatTmp, ErrMsgTmp, UnEchoLocal); if (Failed()) return ELSE - CALL ReadCom( UnIn, FileName,' Skipping the FFT coordinate since not doint an FFT.', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadCom( UnIn, FileName,' Skipping the FFT coordinate since not doint an FFT.', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return ENDIF - #endif + !------------------------------------------------------------------------------------------------- ! points file input !------------------------------------------------------------------------------------------------- - - ! Header line - CALL ReadCom( UnIn, FileName,' Points file input, comment line', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF - - - ! PointsFile -- Read a points file - CALL ReadVar( UnIn, FileName,DvrFlags%PointsFile,'PointsFile',' Read a points file?', & - ErrStatTmp,ErrMsgTmp, UnEchoLocal ) - - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF - - - ! Points input file (unused if .not. DvrFlags%PointsFile) - CALL ReadVar( UnIn, FileName,DvrSettings%PointsFileName,'PointsFileName',' Points file input filename', & - ErrStatTmp,ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF - + CALL ReadCom( UnIn, FileName,' Points file input, comment line', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return + CALL ReadVar( UnIn, FileName,DvrFlags%PointsFile, 'PointsFile', ' Read a points file?', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return + CALL ReadVar( UnIn, FileName,DvrSettings%PointsFileName,'PointsFileName',' Points file input filename', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return IF ( PathIsRelative( DvrSettings%PointsFileName ) ) DvrSettings%PointsFileName = TRIM(PriPath)//TRIM(DvrSettings%PointsFileName) ! CalcAccel - calculate wind acceleration (unused if .not. DvrFlags%PointsFile) - CALL ReadVar( UnIn, FileName,DvrFlags%OutputAccel, 'CalcAccel', ' Calc and output wind acceleration', & - ErrStatTmp,ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadVar( UnIn, FileName,DvrFlags%OutputAccel, 'CalcAccel', ' Calc and output wind acceleration', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return + !------------------------------------------------------------------------------------------------- ! gridded data output !------------------------------------------------------------------------------------------------- - - ! Header - CALL ReadCom( UnIn, FileName,' Gridded data output, comment line', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF - + CALL ReadCom( UnIn, FileName,' Gridded data output, comment line', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return ! WindGrid -- Gridded data output - CALL ReadVar( UnIn, FileName,DvrFlags%WindGrid,'WindGrid',' Output a grid of data?', & - ErrStatTmp,ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadVar( UnIn, FileName,DvrFlags%WindGrid,'WindGrid',' Output a grid of data?', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return - ! Read the coordinate for the FFT if the flag is set, otherwise skip the line + ! Read the coordinate for the WindGrid if the flag is set, otherwise skip the line IF ( DvrFlags%WindGrid ) THEN ! GridCtrCoord -- The coordinates to center the gridded data at - CALL ReadAry ( UnIn, FileName, GridCtrCoord, 3, 'GridCtrCoord', & - 'Coordinate of the center of the gridded data', ErrStatTmp, ErrMsgTmp, UnEchoLocal) - IF ( ErrStat /= ErrID_None ) THEN - CALL SetErrStat( ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadAry ( UnIn, FileName, GridCtrCoord, 3, 'GridCtrCoord', 'Coordinate of the center of the gridded data', ErrStatTmp, ErrMsgTmp, UnEchoLocal); if (Failed()) return ! Read the DY and DZ stepsize - CALL ReadAry ( UnIn, FileName, TmpRealAr3, 3, 'GridDX, GridDY, GridDZ', & - 'GridDX, GridDY, GridDZ', ErrStatTmp, ErrMsgTmp, UnEchoLocal) - IF ( ErrStat /= ErrID_None ) THEN - CALL SetErrStat( ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadAry ( UnIn, FileName, TmpRealAr3, 3, 'GridDX, GridDY, GridDZ', 'GridDX, GridDY, GridDZ', ErrStatTmp, ErrMsgTmp, UnEchoLocal); if (Failed()) return ! Save the DY and DZ values - DvrSettings%GridDelta(1) = abs(TmpRealAr3(1)) ! X direction - DvrSettings%GridDelta(2) = abs(TmpRealAr3(2)) ! Y direction - DvrSettings%GridDelta(3) = abs(TmpRealAr3(3)) ! Z direction + DvrSettings%GridDelta(1:3) = abs(TmpRealAr3(1:3)) DvrFlags%Dx = .TRUE. ! read in value for the X direction gridding DvrFlags%Dy = .TRUE. ! read in value for the Y direction gridding DvrFlags%Dz = .TRUE. ! read in value for the Z direction gridding ! Read the number of points in the Y and Z directions - CALL ReadAry ( UnIn, FileName, TmpIntAr3, 3, 'GridNx, GridNY, GridNZ', & - 'GridNx, GridNY, GridNZ', ErrStatTmp, ErrMsgTmp, UnEchoLocal) - IF ( ErrStat /= ErrID_None ) THEN - CALL SetErrStat( ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadAry ( UnIn, FileName, DvrSettings%GridN, 3, 'GridNx, GridNY, GridNZ', 'GridNx, GridNY, GridNZ', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return ! Save the GridNY and GridNZ values - DvrSettings%GridN(1) = TmpIntAr3(1) ! X direction - DvrSettings%GridN(2) = TmpIntAr3(2) ! Y direction - DvrSettings%GridN(3) = TmpIntAr3(3) ! Z direction - DvrFlags%XRange = .TRUE. ! read in value for the X direction gridding - DvrFlags%YRange = .TRUE. ! read in value for the Y direction gridding - DvrFlags%ZRange = .TRUE. ! read in value for the Z direction gridding - + DvrFlags%XRange = .TRUE. ! read in value for the X direction gridding + DvrFlags%YRange = .TRUE. ! read in value for the Y direction gridding + DvrFlags%ZRange = .TRUE. ! read in value for the Z direction gridding ! Check that valid values of Dx, Dy, and Dz were read in. @@ -1269,10 +1009,8 @@ SUBROUTINE ReadDvrIptFile( DvrFileName, DvrFlags, DvrSettings, ProgInfo, ErrStat DvrFlags%ZRange = .TRUE. ENDIF - ELSE ! read these lines as comments (actually, we don't need to read them) - DvrSettings%GridDelta = 0.0_ReKi DvrFlags%Dx = .FALSE. DvrFlags%Dy = .FALSE. @@ -1284,34 +1022,47 @@ SUBROUTINE ReadDvrIptFile( DvrFileName, DvrFlags, DvrSettings, ProgInfo, ErrStat DvrFlags%ZRange = .FALSE. ! Skip the next three entries of the gridded data section. - CALL ReadCom( UnIn, FileName,' Skipping the gridded data section since not calculating it.', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF - CALL ReadCom( UnIn, FileName,' Skipping the gridded data section since not calculating it.', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF - CALL ReadCom( UnIn, FileName,' Skipping the gridded data section since not calculating it.', ErrStatTmp, ErrMsgTmp, UnEchoLocal ) - IF ( ErrStatTmp /= ErrID_None ) THEN - CALL SetErrStat(ErrID_Fatal,ErrMsgTmp,ErrStat,ErrMsg,RoutineName) - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) - RETURN - ENDIF + CALL ReadCom( UnIn, FileName,' Skipping the gridded data section since not calculating it.', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return + CALL ReadCom( UnIn, FileName,' Skipping the gridded data section since not calculating it.', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return + CALL ReadCom( UnIn, FileName,' Skipping the gridded data section since not calculating it.', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return ENDIF + !------------------------------------------------------------------------------------------------- + ! VTK output slices + !------------------------------------------------------------------------------------------------- + CALL ReadCom( UnIn, FileName,' VTK output slices, comment line', ErrStatTmp, ErrMsgTmp, UnEchoLocal ); if (Failed()) return + + ! NOutWindXY -- Number of XY planes for output .XY.t.vtk (-) [0 to 9] + CALL ReadVar( UnIn, FileName,DvrSettings%NOutWindXY, 'NOutWindXY','Number of VTK slices in XY?', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return + if (DvrSettings%NOutWindXY > 0_IntKi) then + CALL AllocAry( DvrSettings%OutWindZ, DvrSettings%NOutWindXY, "Z coordinates of XY planes for output", ErrStatTmp,ErrMsgTmp ); if (Failed()) return + CALL ReadAry( UnIn, FileName,DvrSettings%OutWindZ,DvrSettings%NOutWindXY,'OutWindZ','Z coordinates', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return + else + CALL ReadCom( UnIn, FileName,' Skipping OutWindZ', ErrStatTmp,ErrMsgTmp,UnEchoLocal); if (Failed()) return + endif + + ! NOutWindXZ -- Number of XZ planes for output .XZ.t.vtk (-) [0 to 9] + CALL ReadVar( UnIn, FileName,DvrSettings%NOutWindXZ, 'NOutWindXZ','Number of VTK slices in XZ?', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return + if (DvrSettings%NOutWindXZ > 0_IntKi) then + CALL AllocAry( DvrSettings%OutWindY, DvrSettings%NOutWindXZ, "Y coordinates of XZ planes for output",ErrStatTmp,ErrMsgTmp ); if (Failed()) return + CALL ReadAry( UnIn, FileName,DvrSettings%OutWindY,DvrSettings%NOutWindXZ,'OutWindY','Y coordinates' ,ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return + else + CALL ReadCom( UnIn, FileName,' Skipping OutWindY', ErrStatTmp,ErrMsgTmp,UnEchoLocal); if (Failed()) return + endif + + ! NOutWindYZ -- Number of YZ planes for output .YZ.t.vtk (-) [0 to 9] + CALL ReadVar( UnIn, FileName,DvrSettings%NOutWindYZ, 'NOutWindYZ','Number of VTK slices in YZ?', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return + if (DvrSettings%NOutWindYZ > 0_IntKi) then + CALL AllocAry( DvrSettings%OutWindX, DvrSettings%NOutWindYZ, "X coordinates of YZ planes for output", ErrStatTmp,ErrMsgTmp ); if (Failed()) return + CALL ReadAry( UnIn, FileName,DvrSettings%OutWindX,DvrSettings%NOutWindYZ,'OutWindX','X coordinates', ErrStatTmp,ErrMsgTmp, UnEchoLocal ); if (Failed()) return + else + CALL ReadCom( UnIn, FileName,' Skipping OutWindX', ErrStatTmp,ErrMsgTmp,UnEchoLocal); if (Failed()) return + endif + ! Close the echo and input file - CALL CleanupEchoFile( EchoFileContents, UnEchoLocal ) - CLOSE( UnIn ) + CALL Cleanup() CONTAINS @@ -1319,17 +1070,19 @@ SUBROUTINE ReadDvrIptFile( DvrFileName, DvrFlags, DvrSettings, ProgInfo, ErrStat !---------------------------------------------------------------------------------------------------- !> The routine cleans up the module echo file and resets the NWTC_Library, reattaching it to !! any existing echo information - SUBROUTINE CleanupEchoFile( EchoFlag, UnEcho) - LOGICAL, INTENT(IN ) :: EchoFlag ! local version of echo flag - INTEGER(IntKi), INTENT(IN ) :: UnEcho ! echo unit number - - ! Close this module's echo file - IF ( EchoFlag ) THEN - CLOSE(UnEcho) + subroutine Cleanup() + ! Close this module's echo file + IF ( EchoFileContents ) THEN + CLOSE(UnEchoLocal) ENDIF - END SUBROUTINE CleanupEchoFile - - + if (UnIn > 1) close(UnIn) + end subroutine Cleanup + !------------------------------------------------------------------------------------------------- + logical function Failed() + CALL SetErrStat( ErrStatTmp, ErrMsgTmp, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + if (Failed) CALL Cleanup() + end function Failed END SUBROUTINE ReadDvrIptFile @@ -2623,6 +2376,49 @@ subroutine IfW_WriteVTK(FF, FileRootName, ErrStat, ErrMsg) end subroutine IfW_WriteVTK +subroutine IfW_WriteXYslice(FF, FileRootName, XYslice_height, ErrStat, ErrMsg) + type(FlowFieldType), intent(in) :: FF !< Parameters + character(*), intent(in) :: FileRootName !< RootName for output files + real(ReKi), intent(in) :: XYslice_height + integer(IntKi), intent(out) :: ErrStat !< Error status of the operation + character(*), intent(out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + character(*), parameter :: RoutineName = "IfW_WriteXYslice" + type(Grid3DFieldType) :: G3D + integer(IntKi) :: unit + integer(IntKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + + ErrStat = ErrID_None + ErrMsg = "" + + ! Get new unit for writing file + call GetNewUnit(unit, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + + ! Switch based on field type + select case (FF%FieldType) + + case (Uniform_FieldType) + call Uniform_to_Grid3D(FF%Uniform, FF%VelInterpCubic, G3D, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat < AbortErrLev) then + call Grid3D_WriteVTKsliceXY(G3D, FileRootName, XYslice_height, unit, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + end if + + case (Grid3D_FieldType) + call Grid3D_WriteVTKsliceXY(FF%Grid3D, FileRootName, XYslice_height, unit, ErrStat, ErrMsg) + + case default + ErrStat = ErrID_Warn + ErrMsg = RoutineName//': Field type '//TRIM(Num2LStr(FF%FieldType))// & + ' cannot be converted to VTK format.' + end select +end subroutine IfW_WriteXYslice + + !> This routine exists only to support the development of the module. It will not be needed after the module is complete. SUBROUTINE printSettings( DvrFlags, DvrSettings ) ! The arguments @@ -2671,6 +2467,25 @@ SUBROUTINE printSettings( DvrFlags, DvrSettings ) CALL WrScr(' FFTOutputInit: '//FLAG(DvrSettings%FFTOutput%Initialized)// ' Unit #: '//TRIM(Num2LStr(DvrSettings%FFTOutput%Unit))) CALL WrScr(' PointsVelOutputInit: '//FLAG(DvrSettings%PointsVelOutput%Initialized)// ' Unit #: '//TRIM(Num2LStr(DvrSettings%PointsVelOutput%Unit))) CALL WrScr(' PointsAccOutputInit: '//FLAG(DvrSettings%PointsVelOutput%Initialized)// ' Unit #: '//TRIM(Num2LStr(DvrSettings%PointsVelOutput%Unit))) + call WrScr(' NOutWindXY: '//trim(Num2LStr(DvrSettings%NOutWindXY))) + if (DvrSettings%NOutWindXY>0) then + do i=1,DvrSettings%NOutWindXY + call WrScr(' z location '//trim(Num2LStr(i))//': '//trim(Num2LStr(DvrSettings%OutWindZ(i)))) + enddo + endif + call WrScr(' NOutWindXZ: '//trim(Num2LStr(DvrSettings%NOutWindXZ))) + if (DvrSettings%NOutWindXZ>0) then + do i=1,DvrSettings%NOutWindXZ + call WrScr(' y location '//trim(Num2LStr(i))//': '//trim(Num2LStr(DvrSettings%OutWindY(i)))) + enddo + endif + call WrScr(' NOutWindYZ: '//trim(Num2LStr(DvrSettings%NOutWindYZ))) + if (DvrSettings%NOutWindYZ>0) then + do i=1,DvrSettings%NOutWindYZ + call WrScr(' x location '//trim(Num2LStr(i))//': '//trim(Num2LStr(DvrSettings%OutWindX(i)))) + enddo + endif + END SUBROUTINE printSettings diff --git a/modules/inflowwind/src/InflowWind_Driver_Types.f90 b/modules/inflowwind/src/InflowWind_Driver_Types.f90 index 669303cf60..7babb42de5 100644 --- a/modules/inflowwind/src/InflowWind_Driver_Types.f90 +++ b/modules/inflowwind/src/InflowWind_Driver_Types.f90 @@ -1,111 +1,530 @@ -!********************************************************************************************************************************** +!STARTOFREGISTRYGENERATEDFILE 'InflowWind_Driver_Types.f90' ! -! MODULE: IfW_Driver_Types - This module contains types used by the InflowWind Driver program to store arguments passed in +! WARNING This file is generated automatically by the FAST registry. +! Do not edit. Your changes to this file will be lost. ! -! The types listed here are used within the InflowWind Driver program to store the settings. These settings are read in as -! command line arguments, then stored within these types. +! FAST Registry +!********************************************************************************************************************************* +! InflowWind_Driver_Types +!................................................................................................................................. +! This file is part of InflowWind_Driver. ! -!********************************************************************************************************************************** +! Copyright (C) 2012-2016 National Renewable Energy Laboratory ! -!.................................................................................................................................. -! LICENSING -! Copyright (C) 2015 National Renewable Energy Laboratory +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at ! -! This file is part of InflowWind. +! http://www.apache.org/licenses/LICENSE-2.0 ! -! InflowWind is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as -! published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. ! -! This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -! of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ! -! You should have received a copy of the GNU General Public License along with InflowWind. -! If not, see . +! W A R N I N G : This file was automatically generated from the FAST registry. Changes made to this file may be lost. ! -!********************************************************************************************************************************** - +!********************************************************************************************************************************* +!> This module contains the user-defined types needed in InflowWind_Driver. It also contains copy, destroy, pack, and +!! unpack routines associated with each defined data type. This code is automatically generated by the FAST Registry. MODULE InflowWind_Driver_Types +!--------------------------------------------------------------------------------------------------------------------------------- +USE NWTC_Library +IMPLICIT NONE +! ========= OutputFile ======= + TYPE, PUBLIC :: OutputFile + character(1024) :: Name !< Filename for output from points read in from points file [-] + INTEGER(IntKi) :: Unit = -1 !< Unit number for the output file for the Points file output [-] + LOGICAL :: Initialized = .false. !< Flag indicating that file has been initialized [-] + END TYPE OutputFile +! ======================= +! ========= IfWDriver_Flags ======= + TYPE, PUBLIC :: IfWDriver_Flags + LOGICAL :: DvrIptFile = .false. !< Was an input file name given on the command line? [-] + LOGICAL :: IfWIptFile = .false. !< Was an InflowWind input file requested? [-] + LOGICAL :: Summary = .false. !< create a summary at command line? (data extents in the wind file) [-] + LOGICAL :: SummaryFile = .false. !< create a summary file of the output? [-] + LOGICAL :: TStart = .false. !< specified a start time [-] + LOGICAL :: NumTimeSteps = .false. !< specified a number of timesteps to process [-] + LOGICAL :: NumTimeStepsDefault = .false. !< specified a 'DEFAULT' for number of timesteps to process [-] + LOGICAL :: DT = .false. !< specified a resolution in time [-] + LOGICAL :: DTDefault = .false. !< specified a 'DEFAULT' for the time resolution [-] + LOGICAL :: FFTcalc = .false. !< do an FFT [-] + LOGICAL :: WindGrid = .false. !< Requested output of wind data on a grid -- input file option only [-] + LOGICAL :: XRange = .false. !< specified a range of x -- command line option only -- stored as GridCtrCoord and GridDelta [-] + LOGICAL :: YRange = .false. !< specified a range of y -- command line option only -- stored as GridCtrCoord and GridDelta [-] + LOGICAL :: ZRange = .false. !< specified a range of z -- command line option only -- stored as GridCtrCoord and GridDelta [-] + LOGICAL :: Dx = .false. !< specified a resolution in x -- command line option only, 0.0 otherwise [-] + LOGICAL :: Dy = .false. !< speficied a resolution in y [-] + LOGICAL :: Dz = .false. !< specified a resolution in z [-] + LOGICAL :: PointsFile = .false. !< points filename to read in [-] + LOGICAL :: OutputAccel = .false. !< flag to calculate and output wind acceleration in addition to velocity [-] + LOGICAL :: Verbose = .false. !< Verbose error reporting [-] + LOGICAL :: VVerbose = .false. !< Very Verbose error reporting [-] + LOGICAL :: BoxExceedAllowF = .false. !< set flag to allow exceeding wind box boundaries for FF files (for diagnostic purposes) [-] + LOGICAL :: WrHAWC = .false. !< Requested file conversion to HAWC2 format? [-] + LOGICAL :: WrBladed = .false. !< Requested file conversion to Bladed format? [-] + LOGICAL :: WrVTK = .false. !< Requested file output as VTK? [-] + LOGICAL :: WrUniform = .false. !< Requested file output as Uniform wind format? [-] + LOGICAL :: XYslice = .false. !< Take XY slice at one elevation [-] + END TYPE IfWDriver_Flags +! ======================= +! ========= IfWDriver_Settings ======= + TYPE, PUBLIC :: IfWDriver_Settings + character(1024) :: DvrIptFileName !< Driver input file name [-] + character(1024) :: IfWIptFileName !< Filename of InflowWind input file to read (if no driver input file) [-] + character(1024) :: SummaryFileName !< Filename for the summary information output [-] + character(1024) :: PointsFileName !< Filename of points file to read in [-] + INTEGER(IntKi) :: NumTimeSteps = 0 !< Number of timesteps [-] + REAL(DbKi) :: DT = 0.0_DbKi !< resolution of time [s] + REAL(DbKi) :: TStart = 0.0_DbKi !< range of time -- end time converted from TRange (command line option only) [s] + REAL(ReKi) :: FFTcoord(1:3) = 0.0_ReKi !< (x,y,z) coordinate to do an FFT at [(m)] + REAL(ReKi) :: GridDelta(1:3) = 0.0_ReKi !< (GridDx,GridDy,GridDz) -- grid point spacing [(m)] + INTEGER(IntKi) :: GridN(1:3) = 1_IntKi !< (GridNx,GridNy,GridNz) -- number of grid points [-] + REAL(ReKi) :: XRange(1:2) = 0.0_ReKi !< Range in the x-direction for the gridded data [(m)] + REAL(ReKi) :: YRange(1:2) = 0.0_ReKi !< Range in the y-direction for the gridded data [(m)] + REAL(ReKi) :: ZRange(1:2) = 0.0_ReKi !< Range in the z-direction for the gridded data [(m)] + TYPE(ProgDesc) :: ProgInfo !< Program info [-] + TYPE(OutputFile) :: WindGridOutput !< Wind grid file handling [-] + TYPE(OutputFile) :: FFTOutput !< FFT file handling [-] + TYPE(OutputFile) :: PointsVelOutput !< Points output velocity file handling [-] + INTEGER(IntKi) :: NOutWindXY = 0 !< Number of XY planes for output .XY.t.vtk [0 to 9] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: OutWindZ !< Z coordinates of XY planes for output [1 to NOutWindXY] [unused for NOutWindXY=0] [(m)] + INTEGER(IntKi) :: NOutWindXZ = 0 !< Number of YZ planes for output .YZ.t.vtk [0 to 9] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: OutWindY !< Y coordinates of YZ planes for output [1 to NOutWindYZ] [unused for NOutWindYZ=0] [(m)] + INTEGER(IntKi) :: NOutWindYZ = 0 !< Number of YZ planes for output .YZ.t.vtk [0 to 9] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: OutWindX !< X coordinates of YZ planes for output [1 to NOutWindYZ] [unused for NOutWindYZ=0] [(m)] + END TYPE IfWDriver_Settings +! ======================= +CONTAINS - USE NWTC_Library - USE InflowWind_Types - - IMPLICIT NONE - - TYPE OutputFile - LOGICAL :: Initialized = .FALSE. !< Flag indicating that file has been initialized - CHARACTER(1024) :: Name = "" !< Filename for output from points read in from points file - INTEGER(IntKi) :: Unit = -1 !< Unit number for the output file for the Points file output - END TYPE - - !> This contains flags to note if the settings were made. This same data structure is - !! used both during the driver input file and the command line options. - !! - !! NOTE: The WindFileType is only set if it is given as a command line option. Otherwise - !! it is handled internally by InflowWInd. - !! - !! NOTE: The wind direction is specified by the InflowWind input file. - TYPE :: IfWDriver_Flags - LOGICAL :: DvrIptFile = .FALSE. !< Was an input file name given on the command line? - LOGICAL :: IfWIptFile = .FALSE. !< Was an InflowWind input file requested? - LOGICAL :: Summary = .FALSE. !< create a summary at command line? (data extents in the wind file) - LOGICAL :: SummaryFile = .FALSE. !< create a summary file of the output? - LOGICAL :: TStart = .FALSE. !< specified a start time - LOGICAL :: NumTimeSteps = .FALSE. !< specified a number of timesteps to process - LOGICAL :: NumTimeStepsDefault = .FALSE. !< specified a 'DEFAULT' for number of timesteps to process - LOGICAL :: DT = .FALSE. !< specified a resolution in time - LOGICAL :: DTDefault = .FALSE. !< specified a 'DEFAULT' for the time resolution - - LOGICAL :: FFTcalc = .FALSE. !< do an FFT - - LOGICAL :: WindGrid = .FALSE. !< Requested output of wind data on a grid -- input file option only - LOGICAL :: XRange = .FALSE. !< specified a range of x -- command line option only -- stored as GridCtrCoord and GridDelta - LOGICAL :: YRange = .FALSE. !< specified a range of y -- command line option only -- stored as GridCtrCoord and GridDelta - LOGICAL :: ZRange = .FALSE. !< specified a range of z -- command line option only -- stored as GridCtrCoord and GridDelta - LOGICAL :: Dx = .FALSE. !< specified a resolution in x -- command line option only, 0.0 otherwise - LOGICAL :: Dy = .FALSE. !< speficied a resolution in y - LOGICAL :: Dz = .FALSE. !< specified a resolution in z - - LOGICAL :: PointsFile = .FALSE. !< points filename to read in - LOGICAL :: OutputAccel = .FALSE. !< flag to calculate and output wind acceleration in addition to velocity - - LOGICAL :: Verbose = .FALSE. !< Verbose error reporting - LOGICAL :: VVerbose = .FALSE. !< Very Verbose error reporting - LOGICAL :: BoxExceedAllowF = .FALSE. !< set flag to allow exceeding wind box boundaries for FF files (for diagnostic purposes) +subroutine InflowWind_Driver_CopyOutputFile(SrcOutputFileData, DstOutputFileData, CtrlCode, ErrStat, ErrMsg) + type(OutputFile), intent(in) :: SrcOutputFileData + type(OutputFile), intent(inout) :: DstOutputFileData + integer(IntKi), intent(in ) :: CtrlCode + integer(IntKi), intent( out) :: ErrStat + character(*), intent( out) :: ErrMsg + character(*), parameter :: RoutineName = 'InflowWind_Driver_CopyOutputFile' + ErrStat = ErrID_None + ErrMsg = '' + DstOutputFileData%Name = SrcOutputFileData%Name + DstOutputFileData%Unit = SrcOutputFileData%Unit + DstOutputFileData%Initialized = SrcOutputFileData%Initialized +end subroutine - LOGICAL :: WrHAWC = .FALSE. !< Requested file conversion to HAWC2 format? - LOGICAL :: WrBladed = .FALSE. !< Requested file conversion to Bladed format? - LOGICAL :: WrVTK = .FALSE. !< Requested file output as VTK? - LOGICAL :: WrUniform = .FALSE. !< Requested file output as Uniform wind format? - END TYPE IfWDriver_Flags +subroutine InflowWind_Driver_DestroyOutputFile(OutputFileData, ErrStat, ErrMsg) + type(OutputFile), intent(inout) :: OutputFileData + integer(IntKi), intent( out) :: ErrStat + character(*), intent( out) :: ErrMsg + character(*), parameter :: RoutineName = 'InflowWind_Driver_DestroyOutputFile' + ErrStat = ErrID_None + ErrMsg = '' +end subroutine +subroutine InflowWind_Driver_PackOutputFile(Buf, Indata) + type(PackBuffer), intent(inout) :: Buf + type(OutputFile), intent(in) :: InData + character(*), parameter :: RoutineName = 'InflowWind_Driver_PackOutputFile' + if (Buf%ErrStat >= AbortErrLev) return + call RegPack(Buf, InData%Name) + call RegPack(Buf, InData%Unit) + call RegPack(Buf, InData%Initialized) + if (RegCheckErr(Buf, RoutineName)) return +end subroutine - ! This contains all the settings (possible passed in arguments). - TYPE :: IfWDriver_Settings - CHARACTER(1024) :: DvrIptFileName = "" !< Driver input file name - CHARACTER(1024) :: IfWIptFileName = "" !< Filename of InflowWind input file to read (if no driver input file) - CHARACTER(1024) :: SummaryFileName = "" !< Filename for the summary information output +subroutine InflowWind_Driver_UnPackOutputFile(Buf, OutData) + type(PackBuffer), intent(inout) :: Buf + type(OutputFile), intent(inout) :: OutData + character(*), parameter :: RoutineName = 'InflowWind_Driver_UnPackOutputFile' + if (Buf%ErrStat /= ErrID_None) return + call RegUnpack(Buf, OutData%Name) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%Unit) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%Initialized) + if (RegCheckErr(Buf, RoutineName)) return +end subroutine - CHARACTER(1024) :: PointsFileName = "" !< Filename of points file to read in - - INTEGER(IntKi) :: NumTimeSteps = 0 !< Number of timesteps - REAL(DbKi) :: DT = 0.0_DbKi !< resolution of time - REAL(DbKi) :: TStart = 0.0_DbKi !< range of time -- end time converted from TRange (command line option only) +subroutine InflowWind_Driver_CopyIfWDriver_Flags(SrcIfWDriver_FlagsData, DstIfWDriver_FlagsData, CtrlCode, ErrStat, ErrMsg) + type(IfWDriver_Flags), intent(in) :: SrcIfWDriver_FlagsData + type(IfWDriver_Flags), intent(inout) :: DstIfWDriver_FlagsData + integer(IntKi), intent(in ) :: CtrlCode + integer(IntKi), intent( out) :: ErrStat + character(*), intent( out) :: ErrMsg + character(*), parameter :: RoutineName = 'InflowWind_Driver_CopyIfWDriver_Flags' + ErrStat = ErrID_None + ErrMsg = '' + DstIfWDriver_FlagsData%DvrIptFile = SrcIfWDriver_FlagsData%DvrIptFile + DstIfWDriver_FlagsData%IfWIptFile = SrcIfWDriver_FlagsData%IfWIptFile + DstIfWDriver_FlagsData%Summary = SrcIfWDriver_FlagsData%Summary + DstIfWDriver_FlagsData%SummaryFile = SrcIfWDriver_FlagsData%SummaryFile + DstIfWDriver_FlagsData%TStart = SrcIfWDriver_FlagsData%TStart + DstIfWDriver_FlagsData%NumTimeSteps = SrcIfWDriver_FlagsData%NumTimeSteps + DstIfWDriver_FlagsData%NumTimeStepsDefault = SrcIfWDriver_FlagsData%NumTimeStepsDefault + DstIfWDriver_FlagsData%DT = SrcIfWDriver_FlagsData%DT + DstIfWDriver_FlagsData%DTDefault = SrcIfWDriver_FlagsData%DTDefault + DstIfWDriver_FlagsData%FFTcalc = SrcIfWDriver_FlagsData%FFTcalc + DstIfWDriver_FlagsData%WindGrid = SrcIfWDriver_FlagsData%WindGrid + DstIfWDriver_FlagsData%XRange = SrcIfWDriver_FlagsData%XRange + DstIfWDriver_FlagsData%YRange = SrcIfWDriver_FlagsData%YRange + DstIfWDriver_FlagsData%ZRange = SrcIfWDriver_FlagsData%ZRange + DstIfWDriver_FlagsData%Dx = SrcIfWDriver_FlagsData%Dx + DstIfWDriver_FlagsData%Dy = SrcIfWDriver_FlagsData%Dy + DstIfWDriver_FlagsData%Dz = SrcIfWDriver_FlagsData%Dz + DstIfWDriver_FlagsData%PointsFile = SrcIfWDriver_FlagsData%PointsFile + DstIfWDriver_FlagsData%OutputAccel = SrcIfWDriver_FlagsData%OutputAccel + DstIfWDriver_FlagsData%Verbose = SrcIfWDriver_FlagsData%Verbose + DstIfWDriver_FlagsData%VVerbose = SrcIfWDriver_FlagsData%VVerbose + DstIfWDriver_FlagsData%BoxExceedAllowF = SrcIfWDriver_FlagsData%BoxExceedAllowF + DstIfWDriver_FlagsData%WrHAWC = SrcIfWDriver_FlagsData%WrHAWC + DstIfWDriver_FlagsData%WrBladed = SrcIfWDriver_FlagsData%WrBladed + DstIfWDriver_FlagsData%WrVTK = SrcIfWDriver_FlagsData%WrVTK + DstIfWDriver_FlagsData%WrUniform = SrcIfWDriver_FlagsData%WrUniform + DstIfWDriver_FlagsData%XYslice = SrcIfWDriver_FlagsData%XYslice +end subroutine - REAL(ReKi) :: FFTcoord(1:3) = 0.0_ReKi !< (x,y,z) coordinate to do an FFT at +subroutine InflowWind_Driver_DestroyIfWDriver_Flags(IfWDriver_FlagsData, ErrStat, ErrMsg) + type(IfWDriver_Flags), intent(inout) :: IfWDriver_FlagsData + integer(IntKi), intent( out) :: ErrStat + character(*), intent( out) :: ErrMsg + character(*), parameter :: RoutineName = 'InflowWind_Driver_DestroyIfWDriver_Flags' + ErrStat = ErrID_None + ErrMsg = '' +end subroutine - REAL(ReKi) :: GridDelta(1:3) = 0.0_ReKi !< (GridDx,GridDy,GridDz) -- grid point spacing - INTEGER(IntKi) :: GridN(1:3) = 1_IntKi !< (GridNx,GridNy,GridNz) -- number of grid points +subroutine InflowWind_Driver_PackIfWDriver_Flags(Buf, Indata) + type(PackBuffer), intent(inout) :: Buf + type(IfWDriver_Flags), intent(in) :: InData + character(*), parameter :: RoutineName = 'InflowWind_Driver_PackIfWDriver_Flags' + if (Buf%ErrStat >= AbortErrLev) return + call RegPack(Buf, InData%DvrIptFile) + call RegPack(Buf, InData%IfWIptFile) + call RegPack(Buf, InData%Summary) + call RegPack(Buf, InData%SummaryFile) + call RegPack(Buf, InData%TStart) + call RegPack(Buf, InData%NumTimeSteps) + call RegPack(Buf, InData%NumTimeStepsDefault) + call RegPack(Buf, InData%DT) + call RegPack(Buf, InData%DTDefault) + call RegPack(Buf, InData%FFTcalc) + call RegPack(Buf, InData%WindGrid) + call RegPack(Buf, InData%XRange) + call RegPack(Buf, InData%YRange) + call RegPack(Buf, InData%ZRange) + call RegPack(Buf, InData%Dx) + call RegPack(Buf, InData%Dy) + call RegPack(Buf, InData%Dz) + call RegPack(Buf, InData%PointsFile) + call RegPack(Buf, InData%OutputAccel) + call RegPack(Buf, InData%Verbose) + call RegPack(Buf, InData%VVerbose) + call RegPack(Buf, InData%BoxExceedAllowF) + call RegPack(Buf, InData%WrHAWC) + call RegPack(Buf, InData%WrBladed) + call RegPack(Buf, InData%WrVTK) + call RegPack(Buf, InData%WrUniform) + call RegPack(Buf, InData%XYslice) + if (RegCheckErr(Buf, RoutineName)) return +end subroutine - REAL(ReKi) :: XRange(1:2) = 0.0_ReKi !< Range in the x-direction for the gridded data - REAL(ReKi) :: YRange(1:2) = 0.0_ReKi !< Range in the y-direction for the gridded data - REAL(ReKi) :: ZRange(1:2) = 0.0_ReKi !< Range in the z-direction for the gridded data +subroutine InflowWind_Driver_UnPackIfWDriver_Flags(Buf, OutData) + type(PackBuffer), intent(inout) :: Buf + type(IfWDriver_Flags), intent(inout) :: OutData + character(*), parameter :: RoutineName = 'InflowWind_Driver_UnPackIfWDriver_Flags' + if (Buf%ErrStat /= ErrID_None) return + call RegUnpack(Buf, OutData%DvrIptFile) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%IfWIptFile) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%Summary) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%SummaryFile) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%TStart) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%NumTimeSteps) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%NumTimeStepsDefault) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%DT) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%DTDefault) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%FFTcalc) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%WindGrid) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%XRange) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%YRange) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%ZRange) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%Dx) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%Dy) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%Dz) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%PointsFile) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%OutputAccel) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%Verbose) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%VVerbose) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%BoxExceedAllowF) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%WrHAWC) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%WrBladed) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%WrVTK) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%WrUniform) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%XYslice) + if (RegCheckErr(Buf, RoutineName)) return +end subroutine - TYPE(ProgDesc) :: ProgInfo !< Program info - TYPE(OutputFile) :: WindGridOutput - TYPE(OutputFile) :: FFTOutput - TYPE(OutputFile) :: PointsVelOutput +subroutine InflowWind_Driver_CopyIfWDriver_Settings(SrcIfWDriver_SettingsData, DstIfWDriver_SettingsData, CtrlCode, ErrStat, ErrMsg) + type(IfWDriver_Settings), intent(in) :: SrcIfWDriver_SettingsData + type(IfWDriver_Settings), intent(inout) :: DstIfWDriver_SettingsData + integer(IntKi), intent(in ) :: CtrlCode + integer(IntKi), intent( out) :: ErrStat + character(*), intent( out) :: ErrMsg + integer(IntKi) :: LB(1), UB(1) + integer(IntKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + character(*), parameter :: RoutineName = 'InflowWind_Driver_CopyIfWDriver_Settings' + ErrStat = ErrID_None + ErrMsg = '' + DstIfWDriver_SettingsData%DvrIptFileName = SrcIfWDriver_SettingsData%DvrIptFileName + DstIfWDriver_SettingsData%IfWIptFileName = SrcIfWDriver_SettingsData%IfWIptFileName + DstIfWDriver_SettingsData%SummaryFileName = SrcIfWDriver_SettingsData%SummaryFileName + DstIfWDriver_SettingsData%PointsFileName = SrcIfWDriver_SettingsData%PointsFileName + DstIfWDriver_SettingsData%NumTimeSteps = SrcIfWDriver_SettingsData%NumTimeSteps + DstIfWDriver_SettingsData%DT = SrcIfWDriver_SettingsData%DT + DstIfWDriver_SettingsData%TStart = SrcIfWDriver_SettingsData%TStart + DstIfWDriver_SettingsData%FFTcoord(1:3) = SrcIfWDriver_SettingsData%FFTcoord(1:3) + DstIfWDriver_SettingsData%GridDelta(1:3) = SrcIfWDriver_SettingsData%GridDelta(1:3) + DstIfWDriver_SettingsData%GridN(1:3) = SrcIfWDriver_SettingsData%GridN(1:3) + DstIfWDriver_SettingsData%XRange(1:2) = SrcIfWDriver_SettingsData%XRange(1:2) + DstIfWDriver_SettingsData%YRange(1:2) = SrcIfWDriver_SettingsData%YRange(1:2) + DstIfWDriver_SettingsData%ZRange(1:2) = SrcIfWDriver_SettingsData%ZRange(1:2) + call NWTC_Library_CopyProgDesc(SrcIfWDriver_SettingsData%ProgInfo, DstIfWDriver_SettingsData%ProgInfo, CtrlCode, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + call InflowWind_Driver_CopyOutputFile(SrcIfWDriver_SettingsData%WindGridOutput, DstIfWDriver_SettingsData%WindGridOutput, CtrlCode, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + call InflowWind_Driver_CopyOutputFile(SrcIfWDriver_SettingsData%FFTOutput, DstIfWDriver_SettingsData%FFTOutput, CtrlCode, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + call InflowWind_Driver_CopyOutputFile(SrcIfWDriver_SettingsData%PointsVelOutput, DstIfWDriver_SettingsData%PointsVelOutput, CtrlCode, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + DstIfWDriver_SettingsData%NOutWindXY = SrcIfWDriver_SettingsData%NOutWindXY + if (allocated(SrcIfWDriver_SettingsData%OutWindZ)) then + LB(1:1) = lbound(SrcIfWDriver_SettingsData%OutWindZ) + UB(1:1) = ubound(SrcIfWDriver_SettingsData%OutWindZ) + if (.not. allocated(DstIfWDriver_SettingsData%OutWindZ)) then + allocate(DstIfWDriver_SettingsData%OutWindZ(LB(1):UB(1)), stat=ErrStat2) + if (ErrStat2 /= 0) then + call SetErrStat(ErrID_Fatal, 'Error allocating DstIfWDriver_SettingsData%OutWindZ.', ErrStat, ErrMsg, RoutineName) + return + end if + end if + DstIfWDriver_SettingsData%OutWindZ = SrcIfWDriver_SettingsData%OutWindZ + end if + DstIfWDriver_SettingsData%NOutWindXZ = SrcIfWDriver_SettingsData%NOutWindXZ + if (allocated(SrcIfWDriver_SettingsData%OutWindY)) then + LB(1:1) = lbound(SrcIfWDriver_SettingsData%OutWindY) + UB(1:1) = ubound(SrcIfWDriver_SettingsData%OutWindY) + if (.not. allocated(DstIfWDriver_SettingsData%OutWindY)) then + allocate(DstIfWDriver_SettingsData%OutWindY(LB(1):UB(1)), stat=ErrStat2) + if (ErrStat2 /= 0) then + call SetErrStat(ErrID_Fatal, 'Error allocating DstIfWDriver_SettingsData%OutWindY.', ErrStat, ErrMsg, RoutineName) + return + end if + end if + DstIfWDriver_SettingsData%OutWindY = SrcIfWDriver_SettingsData%OutWindY + end if + DstIfWDriver_SettingsData%NOutWindYZ = SrcIfWDriver_SettingsData%NOutWindYZ + if (allocated(SrcIfWDriver_SettingsData%OutWindX)) then + LB(1:1) = lbound(SrcIfWDriver_SettingsData%OutWindX) + UB(1:1) = ubound(SrcIfWDriver_SettingsData%OutWindX) + if (.not. allocated(DstIfWDriver_SettingsData%OutWindX)) then + allocate(DstIfWDriver_SettingsData%OutWindX(LB(1):UB(1)), stat=ErrStat2) + if (ErrStat2 /= 0) then + call SetErrStat(ErrID_Fatal, 'Error allocating DstIfWDriver_SettingsData%OutWindX.', ErrStat, ErrMsg, RoutineName) + return + end if + end if + DstIfWDriver_SettingsData%OutWindX = SrcIfWDriver_SettingsData%OutWindX + end if +end subroutine - END TYPE IfWDriver_Settings +subroutine InflowWind_Driver_DestroyIfWDriver_Settings(IfWDriver_SettingsData, ErrStat, ErrMsg) + type(IfWDriver_Settings), intent(inout) :: IfWDriver_SettingsData + integer(IntKi), intent( out) :: ErrStat + character(*), intent( out) :: ErrMsg + integer(IntKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + character(*), parameter :: RoutineName = 'InflowWind_Driver_DestroyIfWDriver_Settings' + ErrStat = ErrID_None + ErrMsg = '' + call NWTC_Library_DestroyProgDesc(IfWDriver_SettingsData%ProgInfo, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call InflowWind_Driver_DestroyOutputFile(IfWDriver_SettingsData%WindGridOutput, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call InflowWind_Driver_DestroyOutputFile(IfWDriver_SettingsData%FFTOutput, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call InflowWind_Driver_DestroyOutputFile(IfWDriver_SettingsData%PointsVelOutput, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (allocated(IfWDriver_SettingsData%OutWindZ)) then + deallocate(IfWDriver_SettingsData%OutWindZ) + end if + if (allocated(IfWDriver_SettingsData%OutWindY)) then + deallocate(IfWDriver_SettingsData%OutWindY) + end if + if (allocated(IfWDriver_SettingsData%OutWindX)) then + deallocate(IfWDriver_SettingsData%OutWindX) + end if +end subroutine +subroutine InflowWind_Driver_PackIfWDriver_Settings(Buf, Indata) + type(PackBuffer), intent(inout) :: Buf + type(IfWDriver_Settings), intent(in) :: InData + character(*), parameter :: RoutineName = 'InflowWind_Driver_PackIfWDriver_Settings' + if (Buf%ErrStat >= AbortErrLev) return + call RegPack(Buf, InData%DvrIptFileName) + call RegPack(Buf, InData%IfWIptFileName) + call RegPack(Buf, InData%SummaryFileName) + call RegPack(Buf, InData%PointsFileName) + call RegPack(Buf, InData%NumTimeSteps) + call RegPack(Buf, InData%DT) + call RegPack(Buf, InData%TStart) + call RegPack(Buf, InData%FFTcoord(1:3)) + call RegPack(Buf, InData%GridDelta(1:3)) + call RegPack(Buf, InData%GridN(1:3)) + call RegPack(Buf, InData%XRange(1:2)) + call RegPack(Buf, InData%YRange(1:2)) + call RegPack(Buf, InData%ZRange(1:2)) + call NWTC_Library_PackProgDesc(Buf, InData%ProgInfo) + call InflowWind_Driver_PackOutputFile(Buf, InData%WindGridOutput) + call InflowWind_Driver_PackOutputFile(Buf, InData%FFTOutput) + call InflowWind_Driver_PackOutputFile(Buf, InData%PointsVelOutput) + call RegPack(Buf, InData%NOutWindXY) + call RegPack(Buf, allocated(InData%OutWindZ)) + if (allocated(InData%OutWindZ)) then + call RegPackBounds(Buf, 1, lbound(InData%OutWindZ), ubound(InData%OutWindZ)) + call RegPack(Buf, InData%OutWindZ) + end if + call RegPack(Buf, InData%NOutWindXZ) + call RegPack(Buf, allocated(InData%OutWindY)) + if (allocated(InData%OutWindY)) then + call RegPackBounds(Buf, 1, lbound(InData%OutWindY), ubound(InData%OutWindY)) + call RegPack(Buf, InData%OutWindY) + end if + call RegPack(Buf, InData%NOutWindYZ) + call RegPack(Buf, allocated(InData%OutWindX)) + if (allocated(InData%OutWindX)) then + call RegPackBounds(Buf, 1, lbound(InData%OutWindX), ubound(InData%OutWindX)) + call RegPack(Buf, InData%OutWindX) + end if + if (RegCheckErr(Buf, RoutineName)) return +end subroutine +subroutine InflowWind_Driver_UnPackIfWDriver_Settings(Buf, OutData) + type(PackBuffer), intent(inout) :: Buf + type(IfWDriver_Settings), intent(inout) :: OutData + character(*), parameter :: RoutineName = 'InflowWind_Driver_UnPackIfWDriver_Settings' + integer(IntKi) :: LB(1), UB(1) + integer(IntKi) :: stat + logical :: IsAllocAssoc + if (Buf%ErrStat /= ErrID_None) return + call RegUnpack(Buf, OutData%DvrIptFileName) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%IfWIptFileName) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%SummaryFileName) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%PointsFileName) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%NumTimeSteps) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%DT) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%TStart) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%FFTcoord(1:3)) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%GridDelta(1:3)) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%GridN(1:3)) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%XRange(1:2)) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%YRange(1:2)) + if (RegCheckErr(Buf, RoutineName)) return + call RegUnpack(Buf, OutData%ZRange(1:2)) + if (RegCheckErr(Buf, RoutineName)) return + call NWTC_Library_UnpackProgDesc(Buf, OutData%ProgInfo) ! ProgInfo + call InflowWind_Driver_UnpackOutputFile(Buf, OutData%WindGridOutput) ! WindGridOutput + call InflowWind_Driver_UnpackOutputFile(Buf, OutData%FFTOutput) ! FFTOutput + call InflowWind_Driver_UnpackOutputFile(Buf, OutData%PointsVelOutput) ! PointsVelOutput + call RegUnpack(Buf, OutData%NOutWindXY) + if (RegCheckErr(Buf, RoutineName)) return + if (allocated(OutData%OutWindZ)) deallocate(OutData%OutWindZ) + call RegUnpack(Buf, IsAllocAssoc) + if (RegCheckErr(Buf, RoutineName)) return + if (IsAllocAssoc) then + call RegUnpackBounds(Buf, 1, LB, UB) + if (RegCheckErr(Buf, RoutineName)) return + allocate(OutData%OutWindZ(LB(1):UB(1)),stat=stat) + if (stat /= 0) then + call SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutWindZ.', Buf%ErrStat, Buf%ErrMsg, RoutineName) + return + end if + call RegUnpack(Buf, OutData%OutWindZ) + if (RegCheckErr(Buf, RoutineName)) return + end if + call RegUnpack(Buf, OutData%NOutWindXZ) + if (RegCheckErr(Buf, RoutineName)) return + if (allocated(OutData%OutWindY)) deallocate(OutData%OutWindY) + call RegUnpack(Buf, IsAllocAssoc) + if (RegCheckErr(Buf, RoutineName)) return + if (IsAllocAssoc) then + call RegUnpackBounds(Buf, 1, LB, UB) + if (RegCheckErr(Buf, RoutineName)) return + allocate(OutData%OutWindY(LB(1):UB(1)),stat=stat) + if (stat /= 0) then + call SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutWindY.', Buf%ErrStat, Buf%ErrMsg, RoutineName) + return + end if + call RegUnpack(Buf, OutData%OutWindY) + if (RegCheckErr(Buf, RoutineName)) return + end if + call RegUnpack(Buf, OutData%NOutWindYZ) + if (RegCheckErr(Buf, RoutineName)) return + if (allocated(OutData%OutWindX)) deallocate(OutData%OutWindX) + call RegUnpack(Buf, IsAllocAssoc) + if (RegCheckErr(Buf, RoutineName)) return + if (IsAllocAssoc) then + call RegUnpackBounds(Buf, 1, LB, UB) + if (RegCheckErr(Buf, RoutineName)) return + allocate(OutData%OutWindX(LB(1):UB(1)),stat=stat) + if (stat /= 0) then + call SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutWindX.', Buf%ErrStat, Buf%ErrMsg, RoutineName) + return + end if + call RegUnpack(Buf, OutData%OutWindX) + if (RegCheckErr(Buf, RoutineName)) return + end if +end subroutine END MODULE InflowWind_Driver_Types +!ENDOFREGISTRYGENERATEDFILE diff --git a/modules/inflowwind/src/InflowWind_IO.f90 b/modules/inflowwind/src/InflowWind_IO.f90 index 96c2d7e21c..2777a0bed7 100644 --- a/modules/inflowwind/src/InflowWind_IO.f90 +++ b/modules/inflowwind/src/InflowWind_IO.f90 @@ -39,7 +39,8 @@ module InflowWind_IO public :: Uniform_WriteHH, & Grid3D_WriteBladed, & Grid3D_WriteHAWC, & - Grid3D_WriteVTK + Grid3D_WriteVTK, & + Grid3D_WriteVTKsliceXY type(ProgDesc), parameter :: InflowWind_IO_Ver = ProgDesc('InflowWind_IO', '', '') @@ -2924,4 +2925,82 @@ subroutine Grid3D_WriteHAWC(G3D, FileRootName, unit, ErrStat, ErrMsg) end subroutine Grid3D_WriteHAWC + +subroutine Grid3D_WriteVTKsliceXY(G3D, FileRootName, XYslice_height, unit, ErrStat, ErrMsg) + + type(Grid3DFieldType), intent(in) :: G3D !< Parameters + character(*), intent(in) :: FileRootName !< RootName for output files + real(ReKi), intent(in) :: XYslice_height + integer(IntKi), intent(in) :: unit !< Error status of the operation + integer(IntKi), intent(out) :: ErrStat !< Error status of the operation + character(*), intent(out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + character(*), parameter :: RoutineName = 'Grid3D_WriteVTKsliceXY' + character(1024) :: RootPathName + character(1024) :: FileName + character(3) :: ht_str + integer :: it !< time index for slice + integer :: ix + integer :: iy + integer :: iz + real(ReKi) :: time !< time for this slice + real(ReKi) :: ht !< nearest grid slice elevation + integer(IntKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + + ErrStat = ErrID_None + ErrMsg = "" + + call GetPath(FileRootName, RootPathName) + RootPathName = trim(RootPathName)//PathSep//"vtk" + call MkDir(trim(RootPathName)) ! make this directory if it doesn't already exist + + ! get indices for this slice + iz = nint((G3D%GridBase + XYslice_height)*G3D%InvDZ) + ht = real(iz,ReKi) / G3D%InvDZ + G3D%GridBase ! nearest height index + write(ht_str,'(i3)') nint(ht) + + ! check for errors in slice height + if (iz <= 0_IntKi .or. iz > G3D%NZGrids) then + call SetErrStat(ErrID_Warn,"No grid points near XY slice height of "//trim(num2lstr(XYslice_height))//". Skipping writing slice file.",ErrStat,ErrMsg,RoutineName) + return + endif + + ! Loop through time steps + do it = 1, G3D%NSteps + + time = real(it - 1, ReKi)*G3D%DTime + + ! Create the output vtk file with naming /vtk/DisYZ.t.vtk + FileName = trim(RootPathName)//PathSep//"DisXY.Z"//ht_str//".t"//trim(num2lstr(it))//".vtp" + + ! see WrVTK_SP_header + call OpenFOutFile(unit, TRIM(FileName), ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + + write (unit, '(A)') '# vtk DataFile Version 3.0' + write (unit, '(A)') "InflowWind XY Slice at T= "//trim(num2lstr(time))//" s" + write (unit, '(A)') 'ASCII' + write (unit, '(A)') 'DATASET STRUCTURED_POINTS' + + ! Note: gridVals must be stored such that the left-most dimension is X + ! and the right-most dimension is Z (see WrVTK_SP_vectors3D) + write (unit, '(A,3(i5,1X))') 'DIMENSIONS ', G3D%NSteps, G3D%NYGrids, 1 + write (unit, '(A,3(f10.2,1X))') 'ORIGIN ', G3D%InitXPosition+time*G3D%MeanWS, -G3D%YHWid, ht + write (unit, '(A,3(f10.2,1X))') 'SPACING ', -G3D%Dtime*G3D%MeanWS, 1.0_ReKi/G3D%InvDY, 0.0_ReKi + write (unit, '(A,i9)') 'POINT_DATA ', G3D%NSteps*G3D%NYGrids + write (unit, '(A)') 'VECTORS DisXY float' + + do iy = 1, G3D%NYGrids + do ix = 1, G3D%NSteps ! time and X are interchangeable + write (unit, '(3(f10.2,1X))') G3D%Vel(:, iy, iz, ix) + end do + end do + + close (unit) + enddo + +end subroutine Grid3D_WriteVTKsliceXY + end module InflowWind_IO diff --git a/reg_tests/r-test b/reg_tests/r-test index 3e92b0bdc7..b7213a3858 160000 --- a/reg_tests/r-test +++ b/reg_tests/r-test @@ -1 +1 @@ -Subproject commit 3e92b0bdc7b1a641649d94b92f99397c5669b9b3 +Subproject commit b7213a38581cb306f6a516b75c2d23bd28778cf6 diff --git a/vs-build/InflowWind/InflowWind_driver.vfproj b/vs-build/InflowWind/InflowWind_driver.vfproj index ceb7f5b44f..79d45de673 100644 --- a/vs-build/InflowWind/InflowWind_driver.vfproj +++ b/vs-build/InflowWind/InflowWind_driver.vfproj @@ -124,6 +124,23 @@ + + + + + + + + + + + + + + + + + diff --git a/vs-build/RunRegistry.bat b/vs-build/RunRegistry.bat index f7d9623019..9483cadf4b 100644 --- a/vs-build/RunRegistry.bat +++ b/vs-build/RunRegistry.bat @@ -132,6 +132,12 @@ SET Output_Loc=%CURR_LOC% %REGISTRY% "%CURR_LOC%\%ModuleName%.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -noextrap -O "%Output_Loc%" GOTO checkError +:InflowWind_Driver +SET CURR_LOC=%IfW_Loc% +SET Output_Loc=%CURR_LOC% +%REGISTRY% "%CURR_LOC%\%ModuleName%_Registry.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -noextrap -O "%Output_Loc%" +GOTO checkError + :OpenFOAM SET CURR_LOC=%OpFM_Loc% SET Output_Loc=%CURR_LOC%