Skip to content

Commit

Permalink
yaw_added_recovery test updated to include default 0 gain and nonzero…
Browse files Browse the repository at this point in the history
… gain.
  • Loading branch information
misi9170 committed Dec 11, 2023
1 parent 49377a7 commit 0408cc5
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 14 deletions.
2 changes: 0 additions & 2 deletions floris/simulation/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,6 @@ def empirical_gauss_solver(

if model_manager.enable_yaw_added_recovery:
# Influence of yawing on turbine's own wake
# TODO: Create reg test for the case when enable_yaw_added_recovery is True
mixing_factor[:, i:i+1, i] += \
yaw_added_wake_mixing(
axial_induction_i,
Expand Down Expand Up @@ -1334,7 +1333,6 @@ def empirical_gauss_solver(
axial_induction_i, downstream_distance_D[:,:,i]
)
if model_manager.enable_yaw_added_recovery:
# TODO: Create reg test for the case when enable_yaw_added_recovery is True
mixing_factor[:,:,i] += \
area_overlap * yaw_added_wake_mixing(
axial_induction_i,
Expand Down
102 changes: 90 additions & 12 deletions tests/reg_tests/empirical_gauss_regression_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,31 +94,31 @@
]
)

yaw_added_mixing_baseline = np.array(
yaw_added_recovery_baseline = np.array(
[
# 8 m/s
[
[7.9736330, 0.7606986, 1679924.0721706, 0.2549029],
[6.0012490, 0.8353654, 707912.3201655, 0.2971241],
[6.0404040, 0.8335607, 723777.1688957, 0.2960151],
[5.9343009, 0.8387850, 684615.9328740, 0.2992420],
[5.9680241, 0.8370593, 696314.1525222, 0.2981704],
],
# 9 m/s
[
[8.9703371, 0.7596552, 2391434.0080674, 0.2543734],
[6.7531818, 0.8021893, 1027839.1215598, 0.2776204],
[6.8331381, 0.7989720, 1065054.4872236, 0.2758193],
[6.6795240, 0.8051531, 993555.3595338, 0.2792927],
[6.7704684, 0.8014937, 1035885.1172753, 0.2772298],
],
# 10 m/s
[
[9.9670412, 0.7500732, 3275671.6727516, 0.2495630],
[7.5219271, 0.7752809, 1420639.3564230, 0.2629773],
[7.6244680, 0.7726302, 1482087.5389477, 0.2615835],
[7.4567077, 0.7772686, 1384573.5845651, 0.2640278],
[7.5779862, 0.7738318, 1454233.0717541, 0.2622143],
],
# 11 m/s
[
[10.9637454, 0.7278454, 4333842.6695283, 0.2387424],
[8.3229921, 0.7620429, 1926896.4413586, 0.2560958],
[8.3952439, 0.7618461, 1976057.7564083, 0.2559949],
[8.2914104, 0.7621290, 1905407.7287412, 0.2561399],
[8.3784336, 0.7618919, 1964619.7950752, 0.2560184],
],
]
)
Expand Down Expand Up @@ -203,6 +203,7 @@ def test_regression_tandem(sample_inputs_fixture):
farm_cts,
farm_powers,
farm_axial_inductions,
max_findex_print=4
)

assert_results_arrays(test_results[0:4], baseline)
Expand Down Expand Up @@ -367,11 +368,12 @@ def test_regression_yaw(sample_inputs_fixture):
farm_cts,
farm_powers,
farm_axial_inductions,
max_findex_print=4
)

assert_results_arrays(test_results[0:4], yawed_baseline)

def test_regression_yaw_added_mixing(sample_inputs_fixture):
def test_regression_yaw_added_recovery(sample_inputs_fixture):
"""
Tandem turbines with the upstream turbine yawed and yaw added recovery
correction enabled
Expand All @@ -381,8 +383,83 @@ def test_regression_yaw_added_mixing(sample_inputs_fixture):
sample_inputs_fixture.floris["wake"]["model_strings"]["deflection_model"] = DEFLECTION_MODEL
sample_inputs_fixture.floris["wake"]["model_strings"]["turbulence_model"] = TURBULENCE_MODEL

# Turn on yaw added mixing
# Turn on yaw added recovery
sample_inputs_fixture.floris["wake"]["enable_yaw_added_recovery"] = True
# First pass, leave at default value of 0; should then do nothing

floris = Floris.from_dict(sample_inputs_fixture.floris)

yaw_angles = np.zeros((N_FINDEX, N_TURBINES))
yaw_angles[:,0] = 5.0
floris.farm.yaw_angles = yaw_angles

floris.initialize_domain()
floris.steady_state_atmospheric_condition()

n_turbines = floris.farm.n_turbines
n_findex = floris.flow_field.n_findex

velocities = floris.flow_field.u
yaw_angles = floris.farm.yaw_angles
tilt_angles = floris.farm.tilt_angles
test_results = np.zeros((n_findex, n_turbines, 4))

farm_avg_velocities = average_velocity(
velocities,
)
farm_eff_velocities = rotor_effective_velocity(
floris.flow_field.air_density,
floris.farm.ref_density_cp_cts,
velocities,
yaw_angles,
tilt_angles,
floris.farm.ref_tilt_cp_cts,
floris.farm.pPs,
floris.farm.pTs,
floris.farm.turbine_fTilts,
floris.farm.correct_cp_ct_for_tilt,
floris.farm.turbine_type_map,
)
farm_cts = Ct(
velocities,
yaw_angles,
tilt_angles,
floris.farm.ref_tilt_cp_cts,
floris.farm.turbine_fCts,
floris.farm.turbine_fTilts,
floris.farm.correct_cp_ct_for_tilt,
floris.farm.turbine_type_map,
)
farm_powers = power(
floris.farm.ref_density_cp_cts,
farm_eff_velocities,
floris.farm.turbine_power_interps,
floris.farm.turbine_type_map,
)
farm_axial_inductions = axial_induction(
velocities,
yaw_angles,
tilt_angles,
floris.farm.ref_tilt_cp_cts,
floris.farm.turbine_fCts,
floris.farm.turbine_fTilts,
floris.farm.correct_cp_ct_for_tilt,
floris.farm.turbine_type_map,
)
for i in range(n_findex):
for j in range(n_turbines):
test_results[i, j, 0] = farm_avg_velocities[i, j]
test_results[i, j, 1] = farm_cts[i, j]
test_results[i, j, 2] = farm_powers[i, j]
test_results[i, j, 3] = farm_axial_inductions[i, j]

# Compare to case where enable_yaw_added_recovery = False, since
# default gains are 0.
assert_results_arrays(test_results[0:4], yawed_baseline)

# Second pass, use nonzero gain
sample_inputs_fixture.floris["wake"]["wake_deflection_parameters"]\
["empirical_gauss"]["yaw_added_mixing_gain"] = 0.1

floris = Floris.from_dict(sample_inputs_fixture.floris)

Expand Down Expand Up @@ -456,9 +533,10 @@ def test_regression_yaw_added_mixing(sample_inputs_fixture):
farm_cts,
farm_powers,
farm_axial_inductions,
max_findex_print=4
)

assert_results_arrays(test_results[0], yaw_added_mixing_baseline)
assert_results_arrays(test_results[0:4], yaw_added_recovery_baseline)


def test_regression_small_grid_rotation(sample_inputs_fixture):
Expand Down

0 comments on commit 0408cc5

Please sign in to comment.