Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion raft/raft_rotor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 25 additions & 1 deletion tests/test_rotor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
'''
Expand All @@ -159,4 +184,3 @@ def test_calcAero(index_and_rotor, flagSaveValues=False):

rotor = create_rotor(list_files[index])
test_calcAero((index, rotor), flagSaveValues=False)