New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
#1835 (Uninitialized variable nn_dttrc used in iom.F90) – NEMO

Opened 7 years ago

Closed 7 years ago

#1835 closed Bug (fixed)

Uninitialized variable nn_dttrc used in iom.F90

Reported by: mdunphy Owned by: lovato
Priority: low Milestone:
Component: OCE Version: v3.6
Severity: Keywords:
Cc:

Description

Context

The variable nn_dttrc is not initialized when we run without TOP, however it's used in iom.F90, and gets flagged as making use of an uninitialized value.

Analysis

Instrumenting subroutine set_xmlatt in iom.F90 like this:

WRITE(*,*) "Calling iom_set_field_attr for field_definition"
WRITE(cl1,'(i1)') 1 ; CALL iom_set_field_attr('field_definition', freq_op=cl1'ts', freq_offset='0ts')
WRITE(*,*) "Calling iom_set_field_attr for SBC, ff_fsbc = ", nn_fsbc
WRITE(cl1,'(i1)') nn_fsbc ; CALL iom_set_field_attr('SBC' , freq_op=cl1
'ts', freq_offset='0ts')
WRITE(*,*) "Calling iom_set_field_attr for SBC_scalar, ff_fsbc = ", nn_fsbc
WRITE(cl1,'(i1)') nn_fsbc ; CALL iom_set_field_attr('SBC_scalar' , freq_op=cl1'ts', freq_offset='0ts')
WRITE(*,*) "Calling iom_set_field_attr for ptrc_T, nn_dttrc = ", nn_dttrc
WRITE(cl1,'(i1)') nn_dttrc ; CALL iom_set_field_attr('ptrc_T' , freq_op=cl1
'ts', freq_offset='0ts')
WRITE(*,*) "Calling iom_set_field_attr for diad_T, nn_dttrc = ", nn_dttrc
WRITE(cl1,'(i1)') nn_dttrc ; CALL iom_set_field_attr('diad_T' , freq_op=cl1'ts', freq_offset='0ts')

Gives prints like this:

Calling iom_set_field_attr for field_definition
Calling iom_set_field_attr for SBC, ff_fsbc = 1
Calling iom_set_field_attr for SBC_scalar, ff_fsbc = 1
Calling iom_set_field_attr for ptrc_T, nn_dttrc = -757026840
Calling iom_set_field_attr for diad_T, nn_dttrc = -757026840

I'm not sure if this causes any problems since TOP is off. The uninitialized value makes it way to XIOS so it may have some effect depending on what XIOS does with crazy values. At the very least, fixing this means fewer uninitialized variable reports/warnings.

Fix

We can initialize nn_dttrc = 1 where it is defined, patch attached.

Alternatively, we can put #ifdef key_top ... #endif around the calls to iom_set_field_attr with nn_dttrc.

Commit History (2)

ChangesetAuthorTimeChangeLog
8027lovato2017-05-15T18:04:37+02:00

trunk : apply bugfix for ticket #1835

8026lovato2017-05-15T17:54:57+02:00

3.6 stable: solve ticket #1835 and add following fixes (tested with SETTE):

  • add key_offline control in zdfddm_substitute.h90
  • use loop index in rab2d as in rab3d, and take out lbc calls
  • make atm_co2 always accessible from sbc_oce
  • update sette scripts for athena cluster

Attachments (1)

trc_oce.patch (854 bytes) - added by mdunphy 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by mdunphy

comment:1 Changed 7 years ago by clevy

  • Owner changed from nemo to lovato

comment:2 Changed 7 years ago by lovato

  • Resolution set to fixed
  • Status changed from new to closed

Code was updated for v3.6_stable at r8026 and trunk at r8027

Note: See TracTickets for help on using tickets.