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.
#2313 (Possible uninitialised variables in sbccpl) – NEMO

Opened 5 years ago

Closed 4 years ago

Last modified 2 years ago

#2313 closed Bug (fixed)

Possible uninitialised variables in sbccpl

Reported by: timgraham Owned by: systeam
Priority: low Milestone:
Component: SBC Version: v4.0
Severity: minor Keywords: coupled_mode currents v4.0
Cc:

Description

Context

In the following lines of code the syntax in the ELSE IF part seems wrong as there is a call to ctl_stop followed by another line of code that can never be run

     IF( sn_snd_crt%clvgrd == 'U,V' ) THEN
         ssnd(jps_ocx1)%clgrid = 'U' ; ssnd(jps_ocy1)%clgrid = 'V'
     ELSE IF( sn_snd_crt%clvgrd /= 'T' ) THEN  
         CALL ctl_stop( 'sn_snd_crt%clvgrd must be equal to T' )
         ssnd(jps_ocx1:jps_ivz1)%clgrid  = 'T'      ! all oce and ice components on the same unique grid
     ENDIF

...

Analysis

If sn_snd_crt%clvgrd = 'T' then the code will continue to run but the variables ssnd(jps_ocx1:jps_ivz1)%clgrid won't be initialised to 'T' potentially causing problems later in the run.

Fix

Perhaps the code should be:

     IF( sn_snd_crt%clvgrd == 'U,V' ) THEN
         ssnd(jps_ocx1)%clgrid = 'U' ; ssnd(jps_ocy1)%clgrid = 'V'
     ELSE IF( sn_snd_crt%clvgrd == 'T' ) THEN  
         ssnd(jps_ocx1:jps_ivz1)%clgrid  = 'T'      ! all oce and ice components on the same unique grid
     ELSE
         CALL ctl_stop( 'sn_snd_crt%clvgrd must be equal to T or 'U,V' )
     ENDIF

I'm not able to test this change as we couple on the 'U,V' grids.

Commit History (1)

ChangesetAuthorTimeChangeLog
12171smasson2019-12-11T10:36:23+01:00

trunk: minor cleaning in sbccpl, see #2313

Change History (3)

comment:1 Changed 4 years ago by smasson

In 12171:

Error: Failed to load processor CommitTicketReference
No macro or processor named 'CommitTicketReference' found

remove useless line as by default

ssnd(:)%clgrid  = 'T'


Last edited 4 years ago by smasson (previous) (diff)

comment:2 Changed 4 years ago by smasson

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

comment:3 Changed 2 years ago by nemo

  • Keywords v4.0 added
Note: See TracTickets for help on using tickets.