Opened 6 years ago

Closed 2 years ago

Last modified 11 months ago

#1443 closed Bug (fixed)

The trajectory at the before time level seems to be incorrectly set during adjoint time steps

Reported by: sam Owned by: pabouttier
Priority: low Milestone:
Component: TAM Version: release-3.4
Severity: minor Keywords: TAM
Cc:

Description

In subroutine 'trj_rea' of module 'trj_tam', the direction of advancement of the state variables between the now and the before time levels seems to be incorrect when the trajectory is read in adjoint mode and should be reversed. In subroutine 'trj_rea' it seems to be possible to directly interpolate the state variables at both time levels when stepping the trajectory backwards in time.

Commit History (1)

ChangesetAuthorTimeChangeLog
11774smueller2019-10-23T16:30:17+02:00

Correction of the state-variable advancement in adjoint mode (application of the patch attached to ticket #1443)

Attachments (1)

trj_tam.F90.diff (1.5 KB) - added by sam 2 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 6 years ago by clevy

  • Owner changed from NEMO team to pabouttier

comment:2 Changed 6 years ago by bouttier

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

In fact, the direction of advancement of the state variables between the now and the before time levels is correct.

comment:3 Changed 5 years ago by sam

  • Priority changed from minor to major
  • Resolution invalid deleted
  • Status changed from closed to reopened

The incorrect assignment of the variables 'tsb', 'ub', and 'vb' in adjoint mode seems to lead to the failure of the validation of the adjoint time step (using the built-in test by setting parameter 'ln_swi_opatam' to 1).

comment:4 Changed 4 years ago by nicolasmartin

  • Keywords TAM added

comment:5 Changed 4 years ago by nicolasmartin

  • Keywords nemo_v3_4* added

comment:6 Changed 4 years ago by nicolasmartin

  • Keywords nemo_v3_4 added

comment:7 Changed 4 years ago by nicolasmartin

  • Keywords nemo_v3_4 removed

comment:8 Changed 3 years ago by nemo

  • Keywords release-3.4* added; nemo_v3_4* removed

comment:9 Changed 3 years ago by nemo

  • Keywords release-3.4* removed

comment:10 Changed 3 years ago by nicolasmartin

  • Priority changed from normal to low
  • Severity set to minor

Decision has to be made on this old ticket: if relevant the version of the release must be updated (release-3.6 or trunk for upcoming 4.0), if not close the ticket.

comment:11 Changed 2 years ago by sam

The bug described in this ticket can be fixed by using the attached diff file 'trj_tam.F90.diff' to patch 'trj_tam.F90'.

Changed 2 years ago by sam

comment:12 Changed 2 years ago by nicolasmartin

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

Thanks for sharing your own fix ;-).

  • trj_tam.F90

    old new  
    577577      IF(lwp)WRITE(numout,*) '   linear interpolate coeff.', & 
    578578         &                   '  = ', zwtr1, zwtr2 
    579579 
    580       IF ( kstp /= nit000-1 ) THEN 
     580      IF ( ( kstp /= nit000-1 ).AND.( kdir == 1 ) ) THEN 
    581581         tsb(:,:,:,:) = tsn(:,:,:,:) 
    582582         ub(:,:,:) = un(:,:,:) 
    583583         vb(:,:,:) = vn(:,:,:) 
     
    590590      vn(:,:,:)             = zwtr1 * vnr1    (:,:,:) + zwtr2 * vnr2    (:,:,:) 
    591591      tsn(:,:,:,jp_tem)     = zwtr1 * tnr1    (:,:,:) + zwtr2 * tnr2    (:,:,:) 
    592592      tsn(:,:,:,jp_sal)     = zwtr1 * snr1    (:,:,:) + zwtr2 * snr2    (:,:,:) 
     593      IF ( kdir == -1 ) THEN 
     594         zwtr1  = ( stpr2 - zstp + 1  ) * zden 
     595         zwtr2  = ( zstp - 1 - stpr1  ) * zden 
     596         ub(:,:,:)          = zwtr1 * unr1    (:,:,:) + zwtr2 * unr2    (:,:,:) 
     597         vb(:,:,:)          = zwtr1 * vnr1    (:,:,:) + zwtr2 * vnr2    (:,:,:) 
     598         tsb(:,:,:,jp_tem)  = zwtr1 * tnr1    (:,:,:) + zwtr2 * tnr2    (:,:,:) 
     599         tsb(:,:,:,jp_sal)  = zwtr1 * snr1    (:,:,:) + zwtr2 * snr2    (:,:,:) 
     600         IF(lwp)WRITE(numout,*) ' before lin. interp. coeff.', & 
     601           &                   '  = ', zwtr1, zwtr2 
     602 
     603         zwtr1  = ( stpr2 - zstp      ) * zden 
     604         zwtr2  = ( zstp  - stpr1     ) * zden       
     605      END IF 
    593606      IF ( kstp == nit000-1 ) THEN 
    594607         tsb(:,:,:,:) = tsn(:,:,:,:) 
    595608         ub(:,:,:) = un(:,:,:) 

Arguably we are not going to commit it to the release version of the code so I close the ticket

comment:13 Changed 11 months ago by smueller

In 11774:

Correction of the state-variable advancement in adjoint mode (application of the patch attached to ticket #1443)

Note: See TracTickets for help on using tickets.