Skip to content

Bug report: cubature interpolation does not work with CC model #709

@Bartdoekemeijer

Description

@Bartdoekemeijer

Cubature interpolation throws error for CC wake velocity deficit model

How to reproduce

Here is a minimal code that reproduces the error:

# Instantiate FLORIS using either the GCH or CC model
from floris.tools import FlorisInterface
fi = FlorisInterface("inputs/cc.yaml")

# Use turbine cubature grid for rotor interpolation
fi_dict = fi.floris.as_dict()
fi_dict["solver"] = {
    "type": "turbine_cubature_grid",
    "turbine_grid_points": 3
}
fi = FlorisInterface(fi_dict)

# Calculate wakes and retrieve turbine powers
fi.calculate_wake()
turbine_powers = fi.get_turbine_powers()
print(turbine_powers.flatten())

Relevant output

The example code above results in the following error first:

Exception has occurred: AttributeError
'TurbineCubatureGrid' object has no attribute 'x'
  File "/mnt/c/Users/Bart/python_scripts/floris/floris/simulation/grid.py", line 381, in set_grid
    self.x = np.take_along_axis(self.x_sorted, self.unsorted_indices, axis=2)

If we then remove those lines from the code (is that correct?), the example script runs fine when you replace cc.yaml with gch.yaml. With cc.yaml, we have a second error come up:

Exception has occurred: ValueError
non-broadcastable output operand with shape (1,1,1,1,1) doesn't match the broadcast shape (1,1,1,1,1,9,3)
  File "/mnt/c/Users/Bart/python_scripts/floris/floris/simulation/solver.py", line 564, in cc_solver
    effective_yaw_i += added_yaw
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

What I also found is that the velocities variable being passed into the Ct(...) function in turbine.py seems to not be the right dimensions when using the CC model.

  • With CC, the shape of velocities is (1, 1, 3),
  • With GCH, the shape of velocities is (1, 1, 1, 9, 1).

Floris version

Using the current develop branch with latest commit 8ece0f.

System Information

  • OS: Ubuntu 22.04
  • Python version: Python 3.11
  • Library versions:
    • numpy==1.24.3
    • numexpr==2.8.4
    • scipy==1.10.1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions