11import pandas as pd
2- import numpy as np
32import os , sys , shutil
43import subprocess
54import numpy as np
@@ -83,7 +82,8 @@ def __init__(self,
8382 EDmodel = None ,
8483 nSeeds = 6 ,
8584 seedValues = None ,
86- LESpath = None ,
85+ inflowPath = None ,
86+ inflowType = 'TS' ,
8787 sweepYawMisalignment = False ,
8888 refTurb_rot = 0 ,
8989 verbose = 0 ):
@@ -139,10 +139,13 @@ def __init__(self,
139139 Number of seeds used for TurbSim simulations. If changing this value, give seedValues
140140 seedValues: list of int
141141 Seed value for each seed of requested TurbSim simulations if nSeeds!=6
142- LESpath: str or list of strings
142+ inflowType: str
143+ inflow type (LES or TS) This variable will dictate whether it is a TurbSim-driven or LES-driven case
144+ Choose 'LES' or 'TS' (default is TS, TurbSim-driven)
145+ inflowPath: str or list of strings
143146 Full path of the LES data, if driven by LES. If None, the setup will be for TurbSim inflow.
144- LESpath can be a single path, or a list of paths of the same length as the sweep in conditions.
145- For example, if TIvalue=[8,10,12], then LESpath can be 3 paths, related to each condition.
147+ inflowPath can be a single path, or a list of paths of the same length as the sweep in conditions.
148+ For example, if TIvalue=[8,10,12], then inflowPath can be 3 paths, related to each condition.
146149 sweepYawMisalignment: bool
147150 Whether or not to perform a sweep with and without yaw misalignment perturbations
148151 refTurb_rot: int
@@ -173,7 +176,8 @@ def __init__(self,
173176 self .ADmodel = ADmodel
174177 self .EDmodel = EDmodel
175178 self .nSeeds = nSeeds
176- self .LESpath = LESpath
179+ self .inflowPath = inflowPath
180+ self .inflowType = inflowType
177181 self .sweepYM = sweepYawMisalignment
178182 self .seedValues = seedValues
179183 self .refTurb_rot = refTurb_rot
@@ -205,7 +209,7 @@ def __repr__(self):
205209 s = f'Requested parameters:\n '
206210 s += f' - Case path: { self .path } \n '
207211 s += f' - Wake model: { self .mod_wake } (1:Polar; 2:Curl; 3:Cartesian)\n '
208- if self .LESpath is None :
212+ if self .inflowType == 'TS' :
209213 s += f' - Number of TurbSim seeds: { self .nSeeds } \n '
210214 s += f' - End time: { self .tmax } s\n '
211215 s += f'Requested farm:\n '
@@ -236,16 +240,16 @@ def __repr__(self):
236240 s += f"\n \n "
237241
238242
239- if self .LESpath is None :
243+ if self .inflowType == 'TS' :
240244 s += f'Turbulence boxes: TurbSim\n '
241245 s += f'TurbSim turbulence boxes details:\n '
242246 else :
243247 s += f'Turbulence boxes: LES\n '
244248 s += f'LES turbulence boxes details:\n '
245- s += f' Path: { self .LESpath } \n '
249+ s += f' Path: { self .inflowPath } \n '
246250
247251
248- if self .TSlowBoxFilesCreatedBool or self .LESpath is not None :
252+ if self .TSlowBoxFilesCreatedBool or self .inflowType != 'TS' :
249253 s += f' Low-resolution domain: \n '
250254 s += f' - ds low: { self .ds_low_les } m\n '
251255 s += f' - dt low: { self .dt_low_les } s\n '
@@ -255,7 +259,7 @@ def __repr__(self):
255259 s += f'Low-res boxes not created yet.\n '
256260
257261
258- if self .TShighBoxFilesCreatedBool or self .LESpath is not None :
262+ if self .TShighBoxFilesCreatedBool or self .inflowType != 'TS' :
259263 s += f' High-resolution domain: \n '
260264 s += f' - ds high: { self .ds_high_les } m\n '
261265 s += f' - dt high: { self .dt_high_les } s\n '
@@ -416,14 +420,14 @@ def _checkInputs(self):
416420 f'to the number of seeds requested.' )
417421
418422 # Check LES parameters
419- if self .LESpath is None :
423+ if self .inflowType == 'TS' :
420424 self .inflowStr = 'TurbSim'
421425 self .Mod_AmbWind = 3
422426 else :
423- if isinstance (self .LESpath ,str ): self .LESpath = [self .LESpath ]* len (self .vhub )
427+ if isinstance (self .inflowPath ,str ): self .inflowPath = [self .inflowPath ]* len (self .vhub )
424428 self .inflowStr = 'LES'
425429 self .Mod_AmbWind = 1
426- for p in self .LESpath :
430+ for p in self .inflowPath :
427431 if not os .path .isdir (p ):
428432 raise ValueError (f'The LES path { p } does not exist' )
429433 # LES is requested, so domain limits must be given
@@ -1811,7 +1815,7 @@ def _FF_setup_LES(self, seedsToKeep=1):
18111815
18121816 # Low-res box
18131817 try :
1814- src = os .path .join (self .LESpath [cond ], 'Low' )
1818+ src = os .path .join (self .inflowPath [cond ], 'Low' )
18151819 dst = os .path .join (self .path , self .condDirList [cond ], self .caseDirList [case ], f'Seed_{ seed } ' , LESboxesDirName , 'Low' )
18161820 os .symlink (src , dst )
18171821 except FileExistsError :
@@ -1820,7 +1824,7 @@ def _FF_setup_LES(self, seedsToKeep=1):
18201824 # High-res boxes
18211825 for t in range (self .nTurbines ):
18221826 try :
1823- src = os .path .join (self .LESpath [cond ], f"HighT{ t + 1 } _inflow{ str (self .allCases .sel (case = case ).inflow_deg .values ).replace ('-' ,'m' )} deg" )
1827+ src = os .path .join (self .inflowPath [cond ], f"HighT{ t + 1 } _inflow{ str (self .allCases .sel (case = case ).inflow_deg .values ).replace ('-' ,'m' )} deg" )
18241828 dst = os .path .join (self .path ,self .condDirList [cond ], self .caseDirList [case ], f'Seed_{ seed } ' , LESboxesDirName , f'HighT{ t + 1 } ' )
18251829 os .symlink (src , dst )
18261830 except FileExistsError :
0 commit comments