Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F/md shared example #2584

Merged
merged 8 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
40 changes: 37 additions & 3 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_SiKi,0.0_SiKi,0.0_SiKi/), 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_SiKi,0.0_SiKi,0.0_SiKi/), 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 Expand Up @@ -1841,7 +1875,7 @@ subroutine FARM_End(farm, ErrStat, ErrMsg)

!--------------
! 6. End farm-level MoorDyn
if (farm%p%MooringMod == 3) then
if (farm%p%MooringMod == 3 .and. allocated(farm%MD%Input)) then
call MD_End(farm%MD%Input(1), farm%MD%p, farm%MD%x, farm%MD%xd, farm%MD%z, farm%MD%OtherSt, farm%MD%y, farm%MD%m, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
!TODO: any related items need to be cleared?
Expand Down
Loading
Loading