Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 9106f15

Browse files
authored
IO: adding excel file, hawcstab2 cmb, and misc updates from weio/welib (#31)
1 parent bc5b044 commit 9106f15

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1800
-124
lines changed

data/NREL5MW/Main_Onshore_OF.fst data/NREL5MW/Main_Onshore.fst

+12-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,20 @@ False Echo - Echo input data to <RootName>.ech (flag)
1818
0 CompSub - Compute sub-structural dynamics (switch) {0=None; 1=SubDyn}
1919
0 CompMooring - Compute mooring system (switch) {0=None; 1=MAP++; 2=FEAMooring; 3=MoorDyn; 4=OrcaFlex}
2020
0 CompIce - Compute ice loads (switch) {0=None; 1=IceFloe; 2=IceDyn}
21+
0 MHK - MHK turbine type (switch) {0=Not an MHK turbine; 1=Fixed MHK turbine; 2=Floating MHK turbine}
22+
---------------------- ENVIRONMENTAL CONDITIONS --------------------------------
23+
9.80665 Gravity - Gravitational acceleration (m/s^2)
24+
1.225 AirDens - Air density (kg/m^3)
25+
0 WtrDens - Water density (kg/m^3)
26+
1.464e-05 KinVisc - Kinematic viscosity of working fluid (m^2/s)
27+
335 SpdSound - Speed of sound in working fluid (m/s)
28+
103500 Patm - Atmospheric pressure (Pa) [used only for an MHK turbine cavitation check]
29+
1700 Pvap - Vapour pressure of working fluid (Pa) [used only for an MHK turbine cavitation check]
30+
0 WtrDpth - Water depth (m)
31+
0 MSL2SWL - Offset between still-water level and mean sea level (m) [positive upward]
2132
---------------------- INPUT FILES ---------------------------------------------
2233
"onshore/NREL5MW_ED_Onshore.dat" EDFile - Name of file containing ElastoDyn input parameters (quoted string)
23-
"NA" BDBldFile(1) - Name of file containing BeamDyn input parameters for blade 1 (quoted string)
34+
"5MW_Baseline/NRELOffshrBsline5MW_BeamDyn.dat" BDBldFile(1) - Name of file containing BeamDyn input parameters for blade 1 (quoted string)
2435
"NA" BDBldFile(2) - Name of file containing BeamDyn input parameters for blade 2 (quoted string)
2536
"NA" BDBldFile(3) - Name of file containing BeamDyn input parameters for blade 3 (quoted string)
2637
"onshore/NREL5MW_IW.dat" InflowFile - Name of file containing inflow wind input parameters (quoted string)

data/NREL5MW/onshore/NREL5MW_AD.dat

+17-18
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,28 @@ False CavitCheck - Perform cavitation check? (flag) [AFAeroMod m
1313
False CompAA - Flag to compute AeroAcoustics calculation [used only when WakeMod = 1 or 2]
1414
"unused" AA_InputFile - AeroAcoustics input file [used only when CompAA=true]
1515
====== Environmental Conditions ===================================================================
16-
1.225 AirDens - Air density (kg/m^3)
17-
1.464E-05 KinVisc - Kinematic air viscosity (m^2/s)
18-
335 SpdSound - Speed of sound (m/s)
19-
103500 Patm - Atmospheric pressure (Pa) [used only when CavitCheck=True]
20-
1700 Pvap - Vapour pressure of fluid (Pa) [used only when CavitCheck=True]
21-
0.5 FluidDepth - Water depth above mid-hub height (m) [used only when CavitCheck=True]
22-
====== Blade-Element/Momentum Theory Options ====================================================== [unused when WakeMod=0 or 3]
23-
2 SkewMod - Type of skewed-wake correction model (switch) {1=uncoupled, 2=Pitt/Peters, 3=coupled} [unused when WakeMod=0 or 3]
24-
"default" SkewModFactor - Constant used in Pitt/Peters skewed wake model {or "default" is 15/32*pi} (-) [used only when SkewMod=2; unused when WakeMod=0 or 3]
25-
True TipLoss - Use the Prandtl tip-loss model? (flag) [unused when WakeMod=0 or 3]
26-
True HubLoss - Use the Prandtl hub-loss model? (flag) [unused when WakeMod=0 or 3]
27-
True TanInd - Include tangential induction in BEMT calculations? (flag) [unused when WakeMod=0 or 3]
28-
False AIDrag - Include the drag term in the axial-induction calculation? (flag) [unused when WakeMod=0 or 3]
29-
False TIDrag - Include the drag term in the tangential-induction calculation? (flag) [unused when WakeMod=0,3 or TanInd=FALSE]
30-
"Default" IndToler - Convergence tolerance for BEMT nonlinear solve residual equation {or "default"} (-) [unused when WakeMod=0 or 3]
31-
100 MaxIter - Maximum number of iteration steps (-) [unused when WakeMod=0]
16+
default AirDens - Air density (kg/m^3)
17+
default KinVisc - Kinematic air viscosity (m^2/s)
18+
default SpdSound - Speed of sound (m/s)
19+
default Patm - Atmospheric pressure (Pa) [used only when CavitCheck=True]
20+
default Pvap - Vapour pressure of fluid (Pa) [used only when CavitCheck=True]
21+
====== Blade-Element/Momentum Theory Options ====================================================== [used only when WakeMod=1]
22+
2 SkewMod - Type of skewed-wake correction model (switch) {1=uncoupled, 2=Pitt/Peters, 3=coupled} [used only when WakeMod=1]
23+
"default" SkewModFactor - Constant used in Pitt/Peters skewed wake model {or "default" is 15/32*pi} (-) [used only when SkewMod=2; unused when WakeMod=0]
24+
True TipLoss - Use the Prandtl tip-loss model? (flag) [used only when WakeMod=1]
25+
False HubLoss - Use the Prandtl hub-loss model? (flag) [used only when WakeMod=1]
26+
True TanInd - Include tangential induction in BEMT calculations? (flag) [used only when WakeMod=1]
27+
False AIDrag - Include the drag term in the axial-induction calculation? (flag) [used only when WakeMod=1]
28+
False TIDrag - Include the drag term in the tangential-induction calculation? (flag) [used only when WakeMod=1 and TanInd=TRUE]
29+
"default" IndToler - Convergence tolerance for BEMT nonlinear solve residual equation {or "default"} (-) [used only when WakeMod=1]
30+
100 MaxIter - Maximum number of iteration steps (-) [used only when WakeMod=1]
3231
====== Dynamic Blade-Element/Momentum Theory Options ============================================== [used only when WakeMod=2]
3332
2 DBEMT_Mod - Type of dynamic BEMT (DBEMT) model {1=constant tau1, 2=time-dependent tau1} (-) [used only when WakeMod=2]
3433
4 tau1_const - Time constant for DBEMT (s) [used only when WakeMod=2 and DBEMT_Mod=1]
3534
====== OLAF -- cOnvecting LAgrangian Filaments (Free Vortex Wake) Theory Options ================== [used only when WakeMod=3]
36-
"unused" OLAFInputFileName - Input file for OLAF [used only when WakeMod=3]
35+
"unused" OLAFInputFileName - Input file for OLAF [used only when WakeMod=3]
3736
====== Beddoes-Leishman Unsteady Airfoil Aerodynamics Options ===================================== [used only when AFAeroMod=2]
38-
3 UAMod - Unsteady Aero Model Switch (switch) {1=Baseline model (Original), 2=Gonzalez's variant (changes in Cn,Cc,Cm), 3=Minnema/Pierce variant (changes in Cc and Cm)} [used only when AFAeroMod=2]
37+
3 UAMod - Unsteady Aero Model Switch (switch) {1=Baseline model (Original), 2=Gonzalezs variant (changes in Cn,Cc,Cm), 3=Minemma/Pierce variant (changes in Cc and Cm)} [used only when AFAeroMod=2]
3938
True FLookup - Flag to indicate whether a lookup for f' will be calculated (TRUE) or whether best-fit exponential equations will be used (FALSE); if FALSE S1-S4 must be provided in airfoil input files (flag) [used only when AFAeroMod=2]
4039
====== Airfoil Information =========================================================================
4140
1 AFTabMod - Interpolation method for multiple airfoil tables {1=1D interpolation on AoA (first table only); 2=2D interpolation on AoA and Re; 3=2D interpolation on AoA and UserProp} (-)

data/NREL5MW/onshore/NREL5MW_ED_Onshore.dat

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ NREL 5.0 MW Baseline Wind Turbine for Use in Offshore Analysis. Properties from
44
False Echo - Echo input data to "<RootName>.ech" (flag)
55
3 Method - Integration method: {1: RK4, 2: AB4, or 3: ABM4} (-)
66
"default" DT - Integration time step (s)
7-
---------------------- ENVIRONMENTAL CONDITION ---------------------------------
8-
9.80665 Gravity - Gravitational acceleration (m/s^2)
97
---------------------- DEGREES OF FREEDOM --------------------------------------
108
True FlapDOF1 - First flapwise blade mode DOF (flag)
119
True FlapDOF2 - Second flapwise blade mode DOF (flag)
@@ -32,7 +30,7 @@ False PtfmYDOF - Platform yaw rotation DOF (flag)
3230
0 BlPitch(3) - Blade 3 initial pitch (degrees) [unused for 2 blades]
3331
0 TeetDefl - Initial or fixed teeter angle (degrees) [unused for 3 blades]
3432
0 Azimuth - Initial azimuth angle for blade 1 (degrees)
35-
0.0 RotSpeed - Initial or fixed rotor speed (rpm)
33+
10.0 RotSpeed - Initial or fixed rotor speed (rpm)
3634
0 NacYaw - Initial or fixed nacelle-yaw angle (degrees)
3735
0 TTDspFA - Initial fore-aft tower-top displacement (meters)
3836
0 TTDspSS - Initial side-to-side tower-top displacement (meters)
@@ -210,6 +208,10 @@ True TabDelim - Use tab delimiters in text tabular output file? (fla
210208
"TwrBsMzt" - Side-to-side bending, fore-aft bending, and yaw moments at the base of the tower (platform)
211209
"RootMyb1"
212210
"NcIMUTVxs"
211+
"Q_DrTr" Displacement of drivetrain rotational-flexibility DOF
212+
"Q_GeAz" Displacement of variable speed generator DOF
213+
"QD_DrTr" Velocity of drivetrain rotational-flexibility DOF
214+
"QD_GeAz" Velocity of variable speed generator DOF
213215
END of input file (the word "END" must appear in the first 3 columns of this last OutList line)
214216
---------------------- NODE OUTPUTS --------------------------------------------
215217
1 BldNd_BladesOut - Blades to output

pyFAST/case_generation/case_gen.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def paramsStiff(p=None):
345345
p['EDFile|PtfmYDOF'] = 'False'
346346
return p
347347

348-
def paramsWS_RPM_Pitch(WS, RPM, Pitch, baseDict=None, FlatInputs=False):
348+
def paramsWS_RPM_Pitch(WS, RPM, Pitch, baseDict=None, flatInputs=False):
349349
"""
350350
Generate OpenFAST "parameters" (list of dictionaries with "address")
351351
chaing the inputs in ElastoDyn, InflowWind for different wind speed, RPM and Pitch
@@ -470,8 +470,8 @@ def createStepWind(filename,WSstep=1,WSmin=3,WSmax=25,tstep=100,dt=0.5,tmin=0,tm
470470

471471
#print(f.toDataFrame())
472472
#pass
473-
#createStepWind('tests.wnd',tstep=200,WSmax=28)
474-
# createStepWind('tests.wnd',tstep=200,WSmin=5,WSmax=7,WSstep=2)
473+
#createStepWind('test.wnd',tstep=200,WSmax=28)
474+
# createStepWind('test.wnd',tstep=200,WSmin=5,WSmax=7,WSstep=2)
475475

476476

477477

pyFAST/case_generation/examples/Example_CPLambdaPitch.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ def CPLambdaExample():
1212
""" Example to determine the CP-CT Lambda Pitch matrices of a turbine.
1313
This script uses the function CPCT_LambdaPitch which basically does the same as Parametric Examples given in this folder
1414
"""
15-
FAST_EXE = os.path.join(MyDir, "../../../../openfast/build/bin/openfast_x64.exe") # Location of a FAST exe (and dll)
15+
FAST_EXE = os.path.join(MyDir, '../../../data/openfast.exe') # Location of a FAST exe (and dll)
1616
ref_dir = os.path.join(MyDir, '../../../data/NREL5MW/') # Folder where the fast input files are located (will be copied)
17-
main_file = 'Main_Onshore_OF.fst' # Main file in ref_dir, used as a template
17+
main_file = 'Main_Onshore.fst' # Main file in ref_dir, used as a template
1818

1919
# --- Computing CP and CT matrices for range of lambda and pitches
20-
Lambda = np.linspace(0.1,10,20)
21-
Pitch = np.linspace(-2,10,20)
20+
Lambda = np.linspace(0.1,10,3)
21+
Pitch = np.linspace(-10,10,4)
2222

2323
CP,CT,Lambda,Pitch,MaxVal,result = case_gen.CPCT_LambdaPitch(ref_dir,main_file,Lambda,Pitch,fastExe=FAST_EXE,showOutputs=False,nCores=4,TMax=10)
2424

pyFAST/case_generation/examples/Example_ExcelFile.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
def main():
1717
# --- Main Parameters
1818
ref_dir = os.path.join(MyDir, '../../../data/NREL5MW/') # Folder where the fast input files are located (will be copied)
19-
FAST_EXE = FAST_EXE = os.path.join(MyDir, '../../../../openfast/build/bin/openfast_x64.exe') # Location of a FAST exe (and dll)
20-
main_file = 'Main_Onshore_OF.fst' # Main file in ref_dir, used as a template
19+
FAST_EXE = os.path.join(MyDir, '../../../data/openfast.exe') # Location of a FAST exe (and dll)
20+
main_file = 'Main_Onshore.fst' # Main file in ref_dir, used as a template
2121
work_dir = os.path.join(MyDir, '_NREL5MW_ParametricExcel/') # Output folder (will be created)
2222
parametricFile = 'ParametricExcel.xlsx' # Excel file containing set of parameters
2323

pyFAST/case_generation/examples/Example_Parametric.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def ParametricExample():
2828
2929
"""
3030
# --- Parameters for this script
31-
FAST_EXE = FAST_EXE = os.path.join(MyDir, '../../../../openfast/build/bin/openfast_x64.exe') # Location of a FAST exe (and dll)
31+
FAST_EXE = os.path.join(MyDir, '../../../data/openfast.exe') # Location of a FAST exe (and dll)
3232
ref_dir = os.path.join(MyDir, '../../../data/NREL5MW/') # Folder where the fast input files are located (will be copied)
33-
main_file = 'Main_Onshore_OF.fst' # Main file in ref_dir, used as a template
33+
main_file = 'Main_Onshore.fst' # Main file in ref_dir, used as a template
3434
work_dir = '_NREL5MW_Parametric/' # Output folder (will be created)
3535

3636
# --- Defining the parametric study (list of dictionnaries with keys as FAST parameters)

pyFAST/case_generation/examples/Example_PowerCurve_Parametric.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ def PowerCurveParametricExample1():
2323
- they values are the values corresponding to this parameter
2424
"""
2525
# --- Parameters for this script
26-
FAST_EXE = os.path.join(MyDir, '../../../../openfast/build/bin/openfast_x64.exe') # Location of a FAST exe (and dll)
26+
FAST_EXE = os.path.join(MyDir, '../../../data/openfast.exe') # Location of a FAST exe (and dll)
2727
ref_dir = os.path.join(MyDir, '../../../data/NREL5MW/') # Folder where the fast input files are located (will be copied)
28-
main_file = 'Main_Onshore_OF.fst' # Main file in ref_dir, used as a template
28+
main_file = 'Main_Onshore.fst' # Main file in ref_dir, used as a template
2929
work_dir = '_NREL5MW_PowerCurveParametric/' # Output folder (will be created)
3030

3131
# --- Defining the parametric study (list of dictionnaries with keys as FAST parameters)
@@ -82,9 +82,9 @@ def PowerCurveParametricExample2():
8282
- they values are the values corresponding to this parameter
8383
"""
8484
# --- Parameters for this script
85-
FAST_EXE = FAST_EXE = os.path.join(MyDir, '../../../../openfast/build/bin/openfast_x64.exe') # Location of a FAST exe (and dll)
85+
FAST_EXE = os.path.join(MyDir, '../../../data/openfast.exe') # Location of a FAST exe (and dll)
8686
ref_dir = os.path.join(MyDir, '../../../data/NREL5MW/') # Folder where the fast input files are located (will be copied)
87-
main_file = 'Main_Onshore_OF.fst' # Main file in ref_dir, used as a template
87+
main_file = 'Main_Onshore.fst' # Main file in ref_dir, used as a template
8888
work_dir = '_NREL5MW_PowerCurveParametric2/' # Output folder (will be created)
8989
out_Ext = '.outb' # Output extension
9090

pyFAST/case_generation/runner.py

+19-13
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# --- Tools for executing FAST
2323
# --------------------------------------------------------------------------------{
2424
# --- START cmd.py
25-
def run_cmds(inputfiles, exe, parallel=True, showOutputs=True, nCores=None, showCommand=True):
25+
def run_cmds(inputfiles, exe, parallel=True, showOutputs=True, nCores=None, showCommand=True, verbose=True):
2626
""" Run a set of simple commands of the form `exe input_file`
2727
By default, the commands are run in "parallel" (though the method needs to be improved)
2828
The stdout and stderr may be displayed on screen (`showOutputs`) or hidden.
@@ -31,13 +31,15 @@ def run_cmds(inputfiles, exe, parallel=True, showOutputs=True, nCores=None, show
3131
Failed=[]
3232
def _report(p):
3333
if p.returncode==0:
34-
print('[ OK ] Input : ',p.input_file)
34+
if verbose:
35+
print('[ OK ] Input : ',p.input_file)
3536
else:
3637
Failed.append(p)
37-
print('[FAIL] Input : ',p.input_file)
38-
print(' Directory: '+os.getcwd())
39-
print(' Command : '+p.cmd)
40-
print(' Use `showOutputs=True` to debug, or run the command above.')
38+
if verbose:
39+
print('[FAIL] Input : ',p.input_file)
40+
print(' Directory: '+os.getcwd())
41+
print(' Command : '+p.cmd)
42+
print(' Use `showOutputs=True` to debug, or run the command above.')
4143
#out, err = p.communicate()
4244
#print('StdOut:\n'+out)
4345
#print('StdErr:\n'+err)
@@ -68,13 +70,14 @@ def _report(p):
6870
_report(p)
6971
# --- Giving a summary
7072
if len(Failed)==0:
71-
print('[ OK ] All simulations run successfully.')
72-
return True
73+
if verbose:
74+
print('[ OK ] All simulations run successfully.')
75+
return True, Failed
7376
else:
7477
print('[FAIL] {}/{} simulations failed:'.format(len(Failed),len(inputfiles)))
7578
for p in Failed:
7679
print(' ',p.input_file)
77-
return False
80+
return False, Failed
7881

7982
def run_cmd(input_file_or_arglist, exe, wait=True, showOutputs=False, showCommand=True):
8083
""" Run a simple command of the form `exe input_file` or `exe arg1 arg2` """
@@ -116,7 +119,7 @@ class Dummy():
116119
return p
117120
# --- END cmd.py
118121

119-
def run_fastfiles(fastfiles, fastExe=None, parallel=True, showOutputs=True, nCores=None, showCommand=True, reRun=True):
122+
def run_fastfiles(fastfiles, fastExe=None, parallel=True, showOutputs=True, nCores=None, showCommand=True, reRun=True, verbose=True):
120123
if fastExe is None:
121124
fastExe=FAST_EXE
122125
if not reRun:
@@ -131,15 +134,15 @@ def run_fastfiles(fastfiles, fastExe=None, parallel=True, showOutputs=True, nCor
131134
newfiles.append(f)
132135
fastfiles=newfiles
133136

134-
return run_cmds(fastfiles, fastExe, parallel=parallel, showOutputs=showOutputs, nCores=nCores, showCommand=showCommand)
137+
return run_cmds(fastfiles, fastExe, parallel=parallel, showOutputs=showOutputs, nCores=nCores, showCommand=showCommand, verbose=verbose)
135138

136139
def run_fast(input_file, fastExe=None, wait=True, showOutputs=False, showCommand=True):
137140
if fastExe is None:
138141
fastExe=FAST_EXE
139142
return run_cmd(input_file, fastExe, wait=wait, showOutputs=showOutputs, showCommand=showCommand)
140143

141144

142-
def writeBatch(batchfile, fastfiles, fastExe=None, nBatches=1):
145+
def writeBatch(batchfile, fastfiles, fastExe=None, nBatches=1, pause=False):
143146
""" Write batch file, everything is written relative to the batch file"""
144147
if fastExe is None:
145148
fastExe=FAST_EXE
@@ -154,6 +157,9 @@ def writeb(batchfile, fastfiles):
154157
ff_rel = os.path.relpath(ff_abs, batchdir)
155158
l = fastExe_rel + ' '+ ff_rel
156159
f.write("%s\n" % l)
160+
if pause:
161+
f.write("pause\n") # windows only..
162+
157163
if nBatches==1:
158164
writeb(batchfile, fastfiles)
159165
else:
@@ -167,7 +173,7 @@ def writeb(batchfile, fastfiles):
167173

168174

169175

170-
def removeFASTOutputs(workDir):
176+
def removeFASTOuputs(workDir):
171177
# Cleaning folder
172178
for f in glob.glob(os.path.join(workDir,'*.out')):
173179
os.remove(f)

pyFAST/case_generation/tests/test_run_Examples.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ def test_run_examples(self):
2020
MyDir=os.path.dirname(__file__)
2121
files = glob.glob(os.path.join(MyDir,'../examples/[a-zA-Z]*.py'))
2222
import matplotlib.pyplot as plt
23-
plt.close('all')
2423
print('\n--------------------------------------------------------------')
2524
for f in files:
2625
print('Running example script: {}'.format(f))
2726
if hasattr(self,'subTest'):
2827
with self.subTest(filename=os.path.basename(f)):
2928
execfile(f, {'__name__': '__test__', 'print': lambda *_:None})
29+
plt.close('all')
3030

3131

3232
if __name__ == '__main__':

0 commit comments

Comments
 (0)