Opened 23 months ago

Closed 23 months ago

Last modified 22 months ago

#2110 closed Defect (fixed)

Bug in traadv_fct.F90

Reported by: acc Owned by: acc
Priority: low Milestone: 2018 release-4.0
Component: OCE Version: trunk
Severity: minor Keywords:
Cc:

Description (last modified by nicolasmartin)

A minor bug exists in the interpolation scheme for the FCT 4th order vertical scheme. The bug was introduced when the code was adapted to cope with the under ice shelf cavities but affects all runs using this option. It manifests as spurious temperatures outside the initial range early in runs of the OVERFLOW test case. Even with the fix shown below, spurious values still occur with this test but much later in the run (> 3000 time steps) and these are in response to excessive vertical velocities which stop the run after 3329 time steps.

Note the pre-ISF enabled version is still in the code (as interp_4th_cpt_org) but is not used. It can be removed subject to successful testing of the new version in an ISF case.

Context

The wrong index is used when setting the bottom boundary condition. The use of jk does not stray out of bounds because jk has a residual valid value from an earlier loop but the boundary condition will be wrong for anything other than flat-bottomed cases.

Analysis

The fix is simple:

  • src/OCE/TRA/traadv_fct.F90

     
    555555            zwd (ji,jj,ikt) = 1._wp          ! top 
    556556            zwi (ji,jj,ikt) = 0._wp 
    557557            zws (ji,jj,ikt) = 0._wp 
    558             zwrm(ji,jj,ikt) = 0.5_wp * ( pt_in(ji,jj,jk-1) + pt_in(ji,jj,jk) ) 
     558            zwrm(ji,jj,ikt) = 0.5_wp * ( pt_in(ji,jj,ikt-1) + pt_in(ji,jj,ikt) ) 
    559559            ! 
    560560            zwd (ji,jj,ikb) = 1._wp          ! bottom 
    561561            zwi (ji,jj,ikb) = 0._wp 
    562562            zws (ji,jj,ikb) = 0._wp 
    563             zwrm(ji,jj,ikb) = 0.5_wp * ( pt_in(ji,jj,jk-1) + pt_in(ji,jj,jk) )             
     563            zwrm(ji,jj,ikb) = 0.5_wp * ( pt_in(ji,jj,ikb-1) + pt_in(ji,jj,ikb) )             
    564564         END DO 
    565565      END DO 

Recommendation

Commit History (1)

ChangesetAuthorTimeChangeLog
9901acc2018-07-09T13:32:57+02:00

Bug fix in traadv_fct.F90. See ticket #2110

Change History (3)

comment:1 Changed 23 months ago by acc

In 9901:

Bug fix in traadv_fct.F90. See ticket #2110

comment:2 Changed 23 months ago by acc

  • Resolution set to fixed
  • Status changed from new to closed

Final fix also includes code to set level 2 zwd values in the ice cavity case which could be left unset for thick ice shelves and pose a risk of generating Nans. Extra code is simply:

      IF ( ln_isfcav ) THEN            ! set level two values which may not be set in ISF case
         zwd(:,:,2) = 1._wp  ;  zwi(:,:,2) = 0._wp  ;  zws(:,:,2) = 0._wp  ;  zwrm(:,:,2) = 0._wp
      END IF
Last edited 22 months ago by nemo (previous) (diff)

comment:3 Changed 22 months ago by nicolasmartin

  • Description modified (diff)
Note: See TracTickets for help on using tickets.