Version 5 (modified by cetlod, 11 years ago) (diff)

Last edited Timestamp?

Christian Ethé

### Branch

DEV_r1837_TRA_TRP ( the number of revision will be updated )

### Description

Motivations
System simplification : Merge of active and passive tracer advection/diffusion modules to avoid duplication of almost identical modules

Strategy

(1) Creation of advection/diffusion modules with 4D tracer array as input argument

```   SUBROUTINE tra_adv_cen2( kt, cdtype, pun, pvn, pwn, ptrab, ptran, ptraa )
!!----------------------------------------------------------------------
!!
!! ** Purpose :
!!
!! ** Method  :
!!----------------------------------------------------------------------
INTEGER         , INTENT(in   )                         ::   kt              ! ocean time-step index
CHARACTER(len=3), INTENT(in   )                         ::   cdtype          ! =TRA or TRC (tracer indicator)
REAL(wp)        , INTENT(in   ), DIMENSION(:,:,:  )     ::   pun, pvn, pwn   ! 3 ocean velocity ( fluxes ) components
REAL(wp)        , INTENT(in   ), DIMENSION(:,:,:  )     ::   ptrab, ptran    ! before and now tracer fields
REAL(wp)        , INTENT(inout), DIMENSION(:,:,:,:)     ::   ptraa           ! tracer trend
```

(2) Test for T & S 3D arrays by using the fortran RESHAPE function

```   SUBROUTINE tra_adv( kt )
!!----------------------------------------------------------------------
!!
!! ** Purpose :
!!
!! ** Method  :
!!----------------------------------------------------------------------
INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
!!
INTEGER ::   jk   ! dummy loop index
REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zun, zvn, zwn   ! effective transports
!!----------------------------------------------------------------------

!                                              ! effective transport
DO jk = 1, jpkm1
!                                                ! eulerian + bbl transport
zun(:,:,jk) = e2u(:,:) * fse3u(:,:,jk) * ( un(:,:,jk) - u_bbl(:,:,jk) )
zvn(:,:,jk) = e1v(:,:) * fse3v(:,:,jk) * ( vn(:,:,jk) - v_bbl(:,:,jk) )
zwn(:,:,jk) = e1t(:,:) * e2t(:,:)      * ( wn(:,:,jk) + w_bbl(:,:,jk) )
#else
!                                                ! eulerian transport only
zun(:,:,jk) = e2u(:,:) * fse3u(:,:,jk) *   un(:,:,jk)
zvn(:,:,jk) = e1v(:,:) * fse3v(:,:,jk) *   vn(:,:,jk)
zwn(:,:,jk) = e1t(:,:) * e2t(:,:)      *   wn(:,:,jk)
#endif
END DO
zwn(:,:,jpk) = 0.e0                                 ! no transport trough the bottom

!                                                   ! add the eiv transport (if necessary)
IF( lk_traldf_eiv )   CALL tra_adv_eiv( kt, zun, zvn, zwn )

CALL tra_adv_cen2( kt, 'TRA', zun, zvn, zwn                        ,  &
&                          RESHAPE( tb, (/jpi,jpj,jpk,2/), sb ) ,  &
&                          RESHAPE( tn, (/jpi,jpj,jpk,2/), sn ) ,  &
&                          RESHAPE( ta, (/jpi,jpj,jpk,2/), sa )      )    ! 2nd order centered
```

(3) Apply to the passive tracers

```   SUBROUTINE trc_adv( kt )
!!----------------------------------------------------------------------
!!
!! ** Purpose :
!!
!! ** Method  :
!!----------------------------------------------------------------------
INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
!!
INTEGER ::   jk   ! dummy loop index
REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zun, zvn, zwn   ! effective transports
!!----------------------------------------------------------------------

!                                              ! effective transport
DO jk = 1, jpkm1
!                                                ! eulerian + bbl transport
zun(:,:,jk) = e2u(:,:) * fse3u(:,:,jk) * ( un(:,:,jk) - u_trc_bbl(:,:,jk) )
zvn(:,:,jk) = e1v(:,:) * fse3v(:,:,jk) * ( vn(:,:,jk) - v_trc_bbl(:,:,jk) )
zwn(:,:,jk) = e1t(:,:) * e2t(:,:)      * ( wn(:,:,jk) + w_trc_bbl(:,:,jk) )
#else
!                                                ! eulerian transport only
zun(:,:,jk) = e2u(:,:) * fse3u(:,:,jk) *   un(:,:,jk)
zvn(:,:,jk) = e1v(:,:) * fse3v(:,:,jk) *   vn(:,:,jk)
zwn(:,:,jk) = e1t(:,:) * e2t(:,:)      *   wn(:,:,jk)
#endif
END DO
zwn(:,:,jpk) = 0.e0                                 ! no transport trough the bottom

!                                                   ! add the eiv transport (if necessary)
IF( lk_trcldf_eiv )   CALL trc_adv_eiv( kt, zun, zvn, zwn )

CALL tra_adv_cen2( kt, 'TRC', zun, zvn, zwn, trb, trn, tra )    ! 2nd order centered
```

(4) replace T and S 3D arrays by 4D arrays TS throughout the code

### Testing

Testing could consider (where appropriate) other configurations in addition to NVTK].

 NVTK Tested '''YES/NO''' Other model configurations '''YES/NO''' Processor configurations tested [ Enter processor configs tested here ] If adding new functionality please confirm that the New code doesn't change results when it is switched off and ''works'' when switched on '''YES/NO/NA'''

(Answering UNSURE is likely to generate further questions from reviewers.)

• Processor configurations tested
• etc——

### Bit Comparability

 Does this change preserve answers in your tested standard configurations (to the last bit) ? '''YES/NO ''' Does this change bit compare across various processor configurations. (1xM, Nx1 and MxN are recommended) '''YES/NO''' Is this change expected to preserve answers in all possible model configurations? '''YES/NO''' Is this change expected to preserve all diagnostics? ,,''Preserving answers in model runs does not necessarily imply preserved diagnostics. '' '''YES/NO'''

If you answered '''NO''' to any of the above, please provide further details:

• Which routine(s) are causing the difference?
• Why the changes are not protected by a logical switch or new section-version
• What is needed to achieve regression with the previous model release (e.g. a regression branch, hand-edits etc). If this is not possible, explain why not.
• What do you expect to see occur in the test harness jobs?
• Which diagnostics have you altered and why have they changed?Please add details here……..

### System Changes

 Does your change alter namelists? '''YES/NO ''' Does your change require a change in compiler options? '''YES/NO '''

If any of these apply, please document the changes required here…….

### Resources

''Please ''summarize'' any changes in runtime or memory use caused by this change……''

### IPR issues

 Has the code been wholly (100%) produced by NEMO developers staff working exclusively on NEMO? '''YES/ NO '''

If No:

• Identify the collaboration agreement details
• Ensure the code routine header is in accordance with the agreement, (Copyright/Redistribution? etc).Add further details here if required……….