foxes 0.8.1__py3-none-any.whl → 1.0__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 (175) hide show
  1. docs/source/conf.py +353 -0
  2. examples/abl_states/run.py +160 -0
  3. examples/compare_rotors_pwakes/run.py +217 -0
  4. examples/compare_wakes/run.py +241 -0
  5. examples/dyn_wakes/run.py +311 -0
  6. examples/field_data_nc/run.py +121 -0
  7. examples/induction_RHB/run.py +201 -0
  8. examples/multi_height/run.py +113 -0
  9. examples/power_mask/run.py +249 -0
  10. examples/random_timeseries/run.py +210 -0
  11. examples/scan_row/run.py +193 -0
  12. examples/sector_management/run.py +162 -0
  13. examples/sequential/run.py +209 -0
  14. examples/single_state/run.py +201 -0
  15. examples/states_lookup_table/run.py +137 -0
  16. examples/streamline_wakes/run.py +138 -0
  17. examples/tab_file/run.py +142 -0
  18. examples/timelines/run.py +267 -0
  19. examples/timeseries/run.py +183 -0
  20. examples/timeseries_slurm/run.py +185 -0
  21. examples/wind_rose/run.py +141 -0
  22. examples/windio/run.py +29 -0
  23. examples/yawed_wake/run.py +196 -0
  24. foxes/__init__.py +4 -8
  25. foxes/algorithms/__init__.py +1 -1
  26. foxes/algorithms/downwind/downwind.py +232 -101
  27. foxes/algorithms/downwind/models/farm_wakes_calc.py +11 -6
  28. foxes/algorithms/downwind/models/init_farm_data.py +1 -1
  29. foxes/algorithms/downwind/models/point_wakes_calc.py +5 -6
  30. foxes/algorithms/downwind/models/reorder_farm_output.py +0 -1
  31. foxes/algorithms/downwind/models/set_amb_point_results.py +4 -2
  32. foxes/algorithms/iterative/iterative.py +73 -33
  33. foxes/algorithms/iterative/models/farm_wakes_calc.py +11 -6
  34. foxes/algorithms/sequential/models/plugin.py +1 -1
  35. foxes/algorithms/sequential/sequential.py +126 -255
  36. foxes/constants.py +17 -2
  37. foxes/core/__init__.py +1 -0
  38. foxes/core/algorithm.py +631 -146
  39. foxes/core/data.py +252 -20
  40. foxes/core/data_calc_model.py +13 -289
  41. foxes/core/engine.py +630 -0
  42. foxes/core/farm_controller.py +37 -9
  43. foxes/core/farm_data_model.py +15 -0
  44. foxes/core/model.py +133 -80
  45. foxes/core/point_data_model.py +15 -0
  46. foxes/core/rotor_model.py +27 -21
  47. foxes/core/states.py +16 -0
  48. foxes/core/turbine_type.py +28 -0
  49. foxes/core/wake_frame.py +22 -4
  50. foxes/core/wake_model.py +2 -3
  51. foxes/data/windio/windio_5turbines_timeseries.yaml +23 -1
  52. foxes/engines/__init__.py +16 -0
  53. foxes/engines/dask.py +975 -0
  54. foxes/engines/default.py +75 -0
  55. foxes/engines/futures.py +72 -0
  56. foxes/engines/mpi.py +38 -0
  57. foxes/engines/multiprocess.py +74 -0
  58. foxes/engines/numpy.py +185 -0
  59. foxes/engines/pool.py +263 -0
  60. foxes/engines/single.py +139 -0
  61. foxes/input/farm_layout/__init__.py +1 -0
  62. foxes/input/farm_layout/from_csv.py +4 -0
  63. foxes/input/farm_layout/from_json.py +1 -1
  64. foxes/input/farm_layout/grid.py +2 -2
  65. foxes/input/farm_layout/ring.py +65 -0
  66. foxes/input/farm_layout/row.py +2 -2
  67. foxes/input/states/__init__.py +6 -0
  68. foxes/input/states/create/random_abl_states.py +1 -1
  69. foxes/input/states/field_data_nc.py +157 -32
  70. foxes/input/states/multi_height.py +127 -13
  71. foxes/input/states/one_point_flow.py +577 -0
  72. foxes/input/states/scan_ws.py +73 -2
  73. foxes/input/states/states_table.py +204 -35
  74. foxes/input/windio/__init__.py +1 -1
  75. foxes/input/windio/get_states.py +44 -23
  76. foxes/input/windio/read_attributes.py +41 -16
  77. foxes/input/windio/read_farm.py +116 -102
  78. foxes/input/windio/read_fields.py +13 -6
  79. foxes/input/windio/read_outputs.py +63 -22
  80. foxes/input/windio/runner.py +31 -17
  81. foxes/input/windio/windio.py +36 -22
  82. foxes/models/ground_models/wake_mirror.py +8 -4
  83. foxes/models/model_book.py +29 -18
  84. foxes/models/partial_wakes/rotor_points.py +3 -3
  85. foxes/models/rotor_models/centre.py +4 -0
  86. foxes/models/rotor_models/grid.py +22 -23
  87. foxes/models/rotor_models/levels.py +4 -5
  88. foxes/models/turbine_models/calculator.py +0 -2
  89. foxes/models/turbine_models/lookup_table.py +27 -2
  90. foxes/models/turbine_models/rotor_centre_calc.py +4 -3
  91. foxes/models/turbine_models/set_farm_vars.py +103 -34
  92. foxes/models/turbine_types/PCt_file.py +24 -0
  93. foxes/models/turbine_types/PCt_from_two.py +24 -0
  94. foxes/models/turbine_types/__init__.py +1 -0
  95. foxes/models/turbine_types/lookup.py +316 -0
  96. foxes/models/turbine_types/null_type.py +50 -0
  97. foxes/models/turbine_types/wsrho2PCt_from_two.py +24 -0
  98. foxes/models/turbine_types/wsti2PCt_from_two.py +24 -0
  99. foxes/models/vertical_profiles/data_profile.py +1 -1
  100. foxes/models/wake_frames/__init__.py +1 -0
  101. foxes/models/wake_frames/dynamic_wakes.py +424 -0
  102. foxes/models/wake_frames/farm_order.py +23 -3
  103. foxes/models/wake_frames/rotor_wd.py +4 -2
  104. foxes/models/wake_frames/seq_dynamic_wakes.py +56 -63
  105. foxes/models/wake_frames/streamlines.py +19 -20
  106. foxes/models/wake_frames/timelines.py +328 -127
  107. foxes/models/wake_frames/yawed_wakes.py +4 -1
  108. foxes/models/wake_models/dist_sliced.py +1 -3
  109. foxes/models/wake_models/induction/rankine_half_body.py +4 -4
  110. foxes/models/wake_models/induction/rathmann.py +2 -2
  111. foxes/models/wake_models/induction/self_similar.py +2 -2
  112. foxes/models/wake_models/induction/vortex_sheet.py +2 -2
  113. foxes/models/wake_models/ti/iec_ti.py +34 -17
  114. foxes/models/wake_models/top_hat.py +1 -1
  115. foxes/models/wake_models/wind/bastankhah14.py +2 -2
  116. foxes/models/wake_models/wind/bastankhah16.py +8 -7
  117. foxes/models/wake_models/wind/jensen.py +1 -1
  118. foxes/models/wake_models/wind/turbopark.py +2 -2
  119. foxes/output/__init__.py +4 -1
  120. foxes/output/farm_layout.py +2 -2
  121. foxes/output/flow_plots_2d/__init__.py +0 -1
  122. foxes/output/flow_plots_2d/flow_plots.py +70 -30
  123. foxes/output/grids.py +91 -21
  124. foxes/output/seq_plugins/__init__.py +2 -0
  125. foxes/output/{flow_plots_2d → seq_plugins}/seq_flow_ani_plugin.py +62 -20
  126. foxes/output/seq_plugins/seq_wake_debug_plugin.py +145 -0
  127. foxes/output/slice_data.py +131 -111
  128. foxes/output/state_turbine_map.py +18 -13
  129. foxes/output/state_turbine_table.py +19 -19
  130. foxes/utils/__init__.py +1 -1
  131. foxes/utils/dev_utils.py +42 -0
  132. foxes/utils/dict.py +1 -1
  133. foxes/utils/factory.py +147 -52
  134. foxes/utils/pandas_helpers.py +4 -3
  135. foxes/utils/wind_dir.py +0 -2
  136. foxes/utils/xarray_utils.py +25 -13
  137. foxes/variables.py +37 -0
  138. {foxes-0.8.1.dist-info → foxes-1.0.dist-info}/METADATA +72 -34
  139. foxes-1.0.dist-info/RECORD +307 -0
  140. {foxes-0.8.1.dist-info → foxes-1.0.dist-info}/WHEEL +1 -1
  141. foxes-1.0.dist-info/top_level.txt +4 -0
  142. tests/0_consistency/iterative/test_iterative.py +92 -0
  143. tests/0_consistency/partial_wakes/test_partial_wakes.py +90 -0
  144. tests/1_verification/flappy_0_6/PCt_files/flappy/run.py +85 -0
  145. tests/1_verification/flappy_0_6/PCt_files/test_PCt_files.py +103 -0
  146. tests/1_verification/flappy_0_6/abl_states/flappy/run.py +85 -0
  147. tests/1_verification/flappy_0_6/abl_states/test_abl_states.py +87 -0
  148. tests/1_verification/flappy_0_6/partial_top_hat/flappy/run.py +82 -0
  149. tests/1_verification/flappy_0_6/partial_top_hat/test_partial_top_hat.py +82 -0
  150. tests/1_verification/flappy_0_6/row_Jensen_linear_centre/flappy/run.py +92 -0
  151. tests/1_verification/flappy_0_6/row_Jensen_linear_centre/test_row_Jensen_linear_centre.py +93 -0
  152. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat/flappy/run.py +92 -0
  153. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat/test_row_Jensen_linear_tophat.py +96 -0
  154. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2005/flappy/run.py +94 -0
  155. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2005/test_row_Jensen_linear_tophat_IECTI_2005.py +122 -0
  156. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2019/flappy/run.py +94 -0
  157. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2019/test_row_Jensen_linear_tophat_IECTI_2019.py +122 -0
  158. tests/1_verification/flappy_0_6/row_Jensen_quadratic_centre/flappy/run.py +92 -0
  159. tests/1_verification/flappy_0_6/row_Jensen_quadratic_centre/test_row_Jensen_quadratic_centre.py +93 -0
  160. tests/1_verification/flappy_0_6_2/grid_rotors/flappy/run.py +85 -0
  161. tests/1_verification/flappy_0_6_2/grid_rotors/test_grid_rotors.py +130 -0
  162. tests/1_verification/flappy_0_6_2/row_Bastankhah_Crespo/flappy/run.py +96 -0
  163. tests/1_verification/flappy_0_6_2/row_Bastankhah_Crespo/test_row_Bastankhah_Crespo.py +116 -0
  164. tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/flappy/run.py +93 -0
  165. tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/test_row_Bastankhah_linear_centre.py +99 -0
  166. tests/3_examples/test_examples.py +34 -0
  167. foxes/VERSION +0 -1
  168. foxes/output/flow_plots_2d.py +0 -0
  169. foxes/utils/plotly_helpers.py +0 -19
  170. foxes/utils/runners/__init__.py +0 -1
  171. foxes/utils/runners/runners.py +0 -280
  172. foxes-0.8.1.dist-info/RECORD +0 -248
  173. foxes-0.8.1.dist-info/top_level.txt +0 -1
  174. foxes-0.8.1.dist-info/zip-safe +0 -1
  175. {foxes-0.8.1.dist-info → foxes-1.0.dist-info}/LICENSE +0 -0
docs/source/conf.py ADDED
@@ -0,0 +1,353 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Configuration file for the Sphinx documentation builder.
4
+ #
5
+ # This file does only contain a selection of the most common options. For a
6
+ # full list see the documentation:
7
+ # http://www.sphinx-doc.org/en/master/config
8
+
9
+ # -- Path setup --------------------------------------------------------------
10
+
11
+ # If extensions (or modules to document with autodoc) are in another directory,
12
+ # add these directories to sys.path here. If the directory is relative to the
13
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
14
+ #
15
+ import os
16
+ import sys
17
+
18
+ sys.path.insert(0, os.path.abspath("../.."))
19
+
20
+ from foxes import __version__
21
+
22
+ # -- Project information -----------------------------------------------------
23
+
24
+ project = "foxes"
25
+ copyright = "2024, Fraunhofer IWES"
26
+ author = "Fraunhofer IWES"
27
+
28
+ # The short X.Y version
29
+ version = __version__
30
+ # The full version, including alpha/beta/rc tags
31
+ release = __version__
32
+
33
+
34
+ # -- General configuration ---------------------------------------------------
35
+
36
+ # If your documentation needs a minimal Sphinx version, state it here.
37
+ #
38
+ # needs_sphinx = '1.0'
39
+
40
+ # Add any Sphinx extension module names here, as strings. They can be
41
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
42
+ # ones.
43
+ extensions = [
44
+ "nbsphinx",
45
+ "sphinx_immaterial",
46
+ "sphinx_immaterial.apidoc.python.apigen",
47
+ "sphinx.ext.autodoc",
48
+ "sphinx.ext.autosectionlabel",
49
+ # "sphinx.ext.autosummary",
50
+ "sphinx.ext.intersphinx",
51
+ "sphinx.ext.mathjax",
52
+ # "sphinx.ext.napoleon",
53
+ "sphinx.ext.viewcode",
54
+ # "sphinx.ext.inheritance_diagram",
55
+ "sphinx.ext.doctest",
56
+ "m2r2",
57
+ ]
58
+
59
+ intersphinx_mapping = {
60
+ "python": ("https://docs.python.org/3/", None),
61
+ "numpy": ("https://docs.scipy.org/doc/numpy/", None),
62
+ "scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
63
+ }
64
+
65
+ # Add any paths that contain templates here, relative to this directory.
66
+ # templates_path = ["_templates"]
67
+ # autosummary_generate = False
68
+
69
+ # The suffix(es) of source filenames.
70
+ # You can specify multiple suffix as a list of string:
71
+ #
72
+ source_suffix = [".rst", ".md"]
73
+
74
+ # The master toctree document.
75
+ master_doc = "index"
76
+
77
+ # The language for content autogenerated by Sphinx. Refer to documentation
78
+ # for a list of supported languages.
79
+ #
80
+ # This is also used if you do content translation via gettext catalogs.
81
+ # Usually you set "language" from the command line for these cases.
82
+ language = "en"
83
+
84
+ # List of patterns, relative to source directory, that match files and
85
+ # directories to ignore when looking for source files.
86
+ # This pattern also affects html_static_path and html_extra_path.
87
+ exclude_patterns = [
88
+ # ipynb checkpoints
89
+ "notebooks/.ipynb_checkpoints/*.ipynb",
90
+ "build/*",
91
+ # "_templates/*",
92
+ # DEBUG
93
+ # "examples.rst",
94
+ # "notebooks/*",
95
+ # "notebooks/layout_opt.ipynb",
96
+ # "notebooks/timelines.ipynb",
97
+ # "notebooks/heterogeneous.ipynb",
98
+ # "notebooks/timeseries.ipynb",
99
+ # "api.rst"
100
+ ]
101
+
102
+ # The name of the Pygments (syntax highlighting) style to use.
103
+ pygments_style = None
104
+
105
+ # autosummary_generate = True
106
+ napolean_use_rtype = False
107
+
108
+ # -- Options for sphinxcontrib.email ------------------------------------------
109
+ # email_automode = True
110
+
111
+
112
+ # -- Options for nbsphinx -----------------------------------------------------
113
+
114
+ # Execute notebooks before conversion: 'always', 'never', 'auto' (default)
115
+ # We execute all notebooks, exclude the slow ones using 'exclude_patterns'
116
+ nbsphinx_execute = "always"
117
+
118
+ # Use this kernel instead of the one stored in the notebook metadata:
119
+ # nbsphinx_kernel_name = 'python3'
120
+
121
+ # List of arguments to be passed to the kernel that executes the notebooks:
122
+ # nbsphinx_execute_arguments = []
123
+
124
+ # If True, the build process is continued even if an exception occurs:
125
+ # nbsphinx_allow_errors = True
126
+
127
+
128
+ # Controls when a cell will time out (defaults to 30; use -1 for no timeout):
129
+ nbsphinx_timeout = 500
130
+
131
+ # Default Pygments lexer for syntax highlighting in code cells:
132
+ # nbsphinx_codecell_lexer = 'ipython3'
133
+
134
+ # Width of input/output prompts used in CSS:
135
+ # nbsphinx_prompt_width = '8ex'
136
+
137
+ # If window is narrower than this, input/output prompts are on separate lines:
138
+ # nbsphinx_responsive_width = '700px'
139
+
140
+ # This is processed by Jinja2 and inserted before each notebook
141
+ # Fix for issue with pyplot, cf
142
+ # https://github.com/readthedocs/sphinx_rtd_theme/issues/788#issuecomment-585785027
143
+ nbsphinx_prolog = r"""
144
+ .. raw:: html
145
+
146
+ <script src='http://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js'></script>
147
+ <script>require=requirejs;</script>
148
+
149
+
150
+ """
151
+
152
+ # This is processed by Jinja2 and inserted after each notebook
153
+ # nbsphinx_epilog = r"""
154
+ # """
155
+
156
+ # Input prompt for code cells. "%s" is replaced by the execution count.
157
+ nbsphinx_input_prompt = "In [%s]:"
158
+
159
+ # Output prompt for code cells. "%s" is replaced by the execution count.
160
+ nbsphinx_output_prompt = "Out[%s]:"
161
+
162
+ # Specify conversion functions for custom notebook formats:
163
+ # import jupytext
164
+ # nbsphinx_custom_formats = {
165
+ # '.Rmd': lambda s: jupytext.reads(s, '.Rmd'),
166
+ # }
167
+
168
+ # Link or path to require.js, set to empty string to disable
169
+ # nbsphinx_requirejs_path = ''
170
+
171
+ # Options for loading require.js
172
+ # nbsphinx_requirejs_options = {'async': 'async'}
173
+ mathjax3_config = {
174
+ "TeX": {"equationNumbers": {"autoNumber": "AMS", "useLabelIds": True}},
175
+ }
176
+
177
+ # Additional files needed for generating LaTeX/PDF output:
178
+ # latex_additional_files = ['references.bib']
179
+
180
+ # -- Options for autodoc ----------------------------------------------------
181
+ # https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#configuration
182
+
183
+ # Automatically extract typehints when specified and place them in
184
+ # descriptions of the relevant function/method.
185
+ autodoc_typehints = "description"
186
+
187
+ # Don't show class signature with the class' name.
188
+ autodoc_class_signature = "separated"
189
+
190
+ # -- Options for HTML output -------------------------------------------------
191
+
192
+ # The theme to use for HTML and HTML Help pages. See the documentation for
193
+ # a list of builtin themes.
194
+ #
195
+ html_theme = "sphinx_immaterial"
196
+
197
+ # html_theme = 'cloud'
198
+
199
+ # Theme options are theme-specific and customize the look and feel of a theme
200
+ # further. For a list of options available for each theme, see the
201
+ # documentation.
202
+ html_theme_options = {
203
+ # TOC options
204
+ #'navigation_depth': 2, # only show 2 levels on left sidebar
205
+ # "collapse_navigation": False, # don't allow sidebar to collapse,
206
+ "site_url": "https://fraunhoferiwes.github.io/foxes.docs/index.html",
207
+ "repo_url": "https://github.com/FraunhoferIWES/foxes",
208
+ "icon": {"repo": "fontawesome/brands/github", "edit": "material/file-edit-outline"},
209
+ "palette": {"primary": "teal"},
210
+ "toc_title_is_page_title": True,
211
+ }
212
+
213
+ # Add any paths that contain custom static files (such as style sheets) here,
214
+ # relative to this directory. They are copied after the builtin static files,
215
+ # so a file named "default.css" will overwrite the builtin "default.css".
216
+ # html_static_path = ["_static"]
217
+
218
+ # custom.css is inside one of the html_static_path folders (e.g. _static)
219
+ # html_css_files = ["custom.css"]
220
+
221
+ # Custom sidebar templates, must be a dictionary that maps document names
222
+ # to template names.
223
+ #
224
+ # The default sidebars (for documents that don't match any pattern) are
225
+ # defined by theme itself. Builtin themes are using these templates by
226
+ # default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
227
+ # 'searchbox.html']``.
228
+ #
229
+ # html_sidebars = {}
230
+
231
+
232
+ # -- Options for HTMLHelp output ---------------------------------------------
233
+
234
+ # Output file base name for HTML help builder.
235
+ htmlhelp_basename = "foxesdoc"
236
+
237
+
238
+ # -- Options for LaTeX output ------------------------------------------------
239
+
240
+ latex_elements = {
241
+ # The paper size ('letterpaper' or 'a4paper').
242
+ #
243
+ # 'papersize': 'letterpaper',
244
+ # The font size ('10pt', '11pt' or '12pt').
245
+ #
246
+ # 'pointsize': '10pt',
247
+ # Additional stuff for the LaTeX preamble.
248
+ #
249
+ # 'preamble': '',
250
+ # Latex figure (float) alignment
251
+ #
252
+ # 'figure_align': 'htbp',
253
+ }
254
+
255
+ # Grouping the document tree into LaTeX files. List of tuples
256
+ # (source start file, target name, title,
257
+ # author, documentclass [howto, manual, or own class]).
258
+ latex_documents = [
259
+ (master_doc, "foxes.tex", "foxes Documentation", "Fraunhofer IWES", "manual"),
260
+ ]
261
+
262
+
263
+ # -- Options for manual page output ------------------------------------------
264
+
265
+ # One entry per manual page. List of tuples
266
+ # (source start file, name, description, authors, manual section).
267
+ man_pages = [(master_doc, "foxes", "foxes Documentation", [author], 1)]
268
+
269
+
270
+ # -- Options for Texinfo output ----------------------------------------------
271
+
272
+ # Grouping the document tree into Texinfo files. List of tuples
273
+ # (source start file, target name, title, author,
274
+ # dir menu entry, description, category)
275
+ texinfo_documents = [
276
+ (
277
+ master_doc,
278
+ "foxes",
279
+ "foxes Documentation",
280
+ author,
281
+ "foxes",
282
+ "Farm Optimization and eXtended yield Evaluation Software",
283
+ "Miscellaneous",
284
+ ),
285
+ ]
286
+
287
+
288
+ # -- Options for Epub output -------------------------------------------------
289
+
290
+ # Bibliographic Dublin Core info.
291
+ epub_title = project
292
+
293
+ # The unique identifier of the text. This can be a ISBN number
294
+ # or the project homepage.
295
+ #
296
+ # epub_identifier = ''
297
+
298
+ # A unique identification for the text.
299
+ #
300
+ # epub_uid = ''
301
+
302
+ # A list of files that should not be packed into the epub file.
303
+ epub_exclude_files = ["search.html"]
304
+
305
+ # -- python_apigen configuration -------------------------------------------------
306
+
307
+ python_apigen_modules = {
308
+ "foxes.variables": "_foxes/variables/",
309
+ "foxes.constants": "_foxes/constants/",
310
+ "foxes.algorithms": "_foxes/algorithms/",
311
+ "foxes.algorithms.downwind": "_foxes/algorithms/downwind/",
312
+ "foxes.algorithms.downwind.models": "_foxes/algorithms/downwind/models/",
313
+ "foxes.algorithms.iterative": "_foxes/algorithms/iterative/",
314
+ "foxes.algorithms.iterative.models": "_foxes/algorithms/iterative/models/",
315
+ "foxes.algorithms.sequential": "_foxes/algorithms/sequential/",
316
+ "foxes.algorithms.sequential.models": "_foxes/algorithms/sequential/models/",
317
+ "foxes.core": "_foxes/core/",
318
+ "foxes.data": "_foxes/data/",
319
+ "foxes.engines": "_foxes/engines/",
320
+ "foxes.input.farm_layout": "_foxes/input/farm_layout/",
321
+ "foxes.input.states": "_foxes/input/states/",
322
+ "foxes.input.states.create": "_foxes/input/states/create/",
323
+ "foxes.input.windio": "_foxes/input/windio/",
324
+ "foxes.output": "_foxes/output/",
325
+ "foxes.output.flow_plots_2d": "_foxes/output/flow_plots_2d/",
326
+ "foxes.output.seq_plugins": "_foxes/output/seq_plugins/",
327
+ "foxes.models": "_foxes/models/",
328
+ "foxes.models.farm_controllers": "_foxes/models/farm_controllers/",
329
+ "foxes.models.farm_models": "_foxes/models/farm_models/",
330
+ "foxes.models.partial_wakes": "_foxes/models/partial_wakes/",
331
+ "foxes.models.point_models": "_foxes/models/point_models/",
332
+ "foxes.models.rotor_models": "_foxes/models/rotor_models/",
333
+ "foxes.models.turbine_models": "_foxes/models/turbine_models/",
334
+ "foxes.models.turbine_types": "_foxes/models/turbine_types/",
335
+ "foxes.models.vertical_profiles": "_foxes/models/vertical_profiles/",
336
+ "foxes.models.axial_induction": "_foxes/models/axial_induction",
337
+ "foxes.models.ground_models": "_foxes/models/ground_models",
338
+ "foxes.models.wake_frames": "_foxes/models/wake_frames/",
339
+ "foxes.models.wake_models": "_foxes/models/wake_models/",
340
+ "foxes.models.wake_models.induction": "_foxes/models/wake_models/induction/",
341
+ "foxes.models.wake_models.wind": "_foxes/models/wake_models/wind/",
342
+ "foxes.models.wake_models.ti": "_foxes/models/wake_models/ti/",
343
+ "foxes.models.wake_superpositions": "_foxes/models/wake_superpositions/",
344
+ "foxes.utils": "_foxes/utils/",
345
+ "foxes.utils.abl": "_foxes/utils/abl",
346
+ "foxes.utils.geom2d": "_foxes/utils/geom2d/",
347
+ "foxes.utils.runners": "_foxes/utils/runners/",
348
+ "foxes.utils.two_circles": "_foxes/utils/two_circles/",
349
+ "foxes.utils.abl.neutral": "_foxes/utils/abl/neutral/",
350
+ "foxes.utils.abl.stable": "_foxes/utils/abl/stable/",
351
+ "foxes.utils.abl.unstable": "_foxes/utils/abl/unstable/",
352
+ "foxes.utils.abl.sheared": "_foxes/utils/abl/sheared/",
353
+ }
@@ -0,0 +1,160 @@
1
+ import time
2
+ import argparse
3
+
4
+ import foxes
5
+ import foxes.variables as FV
6
+
7
+ if __name__ == "__main__":
8
+ parser = argparse.ArgumentParser()
9
+ parser.add_argument(
10
+ "-l",
11
+ "--layout",
12
+ help="The wind farm layout file (path or static)",
13
+ default="test_farm_67.csv",
14
+ )
15
+ parser.add_argument(
16
+ "-s",
17
+ "--states",
18
+ help="The states input file (path or static)",
19
+ default="abl_states_6000.csv.gz",
20
+ )
21
+ parser.add_argument(
22
+ "-t",
23
+ "--turbine_file",
24
+ help="The P-ct-curve csv file (path or static)",
25
+ default="NREL-5MW-D126-H90.csv",
26
+ )
27
+ parser.add_argument("-r", "--rotor", help="The rotor model", default="level4")
28
+ parser.add_argument(
29
+ "-p", "--pwakes", help="The partial wakes models", default=None, nargs="+"
30
+ )
31
+ parser.add_argument(
32
+ "-w",
33
+ "--wakes",
34
+ help="The wake models",
35
+ default=["CrespoHernandez_quadratic_k002", "Bastankhah2016_linear_lim_k004"],
36
+ nargs="+",
37
+ )
38
+ parser.add_argument(
39
+ "-m", "--tmodels", help="The turbine models", default=[], nargs="+"
40
+ )
41
+ parser.add_argument("-e", "--engine", help="The engine", default=None)
42
+ parser.add_argument(
43
+ "-n", "--n_cpus", help="The number of cpus", default=None, type=int
44
+ )
45
+ parser.add_argument(
46
+ "-c",
47
+ "--chunksize_states",
48
+ help="The chunk size for states",
49
+ default=None,
50
+ type=int,
51
+ )
52
+ parser.add_argument(
53
+ "-C",
54
+ "--chunksize_points",
55
+ help="The chunk size for points",
56
+ default=None,
57
+ type=int,
58
+ )
59
+ parser.add_argument(
60
+ "-nf", "--nofig", help="Do not show figures", action="store_true"
61
+ )
62
+ args = parser.parse_args()
63
+
64
+ mbook = foxes.models.ModelBook()
65
+ ttype = foxes.models.turbine_types.PCtFile(args.turbine_file)
66
+ mbook.turbine_types[ttype.name] = ttype
67
+
68
+ states = foxes.input.states.StatesTable(
69
+ data_source=args.states,
70
+ output_vars=[FV.WS, FV.WD, FV.TI, FV.RHO, FV.MOL],
71
+ var2col={FV.WS: "ws", FV.WD: "wd", FV.TI: "ti", FV.MOL: "mol"},
72
+ fixed_vars={FV.RHO: 1.225, FV.Z0: 0.05, FV.H: 100.0},
73
+ profiles={FV.WS: "ABLLogWsProfile"},
74
+ )
75
+
76
+ farm = foxes.WindFarm()
77
+ foxes.input.farm_layout.add_from_file(
78
+ farm,
79
+ args.layout,
80
+ col_x="x",
81
+ col_y="y",
82
+ col_H="H",
83
+ turbine_models=args.tmodels + [ttype.name],
84
+ )
85
+
86
+ algo = foxes.algorithms.Downwind(
87
+ farm,
88
+ states,
89
+ wake_models=args.wakes,
90
+ rotor_model=args.rotor,
91
+ wake_frame="rotor_wd",
92
+ partial_wakes=args.pwakes,
93
+ mbook=mbook,
94
+ engine=args.engine,
95
+ n_procs=args.n_cpus,
96
+ chunk_size_states=args.chunksize_states,
97
+ chunk_size_points=args.chunksize_points,
98
+ )
99
+
100
+ time0 = time.time()
101
+ farm_results = algo.calc_farm()
102
+ time1 = time.time()
103
+
104
+ print("\nCalc time =", time1 - time0, "\n")
105
+
106
+ print(farm_results)
107
+
108
+ fr = farm_results.to_dataframe()
109
+ print(fr[[FV.WD, FV.H, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]])
110
+
111
+ o = foxes.output.FarmResultsEval(farm_results)
112
+ o = foxes.output.FarmResultsEval(farm_results)
113
+ o.add_capacity(algo)
114
+ o.add_capacity(algo, ambient=True)
115
+ o.add_efficiency()
116
+
117
+ # state-turbine results
118
+ farm_df = farm_results.to_dataframe()
119
+ print("\nFarm results data:\n")
120
+ print(
121
+ farm_df[
122
+ [
123
+ FV.X,
124
+ FV.WD,
125
+ FV.AMB_REWS,
126
+ FV.REWS,
127
+ FV.AMB_TI,
128
+ FV.TI,
129
+ FV.AMB_P,
130
+ FV.P,
131
+ FV.EFF,
132
+ ]
133
+ ]
134
+ )
135
+ print()
136
+
137
+ # results by turbine
138
+ turbine_results = o.reduce_states(
139
+ {
140
+ FV.AMB_P: "mean",
141
+ FV.P: "mean",
142
+ FV.AMB_CAP: "mean",
143
+ FV.CAP: "mean",
144
+ FV.EFF: "mean",
145
+ }
146
+ )
147
+ turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
148
+ algo=algo, annual=True, ambient=True
149
+ )
150
+ turbine_results[FV.YLD] = o.calc_turbine_yield(algo=algo, annual=True)
151
+ print("\nResults by turbine:\n")
152
+ print(turbine_results)
153
+
154
+ # power results
155
+ P0 = o.calc_mean_farm_power(ambient=True)
156
+ P = o.calc_mean_farm_power()
157
+ print(f"\nFarm power : {P/1000:.1f} MW")
158
+ print(f"Farm ambient power: {P0/1000:.1f} MW")
159
+ print(f"Farm efficiency : {o.calc_farm_efficiency():.2f}")
160
+ print(f"Annual farm yield : {turbine_results[FV.YLD].sum():.2f} GWh.")