foxes 0.6.1__py3-none-any.whl → 0.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of foxes might be problematic. Click here for more details.
- foxes/VERSION +1 -1
- foxes/algorithms/downwind/downwind.py +131 -65
- foxes/algorithms/downwind/models/__init__.py +2 -1
- foxes/algorithms/downwind/models/farm_wakes_calc.py +87 -55
- foxes/algorithms/downwind/models/init_farm_data.py +134 -0
- foxes/algorithms/downwind/models/point_wakes_calc.py +54 -65
- foxes/algorithms/downwind/models/{calc_order.py → reorder_farm_output.py} +28 -26
- foxes/algorithms/iterative/iterative.py +100 -51
- foxes/algorithms/iterative/models/convergence.py +3 -3
- foxes/algorithms/iterative/models/farm_wakes_calc.py +55 -48
- foxes/algorithms/sequential/models/seq_state.py +7 -6
- foxes/algorithms/sequential/sequential.py +81 -44
- foxes/constants.py +33 -18
- foxes/core/__init__.py +2 -2
- foxes/core/algorithm.py +31 -12
- foxes/core/data.py +335 -41
- foxes/core/data_calc_model.py +27 -23
- foxes/core/farm_controller.py +27 -28
- foxes/core/farm_data_model.py +26 -4
- foxes/core/model.py +186 -129
- foxes/core/partial_wakes_model.py +84 -81
- foxes/core/point_data_model.py +51 -18
- foxes/core/rotor_model.py +59 -77
- foxes/core/states.py +6 -6
- foxes/core/turbine_model.py +4 -4
- foxes/core/turbine_type.py +24 -0
- foxes/core/vertical_profile.py +3 -3
- foxes/core/wake_frame.py +91 -50
- foxes/core/wake_model.py +74 -43
- foxes/core/wake_superposition.py +29 -26
- foxes/input/farm_layout/__init__.py +1 -0
- foxes/input/farm_layout/from_random.py +49 -0
- foxes/input/states/__init__.py +1 -1
- foxes/input/states/create/__init__.py +1 -0
- foxes/input/states/create/random_abl_states.py +6 -2
- foxes/input/states/create/random_timeseries.py +56 -0
- foxes/input/states/field_data_nc.py +12 -8
- foxes/input/states/multi_height.py +24 -14
- foxes/input/states/scan_ws.py +13 -17
- foxes/input/states/single.py +28 -20
- foxes/input/states/states_table.py +22 -18
- foxes/models/axial_induction_models/betz.py +1 -1
- foxes/models/farm_models/turbine2farm.py +2 -2
- foxes/models/model_book.py +40 -14
- foxes/models/partial_wakes/__init__.py +2 -2
- foxes/models/partial_wakes/axiwake.py +73 -200
- foxes/models/partial_wakes/centre.py +40 -0
- foxes/models/partial_wakes/grid.py +7 -63
- foxes/models/partial_wakes/rotor_points.py +53 -147
- foxes/models/partial_wakes/segregated.py +158 -0
- foxes/models/partial_wakes/top_hat.py +88 -196
- foxes/models/point_models/set_uniform_data.py +4 -4
- foxes/models/point_models/tke2ti.py +4 -4
- foxes/models/point_models/wake_deltas.py +4 -4
- foxes/models/rotor_models/centre.py +15 -19
- foxes/models/rotor_models/grid.py +2 -1
- foxes/models/rotor_models/levels.py +2 -1
- foxes/models/turbine_models/__init__.py +0 -1
- foxes/models/turbine_models/calculator.py +11 -7
- foxes/models/turbine_models/kTI_model.py +13 -11
- foxes/models/turbine_models/lookup_table.py +22 -9
- foxes/models/turbine_models/power_mask.py +81 -51
- foxes/models/turbine_models/rotor_centre_calc.py +17 -20
- foxes/models/turbine_models/sector_management.py +5 -6
- foxes/models/turbine_models/set_farm_vars.py +49 -20
- foxes/models/turbine_models/table_factors.py +5 -5
- foxes/models/turbine_models/thrust2ct.py +9 -5
- foxes/models/turbine_models/yaw2yawm.py +7 -13
- foxes/models/turbine_models/yawm2yaw.py +7 -11
- foxes/models/turbine_types/PCt_file.py +84 -3
- foxes/models/turbine_types/PCt_from_two.py +7 -3
- foxes/models/turbine_types/null_type.py +2 -2
- foxes/models/turbine_types/wsrho2PCt_from_two.py +2 -2
- foxes/models/turbine_types/wsti2PCt_from_two.py +6 -2
- foxes/models/wake_frames/farm_order.py +26 -22
- foxes/models/wake_frames/rotor_wd.py +32 -31
- foxes/models/wake_frames/seq_dynamic_wakes.py +112 -64
- foxes/models/wake_frames/streamlines.py +51 -47
- foxes/models/wake_frames/timelines.py +59 -47
- foxes/models/wake_frames/yawed_wakes.py +63 -40
- foxes/models/wake_models/axisymmetric.py +31 -35
- foxes/models/wake_models/dist_sliced.py +50 -56
- foxes/models/wake_models/gaussian.py +33 -35
- foxes/models/wake_models/induction/rankine_half_body.py +79 -87
- foxes/models/wake_models/induction/rathmann.py +56 -63
- foxes/models/wake_models/induction/self_similar.py +59 -62
- foxes/models/wake_models/ti/crespo_hernandez.py +83 -74
- foxes/models/wake_models/ti/iec_ti.py +65 -75
- foxes/models/wake_models/top_hat.py +60 -69
- foxes/models/wake_models/wake_mirror.py +49 -54
- foxes/models/wake_models/wind/bastankhah14.py +44 -66
- foxes/models/wake_models/wind/bastankhah16.py +84 -111
- foxes/models/wake_models/wind/jensen.py +67 -89
- foxes/models/wake_models/wind/turbopark.py +93 -133
- foxes/models/wake_superpositions/ti_linear.py +33 -27
- foxes/models/wake_superpositions/ti_max.py +33 -27
- foxes/models/wake_superpositions/ti_pow.py +35 -27
- foxes/models/wake_superpositions/ti_quadratic.py +33 -27
- foxes/models/wake_superpositions/ws_linear.py +39 -32
- foxes/models/wake_superpositions/ws_max.py +40 -33
- foxes/models/wake_superpositions/ws_pow.py +39 -32
- foxes/models/wake_superpositions/ws_product.py +35 -28
- foxes/models/wake_superpositions/ws_quadratic.py +39 -32
- foxes/opt/constraints/min_dist.py +1 -1
- foxes/opt/objectives/farm_vars.py +1 -1
- foxes/opt/problems/layout/farm_layout.py +38 -97
- foxes/output/__init__.py +1 -0
- foxes/output/farm_results_eval.py +1 -1
- foxes/output/flow_plots_2d/flow_plots.py +2 -0
- foxes/output/flow_plots_2d/get_fig.py +2 -0
- foxes/output/grids.py +1 -1
- foxes/output/rose_plot.py +3 -3
- foxes/output/rotor_point_plots.py +117 -0
- foxes/output/turbine_type_curves.py +2 -2
- foxes/utils/__init__.py +2 -1
- foxes/utils/load.py +29 -0
- foxes/utils/random_xy.py +56 -0
- foxes/utils/runners/runners.py +13 -1
- foxes/utils/windrose_plot.py +1 -1
- foxes/variables.py +10 -0
- {foxes-0.6.1.dist-info → foxes-0.7.dist-info}/METADATA +13 -7
- {foxes-0.6.1.dist-info → foxes-0.7.dist-info}/RECORD +126 -122
- {foxes-0.6.1.dist-info → foxes-0.7.dist-info}/WHEEL +1 -1
- foxes/models/partial_wakes/distsliced.py +0 -322
- foxes/models/partial_wakes/mapped.py +0 -252
- foxes/models/turbine_models/set_XYHD.py +0 -130
- {foxes-0.6.1.dist-info → foxes-0.7.dist-info}/LICENSE +0 -0
- {foxes-0.6.1.dist-info → foxes-0.7.dist-info}/top_level.txt +0 -0
- {foxes-0.6.1.dist-info → foxes-0.7.dist-info}/zip-safe +0 -0
|
@@ -34,7 +34,7 @@ class Bastankhah2016Model(Model):
|
|
|
34
34
|
MDATA_KEY = "Bastankhah2016Model"
|
|
35
35
|
PARS = "pars"
|
|
36
36
|
CHECK = "check"
|
|
37
|
-
|
|
37
|
+
ST_SEL = "st_sel"
|
|
38
38
|
X0 = "x0"
|
|
39
39
|
|
|
40
40
|
NEAR = "near"
|
|
@@ -117,8 +117,8 @@ class Bastankhah2016Model(Model):
|
|
|
117
117
|
algo,
|
|
118
118
|
mdata,
|
|
119
119
|
fdata,
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
tdata,
|
|
121
|
+
downwind_index,
|
|
122
122
|
x,
|
|
123
123
|
gamma,
|
|
124
124
|
k,
|
|
@@ -130,21 +130,20 @@ class Bastankhah2016Model(Model):
|
|
|
130
130
|
----------
|
|
131
131
|
algo: foxes.core.Algorithm
|
|
132
132
|
The calculation algorithm
|
|
133
|
-
mdata: foxes.core.
|
|
133
|
+
mdata: foxes.core.MData
|
|
134
134
|
The model data
|
|
135
|
-
fdata: foxes.core.
|
|
135
|
+
fdata: foxes.core.FData
|
|
136
136
|
The farm data
|
|
137
|
-
|
|
138
|
-
The
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
wake causing turbine. Shape: (n_states,)
|
|
137
|
+
tdata: foxes.core.TData
|
|
138
|
+
The target point data
|
|
139
|
+
downwind_index: int
|
|
140
|
+
The index in the downwind order
|
|
142
141
|
x: numpy.ndarray
|
|
143
|
-
The x values, shape: (n_states,
|
|
142
|
+
The x values, shape: (n_states, n_targets)
|
|
144
143
|
gamma: numpy.ndarray
|
|
145
|
-
The YAWM angles in radiants, shape: (n_states,
|
|
144
|
+
The YAWM angles in radiants, shape: (n_states, n_targets)
|
|
146
145
|
k: numpy.ndarray
|
|
147
|
-
The k parameter values, shape: (n_states,
|
|
146
|
+
The k parameter values, shape: (n_states, n_targets)
|
|
148
147
|
|
|
149
148
|
"""
|
|
150
149
|
|
|
@@ -152,95 +151,95 @@ class Bastankhah2016Model(Model):
|
|
|
152
151
|
out = {self.PARS: self.pars}
|
|
153
152
|
out[self.CHECK] = (
|
|
154
153
|
mdata[FC.STATE][0],
|
|
155
|
-
|
|
154
|
+
downwind_index,
|
|
156
155
|
x.shape,
|
|
157
156
|
)
|
|
158
157
|
|
|
159
158
|
# get D:
|
|
160
159
|
D = super().get_data(
|
|
161
160
|
FV.D,
|
|
162
|
-
FC.
|
|
161
|
+
target=FC.STATE_TARGET,
|
|
163
162
|
lookup="w",
|
|
164
163
|
algo=algo,
|
|
165
164
|
fdata=fdata,
|
|
166
|
-
|
|
165
|
+
tdata=tdata,
|
|
166
|
+
downwind_index=downwind_index,
|
|
167
167
|
upcast=True,
|
|
168
|
-
states_source_turbine=states_source_turbine,
|
|
169
168
|
)
|
|
170
169
|
|
|
171
170
|
# get ct:
|
|
172
171
|
ct = super().get_data(
|
|
173
172
|
FV.CT,
|
|
174
|
-
FC.
|
|
173
|
+
target=FC.STATE_TARGET,
|
|
175
174
|
lookup="w",
|
|
176
175
|
algo=algo,
|
|
177
176
|
fdata=fdata,
|
|
178
|
-
|
|
177
|
+
tdata=tdata,
|
|
178
|
+
downwind_index=downwind_index,
|
|
179
179
|
upcast=True,
|
|
180
|
-
states_source_turbine=states_source_turbine,
|
|
181
180
|
)
|
|
182
181
|
|
|
183
182
|
# select targets:
|
|
184
|
-
|
|
185
|
-
if np.any(
|
|
183
|
+
st_sel = (x > 0) & (ct > 0.0)
|
|
184
|
+
if np.any(st_sel):
|
|
186
185
|
# get ws:
|
|
187
186
|
ws = super().get_data(
|
|
188
187
|
FV.REWS,
|
|
189
|
-
FC.
|
|
188
|
+
target=FC.STATE_TARGET,
|
|
190
189
|
lookup="w",
|
|
191
190
|
algo=algo,
|
|
192
191
|
fdata=fdata,
|
|
193
|
-
|
|
192
|
+
tdata=tdata,
|
|
193
|
+
downwind_index=downwind_index,
|
|
194
194
|
upcast=True,
|
|
195
|
-
states_source_turbine=states_source_turbine,
|
|
196
195
|
)
|
|
197
196
|
|
|
198
197
|
# get TI:
|
|
199
198
|
ti = super().get_data(
|
|
200
199
|
FV.TI,
|
|
201
|
-
FC.
|
|
200
|
+
target=FC.STATE_TARGET,
|
|
202
201
|
lookup="w",
|
|
203
202
|
algo=algo,
|
|
204
203
|
fdata=fdata,
|
|
205
|
-
|
|
204
|
+
tdata=tdata,
|
|
205
|
+
downwind_index=downwind_index,
|
|
206
206
|
upcast=True,
|
|
207
|
-
states_source_turbine=states_source_turbine,
|
|
208
207
|
)
|
|
209
208
|
|
|
210
209
|
# get alpha:
|
|
211
210
|
alpha = super().get_data(
|
|
212
211
|
FV.PA_ALPHA,
|
|
213
|
-
FC.
|
|
212
|
+
target=FC.STATE_TARGET,
|
|
214
213
|
lookup="ws",
|
|
215
214
|
algo=algo,
|
|
216
215
|
fdata=fdata,
|
|
217
|
-
|
|
216
|
+
tdata=tdata,
|
|
217
|
+
downwind_index=downwind_index,
|
|
218
218
|
upcast=True,
|
|
219
|
-
states_source_turbine=states_source_turbine,
|
|
220
219
|
)
|
|
221
220
|
|
|
222
221
|
# get beta:
|
|
223
222
|
beta = super().get_data(
|
|
224
223
|
FV.PA_BETA,
|
|
225
|
-
FC.
|
|
224
|
+
target=FC.STATE_TARGET,
|
|
226
225
|
lookup="ws",
|
|
227
226
|
algo=algo,
|
|
228
227
|
fdata=fdata,
|
|
229
|
-
|
|
228
|
+
tdata=tdata,
|
|
229
|
+
downwind_index=downwind_index,
|
|
230
230
|
upcast=True,
|
|
231
|
-
states_source_turbine=states_source_turbine,
|
|
232
231
|
)
|
|
233
232
|
|
|
234
233
|
# apply filter:
|
|
235
|
-
x = x[
|
|
236
|
-
D = D[
|
|
237
|
-
ct = ct[
|
|
238
|
-
ws = ws[
|
|
239
|
-
ti = ti[
|
|
240
|
-
k = k[
|
|
241
|
-
gamma = gamma[
|
|
242
|
-
alpha = alpha[
|
|
243
|
-
beta = beta[
|
|
234
|
+
x = x[st_sel]
|
|
235
|
+
D = D[st_sel]
|
|
236
|
+
ct = ct[st_sel]
|
|
237
|
+
ws = ws[st_sel]
|
|
238
|
+
ti = ti[st_sel]
|
|
239
|
+
k = k[st_sel]
|
|
240
|
+
gamma = gamma[st_sel]
|
|
241
|
+
alpha = alpha[st_sel]
|
|
242
|
+
beta = beta[st_sel]
|
|
244
243
|
|
|
245
244
|
# calc theta_c0, Eq. (6.12):
|
|
246
245
|
cosg = np.cos(gamma)
|
|
@@ -329,10 +328,10 @@ class Bastankhah2016Model(Model):
|
|
|
329
328
|
out[self.SIGMA_Z_FAR] = sigma_z
|
|
330
329
|
|
|
331
330
|
# update mdata:
|
|
332
|
-
out[self.
|
|
331
|
+
out[self.ST_SEL] = st_sel
|
|
333
332
|
mdata[self.MDATA_KEY] = out
|
|
334
333
|
|
|
335
|
-
def has_data(self, mdata,
|
|
334
|
+
def has_data(self, mdata, downwind_index, x):
|
|
336
335
|
"""
|
|
337
336
|
Check if data exists
|
|
338
337
|
|
|
@@ -340,7 +339,7 @@ class Bastankhah2016Model(Model):
|
|
|
340
339
|
----------
|
|
341
340
|
mdata: foxes.core.Data
|
|
342
341
|
The model data
|
|
343
|
-
|
|
342
|
+
downwind_index: numpy.ndarray
|
|
344
343
|
For each state, one turbine index for the
|
|
345
344
|
wake causing turbine. Shape: (n_states,)
|
|
346
345
|
x: numpy.ndarray
|
|
@@ -354,7 +353,7 @@ class Bastankhah2016Model(Model):
|
|
|
354
353
|
"""
|
|
355
354
|
check = (
|
|
356
355
|
mdata[FC.STATE][0],
|
|
357
|
-
|
|
356
|
+
downwind_index,
|
|
358
357
|
x.shape,
|
|
359
358
|
)
|
|
360
359
|
return self.MDATA_KEY in mdata and mdata[self.MDATA_KEY][self.CHECK] == check
|
|
@@ -427,10 +426,8 @@ class Bastankhah2016(DistSlicedWakeModel):
|
|
|
427
426
|
|
|
428
427
|
Parameters
|
|
429
428
|
----------
|
|
430
|
-
superposition:
|
|
431
|
-
The
|
|
432
|
-
value: The wake superposition model name,
|
|
433
|
-
will be looked up in model book
|
|
429
|
+
superposition: str
|
|
430
|
+
The wind deficit superposition
|
|
434
431
|
k: float
|
|
435
432
|
The wake growth parameter k. If not given here
|
|
436
433
|
it will be searched in the farm data, by default None
|
|
@@ -459,8 +456,14 @@ class Bastankhah2016(DistSlicedWakeModel):
|
|
|
459
456
|
|
|
460
457
|
def __repr__(self):
|
|
461
458
|
k = getattr(self, self.k_var)
|
|
462
|
-
|
|
463
|
-
s
|
|
459
|
+
iname = self.model_pars.get("induction", "Madsen")
|
|
460
|
+
s = f"{type(self).__name__}"
|
|
461
|
+
s += f"({self.superpositions[FV.WS]}, induction={iname}"
|
|
462
|
+
if k is None:
|
|
463
|
+
s += f", k_var={self.k_var}"
|
|
464
|
+
else:
|
|
465
|
+
s += f", {self.k_var}={k}"
|
|
466
|
+
s += ")"
|
|
464
467
|
return s
|
|
465
468
|
|
|
466
469
|
def sub_models(self):
|
|
@@ -493,39 +496,13 @@ class Bastankhah2016(DistSlicedWakeModel):
|
|
|
493
496
|
self.model = Bastankhah2016Model(**self.model_pars)
|
|
494
497
|
super().initialize(algo, verbosity, force)
|
|
495
498
|
|
|
496
|
-
def
|
|
497
|
-
"""
|
|
498
|
-
Initialize wake delta storage.
|
|
499
|
-
|
|
500
|
-
They are added on the fly to the wake_deltas dict.
|
|
501
|
-
|
|
502
|
-
Parameters
|
|
503
|
-
----------
|
|
504
|
-
algo: foxes.core.Algorithm
|
|
505
|
-
The calculation algorithm
|
|
506
|
-
mdata: foxes.core.Data
|
|
507
|
-
The model data
|
|
508
|
-
fdata: foxes.core.Data
|
|
509
|
-
The farm data
|
|
510
|
-
pdata: foxes.core.Data
|
|
511
|
-
The evaluation point data
|
|
512
|
-
wake_deltas: dict
|
|
513
|
-
The wake deltas storage, add wake deltas
|
|
514
|
-
on the fly. Keys: Variable name str, for which the
|
|
515
|
-
wake delta applies, values: numpy.ndarray with
|
|
516
|
-
shape (n_states, n_points, ...)
|
|
517
|
-
|
|
518
|
-
"""
|
|
519
|
-
n_states = mdata.n_states
|
|
520
|
-
wake_deltas[FV.WS] = np.zeros((n_states, pdata.n_points), dtype=FC.DTYPE)
|
|
521
|
-
|
|
522
|
-
def calc_wakes_spsel_x_yz(
|
|
499
|
+
def calc_wakes_x_yz(
|
|
523
500
|
self,
|
|
524
501
|
algo,
|
|
525
502
|
mdata,
|
|
526
503
|
fdata,
|
|
527
|
-
|
|
528
|
-
|
|
504
|
+
tdata,
|
|
505
|
+
downwind_index,
|
|
529
506
|
x,
|
|
530
507
|
yz,
|
|
531
508
|
):
|
|
@@ -536,74 +513,70 @@ class Bastankhah2016(DistSlicedWakeModel):
|
|
|
536
513
|
----------
|
|
537
514
|
algo: foxes.core.Algorithm
|
|
538
515
|
The calculation algorithm
|
|
539
|
-
mdata: foxes.core.
|
|
516
|
+
mdata: foxes.core.MData
|
|
540
517
|
The model data
|
|
541
|
-
fdata: foxes.core.
|
|
518
|
+
fdata: foxes.core.FData
|
|
542
519
|
The farm data
|
|
543
|
-
|
|
544
|
-
The
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
wake causing turbine. Shape: (n_states,)
|
|
520
|
+
tdata: foxes.core.TData
|
|
521
|
+
The target point data
|
|
522
|
+
downwind_index: int
|
|
523
|
+
The index in the downwind order
|
|
548
524
|
x: numpy.ndarray
|
|
549
|
-
The x values, shape: (n_states,
|
|
525
|
+
The x values, shape: (n_states, n_targets)
|
|
550
526
|
yz: numpy.ndarray
|
|
551
527
|
The yz values for each x value, shape:
|
|
552
|
-
(n_states,
|
|
528
|
+
(n_states, n_targets, n_yz_per_target, 2)
|
|
553
529
|
|
|
554
530
|
Returns
|
|
555
531
|
-------
|
|
556
532
|
wdeltas: dict
|
|
557
533
|
The wake deltas. Key: variable name str,
|
|
558
|
-
value: numpy.ndarray, shape: (
|
|
559
|
-
|
|
560
|
-
The state-
|
|
561
|
-
is non-zero, shape: (n_states,
|
|
534
|
+
value: numpy.ndarray, shape: (n_st_sel, n_yz_per_target)
|
|
535
|
+
st_sel: numpy.ndarray of bool
|
|
536
|
+
The state-target selection, for which the wake
|
|
537
|
+
is non-zero, shape: (n_states, n_targets)
|
|
562
538
|
|
|
563
539
|
"""
|
|
564
|
-
|
|
565
540
|
# prepare:
|
|
566
541
|
n_y_per_z = yz.shape[2]
|
|
567
542
|
|
|
568
543
|
# calculate model data:
|
|
569
|
-
if not self.model.has_data(mdata,
|
|
544
|
+
if not self.model.has_data(mdata, downwind_index, x):
|
|
570
545
|
# get gamma:
|
|
571
546
|
gamma = self.get_data(
|
|
572
547
|
FV.YAWM,
|
|
573
|
-
FC.
|
|
548
|
+
FC.STATE_TARGET,
|
|
574
549
|
lookup="ws",
|
|
575
550
|
algo=algo,
|
|
576
551
|
fdata=fdata,
|
|
577
|
-
|
|
552
|
+
tdata=tdata,
|
|
578
553
|
upcast=True,
|
|
579
|
-
|
|
554
|
+
downwind_index=downwind_index,
|
|
580
555
|
)
|
|
581
556
|
gamma *= np.pi / 180
|
|
582
557
|
|
|
583
558
|
# get k:
|
|
584
559
|
k = self.get_data(
|
|
585
560
|
self.k_var,
|
|
586
|
-
FC.
|
|
561
|
+
FC.STATE_TARGET,
|
|
587
562
|
lookup="sw",
|
|
588
563
|
algo=algo,
|
|
589
564
|
fdata=fdata,
|
|
590
|
-
|
|
565
|
+
tdata=tdata,
|
|
591
566
|
upcast=True,
|
|
592
|
-
|
|
567
|
+
downwind_index=downwind_index,
|
|
593
568
|
)
|
|
594
569
|
|
|
595
570
|
# run calculation:
|
|
596
|
-
self.model.calc_data(
|
|
597
|
-
algo, mdata, fdata, pdata, states_source_turbine, x, gamma, k
|
|
598
|
-
)
|
|
571
|
+
self.model.calc_data(algo, mdata, fdata, tdata, downwind_index, x, gamma, k)
|
|
599
572
|
|
|
600
573
|
# select targets:
|
|
601
|
-
|
|
602
|
-
n_sp_sel = np.sum(
|
|
574
|
+
st_sel = self.model.get_data(Bastankhah2016Model.ST_SEL, mdata)
|
|
575
|
+
n_sp_sel = np.sum(st_sel)
|
|
603
576
|
wdeltas = {FV.WS: np.zeros((n_sp_sel, n_y_per_z), dtype=FC.DTYPE)}
|
|
604
|
-
if np.any(
|
|
577
|
+
if np.any(st_sel):
|
|
605
578
|
# apply filter:
|
|
606
|
-
yz = yz[
|
|
579
|
+
yz = yz[st_sel]
|
|
607
580
|
|
|
608
581
|
# collect data:
|
|
609
582
|
near = self.model.get_data(Bastankhah2016Model.NEAR, mdata)
|
|
@@ -650,4 +623,4 @@ class Bastankhah2016(DistSlicedWakeModel):
|
|
|
650
623
|
* np.exp(-0.5 * (z / sigma_z) ** 2)
|
|
651
624
|
)
|
|
652
625
|
|
|
653
|
-
return wdeltas,
|
|
626
|
+
return wdeltas, st_sel
|
|
@@ -27,10 +27,8 @@ class JensenWake(TopHatWakeModel):
|
|
|
27
27
|
|
|
28
28
|
Parameters
|
|
29
29
|
----------
|
|
30
|
-
|
|
31
|
-
The
|
|
32
|
-
value: The wake superposition model name,
|
|
33
|
-
will be looked up in model book
|
|
30
|
+
superposition: str
|
|
31
|
+
The wind deficit superposition
|
|
34
32
|
k: float, optional
|
|
35
33
|
The wake growth parameter k. If not given here
|
|
36
34
|
it will be searched in the farm data.
|
|
@@ -47,43 +45,25 @@ class JensenWake(TopHatWakeModel):
|
|
|
47
45
|
|
|
48
46
|
def __repr__(self):
|
|
49
47
|
k = getattr(self, self.k_var)
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
iname = (
|
|
49
|
+
self.induction if isinstance(self.induction, str) else self.induction.name
|
|
50
|
+
)
|
|
51
|
+
s = f"{type(self).__name__}"
|
|
52
|
+
s += f"({self.superpositions[FV.WS]}, induction={iname}"
|
|
53
|
+
if k is None:
|
|
54
|
+
s += f", k_var={self.k_var}"
|
|
55
|
+
else:
|
|
56
|
+
s += f", {self.k_var}={k}"
|
|
57
|
+
s += ")"
|
|
52
58
|
return s
|
|
53
59
|
|
|
54
|
-
def init_wake_deltas(self, algo, mdata, fdata, pdata, wake_deltas):
|
|
55
|
-
"""
|
|
56
|
-
Initialize wake delta storage.
|
|
57
|
-
|
|
58
|
-
They are added on the fly to the wake_deltas dict.
|
|
59
|
-
|
|
60
|
-
Parameters
|
|
61
|
-
----------
|
|
62
|
-
algo: foxes.core.Algorithm
|
|
63
|
-
The calculation algorithm
|
|
64
|
-
mdata: foxes.core.Data
|
|
65
|
-
The model data
|
|
66
|
-
fdata: foxes.core.Data
|
|
67
|
-
The farm data
|
|
68
|
-
pdata: foxes.core.Data
|
|
69
|
-
The evaluation point data
|
|
70
|
-
wake_deltas: dict
|
|
71
|
-
The wake deltas storage, add wake deltas
|
|
72
|
-
on the fly. Keys: Variable name str, for which the
|
|
73
|
-
wake delta applies, values: numpy.ndarray with
|
|
74
|
-
shape (n_states, n_points, ...)
|
|
75
|
-
|
|
76
|
-
"""
|
|
77
|
-
n_states = mdata.n_states
|
|
78
|
-
wake_deltas[FV.WS] = np.zeros((n_states, pdata.n_points), dtype=FC.DTYPE)
|
|
79
|
-
|
|
80
60
|
def calc_wake_radius(
|
|
81
61
|
self,
|
|
82
62
|
algo,
|
|
83
63
|
mdata,
|
|
84
64
|
fdata,
|
|
85
|
-
|
|
86
|
-
|
|
65
|
+
tdata,
|
|
66
|
+
downwind_index,
|
|
87
67
|
x,
|
|
88
68
|
ct,
|
|
89
69
|
):
|
|
@@ -94,65 +74,58 @@ class JensenWake(TopHatWakeModel):
|
|
|
94
74
|
----------
|
|
95
75
|
algo: foxes.core.Algorithm
|
|
96
76
|
The calculation algorithm
|
|
97
|
-
mdata: foxes.core.
|
|
77
|
+
mdata: foxes.core.MData
|
|
98
78
|
The model data
|
|
99
|
-
fdata: foxes.core.
|
|
79
|
+
fdata: foxes.core.FData
|
|
100
80
|
The farm data
|
|
101
|
-
|
|
102
|
-
The
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
wake causing turbine. Shape: (n_states,)
|
|
81
|
+
tdata: foxes.core.TData
|
|
82
|
+
The target point data
|
|
83
|
+
downwind_index: int
|
|
84
|
+
The index in the downwind order
|
|
106
85
|
x: numpy.ndarray
|
|
107
|
-
The x values, shape: (n_states,
|
|
108
|
-
r: numpy.ndarray
|
|
109
|
-
The radial values for each x value, shape:
|
|
110
|
-
(n_states, n_points, n_r_per_x, 2)
|
|
86
|
+
The x values, shape: (n_states, n_targets)
|
|
111
87
|
ct: numpy.ndarray
|
|
112
88
|
The ct values of the wake-causing turbines,
|
|
113
|
-
shape: (n_states,
|
|
89
|
+
shape: (n_states, n_targets)
|
|
114
90
|
|
|
115
91
|
Returns
|
|
116
92
|
-------
|
|
117
93
|
wake_r: numpy.ndarray
|
|
118
|
-
The wake radii, shape: (n_states,
|
|
94
|
+
The wake radii, shape: (n_states, n_targets)
|
|
119
95
|
|
|
120
96
|
"""
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
states_source_turbine=states_source_turbine,
|
|
131
|
-
)
|
|
132
|
-
/ 2
|
|
97
|
+
D = self.get_data(
|
|
98
|
+
FV.D,
|
|
99
|
+
FC.STATE_TARGET,
|
|
100
|
+
lookup="w",
|
|
101
|
+
algo=algo,
|
|
102
|
+
fdata=fdata,
|
|
103
|
+
tdata=tdata,
|
|
104
|
+
downwind_index=downwind_index,
|
|
105
|
+
upcast=False,
|
|
133
106
|
)
|
|
134
107
|
|
|
135
108
|
k = self.get_data(
|
|
136
109
|
self.k_var,
|
|
137
|
-
FC.
|
|
110
|
+
FC.STATE_TARGET,
|
|
138
111
|
lookup="sw",
|
|
139
112
|
algo=algo,
|
|
140
113
|
fdata=fdata,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
114
|
+
tdata=tdata,
|
|
115
|
+
downwind_index=downwind_index,
|
|
116
|
+
upcast=False,
|
|
144
117
|
)
|
|
145
118
|
|
|
146
|
-
return
|
|
119
|
+
return D / 2 + k * x
|
|
147
120
|
|
|
148
|
-
def
|
|
121
|
+
def calc_centreline(
|
|
149
122
|
self,
|
|
150
123
|
algo,
|
|
151
124
|
mdata,
|
|
152
125
|
fdata,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
126
|
+
tdata,
|
|
127
|
+
downwind_index,
|
|
128
|
+
st_sel,
|
|
156
129
|
x,
|
|
157
130
|
wake_r,
|
|
158
131
|
ct,
|
|
@@ -164,40 +137,45 @@ class JensenWake(TopHatWakeModel):
|
|
|
164
137
|
----------
|
|
165
138
|
algo: foxes.core.Algorithm
|
|
166
139
|
The calculation algorithm
|
|
167
|
-
mdata: foxes.core.
|
|
140
|
+
mdata: foxes.core.MData
|
|
168
141
|
The model data
|
|
169
|
-
fdata: foxes.core.
|
|
142
|
+
fdata: foxes.core.FData
|
|
170
143
|
The farm data
|
|
171
|
-
|
|
172
|
-
The
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
is non-zero, shape: (n_states, n_points)
|
|
144
|
+
tdata: foxes.core.TData
|
|
145
|
+
The target point data
|
|
146
|
+
downwind_index: int
|
|
147
|
+
The index in the downwind order
|
|
148
|
+
st_sel: numpy.ndarray of bool
|
|
149
|
+
The state-target selection, for which the wake
|
|
150
|
+
is non-zero, shape: (n_states, n_targets)
|
|
179
151
|
x: numpy.ndarray
|
|
180
|
-
The x values, shape: (
|
|
152
|
+
The x values, shape: (n_st_sel,)
|
|
181
153
|
wake_r: numpy.ndarray
|
|
182
|
-
The wake radii, shape: (
|
|
154
|
+
The wake radii, shape: (n_st_sel,)
|
|
183
155
|
ct: numpy.ndarray
|
|
184
156
|
The ct values of the wake-causing turbines,
|
|
185
|
-
shape: (
|
|
157
|
+
shape: (n_st_sel,)
|
|
186
158
|
|
|
187
159
|
Returns
|
|
188
160
|
-------
|
|
189
161
|
cl_del: dict
|
|
190
162
|
The centre line wake deltas. Key: variable name str,
|
|
191
|
-
varlue: numpy.ndarray, shape: (
|
|
163
|
+
varlue: numpy.ndarray, shape: (n_st_sel,)
|
|
192
164
|
|
|
193
165
|
"""
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
166
|
+
R = (
|
|
167
|
+
self.get_data(
|
|
168
|
+
FV.D,
|
|
169
|
+
FC.STATE_TARGET,
|
|
170
|
+
lookup="w",
|
|
171
|
+
algo=algo,
|
|
172
|
+
fdata=fdata,
|
|
173
|
+
tdata=tdata,
|
|
174
|
+
downwind_index=downwind_index,
|
|
175
|
+
upcast=True,
|
|
176
|
+
)[st_sel]
|
|
177
|
+
/ 2
|
|
178
|
+
)
|
|
201
179
|
|
|
202
180
|
twoa = 2 * self.induction.ct2a(ct)
|
|
203
181
|
|