Skip to content

Commit 4406c36

Browse files
authored
Merge pull request #30 from rthedin/f/ff
Further FAST.Farm improvements
2 parents d764333 + d5915bc commit 4406c36

File tree

5 files changed

+1313
-48
lines changed

5 files changed

+1313
-48
lines changed

openfast_toolbox/fastfarm/AMRWindSimulation.py

+23-19
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ def _checkInputs(self):
175175
# Check that level_lr is >= 0
176176
# check that level_hr is <=self.max_level
177177

178+
# For convenience, the turbines should not be zero-indexed
179+
if self.wts[0]['name'] != 'T1':
180+
print(f"--- WARNING: Recommended turbine numbering should start at 1. Currently it is zero-indexed.")
181+
178182

179183
# Flags of given/calculated spatial resolution for warning/error printing purposes
180184
self.given_ds_hr = False
@@ -652,7 +656,7 @@ def write_sampling_params(self, out=None, overwrite=False):
652656
sampling_labels_lr_str = " ".join(str(item) for item in self.sampling_labels_lr)
653657
sampling_labels_hr_str = " ".join(str(item) for item in self.sampling_labels_hr)
654658
s += f"#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#\n"
655-
s += f"# POST-Processing #\n"
659+
s += f"# POST-PROCESSING #\n"
656660
s += f"#.......................................#\n"
657661
s += f"# Sampling info generated by AMRWindSamplingCreation.py on {self.curr_datetime}\n"
658662
s += f"incflo.post_processing = {self.postproc_name_lr} {self.postproc_name_hr} # averaging\n\n\n"
@@ -667,19 +671,19 @@ def write_sampling_params(self, out=None, overwrite=False):
667671
zoffsets_lr_str = " ".join(str(item) for item in self.zoffsets_lr)
668672

669673
s += f"# Low sampling grid spacing = {self.ds_lr} m\n"
670-
s += f"{self.postproc_name_lr}.Low.type = PlaneSampler\n"
671-
s += f"{self.postproc_name_lr}.Low.num_points = {self.nx_lr} {self.ny_lr}\n"
672-
s += f"{self.postproc_name_lr}.Low.origin = {self.xlow_lr:.4f} {self.ylow_lr:.4f} {self.zlow_lr:.4f}\n" # Round the float output
673-
s += f"{self.postproc_name_lr}.Low.axis1 = {self.xdist_lr:.4f} 0.0 0.0\n" # Assume: axis1 oriented parallel to AMR-Wind x-axis
674-
s += f"{self.postproc_name_lr}.Low.axis2 = 0.0 {self.ydist_lr:.4f} 0.0\n" # Assume: axis2 oriented parallel to AMR-Wind y-axis
675-
s += f"{self.postproc_name_lr}.Low.normal = 0.0 0.0 1.0\n"
676-
s += f"{self.postproc_name_lr}.Low.offsets = {zoffsets_lr_str}\n\n\n"
674+
s += f"{self.postproc_name_lr}.Low.type = PlaneSampler\n"
675+
s += f"{self.postproc_name_lr}.Low.num_points = {self.nx_lr} {self.ny_lr}\n"
676+
s += f"{self.postproc_name_lr}.Low.origin = {self.xlow_lr:.4f} {self.ylow_lr:.4f} {self.zlow_lr:.4f}\n" # Round the float output
677+
s += f"{self.postproc_name_lr}.Low.axis1 = {self.xdist_lr:.4f} 0.0 0.0\n" # Assume: axis1 oriented parallel to AMR-Wind x-axis
678+
s += f"{self.postproc_name_lr}.Low.axis2 = 0.0 {self.ydist_lr:.4f} 0.0\n" # Assume: axis2 oriented parallel to AMR-Wind y-axis
679+
s += f"{self.postproc_name_lr}.Low.offset_vector = 0.0 0.0 1.0\n"
680+
s += f"{self.postproc_name_lr}.Low.offsets = {zoffsets_lr_str}\n\n\n"
677681

678682
s += f"# ---- High-res sampling parameters ----\n"
679-
s += f"{self.postproc_name_hr}.output_format = netcdf\n"
680-
s += f"{self.postproc_name_hr}.output_frequency = {self.output_frequency_hr}\n"
681-
s += f"{self.postproc_name_hr}.fields = velocity # temperature tke\n"
682-
s += f"{self.postproc_name_hr}.labels = {sampling_labels_hr_str}\n"
683+
s += f"{self.postproc_name_hr}.output_format = netcdf\n"
684+
s += f"{self.postproc_name_hr}.output_frequency = {self.output_frequency_hr}\n"
685+
s += f"{self.postproc_name_hr}.fields = velocity # temperature tke\n"
686+
s += f"{self.postproc_name_hr}.labels = {sampling_labels_hr_str}\n"
683687

684688
# Write out high resolution sampling plane info
685689
for turbkey in self.hr_domains:
@@ -704,13 +708,13 @@ def write_sampling_params(self, out=None, overwrite=False):
704708
zoffsets_hr_str = " ".join(str(item) for item in zoffsets_hr)
705709

706710
s += f"\n# Turbine {wt_name} with base at (x,y,z) = ({wt_x:.4f}, {wt_y:.4f}, {wt_z:.4f}), with hh = {wt_h}, D = {wt_D}, grid spacing = {self.ds_hr} m\n"
707-
s += f"{self.postproc_name_hr}.{sampling_name}.type = PlaneSampler\n"
708-
s += f"{self.postproc_name_hr}.{sampling_name}.num_points = {nx_hr} {ny_hr}\n"
709-
s += f"{self.postproc_name_hr}.{sampling_name}.origin = {xlow_hr:.4f} {ylow_hr:.4f} {zlow_hr:.4f}\n" # Round the float output
710-
s += f"{self.postproc_name_hr}.{sampling_name}.axis1 = {xdist_hr:.4f} 0.0 0.0\n" # Assume: axis1 oriented parallel to AMR-Wind x-axis
711-
s += f"{self.postproc_name_hr}.{sampling_name}.axis2 = 0.0 {ydist_hr:.4f} 0.0\n" # Assume: axis2 oriented parallel to AMR-Wind y-axis
712-
s += f"{self.postproc_name_hr}.{sampling_name}.normal = 0.0 0.0 1.0\n"
713-
s += f"{self.postproc_name_hr}.{sampling_name}.offsets = {zoffsets_hr_str}\n"
711+
s += f"{self.postproc_name_hr}.{sampling_name}.type = PlaneSampler\n"
712+
s += f"{self.postproc_name_hr}.{sampling_name}.num_points = {nx_hr} {ny_hr}\n"
713+
s += f"{self.postproc_name_hr}.{sampling_name}.origin = {xlow_hr:.4f} {ylow_hr:.4f} {zlow_hr:.4f}\n" # Round the float output
714+
s += f"{self.postproc_name_hr}.{sampling_name}.axis1 = {xdist_hr:.4f} 0.0 0.0\n" # Assume: axis1 oriented parallel to AMR-Wind x-axis
715+
s += f"{self.postproc_name_hr}.{sampling_name}.axis2 = 0.0 {ydist_hr:.4f} 0.0\n" # Assume: axis2 oriented parallel to AMR-Wind y-axis
716+
s += f"{self.postproc_name_hr}.{sampling_name}.offset_vector = 0.0 0.0 1.0\n"
717+
s += f"{self.postproc_name_hr}.{sampling_name}.offsets = {zoffsets_hr_str}\n"
714718

715719

716720
if out is None:

0 commit comments

Comments
 (0)