From 821266c250e10d5fbddbd3326cd17d4e40d76033 Mon Sep 17 00:00:00 2001 From: misi9170 Date: Thu, 26 Sep 2024 14:34:50 -0600 Subject: [PATCH] Add test for pathos interface. --- tests/parallel_floris_model_2_unit_test.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/parallel_floris_model_2_unit_test.py b/tests/parallel_floris_model_2_unit_test.py index 9b35b2cb7..0fa261e29 100644 --- a/tests/parallel_floris_model_2_unit_test.py +++ b/tests/parallel_floris_model_2_unit_test.py @@ -63,6 +63,29 @@ def test_multiprocessing_interface(sample_inputs_fixture): assert np.allclose(f_turb_powers, pf_turb_powers) +def test_pathos_interface(sample_inputs_fixture): + """ + With interface="pathos", the ParallelFlorisModel should return the same powers + as the FlorisModel. + """ + sample_inputs_fixture.core["wake"]["model_strings"]["velocity_model"] = VELOCITY_MODEL + sample_inputs_fixture.core["wake"]["model_strings"]["deflection_model"] = DEFLECTION_MODEL + + fmodel = FlorisModel(sample_inputs_fixture.core) + pfmodel = ParallelFlorisModel( + sample_inputs_fixture.core, + interface="pathos", + n_wind_condition_splits=2 + ) + + fmodel.run() + pfmodel.run() + + f_turb_powers = fmodel.get_turbine_powers() + pf_turb_powers = pfmodel.get_turbine_powers() + + assert np.allclose(f_turb_powers, pf_turb_powers) + def test_return_turbine_powers_only(sample_inputs_fixture): """ With return_turbine_powers_only=True, the ParallelFlorisModel should return only the