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

Uninitialised variables VS/VD in w3srcemd #1036

Closed
ukmo-ccbunney opened this issue Jul 6, 2023 · 0 comments · Fixed by #1037
Closed

Uninitialised variables VS/VD in w3srcemd #1036

ukmo-ccbunney opened this issue Jul 6, 2023 · 0 comments · Fixed by #1037
Assignees
Labels
bug Something isn't working

Comments

@ukmo-ccbunney
Copy link
Collaborator

Describe the bug
The VS and VD variables are not being properly initialised in w3srcemd.

Unfortunately, the compiler never complains about because it looks like they are being set with values here:

WW3/model/src/w3srcemd.F90

Lines 1446 to 1448 in 3eb8161

DO IS=IS1, NSPECH
VS(IS) = VSLN(IS) + VSIN(IS) + VSNL(IS) &
+ VSDS(IS) + VSBT(IS)

However, the loop is through IS1 to NSPECH, which are not necessarily the same as 1 and NSPEC respectively.
This means there are potentially some array elements that are unilitialised

The next time that VD is used (in the PDLIB versions of ww3_tp2.21 at least) is in the source term increment loop here:

WW3/model/src/w3srcemd.F90

Lines 1562 to 1566 in 3eb8161

DO IK = 1, NK
JAC = CLATSL/CG1(IK)
DO ITH = 1, NTH
ISP = ITH + (IK-1)*NTH
VD(ISP) = MIN(0., VD(ISP))

which is looping over the whole spectrum (IK and ITH).

To Reproduce
Compiled and run ww3_tp2.21 regtests with -finit-real=snan
This initialises all real variables to signalling NaN values (which should cause a crash).

Expected behavior
Regtest should crash (it did with GNU compiler) complainig about invalid values in VD around line 1566.

@ukmo-ccbunney ukmo-ccbunney added the bug Something isn't working label Jul 6, 2023
@ukmo-ccbunney ukmo-ccbunney self-assigned this Jul 6, 2023
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

Successfully merging a pull request may close this issue.

1 participant