OpenFASTWorkshop NAWEAWindTech2023 Practical Branlard
OpenFASTWorkshop NAWEAWindTech2023 Practical Branlard
OpenFASTWorkshop NAWEAWindTech2023 Practical Branlard
Target audience:
[L1]: beginner
[L2]: standard user
[L3]: advanced user
NREL | 2
Outline
1. Choose your own adventure:
• [L2]: Challenges for standard users
• [L1]: Become a standard user
3. Tools:
• pyDatView
• python-toolbox (input/output, case generations)
• WEIS (DLC generation)
5. Your questions
NREL | 3
Tools overview
• OpenFAST realm:
• Glue codes executables (use multiple modules): openFAST, FAST.farm, TurbSim
• Driver executables (use a single module): aerodyn_driver, hydrodyn_driver
• Libraries: Simulink, C++ library, DISCON (controller), more and more C-libraries wrapped with python
They take input files and return outputs (files).
• WEIS: tools for preprocessing and postprocessing OpenFAST files (workhorse, e.g. DLC)
https://github.com/WISDEM/WEIS
NREL | 6
Challenges – OpenFAST Debugging
Your friend Luigi wants to go green and change his flag with a wind turbine. To avoid hitting his head
with the rotor, he had attached the rotor at a 30 deg yaw angle around the pole (slightly away from his
2D world). He his concerned about the yaw torsion of his flagpole. He has heard of OpenFAST, and he
knows tower torsion is not available in ElastoDyn, but he believes he can tune the yaw degree of
freedom to approximate the tower torsion of his pole.
He wonders:
1) What is the natural frequency and damping of the yaw degree of freedom of his structure only,
at standstill, without any wind, aerodynamics and rotation
2) What are these values when the turbine is spinning at a constant speed (9 rpm), with a wind of
8m/s, including aerodynamic forces (but he doesn’t want dynamic stall).
3) Can he adapt his model to get a structural frequency to 2.5 Hz instead?
He therefore setup an OpenFAST model, with a 30 deg yaw offset to the wind.
NREL | 8
Challenges –Text Editor
NOTE: I can help for Vim
• TE1: Setup syntax highlighting so that FAST input files look nicer
when you open them. Example specs:
• Extensions: .dat, .fst, .dvr, .inp
• Comments characters: !, #, ===
• Strings: “” or ‘’
• Numbers
• Keywords: True, False, default (case insensitive)
• TE3: Can you open the file where the cursor is located?
And then go back.
• TE4: Can you open a terminal in the same folder as the file you are
editing?
• TE5: When you are typing a filepath, can you autocomplete it with
existing files on your system?
NREL | 9
Challenges – Operating system and command prompt
• OS1: Can you open a terminal in a given folder from your file explorer?
Application: run openfast/turbsim from a given folder
• OS3: Can you copy/paste a filename from the file explorer to your
terminal?
Application: run openfast/turbsim on a given filename
• OS4: Can you add a directory to your system/user path so that binaries
within this folder are accessible in your terminal?
Application: put your openfast executables in one directory, access them everywhere
• OF3: How to export the axial induction for all the nodes of blade 1?
Hint: look for BldNd_BladesOut in the documentation.
NOTE: you can use pyDatView (FAST Radial average), and/or the python-toolbox examples
input_output/examples/Example_RadialPostPro.py to look at the average results.
• OF6: Can you prescribe a load time series at the tower top?
Hint: Use a nacelle structural controller, see “NumNStC”
NREL | 11
Challenges – Tools
• TO2: Can you install pyDatView? (try v0.4 or the latest dev version)
• Open several OpenFAST input and output files at once.
• Perform some FFT analyses, Compare signals, change the units.
• Try the menu “Data/Fast Radial average” on a simulation outputs that has multiple
radial outputs (like AB1N001alpha)
NREL | 12
Challenges – Developers [L3]
• Can you compile the aerodyn_driver, with OpenMP, debug and double precision?
Hint: cmake options: -DOPENMP=ON -DDOUBLE_PRECISION=ON -DCMAKE_BUILD_TYPE=Debug
NREL | 13
1. Chose your own adventure:
… …
AD_Blade.dat
tMax 5.5
Polar.dat
INPUTS
OUTPUT
EXE
NREL | 16
Inputs and outputs – Some notes [L1-L2]
• Filenames can be absolute (“C:/path/AeroDyn.dat”) or relative (“../AeroDyn.dat”, “./sub/AeroDyn.dat”)
• Relative paths are relative to the “parent file” that specify them, for instance:
the “main AeroDyn file” is relative to the “Main file (.fst)”
the “AeroDyn blade file” is relative to the “main AeroDyn file”
• Both “/” and “\” should work, but it’s recommended to use “/”
• Avoid filepaths with spaces.. but if you do, remember to surround them by quotes: “my folder/my file.dat”
NREL | 17
Getting OpenFAST
• Installation instructions:
https://openfast.readthedocs.io/en/main/source/install/index.html
• Windows:
https://github.com/OpenFAST/openfast/releases
(NOTE: the executable are also available from the tinyurl)
• Mac/Linux:
# Create a new conda environment
conda create -n openfast_env
# Install OpenFAST through the Conda Forge channel
conda install -c conda-forge openfast
# Test OpenFAST
openfast -v
• Navigate to the folder where the OpenFAST executable and main input file are:
cd path/to/folder
• Call the OpenFAST executable with the main input file as argument:
./openfast_x64.exe Main.fst
NREL | 19
Running OpenFAST – Some notes [L1-L2]
• The path to the executable can be absolute or relative to the current folder you are in:
• The path of the main input file can be absolute or relative to the current folder you are in:
• You can add the directory containing the OpenFAST executable to the system path or create an “alias” in your
terminal to avoid having to type the path to the executable all the time
(see Challenges OS4 and OS5)
• We recommend running OpenFAST from the directory where the main FST file is located.
• Avoid spaces in your filenames and directories
• Using the extension of the executable is optional on windows.
• The direction of the slashes depends on the OS and terminal (use “\” on windows, use “/” otherwise)
NREL | 20
Input file syntax
• There are many inputs, which can be overwhelming
• A bit of syntax highlighting makes it more “friendly” (See challenge TE1) NREL | 21
Output file and output channels [L1-L2]
• Each module define the output channels
at the end of their input file, after the key “ OutList”
• You can find the list of output channels available for each module in the OpenFAST repository:
docs/OtherSupporting/OutListParameters.xlsx
NREL | 22
Errors [L1-L2]
• User errors are common….
• OpenFAST should provide some kind of indication (The terminal output is Function1:Function2:Function[n]:Error Message )
Read the error messages carefully
• We’ll use the NREL 5-MW (sometimes, a simplified version of it), which is a fictitious but representative multi-MW
wind turbine. (https://www.nrel.gov/docs/fy09osti/38060.pdf)
Rated power 5 MW
Rated rotor speed 12.1 rpm
Hub Height 90 m
Rotor diameter 126 m
NREL | 25
Case 1 – Onshore turbine, structure only
• The turbine is only loaded by gravity, the tower is initially
displaced by 3m
• How to run and plot results (Note: Matlab script provided as well):
NREL | 27
Case 3 – Steady Wind of 8m/s with simple controller
• We add a simple controller (generator torque) using the ServoDyn module.
(we do not use a DLL to avoid platform compatibility issues)
• The turbine is started with a tower top displacement (to better see the tower
motion)
NREL | 28
Case 5 – Turbulent Wind ~8m/s with simple controller
• In AeroDyn, we add unsteady airfoil aerodynamics (AFAeroMod=2), tower
influence (TwrPotent=1), and aerodynamic forces on the tower
(TwrAero=True).
./TurbSim.exe ./TurbSimBox_8mps_5MW.inp
• It is important that the “box” dimensions are large enough to include the
rotor, and, because we use TwrAero, the tower as well ( WrADTWR)
NREL | 29
Case 5 – Turbulent Wind ~8m/s with simple controller
• Important inputs for this case:
• AeroDyn.dat: TwrAero, TwrPotent, AFAeroMod
• InflowWind.dat: WindType, FileName_BTS
• TurbSimBox*.inp: WrADFF, WrADTWR, NumGrid*,
AnalysisTime
RefHt, Uref, PLExp
TurbModel, IEC*
• Try running a longer simulation, changing the mean wind speed of the box,
changing the shear (PLExp). Try opening the box in pyDatView.
NREL | 30
40
Z
30
• We use the “offshore“ version of the NREL 5-MW mounted on a monopile (OC3
Monopile developed within IEA Wind Task 23 OC3 project)
20
• The sea state consists of regular waves with 2m height and 8s period
• Run OpenFAST on the Main.fst. Run the plot script. Open the JSON files in: -10
https://ebranlard.github.io/viz3Danim/
-20
2
0 2
-2 -20
OC3-Monopile Meshes –
HydroDyn (Blue, Green,
Red) & SubDyn (Gray)
Y X
NREL | 31
3. When you are on your own and
need help
Where to find help
• As much as possible, readthedocs:
https://openfast.readthedocs.io/en/
• Installing/compiling OpenFAST
• User Documentation
• Modules input files
• Modules theory (AeroAcoustics, OLAF, ExtPtfm,
SubDyn, Structural Control, FAST.Farm)
• Modules theory not in html (ElastoDyn,
~AeroDyn, HydroDyn, TurbSim)
• NOTE: a quick start, with practical usecases, is missing.
Hopefully one day! A preliminary version:
https://ebranlard-openfast.readthedocs.io/en/doc/sou
rce/working.html
NREL | 33
Input files change all the time….
• If you change version of OpenFAST the input files will likely change a bit.
We are aware that this is painful… it’ll take time for us to improve on that.
• [L1] Input file changes from one version to the next are documented here:
https://openfast.readthedocs.io/en/main/source/user/api_change.html
• [L1] You can find up-to-date example input files of the current stable
version of OpenFAST here:
https://github.com/OpenFAST/r-test/tree/main/glue-codes/openfast
• Navigate to
5MW_Baseline
• Click on a given file to see its format, copy paste content to a new
file on your computer, compare with your input file (we’ll cover
comparison later)
• [L2] If you are using a previous version, clone the repository and checkout
the corresponding version tag (and follow similar steps than above)
git clone https://github.com/OpenFAST/r-test/ NREL | 34
cd r-test
3. Tools to work with OpenFAST
pyDatView
Tool for 1D visualization of input and output files and some typical postprocessing:
https://github.com/ebranlard/pyDatView
• Windows installation:
• Download “setup.exe” files for stable, or latest dev:
https://github.com/ebranlard/pyDatView/releases
Install it. Then you’ll find pyDatView in the windows menu
You can pin it to the task bar and add file association.
• Or, clone the repo and install the dependencies
• Linux:
sudo apt-get install libgtk-3-dev # might need to be changed.
# Search for “How to install wxpython on [your OS]”
git clone https://github.com/ebranlard/pyDatView -b dev
cd pyDatView
python -m pip install --user -r requirements.txt
python pyDatView.py example_files/FASTIn_arf_coords.txt
NREL | 37
python-toolbox
• Currently the package is called pyFAST. We might rename it in the future because pyFAST is already
taken on pypi.
• Installation:
git clone http://github.com/OpenFAST/python-toolbox
cd python-toolbox
python -m pip install -e .
• Most of what pyDatView does can be scripted using the python-toolbox (or welib)
NREL | 38
python-toolbox – simple examples
(see Demos/python-toolbox from shared folder)
• Read an OpenFAST output file (binary or ascii), plot some signals (Example2.py):
import matplotlib.pyplot as plt
from pyFAST.input_output import FASTOutputFile
df = FASTOutputFile('FASTOutBin.outb').toDataFrame()
print(df.keys())
plt.plot(df['Time_[s]'], df['RotSpeed_[rpm]'])
NREL | 39
python-toolbox – simple examples
(see Demos/python-toolbox from shared folder)
NREL | 40
python-toolbox – simple examples
(see Demos/python-toolbox from shared folder)
• Read a CSV file with (alpha, Cl, etc) and write it to AeroDyn format (Example5.py):
from pyFAST.airfoils.Polar import Polar
polar = Polar('data/DU21_A17.csv', fformat='delimited')
ADpol = polar.toAeroDyn('data/AeroDyn_Polar_DU21_A17.dat’)
NREL | 41
python-toolbox – simple examples
Create input files for parametric simulations (Example7.py):
NREL | 43
WEIS - ROSCO
WEIS: Documentation and examples: https://github.com/WISDEM/WEIS
• WEIS is useful to run optimization studies, parametric studies, full DLC load cases, with batch
postprocessing, including rainflow counting.
• You will likely still need the python-toolbox for “granularity” (simple tasks)
NREL | 44
4. More difficult runs:
OLAF, Linearization
OLAF – Guidelines
We always have to setup and adapt the OLAF parameters. The guidelines of the documentation are a good start:
https://openfast.readthedocs.io/en/dev/source/user/aerodyn-olaf/RunningOLAF.html#guidelines
• We compare BEM and OLAF. OLAF parameters are not tuned in this example!
• The OLAF simulation generates VTK files in the folder vtk_fvw (see OLAF inputs WrVTK and
GridOuts)
• The postprocessing script (PlotSimulationResults.*) compares BEM/OLAF and shows the velocity field
at the end of the simulation
NREL | 47
OLAF – Case 9
Before parameter setup: (wake way too short, spiky velocity field)
Note: we still need to run longer, convergence has not been reached.
The guidelines estimate the transient time to be 186s
NREL | 48
Linearization – Some preliminary notes
• Warning: The process can be tedious and time consuming ([L3], but we’ll try step by step…)
• Simplified theory: A
Given a nonlinear state equation:
We can linearize it about an operating point using a Taylor expansion:
An eigenvalue analysis of A gives: frequencies, dampings, modes of the system
• Implementation:
• OpenFAST performs similar operations than this simplified theory behind the scene, with added complexity due to the modular
framework, and the account of algebraic constraints, see Jonkman et al. 2016, 2018.
• The “same code” is run within OpenFAST during time-domain simulations and during linearization
• OpenFAST mostly use finite differences to compute Jacobian
• A subset of the modelling options is available when doing linearization
(for instance in AeroDyn we need FrozenWake=True, WakeMod=1, AFAeroMod=1, in ServoDyn we need the simple VS controller)
NREL | 49
Linearization – Some preliminary notes
• Rotating system:
• When the system is rotating, the operating point is a periodic steady state.
• We need to linearize multiple times across one revolution.
• Due to the presence of states in the rotating frame, a multi-blade coordinate transform needs to be applied to the “A” matrices
before averaging them over one revolution.
• In practice:
• Linearization is activated using the Linearize input file switch “Linfile (.lin)”
• It’s the user responsibility to ensure the operating point is an equilibrium point.
• A trimming algorithm is available to help this process.
NREL | 50
Linearization – Case 10 – Blade Only in Vacuum
(See Simulations/10_Linearization_BladeOnly_Vacuum in shared folder)
• The postprocessing script (postpro_SimpleEigenAnalysis.*) performs a simple eigenvalue analysis on the A matrix:
Nat. freq. [Hz] Damping ratio [%] Mode Identified
0.6717 0.4738 1 st Flap
1.0791 0.4712 1 st Edge
1.9809 0.4894 2 nd Flap
NREL | 51
Linearization – Case 11 – Rotating
(See Simulations/11_Linearization_Rotating in shared folder)
• Three blades, Blade DOFs on and generator DOF on (others are off)
• Wind Speed=8m/s, Target rotational speed of 9 rpm.
• Linearization is obtained using a “Trim” algorithm (CalcSteady), which ensures that the rotational speed
is as specified. The trim algorithm continuously adapts the generator torque or pitch angle (depending on
TrimCase), and waits for a (periodic) equilibrium to be reached.
• 36 “lin-files” are generated over one rotor revolution (based on input NLinTimes)
• You can also try the script (postpro_MultiLin_Campbell.py) which is intended for several
Operating points (OP)
#, NatFreq_[Hz], DampRatio_[-], M
1, 0.588, 0.632 , E
2, 0.722, 0.526 , E
3, 0.841, 0.441 , E
4, 0.937, 0.016 , E
5, 1.237, 0.012 , E
6, 1.837, 0.155 , E
7, 1.987, 0.142 , E
8, 2.133, 0.133 , E
9, 2.256, 0.022 , E
NREL | 53
Linearization – Case 12 – Campbell diagram
(See Simulations/12_Campbell in shared folder)
• All degrees of freedom are ON, except generator (to avoid switching between TrimGain=2 and TrimGain=3)
• The operating conditions are specified in a CSV file (rotor speed, wind speed, pitch)
• The script runCampbel_NoServo.*:
• Generates input files for each operating conditions
• Runs OpenFAST (the trim algorithm is used to find a periodic steady state)
• Postprocess the linfiles, generates a set of Campbell files “Campbell_*.*”, and plots them
NREL | 54
Linearization – Case 11 – Campbell diagram
• In this case, the identification works fine
• Usually, the user needs to adjust the Mode ID file: “Campbell_ModesID.csv” file
• You can try plotting the Campbell diagram using a different ID file:
• You can also rerun the script runCampbell*.py setting: writeFSTfiles = False,
runFast=False, and changing the variable modeID_file
NREL | 55
Linearization – Some more notes
• Mode Identification is usually difficult and time consuming
• When the Generator DOF is ON (Using the simplified controller), depending on the wind speed, the user needs to switch between:
• TrimGain=2 in Region2 (Generator Torque control)
• TrimCase=3 in Region 3 (Pitch control)
• At the boundary between the two, things can be tricky. A good hack is, in Region 3, to set the rated speed to a small value so
that Qgen=Qrated, for instance VS_RtGnSp = 0.01
• The python function writeLinearizationFiles (pyFAST), should take care of all of that (remember to set trimGainPitch,
trimGainGenTorque, and possibly maxTrq). The Operating point file needs to contain the Generator Torque so that the function can
decide when to switch from region 2 and 3.
• It can happen that the trim algorithm does not find a periodic steady state (even after a long time like 5400s). The latest OpenFAST will
output one lin time at the end of the simulation.
• 3D visualization of mode shapes is possible, but even more tedious. You can read about it here:
https://ebranlard-openfast.readthedocs.io/en/doc/source/working.html