Skip to content

Commit f46b553

Browse files
committed
FF: fix high-res specs for TS-driven cases
1 parent ee50b7b commit f46b553

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

openfast_toolbox/fastfarm/FASTFarmCaseCreation.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,8 +2366,8 @@ def _FF_setup_TS(self):
23662366
d = self._getBoxesParamsForFF(lowbts, highbts, self.dt_low_les, D_, HubHt_, xWT, yt)
23672367

23682368
# Write the file
2369-
writeFastFarm(outputFSTF, templateFSTF, xWT, yt, zWT, d, OutListT1=self.outlistFF, noLeadingZero=True)
2370-
2369+
writeFastFarm(outputFSTF, templateFSTF, xWT, yt, zWT, d, OutListT1=self.outlistFF,
2370+
noLeadingZero=True, turbineTemplateFullFilename=f"../{self.turbfilename}1.fst")
23712371

23722372
# Open saved file and change additional values manually or make sure we have the correct ones
23732373
ff_file = FASTInputFile(outputFSTF)
@@ -2488,8 +2488,12 @@ def _getBoxesParamsForFF(self, lowbts, highbts, dt_low_desired, D, HubHt, xWT, y
24882488
# --- High-res location per turbine
24892489
X0_desired = np.asarray(xWT)-LX_High/2 # high-res is centered on turbine location
24902490
Y0_desired = np.asarray(yt)-LY_High/2 # high-res is centered on turbine location
2491-
X0_High = X0_Low + np.floor((X0_desired-X0_Low)/dX_High)*dX_High
2492-
Y0_High = Y0_Low + np.floor((Y0_desired-Y0_Low)/dY_High)*dY_High
2491+
if self.inflowType == 'TS':
2492+
X0_High = X0_desired
2493+
Y0_High = Y0_desired
2494+
elif self.inflowType == 'LES':
2495+
X0_High = X0_Low + np.floor((X0_desired-X0_Low)/dX_High)*dX_High
2496+
Y0_High = Y0_Low + np.floor((Y0_desired-Y0_Low)/dY_High)*dY_High
24932497

24942498
if self.verbose>2:
24952499
print(f' Low Box \t\t High box ')
@@ -2538,17 +2542,18 @@ def _getBoxesParamsForFF(self, lowbts, highbts, dt_low_desired, D, HubHt, xWT, y
25382542

25392543

25402544
# --- Sanity check: check that the high res is at "almost" an integer location
2541-
X_rel = (np.array(d['X0_High'])-d['X0_Low'])/d['dX_High']
2542-
Y_rel = (np.array(d['Y0_High'])-d['Y0_Low'])/d['dY_High']
2543-
dX = X_rel - np.round(X_rel) # Should be close to zero
2544-
dY = Y_rel - np.round(Y_rel) # Should be close to zero
2545-
2546-
if any(abs(dX)>1e-3):
2547-
print('Deltas:',dX)
2548-
raise Exception('Some X0_High are not on an integer multiple of the high-res grid')
2549-
if any(abs(dY)>1e-3):
2550-
print('Deltas:',dY)
2551-
raise Exception('Some Y0_High are not on an integer multiple of the high-res grid')
2545+
if self.inflowType == 'LES':
2546+
X_rel = (np.array(d['X0_High'])-d['X0_Low'])/d['dX_High']
2547+
Y_rel = (np.array(d['Y0_High'])-d['Y0_Low'])/d['dY_High']
2548+
dX = X_rel - np.round(X_rel) # Should be close to zero
2549+
dY = Y_rel - np.round(Y_rel) # Should be close to zero
2550+
2551+
if any(abs(dX)>1e-3):
2552+
print('Deltas:',dX)
2553+
raise Exception('Some X0_High are not on an integer multiple of the high-res grid')
2554+
if any(abs(dY)>1e-3):
2555+
print('Deltas:',dY)
2556+
raise Exception('Some Y0_High are not on an integer multiple of the high-res grid')
25522557

25532558
return d
25542559

0 commit comments

Comments
 (0)