Skip to content

Commit

Permalink
Merge branch 'MHKiT-Software:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
hivanov-nrel authored Jul 1, 2024
2 parents 03ee5aa + 52f0839 commit 51ed372
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
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
2 changes: 1 addition & 1 deletion mhkit/wave/resource/jonswap_spectrum.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
if nargin == 3
S_py=py.mhkit.wave.resource.jonswap_spectrum(frequency,Tp,Hs);
elseif nargin == 4
S_py=py.mhkit.wave.resource.jonswap_spectrum(frequency,Tp,varargin{1},pyargs('gamma',varargin{1}));
S_py=py.mhkit.wave.resource.jonswap_spectrum(frequency, Tp, Hs, pyargs('gamma', varargin{1}));
end

S.spectrum=double(py.array.array('d',py.numpy.nditer(S_py.values))).';
Expand Down

0 comments on commit 51ed372

Please sign in to comment.