Skip to content

Commit

Permalink
Add flow visualization to wake steering example (#1006)
Browse files Browse the repository at this point in the history
* Visualize flows under yaw misalignment

* isort fix.
  • Loading branch information
misi9170 authored Oct 21, 2024
1 parent d6fddb3 commit 8a2bdd0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/examples_control_optimization/001_opt_yaw_single_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import matplotlib.pyplot as plt
import numpy as np

import floris.flow_visualization as flowviz
import floris.layout_visualization as layoutviz
from floris import FlorisModel, TimeSeries
from floris.optimization.yaw_optimization.yaw_optimizer_sr import YawOptimizationSR

Expand Down Expand Up @@ -63,4 +65,27 @@
ax.legend()
ax.grid(True)

# Visualize results for a single wind direction (270 deg) and wind speed (8 m/s)
fig, axarr = plt.subplots(2, 1, figsize=(10, 5), sharex=False)
ax = axarr[0] # Baseline aligned operation
fmodel.reset_operation()
fmodel.set(wind_directions=[270.0], wind_speeds=[8.0], turbulence_intensities=[0.06])
fmodel.run()
horizontal_plane = fmodel.calculate_horizontal_plane(height=90.0)
flowviz.visualize_cut_plane(horizontal_plane, ax=ax)
layoutviz.plot_turbine_rotors(fmodel, ax=ax)
ax.set_title("Turbines aligned")

ax = axarr[1] # Optimized yaw angles
optimal_yaw_angles = (
df_opt[(df_opt["wind_direction"] == 270.0) & (df_opt["wind_speed"] == 8.0)]
.yaw_angles_opt.values[0]
).reshape(1,-1)
fmodel.set(yaw_angles=optimal_yaw_angles)
fmodel.run()
horizontal_plane = fmodel.calculate_horizontal_plane(height=90.0)
flowviz.visualize_cut_plane(horizontal_plane, ax=ax)
layoutviz.plot_turbine_rotors(fmodel, ax=ax, yaw_angles=optimal_yaw_angles)
ax.set_title("Optimized yaw angles")

plt.show()

0 comments on commit 8a2bdd0

Please sign in to comment.