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 15400 for branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/OBS/obs_prep.F90 – NEMO

Ignore:
Timestamp:
2021-10-19T11:34:55+02:00 (11 months ago)
Author:
kingr
Message:

Bug-fix to obsoper to avoid division by zero in rare cases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/OBS/obs_prep.F90

    r15255 r15400  
    12241224      INTEGER :: iig, ijg           ! i,j of observation on model grid point. 
    12251225      INTEGER :: jobs, jobsp, jk, ji, jj 
    1226       REAL(KIND=wp) :: maxdept, maxdepw 
     1226      REAL(KIND=wp) :: maxdepw 
    12271227 
    12281228      ! Get grid point indices 
     
    13171317 
    13181318            ! Calculate max T and W depths of 2x2 grid 
    1319             maxdept=zgdept(1,1,NINT(zbathy(1,1,jobs)),jobs) 
    13201319            maxdepw=zgdepw(1,1,NINT(zbathy(1,1,jobs))+1,jobs) 
    13211320            DO jj = 1, 2 
    13221321               DO ji = 1, 2 
    1323                   IF ( zgdept(ji,jj,NINT(zbathy(ji,jj,jobs)),jobs) > maxdept ) THEN 
    1324                      maxdept = zgdept(ji,jj,NINT(zbathy(ji,jj,jobs)),jobs) 
    1325                   END IF 
    13261322                  IF ( zgdepw(ji,jj,NINT(zbathy(ji,jj,jobs))+1,jobs) > maxdepw ) THEN 
    13271323                     maxdepw = zgdepw(ji,jj,NINT(zbathy(ji,jj,jobs))+1,jobs) 
     
    13981394               ENDIF 
    13991395            ENDIF 
    1400              
    1401             ! Set observation depth equal to that of the first model depth 
    1402             IF ( pobsdep(jobsp) < MINVAL(zgdept(1:2,1:2,1,jobs) ) ) THEN 
    1403                pobsdep(jobsp) = MINVAL(zgdept(1:2,1:2,1,jobs)) 
    1404             ENDIF 
    1405  
    1406             ! Set observation depth equal to that of the last wet T-point 
    1407             IF ( ( pobsdep(jobsp) > maxdept ) .AND. & 
    1408                & ( pobsdep(jobsp) < maxdepw ) ) THEN 
    1409                pobsdep(jobsp) = maxdept 
    1410             END IF 
    1411              
     1396            
    14121397#if defined key_bdy 
    14131398            ! Flag if the observation falls close to the boundary rim 
Note: See TracChangeset for help on using the changeset viewer.