# 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.

Opened 5 years ago

Closed 5 years ago

## #2290 closed Bug (fixed)

Reported by: Owned by: jchanut systeam low DYN v4.0 minor v4.0

### Description

#### Analysis

There are a couple of bugs in dynzdf.F90 with ln_zad_Aimp=.true.
1) In building the tridiagonal matrix one uses the implicit vertical velocity at W-point:

```zWui = 0.5_wp * ( wi(ji,jj,jk  ) + wi(ji+1,jj,jk  ) )
zWus = 0.5_wp * ( wi(ji,jj,jk+1) + wi(ji+1,jj,jk+1) )
```

which is multiplied later when filling the matrix by

```zdt = r2dt * 0.5
```

```zwi(ji,jj,jk) = zzwi + zdt * MIN( zWui, 0._wp )
zws(ji,jj,jk) = zzws - zdt * MAX( zWus, 0._wp )
zwd(ji,jj,jk) = 1._wp - zzwi - zzws + zdt * ( MAX( zWui, 0._wp ) - MIN( zWus, 0._wp ) )
```

It means that vertical velocities are multiplied by 0.5 twice instead of once.

2) Off diagonal terms should be divided by e3u, including implicit advection terms which is not the case.

#### Fix

U velocity case:

```ze3ua =  ( 1._wp - r_vvl ) * e3u_n(ji,jj,jk) + r_vvl * e3u_a(ji,jj,jk)
...
zWui = ( wi(ji,jj,jk  ) + wi(ji+1,jj,jk  ) ) / ze3ua
zWus = ( wi(ji,jj,jk+1) + wi(ji+1,jj,jk+1) ) / ze3ua
zwi(ji,jj,jk) = zzwi + zdt * MIN( zWui, 0._wp )
zws(ji,jj,jk) = zzws - zdt * MAX( zWus, 0._wp )
zwd(ji,jj,jk) = 1._wp - zzwi - zzws + zdt * ( MAX( zWui, 0._wp ) - MIN( zWus, 0._wp ) )
```

### Commit History (2)

ChangesetTimeChangeLog
11282jchanut2019-07-17T15:57:17+02:00

11281jchanut2019-07-17T15:51:21+02:00

### comment:1 Changed 5 years ago by jchanut

In 11281:

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

### comment:2 Changed 5 years ago by jchanut

In 11282:

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

### comment:3 Changed 5 years ago by jchanut

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