Skip to content

Commit

Permalink
Upgrade FOXES dependency to v0.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rafmudaf committed Mar 19, 2024
1 parent 0e8eae3 commit 7bbd506
Show file tree
Hide file tree
Showing 8 changed files with 213 additions and 159 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Currently, `wcomp` must be installed manually `pip`. The dependencies are:

- windIO v1.0, can be installed directly from PyPI
- FLORIS v3.5, can be installed directly from PyPI but preferably locally from https://github.com/nrel/floris
- FOXES v0.5.1 plus two additional commits, must be installed from https://github.com/rafmudaf/foxes at main branch
- foxes v0.6.2 plus one additional commit, must be installed from https://github.com/rafmudaf/foxes at main branch
- PyWake v2.5.0 plus two additional commits, must be installed from https://github.com/rafmudaf/PyWake at master branch

Follow these steps to install the dependencies and `wcomp`:
Expand Down Expand Up @@ -69,7 +69,7 @@ The `windIO` package is used both to define the comparison cases and to load the
```mermaid
graph TD
L["FLORIS"]
M["FOXES"]
M["foxes"]
N["PyWake"]
A["windIO"]
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ API documentation for their respective interface files, for reference.
| Wake Model | Interface File |
|------------|----------------|
| [Floris](https://github.com/NREL/floris) | {py:class}`wcomp.floris_interface` |
| [FOXES](https://github.com/FraunhoferIWES/foxes) | {py:class}`wcomp.foxes_interface` |
| [foxes](https://github.com/FraunhoferIWES/foxes) | {py:class}`wcomp.foxes_interface` |
| [PyWake](https://gitlab.windenergy.dtu.dk/TOPFARM/PyWake) | {py:class}`wcomp.pywake_interface` |

<!-- ```{autoclasstree} wcomp.base_interface
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ in the comparison directly.

The wake modeling software currently integrated to `wcomp` are:
- [Floris](https://github.com/NREL/floris)
- [FOXES](https://github.com/FraunhoferIWES/foxes)
- [foxes](https://github.com/FraunhoferIWES/foxes)
- [PyWake](https://gitlab.windenergy.dtu.dk/TOPFARM/PyWake)

The package diagram below shows the modules within `wcomp` and how each relates to the
Expand Down Expand Up @@ -52,7 +52,7 @@ Currently, `wcomp` must be installed manually with `pip`. The dependencies are:

- windIO v1.0, can be installed directly from PyPI
- FLORIS v3.5, can be installed directly from PyPI but preferably locally from https://github.com/nrel/floris
- FOXES v0.5.1 plus two additional commits, must be installed from https://github.com/rafmudaf/foxes at main branch
- foxes v0.6.2 plus one additional commit, must be installed from https://github.com/rafmudaf/foxes at main branch
- PyWake v2.5.0 plus two additional commits, must be installed from https://github.com/rafmudaf/PyWake at master branch

Follow these steps to install the dependencies and `wcomp`:
Expand Down
192 changes: 181 additions & 11 deletions examples/torque2024_1turbine.ipynb

Large diffs are not rendered by default.

132 changes: 6 additions & 126 deletions examples/wesc2023_demo.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# What packages are required for this module to be executed?
REQUIRED = [
"floris", # At develop, latest hash is c7f8f36
"foxes", # At v0.5.1 with two additional commits on rafmudaf/foxes, latest hash is 275f645
"foxes", # At v0.6.2 with one additional commit on rafmudaf/foxes, latest hash is a3e3c48
"py-wake", # At master with two additional commits on rafmudaf/PyWake, latest hash is 35e63b7
"numpy>=1.20",
"windIO",
Expand Down
2 changes: 1 addition & 1 deletion wcomp/floris_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
},
}

# ASSUMPTION: FLORIS has a vertical and horizontal wake expansion rate for Bastankhah 2016, but FOXES uses the same for both.
# ASSUMPTION: FLORIS has a vertical and horizontal wake expansion rate for Bastankhah 2016, but foxes uses the same for both.
# This is also mentioned in the paper in section 7 Model Predictions.
# For simplicity in connecting the models, I'm setting FLORIS to use the same for both.

Expand Down
34 changes: 19 additions & 15 deletions wcomp/foxes_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
from foxes.output import FlowPlots2D
from foxes.models.model_book import ModelBook
from foxes.models.wake_models.wind import JensenWake
from foxes.models.wake_models.wind import PorteAgelWake
from foxes.models.wake_models.wind import Bastankhah2014
from foxes.models.wake_models.wind import Bastankhah2016
from foxes.models.wake_models.wind import TurbOParkWake
from foxes.models.wake_frames import YawedWakes

Expand All @@ -37,13 +38,13 @@
}
},
# "bastankah2014": {
# "model_ref": BastankhahWake,
# "model_ref": Bastankhah2014,
# "parameters": {
# "alpha": "k",
# }
# },
"bastankhah2016": {
"model_ref": PorteAgelWake,
"model_ref": Bastankhah2016,
"parameters": {
"alpha": "alpha",
"beta": "beta",
Expand Down Expand Up @@ -318,7 +319,7 @@ def read_analyses(self, analyses, mbook, farm, states, keymap={}, **algo_pars):
temp_model_name = "this_model"
mbook.wake_models[temp_model_name] = _velocity_model(
**_velocity_model_parameters,
superposition="quadratic"
superposition="ws_quadratic"
)
# mbook.print_toc(subset="wake_models")
return Downwind(
Expand Down Expand Up @@ -506,30 +507,30 @@ def horizontal_contour(

x1_bounds = (np.min(self.farm_results.X) - 2 * self.rotor_diameter, np.max(self.farm_results.X) + 10 * self.rotor_diameter)
x2_bounds = (np.min(self.farm_results.Y) - 2 * self.rotor_diameter, np.max(self.farm_results.Y) + 2 * self.rotor_diameter)
# print("foxes bounds")
# print(x1_bounds)
# print(x2_bounds)
o = FlowPlots2D(self.algo, self.farm_results)
# g = o.gen_states_fig_xy("WS", resolution=10, figsize=(10, 5), verbosity=0)
# xres = (x1_bounds[1] - x1_bounds[0]) / resolution[0]
# yres = (x2_bounds[1] - x2_bounds[0]) / resolution[1]
grid_points, u = o.get_mean_fig_xy(
"WS",
u, grid_data = o.get_mean_data_xy(
resolution=resolution,
variables=["WS"],
xmin=x1_bounds[0],
xmax=x1_bounds[1],
ymin=x2_bounds[0],
ymax=x2_bounds[1],
figsize=(10, 5)
z=self.hub_height,
ret_grid=True,
data_format="numpy",
)
x_pos, y_pos, z_pos, grid_points = grid_data
x = grid_points[:, :, 0]
y = grid_points[:, :, 1]
# z = grid_points[:, :, 2]

plane = WakePlane(
x[0],
y[0],
u[0],
u[:,:,0].flatten(),
"z",
resolution,
)
Expand All @@ -554,23 +555,26 @@ def xsection_contour(
# g = o.gen_states_fig_xy("WS", resolution=10, figsize=(10, 5), verbosity=0)
# xres = (x1_bounds[1] - x1_bounds[0]) / resolution[0]
# yres = (x2_bounds[1] - x2_bounds[0]) / resolution[1]
grid_points, u = o.get_mean_fig_yz(
"WS",
u, grid_data = o.get_mean_data_yz(
resolution=resolution,
variables=["WS"],
ymin=x1_bounds[0],
ymax=x1_bounds[1],
zmin=x2_bounds[0],
zmax=x2_bounds[1],
figsize=(10, 5)
x=x_coordinate,
ret_grid=True,
data_format="numpy",
)
x_pos, y_pos, z_pos, grid_points = grid_data
# x = grid_points[:, :, 0]
y = grid_points[:, :, 1]
z = grid_points[:, :, 2]

plane = WakePlane(
y[0],
z[0],
u[0],
u[:,:,0].flatten(),
"x",
resolution,
)
Expand Down

0 comments on commit 7bbd506

Please sign in to comment.