Skip to content

Commit

Permalink
Merge pull request #20 from rafmudaf/f/AD_TwrShadow
Browse files Browse the repository at this point in the history
Merge dev and update r-test
  • Loading branch information
bjonkman authored Sep 20, 2022
2 parents 4506efe + 673b437 commit 98d86ee
Show file tree
Hide file tree
Showing 56 changed files with 26,710 additions and 6,223 deletions.
45 changes: 43 additions & 2 deletions docs/source/user/api_change.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,57 @@ Thus, be sure to implement each in order so that subsequent line numbers are cor
OpenFAST v3.2.0 to OpenFAST `dev`
----------------------------------

============================================= ==== =============== ========================================================================================================================================================================================================
============================================= ==== ================= ======================================================================================================================================================================================================
Added in OpenFAST dev
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Module Line Flag Name Example Value
============================================= ==== ================= ======================================================================================================================================================================================================
AeroDyn driver 54\* WrVTK_Type 1 WrVTK_Type - VTK visualization data type: (switch) {1=surfaces; 2=lines; 3=both}
FAST.Farm 9 ModWaveField 2 Mod_WaveField Wave field handling (-) (switch) {1: use individual HydroDyn inputs without adjustment, 2: adjust wave phases based on turbine offsets from farm origin}
FAST.Farm 10 Mod_SharedMooring 0 Mod_SharedMooring Shared mooring system model (switch) {0: None, 3=MoorDyn}}
FAST.Farm 13 na ------ SHARED MOORING SYSTEM ------ [used only for Mod_SharedMoor>0]
FAST.Farm 14 SharedMoorFile "" SharedMoorFile Name of file containing shared mooring system input parameters (quoted string) [used only when Mod_SharedMooring > 0]
FAST.Farm 15 DT_Mooring 0.04 DT_Mooring Time step for farm-level mooring coupling with each turbine (s) [used only when Mod_SharedMooring > 0]
============================================= ==== ================= ======================================================================================================================================================================================================

\*Exact line number depends on number of entries in various preceeding tables.


============================================= ==== =============== ========================================================================================================================================================================================================
AeroDyn driver 54\* WrVTK_Type 1 WrVTK_Type - VTK visualization data type: (switch) {1=surfaces; 2=lines; 3=both}
Modified in OpenFAST dev
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Module Line Flag Name Example Value
============================================= ==== =============== ========================================================================================================================================================================================================
MoorDyn\& 5 na Name Diam MassDen EA BA/-zeta EI Cd Ca CdAx CaAx
MoorDyn\& 6 na (-) (m) (kg/m) (N) (N-s/-) (-) (-) (-) (-) (-)
MoorDyn\& 7 na main 0.0766 113.35 7.536E8 -1.0 0 2.0 0.8 0.4 0.25
MoorDyn\& 8\* na ---------------------- POINTS --------------------------------
MoorDyn\& 9\* na ID Attachment X Y Z M V CdA CA
MoorDyn\& 10\* na (-) (-) (m) (m) (m) (kg) (m^3) (m^2) (-)
MoorDyn\& 11\* na 1 Fixed 418.8 725.383 -200.0 0 0 0 0
MoorDyn\& 17\* na ---------------------- LINES --------------------------------------
MoorDyn\& 18\* na ID LineType AttachA AttachB UnstrLen NumSegs Outputs
MoorDyn\& 19\* na (-) (-) (-) (-) (m) (-) (-)
MoorDyn\& 20\* na 1 main 1 4 835.35 20 -
============================================= ==== =============== ========================================================================================================================================================================================================

\&MoorDyn has undergone an extensive revision that leaves few lines unchanged. We recommend looking at a sample input file for the 5MW_OC4Semi_WSt_WavesWN regression test for reference rather than line by line changes in the above tables.


============================================= ==== =============== ========================================================================================================================================================================================================
Removed in OpenFAST dev
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Module Line Flag Name Example Value
============================================= ==== =============== ========================================================================================================================================================================================================
MoorDyn\& 5 NTypes 1 NTypes - number of LineTypes
MoorDyn\& 10\* NConnects 6 NConnects - number of connections including anchors and fairleads
MoorDyn\& 20\* NLines 3 NLines - number of line objects
============================================= ==== =============== ========================================================================================================================================================================================================

\*Exact line number depends on number of entries in various preceeding tables.

\&MoorDyn has undergone an extensive revision that leaves few lines unchanged. We recommend looking at a sample input file for the 5MW_OC4Semi_WSt_WavesWN regression test for reference rather than line by line changes in the above tables.


OpenFAST v3.1.0 to OpenFAST v3.2.0
----------------------------------
Expand Down
30 changes: 30 additions & 0 deletions docs/source/user/fast.farm/InputFiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ sections:

- Super Controller

- Shared Moorings

- Ambient Wind

- Wind Turbines
Expand Down Expand Up @@ -95,6 +97,15 @@ ambient wind data as defined by the FAST.Farm interface to the
**[Mod_AmbWind=3]**. The distinct Ambient Wind subsections below pertain
to each option.

**Mod_WaveField** [switch] indicates how the wave field should be treated. The
two options are: 1) use individual HydroDyn inputs at each turbine without
adjustment, 2) adjust wave phases based on turbine offsets from wind farm
origin.

**Mod_SharedMooring** [switch] indicates if a farm level mooring line system
interconnects turbines. There are presently two options: 0) No shared moorings,
3) MoorDyn.

Super Controller
~~~~~~~~~~~~~~~~

Expand All @@ -108,6 +119,25 @@ turbine controllers defined in the style of the DISCON dynamic library
of the DNV GL’s Bladed wind turbine software package, with minor
modification. See :numref:`FF:sec:SupCon` for more information.

Shared Moorings
~~~~~~~~~~~~~~~

Shared mooring lines running between platforms introduce a coupling between the
platforms that operates on the same time scales as a platform's interaction with
a regular mooring system (typically resolved at a time step of 10--30 ms in
OpenFAST simulations). See :numref:`MoorDyn` for more information.

**SharedMoorFile** [quoted string] sets the name and location of the MoorDyn
input file for the mooring lines in the wind farm. It is only used if
**Mod_SharedMooring** = 3. **The file name must be in quotations** and can
contain an absolute or a relative path. The mooring lines then connect to each
of the wind turbines in the farm. See `MoorDyn with FAST.Farm
<https://moordyn.readthedocs.io/en/latest/usage.html#moordyn-with-fast-farm>`_
documentation for details on the input file at the farm level.

**DT_Mooring** (sec) sets the timestep for the shared mooring connections with
MoorDyn.

.. _FF:Input:VTK:

Ambient Wind: Precursor in Visualization Toolkit Format
Expand Down
5 changes: 5 additions & 0 deletions docs/source/user/fast.farm/examples/FAST.Farm--input.dat
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ FATAL AbortLevel Error level when simulation should abort (string) {"WAR
2000.0 TMax Total run time (s) [>=0.0]
False UseSC Use a super controller? (flag)
1 Mod_AmbWind Ambient wind model (-) (switch) {1: high-fidelity precursor in VTK format, 2: one InflowWind module, 3: multiple instances of InflowWind module}
2 Mod_WaveField Wave field handling (-) (switch) {1: use individual HydroDyn inputs without adjustment, 2: adjust wave phases based on turbine offsets from farm origin}
0 Mod_SharedMooring Shared mooring system model (switch) {0: None, 3=MoorDyn}}
--- SUPER CONTROLLER --- [used only for UseSC=True]
"SC_DLL.dll" SC_FileName Name/location of the dynamic library {.dll [Windows] or .so [Linux]} containing the Super Controller algorithms (quoted string)
--- SHARED MOORING SYSTEM --- [used only for Mod_SharedMoor>0]
"" SharedMoorFile Name of file containing shared mooring system input parameters (quoted string) [used only when Mod_SharedMooring > 0]
0.04 DT_Mooring Time step for farm-level mooring coupling with each turbine (s) [used only when Mod_SharedMooring > 0]
--- AMBIENT WIND: PRECURSOR IN VTK FORMAT --- [used only for Mod_AmbWind=1]
2.0 DT_Low-VTK Time step for low-resolution wind data input files; will be used as the global FAST.Farm time step (s) [>0.0]
0.5 DT_High-VTK Time step for high-resolution wind data input files (s) [>0.0] "/AmbWind/steady" WindFilePath Path name to wind data files from precursor (string)
Expand Down
1 change: 1 addition & 0 deletions docs/source/user/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Documentation covers usage of models, underlying theory, and in some cases modul
ElastoDyn <elastodyn/index.rst>
HydroDyn <hydrodyn/index.rst>
InflowWind <inflowwind/index.rst>
MoorDyn <moordyn/index.rst>
ServoDyn <servodyn/index.rst>
Structural Control <servodyn-stc/StC_index.rst>
TurbSim <turbsim/index.rst>
Expand Down
12 changes: 12 additions & 0 deletions docs/source/user/moordyn/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _MoorDyn:

MoorDyn Users Guide
====================

A standalone C++ version of MoorDyn is also available outside the OpenFAST
repository. The documentation for the C++ version covers the input file format
(`MoorDyn usage <https://moordyn.readthedocs.io/en/latest/usage.html>`_, specifically the section for V2)
usage of MoorDyn at the FAST.Farm level
(`MoorDyn with FAST.Farm <https://moordyn.readthedocs.io/en/latest/usage.html#moordyn-with-fast-farm>`_),
and links to publications with the relevant theory.

33 changes: 18 additions & 15 deletions glue-codes/fast-farm/src/FASTWrapper.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ MODULE FASTWrapper

PUBLIC :: FWrap_t0 ! call to compute outputs at t0 [and initialize some more variables]
PUBLIC :: FWrap_Increment ! call to update states to n+1 and compute outputs at n+1
PUBLIC :: FWrap_SetInputs
PUBLIC :: FWrap_CalcOutput


CONTAINS
Expand Down Expand Up @@ -140,6 +142,7 @@ SUBROUTINE FWrap_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
!.... multi-turbine options ....
ExternInitData%TurbineID = InitInp%TurbNum
ExternInitData%TurbinePos = InitInp%p_ref_Turbine
ExternInitData%WaveFieldMod = InitInp%WaveFieldMod

ExternInitData%FarmIntegration = .true.
ExternInitData%RootName = InitInp%RootName
Expand Down Expand Up @@ -286,11 +289,11 @@ end subroutine cleanup
END SUBROUTINE FWrap_Init
!----------------------------------------------------------------------------------------------------------------------------------
! this routine sets the parameters for the FAST Wrapper module. It does not set p%n_FAST_low because we need to initialize FAST first.
subroutine FWrap_SetParameters(InitInp, p, dt_FAST, InitInp_dt_low, ErrStat, ErrMsg)
subroutine FWrap_SetParameters(InitInp, p, dt_FAST, dt_caller, ErrStat, ErrMsg)
TYPE(FWrap_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine
TYPE(FWrap_ParameterType), INTENT(INOUT) :: p !< Parameters
REAL(DbKi), INTENT(IN ) :: dt_FAST !< time step for FAST
REAL(DbKi), INTENT(IN ) :: InitInp_dt_low !< time step for FAST.Farm
REAL(DbKi), INTENT(IN ) :: dt_caller !< time step that FWrap will be called at by FAST.Farm (if MooringMod>0, this will be smaller than DT_low)

INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation
CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None
Expand All @@ -317,22 +320,22 @@ subroutine FWrap_SetParameters(InitInp, p, dt_FAST, InitInp_dt_low, ErrStat, Err


! p%n_FAST_low has to be set AFTER we initialize FAST, because we need to know what the FAST time step is going to be.
IF ( EqualRealNos( dt_FAST, InitInp_dt_low ) ) THEN
IF ( EqualRealNos( dt_FAST, dt_caller ) ) THEN
p%n_FAST_low = 1
ELSE
IF ( dt_FAST > InitInp_dt_low ) THEN
IF ( dt_FAST > dt_caller ) THEN
ErrStat = ErrID_Fatal
ErrMsg = "The FAST time step ("//TRIM(Num2LStr(dt_FAST))// &
" s) cannot be larger than FAST.Farm time step ("//TRIM(Num2LStr(InitInp_dt_low))//" s)."
" s) cannot be larger than FAST.Farm time step ("//TRIM(Num2LStr(dt_caller))//" s)."
ELSE
! calculate the number of subcycles:
p%n_FAST_low = NINT( InitInp_dt_low / dt_FAST )
p%n_FAST_low = NINT( dt_caller / dt_FAST )

! let's make sure the FAST DT is an exact integer divisor of the global (FAST.Farm) time step:
IF ( .NOT. EqualRealNos( InitInp_dt_low, dt_FAST * p%n_FAST_low ) ) THEN
IF ( .NOT. EqualRealNos( dt_caller, dt_FAST * p%n_FAST_low ) ) THEN
ErrStat = ErrID_Fatal
ErrMsg = "The FASTWrapper module time step ("//TRIM(Num2LStr(dt_FAST))// &
" s) must be an integer divisor of the FAST.Farm time step ("//TRIM(Num2LStr(InitInp_dt_low))//" s)."
" s) must be an integer divisor of the FAST.Farm or farm-level mooring time step ("//TRIM(Num2LStr(dt_caller))//" s)."
END IF

END IF
Expand Down Expand Up @@ -411,7 +414,7 @@ END SUBROUTINE FWrap_End
SUBROUTINE FWrap_Increment( t, n, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg )
!..................................................................................................................................

REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds
REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds (no longer used, since inputs are set elsewhere)
INTEGER(IntKi), INTENT(IN ) :: n !< Current step of the simulation: t = n*Interval
TYPE(FWrap_InputType), INTENT(INOUT) :: u !< Inputs at t (not changed, but possibly copied)
TYPE(FWrap_ParameterType), INTENT(IN ) :: p !< Parameters
Expand Down Expand Up @@ -451,20 +454,20 @@ SUBROUTINE FWrap_Increment( t, n, u, p, x, xd, z, OtherState, y, m, ErrStat, Err
!ELSE
!
! set the inputs needed for FAST
call FWrap_SetInputs(u, m, t)
!call FWrap_SetInputs(u, m, t) <<< moved up into FAST.Farm FARM_UpdateStates

! call FAST p%n_FAST_low times:
do n_ss = 1, p%n_FAST_low
n_FAST = n*p%n_FAST_low + n_ss - 1
! call FAST p%n_FAST_low times (p%n_FAST_low is simply the number of steps to make per wrapper call. It is affected by MooringMod)
do n_ss = 1, p%n_FAST_low
n_FAST = n*p%n_FAST_low + n_ss - 1

CALL FAST_Solution_T( t_initial, n_FAST, m%Turbine, ErrStat2, ErrMsg2 )
call setErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
if (ErrStat >= AbortErrLev) return

end do ! n_ss

call FWrap_CalcOutput(p, u, y, m, ErrStat2, ErrMsg2)
call setErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
!call FWrap_CalcOutput(p, u, y, m, ErrStat2, ErrMsg2) <<< moved up into FAST.Farm FARM_UpdateStates
! call setErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)

!END IF

Expand Down
2 changes: 2 additions & 0 deletions glue-codes/fast-farm/src/FASTWrapper_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ typedef ^ InitInputType CHARACTER(1024) FASTInFile
typedef ^ InitInputType ReKi dr - - - "Radial increment of radial finite-difference grid" m
typedef ^ InitInputType DbKi tmax - - - "Simulation length" s
typedef ^ InitInputType ReKi p_ref_Turbine {3} - - "Undisplaced global coordinates of this turbine" m
typedef ^ InitInputType 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 ^ InitInputType IntKi n_high_low - - - "Number of high-resolution time steps per low-resolution time step" -
typedef ^ InitInputType DbKi dt_high - - - "High-resolution time step" s
typedef ^ InitInputType ReKi p_ref_high {3} - - "Position of the origin of the high-resolution spatial domain for this turbine" m
Expand All @@ -43,6 +44,7 @@ typedef ^ InitInputType SiKi fromSC
# Define outputs from the initialization routine here:
#typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "Names of the output-to-file channels" -
#typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputUnt {:} - - "Units of the output-to-file channels" -
typedef ^ InitOutputType DbKi PtfmInit {6} - - "Initial platform position/rotation vector - surge,sway,heave,roll,pitch,yaw - needed for mooring module initInp" -
typedef ^ InitOutputType ProgDesc Ver - - - "This module's name, version, and date" -


Expand Down
Loading

0 comments on commit 98d86ee

Please sign in to comment.