Skip to content

Commit

Permalink
Add cubature grid unit test fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
rafmudaf committed Apr 19, 2024
1 parent ad41b1d commit 327559a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
FlowField,
FlowFieldGrid,
PointsGrid,
TurbineCubatureGrid,
TurbineGrid,
)

Expand Down Expand Up @@ -157,6 +158,19 @@ def turbine_grid_fixture(sample_inputs_fixture) -> TurbineGrid:
grid_resolution=TURBINE_GRID_RESOLUTION,
)

@pytest.fixture
def cubature_grid_fixture(sample_inputs_fixture) -> TurbineCubatureGrid:
turbine_coordinates = [Vec3(c) for c in list(zip(X_COORDS, Y_COORDS, Z_COORDS))]
rotor_diameters = ROTOR_DIAMETER * np.ones( (N_TURBINES) )
return TurbineCubatureGrid(
turbine_coordinates=turbine_coordinates,
reference_turbine_diameter=rotor_diameters,
wind_directions=np.array(WIND_DIRECTIONS),
wind_speeds=np.array(WIND_SPEEDS),
grid_resolution=TURBINE_GRID_RESOLUTION,
time_series=TIME_SERIES
)

@pytest.fixture
def flow_field_grid_fixture(sample_inputs_fixture) -> FlowFieldGrid:
turbine_coordinates = np.array(list(zip(X_COORDS, Y_COORDS, Z_COORDS)))
Expand Down
15 changes: 15 additions & 0 deletions tests/turbine_cubature_grid_unit_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

import numpy as np
import pytest

from floris.utilities import Vec3
from tests.conftest import (
N_TURBINES,
N_WIND_DIRECTIONS,
N_WIND_SPEEDS,
TURBINE_GRID_RESOLUTION,
)


def test_cubaturegrid(cubature_grid_fixture):
print(cubature_grid_fixture)

0 comments on commit 327559a

Please sign in to comment.