id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc 1768,zdfric: momentum background viscosity propagates into tracer diffusivity,mclaus,nemo,"= Context = I think, the following code of zdfric.F90 (line 158, trunk@6489) produces to large values of vertical eddy viscosity for the tracers. {{{#!fortran DO jj = 2, jpjm1 ! Eddy diffusivity coefficients (avt) DO ji = fs_2, fs_jpim1 avt(ji,jj,jk) = tmric(ji,jj,jk) / ( 1._wp + rn_alp * zwx(ji,jj) ) & & * ( avmu(ji,jj,jk) + avmu(ji-1,jj,jk) & & + avmv(ji,jj,jk) + avmv(ji,jj-1,jk) ) & & + avtb(jk) * tmask(ji,jj,jk) ! ! Add the background coefficient on eddy viscosity avmu(ji,jj,jk) = avmu(ji,jj,jk) + avmb(jk) * umask(ji,jj,jk) avmv(ji,jj,jk) = avmv(ji,jj,jk) + avmb(jk) * vmask(ji,jj,jk) END DO END DO }}} = Analysis = The problem is that within the same loop body, the vertical eddy viscosity for the tracer is computed using a four point average of the eddy viscosity for the zonal and meridional momentum and the background eddy viscosity is added to the viscosity of the momentum. This way, `avmu(ji-1,jj,jk)` has the background viscosity added but `avmu(ji,jj,jk)` has not. As a result, the four point average is larger by about 50% of the momentums' background viscosity. As a side effect, there is a memory dependence in the loop preventing the compiler to optimize the loop. Affected versions are 3.4, 3.6 and trunk and possibly older version of NEMO = Fix = I suggest to split the loop into two nested loops. A patch file is attached.",Bug,closed,normal,2015 release-3.6,OCE,trunk,,fixed,OPA v3.6 zdfric,