Exemplo n.º 1
0
    def plot_deflection_grid(self, normalize_with=1, ax=None):
        assert self.windFarmModel.deflectionModel is not None
        assert len(self.simulationResult.wt) == 1
        assert len(self.simulationResult.ws) == 1
        assert len(self.simulationResult.wd) == 1
        x, y = self.x, self.y
        y = y[::len(y) // 10]

        X, Y = np.meshgrid(x, y)

        from py_wake.utils.model_utils import get_model_input
        kwargs = get_model_input(self.windFarmModel,
                                 X.flatten(),
                                 Y.flatten(),
                                 ws=self.ws,
                                 wd=self.wd,
                                 yaw_ilk=self.simulationResult.Yaw.ilk())
        dw, hcw, dh = self.windFarmModel.deflectionModel.calc_deflection(
            **kwargs)
        Yp = -hcw[0, :, 0, 0].reshape(X.shape)
        ax = ax or plt.gca()
        X, Y, Yp = [v / normalize_with for v in [X, Y, Yp]]
        # ax.plot(X[255, :], Y[255, :], 'grey', lw=3)
        for x, y, yp in zip(X, Y, Yp):
            ax.plot(x, y, 'grey', lw=1, zorder=-32)
            ax.plot(x, yp, 'k', lw=1)
Exemplo n.º 2
0
def test_get_model_input():
    site, windTurbines = IEA37Site(16), IEA37_WindTurbines()
    wfm = IEA37SimpleBastankhahGaussian(site, windTurbines)
    args = get_model_input(wfm, [1000], [0], ws=10, wd=270)
    npt.assert_array_almost_equal(args['dw_ijl'], [[[1000]]])
    npt.assert_array_almost_equal(args['hcw_ijl'], [[[0]]])
    npt.assert_array_almost_equal(args['dh_ijl'], [[[0]]])
    npt.assert_array_almost_equal(args['yaw_ilk'], [[[0]]])
    npt.assert_array_almost_equal(args['WS_ilk'], [[[10]]])
    npt.assert_array_almost_equal(args['ct_ilk'], [[[8 / 9]]])