Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion pyFAST/case_generation/case_gen.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -339,7 +339,7 @@ def paramsStiff(p=dict()):
p['EDFile|PtfmYDOF'] = 'False'
return p

def paramsWS_RPM_Pitch(WS, RPM, Pitch, baseDict=None, flatInputs=False):
def paramsWS_RPM_Pitch(WS, RPM, Pitch, baseDict=None, FlatInputs=False):
"""
Generate OpenFAST "parameters" (list of dictionaries with "address")
chaing the inputs in ElastoDyn, InflowWind for different wind speed, RPM and Pitch
Expand Down
4 changes: 4 additions & 0 deletions pyFAST/input_output/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,3 +53,7 @@ ts = TurbSimFile('Turb.bts')
print(ts.keys())
print(ts['u'].shape)
```

TurbSim file processing
Including TurbSim input file modification, run and result export.
see [examples](pyFAST/input_output/examples/Example_TurbSim_Processing.py)
35 changes: 35 additions & 0 deletions pyFAST/input_output/examples/Example_TurbSim_Processing.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
from pyFAST.input_output import FASTInputFile
from pyFAST.case_generation import runner
from pyFAST.input_output import TurbSimFile
import pandas as pd

def main():
"""Modify TurbSim parameters and write"""
filename = '../tests/example_files/FASTIn_TurbSim.dat' # Name of TurbSim's input file
f = FASTInputFile(filename)
f['WrBLFF'] = False
f['WrADFF'] = True
f['WrADTWR'] = True
f['NumGrid_Z'] = 15
f['NumGrid_Y'] = 15
f['AnalysisTime'] = 600
f.write('../tests/example_files/FASTIn_TurbSim_change.dat') # Modified file name

"""Run TurbSim"""
TurbSim_FILE = '../tests/example_files/FASTIn_TurbSim_change.dat' # Input file
Turbsim_EXE = 'C:/Program Files/openfast/TurbSim_x64.exe' # Change to the path of the TurbSim executable
runner.run_cmd(TurbSim_FILE, Turbsim_EXE, wait=True, showOutputs=False, showCommand=True)

"""Open the turbulence box, containing the wind speed in 3 directions"""
ts = TurbSimFile('../tests/example_files/FASTIn_TurbSim_change.bts') # Output file
print(ts.keys())
print(ts['info'])
print(ts['u'].shape)

"""Save wind speed data in CSV format"""
fgp_data = pd.DataFrame(ts['u'][:,:,0,0]).T # 3D turbulence data for the first grid point
fgp_data.columns = ['streamwise wind speed', 'transverse wind speed', 'vertical wind speed'] # add columns name
fgp_data.to_csv('../tests/example_files/wind_data_of_first_grid_point.csv') # save data in CSV format

if __name__ == "__main__":
main()
74 changes: 74 additions & 0 deletions pyFAST/input_output/tests/example_files/FASTIn_TurbSim.dat
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
---------TurbSim v2.00.* Input File------------------------
Example input file for TurbSim.
---------Runtime Options-----------------------------------
False Echo - Echo input data to <RootName>.ech (flag)
2318573 RandSeed1 - First random seed (-2147483648 to 2147483647)
RANLUX RandSeed2 - Second random seed (-2147483648 to 2147483647) for intrinsic pRNG, or an alternative pRNG: "RanLux" or "RNSNLW"
False WrBHHTP - Output hub-height turbulence parameters in binary form? (Generates RootName.bin)
False WrFHHTP - Output hub-height turbulence parameters in formatted form? (Generates RootName.dat)
False WrADHH - Output hub-height time-series data in AeroDyn form? (Generates RootName.hh)
False WrADFF - Output full-field time-series data in TurbSim/AeroDyn form? (Generates RootName.bts)
True WrBLFF - Output full-field time-series data in BLADED/AeroDyn form? (Generates RootName.wnd)
False WrADTWR - Output tower time-series data? (Generates RootName.twr)
False WrFMTFF - Output full-field time-series data in formatted (readable) form? (Generates RootName.u, RootName.v, RootName.w)
False WrACT - Output coherent turbulence time steps in AeroDyn form? (Generates RootName.cts)
True Clockwise - Clockwise rotation looking downwind? (used only for full-field binary files - not necessary for AeroDyn)
0 ScaleIEC - Scale IEC turbulence models to exact target standard deviation? [0=no additional scaling; 1=use hub scale uniformly; 2=use individual scales]

--------Turbine/Model Specifications-----------------------
13 NumGrid_Z - Vertical grid-point matrix dimension
13 NumGrid_Y - Horizontal grid-point matrix dimension
0.05 TimeStep - Time step [seconds]
600 AnalysisTime - Length of analysis time series [seconds] (program will add time if necessary: AnalysisTime = MAX(AnalysisTime, UsableTime+GridWidth/MeanHHWS) )
"ALL" UsableTime - Usable length of output time series [seconds] (program will add GridWidth/MeanHHWS seconds unless UsableTime is "ALL")
84.2876 HubHt - Hub height [m] (should be > 0.5*GridHeight)
80.00 GridHeight - Grid height [m]
80.00 GridWidth - Grid width [m] (should be >= 2*(RotorRadius+ShaftLength))
0 VFlowAng - Vertical mean flow (uptilt) angle [degrees]
0 HFlowAng - Horizontal mean flow (skew) angle [degrees]

--------Meteorological Boundary Conditions-------------------
"SMOOTH" TurbModel - Turbulence model ("IECKAI","IECVKM","GP_LLJ","NWTCUP","SMOOTH","WF_UPW","WF_07D","WF_14D","TIDAL","API","USRINP","TIMESR", or "NONE")
"unused" UserFile - Name of the file that contains inputs for user-defined spectra or time series inputs (used only for "USRINP" and "TIMESR" models)
"1-Ed3" IECstandard - Number of IEC 61400-x standard (x=1,2, or 3 with optional 61400-1 edition number (i.e. "1-Ed2") )
"A" IECturbc - IEC turbulence characteristic ("A", "B", "C" or the turbulence intensity in percent) ("KHTEST" option with NWTCUP model, not used for other models)
"NTM" IEC_WindType - IEC turbulence type ("NTM"=normal, "xETM"=extreme turbulence, "xEWM1"=extreme 1-year wind, "xEWM50"=extreme 50-year wind, where x=wind turbine class 1, 2, or 3)
default ETMc - IEC Extreme Turbulence Model "c" parameter [m/s]
"PL" WindProfileType - Velocity profile type ("LOG";"PL"=power law;"JET";"H2L"=Log law for TIDAL model;"API";"USR";"TS";"IEC"=PL on rotor disk, LOG elsewhere; or "default")
"unused" ProfileFile - Name of the file that contains input profiles for WindProfileType="USR" and/or TurbModel="USRVKM" [-]
84.2876 RefHt - Height of the reference velocity (URef) [m]
18.2 URef - Mean (total) velocity at the reference height [m/s] (or "default" for JET velocity profile) [must be 1-hr mean for API model; otherwise is the mean over AnalysisTime seconds]
default ZJetMax - Jet height [m] (used only for JET velocity profile, valid 70-490 m)
default PLExp - Power law exponent [-] (or "default")
default Z0 - Surface roughness length [m] (or "default")

--------Non-IEC Meteorological Boundary Conditions------------
default Latitude - Site latitude [degrees] (or "default")
0.05 RICH_NO - Gradient Richardson number [-]
default UStar - Friction or shear velocity [m/s] (or "default")
default ZI - Mixing layer depth [m] (or "default")
default PC_UW - Hub mean u'w' Reynolds stress [m^2/s^2] (or "default" or "none")
default PC_UV - Hub mean u'v' Reynolds stress [m^2/s^2] (or "default" or "none")
default PC_VW - Hub mean v'w' Reynolds stress [m^2/s^2] (or "default" or "none")

--------Spatial Coherence Parameters----------------------------
default SCMod1 - u-component coherence model ("GENERAL", "IEC", "API", "NONE", or "default")
default SCMod2 - v-component coherence model ("GENERAL", "IEC", "NONE", or "default")
default SCMod3 - w-component coherence model ("GENERAL", "IEC", "NONE", or "default")
default InCDec1 - u-component coherence parameters for general or IEC models [-, m^-1] (e.g. "10.0 0.3e-3" in quotes) (or "default")
default InCDec2 - v-component coherence parameters for general or IEC models [-, m^-1] (e.g. "10.0 0.3e-3" in quotes) (or "default")
default InCDec3 - w-component coherence parameters for general or IEC models [-, m^-1] (e.g. "10.0 0.3e-3" in quotes) (or "default")
default CohExp - Coherence exponent for general model [-] (or "default")

--------Coherent Turbulence Scaling Parameters-------------------
"../tests/example_files/EventData" CTEventPath - Name of the path where event data files are located
"Random" CTEventFile - Type of event files ("LES", "DNS", or "RANDOM")
true Randomize - Randomize the disturbance scale and locations? (true/false)
1.0 DistScl - Disturbance scale [-] (ratio of event dataset height to rotor disk). (Ignored when Randomize = true.)
0.5 CTLy - Fractional location of tower centerline from right [-] (looking downwind) to left side of the dataset. (Ignored when Randomize = true.)
0.5 CTLz - Fractional location of hub height from the bottom of the dataset. [-] (Ignored when Randomize = true.)
30.0 CTStartTime - Minimum start time for coherent structures in RootName.cts [seconds]

====================================================
! NOTE: Do not add or remove any lines in this file!
====================================================