New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 10342 for NEMO/trunk – NEMO

Changeset 10342 for NEMO/trunk


Ignore:
Timestamp:
2018-11-20T14:18:06+01:00 (5 years ago)
Author:
smasson
Message:

trunk: avoid undefined (and harmless) values in gls to pass -fpe0 test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/ZDF/zdfgls.F90

    r10068 r10342  
    275275               ! building the matrix 
    276276               zcof = rfact_tke * tmask(ji,jj,jk) 
    277                !                                               ! lower diagonal 
     277               !                                        ! lower diagonal, in fact not used for jk = 2 (see surface conditions) 
    278278               zd_lw(ji,jj,jk) = zcof * ( p_avm(ji,jj,jk  ) + p_avm(ji,jj,jk-1) ) / ( e3t_n(ji,jj,jk-1) * e3w_n(ji,jj,jk) ) 
    279                !                                               ! upper diagonal 
     279               !                                        ! upper diagonal, in fact not used for jk = ibotm1 (see bottom conditions) 
    280280               zd_up(ji,jj,jk) = zcof * ( p_avm(ji,jj,jk+1) + p_avm(ji,jj,jk  ) ) / ( e3t_n(ji,jj,jk  ) * e3w_n(ji,jj,jk) ) 
    281                !                                               ! diagonal 
     281               !                                        ! diagonal 
    282282               zdiag(ji,jj,jk) = 1._wp - zd_lw(ji,jj,jk) - zd_up(ji,jj,jk)  + rdt * zdiss * wmask(ji,jj,jk)  
    283                !                                               ! right hand side in en 
     283               !                                        ! right hand side in en 
    284284               en(ji,jj,jk) = en(ji,jj,jk) + rdt * zesh2 * wmask(ji,jj,jk) 
    285285            END DO 
     
    792792      zstm(:,:,1) = zstm(:,:,2) 
    793793 
    794       DO jj = 2, jpjm1 
     794      ! default value, in case jpk > mbkt(ji,jj)+1. Not needed but avoid a bug when looking for undefined values (-fpe0) 
     795      zstm(:,:,jpk) = 0.   
     796      DO jj = 2, jpjm1                ! update bottom with good values 
    795797         DO ji = fs_2, fs_jpim1   ! vector opt. 
    796798            zstm(ji,jj,mbkt(ji,jj)+1) = zstm(ji,jj,mbkt(ji,jj)) 
    797799         END DO 
    798800      END DO 
     801 
     802      zstt(:,:,  1) = wmask(:,:,  1)  ! default value not needed but avoid a bug when looking for undefined values (-fpe0) 
     803      zstt(:,:,jpk) = wmask(:,:,jpk)  ! default value not needed but avoid a bug when looking for undefined values (-fpe0) 
     804 
    799805!!gm should be done for ISF (top boundary cond.) 
    800806!!gm so, totally new staff needed!!gm 
     
    802808      ! Compute diffusivities/viscosities 
    803809      ! The computation below could be restrained to jk=2 to jpkm1 if GOTM style Dirichlet conditions are used 
     810      !  -> yes BUT p_avm(:,:1) and p_avm(:,:jpk) are used when we compute zd_lw(:,:2) and zd_up(:,:jpkm1). These values are 
     811      !     later overwritten by surface/bottom boundaries conditions, so we don't really care of p_avm(:,:1) and p_avm(:,:jpk) 
     812      !     for zd_lw and zd_up but they have to be defined to avoid a bug when looking for undefined values (-fpe0) 
    804813      DO jk = 1, jpk 
    805814         DO jj = 2, jpjm1 
Note: See TracChangeset for help on using the changeset viewer.