Skip to content

Commit 76df862

Browse files
MYMahfouzrafmudaf
authored andcommitted
Update grid.py
1 parent 304626d commit 76df862

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

floris/simulation/grid.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,28 @@ def set_grid(self) -> None:
355355
Then, create the grid based on this wind-from-left orientation
356356
"""
357357
# These are the rotated coordinates of the wind turbines based on the wind direction
358-
x, y, z = rotate_coordinates_rel_west(self.wind_directions, self.turbine_coordinates_array)
358+
fix_orientation = True #dh. TODO add variable in class
359+
if fix_orientation : wd = np.ones_like(self.wind_directions)*270 #dh. do not rotate
360+
else : wd = self.wind_directions #dh. do rotate
361+
362+
x, y, z = rotate_coordinates_rel_west(wd, self.turbine_coordinates_array)
359363

360364
max_diameter = np.max(self.reference_turbine_diameter)
361365

362366
if self.normal_vector == "z": # Rules of thumb for horizontal plane
363367
if self.x1_bounds is None:
364-
self.x1_bounds = (np.min(x) - 2 * max_diameter, np.max(x) + 10 * max_diameter)
368+
# dh. broaden the flowfiled_planar
369+
if fix_orientation :
370+
self.x1_bounds = (np.min(x) - 10 * max_diameter, np.max(x) + 10 * max_diameter)
371+
else :
372+
self.x1_bounds = (np.min(x) - 2 * max_diameter, np.max(x) + 10 * max_diameter)
365373

366374
if self.x2_bounds is None:
367-
self.x2_bounds = (np.min(y) - 2 * max_diameter, np.max(y) + 2 * max_diameter)
375+
# dh
376+
if fix_orientation :
377+
self.x2_bounds = (np.min(y) - 10 * max_diameter, np.max(y) + 10 * max_diameter)
378+
else :
379+
self.x2_bounds = (np.min(y) - 2 * max_diameter, np.max(y) + 2 * max_diameter)
368380

369381
# TODO figure out proper z spacing for GCH, currently set to +/- 10.0
370382
x_points, y_points, z_points = np.meshgrid(
@@ -377,6 +389,9 @@ def set_grid(self) -> None:
377389
]),
378390
indexing="ij"
379391
)
392+
393+
if fix_orientation :
394+
x_points, y_points, z_points = rotate_coordinates_rel_west(self.wind_directions, (x_points, y_points, z_points), inv_rot=False )
380395

381396
self.x_sorted = x_points[None, None, :, :, :]
382397
self.y_sorted = y_points[None, None, :, :, :]

0 commit comments

Comments
 (0)