New URL for NEMO forge!

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.
#2110 (Bug in traadv_fct.F90) – NEMO

Opened 5 years ago

Closed 5 years 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: OPA v4.0

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.


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.


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 


Commit History (1)


Bug fix in traadv_fct.F90. See ticket #2110

Change History (4)

comment:1 Changed 5 years ago by acc

In 9901:

Error: Failed to load processor CommitTicketReference
No macro or processor named 'CommitTicketReference' found

comment:2 Changed 5 years 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 5 years ago by nemo (previous) (diff)

comment:3 Changed 5 years ago by nicolasmartin

  • Description modified (diff)

comment:4 Changed 22 months ago by nemo

  • Keywords OPA v4.0 added
Note: See TracTickets for help on using tickets.