Skip to content

Bug report: FLORIS 2.5 is not able to handle ngrid=1 correctly #1004

@gogannes

Description

@gogannes

FLORIS 2.5 is not able to handle ngrid=1 correctly

The ngrid option does not work correctly for ngrid=1.

I know that most people may not use 2.4 anymore, but for those who may have to use it still in some cases, this issue may help if ngrid=1 is chosen.

I believe this isn't an issue with FLORIS 4.x anymore, as the similar issue is mentioned within the comments of grid.py: "If a grid resolution of 1 is selected, create a disc_grid of zeros, as np.linspace would just return the starting value of -1 * disc_area_radius which would place the point below the center of the rotor. (turbine_grid_points)."

How to reproduce

import numpy as np
import floris.tools as wfct

for ngrid in [5, 4, 3, 2, 1]:
    fi = wfct.floris_interface.FlorisInterface("examples/example_input.json")
    fi.reinitialize_flow_field(layout_array=[[0], [0]], wind_speed=6, wind_direction=0)
    fi.change_turbine([0], {"ngrid": ngrid})
    fi.calculate_wake(no_wake=True)
    print(f"turbine power for ngrid={ngrid}: {np.array(fi.get_turbine_power())}")

Relevant output

turbine power for ngrid=5: [702300.90048392]
turbine power for ngrid=4: [701715.73960506]
turbine power for ngrid=3: [700546.00421529]
turbine power for ngrid=2: [697099.02181379]
turbine power for ngrid=1: [602547.23424941] << changing from ngrid=2 to ngrid=1 affects turbine power significantly!

How to fix

in flow_field.py, replace:

yt = np.linspace(
    x2 - pt,
    x2 + pt,
    ngrid,
)
zt = np.linspace(
    x3 - pt,
    x3 + pt,
    ngrid,
)

by

if ngrid == 1:
    yt = [x2]
    zt = [x3]
else:
    yt = np.linspace(
        x2 - pt,
        x2 + pt,
        ngrid,
    )
    zt = np.linspace(
        x3 - pt,
        x3 + pt,
        ngrid,
    )

and the output changes to

turbine power for ngrid=5: [702300.90048392]
turbine power for ngrid=4: [701715.73960506]
turbine power for ngrid=3: [700546.00421529]
turbine power for ngrid=2: [697099.02181379]
turbine power for ngrid=1: [707405.81137472] << now the power value is correct.

Floris version

2.5.1

System Information

  • OS: Windows 11 Pro
  • Python version: Python 3.9.13

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingv2.xRelated to any version of FLORIS less than v3

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