Array bound problem in get_initial

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
crowley
Posts: 12
Joined: Wed Mar 26, 2003 4:14 pm
Location: DOI/MMS

Array bound problem in get_initial

#1 Unread post by crowley »

I am (finally) porting my application to version 2.0, but I have run into a problem. The array bound check is barfing on get initial:

Run-Time Error 455: Array section bounds inconsistent with parent array
In Procedure: get_initial
Diagnostics Entered From Subroutine get_initial Line 249
Entered From Subroutine initial Line 126
Entered From MAIN PROGRAM Line 69
End of diagnostics

The offending code seems to be:

Code: Select all

#if defined EW_PERIODIC || defined NS_PERIODIC || !defined DISTRIBUTE
!
!  Set periodic boundary conditions.
!
      CALL exchange_r2d_tile (ng, 1, Lm(ng), 1, Mm(ng),                 &
     &                        LBi, UBi, LBj, UBj,                       &
     &                        OCEAN(ng) % zeta(:,:,1))
      CALL exchange_u2d_tile (ng, 1, Lm(ng), 1, Mm(ng),                 &
     &                        LBi, UBi, LBj, UBj,                       &
     &                        OCEAN(ng) % ubar(:,:,1))
      CALL exchange_v2d_tile (ng, 1, Lm(ng), 1, Mm(ng),                 &
     &                        LBi, UBi, LBj, UBj,                       &
     &                        OCEAN(ng) % vbar(:,:,1))

...

Since I am running in Serial mode with no periodic boundary conditions I don't think this code should even be used.

Should this code be activated anytime DISTRIBUTE is NOT defined, or is the cpp statement incorrect? (notice: !defined DISTRIBUTE)

If the cpp statement is wrong it is also wrong in get_grid (though it got past the checks).

Any other similar statements throughout the code are:

Code: Select all

#if defined EW_PERIODIC || defined NS_PERIODIC || defined DISTRIBUTE 
Heather

User avatar
arango
Site Admin
Posts: 1347
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

#2 Unread post by arango »

Hi Heather,

This routine is special and does distributed-memory differently than other places in the code. This section of the code is only executed in periodic boundary conditions during serial or shared-memory configurations. In distributed-memory configurations, the periodic boundary conditions are applied during reading in routine "nf_fread" by calling the "mp_scatter" routine.

Obviously, there is a bug here. The CPP directive should be more like:

Code: Select all


#if (defined EW_PERIODIC || defined NS_PERIODIC) && !defined DISTRIBUTE

The .or. logic in CPP becomes .and. when preceded by a negation.

This is also wrong in similar statements in "get_grid".

Thank you for reporting this bug.

Hernan G. Arango
arango@imcs.rutgers.edu

Post Reply