diff --git a/raft/raft_rotor.py b/raft/raft_rotor.py index e77eda9..ee78ef1 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 f69255c..f11e20e 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) -