From c66a185881c535f800c12e64b1afb17f3500dd2e Mon Sep 17 00:00:00 2001 From: Johannes Schreiber Date: Sat, 9 Nov 2024 00:46:19 +0100 Subject: [PATCH] fix bug that ngrid=1 doesn't work correctly (#1008) --- floris/simulation/flow_field.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/floris/simulation/flow_field.py b/floris/simulation/flow_field.py index d71b6fc3c..3b679fa28 100644 --- a/floris/simulation/flow_field.py +++ b/floris/simulation/flow_field.py @@ -100,16 +100,20 @@ def _discretize_turbine_domain(self): pt = turbine.rloc * turbine.rotor_radius xt = [coord.x1 for coord in self.turbine_map.coords] - yt = np.linspace( - x2 - pt, - x2 + pt, - ngrid, - ) - zt = np.linspace( - x3 - pt, - x3 + pt, - ngrid, - ) + if ngrid == 1: + yt = [x2] + zt = [x3] + else: + yt = np.linspace( + x2 - pt, + x2 + pt, + ngrid, + ) + zt = np.linspace( + x3 - pt, + x3 + pt, + ngrid, + ) x_grid[i] = xt[i] y_grid[i] = yt