Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Warn users if the turbine_type is set without setting reference_wind_height #1000

Merged
merged 3 commits into from
Oct 17, 2024

Conversation

misi9170
Copy link
Collaborator

@misi9170 misi9170 commented Oct 15, 2024

Replaces #809 to address #806. When a FlorisModel is instantiated using an input wind file that has a reference_wind_height: -1, the hub height of the specified turbine model is used as the reference wind height. However, if the turbine_type is subsequently changed, the reference wind height is not updated to match. This PR adds a warning that is raised if turbine_type is set without also setting the reference_wind_height.

The following script demonstrates this update. Prior to the fix, the following code runs without raising any warnings:

from floris import FlorisModel
#from floris import UncertainFlorisModel as FlorisModel
#from floris import ParFlorisModel as FlorisModel

# Initialization uses NREL 5MW model with 90m hub height
fmodel = FlorisModel("../inputs/gch.yaml")
print(fmodel.core.flow_field.reference_wind_height)

# Changing the turbine type without specifying reference_wind_height
fmodel.set(turbine_type=["iea_15mw"]*len(fmodel.layout_x))
print(fmodel.core.flow_field.reference_wind_height)

# Changing the turbine type and specifying reference_wind_height
fmodel.set(turbine_type=["iea_15mw"]*len(fmodel.layout_x), reference_wind_height=150.2)
print(fmodel.core.flow_field.reference_wind_height)

producing

90.0
90.0
150.2

After the bugfix, the output is instead:

90.0
floris.floris_model.FlorisModel WARNING turbine_type has been changed without specifying a new reference_wind_height. reference_wind_height remains 90.00 m. Consider calling `FlorisModel.assign_hub_height_to_ref_height` to update the reference wind height to the turbine hub height.
90.0
150.2

TODO:

  • Implement warning
  • Check that warning is also raised for UncertainFlorisModel and ParFlorisModel (other warnings are also raised due to reinstantiation of the underlying fmodel_expanded with UncertainFlorisModel, but this is acceptable)
  • Add test for raising warning

@misi9170 misi9170 requested a review from paulf81 October 17, 2024 19:44
@misi9170 misi9170 merged commit ef3a64d into NREL:develop Oct 17, 2024
8 checks passed
@misi9170 misi9170 deleted the bugfix/refheight-warning branch October 17, 2024 19:59
@misi9170 misi9170 mentioned this pull request Oct 17, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants