Opened 16 months ago

Closed 16 months ago

Last modified 16 months ago

#935 closed defect (Fixed)

IMPORTANT: Corrected initialization of boundary indices in 2D applications

Reported by: arango Owned by:
Priority: minor Milestone: Release ROMS/TOMS 4.1
Component: Nonlinear Version: 4.0
Keywords: Cc:

Description

Removed the initialization of 3D boundary indices in mod_ncparam.F for shallow-water applications where SOLVE3D is undefined. Now we have:

!
!  Set generic lateral boundary indices for LBC structure. Use the same
! values of the state variables at the same C-grid location. Generic
! indices are used for testing periodicity. The PSI-variables and
! W-variables are assigned the same value as the RHO-variables.
!
      isBp2d=isFsur                           ! 2D PSI-variables
      isBr2d=isFsur                           ! 2D RHO-variables
      isBu2d=isUbar                           ! 2D U-variables
      isBv2d=isVbar                           ! 2D V-variables
#if defined SOLVE3D
      isBp3d=isTvar(1)                        ! 3D PSI-variables
      isBr3d=isTvar(1)                        ! 3D RHO-variables
      isBu3d=isUvel                           ! 3D U-variables
      isBv3d=isVvel                           ! 3D V-variables
      isBw3d=isTvar(1)                        ! 3D W-variables
# if defined GLS_MIXING || defined MY25_MIXING
      isMtke=isTvar(MT)+1                     ! turbulent variables
# endif
#endif

In 2D applications, the total number of tracers, MT=0. Therefore, the isTvar vector is allocated as

     IF (.not.allocated(isTvar)) THEN
       allocate ( isTvar(MT) )
       Dmem(1)=Dmem(1)+REAL(MT,r8)
     END IF

Thus, we have only access to element zero of the vector isTvar, which may trigger a segmentation violation when accessing isTvar(1).

Many thanks to Moein DoostMohammadi for bringing this issue to my attention.

Change History (2)

comment:1 by arango, 16 months ago

Resolution: Fixed
Status: newclosed

comment:2 by arango, 16 months ago

  • Fixed remaining issues when using idTvar, idTsur, and isTvar in shallow-water applications when SOLVE3D is undefined.
  • The allocation of the maximum number of tracers (MT) is constrained to be larger than zero.
  • Corrected a bug in the deallocation of mod_fourdvar.F when the internal switch OBSERVATIONS is undefined. The error was triggered when activating the NORMALIZATION switch to compute the 4D-Var error covariance normalization coefficients.
Note: See TracTickets for help on using tickets.