@@ -531,6 +531,7 @@ def _checkInputs(self):
531531 self .hasSrvD = False
532532 self .hasHD = False
533533 self .hasMD = False
534+ self .hasBath = False
534535 self .hasSS = False
535536 self .hasSubD = False
536537 self .hasBD = False
@@ -836,6 +837,9 @@ def copyTurbineFilesForEachCase(self, writeFiles=True):
836837 self .MoorDynFile .write (os .path .join (currPath ,f'{ self .MDfilename } { t + 1 } _mod.dat' ))
837838 else :
838839 if t == 0 : shutilcopy2_untilSuccessful (self .MDfilepath , os .path .join (currPath , self .MDfilename ))
840+
841+ if writeFiles and self .hasBath :
842+ if t == 0 : shutilcopy2_untilSuccessful (self .bathfilepath , os .path .join (currPath , self .bathfilename ))
839843
840844 # Update each turbine's OpenFAST input
841845 self .turbineFile ['TMax' ] = self .tmax
@@ -1055,6 +1059,7 @@ def setTemplateFilename(self, templatePath=None, templateFiles=None):
10551059 'SEDfilename' : None,
10561060 'HDfilename' : 'HydroDyn.dat', # ending with .T for per-turbine HD, .dat for holisitc
10571061 'MDfilename' : 'MoorDyn.T', # ending with .T for per-turbine MD, .dat for holistic
1062+ 'bathfilename' : 'bathymetry.txt',
10581063 'SSfilename' : 'SeaState.dat',
10591064 'SrvDfilename' : 'ServoDyn.T',
10601065 'ADfilename' : 'AeroDyn.dat',
@@ -1084,6 +1089,7 @@ def setTemplateFilename(self, templatePath=None, templateFiles=None):
10841089 self .SEDfilename = "unused" ; self .SEDfilepath = "unused"
10851090 self .HDfilename = "unused" ; self .HDfilepath = "unused"
10861091 self .MDfilename = "unused" ; self .MDfilepath = "unused"
1092+ self .bathfilename = "unused" ; self .bathfilepath = "unused"
10871093 self .SSfilename = "unused" ; self .SSfilepath = "unused"
10881094 self .SrvDfilename = "unused" ; self .SrvDfilepath = "unused"
10891095 self .ADfilename = "unused" ; self .ADfilepath = "unused"
@@ -1114,7 +1120,7 @@ def setTemplateFilename(self, templatePath=None, templateFiles=None):
11141120 self .templatePathabs = os .path .abspath (self .templatePath )
11151121
11161122 # Check and set the templateFiles
1117- valid_keys = {'EDfilename' , 'SEDfilename' , 'HDfilename' , 'MDfilename' , 'SSfilename' ,
1123+ valid_keys = {'EDfilename' , 'SEDfilename' , 'HDfilename' , 'MDfilename' , 'bathfilename' , ' SSfilename' ,
11181124 'SrvDfilename' , 'ADfilename' , 'ADskfilename' , 'SubDfilename' , 'IWfilename' , 'BDfilename' ,
11191125 'BDbladefilename' , 'EDbladefilename' , 'EDtowerfilename' , 'ADbladefilename' , 'turbfilename' ,
11201126 'libdisconfilepath' , 'controllerInputfilename' , 'coeffTablefilename' , 'hydroDatapath' ,
@@ -1180,6 +1186,11 @@ def checkIfExists(f):
11801186 self .MDfilename = value
11811187 self .hasMD = True
11821188
1189+ elif key == 'bathfilename' :
1190+ self .bathfilepath = os .path .join (self .templatePath , value )
1191+ checkIfExists (self .bathfilepath )
1192+ self .bathfilename = value
1193+ self .hasBath = True
11831194 elif key == 'SSfilename' :
11841195 if not value .endswith ('.dat' ):
11851196 raise ValueError (f'The SeaState filename should end in `.dat`.' )
@@ -1812,7 +1823,7 @@ def getDomainParameters(self):
18121823
18131824 # Determine offsets from turbines coordinate frame to TurbSim coordinate frame
18141825 self .yoffset_turbsOrigin2TSOrigin = - ( (self .TSlowbox .ymax - self .TSlowbox .ymin )/ 2 + self .TSlowbox .ymin )
1815- self .xoffset_turbsOrigin2TSOrigin = - self .extent_low [0 ]* self .D
1826+ self .xoffset_turbsOrigin2TSOrigin = - self .extent_low [0 ]* self .D
18161827
18171828 if self .verbose > 0 :
18181829 print (f" The y offset between the turbine ref frame and turbsim is { self .yoffset_turbsOrigin2TSOrigin } " )
@@ -2142,8 +2153,8 @@ def FF_setup(self, outlistFF=None, **kwargs):
21422153
21432154 offset = 10
21442155 planes_xy = [self .zhub + self .zbot ]
2145- planes_yz = np .unique (xWT + offset )
2146- planes_xz = np .unique (yWT )
2156+ planes_yz = np .unique (np . round ( xWT + offset , 2 ) )
2157+ planes_xz = np .unique (np . round ( yWT , 2 ) )
21472158
21482159 # Number of planes must be at most 9
21492160 self .planes_xy = planes_xy [0 :9 ]
@@ -2763,11 +2774,12 @@ def plot(self, figsize=(14,7), fontsize=13, saveFig=True, returnFig=False, figFo
27632774
27642775 # plot turbine disk accoding to all yaws in current wdir
27652776 allyaw_currwdir = self .allCases .where (self .allCases ['inflow_deg' ]== inflow ,drop = True ).sel (turbine = currTurbine )['yaw' ]
2777+ phi = self .allCases .where (self .allCases ['inflow_deg' ]== inflow ,drop = True ).sel (turbine = currTurbine )['phi' ]
27662778 _ , ind = np .unique (allyaw_currwdir , axis = 0 , return_index = True )
27672779 yaw_currwdir = allyaw_currwdir [np .sort (ind )].values # duplicates removed, same order as original array
27682780 for yaw in yaw_currwdir :
2769- ax .plot ([dst .x .values - (dst .D .values / 2 )* sind (yaw ), dst .x .values + (dst .D .values / 2 )* sind (yaw )],
2770- [dst .y .values - (dst .D .values / 2 )* cosd (yaw ), dst .y .values + (dst .D .values / 2 )* cosd (yaw )], c = color , alpha = alphas [j ])
2781+ ax .plot ([dst .x .values - (dst .D .values / 2 )* sind (yaw + phi ), dst .x .values + (dst .D .values / 2 )* sind (yaw + phi )],
2782+ [dst .y .values - (dst .D .values / 2 )* cosd (yaw + phi ), dst .y .values + (dst .D .values / 2 )* cosd (yaw + phi )], c = color , alpha = alphas [j ])
27712783
27722784 # plot convex hull of farm (or line) for given inflow
27732785 turbs = self .wts_rot_ds .sel (inflow_deg = inflow )[['x' ,'y' ]].to_array ().transpose ()
0 commit comments