NOAA-EMC / WW3

WAVEWATCH III
Other
265 stars 542 forks source link

Bug with combination of USF+ounf+short #1223

Open ErickRogers opened 6 months ago

ErickRogers commented 6 months ago

Describe the bug When USF (Stokes spectra) is used with ounf and "short integer" option, the vertical field is just a duplicate of the horizontal field

To Reproduce

2 tar.gz files are attached.

MODELDIR=<set your path to /model/> cd $MODELDIR/../regtests ./bin/run_cmake_test -o netcdf -s PR3_UQ_NC4 -i input_usf_broken -w work_usf_broken $MODELDIR ww3_tp2.3 ./bin/run_cmake_test -o netcdf -s PR3_UQ_NC4 -i input_usf_OK -w work_usf_OK $MODELDIR ww3_tp2.3

Expected behavior I use ncview from my linux terminal, and load the ww3.196806_usf.nc file in a work_blah directory, pick uusf, and go to field number 2 (of 6), go to freq=0.11 Hz, the switch between uusf and vusf and they show up as identical in the work_usf_broken directory and different (correct) in the work_usf_OK directory.

(In hindsight, a test with wave propagating to the northeast is not the best choice for demonstrating a spurious match of U and V fields, but you can see from the work_usf_OK result that the fields are, in fact, different)

input_usf_broken.tar.gz input_usf_OK.tar.gz

If these tar files are insufficient, @ me and I'll add screenshots too.

P.S. I discussed this previously with @JessicaMeixner-NOAA

CarstenHansen commented 5 months ago

May I suggest that the bug is in the assignment of MXX (the eastward spectral variance) to both of the netcdf variables of the 2D spectrum. In the code, the second MXXshould be replaced by MYY (the northward spectral variance) : https://github.com/NOAA-EMC/WW3/blob/14e6bedfcefeff8f0896acea5dade4100a3fbacd/model/src/ww3_ounf.F90#L2956-L2961

ErickRogers commented 5 months ago

Yes, I believe you have located the cause of the problem. Nice work.