Skip to content

Adjust do loop bounds in a2b_ord2 to prevent reading from uninitialized memory#349

Merged
laurenchilutti merged 2 commits into
NOAA-GFDL:dev/emcfrom
DusanJovic-NOAA:dycore_a2b_ord2_bugfix
Jul 16, 2024
Merged

Adjust do loop bounds in a2b_ord2 to prevent reading from uninitialized memory#349
laurenchilutti merged 2 commits into
NOAA-GFDL:dev/emcfrom
DusanJovic-NOAA:dycore_a2b_ord2_bugfix

Conversation

@DusanJovic-NOAA
Copy link
Copy Markdown
Contributor

Description

This PR fixes occasional model crashes in debug mode caused by floating-point exception in subroutine a2b_ord2 in model/a2b_edge.F90. See issue #346 for details.

In subroutine a2b_ord2 do loop bounds are changed to avoid reading from uninitialized elements of qin array.

Intel Fortran compiler flag (-init=snan,arrays) has been added to debug flags.

Fixes #346

How Has This Been Tested?

Several debug ufs-weather-model regression tests have been run on Hera and few other NOAA systems successfully. I will run full regression test on Hera.

Checklist:

Please check all whether they apply or not

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

…tialized elements of qin array

Input array qin in a2b_ord2 routine is declared as qin(is-ng:ie+ng,js-ng:je+ng) but only elements in
(is-1:ie+1, js-1:je+1) range are initialized in a calling routine, for example pin array in adv_pe routine in dyn_core.F90
Copy link
Copy Markdown
Contributor

@XiaqiongZhou-NOAA XiaqiongZhou-NOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loop i-, j-dimensions of qin are consistent with that in dyn_core.F90 now.

Copy link
Copy Markdown
Contributor

@lharris4 lharris4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fine. Do keep an eye out for potential artifacts at nested and regional domain boundaries.

@zach1221
Copy link
Copy Markdown

@bensonr testing on WM PR-2362 is complete. Can you please merge this cubed-sphere PR?

@jkbk2004
Copy link
Copy Markdown

@laurenchilutti This pr can be merged.

@laurenchilutti laurenchilutti merged commit 1720f85 into NOAA-GFDL:dev/emc Jul 16, 2024
@DusanJovic-NOAA DusanJovic-NOAA deleted the dycore_a2b_ord2_bugfix branch July 16, 2024 13:40
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.

7 participants