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

Add offshore linearization capability #350

Merged
merged 133 commits into from
Jun 15, 2020

Conversation

HaymanConsulting
Copy link
Contributor

@HaymanConsulting HaymanConsulting commented Oct 24, 2019

Complete this sentence
THIS PULL REQUEST IS READY TO MERGE

Feature or improvement description
This pull request adds new linearization functionality to OpenFAST for floating offshore wind turbines. Specifically, linearization capability has been added for HydroDyn (and associated sub-modules) and MAP++. A new state-space wave excitation module has been developed. Additionally the glue-code has been modified to support these additional linearization features. The HydroDyn input file now includes options (ExctnMod) related to the new state-space wave excitation module.

Related issue, if one exists
None

Impacted areas of the software
OpenFAST glue-code
ElastoDyn
HydroDyn
WAMIT
SS_Excitation
SS_Radiation
MAP++

Additional supporting information
https://www.nrel.gov/docs/fy19osti/71865.pdf
https://www.sintef.no/globalassets/project/eera-deepwind-2019/presentations/h_jonkman_nrel.pdf

Automated test results

alvarogonzalezsalcedo and others added 30 commits March 6, 2018 13:09
- tau_V was reset at n+1 before setting other states that required values at n.
- also removed some comments
this commit should affect spacing and comments only
   factor = (alpha_filt_cur - alpha0) * Kalpha_f     
   if (xd%tau_V(i,j) > T_VL .AND. (factor > 0)) then  
         ! The assertion is the T_V will always equal T_V0/2 when this condition is satisfied 
 
      becomes [note sign change and comment regarding value of sigma3, BUT: Code still needs a fix which is incomplete regarding the 2nd comment.  If you fall into that if block, then  we must continue to eliminate the vortex feed until we begin tracking another vortex, i.e., tau_V is reset to 0.0, this may mean the addition of a new flag.]
 
   if (xd%tau_V(i,j) > T_VL .AND. (Kalpha_f*dalpha0 < 0)) then ! .AND. (.not. LESF) 
         ! We no longer require that T_V will always equal T_V0/2 when this condition is satisfied as was the case in AD v13 GJH 7/20/2017 
         ! If we fall into this condition, we need to require we stay here until the current vortex is shed (i.e., tauV is reset to zero) 
      Cn_v = xd%Cn_v_minus1(i,j)*exp(-ds/T_V)   ! Eqn 1.52     
   else       
      Cn_v = Get_ExpEqn( ds, T_V, xd%Cn_v_minus1(i,j), C_V, xd%C_V_minus1(i,j) )   ! Eqn 1.47
Email dated July 28, 2017: From Greg Hayman/Rick Damiani to Envision Energy:

We changed the definition of VRTX:
 
was:  
    VRTX = (xd%tau_V(i,j) <= 2.0_ReKi*T_VL) .and. (xd%tau_V(i,j) > 0.0_ReKi) 
 now:
      ! Is the vortex over the chord?   
   VRTX = (xd%tau_V(i,j) > 0.0_ReKi) .and. (xd%tau_V(i,j) <= T_VL) 
 
Because of this change in the definition of VRTX all if tests related to VRTX have been changed:
    if ( VRTX .and. (xd%tau_V(i,j) <= T_VL) ) then  ! Still shedding a vortex? 
 becomes
    if ( VRTX ) then  ! Still shedding a vortex, i.e., the current vortex is still over the chord?
 and
    if ( VRTX .and. (xd%tau_V(i,j) <= T_VL) ) then
 becomes  [ NOTE This is part of a logic change in the sigma3 section, see below]
    else if ( VRTX ) then
The glue-code implementation is incomplete, and MAP still needs to be linearized
1. fprimeprime_m wasn't initialized in UAMod 2, but was still used to compue cm_FS. I initialized to 0 until Alvaro can comment as to what it should be.
2. Df_c was changed to use T_fc instead of T_f, but T_fc was static when UAMod/=2 (it is based on a new state variable for UAMod==2). I modified the OtherState%sigma1c variable to be equal to the old %sigma1 to get the same results here.
- added ds to KC parameters so that we don't recalculate it in the update states routine.
-
His fix changes the calculation of DF_c.
Added MAP and more glue-code implementation
Added MAP_JacobianPInput, and bug fixes
Added DerivOrder information for output files.  Various bug fixes.  Finished glue code implementation.
Needed to avoid problems due to MAP load mesh not having moments
This code came from GHayman in Feb 2018; I fixed some merge conflicts and some minor details. It compiles (with the exception of UA driver) and gives same results as before.

I did not add the AFI driver or move the AFI code into a separate source-code directory,
Any airfoils that use "default" interpolation will see different results.
BEMTU_Wind was calculating Re based on dynamic viscosity instead of kinematic viscosity as reported here: OpenFAST#71

Fixed the calculation and cleaned up calling routines that don't need the airDens variable anymore.
The SSS_Excitation states were being misrepresented in the LinNames_x array due to an error when computing the number of states for a given DOF.

The HydroDyn continuous state names were not being set in the glue code.
The floating linearization feature includes Fortran-specific MAP++ datatypes which need to be including in the cmake build system.
added references to SS_Excitation module
bjonkman and others added 5 commits November 12, 2019 09:08
- Remove override of default C++ include paths. Source-file directories are included by default, so they don't need to be explicitly specified
- Remove link to (non-existent) WinSock2.h file in the vs-build directory; this should be found in the Windows SDK instead
Merge previous PRs into this one
@bjonkman
Copy link
Contributor

@rafmudaf and @ghaymanNREL: I've already updated the HydroDyn input files in the regression tests with the additional line required for this pull request. You can cherrypick those files from this commit bjonkman/r-test@411e037

@bjonkman
Copy link
Contributor

These merge conflicts are resolved in HaymanConsulting#13

Merged NREL dev into the branch and addressed merge conflicts
call SetErrStat( ErrID_Fatal,'RdtnDT must be equal to the glue-code DT if PotMod = 1 and using RdtnMod > 0 or ExctnMod > 1.',ErrStat,ErrMsg,RoutineName)
return
end if

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ghaymanNREL, @jjonkman : This new check prevents the ITIBarge regression test from running. Is this the correct logic? Or were the old input files set up improperly?

RdtnDT must be equal to the glue-code DT if PotMod = 1 and using RdtnMod > 0 or ExctnMod > 1

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been resolved?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ghaymanNREL sent me some email chains about this issue in February. After reading them, I inferred that the previous implementation of the RdtnDT time step was incorrect if it wasn't the same as the glue code, so they added this check. I changed the input file that was causing issues in the regression tests for PR #373 (see bjonkman/r-test@c2fe16a). Greg probably modified it in his r-test branch, too.

Actually, it looks like @jjonkman wanted the comment for RdtnDT to be updated to read

 Time step for wave radiation kernel calculations (sec) [only used when PotMod=1 and RdtnMod=1; DT<=RdtnDT<=0.1 recommended; determines RdtnOmegaMax=Pi/RdtnDT in the cosine transform]

Guess we should update that in the HD input files, too.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @rafmudaf created a new r-test branch for this PR from a commit on the r-test/bjonkman-linear branch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that @ghaymanNREL already had a branch with these changes, too (last October/November), so I made a pull request for @rafmudaf to merge that into his new branch.

@jonmtz
Copy link

jonmtz commented Feb 20, 2020

Dear all,

I am trying to use the latest commit of this branch to try the linearization tool for floating case, and I am executing the test 5MW_OC4Semi_Linear.
Nevertheless, when it starts performing the linearization it stops, and there is no progress in the simulation (more than 20 minutes waiting).

Error_linSim

How could I solve the problem?

Thank you in advance,

Jon

@jonmtz
Copy link

jonmtz commented Feb 21, 2020

Hi,

I ran the simulation again and left for a long time, and thakfully it finished. Nevertheless it took 24 minutes to perform the linearization.

Finished Simulation

Is it usual to need so much time?

Besides, there are small differences in the .lin file comparing to the windows-intel results. Here I should point that I have performed the simulation with cygwin64+CMake compilation, so that could be the cause.

Comparison Lin Results

I would appreciate feedback!

Best regards,

Jon

@jjonkman
Copy link
Collaborator

Well, I would normally suggest compiling OpenFAST in single precision; double precision is generally not necessary for accuracy (the variables that need double precision are defined in double even for single precision compiling) and compiling in single will run a lot faster. Also, the speed will depend on which compiler you are using and the optimization settings defined.

@jonmtz
Copy link

jonmtz commented Feb 28, 2020

Forgot to answer @jjonkman,

I compiled for single precision as you said and the linearization works faster (even if still a bit slow).

Thank you!

if (p%CompSub /= MODULE_None) call SetErrStat(ErrID_Fatal,'Linearization is not implemented for any of the substructure modules.',ErrStat, ErrMsg, RoutineName)
if (p%CompMooring /= MODULE_None) call SetErrStat(ErrID_Fatal,'Linearization is not implemented for any of the mooring modules.',ErrStat, ErrMsg, RoutineName)
!if (p%CompMooring /= MODULE_None) call SetErrStat(ErrID_Fatal,'Linearization is not implemented for any of the mooring modules.',ErrStat, ErrMsg, RoutineName)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bjonkman shouldn't this be

if (p%CompMooring == MODULE_MD) call SetErrStat(ErrID_Fatal,'Linearization is not implemented MoorDyn.',ErrStat, ErrMsg, RoutineName)
if (p%CompMooring == MODULE_FEAM) call SetErrStat(ErrID_Fatal,'Linearization is not implemented FEAMooring.',ErrStat, ErrMsg, RoutineName)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree that should be changed in case someone tries to linearize with a mooring module other than MAP.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it looks like I fixed this problem in #373.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can leave it as is in this PR.

@rafmudaf
Copy link
Collaborator

5MW_ITIBarge_DLL_WTurb_WavesIrr and all similar cases should have this input changed to 0.0125 to match the glue-code time step. Does this have any unintended impact?

Here's the error with the input unchanged:


 **************************************************************************************************
 OpenFAST

 Copyright (C) 2020 National Renewable Energy Laboratory
 Copyright (C) 2020 Envision Energy USA LTD

 This program is licensed under Apache License Version 2.0 and comes with ABSOLUTELY NO WARRANTY.
 See the "LICENSE" file distributed with this software for details.
 **************************************************************************************************

 OpenFAST-v2.3.0-210-g533fd372-dirty
 Compile Info:
  - Compiler: GCC version 7.5.0
  - Architecture: 64 bit
  - Precision: double
  - Date: Jun  5 2020
  - Time: 10:33:06
 Execution Info:
  - Date: 06/12/2020
  - Time: 13:26:45-0500

 OpenFAST input file heading:
     FAST Certification Test #22: NREL 5.0 MW Baseline Wind Turbine with ITI Barge Configuration,
     for use in offshore analysis

 Running ElastoDyn.
 Running AeroDyn14.
 Running InflowWind.

    Reading a 31x31 grid (145 m wide, 17.5 m to 162.5 m above ground) with a characteristic wind
    speed of 12 m/s. This full-field file was generated by TurbSim (v1.06.00, 21-Sep-2012) on
    07-Jan-2014 at 12:50:45.

    Processed 1442 time steps of 20-Hz full-field data (72.05 seconds).
 Running ServoDyn.
 Running ServoDyn Interface for Bladed Controllers.
 Running HydroDyn.

 FAST_InitializeAll:HydroDyn_Init:HydroDynInput_ProcessInitData:RdtnDT must be equal to the
 glue-code DT if PotMod = 1 and using RdtnMod > 0 or ExctnMod > 1.

� FAST encountered an error during module initialization.
  Simulation error level: FATAL ERROR

  Aborting OpenFAST.

@andrew-platt
Copy link
Collaborator

# Conflicts:
#	modules/openfast-library/src/FAST_Subs.f90
# Conflicts:
#	modules/openfast-library/src/FAST_Lin.f90
#	modules/openfast-library/src/FAST_Subs.f90
Adds the new ExtnMod parameter to the inputs. Baselines not changed.
@rafmudaf rafmudaf merged commit 226008c into OpenFAST:dev Jun 15, 2020
@rafmudaf rafmudaf mentioned this pull request Sep 11, 2020
@rafmudaf rafmudaf self-assigned this Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants