Skip to content

Fix 3/2 integer division in W3FLD1 #1431

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

Open
wants to merge 1 commit into
base: dev/ufs-weather-model
Choose a base branch
from

Conversation

NickSzapiro-NOAA
Copy link
Contributor

Pull Request Summary

Address compiler warning and bug that (x)**(3/2) is truncated to (x)**1 from integer division

Description

Fix compiler warning (and integer division bug)

.../ufs-weather-model/WW3/model/src/w3fld1md.F90:590:53:

  590 |              TLTN(ZI)**2 + TLTE(ZI)**2 ) / DAIR )**(3/2) ) &
      |                                                     1
Warning: Integer division truncated to constant '1' at (1) [-Winteger-division]
.../ufs-weather-model/WW3/model/src/w3fld1md.F90:595:53:

  595 |              TLTN(ZI)**2 + TLTE(ZI)**2 ) / DAIR )**(3/2) ) &
      |                                                     1
Warning: Integer division truncated to constant '1' at (1) [-Winteger-division]

As wind stress BC is not used in coupling, this is a bit-for-bit change in UFS GEFS regression test and presumably others as well.

For full testing and commit queue, can combine with #1423 and others

Issue(s) addressed

Part of ufs-community/ufs-weather-model#2703

Commit Message

Fix 3/2 integer division in W3FLD1

Check list

Testing

  • How were these changes tested?
  • Are the changes covered by regression tests? (If not, why? Do new tests need to be added?)
  • Have the matrix regression tests been run (if yes, please note HPC and compiler)?
  • Please indicate the expected changes in the regression test output, (Note the list of known non-identical tests.)
  • Please provide the summary output of matrix.comp (matrix.Diff.txt, matrixCompFull.txt and matrixCompSummary.txt):

**(3/2): Warning: Integer division truncated to constant '1' [-Winteger-division]
@JessicaMeixner-NOAA
Copy link
Collaborator

@NickSzapiro-NOAA I'm in support of combining this with other updates -but let me first run this through standalone WW3 testing to see impacts. Should have those tomorrow.

@JessicaMeixner-NOAA
Copy link
Collaborator

Here are the standalone diffs:

**********************************************************************
********************* non-identical cases ****************************
**********************************************************************
mww3_test_03/./work_PR3_UQ_MPI_e_c                     (1 files differ)
mww3_test_03/./work_PR2_UQ_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UNO_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UNO_MPI_d2                     (9 files differ)
mww3_test_03/./work_PR1_MPI_d2                     (15 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2_c                     (14 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c                     (17 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2                     (12 files differ)
mww3_test_03/./work_PR2_UQ_MPI_d2                     (15 files differ)
mww3_test_03/./work_PR3_UQ_MPI_e                     (1 files differ)
mww3_test_03/./work_PR3_UNO_MPI_e_c                     (1 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2                     (16 files differ)
mww3_test_09/./work_MPI_ASCII                     (0 files differ)
ww3_tp2.10/./work_MPI_OMPH                     (7 files differ)
ww3_tp2.16/./work_MPI_OMPH                     (4 files differ)
ww3_tp2.6/./work_ST4_ASCII                     (0 files differ)
ww3_ufs1.1/./work_unstr_b                     (3 files differ)
ww3_ufs1.1/./work_unstr_a                     (3 files differ)
ww3_ufs1.1/./work_unstr_c                     (3 files differ)
ww3_ufs1.3/./work_a                     (3 files differ)

Unexpected diffs include:

ww3_ufs1.1/./work_unstr_b                     (3 files differ)
ww3_ufs1.1/./work_unstr_a                     (3 files differ)
ww3_ufs1.1/./work_unstr_c                     (3 files differ)

Swich files that have FLD1 swiches are:

ww3_ts3/input/switch_ST4_PR1_FLD1:1:NOGRB SHRD PR1 FLX0 LN1 ST4 NL1 BT0 DB0 TR0 BS0 IC0 IS0 REF0 WNT1 WNX1 RWND CRT1 CRX1 MGW MGP MGG FLD1 O0 O1 O2 O3 O4 O5 O6 O7 O10 O11
ww3_ts3/input/switch_ST4_PR1_FLD1_MPI:1:NOGRB DIST MPI PR1 FLX0 LN1 ST4 NL1 BT0 DB0 TR0 BS0 IC0 IS0 REF0 WNT1 WNX1 RWND CRT1 CRX1 MGW MGP MGG FLD1 O0 O1 O2 O3 O4 O5 O6 O7 O10 O11
ww3_ufs1.1/input_unstr/switch_PDLIB:1:NCO PDLIB SCOTCH NOGRB DIST MPI PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD1 TR0 BS0 WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0 BIN2NC

This PR is small so it's at least easy to confirm that this is okay. No UFS test uses the FLD1 switch, so we will not have answer changes in UFS regression testing.

@JessicaMeixner-NOAA JessicaMeixner-NOAA self-requested a review May 19, 2025 13:45
@JessicaMeixner-NOAA
Copy link
Collaborator

@NickSzapiro-NOAA - Let's chat tomorrow when we meeting for the IAU issue about what the best strategy for getting these PRs merged or make a new meeting to quickly discuss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants