Skip to content

Commit 32aa490

Browse files
committed
Merge remote-tracking branch 'OpenFAST/dev' into m/3.5.5_to_dev
2 parents acf1739 + 40202bb commit 32aa490

File tree

9 files changed

+831
-500
lines changed

9 files changed

+831
-500
lines changed

docs/source/user/inflowwind/examples/inflowwind_driver_example.inp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@ InflowWind driver input file.
2424
6,0,15 GridCtrCoord -- coordinate of center of grid (m)
2525
1,1,0 GridDx,GridDY,GridDZ -- Step size of grid (m)
2626
1,1,0 GridNx,GridNY,GridNZ -- number of grid points in X, Y and Z directions (-)
27+
---- Output VTK slices ------------------------------------------------------
28+
0 NOutWindXY -- Number of XY planes for output <RootName>.XY<loc>.t<n>.vtk (-) [0 to 9]
29+
90 OutWindZ -- Z coordinates of XY planes for output (m) [1 to NOutWindXY] [unused for NOutWindXY=0]
30+
0 NOutWindXZ -- Number of XZ planes for output <RootName>.YZ<loc>.t<n>.vtk (-) [0 to 9]
31+
0 OutWindY -- Y coordinates of XZ planes for output (m) [1 to NOutWindXZ] [unused for NOutWindXZ=0]
32+
0 NOutWindYZ -- Number of YZ planes for output <RootName>.YZ<loc>.t<n>.vtk (-) [0 to 9]
33+
0 OutWindX -- X coordinates of YZ planes for output (m) [1 to NOutWindYZ] [unused for NOutWindYZ=0]
2734
END of driver input file

modules/inflowwind/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ if (GENERATE_TYPES)
1919
generate_f90_types(src/InflowWind_IO.txt ${CMAKE_CURRENT_LIST_DIR}/src/InflowWind_IO_Types.f90 -noextrap)
2020
generate_f90_types(src/Lidar.txt ${CMAKE_CURRENT_LIST_DIR}/src/Lidar_Types.f90)
2121
generate_f90_types(src/InflowWind.txt ${CMAKE_CURRENT_LIST_DIR}/src/InflowWind_Types.f90)
22+
generate_f90_types(src/InflowWind_Driver_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/InflowWind_Driver_Types.f90 -noextrap)
2223
endif()
2324

2425
# InflowWind object library

modules/inflowwind/src/InflowWind_Driver.f90

Lines changed: 68 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ PROGRAM InflowWind_Driver
3939
TYPE( ProgDesc ), PARAMETER :: ProgInfo = ProgDesc("InflowWind_Driver","","")
4040
INTEGER(IntKi) :: IfWDriver_Verbose = 5 ! Verbose level. 0 = none, 5 = some, 10 = lots
4141

42+
! output paths hard coded
43+
CHARACTER(*), PARAMETER :: VTKsliceDir = "vtk" ! Directory to place the output VTK slices
44+
4245
! Types needed here (from InflowWind module)
4346
TYPE(InflowWind_InitInputType) :: InflowWind_InitInp ! Data for initialization -- this is where the input info goes
4447
TYPE(InflowWind_InputType) :: InflowWind_u1 ! input -- contains xyz coords of interest -- set 1
@@ -116,8 +119,23 @@ PROGRAM InflowWind_Driver
116119
CALL CPU_TIME( Timer(1) )
117120

118121
! Set some CLSettings to null/default values
119-
CLSettings%ProgInfo = ProgInfo
120-
Settings%ProgInfo = ProgInfo
122+
CLSettings%ProgInfo = ProgInfo
123+
Settings%ProgInfo = ProgInfo
124+
! Set the filenames to empty strings -- otherwise prints garbage with the -vv option
125+
CLSettings%DvrIptFileName = ''
126+
CLSettings%IfWIptFileName = ''
127+
CLSettings%SummaryFileName = ''
128+
CLSettings%PointsFileName = ''
129+
CLSettings%WindGridOutput%Name = ''
130+
CLSettings%FFTOutput%Name = ''
131+
CLSettings%PointsVelOutput%Name = ''
132+
Settings%DvrIptFileName = ''
133+
Settings%IfWIptFileName = ''
134+
Settings%SummaryFileName = ''
135+
Settings%PointsFileName = ''
136+
Settings%WindGridOutput%Name = ''
137+
Settings%FFTOutput%Name = ''
138+
Settings%PointsVelOutput%Name = ''
121139

122140
!--------------------------------------------------------------------------------------------------------------------------------
123141
!-=-=- Parse the command line inputs -=-=-
@@ -419,92 +437,61 @@ PROGRAM InflowWind_Driver
419437
InflowWind_p%FlowField%Grid3D%BoxExceedAllowDrv = .true.
420438
end if
421439

422-
! Make sure no errors occured that give us reason to terminate now.
423-
IF ( ErrStat >= AbortErrLev ) THEN
424-
CALL DriverCleanup()
425-
CALL ProgAbort( ErrMsg )
426-
ELSEIF ( ErrStat /= ErrID_None ) THEN
427-
IF ( IfWDriver_Verbose >= 7_IntKi ) THEN
428-
CALL WrScr(NewLine//' InflowWind_Init returned: ErrStat: '//TRIM(Num2LStr(ErrStat))// &
429-
NewLine//' ErrMsg: '//TRIM(ErrMsg)//NewLine)
430-
ELSEIF ( ErrStat >= ErrID_Warn ) THEN
431-
CALL ProgWarn( ErrMsg )
432-
ELSE
433-
CALL WrScr(TRIM(ErrMsg))
434-
ENDIF
435-
ENDIF
436-
440+
call CheckCallErr('InflowWind_Init')
437441

438442

439-
! Let user know we returned from the InflowWind code if verbose
440-
IF ( IfWDriver_Verbose >= 5_IntKi ) CALL WrScr(NewLine//'InflowWind_Init CALL returned without errors.'//NewLine)
441-
442443

443444
! Convert InflowWind file to HAWC format
444445
IF (SettingsFlags%WrHAWC) THEN
445446
CALL IfW_WriteHAWC( InflowWind_p%FlowField, InflowWind_InitInp%RootName, ErrStat, ErrMsg )
446-
IF (ErrStat > ErrID_None) THEN
447-
CALL WrScr( TRIM(ErrMsg) )
448-
IF ( ErrStat >= AbortErrLev ) THEN
449-
CALL DriverCleanup()
450-
CALL ProgAbort( ErrMsg )
451-
ELSEIF ( IfWDriver_Verbose >= 7_IntKi ) THEN
452-
CALL WrScr(NewLine//' IfW_WriteHAWC returned: ErrStat: '//TRIM(Num2LStr(ErrStat)))
453-
END IF
454-
ELSE IF ( IfWDriver_Verbose >= 5_IntKi ) THEN
455-
CALL WrScr(NewLine//'IfW_WriteHAWC CALL returned without errors.'//NewLine)
456-
END IF
447+
call CheckCallErr('IfW_WriteHAWC')
457448
END IF
458449

459450

460451
! Convert InflowWind file to Native Bladed format
461452
IF (SettingsFlags%WrBladed) THEN
462453
CALL IfW_WriteBladed( InflowWind_p%FlowField, InflowWind_InitInp%RootName, ErrStat, ErrMsg )
463-
IF (ErrStat > ErrID_None) THEN
464-
CALL WrScr( TRIM(ErrMsg) )
465-
IF ( ErrStat >= AbortErrLev ) THEN
466-
CALL DriverCleanup()
467-
CALL ProgAbort( ErrMsg )
468-
ELSEIF ( IfWDriver_Verbose >= 7_IntKi ) THEN
469-
CALL WrScr(NewLine//' InflowWind_Convert2Bladed returned: ErrStat: '//TRIM(Num2LStr(ErrStat)))
470-
END IF
471-
ELSE IF ( IfWDriver_Verbose >= 5_IntKi ) THEN
472-
CALL WrScr(NewLine//'InflowWind_Convert2Bladed CALL returned without errors.'//NewLine)
473-
END IF
454+
call CheckCallErr('IfW_WriteBladed')
474455
END IF
475456

457+
476458
IF (SettingsFlags%WrVTK) THEN
477459
CALL IfW_WriteVTK( InflowWind_p%FlowField, InflowWind_InitInp%RootName, ErrStat, ErrMsg )
478-
IF (ErrStat > ErrID_None) THEN
479-
CALL WrScr( TRIM(ErrMsg) )
480-
IF ( ErrStat >= AbortErrLev ) THEN
481-
CALL DriverCleanup()
482-
CALL ProgAbort( ErrMsg )
483-
ELSEIF ( IfWDriver_Verbose >= 7_IntKi ) THEN
484-
CALL WrScr(NewLine//' IfW_WriteVTK returned: ErrStat: '//TRIM(Num2LStr(ErrStat)))
485-
END IF
486-
ELSE IF ( IfWDriver_Verbose >= 5_IntKi ) THEN
487-
CALL WrScr(NewLine//'IfW_WriteVTK CALL returned without errors.'//NewLine)
488-
END IF
489-
460+
call CheckCallErr('IfW_WriteVTK')
490461
END IF
491462

492463

493464
IF (SettingsFlags%WrUniform) THEN
494465
CALL IfW_WriteUniform( InflowWind_p%FlowField, InflowWind_InitInp%RootName, ErrStat, ErrMsg )
495-
IF (ErrStat > ErrID_None) THEN
496-
CALL WrScr( TRIM(ErrMsg) )
497-
IF ( ErrStat >= AbortErrLev ) THEN
498-
CALL DriverCleanup()
499-
CALL ProgAbort( ErrMsg )
500-
ELSEIF ( IfWDriver_Verbose >= 7_IntKi ) THEN
501-
CALL WrScr(NewLine//' IfW_WriteUniform returned: ErrStat: '//TRIM(Num2LStr(ErrStat)))
502-
END IF
503-
ELSE IF ( IfWDriver_Verbose >= 5_IntKi ) THEN
504-
CALL WrScr(NewLine//'IfW_WriteUniform CALL returned without errors.'//NewLine)
505-
END IF
466+
call CheckCallErr('IfW_WriteUniform')
506467
END IF
507468

469+
470+
IF (Settings%NOutWindXY>0) THEN
471+
do i=1,Settings%NOutWindXY
472+
CALL IfW_WriteXYslice( InflowWind_p%FlowField, InflowWind_InitInp%RootName, VTKsliceDir, Settings%OutWindZ(i), ErrStat, ErrMsg )
473+
call CheckCallErr('IfW_WriteXYslice'//trim(Num2LStr(i)))
474+
enddo
475+
END IF
476+
477+
478+
!FIXME: future developent
479+
! IF (Settings%NOutWindXZ>0) THEN
480+
! do i=1,Settings%NOutWindXZ
481+
! CALL IfW_WriteXZslice( InflowWind_p%FlowField, InflowWind_InitInp%RootName, VTKsliceDir, Settings%OutWindY(i), ErrStat, ErrMsg )
482+
! call CheckCallErr('IfW_WriteXZslice'//trim(Num2LStr(i)))
483+
! enddo
484+
! END IF
485+
486+
487+
! IF (Settings%NOutWindYZ>0) THEN
488+
! do i=1,Settings%NOutWindYZ
489+
! CALL IfW_WriteYZslice( InflowWind_p%FlowField, InflowWind_InitInp%RootName, VTKsliceDir, Settings%OutWindX(i), ErrStat, ErrMsg )
490+
! call CheckCallErr('IfW_WriteYZslice'//trim(Num2LStr(i)))
491+
! enddo
492+
! END IF
493+
494+
508495
!--------------------------------------------------------------------------------------------------------------------------------
509496
!-=-=- Other Setup -=-=-
510497
!--------------------------------------------------------------------------------------------------------------------------------
@@ -942,6 +929,22 @@ SUBROUTINE DriverCleanup()
942929

943930
END SUBROUTINE DriverCleanup
944931

932+
subroutine CheckCallErr(RoutineName)
933+
character(*), intent(in) :: RoutineName
934+
if (ErrStat > ErrID_None) then
935+
call WrScr( trim(ErrMsg) )
936+
if ( ErrStat >= AbortErrLev ) then
937+
call DriverCleanup()
938+
call ProgAbort( ErrMsg )
939+
elseif ( IfWDriver_Verbose >= 7_IntKi ) then
940+
call WrScr(NewLine//' '//trim(RoutineName)//' returned: ErrStat: '//TRIM(Num2LStr(ErrStat)))
941+
endif
942+
elseif ( IfWDriver_Verbose >= 5_IntKi ) then
943+
CALL WrScr(NewLine//trim(RoutineName)//' CALL returned without errors.'//NewLine)
944+
endif
945+
end subroutine CheckCallErr
946+
947+
945948
END PROGRAM InflowWind_Driver
946949

947950

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#----------------------------------------------------------------------------------------------------------------------------------
2+
# Registry for IfW_Interp, creates MODULE IfW_Interp_Types
3+
# Module IfW_Interp_Types contains all of the user-defined types needed in IfW_FF. It also contains copy, destroy, pack, and
4+
# unpack routines associated with each defined data types.
5+
#----------------------------------------------------------------------------------------------------------------------------------
6+
# keyword <Module> <TypeName> <FieldType> <FieldName> <Dims> <Ctrl> <DNA ME> <DESCRIP> <UNITS>
7+
#----------------------------------------------------------------------------------------------------------------------------------
8+
9+
include Registry_NWTC_Library.txt
10+
11+
#----------------------------------------------------------------------------------------------------------------------------------
12+
typedef InflowWind_Driver OutputFile character(1024) Name - "" - "Filename for output from points read in from points file" -
13+
typedef ^ ^ integer Unit - -1 - "Unit number for the output file for the Points file output" -
14+
typedef ^ ^ logical Initialized - .false. - "Flag indicating that file has been initialized" -
15+
16+
# This contains flags to note if the settings were made. This same data structure is
17+
# used both during the driver input file and the command line options.
18+
#
19+
# NOTE: The WindFileType is only set if it is given as a command line option. Otherwise
20+
# it is handled internally by InflowWInd.
21+
#
22+
# NOTE: The wind direction is specified by the InflowWind input file.
23+
#----------------------------------------------------------------------------------------------------------------------------------
24+
typedef InflowWind_Driver IfWDriver_Flags logical DvrIptFile - .false. - "Was an input file name given on the command line?" -
25+
typedef ^ ^ logical IfWIptFile - .false. - "Was an InflowWind input file requested?" -
26+
typedef ^ ^ logical Summary - .false. - "create a summary at command line? (data extents in the wind file)" -
27+
typedef ^ ^ logical SummaryFile - .false. - "create a summary file of the output?" -
28+
typedef ^ ^ logical TStart - .false. - "specified a start time" -
29+
typedef ^ ^ logical NumTimeSteps - .false. - "specified a number of timesteps to process" -
30+
typedef ^ ^ logical NumTimeStepsDefault - .false. - "specified a 'DEFAULT' for number of timesteps to process" -
31+
typedef ^ ^ logical DT - .false. - "specified a resolution in time" -
32+
typedef ^ ^ logical DTDefault - .false. - "specified a 'DEFAULT' for the time resolution" -
33+
34+
typedef ^ ^ logical FFTcalc - .false. - "do an FFT" -
35+
36+
typedef ^ ^ logical WindGrid - .false. - "Requested output of wind data on a grid -- input file option only" -
37+
typedef ^ ^ logical XRange - .false. - "specified a range of x -- command line option only -- stored as GridCtrCoord and GridDelta" -
38+
typedef ^ ^ logical YRange - .false. - "specified a range of y -- command line option only -- stored as GridCtrCoord and GridDelta" -
39+
typedef ^ ^ logical ZRange - .false. - "specified a range of z -- command line option only -- stored as GridCtrCoord and GridDelta" -
40+
typedef ^ ^ logical Dx - .false. - "specified a resolution in x -- command line option only, 0.0 otherwise" -
41+
typedef ^ ^ logical Dy - .false. - "speficied a resolution in y" -
42+
typedef ^ ^ logical Dz - .false. - "specified a resolution in z" -
43+
44+
typedef ^ ^ logical PointsFile - .false. - "points filename to read in" -
45+
typedef ^ ^ logical OutputAccel - .false. - "flag to calculate and output wind acceleration in addition to velocity" -
46+
47+
typedef ^ ^ logical Verbose - .false. - "Verbose error reporting" -
48+
typedef ^ ^ logical VVerbose - .false. - "Very Verbose error reporting" -
49+
typedef ^ ^ logical BoxExceedAllowF - .false. - "set flag to allow exceeding wind box boundaries for FF files (for diagnostic purposes)" -
50+
51+
typedef ^ ^ logical WrHAWC - .false. - "Requested file conversion to HAWC2 format?" -
52+
typedef ^ ^ logical WrBladed - .false. - "Requested file conversion to Bladed format?" -
53+
typedef ^ ^ logical WrVTK - .false. - "Requested file output as VTK?" -
54+
typedef ^ ^ logical WrUniform - .false. - "Requested file output as Uniform wind format?" -
55+
56+
typedef ^ ^ logical XYslice - .false. - "Take XY slice at one elevation" -
57+
58+
59+
60+
# This contains all the settings (possible passed in arguments).
61+
#----------------------------------------------------------------------------------------------------------------------------------
62+
typedef InflowWind_Driver IfWDriver_Settings character(1024) DvrIptFileName - "" - "Driver input file name" -
63+
typedef ^ ^ character(1024) IfWIptFileName - "" - "Filename of InflowWind input file to read (if no driver input file)" -
64+
typedef ^ ^ character(1024) SummaryFileName - "" - "Filename for the summary information output" -
65+
66+
typedef ^ ^ character(1024) PointsFileName - "" - "Filename of points file to read in" -
67+
68+
typedef ^ ^ IntKi NumTimeSteps - 0 - "Number of timesteps" -
69+
typedef ^ ^ DbKi DT - 0.0_DbKi - "resolution of time" s
70+
typedef ^ ^ DbKi TStart - 0.0_DbKi - "range of time -- end time converted from TRange (command line option only)" s
71+
72+
typedef ^ ^ ReKi FFTcoord(1:3) - 0.0_ReKi - "(x,y,z) coordinate to do an FFT at" (m)
73+
74+
typedef ^ ^ ReKi GridDelta(1:3) - 0.0_ReKi - "(GridDx,GridDy,GridDz) -- grid point spacing" (m)
75+
typedef ^ ^ IntKi GridN(1:3) - 1_IntKi - "(GridNx,GridNy,GridNz) -- number of grid points" -
76+
77+
typedef ^ ^ ReKi XRange(1:2) - 0.0_ReKi - "Range in the x-direction for the gridded data" (m)
78+
typedef ^ ^ ReKi YRange(1:2) - 0.0_ReKi - "Range in the y-direction for the gridded data" (m)
79+
typedef ^ ^ ReKi ZRange(1:2) - 0.0_ReKi - "Range in the z-direction for the gridded data" (m)
80+
81+
typedef ^ ^ ProgDesc ProgInfo - - - "Program info" -
82+
typedef ^ ^ OutputFile WindGridOutput - - - "Wind grid file handling" -
83+
typedef ^ ^ OutputFile FFTOutput - - - "FFT file handling" -
84+
typedef ^ ^ OutputFile PointsVelOutput - - - "Points output velocity file handling" -
85+
86+
typedef ^ ^ IntKi NOutWindXY - 0 - "Number of XY planes for output <RootName>.XY<loc>.t<n>.vtk [0 to 9]" -
87+
typedef ^ ^ ReKi OutWindZ : - - "Z coordinates of XY planes for output [1 to NOutWindXY] [unused for NOutWindXY=0]" (m)
88+
typedef ^ ^ IntKi NOutWindXZ - 0 - "Number of YZ planes for output <RootName>.YZ<loc>.t<n>.vtk [0 to 9]" -
89+
typedef ^ ^ ReKi OutWindY : - - "Y coordinates of YZ planes for output [1 to NOutWindYZ] [unused for NOutWindYZ=0]" (m)
90+
typedef ^ ^ IntKi NOutWindYZ - 0 - "Number of YZ planes for output <RootName>.YZ<loc>.t<n>.vtk [0 to 9]" -
91+
typedef ^ ^ ReKi OutWindX : - - "X coordinates of YZ planes for output [1 to NOutWindYZ] [unused for NOutWindYZ=0]" (m)

0 commit comments

Comments
 (0)