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.
#635 (misplaced modification of fstravs in trczdf_iso.F90) – NEMO

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#635 closed Bug (fixed)

misplaced modification of fstravs in trczdf_iso.F90

Reported by: sga Owned by: nemo
Priority: normal Milestone:
Component: TOP Version: trunk
Severity: Keywords:
Cc:

Description

In routine trczdf_iso.F90 the vertical part of the isopycnal mixing is added to the fstravs array inside a loop over the number of tracers, before fstravs is used in a second loop over the tracers. This means that if there are 10 tracers, that the isopycnal mixing is 10 times too big. It needs to be moved outside the loop over jn. A suggested patch against revision 1793 of the trunk (identical to our revision 1109) would be:

Index: NEMO/TOP_SRC/TRP/trczdf_iso.F90
===================================================================
--- NEMO/TOP_SRC/TRP/trczdf_iso.F90 (revision 1109)
+++ NEMO/TOP_SRC/TRP/trczdf_iso.F90 (working copy)
@@ -180,8 +180,22 @@

!---------------------------------------------------
zavs(:,:,:) = fstravs(:,:,:)


+ ! 0.2 update and save of avt (and avs if double diffusive mixing)
+ ! ---------------------------

+ DO jk = 2, jpkm1
+ DO ji = 2, jpim1

+ zavi = fsahtw(ji,jj,jk)*( wslpi(ji,jj,jk)*wslpi(ji,jj,jk) &
+ & +wslpj(ji,jj,jk)*wslpj(ji,jj,jk) )
+
+ ! add isopycnal vertical coeff. to avs
+ fstravs(ji,jj,jk) = fstravs(ji,jj,jk) + zavi
+
+ END DO
+ END DO
+
+

DO jn = 1, jptra


IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn) ! save trends

@@ -262,21 +276,6 @@

END DO



  • ! I.3 update and save of avt (and avs if double diffusive mixing)
  • ! ---------------------------

-

  • DO jk = 2, jpkm1
  • DO ji = 2, jpim1

-

  • zavi = fsahtw(ji,jj,jk)*( wslpi(ji,jj,jk)*wslpi(ji,jj,jk) &
  • & +wslpj(ji,jj,jk)*wslpj(ji,jj,jk) )

-

  • ! add isopycnal vertical coeff. to avs
  • fstravs(ji,jj,jk) = fstravs(ji,jj,jk) + zavi

-

  • END DO
  • END DO

-

#if defined key_trcldf_eiv

! ! ---------------------------------------!
! ! Eddy induced vertical advective fluxes !

Commit History (0)

(No commits)

Change History (4)

comment:1 follow-up: Changed 14 years ago by cetlod

The same problem are in the routine trczdf_iso_vopt.F90 and trczdf_imp.F90. The results are right because temporary arrays used to compute the vertical diffusion coefficient are re-initialize to zero in the loop over the tracers.

We should apply the same patch suggested by Steven to correct all these routines.

Thanks Steven

comment:2 Changed 14 years ago by cetlod

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

comment:3 in reply to: ↑ 1 Changed 14 years ago by acc

Replying to cetlod:

The same problem are in the routine trczdf_iso_vopt.F90 and trczdf_imp.F90. The results are right because temporary arrays used to compute the vertical diffusion coefficient are re-initialize to zero in the loop over the tracers.

"the results are right"?
It looks to me as if only the edge points of zavsi are reset each iteration so surely trczdf_iso_vopt suffers from the same accumulation error?

comment:4 Changed 14 years ago by cetlod

  • In trczdf_iso_vopt.F90, we use a temporay array,"zavsi", which contains the vertical mixing coef fstravs + the vertical part of the isopycnal mixing

DO LOOPS

zavi = fsahtw(ji,jj,jk)*( wslpi(ji,jj,jk)*wslpi(ji,jj,jk) &
& +wslpj(ji,jj,jk)*wslpj(ji,jj,jk) )
! add isopycnal vertical coeff. to avs
zavsi(ji,jj,jk) = fstravs(ji,jj,jk) + zavi

ENDDO LOOPS

  • In trczdf_iso.F90, we update fstravs with the the vertical part of the isopycnal mixing

DO LOOPS

zavi = fsahtw(ji,jj,jk)*( wslpi(ji,jj,jk)*wslpi(ji,jj,jk) &
& +wslpj(ji,jj,jk)*wslpj(ji,jj,jk) )
! add isopycnal vertical coeff. to avs
fstravs(ji,jj,jk) = fstravs(ji,jj,jk) + zavi

ENDDO LOOPS

That's the real reason why we accumulate in trczdf_iso.F90 and not in trczdf_iso_vopt.F90

Note: See TracTickets for help on using tickets.