Skip to content

Bug: Axial induction calculation called from the floris interface crashes #664

@MarcusBecker-GitHub

Description

@MarcusBecker-GitHub

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions