foxes 0.7.3__py3-none-any.whl → 0.7.4__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/constants.py +1 -1
- foxes/core/wind_farm.py +1 -1
- foxes/input/windio/__init__.py +1 -0
- foxes/input/windio/get_states.py +82 -13
- foxes/input/windio/read_attributes.py +99 -82
- foxes/input/windio/read_farm.py +12 -12
- foxes/input/windio/read_fields.py +37 -27
- foxes/input/windio/read_outputs.py +125 -0
- foxes/input/windio/runner.py +72 -8
- foxes/input/windio/windio.py +24 -16
- foxes/models/wake_models/wind/bastankhah14.py +1 -1
- foxes/output/__init__.py +1 -0
- foxes/output/slice_data.py +41 -11
- foxes/output/state_turbine_table.py +78 -0
- {foxes-0.7.3.dist-info → foxes-0.7.4.dist-info}/METADATA +1 -1
- {foxes-0.7.3.dist-info → foxes-0.7.4.dist-info}/RECORD +21 -19
- {foxes-0.7.3.dist-info → foxes-0.7.4.dist-info}/WHEEL +1 -1
- {foxes-0.7.3.dist-info → foxes-0.7.4.dist-info}/LICENSE +0 -0
- {foxes-0.7.3.dist-info → foxes-0.7.4.dist-info}/top_level.txt +0 -0
- {foxes-0.7.3.dist-info → foxes-0.7.4.dist-info}/zip-safe +0 -0
foxes/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.7.
|
|
1
|
+
0.7.4
|
foxes/constants.py
CHANGED
foxes/core/wind_farm.py
CHANGED
|
@@ -48,7 +48,7 @@ class WindFarm:
|
|
|
48
48
|
self.turbines.append(turbine)
|
|
49
49
|
if verbosity > 0:
|
|
50
50
|
print(
|
|
51
|
-
f"Turbine {turbine.index}, {turbine.name}: {', '.join(turbine.models)}"
|
|
51
|
+
f"Turbine {turbine.index}, {turbine.name}: xy=({turbine.xy[0]:.2f}, {turbine.xy[1]:.2f}), {', '.join(turbine.models)}"
|
|
52
52
|
)
|
|
53
53
|
|
|
54
54
|
@property
|
foxes/input/windio/__init__.py
CHANGED
foxes/input/windio/get_states.py
CHANGED
|
@@ -1,15 +1,36 @@
|
|
|
1
|
+
import numpy as np
|
|
1
2
|
import pandas as pd
|
|
3
|
+
from xarray import Dataset
|
|
2
4
|
from numbers import Number
|
|
3
5
|
|
|
4
6
|
from foxes.core import States
|
|
5
7
|
import foxes.constants as FC
|
|
6
8
|
import foxes.variables as FV
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
def _get_profiles(coords, fields, dims, ovars, fixval, verbosity):
|
|
11
|
+
"""Read ABL profiles information
|
|
12
|
+
:group: input.windio
|
|
13
|
+
"""
|
|
14
|
+
profiles = {}
|
|
15
|
+
if FV.Z0 in fields:
|
|
16
|
+
if FV.H not in fields and verbosity > 0:
|
|
17
|
+
print(f"Ignoring '{FV.Z0}', since no reference_height found. No ABL profile activated.")
|
|
18
|
+
elif FV.MOL in fields:
|
|
19
|
+
ovars.append(FV.MOL)
|
|
20
|
+
fixval[FV.H] = fields[FV.H]
|
|
21
|
+
profiles = {FV.WS: "ABLLogWsProfile"}
|
|
22
|
+
else:
|
|
23
|
+
fixval[FV.H] = fields[FV.H]
|
|
24
|
+
profiles = {FV.WS: "ABLLogNeutralWsProfile"}
|
|
25
|
+
elif FV.H in fields and verbosity > 0:
|
|
26
|
+
print(f"Ignoring '{FV.H}', since no '{FV.Z0}' data found. No ABL profile activated.")
|
|
27
|
+
if len(profiles) and verbosity > 2:
|
|
28
|
+
print(f" Selecting ABL profile '{profiles[FV.WS]}', {FV.H} = {fields[FV.H]} m")
|
|
29
|
+
|
|
30
|
+
return profiles
|
|
31
|
+
|
|
32
|
+
def _get_SingleStateStates(coords, fields, dims, states_dict,
|
|
33
|
+
ovars, fixval, profiles, verbosity):
|
|
13
34
|
"""Try to generate single state parameters
|
|
14
35
|
:group: input.windio
|
|
15
36
|
"""
|
|
@@ -17,7 +38,7 @@ def _get_SingleStateStates(coords, fields, dims, states_dict, verbosity):
|
|
|
17
38
|
if not isinstance(c, Number):
|
|
18
39
|
return False
|
|
19
40
|
|
|
20
|
-
if verbosity >
|
|
41
|
+
if verbosity > 2:
|
|
21
42
|
print(" selecting class 'SingleStateStates'")
|
|
22
43
|
|
|
23
44
|
smap = {FV.WS: "ws", FV.WD: "wd", FV.TI: "ti", FV.RHO: "rho"}
|
|
@@ -39,18 +60,19 @@ def _get_SingleStateStates(coords, fields, dims, states_dict, verbosity):
|
|
|
39
60
|
states_dict.update(
|
|
40
61
|
dict(
|
|
41
62
|
states_type="SingleStateStates",
|
|
63
|
+
profiles=profiles,
|
|
42
64
|
**data,
|
|
43
65
|
)
|
|
44
66
|
)
|
|
45
67
|
return True
|
|
46
68
|
|
|
47
|
-
|
|
48
|
-
|
|
69
|
+
def _get_Timeseries(coords, fields, dims, states_dict,
|
|
70
|
+
ovars, fixval, profiles, verbosity):
|
|
49
71
|
"""Try to generate time series parameters
|
|
50
72
|
:group: input.windio
|
|
51
73
|
"""
|
|
52
74
|
if len(coords) == 1 and FC.TIME in coords:
|
|
53
|
-
if verbosity >
|
|
75
|
+
if verbosity > 2:
|
|
54
76
|
print(" selecting class 'Timeseries'")
|
|
55
77
|
|
|
56
78
|
data = {}
|
|
@@ -60,7 +82,7 @@ def _get_Timeseries(coords, fields, dims, states_dict, verbosity):
|
|
|
60
82
|
data[v] = d
|
|
61
83
|
elif len(dims[v]) == 0:
|
|
62
84
|
fix[v] = d
|
|
63
|
-
elif verbosity >
|
|
85
|
+
elif verbosity > 2:
|
|
64
86
|
print(f" ignoring field '{v}' with dims {dims[v]}")
|
|
65
87
|
fix.update({v: d for v, d in fixval.items() if v not in data})
|
|
66
88
|
|
|
@@ -72,11 +94,50 @@ def _get_Timeseries(coords, fields, dims, states_dict, verbosity):
|
|
|
72
94
|
data_source=sdata,
|
|
73
95
|
output_vars=ovars,
|
|
74
96
|
fixed_vars=fix,
|
|
97
|
+
profiles=profiles,
|
|
75
98
|
)
|
|
76
99
|
)
|
|
77
100
|
return True
|
|
78
101
|
return False
|
|
79
102
|
|
|
103
|
+
def _get_MultiHeightNCTimeseries(coords, fields, dims, states_dict,
|
|
104
|
+
ovars, fixval, profiles, verbosity):
|
|
105
|
+
"""Try to generate time series parameters
|
|
106
|
+
:group: input.windio
|
|
107
|
+
"""
|
|
108
|
+
if len(coords) == 2 and FC.TIME in coords and FV.H in coords:
|
|
109
|
+
if verbosity > 2:
|
|
110
|
+
print(" selecting class 'MultiHeightNCTimeseries'")
|
|
111
|
+
|
|
112
|
+
if len(profiles) and verbosity > 0:
|
|
113
|
+
print(f"Ignoring profile '{profiles[FV.WS]}' for states class 'MultiHeightNCTimeseries'")
|
|
114
|
+
|
|
115
|
+
data = {}
|
|
116
|
+
fix = {}
|
|
117
|
+
for v, d in fields.items():
|
|
118
|
+
if dims[v] == (FC.TIME, FV.H):
|
|
119
|
+
data[v] = ((FC.TIME, FV.H), d)
|
|
120
|
+
if dims[v] == (FV.H, FC.TIME):
|
|
121
|
+
data[v] = ((FC.TIME, FV.H), np.swapaxes(d, 0, 1))
|
|
122
|
+
elif len(dims[v]) == 0:
|
|
123
|
+
fix[v] = d
|
|
124
|
+
elif verbosity > 2:
|
|
125
|
+
print(f" ignoring field '{v}' with dims {dims[v]}")
|
|
126
|
+
fix.update({v: d for v, d in fixval.items() if v not in data})
|
|
127
|
+
|
|
128
|
+
sdata = Dataset(coords=coords, data_vars=data)
|
|
129
|
+
states_dict.update(
|
|
130
|
+
dict(
|
|
131
|
+
states_type="MultiHeightNCTimeseries",
|
|
132
|
+
h_coord=FV.H,
|
|
133
|
+
format_times_func=None,
|
|
134
|
+
data_source=sdata,
|
|
135
|
+
output_vars=ovars,
|
|
136
|
+
fixed_vars=fix,
|
|
137
|
+
)
|
|
138
|
+
)
|
|
139
|
+
return True
|
|
140
|
+
return False
|
|
80
141
|
|
|
81
142
|
def get_states(coords, fields, dims, verbosity=1):
|
|
82
143
|
"""
|
|
@@ -101,13 +162,21 @@ def get_states(coords, fields, dims, verbosity=1):
|
|
|
101
162
|
:group: input.windio
|
|
102
163
|
|
|
103
164
|
"""
|
|
104
|
-
if verbosity >
|
|
165
|
+
if verbosity > 2:
|
|
105
166
|
print(" Preparing states")
|
|
167
|
+
|
|
168
|
+
ovars = [FV.WS, FV.WD, FV.TI, FV.RHO]
|
|
169
|
+
fixval = {FV.TI: 0.05, FV.RHO: 1.225}
|
|
170
|
+
profiles = _get_profiles(coords, fields, dims, ovars, fixval, verbosity)
|
|
106
171
|
|
|
107
172
|
states_dict = {}
|
|
108
173
|
if _get_SingleStateStates(
|
|
109
|
-
coords, fields, dims, states_dict, verbosity
|
|
110
|
-
) or _get_Timeseries(
|
|
174
|
+
coords, fields, dims, states_dict, ovars, fixval, profiles, verbosity
|
|
175
|
+
) or _get_Timeseries(
|
|
176
|
+
coords, fields, dims, states_dict, ovars, fixval, profiles, verbosity
|
|
177
|
+
) or _get_MultiHeightNCTimeseries(
|
|
178
|
+
coords, fields, dims, states_dict, ovars, fixval, profiles, verbosity
|
|
179
|
+
):
|
|
111
180
|
return States.new(**states_dict)
|
|
112
181
|
else:
|
|
113
182
|
raise ValueError(
|
|
@@ -2,6 +2,8 @@ from foxes.utils import Dict
|
|
|
2
2
|
from foxes.core import WakeModel, WakeFrame
|
|
3
3
|
import foxes.variables as FV
|
|
4
4
|
|
|
5
|
+
from .read_outputs import read_outputs
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
def _read_wind_deficit(wind_deficit, superposition, induction, algo_dict, verbosity):
|
|
7
9
|
"""Reads the wind deficit wake model"""
|
|
@@ -23,11 +25,20 @@ def _read_wind_deficit(wind_deficit, superposition, induction, algo_dict, verbos
|
|
|
23
25
|
},
|
|
24
26
|
name="ws_sup_dict",
|
|
25
27
|
)
|
|
26
|
-
|
|
28
|
+
ws_sup_amb_dict = Dict(
|
|
29
|
+
{
|
|
30
|
+
"Linear": "ws_linear_amb",
|
|
31
|
+
"Quadratic": "ws_quadratic_amb",
|
|
32
|
+
},
|
|
33
|
+
name="ws_sup_dict",
|
|
34
|
+
)
|
|
35
|
+
|
|
27
36
|
wname = wind_deficit.pop("name")
|
|
28
|
-
|
|
37
|
+
eff_ws = wind_deficit.pop("use_effective_ws", True)
|
|
38
|
+
if verbosity > 2:
|
|
29
39
|
print(" Reading wind_deficit_model")
|
|
30
|
-
print(" Name:", wname)
|
|
40
|
+
print(" Name :", wname)
|
|
41
|
+
print(" Eff ws :", eff_ws)
|
|
31
42
|
print(" Contents:", [k for k in wind_deficit.keys()])
|
|
32
43
|
wind_def_dict = Dict(wmodel_type=wind_def_map[wname], induction=induction)
|
|
33
44
|
kcoef = Dict(wind_deficit["wake_expansion_coefficient"], name="kcoef")
|
|
@@ -36,11 +47,11 @@ def _read_wind_deficit(wind_deficit, superposition, induction, algo_dict, verbos
|
|
|
36
47
|
amb_ti = kcoef.get("free_stream_ti", False)
|
|
37
48
|
if ka is None or ka == 0.0:
|
|
38
49
|
wind_def_dict["k"] = kb
|
|
39
|
-
if verbosity >
|
|
50
|
+
if verbosity > 2:
|
|
40
51
|
print(" Using k =", kb)
|
|
41
52
|
else:
|
|
42
53
|
ti_var = FV.AMB_TI if amb_ti else FV.TI
|
|
43
|
-
if verbosity >
|
|
54
|
+
if verbosity > 2:
|
|
44
55
|
print(f" Using k = {ka} * {ti_var} + {kb}")
|
|
45
56
|
wind_def_dict["k"] = None
|
|
46
57
|
wind_def_dict["ka"] = ka
|
|
@@ -48,20 +59,20 @@ def _read_wind_deficit(wind_deficit, superposition, induction, algo_dict, verbos
|
|
|
48
59
|
wind_def_dict["ti_var"] = ti_var
|
|
49
60
|
if "ceps" in wind_deficit:
|
|
50
61
|
sbf = wind_deficit["ceps"]
|
|
51
|
-
if verbosity >
|
|
62
|
+
if verbosity > 2:
|
|
52
63
|
print(f" Using sbeta_factor = {sbf}")
|
|
53
64
|
wind_def_dict["sbeta_factor"] = sbf
|
|
54
|
-
|
|
65
|
+
supd = ws_sup_dict if eff_ws else ws_sup_amb_dict
|
|
66
|
+
wind_def_dict["superposition"] = supd[superposition["ws_superposition"]]
|
|
55
67
|
|
|
56
68
|
algo_dict["mbook"].wake_models[wname] = WakeModel.new(**wind_def_dict)
|
|
57
|
-
if verbosity >
|
|
69
|
+
if verbosity > 2:
|
|
58
70
|
print(f" Created wake model '{wname}':")
|
|
59
71
|
print(" ", algo_dict["mbook"].wake_models[wname])
|
|
60
72
|
algo_dict["wake_models"].append(wname)
|
|
61
73
|
|
|
62
74
|
return ka, kb, amb_ti
|
|
63
75
|
|
|
64
|
-
|
|
65
76
|
def _read_turbulence(
|
|
66
77
|
turbulence_model, superposition, induction, algo_dict, ka, kb, amb_ti, verbosity
|
|
67
78
|
):
|
|
@@ -70,7 +81,7 @@ def _read_turbulence(
|
|
|
70
81
|
twake_def_map = Dict(
|
|
71
82
|
{
|
|
72
83
|
"CrespoHernandez": "CrespoHernandezTIWake",
|
|
73
|
-
"IEC-TI-2019": "
|
|
84
|
+
"IEC-TI-2019": "IECTIWake",
|
|
74
85
|
},
|
|
75
86
|
name="twake_def_map",
|
|
76
87
|
)
|
|
@@ -84,38 +95,41 @@ def _read_turbulence(
|
|
|
84
95
|
)
|
|
85
96
|
|
|
86
97
|
wname = turbulence_model.pop("name")
|
|
87
|
-
if verbosity >
|
|
98
|
+
if verbosity > 2:
|
|
88
99
|
print(" Reading turbulence_model")
|
|
89
100
|
print(" Name:", wname)
|
|
90
101
|
print(" Contents:", [k for k in turbulence_model.keys()])
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
102
|
+
if wname != "None":
|
|
103
|
+
tiwake_dict = dict(wmodel_type=twake_def_map[wname], induction=induction)
|
|
104
|
+
if wname == "IEC-TI-2019":
|
|
105
|
+
tiwake_dict["opening_angle"] = None
|
|
106
|
+
tiwake_dict["iec_type"] = "2019"
|
|
107
|
+
if "wake_expansion_coefficient" in turbulence_model:
|
|
108
|
+
kcoef = Dict(turbulence_model["wake_expansion_coefficient"], name="kcoef")
|
|
109
|
+
ka = kcoef["k_a"]
|
|
110
|
+
kb = kcoef.get("k_b", 0.0)
|
|
111
|
+
amb_ti = kcoef.get("free_stream_ti", False)
|
|
112
|
+
if ka is None or ka == 0.0:
|
|
113
|
+
tiwake_dict["k"] = kb
|
|
114
|
+
if verbosity > 2:
|
|
115
|
+
print(" Using k =", kb)
|
|
116
|
+
else:
|
|
117
|
+
ti_var = FV.AMB_TI if amb_ti else FV.TI
|
|
118
|
+
if verbosity > 2:
|
|
119
|
+
print(f" Using k = {ka} * {ti_var} + {kb}")
|
|
120
|
+
tiwake_dict["k"] = None
|
|
121
|
+
tiwake_dict["ka"] = ka
|
|
122
|
+
tiwake_dict["kb"] = kb
|
|
123
|
+
tiwake_dict["ti_var"] = ti_var
|
|
124
|
+
tiwake_dict["superposition"] = ti_sup_dict[superposition["ti_superposition"]]
|
|
125
|
+
|
|
126
|
+
algo_dict["mbook"].wake_models[wname] = WakeModel.new(**tiwake_dict)
|
|
127
|
+
if verbosity > 2:
|
|
128
|
+
print(f" Created wake model '{wname}':")
|
|
129
|
+
print(" ", algo_dict["mbook"].wake_models[wname])
|
|
130
|
+
algo_dict["wake_models"].append(wname)
|
|
117
131
|
|
|
118
|
-
def _read_blockage(blockage_model,
|
|
132
|
+
def _read_blockage(blockage_model, induction, algo_dict, verbosity):
|
|
119
133
|
"""Reads the blockage model"""
|
|
120
134
|
indc_def_map = Dict(
|
|
121
135
|
{
|
|
@@ -128,23 +142,22 @@ def _read_blockage(blockage_model, superposition, induction, algo_dict, verbosit
|
|
|
128
142
|
)
|
|
129
143
|
|
|
130
144
|
wname = blockage_model.pop("name")
|
|
131
|
-
if verbosity >
|
|
145
|
+
if verbosity > 2:
|
|
132
146
|
print(" Reading blockage_model")
|
|
133
147
|
print(" Name:", wname)
|
|
134
148
|
print(" Contents:", [k for k in blockage_model.keys()])
|
|
135
149
|
if wname != "None":
|
|
136
150
|
indc_dict = Dict(wmodel_type=indc_def_map[wname], induction=induction)
|
|
137
151
|
algo_dict["mbook"].wake_models[wname] = WakeModel.new(**indc_dict)
|
|
138
|
-
if verbosity >
|
|
152
|
+
if verbosity > 2:
|
|
139
153
|
print(f" Created wake model '{wname}':")
|
|
140
154
|
print(" ", algo_dict["mbook"].wake_models[wname])
|
|
141
155
|
algo_dict["wake_models"].append(wname)
|
|
142
156
|
algo_dict["algo_type"] = "Iterative"
|
|
143
157
|
|
|
144
|
-
|
|
145
158
|
def _read_rotor_averaging(rotor_averaging, algo_dict, verbosity):
|
|
146
159
|
"""Reads the rotor averaging"""
|
|
147
|
-
if verbosity >
|
|
160
|
+
if verbosity > 2:
|
|
148
161
|
print(" Reading rotor_averaging")
|
|
149
162
|
print(" Contents:", [k for k in rotor_averaging.keys()])
|
|
150
163
|
grid = rotor_averaging["grid"]
|
|
@@ -158,13 +171,13 @@ def _read_rotor_averaging(rotor_averaging, algo_dict, verbosity):
|
|
|
158
171
|
wake_averaging = rotor_averaging["wake_averaging"]
|
|
159
172
|
wse_P = rotor_averaging["wind_speed_exponent_for_power"]
|
|
160
173
|
wse_ct = rotor_averaging["wind_speed_exponent_for_ct"]
|
|
161
|
-
if verbosity >
|
|
174
|
+
if verbosity > 2:
|
|
162
175
|
print(" grid :", grid)
|
|
163
176
|
print(" background_averaging:", background_averaging)
|
|
164
177
|
print(" wake_averaging :", wake_averaging)
|
|
165
178
|
print(" ws exponent power :", wse_P)
|
|
166
179
|
print(" ws exponent ct :", wse_ct)
|
|
167
|
-
if background_averaging
|
|
180
|
+
if background_averaging in ["center", "centre"]:
|
|
168
181
|
algo_dict["rotor_model"] = "centre"
|
|
169
182
|
elif background_averaging == "grid":
|
|
170
183
|
algo_dict["rotor_model"] = f"grid{nx*ny}"
|
|
@@ -172,7 +185,7 @@ def _read_rotor_averaging(rotor_averaging, algo_dict, verbosity):
|
|
|
172
185
|
raise KeyError(
|
|
173
186
|
f"Expecting background_averaging 'center' or 'grid', got '{background_averaging}'"
|
|
174
187
|
)
|
|
175
|
-
if wake_averaging
|
|
188
|
+
if wake_averaging in ["centre", "center"]:
|
|
176
189
|
algo_dict["partial_wakes"] = "centre"
|
|
177
190
|
elif wake_averaging == "grid":
|
|
178
191
|
if background_averaging == "grid":
|
|
@@ -184,11 +197,10 @@ def _read_rotor_averaging(rotor_averaging, algo_dict, verbosity):
|
|
|
184
197
|
algo_dict["partial_wakes"] = grid
|
|
185
198
|
else:
|
|
186
199
|
algo_dict["partial_wakes"] = wake_averaging
|
|
187
|
-
if verbosity >
|
|
200
|
+
if verbosity > 2:
|
|
188
201
|
print(" --> rotor_model :", algo_dict["rotor_model"])
|
|
189
202
|
print(" --> partial_wakes :", algo_dict["partial_wakes"])
|
|
190
203
|
|
|
191
|
-
|
|
192
204
|
def _read_deflection(deflection, induction, algo_dict, verbosity):
|
|
193
205
|
"""Reads deflection model"""
|
|
194
206
|
defl_def_map = Dict(
|
|
@@ -200,7 +212,7 @@ def _read_deflection(deflection, induction, algo_dict, verbosity):
|
|
|
200
212
|
)
|
|
201
213
|
|
|
202
214
|
wname = deflection.pop("name")
|
|
203
|
-
if verbosity >
|
|
215
|
+
if verbosity > 2:
|
|
204
216
|
print(" Reading deflection_model")
|
|
205
217
|
print(" Name:", wname)
|
|
206
218
|
print(" Contents:", [k for k in deflection.keys()])
|
|
@@ -211,21 +223,20 @@ def _read_deflection(deflection, induction, algo_dict, verbosity):
|
|
|
211
223
|
)
|
|
212
224
|
except TypeError:
|
|
213
225
|
algo_dict["mbook"].wake_frames[wname] = WakeFrame.new(**indc_dict)
|
|
214
|
-
if verbosity >
|
|
226
|
+
if verbosity > 2:
|
|
215
227
|
print(f" Created wake frame '{wname}':")
|
|
216
228
|
print(" ", algo_dict["mbook"].wake_frames[wname])
|
|
217
229
|
algo_dict["wake_frame"] = wname
|
|
218
230
|
|
|
219
|
-
|
|
220
231
|
def _read_analysis(wio_ana, algo_dict, verbosity):
|
|
221
232
|
"""Reads the windio analyses"""
|
|
222
|
-
if verbosity >
|
|
233
|
+
if verbosity > 2:
|
|
223
234
|
print(" Reading analysis")
|
|
224
235
|
print(" Contents:", [k for k in wio_ana.keys()])
|
|
225
236
|
|
|
226
237
|
# superposition:
|
|
227
238
|
superposition = Dict(wio_ana["superposition_model"], name="superposition_model")
|
|
228
|
-
if verbosity >
|
|
239
|
+
if verbosity > 2:
|
|
229
240
|
print(" Reading superposition_model")
|
|
230
241
|
print(" Contents:", [k for k in superposition.keys()])
|
|
231
242
|
|
|
@@ -237,8 +248,8 @@ def _read_analysis(wio_ana, algo_dict, verbosity):
|
|
|
237
248
|
},
|
|
238
249
|
name="induction mapping",
|
|
239
250
|
)
|
|
240
|
-
induction = imap[wio_ana
|
|
241
|
-
if verbosity >
|
|
251
|
+
induction = imap[wio_ana.get("axial_induction_model", "1D")]
|
|
252
|
+
if verbosity > 2:
|
|
242
253
|
print(" axial induction model:", induction)
|
|
243
254
|
|
|
244
255
|
# wind deficit model:
|
|
@@ -248,33 +259,35 @@ def _read_analysis(wio_ana, algo_dict, verbosity):
|
|
|
248
259
|
)
|
|
249
260
|
|
|
250
261
|
# turbulence model:
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
262
|
+
if "turbulence_model" in wio_ana:
|
|
263
|
+
turbulence_model = Dict(wio_ana["turbulence_model"], name="turbulence_model")
|
|
264
|
+
_read_turbulence(
|
|
265
|
+
turbulence_model, superposition, induction, algo_dict, ka, kb, amb_ti, verbosity
|
|
266
|
+
)
|
|
267
|
+
elif verbosity > 0:
|
|
268
|
+
print("turbulence_model not found, not using a TI wake model")
|
|
255
269
|
|
|
256
270
|
# blockage model:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
271
|
+
if "blockage_model" in wio_ana:
|
|
272
|
+
blockage_model = Dict(wio_ana["blockage_model"], name="blockage_model")
|
|
273
|
+
_read_blockage(blockage_model, induction, algo_dict, verbosity)
|
|
274
|
+
elif verbosity > 0:
|
|
275
|
+
print("blockage_model not found, not using a turbine induction model")
|
|
276
|
+
|
|
260
277
|
# rotor_averaging:
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
278
|
+
if "rotor_averaging" in wio_ana:
|
|
279
|
+
rotor_averaging = Dict(wio_ana["rotor_averaging"], name="rotor_averaging")
|
|
280
|
+
_read_rotor_averaging(rotor_averaging, algo_dict, verbosity)
|
|
281
|
+
elif verbosity > 0:
|
|
282
|
+
print("rotor_averaging not found, using default settings")
|
|
283
|
+
|
|
264
284
|
# deflection:
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if verbosity > 1:
|
|
272
|
-
print(" Reading outputs")
|
|
273
|
-
print(" Contents:", [k for k in wio_outs.keys()])
|
|
274
|
-
quit()
|
|
275
|
-
return []
|
|
276
|
-
|
|
277
|
-
|
|
285
|
+
if "deflection_model" in wio_ana:
|
|
286
|
+
deflection = Dict(wio_ana["deflection_model"], name="deflection_model")
|
|
287
|
+
_read_deflection(deflection, induction, algo_dict, verbosity)
|
|
288
|
+
elif verbosity > 0:
|
|
289
|
+
print("deflection_model not found, using default settings")
|
|
290
|
+
|
|
278
291
|
def read_attributes(wio, algo_dict, verbosity):
|
|
279
292
|
"""
|
|
280
293
|
Reads the attributes part of windio
|
|
@@ -297,7 +310,7 @@ def read_attributes(wio, algo_dict, verbosity):
|
|
|
297
310
|
|
|
298
311
|
"""
|
|
299
312
|
wio_attrs = Dict(wio["attributes"], name="attributes")
|
|
300
|
-
if verbosity >
|
|
313
|
+
if verbosity > 1:
|
|
301
314
|
print("Reading attributes")
|
|
302
315
|
print(" Contents:", [k for k in wio_attrs.keys()])
|
|
303
316
|
|
|
@@ -305,17 +318,21 @@ def read_attributes(wio, algo_dict, verbosity):
|
|
|
305
318
|
if "flow_model" in wio_attrs:
|
|
306
319
|
flow_model = Dict(wio_attrs["flow_model"], name="flow_model")
|
|
307
320
|
fmname = flow_model.pop("name")
|
|
308
|
-
if verbosity >
|
|
321
|
+
if verbosity > 2:
|
|
309
322
|
print(" Reading flow_model")
|
|
310
323
|
print(" Name:", fmname)
|
|
311
324
|
print(" Contents:", [k for k in flow_model.keys()])
|
|
312
325
|
if fmname != "foxes":
|
|
313
|
-
|
|
326
|
+
print(f"Running flow model 'foxes', overruling original choice '{fmname}'")
|
|
314
327
|
|
|
315
328
|
# read analysis:
|
|
316
329
|
wio_ana = Dict(wio_attrs["analysis"], name="analyses")
|
|
317
330
|
_read_analysis(wio_ana, algo_dict, verbosity)
|
|
318
331
|
|
|
319
332
|
# outputs:
|
|
320
|
-
|
|
321
|
-
|
|
333
|
+
out_dicts = []
|
|
334
|
+
if "outputs" in wio_attrs:
|
|
335
|
+
outputs = Dict(wio_attrs["outputs"], name="outputs")
|
|
336
|
+
out_dicts = read_outputs(outputs, algo_dict, verbosity)
|
|
337
|
+
|
|
338
|
+
return out_dicts
|
foxes/input/windio/read_farm.py
CHANGED
|
@@ -32,27 +32,27 @@ def read_turbine_type(wio_trbns, algo_dict, ws_exp_P, ws_exp_ct, verbosity):
|
|
|
32
32
|
|
|
33
33
|
"""
|
|
34
34
|
tname = wio_trbns.pop("name")
|
|
35
|
-
if verbosity >
|
|
35
|
+
if verbosity > 2:
|
|
36
36
|
print(" Reading wio_trbns")
|
|
37
37
|
print(" Name:", tname)
|
|
38
38
|
print(" Contents:", [k for k in wio_trbns.keys()])
|
|
39
39
|
|
|
40
40
|
# read performance:
|
|
41
41
|
performance = Dict(wio_trbns["performance"], name="performance")
|
|
42
|
-
if verbosity >
|
|
42
|
+
if verbosity > 2:
|
|
43
43
|
print(" Reading performance")
|
|
44
44
|
print(" Contents:", [k for k in performance.keys()])
|
|
45
45
|
|
|
46
46
|
# P, ct data:
|
|
47
47
|
if "power_curve" in performance:
|
|
48
48
|
power_curve = Dict(performance["power_curve"], name="power_curve")
|
|
49
|
-
if verbosity >
|
|
49
|
+
if verbosity > 2:
|
|
50
50
|
print(" Reading power_curve")
|
|
51
51
|
print(" Contents:", [k for k in power_curve.keys()])
|
|
52
52
|
P = power_curve["power_values"]
|
|
53
53
|
ws_P = power_curve["power_wind_speeds"]
|
|
54
54
|
ct_curve = Dict(performance["Ct_curve"], name="Ct_values")
|
|
55
|
-
if verbosity >
|
|
55
|
+
if verbosity > 2:
|
|
56
56
|
print(" Reading Ct_curve")
|
|
57
57
|
print(" Contents:", [k for k in ct_curve.keys()])
|
|
58
58
|
ct = ct_curve["Ct_values"]
|
|
@@ -66,7 +66,7 @@ def read_turbine_type(wio_trbns, algo_dict, ws_exp_P, ws_exp_ct, verbosity):
|
|
|
66
66
|
raise ValueError(f"Expecting wind speed exponent 1, 2 or 3, got {wse}")
|
|
67
67
|
return FV.REWS if wse == 1 else (FV.REWS2 if wse == 2 else FV.REWS3)
|
|
68
68
|
|
|
69
|
-
if verbosity >
|
|
69
|
+
if verbosity > 2:
|
|
70
70
|
print(f" Creating model '{tname}'")
|
|
71
71
|
print(f" Turbine type class: PCtFromTwo")
|
|
72
72
|
algo_dict["mbook"].turbine_types[tname] = TurbineType.new(
|
|
@@ -83,19 +83,19 @@ def read_turbine_type(wio_trbns, algo_dict, ws_exp_P, ws_exp_ct, verbosity):
|
|
|
83
83
|
var_ws_P=_get_wse_var(ws_exp_P),
|
|
84
84
|
rho=1.225,
|
|
85
85
|
)
|
|
86
|
-
if verbosity >
|
|
86
|
+
if verbosity > 2:
|
|
87
87
|
print(" ", algo_dict["mbook"].turbine_types[tname])
|
|
88
88
|
|
|
89
89
|
# P, ct data:
|
|
90
90
|
elif "Cp_curve" in performance:
|
|
91
91
|
cp_curve = Dict(performance["Cp_curve"], name="Cp_curve")
|
|
92
|
-
if verbosity >
|
|
92
|
+
if verbosity > 2:
|
|
93
93
|
print(" Reading Cp_curve")
|
|
94
94
|
print(" Contents:", [k for k in cp_curve.keys()])
|
|
95
95
|
cp = cp_curve["Cp_values"]
|
|
96
96
|
ws_cp = cp_curve["Cp_wind_speeds"]
|
|
97
97
|
ct_curve = Dict(performance["Ct_curve"], name="Ct_values")
|
|
98
|
-
if verbosity >
|
|
98
|
+
if verbosity > 2:
|
|
99
99
|
print(" Reading Ct_curve")
|
|
100
100
|
print(" Contents:", [k for k in ct_curve.keys()])
|
|
101
101
|
ct = ct_curve["Ct_values"]
|
|
@@ -104,7 +104,7 @@ def read_turbine_type(wio_trbns, algo_dict, ws_exp_P, ws_exp_ct, verbosity):
|
|
|
104
104
|
data_cp = pd.DataFrame(data={"ws": ws_cp, "cp": cp})
|
|
105
105
|
data_ct = pd.DataFrame(data={"ws": ws_ct, "ct": ct})
|
|
106
106
|
|
|
107
|
-
if verbosity >
|
|
107
|
+
if verbosity > 2:
|
|
108
108
|
print(f" Creating model '{tname}'")
|
|
109
109
|
print(f" Turbine type class: CpCtFromTwo")
|
|
110
110
|
algo_dict["mbook"].turbine_types[tname] = TurbineType.new(
|
|
@@ -150,14 +150,14 @@ def read_layout(lname, ldict, algo_dict, ttype, verbosity=1):
|
|
|
150
150
|
:group: input.windio
|
|
151
151
|
|
|
152
152
|
"""
|
|
153
|
-
if verbosity >
|
|
153
|
+
if verbosity > 2:
|
|
154
154
|
print(f" Reading '{lname}'")
|
|
155
155
|
cdict = Dict(ldict["coordinates"], name="coordinates")
|
|
156
156
|
farm = algo_dict["farm"]
|
|
157
157
|
for xy in zip(cdict["x"], cdict["y"]):
|
|
158
158
|
farm.add_turbine(
|
|
159
159
|
Turbine(xy=np.array(xy), turbine_models=[ttype]),
|
|
160
|
-
verbosity=
|
|
160
|
+
verbosity=verbosity-3,
|
|
161
161
|
)
|
|
162
|
-
if verbosity >
|
|
162
|
+
if verbosity > 2:
|
|
163
163
|
print(f" Added {farm.n_turbines} wio_trbns of type '{ttype}'")
|