Potential bug when using TwoWT Surrogate - Default site TI used (v2.4.1+)
I have identified a possible bug when using the TwoWT wind turbine class in a simulation. The turbulence intensity provided to the simulation call is ignored, and the site's default intensity attribute is used. This only happens when using the 2WT class; the 1WT class does not suffer from this issue. See the code below for a MWE to reproduce this problem.
I have tested this on version 2.4.0, 2.4.1 and 2.5.0. Note that in version 2.4.0, this behaviour is not seen. There, it works as expected. Only in versions 2.4.1 and 2.5.0 this bug seems to occur. Furthermore, neither turbulence model nor wake deficit model used seem to affect the behaviour. I have also tested this with different wind site objects; all this does is change the turbulence intensity, which depends on their respective default settings.
In the code snippet below, all printed expressions should evaluate to True, indicating the user's TI input is transferred to the wind field correctly. Furthermore, the TI at the front turbine should match this input as well, as it solely has free-stream wind in front of it. You can reproduce this error on a fresh Google Colab, installing PyWake with
!pip install py_wake==2.5.0
(or 2.4.1/2.4.0) and running the snippet below. Note that for PyWake version 2.4.0, xarray needs to be downgraded using
!pip install xarray==2022.09.0
from py_wake.examples.data.iea34_130rwt._iea34_130rwt import IEA34_130_2WT_Surrogate, IEA34_130_1WT_Surrogate
from py_wake.examples.data.iea37._iea37 import IEA37Site
from py_wake.site.xrsite import UniformSite
from py_wake.deficit_models import BastankhahGaussianDeficit
from py_wake.turbulence_models import CrespoHernandez
from py_wake.wind_farm_models import PropagateDownwind
from py_wake.examples.data.hornsrev1 import Hornsrev1Site
ws = 20
ti = 0.3
# site = IEA37Site(16) # Same behaviour with default ti = 0.075
# site = UniformSite(p_wd=[1], ti=0.42, ws=12)
site = Hornsrev1Site() # Same behaviour, default ti = 0.1
x, y = [0, 200], [0, 0]
print(f'Default ti value for Site: {site.ds.TI.values}')
def check(method):
wt = IEA34_130_1WT_Surrogate() if method == 'OneWT' else IEA34_130_2WT_Surrogate()
wfm = PropagateDownwind(site,
wt,
wake_deficitModel=BastankhahGaussianDeficit(),
turbulenceModel=CrespoHernandez())
sim_res = wfm(x, y, wd=270, ws=ws, TI=ti)
# Free-stream wind TI
ti_freestream = sim_res.TI.values
# Turbine 1 (upstream), effective TI
ti_wt1 = sim_res.TI_eff[wt==0].values[0][0]
# ti_freestream should equal simulation input
print(f'[{method}] Simulation input ({ti}) equals sim_res free-stream value ({ti_freestream}): {ti == ti_freestream}')
# Similarly, effective ti at turbine 1 (upstream) should equal simulation input
print(f'[{method}] Simulation input ({ti}) equals wt1 effective ti value ({ti_wt1}): {ti == ti_wt1}')
check('OneWT') # ti is consistent
check('TwoWT') # ti reverts back to site default