forked from NREL/floris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add parallel computing interface regression test
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
tests/reg_tests/parallel_computing_interface_regression_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
import copy | ||
|
||
import numpy as np | ||
|
||
from floris.tools import FlorisInterface, ParallelComputingInterface | ||
from tests.conftest import ( | ||
assert_results_arrays, | ||
) | ||
|
||
|
||
DEBUG = True | ||
VELOCITY_MODEL = "gauss" | ||
DEFLECTION_MODEL = "gauss" | ||
|
||
|
||
def test_parallel_turbine_powers(sample_inputs_fixture): | ||
""" | ||
The calculate_no_wake function calculates the power production of a wind farm | ||
assuming no wake losses. It does this by initializing and finalizing the | ||
floris simulation while skipping the wake calculation. The power for all wind | ||
turbines should be the same for a uniform wind condition. The chosen wake model | ||
is not important since it will not actually be used. However, it is left enabled | ||
instead of using "None" so that additional tests can be constructed here such | ||
as one with yaw activated. | ||
""" | ||
sample_inputs_fixture.floris["wake"]["model_strings"]["velocity_model"] = VELOCITY_MODEL | ||
sample_inputs_fixture.floris["wake"]["model_strings"]["deflection_model"] = DEFLECTION_MODEL | ||
|
||
fi_serial = FlorisInterface(sample_inputs_fixture.floris) | ||
fi_parallel_input = copy.deepcopy(fi_serial) | ||
fi_serial.calculate_wake() | ||
|
||
serial_turbine_powers = fi_serial.get_turbine_powers() | ||
|
||
fi_parallel = ParallelComputingInterface( | ||
fi=fi_parallel_input, | ||
max_workers=2, | ||
n_wind_condition_splits=2, | ||
interface="concurrent", | ||
print_timings=False, | ||
) | ||
|
||
parallel_turbine_powers = fi_parallel.get_turbine_powers() | ||
|
||
if DEBUG: | ||
print(serial_turbine_powers) | ||
print(parallel_turbine_powers) | ||
|
||
assert_results_arrays(parallel_turbine_powers, serial_turbine_powers) |