Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#224 closed defect (invalid)

routing_diagnostic lower bound (-1) in array

Reported by: ajornet Owned by: somebody
Priority: major Milestone: orchidee_1_9_6
Component: Biogeochemical processes Version: trunc
Keywords: routing array routing_diagnostic bname basin Cc: albert.jornet-puig@…

Description

When running ORCHIDEE in non global mode. Selecting random coordinates but valid it raises the following exception:
run.def is attached to the ticket.

forrtl: severe (408): fort: (3): Subscript #1 of the array BASIN_NAMES has value -1 which is less than the lower bound of 1

Image              PC                Routine            Line        Source             
orchidee_ol        00000000013224C0  routing_mp_routin        3046  routing.f90
orchidee_ol        0000000001303631  routing_mp_routin        2553  routing.f90
orchidee_ol        000000000128C304  routing_mp_routin         445  routing.f90
orchidee_ol        0000000000710F33  sechiba_mp_sechib         491  sechiba.f90
orchidee_ol        000000000050A8D9  intersurf_mp_inte         365  intersurf.f90
orchidee_ol        000000000049DEC4  MAIN__                   1264  dim2_driver.f90
orchidee_ol        00000000004339C6  Unknown               Unknown  Unknown
libc.so.6          00002B08891C3D5D  Unknown               Unknown  Unknown
orchidee_ol        00000000004338B9  Unknown               Unknown  Unknown

File routing.f90 at the subroutine routing_diagnostic.
The array sorted_names is accessed with a -1 value. This is out of the array scope.

     ! Create the sorted list of names
     !
     err_basin_number = .FALSE.
     DO icc = 1, num_largest
        !
        ib=sortedrivs(icc)
        !
        IF ( topids(ib) .GT. nb_small ) THEN
           IF (topids(ib) <= 99 ) THEN
              WRITE(sorted_names(icc), '("Nb_",I2.2)') topids(ib)
           ELSE IF (topids(ib) <= 999 ) THEN
              WRITE(sorted_names(icc), '("Nb_",I3.3)') topids(ib)
           ELSE IF (topids(ib) <= 9999 ) THEN
              WRITE(sorted_names(icc), '("Nb_",I4.4)') topids(ib)
           ELSE IF (topids(ib) <= 99999 ) THEN
              WRITE(sorted_names(icc), '("Nb_",I5.5)') topids(ib)
           ELSE IF (topids(ib) <= 999999 ) THEN
              WRITE(sorted_names(icc), '("Nb_",I6.6)') topids(ib)
           ELSE
              err_basin_number = .TRUE.
              EXIT
           ENDIF
 
        ELSE
           sorted_names(icc) = basin_names(topids(ib))  !<<---- HERE
        ENDIF
        !
     ENDDO

Proposed solution:

The problems comes from the subroutine routing_findbasins at:

    ! put everything in the first basin
    IF ( itrans .GT. 1) THEN
       ipb = trans(1)
       coast_pts(sz(ipb)) = bname(ipb)
       bname(ipb) = -1                   !<-- HERE
       DO ip=2,itrans
          sz(ipb) = sz(ipb) + 1
          coast_pts(sz(ipb)) = bname(trans(ip))
          sz(trans(ip)) = 0
          pts(ipb, sz(ipb), 1) = pts(trans(ip), 1, 1)
          pts(ipb, sz(ipb), 2) = pts(trans(ip), 1, 2)
       ENDDO
    ENDIF

As the comment says, everything should go to the first basin. But actually, it is the opposite because of bname at the beginning of the loop. For this reason, there a -1 value at routing_diagnostic.

    ! put everything in the first basin
    IF ( itrans .GT. 1) THEN
       ipb = trans(1)
       coast_pts(sz(ipb)) = bname(ipb)      
       DO ip=2,itrans
          sz(ipb) = sz(ipb) + 1
          coast_pts(sz(ipb)) = bname(trans(ip))
          sz(trans(ip)) = 0
          bname(trans(ip)) = -1               !<-- HERE
          pts(ipb, sz(ipb), 1) = pts(trans(ip), 1, 1)
          pts(ipb, sz(ipb), 2) = pts(trans(ip), 1, 2)
       ENDDO
    ENDIF

So moving bname = -1 to the loop it is ensured the rest of the bassins go to the first occurrence.

Attachments (1)

run.def.bname (7.7 KB) - added by ajornet 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by ajornet

comment:1 Changed 7 years ago by ajornet

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

comment:2 Changed 7 years ago by ajornet

I discussed it with Jan. This is not a problem.

Note: See TracTickets for help on using tickets.