# The vertical diffusion trend term has issues (utrd\_zdf/vtrd\_zdf)

**URL:** <https://nemo-ocean.discourse.group/t/the-vertical-diffusion-trend-term-has-issues-utrd-zdf-vtrd-zdf/1036>\
**Category:** v4.0.x\
**Tags:** TRD, DYN, ZDF\
**Created:** [30 June 2026 13:20 UTC](https://nemo-ocean.discourse.group/t/the-vertical-diffusion-trend-term-has-issues-utrd-zdf-vtrd-zdf/1036 "2026-06-30T13:20:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![corentingnt](https://avatars.discourse-cdn.com/v4/letter/c/7ea924/32.png) [@corentingnt](https://nemo-ocean.discourse.group/u/corentingnt)\
**Post date:** [30 June 2026 13:20 UTC](https://nemo-ocean.discourse.group/t/the-vertical-diffusion-trend-term-has-issues-utrd-zdf-vtrd-zdf/1036/1 "2026-06-30T13:20:42Z")

</div>

Hi,  
We do this message with Véga, trainee with Julie Deshayes and myself at Locean (I am PhD student). We looked at different trends terms in the NEMO.4.0 version. We noticed an issue with utrd\_zdf and vtrd\_zdf, that seemed defined up to a constant of (x,y), invariant of z. We figured out this constant was the barotropic velocity, that was removed from only one of the two terms ua, ub used to compute the trend at the end of the dynzdf file.

Hence, we did the following modification in the code (dynzdf.F90, lign 128, we only add the IF ( l\_trddyn ) THEN - \*\*\*\* - END IF part) :

```fortran
      IF( ln_drgimp .AND. ln_dynspg_ts ) THEN
         DO jk = 1, jpkm1 ! remove barotropic velocities
            ua(:,:,jk) = ( ua(:,:,jk) - ua_b(:,:) ) * umask(:,:,jk)
            va(:,:,jk) = ( va(:,:,jk) - va_b(:,:) ) * vmask(:,:,jk)
            IF ( l_trddyn ) THEN ! (and also from the tendency term if needed)
               ztrdu(:,:,jk) = ztrdu(:,:,jk) - ua_b(:,:)/r2dt * umask(:,:,jk)
               ztrdv(:,:,jk) = ztrdv(:,:,jk) - va_b(:,:)/r2dt * vmask(:,:,jk)
            END IF 
         END DO

```

It provides an apparently correct result. Initially, we modified the file at the end, however Gurvan told us to put it rather at the beginning, where the same operation is done for the velocity.

Best,  
Corentin and Véga

---

<div class="post-metadata">

**Author:** ![SGriffies](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@SGriffies](https://nemo-ocean.discourse.group/u/SGriffies)\
**Post date:** [2 July 2026 16:50 UTC](https://nemo-ocean.discourse.group/t/the-vertical-diffusion-trend-term-has-issues-utrd-zdf-vtrd-zdf/1036/2 "2026-07-02T16:50:44Z")

</div>

Hi,

Do you know if this an issue in the newer NEMO 5 code?

Stephen
