Skip to content

Commit

Permalink
OpenFAST Aerodynamic Map Generator (#1733)
Browse files Browse the repository at this point in the history
* Linear: use subroutine to write linearization files

`WriteModuleLinearMatrices` is general and can be called by all modules that have linearization routines.

* Linear: add (commented-out) variable for debugging

* Linear: sync spacing/case/comments

* FAST subs: write output file after closing modules

This allows more memory to be allocated when writing the binary file (because we've deallocated things when closing the individual modules).

* FAST subs: add allocation check

also fix some comments

* FAST subs: add `HubRad` var to help integrate with other structural solvers

* Linear trim solution: add error check

Since the trim solution seems to always converge on the first step when NLinTimes == 1 (see #857), I added a warning and overwrite NLinTimes to be 2 instead. This should be removed when #857 is fixed

* FAST subs: update spacing and comments

* AeroMap/SteadyState: Add driver for aeromaps

Note: This does not yet have the changes for AeroDyn in it.

* added example aeromap input file

* Fix UA linearization in VTK mode shape restore

* update r-test pointer

* FAST Registry: fix typos

* Updates for aero maps

* Add some warnings for AeroMaps

* r-test: Attempt to add steadystate/aeromap test

* add some debugging statement to linear regression test

* add BD instance number back to the first BD linear file name

* Minor tweaks for linearization cases

- update ideal beam cases to run in single precision
- don't build controllers for linearization cases
- update some documentation

* debugging statements for linearization r-test on github actions

* Fix name for BD lin files + update AD inputs from IfW in SS solve

Update the rest of the OpenFAST "InflowOn..." inputs to AeroDyn

* AD/SS: Fix for setting invalid field

* revert change to r-test fixed-free and free-free tower size

* Response to EB comments on #1733

- remove comment lines that look like git merge conflict lines
- move some SS parameters to FAST_Types (though that didn't solve the issue)
- change extension on aero map input files from ".inp" to ".dvr".
  • Loading branch information
bjonkman authored Aug 22, 2023
1 parent e831e7a commit 9580fe5
Show file tree
Hide file tree
Showing 22 changed files with 3,867 additions and 457 deletions.
52 changes: 50 additions & 2 deletions .github/workflows/automated-dev-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ jobs:
run: |
ctest -VV -j8 \
-L openfast \
-LE "cpp|linear|python|fastlib" \
-LE "cpp|linear|python|fastlib|aeromap" \
-E "5MW_OC4Semi_WSt_WavesWN|5MW_OC3Mnpl_DLL_WTurb_WavesIrr|5MW_OC4Jckt_DLL_WTurb_WavesIrr_MGrowth|5MW_OC3Trpd_DLL_WSt_WavesReg|5MW_Land_BD_DLL_WTurb"
- name: Failing test artifacts
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -648,6 +648,55 @@ jobs:
code-coverage-cobertura: code-coverage/coverage.xml


rtest-OF-5MW_Land_AeroMap:
runs-on: ubuntu-22.04
needs: build-openfast-release
steps:
- name: Cache the workspace
uses: actions/[email protected]
with:
path: ${{runner.workspace}}
key: build-openfast-release-${{ github.sha }}
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy "Bokeh>=2.4,!=3.0.0,!=3.0.1,!=3.0.2,!=3.0.3"
sudo apt-get update -y
sudo apt-get install -y libopenblas-dev libopenblas-openmp-dev
sudo apt-get install -y libhdf5-dev libopenmpi-dev libyaml-cpp-dev
- name: Configure Tests
working-directory: ${{runner.workspace}}/openfast/build
run: |
cmake \
-DPython_ROOT_DIR:STRING=${{env.pythonLocation}} \
-DBUILD_TESTING:BOOL=ON \
-DCTEST_PLOT_ERRORS:BOOL=ON \
${GITHUB_WORKSPACE}
- name: Run 5MW aero map tests
working-directory: ${{runner.workspace}}/openfast/build
run: |
ctest -VV -L aeromap -LE "cpp|linear|python" -R 5MW_Land_AeroMap
- name: Failing test artifacts
uses: actions/upload-artifact@v3
if: failure()
with:
name: rtest-OF-5MW_Land_AeroMap
path: |
${{runner.workspace}}/openfast/build/reg_tests/modules
${{runner.workspace}}/openfast/build/reg_tests/glue-codes/openfast
!${{runner.workspace}}/openfast/build/reg_tests/glue-codes/openfast/5MW_Baseline
!${{runner.workspace}}/openfast/build/reg_tests/glue-codes/openfast/AOC
!${{runner.workspace}}/openfast/build/reg_tests/glue-codes/openfast/AWT27
!${{runner.workspace}}/openfast/build/reg_tests/glue-codes/openfast/SWRT
!${{runner.workspace}}/openfast/build/reg_tests/glue-codes/openfast/UAE_VI
!${{runner.workspace}}/openfast/build/reg_tests/glue-codes/openfast/WP_Baseline
rtest-OF-5MW_OC4Semi_WSt_WavesWN:
runs-on: ubuntu-22.04
needs: build-openfast-release
Expand Down Expand Up @@ -927,7 +976,6 @@ jobs:
-DBUILD_TESTING:BOOL=ON \
-DCTEST_PLOT_ERRORS:BOOL=ON \
${GITHUB_WORKSPACE}
cmake --build . --target regression_test_controllers
- name: Run OpenFAST linearization tests
working-directory: ${{runner.workspace}}/openfast/build
run: |
Expand Down
40 changes: 40 additions & 0 deletions docs/source/user/aeromap/examples/AeroMap.dvr
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
------- OpenFAST AeroMap INPUT FILE ----------------------------------------------
AeroMap generation for FAST Certification Test #18: NREL 5.0 MW Baseline Wind Turbine (Onshore)
---------------------- OpenFAST MODEL FILE ---------------------------------------
"openfast.fst" FstFile - Name of the primary OpenFAST input file (-)
---------------------- STEADY-STATE SIMULATION CONTROL --------------------------------------
false Echo - Echo input data to <RootName>.ech (flag)
1e-4 Toler - Convergence tolerance for nonlinear solve residual equation [>0] (-)
50 MaxIter - Maximum number of iteration steps for nonlinear solve [>0] (-)
1 N_SSJac - Number of iteration steps to recalculate steady-state Jacobian (-) [1=every iteration step, 2=every other step] (Note: for large flexible blades, this almost always needs to be 1)
1E+05 SSJacSclFact - Scaling factor used in steady-state Jacobians (-) [on order of blade mass in kg]
---------------------- STEADY-STATE CASES --------------------------------------
1 WindSpeedOrTSR - Choice of swept parameter (switch) { 1:wind speed; 2: TSR }
25 NumCases - Number of cases to run
RotSpeed WndSpeedOrTSR Pitch
(rpm) (m/s or -) (deg)
8.0000 3.0000 0.0000
8.0000 6.0000 0.0000
8.0000 9.0000 0.0000
8.0000 12.0000 0.0000
8.0000 15.0000 0.0000
8.0000 15.0000 3.0000
8.0000 12.0000 3.0000
8.0000 9.0000 3.0000
8.0000 6.0000 3.0000
8.0000 3.0000 3.0000
8.0000 3.0000 6.0000
8.0000 6.0000 6.0000
8.0000 9.0000 6.0000
8.0000 12.0000 6.0000
8.0000 15.0000 6.0000
8.0000 15.0000 9.0000
8.0000 12.0000 9.0000
8.0000 9.0000 9.0000
8.0000 6.0000 9.0000
8.0000 3.0000 9.0000
8.0000 3.0000 12.0000
8.0000 6.0000 12.0000
8.0000 9.0000 12.0000
8.0000 12.0000 12.0000
8.0000 15.0000 12.0000
10 changes: 8 additions & 2 deletions glue-codes/openfast/src/FAST_Prog.f90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ PROGRAM FAST


USE FAST_Subs ! all of the ModuleName and ModuleName_types modules are inherited from FAST_Subs

USE FAST_SS_Subs, ONLY : FAST_RunSteadyStateDriver

IMPLICIT NONE

! Local parameters:
Expand All @@ -58,7 +59,7 @@ PROGRAM FAST
! determine if this is a restart from checkpoint
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CALL NWTC_Init() ! initialize NWTC library (set some global constants and if necessary, open console for writing)
ProgName = 'OpenFAST'
ProgName = FAST_Ver%Name
InputFile = ""
CheckpointRoot = ""

Expand All @@ -76,6 +77,11 @@ PROGRAM FAST
Restart_step = Turbine(1)%p_FAST%n_TMax_m1 + 1
CALL ExitThisProgram_T( Turbine(1), ErrID_None, .true., SkipRunTimeMsg = .TRUE. )

ELSE IF ( TRIM(FlagArg) == 'STEADYSTATE' ) THEN ! Do steady-state analysis, not time-marching -- this works for only 1 turbine (i.e., NumTurbines==1)!

! this runs the steady-state solver driver and ENDS the program:
CALL FAST_RunSteadyStateDriver( Turbine(1) )

ELSEIF ( LEN( TRIM(FlagArg) ) > 0 ) THEN ! Any other flag, end normally
CALL NormStop()

Expand Down
13 changes: 8 additions & 5 deletions modules/aerodyn/src/AeroDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut
InputFileData%TwrAero = .false.
InputFileData%FrozenWake = .false.
!InputFileData%CavitCheck = .false.
!InputFileData%TFinAero = .false. ! not sure if this needs to be set or not
end do

if (InputFileData%WakeMod == WakeMod_DBEMT) then
Expand Down Expand Up @@ -1292,6 +1293,8 @@ subroutine SetParameters( InitInp, InputFileData, RotData, p, p_AD, ErrStat, Err
ErrMsg = ""

p_AD%UA_Flag = InputFileData%AFAeroMod == AFAeroMod_BL_unsteady
p_AD%CompAeroMaps = InitInp%CompAeroMaps

p%MHK = InitInp%MHK

p_AD%DT = InputFileData%DTAero
Expand Down Expand Up @@ -1596,10 +1599,10 @@ subroutine AD_UpdateStates( t, n, u, utimes, p, x, xd, z, OtherState, m, errStat
integer(intKi) :: iR ! Counter on rotors
integer :: i
real(DbKi) :: BEMT_utimes(2) !< Times associated with m%BEMT_u(:), in seconds
type(AD_InputType) :: uInterp ! Interpolated/Extrapolated input
integer(intKi) :: ErrStat2 ! temporary Error status
character(ErrMsgLen) :: ErrMsg2 ! temporary Error message
character(*), parameter :: RoutineName = 'AD_UpdateStates'
type(AD_InputType) :: uInterp ! Interpolated/Extrapolated input
integer(intKi) :: ErrStat2 ! temporary Error status
character(ErrMsgLen) :: ErrMsg2 ! temporary Error message
character(*), parameter :: RoutineName = 'AD_UpdateStates'

ErrStat = ErrID_None
ErrMsg = ""
Expand Down Expand Up @@ -3131,7 +3134,7 @@ subroutine SetInputsForFVW(p, u, m, errStat, errMsg)
integer(intKi) :: ErrStat2
character(ErrMsgLen) :: ErrMsg2
character(*), parameter :: RoutineName = 'SetInputsForFVW'
integer :: iW
integer :: iW

ErrStat = ErrID_None
ErrMsg = ""
Expand Down
2 changes: 1 addition & 1 deletion modules/nwtc-library/src/NWTC_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ MODULE NWTC_IO

LOGICAL :: Beep = .TRUE. !< Flag that specifies whether or not to beep for error messages and program terminations.

CHARACTER(20) :: ProgName = ' ' !< The name of the calling program. DO NOT USE THIS IN NEW PROGRAMS (Modules)
CHARACTER(25) :: ProgName = ' ' !< The name of the calling program. DO NOT USE THIS IN NEW PROGRAMS (Modules)
CHARACTER(99) :: ProgVer = ' ' !< The version (including date) of the calling program. DO NOT USE THIS IN NEW PROGRAMS
CHARACTER(1), PARAMETER :: Tab = CHAR( 9 ) !< The tab character.
CHARACTER(*), PARAMETER :: CommChars = '!#%' !< Comment characters that mark the end of useful input
Expand Down
2 changes: 2 additions & 0 deletions modules/openfast-library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ add_library(openfast_postlib STATIC
src/FAST_Mods.f90
src/FAST_Subs.f90
src/FAST_Solver.f90
src/FAST_SS_Subs.f90
src/FAST_SS_Solver.f90
)
target_link_libraries(openfast_postlib openfast_prelib extinflowlib scfastlib)
target_include_directories(openfast_postlib PUBLIC
Expand Down
Loading

0 comments on commit 9580fe5

Please sign in to comment.