@@ -1784,7 +1784,8 @@ def TS_low_setup(self, writeFiles=True, runOnce=False):
17841784 Lowinp ['InCDec1' ] = Lowinp ['InCDec2' ] = Lowinp ['InCDec3' ] = f'"{ a } { b / (8.1 * Lambda1 ):.8f} "'
17851785 # The dt was computed for a proper low-res box but here we will want to compare with the high-res
17861786 # and it is convenient to have the same time step. Let's do that change here
1787- Lowinp ['TimeStep' ] = 1 / (2 * self .fmax )
1787+ # Lowinp['TimeStep'] = 1/(2*self.fmax)
1788+ Lowinp ['TimeStep' ] = np .round (Lowinp ['TimeStep' ], 2 )
17881789 if writeFiles :
17891790 lowFileName = os .path .join (seedPath , 'Low.inp' )
17901791 Lowinp .write (lowFileName )
@@ -1994,6 +1995,9 @@ def TS_high_get_time_series(self):
19941995 Vmid = bts ['u' ][0 ,:,jMid ,kMid ]
19951996 time = bts .t
19961997
1998+ # Given the nature of how TS decides on the total time, let's get the actual tmax from the low-res
1999+ self .tmax_low = time [- 1 ]
2000+
19972001 # The time-series need to be shifted depending on the turbine location, so we need to find how many
19982002 # grid points (time steps) the data have convected. We use the mean streamwise component for that
19992003 start_time_step = round ( (xt / Vmid .mean ())/ bts .dt )
@@ -2002,11 +2006,17 @@ def TS_high_get_time_series(self):
20022006 uvel = np .roll (bts ['u' ][0 , :, jTurb , kTurb ], start_time_step )
20032007 vvel = np .roll (bts ['u' ][1 , :, jTurb , kTurb ], start_time_step )
20042008 wvel = np .roll (bts ['u' ][2 , :, jTurb , kTurb ], start_time_step )
2005-
2009+
2010+ # Map it to high-res time and dt (both)
2011+ time_hr = np .arange (time [0 ], self .tmax_low + self .dt_high_les , self .dt_high_les )
2012+ uvel_hr = np .interp (time_hr , time , uvel )
2013+ vvel_hr = np .interp (time_hr , time , vvel )
2014+ wvel_hr = np .interp (time_hr , time , wvel )
2015+
20062016 # Checks
2007- assert len (time )== len (uvel )
2008- assert len (uvel )== len (vvel )
2009- assert len (vvel )== len (wvel )
2017+ assert len (time_hr )== len (uvel_hr )
2018+ assert len (uvel_hr )== len (vvel_hr )
2019+ assert len (vvel_hr )== len (wvel_hr )
20102020
20112021 # Save timeseries as CondXX/Seed_Z/USRTimeSeries_T*.txt. This file will later be copied to CondXX/CaseYY/Seed_Z
20122022 timeSeriesOutputFile = os .path .join (caseSeedPath , f'USRTimeSeries_T{ t + 1 } .txt' )
@@ -2024,7 +2034,7 @@ def TS_high_get_time_series(self):
20242034 print (f"Seed { seed } , Case { case } : Turbine { t + 1 } is not at a grid point location. Tubine is at y={ yloc_ } " ,\
20252035 f"on the turbine reference frame, which is y={ yt } on the low-res TurbSim reference frame. The" ,\
20262036 f"nearest grid point in y is { bts ['y' ][jTurb ]} so printing y={ yoffset } to the time-series file." )
2027- writeTimeSeriesFile (timeSeriesOutputFile , yoffset , Hub_series , uvel , vvel , wvel , time )
2037+ writeTimeSeriesFile (timeSeriesOutputFile , yoffset , Hub_series , uvel_hr , vvel_hr , wvel_hr , time_hr )
20282038
20292039
20302040
@@ -2076,7 +2086,7 @@ def TS_high_setup(self, writeFiles=True):
20762086 # Create and write new Low.inp files creating the proper box with proper resolution
20772087 currentTS = TSCaseCreation (D_ , HubHt_ , Vhub_ , tivalue_ , shear_ , x = xloc_ , y = yloc_ , zbot = self .zbot ,
20782088 cmax = self .cmax , fmax = self .fmax , Cmeander = self .Cmeander , boxType = boxType , high_ext = self .extent_high )
2079- currentTS .writeTSFile (self .turbsimHighfilepath , currentTSHighFile , tmax = self .tmax , turb = t , verbose = self .verbose )
2089+ currentTS .writeTSFile (self .turbsimHighfilepath , currentTSHighFile , tmax = self .tmax_low , turb = t , verbose = self .verbose )
20802090
20812091 # Modify some values and save file (some have already been set in the call above)
20822092 Highinp = FASTInputFile (currentTSHighFile )
0 commit comments