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

Initialise VD and VS in w3srcemd #1037

Merged

Conversation

ukmo-ccbunney
Copy link
Collaborator

@ukmo-ccbunney ukmo-ccbunney commented Jul 6, 2023

Pull Request Summary

Source term variables VD and VS were not being properly initialised to zero before use in w3srcemd.

Description

It was noted recently that some of the ww3_t2.21 regression tests were not bit-for-bit anymore.
After running in debug mode with -finit-real=snan compiler flag (to initialise all real variables with signalling NaN values), it was possible to track down a possible culprit in the w3srcemd module.

The VD and VS variables are not properly intialised prior to them being used.

This is unfortunately not caught by the compiler as a warning as it looks like they are being set in a loop.
Unfortunately, the loops bounds are not always covering the full dimensionality of VS/VD leaving some bins unitialised.

See #1036 and discussion here for details:
#1030 (comment)

Issue(s) addressed

Commit Message

Initialise VD and VS in w3srcemd

Check list

Testing

  • How were these changes tested? Regtests against self (for self-consistency) and against develop.
  • Are the changes covered by regression tests? (If not, why? Do new tests need to be added?) Yes
  • Have the matrix regression tests been run (if yes, please note HPC and compiler)? Cray XC, GNU Fortran
  • Please indicate the expected changes in the regression test output: Potential for small changes across all regtests due to proper initialisation of the primary source/diagonal term arrays.
  • Please provide the summary output of matrix.comp (matrix.Diff.txt, matrixCompFull.txt and matrixCompSummary.txt): See results in discussion below

@ukmo-ccbunney ukmo-ccbunney self-assigned this Jul 6, 2023
@ukmo-ccbunney ukmo-ccbunney added the bug Something isn't working label Jul 6, 2023
@ukmo-ccbunney
Copy link
Collaborator Author

Here are the regression test outputs from testing this branch against itself (tests self consistency)

**********************************************************************
********************* non-identical cases ****************************
**********************************************************************
mww3_test_02/./work_PR3_UQ_MPI_c_c        (3 files differ)      [log.mww3/outer/tiny sometimes
mww3_test_02/./work_PR3_UNO_MPI_c_c       (1 files differ)      [ "   " ]
mww3_test_03/./work_PR3_UQ_MPI_d2         (16 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c       (16 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2        (18 files differ)
mww3_test_03/./work_PR1_MPI_e             (1 files differ)
mww3_test_03/./work_PR1_MPI_d2            (25 files differ)
mww3_test_03/./work_PR2_UNO_MPI_d2        (15 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2_c      (17 files differ)
mww3_test_03/./work_PR2_UQ_MPI_d2         (17 files differ)
ww3_tp2.15/./work_PR3_UQ_RHO              (0 files differ)     [ww3_prnc.out not in compare dir]
ww3_tp2.15/./work_PR3_UQ_RHO_MPI          (0 files differ)     [ww3_prnc.out not in compare dir]
ww3_tp2.15/./work_ST4FLX5                 (0 files differ)     [ww3_prnc.out not in compare dir]
ww3_tp2.15/./work_ST6FLX5                 (0 files differ)      [ww3_prnc.out not in compare dir]

I am running the regression tests against develop now - will post results when they are ready.

@ukmo-ccbunney
Copy link
Collaborator Author

ukmo-ccbunney commented Jul 6, 2023

Results of regtests compared to develop

**********************************************************************
********************* non-identical cases ****************************
**********************************************************************
mww3_test_02/./work_PR3_UQ_MPI_c_c       (2 files differ)   [sometimes one of the log.* files is blank]
mww3_test_03/./work_PR3_UQ_MPI_d2        (16 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c      (17 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2       (17 files differ) 
mww3_test_03/./work_PR1_MPI_e            (1 files differ)
mww3_test_03/./work_PR1_MPI_d2           (22 files differ)
mww3_test_03/./work_PR2_UNO_MPI_d2       (12 files differ) 
mww3_test_03/./work_PR3_UNO_MPI_d2_c     (18 files differ)
mww3_test_03/./work_PR2_UQ_MPI_d2        (17 files differ)
mww3_test_03/./work_PR2_UNO_MPI_e        (1 files differ)
ww3_tp2.15/./work_PR3_UQ_RHO             (0 files differ)  [ww3_prnc.out not in compare directory]
ww3_tp2.15/./work_PR3_UQ_RHO_MPI         (0 files differ)  [ww3_prnc.out not in compare directory]
ww3_tp2.15/./work_ST4FLX5                (0 files differ)  [ww3_prnc.out not in compare directory]
ww3_tp2.15/./work_ST6FLX5                (0 files differ)  [ww3_prnc.out not in compare directory]
ww3_tp2.21/./work_b_metis                (6 files differ)  [expected change]

Only ww3_tp2.21/work_b_metis is showing a change compared to develop which is slightly surprising. I did expect to see more differences.

@JessicaMeixner-NOAA
Copy link
Collaborator

Results from orion:

**********************************************************************
********************* non-identical cases ****************************
**********************************************************************
mww3_test_03/./work_PR1_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UNO_MPI_d2                     (16 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2                     (15 files differ)
mww3_test_03/./work_PR3_UNO_MPI_e                     (1 files differ)
mww3_test_03/./work_PR3_UQ_MPI_e                     (1 files differ)
mww3_test_03/./work_PR1_MPI_d2                     (14 files differ)
mww3_test_03/./work_PR2_UQ_MPI_d2                     (14 files differ)
mww3_test_03/./work_PR3_UQ_MPI_e_c                     (1 files differ)
mww3_test_03/./work_PR3_UNO_MPI_e_c                     (1 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2                     (14 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c                     (16 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2_c                     (13 files differ)
ww3_tp2.10/./work_MPI_OMPH                     (7 files differ)
ww3_tp2.16/./work_MPI_OMPH                     (4 files differ)
ww3_tp2.21/./work_mb                     (7 files differ)
ww3_tp2.21/./work_b                     (6 files differ)
ww3_tp2.21/./work_b_metis                     (6 files differ)
ww3_ufs1.1/./work_unstr_c                     (3 files differ)
ww3_ufs1.3/./work_a                     (3 files differ)

Results from hera:

**********************************************************************
********************* non-identical cases ****************************
**********************************************************************
mww3_test_03/./work_PR1_MPI_e                     (1 files differ)
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_d2                     (10 files differ)
mww3_test_03/./work_PR1_MPI_d2                     (13 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2_c                     (13 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c                     (13 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2                     (16 files differ)
mww3_test_03/./work_PR2_UQ_MPI_d2                     (13 files differ)
mww3_test_03/./work_PR3_UQ_MPI_e                     (1 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2                     (16 files differ)
ww3_tp2.10/./work_MPI_OMPH                     (6 files differ)
ww3_tp2.16/./work_MPI_OMPH                     (4 files differ)
ww3_tp2.21/./work_b_metis                     (6 files differ)
ww3_tp2.21/./work_mb                     (7 files differ)
ww3_tp2.21/./work_b                     (6 files differ)
ww3_ufs1.1/./work_unstr_c                     (3 files differ)
ww3_ufs1.3/./work_a                     (3 files differ)

Full logs from hera:
matrixCompFull.txt
matrixCompSummary.txt
(diff too big)

I'll run the self-consistency test now. Sorry I forgot to start that yesterday. This should be merged by the end of the day though.

  • Another note: I did run the regression tests for the ufs-weather-model on orion with this branch merged into dev/ufs-weather-model and all tests passed there.

@JessicaMeixner-NOAA
Copy link
Collaborator

The self-consistency tests were as expected.

@JessicaMeixner-NOAA JessicaMeixner-NOAA merged commit 17a4e32 into NOAA-EMC:develop Jul 7, 2023
2 of 4 checks passed
@JessicaMeixner-NOAA JessicaMeixner-NOAA mentioned this pull request Sep 29, 2023
4 tasks
miguelsolanocordoba added a commit to wavespotter/WW3 that referenced this pull request Apr 19, 2024
* Bugfix - initialised VD and VS to zero in w3srcemd. (NOAA-EMC#1037)

* More efficient test for binary files in matrix.comp (NOAA-EMC#1035)

* Tidy up of pre-processor directives and unused variables in w3srcemd.F90 (NOAA-EMC#1010)

* Correct typo in w3srcemd.F90 pre-processor directive. (NOAA-EMC#1039)

* minor bugfix for matrix grepping on keywords (NOAA-EMC#1049)

* Stop masking group 1 output where icec > icen (NOAA-EMC#1019)

* Doxygen documentation added, 8th subset.(NOAA-EMC#1046)

* NC4 ,F90 ,XX0 switches removed from ww3_tp2.19 regtest (NOAA-EMC#1054)

* CI:  Fix for Intel scripts. GNU scripts updated. (NOAA-EMC#1064)

* correct the computation of QP parameter, add QKK output parameter, change UST scale factor (NOAA-EMC#1050)

* correct issue with ww3_multi when requesting restart2 and using nml file instead of inp file (NOAA-EMC#1070)

* correct calendar for track netcdf output (NOAA-EMC#1079)

* Fix missing mod_def.ww3 file in multigrid regression tests for track output (NOAA-EMC#1091)

* STAB3: fix cmake build for ST4 or ST3 (NOAA-EMC#1086)

* new feature to output out_grd.ww3, out_pnt.ww3 and mod_def.ww3 both in binary and ascii format using switch ASCII. (NOAA-EMC#1089)

* Update local unit number arrays (NDS, MDS) to be same size of array defined in w3odatmd (size=15). Also, defined unit numbers for NDS(14) and NDS(15). (NOAA-EMC#1098)

* Removed code referencing PHIOC in output section for PHICE in ww3_ounf (NOAA-EMC#1093)

* implementation of the GQM (Gaussian Quadrature Method) to replace the DIA in NL1 or NL2. (NOAA-EMC#1083)

* update logic to ensure you are not accessing uninitialized dates (NOAA-EMC#1114)

* Initialised S and D arrays in W3SDB1 before potential early return if zero energy. (NOAA-EMC#1115)

* ww3_ounp.F90:  x/y units attribute corrected from 'm' to 'km' (NOAA-EMC#1088)

* Bugfix: Assign unit numbers to ASCII gridded/point output in multi-grid mode. (NOAA-EMC#1118)

* correct bugs to run correctly GQM implementation (NOAA-EMC#1127)

* Adding documentation to w3iopo() in preparation for code for NOAA-EMC#682. (NOAA-EMC#1131)

* NCEP regtest module updates: uses spack-stack/1.5.0, includes scotch/7.0.4 (NOAA-EMC#1137)

* Minor update to ncep regtests (NOAA-EMC#1138)

* Updated intel workflow to install oneapi compilers from new location. (NOAA-EMC#1157)

* Add unit test for points I/O code. (NOAA-EMC#1158)

* Update Intel CI (relocate /usr/local; ensure intel-oneapi-mpi; use ubuntu-latest) (NOAA-EMC#1161)

* remove lookup table for ST4 to speed up computation and clean up the ST4 code (NOAA-EMC#1124)

Co-authored-by: Fabrice Ardhuin <[email protected]>

* initialize USSP_WN for mod_def (NOAA-EMC#1165)

* Introduce IC4M8 and IC4M9 to WW3 (NOAA-EMC#1176)

* clean up and add ST4 variables (NOAA-EMC#1181)

* w3fld1md.F90: fix divide by zero in CRIT2 parameter (NOAA-EMC#1184)

* ww3_prnc.F90: fix out-of-scope grid index write statement (NOAA-EMC#1185)

* Bugfix: address potential divide-by-zero in APPENDTAIL (NOAA-EMC#1188)

Co-authored-by: Denise Worthen <[email protected]>

* Provide initial drying of cells with depth < ZLIM for SMC grid. (NOAA-EMC#1192)

* Output OMP threading info to screen when running ww3_shel/ww3_multi compiled with the OMPG switch. Also fixes truncation of build.log when running run_cmake_build. (NOAA-EMC#1191)

* Added screen output showing number of threads when OMP enabled.

* update build to get more info in logs (NOAA-EMC#46)

---------

Co-authored-by: Jessica Meixner <[email protected]>

* update run_cmake_test to catch build errors and exit (NOAA-EMC#1194)

* fix merge conflicts

* Fix gustiness bug, as suggst by Pieter

* Change USTARsigma to WAM implementation

---------

Co-authored-by: Chris Bunney <[email protected]>
Co-authored-by: Mickael Accensi <[email protected]>
Co-authored-by: Benoit Pouliot <[email protected]>
Co-authored-by: Matthew Masarik <[email protected]>
Co-authored-by: Ghazal-Mohammadpour <[email protected]>
Co-authored-by: Jessica Meixner <[email protected]>
Co-authored-by: Biao Zhao <[email protected]>
Co-authored-by: Edward Hartnett <[email protected]>
Co-authored-by: Alex Richert <[email protected]>
Co-authored-by: Fabrice Ardhuin <[email protected]>
Co-authored-by: W. Erick Rogers <[email protected]>
Co-authored-by: Denise Worthen <[email protected]>
Co-authored-by: Camille Teicheira <[email protected]>
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 this pull request may close these issues.

Uninitialised variables VS/VD in w3srcemd
2 participants