Axial induction calculation called from the floris interface crashes
The function get_turbine_ais() in the floris interface crashes, since it is called with ref_tilt_cp_cts instead of ref_tilt_cp_cts_sorted. ref_tilt_cp_cts is a n-turbine array, ref_tilt_cp_cts_sorted is a 1 x 1 x n-turbine array.
As a result, line 432 in /simulation/turbine.py throws an error:
if ix_filter is not None:
yaw_angle = yaw_angle[:, :, ix_filter]
tilt_angle = tilt_angle[:, :, ix_filter]
ref_tilt_cp_ct = ref_tilt_cp_ct[:, :, ix_filter] # <---- ERROR
As I see it, the bug could be fixed by either changing the function get_turbine_ais() in the floris interface:
def get_turbine_ais(self) -> NDArrayFloat:
turbine_ais = axial_induction(
velocities=self.floris.flow_field.u,
yaw_angle=self.floris.farm.yaw_angles,
tilt_angle=self.floris.farm.tilt_angles,
ref_tilt_cp_ct=self.floris.farm.ref_tilt_cp_cts_sorted, # <---- CHANGE
fCt=self.floris.farm.turbine_fCts,
tilt_interp=self.floris.farm.turbine_fTilts,
correct_cp_ct_for_tilt=self.floris.farm.correct_cp_ct_for_tilt,
turbine_type_map=self.floris.farm.turbine_type_map,
average_method=self.floris.grid.average_method,
cubature_weights=self.floris.grid.cubature_weights,
)
return turbine_ais
or by modifying the way ix_filter is used in the axial_induction() function in turbine.py, but I don't know what would be the favoured approach. Additionally, it might be good to add a comment to the axial_induction() function in turbine.py to define the input structure, as it is done with the other inputs.
How to reproduce
from floris.tools import FlorisInterface
fi = FlorisInterface('*Path*/examples/inputs/gch.yaml')
fi.calculate_wake()
fi.get_turbine_ais()
Floris version
FLORIS v3.4
Axial induction calculation called from the floris interface crashes
The function
get_turbine_ais()in the floris interface crashes, since it is called withref_tilt_cp_ctsinstead ofref_tilt_cp_cts_sorted.ref_tilt_cp_ctsis a n-turbine array,ref_tilt_cp_cts_sortedis a 1 x 1 x n-turbine array.As a result, line 432 in /simulation/turbine.py throws an error:
As I see it, the bug could be fixed by either changing the function
get_turbine_ais()in the floris interface:or by modifying the way
ix_filteris used in theaxial_induction()function in turbine.py, but I don't know what would be the favoured approach. Additionally, it might be good to add a comment to theaxial_induction()function in turbine.py to define the input structure, as it is done with the other inputs.How to reproduce
Floris version
FLORIS v3.4