Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
wind_direction = wdir,
turbulence_intensity = ti,
wind_layout = (wind_x,wind_y),
layout_array = (layout_x,layout_y))
print('------------- visualizing reinitialized cut plane --------')
fi.calculate_wake()
hor_plane = fi.get_hor_plane()
wind_direction_at_turbine = fi.floris.farm.wind_map.turbine_wind_direction
fig, ax=plt.subplots(figsize = (11,3))
im = wfct.visualization.visualize_cut_plane(hor_plane, ax)
cbar = fig.colorbar(im, ax=ax, fraction = 0.025, aspect = 12, pad=0.04)
cbar.set_label("Wind Speed (m/s)", labelpad=+10)
im = wfct.visualization.plot_turbines(ax = ax, layout_x = fi.layout_x ,layout_y = fi.layout_y, yaw_angles = [-1 * d for i,d in enumerate(wind_direction_at_turbine)], D = 80 )
plt.show(im)
)
# Set the yaw angles
fi.calculate_wake(yaw_angles=si.yaw_angles)
# Plot the FLORIS flow and turbines using the input information,
# and bounds from SOWFA
hor_plane_matched = fi.get_hor_plane(
90,
x_bounds=[np.min(sowfa_flow_data.x), np.max(sowfa_flow_data.x)],
y_bounds=[np.min(sowfa_flow_data.y), np.max(sowfa_flow_data.y)],
)
wfct.visualization.visualize_cut_plane(
hor_plane_matched, ax=ax3, minSpeed=minspeed, maxSpeed=maxspeed
)
vis.plot_turbines(
ax3,
fi.layout_x,
fi.layout_y,
fi.get_yaw_angles(),
fi.floris.farm.turbine_map.turbines[0].rotor_diameter,
)
ax3.set_title("FLORIS - Matched")
ax3.set_xlabel("x location [m]")
ax3.set_ylabel("y location [m]")
plt.show()
cbar = fig.colorbar(im, ax=ax, fraction=0.025, pad=0.04)
cbar.set_label("Wind Speed (m/s)", labelpad=+10)
ax.set_title("Homogenous")
ax = axarr[1]
im = wfct.visualization.visualize_cut_plane(
hor_plane_het_dir, ax, minSpeed=4, maxSpeed=9
)
cbar = fig.colorbar(im, ax=ax, fraction=0.025, pad=0.04)
cbar.set_label("Wind Speed (m/s)", labelpad=+10)
ax.set_title("Heterogenous")
# Note that applying turbines requires first learning the
# wind direction the turbines are aligned to
wind_direction_at_turbine = fi.floris.farm.wind_map.turbine_wind_direction
wfct.visualization.plot_turbines(
ax=ax,
layout_x=fi.layout_x,
layout_y=fi.layout_y,
yaw_angles=[-1 * d for i, d in enumerate(wind_direction_at_turbine)],
D=126,
)
plt.show()
# Define a minspeed and maxspeed to use across visualiztions
minspeed = 4.0
maxspeed = 8.5
# Load the SOWFA case in
si = wfct.sowfa_utilities.SowfaInterface("sowfa_example")
# Plot the SOWFA flow and turbines using the input information
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, figsize=(5, 8.5))
sowfa_flow_data = si.flow_data
hor_plane = si.get_hor_plane(90)
wfct.visualization.visualize_cut_plane(
hor_plane, ax=ax2, minSpeed=minspeed, maxSpeed=maxspeed
)
vis.plot_turbines(ax2, si.layout_x, si.layout_y, si.yaw_angles, si.D)
ax2.set_title("SOWFA")
ax2.set_ylabel("y location [m]")
# Load the FLORIS case in
fi = wfct.floris_interface.FlorisInterface("../example_input.json")
fi.calculate_wake()
# Plot the original FLORIS flow and turbines using the input information
hor_plane_orig = fi.get_hor_plane(90)
wfct.visualization.visualize_cut_plane(
hor_plane_orig, ax=ax1, minSpeed=minspeed, maxSpeed=maxspeed
)
vis.plot_turbines(
ax1,
fi.layout_x,
fi.layout_y,
hor_plane, ax=ax2, minSpeed=minspeed, maxSpeed=maxspeed
)
vis.plot_turbines(ax2, si.layout_x, si.layout_y, si.yaw_angles, si.D)
ax2.set_title("SOWFA")
ax2.set_ylabel("y location [m]")
# Load the FLORIS case in
fi = wfct.floris_interface.FlorisInterface("../example_input.json")
fi.calculate_wake()
# Plot the original FLORIS flow and turbines using the input information
hor_plane_orig = fi.get_hor_plane(90)
wfct.visualization.visualize_cut_plane(
hor_plane_orig, ax=ax1, minSpeed=minspeed, maxSpeed=maxspeed
)
vis.plot_turbines(
ax1,
fi.layout_x,
fi.layout_y,
fi.get_yaw_angles(),
fi.floris.farm.turbine_map.turbines[0].rotor_diameter,
)
ax1.set_title("FLORIS - Original")
ax1.set_ylabel("y location [m]")
# Set the relevant FLORIS parameters to equal the SOWFA case
fi.reinitialize_flow_field(
wind_speed=[si.precursor_wind_speed],
wind_direction=[si.precursor_wind_dir],
layout_array=(si.layout_x, si.layout_y),
)
)
fi.calculate_wake()
print('------------- visualizing reinitialized cut plane --------')
hor_plane = fi.get_hor_plane()
wind_direction_at_turbine = fi.floris.farm.wind_map.turbine_wind_direction
fig, ax=plt.subplots(figsize = (10,7))
im = wfct.visualization.visualize_cut_plane(hor_plane, ax)
cbar = fig.colorbar(im, ax=ax, fraction=0.025, pad=0.04)
cbar.set_label("Wind Speed (m/s)", labelpad=+10)
im = wfct.visualization.plot_turbines(ax = ax, layout_x = fi.layout_x ,layout_y = fi.layout_y, yaw_angles = [-1 * d for i,d in enumerate(wind_direction_at_turbine)], D = 80 )
plt.show(im)
# Visualize Percent Velocity Deficit
print('------------- visualizing percent velocity deficit in cut plane --------')
hor_plane = fi.get_hor_plane()
wind_direction_at_turbine = fi.floris.farm.wind_map.turbine_wind_direction
fig, ax=plt.subplots(figsize = (10,7))
im = wfct.visualization.visualize_cut_plane(hor_plane, ax)
cbar = fig.colorbar(im, ax=ax, fraction=0.025, pad=0.04)
cbar.set_label("Velocity Deficit (%)", labelpad=+10)