From 0d0a5c7fba3495accdce47e7e48e386519754f80 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Jun 2026 04:05:29 +0000 Subject: [PATCH 1/2] Initial plan From b5e50bede359404e98bb858251799b3fd7fb3851 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Jun 2026 04:17:57 +0000 Subject: [PATCH 2/2] test: guard rotor turbulence scaling regression --- raft/raft_rotor.py | 2 +- tests/test_rotor.py | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/raft/raft_rotor.py b/raft/raft_rotor.py index e77eda9f..ee78ef17 100644 --- a/raft/raft_rotor.py +++ b/raft/raft_rotor.py @@ -863,7 +863,7 @@ def calcAero(self, case, current=False, display=0): # ----- Dynamic rotor forces and reaction matrices ----- # calculate rotor-averaged turbulent wind spectrum - _,_,_,S_rot = self.IECKaimal(case, current=current) # PSD [(m/s)^2/rad] + _,_,_,S_rot = self.IECKaimal(case, current=current) # PSD used directly with the model's rad/s spacing # convert from power spectral density to complex amplitudes (FFT) self.V_w = np.array(np.sqrt(2*S_rot*(self.w[1]-self.w[0])), dtype=complex) diff --git a/tests/test_rotor.py b/tests/test_rotor.py index f69255ce..f11e20ee 100644 --- a/tests/test_rotor.py +++ b/tests/test_rotor.py @@ -151,6 +151,31 @@ def test_calcAero(index_and_rotor, flagSaveValues=False): pickle.dump(output_true_values, f) # Do something similar for turbine class + +def test_calcAero_turbulence_scaling(index_and_rotor): + index, rotor = index_and_rotor + rotor.setPosition() + + if 'IEA15MW' in list_files[index]: + wind_speed = 15 + elif 'NREL5MW' in list_files[index]: + wind_speed = 15 + else: + wind_speed = 12 + + case = { + 'wind_speed': wind_speed, + 'wind_heading': 0, + 'turbulence': 0.5, + 'turbine_status': 'operating', + 'yaw_misalign': 0, + } + + rotor.calcAero(case) + _, _, _, S_rot = rotor.IECKaimal(case) + + assert_allclose(rotor.V_w, np.sqrt(2*S_rot*(rotor.w[1]-rotor.w[0]))) + ''' To run as a script. Useful for debugging. ''' @@ -159,4 +184,3 @@ def test_calcAero(index_and_rotor, flagSaveValues=False): rotor = create_rotor(list_files[index]) test_calcAero((index, rotor), flagSaveValues=False) -