Skip to content

Commit

Permalink
Add turbulent gust wind types
Browse files Browse the repository at this point in the history
  • Loading branch information
abhineet-gupta committed Jan 20, 2025
1 parent 0be3634 commit 92c20ad
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 25 deletions.
14 changes: 7 additions & 7 deletions weis/aeroelasticse/IEC_CoeherentGusts.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ def execute(self, dir, base_name, dlc):

wind_file_name = os.path.join(dir, base_name + '_' + dlc.IEC_WindType + '_U%1.6f'%dlc.URef + '_D%s'%dlc.direction_pn + '_S%s'%dlc.shear_hv + '.wnd')

if dlc.IEC_WindType == 'EOG':
if dlc.IEC_WindType.split('-')[-1] == 'EOG':
self.EOG(dlc, wind_file_name)
elif dlc.IEC_WindType == 'EDC':
elif dlc.IEC_WindType.split('-')[-1] == 'EDC':
self.EDC(dlc, wind_file_name)
elif dlc.IEC_WindType == 'ECD':
elif dlc.IEC_WindType.split('-')[-1] == 'ECD':
self.ECD(dlc, wind_file_name)
elif dlc.IEC_WindType == 'EWS':
elif dlc.IEC_WindType.split('-')[-1] == 'EWS':
self.EWS(dlc, wind_file_name)
elif dlc.IEC_WindType == 'Ramp':
elif dlc.IEC_WindType.split('-')[-1] == 'Ramp':
self.Ramp(dlc, wind_file_name)
elif dlc.IEC_WindType == 'Step':
elif dlc.IEC_WindType.split('-')[-1] == 'Step':
self.Step(dlc, wind_file_name)
elif dlc.IEC_WindType == 'Custom':
wind_file_name = dlc.wind_file
Expand Down Expand Up @@ -337,7 +337,7 @@ def wnd2bts(self, data, y, z):

return ts

def add_turbulence(fname, u, v = None, w = None, time = None, HH = None, new_fname = None):
def add_turbulence(self,fname, u, v = None, w = None, time = None, HH = None, new_fname = None):
"""
Creates a new BTS file using the turbulence of an existing BTS file,
combined with time-varying u (and possibly v and w) signals.
Expand Down
28 changes: 26 additions & 2 deletions weis/aeroelasticse/turbsim_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ def generate_wind_files(dlc_generator, FAST_namingOut, wind_directory, rotorD, h

if dlc_generator.cases[i_case].turbulent_wind:
# Write out turbsim input file

# If IEC_WindType is Turbulent-<Gust>, create a temporary NTM turbulent file to be used to add turbulence to gust later
Turbulent_Gust = False
if dlc_generator.cases[i_case].IEC_WindType.split('-')[0] == 'Turbulent':
Turbulent_Gust = True
actualwindtype = dlc_generator.cases[i_case].IEC_WindType
dlc_generator.cases[i_case].IEC_WindType = 'NTM'

turbsim_input_file_name = FAST_namingOut + '_' + dlc_generator.cases[i_case].IEC_WindType + (
'_U%1.6f'%dlc_generator.cases[i_case].URef +
'_Seed%1.1f'%dlc_generator.cases[i_case].RandSeed1) + '.in'
Expand Down Expand Up @@ -261,8 +269,12 @@ def generate_wind_files(dlc_generator, FAST_namingOut, wind_directory, rotorD, h

# Pass data to CaseGen_General to call OpenFAST
wind_file_type = 3

# If IEC_WindType is Turbulent-<Gust>, switch IEC_WindType variable back to original wind type
if Turbulent_Gust:
dlc_generator.cases[i_case].IEC_WindType = actualwindtype

else:
if not dlc_generator.cases[i_case].turbulent_wind or dlc_generator.cases[i_case].IEC_WindType.split('-')[0]=='Turbulent':
if dlc_generator.cases[i_case].IEC_WindType == 'Steady':
wind_file_type = 1
wind_file_path_InflowWind = 'unused'
Expand All @@ -279,5 +291,17 @@ def generate_wind_files(dlc_generator, FAST_namingOut, wind_directory, rotorD, h
wind_file_path_InflowWind = os.path.join("wind", os.path.basename(wind_file_name))
else:
wind_file_path_InflowWind = wind_file_name
wind_file_type = 2

if dlc_generator.cases[i_case].IEC_WindType.split('-')[0]=='Turbulent':
turbulent_NTM_file = os.path.join(wind_directory, FAST_namingOut + '_NTM' +
('_U%1.6f'%dlc_generator.cases[i_case].URef +
'_Seed%1.1f'%dlc_generator.cases[i_case].RandSeed1) + '.bts')
wind_file_path_InflowWind = os.path.join(wind_directory, FAST_namingOut + '_' +
dlc_generator.cases[i_case].IEC_WindType + ('_U%1.6f'%dlc_generator.cases[i_case].URef +
'_Seed%1.1f'%dlc_generator.cases[i_case].RandSeed1) + '.bts')
gusts.write_bts(bts_fname = turbulent_NTM_file, wnd_fname = wind_file_name, new_fname = wind_file_path_InflowWind)
wind_file_type = 3
else:
wind_file_type = 2

return wind_file_type, wind_file_path_InflowWind
32 changes: 17 additions & 15 deletions weis/dlc_driver/dlc_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,33 +401,35 @@ def generate_cases(self,generic_case_inputs,dlc_options):
# DLC specific: Make idlc for other parts of WEIS (mostly turbsim generation)
for _, case in enumerate(generic_case_list):
idlc = DLCInstance(options=dlc_options)
if dlc_options['IEC_WindType'] == 'ECD':
idlc.turbulent_wind = False
idlc.turbulent_wind = False

if dlc_options['IEC_WindType'].split('-')[-1] == 'ECD':
idlc.direction_pn = case['direction']
elif dlc_options['IEC_WindType'] == 'EOG':
idlc.turbulent_wind = False
elif dlc_options['IEC_WindType'].split('-')[-1] == 'EOG':
idlc.sigma1,idlc.V_e1 = self.IECturb.EOG(case['wind_speed'])
elif dlc_options['IEC_WindType'] == 'EWS':
idlc.turbulent_wind = False
elif dlc_options['IEC_WindType'].split('-')[-1] == 'EWS':
idlc.direction_pn = case['direction']
idlc.shear_hv = case['shear']
idlc.sigma1 = self.IECturb.NTM(case['wind_speed'])
elif dlc_options['IEC_WindType'] == 'Steady':
idlc.turbulent_wind = False
elif dlc_options['IEC_WindType'] == 'Ramp':
idlc.turbulent_wind = False
elif dlc_options['IEC_WindType'].split('-')[-1] == 'Ramp':
idlc.ramp_speeddelta = dlc_options['ramp_speeddelta']
idlc.ramp_duration = dlc_options['ramp_duration']
idlc.gust_wait_time = dlc_options['gust_wait_time']
elif dlc_options['IEC_WindType'] == 'Step':
idlc.turbulent_wind = False
elif dlc_options['IEC_WindType'].split('-')[-1] == 'Step':
idlc.step_speeddelta = dlc_options['step_speeddelta']
idlc.gust_wait_time = dlc_options['gust_wait_time']
elif dlc_options['IEC_WindType'] == 'Steady':
pass
elif dlc_options['IEC_WindType'] == 'Custom':
idlc.turbulent_wind = False
pass
else:
idlc.turbulent_wind = True
idlc.RandSeed1 = case['wind_seed']

if dlc_options['IEC_WindType'].split('-')[0] == 'Turbulent':
idlc.turbulent_wind = True
idlc.RandSeed1 = case['wind_seed']

idlc.URef = case['wind_speed']
idlc.label = dlc_options['label']
idlc.total_time = case['total_time']
Expand Down Expand Up @@ -849,7 +851,7 @@ def generate_Ramp(self, dlc_options):
# DLC Specific options:
dlc_options['label'] = 'Ramp'
dlc_options['sea_state'] = 'normal'
dlc_options['IEC_WindType'] = 'Ramp'
dlc_options['IEC_WindType'] = 'Turbulent-Ramp'

# Set yaw_misalign, else default
if 'yaw_misalign' in dlc_options:
Expand Down Expand Up @@ -1013,7 +1015,7 @@ def generate_2p3(self, dlc_options):
dlc_options['PSF'] = 1.1 # For fault cases, psf depends on the mean-time between faults

if 'genfault_time' not in dlc_options:
raise Exception('genfault_time must be set for the DLC 2.3')
raise Exceptionf('genfault_time must be set for the DLC 2.3')

# azimuth starting positions
dlc_options['azimuth_init'] = np.linspace(0.,120.,dlc_options['n_azimuth'],endpoint=False)
Expand Down
2 changes: 1 addition & 1 deletion weis/inputs/modeling_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3186,7 +3186,7 @@ properties:
IEC_WindType:
type: string
default: NTM
enum: ['NTM', '1ETM', '2ETM', '3ETM', '1EWM1', '2EWM1', '3EWM1', '1EWM50', '2EWM50', '3EWM50', 'ECD', 'EDC', 'EOG','EWS','Custom','Ramp','Steady','Step']
enum: ['NTM', '1ETM', '2ETM', '3ETM', '1EWM1', '2EWM1', '3EWM1', '1EWM50', '2EWM50', '3EWM50', 'ECD','ECD', 'Turbulent-EDC','EOG','Turbulent-EOG','EWS','Turbulent-EWS','Ramp','Turbulent-Ramp','Step','Turbulent-Step','Steady','Custom']
description: 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), 'ECD'=extreme coherent gust with direction change, 'EDC'=extreme direction change, 'EOG'=extreme operating gust. Normally the user does not need to define this entry, 'EWS'='extreme wind shear'
analysis_time:
type: number
Expand Down

0 comments on commit 92c20ad

Please sign in to comment.