Opened 8 years ago

Closed 8 years ago

#695 closed bug (Fixed)

Checking point source methodologies: invalid value of ng

Reported by: m.hadfield Owned by: arango
Priority: major Milestone: Release ROMS/TOMS 3.7
Component: Nonlinear Version: 3.7
Keywords: Cc:

Description (last modified by arango)

In read_phypar.F, lines 2736 through 2750 check the point source methodologies

!
!  Check if both point sources methodologies are activated.  Only one
!  method is allowed for a particular grid.  Otherwise, the point
!  source will be applies twice.
!
       IF (LuvSrc(ng).and.LwSrc(ng)) THEN
         IF (Master) THEN
           WRITE (out,260) 'LuvSrc', LuvSrc(ng),                        &
     &           'Because LwSrc  is also ON; only one method is legal.'
           WRITE (out,260) 'LwSrc', LwSrc(ng),                          &
     &           'Because LuvSrc is also ON; only one method is legal.'
           exit_flag=4
           RETURN
         END IF
       END IF

This needs to be enclosed in a loop over ng:

      DO ng=1,Ngrids
       IF (LuvSrc(ng).and.LwSrc(ng)) THEN
      ...
       END IF
      END DO

Otherwise, ng has the value it acquired on exit from the previous such loop, which leads to an out-of-bound access in LuvSrc(ng) and LwSrc(ng).

Change History (1)

comment:1 by arango, 8 years ago

Description: modified (diff)
Resolution: Fixed
Status: newclosed

Oops, thank you. I don't know why the DO-loop disappeared.

Note: See TracTickets for help on using tickets.