Skip to content

Commit 7019be0

Browse files
ptrbortolottirthedin
authored andcommitted
let the user pick low and high res parameters, but let the code use defaults if user does not provide them
1 parent e0e35a7 commit 7019be0

2 files changed

Lines changed: 12 additions & 25 deletions

File tree

openfast_toolbox/fastfarm/FASTFarmCaseCreation.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def _checkInputs(self):
325325
self.fmax = self.wts[0]['fmax']
326326
self.Cmeander = self.wts[0]['Cmeander']
327327

328-
if self.inflowType == 'TS':
328+
if self.inflowType == 'TS' and self.dt_high == None:
329329
self.dt_high = 1./(2.*self.fmax)
330330

331331
# Check the platform heading and initialize as zero if needed
@@ -507,19 +507,21 @@ def _checkInputs(self):
507507

508508
# Check the ds and dt for the high- and low-res boxes. If not given, call the
509509
# AMR-Wind auxiliary function with dummy domain limits.
510-
if None in (self.dt_high, self.ds_high, self.dt_low, self.ds_low):
510+
if None in (self.dt_high, self.ds_high, self.dt_low, self.ds_low) and self.inflowType == 'LES':
511511
mod_wake_str = ['','polar', 'curled', 'cartesian']
512512
print(f'WARNING: One or more temporal or spatial resolution for low- and high-res domains were not given.')
513513
print(f' Estimated values for {mod_wake_str[self.mod_wake]} wake model shown below.')
514514
self._determine_resolutions_from_dummy_amrwind_grid()
515515

516-
# Check the domain extents
517-
if self.dt_low%(self.dt_high-1e-15) > 1e-12:
518-
raise ValueError(f'The temporal resolution dT_Low should be a multiple of dT_High')
519-
if self.dt_low < self.dt_high:
520-
raise ValueError(f'The temporal resolution dT_High should not be greater than dT_Low on the LES side')
521-
if self.ds_low < self.ds_high:
522-
raise ValueError(f'The grid resolution dS_High should not be greater than dS_Low on the LES side')
516+
# Check the domain extents when values are provided by the user:
517+
if self.dt_low != None and self.dt_high!= None:
518+
if self.dt_low%(self.dt_high-1e-15) > 1e-12:
519+
raise ValueError(f'The temporal resolution dT_Low should be a multiple of dT_High')
520+
if self.dt_low < self.dt_high:
521+
raise ValueError(f'The temporal resolution dT_High should not be greater than dT_Low on the LES side')
522+
if self.ds_low != None and self.ds_high!= None:
523+
if self.ds_low < self.ds_high:
524+
raise ValueError(f'The grid resolution dS_High should not be greater than dS_Low on the LES side')
523525

524526

525527
# Check the reference turbine for rotation
@@ -1899,7 +1901,7 @@ def TS_high_get_time_series(self):
18991901
wvel = np.roll(bts['u'][2, :, jTurb, kTurb], start_time_step)
19001902

19011903
# Map it to high-res time and dt (both)
1902-
time_hr = np.arange(0, self.tmax + self.dt_high, self.dt_high)
1904+
time_hr = np.arange(bts.t[0], self.tmax + self.dt_high, self.dt_high)
19031905
uvel_hr = np.interp(time_hr, time, uvel)
19041906
vvel_hr = np.interp(time_hr, time, vvel)
19051907
wvel_hr = np.interp(time_hr, time, wvel)

openfast_toolbox/fastfarm/examples/Ex3_FFarmCompleteSetup.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,6 @@ def main():
6666
# Set the yaw of each turbine for wind dir. One row for each wind direction.
6767
yaw_init = None
6868

69-
# ----------- Low- and high-res boxes parameters
70-
# Should match LES if comparisons are to be made; otherwise, set desired values
71-
# For an automatic computation of such parameters, omit them from the call to FFCaseCreation
72-
# High-res boxes settings
73-
dt_high_les = 0.6 # sampling frequency of high-res files
74-
ds_high_les = 10.0 # dx, dy, dz that you want these high-res files at
75-
extent_high = 1.2 # high-res box extent in y and x for each turbine, in D.
76-
# Low-res boxes settings
77-
dt_low_les = 3 # sampling frequency of low-res files
78-
ds_low_les = 20.0 # dx, dy, dz of low-res files
79-
extent_low = [3, 8, 3, 3, 2] # extent in xmin, xmax, ymin, ymax, zmax, in D
80-
81-
8269
# ----------- Execution parameters
8370
ffbin = '/full/path/to/your/binary/.../bin/FAST.Farm'
8471

@@ -132,8 +119,6 @@ def main():
132119

133120
# Initial setup
134121
case = FFCaseCreation(path, wts, tmax, zbot, vhub, shear, TIvalue, inflow_deg,
135-
dt_high_les, ds_high_les, extent_high,
136-
dt_low_les, ds_low_les, extent_low,
137122
ffbin=ffbin, mod_wake=mod_wake, yaw_init=yaw_init,
138123
nSeeds=nSeeds,
139124
inflowType=inflowType,

0 commit comments

Comments
 (0)