Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with combination of USF+ounf+short #1223

Open
ErickRogers opened this issue May 2, 2024 · 2 comments
Open

Bug with combination of USF+ounf+short #1223

ErickRogers opened this issue May 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ErickRogers
Copy link
Contributor

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

@ErickRogers ErickRogers added the bug Something isn't working label May 2, 2024
@CarstenHansen
Copy link
Contributor

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) :

WW3/model/src/ww3_ounf.F90

Lines 2956 to 2961 in 14e6bed

IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), &
MXX(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/))
call CHECK_ERR(IRET)
IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), &
MXX(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/))
call CHECK_ERR(IRET)

@ErickRogers
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants