foxes 0.7.0.6__py3-none-any.whl → 0.7.2__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.

@@ -1,6 +1,7 @@
1
+ from math import sqrt
1
2
  import foxes.models as fm
2
3
  import foxes.variables as FV
3
- from foxes.utils import Dict
4
+ from foxes.utils import FDict
4
5
 
5
6
  from foxes.core import (
6
7
  PointDataModel,
@@ -24,42 +25,42 @@ class ModelBook:
24
25
 
25
26
  Attributes
26
27
  ----------
27
- point_models: foxes.utils.Dict
28
+ point_models: foxes.utils.FDict
28
29
  The point models. Keys: model name str,
29
30
  values: foxes.core.PointDataModel
30
- rotor_models: foxes.utils.Dict
31
+ rotor_models: foxes.utils.FDict
31
32
  The rotor models. Keys: model name str,
32
33
  values: foxes.core.RotorModel
33
- turbine_types: foxes.utils.Dict
34
+ turbine_types: foxes.utils.FDict
34
35
  The turbine type models. Keys: model name str,
35
36
  values: foxes.core.TurbineType
36
- turbine_models: foxes.utils.Dict
37
+ turbine_models: foxes.utils.FDict
37
38
  The turbine models. Keys: model name str,
38
39
  values: foxes.core.TurbineModel
39
- farm_models: foxes.utils.Dict
40
+ farm_models: foxes.utils.FDict
40
41
  The farm models. Keys: model name str,
41
42
  values: foxes.core.FarmModel
42
- farm_controllers: foxes.utils.Dict
43
+ farm_controllers: foxes.utils.FDict
43
44
  The farm controllers. Keys: model name str,
44
45
  values: foxes.core.FarmController
45
- partial_wakes: foxes.utils.Dict
46
+ partial_wakes: foxes.utils.FDict
46
47
  The partial wakes. Keys: model name str,
47
48
  values: foxes.core.PartialWakeModel
48
- wake_frames: foxes.utils.Dict
49
+ wake_frames: foxes.utils.FDict
49
50
  The wake frames. Keys: model name str,
50
51
  values: foxes.core.WakeFrame
51
- wake_superpositions: foxes.utils.Dict
52
+ wake_superpositions: foxes.utils.FDict
52
53
  The wake superposition models. Keys: model name str,
53
54
  values: foxes.core.WakeSuperposition
54
- wake_models: foxes.utils.Dict
55
+ wake_models: foxes.utils.FDict
55
56
  The wake models. Keys: model name str,
56
57
  values: foxes.core.WakeModel
57
- induction_models: foxes.utils.Dict
58
+ induction_models: foxes.utils.FDict
58
59
  The induction models. Keys: model name str,
59
60
  values: foxes.core.AxialInductionModel
60
- sources: foxes.utils.Dict
61
+ sources: foxes.utils.FDict
61
62
  All sources dict
62
- base_classes: foxes.utils.Dict
63
+ base_classes: foxes.utils.FDict
63
64
  The base classes for all model types
64
65
 
65
66
  :group: models
@@ -76,22 +77,54 @@ class ModelBook:
76
77
  Path to power/ct curve file, for creation
77
78
  of default turbine type model
78
79
  """
79
- self.point_models = Dict(name="point_models")
80
+ self.point_models = FDict(name="point_models")
80
81
  self.point_models["tke2ti"] = fm.point_models.TKE2TI()
81
82
 
82
- self.rotor_models = Dict(name="rotor_models")
83
+ self.rotor_models = FDict(name="rotor_models")
83
84
  rvars = [FV.REWS, FV.REWS2, FV.REWS3, FV.TI, FV.RHO]
84
85
  self.rotor_models["centre"] = fm.rotor_models.CentreRotor(calc_vars=rvars)
85
- nlist = list(range(2, 11)) + [20]
86
- for n in nlist:
87
- self.rotor_models[f"grid{n**2}"] = fm.rotor_models.GridRotor(
88
- calc_vars=rvars, n=n, reduce=True
89
- )
90
- self.rotor_models[f"level{n}"] = fm.rotor_models.LevelRotor(
91
- calc_vars=rvars, n=n, reduce=True
92
- )
93
86
 
94
- self.turbine_types = Dict(name="turbine_types")
87
+ def _n2n(n2):
88
+ n2 = float(n2)
89
+ n = int(sqrt(n2))
90
+ if n**2 != n2:
91
+ raise Exception(
92
+ f"GridRotor factory: Value {n2} is not the square of an integer"
93
+ )
94
+ return n
95
+
96
+ self.rotor_models.add_factory(
97
+ fm.rotor_models.GridRotor,
98
+ "grid<n2>",
99
+ kwargs=dict(calc_vars=rvars, reduce=True),
100
+ var2arg={"n2": "n"},
101
+ n2=_n2n,
102
+ hints={"n2": "(Number of points in square grid)"},
103
+ )
104
+ self.rotor_models.add_factory(
105
+ fm.rotor_models.GridRotor,
106
+ "grid<n2>_raw",
107
+ kwargs=dict(calc_vars=rvars, reduce=False),
108
+ var2arg={"n2": "n"},
109
+ n2=_n2n,
110
+ hints={"n2": "(Number of points in square grid)"},
111
+ )
112
+ self.rotor_models.add_factory(
113
+ fm.rotor_models.LevelRotor,
114
+ "level<n>",
115
+ kwargs=dict(calc_vars=rvars, reduce=True),
116
+ n=lambda x: int(x),
117
+ hints={"n": "(Number of vertical levels)"},
118
+ )
119
+ self.rotor_models.add_factory(
120
+ fm.rotor_models.LevelRotor,
121
+ "level<n>_raw",
122
+ kwargs=dict(calc_vars=rvars, reduce=False),
123
+ n=lambda x: int(x),
124
+ hints={"n": "(Number of vertical levels)"},
125
+ )
126
+
127
+ self.turbine_types = FDict(name="turbine_types")
95
128
  self.turbine_types["null_type"] = fm.turbine_types.NullType()
96
129
  self.turbine_types["NREL5MW"] = fm.turbine_types.PCtFile(
97
130
  "NREL-5MW-D126-H90.csv", rho=1.225
@@ -108,21 +141,50 @@ class ModelBook:
108
141
  if Pct_file is not None:
109
142
  self.turbine_types["Pct"] = fm.turbine_types.PCtFile(Pct_file)
110
143
 
111
- self.turbine_models = Dict(
144
+ self.turbine_models = FDict(
112
145
  name="turbine_models",
113
146
  kTI=fm.turbine_models.kTI(),
114
- kTI_02=fm.turbine_models.kTI(kTI=0.2),
115
- kTI_04=fm.turbine_models.kTI(kTI=0.4),
116
- kTI_05=fm.turbine_models.kTI(kTI=0.5),
117
147
  kTI_amb=fm.turbine_models.kTI(ti_var=FV.AMB_TI),
118
- kTI_amb_02=fm.turbine_models.kTI(ti_var=FV.AMB_TI, kTI=0.2),
119
- kTI_amb_04=fm.turbine_models.kTI(ti_var=FV.AMB_TI, kTI=0.4),
120
- kTI_amb_05=fm.turbine_models.kTI(ti_var=FV.AMB_TI, kTI=0.5),
121
148
  thrust2ct=fm.turbine_models.Thrust2Ct(),
122
149
  PMask=fm.turbine_models.PowerMask(),
123
150
  yaw2yawm=fm.turbine_models.YAW2YAWM(),
124
151
  yawm2yaw=fm.turbine_models.YAWM2YAW(),
125
152
  )
153
+ self.turbine_models.add_factory(
154
+ fm.turbine_models.kTI,
155
+ "kTI_<kTI>",
156
+ kTI=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
157
+ hints={"kTI": "(Value, e.g. 004 for 0.04)"},
158
+ )
159
+ self.turbine_models.add_factory(
160
+ fm.turbine_models.kTI,
161
+ "kTI_amb_<kTI>",
162
+ kwargs=dict(ti_var=FV.AMB_TI),
163
+ kTI=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
164
+ hints={"kTI": "(Value, e.g. 004 for 0.04)"},
165
+ )
166
+ self.turbine_models.add_factory(
167
+ fm.turbine_models.kTI,
168
+ "kTI_<kTI>_<kb>",
169
+ kTI=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
170
+ kb=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
171
+ hints={
172
+ "kTI": "(Value, e.g. 004 for 0.04)",
173
+ "kb": "(Value, e.g. 004 for 0.04)",
174
+ },
175
+ )
176
+ self.turbine_models.add_factory(
177
+ fm.turbine_models.kTI,
178
+ "kTI_amb_<kTI>_<kb>",
179
+ kwargs=dict(ti_var=FV.AMB_TI),
180
+ kTI=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
181
+ kb=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
182
+ hints={
183
+ "kTI": "(Value, e.g. 004 for 0.04)",
184
+ "kb": "(Value, e.g. 004 for 0.04)",
185
+ },
186
+ )
187
+
126
188
  self.turbine_models["hubh_data"] = fm.turbine_models.RotorCentreCalc(
127
189
  {
128
190
  f"{FV.WD}_HH": FV.WD,
@@ -132,7 +194,7 @@ class ModelBook:
132
194
  }
133
195
  )
134
196
 
135
- self.farm_models = Dict(
197
+ self.farm_models = FDict(
136
198
  name="farm_models",
137
199
  **{
138
200
  f"farm_{mname}": fm.farm_models.Turbine2FarmModel(m)
@@ -140,65 +202,80 @@ class ModelBook:
140
202
  },
141
203
  )
142
204
 
143
- self.farm_controllers = Dict(
205
+ self.farm_controllers = FDict(
144
206
  name="farm_controllers",
145
207
  basic_ctrl=fm.farm_controllers.BasicFarmController(),
146
208
  )
147
209
 
148
- self.partial_wakes = Dict(
210
+ self.partial_wakes = FDict(
149
211
  name="partial_wakes",
150
212
  rotor_points=fm.partial_wakes.RotorPoints(),
151
213
  top_hat=fm.partial_wakes.PartialTopHat(),
152
214
  centre=fm.partial_wakes.PartialCentre(),
153
215
  )
154
- nlst = list(range(2, 11)) + [20]
155
- for n in nlst:
156
- self.partial_wakes[f"axiwake{n}"] = fm.partial_wakes.PartialAxiwake(n)
157
- for n in nlist:
158
- self.partial_wakes[f"grid{n**2}"] = fm.partial_wakes.PartialGrid(n=n)
216
+ self.partial_wakes.add_factory(
217
+ fm.partial_wakes.PartialAxiwake,
218
+ "axiwake<n>",
219
+ n=lambda x: int(x),
220
+ hints={"n": "(Number of evaluation points)"},
221
+ )
222
+ self.partial_wakes.add_factory(
223
+ fm.partial_wakes.PartialGrid,
224
+ "grid<n2>",
225
+ var2arg={"n2": "n"},
226
+ n2=_n2n,
227
+ hints={"n2": "(Number of points in square grid)"},
228
+ )
159
229
 
160
- self.wake_frames = Dict(
230
+ self.wake_frames = FDict(
161
231
  name="wake_frames",
162
232
  rotor_wd=fm.wake_frames.RotorWD(var_wd=FV.WD),
163
233
  rotor_wd_farmo=fm.wake_frames.FarmOrder(),
164
234
  yawed=fm.wake_frames.YawedWakes(),
165
- yawed_k002=fm.wake_frames.YawedWakes(k=0.02),
166
- yawed_k004=fm.wake_frames.YawedWakes(k=0.04),
167
235
  )
168
- stps = [1.0, 5.0, 10.0, 50.0, 100.0, 500.0]
169
- for s in stps:
170
- self.wake_frames[f"streamlines_{int(s)}"] = fm.wake_frames.Streamlines2D(
171
- step=s
172
- )
173
- for s in stps:
174
- self.wake_frames[f"streamlines_{int(s)}_yawed"] = fm.wake_frames.YawedWakes(
175
- base_frame=fm.wake_frames.Streamlines2D(step=s)
176
- )
177
- for s in stps:
178
- self.wake_frames[f"streamlines_{int(s)}_farmo"] = fm.wake_frames.FarmOrder(
179
- base_frame=fm.wake_frames.Streamlines2D(step=s)
180
- )
181
- dtlist = [
182
- ("1s", 1 / 60),
183
- ("10s", 1 / 6),
184
- ("30s", 0.5),
185
- ("1min", 1),
186
- ("10min", 10),
187
- ("30min", 30),
188
- ]
236
+ self.wake_frames.add_factory(
237
+ fm.wake_frames.YawedWakes,
238
+ "yawed_k<k>",
239
+ k=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
240
+ hints={"k": "(Value, e.g. 004 for 0.04)"},
241
+ )
242
+ self.wake_frames.add_factory(
243
+ fm.wake_frames.Streamlines2D,
244
+ "streamlines_<step>",
245
+ step=lambda x: float(x),
246
+ hints={"step": "(Step size in m)"},
247
+ )
248
+ self.wake_frames.add_factory(
249
+ fm.wake_frames.Streamlines2D,
250
+ "streamlines_<step>",
251
+ step=lambda x: float(x),
252
+ hints={"step": "(Step size in m)"},
253
+ )
254
+
189
255
  self.wake_frames["timelines"] = fm.wake_frames.Timelines()
190
- for s, t in dtlist:
191
- self.wake_frames[f"timelines_{s}"] = fm.wake_frames.Timelines(dt_min=t)
192
- self.wake_frames["timelines_1km"] = fm.wake_frames.Timelines(
193
- max_wake_length=1000.0
194
- )
195
- self.wake_frames["seq_dyn_wakes"] = fm.wake_frames.SeqDynamicWakes()
196
- for s, t in dtlist:
197
- self.wake_frames[f"seq_dyn_wakes_{s}"] = fm.wake_frames.SeqDynamicWakes(
198
- dt_min=t
199
- )
200
256
 
201
- self.wake_superpositions = Dict(
257
+ def _todt(x):
258
+ if x[-1] == "s":
259
+ return float(x[:-1]) / 60
260
+ elif x[-3:] == "min":
261
+ return float(x[:-3])
262
+
263
+ self.wake_frames.add_factory(
264
+ fm.wake_frames.Timelines,
265
+ "timelines_<dt>",
266
+ dt=_todt,
267
+ var2arg={"dt": "dt_min"},
268
+ hints={"dt": "(Time step, e.g '10s', '1min' etc.)"},
269
+ )
270
+ self.wake_frames.add_factory(
271
+ fm.wake_frames.SeqDynamicWakes,
272
+ "seq_dyn_wakes_<dt>",
273
+ dt=_todt,
274
+ var2arg={"dt": "dt_min"},
275
+ hints={"dt": "(Time step, e.g '10s', '1min' etc.)"},
276
+ )
277
+
278
+ self.wake_superpositions = FDict(
202
279
  name="wake_superpositions",
203
280
  ws_linear=fm.wake_superpositions.WSLinear(scale_amb=False),
204
281
  ws_linear_lim=fm.wake_superpositions.WSLinear(
@@ -208,6 +285,8 @@ class ModelBook:
208
285
  ws_linear_amb_lim=fm.wake_superpositions.WSLinear(
209
286
  scale_amb=True, lim_low=1e-4
210
287
  ),
288
+ ws_linear_loc=fm.wake_superpositions.WSLinearLocal(),
289
+ ws_linear_loc_lim=fm.wake_superpositions.WSLinearLocal(lim_low=1e-4),
211
290
  ws_quadratic=fm.wake_superpositions.WSQuadratic(scale_amb=False),
212
291
  ws_quadratic_lim=fm.wake_superpositions.WSQuadratic(
213
292
  scale_amb=False, lim_low=1e-4
@@ -216,12 +295,20 @@ class ModelBook:
216
295
  ws_quadratic_amb_lim=fm.wake_superpositions.WSQuadratic(
217
296
  scale_amb=True, lim_low=1e-4
218
297
  ),
298
+ ws_quadratic_loc=fm.wake_superpositions.WSQuadraticLocal(),
299
+ ws_quadratic_loc_lim=fm.wake_superpositions.WSQuadraticLocal(lim_low=1e-4),
219
300
  ws_cubic=fm.wake_superpositions.WSPow(pow=3, scale_amb=False),
220
301
  ws_cubic_amb=fm.wake_superpositions.WSPow(pow=3, scale_amb=True),
302
+ ws_cubic_loc=fm.wake_superpositions.WSPowLocal(pow=3),
303
+ ws_cubic_loc_lim=fm.wake_superpositions.WSPowLocal(pow=3, lim_low=1e-4),
221
304
  ws_quartic=fm.wake_superpositions.WSPow(pow=4, scale_amb=False),
222
305
  ws_quartic_amb=fm.wake_superpositions.WSPow(pow=4, scale_amb=True),
306
+ ws_quartic_loc=fm.wake_superpositions.WSPowLocal(pow=4),
307
+ ws_quartic_loc_lim=fm.wake_superpositions.WSPowLocal(pow=4, lim_low=1e-4),
223
308
  ws_max=fm.wake_superpositions.WSMax(scale_amb=False),
224
309
  ws_max_amb=fm.wake_superpositions.WSMax(scale_amb=True),
310
+ ws_max_loc=fm.wake_superpositions.WSMaxLocal(),
311
+ ws_max_loc_lim=fm.wake_superpositions.WSMaxLocal(lim_low=1e-4),
225
312
  ws_product=fm.wake_superpositions.WSProduct(),
226
313
  ws_product_lim=fm.wake_superpositions.WSProduct(lim_low=1e-4),
227
314
  ti_linear=fm.wake_superpositions.TILinear(superp_to_amb="quadratic"),
@@ -231,187 +318,231 @@ class ModelBook:
231
318
  ti_max=fm.wake_superpositions.TIMax(superp_to_amb="quadratic"),
232
319
  )
233
320
 
234
- self.axial_induction = Dict(name="induction_models")
235
- self.axial_induction["Betz"] = fm.axial_induction_models.BetzAxialInduction()
236
- self.axial_induction["Madsen"] = (
237
- fm.axial_induction_models.MadsenAxialInduction()
238
- )
239
-
240
- self.wake_models = Dict(name="wake_models")
241
- slist = [
242
- "linear",
243
- "linear_lim",
244
- "linear_amb",
245
- "linear_amb_lim",
246
- "quadratic",
247
- "quadratic_lim",
248
- "quadratic_amb",
249
- "quadratic_amb_lim",
250
- "cubic",
251
- "cubic_amb",
252
- "quartic",
253
- "quartic_amb",
254
- "wmax",
255
- "max_amb",
256
- "product",
257
- "product_lim",
258
- ]
259
- for s in slist:
260
- self.wake_models[f"Jensen_{s}"] = fm.wake_models.wind.JensenWake(
261
- superposition=f"ws_{s}"
262
- )
263
- self.wake_models[f"Jensen_{s}_k002"] = fm.wake_models.wind.JensenWake(
264
- k=0.02, superposition=f"ws_{s}"
265
- )
266
- self.wake_models[f"Jensen_{s}_k004"] = fm.wake_models.wind.JensenWake(
267
- k=0.04, superposition=f"ws_{s}"
268
- )
269
- self.wake_models[f"Jensen_{s}_k007"] = fm.wake_models.wind.JensenWake(
270
- k=0.07, superposition=f"ws_{s}"
271
- )
272
- self.wake_models[f"Jensen_{s}_k0075"] = fm.wake_models.wind.JensenWake(
273
- k=0.075, superposition=f"ws_{s}"
274
- )
321
+ self.axial_induction = FDict(name="induction_models")
322
+ self.axial_induction["Betz"] = fm.axial_induction.BetzAxialInduction()
323
+ self.axial_induction["Madsen"] = fm.axial_induction.MadsenAxialInduction()
275
324
 
276
- self.wake_models[f"Bastankhah2014_{s}"] = (
277
- fm.wake_models.wind.Bastankhah2014(
278
- superposition=f"ws_{s}", sbeta_factor=0.2
279
- )
280
- )
281
- self.wake_models[f"Bastankhah2014_{s}_k002"] = (
282
- fm.wake_models.wind.Bastankhah2014(
283
- k=0.02, sbeta_factor=0.2, superposition=f"ws_{s}"
284
- )
285
- )
286
- self.wake_models[f"Bastankhah2014_{s}_k004"] = (
287
- fm.wake_models.wind.Bastankhah2014(
288
- k=0.04, sbeta_factor=0.2, superposition=f"ws_{s}"
289
- )
290
- )
325
+ self.wake_models = FDict(name="wake_models")
291
326
 
292
- self.wake_models[f"Bastankhah2014B_{s}"] = (
293
- fm.wake_models.wind.Bastankhah2014(
294
- superposition=f"ws_{s}", sbeta_factor=0.2, induction="Betz"
295
- )
296
- )
297
- self.wake_models[f"Bastankhah2014B_{s}_k002"] = (
298
- fm.wake_models.wind.Bastankhah2014(
299
- k=0.02, sbeta_factor=0.2, superposition=f"ws_{s}", induction="Betz"
300
- )
301
- )
302
- self.wake_models[f"Bastankhah2014B_{s}_k004"] = (
303
- fm.wake_models.wind.Bastankhah2014(
304
- k=0.04, sbeta_factor=0.2, superposition=f"ws_{s}", induction="Betz"
305
- )
306
- )
327
+ self.wake_models.add_factory(
328
+ fm.wake_models.wind.JensenWake,
329
+ "Jensen_<superposition>",
330
+ superposition=lambda s: f"ws_{s}",
331
+ hints={"superposition": "(Superposition, e.g. linear for ws_linear)"},
332
+ )
333
+ self.wake_models.add_factory(
334
+ fm.wake_models.wind.JensenWake,
335
+ "Jensen_<superposition>_k<k>",
336
+ superposition=lambda s: f"ws_{s}",
337
+ k=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
338
+ hints={
339
+ "superposition": "(Superposition, e.g. linear for ws_linear)",
340
+ "k": "(Value, e.g. 004 for 0.04)",
341
+ },
342
+ )
307
343
 
308
- self.wake_models[f"Bastankhah025_{s}"] = fm.wake_models.wind.Bastankhah2014(
309
- superposition=f"ws_{s}", sbeta_factor=0.25
310
- )
311
- self.wake_models[f"Bastankhah025_{s}_k002"] = (
312
- fm.wake_models.wind.Bastankhah2014(
313
- k=0.02, superposition=f"ws_{s}", sbeta_factor=0.25
314
- )
315
- )
316
- self.wake_models[f"Bastankhah025_{s}_k004"] = (
317
- fm.wake_models.wind.Bastankhah2014(
318
- k=0.04, superposition=f"ws_{s}", sbeta_factor=0.25
319
- )
320
- )
344
+ self.wake_models.add_factory(
345
+ fm.wake_models.wind.Bastankhah2014,
346
+ "Bastankhah2014_<superposition>",
347
+ kwargs=dict(sbeta_factor=0.2),
348
+ superposition=lambda s: f"ws_{s}",
349
+ hints={"superposition": "(Superposition, e.g. linear for ws_linear)"},
350
+ )
351
+ self.wake_models.add_factory(
352
+ fm.wake_models.wind.Bastankhah2014,
353
+ "Bastankhah2014_<superposition>_k<k>",
354
+ kwargs=dict(sbeta_factor=0.2),
355
+ superposition=lambda s: f"ws_{s}",
356
+ k=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
357
+ hints={
358
+ "superposition": "(Superposition, e.g. linear for ws_linear)",
359
+ "k": "(Value, e.g. 004 for 0.04)",
360
+ },
361
+ )
362
+ self.wake_models.add_factory(
363
+ fm.wake_models.wind.Bastankhah2014,
364
+ "Bastankhah2014B_<superposition>",
365
+ kwargs=dict(sbeta_factor=0.2, induction="Betz"),
366
+ superposition=lambda s: f"ws_{s}",
367
+ hints={"superposition": "(Superposition, e.g. linear for ws_linear)"},
368
+ )
369
+ self.wake_models.add_factory(
370
+ fm.wake_models.wind.Bastankhah2014,
371
+ "Bastankhah2014B_<superposition>_k<k>",
372
+ kwargs=dict(sbeta_factor=0.2, induction="Betz"),
373
+ superposition=lambda s: f"ws_{s}",
374
+ k=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
375
+ hints={
376
+ "superposition": "(Superposition, e.g. linear for ws_linear)",
377
+ "k": "(Value, e.g. 004 for 0.04)",
378
+ },
379
+ )
380
+ self.wake_models.add_factory(
381
+ fm.wake_models.wind.Bastankhah2014,
382
+ "Bastankhah025_<superposition>",
383
+ kwargs=dict(sbeta_factor=0.25),
384
+ superposition=lambda s: f"ws_{s}",
385
+ hints={"superposition": "(Superposition, e.g. linear for ws_linear)"},
386
+ )
387
+ self.wake_models.add_factory(
388
+ fm.wake_models.wind.Bastankhah2014,
389
+ "Bastankhah025_<superposition>_k<k>",
390
+ kwargs=dict(sbeta_factor=0.25),
391
+ superposition=lambda s: f"ws_{s}",
392
+ k=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
393
+ hints={
394
+ "superposition": "(Superposition, e.g. linear for ws_linear)",
395
+ "k": "(Value, e.g. 004 for 0.04)",
396
+ },
397
+ )
398
+ self.wake_models.add_factory(
399
+ fm.wake_models.wind.Bastankhah2014,
400
+ "Bastankhah025B_<superposition>",
401
+ kwargs=dict(sbeta_factor=0.25, induction="Betz"),
402
+ superposition=lambda s: f"ws_{s}",
403
+ hints={"superposition": "(Superposition, e.g. linear for ws_linear)"},
404
+ )
405
+ self.wake_models.add_factory(
406
+ fm.wake_models.wind.Bastankhah2014,
407
+ "Bastankhah025B_<superposition>_k<k>",
408
+ kwargs=dict(sbeta_factor=0.25, induction="Betz"),
409
+ superposition=lambda s: f"ws_{s}",
410
+ k=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
411
+ hints={
412
+ "superposition": "(Superposition, e.g. linear for ws_linear)",
413
+ "k": "(Value, e.g. 004 for 0.04)",
414
+ },
415
+ )
321
416
 
322
- self.wake_models[f"Bastankhah025B_{s}"] = (
323
- fm.wake_models.wind.Bastankhah2014(
324
- superposition=f"ws_{s}", sbeta_factor=0.25, induction="Betz"
325
- )
326
- )
327
- self.wake_models[f"Bastankhah025B_{s}_k002"] = (
328
- fm.wake_models.wind.Bastankhah2014(
329
- k=0.02, superposition=f"ws_{s}", sbeta_factor=0.25, induction="Betz"
330
- )
331
- )
332
- self.wake_models[f"Bastankhah025B_{s}_k004"] = (
333
- fm.wake_models.wind.Bastankhah2014(
334
- k=0.04, superposition=f"ws_{s}", sbeta_factor=0.25, induction="Betz"
335
- )
336
- )
417
+ self.wake_models.add_factory(
418
+ fm.wake_models.wind.Bastankhah2016,
419
+ "Bastankhah2016_<superposition>",
420
+ superposition=lambda s: f"ws_{s}",
421
+ hints={"superposition": "(Superposition, e.g. linear for ws_linear)"},
422
+ )
423
+ self.wake_models.add_factory(
424
+ fm.wake_models.wind.Bastankhah2016,
425
+ "Bastankhah2016_<superposition>_k<k>",
426
+ superposition=lambda s: f"ws_{s}",
427
+ k=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
428
+ hints={
429
+ "superposition": "(Superposition, e.g. linear for ws_linear)",
430
+ "k": "(Value, e.g. 004 for 0.04)",
431
+ },
432
+ )
433
+ self.wake_models.add_factory(
434
+ fm.wake_models.wind.Bastankhah2016,
435
+ "Bastankhah2016B_<superposition>",
436
+ kwargs=dict(induction="Betz"),
437
+ superposition=lambda s: f"ws_{s}",
438
+ hints={"superposition": "(Superposition, e.g. linear for ws_linear)"},
439
+ )
440
+ self.wake_models.add_factory(
441
+ fm.wake_models.wind.Bastankhah2016,
442
+ "Bastankhah2016B_<superposition>_k<k>",
443
+ kwargs=dict(induction="Betz"),
444
+ superposition=lambda s: f"ws_{s}",
445
+ k=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
446
+ hints={
447
+ "superposition": "(Superposition, e.g. linear for ws_linear)",
448
+ "k": "(Value, e.g. 004 for 0.04)",
449
+ },
450
+ )
337
451
 
338
- self.wake_models[f"Bastankhah2016_{s}"] = (
339
- fm.wake_models.wind.Bastankhah2016(superposition=f"ws_{s}")
340
- )
341
- self.wake_models[f"Bastankhah2016_{s}_k002"] = (
342
- fm.wake_models.wind.Bastankhah2016(superposition=f"ws_{s}", k=0.02)
343
- )
344
- self.wake_models[f"Bastankhah2016_{s}_k004"] = (
345
- fm.wake_models.wind.Bastankhah2016(superposition=f"ws_{s}", k=0.04)
346
- )
452
+ self.wake_models.add_factory(
453
+ fm.wake_models.wind.TurbOParkWake,
454
+ "TurbOPark_<superposition>",
455
+ superposition=lambda s: f"ws_{s}",
456
+ hints={"superposition": "(Superposition, e.g. linear for ws_linear)"},
457
+ )
458
+ self.wake_models.add_factory(
459
+ fm.wake_models.wind.TurbOParkWake,
460
+ "TurbOPark_<superposition>_k<k>",
461
+ superposition=lambda s: f"ws_{s}",
462
+ k=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
463
+ hints={
464
+ "superposition": "(Superposition, e.g. linear for ws_linear)",
465
+ "k": "(Value, e.g. 004 for 0.04)",
466
+ },
467
+ )
468
+ self.wake_models.add_factory(
469
+ fm.wake_models.wind.TurbOParkWake,
470
+ "TurbOParkB_<superposition>",
471
+ kwargs=dict(induction="Betz"),
472
+ superposition=lambda s: f"ws_{s}",
473
+ hints={"superposition": "(Superposition, e.g. linear for ws_linear)"},
474
+ )
475
+ self.wake_models.add_factory(
476
+ fm.wake_models.wind.TurbOParkWake,
477
+ "TurbOParkB_<superposition>_k<k>",
478
+ kwargs=dict(induction="Betz"),
479
+ superposition=lambda s: f"ws_{s}",
480
+ k=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
481
+ hints={
482
+ "superposition": "(Superposition, e.g. linear for ws_linear)",
483
+ "k": "(Value, e.g. 004 for 0.04)",
484
+ },
485
+ )
347
486
 
348
- self.wake_models[f"Bastankhah2016B_{s}"] = (
349
- fm.wake_models.wind.Bastankhah2016(
350
- superposition=f"ws_{s}", induction="Betz"
351
- )
352
- )
353
- self.wake_models[f"Bastankhah2016B_{s}_k002"] = (
354
- fm.wake_models.wind.Bastankhah2016(
355
- superposition=f"ws_{s}", k=0.02, induction="Betz"
356
- )
357
- )
358
- self.wake_models[f"Bastankhah2016B_{s}_k004"] = (
359
- fm.wake_models.wind.Bastankhah2016(
360
- superposition=f"ws_{s}", k=0.04, induction="Betz"
361
- )
362
- )
487
+ self.wake_models.add_factory(
488
+ fm.wake_models.wind.TurbOParkWakeIX,
489
+ "TurbOParkIX_<superposition>_dx<dx>",
490
+ superposition=lambda s: f"ws_{s}",
491
+ dx=lambda x: float(x),
492
+ hints={
493
+ "superposition": "(Superposition, e.g. linear for ws_linear)",
494
+ "dx": "(Integration step in m)",
495
+ },
496
+ )
363
497
 
364
- self.wake_models[f"TurbOPark_{s}_A002"] = fm.wake_models.wind.TurbOParkWake(
365
- A=0.02, superposition=f"ws_{s}"
366
- )
367
- self.wake_models[f"TurbOPark_{s}_A004"] = fm.wake_models.wind.TurbOParkWake(
368
- A=0.04, superposition=f"ws_{s}"
369
- )
498
+ self.wake_models.add_factory(
499
+ fm.wake_models.wind.TurbOParkWakeIX,
500
+ "TurbOParkIX_<superposition>_k<k>_dx<dx>",
501
+ superposition=lambda s: f"ws_{s}",
502
+ k=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
503
+ dx=lambda x: float(x),
504
+ hints={
505
+ "superposition": "(Superposition, e.g. linear for ws_linear)",
506
+ "k": "(Value, e.g. 004 for 0.04)",
507
+ "dx": "(Integration step in m)",
508
+ },
509
+ )
370
510
 
371
- self.wake_models[f"TurbOParkB_{s}_A002"] = (
372
- fm.wake_models.wind.TurbOParkWake(
373
- A=0.02, superposition=f"ws_{s}", induction="Betz"
374
- )
375
- )
376
- self.wake_models[f"TurbOParkB_{s}_A004"] = (
377
- fm.wake_models.wind.TurbOParkWake(
378
- A=0.04, superposition=f"ws_{s}", induction="Betz"
379
- )
380
- )
511
+ self.wake_models.add_factory(
512
+ fm.wake_models.ti.CrespoHernandezTIWake,
513
+ "CrespoHernandez_<superposition>",
514
+ kwargs=dict(use_ambti=False),
515
+ superposition=lambda s: f"ti_{s}",
516
+ hints={"superposition": "(Superposition, e.g. linear for ti_linear)"},
517
+ )
381
518
 
382
- As = [0.02, 0.04]
383
- dxs = [0.01, 1.0, 5.0, 10.0, 50.0, 100.0]
384
- for A in As:
385
- for dx in dxs:
386
- a = str(A).replace(".", "")
387
- d = str(dx).replace(".", "") if dx < 1 else int(dx)
388
- self.wake_models[f"TurbOParkIX_{s}_A{a}_dx{d}"] = (
389
- fm.wake_models.wind.TurbOParkWakeIX(
390
- A=A, superposition=f"ws_{s}", dx=dx
391
- )
392
- )
393
-
394
- slist = ["linear", "quadratic", "cubic", "quartic", "max"]
395
- for s in slist:
396
- self.wake_models[f"CrespoHernandez_{s}"] = (
397
- fm.wake_models.ti.CrespoHernandezTIWake(superposition=f"ti_{s}")
398
- )
399
- self.wake_models[f"CrespoHernandez_ambti_{s}"] = (
400
- fm.wake_models.ti.CrespoHernandezTIWake(
401
- superposition=f"ti_{s}", use_ambti=True
402
- )
403
- )
404
- self.wake_models[f"CrespoHernandez_{s}_k002"] = (
405
- fm.wake_models.ti.CrespoHernandezTIWake(k=0.02, superposition=f"ti_{s}")
406
- )
519
+ self.wake_models.add_factory(
520
+ fm.wake_models.ti.CrespoHernandezTIWake,
521
+ "CrespoHernandez_<superposition>_k<k>",
522
+ kwargs=dict(use_ambti=False),
523
+ superposition=lambda s: f"ti_{s}",
524
+ k=lambda x: float(f"0.{x[1:]}" if x[0] == "0" else float(x)),
525
+ hints={
526
+ "superposition": "(Superposition, e.g. linear for ti_linear)",
527
+ "k": "(Value, e.g. 004 for 0.04)",
528
+ },
529
+ )
407
530
 
408
- self.wake_models[f"IECTI2005_{s}"] = fm.wake_models.ti.IECTIWake(
409
- superposition=f"ti_{s}", iec_type="2005"
410
- )
531
+ self.wake_models.add_factory(
532
+ fm.wake_models.ti.IECTIWake,
533
+ "IECTI2005_<superposition>",
534
+ kwargs=dict(iec_type="2005"),
535
+ superposition=lambda s: f"ti_{s}",
536
+ hints={"superposition": "(Superposition, e.g. linear for ti_linear)"},
537
+ )
411
538
 
412
- self.wake_models[f"IECTI2019_{s}"] = fm.wake_models.ti.IECTIWake(
413
- superposition=f"ti_{s}", iec_type="2019"
414
- )
539
+ self.wake_models.add_factory(
540
+ fm.wake_models.ti.IECTIWake,
541
+ "IECTI2019_<superposition>",
542
+ kwargs=dict(iec_type="2019"),
543
+ superposition=lambda s: f"ti_{s}",
544
+ hints={"superposition": "(Superposition, e.g. linear for ti_linear)"},
545
+ )
415
546
 
416
547
  self.wake_models[f"RHB"] = fm.wake_models.induction.RankineHalfBody()
417
548
  self.wake_models[f"Rathmann"] = fm.wake_models.induction.Rathmann()
@@ -420,7 +551,7 @@ class ModelBook:
420
551
  fm.wake_models.induction.SelfSimilar2020()
421
552
  )
422
553
 
423
- self.sources = Dict(
554
+ self.sources = FDict(
424
555
  name="sources",
425
556
  point_models=self.point_models,
426
557
  rotor_models=self.rotor_models,
@@ -434,7 +565,7 @@ class ModelBook:
434
565
  wake_models=self.wake_models,
435
566
  axial_induction=self.axial_induction,
436
567
  )
437
- self.base_classes = Dict(
568
+ self.base_classes = FDict(
438
569
  name="base_classes",
439
570
  point_models=PointDataModel,
440
571
  rotor_models=RotorModel,
@@ -468,6 +599,7 @@ class ModelBook:
468
599
  String that has to be part of the model name
469
600
 
470
601
  """
602
+
471
603
  for k in sorted(list(self.sources.keys())):
472
604
  ms = self.sources[k]
473
605
  if subset is None or k in subset:
@@ -477,6 +609,11 @@ class ModelBook:
477
609
  for mname in sorted(list(ms.keys())):
478
610
  if search is None or search in mname:
479
611
  print(f"{mname}: {ms[mname]}")
612
+ if isinstance(ms, FDict):
613
+ for f in ms.factories:
614
+ if search is None or search in f.name_template:
615
+ print()
616
+ print(f)
480
617
  else:
481
618
  print("(none)")
482
619
  print()
@@ -557,7 +694,7 @@ class ModelBook:
557
694
 
558
695
  """
559
696
  for ms in self.sources.values():
560
- if isinstance(ms, Dict):
697
+ if isinstance(ms, FDict):
561
698
  for m in ms.values():
562
699
  if m.initialized:
563
700
  m.finalize(algo, verbosity)