Skip to content

Commit

Permalink
added G1 calibration data
Browse files Browse the repository at this point in the history
  • Loading branch information
gogannes committed Sep 1, 2023
1 parent 203c48f commit ed0e2ee
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
74 changes: 74 additions & 0 deletions demo_with_calibration_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Copyright (c) 2023, Johannes Schreiber; Amr Balbaa; Carlo L. Bottasso
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

import pathlib
import pickle

import matplotlib.pyplot as plt
import numpy as np

from double_gaussian_wake_model.wake_model import double_gaussian_deficit


# This script loads the calibration data (scaled G1-turbine) and re-generates Fig. 3 of:
# Schreiber, J., Balbaa, A., and Bottasso, C. L.: Brief communication: A double-Gaussian wake model,
# Wind Energ. Sci., 5, 237–244, https://doi.org/10.5194/wes-5-237-2020, 2020.

def get_points_for_line_plot(d0, downstream_D=6, resolution=0.01, limit_D=1.5):
z = np.array([0])
y = np.arange(-limit_D, limit_D, resolution) * d0
x = np.array([downstream_D]) * d0
return x, y, z


# Loading of epsilon table
if pathlib.Path('resources/fcn_epsilon.pickle').is_file():
with open('resources/fcn_epsilon.pickle', 'rb') as f:
fcn_epsilon = pickle.load(f)
recompute_epsilon = False
else:
print("Epsilon look-up table could not be found. "
"Run 'generate_epsilon.py' to create it."
"Using the slower and 'recompute_epsilon' option for now.")
fcn_epsilon = None
recompute_epsilon = True

# load calibration data
with open('resources/G1_calibration_data.pickle', 'rb') as f:
data = pickle.load(f)

# Parameters:
kr, k, x0 = 0.534719991282902, 0.010379302460442, 1.103128529641920

Ct = 0.75
v = 1.0
d0 = 1.1

fig, axes = plt.subplots(1, len(data["distance_D"]), sharex=True, sharey=True, figsize=(12, 6))
for i, downstream_D in enumerate(data["distance_D"]):
ax = axes[i]

ax.plot(data["CFD_x"][i], data["CFD_y"][i], label=f"CFD", linewidth=0, marker="x", color="r")
ax.plot(data["Exp_x"][i], data["Exp_y"][i], label=f"Exp.", linewidth=0, marker="o", color="k", mfc='none')

x, y, z = get_points_for_line_plot(d0, downstream_D)
deficit = double_gaussian_deficit(x, y, z, Ct, d0, kr, x0, k, recompute_epsilon, fcn_epsilon)
ax.plot(v * (1 - deficit), y / d0, label=f"DG", color="tab:blue")

ax.set_title(f"x={downstream_D}D")

if i == 0:
ax.legend(loc="lower right")

ax.set_ylabel('Y [D]')
ax.set_xlabel('V [-]')
ax.set_ylim([-1.5, 1.5])
ax.set_xlim([0.4, 1.1])
ax.grid()

fig.tight_layout()

plt.show()
Binary file added resources/G1_calibration_data.pickle
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name='double_gaussian_wake_model',
version='0.1.0',
version='2.1',
py_modules=['double_gaussian_wake_model'],
url='https://github.com/gogannes/double_gaussian_wake_model',
license='BSD-2-Clause',
Expand Down

0 comments on commit ed0e2ee

Please sign in to comment.