diff --git a/README.md b/README.md index ea6d8313e..7d26cf1bd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ FLORIS is a controls-focused wind farm simulation software incorporating steady-state engineering wake models into a performance-focused Python framework. It has been in active development at NREL since 2013 and the latest -release is [FLORIS v4.0](https://github.com/NREL/floris/releases/latest). +release is [FLORIS v4.0.1](https://github.com/NREL/floris/releases/latest). Online documentation is available at https://nrel.github.io/floris. The software is in active development and engagement with the development team diff --git a/floris/core/farm.py b/floris/core/farm.py index 6ab28d2a0..58b29637b 100644 --- a/floris/core/farm.py +++ b/floris/core/farm.py @@ -465,7 +465,7 @@ def coordinates(self): np.array([x, y, z]) for x, y, z in zip( self.layout_x, self.layout_y, - self.hub_heights if len(self.hub_heights.shape) == 1 else self.hub_heights[0,0] + self.hub_heights if len(self.hub_heights.shape) == 1 else self.hub_heights[0] ) ]) diff --git a/floris/core/grid.py b/floris/core/grid.py index 9076e01e2..b20ca25ce 100644 --- a/floris/core/grid.py +++ b/floris/core/grid.py @@ -317,21 +317,28 @@ def set_grid(self) -> None: ), dtype=floris_float_type ) - _x = x[:, :, :, None, None] * template_grid - _y = y[:, :, :, None, None] * template_grid - _z = z[:, :, :, None, None] * template_grid + _x = x[:, :, None, None] * template_grid + _y = y[:, :, None, None] * template_grid + _z = z[:, :, None, None] * template_grid + + n_coordinates = len(yv) + yv = np.broadcast_to(yv, (self.n_findex, self.n_turbines, n_coordinates)) + yv = np.expand_dims(yv, axis=-1) + zv = np.broadcast_to(zv, (self.n_findex, self.n_turbines, n_coordinates)) + zv = np.expand_dims(zv, axis=-1) + for ti in range(self.n_turbines): - _y[:, :, ti, :, :] += yv[None, None, :, None]*self.turbine_diameters[ti] / 2.0 - _z[:, :, ti, :, :] += zv[None, None, :, None]*self.turbine_diameters[ti] / 2.0 + _y[:, ti, :, :] += yv[:, ti] * self.turbine_diameters[ti] / 2.0 + _z[:, ti, :, :] += zv[:, ti] * self.turbine_diameters[ti] / 2.0 # Sort the turbines at each wind direction # Get the sorted indices for the x coordinates. These are the indices # to sort the turbines from upstream to downstream for all wind directions. # Also, store the indices to sort them back for when the calculation finishes. - self.sorted_indices = _x.argsort(axis=2) - self.sorted_coord_indices = x.argsort(axis=2) - self.unsorted_indices = self.sorted_indices.argsort(axis=2) + self.sorted_indices = _x.argsort(axis=1) + self.sorted_coord_indices = x.argsort(axis=1) + self.unsorted_indices = self.sorted_indices.argsort(axis=1) # Put the turbine coordinates into the final arrays in their sorted order # These are the coordinates that should be used within the internal calculations @@ -340,10 +347,6 @@ def set_grid(self) -> None: self.y_sorted = np.take_along_axis(_y, self.sorted_indices, axis=1) self.z_sorted = np.take_along_axis(_z, self.sorted_indices, axis=1) - self.x = np.take_along_axis(self.x_sorted, self.unsorted_indices, axis=1) - self.y = np.take_along_axis(self.y_sorted, self.unsorted_indices, axis=1) - self.z = np.take_along_axis(self.z_sorted, self.unsorted_indices, axis=1) - @classmethod def get_cubature_coefficients(cls, N: int): """ @@ -359,7 +362,7 @@ def get_cubature_coefficients(cls, N: int): integration coefficients, "r", "t", "q", "A" and "B". """ - if N < 1 and N < 10: + if N < 1 or N > 10: raise ValueError( f"Order of cubature integration must be between '1' and '10', given {N}." ) diff --git a/floris/version.py b/floris/version.py index b8626c4cf..1454f6ed4 100644 --- a/floris/version.py +++ b/floris/version.py @@ -1 +1 @@ -4 +4.0.1