-
Notifications
You must be signed in to change notification settings - Fork 0
/
boundary.py
80 lines (55 loc) · 2.25 KB
/
boundary.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
from miniwake import SingleWake
from miniwake.turbine import Turbine
from miniwake.turbine import FixedThrustCurve
import numpy as np
import matplotlib.pyplot as plt
upwind_turbine = Turbine(name="T1",
x=0.0,
y=0.0,
hub_height=80.0,
diameter=76.0,
rotational_speed_rpm=17.0,
thrust_curve=FixedThrustCurve(0.4))
upwind_velocity = 9.
amient_turbulence_intensity = 0.10
upwind_local_turbulence_intensity = amient_turbulence_intensity
single_wake = SingleWake(ambient_turbulence_intensity=amient_turbulence_intensity,
upwind_turbine=upwind_turbine,
upwind_velocity=upwind_velocity,
upwind_local_turbulence_intensity=upwind_local_turbulence_intensity,
apply_meander=True)
downwind_points = 200
crosswind_points = 100
data = np.array((downwind_points, crosswind_points))
cross_sections = []
threshold = 0.0001
threshold_distances = []
threshold_laterals = []
for normalised_downwind in np.linspace(1.0, 1000.0, num=downwind_points):
downwind_distance = normalised_downwind * upwind_turbine.diameter
wake = single_wake.calculate(downwind_distance)
yv = []
threshold_lateral = None
for normalised_lateral in np.linspace(0, 50.0, num=100):
lateral_distance = normalised_lateral * upwind_turbine.diameter
deficit = wake.velocity_deficit(lateral_distance=lateral_distance, vertical_distance=0.0)
if deficit < threshold:
deficit = np.nan
if threshold_lateral is None:
threshold_lateral = normalised_lateral
yv.append(deficit)
cross_sections.append(np.array(yv))
threshold_distances.append(normalised_downwind)
threshold_laterals.append(threshold_lateral)
data = np.array(cross_sections)
x = np.array(threshold_distances, dtype=float)
y = np.array(threshold_laterals, dtype=float)
t = 1.0 + 0.24 * x
xy = np.transpose(np.vstack((x, y)))
np.savetxt(f"out_{amient_turbulence_intensity}.dat", xy)
plt.imshow(data, cmap='viridis')
plt.colorbar()
plt.show()
plt.scatter(x, y, s=20, marker='o')
plt.scatter(x, t, s=20, marker='^')
plt.show()