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

Reduce computation time massively in large het_map objects #1024

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions floris/core/flow_field.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

from __future__ import annotations

import copy

import attrs
import matplotlib.path as mpltPath
import numpy as np
Expand Down Expand Up @@ -290,18 +292,21 @@ def generate_heterogeneous_wind_map(self):
# Compute the 3-dimensional interpolants for each wind direction
# Linear interpolation is used for points within the user-defined area of values,
# while the freestream wind speed is used for points outside that region
in_region = [
self.interpolate_multiplier_xyz(x, y, z, multiplier, fill_value=1.0)
for multiplier in speed_multipliers
]
F = self.interpolate_multiplier_xyz(x, y, z, speed_multipliers[0], fill_value=1.0)
in_region = []
for multiplier in speed_multipliers:
F.values = multiplier[:, None]
in_region.append(copy.deepcopy(F))

else:
# Compute the 2-dimensional interpolants for each wind direction
# Linear interpolation is used for points within the user-defined area of values,
# while the freestream wind speed is used for points outside that region
in_region = [
self.interpolate_multiplier_xy(x, y, multiplier, fill_value=1.0)
for multiplier in speed_multipliers
]
self.interpolate_multiplier_xy(x, y, multiplier, fill_value=1.0)
in_region = []
for multiplier in speed_multipliers:
F.values = multiplier[:, None]
in_region.append(copy.deepcopy(F))

self.het_map = in_region

Expand Down
Loading