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.

Files changed (129) hide show
  1. foxes/VERSION +1 -1
  2. foxes/algorithms/downwind/downwind.py +131 -65
  3. foxes/algorithms/downwind/models/__init__.py +2 -1
  4. foxes/algorithms/downwind/models/farm_wakes_calc.py +87 -55
  5. foxes/algorithms/downwind/models/init_farm_data.py +134 -0
  6. foxes/algorithms/downwind/models/point_wakes_calc.py +54 -65
  7. foxes/algorithms/downwind/models/{calc_order.py → reorder_farm_output.py} +28 -26
  8. foxes/algorithms/iterative/iterative.py +100 -51
  9. foxes/algorithms/iterative/models/convergence.py +3 -3
  10. foxes/algorithms/iterative/models/farm_wakes_calc.py +55 -48
  11. foxes/algorithms/sequential/models/seq_state.py +7 -6
  12. foxes/algorithms/sequential/sequential.py +81 -44
  13. foxes/constants.py +33 -18
  14. foxes/core/__init__.py +2 -2
  15. foxes/core/algorithm.py +31 -12
  16. foxes/core/data.py +335 -41
  17. foxes/core/data_calc_model.py +27 -23
  18. foxes/core/farm_controller.py +27 -28
  19. foxes/core/farm_data_model.py +26 -4
  20. foxes/core/model.py +186 -129
  21. foxes/core/partial_wakes_model.py +84 -81
  22. foxes/core/point_data_model.py +51 -18
  23. foxes/core/rotor_model.py +59 -77
  24. foxes/core/states.py +6 -6
  25. foxes/core/turbine_model.py +4 -4
  26. foxes/core/turbine_type.py +24 -0
  27. foxes/core/vertical_profile.py +3 -3
  28. foxes/core/wake_frame.py +91 -50
  29. foxes/core/wake_model.py +74 -43
  30. foxes/core/wake_superposition.py +29 -26
  31. foxes/input/farm_layout/__init__.py +1 -0
  32. foxes/input/farm_layout/from_random.py +49 -0
  33. foxes/input/states/__init__.py +1 -1
  34. foxes/input/states/create/__init__.py +1 -0
  35. foxes/input/states/create/random_abl_states.py +6 -2
  36. foxes/input/states/create/random_timeseries.py +56 -0
  37. foxes/input/states/field_data_nc.py +12 -8
  38. foxes/input/states/multi_height.py +24 -14
  39. foxes/input/states/scan_ws.py +13 -17
  40. foxes/input/states/single.py +28 -20
  41. foxes/input/states/states_table.py +22 -18
  42. foxes/models/axial_induction_models/betz.py +1 -1
  43. foxes/models/farm_models/turbine2farm.py +2 -2
  44. foxes/models/model_book.py +40 -14
  45. foxes/models/partial_wakes/__init__.py +2 -2
  46. foxes/models/partial_wakes/axiwake.py +73 -200
  47. foxes/models/partial_wakes/centre.py +40 -0
  48. foxes/models/partial_wakes/grid.py +7 -63
  49. foxes/models/partial_wakes/rotor_points.py +53 -147
  50. foxes/models/partial_wakes/segregated.py +158 -0
  51. foxes/models/partial_wakes/top_hat.py +88 -196
  52. foxes/models/point_models/set_uniform_data.py +4 -4
  53. foxes/models/point_models/tke2ti.py +4 -4
  54. foxes/models/point_models/wake_deltas.py +4 -4
  55. foxes/models/rotor_models/centre.py +15 -19
  56. foxes/models/rotor_models/grid.py +2 -1
  57. foxes/models/rotor_models/levels.py +2 -1
  58. foxes/models/turbine_models/__init__.py +0 -1
  59. foxes/models/turbine_models/calculator.py +11 -7
  60. foxes/models/turbine_models/kTI_model.py +13 -11
  61. foxes/models/turbine_models/lookup_table.py +22 -9
  62. foxes/models/turbine_models/power_mask.py +81 -51
  63. foxes/models/turbine_models/rotor_centre_calc.py +17 -20
  64. foxes/models/turbine_models/sector_management.py +5 -6
  65. foxes/models/turbine_models/set_farm_vars.py +49 -20
  66. foxes/models/turbine_models/table_factors.py +5 -5
  67. foxes/models/turbine_models/thrust2ct.py +9 -5
  68. foxes/models/turbine_models/yaw2yawm.py +7 -13
  69. foxes/models/turbine_models/yawm2yaw.py +7 -11
  70. foxes/models/turbine_types/PCt_file.py +84 -3
  71. foxes/models/turbine_types/PCt_from_two.py +7 -3
  72. foxes/models/turbine_types/null_type.py +2 -2
  73. foxes/models/turbine_types/wsrho2PCt_from_two.py +2 -2
  74. foxes/models/turbine_types/wsti2PCt_from_two.py +6 -2
  75. foxes/models/wake_frames/farm_order.py +26 -22
  76. foxes/models/wake_frames/rotor_wd.py +32 -31
  77. foxes/models/wake_frames/seq_dynamic_wakes.py +112 -64
  78. foxes/models/wake_frames/streamlines.py +51 -47
  79. foxes/models/wake_frames/timelines.py +59 -47
  80. foxes/models/wake_frames/yawed_wakes.py +63 -40
  81. foxes/models/wake_models/axisymmetric.py +31 -35
  82. foxes/models/wake_models/dist_sliced.py +50 -56
  83. foxes/models/wake_models/gaussian.py +33 -35
  84. foxes/models/wake_models/induction/rankine_half_body.py +79 -87
  85. foxes/models/wake_models/induction/rathmann.py +56 -63
  86. foxes/models/wake_models/induction/self_similar.py +59 -62
  87. foxes/models/wake_models/ti/crespo_hernandez.py +83 -74
  88. foxes/models/wake_models/ti/iec_ti.py +65 -75
  89. foxes/models/wake_models/top_hat.py +60 -69
  90. foxes/models/wake_models/wake_mirror.py +49 -54
  91. foxes/models/wake_models/wind/bastankhah14.py +44 -66
  92. foxes/models/wake_models/wind/bastankhah16.py +84 -111
  93. foxes/models/wake_models/wind/jensen.py +67 -89
  94. foxes/models/wake_models/wind/turbopark.py +93 -133
  95. foxes/models/wake_superpositions/ti_linear.py +33 -27
  96. foxes/models/wake_superpositions/ti_max.py +33 -27
  97. foxes/models/wake_superpositions/ti_pow.py +35 -27
  98. foxes/models/wake_superpositions/ti_quadratic.py +33 -27
  99. foxes/models/wake_superpositions/ws_linear.py +39 -32
  100. foxes/models/wake_superpositions/ws_max.py +40 -33
  101. foxes/models/wake_superpositions/ws_pow.py +39 -32
  102. foxes/models/wake_superpositions/ws_product.py +35 -28
  103. foxes/models/wake_superpositions/ws_quadratic.py +39 -32
  104. foxes/opt/constraints/min_dist.py +1 -1
  105. foxes/opt/objectives/farm_vars.py +1 -1
  106. foxes/opt/problems/layout/farm_layout.py +38 -97
  107. foxes/output/__init__.py +1 -0
  108. foxes/output/farm_results_eval.py +1 -1
  109. foxes/output/flow_plots_2d/flow_plots.py +2 -0
  110. foxes/output/flow_plots_2d/get_fig.py +2 -0
  111. foxes/output/grids.py +1 -1
  112. foxes/output/rose_plot.py +3 -3
  113. foxes/output/rotor_point_plots.py +117 -0
  114. foxes/output/turbine_type_curves.py +2 -2
  115. foxes/utils/__init__.py +2 -1
  116. foxes/utils/load.py +29 -0
  117. foxes/utils/random_xy.py +56 -0
  118. foxes/utils/runners/runners.py +13 -1
  119. foxes/utils/windrose_plot.py +1 -1
  120. foxes/variables.py +10 -0
  121. {foxes-0.6.1.dist-info → foxes-0.7.dist-info}/METADATA +13 -7
  122. {foxes-0.6.1.dist-info → foxes-0.7.dist-info}/RECORD +126 -122
  123. {foxes-0.6.1.dist-info → foxes-0.7.dist-info}/WHEEL +1 -1
  124. foxes/models/partial_wakes/distsliced.py +0 -322
  125. foxes/models/partial_wakes/mapped.py +0 -252
  126. foxes/models/turbine_models/set_XYHD.py +0 -130
  127. {foxes-0.6.1.dist-info → foxes-0.7.dist-info}/LICENSE +0 -0
  128. {foxes-0.6.1.dist-info → foxes-0.7.dist-info}/top_level.txt +0 -0
  129. {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
- SP_SEL = "sp_sel"
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
- pdata,
121
- states_source_turbine,
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.Data
133
+ mdata: foxes.core.MData
134
134
  The model data
135
- fdata: foxes.core.Data
135
+ fdata: foxes.core.FData
136
136
  The farm data
137
- pdata: foxes.core.Data
138
- The evaluation point data
139
- states_source_turbine: numpy.ndarray
140
- For each state, one turbine index for the
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, n_points)
142
+ The x values, shape: (n_states, n_targets)
144
143
  gamma: numpy.ndarray
145
- The YAWM angles in radiants, shape: (n_states, n_points)
144
+ The YAWM angles in radiants, shape: (n_states, n_targets)
146
145
  k: numpy.ndarray
147
- The k parameter values, shape: (n_states, n_points)
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
- states_source_turbine[0],
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.STATE_POINT,
161
+ target=FC.STATE_TARGET,
163
162
  lookup="w",
164
163
  algo=algo,
165
164
  fdata=fdata,
166
- pdata=pdata,
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.STATE_POINT,
173
+ target=FC.STATE_TARGET,
175
174
  lookup="w",
176
175
  algo=algo,
177
176
  fdata=fdata,
178
- pdata=pdata,
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
- sp_sel = (x > 1e-5) & (ct > 0.0)
185
- if np.any(sp_sel):
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.STATE_POINT,
188
+ target=FC.STATE_TARGET,
190
189
  lookup="w",
191
190
  algo=algo,
192
191
  fdata=fdata,
193
- pdata=pdata,
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.STATE_POINT,
200
+ target=FC.STATE_TARGET,
202
201
  lookup="w",
203
202
  algo=algo,
204
203
  fdata=fdata,
205
- pdata=pdata,
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.STATE_POINT,
212
+ target=FC.STATE_TARGET,
214
213
  lookup="ws",
215
214
  algo=algo,
216
215
  fdata=fdata,
217
- pdata=pdata,
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.STATE_POINT,
224
+ target=FC.STATE_TARGET,
226
225
  lookup="ws",
227
226
  algo=algo,
228
227
  fdata=fdata,
229
- pdata=pdata,
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[sp_sel]
236
- D = D[sp_sel]
237
- ct = ct[sp_sel]
238
- ws = ws[sp_sel]
239
- ti = ti[sp_sel]
240
- k = k[sp_sel]
241
- gamma = gamma[sp_sel]
242
- alpha = alpha[sp_sel]
243
- beta = beta[sp_sel]
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.SP_SEL] = sp_sel
331
+ out[self.ST_SEL] = st_sel
333
332
  mdata[self.MDATA_KEY] = out
334
333
 
335
- def has_data(self, mdata, states_source_turbine, x):
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
- states_source_turbine: numpy.ndarray
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
- states_source_turbine[0],
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: dict
431
- The superpositions. Key: variable name str,
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
- s = super().__repr__()
463
- s += f"({self.k_var}={k}, sp={self.superpositions[FV.WS]})"
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 init_wake_deltas(self, algo, mdata, fdata, pdata, wake_deltas):
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
- pdata,
528
- states_source_turbine,
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.Data
516
+ mdata: foxes.core.MData
540
517
  The model data
541
- fdata: foxes.core.Data
518
+ fdata: foxes.core.FData
542
519
  The farm data
543
- pdata: foxes.core.Data
544
- The evaluation point data
545
- states_source_turbine: numpy.ndarray
546
- For each state, one turbine index for the
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, n_points)
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, n_points, n_yz_per_x, 2)
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: (n_sp_sel, n_yz_per_x)
559
- sp_sel: numpy.ndarray of bool
560
- The state-point selection, for which the wake
561
- is non-zero, shape: (n_states, n_points)
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, states_source_turbine, x):
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.STATE_POINT,
548
+ FC.STATE_TARGET,
574
549
  lookup="ws",
575
550
  algo=algo,
576
551
  fdata=fdata,
577
- pdata=pdata,
552
+ tdata=tdata,
578
553
  upcast=True,
579
- states_source_turbine=states_source_turbine,
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.STATE_POINT,
561
+ FC.STATE_TARGET,
587
562
  lookup="sw",
588
563
  algo=algo,
589
564
  fdata=fdata,
590
- pdata=pdata,
565
+ tdata=tdata,
591
566
  upcast=True,
592
- states_source_turbine=states_source_turbine,
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
- sp_sel = self.model.get_data(Bastankhah2016Model.SP_SEL, mdata)
602
- n_sp_sel = np.sum(sp_sel)
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(sp_sel):
577
+ if np.any(st_sel):
605
578
  # apply filter:
606
- yz = yz[sp_sel]
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, sp_sel
626
+ return wdeltas, st_sel
@@ -27,10 +27,8 @@ class JensenWake(TopHatWakeModel):
27
27
 
28
28
  Parameters
29
29
  ----------
30
- superpositions: dict
31
- The superpositions. Key: variable name str,
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
- s = super().__repr__()
51
- s += f"({self.k_var}={k}, sp={self.superpositions[FV.WS]})"
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
- pdata,
86
- states_source_turbine,
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.Data
77
+ mdata: foxes.core.MData
98
78
  The model data
99
- fdata: foxes.core.Data
79
+ fdata: foxes.core.FData
100
80
  The farm data
101
- pdata: foxes.core.Data
102
- The evaluation point data
103
- states_source_turbine: numpy.ndarray
104
- For each state, one turbine index for the
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, n_points)
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, n_points)
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, n_points)
94
+ The wake radii, shape: (n_states, n_targets)
119
95
 
120
96
  """
121
-
122
- R = (
123
- self.get_data(
124
- FV.D,
125
- FC.STATE_POINT,
126
- lookup="w",
127
- algo=algo,
128
- fdata=fdata,
129
- pdata=pdata,
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.STATE_POINT,
110
+ FC.STATE_TARGET,
138
111
  lookup="sw",
139
112
  algo=algo,
140
113
  fdata=fdata,
141
- pdata=pdata,
142
- upcast=True,
143
- states_source_turbine=states_source_turbine,
114
+ tdata=tdata,
115
+ downwind_index=downwind_index,
116
+ upcast=False,
144
117
  )
145
118
 
146
- return R + k * x
119
+ return D / 2 + k * x
147
120
 
148
- def calc_centreline_wake_deltas(
121
+ def calc_centreline(
149
122
  self,
150
123
  algo,
151
124
  mdata,
152
125
  fdata,
153
- pdata,
154
- states_source_turbine,
155
- sp_sel,
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.Data
140
+ mdata: foxes.core.MData
168
141
  The model data
169
- fdata: foxes.core.Data
142
+ fdata: foxes.core.FData
170
143
  The farm data
171
- pdata: foxes.core.Data
172
- The evaluation point data
173
- states_source_turbine: numpy.ndarray
174
- For each state, one turbine index for the
175
- wake causing turbine. Shape: (n_states,)
176
- sp_sel: numpy.ndarray of bool
177
- The state-point selection, for which the wake
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: (n_sp_sel,)
152
+ The x values, shape: (n_st_sel,)
181
153
  wake_r: numpy.ndarray
182
- The wake radii, shape: (n_sp_sel,)
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: (n_sp_sel,)
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: (n_sp_sel,)
163
+ varlue: numpy.ndarray, shape: (n_st_sel,)
192
164
 
193
165
  """
194
- n_states = mdata.n_states
195
- n_points = sp_sel.shape[1]
196
- st_sel = (np.arange(n_states), states_source_turbine)
197
-
198
- R = np.zeros((n_states, n_points), dtype=FC.DTYPE)
199
- R[:] = fdata[FV.D][st_sel][:, None] / 2
200
- R = R[sp_sel]
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