Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions openfast_toolbox/fastfarm/AMRWindSimulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,21 +642,34 @@ def _check_grid_placement_single(self, sampling_xyzgrid_lhr, amr_xyzgrid_at_lhr_



def write_sampling_params(self, out=None, format='netcdf', overwrite=False):
def write_sampling_params(self, out=None, format='netcdf', terrain=None, overwrite=False):
'''
Write out text that can be used for the sampling planes in an
AMR-Wind input file

out: str
Output path or full filename for Input file to be written
to. If None, result is written to screen.
format: str
Format requested for the output to be saved from AMR-Wind. Options are
native and netcdf
terrain: bool (required)
If the case contains terrain. If it does, mu_turb will also be requested. This
is necessary to process terrain files and set NaN inside the terrain.
overwrite: bool
If saving to a file, whether or not to overwrite potentially
existing file
'''
if format not in ['netcdf','native']:
raise ValueError(f'format should be either native or netcdf')

if terrain == True:
fields = 'velocity mu_turb'
elif terrain == False:
fields = 'velocity'
else:
raise ValueError(f'The `terrain` input should be explicitly set to True or False')

# Write time step information for consistenty with sampling frequency
s = f"time.fixed_dt = {self.dt}\n\n"
# Write flow velocity info for consistency
Expand All @@ -674,7 +687,7 @@ def write_sampling_params(self, out=None, format='netcdf', overwrite=False):
s += f"# ---- Low-res sampling parameters ----\n"
s += f"{self.postproc_name_lr}.output_format = {format}\n"
s += f"{self.postproc_name_lr}.output_frequency = {self.output_frequency_lr}\n"
s += f"{self.postproc_name_lr}.fields = velocity # temperature tke\n"
s += f"{self.postproc_name_lr}.fields = {fields}\n"
s += f"{self.postproc_name_lr}.labels = {sampling_labels_lr_str}\n\n"

# Write out low resolution sampling plane info
Expand All @@ -692,7 +705,7 @@ def write_sampling_params(self, out=None, format='netcdf', overwrite=False):
s += f"# ---- High-res sampling parameters ----\n"
s += f"{self.postproc_name_hr}.output_format = {format}\n"
s += f"{self.postproc_name_hr}.output_frequency = {self.output_frequency_hr}\n"
s += f"{self.postproc_name_hr}.fields = velocity # temperature tke\n"
s += f"{self.postproc_name_hr}.fields = {fields}\n"
s += f"{self.postproc_name_hr}.labels = {sampling_labels_hr_str}\n"

# Write out high resolution sampling plane info
Expand Down
5 changes: 4 additions & 1 deletion openfast_toolbox/fastfarm/FASTFarmCaseCreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def __init__(self,
ADmodel: list of strings
List of AeroDyn/AeroDisk models to use for each case
EDmodel: list of strings
List of ElastoDym/SimplifiedElastoDyn models to use for each case
List of ElastoDyn/SimplifiedElastoDyn models to use for each case
nSeeds: int
Number of seeds used for TurbSim simulations. If changing this value, give seedValues
seedValues: list of int
Expand Down Expand Up @@ -805,6 +805,9 @@ def copyTurbineFilesForEachCase(self, writeFiles=True):
if ADmodel_ == 'ADyn':
self.AeroDynFile['ADBlFile(1)'] = self.AeroDynFile['ADBlFile(2)'] = self.AeroDynFile['ADBlFile(3)'] = f'"{self.ADbladefilename}"'
self.AeroDynFile['Wake_Mod'] = 1
if 'Skew_Mod' in self.AeroDynFile.keys():
self.AeroDynFile['Skew_Mod'] = 1
self.AeroDynFile['SkewMomCorr'] = True
# self.AeroDynFile['UA_Mod'] = 0
# Adjust the Airfoil path to point to the templatePath (1:-1 to remove quotes)
self.AeroDynFile['AFNames'] = [f'"{os.path.join(self.templatePathabs, "Airfoils", i[1:-1].split("Airfoils/", 1)[-1])}"'
Expand Down
Loading
Loading