# 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.
#1935 (Kinetic Energy calculation is wrong) – NEMO

Opened 7 years ago

Closed 7 years ago

# Kinetic Energy calculation is wrong

Reported by: Owned by: timgraham nemo low OCE v3.6 eken DIA diagnostics

# Context

The calculation of KE in diawri.F90 is not correct. Also note that using the short name "eken" is misleading as this is not the Kinetic Energy and not the Eddy Kinetic Energy

# Analysis

In the code at line 302 we have

```         zztmp   = 1._wp / ( e1e2t(ji,jj) * e3t_n(ji,jj,jk) )
zztmpx  = 0.5 * (  un(ji-1,jj,jk) * un(ji-1,jj,jk) * e2u(ji-1,jj) * e3u_n(ji-1,jj,jk)    &
&             + un(ji  ,jj,jk) * un(ji  ,jj,jk) * e2u(ji  ,jj) * e3u_n(ji  ,jj,jk) )  &
&          *  zztmp
!
zztmpy  = 0.5 * (  vn(ji,jj-1,jk) * vn(ji,jj-1,jk) * e1v(ji,jj-1) * e3v_n(ji,jj-1,jk)    &
&             + vn(ji,jj  ,jk) * vn(ji,jj  ,jk) * e1v(ji,jj  ) * e3v_n(ji,jj  ,jk) )  &
&          *  zztmp
!
rke(ji,jj,jk) = 0.5_wp * ( zztmpx + zztmpy )

```

i.e. velocity * velocity * length * thickness / (area * thickness) giving units of m/s2 rather than m2/s2 as we would expect.

# Fix

```         zztmp   = r1_e1e2t(ji,jj) / e3t_n(ji,jj,jk) )
zztmpx  = 0.5 * (  un(ji-1,jj,jk) * un(ji-1,jj,jk) * e1e2u(ji-1,jj) * e3u_n(ji-1,jj,jk)    &
&             + un(ji  ,jj,jk) * un(ji  ,jj,jk) * e1e2u(ji  ,jj) * e3u_n(ji  ,jj,jk) )  &
&          *  zztmp
!
zztmpy  = 0.5 * (  vn(ji,jj-1,jk) * vn(ji,jj-1,jk) * e1e2v(ji,jj-1) * e3v_n(ji,jj-1,jk)    &
&             + vn(ji,jj  ,jk) * vn(ji,jj  ,jk) * e1e2v(ji,jj  ) * e3v_n(ji,jj  ,jk) )  &
&          *  zztmp
!
rke(ji,jj,jk) = 0.5_wp * ( zztmpx + zztmpy )
```

### Commit History (3)

ChangesetTimeChangeLog
8473timgraham2017-08-30T11:38:39+02:00

Corrected fix for #1935 (not using variables that don't exist in nemo_v3_6_stable)

8465timgraham2017-08-25T10:34:47+02:00

#1934 and #1935 - correct calculation of KE in diawri.F90

8464timgraham2017-08-25T10:31:40+02:00

#1934 and #1935 - correct KE calculation in diawri.F90

### comment:1 Changed 7 years ago by timgraham

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

Fixed at r8464 of nemo_v3_6_stable and r8465 in the trunk

### comment:2 Changed 7 years ago by arsouze

• Resolution fixed deleted
• Status changed from closed to reopened

It looks like variables r1_e1e2t, e1e2u, e1e2v are not defined in NEMO_v3_6_STABLE.

### comment:3 Changed 7 years ago by timgraham

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

Sorry about that. Now fixed at r8473

### comment:4 Changed 7 years ago by nicolasmartin

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