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

W3SDB1 - potential return of unitialised values #1106

Closed
ukmo-ccbunney opened this issue Oct 20, 2023 · 1 comment · Fixed by #1115
Closed

W3SDB1 - potential return of unitialised values #1106

ukmo-ccbunney opened this issue Oct 20, 2023 · 1 comment · Fixed by #1115
Assignees
Labels
bug Something isn't working

Comments

@ukmo-ccbunney
Copy link
Collaborator

ukmo-ccbunney commented Oct 20, 2023

There is a test in the Depth Induced Breaking source term (W3SDB1) that returns immediately from the subroutine if there is zero(ish) energy:

WW3/model/src/w3sdb1md.F90

Lines 236 to 240 in 8eb3596

THR = DBLE(1.E-15)
IF (SUM(A) .LT. THR) RETURN
S = 0.
D = 0.

This is a potential source of uninitialised value errors in the model as S and D (the source and diagonal arrays) are INTENT(OUT) and not initialised prior to the potential return from the function:

REAL, INTENT(OUT) :: S(NSPEC), D(NSPEC)

The initisliastion of S and D should be moved above the return statement.

@ukmo-ccbunney ukmo-ccbunney added the bug Something isn't working label Oct 20, 2023
@ukmo-ccbunney ukmo-ccbunney self-assigned this Oct 20, 2023
@MatthewMasarik-NOAA
Copy link
Collaborator

Very nice find!

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.

2 participants