Example #1
0
def test_fuga_downwind_vs_notebook():

    powerCtFunction = PowerCtTabular([0, 100], [0, 0], 'w',
                                     [0.850877, 0.850877])
    wt = WindTurbine(name='',
                     diameter=80,
                     hub_height=70,
                     powerCtFunction=powerCtFunction)

    path = tfp + 'fuga/2MW/Z0=0.00001000Zi=00400Zeta0=0.00E+00'
    site = UniformSite([1, 0, 0, 0], ti=0.075)
    wfm_ULT = PropagateDownwind(site, wt, FugaYawDeficit(path))
    WS = 10
    p = Path(tfp) / "fuga/v80_wake_4d_y_no_deflection.csv"
    y, notebook_deficit_4d = np.array(
        [v.split(",") for v in p.read_text().strip().split("\n")],
        dtype=float).T
    sim_res = wfm_ULT([0], [0], wd=270, ws=WS, yaw=[[[17.4493]]])
    fm = sim_res.flow_map(XYGrid(4 * wt.diameter(), y=y))
    npt.assert_allclose(fm.WS_eff.squeeze() - WS,
                        notebook_deficit_4d,
                        atol=1e-6)

    if 0:
        plt.plot(y, notebook_deficit_4d, label='Notebook deficit 4d')
        plt.plot(y, fm.WS_eff.squeeze() - WS)
        plt.show()
    plt.close('all')
Example #2
0
def test_fuga_deflection_time_series_gradient_evaluation():

    p = Path(tfp) / "fuga/v80_wake_center_x.csv"
    x, notebook_wake_center = np.array([v.split(",") for v in p.read_text().strip().split("\n")], dtype=float).T

    powerCtFunction = PowerCtTabular([0, 100], [0, 0], 'w', [0.850877, 0.850877])
    wt = WindTurbine(name='', diameter=80, hub_height=70, powerCtFunction=powerCtFunction)

    path = tfp + 'fuga/2MW/Z0=0.00001000Zi=00400Zeta0=0.00E+00'
    site = UniformSite([1, 0, 0, 0], ti=0.075)

    wfm = PropagateDownwind(
        site,
        wt,
        wake_deficitModel=FugaYawDeficit(path),
        deflectionModel=FugaDeflection(path, 'input_par')
    )

    WS = 10

    yaw_ref = np.full((10, 1), 17)
    yaw_step = np.eye(10, 10) * 1e-6 + yaw_ref
    yaw = np.concatenate([yaw_step, yaw_ref], axis=1)
    sim_res = wfm(np.arange(10) * wt.diameter() * 4, [0] * 10, yaw=yaw, wd=[270] * 11, ws=[WS] * 11, time=True)
    print(sim_res)
Example #3
0
def test_fuga_wake_center_vs_notebook():

    p = Path(tfp) / "fuga/v80_wake_center_x.csv"
    x, notebook_wake_center = np.array([v.split(",") for v in p.read_text().strip().split("\n")], dtype=float).T

    powerCtFunction = PowerCtTabular([0, 100], [0, 0], 'w', [0.850877, 0.850877])
    wt = WindTurbine(name='', diameter=80, hub_height=70, powerCtFunction=powerCtFunction)

    path = tfp + 'fuga/2MW/Z0=0.00001000Zi=00400Zeta0=0.00E+00'
    site = UniformSite([1, 0, 0, 0], ti=0.075)

    wfm = PropagateDownwind(
        site,
        wt,
        wake_deficitModel=FugaYawDeficit(path),
        deflectionModel=FugaDeflection(path, 'input_par')
    )

    WS = 10
    sim_res = wfm([0], [0], yaw=[17.4493], wd=270, ws=[WS])
    y = wfm.wake_deficitModel.mirror(wfm.wake_deficitModel.y, anti_symmetric=True)
    fm = sim_res.flow_map(XYGrid(x=x[1:], y=y[240:271]))
    fuga_wake_center = [np.interp(0, InterpolatedUnivariateSpline(ws.y, ws.values).derivative()(ws.y), ws.y)
                        for ws in fm.WS_eff.squeeze().T]

    if 0:
        plt.plot(x, notebook_wake_center, label='Notebook deflection')
        plt.plot(x[1:], fuga_wake_center)
        plt.show()
    plt.close('all')
    npt.assert_allclose(fuga_wake_center, notebook_wake_center[1:], atol=.14)
Example #4
0
 def from_case_dict(name, case_dict):
     site = UniformSite(p_wd=[1],
                        ti=case_dict['TItot'] / 0.8,
                        ws=case_dict['U0'])
     site.default_wd = np.linspace(-30, 30, 61) % 360
     windTurbines = WindTurbine(name="",
                                diameter=case_dict['D'],
                                hub_height=case_dict['zH'],
                                powerCtFunction=PowerCtFunction(
                                    input_keys=['ws'],
                                    power_ct_func=lambda ws, run_only, ct=case_dict['CT']: ws * 0 + ct,
                                    power_unit='w'))
     xD = case_dict['xDown']
     x = xD * case_dict['sDown']
     return SingleWakeValidationCase(name, site, windTurbines, xD, x)