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.
Changeset 6225 for branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90 – NEMO

Ignore:
Timestamp:
2016-01-08T10:35:19+01:00 (8 years ago)
Author:
jamesharle
Message:

Update MPP_BDY_UPDATE branch to be consistent with head of trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90

    r4488 r6225  
    44   !! Ocean Active tracers : lateral diffusive trends  
    55   !!===================================================================== 
    6    !! History :  9.0  ! 2005-11 (G. Madec)  Original code 
    7    !!       NEMO 3.0  ! 2008-01  (C. Ethe, G. Madec)  merge TRC-TRA  
    8    !!---------------------------------------------------------------------- 
    9  
    10    !!---------------------------------------------------------------------- 
    11    !!   tra_ldf      : update the tracer trend with the lateral diffusion 
    12    !!   tra_ldf_init : initialization, namelist read, and parameters control 
    13    !!       ldf_ano  : compute lateral diffusion for constant T-S profiles 
    14    !!---------------------------------------------------------------------- 
    15    USE oce             ! ocean dynamics and tracers 
    16    USE dom_oce         ! ocean space and time domain 
    17    USE phycst          ! physical constants 
    18    USE ldftra_oce      ! ocean tracer   lateral physics 
    19    USE ldfslp          ! ??? 
    20    USE traldf_bilapg   ! lateral mixing            (tra_ldf_bilapg routine) 
    21    USE traldf_bilap    ! lateral mixing             (tra_ldf_bilap routine) 
    22    USE traldf_iso      ! lateral mixing               (tra_ldf_iso routine) 
    23    USE traldf_iso_grif ! lateral mixing          (tra_ldf_iso_grif routine) 
    24    USE traldf_lap      ! lateral mixing               (tra_ldf_lap routine) 
    25    USE trdmod_oce      ! ocean space and time domain 
    26    USE trdtra          ! ocean active tracers trends 
    27    USE prtctl          ! Print control 
    28    USE in_out_manager  ! I/O manager 
    29    USE lib_mpp         ! distribued memory computing library 
    30    USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    31    USE wrk_nemo        ! Memory allocation 
    32    USE timing          ! Timing 
     6   !! History :  9.0  ! 2005-11  (G. Madec)  Original code 
     7   !!  NEMO      3.0  ! 2008-01  (C. Ethe, G. Madec)  merge TRC-TRA  
     8   !!            3.7  ! 2013-12  (G. Madec) remove the optional computation from T & S anomaly profiles and traldf_bilapg 
     9   !!             -   ! 2013-12  (F. Lemarie, G. Madec)  triad operator (Griffies) + Method of Stabilizing Correction 
     10   !!             -   ! 2014-01  (G. Madec, S. Masson)  restructuration/simplification of lateral diffusive operators 
     11   !!---------------------------------------------------------------------- 
     12 
     13   !!---------------------------------------------------------------------- 
     14   !!   tra_ldf       : update the tracer trend with the lateral diffusion trend 
     15   !!   tra_ldf_init  : initialization, namelist read, and parameters control 
     16   !!---------------------------------------------------------------------- 
     17   USE oce            ! ocean dynamics and tracers 
     18   USE dom_oce        ! ocean space and time domain 
     19   USE phycst         ! physical constants 
     20   USE ldftra         ! lateral diffusion: eddy diffusivity & EIV coeff. 
     21   USE ldfslp         ! lateral diffusion: iso-neutral slope 
     22   USE traldf_lap_blp ! lateral diffusion: laplacian iso-level            operator  (tra_ldf_lap/_blp   routines) 
     23   USE traldf_iso     ! lateral diffusion: laplacian iso-neutral standard operator  (tra_ldf_iso        routine ) 
     24   USE traldf_triad   ! lateral diffusion: laplacian iso-neutral triad    operator  (tra_ldf_triad      routine ) 
     25   USE trd_oce        ! trends: ocean variables 
     26   USE trdtra         ! ocean active tracers trends 
     27   ! 
     28   USE prtctl         ! Print control 
     29   USE in_out_manager ! I/O manager 
     30   USE lib_mpp        ! distribued memory computing library 
     31   USE lbclnk         ! ocean lateral boundary conditions (or mpp link) 
     32   USE wrk_nemo       ! Memory allocation 
     33   USE timing         ! Timing 
    3334 
    3435   IMPLICIT NONE 
    3536   PRIVATE 
    3637 
    37    PUBLIC   tra_ldf         ! called by step.F90  
    38    PUBLIC   tra_ldf_init    ! called by opa.F90  
     38   PUBLIC   tra_ldf        ! called by step.F90  
     39   PUBLIC   tra_ldf_init   ! called by nemogcm.F90  
    3940   ! 
    40    INTEGER ::   nldf = 0   ! type of lateral diffusion used defined from ln_traldf_... namlist logicals) 
    41  
    42    REAL, SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::   t0_ldf, s0_ldf   !: lateral diffusion trends of T & S for a cst profile 
    43    !                                                               !  (key_traldf_ano only) 
    44  
     41   INTEGER ::   nldf = 0   ! type of lateral diffusion used defined from ln_traldf_... (namlist logicals) 
     42    
    4543   !! * Substitutions 
    46 #  include "domzgr_substitute.h90" 
    4744#  include "vectopt_loop_substitute.h90" 
    4845   !!---------------------------------------------------------------------- 
    49    !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
     46   !! NEMO/OPA 3.7 , NEMO Consortium (2015) 
    5047   !! $Id$  
    5148   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    6461      !!---------------------------------------------------------------------- 
    6562      ! 
    66       IF( nn_timing == 1 )  CALL timing_start('tra_ldf') 
    67       ! 
    68       rldf = 1     ! For active tracers the  
    69  
     63      IF( nn_timing == 1 )   CALL timing_start('tra_ldf') 
     64      ! 
    7065      IF( l_trdtra )   THEN                    !* Save ta and sa trends 
    71          CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds )  
     66         CALL wrk_alloc( jpi,jpj,jpk,  ztrdt, ztrds )  
    7267         ztrdt(:,:,:) = tsa(:,:,:,jp_tem)  
    7368         ztrds(:,:,:) = tsa(:,:,:,jp_sal) 
    7469      ENDIF 
    75  
    76       SELECT CASE ( nldf )                       ! compute lateral mixing trend and add it to the general trend 
    77       CASE ( 0 )   ;   CALL tra_ldf_lap     ( kt, nit000, 'TRA', gtsu, gtsv, tsb, tsa, jpts        )  ! iso-level laplacian 
    78       CASE ( 1 )                                                                              ! rotated laplacian 
    79          IF( ln_traldf_grif ) THEN                                                           
    80                        CALL tra_ldf_iso_grif( kt, nit000,'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 )      ! Griffies operator 
    81          ELSE                                                                                 
    82                        CALL tra_ldf_iso     ( kt, nit000, 'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 )      ! Madec operator 
    83          ENDIF 
    84       CASE ( 2 )   ;   CALL tra_ldf_bilap   ( kt, nit000, 'TRA', gtsu, gtsv, tsb, tsa, jpts        )  ! iso-level bilaplacian 
    85       CASE ( 3 )   ;   CALL tra_ldf_bilapg  ( kt, nit000, 'TRA',             tsb, tsa, jpts        )  ! s-coord. geopot. bilap. 
    86          ! 
    87       CASE ( -1 )                                ! esopa: test all possibility with control print 
    88          CALL tra_ldf_lap   ( kt, nit000, 'TRA', gtsu, gtsv, tsb, tsa, jpts        )  
    89          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf0 - Ta: ', mask1=tmask,               & 
    90          &             tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' ) 
    91          IF( ln_traldf_grif ) THEN 
    92             CALL tra_ldf_iso_grif( kt, nit000, 'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 ) 
    93          ELSE 
    94             CALL tra_ldf_iso     ( kt, nit000, 'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 )   
    95          ENDIF 
    96          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf1 - Ta: ', mask1=tmask,               & 
    97          &             tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' ) 
    98          CALL tra_ldf_bilap ( kt, nit000, 'TRA', gtsu, gtsv, tsb, tsa, jpts        )  
    99          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf2 - Ta: ', mask1=tmask,               & 
    100          &             tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' ) 
    101          CALL tra_ldf_bilapg( kt, nit000, 'TRA',             tsb, tsa, jpts        )  
    102          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf3 - Ta: ', mask1=tmask,               & 
    103          &             tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' ) 
     70      ! 
     71      SELECT CASE ( nldf )                     !* compute lateral mixing trend and add it to the general trend 
     72      CASE ( np_lap   )                                  ! laplacian: iso-level operator 
     73         CALL tra_ldf_lap  ( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb,      tsa, jpts,  1   ) 
     74      CASE ( np_lap_i )                                  ! laplacian: standard iso-neutral operator (Madec) 
     75         CALL tra_ldf_iso  ( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb, tsb, tsa, jpts,  1   ) 
     76      CASE ( np_lap_it )                                 ! laplacian: triad iso-neutral operator (griffies) 
     77         CALL tra_ldf_triad( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb, tsb, tsa, jpts,  1   ) 
     78      CASE ( np_blp , np_blp_i , np_blp_it )             ! bilaplacian: iso-level & iso-neutral operators 
     79         CALL tra_ldf_blp  ( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb      , tsa, jpts, nldf ) 
    10480      END SELECT 
    105  
    106 #if defined key_traldf_ano 
    107       tsa(:,:,:,jp_tem) = tsa(:,:,:,jp_tem) - t0_ldf(:,:,:)      ! anomaly: substract the reference diffusivity 
    108       tsa(:,:,:,jp_sal) = tsa(:,:,:,jp_sal) - s0_ldf(:,:,:) 
    109 #endif 
    110  
    111       IF( l_trdtra )   THEN                      ! save the horizontal diffusive trends for further diagnostics 
     81      ! 
     82      IF( l_trdtra )   THEN                    !* save the horizontal diffusive trends for further diagnostics 
    11283         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:) 
    11384         ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:) 
    114          CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_ldf, ztrdt ) 
    115          CALL trd_tra( kt, 'TRA', jp_sal, jptra_trd_ldf, ztrds ) 
    116          CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds )  
    117       ENDIF 
    118       !                                          ! print mean trends (used for debugging) 
     85         CALL trd_tra( kt, 'TRA', jp_tem, jptra_ldf, ztrdt ) 
     86         CALL trd_tra( kt, 'TRA', jp_sal, jptra_ldf, ztrds ) 
     87         CALL wrk_dealloc( jpi,jpj,jpk,  ztrdt, ztrds )  
     88      ENDIF 
     89      !                                        !* print mean trends (used for debugging) 
    11990      IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf  - Ta: ', mask1=tmask,               & 
    12091         &                       tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' ) 
    12192      ! 
    122       IF( nn_timing == 1 )  CALL timing_stop('tra_ldf') 
     93      IF( nn_timing == 1 )   CALL timing_stop('tra_ldf') 
    12394      ! 
    12495   END SUBROUTINE tra_ldf 
     
    132103      !! 
    133104      !! ** Method  :   set nldf from the namtra_ldf logicals 
    134       !!      nldf == -1   ESOPA test: ALL operators are used 
    135       !!      nldf ==  0   laplacian operator 
    136       !!      nldf ==  1   Rotated laplacian operator 
    137       !!      nldf ==  2   bilaplacian operator 
    138       !!      nldf ==  3   Rotated bilaplacian 
    139       !!---------------------------------------------------------------------- 
    140       INTEGER ::   ioptio, ierr         ! temporary integers  
    141       !!---------------------------------------------------------------------- 
    142  
    143       !  Define the lateral mixing oparator for tracers 
    144       ! =============================================== 
    145      
    146       IF(lwp) THEN                    ! Namelist print 
     105      !!---------------------------------------------------------------------- 
     106      INTEGER ::   ioptio, ierr   ! temporary integers  
     107      !!---------------------------------------------------------------------- 
     108      ! 
     109      IF(lwp) THEN                     ! Namelist print 
    147110         WRITE(numout,*) 
    148111         WRITE(numout,*) 'tra_ldf_init : lateral tracer diffusive operator' 
    149112         WRITE(numout,*) '~~~~~~~~~~~' 
    150          WRITE(numout,*) '   Namelist namtra_ldf already read in ldftra module' 
    151          WRITE(numout,*) '   see ldf_tra_init report for lateral mixing parameters' 
     113         WRITE(numout,*) '   Namelist namtra_ldf: already read in ldftra module' 
     114         WRITE(numout,*) '      see ldf_tra_init report for lateral mixing parameters' 
    152115         WRITE(numout,*) 
    153116      ENDIF 
    154  
    155       !                               ! control the input 
     117      !                                   ! use of lateral operator or not 
     118      nldf   = np_ERROR 
    156119      ioptio = 0 
    157       IF( ln_traldf_lap   )   ioptio = ioptio + 1 
    158       IF( ln_traldf_bilap )   ioptio = ioptio + 1 
    159       IF( ioptio >  1 )   CALL ctl_stop( '          use ONE or NONE of the 2 lap/bilap operator type on tracer' ) 
    160       IF( ioptio == 0 )   nldf = -2   ! No lateral diffusion 
    161       ioptio = 0 
    162       IF( ln_traldf_level )   ioptio = ioptio + 1 
    163       IF( ln_traldf_hor   )   ioptio = ioptio + 1 
    164       IF( ln_traldf_iso   )   ioptio = ioptio + 1 
    165       IF( ioptio >  1 )   CALL ctl_stop( '          use only ONE direction (level/hor/iso)' ) 
    166  
    167       ! defined the type of lateral diffusion from ln_traldf_... logicals 
    168       ! CAUTION : nldf = 1 is used in trazdf_imp, change it carefully 
    169       ierr = 0 
    170       IF( ln_traldf_lap ) THEN       ! laplacian operator 
    171          IF ( ln_zco ) THEN                ! z-coordinate 
    172             IF ( ln_traldf_level )   nldf = 0      ! iso-level  (no rotation) 
    173             IF ( ln_traldf_hor   )   nldf = 0      ! horizontal (no rotation) 
    174             IF ( ln_traldf_iso   )   nldf = 1      ! isoneutral (   rotation) 
     120      IF( ln_traldf_lap )   ioptio = ioptio + 1 
     121      IF( ln_traldf_blp )   ioptio = ioptio + 1 
     122      IF( ioptio >  1   )   CALL ctl_stop( 'tra_ldf_init: use ONE or NONE of the 2 lap/bilap operator type on tracer' ) 
     123      IF( ioptio == 0   )   nldf = np_no_ldf     ! No lateral diffusion 
     124      ! 
     125      IF( nldf /= np_no_ldf ) THEN        ! direction ==>> type of operator   
     126         ioptio = 0 
     127         IF( ln_traldf_lev )   ioptio = ioptio + 1 
     128         IF( ln_traldf_hor )   ioptio = ioptio + 1 
     129         IF( ln_traldf_iso )   ioptio = ioptio + 1 
     130         IF( ioptio >  1 )   CALL ctl_stop( 'tra_ldf_init: use only ONE direction (level/hor/iso)' ) 
     131         ! 
     132         !                                ! defined the type of lateral diffusion from ln_traldf_... logicals 
     133         ierr = 0 
     134         IF( ln_traldf_lap ) THEN         ! laplacian operator 
     135            IF ( ln_zco ) THEN               ! z-coordinate 
     136               IF ( ln_traldf_lev   )   nldf = np_lap     ! iso-level = horizontal (no rotation) 
     137               IF ( ln_traldf_hor   )   nldf = np_lap     ! iso-level = horizontal (no rotation) 
     138               IF ( ln_traldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard  (   rotation) 
     139               IF ( ln_traldf_triad )   nldf = np_lap_it  ! iso-neutral: triad     (   rotation) 
     140            ENDIF 
     141            IF ( ln_zps ) THEN               ! z-coordinate with partial step 
     142               IF ( ln_traldf_lev   )   ierr = 1          ! iso-level not allowed  
     143               IF ( ln_traldf_hor   )   nldf = np_lap     ! horizontal             (no rotation) 
     144               IF ( ln_traldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard     (rotation) 
     145               IF ( ln_traldf_triad )   nldf = np_lap_it  ! iso-neutral: triad        (rotation) 
     146            ENDIF 
     147            IF ( ln_sco ) THEN               ! s-coordinate 
     148               IF ( ln_traldf_lev   )   nldf = np_lap     ! iso-level              (no rotation) 
     149               IF ( ln_traldf_hor   )   nldf = np_lap_i   ! horizontal             (   rotation) 
     150               IF ( ln_traldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard  (   rotation) 
     151               IF ( ln_traldf_triad )   nldf = np_lap_it  ! iso-neutral: triad     (   rotation) 
     152            ENDIF 
    175153         ENDIF 
    176          IF ( ln_zps ) THEN             ! z-coordinate 
    177             IF ( ln_traldf_level )   ierr = 1      ! iso-level not allowed 
    178             IF ( ln_traldf_hor   )   nldf = 0      ! horizontal (no rotation) 
    179             IF ( ln_traldf_iso   )   nldf = 1      ! isoneutral (   rotation) 
     154         ! 
     155         IF( ln_traldf_blp ) THEN         ! bilaplacian operator 
     156            IF ( ln_zco ) THEN               ! z-coordinate 
     157               IF ( ln_traldf_lev   )   nldf = np_blp     ! iso-level = horizontal (no rotation) 
     158               IF ( ln_traldf_hor   )   nldf = np_blp     ! iso-level = horizontal (no rotation) 
     159               IF ( ln_traldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard  (   rotation) 
     160               IF ( ln_traldf_triad )   nldf = np_blp_it  ! iso-neutral: triad     (   rotation) 
     161            ENDIF 
     162            IF ( ln_zps ) THEN               ! z-coordinate with partial step 
     163               IF ( ln_traldf_lev   )   ierr = 1          ! iso-level not allowed  
     164               IF ( ln_traldf_hor   )   nldf = np_blp     ! horizontal             (no rotation) 
     165               IF ( ln_traldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard  (   rotation) 
     166               IF ( ln_traldf_triad )   nldf = np_blp_it  ! iso-neutral: triad     (   rotation) 
     167            ENDIF 
     168            IF ( ln_sco ) THEN               ! s-coordinate 
     169               IF ( ln_traldf_lev   )   nldf = np_blp     ! iso-level              (no rotation) 
     170               IF ( ln_traldf_hor   )   nldf = np_blp_it  ! horizontal             (   rotation) 
     171               IF ( ln_traldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard  (   rotation) 
     172               IF ( ln_traldf_triad )   nldf = np_blp_it  ! iso-neutral: triad     (   rotation) 
     173            ENDIF 
    180174         ENDIF 
    181          IF ( ln_sco ) THEN             ! z-coordinate 
    182             IF ( ln_traldf_level )   nldf = 0      ! iso-level  (no rotation) 
    183             IF ( ln_traldf_hor   )   nldf = 1      ! horizontal (   rotation) 
    184             IF ( ln_traldf_iso   )   nldf = 1      ! isoneutral (   rotation) 
    185          ENDIF 
    186       ENDIF 
    187  
    188       IF( ln_traldf_bilap ) THEN      ! bilaplacian operator 
    189          IF ( ln_zco ) THEN                ! z-coordinate 
    190             IF ( ln_traldf_level )   nldf = 2      ! iso-level  (no rotation) 
    191             IF ( ln_traldf_hor   )   nldf = 2      ! horizontal (no rotation) 
    192             IF ( ln_traldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
    193          ENDIF 
    194          IF ( ln_zps ) THEN             ! z-coordinate 
    195             IF ( ln_traldf_level )   ierr = 1      ! iso-level not allowed  
    196             IF ( ln_traldf_hor   )   nldf = 2      ! horizontal (no rotation) 
    197             IF ( ln_traldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
    198          ENDIF 
    199          IF ( ln_sco ) THEN             ! z-coordinate 
    200             IF ( ln_traldf_level )   nldf = 2      ! iso-level  (no rotation) 
    201             IF ( ln_traldf_hor   )   nldf = 3      ! horizontal (   rotation) 
    202             IF ( ln_traldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
    203          ENDIF 
    204       ENDIF 
    205  
    206       IF( nldf == 3 )   CALL ctl_warn( 'geopotential bilaplacian tracer diffusion in s-coords not thoroughly tested' ) 
    207       IF( ierr == 1 )   CALL ctl_stop( ' iso-level in z-coordinate - partial step, not allowed' ) 
    208       IF( ierr == 2 )   CALL ctl_stop( ' isoneutral bilaplacian operator does not exist' ) 
    209       IF( lk_traldf_eiv .AND. .NOT.ln_traldf_iso )   & 
    210            CALL ctl_stop( '          eddy induced velocity on tracers',   & 
    211            &              ' the eddy induced velocity on tracers requires isopycnal laplacian diffusion' ) 
    212       IF( nldf == 1 .OR. nldf == 3 ) THEN      ! rotation 
    213          IF( .NOT.lk_ldfslp )   CALL ctl_stop( '          the rotation of the diffusive tensor require key_ldfslp' ) 
    214          l_traldf_rot = .TRUE.                 ! needed for trazdf_imp 
    215       ENDIF 
    216  
    217       IF( lk_esopa ) THEN 
    218          IF(lwp) WRITE(numout,*) '          esopa control: use all lateral physics options' 
    219          nldf = -1 
    220       ENDIF 
    221  
     175      ENDIF 
     176      ! 
     177      IF( ierr == 1 )   CALL ctl_stop( 'iso-level in z-partial step, not allowed' ) 
     178      IF( ln_ldfeiv .AND. .NOT.( ln_traldf_iso .OR. ln_traldf_triad ) )                                    & 
     179           &            CALL ctl_stop( 'eddy induced velocity on tracers requires iso-neutral laplacian diffusion' ) 
     180           ! 
     181      IF(  nldf == np_lap_i .OR. nldf == np_lap_it .OR. & 
     182         & nldf == np_blp_i .OR. nldf == np_blp_it  )   l_ldfslp = .TRUE.    ! slope of neutral surfaces required  
     183      ! 
    222184      IF(lwp) THEN 
    223185         WRITE(numout,*) 
    224          IF( nldf == -2 )   WRITE(numout,*) '          NO lateral diffusion' 
    225          IF( nldf == -1 )   WRITE(numout,*) '          ESOPA test All scheme used' 
    226          IF( nldf ==  0 )   WRITE(numout,*) '          laplacian operator' 
    227          IF( nldf ==  1 )   WRITE(numout,*) '          Rotated laplacian operator' 
    228          IF( nldf ==  2 )   WRITE(numout,*) '          bilaplacian operator' 
    229          IF( nldf ==  3 )   WRITE(numout,*) '          Rotated bilaplacian' 
    230       ENDIF 
    231  
    232       ! Reference T & S diffusivity (if necessary) 
    233       ! =========================== 
    234       CALL ldf_ano 
     186         SELECT CASE( nldf ) 
     187         CASE( np_no_ldf )   ;   WRITE(numout,*) '   NO lateral diffusion' 
     188         CASE( np_lap    )   ;   WRITE(numout,*) '   laplacian iso-level operator' 
     189         CASE( np_lap_i  )   ;   WRITE(numout,*) '   Rotated laplacian operator (standard)' 
     190         CASE( np_lap_it )   ;   WRITE(numout,*) '   Rotated laplacian operator (triad)' 
     191         CASE( np_blp    )   ;   WRITE(numout,*) '   bilaplacian iso-level operator' 
     192         CASE( np_blp_i  )   ;   WRITE(numout,*) '   Rotated bilaplacian operator (standard)' 
     193         CASE( np_blp_it )   ;   WRITE(numout,*) '   Rotated bilaplacian operator (triad)' 
     194         END SELECT 
     195      ENDIF 
    235196      ! 
    236197   END SUBROUTINE tra_ldf_init 
    237  
    238 #if defined key_traldf_ano 
    239    !!---------------------------------------------------------------------- 
    240    !!   'key_traldf_ano'               T & S lateral diffusion on anomalies 
    241    !!---------------------------------------------------------------------- 
    242  
    243    SUBROUTINE ldf_ano 
    244       !!---------------------------------------------------------------------- 
    245       !!                  ***  ROUTINE ldf_ano  *** 
    246       !! 
    247       !! ** Purpose :   initializations of  
    248       !!---------------------------------------------------------------------- 
    249       ! 
    250       USE zdf_oce         ! vertical mixing 
    251       USE trazdf          ! vertical mixing: double diffusion 
    252       USE zdfddm          ! vertical mixing: double diffusion 
    253       ! 
    254       INTEGER  ::   jk              ! Dummy loop indice 
    255       INTEGER  ::   ierr            ! local integer 
    256       LOGICAL  ::   llsave          ! local logical 
    257       REAL(wp) ::   zt0, zs0, z12   ! local scalar 
    258       REAL(wp), POINTER, DIMENSION(:,:,:) :: zt_ref, zs_ref, ztb, zsb, zavt      
    259       !!---------------------------------------------------------------------- 
    260       ! 
    261       IF( nn_timing == 1 )  CALL timing_start('ldf_ano') 
    262       ! 
    263       CALL wrk_alloc( jpi, jpj, jpk, zt_ref, zs_ref, ztb, zsb, zavt )  
    264       ! 
    265  
    266       IF(lwp) THEN 
    267          WRITE(numout,*) 
    268          WRITE(numout,*) 'tra:ldf_ano : lateral diffusion acting on anomalies' 
    269          WRITE(numout,*) '~~~~~~~~~~~' 
    270       ENDIF 
    271  
    272       !                              ! allocate trabbl arrays 
    273       ALLOCATE( t0_ldf(jpi,jpj,jpk) , s0_ldf(jpi,jpj,jpk) , STAT=ierr ) 
    274       IF( lk_mpp    )   CALL mpp_sum( ierr ) 
    275       IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'ldf_ano: unable to allocate arrays' ) 
    276  
    277       ! defined the T & S reference profiles 
    278       ! ------------------------------------ 
    279       zt0 =10.e0                               ! homogeneous ocean 
    280       zs0 =35.e0 
    281       zt_ref(:,:,:) = 10.0 * tmask(:,:,:) 
    282       zs_ref(:,:,:) = 35.0 * tmask(:,:,:) 
    283       IF(lwp) WRITE(numout,*) '              homogeneous ocean T = ', zt0, ' S = ',zs0 
    284  
    285       !                                        ! T & S profile (to be coded +namelist parameter 
    286  
    287       ! prepare the ldf computation 
    288       ! --------------------------- 
    289       llsave = l_trdtra 
    290       l_trdtra = .false.      ! desactivate trend computation 
    291       t0_ldf(:,:,:) = 0.e0 
    292       s0_ldf(:,:,:) = 0.e0 
    293       ztb   (:,:,:) = tsb (:,:,:,jp_tem) 
    294       zsb   (:,:,:) = tsb (:,:,:,jp_sal) 
    295       ua    (:,:,:) = tsa (:,:,:,jp_tem) 
    296       va    (:,:,:) = tsa (:,:,:,jp_sal) 
    297       zavt  (:,:,:) = avt(:,:,:) 
    298       IF( lk_zdfddm ) THEN CALL ctl_stop( ' key_traldf_ano with key_zdfddm not implemented' ) 
    299       ! set tb, sb to reference values and avr to zero 
    300       tsb (:,:,:,jp_tem) = zt_ref(:,:,:) 
    301       tsb (:,:,:,jp_sal) = zs_ref(:,:,:) 
    302       tsa (:,:,:,jp_tem) = 0.e0 
    303       tsa (:,:,:,jp_sal) = 0.e0 
    304       avt(:,:,:)         = 0.e0 
    305  
    306       ! Compute the ldf trends 
    307       ! ---------------------- 
    308       CALL tra_ldf( nit000 + 1 )      ! horizontal components (+1: no more init) 
    309       CALL tra_zdf( nit000     )      ! vertical component (if necessary nit000 to performed the init) 
    310  
    311       ! finalise the computation and recover all arrays 
    312       ! ----------------------------------------------- 
    313       l_trdtra = llsave 
    314       z12 = 2.e0 
    315       IF( neuler == 1)   z12 = 1.e0 
    316       IF( ln_zdfexp ) THEN      ! ta,sa are the trends 
    317          t0_ldf(:,:,:) = tsa(:,:,:,jp_tem) 
    318          s0_ldf(:,:,:) = tsa(:,:,:,jp_sal) 
    319       ELSE 
    320          DO jk = 1, jpkm1 
    321             t0_ldf(:,:,jk) = ( tsa(:,:,jk,jp_tem) - tsb(:,:,jk,jp_tem) ) / ( z12 *rdttra(jk) ) 
    322             s0_ldf(:,:,jk) = ( tsa(:,:,jk,jp_sal) - tsb(:,:,jk,jp_sal) ) / ( z12 *rdttra(jk) ) 
    323          END DO 
    324       ENDIF 
    325       tsb(:,:,:,jp_tem) = ztb (:,:,:) 
    326       tsb(:,:,:,jp_sal) = zsb (:,:,:) 
    327       tsa(:,:,:,jp_tem) = ua  (:,:,:) 
    328       tsa(:,:,:,jp_sal) = va  (:,:,:) 
    329       avt(:,:,:)        = zavt(:,:,:) 
    330       ! 
    331       CALL wrk_dealloc( jpi, jpj, jpk, zt_ref, zs_ref, ztb, zsb, zavt )  
    332       ! 
    333       IF( nn_timing == 1 )  CALL timing_stop('ldf_ano') 
    334       ! 
    335    END SUBROUTINE ldf_ano 
    336  
    337 #else 
    338    !!---------------------------------------------------------------------- 
    339    !!   default option :   Dummy code   NO T & S background profiles 
    340    !!---------------------------------------------------------------------- 
    341    SUBROUTINE ldf_ano 
    342       IF(lwp) THEN 
    343          WRITE(numout,*) 
    344          WRITE(numout,*) 'tra:ldf_ano : lateral diffusion acting on the full fields' 
    345          WRITE(numout,*) '~~~~~~~~~~~' 
    346       ENDIF 
    347    END SUBROUTINE ldf_ano 
    348 #endif 
    349198 
    350199   !!====================================================================== 
Note: See TracChangeset for help on using the changeset viewer.