question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Repeated calls to calculate wake can result in wrong wake calculations

See original GitHub issue

Bug description When placed in a for loop with certain turbine layouts, calculate_wake does not return the expected values. Note: this can currently be avoided by calling fi.reinitialize() before each repeated calculate wake call, but that adds unnecessary computation.

To Reproduce Steps to reproduce the behavior:

  1. Run the below code in the examples folder of FLORIS.
  2. See the error in the displayed plot, where the total farm power varies with each calculate wake call.
import matplotlib.pyplot as plt
from floris.tools import FlorisInterface
import numpy as np


fi = FlorisInterface("inputs/gch.yaml")

D = fi.floris.farm.rotor_diameters[0][0][0]
layout_x = np.array([0.0, 5.0*D, 10.0*D, 0.0, 5.0*D, 10.0*D])
layout_y = np.array([0.0, 0.0, 0.0, 5.0*D, 5.0*D, 5.0*D])
fi.reinitialize(layout=(layout_x,layout_y))

n = 10
wf_pow = np.zeros(n)
for k in range(n):
    fi.calculate_wake()
    wf_pow[k] = fi.get_farm_power()

plt.figure(1)
plt.plot(wf_pow)
plt.xlabel("calculate wake call #")
plt.ylabel("farm power")
plt.show()

image

Expected behavior Expected behavior would be that calculate wake would return the same power with repeated calls where no inputs have changed (example shown below).

image

Floris Version Release v3.0.1

System Information (please complete the following information):

  • OS: Ubuntu 20.04
  • Library versions
    • matplotlib - 3.5.1
    • numpy - 1.22.1
    • pytest - 6.2.5
    • scipy - 1.7.3
    • pandas - 1.4.0

Additional details This is do to the current inclusion of the finalize call within the solve wrapper, which unsorts the turbines. The turbines are then not re-sorted from upstream to downstream (which occurs in the initialization step) before the next calculate wake call, which results in incorrect wake calculations.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
bayccommented, Apr 1, 2022

One design intent of the v3 architecture was to consider each calculation a unique process that begins and ends. This was the idea with creating a new Floris object in FlorisInterface.reinitialize() instead of making changes to the Floris data directly. However, this change in functionality violates that idea since now we are expecting that each calculation will retain data from a previous calculation. Without considering performance, this would be resolved by doing the sort / unsort every time we execute FlorisInterface.calculate_wake(), like @bayc mentioned in the original post. Practically, though, do we have a guess at the performance impact of that in a realistic use case?

I don’t have an idea of performance, but that is an interesting thought, and would be like how we did the calculations in v2, sorting each time.

1reaction
bayccommented, Apr 1, 2022

Just so I understand the problem a bit more, what’s the scenario for repeatedly calling FlorisInterface.calculate_wake() without changing anything (i.e. without FlorisInterface.reinitialize())? One might be to compare with and without yaw control.

This is an issue in yaw optimizations that don’t need to call FlorisInterface.reinitialize() where they are just updating yaw angles and not turbine positions or wind conditions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are Wake Frequency Calculations for Thermowells?
A proper wake frequency calculation formula will ensure the thermowell will work correctly for your application.
Read more >
Am I the only one who wakes up doing all sorts of calculations?
He will wake me up in the middle of the night and spout out math equations, asking if the answer he's calculated in...
Read more >
What is a Thermowell Wake Frequency Calculation?
Calculating thermowell wake frequency can help. In this article, I will explain what thermowell wake frequency is and how to calculate it.
Read more >
Thermowell Wake Frequency calculation "MISTAKE" everyone ...
The Thermowell Wake frequency calculations predominantly use ASME PTC 19.3 standards.ASME PTC 19.3 standards are one of the most respected ...
Read more >
Wake-up call: Sleep deprivation can lead to workplace mistakes
How many of them aren't getting enough sleep—and making avoidable errors in their calculations? For your employees, sleep shouldn't be viewed as downtime...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found