Opened 9 months ago

Closed 6 months ago

#2313 closed Bug (fixed)

Possible uninitialised variables in sbccpl

Reported by: timgraham Owned by: systeam
Priority: low Milestone:
Component: SBC Version: release-4.0
Severity: minor Keywords: coupled_mode, currents
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 (2)

comment:1 Changed 6 months ago by smasson

In 12171:

trunk: minor cleaning in sbccpl, see #2313

remove useless line as by default

ssnd(:)%clgrid  = 'T'


Last edited 6 months ago by smasson (previous) (diff)

comment:2 Changed 6 months ago by smasson

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.