Пример #1
0
                    ax=axarr[0],
                    title="Initial setup",
                    minSpeed=MIN_WS,
                    maxSpeed=MAX_WS)

# Change the wind speed
horizontal_plane = fi.calculate_horizontal_plane(ws=[7.0], height=90.0)
visualize_cut_plane(horizontal_plane,
                    ax=axarr[1],
                    title="Wind speed at 7 m/s",
                    minSpeed=MIN_WS,
                    maxSpeed=MAX_WS)

# Change the wind shear, reset the wind speed, and plot a vertical slice
fi.reinitialize(wind_shear=0.2, wind_speeds=[8.0])
y_plane = fi.calculate_y_plane(crossstream_dist=0.0)
visualize_cut_plane(y_plane,
                    ax=axarr[2],
                    title="Wind shear at 0.2",
                    minSpeed=MIN_WS,
                    maxSpeed=MAX_WS)

# Change the farm layout
N = 3  # Number of turbines per row and per column
X, Y = np.meshgrid(
    5.0 * fi.floris.farm.rotor_diameters[0][0][0] * np.arange(0, N, 1),
    5.0 * fi.floris.farm.rotor_diameters[0][0][0] * np.arange(0, N, 1),
)
fi.reinitialize(layout=(X.flatten(), Y.flatten()))
horizontal_plane = fi.calculate_horizontal_plane(height=90.0)
visualize_cut_plane(horizontal_plane,
het_map_2d = generate_heterogeneous_wind_map(speed_ups, x_locs, y_locs)

# Initialize FLORIS with the given input file via FlorisInterface.
# Also, pass the heterogeneous map into the FlorisInterface.
fi_2d = FlorisInterface("inputs/gch.yaml", het_map=het_map_2d)

# Set shear to 0.0 to highlight the heterogeneous inflow
fi_2d.reinitialize(wind_shear=0.0)

# Using the FlorisInterface functions for generating plots, run FLORIS
# and extract 2D planes of data.
horizontal_plane_2d = fi_2d.calculate_horizontal_plane(x_resolution=200,
                                                       y_resolution=100,
                                                       height=90.0)
y_plane_2d = fi_2d.calculate_y_plane(x_resolution=200,
                                     z_resolution=100,
                                     crossstream_dist=0.0)
cross_plane_2d = fi_2d.calculate_cross_plane(y_resolution=100,
                                             z_resolution=100,
                                             downstream_dist=500.0)

# Create the plots
fig, ax_list = plt.subplots(3, 1, figsize=(10, 8))
ax_list = ax_list.flatten()
visualize_cut_plane(horizontal_plane_2d,
                    ax=ax_list[0],
                    title="Horizontal",
                    color_bar=True)
ax_list[0].set_xlabel('x')
ax_list[0].set_ylabel('y')
visualize_cut_plane(y_plane_2d,
"""
This example uses an input file where multiple turbine types are defined.
The first two turbines are the NREL 5MW, and the third turbine is the IEA 10MW.
"""

# Initialize FLORIS with the given input file via FlorisInterface.
# For basic usage, FlorisInterface provides a simplified and expressive
# entry point to the simulation routines.
fi = FlorisInterface("inputs/gch_multiple_turbine_types.yaml")

# Using the FlorisInterface functions for generating plots, run FLORIS
# and extract 2D planes of data.
horizontal_plane = fi.calculate_horizontal_plane(x_resolution=200,
                                                 y_resolution=100,
                                                 height=90)
y_plane = fi.calculate_y_plane(x_resolution=200,
                               z_resolution=100,
                               crossstream_dist=0.0)
cross_plane = fi.calculate_cross_plane(y_resolution=100,
                                       z_resolution=100,
                                       downstream_dist=500.0)

# Create the plots
fig, ax_list = plt.subplots(3, 1, figsize=(10, 8))
ax_list = ax_list.flatten()
visualize_cut_plane(horizontal_plane, ax=ax_list[0], title="Horizontal")
visualize_cut_plane(y_plane, ax=ax_list[1], title="Streamwise profile")
visualize_cut_plane(cross_plane, ax=ax_list[2], title="Spanwise profile")

plt.show()