Skip to content

Commit

Permalink
Add helix model operation mode (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafmudaf committed Apr 5, 2024
1 parent 3c24a9c commit 9da4cbb
Show file tree
Hide file tree
Showing 43 changed files with 1,080 additions and 3 deletions.
160 changes: 160 additions & 0 deletions examples/examples_control_types/004_helix_active_wake_mixing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Copyright 2024 NREL

# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# See https://floris.readthedocs.io for documentation

import matplotlib.pyplot as plt
import numpy as np
import yaml

import floris.flow_visualization as flowviz
from floris import FlorisModel


"""
Example to test out using helix wake mixing of upstream turbines.
Helix wake mixing is turned on at turbine 1, off at turbines 2 to 4;
Turbine 2 is in wake turbine 1, turbine 4 in wake of turbine 3.
"""

# Grab model of FLORIS and update to awc-enabled turbines
fmodel = FlorisModel("../inputs/emgauss_helix.yaml")
fmodel.set_operation_model("awc")

# Set the wind directions and speeds to be constant over N different helix amplitudes
N = 1
awc_modes = np.array(["helix", "baseline", "baseline", "baseline"]).reshape(4, N).T
awc_amplitudes = np.array([2.5, 0, 0, 0]).reshape(4, N).T

# Create 4 WT WF layout with lateral offset of 3D and streamwise offset of 4D
D = 240
fmodel.set(
layout_x=[0.0, 4*D, 0.0, 4*D],
layout_y=[0.0, 0.0, -3*D, -3*D],
wind_directions=270 * np.ones(N),
wind_speeds=8.0 * np.ones(N),
turbulence_intensities=0.06*np.ones(N),
awc_modes=awc_modes,
awc_amplitudes=awc_amplitudes
)
fmodel.run()
turbine_powers = fmodel.get_turbine_powers()

# Plot the flow fields for T1 awc_amplitude = 2.5
horizontal_plane = fmodel.calculate_horizontal_plane(
x_resolution=200,
y_resolution=100,
height=150.0,
awc_modes=awc_modes,
awc_amplitudes=awc_amplitudes
)

y_plane_baseline = fmodel.calculate_y_plane(
x_resolution=200,
z_resolution=100,
crossstream_dist=0.0,
awc_modes=awc_modes,
awc_amplitudes=awc_amplitudes
)
y_plane_helix = fmodel.calculate_y_plane(
x_resolution=200,
z_resolution=100,
crossstream_dist=-3*D,
awc_modes=awc_modes,
awc_amplitudes=awc_amplitudes
)

cross_plane = fmodel.calculate_cross_plane(
y_resolution=100,
z_resolution=100,
downstream_dist=720.0,
awc_modes=awc_modes,
awc_amplitudes=awc_amplitudes
)

# Create the plots
fig, ax_list = plt.subplots(2, 2, figsize=(10, 8), tight_layout=True)
ax_list = ax_list.flatten()
flowviz.visualize_cut_plane(
horizontal_plane,
ax=ax_list[0],
label_contours=True,
title="Horizontal"
)
flowviz.visualize_cut_plane(
cross_plane,
ax=ax_list[2],
label_contours=True,
title="Spanwise profile at 3D"
)

# fig2, ax_list2 = plt.subplots(2, 1, figsize=(10, 8), tight_layout=True)
# ax_list2 = ax_list2.flatten()
flowviz.visualize_cut_plane(
y_plane_baseline,
ax=ax_list[1],
label_contours=True,
title="Streamwise profile, helix"
)
flowviz.visualize_cut_plane(
y_plane_helix,
ax=ax_list[3],
label_contours=True,
title="Streamwise profile, baseline"
)

# Calculate the effect of changing awc_amplitudes
N = 50
awc_amplitudes = np.array([
np.linspace(0, 5, N),
np.zeros(N), np.zeros(N), np.zeros(N)
]).reshape(4, N).T

# Reset FlorisModel for different helix amplitudes
fmodel.set(
wind_directions=270 * np.ones(N),
wind_speeds=8 * np.ones(N),
turbulence_intensities=0.06*np.ones(N),
awc_modes=awc_modes,
awc_amplitudes=awc_amplitudes
)
fmodel.run()
turbine_powers = fmodel.get_turbine_powers()

# Plot the power as a function of helix amplitude
fig_power, ax_power = plt.subplots()
ax_power.fill_between(
awc_amplitudes[:, 0],
0,
turbine_powers[:, 0]/1000,
color='C0',
label='Turbine 1'
)
ax_power.fill_between(
awc_amplitudes[:, 0],
turbine_powers[:, 0]/1000,
turbine_powers[:, :2].sum(axis=1)/1000,
color='C1',
label='Turbine 2'
)
ax_power.plot(
awc_amplitudes[:, 0],
turbine_powers[:,:2].sum(axis=1)/1000,
color='k',
label='Farm'
)

ax_power.set_xlabel("Upstream turbine helix amplitude [deg]")
ax_power.set_ylabel("Power [kW]")
ax_power.legend()

flowviz.show()
1 change: 1 addition & 0 deletions examples/inputs/cc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ wake:
enable_secondary_steering: true
enable_yaw_added_recovery: true
enable_transverse_velocities: true
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs/emgauss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ wake:

enable_secondary_steering: false
enable_yaw_added_recovery: true
enable_active_wake_mixing: false
enable_transverse_velocities: false

wake_deflection_parameters:
Expand Down
109 changes: 109 additions & 0 deletions examples/inputs/emgauss_helix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

name: Emperical Gaussian
description: Three turbines using empirical Gaussian model
floris_version: v4.0

logging:
console:
enable: true
level: WARNING
file:
enable: false
level: WARNING

solver:
type: turbine_grid
turbine_grid_points: 3

farm:
layout_x:
- 0.0
- 630.0
- 1260.0
layout_y:
- 0.0
- 0.0
- 0.0
turbine_type:
- iea_15MW

flow_field:
air_density: 1.225
reference_wind_height: -1 # -1 is code for use the hub height
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
wind_speeds:
- 8.0
wind_veer: 0.0

wake:
model_strings:
combination_model: sosfs
deflection_model: empirical_gauss
turbulence_model: wake_induced_mixing
velocity_model: empirical_gauss

enable_secondary_steering: false
enable_yaw_added_recovery: false
enable_active_wake_mixing: true
enable_transverse_velocities: false

wake_deflection_parameters:
gauss:
ad: 0.0
alpha: 0.58
bd: 0.0
beta: 0.077
dm: 1.0
ka: 0.38
kb: 0.004
jimenez:
ad: 0.0
bd: 0.0
kd: 0.05
empirical_gauss:
horizontal_deflection_gain_D: 3.0
vertical_deflection_gain_D: -1
deflection_rate: 30
mixing_gain_deflection: 0.0
yaw_added_mixing_gain: 0.0

wake_velocity_parameters:
cc:
a_s: 0.179367259
b_s: 0.0118889215
c_s1: 0.0563691592
c_s2: 0.13290157
a_f: 3.11
b_f: -0.68
c_f: 2.41
alpha_mod: 1.0
gauss:
alpha: 0.58
beta: 0.077
ka: 0.38
kb: 0.004
jensen:
we: 0.05
empirical_gauss:
wake_expansion_rates:
- 0.023
- 0.008
breakpoints_D:
- 10
sigma_0_D: 0.28
smoothing_length_D: 2.0
mixing_gain_velocity: 2.0
awc_wake_exp: 1.2
awc_wake_denominator: 400
wake_turbulence_parameters:
crespo_hernandez:
initial: 0.1
constant: 0.5
ai: 0.8
downstream: -0.32
wake_induced_mixing:
atmospheric_ti_gain: 0.0
4 changes: 4 additions & 0 deletions examples/inputs/gch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ wake:
# Can be "true" or "false".
enable_yaw_added_recovery: true

###
# Can be "true" or "false".
enable_active_wake_mixing: false

###
# Can be "true" or "false".
enable_transverse_velocities: true
Expand Down
1 change: 1 addition & 0 deletions examples/inputs/gch_heterogeneous_inflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ wake:
enable_secondary_steering: true
enable_yaw_added_recovery: true
enable_transverse_velocities: true
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs/gch_multi_dim_cp_ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ wake:
enable_secondary_steering: true
enable_yaw_added_recovery: true
enable_transverse_velocities: true
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs/gch_multiple_turbine_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: false
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs/jensen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: false
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs/turbopark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: false
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs_floating/emgauss_fixed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: true
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs_floating/emgauss_floating.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: true
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs_floating/emgauss_floating_fixedtilt15.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: true
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs_floating/emgauss_floating_fixedtilt5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: true
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs_floating/gch_fixed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ wake:
enable_secondary_steering: true
enable_yaw_added_recovery: true
enable_transverse_velocities: true
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs_floating/gch_floating.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ wake:
enable_secondary_steering: true
enable_yaw_added_recovery: true
enable_transverse_velocities: true
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ wake:
enable_secondary_steering: true
enable_yaw_added_recovery: true
enable_transverse_velocities: true
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
Loading

0 comments on commit 9da4cbb

Please sign in to comment.