How to use the floris.tools.visualization.visualize_cut_plane 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 / sowfa_comparisons / sowfa_minus_floris.py View on Github external
x_loc = 600

cut_plane_sowfa = si.get_cross_plane(x_loc)
cut_plane_floris = fi.get_cross_plane(x_loc)
cut_plane_floris_project = cp.project_onto(cut_plane_floris, cut_plane_sowfa)
cut_plane_difference = cp.subtract(cut_plane_sowfa, cut_plane_floris_project)

print(cut_plane_sowfa.df.head())
print(cut_plane_floris_project.df.head())
print(cut_plane_difference.df.head())

fig, axarr = plt.subplots(2, 2, figsize=(10, 10))

# SOWFA
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
)
github NREL / floris / examples / sowfa_comparisons / open_and_vis_sowfa.py View on Github external
sowfa_case = wfct.sowfa_utilities.SowfaInterface("sowfa_example")

# Summarize self
print(sowfa_case)

# Demonstrate flow field visualizations

# # Get the horizontal cut plane at 90 m
hor_plane = sowfa_case.get_hor_plane(90)

# Show the views in different permutations
fig, axarr = plt.subplots(3, 2, figsize=(10, 10))

# Original
ax = axarr[0, 0]
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)
ax.set_title("Original")

# Set turbine location as 0,0
hor_plane = wfct.cut_plane.set_origin(hor_plane, 250.0, 200.0)
ax = axarr[1, 0]
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)
ax.set_title("Turbine at origin")

# Increase the resolution
hor_plane = wfct.cut_plane.change_resolution(hor_plane, resolution=(1000, 1000))
ax = axarr[2, 0]
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)
ax.set_title("Increased Resolution (Interpolation)")

# # Interpolate onto new array
x1_array = np.linspace(-50, 300)
github NREL / floris / examples / example_0005_adjust_floris.py View on Github external
fi.reinitialize_flow_field(wind_speed=[speed], wind_direction=[wdir])

        # recalculate the wake
        fi.calculate_wake()

        # record powers
        power[i, j] = np.sum(fi.get_turbine_power())

        # ============================================
        # not necessary if you only want the powers
        # ============================================
        # Visualize the changes
        # Initialize the horizontal cut
        hor_plane = hor_plane = fi.get_hor_plane()

        im = wfct.visualization.visualize_cut_plane(hor_plane, ax=ax[i, j])
        strTitle = 'Wind Dir = ' + \
            str(wdir) + 'deg' + ' Speed = ' + str(speed) + 'm/s'
        ax[i, j].set_title(strTitle)
        fig.colorbar(im, ax=ax[i, j], fraction=0.025, pad=0.04)

# ================================================================================
# print('Set yaw angles...')
# ================================================================================

# assign yaw angles to turbines and calculate wake at 270
# initial power output
fi.calculate_wake()
power_initial = np.sum(fi.get_turbine_power())

# Set the yaw angles
yaw_angles = [25.0, 0, 25.0, 0]
github NREL / floris / examples / _getting_started / example_02_turbine_adjustments.py View on Github external
# Set to 2x2 farm
fi.reinitialize_flow_field(layout_array=[[0, 0, 600, 600], [0, 300, 0, 300]])

# Change turbine 0 and 3 to have a 35 m rotor diameter
fi.change_turbine([0, 3], {"rotor_diameter": 35})

# Calculate wake
fi.calculate_wake()

# Get horizontal plane at default height (hub-height)
hor_plane = fi.get_hor_plane()

# Plot and show
fig, ax = plt.subplots()
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)
plt.show()
github NREL / floris / examples / visualization / provisional / flow_changes_in_yaw.py View on Github external
ax.set_title("Baseline, 5D")

ax = axarr[1, 0]
wfct.visualization.visualize_cut_plane(cut_plane_base_7, ax=ax, minSpeed=4, maxSpeed=8)
ax.set_title("Baseline, 7D")

ax = axarr[0, 1]
wfct.visualization.visualize_cut_plane(cut_plane_yaw_5, ax=ax, minSpeed=4, maxSpeed=8)
ax.set_title("Yaw, 5D")

ax = axarr[1, 1]
wfct.visualization.visualize_cut_plane(cut_plane_yaw_7, ax=ax, minSpeed=4, maxSpeed=8)
ax.set_title("Yaw, 7D")

ax = axarr[0, 2]
wfct.visualization.visualize_cut_plane(cut_plane_diff_5, ax=ax, minSpeed=-1, maxSpeed=1)
ax.set_title("Difference, 5D")

ax = axarr[1, 2]
wfct.visualization.visualize_cut_plane(cut_plane_diff_7, ax=ax, minSpeed=-1, maxSpeed=1)
ax.set_title("Difference, 7D")

# Reverse axis  making the view upstream looking down
for ax in axarr.flatten():
    wfct.visualization.reverse_cut_plane_x_axis_in_plot(ax)

plt.show()
github NREL / floris / examples / optimization / scipy / controls_optimization / optimize_yaw_wind_rose_robust.py View on Github external
layout_array=(layout_x, layout_y), wind_direction=[270.0], wind_speed=[8.0]
)
fi.calculate_wake()

unc_options = {"std_wd": 4.95, "std_yaw": 0.0, "pmf_res": 1.0, "pdf_cutoff": 0.95}

# ==============================================================================
print("Plotting the FLORIS flowfield...")
# ==============================================================================

# Initialize the horizontal cut
hor_plane = fi.get_hor_plane(height=fi.floris.farm.turbines[0].hub_height)

# Plot and show
fig, ax = plt.subplots()
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)
ax.set_title("Baseline flow for U = 8 m/s, Wind Direction = 270$^\circ$")

# ==============================================================================
print("Importing wind rose data...")
# ==============================================================================

# Create wind rose object and import wind rose dataframe using WIND Toolkit
# HSDS API.Alternatively, load existing file with wind rose information.
calculate_new_wind_rose = False

wind_rose = rose.WindRose()

if calculate_new_wind_rose:

    wd_list = np.arange(0, 360, 5)
    ws_list = np.arange(0, 26, 1)
github NREL / floris / examples / visualization / subtract_inflow.py View on Github external
cut_plane_base_in = fi.get_cross_plane(-5 * D)


# Get the difference planes
cut_plane_diff = cp.subtract(cut_plane_base_5, cut_plane_base_in)


# Plot and show
fig, axarr = plt.subplots(3, 1, figsize=(7, 10))

ax = axarr[0]
wfct.visualization.visualize_cut_plane(cut_plane_base_5, ax=ax, minSpeed=4, maxSpeed=8)
ax.set_title("Baseline, 5D")

ax = axarr[1]
wfct.visualization.visualize_cut_plane(cut_plane_base_in, ax=ax, minSpeed=4, maxSpeed=8)
ax.set_title("Baseline, Inflow")

ax = axarr[2]
wfct.visualization.visualize_cut_plane(cut_plane_diff, ax=ax, minSpeed=-2, maxSpeed=2)
ax.set_title("5D - INFLOW")

# Reverse axis  making the view upstream looking down
for ax in axarr.flatten():
    wfct.visualization.reverse_cut_plane_x_axis_in_plot(ax)

plt.show()
github NREL / floris / examples / example_0006_floris_demonstrate_hh_plot.py View on Github external
# Get a horizontal cut from horizontal methods
start = time.time()
hor_plane_2 = wfct.cut_plane.HorPlane(
    fi.get_hub_height_flow_data(),
    fi.floris.farm.turbines[0].hub_height
)
fi.calculate_wake()
finish = time.time()
print('Time to extract horizontal flow field', finish - start)

# Plot and show they are the same
fig, axarr = plt.subplots(1, 2)
wfct.visualization.visualize_cut_plane(
    hor_plane_1, ax=axarr[0], minSpeed=minSpeed, maxSpeed=maxSpeed)
wfct.visualization.visualize_cut_plane(
    hor_plane_2, ax=axarr[1], minSpeed=minSpeed, maxSpeed=maxSpeed)
plt.show()
github NREL / floris / examples / change_turbine / change_diameter.py View on Github external
plt.suptitle("Adjusting T0 Diameter")

# Waked, adjust T0 diameter
fi = wfct.floris_interface.FlorisInterface("../example_input.json")
fi.reinitialize_flow_field(layout_array=[[0, 500], [0, 0]])

# Calculate wake
fi.calculate_wake()
init_power = np.array(fi.get_turbine_power()) / 1000.0

fig, axarr = plt.subplots(1, 3, sharex=False, sharey=False, figsize=(15, 5))

# Show the hub-height slice in the 3rd pane
hor_plane = fi.get_hor_plane()
wfct.visualization.visualize_cut_plane(hor_plane, ax=axarr[2])

for t in range(2):

    ax = axarr[t]

    # Now sweep the heights for this turbine
    diameters = np.arange(80, 160, 1.0)
    powers = np.zeros_like(diameters)

    for d_idx, d in enumerate(diameters):
        fi.change_turbine([1], {"rotor_diameter": d})
        fi.calculate_wake()
        powers[d_idx] = fi.get_turbine_power()[t] / 1000.0

    ax.plot(diameters, powers, "k")
    ax.axhline(init_power[t], color="r", ls=":")
github NREL / floris / examples / _getting_started / example_00_open_and_vis_floris.py View on Github external
# Initialize the FLORIS interface fi
# For basic usage, the florice interface provides a simplified interface to
# the underlying classes
fi = wfct.floris_interface.FlorisInterface("../example_input.json")

# Calculate wake
fi.calculate_wake()

# Get horizontal plane at default height (hub-height)
hor_plane = fi.get_hor_plane()

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