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

Bug report: sample_flow_at_points() does not run in parallel in the ParFlorisModel #1009

Open
Bartdoekemeijer opened this issue Oct 24, 2024 · 0 comments
Labels
enhancement An improvement of an existing feature v4 Focus of FLORIS v4

Comments

@Bartdoekemeijer
Copy link
Collaborator

sample_flow_at_points() not parallelized in ParFlorisModel

The sample_flow_at_points() function runs on a single core even when evaluated on the ParFlorisModel class.

How to reproduce

Here's a simple example that should run in parallel, but doesnt:

import numpy as np
from floris import ParFlorisModel

if __name__ == "__main__":
    # Load the parallel floris model and create a 200-turbine farm
    fmodel = ParFlorisModel("inputs/gch.yaml", max_workers=8)
    fmodel.set(
        layout_x=5 * 126.0 * np.arange(200),
        layout_y=np.zeros(200),
    )

    # Cover a large grid of findices
    wd_grid, ws_grid = np.meshgrid(
        np.arange(0.0, 360.0, 3.0),
        np.arange(1.0, 30.01, 1.0)
    )
    fmodel.set(
        wind_directions=wd_grid.flatten(),
        wind_speeds=ws_grid.flatten(),
        turbulence_intensities=0.06 * np.ones_like(ws_grid.flatten()),
    )

    # Sample wind speeds at a couple of points in the flow
    wind_speeds_at_points = fmodel.sample_flow_at_points(
        x=[500.0, 750.0, 1000.0, 1250.0, 1500.0],
        y=[  0.0,   0.0,    0.0,    0.0,    0.0],
        z=[ 90.0,  90.0,   90.0,   90.0,   90.0]
    )
    print(wind_speeds_at_points)

And when using top in the terminal, I would expect multiple python instances to appear for the parallel run. They do not. This is because sample_flow_at_points() does not cycle through the normal run() command, as far as I understand.

Relevant output

The outputs of the script should remain identical, but during execution multiple python instances should appear. Also, the script should run substantially faster in parallel than in serial.

Floris version

Current develop branch, FLORIS v4.2, commit 8a2bdd0318dd60b14fb3053cf92e93c35aa56007

System Information

  • OS: Ubuntu 22.04 LTS
  • Python version: Python 3.12.6
  • Library versions
    • numpy==1.26.4
    • numexpr==2.10.1
    • scipy==1.14.1
    • pandas==2.2.3
@Bartdoekemeijer Bartdoekemeijer added enhancement An improvement of an existing feature v4 Focus of FLORIS v4 labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature v4 Focus of FLORIS v4
Projects
None yet
Development

No branches or pull requests

1 participant