Skip to content

Commit ef4dbed

Browse files
committed
FF: add visualization of shared mooring lines
1 parent ea8e9ca commit ef4dbed

File tree

8 files changed

+82
-21
lines changed

8 files changed

+82
-21
lines changed

docs/source/user/api_change.rst

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,19 @@ SubDyn 56\*
3838
SubDyn 57\* NSpringPropSets 0 - Number of spring properties
3939
SubDyn 58\* PropSetID k11 k12 k13 k14 k15 k16 k22 k23 k24 k25 k26 k33 k34 k35 k36 k44 k45 k46 k55 k56 k66
4040
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)
41-
FAST.Farm 47 RotorDiamRef 125 RotorDiamRef - Reference turbine rotor diameter for wake calculations (m) [>0.0]
42-
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]
43-
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]
44-
FAST.Farm 59-66 --removed--
45-
FAST.Farm 71 --- WAKE-ADDED TURBULENCE ---
46-
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)
47-
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)
48-
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] (-)
49-
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)
50-
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)
51-
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 ]]
52-
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]
41+
FAST.Farm 16 WrMooringVis true WrMooringVis - Write shared mooring visualization, at DT_Mooring timestep (-) [only used for Mod_SharedMooring=3]
42+
FAST.Farm 48 RotorDiamRef 125 RotorDiamRef - Reference turbine rotor diameter for wake calculations (m) [>0.0]
43+
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]
44+
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]
45+
FAST.Farm 60-66 --removed--
46+
FAST.Farm 72 --- WAKE-ADDED TURBULENCE ---
47+
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)
48+
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)
49+
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] (-)
50+
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)
51+
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)
52+
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 ]]
53+
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]
5354
AeroDyn 80\* NacArea 0, 0, 0 NacArea - Projected area of the nacelle in X, Y, Z in the nacelle coordinate system (m^2)
5455
AeroDyn 81\* NacCd 0, 0, 0 NacCd - Drag coefficient for the nacelle areas defined above (-)
5556
AeroDyn 82\* NacDragAC 0, 0, 0 NacDragAC - Position of aerodynamic center of nacelle drag in nacelle coordinates (m)

docs/source/user/fast.farm/InputFiles.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ documentation for details on the input file at the farm level.
138138
**DT_Mooring** (sec) sets the timestep for the shared mooring connections with
139139
MoorDyn.
140140

141+
**WrMooringVis** [swithch] Write shared mooring line visualization, at
142+
DT_Mooring timestep
143+
144+
141145
.. _FF:Input:VTK:
142146

143147
Ambient Wind: Precursor in Visualization Toolkit Format

glue-codes/fast-farm/src/FAST_Farm_IO.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ SUBROUTINE Farm_ReadPrimaryFile( InputFile, p, WD_InitInp, AWAE_InitInp, SC_Init
643643
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
644644
IF ( PathIsRelative( p%MD_FileName ) ) p%MD_FileName = TRIM(PriPath)//TRIM(p%MD_FileName)
645645
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
646+
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
646647

647648
!---------------------- AMBIENT WIND: PRECURSOR IN VTK FORMAT ---------------------------------------------
648649
CALL ReadCom( UnIn, InputFile, 'Section Header: Ambient Wind: Precursor in VTK Format', ErrStat2, ErrMsg2, UnEc ); if (Failed()) return

glue-codes/fast-farm/src/FAST_Farm_Registry.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ typedef ^ ParameterType LOGICAL UseSC -
4141
typedef ^ ParameterType ReKi WT_Position {:}{:} - - "X-Y-Z position of each wind turbine; index 1 = XYZ; index 2 = turbine number" meters
4242
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}" -
4343
typedef ^ ParameterType IntKi MooringMod - - - "Mod_SharedMooring is a flag for array-level mooring. (switch) {0: none, 3: yes/MoorDyn}" -
44+
typedef ^ ParameterType logical WrMooringVis - - - "Write shared mooring visualization (-) [only used for Mod_SharedMooring=3]" -
4445
typedef ^ ParameterType CHARACTER(1024) MD_FileName - - - "Name/location of the farm-level MoorDyn input file" -
4546
typedef ^ ParameterType DbKi DT_mooring - - - "Time step for farm-levem mooring coupling with each turbine [used only when Mod_SharedMooring > 0]" seconds
4647
typedef ^ ParameterType IntKi n_mooring - - - "Number of FAST and MoorDyn time steps per FAST.Farm timestep when mooring > 0" -
@@ -157,6 +158,9 @@ typedef ^ ^ DbKi InputTimes {:} -
157158
typedef ^ ^ MD_OutputType y - - - "System outputs"
158159
typedef ^ ^ MD_MiscVarType m - - - "Misc/optimization variables"
159160
typedef ^ ^ logical IsInitialized - .FALSE. - "Has MD_Init been called"
161+
typedef ^ ^ IntKi VTK_count - 0 - "Counter for VTK output of shared moorings"
162+
typedef ^ ^ IntKi VTK_TWidth - - - "width for VTK_count field in output name"
163+
typedef ^ ^ character(1024) VTK_OutFileRoot - - - "Rootfilename for VTK output"
160164
# ..... WAT InflowWind data ............................................................................................
161165
typedef ^ WAT_IfW_data InflowWind_ContinuousStateType x - - - "Continuous states"
162166
typedef ^ ^ InflowWind_DiscreteStateType xd - - - "Discrete states"

glue-codes/fast-farm/src/FAST_Farm_Subs.f90

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ SUBROUTINE Farm_InitMD( farm, ErrStat, ErrMsg )
783783
type(MD_InitInputType) :: MD_InitInp
784784
type(MD_InitOutputType) :: MD_InitOut
785785

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

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

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

10071016
end if
10081017
end do
1009-
1018+
10101019

10111020
contains
10121021
logical function Failed()
@@ -1657,7 +1666,7 @@ subroutine FARM_CalcOutput(t, farm, ErrStat, ErrMsg)
16571666
INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status
16581667
CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message
16591668

1660-
INTEGER(IntKi) :: nt
1669+
INTEGER(IntKi) :: nt,j
16611670
INTEGER(IntKi) :: ErrStat2 ! Temporary Error status
16621671
CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message
16631672
CHARACTER(*), PARAMETER :: RoutineName = 'FARM_CalcOutput'
@@ -1755,6 +1764,31 @@ subroutine FARM_CalcOutput(t, farm, ErrStat, ErrMsg)
17551764
call Farm_WriteOutput(n, t, farm, ErrStat2, ErrMsg2)
17561765
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
17571766

1767+
!.......................................................................................
1768+
! Write shared moorings visualization
1769+
!.......................................................................................
1770+
1771+
! Write visualization meshes
1772+
if (farm%p%MooringMod == 3) then
1773+
if (farm%MD%p%VisMeshes) then
1774+
if (allocated(farm%MD%y%VisLinesMesh)) then
1775+
do j=1,size(farm%MD%y%VisLinesMesh)
1776+
if (farm%MD%y%VisLinesMesh(j)%Committed) then
1777+
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 )
1778+
endif
1779+
enddo
1780+
endif
1781+
if (allocated(farm%MD%y%VisRodsMesh)) then
1782+
do j=1,size(farm%MD%y%VisRodsMesh)
1783+
if (farm%MD%y%VisRodsMesh(j)%Committed) then
1784+
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 )
1785+
endif
1786+
enddo
1787+
endif
1788+
farm%MD%VTK_Count = farm%MD%VTK_Count + 1
1789+
endif
1790+
endif
1791+
17581792
! write(*,*) 'Total Farm_CO-serial took '//trim(num2lstr(omp_get_wtime()-tm1))//' seconds.'
17591793

17601794
end subroutine FARM_CalcOutput

glue-codes/fast-farm/src/FAST_Farm_Types.f90

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ MODULE FAST_Farm_Types
6060
REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: WT_Position !< X-Y-Z position of each wind turbine; index 1 = XYZ; index 2 = turbine number [meters]
6161
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} [-]
6262
INTEGER(IntKi) :: MooringMod = 0_IntKi !< Mod_SharedMooring is a flag for array-level mooring. (switch) {0: none, 3: yes/MoorDyn} [-]
63+
LOGICAL :: WrMooringVis = .false. !< Write shared mooring visualization (-) [only used for Mod_SharedMooring=3] [-]
6364
CHARACTER(1024) :: MD_FileName !< Name/location of the farm-level MoorDyn input file [-]
6465
REAL(DbKi) :: DT_mooring = 0.0_R8Ki !< Time step for farm-levem mooring coupling with each turbine [used only when Mod_SharedMooring > 0] [seconds]
6566
INTEGER(IntKi) :: n_mooring = 0_IntKi !< Number of FAST and MoorDyn time steps per FAST.Farm timestep when mooring > 0 [-]
@@ -185,6 +186,9 @@ MODULE FAST_Farm_Types
185186
TYPE(MD_OutputType) :: y !< System outputs [-]
186187
TYPE(MD_MiscVarType) :: m !< Misc/optimization variables [-]
187188
LOGICAL :: IsInitialized = .FALSE. !< Has MD_Init been called [-]
189+
INTEGER(IntKi) :: VTK_count = 0 !< Counter for VTK output of shared moorings [-]
190+
INTEGER(IntKi) :: VTK_TWidth = 0_IntKi !< width for VTK_count field in output name [-]
191+
character(1024) :: VTK_OutFileRoot !< Rootfilename for VTK output [-]
188192
END TYPE MD_Data
189193
! =======================
190194
! ========= WAT_IfW_data =======
@@ -249,6 +253,7 @@ subroutine Farm_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg)
249253
end if
250254
DstParamData%WaveFieldMod = SrcParamData%WaveFieldMod
251255
DstParamData%MooringMod = SrcParamData%MooringMod
256+
DstParamData%WrMooringVis = SrcParamData%WrMooringVis
252257
DstParamData%MD_FileName = SrcParamData%MD_FileName
253258
DstParamData%DT_mooring = SrcParamData%DT_mooring
254259
DstParamData%n_mooring = SrcParamData%n_mooring
@@ -452,6 +457,7 @@ subroutine Farm_PackParam(RF, Indata)
452457
call RegPackAlloc(RF, InData%WT_Position)
453458
call RegPack(RF, InData%WaveFieldMod)
454459
call RegPack(RF, InData%MooringMod)
460+
call RegPack(RF, InData%WrMooringVis)
455461
call RegPack(RF, InData%MD_FileName)
456462
call RegPack(RF, InData%DT_mooring)
457463
call RegPack(RF, InData%n_mooring)
@@ -534,6 +540,7 @@ subroutine Farm_UnPackParam(RF, OutData)
534540
call RegUnpackAlloc(RF, OutData%WT_Position); if (RegCheckErr(RF, RoutineName)) return
535541
call RegUnpack(RF, OutData%WaveFieldMod); if (RegCheckErr(RF, RoutineName)) return
536542
call RegUnpack(RF, OutData%MooringMod); if (RegCheckErr(RF, RoutineName)) return
543+
call RegUnpack(RF, OutData%WrMooringVis); if (RegCheckErr(RF, RoutineName)) return
537544
call RegUnpack(RF, OutData%MD_FileName); if (RegCheckErr(RF, RoutineName)) return
538545
call RegUnpack(RF, OutData%DT_mooring); if (RegCheckErr(RF, RoutineName)) return
539546
call RegUnpack(RF, OutData%n_mooring); if (RegCheckErr(RF, RoutineName)) return
@@ -1257,6 +1264,9 @@ subroutine Farm_CopyMD_Data(SrcMD_DataData, DstMD_DataData, CtrlCode, ErrStat, E
12571264
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
12581265
if (ErrStat >= AbortErrLev) return
12591266
DstMD_DataData%IsInitialized = SrcMD_DataData%IsInitialized
1267+
DstMD_DataData%VTK_count = SrcMD_DataData%VTK_count
1268+
DstMD_DataData%VTK_TWidth = SrcMD_DataData%VTK_TWidth
1269+
DstMD_DataData%VTK_OutFileRoot = SrcMD_DataData%VTK_OutFileRoot
12601270
end subroutine
12611271

12621272
subroutine Farm_DestroyMD_Data(MD_DataData, ErrStat, ErrMsg)
@@ -1326,6 +1336,9 @@ subroutine Farm_PackMD_Data(RF, Indata)
13261336
call MD_PackOutput(RF, InData%y)
13271337
call MD_PackMisc(RF, InData%m)
13281338
call RegPack(RF, InData%IsInitialized)
1339+
call RegPack(RF, InData%VTK_count)
1340+
call RegPack(RF, InData%VTK_TWidth)
1341+
call RegPack(RF, InData%VTK_OutFileRoot)
13291342
if (RegCheckErr(RF, RoutineName)) return
13301343
end subroutine
13311344

@@ -1361,6 +1374,9 @@ subroutine Farm_UnPackMD_Data(RF, OutData)
13611374
call MD_UnpackOutput(RF, OutData%y) ! y
13621375
call MD_UnpackMisc(RF, OutData%m) ! m
13631376
call RegUnpack(RF, OutData%IsInitialized); if (RegCheckErr(RF, RoutineName)) return
1377+
call RegUnpack(RF, OutData%VTK_count); if (RegCheckErr(RF, RoutineName)) return
1378+
call RegUnpack(RF, OutData%VTK_TWidth); if (RegCheckErr(RF, RoutineName)) return
1379+
call RegUnpack(RF, OutData%VTK_OutFileRoot); if (RegCheckErr(RF, RoutineName)) return
13641380
end subroutine
13651381

13661382
subroutine Farm_CopyWAT_IfW_data(SrcWAT_IfW_dataData, DstWAT_IfW_dataData, CtrlCode, ErrStat, ErrMsg)

0 commit comments

Comments
 (0)