Skip to content

Commit

Permalink
FF: add visualization of shared mooring lines
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-platt committed Dec 23, 2024
1 parent ea8e9ca commit ef4dbed
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 21 deletions.
25 changes: 13 additions & 12 deletions docs/source/user/api_change.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,19 @@ SubDyn 56\*
SubDyn 57\* NSpringPropSets 0 - Number of spring properties
SubDyn 58\* PropSetID k11 k12 k13 k14 k15 k16 k22 k23 k24 k25 k26 k33 k34 k35 k36 k44 k45 k46 k55 k56 k66
SubDyn 59\* (-) (N/m) (N/m) (N/m) (N/rad) (N/rad) (N/rad) (N/m) (N/m) (N/rad) (N/rad) (N/rad) (N/m) (N/rad) (N/rad) (N/rad) (Nm/rad) (Nm/rad) (Nm/rad) (Nm/rad) (Nm/rad) (Nm/rad)
FAST.Farm 47 RotorDiamRef 125 RotorDiamRef - Reference turbine rotor diameter for wake calculations (m) [>0.0]
FAST.Farm 57 k_vAmb DEFAULT k_vAmb - Calibrated parameters for the influence of the ambient turbulence in the eddy viscosity (set of 5 parameters: k, FMin, DMin, DMax, Exp) (-) [>=0.0, >=0.0 and <=1.0, >=0.0, >DMin, >0.0] or DEFAULT [DEFAULT=0.05, 1.0, 0.0, 1.0, 0.01]
FAST.Farm 58 kvShr DEFAULT k_vShr - Calibrated parameters for the influence of the shear layer in the eddy viscosity (set of 5 parameters: k, FMin, DMin, DMax, Exp) (-) [>=0.0, >=0.0 and <=1.0, >=0.0, >DMin, >0.0] or DEFAULT [DEFAULT=0.016, 0.2, 3.0, 25.0, 0.1]
FAST.Farm 59-66 --removed--
FAST.Farm 71 --- WAKE-ADDED TURBULENCE ---
FAST.Farm 72 WAT 2 WAT - Switch between wake-added turbulence box options {0: no wake added turbulence, 1: predefined turbulence box, 2: user defined turbulence box} (switch)
FAST.Farm 73 WAT_BoxFile "../WAT_MannBoxDB/FFDB_D100_512x512x64.u" WAT_BoxFile - Filepath to the file containing the u-component of the turbulence box (either predefined or user-defined) (quoted string)
FAST.Farm 74 WAT_NxNyNz 512, 512, 64 WAT_NxNyNz - Number of points in the x, y, and z directions of the WAT_BoxFile [used only if WAT=2, derived value if WAT=1] (-)
FAST.Farm 75 WAT_DxDyDz 5.0, 5.0, 5.0 WAT_DxDyDz - Distance (in meters) between points in the x, y, and z directions of the WAT_BoxFile [used only if WAT=2, derived value if WAT=1] (m)
FAST.Farm 76 WAT_ScaleBox default WAT_ScaleBox - Flag to scale the input turbulence box to zero mean and unit standard deviation at every node [DEFAULT=False] (flag)
FAST.Farm 77 WAT_k_Def default WAT_k_Def - Calibrated parameters for the influence of the maximum wake deficit on wake-added turbulence (set of 5 parameters: k_Def, FMin, DMin, DMax, Exp) (-) [>=0.0, >=0.0 and <=1.0, >=0.0, >DMin, >0.0] or DEFAULT [DEFAULT=[0.6, 0.0, 0.0, 2.0, 1.0 ]]
FAST.Farm 78 WAT_k_Grad default WAT_k_Grad - Calibrated parameters for the influence of the radial velocity gradient of the wake deficit on wake-added turbulence (set of 5 parameters: k_Grad, FMin, DMin, DMax, Exp) (-) [>=0.0, >=0.0 and <=1.0, >=0.0, >DMin, >0.0] or DEFAULT [DEFAULT=[3.0, 0.0, 0.0, 12.0, 0.65]
FAST.Farm 16 WrMooringVis true WrMooringVis - Write shared mooring visualization, at DT_Mooring timestep (-) [only used for Mod_SharedMooring=3]
FAST.Farm 48 RotorDiamRef 125 RotorDiamRef - Reference turbine rotor diameter for wake calculations (m) [>0.0]
FAST.Farm 58 k_vAmb DEFAULT k_vAmb - Calibrated parameters for the influence of the ambient turbulence in the eddy viscosity (set of 5 parameters: k, FMin, DMin, DMax, Exp) (-) [>=0.0, >=0.0 and <=1.0, >=0.0, >DMin, >0.0] or DEFAULT [DEFAULT=0.05, 1.0, 0.0, 1.0, 0.01]
FAST.Farm 59 kvShr DEFAULT k_vShr - Calibrated parameters for the influence of the shear layer in the eddy viscosity (set of 5 parameters: k, FMin, DMin, DMax, Exp) (-) [>=0.0, >=0.0 and <=1.0, >=0.0, >DMin, >0.0] or DEFAULT [DEFAULT=0.016, 0.2, 3.0, 25.0, 0.1]
FAST.Farm 60-66 --removed--
FAST.Farm 72 --- WAKE-ADDED TURBULENCE ---
FAST.Farm 73 WAT 2 WAT - Switch between wake-added turbulence box options {0: no wake added turbulence, 1: predefined turbulence box, 2: user defined turbulence box} (switch)
FAST.Farm 74 WAT_BoxFile "../WAT_MannBoxDB/FFDB_D100_512x512x64.u" WAT_BoxFile - Filepath to the file containing the u-component of the turbulence box (either predefined or user-defined) (quoted string)
FAST.Farm 75 WAT_NxNyNz 512, 512, 64 WAT_NxNyNz - Number of points in the x, y, and z directions of the WAT_BoxFile [used only if WAT=2, derived value if WAT=1] (-)
FAST.Farm 76 WAT_DxDyDz 5.0, 5.0, 5.0 WAT_DxDyDz - Distance (in meters) between points in the x, y, and z directions of the WAT_BoxFile [used only if WAT=2, derived value if WAT=1] (m)
FAST.Farm 77 WAT_ScaleBox default WAT_ScaleBox - Flag to scale the input turbulence box to zero mean and unit standard deviation at every node [DEFAULT=False] (flag)
FAST.Farm 78 WAT_k_Def default WAT_k_Def - Calibrated parameters for the influence of the maximum wake deficit on wake-added turbulence (set of 5 parameters: k_Def, FMin, DMin, DMax, Exp) (-) [>=0.0, >=0.0 and <=1.0, >=0.0, >DMin, >0.0] or DEFAULT [DEFAULT=[0.6, 0.0, 0.0, 2.0, 1.0 ]]
FAST.Farm 79 WAT_k_Grad default WAT_k_Grad - Calibrated parameters for the influence of the radial velocity gradient of the wake deficit on wake-added turbulence (set of 5 parameters: k_Grad, FMin, DMin, DMax, Exp) (-) [>=0.0, >=0.0 and <=1.0, >=0.0, >DMin, >0.0] or DEFAULT [DEFAULT=[3.0, 0.0, 0.0, 12.0, 0.65]
AeroDyn 80\* NacArea 0, 0, 0 NacArea - Projected area of the nacelle in X, Y, Z in the nacelle coordinate system (m^2)
AeroDyn 81\* NacCd 0, 0, 0 NacCd - Drag coefficient for the nacelle areas defined above (-)
AeroDyn 82\* NacDragAC 0, 0, 0 NacDragAC - Position of aerodynamic center of nacelle drag in nacelle coordinates (m)
Expand Down
4 changes: 4 additions & 0 deletions docs/source/user/fast.farm/InputFiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ documentation for details on the input file at the farm level.
**DT_Mooring** (sec) sets the timestep for the shared mooring connections with
MoorDyn.

**WrMooringVis** [swithch] Write shared mooring line visualization, at
DT_Mooring timestep


.. _FF:Input:VTK:

Ambient Wind: Precursor in Visualization Toolkit Format
Expand Down
1 change: 1 addition & 0 deletions glue-codes/fast-farm/src/FAST_Farm_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ SUBROUTINE Farm_ReadPrimaryFile( InputFile, p, WD_InitInp, AWAE_InitInp, SC_Init
CALL ReadVar( UnIn, InputFile, p%MD_FileName, "MD_FileName", "Name/location of the dynamic library {.dll [Windows] or .so [Linux]} containing the Super Controller algorithms (quoated string)", ErrStat2, ErrMsg2, UnEc); if (Failed()) return
IF ( PathIsRelative( p%MD_FileName ) ) p%MD_FileName = TRIM(PriPath)//TRIM(p%MD_FileName)
CALL ReadVar( UnIn, InputFile, p%DT_mooring, "DT_Mooring", "Time step for farm-levem mooring coupling with each turbine [used only when Mod_SharedMooring > 0] (s) [>0.0]", ErrStat2, ErrMsg2, UnEc); if (Failed()) return
CALL ReadVar( UnIn, InputFile, p%WrMooringVis, "MooringVis","Write shared mooring visualization, at DT_Mooring timestep (-) [only used for Mod_SharedMooring=3]", ErrStat2, ErrMsg2, UnEc); if (Failed()) return

!---------------------- AMBIENT WIND: PRECURSOR IN VTK FORMAT ---------------------------------------------
CALL ReadCom( UnIn, InputFile, 'Section Header: Ambient Wind: Precursor in VTK Format', ErrStat2, ErrMsg2, UnEc ); if (Failed()) return
Expand Down
4 changes: 4 additions & 0 deletions glue-codes/fast-farm/src/FAST_Farm_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ typedef ^ ParameterType LOGICAL UseSC -
typedef ^ ParameterType ReKi WT_Position {:}{:} - - "X-Y-Z position of each wind turbine; index 1 = XYZ; index 2 = turbine number" meters
typedef ^ ParameterType IntKi WaveFieldMod - - - "Wave field handling (-) (switch) {0: use individual HydroDyn inputs without adjustment, 1: adjust wave phases based on turbine offsets from farm origin}" -
typedef ^ ParameterType IntKi MooringMod - - - "Mod_SharedMooring is a flag for array-level mooring. (switch) {0: none, 3: yes/MoorDyn}" -
typedef ^ ParameterType logical WrMooringVis - - - "Write shared mooring visualization (-) [only used for Mod_SharedMooring=3]" -
typedef ^ ParameterType CHARACTER(1024) MD_FileName - - - "Name/location of the farm-level MoorDyn input file" -
typedef ^ ParameterType DbKi DT_mooring - - - "Time step for farm-levem mooring coupling with each turbine [used only when Mod_SharedMooring > 0]" seconds
typedef ^ ParameterType IntKi n_mooring - - - "Number of FAST and MoorDyn time steps per FAST.Farm timestep when mooring > 0" -
Expand Down Expand Up @@ -157,6 +158,9 @@ typedef ^ ^ DbKi InputTimes {:} -
typedef ^ ^ MD_OutputType y - - - "System outputs"
typedef ^ ^ MD_MiscVarType m - - - "Misc/optimization variables"
typedef ^ ^ logical IsInitialized - .FALSE. - "Has MD_Init been called"
typedef ^ ^ IntKi VTK_count - 0 - "Counter for VTK output of shared moorings"
typedef ^ ^ IntKi VTK_TWidth - - - "width for VTK_count field in output name"
typedef ^ ^ character(1024) VTK_OutFileRoot - - - "Rootfilename for VTK output"
# ..... WAT InflowWind data ............................................................................................
typedef ^ WAT_IfW_data InflowWind_ContinuousStateType x - - - "Continuous states"
typedef ^ ^ InflowWind_DiscreteStateType xd - - - "Discrete states"
Expand Down
38 changes: 36 additions & 2 deletions glue-codes/fast-farm/src/FAST_Farm_Subs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ SUBROUTINE Farm_InitMD( farm, ErrStat, ErrMsg )
type(MD_InitInputType) :: MD_InitInp
type(MD_InitOutputType) :: MD_InitOut

character(1025) :: Path, FileRoot ! for vtk outputs
INTEGER(IntKi) :: nt ! loop counter for rotor number
INTEGER(IntKi) :: ErrStat2 ! Temporary Error status
CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message
Expand Down Expand Up @@ -844,6 +845,14 @@ SUBROUTINE Farm_InitMD( farm, ErrStat, ErrMsg )
MD_InitInp%rhoW = 1025.0
MD_InitInp%WtrDepth = 0.0 !TODO: eventually connect this to a global depth input variable <<<

! Visualization of shared moorings
if (farm%p%WrMooringVis) then
MD_InitInp%VisMeshes=.true.
farm%MD%VTK_Count = 0
call GetPath ( MD_InitInp%RootName, Path, FileRoot ) ! the returned DVR_Outs%VTK_OutFileRoot includes a file separator character at the end
farm%MD%VTK_OutFileRoot = trim(Path)//PathSep//'vtk'//PathSep//trim(FileRoot)
farm%MD%VTK_TWidth = 5 !FIXME: this should be set based on sim length
endif

! allocate MoorDyn inputs (assuming size 2 for linear interpolation/extrapolation... >
ALLOCATE( farm%MD%Input( 2 ), farm%MD%InputTimes( 2 ), STAT = ErrStat2 )
Expand Down Expand Up @@ -1006,7 +1015,7 @@ subroutine FARM_MD_Increment(t, n, farm, ErrStat, ErrMsg)

end if
end do


contains
logical function Failed()
Expand Down Expand Up @@ -1657,7 +1666,7 @@ subroutine FARM_CalcOutput(t, farm, ErrStat, ErrMsg)
INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status
CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message

INTEGER(IntKi) :: nt
INTEGER(IntKi) :: nt,j
INTEGER(IntKi) :: ErrStat2 ! Temporary Error status
CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message
CHARACTER(*), PARAMETER :: RoutineName = 'FARM_CalcOutput'
Expand Down Expand Up @@ -1755,6 +1764,31 @@ subroutine FARM_CalcOutput(t, farm, ErrStat, ErrMsg)
call Farm_WriteOutput(n, t, farm, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)

!.......................................................................................
! Write shared moorings visualization
!.......................................................................................

! Write visualization meshes
if (farm%p%MooringMod == 3) then
if (farm%MD%p%VisMeshes) then
if (allocated(farm%MD%y%VisLinesMesh)) then
do j=1,size(farm%MD%y%VisLinesMesh)
if (farm%MD%y%VisLinesMesh(j)%Committed) then
call MeshWrVTK((/0.0_ReKi,0.0_ReKi,0.0_ReKi/), farm%MD%y%VisLinesMesh(j), trim(farm%MD%VTK_OutFileRoot)//'.MD_Line'//trim(Num2LStr(j)), farm%MD%VTK_count, .false., ErrSTat2, ErrMsg2, farm%MD%VTK_tWidth )
endif
enddo
endif
if (allocated(farm%MD%y%VisRodsMesh)) then
do j=1,size(farm%MD%y%VisRodsMesh)
if (farm%MD%y%VisRodsMesh(j)%Committed) then
call MeshWrVTK((/0.0_ReKi,0.0_ReKi,0.0_ReKi/), farm%MD%y%VisRodsMesh(j), trim(farm%MD%VTK_OutFileRoot)//'.MD_Rod'//trim(Num2LStr(j)), farm%MD%VTK_count, .false., ErrSTat2, ErrMsg2, farm%MD%VTK_tWidth )
endif
enddo
endif
farm%MD%VTK_Count = farm%MD%VTK_Count + 1
endif
endif

! write(*,*) 'Total Farm_CO-serial took '//trim(num2lstr(omp_get_wtime()-tm1))//' seconds.'

end subroutine FARM_CalcOutput
Expand Down
16 changes: 16 additions & 0 deletions glue-codes/fast-farm/src/FAST_Farm_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ MODULE FAST_Farm_Types
REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: WT_Position !< X-Y-Z position of each wind turbine; index 1 = XYZ; index 2 = turbine number [meters]
INTEGER(IntKi) :: WaveFieldMod = 0_IntKi !< Wave field handling (-) (switch) {0: use individual HydroDyn inputs without adjustment, 1: adjust wave phases based on turbine offsets from farm origin} [-]
INTEGER(IntKi) :: MooringMod = 0_IntKi !< Mod_SharedMooring is a flag for array-level mooring. (switch) {0: none, 3: yes/MoorDyn} [-]
LOGICAL :: WrMooringVis = .false. !< Write shared mooring visualization (-) [only used for Mod_SharedMooring=3] [-]
CHARACTER(1024) :: MD_FileName !< Name/location of the farm-level MoorDyn input file [-]
REAL(DbKi) :: DT_mooring = 0.0_R8Ki !< Time step for farm-levem mooring coupling with each turbine [used only when Mod_SharedMooring > 0] [seconds]
INTEGER(IntKi) :: n_mooring = 0_IntKi !< Number of FAST and MoorDyn time steps per FAST.Farm timestep when mooring > 0 [-]
Expand Down Expand Up @@ -185,6 +186,9 @@ MODULE FAST_Farm_Types
TYPE(MD_OutputType) :: y !< System outputs [-]
TYPE(MD_MiscVarType) :: m !< Misc/optimization variables [-]
LOGICAL :: IsInitialized = .FALSE. !< Has MD_Init been called [-]
INTEGER(IntKi) :: VTK_count = 0 !< Counter for VTK output of shared moorings [-]
INTEGER(IntKi) :: VTK_TWidth = 0_IntKi !< width for VTK_count field in output name [-]
character(1024) :: VTK_OutFileRoot !< Rootfilename for VTK output [-]
END TYPE MD_Data
! =======================
! ========= WAT_IfW_data =======
Expand Down Expand Up @@ -249,6 +253,7 @@ subroutine Farm_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg)
end if
DstParamData%WaveFieldMod = SrcParamData%WaveFieldMod
DstParamData%MooringMod = SrcParamData%MooringMod
DstParamData%WrMooringVis = SrcParamData%WrMooringVis
DstParamData%MD_FileName = SrcParamData%MD_FileName
DstParamData%DT_mooring = SrcParamData%DT_mooring
DstParamData%n_mooring = SrcParamData%n_mooring
Expand Down Expand Up @@ -452,6 +457,7 @@ subroutine Farm_PackParam(RF, Indata)
call RegPackAlloc(RF, InData%WT_Position)
call RegPack(RF, InData%WaveFieldMod)
call RegPack(RF, InData%MooringMod)
call RegPack(RF, InData%WrMooringVis)
call RegPack(RF, InData%MD_FileName)
call RegPack(RF, InData%DT_mooring)
call RegPack(RF, InData%n_mooring)
Expand Down Expand Up @@ -534,6 +540,7 @@ subroutine Farm_UnPackParam(RF, OutData)
call RegUnpackAlloc(RF, OutData%WT_Position); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%WaveFieldMod); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%MooringMod); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%WrMooringVis); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%MD_FileName); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%DT_mooring); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%n_mooring); if (RegCheckErr(RF, RoutineName)) return
Expand Down Expand Up @@ -1257,6 +1264,9 @@ subroutine Farm_CopyMD_Data(SrcMD_DataData, DstMD_DataData, CtrlCode, ErrStat, E
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
DstMD_DataData%IsInitialized = SrcMD_DataData%IsInitialized
DstMD_DataData%VTK_count = SrcMD_DataData%VTK_count
DstMD_DataData%VTK_TWidth = SrcMD_DataData%VTK_TWidth
DstMD_DataData%VTK_OutFileRoot = SrcMD_DataData%VTK_OutFileRoot
end subroutine

subroutine Farm_DestroyMD_Data(MD_DataData, ErrStat, ErrMsg)
Expand Down Expand Up @@ -1326,6 +1336,9 @@ subroutine Farm_PackMD_Data(RF, Indata)
call MD_PackOutput(RF, InData%y)
call MD_PackMisc(RF, InData%m)
call RegPack(RF, InData%IsInitialized)
call RegPack(RF, InData%VTK_count)
call RegPack(RF, InData%VTK_TWidth)
call RegPack(RF, InData%VTK_OutFileRoot)
if (RegCheckErr(RF, RoutineName)) return
end subroutine

Expand Down Expand Up @@ -1361,6 +1374,9 @@ subroutine Farm_UnPackMD_Data(RF, OutData)
call MD_UnpackOutput(RF, OutData%y) ! y
call MD_UnpackMisc(RF, OutData%m) ! m
call RegUnpack(RF, OutData%IsInitialized); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%VTK_count); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%VTK_TWidth); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%VTK_OutFileRoot); if (RegCheckErr(RF, RoutineName)) return
end subroutine

subroutine Farm_CopyWAT_IfW_data(SrcWAT_IfW_dataData, DstWAT_IfW_dataData, CtrlCode, ErrStat, ErrMsg)
Expand Down
Loading

0 comments on commit ef4dbed

Please sign in to comment.