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

Convert turbulence intensity from single value to n_findex length array #782

Merged
merged 106 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
5b6abad
move files around to get started
paulf81 Jan 11, 2024
b515274
move files around to get started
paulf81 Jan 11, 2024
f595720
ignore unused in __init__ files
paulf81 Jan 11, 2024
2096d9c
Consolidate wind rose and time series into one module
paulf81 Jan 12, 2024
9f94b01
Update init
paulf81 Jan 12, 2024
a9bb92c
Update tests
paulf81 Jan 12, 2024
f70c411
Add unpack functions
paulf81 Jan 12, 2024
1fbb6b5
Add grid and unpack tests
paulf81 Jan 12, 2024
1c54853
Small refactor
paulf81 Jan 12, 2024
96b477b
Add resample function
paulf81 Jan 12, 2024
d9be4ac
Test resample
paulf81 Jan 12, 2024
bd0e7f3
Add plot wind rose function
paulf81 Jan 13, 2024
c76f479
Add new wind rose usage example
paulf81 Jan 13, 2024
18a4884
Delete old code
paulf81 Jan 13, 2024
cb3a7e1
add super class to import
paulf81 Jan 13, 2024
8685b5f
Add a super class and inheritance
paulf81 Jan 13, 2024
d087abd
Add wind_data to reinitialize (also ruffing)
paulf81 Jan 13, 2024
c75c23c
Show example of reinit off wind_data objects
paulf81 Jan 13, 2024
d419e0d
Update how compute 0 freq works
paulf81 Jan 16, 2024
f6df165
Test computing all cases
paulf81 Jan 16, 2024
c819fe4
add n_findex calculation and test
paulf81 Jan 16, 2024
09bf38c
Add unpack_freq function
paulf81 Jan 16, 2024
feb0163
Get aep using wind data
paulf81 Jan 16, 2024
dc8bc80
Move unpack_for functions to super class
paulf81 Jan 16, 2024
48730a9
simplify get_farm_AEP_with_wind_data
paulf81 Jan 16, 2024
4bcea14
Add docstrings
paulf81 Jan 17, 2024
793d50a
bugfix
paulf81 Jan 17, 2024
b56a096
Finalize example
paulf81 Jan 17, 2024
6f236f4
Merge branch 'v4' into wind_rose_refactor
paulf81 Jan 17, 2024
81e00ee
Rename module file and base class
paulf81 Jan 17, 2024
6469362
Add description to example explaining plan for updates.
misi9170 Jan 17, 2024
ccdf2c5
providing unpack() on base class; renaming example.
misi9170 Jan 18, 2024
df86945
Inheritance clarified; some cleanup.
misi9170 Jan 18, 2024
2f2b15d
Remove copy()s (can point to same memory).
misi9170 Jan 18, 2024
19b647e
Small fixes throughout.
misi9170 Jan 18, 2024
efd3a95
Python back compatibility type-hinting issue.
misi9170 Jan 18, 2024
0445472
Maintain consistent formatting
rafmudaf Jan 18, 2024
bb83ead
update ti to array
paulf81 Jan 18, 2024
4fbbced
ti to array and ruff formatting
paulf81 Jan 18, 2024
84ae797
ti to array
paulf81 Jan 18, 2024
0f011d8
ti to array and ruff format
paulf81 Jan 18, 2024
390e583
ti to array and ruff format
paulf81 Jan 18, 2024
9bb615a
add ti test
paulf81 Jan 18, 2024
8493b59
Spell check
rafmudaf Jan 18, 2024
27a131c
Remove outdated comments
rafmudaf Jan 18, 2024
a6dc079
Expand docs for wind data unit tests
rafmudaf Jan 18, 2024
2e765b1
Add dimensions to doc string
paulf81 Jan 18, 2024
41af717
Add context to to_wind_rose test comments
paulf81 Jan 18, 2024
1d07c57
Add error to reinitialize
paulf81 Jan 18, 2024
689d6b0
Merge branch 'wind_rose_refactor' into wind_rose_ti_vary
paulf81 Jan 18, 2024
9573040
pluralize ti
paulf81 Jan 19, 2024
9be01c2
pluraralize ti
paulf81 Jan 19, 2024
f93ae9f
pluralize ti
paulf81 Jan 19, 2024
1fca2df
plluralize ti
paulf81 Jan 19, 2024
d81f427
pluralize ti
paulf81 Jan 19, 2024
36f6e28
pluralize ti
paulf81 Jan 19, 2024
f6a5483
Add new test of turbulence intensity
paulf81 Jan 19, 2024
2b64318
Update example 34
paulf81 Jan 19, 2024
f997f12
Update to ti array
paulf81 Jan 19, 2024
b4df579
Add example of sweeping ti
paulf81 Jan 19, 2024
3fbc294
Add tools for generating TI to windrose and timeseries
paulf81 Jan 19, 2024
594f6ab
Add example for generating TI
paulf81 Jan 19, 2024
2053c63
Explain what happens in default cases for WindRose
paulf81 Jan 20, 2024
126f4ad
Rename price to value
paulf81 Jan 20, 2024
4dba98d
Add check on ti and value
paulf81 Jan 20, 2024
6049894
Fix bin minimum
paulf81 Jan 20, 2024
6dda5e8
Merge branch 'wind_rose_refactor' into wind_rose_ti_vary
paulf81 Jan 20, 2024
cdb9875
Revert changes not connected to ti
paulf81 Jan 24, 2024
cbfb48d
Remove pure format changes
paulf81 Jan 24, 2024
20aebb9
Remove pure formatting changes
paulf81 Jan 24, 2024
557565b
Remove pure format changes
paulf81 Jan 24, 2024
853537c
Remove pure format changes
paulf81 Jan 24, 2024
404084d
dont import base
paulf81 Jan 24, 2024
ec3e8f1
Remove pure format
paulf81 Jan 24, 2024
e95b6e5
Remove pure formatting changes
paulf81 Jan 24, 2024
77328da
Remove pure formatting changes
paulf81 Jan 24, 2024
3edcfc5
Remove pure format changes
paulf81 Jan 24, 2024
3711c86
Import WindDataBase correctly
paulf81 Jan 24, 2024
69b33ff
Merge branch 'v4' into pr/paulf81/782
rafmudaf Jan 25, 2024
b313777
Add doc to examples
paulf81 Jan 25, 2024
c37d7ee
Update IEC function to include offset and default values
paulf81 Jan 25, 2024
3d08991
Update defaults
paulf81 Jan 25, 2024
3fef551
Move type error with raise output
paulf81 Jan 29, 2024
ab32696
Back to v3 style
paulf81 Jan 29, 2024
9627db1
Use None instead of np.newaxis
paulf81 Jan 29, 2024
9bae38a
Merge branch 'v4' into wind_rose_ti_vary
paulf81 Jan 29, 2024
e8eeb20
remove _v3 from input_full.yaml
paulf81 Jan 29, 2024
c2ebe42
set ti to array type input
paulf81 Jan 29, 2024
1a142a3
Add check on iter data
paulf81 Jan 29, 2024
39938ff
Set turbulence_intensities type hint to NDArrayFloat
paulf81 Jan 29, 2024
598aa81
Add a converter which can handle either scalar float or floris_array
paulf81 Jan 29, 2024
ab406b0
Add test of single ti values
paulf81 Jan 29, 2024
5316d5f
Replace newaxis with None for empty dimensions
rafmudaf Jan 30, 2024
ba9da1d
Simplify syntax
rafmudaf Jan 30, 2024
c32c097
remove unnecsarry try/catch
paulf81 Jan 30, 2024
f59ab87
minor typo fixes
ejsimley Feb 1, 2024
f1bae5d
adding more details on IEC TI method
ejsimley Feb 1, 2024
9c8c007
Change default to 0.07 for Iref
paulf81 Feb 2, 2024
0a4116f
fix trailing whitespace
paulf81 Feb 2, 2024
f2f4b1b
updating docstrings for new default Iref
ejsimley Feb 2, 2024
0bea0d5
Correct TI units in plot.
misi9170 Feb 2, 2024
68d3864
Clean up eg 35 plot.
misi9170 Feb 2, 2024
077a951
Revert legacy code
paulf81 Feb 2, 2024
2f84b5c
Simplify gate
rafmudaf Feb 2, 2024
9957892
Consolidate and test type conversion functions
rafmudaf Feb 3, 2024
5faeb1e
Add detail in comments
rafmudaf Feb 3, 2024
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
4 changes: 2 additions & 2 deletions examples/12_optimize_yaw_in_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def load_windrose():
fi_aep.reinitialize(
wind_directions=wind_directions,
wind_speeds=wind_speeds,
turbulence_intensity=0.08 # Assume 8% turbulence intensity
turbulence_intensities=[0.08], # Assume 8% turbulence intensity
)

# Pour this into a parallel computing interface
Expand Down Expand Up @@ -105,7 +105,7 @@ def load_windrose():
fi_opt.reinitialize(
wind_directions=wind_directions,
wind_speeds=wind_speeds,
turbulence_intensity=0.08 # Assume 8% turbulence intensity
turbulence_intensities=[0.08], # Assume 8% turbulence intensity
)

# Pour this into a parallel computing interface
Expand Down
4 changes: 2 additions & 2 deletions examples/19_streamlit_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
layout_y=Y,
wind_speeds=[wind_speed],
wind_directions=[wind_direction],
turbulence_intensity=turbulence_intensity
turbulence_intensities=[turbulence_intensity],
)

fi.calculate_wake(yaw_angles=yaw_angles_base)
Expand Down Expand Up @@ -168,7 +168,7 @@
layout_y=Y,
wind_speeds=[wind_speed],
wind_directions=[wind_direction],
turbulence_intensity=turbulence_intensity
turbulence_intensities=[turbulence_intensity],
)

fi.calculate_wake(yaw_angles=yaw_angles_yaw)
Expand Down
2 changes: 1 addition & 1 deletion examples/34_wind_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@


# Build the time series
time_series = TimeSeries(wd_array, ws_array) # , turbulence_intensity=ti_array)
time_series = TimeSeries(wd_array, ws_array, turbulence_intensities=ti_array)

# Now build the wind rose
wind_rose = time_series.to_wind_rose()
Expand Down
62 changes: 62 additions & 0 deletions examples/35_sweep_ti.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2024 NREL

# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# See https://floris.readthedocs.io for documentation

import matplotlib.pyplot as plt
import numpy as np

from floris.tools import (
FlorisInterface,
TimeSeries,
WindRose,
)
from floris.utilities import wrap_360


"""
Demonstrate the new behavior in V4 where TI is an array rather than a float.
Set up an array of two turbines and sweep TI while holding wd/ws constant.
Use the TimeSeries object to drive the FLORIS calculations.
"""


# Generate a random time series of wind speeds, wind directions and turbulence intensities
N = 50
wd_array = 270.0 * np.ones(N)
ws_array = 8.0 * np.ones(N)
ti_array = np.linspace(0.03, 0.2, N)


# Build the time series
time_series = TimeSeries(wd_array, ws_array, turbulence_intensities=ti_array)


# Now set up a FLORIS model and initialize it using the time
fi = FlorisInterface("inputs/gch.yaml")
fi.reinitialize(layout_x=[0, 500.0], layout_y=[0.0, 0.0], wind_data=time_series)
fi.calculate_wake()
turbine_power = fi.get_turbine_powers()

fig, axarr = plt.subplots(2, 1, sharex=True, figsize=(6, 6))
ax = axarr[0]
ax.plot(ti_array*100, turbine_power[:, 0]/1000, color="k")
ax.set_ylabel("Front turbine power [kW]")
ax = axarr[1]
ax.plot(ti_array*100, turbine_power[:, 1]/1000, color="k")
ax.set_ylabel("Rear turbine power [kW]")
ax.set_xlabel("Turbulence intensity [%]")

for ax in axarr:
ax.grid(True)

plt.show()
82 changes: 82 additions & 0 deletions examples/36_generate_ti.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Copyright 2024 NREL

# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# See https://floris.readthedocs.io for documentation

import matplotlib.pyplot as plt
import numpy as np

from floris.tools import (
FlorisInterface,
TimeSeries,
WindRose,
)
from floris.utilities import wrap_360


"""
Demonstrate usage of TI generating and plotting functionality in the WindRose
and TimeSeries classes
"""


# Generate a random time series of wind speeds, wind directions and turbulence intensities
wind_directions = np.array([250, 260, 270])
wind_speeds = np.array([5, 6, 7, 8, 9, 10])

# Declare a WindRose object
wind_rose = WindRose(wind_directions=wind_directions, wind_speeds=wind_speeds)


# Define a custom function where TI = 1 / wind_speed
def custom_ti_func(wind_directions, wind_speeds):
return 1 / wind_speeds


wind_rose.assign_ti_using_wd_ws_function(custom_ti_func)

fig, ax = plt.subplots()
wind_rose.plot_ti_over_ws(ax)
ax.set_title("Turbulence Intensity defined by custom function")

# Now use the normal turbulence model approach from the IEC 61400-1 standard,
# wherein TI is defined as a function of wind speed:
# Iref is defined as the TI value at 15 m/s. Note that Iref = 0.07 is lower
# than the values of Iref used in the IEC standard, but produces TI values more
# in line with those typically used in FLORIS (TI=8.6% at 8 m/s).
Iref = 0.07
wind_rose.assign_ti_using_IEC_method(Iref)
fig, ax = plt.subplots()
wind_rose.plot_ti_over_ws(ax)
ax.set_title(f"Turbulence Intensity defined by Iref = {Iref:0.2}")


# Demonstrate equivalent usage in time series
N = 100
wind_directions = 270 * np.ones(N)
wind_speeds = np.linspace(5, 15, N)
time_series = TimeSeries(wind_directions=wind_directions, wind_speeds=wind_speeds)
time_series.assign_ti_using_IEC_method(Iref=Iref)

fig, axarr = plt.subplots(2, 1, sharex=True, figsize=(7, 8))
ax = axarr[0]
ax.plot(wind_speeds)
ax.set_ylabel("Wind Speeds (m/s)")
ax.grid(True)
ax = axarr[1]
ax.plot(time_series.turbulence_intensities)
ax.set_ylabel("Turbulence Intensity (-)")
ax.grid(True)
fig.suptitle("Generating TI in TimeSeries")


plt.show()
3 changes: 2 additions & 1 deletion examples/inputs/cc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ farm:
flow_field:
air_density: 1.225
reference_wind_height: -1 # -1 is code for use the hub height
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs/emgauss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ farm:
flow_field:
air_density: 1.225
reference_wind_height: -1 # -1 is code for use the hub height
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs/gch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ flow_field:

###
# The level of turbulence intensity level in the wind.
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only change so far to the floris input files from v3 to v4 (that turbulence_intensity, a scalar, changes to turbulence_intensities, a list). When running the new code with an v3 input file, the generic error gets raised:

AttributeError: The initialization for FlowField was given extraneous inputs: ['turbulence_intensity']

Is that OK, or do we need either a converter to convert v3 models to v4 (similar to what we now have for v3-style turbine models) or a more explicit explanation of the change in the error raised?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both sound good to me, we could add a specific error for when turbulence_intensity is provided, and maybe (with a seperate issue) prepare a converter?


###
# The wind directions to include in the simulation.
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs/gch_heterogeneous_inflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ flow_field:
- -300.
- 300.
reference_wind_height: -1
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs/gch_multi_dim_cp_ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ flow_field:
Hs: 3.01
air_density: 1.225
reference_wind_height: -1 # -1 is code for use the hub height
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs/gch_multiple_turbine_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ farm:
flow_field:
air_density: 1.225
reference_wind_height: 90.0 # Since multiple defined turbines, must specify explicitly the reference wind height
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs/jensen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ farm:
flow_field:
air_density: 1.225
reference_wind_height: -1 # -1 is code for use the hub height
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs/turbopark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ farm:
flow_field:
air_density: 1.225
reference_wind_height: 90.0
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs_floating/emgauss_fixed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ farm:
flow_field:
air_density: 1.225
reference_wind_height: -1 # -1 is code for use the hub height
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs_floating/emgauss_floating.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ farm:
flow_field:
air_density: 1.225
reference_wind_height: -1 # -1 is code for use the hub height
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs_floating/emgauss_floating_fixedtilt15.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ farm:
flow_field:
air_density: 1.225
reference_wind_height: -1 # -1 is code for use the hub height
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs_floating/emgauss_floating_fixedtilt5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ farm:
flow_field:
air_density: 1.225
reference_wind_height: -1 # -1 is code for use the hub height
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs_floating/gch_fixed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ farm:
flow_field:
air_density: 1.225
reference_wind_height: -1
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs_floating/gch_floating.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ farm:
flow_field:
air_density: 1.225
reference_wind_height: -1
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
3 changes: 2 additions & 1 deletion examples/inputs_floating/gch_floating_defined_floating.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ farm:
flow_field:
air_density: 1.225
reference_wind_height: -1
turbulence_intensity: 0.06
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
Expand Down
30 changes: 22 additions & 8 deletions floris/simulation/flow_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FlowField(BaseClass):
wind_veer: float = field(converter=float)
wind_shear: float = field(converter=float)
air_density: float = field(converter=float)
turbulence_intensity: float = field(converter=float)
turbulence_intensities: NDArrayFloat = field(converter=floris_array_converter)
reference_wind_height: float = field(converter=float)
time_series: bool = field(default=False)
heterogenous_inflow_config: dict = field(default=None)
Expand All @@ -66,6 +66,17 @@ class FlowField(BaseClass):
init=False, factory=lambda: np.array([])
)

@turbulence_intensities.validator
def turbulence_intensities_validator(
self, instance: attrs.Attribute, value: NDArrayFloat
) -> None:

# Check the turbulence intensity is either length 1 or n_findex
if len(value) != 1 and len(value) != self.n_findex:
raise ValueError("turbulence_intensities should either be length 1 or n_findex")



@wind_directions.validator
def wind_directions_validator(self, instance: attrs.Attribute, value: NDArrayFloat) -> None:
"""Using the validator method to keep the `n_findex` attribute up to date."""
Expand Down Expand Up @@ -108,6 +119,10 @@ def __attrs_post_init__(self) -> None:
if self.heterogenous_inflow_config is not None:
self.generate_heterogeneous_wind_map()

# If turbulence_intensity is length 1, then convert it to a uniform array of
# length n_findex
if len(self.turbulence_intensities) == 1:
self.turbulence_intensities = self.turbulence_intensities[0] * np.ones(self.n_findex)

def initialize_velocity_field(self, grid: Grid) -> None:

Expand Down Expand Up @@ -197,14 +212,13 @@ def initialize_velocity_field(self, grid: Grid) -> None:
self.v_sorted = self.v_initial_sorted.copy()
self.w_sorted = self.w_initial_sorted.copy()

self.turbulence_intensity_field = self.turbulence_intensity * np.ones(
(
self.n_findex,
grid.n_turbines,
1,
1,
)
self.turbulence_intensity_field = self.turbulence_intensities[:, None, None, None]
self.turbulence_intensity_field = np.repeat(
self.turbulence_intensity_field,
grid.n_turbines,
axis=1
)

self.turbulence_intensity_field_sorted = self.turbulence_intensity_field.copy()

def finalize(self, unsorted_indices):
Expand Down
Loading
Loading