Skip to content

Commit

Permalink
Added tests for QTFs computed with RAFT and for MCF
Browse files Browse the repository at this point in the history
- Added `test_calcQTF_slenderBody` in `test_fowt.py` that checks the QTFs computed with RAFT
- Modified tests/VolturnUS-S.yaml to compute the QTFs using the slender-body approximation and to use the MCF correction
- Besides the new QTF test, this commit affects the true values of test_analyzeCases (in test_model.py) and test_hydroExcitation (in test_fowt.py) for the test case VolturnUS-S.yaml. This is because the MCF correction affects the first-order loads and the second-order loads affect the response of the FOWT
  • Loading branch information
lucas-carmo committed Nov 8, 2024
1 parent 930cfb9 commit 872ab5d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_data/VolturnUS-S.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,11 @@ platform:

dlsMax : 5.0 # maximum node splitting section amount for platform members; can't be 0
potModMaster : 1
potSecOrder : 1 # [int] master switch for computing second-order wave forces; 0=do not compute, 1=compute QTFs using slender body approximation, 2=read QTF file in WAMIT format (.11d or .12d)
min_freq2nd : 0.040 # [Hz] minimum frequency for second-order wave forces
df_freq2nd : 0.008 # [Hz] frequency step for second-order wave forces
max_freq2nd : 0.200 # [Hz] maximum frequency for second-order wave forces


members: # list all members here

Expand All @@ -1092,6 +1097,7 @@ platform:
shape : circ # [-] circular or rectangular
gamma : 0.0 # [deg] twist angle about the member's z-axis
potMod : False # [bool] Whether to model the member with potential flow (BEM model) plus viscous drag or purely strip theory
MCF : True
# --- outer shell including hydro---
stations : [0, 1] # [-] location of stations along axis. Will be normalized such that start value maps to rA and end value to rB
d : 9.85 # [m] diameters if circular or side lengths if rectangular (can be pairs)
Expand All @@ -1115,6 +1121,7 @@ platform:
shape : circ # [-] circular or rectangular
gamma : 0.0 # [deg] twist angle about the member's z-axis
potMod : False # [bool] Whether to model the member with potential flow (BEM model) plus viscous drag or purely strip theory
MCF : True
# --- outer shell including hydro---
stations : [0, 35] # [-] location of stations along axis. Will be normalized such that start value maps to rA and end value to rB
d : 12.23 # [m] diameters if circular or side lengths if rectangular (can be pairs)
Expand Down
Binary file modified tests/test_data/VolturnUS-S_true_analyzeCases.pkl
Binary file not shown.
Binary file not shown.
Binary file modified tests/test_data/VolturnUS-S_true_hydroExcitation.pkl
Binary file not shown.
29 changes: 29 additions & 0 deletions tests/test_fowt.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,32 @@ def test_calcCurrentLoads(index_and_fowt):

assert_allclose(D, desired_current_drag[index], rtol=1e-05, atol=1e-3)

def test_calcQTF_slenderBody(index_and_fowt, flagSaveValues=False):
# Set flagSaveValues to true to replace the true values file with the values calculated below
index, fowt = index_and_fowt

if fowt.potSecOrder: # Check only cases that compute the QTFs
true_values_file = list_files[index].replace('.yaml', '_true_calcQTF_slenderBody.pkl')

testCase = {'wave_heading': 30, 'wave_period': 12, 'wave_height': 6} # Testing one case only
fowt.calcHydroConstants() # Need to call this one before calcHydroExcitation
fowt.calcHydroExcitation(testCase, memberList=fowt.memberList) # Need to call this one before calcQTF_slenderBody
fowt.calcQTF_slenderBody(0) # Testing for the body considered to be fixed. Model class should take care of cases with motion

if flagSaveValues:
true_values={
'case': testCase,
'qtf': fowt.qtf,
}
else:
with open(true_values_file, 'rb') as f:
true_values = pickle.load(f)
assert_allclose(fowt.qtf, true_values['qtf'], rtol=1e-05, atol=1e-3)

if flagSaveValues:
with open(true_values_file, 'wb') as f:
pickle.dump(true_values, f)


'''
To run as a script. Useful for debugging.
Expand All @@ -305,3 +331,6 @@ def test_calcCurrentLoads(index_and_fowt):
fowt = create_fowt(list_files[index])
test_calcCurrentLoads((index,fowt))

fowt = create_fowt(list_files[index])
test_calcQTF_slenderBody((index,fowt))

0 comments on commit 872ab5d

Please sign in to comment.