I think it relates to the way get_2dfld was originally used for arrays in which the outer dimension is time, but has now been adapted for arrays in which the outer dimension is tidal constiuent.
In get_data.F, the code to read in tidal constituent data looks like this
Code: Select all
#ifdef SSH_TIDES
!
! Tidal elevation amplitude and phase. In order to read data as a
! function of tidal period, we need to reset the model time variables
! temporarily.
!
IF (iic(ng).eq.0) THEN
time_save=time(ng)
time(ng)=8640000.0_r8
tdays(ng)=time(ng)*sec2day
CALL get_2dfld (ng, idTzam, ncfrcid(idTzam,ng), &
& nFfiles(ng), frcname(1,ng), &
& update(1), LBi, UBi, LBj, UBj, MTC, NTC(ng), &
# ifdef MASKING
& GRID(ng) % rmask(LBi,LBj), &
# endif
& TIDES(ng) % SSH_Tamp(LBi,LBj,1))
CALL get_2dfld (ng, idTzph, ncfrcid(idTzph,ng), &
& nFfiles(ng), frcname(1,ng), &
& update(1), LBi, UBi, LBj, UBj, MTC, NTC(ng), &
# ifdef MASKING
& GRID(ng) % rmask(LBi,LBj), &
# endif
& TIDES(ng) % SSH_Tphase(LBi,LBj,1))
time(ng)=time_save
tdays(ng)=time(ng)*sec2day
END IF
#endif
Inside get_2dfld, the 11th argument is Iout, described as "Size of the outer dimension, if any. Otherwise, Iout must be set to one by the calling program." In loading tidal constituents, during execution of get_2dfld, Tindex is set to Iout and at line 262 the following statement is executed
Code: Select all
Vtime(Tindex,ifield,ng)=Finfo(1,ifield,ng)
Code: Select all
Subscript -4 is out of range for dimension 1 for array
'VTIME' at line 300 in file 'get_2dfld.f90' with bounds 1:7
For my present application, with only one tidal constituent, my work-around is to reduce MTC to 1, but what if I want more than 2 tidal constituents?
I'm not sure I understand the logic in get_data & get_2dfld, but I guess the inner dimension of Vtime needs to be increased to max(2,MTC).