How to use the floris.tools.visualization function in floris

To help you get started, we’ve selected a few floris examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NREL / floris / examples / visualization / visualize_curl.py View on Github external
fi.reinitialize_flow_field(layout_array=(layout_x, layout_y))

# Calculate wake
fi.calculate_wake(yaw_angles=[25, 0, 0])

# Get the hor plane
hor_plane = fi.get_hor_plane()

# Plot and show
fig, ax = plt.subplots()
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)

# Get the vertical cut through and visualize
cp = fi.get_cross_plane(5 * D)
fig, ax = plt.subplots(figsize=(10, 10))
wfct.visualization.visualize_cut_plane(cp, ax=ax, minSpeed=6.0, maxSpeed=8)
wfct.visualization.visualize_quiver(cp, ax=ax, downSamp=2)
ax.set_ylim([15, 300])

# Save the flow data as vtk
flow_data = fi.get_flow_data()
flow_data = flow_data.crop(flow_data, [0, 20 * D], [-300, 300], [50, 300])
flow_data.save_as_vtk("for_3d_viz.vtk")

plt.show()
github NREL / floris / examples / optimization / scipy / controls_optimization / optimize_yaw.py View on Github external
print("==========================================")
print(
    "Total Power Gain = %.1f%%" % (100.0 * (power_opt - power_initial) / power_initial)
)
print("==========================================")
# =============================================================================
print("Plotting the FLORIS flowfield with yaw...")
# =============================================================================

# Initialize the horizontal cut
hor_plane = fi.get_hor_plane(x_resolution=400, y_resolution=100)

# Plot and show
fig, ax = plt.subplots()
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)
ax.set_title("Optimal Wake Steering for U = 8 m/s, Wind Direction = 270$^\circ$")
plt.show()
github NREL / floris / examples / optimization / scipy / example_optimize_yaw.py View on Github external
print('==========================================')
print('Total Power Gain = %.1f%%' %
      (100.*(power_opt - power_initial)/power_initial))
print('==========================================')
# =============================================================================
print('Plotting the FLORIS flowfield with yaw...')
# =============================================================================

# Initialize the horizontal cut
hor_plane = fi.get_hor_plane(x_resolution=400,
                                 y_resolution=100)


# Plot and show
fig, ax = plt.subplots()
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)
ax.set_title('Optimal Wake Steering for U = 8 m/s, Wind Direction = 270$^\circ$')
plt.show()
github NREL / floris / examples / _getting_started / example_04_compare_previous_models.py View on Github external
)
):

    # Aligned case
    fi.calculate_wake(yaw_angles=[0])
    ax = axarr[0, idx]
    hor_plane = fi.get_hor_plane()
    wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)
    ax.set_title(name)
    axarr[0, 0].set_ylabel("Aligned")

    # Yawed case
    fi.calculate_wake(yaw_angles=[25])
    ax = axarr[1, idx]
    hor_plane = fi.get_hor_plane()
    wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)
    axarr[1, 0].set_ylabel("Yawed")


# Show the figure
plt.show()
github NREL / floris / examples / other / demo_turbulence_correction.py View on Github external
hor_plane = fi.get_hor_plane()


txt = (
    str("Turbine Power Output: \n       With Turbulence Correction: ")
    + str(turbulent_power[0] * 10 ** -6)
    + (" MW\n       Without Turbulence Correction: ")
    + str(_power[0] * 10 ** -6)
    + str(" MW")
)

fig = plt.figure(figsize=(10, 7))
ax = plt.subplot()
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)
ax.set_xlabel("Easting (m)")
ax.set_ylabel("Northing (m)")
plt.text(0, -0.5, txt, transform=ax.transAxes)
plt.show(im)


print(
    "========== calculating power curve at each wind speed and turbulence intensity =========="
)
sp = [
    0.1,
    3.5,
    4.0,
    5.0,
github NREL / floris / examples / heterogenous_flow / demo_het_dir.py View on Github external
# Introduce variation in wind direct
fi.reinitialize_flow_field(wind_direction=[270, 280], wind_layout=[[0, 0], [0, 500]])
fi.calculate_wake()
hor_plane_het_dir = fi.get_hor_plane()

# Plot
fig, axarr = plt.subplots(2, 1, figsize=(6, 10))

ax = axarr[0]
im = wfct.visualization.visualize_cut_plane(hor_plane, 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("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,
)
github NREL / floris / examples / sowfa_comparisons / sowfa_minus_floris.py View on Github external
ax = axarr[0, 0]
wfct.visualization.visualize_cut_plane(
    cut_plane_sowfa, ax=ax, minSpeed=minspeed, maxSpeed=maxspeed
)
ax.set_title("SOWFA")

# FLORIS
ax = axarr[0, 1]
wfct.visualization.visualize_cut_plane(
    cut_plane_floris, ax=ax, minSpeed=minspeed, maxSpeed=maxspeed
)
ax.set_title("FLORIS")

# FLORIS Project
ax = axarr[1, 0]
wfct.visualization.visualize_cut_plane(
    cut_plane_floris_project, ax=ax, minSpeed=minspeed, maxSpeed=maxspeed
)
ax.set_title("FLORIS Projected")

# SOWFA - FLORIS
ax = axarr[1, 1]
wfct.visualization.visualize_cut_plane(
    cut_plane_difference, ax=ax, minSpeed=-1, maxSpeed=1
)
ax.set_title("SOWFA - FLORIS Projected")


plt.show()
github NREL / floris / examples / sowfa_comparisons / modify_floris_to_match_sowfa.py View on Github external
import floris.tools.cut_plane as cp
import floris.tools.visualization as vis


# 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(
github NREL / floris / examples / heterogenous_flow / demo_het_speed.py View on Github external
fi.calculate_wake()

# Get hor plane
hor_plane = fi.get_hor_plane()

# Introduce variation in wind speed
fi.reinitialize_flow_field(wind_speed=[6, 9], wind_layout=[[0, 0], [0, 500]])
fi.calculate_wake()
hor_plane_het_speed = fi.get_hor_plane()

# Plot
fig, axarr = plt.subplots(2, 1, figsize=(6, 10))

ax = axarr[0]
im = wfct.visualization.visualize_cut_plane(hor_plane, 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("Homogenous")

ax = axarr[1]
im = wfct.visualization.visualize_cut_plane(
    hor_plane_het_speed, 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")

plt.show()
github NREL / floris / examples / visualization / visualize_curl.py View on Github external
# Change the layout
D = fi.floris.farm.flow_field.turbine_map.turbines[0].rotor_diameter
layout_x = [0, 7 * D, 14 * D]
layout_y = [0, 0, 0]
fi.reinitialize_flow_field(layout_array=(layout_x, layout_y))

# Calculate wake
fi.calculate_wake(yaw_angles=[25, 0, 0])

# Get the hor plane
hor_plane = fi.get_hor_plane()

# Plot and show
fig, ax = plt.subplots()
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)

# Get the vertical cut through and visualize
cp = fi.get_cross_plane(5 * D)
fig, ax = plt.subplots(figsize=(10, 10))
wfct.visualization.visualize_cut_plane(cp, ax=ax, minSpeed=6.0, maxSpeed=8)
wfct.visualization.visualize_quiver(cp, ax=ax, downSamp=2)
ax.set_ylim([15, 300])

# Save the flow data as vtk
flow_data = fi.get_flow_data()
flow_data = flow_data.crop(flow_data, [0, 20 * D], [-300, 300], [50, 300])
flow_data.save_as_vtk("for_3d_viz.vtk")

plt.show()