MHKiT-MATLAB icon indicating copy to clipboard operation
MHKiT-MATLAB copied to clipboard

jonswap_spectrum bug

Open ckberinger opened this issue 1 year ago • 1 comments

Hello,

I found a bug in the jonswap_spectrum code for MHKiT Matlab. The elseif nargin == 4 line has the gamma value placed into the Hs and gamma part of the function. This causes incorrect formulation of the Jonswap function. The correct code is below as the Hs needs to be in the Hs spot of the python function. The gamma value should only change the peakiness of the spectrum, this can be easily seen when plotting the spectrum.

elseif nargin == 4
        S_py=py.mhkit.wave.resource.jonswap_spectrum(frequency,Tp,Hs,pyargs('gamma',varargin{1}));

Cheers, Courtney

ckberinger avatar May 10 '24 19:05 ckberinger

@ckberinger, thank you for reporting this! I can reproduce this issue and have submitted #133 to test for and fix this bug. I will follow up with you after we review #133.

simmsa avatar May 10 '24 20:05 simmsa

Hi @ckberinger, we believe fixed this in #136, and merged this fix into the v0.5.0 release yesterday. Let us know if this fixes your specific issue with the jonswap_spectrum function.

One sidenote, this issue helped us troubleshoot an another issue with the WDRT additions included in the latest release that was caused by this bug. Thank you for reporting this!

simmsa avatar Jul 10 '24 17:07 simmsa

Hey @simmsa this looks great! I am glad it was able to help with another issue!

ckberinger avatar Jul 15 '24 16:07 ckberinger

It is great to have your help! I am going to close this.

simmsa avatar Jul 18 '24 21:07 simmsa