Skip to content

Commit c42f200

Browse files
authored
Merge pull request #59 from rthedin/fixes
FF: Defaults for AeroDyn
2 parents 07a3cb5 + 4df90af commit c42f200

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

openfast_toolbox/fastfarm/AMRWindSimulation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,18 @@ def _checkInputs(self):
180180
# For convenience, the turbines should not be zero-indexed
181181
if 'name' in self.wts[0]:
182182
if self.wts[0]['name'] != 'T1':
183-
if self.verbose>0: print(f"--- WARNING: Recommended turbine numbering should start at 1. Currently it is zero-indexed.")
183+
if self.verbose>0: print(f"WARNING: Recommended turbine numbering should start at 1. Currently it is zero-indexed.")
184184

185185

186186
# Flags of given/calculated spatial resolution for warning/error printing purposes
187187
self.given_ds_hr = False
188188
self.given_ds_lr = False
189189
warn_msg = ""
190190
if self.ds_hr is not None:
191-
warn_msg += f"--- WARNING: HIGH-RES SPATIAL RESOLUTION GIVEN. CONVERTING FATAL ERRORS ON HIGH-RES BOXES CHECKS TO WARNINGS. ---\n"
191+
warn_msg += f"WARNING: HIGH-RES SPATIAL RESOLUTION GIVEN. CONVERTING FATAL ERRORS ON HIGH-RES BOXES CHECKS TO WARNINGS."
192192
self.given_ds_hr = True
193193
if self.ds_lr is not None:
194-
warn_msg += f"--- WARNING: LOW-RES SPATIAL RESOLUTION GIVEN. CONVERTING FATAL ERRORS ON LOW-RES BOX CHECKS TO WARNINGS. ---\n"
194+
warn_msg += f"WARNING: LOW-RES SPATIAL RESOLUTION GIVEN. CONVERTING FATAL ERRORS ON LOW-RES BOX CHECKS TO WARNINGS."
195195
self.given_ds_lr = True
196196
if self.verbose>0: print(f'{warn_msg}\n')
197197
a=1

openfast_toolbox/fastfarm/FASTFarmCaseCreation.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,13 @@ def _determine_resolutions_from_dummy_amrwind_grid(self):
561561
n_cell, max_level, incflo_velocity_hh,
562562
buffer_lr = self.extent_low,
563563
buffer_hr = self.extent_high,
564+
ds_hr = self.ds_high, ds_lr = self.ds_low,
565+
dt_hr = self.dt_high, dt_lr = self.dt_low,
564566
mod_wake = self.mod_wake)
565567

566-
print(f' High-resolution: ds: {amr.ds_high_les} m, dt: {amr.dt_high_les} s')
567-
print(f' Low-resolution: ds: {amr.ds_low_les} m, dt: {amr.dt_low_les} s\n')
568+
print(f'Calculated values:')
569+
print(f' High-resolution: ds: {amr.ds_high_les} m, dt: {amr.dt_high_les} s')
570+
print(f' Low-resolution: ds: {amr.ds_low_les} m, dt: {amr.dt_low_les} s\n')
568571
print(f'WARNING: If the above values are too fine or manual tuning is warranted, specify them manually.')
569572
print(f' To do that, specify, e.g., `dt_high = {2*amr.dt_high_les}` to the call to `FFCaseCreation`.')
570573
print(f' `ds_high = {2*amr.ds_high_les}`')
@@ -808,7 +811,8 @@ def copyTurbineFilesForEachCase(self, writeFiles=True):
808811
if 'Skew_Mod' in self.AeroDynFile.keys():
809812
self.AeroDynFile['Skew_Mod'] = 1
810813
self.AeroDynFile['SkewMomCorr'] = True
811-
# self.AeroDynFile['UA_Mod'] = 0
814+
self.AeroDynFile['BEM_Mod'] = 2
815+
self.AeroDynFile['IntegrationMethod'] = 4
812816
# Adjust the Airfoil path to point to the templatePath (1:-1 to remove quotes)
813817
self.AeroDynFile['AFNames'] = [f'"{os.path.join(self.templatePathabs, "Airfoils", i[1:-1].split("Airfoils/", 1)[-1])}"'
814818
for i in self.AeroDynFile['AFNames'] ]
@@ -1893,7 +1897,7 @@ def TS_high_get_time_series(self):
18931897
uvel_hr = np.interp(time_hr, time, uvel)
18941898
vvel_hr = np.interp(time_hr, time, vvel)
18951899
wvel_hr = np.interp(time_hr, time, wvel)
1896-
1900+
18971901
# Checks
18981902
assert len(time_hr)==len(uvel_hr)
18991903
assert len(uvel_hr)==len(vvel_hr)
@@ -1911,7 +1915,7 @@ def TS_high_get_time_series(self):
19111915
# point in the low-res box, and then pass this offset to the time-series file. In this example, the offset is 2 m, thus the
19121916
# time-series file will have a y of 2 m.
19131917
yoffset = bts['y'][jTurb] - yt
1914-
if yoffset != 0:
1918+
if yoffset != 0 and self.verbose>1:
19151919
print(f"Seed {seed}, Case {case}: Turbine {t+1} is not at a grid point location. Tubine is at y={yloc_}",\
19161920
f"on the turbine reference frame, which is y={yt} on the low-res TurbSim reference frame. The",\
19171921
f"nearest grid point in y is {bts['y'][jTurb]} so printing y={yoffset} to the time-series file.")

openfast_toolbox/fastfarm/examples/Ex1_FASTFarm_discretization.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ def main():
145145
# ----------- Initial setup
146146
# The initial setup with the temporal and spatial resolutions of both high and
147147
# low resolution boxes given as None will trigger their automatic computation.
148-
ffcase = FFCaseCreation(path, wts, tmax, zbot, vhub, shear, TIvalue, inflow_deg,
149-
dt_high=dt_high, ds_high=ds_high, extent_high=extent_high,
150-
dt_low=dt_low, ds_low=ds_low, extent_low=extent_low,
151-
ffbin=ffbin, mod_wake=mod_wake, yaw_init=yaw_init,
152-
nSeeds=nSeeds, tsbin=tsbin, inflowType=inflowType,
153-
refTurb_rot=refTurb_rot, verbose=0)
148+
amr = FFCaseCreation(path, wts, tmax, zbot, vhub, shear, TIvalue, inflow_deg,
149+
dt_high=dt_high, ds_high=ds_high, extent_high=extent_high,
150+
dt_low=dt_low, ds_low=ds_low, extent_low=extent_low,
151+
ffbin=ffbin, mod_wake=mod_wake, yaw_init=yaw_init,
152+
nSeeds=nSeeds, tsbin=tsbin, inflowType=inflowType,
153+
refTurb_rot=refTurb_rot, verbose=0)
154154

155155

156156

0 commit comments

Comments
 (0)