Skip to content

Commit

Permalink
Test: Gamma parameter of jonswap_spectrum
Browse files Browse the repository at this point in the history
  • Loading branch information
simmsa committed Jul 1, 2024
1 parent 077f525 commit f958d55
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mhkit/tests/Wave_TestResourceSpectrum.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ function test_jonswap_spectrum(testCase)
assertLessThan(testCase,errorHm0, 0.01);
assertLessThan(testCase,errorTp0, 0.01);
end

function test_jonswap_spectrum_gamma(testCase)
Obj.f = 0.1/(2*pi):0.01/(2*pi):3.5/(2*pi);
Obj.Tp = 8;
Obj.Hs = 2.5;
Obj.gamma = 2.0

S = jonswap_spectrum(Obj.f, Obj.Tp, Obj.Hs, Obj.gamma);
Hm0 = significant_wave_height(S);
Tp0 = peak_period(S);
errorHm0 = abs(Obj.Tp - Tp0)/Obj.Tp;
errorTp0 = abs(Obj.Hs - Hm0)/Obj.Hs;
assertLessThan(testCase,errorHm0, 0.01);
assertLessThan(testCase,errorTp0, 0.01);
end

function test_plot_spectrum(testCase)
Obj.f = 0.1/(2*pi):0.01/(2*pi):3.5/(2*pi);
Expand Down

0 comments on commit f958d55

Please sign in to comment.