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 3318 for branches – NEMO

Changeset 3318 for branches


Ignore:
Timestamp:
2012-02-25T16:50:01+01:00 (12 years ago)
Author:
gm
Message:

Ediag branche: #927 split TRA/DYN trd computation

Location:
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM
Files:
65 edited
1 copied
3 moved

Legend:

Unmodified
Added
Removed
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/1_namelist

    r3306 r3318  
    748748!!====================================================================== 
    749749!!   namnc4       netcdf4 chunking and compression settings             ("key_netcdf4") 
    750 !!   namtrd       dynamics and/or tracer trends                         ("key_trddyn","key_trdtra","key_trdmld") 
     750!!   namtrd       dynamics and/or tracer trends                          
    751751!!   namflo       float parameters                                      ("key_float") 
    752752!!   namptr       Poleward Transport Diagnostics 
     
    769769!              !       or mixed-layer trends or barotropic vorticity    ("key_trdmld" or     "key_trdvor") 
    770770!----------------------------------------------------------------------- 
     771   ln_glo_trd  = .FALSE.   ! (T) global domain averaged diag for T, T^2, KE, and PE 
     772   ln_dyn_trd  = .FALSE.   ! (T) 3D momentum trend output 
     773   ln_dyn_mld  = .FALSE.   ! (T) 2D momentum trends averaged over the mixed layer  
     774   ln_vor_trd  = .FALSE.   ! (T) 2D barotropic vorticity trends  
     775   ln_KE_trd   = .FALSE.   ! (T) 3D Kinetic   Energy     trends 
     776   ln_PE_trd   = .FALSE.   ! (T) 3D Potential Energy     trends 
     777   ln_tra_trd  = .FALSE.   ! (T) 3D tracer trend output 
     778   ln_tra_mld  = .FALSE.   ! (T) 2D tracer trends averaged over the mixed layer  
    771779   nn_trd      = 365       !  time step frequency dynamics and tracers trends 
    772780   nn_ctls     =   0       !  control surface type in mixed-layer trends (0,1 or n<jpk) 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist

    r3316 r3318  
    537537   ln_traldf_hor    =  .false.  !  horizontal (geopotential)   (needs "key_ldfslp" when ln_sco=T) 
    538538   ln_traldf_iso    =  .true.   !  iso-neutral                 (needs "key_ldfslp") 
    539    !                 !  Griffies parameters              (all need "key_ldfslp") 
     539   !                       !  Griffies parameters              (all need "key_ldfslp") 
    540540   ln_traldf_grif   =  .false.  !  use griffies triads 
    541541   ln_traldf_gdia   =  .false.  !  output griffies eddy velocities 
     
    793793!!====================================================================== 
    794794!!   namnc4       netcdf4 chunking and compression settings             ("key_netcdf4") 
    795 !!   namtrd       dynamics and/or tracer trends                         ("key_trddyn","key_trdtra","key_trdmld") 
     795!!   namtrd       dynamics and/or tracer trends                          
    796796!!   namflo       float parameters                                      ("key_float") 
    797797!!   namptr       Poleward Transport Diagnostics 
     
    811811/ 
    812812!----------------------------------------------------------------------- 
    813 &namtrd        !   diagnostics on dynamics and/or tracer trends         ("key_trddyn" and/or "key_trdtra") 
    814 !              !       or mixed-layer trends or barotropic vorticity    ("key_trdmld" or     "key_trdvor") 
    815 !----------------------------------------------------------------------- 
    816    ln_3D_trd_d = .FALSE.   ! (T) 3D momentum             trends or (F) not 
    817    ln_3D_trd_t = .FALSE.   ! (T) 3D tracer               trends or (F) not 
    818    ln_ML_trd_d = .FALSE.   ! (T) 2D tracer   trends averaged over the mixed layer  
    819    ln_ML_trd_t = .FALSE.   ! (T) 2D momentum trends averaged over the mixed layer  
    820    ln_PE_trd   = .FALSE.   ! (T) 3D Potential Energy     trends or (F) not 
    821    ln_KE_trd   = .FALSE.   ! (T) 3D Kinetic   Energy     trends or (F) not 
    822    ln_vor_trd  = .FALSE.   ! (T) 3D barotropic vorticity trends or (F) not 
     813&namtrd        !   diagnostics on dynamics and/or tracer trends          
     814!              !       or mixed-layer trends or barotropic vorticity     
     815!----------------------------------------------------------------------- 
    823816   ln_glo_trd  = .FALSE.   ! (T) global domain averaged diag for T, T^2, KE, and PE 
     817   ln_dyn_trd  = .FALSE.   ! (T) 3D momentum trend output 
     818   ln_dyn_mld  = .FALSE.   ! (T) 2D momentum trends averaged over the mixed layer  
     819   ln_vor_trd  = .FALSE.   ! (T) 2D barotropic vorticity trends  
     820   ln_KE_trd   = .FALSE.   ! (T) 3D Kinetic   Energy     trends 
     821   ln_PE_trd   = .FALSE.   ! (T) 3D Potential Energy     trends 
     822   ln_tra_trd  = .FALSE.   ! (T) 3D tracer trend output 
     823   ln_tra_mld  = .FALSE.   ! (T) 2D tracer trends averaged over the mixed layer  
    824824   nn_trd      = 365       !  print frequency (ln_glo_trd=T) (unit=time step) 
    825825   nn_ctls     =   0       !  control surface type in mixed-layer trends (0,1 or n<jpk) 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv_cen2.F90

    r3316 r3318  
    1515   USE oce            ! ocean dynamics and tracers 
    1616   USE dom_oce        ! ocean space and time domain 
    17    USE trdmod_oce     ! ocean variables trends 
    18    USE trdmod         ! ocean dynamics trends 
     17   USE trd_oce        ! trends: ocean variables 
     18   USE trddyn         ! trend manager: dynamics 
    1919   USE in_out_manager ! I/O manager 
    2020   USE lib_mpp        ! MPP library 
     
    103103         zfu_uw(:,:,:) = ua(:,:,:) - zfu_uw(:,:,:) 
    104104         zfv_vw(:,:,:) = va(:,:,:) - zfv_vw(:,:,:) 
    105          CALL trd_mod( zfu_uw, zfv_vw, jpdyn_trd_keg, 'DYN', kt ) 
     105         CALL trd_dyn( zfu_uw, zfv_vw, jpdyn_keg, kt ) 
    106106         zfu_t(:,:,:) = ua(:,:,:) 
    107107         zfv_t(:,:,:) = va(:,:,:) 
     
    153153         zfu_t(:,:,:) = ua(:,:,:) - zfu_t(:,:,:) 
    154154         zfv_t(:,:,:) = va(:,:,:) - zfv_t(:,:,:) 
    155          CALL trd_mod( zfu_t, zfv_t, jpdyn_trd_zad, 'DYN', kt ) 
     155         CALL trd_dyn( zfu_t, zfv_t, jpdyn_zad, kt ) 
    156156      ENDIF 
    157157      !                                            ! Control print 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv_ubs.F90

    r3316 r3318  
    1616   USE oce            ! ocean dynamics and tracers 
    1717   USE dom_oce        ! ocean space and time domain 
    18    USE trdmod         ! ocean dynamics trends 
    19    USE trdmod_oce     ! ocean variables trends 
     18   USE trd_oce        ! trends: ocean variables 
     19   USE trddyn         ! trend manager: dynamics 
    2020   USE in_out_manager ! I/O manager 
    2121   USE prtctl         ! Print control 
     
    196196         zfu_uw(:,:,:) = ua(:,:,:) - zfu_uw(:,:,:) 
    197197         zfv_vw(:,:,:) = va(:,:,:) - zfv_vw(:,:,:) 
    198          CALL trd_mod( zfu_uw, zfv_vw, jpdyn_trd_keg, 'DYN', kt ) 
     198         CALL trd_dyn( zfu_uw, zfv_vw, jpdyn_keg, kt ) 
    199199         zfu_t(:,:,:) = ua(:,:,:) 
    200200         zfv_t(:,:,:) = va(:,:,:) 
     
    245245         zfu_t(:,:,:) = ua(:,:,:) - zfu_t(:,:,:) 
    246246         zfv_t(:,:,:) = va(:,:,:) - zfv_t(:,:,:) 
    247          CALL trd_mod( zfu_t, zfv_t, jpdyn_trd_zad, 'DYN', kt ) 
     247         CALL trd_dyn( zfu_t, zfv_t, jpdyn_zad, kt ) 
    248248      ENDIF 
    249249      !                                            ! Control print 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynbfr.F90

    r3317 r3318  
    1212   !!   dyn_bfr      : Update the momentum trend with the bottom friction contribution 
    1313   !!---------------------------------------------------------------------- 
    14    USE oce             ! ocean dynamics and tracers variables 
    15    USE dom_oce         ! ocean space and time domain variables  
    16    USE zdf_oce         ! ocean vertical physics variables 
    17    USE zdfbfr          ! ocean bottom friction variables 
    18    USE trdmod          ! ocean active dynamics and tracers trends  
    19    USE trdmod_oce      ! ocean variables trends 
    20    USE in_out_manager  ! I/O manager 
    21    USE prtctl          ! Print control 
    22    USE timing          ! Timing 
    23    USE wrk_nemo        ! Memory Allocation 
     14   USE oce            ! ocean dynamics and tracers variables 
     15   USE dom_oce        ! ocean space and time domain variables  
     16   USE zdf_oce        ! ocean vertical physics variables 
     17   USE zdfbfr         ! ocean bottom friction variables 
     18   USE trd_oce        ! trends: ocean variables 
     19   USE trddyn         ! trend manager: dynamics 
     20   USE in_out_manager ! I/O manager 
     21   USE prtctl         ! Print control 
     22   USE timing         ! Timing 
     23   USE wrk_nemo       ! Memory Allocation 
    2424 
    2525   IMPLICIT NONE 
    2626   PRIVATE 
    2727 
    28    PUBLIC   dyn_bfr    !  routine called by step.F90 
     28   PUBLIC   dyn_bfr   !  routine called by step.F90 
    2929 
    3030   !! * Substitutions 
     
    9292           ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    9393           ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    94            CALL trd_mod( ztrdu(:,:,:), ztrdv(:,:,:), jpdyn_trd_bfr, 'DYN', kt ) 
     94           CALL trd_dyn( ztrdu(:,:,:), ztrdv(:,:,:), jpdyn_bfr, kt ) 
    9595           CALL wrk_dealloc( jpi,jpj,jpk, ztrdu, ztrdv ) 
    9696        ENDIF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90

    r3294 r3318  
    3131   USE dom_oce         ! ocean space and time domain 
    3232   USE phycst          ! physical constants 
    33    USE trdmod          ! ocean dynamics trends  
    34    USE trdmod_oce      ! ocean variables trends 
     33   USE trd_oce         ! trends: ocean variables 
     34   USE trddyn          ! trend manager: dynamics 
    3535   USE in_out_manager  ! I/O manager 
    3636   USE prtctl          ! Print control 
     
    7474      !!    
    7575      !! ** Action : - Update (ua,va) with the now hydrastatic pressure trend 
    76       !!             - Save the trend (l_trddyn=T) 
     76      !!             - send trends to trd_dyn for futher diagnostics (l_trddyn=T) 
    7777      !!---------------------------------------------------------------------- 
    7878      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
     
    9999         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    100100         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    101          CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_hpg, 'DYN', kt ) 
     101         CALL trd_dyn( ztrdu, ztrdv, jpdyn_hpg, kt ) 
    102102         CALL wrk_dealloc( jpi,jpj,jpk, ztrdu, ztrdv ) 
    103103      ENDIF           
     
    427427   END SUBROUTINE hpg_sco 
    428428 
     429 
    429430   SUBROUTINE hpg_djc( kt ) 
    430431      !!--------------------------------------------------------------------- 
     
    664665      !! 
    665666      !! ** Action : - Update (ua,va) with the now hydrastatic pressure trend 
    666       !!             - Save the trend (l_trddyn=T) 
    667       !! 
    668667      !!---------------------------------------------------------------------- 
    669668      INTEGER, PARAMETER  :: polynomial_type = 1    ! 1: cubic spline, 2: linear 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynkeg.F90

    r3294 r3318  
    1414   USE oce             ! ocean dynamics and tracers 
    1515   USE dom_oce         ! ocean space and time domain 
    16    USE trdmod          ! ocean dynamics trends  
    17    USE trdmod_oce      ! ocean variables trends 
     16   USE trd_oce         ! trends: ocean variables 
     17   USE trddyn          ! trend manager: dynamics 
    1818   USE in_out_manager  ! I/O manager 
    1919   USE lib_mpp         ! MPP library 
     
    5252      !! 
    5353      !! ** Action : - Update the (ua, va) with the hor. ke gradient trend 
    54       !!             - save this trends (l_trddyn=T) for post-processing 
     54      !!             - send this trends to trd_dyn (l_trddyn=T) for post-processing 
    5555      !!---------------------------------------------------------------------- 
    5656      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     
    131131         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    132132         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    133          CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_keg, 'DYN', kt ) 
     133         CALL trd_dyn( ztrdu, ztrdv, jpdyn_keg, kt ) 
    134134         CALL wrk_dealloc( jpi,jpj,jpk, ztrdu, ztrdv ) 
    135135      ENDIF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf.F90

    r3294 r3318  
    2020   USE dynldf_iso     ! lateral mixing            (dyn_ldf_iso    routine) 
    2121   USE dynldf_lap     ! lateral mixing            (dyn_ldf_lap    routine) 
    22    USE trdmod         ! ocean dynamics and tracer trends 
    23    USE trdmod_oce     ! ocean variables trends 
     22   USE trd_oce        ! trends: ocean variables 
     23   USE trddyn         ! trend manager: dynamics 
    2424   USE prtctl         ! Print control 
    2525   USE in_out_manager ! I/O manager 
     
    5454      !! ** Purpose :   compute the lateral ocean dynamics physics. 
    5555      !!---------------------------------------------------------------------- 
    56       ! 
    5756      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
    5857      ! 
     
    106105         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    107106         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    108          CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_ldf, 'DYN', kt ) 
     107         CALL trd_dyn( ztrdu, ztrdv, jpdyn_ldf, kt ) 
    109108         CALL wrk_dealloc( jpi, jpj, jpk, ztrdu, ztrdv ) 
    110109      ENDIF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilap.F90

    r3294 r3318  
    2020   USE ldfdyn_oce      ! ocean dynamics: lateral physics 
    2121   USE in_out_manager  ! I/O manager 
    22    USE trdmod          ! ocean dynamics trends  
    23    USE trdmod_oce      ! ocean variables trends 
    2422   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    2523   USE wrk_nemo        ! Memory Allocation 
     
    7068      !!      Add this before trend to the general trend (ua,va): 
    7169      !!            (ua,va) = (ua,va) + (diffu,diffv) 
    72       !!      'key_trddyn' defined: the two components of the horizontal 
    73       !!                               diffusion trend are saved. 
    7470      !! 
    7571      !! ** Action : - Update (ua,va) with the before iso-level biharmonic 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilapg.F90

    r3294 r3318  
    2020   USE ldfdyn_oce      ! ocean dynamics lateral physics 
    2121   USE zdf_oce         ! ocean vertical physics 
    22    USE trdmod          ! ocean dynamics trends  
    23    USE trdmod_oce      ! ocean variables trends 
    2422   USE ldfslp          ! iso-neutral slopes available 
    2523   USE in_out_manager  ! I/O manager 
     
    8179      !!         -3- Add this trend to the general trend (ta,sa): 
    8280      !!            (ua,va) = (ua,va) + (zwk3,zwk4) 
    83       !!      'key_trddyn' defined: the trend is saved for diagnostics. 
    8481      !! 
    8582      !! ** Action  : - Update (ua,va) arrays with the before geopotential 
    8683      !!                biharmonic mixing trend. 
    87       !!              - save the trend in (zwk3,zwk4) ('key_trddyn') 
    8884      !!---------------------------------------------------------------------- 
    8985      INTEGER, INTENT( in ) ::   kt           ! ocean time-step index 
     
    176172      !!                          pu and pv (all the components except 
    177173      !!                          second order vertical derivative term) 
    178       !!      'key_trddyn' defined: the trend is saved for diagnostics. 
    179174      !!---------------------------------------------------------------------- 
    180175      !! 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_iso.F90

    r3294 r3318  
    2222   USE ldftra_oce      ! ocean tracer   lateral physics 
    2323   USE zdf_oce         ! ocean vertical physics 
    24    USE trdmod          ! ocean dynamics trends  
    25    USE trdmod_oce      ! ocean variables trends 
    2624   USE ldfslp          ! iso-neutral slopes  
    2725   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_lap.F90

    r3294 r3318  
    1919   USE ldfdyn_oce      ! ocean dynamics: lateral physics 
    2020   USE zdf_oce         ! ocean vertical physics 
     21   USE ldfslp          ! iso-neutral slopes  
    2122   USE in_out_manager  ! I/O manager 
    22    USE trdmod          ! ocean dynamics trends  
    23    USE trdmod_oce      ! ocean variables trends 
    24    USE ldfslp          ! iso-neutral slopes  
    2523   USE timing          ! Timing 
    2624 
     
    5755      !!      Add this before trend to the general trend (ua,va): 
    5856      !!            (ua,va) = (ua,va) + (diffu,diffv) 
    59       !!      'key_trddyn' activated: the two components of the horizontal 
    60       !!                                 diffusion trend are saved. 
    6157      !! 
    6258      !! ** Action : - Update (ua,va) with the before iso-level harmonic  
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynnept.F90

    r3294 r3318  
    55   !!                 recoded version of simplest case (u*, v* only) 
    66   !!====================================================================== 
    7    !! History :  1.0  !  2007-06  (Michael Dunphy)  Modular form: - new namelist parameters 
    8    !!                                                             - horizontal diffusion for Neptune 
    9    !!                                                             - vertical diffusion for gm in momentum eqns 
    10    !!                                                             - option to use Neptune in Coriolis eqn 
     7   !! History :  1.0  !  2007-06  (Zeliang Wang, Michael Dunphy, BIO)  Original code 
     8   !!                             Modular form: - new namelist parameters 
     9   !!                                           - horizontal diffusion for Neptune 
     10   !!                                           - vertical diffusion for gm in momentum eqns 
     11   !!                                           - option to use Neptune in Coriolis eqn 
    1112   !!                    2011-08  (Jeff Blundell, NOCS) Simplified form for temporally invariant u*, v* 
    12    !!                                               Horizontal and vertical diffusivity formulations removed 
    13    !!                                               Dynamic allocation of storage added 
    14    !!                                               Option of ramping Neptune vel. down 
    15    !!                                               to zero added in shallow depths added 
     13   !!                             Horizontal and vertical diffusivity formulations removed 
     14   !!                             Dynamic allocation of storage added 
     15   !!                             Option of ramping Neptune vel. down to zero added in shallow depths added 
     16   !!---------------------------------------------------------------------- 
     17 
    1618   !!---------------------------------------------------------------------- 
    1719   !! dynnept_alloc        : 
     
    3032   USE phycst 
    3133   USE lbclnk 
    32    USE wrk_nemo        ! Memory Allocation 
     34   USE wrk_nemo         ! Memory Allocation 
    3335 
    3436   IMPLICIT NONE 
    3537   PRIVATE 
    3638 
    37    !! * Routine accessibility 
    38    PUBLIC dyn_nept_init      ! routine called by nemogcm.F90 
    39    PUBLIC dyn_nept_cor       ! routine called by step.F90 
    40    !! dynnept_alloc()         is called only by dyn_nept_init, within this module 
    41    !! dyn_nept_div_cur_init   is called only by dyn_nept_init, within this module 
    42    !! dyn_nept_vel            is called only by dyn_nept_cor,  within this module 
    43  
    44    !! * Shared module variables 
    45    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)    :: zunep, zvnep  ! Neptune u and v 
    46    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  :: zhdivnep      ! hor. div for Neptune vel. 
    47    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  :: zmrotnep      ! curl for Neptune vel. 
    48  
    49  
    50    !! * Namelist namdyn_nept variables 
     39   PUBLIC   dyn_nept_init   ! routine called by nemogcm.F90 
     40   PUBLIC   dyn_nept_cor    ! routine called by step.F90 
     41 
     42   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: zunep, zvnep   ! Neptune u and v 
     43   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: zhdivnep       ! hor. div for Neptune vel. 
     44   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: zmrotnep       ! curl for Neptune vel. 
     45 
     46   !                                                 !!* Namelist namdyn_nept variables 
    5147   LOGICAL, PUBLIC  ::  ln_neptsimp        = .FALSE.  ! yes/no simplified neptune 
    5248 
     
    6056   REAL(wp)         ::  rn_htrmax          =  200.0   ! max. depth of transition range 
    6157 
    62    !! * Module variables 
    63  
    64  
    6558   !! * Substitutions 
    6659#  include "vectopt_loop_substitute.h90" 
    6760#  include "domzgr_substitute.h90" 
    6861   !!---------------------------------------------------------------------- 
    69    !!   OPA 9.0 , implemented by Bedford Institute of Oceanography 
    70    !!---------------------------------------------------------------------- 
    71  
     62   !! NEMO/OPA 3.3 , NEMO Consortium (2011) 
     63   !! $Id: dynadv_cen2.F90 3316 2012-02-21 16:00:02Z gm $ 
     64   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     65   !!---------------------------------------------------------------------- 
    7266 CONTAINS 
    7367 
     
    9084      !!                and compute the arrays zunep and zvnep 
    9185      !! 
    92       !! ** Method  :   zunep = 
    93       !!                zvnep = 
    94       !! 
    95       !! ** History :  1.0  !   07-05  (Zeliang Wang)   Original code for zunep, zvnep 
    96       !!               1.1  !   07-06  (Michael Dunphy) namelist and  initialisation 
    97       !!               2.0  ! 2011-07  (Jeff Blundell, NOCS) 
    98       !!                    ! Simplified form for temporally invariant u*, v* 
    99       !!                    ! Horizontal and vertical diffusivity formulations removed 
    100       !!                    ! Includes optional tapering-off in shallow depths 
     86      !! ** Method  :   Simplified form for temporally invariant u*, v* 
     87      !!                Horizontal and vertical diffusivity formulations removed 
     88      !!                Includes optional tapering-off in shallow depths 
    10189      !!---------------------------------------------------------------------- 
    10290      USE iom 
    103       !! 
     91      ! 
    10492      INTEGER  ::   ji, jj, jk    ! dummy loop indices 
    10593      REAL(wp) :: unemin,unemax,vnemin,vnemax   ! extrema of (u*, v*) fields 
     
    122110      ! ========================================== 
    123111 
    124 !!    WRITE(numout,*) ' start dynnept namelist' 
    125 !!    CALL FLUSH(numout) 
    126112      REWIND( numnam )                  ! Read Namelist namdyn_nept:  Simplified Neptune 
    127113      READ  ( numnam, namdyn_nept ) 
    128 !!    WRITE(numout,*) ' dynnept namelist done' 
    129 !!    CALL FLUSH(numout) 
    130114 
    131115      IF(lwp) THEN                      ! Control print 
     
    172156 
    173157      IF( .not. ln_rstart ) THEN      ! If restarting, these arrays are read from the restart file 
    174          zhdivnep(:,:,:) = 0.0_wp 
    175          zmrotnep(:,:,:) = 0.0_wp 
     158         zhdivnep(:,:,:) = 0._wp 
     159         zmrotnep(:,:,:) = 0._wp 
    176160      END IF 
    177161 
     
    361345      !! ** Action  : - compute zhdivnep, the hor. divergence of (u*, v*) 
    362346      !!              - compute zmrotnep, the rel. vorticity  of (u*, v*) 
    363       !! 
    364       !! History :  OPA  ! 1987-06  (P. Andrich, D. L Hostis)  Original code 
    365       !!            4.0  ! 1991-11  (G. Madec) 
    366       !!            6.0  ! 1993-03  (M. Guyon)  symetrical conditions 
    367       !!            7.0  ! 1996-01  (G. Madec)  s-coordinates 
    368       !!            8.0  ! 1997-06  (G. Madec)  lateral boundary cond., lbc 
    369       !!            8.1  ! 1997-08  (J.M. Molines)  Open boundaries 
    370       !!            8.2  ! 2000-03  (G. Madec)  no slip accurate 
    371       !!  NEMO      1.0  ! 2002-09  (G. Madec, E. Durand)  Free form, F90 
    372       !!             -   ! 2005-01  (J. Chanut) Unstructured open boundaries 
    373       !!             -   ! 2003-08  (G. Madec)  merged of cur and div, free form, F90 
    374       !!             -   ! 2005-01  (J. Chanut, A. Sellar) unstructured open boundaries 
    375       !!            3.3  ! 2010-09  (D.Storkey and E.O'Dea) bug fixes for BDY module 
    376       !!                 ! 2011-06  (Jeff Blundell, NOCS) Adapt code from divcur.F90 
    377       !!                 !           to compute Neptune effect fields only 
    378347      !!---------------------------------------------------------------------- 
    379348      ! 
     
    517486 
    518487   SUBROUTINE dyn_nept_smooth_vel( htold, htnew, ld_option ) 
    519  
    520488      !!---------------------------------------------------------------------- 
    521489      !!                  ***  ROUTINE dyn_nept_smooth_vel  *** 
     
    607575   END SUBROUTINE dyn_nept_smooth_vel 
    608576 
     577   !!============================================================================== 
    609578END MODULE dynnept 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynnxt.F90

    r3317 r3318  
    2626   USE dom_oce         ! ocean space and time domain 
    2727   USE sbc_oce         ! Surface boundary condition: ocean fields 
    28    USE trdmod_oce      ! ocean trends 
    2928   USE phycst          ! physical constants 
    3029   USE dynspg_oce      ! type of surface pressure gradient 
    3130   USE dynadv          ! dynamics: vector invariant versus flux form 
    3231   USE domvvl          ! variable volume 
    33    USE trdmod         ! ocean dynamics trends  
    34    USE trdmod_oce     ! ocean variables trends 
     32   USE trd_oce        ! trends: ocean variables 
     33   USE trddyn         ! trend manager: dynamics 
    3534   USE obc_oce         ! ocean open boundary conditions 
    3635   USE obcdyn          ! open boundary condition for momentum (obc_dyn routine) 
     
    192191#endif 
    193192 
    194       IF( ln_3D_trd_d ) THEN             ! 3D output: total momentum trends a prepare the atf trend computation 
    195          z1_2dt = 1._wp / (2. * rdt)            ! Euler or leap-frog time step  
    196          IF( neuler == 0 .AND. kt == nit000 )  z1_2dt = 1._wp / rdt 
    197          zua(:,:,:) = ( ua(:,:,:) - ub(:,:,:) ) * z1_2dt 
    198          zva(:,:,:) = ( va(:,:,:) - vb(:,:,:) ) * z1_2dt 
    199          CALL iom_put( "utrd_tot", zua )        ! total momentum trends (but the asselin time filter) 
    200          CALL iom_put( "vtrd_tot", zva ) 
    201          zua(:,:,:) = un(:,:,:)                 ! save the before velocity before the asselin filter 
    202          zva(:,:,:) = vn(:,:,:)                 ! (caution: there is a shift by 1 timestep in the 
     193       IF( l_trddyn ) THEN             ! prepare the atf trend computation 
     194         IF( ln_dyn_trd ) THEN                 ! 3D output: total momentum trends 
     195            z1_2dt = 1._wp / (2. * rdt)            ! Euler or leap-frog time step  
     196            IF( neuler == 0 .AND. kt == nit000 )  z1_2dt = 1._wp / rdt 
     197            zua(:,:,:) = ( ua(:,:,:) - ub(:,:,:) ) * z1_2dt 
     198            zva(:,:,:) = ( va(:,:,:) - vb(:,:,:) ) * z1_2dt 
     199            CALL iom_put( "utrd_tot", zua )        ! total momentum trends (but the asselin time filter) 
     200            CALL iom_put( "vtrd_tot", zva ) 
     201         ENDIF 
     202         zua(:,:,:) = un(:,:,:)                 ! save the now velocity before the asselin filter 
     203         zva(:,:,:) = vn(:,:,:)                 ! (caution: there will be a shift by 1 timestep in the 
    203204         !                                      !  computation of the asselin filter trends) 
    204205      ENDIF 
     
    293294      ENDIF 
    294295 
    295       IF( ln_3D_trd_d ) THEN             ! 3D output: asselin filter trends on momentum 
     296      IF( l_trddyn ) THEN                ! 3D output: asselin filter trends on momentum 
    296297         zua(:,:,:) = ( ub(:,:,:) - zua(:,:,:) ) * z1_2dt 
    297298         zva(:,:,:) = ( vb(:,:,:) - zva(:,:,:) ) * z1_2dt 
    298          CALL trd_mod( zua, zva, jpdyn_trd_atf, 'DYN', kt ) 
     299         CALL trd_dyn( zua, zva, jpdyn_atf, kt ) 
    299300      ENDIF 
    300301 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg.F90

    r3294 r3318  
    2222   USE dynspg_flt     ! surface pressure gradient     (dyn_spg_flt routine) 
    2323   USE dynadv         ! dynamics: vector invariant versus flux form 
    24    USE trdmod         ! ocean dynamics trends 
    25    USE trdmod_oce     ! ocean variables trends 
     24   USE trd_oce        ! trends: ocean variables 
     25   USE trddyn         ! trend manager: dynamics 
    2626   USE prtctl         ! Print control                     (prt_ctl routine) 
    2727   USE in_out_manager ! I/O manager 
    2828   USE lib_mpp        ! MPP library 
    29    USE solver          ! solver initialization 
    30    USE wrk_nemo        ! Memory Allocation 
    31    USE timing          ! Timing 
     29   USE solver         ! solver initialization 
     30   USE wrk_nemo       ! Memory Allocation 
     31   USE timing         ! Timing 
    3232 
    3333 
     
    145145         CASE( 2 ) 
    146146            z2dt = 2. * rdt 
    147             IF( neuler == 0 .AND. kt == nit000 ) z2dt = rdt 
     147            IF( neuler == 0 .AND. kt == nit000 )   z2dt = rdt 
    148148            ztrdu(:,:,:) = ( ua(:,:,:) - ub(:,:,:) ) / z2dt - ztrdu(:,:,:) 
    149149            ztrdv(:,:,:) = ( va(:,:,:) - vb(:,:,:) ) / z2dt - ztrdv(:,:,:) 
    150150         END SELECT 
    151          CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_spg, 'DYN', kt ) 
     151         CALL trd_dyn( ztrdu, ztrdv, jpdyn_spg, kt ) 
    152152         ! 
    153153         CALL wrk_dealloc( jpi, jpj, jpk, ztrdu, ztrdv )  
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynvor.F90

    r3316 r3318  
    1515   !!            3.2  ! 2009-04  (R. Benshila)  vvl: correction of een scheme 
    1616   !!            3.3  ! 2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase 
    17    !!            3.5  ! 2012-02  (G. Madec) suppress jpdyn_trd_dat vorticity trend simplification 
     17   !!            3.5  ! 2012-02  (G. Madec) trend simplification: suppress jpdyn_trd_dat vorticity  
    1818   !!---------------------------------------------------------------------- 
    1919 
     
    3030   USE dommsk         ! ocean mask 
    3131   USE dynadv         ! momentum advection (use ln_dynadv_vec value) 
    32    USE trdmod         ! ocean dynamics trends  
    33    USE trdmod_oce     ! ocean variables trends 
     32   USE trd_oce        ! trends: ocean variables 
     33   USE trddyn         ! trend manager: dynamics 
    3434   USE lbclnk         ! ocean lateral boundary conditions (or mpp link) 
    3535   USE prtctl         ! Print control 
     
    7474      !! ** Action : - Update (ua,va) with the now vorticity term trend 
    7575      !!             - save the trends in (ztrdu,ztrdv) in 2 parts (relative 
    76       !!               and planetary vorticity trends) ('key_trddyn') 
     76      !!               and planetary vorticity trends) (l_trddyn=T) 
    7777      !!---------------------------------------------------------------------- 
    7878      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     
    109109            ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    110110            ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    111             CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_rvo, 'DYN', kt ) 
     111            CALL trd_dyn( ztrdu, ztrdv, jpdyn_rvo, kt ) 
    112112            ztrdu(:,:,:) = ua(:,:,:) 
    113113            ztrdv(:,:,:) = va(:,:,:) 
     
    115115            ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    116116            ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    117             CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_pvo, 'DYN', kt ) 
     117            CALL trd_dyn( ztrdu, ztrdv, jpdyn_pvo, kt ) 
    118118         ELSE 
    119119            CALL vor_ene( kt, ntot, ua, va )                ! total vorticity 
     
    127127            ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    128128            ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    129             CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_rvo, 'DYN', kt ) 
     129            CALL trd_dyn( ztrdu, ztrdv, jpdyn_rvo, kt ) 
    130130            ztrdu(:,:,:) = ua(:,:,:) 
    131131            ztrdv(:,:,:) = va(:,:,:) 
     
    133133            ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    134134            ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    135             CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_pvo, 'DYN', kt ) 
     135            CALL trd_dyn( ztrdu, ztrdv, jpdyn_pvo, kt ) 
    136136         ELSE 
    137137            CALL vor_ens( kt, ntot, ua, va )                ! total vorticity 
     
    145145            ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    146146            ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    147             CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_rvo, 'DYN', kt ) 
     147            CALL trd_dyn( ztrdu, ztrdv, jpdyn_rvo, kt ) 
    148148            ztrdu(:,:,:) = ua(:,:,:) 
    149149            ztrdv(:,:,:) = va(:,:,:) 
     
    151151            ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    152152            ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    153             CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_pvo, 'DYN', kt ) 
     153            CALL trd_dyn( ztrdu, ztrdv, jpdyn_pvo, kt ) 
    154154         ELSE 
    155155            CALL vor_mix( kt )                               ! total vorticity (mix=ens-ene) 
     
    163163            ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    164164            ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    165             CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_rvo, 'DYN', kt ) 
     165            CALL trd_dyn( ztrdu, ztrdv, jpdyn_rvo, kt ) 
    166166            ztrdu(:,:,:) = ua(:,:,:) 
    167167            ztrdv(:,:,:) = va(:,:,:) 
     
    169169            ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    170170            ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    171             CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_pvo, 'DYN', kt ) 
     171            CALL trd_dyn( ztrdu, ztrdv, jpdyn_pvo, kt ) 
    172172         ELSE 
    173173            CALL vor_een( kt, ntot, ua, va )                ! total vorticity 
     
    208208      !! 
    209209      !! ** Action : - Update (ua,va) with the now vorticity term trend 
    210       !!             - save the trends in (ztrdu,ztrdv) in 2 parts (relative 
    211       !!               and planetary vorticity trends) ('key_trddyn') 
    212210      !! 
    213211      !! References : Sadourny, r., 1975, j. atmos. sciences, 32, 680-689. 
     
    325323      !! 
    326324      !! ** Action : - Update (ua,va) arrays with the now vorticity term trend 
    327       !!             - Save the trends in (ztrdu,ztrdv) in 2 parts (relative 
    328       !!               and planetary vorticity trends) ('key_trddyn') 
    329325      !! 
    330326      !! References : Sadourny, r., 1975, j. atmos. sciences, 32, 680-689. 
     
    441437      !! 
    442438      !! ** Action : - Update (ua,va) arrays with the now vorticity term trend 
    443       !!             - Save the trends in (ztrdu,ztrdv) in 2 parts (relative  
    444       !!               and planetary vorticity trends) ('key_trddyn') 
    445439      !! 
    446440      !! References : Sadourny, r., 1975, j. atmos. sciences, 32, 680-689. 
     
    554548      !! 
    555549      !! ** Action : - Update (ua,va) with the now vorticity term trend 
    556       !!             - save the trends in (ztrdu,ztrdv) in 2 parts (relative 
    557       !!               and planetary vorticity trends) ('key_trddyn') 
    558550      !! 
    559551      !! References : Arakawa and Lamb 1980, Mon. Wea. Rev., 109, 18-36 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynzad.F90

    r3294 r3318  
    1616   USE dom_oce        ! ocean space and time domain 
    1717   USE sbc_oce        ! surface boundary condition: ocean 
    18    USE trdmod_oce     ! ocean variables trends 
    19    USE trdmod         ! ocean dynamics trends  
     18   USE trd_oce        ! trends: ocean variables 
     19   USE trddyn         ! trend manager: dynamics 
    2020   USE in_out_manager ! I/O manager 
    21    USE lib_mpp         ! MPP library 
     21   USE lib_mpp        ! MPP library 
    2222   USE prtctl         ! Print control 
    23    USE wrk_nemo        ! Memory Allocation 
    24    USE timing          ! Timing 
     23   USE wrk_nemo       ! Memory Allocation 
     24   USE timing         ! Timing 
    2525 
    2626   IMPLICIT NONE 
     
    5353      !! 
    5454      !! ** Action  : - Update (ua,va) with the vert. momentum adv. trends 
    55       !!              - Save the trends in (ztrdu,ztrdv) ('key_trddyn') 
     55      !!              - Send the trends to trddyn for diagnostics (l_trddyn=T) 
    5656      !!---------------------------------------------------------------------- 
    5757      INTEGER, INTENT(in) ::   kt   ! ocean time-step inedx 
     
    118118         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    119119         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    120          CALL trd_mod(ztrdu, ztrdv, jpdyn_trd_zad, 'DYN', kt) 
     120         CALL trd_dyn( ztrdu, ztrdv, jpdyn_zad, kt ) 
    121121         CALL wrk_dealloc( jpi, jpj, jpk, ztrdu, ztrdv )  
    122122      ENDIF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf.F90

    r3294 r3318  
    2020 
    2121   USE ldfdyn_oce      ! ocean dynamics: lateral physics 
    22    USE trdmod          ! ocean active dynamics and tracers trends  
    23    USE trdmod_oce      ! ocean variables trends 
     22   USE trd_oce         ! trends: ocean variables 
     23   USE trddyn          ! trend manager: dynamics 
    2424   USE in_out_manager  ! I/O manager 
    2525   USE lib_mpp         ! MPP library 
     
    9191         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
    9292         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 
    93          CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_zdf, 'DYN', kt ) 
     93         CALL trd_dyn( ztrdu, ztrdv, jpdyn_zdf, kt ) 
    9494         ! 
    9595         CALL wrk_dealloc( jpi, jpj, jpk, ztrdu, ztrdv )  
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90

    r3294 r3318  
    1818   USE oce             ! ocean dynamics and tracers  
    1919   USE dom_oce         ! ocean space and time domain 
     20   USE trd_oce         ! ocean trend diagnostics 
    2021   USE phycst          ! physical constants 
    2122   USE in_out_manager  ! I/O manager 
     
    136137      IF( kt == nitrst ) THEN 
    137138         CALL iom_close( numrow )     ! close the restart file (only at last time step) 
    138          IF( .NOT. lk_trdmld )   lrst_oce = .FALSE. 
     139         IF( .NOT. ln_tra_mld )   lrst_oce = .FALSE. 
    139140      ENDIF 
    140141      ! 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_cen2.F90

    r3294 r3318  
    44   !! Ocean  tracers:  horizontal & vertical advective trend 
    55   !!====================================================================== 
    6    !! History :  8.2  ! 2001-08  (G. Madec, E. Durand) trahad+trazad=traadv  
    7    !!            1.0  ! 2002-06  (G. Madec)  F90: Free form and module 
    8    !!            9.0  ! 2004-08  (C. Talandier) New trends organization 
     6   !! History :  OPA  ! 2001-08  (G. Madec, E. Durand) v8.2 trahad+trazad=traadv  
     7   !!   NEMO     1.0  ! 2002-06  (G. Madec)  F90: Free form and module 
     8   !!             -   ! 2004-08  (C. Talandier) New trends organization 
    99   !!             -   ! 2005-11  (V. Garnier) Surface pressure gradient organization 
    1010   !!            2.0  ! 2006-04  (R. Benshila, G. Madec) Step reorganization 
     
    2121   USE dom_oce         ! ocean space and time domain 
    2222   USE eosbn2          ! equation of state 
    23    USE trdmod_oce      ! tracers trends 
    24    USE trdtra          ! tracers trends 
     23   USE trd_oce         ! trends: ocean variables 
     24   USE trdtra          ! trends manager: tracers  
    2525   USE closea          ! closed sea 
    2626   USE sbcrnf          ! river runoffs 
     
    3838   PRIVATE 
    3939 
    40    PUBLIC   tra_adv_cen2       ! routine called by step.F90 
    41    PUBLIC   ups_orca_set       ! routine used by traadv_cen2_jki.F90 
     40   PUBLIC   tra_adv_cen2   ! routine called by step.F90 
     41   PUBLIC   ups_orca_set   ! routine used by traadv_cen2_jki.F90 
    4242 
    4343   LOGICAL  :: l_trd       ! flag to compute trends 
     
    5656 
    5757   SUBROUTINE tra_adv_cen2( kt, kit000, cdtype, pun, pvn, pwn,     & 
    58       &                                 ptb, ptn, pta, kjpt   )  
     58      &                                         ptb, ptn, pta, kjpt   )  
    5959      !!---------------------------------------------------------------------- 
    6060      !!                  ***  ROUTINE tra_adv_cen2  *** 
     
    8686      !!       * Add this trend now to the general trend of tracer (ta,sa): 
    8787      !!               pta = pta + ztra 
    88       !!       * trend diagnostic ('key_trdtra' defined): the trend is 
     88      !!       * trend diagnostic (l_trdtra=T or l_trctra=T): the trend is 
    8989      !!      saved for diagnostics. The trends saved is expressed as 
    90       !!      Uh.gradh(T), i.e. 
    91       !!                     save trend = ztra + ptn divn 
     90      !!      Uh.gradh(T), i.e.  save trend = ztra + ptn divn 
    9291      !! 
    9392      !!         Part II : vertical advection 
     
    105104      !!         Add this trend now to the general trend of tracer (ta,sa): 
    106105      !!             pta = pta + ztra 
    107       !!         Trend diagnostic ('key_trdtra' defined): the trend is 
     106      !!         Trend diagnostic (l_trdtra=T or l_trctra=T): the trend is 
    108107      !!      saved for diagnostics. The trends saved is expressed as : 
    109108      !!             save trend =  w.gradz(T) = ztra - ptn divn. 
     
    261260         END DO 
    262261 
    263          !                                 ! trend diagnostics (contribution of upstream fluxes) 
     262         !                                 ! trend diagnostics 
    264263         IF( l_trd ) THEN 
    265             CALL trd_tra( kt, cdtype, jn, jptra_trd_xad, zwx, pun, ptn(:,:,:,jn) ) 
    266             CALL trd_tra( kt, cdtype, jn, jptra_trd_yad, zwy, pvn, ptn(:,:,:,jn) ) 
    267             CALL trd_tra( kt, cdtype, jn, jptra_trd_zad, zwz, pwn, ptn(:,:,:,jn) ) 
     264            CALL trd_tra( kt, cdtype, jn, jptra_xad, zwx, pun, ptn(:,:,:,jn) ) 
     265            CALL trd_tra( kt, cdtype, jn, jptra_yad, zwy, pvn, ptn(:,:,:,jn) ) 
     266            CALL trd_tra( kt, cdtype, jn, jptra_zad, zwz, pwn, ptn(:,:,:,jn) ) 
    268267         END IF 
    269268         !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes) 
     
    273272         ENDIF 
    274273         ! 
    275       ENDDO 
     274      END DO 
    276275 
    277276      ! ---------------------------  required in restart file to ensure restartability) 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl.F90

    r3294 r3318  
    1616   USE oce             ! ocean dynamics and active tracers 
    1717   USE dom_oce         ! ocean space and time domain 
    18    USE trdmod_oce      ! tracers trends  
    19    USE trdtra      ! tracers trends  
     18   USE trd_oce         ! trends: ocean variables 
     19   USE trdtra          ! trends manager: tracers  
    2020   USE in_out_manager  ! I/O manager 
    2121   USE dynspg_oce      ! choice/control of key cpp for surface pressure gradient 
    22    USE trabbl          ! tracers: bottom boundary layer 
    2322   USE lib_mpp         ! distribued memory computing 
    2423   USE lbclnk          ! ocean lateral boundary condition (or mpp link)  
     
    179178         !                                 ! trend diagnostics (contribution of upstream fluxes) 
    180179         IF( l_trd )  THEN 
    181             CALL trd_tra( kt, cdtype, jn, jptra_trd_xad, zwx, pun, ptb(:,:,:,jn) ) 
    182             CALL trd_tra( kt, cdtype, jn, jptra_trd_yad, zwy, pvn, ptb(:,:,:,jn) ) 
     180            CALL trd_tra( kt, cdtype, jn, jptra_xad, zwx, pun, ptb(:,:,:,jn) ) 
     181            CALL trd_tra( kt, cdtype, jn, jptra_yad, zwy, pvn, ptb(:,:,:,jn) ) 
    183182         END IF 
    184183         !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes) 
     
    250249         END DO 
    251250         !                                 ! Save the vertical advective trends for diagnostic 
    252          IF( l_trd ) CALL trd_tra( kt, cdtype, jn, jptra_trd_zad, zwx, pwn, ptb(:,:,:,jn) ) 
     251         IF( l_trd ) CALL trd_tra( kt, cdtype, jn, jptra_zad, zwx, pwn, ptb(:,:,:,jn) ) 
    253252         ! 
    254253      ENDDO 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl2.F90

    r3294 r3318  
    1414   USE oce             ! ocean dynamics and active tracers 
    1515   USE dom_oce         ! ocean space and time domain 
    16    USE trdmod_oce      ! tracers trends  
    17    USE trdtra          ! tracers trends  
     16   USE trd_oce         ! trends: ocean variables 
     17   USE trdtra          ! trends manager: tracers  
    1818   USE in_out_manager  ! I/O manager 
    1919   USE dynspg_oce      ! choice/control of key cpp for surface pressure gradient 
    20    USE trabbl          ! tracers: bottom boundary layer 
    2120   USE lib_mpp         ! distribued memory computing 
    2221   USE lbclnk          ! ocean lateral boundary condition (or mpp link)  
     
    201200         !                                 ! trend diagnostics (contribution of upstream fluxes) 
    202201         IF( l_trd ) THEN 
    203             CALL trd_tra( kt, cdtype, jn, jptra_trd_xad, zwx, pun, ptb(:,:,:,jn) ) 
    204             CALL trd_tra( kt, cdtype, jn, jptra_trd_yad, zwy, pvn, ptb(:,:,:,jn) ) 
     202            CALL trd_tra( kt, cdtype, jn, jptra_xad, zwx, pun, ptb(:,:,:,jn) ) 
     203            CALL trd_tra( kt, cdtype, jn, jptra_yad, zwy, pvn, ptb(:,:,:,jn) ) 
    205204         END IF 
    206205 
     
    284283         END DO 
    285284         !                       ! trend diagnostics (contribution of upstream fluxes) 
    286          IF( l_trd )  CALL trd_tra( kt, cdtype, jn, jptra_trd_zad, zwx, pwn, ptb(:,:,:,jn) ) 
     285         IF( l_trd )  CALL trd_tra( kt, cdtype, jn, jptra_zad, zwx, pwn, ptb(:,:,:,jn) ) 
    287286         ! 
    288287      END DO 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_qck.F90

    r3301 r3318  
    1717   USE oce             ! ocean dynamics and active tracers 
    1818   USE dom_oce         ! ocean space and time domain 
    19    USE trdmod_oce      ! ocean space and time domain 
    20    USE trdtra          ! ocean tracers trends  
    21    USE trabbl          ! advective term in the BBL 
     19   USE trd_oce         ! trends: ocean variables 
     20   USE trdtra          ! trends manager: tracers  
    2221   USE lib_mpp         ! distribued memory computing 
    2322   USE lbclnk          ! ocean lateral boundary condition (or mpp link) 
     
    232231         END DO 
    233232         !                                 ! trend diagnostics (contribution of upstream fluxes) 
    234          IF( l_trd )  CALL trd_tra( kt, cdtype, jn, jptra_trd_xad, zwx, pun, ptn(:,:,:,jn) ) 
     233         IF( l_trd )  CALL trd_tra( kt, cdtype, jn, jptra_xad, zwx, pun, ptn(:,:,:,jn) ) 
    235234         ! 
    236235      END DO 
     
    358357         END DO 
    359358         !                                 ! trend diagnostics (contribution of upstream fluxes) 
    360          IF( l_trd )  CALL trd_tra( kt, cdtype, jn, jptra_trd_yad, zwy, pvn, ptn(:,:,:,jn) ) 
     359         IF( l_trd )  CALL trd_tra( kt, cdtype, jn, jptra_yad, zwy, pvn, ptn(:,:,:,jn) ) 
    361360         !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes) 
    362361         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN   
     
    421420         END DO 
    422421         !                                 ! Save the vertical advective trends for diagnostic 
    423          IF( l_trd )  CALL trd_tra( kt, cdtype, jn, jptra_trd_zad, zwz, pwn, ptn(:,:,:,jn) ) 
     422         IF( l_trd )  CALL trd_tra( kt, cdtype, jn, jptra_zad, zwz, pwn, ptn(:,:,:,jn) ) 
    424423         ! 
    425424      END DO 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_tvd.F90

    r3294 r3318  
    2424   USE oce             ! ocean dynamics and active tracers 
    2525   USE dom_oce         ! ocean space and time domain 
    26    USE trdmod_oce      ! tracers trends 
    27    USE trdtra          ! tracers trends 
     26   USE trd_oce         ! trends: ocean variables 
     27   USE trdtra          ! trends manager: tracers  
    2828   USE in_out_manager  ! I/O manager 
    2929   USE dynspg_oce      ! choice/control of key cpp for surface pressure gradient 
     
    229229            ztrdz(:,:,:) = ztrdz(:,:,:) + zwz(:,:,:)  ! <<< Add to previously computed 
    230230             
    231             CALL trd_tra( kt, cdtype, jn, jptra_trd_xad, ztrdx, pun, ptn(:,:,:,jn) )    
    232             CALL trd_tra( kt, cdtype, jn, jptra_trd_yad, ztrdy, pvn, ptn(:,:,:,jn) )   
    233             CALL trd_tra( kt, cdtype, jn, jptra_trd_zad, ztrdz, pwn, ptn(:,:,:,jn) )  
     231            CALL trd_tra( kt, cdtype, jn, jptra_xad, ztrdx, pun, ptn(:,:,:,jn) )    
     232            CALL trd_tra( kt, cdtype, jn, jptra_yad, ztrdy, pvn, ptn(:,:,:,jn) )   
     233            CALL trd_tra( kt, cdtype, jn, jptra_zad, ztrdz, pwn, ptn(:,:,:,jn) )  
    234234         END IF 
    235235         !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes) 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_ubs.F90

    r3294 r3318  
    1414   USE oce             ! ocean dynamics and active tracers 
    1515   USE dom_oce         ! ocean space and time domain 
    16    USE trdmod_oce         ! ocean space and time domain 
    17    USE trdtra 
    18    USE lib_mpp 
     16   USE trc_oce         ! share passive tracers/Ocean variables 
     17   USE trd_oce         ! trends: ocean variables 
     18   USE trdtra          ! trends manager: tracers  
     19   USE dynspg_oce      ! choice/control of key cpp for surface pressure gradient 
     20   USE in_out_manager  ! I/O manager 
     21   USE lib_mpp         ! I/O library 
    1922   USE lbclnk          ! ocean lateral boundary condition (or mpp link) 
    20    USE in_out_manager  ! I/O manager 
    2123   USE diaptr          ! poleward transport diagnostics 
    22    USE dynspg_oce      ! choice/control of key cpp for surface pressure gradient 
    23    USE trc_oce         ! share passive tracers/Ocean variables 
    2424   USE wrk_nemo        ! Memory Allocation 
    2525   USE timing          ! Timing 
     
    181181         !                                 ! trend diagnostics (contribution of upstream fluxes) 
    182182         IF( l_trd ) THEN 
    183              CALL trd_tra( kt, cdtype, jn, jptra_trd_xad, zwx, pun, ptn(:,:,:,jn) ) 
    184              CALL trd_tra( kt, cdtype, jn, jptra_trd_yad, zwy, pvn, ptn(:,:,:,jn) ) 
     183             CALL trd_tra( kt, cdtype, jn, jptra_xad, zwx, pun, ptn(:,:,:,jn) ) 
     184             CALL trd_tra( kt, cdtype, jn, jptra_yad, zwy, pvn, ptn(:,:,:,jn) ) 
    185185         END IF 
    186186         !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes) 
     
    264264               END DO 
    265265            END DO 
    266             CALL trd_tra( kt, cdtype, jn, jptra_trd_zad, zltv ) 
     266            CALL trd_tra( kt, cdtype, jn, jptra_zad, zltv ) 
    267267         ENDIF 
    268268         ! 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/trabbc.F90

    r3294 r3318  
    1818   USE dom_oce         ! domain: ocean 
    1919   USE phycst          ! physical constants 
    20    USE trdmod_oce      ! trends: ocean variables  
    21    USE trdtra          ! trends: active tracers  
     20   USE trd_oce         ! trends: ocean variables 
     21   USE trdtra          ! trends manager: tracers  
    2222   USE in_out_manager  ! I/O manager 
    2323   USE prtctl          ! Print control 
     
    9999      IF( l_trdtra ) THEN        ! Save the geothermal heat flux trend for diagnostics 
    100100         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:) 
    101          CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_bbc, ztrdt ) 
     101         CALL trd_tra( kt, 'TRA', jp_tem, jptra_bbc, ztrdt ) 
    102102         CALL wrk_dealloc( jpi, jpj, jpk, ztrdt ) 
    103103      ENDIF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90

    r3294 r3318  
    2828   USE phycst         ! physical constant 
    2929   USE eosbn2         ! equation of state 
    30    USE trdmod_oce     ! trends: ocean variables 
    31    USE trdtra         ! trends: active tracers 
     30   USE trd_oce        ! trends: ocean variables 
     31   USE trdtra         ! trends manager: tracers  
    3232   USE iom            ! IOM server                
    3333   USE in_out_manager ! I/O manager 
     
    148148         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:) 
    149149         ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:) 
    150          CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_bbl, ztrdt ) 
    151          CALL trd_tra( kt, 'TRA', jp_sal, jptra_trd_bbl, ztrds ) 
     150         CALL trd_tra( kt, 'TRA', jp_tem, jptra_bbl, ztrdt ) 
     151         CALL trd_tra( kt, 'TRA', jp_sal, jptra_bbl, ztrds ) 
    152152         CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds )  
    153153      ENDIF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/tradmp.F90

    r3317 r3318  
    2727   USE oce            ! ocean: variables 
    2828   USE dom_oce        ! ocean: domain variables 
    29    USE trdmod_oce     ! ocean: trend variables 
    30    USE trdtra         ! active tracers: trends 
     29   USE trd_oce         ! trends: ocean variables 
     30   USE trdtra          ! trends manager: tracers  
    3131   USE zdf_oce        ! ocean: vertical physics 
    3232   USE phycst         ! physical constants 
     
    172172      ! 
    173173      IF( l_trdtra )   THEN       ! trend diagnostic 
    174          CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_dmp, ttrdmp ) 
    175          CALL trd_tra( kt, 'TRA', jp_sal, jptra_trd_dmp, strdmp ) 
     174         CALL trd_tra( kt, 'TRA', jp_tem, jptra_dmp, ttrdmp ) 
     175         CALL trd_tra( kt, 'TRA', jp_sal, jptra_dmp, strdmp ) 
    176176      ENDIF 
    177177      !                           ! Control print 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90

    r3316 r3318  
    2323   USE traldf_iso_grif ! lateral mixing          (tra_ldf_iso_grif routine) 
    2424   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 
     25   USE trd_oce         ! trends: ocean variables 
     26   USE trdtra          ! trends manager: tracers  
    2727   USE prtctl          ! Print control 
    2828   USE in_out_manager  ! I/O manager 
     
    112112         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:) 
    113113         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 ) 
     114         CALL trd_tra( kt, 'TRA', jp_tem, jptra_ldf, ztrdt ) 
     115         CALL trd_tra( kt, 'TRA', jp_sal, jptra_ldf, ztrds ) 
    116116         CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds )  
    117117      ENDIF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/tranpc.F90

    r3294 r3318  
    1717   USE dom_oce         ! ocean space and time domain 
    1818   USE zdf_oce         ! ocean vertical physics 
    19    USE trdmod_oce      ! ocean active tracer trends 
    20    USE trdtra          ! ocean active tracer trends 
     19   USE trd_oce         ! trends: ocean variables 
     20   USE trdtra          ! trends manager: tracers  
    2121   USE eosbn2          ! equation of state (eos routine)  
    2222   USE lbclnk          ! lateral boundary conditions (or mpp link) 
     
    5151      !!      iterations. instabilities are treated when the vertical density 
    5252      !!      gradient is less than 1.e-5. 
    53       !!      l_trdtra=T: the trend associated with this algorithm is saved. 
    5453      !! 
    5554      !! ** Action  : - (ta,sa) after the application od the npc scheme 
    56       !!              - save the associated trends (ttrd,strd) ('key_trdtra') 
     55      !!              - save the associated trends (l_trdtra=T) 
    5756      !! 
    5857      !! References : Madec, et al., 1991, JPO, 21, 9, 1349-1371. 
     
    196195         !                                                ! =============== 
    197196         !  
     197       
     198         ! Lateral boundary conditions on ( ta, sa )   ( Unchanged sign) 
     199         CALL lbc_lnk( tsa(:,:,:,jp_tem), 'T', 1. )   ;   CALL lbc_lnk( tsa(:,:,:,jp_sal), 'T', 1. ) 
     200 
    198201         IF( l_trdtra )   THEN         ! save the Non penetrative mixing trends for diagnostic 
    199202            ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:) 
    200203            ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:) 
    201             CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_npc, ztrdt ) 
    202             CALL trd_tra( kt, 'TRA', jp_sal, jptra_trd_npc, ztrds ) 
     204            CALL trd_tra( kt, 'TRA', jp_tem, jptra_npc, ztrdt ) 
     205            CALL trd_tra( kt, 'TRA', jp_sal, jptra_npc, ztrds ) 
    203206            CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds ) 
    204207         ENDIF 
    205208       
    206          ! Lateral boundary conditions on ( ta, sa )   ( Unchanged sign) 
    207          ! ------------------------------============ 
    208          CALL lbc_lnk( tsa(:,:,:,jp_tem), 'T', 1. )   ;   CALL lbc_lnk( tsa(:,:,:,jp_sal), 'T', 1. ) 
    209        
    210  
    211          !  2. non penetrative convective scheme statistics 
    212          !  ----------------------------------------------- 
     209         ! non penetrative convective scheme statistics 
    213210         IF( nn_npcp /= 0 .AND. MOD( kt, nn_npcp ) == 0 ) THEN 
    214211            IF(lwp) WRITE(numout,*)' kt=',kt, ' number of statically instable',   & 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90

    r3317 r3318  
    2929   USE zdf_oce         ! ??? 
    3030   USE domvvl          ! variable volume 
     31   USE phycst          ! physical constant 
    3132   USE ldftra_oce      ! ocean active tracers lateral physics 
    3233   USE dynspg_oce      ! surface     pressure gradient variables 
    3334   USE dynhpg          ! hydrostatic pressure gradient  
    34    USE trdmod_oce      ! ocean space and time domain variables  
    35    USE trdtra          ! ocean active tracers trends  
    36    USE phycst 
    37    USE obc_oce 
     35   USE traqsr          ! penetrative solar radiation (needed for nksr) 
     36   USE trd_oce         ! trends: ocean variables 
     37   USE trdtra          ! trends manager: tracers  
     38   USE obc_oce         ! open boundary condition variable 
    3839   USE obctra          ! open boundary condition (obc_tra routine) 
    3940   USE bdy_oce 
     
    4243   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    4344   USE prtctl          ! Print control 
    44    USE traqsr          ! penetrative solar radiation (needed for nksr) 
    4545#if defined key_agrif 
    4646   USE agrif_opa_update 
     
    134134         ztrds(:,:,:) = tsn(:,:,:,jp_sal) 
    135135         IF( ln_traldf_iso ) THEN              ! diagnose the "pure" Kz diffusive trend  
    136             CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_zdfp, ztrdt ) 
    137             CALL trd_tra( kt, 'TRA', jp_sal, jptra_trd_zdfp, ztrds ) 
     136            CALL trd_tra( kt, 'TRA', jp_tem, jptra_zdfp, ztrdt ) 
     137            CALL trd_tra( kt, 'TRA', jp_sal, jptra_zdfp, ztrds ) 
    138138         ENDIF 
    139139      ENDIF 
     
    164164            ztrds(:,:,jk) = ( tsb(:,:,jk,jp_sal) - ztrds(:,:,jk) ) * zfact 
    165165         END DO 
    166          CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_atf, ztrdt ) 
    167          CALL trd_tra( kt, 'TRA', jp_sal, jptra_trd_atf, ztrds ) 
     166         CALL trd_tra( kt, 'TRA', jp_tem, jptra_atf, ztrdt ) 
     167         CALL trd_tra( kt, 'TRA', jp_sal, jptra_atf, ztrds ) 
    168168         CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds ) 
    169169      END IF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90

    r3294 r3318  
    2020   USE sbc_oce         ! surface boundary condition: ocean 
    2121   USE trc_oce         ! share SMS/Ocean variables 
    22    USE trdmod_oce      ! ocean variables trends 
    23    USE trdtra          ! ocean active tracers trends  
     22   USE trd_oce         ! trends: ocean variables 
     23   USE trdtra          ! trends manager: tracers  
     24   USE phycst          ! physical constants 
    2425   USE in_out_manager  ! I/O manager 
    25    USE phycst          ! physical constants 
    2626   USE prtctl          ! Print control 
    2727   USE iom             ! I/O manager 
     
    3131   USE wrk_nemo       ! Memory Allocation 
    3232   USE timing         ! Timing 
    33  
    3433 
    3534   IMPLICIT NONE 
     
    8887      !! 
    8988      !! ** Action  : - update ta with the penetrative solar radiation trend 
    90       !!              - save the trend in ttrd ('key_trdtra') 
     89      !!              - send the trend to trdtra (l_trdtra=T) 
    9190      !! 
    9291      !! Reference  : Jerlov, N. G., 1968 Optical Oceanography, Elsevier, 194pp. 
     
    284283      IF( l_trdtra ) THEN     ! qsr tracers trends saved for diagnostics 
    285284         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:) 
    286          CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_qsr, ztrdt ) 
     285         CALL trd_tra( kt, 'TRA', jp_tem, jptra_qsr, ztrdt ) 
    287286         CALL wrk_dealloc( jpi, jpj, jpk, ztrdt )  
    288287      ENDIF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90

    r3317 r3318  
    1818   USE dom_oce         ! ocean space domain variables 
    1919   USE phycst          ! physical constant 
     20   USE sbcrnf          ! River runoff   
     21   USE sbcmod          ! ln_rnf   
    2022   USE traqsr          ! solar radiation penetration 
    21    USE trdmod_oce      ! ocean trends  
    22    USE trdtra          ! ocean trends 
     23   USE trd_oce         ! trends: ocean variables 
     24   USE trdtra          ! trends manager: tracers  
    2325   USE in_out_manager  ! I/O manager 
    2426   USE prtctl          ! Print control 
    2527   USE restart         ! ocean restart 
    26    USE sbcrnf          ! River runoff   
    27    USE sbcmod          ! ln_rnf   
    28    USE iom 
     28   USE iom             ! I/O library 
    2929   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    3030   USE wrk_nemo        ! Memory Allocation 
     
    228228!!gm : end of useless 
    229229 
    230       IF( l_trdtra )   THEN                      ! save the horizontal diffusive trends for further diagnostics 
     230      IF( l_trdtra )   THEN                      ! save the trends for further diagnostics 
    231231         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:) 
    232232         ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:) 
    233          CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_nsr, ztrdt ) 
    234          CALL trd_tra( kt, 'TRA', jp_sal, jptra_trd_nsr, ztrds ) 
     233         CALL trd_tra( kt, 'TRA', jp_tem, jptra_nsr, ztrdt ) 
     234         CALL trd_tra( kt, 'TRA', jp_sal, jptra_nsr, ztrds ) 
    235235         CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds )  
    236236      ENDIF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90

    r3294 r3318  
    2222   USE trazdf_exp      ! vertical diffusion: explicit (tra_zdf_exp     routine) 
    2323   USE trazdf_imp      ! vertical diffusion: implicit (tra_zdf_imp     routine) 
    24  
    2524   USE ldftra_oce      ! ocean active tracers: lateral physics 
    26    USE trdmod_oce      ! ocean active tracers: lateral physics 
    27    USE trdtra      ! ocean tracers trends  
     25   USE trd_oce         ! trends: ocean variables 
     26   USE trdtra          ! trends manager: tracers  
    2827   USE in_out_manager  ! I/O manager 
    2928   USE prtctl          ! Print control 
     
    9695            ztrds(:,:,jk) = ( ( tsa(:,:,jk,jp_sal) - tsb(:,:,jk,jp_sal) ) / r2dtra(jk) ) - ztrds(:,:,jk) 
    9796         END DO 
    98          CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_zdf, ztrdt ) 
    99          CALL trd_tra( kt, 'TRA', jp_sal, jptra_trd_zdf, ztrds ) 
     97         CALL trd_tra( kt, 'TRA', jp_tem, jptra_zdf, ztrdt ) 
     98         CALL trd_tra( kt, 'TRA', jp_sal, jptra_zdf, ztrds ) 
    10099         CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds ) 
    101100      ENDIF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trd_oce.F90

    r3317 r3318  
    1 MODULE trdmod_oce 
     1MODULE trd_oce 
    22   !!====================================================================== 
    3    !!                   ***  MODULE trdmod_oce  *** 
     3   !!                   ***  MODULE trd_oce  *** 
    44   !! Ocean trends :   set tracer and momentum trend variables 
    55   !!====================================================================== 
     
    1313   PUBLIC 
    1414 
    15 #if  defined key_trdtra   &&   defined key_trddyn    ||   defined key_esopa 
    16    LOGICAL, PARAMETER ::   lk_trdtra = .TRUE.    !: tracers  trend flag 
    17    LOGICAL, PARAMETER ::   lk_trddyn = .TRUE.    !: momentum trend flag 
    18 #elif  defined key_trdtra 
    19    LOGICAL, PARAMETER ::   lk_trdtra = .TRUE.    !: tracers  trend flag 
    20    LOGICAL, PARAMETER ::   lk_trddyn = .FALSE.   !: momentum trend flag 
    21 #elif  defined key_trddyn 
    22    LOGICAL, PARAMETER ::   lk_trdtra = .FALSE.   !: tracers  trend flag 
    23    LOGICAL, PARAMETER ::   lk_trddyn = .TRUE.    !: momentum trend flag 
    24 #else 
    25    LOGICAL, PARAMETER ::   lk_trdtra = .FALSE.   !: tracers  trend flag 
    26    LOGICAL, PARAMETER ::   lk_trddyn = .FALSE.   !: momentum trend flag 
    27 #endif 
     15   !                                                   !!* Namelist namtrd:  diagnostics on dynamics/tracer trends * 
     16   LOGICAL , PUBLIC  ::   ln_dyn_trd   = .FALSE.        !: (T) 3D momentum             trends or (F) not 
     17   LOGICAL , PUBLIC  ::   ln_tra_trd   = .FALSE.        !: (T) 3D tracer               trends or (F) not 
     18   LOGICAL , PUBLIC  ::   ln_KE_trd    = .FALSE.        !: (T) 3D Kinetic   Energy     trends or (F) not 
     19   LOGICAL , PUBLIC  ::   ln_PE_trd    = .FALSE.        !: (T) 3D Potential Energy     trends or (F) not 
     20   LOGICAL , PUBLIC  ::   ln_vor_trd   = .FALSE.        !: (T) 3D barotropic vorticity trends or (F) not 
     21   LOGICAL , PUBLIC  ::   ln_glo_trd   = .FALSE.        !: (T) global domain averaged diag for T, T^2, KE, and PE 
     22   LOGICAL , PUBLIC  ::   ln_dyn_mld   = .FALSE.        !: (T) 2D tracer   trends averaged over the mixed layer  
     23   LOGICAL , PUBLIC  ::   ln_tra_mld   = .FALSE.        !: (T) 2D momentum trends averaged over the mixed layer  
     24   INTEGER , PUBLIC  ::   nn_trd  = 10                  !: time step frequency for ln_glo_trd 
     25   INTEGER , PUBLIC  ::   nn_ctls =  0                  !: control surface type for trends vertical integration 
     26   REAL(wp), PUBLIC  ::   rn_ucf   = 1.                 !: unit conversion factor (for netCDF trends outputs) 
     27                                                        !: =1. (=86400.) for degC/s (degC/day) and psu/s (psu/day) 
     28   CHARACTER(len=32) ::   cn_trdrst_in  = "restart_mld" !: suffix of ocean restart name (input) 
     29   CHARACTER(len=32) ::   cn_trdrst_out = "restart_mld" !: suffix of ocean restart name (output) 
     30   LOGICAL , PUBLIC  ::   ln_trdmld_instant = .FALSE.   !: flag to diagnose inst./mean ML T/S trends 
     31   LOGICAL , PUBLIC  ::   ln_trdmld_restart = .FALSE.   !: flag to restart mixed-layer diagnostics 
    2832 
    29    !                                                     !!* Namelist namtrd:  diagnostics on dynamics/tracer trends * 
    30    LOGICAL , PUBLIC  ::   ln_3D_trd_d   = .FALSE.         !: (T) 3D momentum              trends or (F) not 
    31    LOGICAL , PUBLIC  ::   ln_3D_trd_t   = .FALSE.         !: (T) 3D tracer               trends or (F) not 
    32    LOGICAL , PUBLIC  ::   ln_PE_trd     = .FALSE.         !: (T) 3D Potential Energy     trends or (F) not 
    33    LOGICAL , PUBLIC  ::   ln_KE_trd     = .FALSE.         !: (T) 3D Kinetic   Energy     trends or (F) not 
    34    LOGICAL , PUBLIC  ::   ln_vor_trd    = .FALSE.         !: (T) 3D barotropic vorticity trends or (F) not 
    35    LOGICAL , PUBLIC  ::   ln_glo_trd    = .FALSE.         !: (T) global domain averaged diag for T, T^2, KE, and PE 
    36    LOGICAL , PUBLIC  ::   ln_ML_trd_t   = .FALSE.         !: (T) 2D tracer   trends averaged over the mixed layer  
    37    LOGICAL , PUBLIC  ::   ln_ML_trd_d   = .FALSE.         !: (T) 2D momentum trends averaged over the mixed layer  
    38    INTEGER , PUBLIC  ::   nn_trd  = 10                    !: time step frequency for ln_glo_trd 
    39    INTEGER , PUBLIC  ::   nn_ctls =  0                    !: control surface type for trends vertical integration 
    40    REAL(wp), PUBLIC  ::   rn_ucf   = 1.                   !: unit conversion factor (for netCDF trends outputs) 
    41                                                           !: =1. (=86400.) for degC/s (degC/day) and psu/s (psu/day) 
    42    CHARACTER(len=32) ::   cn_trdrst_in  = "restart_mld"   !: suffix of ocean restart name (input) 
    43    CHARACTER(len=32) ::   cn_trdrst_out = "restart_mld"   !: suffix of ocean restart name (output) 
    44    LOGICAL , PUBLIC  ::   ln_trdmld_instant = .FALSE.     !: flag to diagnose inst./mean ML T/S trends 
    45    LOGICAL , PUBLIC  ::   ln_trdmld_restart = .FALSE.     !: flag to restart mixed-layer diagnostics 
    46  
    47 # if defined key_trdtra   ||   defined key_trdmld 
    48    LOGICAL , PUBLIC ::   l_trdtra = .TRUE.                !: tracers  trend flag 
     33   LOGICAL , PUBLIC ::   l_trdtra        !: tracers  trend flag (set from namelist in trdini) 
     34   LOGICAL , PUBLIC ::   l_trddyn        !: momentum trend flag (set from namelist in trdini) 
     35    
     36# if ( defined key_trdtrc && defined key_iomput )  ||  defined key_trdmld_trc 
     37   LOGICAL , PUBLIC ::   l_trdtrc = .TRUE.        !: tracers  trend flag 
    4938# else 
    50    LOGICAL , PUBLIC ::   l_trdtra = .FALSE.               !: tracers  trend flag 
     39   LOGICAL , PUBLIC ::   l_trdtrc = .FALSE.       !: tracers  trend flag 
    5140# endif 
    52 # if defined key_trddyn   ||   defined key_trdvor 
    53    LOGICAL , PUBLIC ::   l_trddyn = .TRUE.                !: momentum trend flag 
    54 # else 
    55    LOGICAL , PUBLIC ::   l_trddyn = .FALSE.               !: momentum trend flag 
    56 # endif 
    57 # if ( defined key_trdtrc && defined key_iomput )  ||  defined key_trdmld_trc 
    58    LOGICAL , PUBLIC ::   l_trdtrc = .TRUE.                !: tracers  trend flag 
    59 # else 
    60    LOGICAL , PUBLIC ::   l_trdtrc = .FALSE.               !: tracers  trend flag 
    61 # endif 
    62    !                                                      !!!* Active tracers trends indexes 
    63    INTEGER, PUBLIC, PARAMETER ::   jptot_tra      = 14     !: Total trend nb: change it when adding/removing one indice below 
    64    !                               ===================     !   
    65    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_xad  =  1     !: x- horizontal advection 
    66    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_yad  =  2     !: y- horizontal advection 
    67    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_zad  =  3     !: z- vertical   advection 
    68    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_sad  =  4     !: z- vertical   advection 
    69    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_ldf  =  5     !: lateral       diffusion 
    70    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_zdf  =  6     !: vertical      diffusion 
    71    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_zdfp =  7     !: "PURE" vert.  diffusion (ln_traldf_iso=T) 
    72    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_bbc  =  8     !: Bottom Boundary Condition (geoth. heating)  
    73    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_bbl  =  9     !: Bottom Boundary Layer (diffusive and/or advective) 
    74    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_npc  = 10     !: non-penetrative convection treatment 
    75    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_dmp  = 11     !: internal restoring (damping) 
    76    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_qsr  = 12     !: penetrative solar radiation 
    77    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_nsr  = 13     !: non solar radiation / C/D on salinity  (+runoff if ln_rnf=T) 
    78    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_atf  = 14     !: Asselin time filter 
     41   !                                                  !!!* Active tracers trends indexes 
     42   INTEGER, PUBLIC, PARAMETER ::   jptot_tra  = 14     !: Total trend nb: change it when adding/removing one indice below 
     43   !                               ===============     !   
     44   INTEGER, PUBLIC, PARAMETER ::   jptra_xad  =  1     !: x- horizontal advection 
     45   INTEGER, PUBLIC, PARAMETER ::   jptra_yad  =  2     !: y- horizontal advection 
     46   INTEGER, PUBLIC, PARAMETER ::   jptra_zad  =  3     !: z- vertical   advection 
     47   INTEGER, PUBLIC, PARAMETER ::   jptra_sad  =  4     !: z- vertical   advection 
     48   INTEGER, PUBLIC, PARAMETER ::   jptra_ldf  =  5     !: lateral       diffusion 
     49   INTEGER, PUBLIC, PARAMETER ::   jptra_zdf  =  6     !: vertical      diffusion 
     50   INTEGER, PUBLIC, PARAMETER ::   jptra_zdfp =  7     !: "PURE" vert.  diffusion (ln_traldf_iso=T) 
     51   INTEGER, PUBLIC, PARAMETER ::   jptra_bbc  =  8     !: Bottom Boundary Condition (geoth. heating)  
     52   INTEGER, PUBLIC, PARAMETER ::   jptra_bbl  =  9     !: Bottom Boundary Layer (diffusive and/or advective) 
     53   INTEGER, PUBLIC, PARAMETER ::   jptra_npc  = 10     !: non-penetrative convection treatment 
     54   INTEGER, PUBLIC, PARAMETER ::   jptra_dmp  = 11     !: internal restoring (damping) 
     55   INTEGER, PUBLIC, PARAMETER ::   jptra_qsr  = 12     !: penetrative solar radiation 
     56   INTEGER, PUBLIC, PARAMETER ::   jptra_nsr  = 13     !: non solar radiation / C/D on salinity  (+runoff if ln_rnf=T) 
     57   INTEGER, PUBLIC, PARAMETER ::   jptra_atf  = 14     !: Asselin time filter 
    7958   ! 
    80    !                                                      !!!* Passive tracers trends indices (use if "key_top" defined) 
    81    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_sms  = 13     !: sources m. sinks 
    82    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_radn = 14     !: corr. trn<0 in trcrad 
    83    INTEGER, PUBLIC, PARAMETER ::   jptra_trd_radb = 15     !: corr. trb<0 in trcrad (like atf) 
     59   !                                                  !!!* Passive tracers trends indices (use if "key_top" defined) 
     60   INTEGER, PUBLIC, PARAMETER ::   jptra_sms  = 15     !: sources m. sinks 
     61   INTEGER, PUBLIC, PARAMETER ::   jptra_radn = 16     !: corr. trn<0 in trcrad 
     62   INTEGER, PUBLIC, PARAMETER ::   jptra_radb = 17     !: corr. trb<0 in trcrad (like atf) 
    8463   ! 
    85    !                                                      !!!* Momentum trends indices 
    86    INTEGER, PUBLIC, PARAMETER ::   jptot_dyn      = 11     !: Total trend nb: change it when adding/removing one indice below 
    87    !                               ===================     !   
    88    INTEGER, PUBLIC, PARAMETER ::   jpdyn_trd_hpg  =  1     !: hydrostatic pressure gradient  
    89    INTEGER, PUBLIC, PARAMETER ::   jpdyn_trd_spg  =  2     !: surface     pressure gradient 
    90    INTEGER, PUBLIC, PARAMETER ::   jpdyn_trd_keg  =  3     !: kinetic energy gradient  or horizontal advection 
    91    INTEGER, PUBLIC, PARAMETER ::   jpdyn_trd_rvo  =  4     !: relative  vorticity      or metric term 
    92    INTEGER, PUBLIC, PARAMETER ::   jpdyn_trd_pvo  =  5     !: planetary vorticity 
    93    INTEGER, PUBLIC, PARAMETER ::   jpdyn_trd_zad  =  6     !: vertical advection 
    94    INTEGER, PUBLIC, PARAMETER ::   jpdyn_trd_ldf  =  7     !: horizontal diffusion    
    95    INTEGER, PUBLIC, PARAMETER ::   jpdyn_trd_zdf  =  8     !: vertical   diffusion 
    96    INTEGER, PUBLIC, PARAMETER ::   jpdyn_trd_tau  =  9     !: surface stress 
    97    INTEGER, PUBLIC, PARAMETER ::   jpdyn_trd_bfr  = 10     !: bottom  stress  
    98    INTEGER, PUBLIC, PARAMETER ::   jpdyn_trd_atf  = 11     !: Asselin time filter 
     64   !                                                  !!!* Momentum trends indices 
     65   INTEGER, PUBLIC, PARAMETER ::   jptot_dyn  = 11     !: Total trend nb: change it when adding/removing one indice below 
     66   !                               ===============     !   
     67   INTEGER, PUBLIC, PARAMETER ::   jpdyn_hpg  =  1     !: hydrostatic pressure gradient  
     68   INTEGER, PUBLIC, PARAMETER ::   jpdyn_spg  =  2     !: surface     pressure gradient 
     69   INTEGER, PUBLIC, PARAMETER ::   jpdyn_keg  =  3     !: kinetic energy gradient  or horizontal advection 
     70   INTEGER, PUBLIC, PARAMETER ::   jpdyn_rvo  =  4     !: relative  vorticity      or metric term 
     71   INTEGER, PUBLIC, PARAMETER ::   jpdyn_pvo  =  5     !: planetary vorticity 
     72   INTEGER, PUBLIC, PARAMETER ::   jpdyn_zad  =  6     !: vertical advection 
     73   INTEGER, PUBLIC, PARAMETER ::   jpdyn_ldf  =  7     !: horizontal diffusion    
     74   INTEGER, PUBLIC, PARAMETER ::   jpdyn_zdf  =  8     !: vertical   diffusion 
     75   INTEGER, PUBLIC, PARAMETER ::   jpdyn_tau  =  9     !: surface stress 
     76   INTEGER, PUBLIC, PARAMETER ::   jpdyn_bfr  = 10     !: bottom  stress  
     77   INTEGER, PUBLIC, PARAMETER ::   jpdyn_atf  = 11     !: Asselin time filter 
    9978   ! 
    10079   !!---------------------------------------------------------------------- 
     
    10382   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    10483   !!====================================================================== 
    105 END MODULE trdmod_oce 
     84END MODULE trd_oce 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trddyn.F90

    r3317 r3318  
    1 MODULE trdmod 
     1MODULE trddyn 
    22   !!====================================================================== 
    3    !!                       ***  MODULE  trdmod  *** 
    4    !! Ocean diagnostics:  ocean tracers and dynamic trends 
     3   !!                       ***  MODULE  trddyn  *** 
     4   !! Ocean diagnostics:  ocean dynamic trends 
    55   !!===================================================================== 
    6    !! History :  1.0  !  2004-08  (C. Talandier) Original code 
    7    !!             -   !  2005-04  (C. Deltel)    Add Asselin trend in the ML budget 
    8    !!            3.3  !  2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase 
    9    !!            3.5  !  2012-02  (G. Madec) add 3D trends output for T, S, U, V, PE and KE 
     6   !! History :  3.5  !  2012-02  (G. Madec) creation from trdmod: split DYN and TRA trends 
     7   !!                           and manage  3D trends output for U, V, and KE 
    108   !!---------------------------------------------------------------------- 
    11 #if  defined key_trdtra || defined key_trddyn || defined key_trdmld || defined key_trdvor || defined key_esopa 
     9 
    1210   !!---------------------------------------------------------------------- 
    13    !!   trd_mod       : manage the type of trend diagnostics 
    14    !!   trd_3Diom     : output 3D momentum and/or tracer trends using IOM 
    15    !!   trd_mod_init  : Initialization step 
     11   !!   trd_dyn       : manage the type of momentum trend diagnostics (3D I/O, domain averaged, KE) 
     12   !!   trd_dyn_iom   : output 3D momentum and/or tracer trends using IOM 
     13   !!   trd_dyn_init  : initialization step 
    1614   !!---------------------------------------------------------------------- 
    1715   USE oce            ! ocean dynamics and tracers variables 
    1816   USE dom_oce        ! ocean space and time domain variables 
    1917   USE zdf_oce        ! ocean vertical physics variables 
    20    USE trdmod_oce     ! ocean variables trends 
     18   USE trd_oce        ! trends: ocean variables 
    2119   USE zdfbfr         ! bottom friction 
    2220   USE ldftra_oce     ! ocean active tracers lateral physics 
     
    2422   USE phycst         ! physical constants 
    2523   USE trdvor         ! ocean vorticity trends  
    26    USE trdicp         ! ocean bassin integral constraints properties 
     24   USE trdglo         ! trends:global domain averaged 
    2725   USE trdmld         ! ocean active mixed layer tracers trends  
    2826   USE in_out_manager ! I/O manager 
     
    3432   PRIVATE 
    3533 
    36    REAL(wp) ::   r2dt          ! time-step, = 2 rdttra except at nit000 (=rdttra) if neuler=0 
     34   REAL(wp) ::   r2dt    ! time-step, = 2 rdttra except at nit000 (=rdttra) if neuler=0 
    3735 
    38    PUBLIC trd_mod              ! called by all dynXX or traXX modules 
    39    PUBLIC trd_mod_init         ! called by opa.F90 module 
     36   PUBLIC trd_dyn        ! called by all dynXX modules 
    4037 
    4138   !! * Substitutions 
     
    4946CONTAINS 
    5047 
    51    SUBROUTINE trd_mod( ptrdx, ptrdy, ktrd, ctype, kt ) 
     48   SUBROUTINE trd_dyn( putrd, pvtrd, ktrd, kt ) 
    5249      !!--------------------------------------------------------------------- 
    5350      !!                  ***  ROUTINE trd_mod  *** 
    5451      !!  
    55       !! ** Purpose :   Dispatch all trends computation, e.g. 3D output, integral 
    56       !!                constraints, barotropic vorticity, kinetic enrgy,  
    57       !!                potential energy, and/or mixed layer budget. 
     52      !! ** Purpose :   Dispatch momentum trend computation, e.g. 3D output,  
     53      !!              integral constraints, barotropic vorticity, kinetic enrgy,  
     54      !!              and/or mixed layer budget. 
    5855      !!---------------------------------------------------------------------- 
    59       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend  
    60       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend 
    61       INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index 
    62       CHARACTER(len=3)          , INTENT(in   ) ::   ctype   ! momentum or tracers trends type 'DYN'/'TRA' 
    63       INTEGER                   , INTENT(in   ) ::   kt      ! time step 
     56      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V trends  
     57      INTEGER                   , INTENT(in   ) ::   ktrd           ! trend index 
     58      INTEGER                   , INTENT(in   ) ::   kt             ! time step 
    6459      !! 
    6560      INTEGER ::   ji, jj   ! dummy loop indices 
     
    7368      ENDIF 
    7469 
    75       !                                            !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    76       IF( ln_3D_trd_d .OR. ln_3D_trd_t ) THEN      !   3D output of momentum and/or tracers trends using IOM interface 
    77          !                                         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    78          CALL trd_3Diom ( ptrdx, ptrdy, ktrd, ctype, kt ) 
    79          ! 
    80       ENDIF 
    81          !                                         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    82       IF( ln_glo_trd ) THEN                        ! I. Integral Constraints Properties for momentum and/or tracers trends 
    83          !                                         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    84          CALL trd_budget( ptrdx, ptrdy, ktrd, ctype, kt ) 
    85          ! 
    86       ENDIF 
     70      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     71      !   3D output of momentum and/or tracers trends using IOM interface 
     72      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     73      IF( ln_dyn_trd )   CALL trd_dyn_iom( putrd, pvtrd, ktrd, kt ) 
     74          
     75      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     76      !  Integral Constraints Properties for momentum and/or tracers trends 
     77      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     78      IF( ln_glo_trd  )   CALL trd_glo( putrd, pvtrd, ktrd, 'DYN', kt ) 
    8779 
    88       !                                            !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    89       IF( lk_trdvor .AND. ctype == 'DYN' ) THEN    ! II. Vorticity trends 
    90          !                                         !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    91          SELECT CASE( ktrd )  
    92          CASE( jpdyn_trd_hpg )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_prg )   ! Hydrostatique Pressure Gradient  
    93          CASE( jpdyn_trd_keg )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_keg )   ! KE Gradient  
    94          CASE( jpdyn_trd_rvo )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_rvo )   ! Relative Vorticity  
    95          CASE( jpdyn_trd_pvo )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_pvo )   ! Planetary Vorticity Term  
    96          CASE( jpdyn_trd_ldf )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_ldf )   ! Horizontal Diffusion  
    97          CASE( jpdyn_trd_zad )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_zad )   ! Vertical Advection  
    98          CASE( jpdyn_trd_spg )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_spg )   ! Surface Pressure Grad.  
    99          CASE( jpdyn_trd_zdf )                                                      ! Vertical Diffusion  
    100             ztswu(:,:) = 0.e0   ;   ztswv(:,:) = 0.e0 
    101             DO jj = 2, jpjm1                                                             ! wind stress trends 
    102                DO ji = fs_2, fs_jpim1   ! vector opt. 
    103                   ztswu(ji,jj) = 0.5 * ( utau_b(ji,jj) + utau(ji,jj) ) / ( fse3u(ji,jj,1) * rau0 ) 
    104                   ztswv(ji,jj) = 0.5 * ( vtau_b(ji,jj) + vtau(ji,jj) ) / ( fse3v(ji,jj,1) * rau0 ) 
    105                END DO 
    106             END DO 
    107             ! 
    108             CALL trd_vor_zint( ptrdx, ptrdy, jpvor_zdf )                             ! zdf trend including surf./bot. stresses  
    109             CALL trd_vor_zint( ztswu, ztswv, jpvor_swf )                             ! surface wind stress  
    110          CASE ( jpdyn_trd_bfr ) 
    111             CALL trd_vor_zint( ptrdx, ptrdy, jpvor_bfr )                             ! Bottom stress 
    112          END SELECT 
    113          ! 
    114       ENDIF 
     80      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     81      !  Kinetic Energy trends 
     82      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     83!!gm      IF( ln_KE_trd  )   CALL trd_KE( putrd, pvtrd, ktrd, kt ) 
     84 
     85      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     86      !  Vorticity trends 
     87      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     88      IF( ln_vor_trd  )   CALL trd_vor( putrd, pvtrd, ktrd, kt ) 
    11589 
    11690      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    117       ! III. Mixed layer trends for active tracers 
     91      ! Mixed layer trends for active tracers 
    11892      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    119  
    120       IF( lk_trdmld .AND. ctype == 'TRA' )   THEN    
    121          !----------------------------------------------------------------------------------------------- 
    122          ! W.A.R.N.I.N.G : 
    123          ! jptra_trd_ldf : called by traldf.F90 
    124          !                 at this stage we store: 
    125          !                  - the lateral geopotential diffusion (here, lateral = horizontal) 
    126          !                  - and the iso-neutral diffusion if activated  
    127          ! jptra_trd_zdf : called by trazdf.F90 
    128          !                 * in case of iso-neutral diffusion we store the vertical diffusion component in the  
    129          !                   lateral trend including the K_z contrib, which will be removed later (see trd_mld) 
    130          !----------------------------------------------------------------------------------------------- 
    131  
    132          SELECT CASE ( ktrd ) 
    133          CASE ( jptra_trd_xad )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_xad, '3D' )   ! zonal    advection 
    134          CASE ( jptra_trd_yad )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_yad, '3D' )   ! merid.   advection 
    135          CASE ( jptra_trd_zad )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_zad, '3D' )   ! vertical advection 
    136          CASE ( jptra_trd_ldf )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_ldf, '3D' )   ! lateral  diffusion 
    137          CASE ( jptra_trd_bbl )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_bbl, '3D' )   ! bottom boundary layer 
    138          CASE ( jptra_trd_zdf ) 
    139             IF( ln_traldf_iso ) THEN   ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_ldf, '3D' )   ! lateral  diffusion (K_z) 
    140             ELSE                       ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_zdf, '3D' )   ! vertical diffusion (K_z) 
    141             ENDIF 
    142          CASE ( jptra_trd_dmp )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_dmp, '3D' )   ! internal 3D restoring (tradmp) 
    143          CASE ( jptra_trd_qsr )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_for, '3D' )   ! air-sea : penetrative sol radiat 
    144          CASE ( jptra_trd_nsr ) 
    145             ptrdx(:,:,2:jpk) = 0._wp   ;   ptrdy(:,:,2:jpk) = 0._wp 
    146             CALL trd_mld_zint( ptrdx, ptrdy, jpmld_for, '2D' )                                  ! air-sea : non penetr sol radiat 
    147          CASE ( jptra_trd_bbc )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_bbc, '3D' )   ! bottom bound cond (geoth flux) 
    148          CASE ( jptra_trd_atf )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_atf, '3D' )   ! asselin numerical 
    149          CASE ( jptra_trd_npc )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_npc, '3D' )   ! non penetr convect adjustment 
    150          END SELECT 
    151          ! 
    152       ENDIF 
     93!!gm      IF( ln_dyn_mld )   CALL trd_mld_dyn    
    15394      ! 
    15495      CALL wrk_dealloc( jpi, jpj, ztswu, ztswv ) 
    15596      ! 
    156    END SUBROUTINE trd_mod 
     97   END SUBROUTINE trd_dyn 
    15798 
    15899 
    159    SUBROUTINE trd_3Diom( ptrdx, ptrdy, ktrd, ctype, kt ) 
     100   SUBROUTINE trd_dyn_iom( putrd, pvtrd, ktrd, kt ) 
    160101      !!--------------------------------------------------------------------- 
    161       !!                  ***  ROUTINE trd_3Diom  *** 
     102      !!                  ***  ROUTINE trd_dyn_iom  *** 
    162103      !!  
    163104      !! ** Purpose :   output 3D trends using IOM 
    164105      !!---------------------------------------------------------------------- 
    165       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend  
    166       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend 
    167       INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index 
    168       CHARACTER(len=3)          , INTENT(in   ) ::   ctype   ! momentum or tracers trends type 'DYN'/'TRA' 
    169       INTEGER                   , INTENT(in   ) ::   kt      ! time step 
    170       !! 
     106      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V trends 
     107      INTEGER                   , INTENT(in   ) ::   ktrd           ! trend index 
     108      INTEGER                   , INTENT(in   ) ::   kt             ! time step 
     109      ! 
    171110      INTEGER ::   ji, jj, jk   ! dummy loop indices 
    172111      INTEGER ::   ikbu, ikbv   ! local integers 
     
    174113      REAL(wp), POINTER, DIMENSION(:,:,:) ::   z3dx, z3dy                 ! 3D workspace  
    175114      !!---------------------------------------------------------------------- 
     115      ! 
     116      putrd(:,:,:) = putrd(:,:,:) * umask(:,:,:)                       ! mask the trends 
     117      pvtrd(:,:,:) = pvtrd(:,:,:) * vmask(:,:,:) 
    176118 
    177        IF( lk_trdtra .AND. ctype == 'TRA' ) THEN       ! active tracer trends 
    178          ! 
    179 !!gm Rq: mask the trends already masked in trd_tra, but lbc_lnk should probably be added 
    180          ! 
    181          SELECT CASE( ktrd ) 
    182          CASE( jptra_trd_xad  )   ;   CALL iom_put( "ttrd_xad" , ptrdx )        ! x- horizontal advection 
    183                                       CALL iom_put( "strd_xad" , ptrdy ) 
    184          CASE( jptra_trd_yad  )   ;   CALL iom_put( "ttrd_yad" , ptrdx )        ! y- horizontal advection 
    185                                       CALL iom_put( "strd_yad" , ptrdy ) 
    186          CASE( jptra_trd_zad  )   ;   CALL iom_put( "ttrd_zad" , ptrdx )        ! z- vertical   advection 
    187                                       CALL iom_put( "strd_zad" , ptrdy ) 
    188                                       IF( .NOT.lk_vvl ) THEN                   ! cst volume : adv flux through z=0 surface 
    189                                          z2dx(:,:) = wn(:,:,1) * tsn(:,:,1,jp_tem) / fse3t(:,:,1) 
    190                                          z2dy(:,:) = wn(:,:,1) * tsn(:,:,1,jp_sal) / fse3t(:,:,1) 
    191                                          CALL iom_put( "ttrd_sad", z2dx ) 
    192                                          CALL iom_put( "strd_sad", z2dy ) 
    193                                       ENDIF 
    194          CASE( jptra_trd_ldf  )   ;   CALL iom_put( "ttrd_ldf" , ptrdx )        ! lateral diffusion 
    195                                       CALL iom_put( "strd_ldf" , ptrdy ) 
    196          CASE( jptra_trd_zdf  )   ;   CALL iom_put( "ttrd_zdf" , ptrdx )        ! vertical diffusion (including Kz contribution) 
    197                                       CALL iom_put( "strd_zdf" , ptrdy ) 
    198          CASE( jptra_trd_zdfp )   ;   CALL iom_put( "ttrd_zdfp", ptrdx )        ! PURE vertical diffusion (no isoneutral contribution) 
    199                                       CALL iom_put( "strd_zdfp", ptrdy ) 
    200          CASE( jptra_trd_dmp  )   ;   CALL iom_put( "ttrd_dmp" , ptrdx )        ! internal restoring (damping) 
    201                                       CALL iom_put( "strd_dmp" , ptrdy ) 
    202          CASE( jptra_trd_bbl  )   ;   CALL iom_put( "ttrd_bbl" , ptrdx )        ! bottom boundary layer 
    203                                       CALL iom_put( "strd_bbl" , ptrdy ) 
    204          CASE( jptra_trd_npc  )   ;   CALL iom_put( "ttrd_npc" , ptrdx )        ! static instability mixing 
    205                                       CALL iom_put( "strd_npc" , ptrdy ) 
    206          CASE( jptra_trd_nsr  )   ;   CALL iom_put( "ttrd_qns" , ptrdx )        ! surface forcing + runoff (ln_rnf=T) 
    207                                       CALL iom_put( "strd_cdt" , ptrdy ) 
    208          CASE( jptra_trd_qsr  )   ;   CALL iom_put( "ttrd_qsr" , ptrdx )        ! penetrative solar radiat. (only on temperature) 
    209          CASE( jptra_trd_bbc  )   ;   CALL iom_put( "ttrd_bbc" , ptrdx )        ! geothermal heating   (only on temperature) 
    210          CASE( jptra_trd_atf  )   ;   CALL iom_put( "ttrd_atf" , ptrdx )        ! asselin time Filter 
    211                                       CALL iom_put( "strd_atf" , ptrdy ) 
     119!!gm NB : here a lbc_lnk should probably be added 
    212120 
    213          END SELECT 
    214       ENDIF 
     121      ! 
     122      SELECT CASE( ktrd ) 
     123      CASE( jpdyn_hpg )   ;   CALL iom_put( "utrd_hpg", putrd )    ! hydrostatic pressure gradient 
     124                              CALL iom_put( "vtrd_hpg", pvtrd ) 
     125      CASE( jpdyn_spg )   ;   CALL iom_put( "utrd_spg", putrd )    ! surface pressure gradient 
     126                              CALL iom_put( "vtrd_spg", pvtrd ) 
     127      CASE( jpdyn_pvo )   ;   CALL iom_put( "utrd_pvo", putrd )    ! planetary vorticity 
     128                              CALL iom_put( "vtrd_pvo", pvtrd ) 
     129      CASE( jpdyn_rvo )   ;   CALL iom_put( "utrd_rvo", putrd )    ! relative  vorticity     (or metric term) 
     130                              CALL iom_put( "vtrd_rvo", pvtrd ) 
     131      CASE( jpdyn_keg )   ;   CALL iom_put( "utrd_keg", putrd )    ! Kinetic Energy gradient (or had) 
     132                              CALL iom_put( "vtrd_keg", pvtrd ) 
     133         z3dx(:,:,:) = 0._wp                                           ! U.dxU & V.dyV (approximation) 
     134         z3dy(:,:,:) = 0._wp 
     135         DO jk = 1, jpkm1                                                  ! no mask as un,vn are masked 
     136            DO jj = 2, jpjm1 
     137                DO ji = 2, jpim1 
     138                  z3dx(ji,jj,jk) = un(ji,jj,jk) * ( un(ji+1,jj,jk) - un(ji-1,jj,jk) ) / ( 2._wp * e1u(ji,jj) ) 
     139                  z3dy(ji,jj,jk) = vn(ji,jj,jk) * ( vn(ji,jj+1,jk) - vn(ji,jj-1,jk) ) / ( 2._wp * e2v(ji,jj) ) 
     140               END DO 
     141            END DO 
     142         END DO 
     143         CALL lbc_lnk( z3dx, 'U', -1. )   ;    CALL lbc_lnk( z3dy, 'V', -1. ) 
     144                              CALL iom_put( "utrd_udx", z3dx  )  
     145                              CALL iom_put( "vtrd_vdy", z3dy  ) 
     146      CASE( jpdyn_zad )   ;   CALL iom_put( "utrd_zad", putrd )    ! vertical   advection 
     147                              CALL iom_put( "vtrd_zad", pvtrd ) 
     148      CASE( jpdyn_ldf )   ;   CALL iom_put( "utrd_ldf", putrd )    ! lateral diffusion 
     149                              CALL iom_put( "vtrd_ldf", pvtrd ) 
     150      CASE( jpdyn_zdf )   ;   CALL iom_put( "utrd_zdf", putrd )    ! vertical diffusion  
     151                              CALL iom_put( "vtrd_zdf", pvtrd ) 
     152                              !                                    ! wind stress trends 
     153                              z2dx(:,:) = ( utau_b(ji,jj) + utau(ji,jj) ) / ( fse3u(:,:,1) * rau0 ) 
     154                              z2dy(:,:) = ( vtau_b(ji,jj) + vtau(ji,jj) ) / ( fse3v(:,:,1) * rau0 ) 
     155                              CALL iom_put( "utrd_tau", z2dx ) 
     156                              CALL iom_put( "vtrd_tau", z2dy ) 
     157      CASE( jpdyn_bfr ) 
     158         IF( .NOT.ln_bfrimp )     CALL iom_put( "utrd_bfr", putrd )    ! bottom friction (explicit case) 
     159         IF( .NOT.ln_bfrimp )     CALL iom_put( "vtrd_bfr", pvtrd ) 
     160!!gm only valid if ln_bfrimp=T otherwise the bottom stress as to be recomputed at the end of the compuation.... 
    215161 
    216       IF( lk_trddyn .AND. ctype == 'DYN' ) THEN       ! momentum trends  
    217             ! 
    218          ptrdx(:,:,:) = ptrdx(:,:,:) * umask(:,:,:)                       ! mask the trends 
    219          ptrdy(:,:,:) = ptrdy(:,:,:) * vmask(:,:,:) 
    220 !!gm NB : here a lbc_lnk should probably be added 
    221          ! 
    222          SELECT CASE( ktrd ) 
    223          CASE( jpdyn_trd_hpg )   ;   CALL iom_put( "utrd_hpg", ptrdx )    ! hydrostatic pressure gradient 
    224                                      CALL iom_put( "vtrd_hpg", ptrdy ) 
    225          CASE( jpdyn_trd_spg )   ;   CALL iom_put( "utrd_spg", ptrdx )    ! surface pressure gradient 
    226                                      CALL iom_put( "vtrd_spg", ptrdy ) 
    227          CASE( jpdyn_trd_pvo )   ;   CALL iom_put( "utrd_pvo", ptrdx )    ! planetary vorticity 
    228                                      CALL iom_put( "vtrd_pvo", ptrdy ) 
    229          CASE( jpdyn_trd_rvo )   ;   CALL iom_put( "utrd_rvo", ptrdx )    ! relative  vorticity     (or metric term) 
    230                                      CALL iom_put( "vtrd_rvo", ptrdy ) 
    231          CASE( jpdyn_trd_keg )   ;   CALL iom_put( "utrd_keg", ptrdx )    ! Kinetic Energy gradient (or had) 
    232                                      CALL iom_put( "vtrd_keg", ptrdy ) 
    233             z3dx(:,:,:) = 0._wp                                           ! U.dxU & V.dyV (approximation) 
    234             z3dy(:,:,:) = 0._wp 
    235             DO jk = 1, jpkm1                                                  ! no mask as un,vn are masked 
     162      CASE( jpdyn_atf )   ;   CALL iom_put( "utrd_atf", putrd )    ! asselin filter trends  
     163                              CALL iom_put( "vtrd_atf", pvtrd ) 
     164         IF( ln_bfrimp ) THEN                                          ! bottom friction (implicit case) 
     165            z3dx(:,:,:) = 0._wp   ;   z3dy(:,:,:) = 0._wp                 ! after velocity known (now filed at this stage) 
     166            DO jk = 1, jpkm1 
    236167               DO jj = 2, jpjm1 
    237168                  DO ji = 2, jpim1 
    238                      z3dx(ji,jj,jk) = un(ji,jj,jk) * ( un(ji+1,jj,jk) - un(ji-1,jj,jk) ) / ( 2._wp * e1u(ji,jj) ) 
    239                      z3dy(ji,jj,jk) = vn(ji,jj,jk) * ( vn(ji,jj+1,jk) - vn(ji,jj-1,jk) ) / ( 2._wp * e2v(ji,jj) ) 
     169                     ikbu = mbku(ji,jj)          ! deepest ocean u- & v-levels 
     170                     ikbv = mbkv(ji,jj) 
     171                     z3dx(ji,jj,jk) = bfrua(ji,jj) * un(ji,jj,ikbu) / fse3u(ji,jj,ikbu) 
     172                     z3dy(ji,jj,jk) = bfrva(ji,jj) * vn(ji,jj,ikbv) / fse3v(ji,jj,ikbv) 
    240173                  END DO 
    241174               END DO 
    242175            END DO 
    243             CALL lbc_lnk( z3dx, 'U', -1. )   ;    CALL lbc_lnk( z3dy, 'V', -1. ) 
    244                                      CALL iom_put( "utrd_udx", z3dx  )  
    245                                      CALL iom_put( "vtrd_vdy", z3dy  ) 
    246          CASE( jpdyn_trd_zad )   ;   CALL iom_put( "utrd_zad", ptrdx )    ! vertical   advection 
    247                                      CALL iom_put( "vtrd_zad", ptrdy ) 
    248          CASE( jpdyn_trd_ldf )   ;   CALL iom_put( "utrd_ldf", ptrdx )    ! lateral diffusion 
    249                                      CALL iom_put( "vtrd_ldf", ptrdy ) 
    250          CASE( jpdyn_trd_zdf )   ;   CALL iom_put( "utrd_zdf", ptrdx )    ! vertical diffusion  
    251                                      CALL iom_put( "vtrd_zdf", ptrdy ) 
    252                                      !                                    ! wind stress trends 
    253                                      z2dx(:,:) = ( utau_b(ji,jj) + utau(ji,jj) ) / ( fse3u(:,:,1) * rau0 ) 
    254                                      z2dy(:,:) = ( vtau_b(ji,jj) + vtau(ji,jj) ) / ( fse3v(:,:,1) * rau0 ) 
    255                                      CALL iom_put( "utrd_tau", z2dx ) 
    256                                      CALL iom_put( "vtrd_tau", z2dy ) 
    257          CASE( jpdyn_trd_bfr ) 
    258             IF( .NOT.ln_bfrimp )     CALL iom_put( "utrd_bfr", ptrdx )    ! bottom friction (explicit case) 
    259             IF( .NOT.ln_bfrimp )     CALL iom_put( "vtrd_bfr", ptrdy ) 
    260 !!gm only valid if ln_bfrimp=T otherwise the bottom stress as to be recomputed.... 
    261  
    262          CASE( jpdyn_trd_atf )   ;   CALL iom_put( "utrd_atf", ptrdx )    ! asselin filter trends  
    263                                      CALL iom_put( "vtrd_atf", ptrdy ) 
    264             IF( ln_bfrimp ) THEN                                          ! bottom friction (implicit case) 
    265                z3dx(:,:,:) = 0._wp   ;   z3dy(:,:,:) = 0._wp                 ! after velocity known (now filed at this stage) 
    266                DO jk = 1, jpkm1 
    267                   DO jj = 2, jpjm1 
    268                      DO ji = 2, jpim1 
    269                         ikbu = mbku(ji,jj)          ! deepest ocean u- & v-levels 
    270                         ikbv = mbkv(ji,jj) 
    271                         z3dx(ji,jj,jk) = bfrua(ji,jj) * un(ji,jj,ikbu) / fse3u(ji,jj,ikbu) 
    272                         z3dy(ji,jj,jk) = bfrva(ji,jj) * vn(ji,jj,ikbv) / fse3v(ji,jj,ikbv) 
    273                      END DO 
    274                   END DO 
    275                END DO 
    276                                      CALL iom_put( "utrd_bfr", z3dx )    ! bottom friction (implicit) 
    277                                      CALL iom_put( "vtrd_bfr", z3dy ) 
    278             ENDIF 
    279             ! 
    280          END SELECT 
     176                              CALL iom_put( "utrd_bfr", z3dx )    ! bottom friction (implicit) 
     177                              CALL iom_put( "vtrd_bfr", z3dy ) 
     178         ENDIF 
    281179         ! 
    282       ENDIF 
     180      END SELECT 
    283181      ! 
    284182      CALL wrk_dealloc( jpi, jpj     , z2dx, z2dy, ztswu, ztswv ) 
    285183      CALL wrk_dealloc( jpi, jpj, jpk, z3dx, z3dy ) 
    286184      ! 
    287    END SUBROUTINE trd_3Diom 
    288  
    289 #else 
    290    !!---------------------------------------------------------------------- 
    291    !!   Default case :           Empty module          No trend diagnostics 
    292    !!---------------------------------------------------------------------- 
    293 CONTAINS 
    294    SUBROUTINE trd_mod( ptrdx, ptrdy, ktrd, ctype, kt )   ! Empty routine 
    295       REAL ::   ptrdx(:,:,:), ptrdy(:,:,:) 
    296       INTEGER  ::   ktrd, kt                             
    297       CHARACTER(len=3) ::  ctype                   
    298       WRITE(*,*) 'trd_mod: You should not have seen this print! error ?',   & 
    299          &       ptrdx(1,1,1), ptrdy(1,1,1), ktrd, ctype, kt 
    300    END SUBROUTINE trd_mod 
    301 #endif 
    302  
    303    SUBROUTINE trd_mod_init 
    304       !!---------------------------------------------------------------------- 
    305       !!                  ***  ROUTINE trd_mod_init  *** 
    306       !!  
    307       !! ** Purpose :   Initialization of activated trends 
    308       !!---------------------------------------------------------------------- 
    309       USE in_out_manager          ! I/O manager 
    310  
    311       NAMELIST/namtrd/ ln_3D_trd_d, ln_KE_trd, ln_vor_trd, ln_ML_trd_d,   & 
    312          &             ln_3D_trd_t, ln_PE_trd, ln_glo_trd, ln_ML_trd_t,   & 
    313          &             nn_trd , cn_trdrst_in , ln_trdmld_restart,         & 
    314          &             nn_ctls, cn_trdrst_out, ln_trdmld_instant, rn_ucf 
    315       !!---------------------------------------------------------------------- 
    316  
    317       IF( l_trdtra .OR. l_trddyn )   THEN 
    318          REWIND( numnam ) 
    319          READ  ( numnam, namtrd )      ! namelist namtrd : trends diagnostic 
    320  
    321          IF(lwp) THEN 
    322             WRITE(numout,*) 
    323             WRITE(numout,*) ' trd_mod_init : Momentum/Tracers trends' 
    324             WRITE(numout,*) ' ~~~~~~~~~~~~~' 
    325             WRITE(numout,*) '   Namelist namtrd : set trends parameters' 
    326             WRITE(numout,*) '      U & V trends: 3D output                 ln_3D_trd_d        = ', ln_3D_trd_d 
    327             WRITE(numout,*) '      T & S trends: 3D output                 ln_3D_trd_t        = ', ln_3D_trd_t 
    328             WRITE(numout,*) '      Kinetic   Energy trends                 ln_KE_trd          = ', ln_KE_trd 
    329             WRITE(numout,*) '      Potential Energy trends                 ln_PE_trd          = ', ln_PE_trd 
    330             WRITE(numout,*) '      Barotropic vorticity trends             ln_vor_trd         = ', ln_vor_trd 
    331             WRITE(numout,*) '      check domain averaged dyn & tra trends  ln_glo_trd         = ', ln_glo_trd 
    332             WRITE(numout,*) '      U & V trends: Mixed Layer averaged      ln_ML_trd_d        = ', ln_3D_trd_d 
    333             WRITE(numout,*) '      T & S trends: Mixed Layer averaged      ln_ML_trd_t        = ', ln_3D_trd_t 
    334      ! 
    335             WRITE(numout,*) '      frequency of trends diagnostics (glo)   nn_trd             = ', nn_trd 
    336             WRITE(numout,*) '      control surface type            (mld)   nn_ctls            = ', nn_ctls 
    337             WRITE(numout,*) '      restart for ML diagnostics              ln_trdmld_restart  = ', ln_trdmld_restart 
    338             WRITE(numout,*) '      instantaneous or mean ML T/S            ln_trdmld_instant  = ', ln_trdmld_instant 
    339             WRITE(numout,*) '      unit conversion factor                  rn_ucf             = ', rn_ucf 
    340         ENDIF 
    341       ENDIF 
    342       ! 
    343       IF( ln_KE_trd .OR. ln_PE_trd .OR. ln_ML_trd_d )   & 
    344          CALL ctl_stop( 'KE, PE, aur ML on momentum are not yet coded we stop' ) 
    345 !!gm  : Potential BUG : 3D output only for vector invariant form!  add a ctl_stop or code the flux form case 
    346 !!gm  : bug/pb for vertical advection of tracer in vvl case: add T.dt[eta] in the output...  
    347       ! 
    348       IF( lk_trddyn .OR. lk_trdtra )    CALL trd_icp_init       ! integral constraints trends 
    349       IF( lk_trdmld                )    CALL trd_mld_init       ! mixed-layer trends (active  tracers)   
    350       IF( lk_trdvor                )    CALL trd_vor_init       ! vorticity trends         
    351       ! 
    352    END SUBROUTINE trd_mod_init 
     185   END SUBROUTINE trd_dyn_iom 
    353186 
    354187   !!====================================================================== 
    355 END MODULE trdmod 
     188END MODULE trddyn 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdglo.F90

    r3317 r3318  
    1 MODULE trdicp 
     1MODULE trdglo 
    22   !!====================================================================== 
    3    !!                       ***  MODULE  trdicp  *** 
    4    !! Ocean diagnostics:  ocean tracers and dynamic trends 
     3   !!                       ***  MODULE  trdglo  *** 
     4   !! Ocean diagnostics:  global domain averaged tracer and momentum trends 
    55   !!===================================================================== 
    66   !! History :  1.0  !  2004-08 (C. Talandier) New trends organization 
     
    99 
    1010   !!---------------------------------------------------------------------- 
    11    !!   trd_budget     : domain averaged budget of trends (including kinetic energy and T^2 trends) 
    12    !!   trd_icp        : compute the basin averaged properties for tra/dyn  
    13    !!   trd_dwr        : print dynmaic trends in ocean.output file 
    14    !!   trd_twr        : print tracers trends in ocean.output file 
    15    !!   trd_icp_init   : initialization step 
     11   !!   trd_glo      : domain averaged budget of trends (including kinetic energy and T^2 trends) 
     12   !!   glo_dyn_wri  : print dynamic trends in ocean.output file 
     13   !!   glo_tra_wri  : print global T & T^2 trends in ocean.output file 
     14   !!   trd_glo_init : initialization step 
    1615   !!---------------------------------------------------------------------- 
    1716   USE oce             ! ocean dynamics and tracers variables 
    1817   USE dom_oce         ! ocean space and time domain variables 
    1918   USE sbc_oce         ! surface boundary condition: ocean 
     19   USE trd_oce         ! trends: ocean variables 
    2020   USE phycst          ! physical constants 
    21    USE trdmod_oce      ! ocean variables trends 
    2221   USE ldftra_oce      ! ocean active tracers: lateral physics 
    2322   USE ldfdyn_oce      ! ocean dynamics: lateral physics 
     
    3534   PRIVATE 
    3635 
    37    PUBLIC   trd_budget    ! called by trdmod.F90 
    38    PUBLIC   trd_dwr       ! called by step.F90 
    39    PUBLIC   trd_twr       ! called by step.F90 
    40    PUBLIC   trd_icp_init  ! called by opa.F90 
     36   PUBLIC   trd_glo       ! called by trdtra and trddyn modules 
     37   PUBLIC   trd_glo_init  ! called by trdini module 
    4138 
    4239   !                     !!! Variables used for diagnostics 
     
    6461CONTAINS 
    6562 
    66    SUBROUTINE trd_budget( ptrdx, ptrdy, ktrd, ctype, kt ) 
     63   SUBROUTINE trd_glo( ptrdx, ptrdy, ktrd, ctype, kt ) 
    6764      !!--------------------------------------------------------------------- 
    68       !!                  ***  ROUTINE trd_budget  *** 
     65      !!                  ***  ROUTINE trd_glo  *** 
    6966      !!  
    70       !! ** Purpose : integral constraint diagnostics for momentum and/or tracer trends 
    71       !!               
     67      !! ** Purpose :   compute and print global domain averaged trends for  
     68      !!              T, T^2, momentum, KE, and KE<->PE 
     69      !! 
    7270      !!---------------------------------------------------------------------- 
    7371      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend  
    7472      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend 
    7573      INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index 
    76       CHARACTER(len=3)          , INTENT(in   ) ::   ctype   ! momentum or tracers trends type 'DYN'/'TRA' 
     74      CHARACTER(len=3)          , INTENT(in   ) ::   ctype   ! momentum or tracers trends type (='DYN'/'TRA') 
    7775      INTEGER                   , INTENT(in   ) ::   kt      ! time step 
    7876      !! 
     
    104102            END DO 
    105103            !                       ! linear free surface: diagnose advective flux trough the fixed k=1 w-surface 
    106             IF( .NOT.lk_vvl .AND. ktrd == jptra_trd_zad ) THEN   
    107                tmo(jptra_trd_sad) = SUM( wn(:,:,1) * tsn(:,:,1,jp_tem) * e1e2t(:,:) ) 
    108                smo(jptra_trd_sad) = SUM( wn(:,:,1) * tsn(:,:,1,jp_sal) * e1e2t(:,:)  ) 
    109                t2 (jptra_trd_sad) = SUM( wn(:,:,1) * tsn(:,:,1,jp_tem) * tsn(:,:,1,jp_tem) * e1e2t(:,:)  ) 
    110                s2 (jptra_trd_sad) = SUM( wn(:,:,1) * tsn(:,:,1,jp_sal) * tsn(:,:,1,jp_sal) * e1e2t(:,:)  ) 
     104            IF( .NOT.lk_vvl .AND. ktrd == jptra_zad ) THEN   
     105               tmo(jptra_sad) = SUM( wn(:,:,1) * tsn(:,:,1,jp_tem) * e1e2t(:,:) ) 
     106               smo(jptra_sad) = SUM( wn(:,:,1) * tsn(:,:,1,jp_sal) * e1e2t(:,:)  ) 
     107               t2 (jptra_sad) = SUM( wn(:,:,1) * tsn(:,:,1,jp_tem) * tsn(:,:,1,jp_tem) * e1e2t(:,:)  ) 
     108               s2 (jptra_sad) = SUM( wn(:,:,1) * tsn(:,:,1,jp_sal) * tsn(:,:,1,jp_sal) * e1e2t(:,:)  ) 
    111109            ENDIF 
    112110            ! 
    113             IF( ktrd == jptra_trd_atf ) THEN     ! last trend (asselin time filter) 
     111            IF( ktrd == jptra_atf ) THEN     ! last trend (asselin time filter) 
    114112               !  
    115                CALL trd_twr( kt )   ! print the results in ocean.output 
     113               CALL glo_tra_wri( kt )             ! print the results in ocean.output 
    116114               !                 
    117                tmo(:) = 0._wp       ! prepare the next time step (domain averaged array reset to zero) 
     115               tmo(:) = 0._wp                     ! prepare the next time step (domain averaged array reset to zero) 
    118116               smo(:) = 0._wp 
    119117               t2 (:) = 0._wp 
     
    137135            END DO 
    138136            !                  
    139             IF( ktrd == jpdyn_trd_zdf ) THEN      ! zdf trend: compute separately the surface forcing trend 
     137            IF( ktrd == jpdyn_zdf ) THEN      ! zdf trend: compute separately the surface forcing trend 
    140138               z1_2rau0 = 0.5_wp / rau0 
    141139               DO jj = 1, jpjm1 
     
    145143                     zvs = ( vtau_b(ji,jj) + vtau(ji,jj) ) * tmask_i(ji  ,jj+1) * tmask_i(ji,jj) * vmask(ji,jj,jk)   & 
    146144                        &                       * z1_2rau0 * e1v    (ji  ,jj  ) * e2v    (ji,jj) * fse3u(ji,jj,jk) 
    147                      umo(jpdyn_trd_tau) = umo(jpdyn_trd_tau) + zvt 
    148                      vmo(jpdyn_trd_tau) = vmo(jpdyn_trd_tau) + zvs 
    149                      hke(jpdyn_trd_tau) = hke(jpdyn_trd_tau) + un(ji,jj,1) * zvt + vn(ji,jj,1) * zvs 
     145                     umo(jpdyn_tau) = umo(jpdyn_tau) + zvt 
     146                     vmo(jpdyn_tau) = vmo(jpdyn_tau) + zvs 
     147                     hke(jpdyn_tau) = hke(jpdyn_tau) + un(ji,jj,1) * zvt + vn(ji,jj,1) * zvs 
    150148                  END DO 
    151149               END DO 
    152150            ENDIF 
    153151            !                        
    154             IF( ktrd == jpdyn_trd_atf ) THEN     ! last trend (asselin time filter) 
     152            IF( ktrd == jpdyn_atf ) THEN     ! last trend (asselin time filter) 
    155153               ! 
    156154               IF( ln_bfrimp ) THEN                   ! implicit bfr case: compute separately the bottom friction  
     
    162160                        zvt = bfrua(ji,jj) * un(ji,jj,ikbu) * e1u(ji,jj) * e2v(ji,jj) 
    163161                        zvs = bfrva(ji,jj) * vn(ji,jj,ikbv) * e1v(ji,jj) * e2v(ji,jj) 
    164                         umo(jpdyn_trd_bfr) = umo(jpdyn_trd_bfr) + zvt 
    165                         vmo(jpdyn_trd_bfr) = vmo(jpdyn_trd_bfr) + zvs 
    166                         hke(jpdyn_trd_bfr) = hke(jpdyn_trd_bfr) + un(ji,jj,ikbu) * zvt + vn(ji,jj,ikbv) * zvs 
     162                        umo(jpdyn_bfr) = umo(jpdyn_bfr) + zvt 
     163                        vmo(jpdyn_bfr) = vmo(jpdyn_bfr) + zvs 
     164                        hke(jpdyn_bfr) = hke(jpdyn_bfr) + un(ji,jj,ikbu) * zvt + vn(ji,jj,ikbv) * zvs 
    167165                     END DO 
    168166                  END DO 
    169167               ENDIF 
    170168               !  
    171                CALL trd_dwr( kt )                     ! print the results in ocean.output 
     169               CALL glo_dyn_wri( kt )                 ! print the results in ocean.output 
    172170               !                 
    173171               umo(:) = 0._wp                         ! reset for the next time step 
     
    183181      CALL wrk_dealloc( jpi, jpj, ztswu, ztswv, z2dx, z2dy ) 
    184182      ! 
    185    END SUBROUTINE trd_budget 
    186  
    187  
    188    SUBROUTINE trd_icp_init 
     183   END SUBROUTINE trd_glo 
     184 
     185 
     186   SUBROUTINE trd_glo_init 
    189187      !!--------------------------------------------------------------------- 
    190       !!                  ***  ROUTINE trd_icp_init  *** 
     188      !!                  ***  ROUTINE trd_glo_init  *** 
    191189      !!  
    192190      !! ** Purpose :   Read the namtrd namelist 
     
    197195      IF(lwp) THEN 
    198196         WRITE(numout,*) 
    199          WRITE(numout,*) 'trd_icp_init : integral constraints properties trends' 
     197         WRITE(numout,*) 'trd_glo_init : integral constraints properties trends' 
    200198         WRITE(numout,*) '~~~~~~~~~~~~~' 
    201199      ENDIF 
     
    210208      IF(lwp) WRITE(numout,*) '                total ocean volume at T-point   tvolt = ',tvolt 
    211209 
    212 #if  defined key_trddyn 
    213210      ! Initialization of potential to kinetic energy conversion 
    214211      rpktrd = 0._wp 
     
    233230         WRITE(numout,*) '                total ocean volume at V-point   tvolv = ',tvolv 
    234231      ENDIF 
    235 #endif 
    236       ! 
    237    END SUBROUTINE trd_icp_init 
    238  
    239  
    240    SUBROUTINE trd_dwr( kt ) 
     232      ! 
     233   END SUBROUTINE trd_glo_init 
     234 
     235 
     236   SUBROUTINE glo_dyn_wri( kt ) 
    241237      !!--------------------------------------------------------------------- 
    242       !!                  ***  ROUTINE trd_dwr  *** 
     238      !!                  ***  ROUTINE glo_dyn_wri  *** 
    243239      !!  
    244       !! ** Purpose :  write dynamic trends in ocean.output  
     240      !! ** Purpose :  write global averaged U, KE, PE<->KE trends in ocean.output  
    245241      !!---------------------------------------------------------------------- 
    246242      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
     
    319315            WRITE (numout,*) 
    320316            WRITE (numout,9500) kt 
    321             WRITE (numout,9501) umo(jpdyn_trd_hpg) / tvolu, vmo(jpdyn_trd_hpg) / tvolv 
    322             WRITE (numout,9509) umo(jpdyn_trd_spg) / tvolu, vmo(jpdyn_trd_spg) / tvolv 
    323             WRITE (numout,9502) umo(jpdyn_trd_keg) / tvolu, vmo(jpdyn_trd_keg) / tvolv 
    324             WRITE (numout,9503) umo(jpdyn_trd_rvo) / tvolu, vmo(jpdyn_trd_rvo) / tvolv 
    325             WRITE (numout,9504) umo(jpdyn_trd_pvo) / tvolu, vmo(jpdyn_trd_pvo) / tvolv 
    326             WRITE (numout,9507) umo(jpdyn_trd_zad) / tvolu, vmo(jpdyn_trd_zad) / tvolv 
    327             WRITE (numout,9505) umo(jpdyn_trd_ldf) / tvolu, vmo(jpdyn_trd_ldf) / tvolv 
    328             WRITE (numout,9508) umo(jpdyn_trd_zdf) / tvolu, vmo(jpdyn_trd_zdf) / tvolv 
    329             WRITE (numout,9510) umo(jpdyn_trd_tau) / tvolu, vmo(jpdyn_trd_tau) / tvolv 
    330             WRITE (numout,9511) umo(jpdyn_trd_bfr) / tvolu, vmo(jpdyn_trd_bfr) / tvolv 
    331             WRITE (numout,9512) umo(jpdyn_trd_atf) / tvolu, vmo(jpdyn_trd_atf) / tvolv 
     317            WRITE (numout,9501) umo(jpdyn_hpg) / tvolu, vmo(jpdyn_hpg) / tvolv 
     318            WRITE (numout,9509) umo(jpdyn_spg) / tvolu, vmo(jpdyn_spg) / tvolv 
     319            WRITE (numout,9502) umo(jpdyn_keg) / tvolu, vmo(jpdyn_keg) / tvolv 
     320            WRITE (numout,9503) umo(jpdyn_rvo) / tvolu, vmo(jpdyn_rvo) / tvolv 
     321            WRITE (numout,9504) umo(jpdyn_pvo) / tvolu, vmo(jpdyn_pvo) / tvolv 
     322            WRITE (numout,9507) umo(jpdyn_zad) / tvolu, vmo(jpdyn_zad) / tvolv 
     323            WRITE (numout,9505) umo(jpdyn_ldf) / tvolu, vmo(jpdyn_ldf) / tvolv 
     324            WRITE (numout,9508) umo(jpdyn_zdf) / tvolu, vmo(jpdyn_zdf) / tvolv 
     325            WRITE (numout,9510) umo(jpdyn_tau) / tvolu, vmo(jpdyn_tau) / tvolv 
     326            WRITE (numout,9511) umo(jpdyn_bfr) / tvolu, vmo(jpdyn_bfr) / tvolv 
     327            WRITE (numout,9512) umo(jpdyn_atf) / tvolu, vmo(jpdyn_atf) / tvolv 
    332328            WRITE (numout,9513) 
    333329            WRITE (numout,9514)                                                 & 
    334             &     (  umo(jpdyn_trd_hpg) + umo(jpdyn_trd_spg) + umo(jpdyn_trd_keg) + umo(jpdyn_trd_rvo)   & 
    335             &      + umo(jpdyn_trd_pvo) + umo(jpdyn_trd_zad) + umo(jpdyn_trd_ldf) + umo(jpdyn_trd_zdf)   & 
    336             &      + umo(jpdyn_trd_tau) + umo(jpdyn_trd_bfr) + umo(jpdyn_trd_atf) ) / tvolu,   & 
    337             &     (  vmo(jpdyn_trd_hpg) + vmo(jpdyn_trd_spg) + vmo(jpdyn_trd_keg) + vmo(jpdyn_trd_rvo)   & 
    338             &      + vmo(jpdyn_trd_pvo) + vmo(jpdyn_trd_zad) + vmo(jpdyn_trd_ldf) + vmo(jpdyn_trd_zdf)   & 
    339             &      + vmo(jpdyn_trd_tau) + vmo(jpdyn_trd_bfr) + vmo(jpdyn_trd_atf) ) / tvolv 
     330            &     (  umo(jpdyn_hpg) + umo(jpdyn_spg) + umo(jpdyn_keg) + umo(jpdyn_rvo)   & 
     331            &      + umo(jpdyn_pvo) + umo(jpdyn_zad) + umo(jpdyn_ldf) + umo(jpdyn_zdf)   & 
     332            &      + umo(jpdyn_tau) + umo(jpdyn_bfr) + umo(jpdyn_atf) ) / tvolu,   & 
     333            &     (  vmo(jpdyn_hpg) + vmo(jpdyn_spg) + vmo(jpdyn_keg) + vmo(jpdyn_rvo)   & 
     334            &      + vmo(jpdyn_pvo) + vmo(jpdyn_zad) + vmo(jpdyn_ldf) + vmo(jpdyn_zdf)   & 
     335            &      + vmo(jpdyn_tau) + vmo(jpdyn_bfr) + vmo(jpdyn_atf) ) / tvolv 
    340336         ENDIF 
    341337 
     
    359355            WRITE (numout,*) 
    360356            WRITE (numout,9520) kt 
    361             WRITE (numout,9521) hke(jpdyn_trd_hpg) / tvolt 
    362             WRITE (numout,9529) hke(jpdyn_trd_spg) / tvolt 
    363             WRITE (numout,9522) hke(jpdyn_trd_keg) / tvolt 
    364             WRITE (numout,9523) hke(jpdyn_trd_rvo) / tvolt 
    365             WRITE (numout,9524) hke(jpdyn_trd_pvo) / tvolt 
    366             WRITE (numout,9527) hke(jpdyn_trd_zad) / tvolt 
    367             WRITE (numout,9525) hke(jpdyn_trd_ldf) / tvolt 
    368             WRITE (numout,9528) hke(jpdyn_trd_zdf) / tvolt 
    369             WRITE (numout,9530) hke(jpdyn_trd_tau) / tvolt 
    370             WRITE (numout,9531) hke(jpdyn_trd_bfr) / tvolt 
    371             WRITE (numout,9532) hke(jpdyn_trd_atf) / tvolt 
     357            WRITE (numout,9521) hke(jpdyn_hpg) / tvolt 
     358            WRITE (numout,9529) hke(jpdyn_spg) / tvolt 
     359            WRITE (numout,9522) hke(jpdyn_keg) / tvolt 
     360            WRITE (numout,9523) hke(jpdyn_rvo) / tvolt 
     361            WRITE (numout,9524) hke(jpdyn_pvo) / tvolt 
     362            WRITE (numout,9527) hke(jpdyn_zad) / tvolt 
     363            WRITE (numout,9525) hke(jpdyn_ldf) / tvolt 
     364            WRITE (numout,9528) hke(jpdyn_zdf) / tvolt 
     365            WRITE (numout,9530) hke(jpdyn_tau) / tvolt 
     366            WRITE (numout,9531) hke(jpdyn_bfr) / tvolt 
     367            WRITE (numout,9532) hke(jpdyn_atf) / tvolt 
    372368            WRITE (numout,9533) 
    373369            WRITE (numout,9534)   & 
    374             &     (  hke(jpdyn_trd_hpg) + hke(jpdyn_trd_spg) + hke(jpdyn_trd_keg) + hke(jpdyn_trd_rvo)   & 
    375             &      + hke(jpdyn_trd_pvo) + hke(jpdyn_trd_zad) + hke(jpdyn_trd_ldf) + hke(jpdyn_trd_zdf)   & 
    376             &      + hke(jpdyn_trd_tau) + hke(jpdyn_trd_bfr) + hke(jpdyn_trd_atf)  ) / tvolt 
     370            &     (  hke(jpdyn_hpg) + hke(jpdyn_spg) + hke(jpdyn_keg) + hke(jpdyn_rvo)   & 
     371            &      + hke(jpdyn_pvo) + hke(jpdyn_zad) + hke(jpdyn_ldf) + hke(jpdyn_zdf)   & 
     372            &      + hke(jpdyn_tau) + hke(jpdyn_bfr) + hke(jpdyn_atf)  ) / tvolt 
    377373         ENDIF 
    378374 
     
    396392            WRITE (numout,*) 
    397393            WRITE (numout,9540) kt 
    398             WRITE (numout,9541) ( hke(jpdyn_trd_keg) + hke(jpdyn_trd_rvo) + hke(jpdyn_trd_zad) ) / tvolt 
    399             WRITE (numout,9542) ( hke(jpdyn_trd_keg) + hke(jpdyn_trd_zad) ) / tvolt 
    400             WRITE (numout,9543) ( hke(jpdyn_trd_pvo) ) / tvolt 
    401             WRITE (numout,9544) ( hke(jpdyn_trd_rvo) ) / tvolt 
    402             WRITE (numout,9545) ( hke(jpdyn_trd_spg) ) / tvolt 
    403             WRITE (numout,9546) ( hke(jpdyn_trd_ldf) ) / tvolt 
    404             WRITE (numout,9547) ( hke(jpdyn_trd_zdf) ) / tvolt 
    405             WRITE (numout,9548) ( hke(jpdyn_trd_hpg) ) / tvolt, rpktrd / tvolt 
     394            WRITE (numout,9541) ( hke(jpdyn_keg) + hke(jpdyn_rvo) + hke(jpdyn_zad) ) / tvolt 
     395            WRITE (numout,9542) ( hke(jpdyn_keg) + hke(jpdyn_zad) ) / tvolt 
     396            WRITE (numout,9543) ( hke(jpdyn_pvo) ) / tvolt 
     397            WRITE (numout,9544) ( hke(jpdyn_rvo) ) / tvolt 
     398            WRITE (numout,9545) ( hke(jpdyn_spg) ) / tvolt 
     399            WRITE (numout,9546) ( hke(jpdyn_ldf) ) / tvolt 
     400            WRITE (numout,9547) ( hke(jpdyn_zdf) ) / tvolt 
     401            WRITE (numout,9548) ( hke(jpdyn_hpg) ) / tvolt, rpktrd / tvolt 
    406402            WRITE (numout,*) 
    407403            WRITE (numout,*) 
     
    425421      CALL wrk_dealloc( jpi, jpj, jpk, zkx, zky, zkz, zkepe ) 
    426422      ! 
    427    END SUBROUTINE trd_dwr 
    428  
    429  
    430    SUBROUTINE trd_twr( kt ) 
     423   END SUBROUTINE glo_dyn_wri 
     424 
     425 
     426   SUBROUTINE glo_tra_wri( kt ) 
    431427      !!--------------------------------------------------------------------- 
    432       !!                  ***  ROUTINE trd_twr  *** 
     428      !!                  ***  ROUTINE glo_tra_wri  *** 
    433429      !!  
    434       !! ** Purpose :  write active tracers trends in ocean.output  
     430      !! ** Purpose :  write global domain averaged of T and T^2 trends in ocean.output  
    435431      !!---------------------------------------------------------------------- 
    436432      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
     
    460456            WRITE (numout,*) 
    461457            WRITE (numout,9400) kt 
    462             WRITE (numout,9401)  tmo(jptra_trd_xad) / tvolt, smo(jptra_trd_xad) / tvolt 
    463             WRITE (numout,9411)  tmo(jptra_trd_yad) / tvolt, smo(jptra_trd_yad) / tvolt 
    464             WRITE (numout,9402)  tmo(jptra_trd_zad) / tvolt, smo(jptra_trd_zad) / tvolt 
    465             WRITE (numout,9403)  tmo(jptra_trd_ldf) / tvolt, smo(jptra_trd_ldf) / tvolt 
    466             WRITE (numout,9404)  tmo(jptra_trd_zdf) / tvolt, smo(jptra_trd_zdf) / tvolt 
    467             WRITE (numout,9405)  tmo(jptra_trd_npc) / tvolt, smo(jptra_trd_npc) / tvolt 
    468             WRITE (numout,9406)  tmo(jptra_trd_dmp) / tvolt, smo(jptra_trd_dmp) / tvolt 
    469             WRITE (numout,9407)  tmo(jptra_trd_qsr) / tvolt 
    470             WRITE (numout,9408)  tmo(jptra_trd_nsr) / tvolt, smo(jptra_trd_nsr) / tvolt 
     458            WRITE (numout,9401)  tmo(jptra_xad) / tvolt, smo(jptra_xad) / tvolt 
     459            WRITE (numout,9411)  tmo(jptra_yad) / tvolt, smo(jptra_yad) / tvolt 
     460            WRITE (numout,9402)  tmo(jptra_zad) / tvolt, smo(jptra_zad) / tvolt 
     461            WRITE (numout,9403)  tmo(jptra_ldf) / tvolt, smo(jptra_ldf) / tvolt 
     462            WRITE (numout,9404)  tmo(jptra_zdf) / tvolt, smo(jptra_zdf) / tvolt 
     463            WRITE (numout,9405)  tmo(jptra_npc) / tvolt, smo(jptra_npc) / tvolt 
     464            WRITE (numout,9406)  tmo(jptra_dmp) / tvolt, smo(jptra_dmp) / tvolt 
     465            WRITE (numout,9407)  tmo(jptra_qsr) / tvolt 
     466            WRITE (numout,9408)  tmo(jptra_nsr) / tvolt, smo(jptra_nsr) / tvolt 
    471467            WRITE (numout,9409)  
    472             WRITE (numout,9410) (  tmo(jptra_trd_xad) + tmo(jptra_trd_yad) + tmo(jptra_trd_zad) + tmo(jptra_trd_ldf) + tmo(jptra_trd_zdf)   & 
    473             &                    + tmo(jptra_trd_npc) + tmo(jptra_trd_dmp) + tmo(jptra_trd_qsr) + tmo(jptra_trd_nsr) ) / tvolt,   & 
    474             &                   (  smo(jptra_trd_xad) + smo(jptra_trd_yad) + smo(jptra_trd_zad) + smo(jptra_trd_ldf) + smo(jptra_trd_zdf)   & 
    475             &                    + smo(jptra_trd_npc) + smo(jptra_trd_dmp)                   + smo(jptra_trd_nsr) ) / tvolt 
     468            WRITE (numout,9410) (  tmo(jptra_xad) + tmo(jptra_yad) + tmo(jptra_zad) + tmo(jptra_ldf) + tmo(jptra_zdf)   & 
     469            &                    + tmo(jptra_npc) + tmo(jptra_dmp) + tmo(jptra_qsr) + tmo(jptra_nsr) ) / tvolt,   & 
     470            &                   (  smo(jptra_xad) + smo(jptra_yad) + smo(jptra_zad) + smo(jptra_ldf) + smo(jptra_zdf)   & 
     471            &                    + smo(jptra_npc) + smo(jptra_dmp)                   + smo(jptra_nsr) ) / tvolt 
    476472         ENDIF 
    477473 
     
    495491            WRITE (numout,*) 
    496492            WRITE (numout,9420) kt 
    497             WRITE (numout,9421)   t2(jptra_trd_xad) / tvolt, s2(jptra_trd_xad) / tvolt 
    498             WRITE (numout,9431)   t2(jptra_trd_yad) / tvolt, s2(jptra_trd_yad) / tvolt 
    499             WRITE (numout,9422)   t2(jptra_trd_zad) / tvolt, s2(jptra_trd_zad) / tvolt 
    500             WRITE (numout,9423)   t2(jptra_trd_ldf) / tvolt, s2(jptra_trd_ldf) / tvolt 
    501             WRITE (numout,9424)   t2(jptra_trd_zdf) / tvolt, s2(jptra_trd_zdf) / tvolt 
    502             WRITE (numout,9425)   t2(jptra_trd_npc) / tvolt, s2(jptra_trd_npc) / tvolt 
    503             WRITE (numout,9426)   t2(jptra_trd_dmp) / tvolt, s2(jptra_trd_dmp) / tvolt 
    504             WRITE (numout,9427)   t2(jptra_trd_qsr) / tvolt 
    505             WRITE (numout,9428)   t2(jptra_trd_nsr) / tvolt, s2(jptra_trd_nsr) / tvolt 
     493            WRITE (numout,9421)   t2(jptra_xad) / tvolt, s2(jptra_xad) / tvolt 
     494            WRITE (numout,9431)   t2(jptra_yad) / tvolt, s2(jptra_yad) / tvolt 
     495            WRITE (numout,9422)   t2(jptra_zad) / tvolt, s2(jptra_zad) / tvolt 
     496            WRITE (numout,9423)   t2(jptra_ldf) / tvolt, s2(jptra_ldf) / tvolt 
     497            WRITE (numout,9424)   t2(jptra_zdf) / tvolt, s2(jptra_zdf) / tvolt 
     498            WRITE (numout,9425)   t2(jptra_npc) / tvolt, s2(jptra_npc) / tvolt 
     499            WRITE (numout,9426)   t2(jptra_dmp) / tvolt, s2(jptra_dmp) / tvolt 
     500            WRITE (numout,9427)   t2(jptra_qsr) / tvolt 
     501            WRITE (numout,9428)   t2(jptra_nsr) / tvolt, s2(jptra_nsr) / tvolt 
    506502            WRITE (numout,9429) 
    507             WRITE (numout,9430) (  t2(jptra_trd_xad) + t2(jptra_trd_yad) + t2(jptra_trd_zad) + t2(jptra_trd_ldf) + t2(jptra_trd_zdf)   & 
    508             &                    + t2(jptra_trd_npc) + t2(jptra_trd_dmp) + t2(jptra_trd_qsr) + t2(jptra_trd_nsr) ) / tvolt,   & 
    509             &                   (  s2(jptra_trd_xad) + s2(jptra_trd_yad) + s2(jptra_trd_zad) + s2(jptra_trd_ldf) + s2(jptra_trd_zdf)   & 
    510             &                    + s2(jptra_trd_npc) + s2(jptra_trd_dmp)                  + s2(jptra_trd_nsr) ) / tvolt 
     503            WRITE (numout,9430) (  t2(jptra_xad) + t2(jptra_yad) + t2(jptra_zad) + t2(jptra_ldf) + t2(jptra_zdf)   & 
     504            &                    + t2(jptra_npc) + t2(jptra_dmp) + t2(jptra_qsr) + t2(jptra_nsr) ) / tvolt,   & 
     505            &                   (  s2(jptra_xad) + s2(jptra_yad) + s2(jptra_zad) + s2(jptra_ldf) + s2(jptra_zdf)   & 
     506            &                    + s2(jptra_npc) + s2(jptra_dmp)                  + s2(jptra_nsr) ) / tvolt 
    511507         ENDIF 
    512508 
     
    530526            WRITE (numout,*) 
    531527            WRITE (numout,9440) kt 
    532             WRITE (numout,9441) ( tmo(jptra_trd_xad)+tmo(jptra_trd_yad)+tmo(jptra_trd_zad) )/tvolt,   & 
    533             &                   ( smo(jptra_trd_xad)+smo(jptra_trd_yad)+smo(jptra_trd_zad) )/tvolt 
    534             WRITE (numout,9442)   tmo(jptra_trd_sad)/tvolt,  smo(jptra_trd_sad)/tvolt 
    535             WRITE (numout,9443)   tmo(jptra_trd_ldf)/tvolt,  smo(jptra_trd_ldf)/tvolt 
    536             WRITE (numout,9444)   tmo(jptra_trd_zdf)/tvolt,  smo(jptra_trd_zdf)/tvolt 
    537             WRITE (numout,9445)   tmo(jptra_trd_npc)/tvolt,  smo(jptra_trd_npc)/tvolt 
    538             WRITE (numout,9446) ( t2(jptra_trd_xad)+t2(jptra_trd_yad)+t2(jptra_trd_zad) )/tvolt,    & 
    539             &                   ( s2(jptra_trd_xad)+s2(jptra_trd_yad)+s2(jptra_trd_zad) )/tvolt 
    540             WRITE (numout,9447)   t2(jptra_trd_ldf)/tvolt,   s2(jptra_trd_ldf)/tvolt 
    541             WRITE (numout,9448)   t2(jptra_trd_zdf)/tvolt,   s2(jptra_trd_zdf)/tvolt 
    542             WRITE (numout,9449)   t2(jptra_trd_npc)/tvolt,   s2(jptra_trd_npc)/tvolt 
     528            WRITE (numout,9441) ( tmo(jptra_xad)+tmo(jptra_yad)+tmo(jptra_zad) )/tvolt,   & 
     529            &                   ( smo(jptra_xad)+smo(jptra_yad)+smo(jptra_zad) )/tvolt 
     530            WRITE (numout,9442)   tmo(jptra_sad)/tvolt,  smo(jptra_sad)/tvolt 
     531            WRITE (numout,9443)   tmo(jptra_ldf)/tvolt,  smo(jptra_ldf)/tvolt 
     532            WRITE (numout,9444)   tmo(jptra_zdf)/tvolt,  smo(jptra_zdf)/tvolt 
     533            WRITE (numout,9445)   tmo(jptra_npc)/tvolt,  smo(jptra_npc)/tvolt 
     534            WRITE (numout,9446) ( t2(jptra_xad)+t2(jptra_yad)+t2(jptra_zad) )/tvolt,    & 
     535            &                   ( s2(jptra_xad)+s2(jptra_yad)+s2(jptra_zad) )/tvolt 
     536            WRITE (numout,9447)   t2(jptra_ldf)/tvolt,   s2(jptra_ldf)/tvolt 
     537            WRITE (numout,9448)   t2(jptra_zdf)/tvolt,   s2(jptra_zdf)/tvolt 
     538            WRITE (numout,9449)   t2(jptra_npc)/tvolt,   s2(jptra_npc)/tvolt 
    543539         ENDIF 
    544540 
     
    558554      ENDIF 
    559555      ! 
    560    END SUBROUTINE trd_twr 
     556   END SUBROUTINE glo_tra_wri 
    561557 
    562558   !!====================================================================== 
    563 END MODULE trdicp 
     559END MODULE trdglo 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdini.F90

    r3317 r3318  
    1 MODULE trdmod 
     1MODULE trdini 
    22   !!====================================================================== 
    3    !!                       ***  MODULE  trdmod  *** 
     3   !!                       ***  MODULE  trdini  *** 
    44   !! Ocean diagnostics:  ocean tracers and dynamic trends 
    55   !!===================================================================== 
    6    !! History :  1.0  !  2004-08  (C. Talandier) Original code 
    7    !!             -   !  2005-04  (C. Deltel)    Add Asselin trend in the ML budget 
    8    !!            3.3  !  2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase 
    9    !!            3.5  !  2012-02  (G. Madec) add 3D trends output for T, S, U, V, PE and KE 
     6   !! History :   3.5  !  2012-02  (G. Madec) add 3D trends output for T, S, U, V, PE and KE 
    107   !!---------------------------------------------------------------------- 
    11 #if  defined key_trdtra || defined key_trddyn || defined key_trdmld || defined key_trdvor || defined key_esopa 
     8 
    129   !!---------------------------------------------------------------------- 
    13    !!   trd_mod       : manage the type of trend diagnostics 
    14    !!   trd_3Diom     : output 3D momentum and/or tracer trends using IOM 
    15    !!   trd_mod_init  : Initialization step 
     10   !!   trd_init      : initialization step 
    1611   !!---------------------------------------------------------------------- 
    17    USE oce            ! ocean dynamics and tracers variables 
    18    USE dom_oce        ! ocean space and time domain variables 
    19    USE zdf_oce        ! ocean vertical physics variables 
    20    USE trdmod_oce     ! ocean variables trends 
    21    USE zdfbfr         ! bottom friction 
    22    USE ldftra_oce     ! ocean active tracers lateral physics 
    23    USE sbc_oce        ! surface boundary condition: ocean 
    24    USE phycst         ! physical constants 
     12   USE trd_oce        ! trends: ocean variables 
     13!   USE ldftra_oce     ! ocean active tracers lateral physics 
     14   USE trdglo         ! ocean bassin integral constraints properties 
     15   USE trdmld         ! ocean active mixed layer tracers trends  
    2516   USE trdvor         ! ocean vorticity trends  
    26    USE trdicp         ! ocean bassin integral constraints properties 
    27    USE trdmld         ! ocean active mixed layer tracers trends  
    2817   USE in_out_manager ! I/O manager 
    29    USE iom            ! I/O manager library 
    3018   USE lib_mpp        ! MPP library 
    31    USE wrk_nemo       ! Memory allocation 
    3219 
    3320   IMPLICIT NONE 
    3421   PRIVATE 
    3522 
    36    REAL(wp) ::   r2dt          ! time-step, = 2 rdttra except at nit000 (=rdttra) if neuler=0 
    37  
    38    PUBLIC trd_mod              ! called by all dynXX or traXX modules 
    39    PUBLIC trd_mod_init         ! called by opa.F90 module 
     23   PUBLIC   trd_init   ! called by nemogcm.F90 module 
    4024 
    4125   !! * Substitutions 
     
    4933CONTAINS 
    5034 
    51    SUBROUTINE trd_mod( ptrdx, ptrdy, ktrd, ctype, kt ) 
    52       !!--------------------------------------------------------------------- 
    53       !!                  ***  ROUTINE trd_mod  *** 
     35   SUBROUTINE trd_init 
     36      !!---------------------------------------------------------------------- 
     37      !!                  ***  ROUTINE trd_init  *** 
    5438      !!  
    55       !! ** Purpose :   Dispatch all trends computation, e.g. 3D output, integral 
    56       !!                constraints, barotropic vorticity, kinetic enrgy,  
    57       !!                potential energy, and/or mixed layer budget. 
     39      !! ** Purpose :   Initialization of trend diagnostics 
    5840      !!---------------------------------------------------------------------- 
    59       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend  
    60       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend 
    61       INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index 
    62       CHARACTER(len=3)          , INTENT(in   ) ::   ctype   ! momentum or tracers trends type 'DYN'/'TRA' 
    63       INTEGER                   , INTENT(in   ) ::   kt      ! time step 
    64       !! 
    65       INTEGER ::   ji, jj   ! dummy loop indices 
    66       REAL(wp), POINTER, DIMENSION(:,:) ::   ztswu, ztswv    ! 2D workspace  
    67       !!---------------------------------------------------------------------- 
    68  
    69       CALL wrk_alloc( jpi, jpj, ztswu, ztswv ) 
    70  
    71       IF( neuler == 0 .AND. kt == nit000    ) THEN   ;   r2dt =      rdt      ! = rdtra (restart with Euler time stepping) 
    72       ELSEIF(               kt <= nit000 + 1) THEN   ;   r2dt = 2. * rdt      ! = 2 rdttra (leapfrog) 
    73       ENDIF 
    74  
    75       !                                            !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    76       IF( ln_3D_trd_d .OR. ln_3D_trd_t ) THEN      !   3D output of momentum and/or tracers trends using IOM interface 
    77          !                                         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    78          CALL trd_3Diom ( ptrdx, ptrdy, ktrd, ctype, kt ) 
    79          ! 
    80       ENDIF 
    81          !                                         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    82       IF( ln_glo_trd ) THEN                        ! I. Integral Constraints Properties for momentum and/or tracers trends 
    83          !                                         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    84          CALL trd_budget( ptrdx, ptrdy, ktrd, ctype, kt ) 
    85          ! 
    86       ENDIF 
    87  
    88       !                                            !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    89       IF( lk_trdvor .AND. ctype == 'DYN' ) THEN    ! II. Vorticity trends 
    90          !                                         !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    91          SELECT CASE( ktrd )  
    92          CASE( jpdyn_trd_hpg )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_prg )   ! Hydrostatique Pressure Gradient  
    93          CASE( jpdyn_trd_keg )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_keg )   ! KE Gradient  
    94          CASE( jpdyn_trd_rvo )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_rvo )   ! Relative Vorticity  
    95          CASE( jpdyn_trd_pvo )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_pvo )   ! Planetary Vorticity Term  
    96          CASE( jpdyn_trd_ldf )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_ldf )   ! Horizontal Diffusion  
    97          CASE( jpdyn_trd_zad )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_zad )   ! Vertical Advection  
    98          CASE( jpdyn_trd_spg )   ;   CALL trd_vor_zint( ptrdx, ptrdy, jpvor_spg )   ! Surface Pressure Grad.  
    99          CASE( jpdyn_trd_zdf )                                                      ! Vertical Diffusion  
    100             ztswu(:,:) = 0.e0   ;   ztswv(:,:) = 0.e0 
    101             DO jj = 2, jpjm1                                                             ! wind stress trends 
    102                DO ji = fs_2, fs_jpim1   ! vector opt. 
    103                   ztswu(ji,jj) = 0.5 * ( utau_b(ji,jj) + utau(ji,jj) ) / ( fse3u(ji,jj,1) * rau0 ) 
    104                   ztswv(ji,jj) = 0.5 * ( vtau_b(ji,jj) + vtau(ji,jj) ) / ( fse3v(ji,jj,1) * rau0 ) 
    105                END DO 
    106             END DO 
    107             ! 
    108             CALL trd_vor_zint( ptrdx, ptrdy, jpvor_zdf )                             ! zdf trend including surf./bot. stresses  
    109             CALL trd_vor_zint( ztswu, ztswv, jpvor_swf )                             ! surface wind stress  
    110          CASE ( jpdyn_trd_bfr ) 
    111             CALL trd_vor_zint( ptrdx, ptrdy, jpvor_bfr )                             ! Bottom stress 
    112          END SELECT 
    113          ! 
    114       ENDIF 
    115  
    116       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    117       ! III. Mixed layer trends for active tracers 
    118       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    119  
    120       IF( lk_trdmld .AND. ctype == 'TRA' )   THEN    
    121          !----------------------------------------------------------------------------------------------- 
    122          ! W.A.R.N.I.N.G : 
    123          ! jptra_trd_ldf : called by traldf.F90 
    124          !                 at this stage we store: 
    125          !                  - the lateral geopotential diffusion (here, lateral = horizontal) 
    126          !                  - and the iso-neutral diffusion if activated  
    127          ! jptra_trd_zdf : called by trazdf.F90 
    128          !                 * in case of iso-neutral diffusion we store the vertical diffusion component in the  
    129          !                   lateral trend including the K_z contrib, which will be removed later (see trd_mld) 
    130          !----------------------------------------------------------------------------------------------- 
    131  
    132          SELECT CASE ( ktrd ) 
    133          CASE ( jptra_trd_xad )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_xad, '3D' )   ! zonal    advection 
    134          CASE ( jptra_trd_yad )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_yad, '3D' )   ! merid.   advection 
    135          CASE ( jptra_trd_zad )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_zad, '3D' )   ! vertical advection 
    136          CASE ( jptra_trd_ldf )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_ldf, '3D' )   ! lateral  diffusion 
    137          CASE ( jptra_trd_bbl )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_bbl, '3D' )   ! bottom boundary layer 
    138          CASE ( jptra_trd_zdf ) 
    139             IF( ln_traldf_iso ) THEN   ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_ldf, '3D' )   ! lateral  diffusion (K_z) 
    140             ELSE                       ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_zdf, '3D' )   ! vertical diffusion (K_z) 
    141             ENDIF 
    142          CASE ( jptra_trd_dmp )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_dmp, '3D' )   ! internal 3D restoring (tradmp) 
    143          CASE ( jptra_trd_qsr )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_for, '3D' )   ! air-sea : penetrative sol radiat 
    144          CASE ( jptra_trd_nsr ) 
    145             ptrdx(:,:,2:jpk) = 0._wp   ;   ptrdy(:,:,2:jpk) = 0._wp 
    146             CALL trd_mld_zint( ptrdx, ptrdy, jpmld_for, '2D' )                                  ! air-sea : non penetr sol radiat 
    147          CASE ( jptra_trd_bbc )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_bbc, '3D' )   ! bottom bound cond (geoth flux) 
    148          CASE ( jptra_trd_atf )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_atf, '3D' )   ! asselin numerical 
    149          CASE ( jptra_trd_npc )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_npc, '3D' )   ! non penetr convect adjustment 
    150          END SELECT 
    151          ! 
    152       ENDIF 
    153       ! 
    154       CALL wrk_dealloc( jpi, jpj, ztswu, ztswv ) 
    155       ! 
    156    END SUBROUTINE trd_mod 
    157  
    158  
    159    SUBROUTINE trd_3Diom( ptrdx, ptrdy, ktrd, ctype, kt ) 
    160       !!--------------------------------------------------------------------- 
    161       !!                  ***  ROUTINE trd_3Diom  *** 
    162       !!  
    163       !! ** Purpose :   output 3D trends using IOM 
    164       !!---------------------------------------------------------------------- 
    165       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend  
    166       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend 
    167       INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index 
    168       CHARACTER(len=3)          , INTENT(in   ) ::   ctype   ! momentum or tracers trends type 'DYN'/'TRA' 
    169       INTEGER                   , INTENT(in   ) ::   kt      ! time step 
    170       !! 
    171       INTEGER ::   ji, jj, jk   ! dummy loop indices 
    172       INTEGER ::   ikbu, ikbv   ! local integers 
    173       REAL(wp), POINTER, DIMENSION(:,:)   ::   z2dx, z2dy, ztswu, ztswv   ! 2D workspace  
    174       REAL(wp), POINTER, DIMENSION(:,:,:) ::   z3dx, z3dy                 ! 3D workspace  
    175       !!---------------------------------------------------------------------- 
    176  
    177        IF( lk_trdtra .AND. ctype == 'TRA' ) THEN       ! active tracer trends 
    178          ! 
    179 !!gm Rq: mask the trends already masked in trd_tra, but lbc_lnk should probably be added 
    180          ! 
    181          SELECT CASE( ktrd ) 
    182          CASE( jptra_trd_xad  )   ;   CALL iom_put( "ttrd_xad" , ptrdx )        ! x- horizontal advection 
    183                                       CALL iom_put( "strd_xad" , ptrdy ) 
    184          CASE( jptra_trd_yad  )   ;   CALL iom_put( "ttrd_yad" , ptrdx )        ! y- horizontal advection 
    185                                       CALL iom_put( "strd_yad" , ptrdy ) 
    186          CASE( jptra_trd_zad  )   ;   CALL iom_put( "ttrd_zad" , ptrdx )        ! z- vertical   advection 
    187                                       CALL iom_put( "strd_zad" , ptrdy ) 
    188                                       IF( .NOT.lk_vvl ) THEN                   ! cst volume : adv flux through z=0 surface 
    189                                          z2dx(:,:) = wn(:,:,1) * tsn(:,:,1,jp_tem) / fse3t(:,:,1) 
    190                                          z2dy(:,:) = wn(:,:,1) * tsn(:,:,1,jp_sal) / fse3t(:,:,1) 
    191                                          CALL iom_put( "ttrd_sad", z2dx ) 
    192                                          CALL iom_put( "strd_sad", z2dy ) 
    193                                       ENDIF 
    194          CASE( jptra_trd_ldf  )   ;   CALL iom_put( "ttrd_ldf" , ptrdx )        ! lateral diffusion 
    195                                       CALL iom_put( "strd_ldf" , ptrdy ) 
    196          CASE( jptra_trd_zdf  )   ;   CALL iom_put( "ttrd_zdf" , ptrdx )        ! vertical diffusion (including Kz contribution) 
    197                                       CALL iom_put( "strd_zdf" , ptrdy ) 
    198          CASE( jptra_trd_zdfp )   ;   CALL iom_put( "ttrd_zdfp", ptrdx )        ! PURE vertical diffusion (no isoneutral contribution) 
    199                                       CALL iom_put( "strd_zdfp", ptrdy ) 
    200          CASE( jptra_trd_dmp  )   ;   CALL iom_put( "ttrd_dmp" , ptrdx )        ! internal restoring (damping) 
    201                                       CALL iom_put( "strd_dmp" , ptrdy ) 
    202          CASE( jptra_trd_bbl  )   ;   CALL iom_put( "ttrd_bbl" , ptrdx )        ! bottom boundary layer 
    203                                       CALL iom_put( "strd_bbl" , ptrdy ) 
    204          CASE( jptra_trd_npc  )   ;   CALL iom_put( "ttrd_npc" , ptrdx )        ! static instability mixing 
    205                                       CALL iom_put( "strd_npc" , ptrdy ) 
    206          CASE( jptra_trd_nsr  )   ;   CALL iom_put( "ttrd_qns" , ptrdx )        ! surface forcing + runoff (ln_rnf=T) 
    207                                       CALL iom_put( "strd_cdt" , ptrdy ) 
    208          CASE( jptra_trd_qsr  )   ;   CALL iom_put( "ttrd_qsr" , ptrdx )        ! penetrative solar radiat. (only on temperature) 
    209          CASE( jptra_trd_bbc  )   ;   CALL iom_put( "ttrd_bbc" , ptrdx )        ! geothermal heating   (only on temperature) 
    210          CASE( jptra_trd_atf  )   ;   CALL iom_put( "ttrd_atf" , ptrdx )        ! asselin time Filter 
    211                                       CALL iom_put( "strd_atf" , ptrdy ) 
    212  
    213          END SELECT 
    214       ENDIF 
    215  
    216       IF( lk_trddyn .AND. ctype == 'DYN' ) THEN       ! momentum trends  
    217             ! 
    218          ptrdx(:,:,:) = ptrdx(:,:,:) * umask(:,:,:)                       ! mask the trends 
    219          ptrdy(:,:,:) = ptrdy(:,:,:) * vmask(:,:,:) 
    220 !!gm NB : here a lbc_lnk should probably be added 
    221          ! 
    222          SELECT CASE( ktrd ) 
    223          CASE( jpdyn_trd_hpg )   ;   CALL iom_put( "utrd_hpg", ptrdx )    ! hydrostatic pressure gradient 
    224                                      CALL iom_put( "vtrd_hpg", ptrdy ) 
    225          CASE( jpdyn_trd_spg )   ;   CALL iom_put( "utrd_spg", ptrdx )    ! surface pressure gradient 
    226                                      CALL iom_put( "vtrd_spg", ptrdy ) 
    227          CASE( jpdyn_trd_pvo )   ;   CALL iom_put( "utrd_pvo", ptrdx )    ! planetary vorticity 
    228                                      CALL iom_put( "vtrd_pvo", ptrdy ) 
    229          CASE( jpdyn_trd_rvo )   ;   CALL iom_put( "utrd_rvo", ptrdx )    ! relative  vorticity     (or metric term) 
    230                                      CALL iom_put( "vtrd_rvo", ptrdy ) 
    231          CASE( jpdyn_trd_keg )   ;   CALL iom_put( "utrd_keg", ptrdx )    ! Kinetic Energy gradient (or had) 
    232                                      CALL iom_put( "vtrd_keg", ptrdy ) 
    233             z3dx(:,:,:) = 0._wp                                           ! U.dxU & V.dyV (approximation) 
    234             z3dy(:,:,:) = 0._wp 
    235             DO jk = 1, jpkm1                                                  ! no mask as un,vn are masked 
    236                DO jj = 2, jpjm1 
    237                   DO ji = 2, jpim1 
    238                      z3dx(ji,jj,jk) = un(ji,jj,jk) * ( un(ji+1,jj,jk) - un(ji-1,jj,jk) ) / ( 2._wp * e1u(ji,jj) ) 
    239                      z3dy(ji,jj,jk) = vn(ji,jj,jk) * ( vn(ji,jj+1,jk) - vn(ji,jj-1,jk) ) / ( 2._wp * e2v(ji,jj) ) 
    240                   END DO 
    241                END DO 
    242             END DO 
    243             CALL lbc_lnk( z3dx, 'U', -1. )   ;    CALL lbc_lnk( z3dy, 'V', -1. ) 
    244                                      CALL iom_put( "utrd_udx", z3dx  )  
    245                                      CALL iom_put( "vtrd_vdy", z3dy  ) 
    246          CASE( jpdyn_trd_zad )   ;   CALL iom_put( "utrd_zad", ptrdx )    ! vertical   advection 
    247                                      CALL iom_put( "vtrd_zad", ptrdy ) 
    248          CASE( jpdyn_trd_ldf )   ;   CALL iom_put( "utrd_ldf", ptrdx )    ! lateral diffusion 
    249                                      CALL iom_put( "vtrd_ldf", ptrdy ) 
    250          CASE( jpdyn_trd_zdf )   ;   CALL iom_put( "utrd_zdf", ptrdx )    ! vertical diffusion  
    251                                      CALL iom_put( "vtrd_zdf", ptrdy ) 
    252                                      !                                    ! wind stress trends 
    253                                      z2dx(:,:) = ( utau_b(ji,jj) + utau(ji,jj) ) / ( fse3u(:,:,1) * rau0 ) 
    254                                      z2dy(:,:) = ( vtau_b(ji,jj) + vtau(ji,jj) ) / ( fse3v(:,:,1) * rau0 ) 
    255                                      CALL iom_put( "utrd_tau", z2dx ) 
    256                                      CALL iom_put( "vtrd_tau", z2dy ) 
    257          CASE( jpdyn_trd_bfr ) 
    258             IF( .NOT.ln_bfrimp )     CALL iom_put( "utrd_bfr", ptrdx )    ! bottom friction (explicit case) 
    259             IF( .NOT.ln_bfrimp )     CALL iom_put( "vtrd_bfr", ptrdy ) 
    260 !!gm only valid if ln_bfrimp=T otherwise the bottom stress as to be recomputed.... 
    261  
    262          CASE( jpdyn_trd_atf )   ;   CALL iom_put( "utrd_atf", ptrdx )    ! asselin filter trends  
    263                                      CALL iom_put( "vtrd_atf", ptrdy ) 
    264             IF( ln_bfrimp ) THEN                                          ! bottom friction (implicit case) 
    265                z3dx(:,:,:) = 0._wp   ;   z3dy(:,:,:) = 0._wp                 ! after velocity known (now filed at this stage) 
    266                DO jk = 1, jpkm1 
    267                   DO jj = 2, jpjm1 
    268                      DO ji = 2, jpim1 
    269                         ikbu = mbku(ji,jj)          ! deepest ocean u- & v-levels 
    270                         ikbv = mbkv(ji,jj) 
    271                         z3dx(ji,jj,jk) = bfrua(ji,jj) * un(ji,jj,ikbu) / fse3u(ji,jj,ikbu) 
    272                         z3dy(ji,jj,jk) = bfrva(ji,jj) * vn(ji,jj,ikbv) / fse3v(ji,jj,ikbv) 
    273                      END DO 
    274                   END DO 
    275                END DO 
    276                                      CALL iom_put( "utrd_bfr", z3dx )    ! bottom friction (implicit) 
    277                                      CALL iom_put( "vtrd_bfr", z3dy ) 
    278             ENDIF 
    279             ! 
    280          END SELECT 
    281          ! 
    282       ENDIF 
    283       ! 
    284       CALL wrk_dealloc( jpi, jpj     , z2dx, z2dy, ztswu, ztswv ) 
    285       CALL wrk_dealloc( jpi, jpj, jpk, z3dx, z3dy ) 
    286       ! 
    287    END SUBROUTINE trd_3Diom 
    288  
    289 #else 
    290    !!---------------------------------------------------------------------- 
    291    !!   Default case :           Empty module          No trend diagnostics 
    292    !!---------------------------------------------------------------------- 
    293 CONTAINS 
    294    SUBROUTINE trd_mod( ptrdx, ptrdy, ktrd, ctype, kt )   ! Empty routine 
    295       REAL ::   ptrdx(:,:,:), ptrdy(:,:,:) 
    296       INTEGER  ::   ktrd, kt                             
    297       CHARACTER(len=3) ::  ctype                   
    298       WRITE(*,*) 'trd_mod: You should not have seen this print! error ?',   & 
    299          &       ptrdx(1,1,1), ptrdy(1,1,1), ktrd, ctype, kt 
    300    END SUBROUTINE trd_mod 
    301 #endif 
    302  
    303    SUBROUTINE trd_mod_init 
    304       !!---------------------------------------------------------------------- 
    305       !!                  ***  ROUTINE trd_mod_init  *** 
    306       !!  
    307       !! ** Purpose :   Initialization of activated trends 
    308       !!---------------------------------------------------------------------- 
    309       USE in_out_manager          ! I/O manager 
    310  
    311       NAMELIST/namtrd/ ln_3D_trd_d, ln_KE_trd, ln_vor_trd, ln_ML_trd_d,   & 
    312          &             ln_3D_trd_t, ln_PE_trd, ln_glo_trd, ln_ML_trd_t,   & 
    313          &             nn_trd , cn_trdrst_in , ln_trdmld_restart,         & 
     41      NAMELIST/namtrd/ ln_dyn_trd, ln_KE_trd, ln_vor_trd, ln_dyn_mld,   & 
     42         &             ln_tra_trd, ln_PE_trd, ln_glo_trd, ln_tra_mld,   & 
     43         &             nn_trd , cn_trdrst_in , ln_trdmld_restart,       & 
    31444         &             nn_ctls, cn_trdrst_out, ln_trdmld_instant, rn_ucf 
    31545      !!---------------------------------------------------------------------- 
    31646 
    317       IF( l_trdtra .OR. l_trddyn )   THEN 
    318          REWIND( numnam ) 
    319          READ  ( numnam, namtrd )      ! namelist namtrd : trends diagnostic 
     47      REWIND( numnam ) 
     48      READ  ( numnam, namtrd )      ! namelist namtrd : trends diagnostic 
    32049 
    321          IF(lwp) THEN 
    322             WRITE(numout,*) 
    323             WRITE(numout,*) ' trd_mod_init : Momentum/Tracers trends' 
    324             WRITE(numout,*) ' ~~~~~~~~~~~~~' 
    325             WRITE(numout,*) '   Namelist namtrd : set trends parameters' 
    326             WRITE(numout,*) '      U & V trends: 3D output                 ln_3D_trd_d        = ', ln_3D_trd_d 
    327             WRITE(numout,*) '      T & S trends: 3D output                 ln_3D_trd_t        = ', ln_3D_trd_t 
    328             WRITE(numout,*) '      Kinetic   Energy trends                 ln_KE_trd          = ', ln_KE_trd 
    329             WRITE(numout,*) '      Potential Energy trends                 ln_PE_trd          = ', ln_PE_trd 
    330             WRITE(numout,*) '      Barotropic vorticity trends             ln_vor_trd         = ', ln_vor_trd 
    331             WRITE(numout,*) '      check domain averaged dyn & tra trends  ln_glo_trd         = ', ln_glo_trd 
    332             WRITE(numout,*) '      U & V trends: Mixed Layer averaged      ln_ML_trd_d        = ', ln_3D_trd_d 
    333             WRITE(numout,*) '      T & S trends: Mixed Layer averaged      ln_ML_trd_t        = ', ln_3D_trd_t 
    334      ! 
    335             WRITE(numout,*) '      frequency of trends diagnostics (glo)   nn_trd             = ', nn_trd 
    336             WRITE(numout,*) '      control surface type            (mld)   nn_ctls            = ', nn_ctls 
    337             WRITE(numout,*) '      restart for ML diagnostics              ln_trdmld_restart  = ', ln_trdmld_restart 
    338             WRITE(numout,*) '      instantaneous or mean ML T/S            ln_trdmld_instant  = ', ln_trdmld_instant 
    339             WRITE(numout,*) '      unit conversion factor                  rn_ucf             = ', rn_ucf 
    340         ENDIF 
     50      IF(lwp) THEN                  ! control print 
     51         WRITE(numout,*) 
     52         WRITE(numout,*) ' trd_init : Momentum/Tracers trends' 
     53         WRITE(numout,*) ' ~~~~~~~~~~' 
     54         WRITE(numout,*) '   Namelist namtrd : set trends parameters' 
     55         WRITE(numout,*) '      global domain averaged dyn & tra trends        ln_glo_trd  = ', ln_glo_trd 
     56         WRITE(numout,*) '      U & V trends: 3D output                        ln_dyn_trd  = ', ln_dyn_trd 
     57         WRITE(numout,*) '      U & V trends: Mixed Layer averaged             ln_dyn_mld  = ', ln_dyn_mld 
     58         WRITE(numout,*) '      T & S trends: 3D output                        ln_tra_trd  = ', ln_tra_trd 
     59         WRITE(numout,*) '      T & S trends: Mixed Layer averaged             ln_tra_mld  = ', ln_tra_mld 
     60         WRITE(numout,*) '      Kinetic   Energy trends                        ln_KE_trd   = ', ln_KE_trd 
     61         WRITE(numout,*) '      Potential Energy trends                        ln_PE_trd   = ', ln_PE_trd 
     62         WRITE(numout,*) '      Barotropic vorticity trends                    ln_vor_trd  = ', ln_vor_trd 
     63         ! 
     64         WRITE(numout,*) '      frequency of trends diagnostics (glo)   nn_trd             = ', nn_trd 
     65         WRITE(numout,*) '      control surface type            (mld)   nn_ctls            = ', nn_ctls 
     66         WRITE(numout,*) '      restart for ML diagnostics              ln_trdmld_restart  = ', ln_trdmld_restart 
     67         WRITE(numout,*) '      instantaneous or mean ML T/S            ln_trdmld_instant  = ', ln_trdmld_instant 
     68         WRITE(numout,*) '      unit conversion factor                  rn_ucf             = ', rn_ucf 
    34169      ENDIF 
    34270      ! 
    343       IF( ln_KE_trd .OR. ln_PE_trd .OR. ln_ML_trd_d )   & 
     71      !                             ! trend extraction flags   
     72      l_trdtra = .FALSE.                                                       ! tracers   
     73      IF ( ln_tra_trd .OR. ln_PE_trd .OR. ln_tra_mld .OR.   & 
     74         & ln_glo_trd                                       )   l_trdtra = .TRUE.  
     75      ! 
     76      l_trddyn = .FALSE.                                                       ! momentum 
     77      IF ( ln_dyn_trd .OR. ln_KE_trd .OR. ln_dyn_mld .OR.   & 
     78         & ln_vor_trd .OR. ln_glo_trd                       )   l_trddyn = .TRUE. 
     79      ! 
     80       
     81      IF( ln_KE_trd .OR. ln_PE_trd .OR. ln_dyn_mld )   & 
    34482         CALL ctl_stop( 'KE, PE, aur ML on momentum are not yet coded we stop' ) 
     83 
     84      ! 
     85      IF( ln_glo_trd )    CALL trd_glo_init       ! integral constraints trends 
     86      IF( ln_tra_mld )    CALL trd_mld_init       ! mixed-layer trends (active  tracers)   
     87      IF( ln_vor_trd )    CALL trd_vor_init       ! vorticity trends         
     88      ! 
    34589!!gm  : Potential BUG : 3D output only for vector invariant form!  add a ctl_stop or code the flux form case 
    34690!!gm  : bug/pb for vertical advection of tracer in vvl case: add T.dt[eta] in the output...  
    34791      ! 
    348       IF( lk_trddyn .OR. lk_trdtra )    CALL trd_icp_init       ! integral constraints trends 
    349       IF( lk_trdmld                )    CALL trd_mld_init       ! mixed-layer trends (active  tracers)   
    350       IF( lk_trdvor                )    CALL trd_vor_init       ! vorticity trends         
    35192      ! 
    352    END SUBROUTINE trd_mod_init 
     93   END SUBROUTINE trd_init 
    35394 
    35495   !!====================================================================== 
    355 END MODULE trdmod 
     96END MODULE trdini 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdmld.F90

    r3294 r3318  
    1111   !!                 !  05-05  (C. Deltel)     Diagnose trends of time averaged ML T & S 
    1212   !!---------------------------------------------------------------------- 
    13 #if   defined key_trdmld   ||   defined key_esopa 
    14    !!---------------------------------------------------------------------- 
    15    !!   'key_trdmld'                          mixed layer trend diagnostics 
     13 
    1614   !!---------------------------------------------------------------------- 
    1715   !!   trd_mld          : T and S cumulated trends averaged over the mixed layer 
     
    2119   USE oce             ! ocean dynamics and tracers variables 
    2220   USE dom_oce         ! ocean space and time domain variables 
    23    USE trdmod_oce      ! ocean variables trends 
     21   USE trd_oce         ! trends: ocean variables 
    2422   USE trdmld_oce      ! ocean variables trends 
    2523   USE ldftra_oce      ! ocean active tracers lateral physics 
     
    9492      !!            surface and the control surface is called "mixed-layer" 
    9593      !!---------------------------------------------------------------------- 
    96       ! 
    9794      INTEGER                         , INTENT( in ) ::   ktrd       ! ocean trend index 
    9895      CHARACTER(len=2)                , INTENT( in ) ::   ctype      ! 2D surface/bottom or 3D interior physics 
     
    112109      IF( icount == 1 ) THEN         
    113110         ! 
    114          tmltrd(:,:,:) = 0.e0    ;    smltrd(:,:,:) = 0.e0    ! <<< reset trend arrays to zero 
     111         tmltrd(:,:,:) = 0._wp    ;    smltrd(:,:,:) = 0._wp    ! <<< reset trend arrays to zero 
    115112          
    116113         ! ... Set nmld(ji,jj) = index of first T point below control surf. or outside mixed-layer 
    117114         IF( nn_ctls == 0 ) THEN       ! * control surface = mixed-layer with density criterion  
    118115            nmld(:,:) = nmln(:,:)    ! array nmln computed in zdfmxl.F90 
    119          ELSE IF( nn_ctls == 1 ) THEN  ! * control surface = read index from file  
     116         ELSEIF( nn_ctls == 1 ) THEN   ! * control surface = read index from file  
    120117            nmld(:,:) = nbol(:,:) 
    121          ELSE IF( nn_ctls >= 2 ) THEN  ! * control surface = model level 
     118         ELSEIF( nn_ctls >= 2 ) THEN   ! * control surface = model level 
    122119            nn_ctls = MIN( nn_ctls, jpktrd - 1 ) 
    123120            nmld(:,:) = nn_ctls + 1 
     
    129126            ! Check of validity : nmld(ji,jj) <= jpktrd 
    130127            isum        = 0 
    131             zvlmsk(:,:) = 0.e0 
     128            zvlmsk(:,:) = 0._wp 
    132129 
    133130            IF( jpktrd < jpk ) THEN  
     
    138135                     ELSE 
    139136                        isum = isum + 1 
    140                         zvlmsk(ji,jj) = 0. 
     137                        zvlmsk(ji,jj) = 0._wp 
    141138                     ENDIF 
    142139                  END DO 
     
    157154          
    158155         ! ... Weights for vertical averaging 
    159          wkx(:,:,:) = 0.e0 
     156         wkx(:,:,:) = 0._wp 
    160157         DO jk = 1, jpktrd             ! initialize wkx with vertical scale factor in mixed-layer 
    161158            DO jj = 1,jpj 
     
    166163         END DO 
    167164          
    168          rmld(:,:) = 0.e0                ! compute mixed-layer depth : rmld 
     165         rmld(:,:) = 0._wp               ! compute mixed-layer depth : rmld 
    169166         DO jk = 1, jpktrd 
    170167            rmld(:,:) = rmld(:,:) + wkx(:,:,jk) 
     
    172169          
    173170         DO jk = 1, jpktrd             ! compute integration weights 
    174             wkx(:,:,jk) = wkx(:,:,jk) / MAX( 1., rmld(:,:) ) 
     171            wkx(:,:,jk) = wkx(:,:,jk) / MAX( 1._wp, rmld(:,:) ) 
    175172         END DO 
    176173 
     
    241238      !!       In IV), the appropriate trends are written in the trends NetCDF file. 
    242239      !! 
    243       !! References : 
    244       !!       - Vialard & al. 
    245       !!       - See NEMO documentation (in preparation) 
    246       !!---------------------------------------------------------------------- 
    247       ! 
     240      !! References :  Vialard et al.,2001, JPO. 
     241      !!---------------------------------------------------------------------- 
    248242      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
    249243      ! 
     
    761755      ! ------------------------------------------------- 
    762756 
    763       IF( ( lk_trdmld ) .AND. ( MOD( nitend, nn_trd ) /= 0 ) ) THEN 
     757      IF( MOD( nitend, nn_trd ) /= 0 ) THEN 
    764758         WRITE(numout,cform_err) 
    765759         WRITE(numout,*) '                Your nitend parameter, nitend = ', nitend 
     
    774768      END IF 
    775769 
    776       IF( ( lk_trdmld ) .AND. ( nn_cla == 1 ) ) THEN 
    777          WRITE(numout,cform_war) 
    778          WRITE(numout,*) '                You set n_cla = 1. Note that the Mixed-Layer diagnostics  ' 
    779          WRITE(numout,*) '                are not exact along the corresponding straits.            ' 
    780          nwarn = nwarn + 1 
    781       END IF 
     770      IF( nn_cla == 1 )   CALL ctl_warn( '      You set n_cla = 1. Note that the Mixed-Layer diagnostics  ',   & 
     771         &                               '      are not exact along the corresponding straits.            ') 
    782772 
    783773      !                                   ! allocate trdmld arrays 
     
    951941   END SUBROUTINE trd_mld_init 
    952942 
    953 #else 
    954    !!---------------------------------------------------------------------- 
    955    !!   Default option :                                       Empty module 
    956    !!---------------------------------------------------------------------- 
    957 CONTAINS 
    958    SUBROUTINE trd_mld( kt )             ! Empty routine 
    959       INTEGER, INTENT( in) ::   kt 
    960       WRITE(*,*) 'trd_mld: You should not have seen this print! error?', kt 
    961    END SUBROUTINE trd_mld 
    962    SUBROUTINE trd_mld_zint( pttrdmld, pstrdmld, ktrd, ctype ) 
    963       REAL, DIMENSION(:,:,:), INTENT( in ) ::   & 
    964          pttrdmld, pstrdmld                   ! Temperature and Salinity trends 
    965       INTEGER, INTENT( in ) ::   ktrd         ! ocean trend index 
    966       CHARACTER(len=2), INTENT( in ) ::   &   
    967          ctype                                ! surface/bottom (2D arrays) or 
    968          !                                    ! interior (3D arrays) physics 
    969       WRITE(*,*) 'trd_mld_zint: You should not have seen this print! error?', pttrdmld(1,1,1) 
    970       WRITE(*,*) '  "      "  : You should not have seen this print! error?', pstrdmld(1,1,1) 
    971       WRITE(*,*) '  "      "  : You should not have seen this print! error?', ctype 
    972       WRITE(*,*) '  "      "  : You should not have seen this print! error?', ktrd 
    973    END SUBROUTINE trd_mld_zint 
    974    SUBROUTINE trd_mld_init              ! Empty routine 
    975       WRITE(*,*) 'trd_mld_init: You should not have seen this print! error?' 
    976    END SUBROUTINE trd_mld_init 
    977 #endif 
    978  
    979943   !!====================================================================== 
    980944END MODULE trdmld 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdmld_oce.F90

    r2715 r3318  
    55   !!====================================================================== 
    66   !! History :  1.0  ! 2004-08  (C. Talandier)  New trends organization 
     7   !!            3.5  ! 2012-02  (G. Madec) suppress the trend keys 
    78   !!---------------------------------------------------------------------- 
    89   USE par_oce        ! ocean parameters 
     
    1314   PUBLIC   trdmld_oce_alloc    ! Called in trdmld.F90 
    1415 
    15 #if defined key_trdmld 
    16    LOGICAL, PUBLIC, PARAMETER ::   lk_trdmld = .TRUE.    !: ML trend flag 
    17 #else 
    18    LOGICAL, PUBLIC, PARAMETER ::   lk_trdmld = .FALSE.   !: ML trend flag 
    19 #endif 
    20    !!* mixed layer trends indices 
    21    INTEGER, PARAMETER, PUBLIC ::   jpltrd = 11      !: number of mixed-layer trends arrays 
     16   !                                                !* mixed layer trend indices 
     17   INTEGER, PUBLIC, PARAMETER ::   jpltrd = 11      !: number of mixed-layer trends arrays 
    2218   INTEGER, PUBLIC            ::   jpktrd           !: max level for mixed-layer trends diag. 
    2319   ! 
     
    3531   INTEGER, PUBLIC, PARAMETER ::   jpmld_atf = 11   !:  asselin trend (**MUST BE THE LAST ONE**) 
    3632 
    37 #if   defined  key_trdmld   ||   defined key_esopa 
    38    !!---------------------------------------------------------------------- 
    39    !!   'key_trdmld'                         mixed layer trends diagnostics 
    40    !!---------------------------------------------------------------------- 
    4133 
    4234   !! Arrays used for diagnosing mixed-layer trends  
     
    7971      smltrd_csum_ln,               & !:    ( idem for salinity ) 
    8072      smltrd_csum_ub                  !:  
    81 #endif 
     73 
    8274   !!---------------------------------------------------------------------- 
    8375   !! NEMO/OPA 4.0 , NEMO Consortium (2011) 
     
    10193     ierr(:) = 0 
    10294 
    103 #if   defined  key_trdmld   ||   defined key_esopa 
    10495     ALLOCATE( nmld(jpi,jpj), nbol(jpi,jpj),       & 
    10596        &      wkx(jpi,jpj,jpk), rmld(jpi,jpj),    &  
     
    125116        &      tmltrd_csum_ub(jpi,jpj,jpltrd), smltrd_sum(jpi,jpj,jpltrd),     & 
    126117        &      smltrd_csum_ln(jpi,jpj,jpltrd), smltrd_csum_ub(jpi,jpj,jpltrd), STAT=ierr(5) ) 
    127 #endif 
    128118      ! 
    129119      trdmld_oce_alloc = MAXVAL( ierr ) 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdmld_rst.F90

    r2528 r3318  
    44   !! Ocean dynamic :  Input/Output files for restart on mixed-layer diagnostics 
    55   !!================================================================================= 
    6    !! History :  9.0  ! 05-05 (C. Deltel) Original code 
     6   !! History :  1.0  ! 2005-05 (C. Deltel) Original code 
    77   !!--------------------------------------------------------------------------------- 
    8 #if defined key_trdmld 
     8 
     9   !!--------------------------------------------------------------------------------- 
     10   !!  trd_mld_rst_write : write mixed layer trend restart 
     11   !!  trd_mld_rst_read  : read  mixed layer trend restart 
    912   !!--------------------------------------------------------------------------------- 
    1013   USE dom_oce         ! ocean space and time domain 
    11    USE trdmod_oce      ! ocean variables for trend diagnostics (i.e. icp/mixed-layer/vorticity) 
     14   USE trd_oce         ! trends: ocean variables 
    1215   USE in_out_manager  ! I/O manager 
    1316   USE iom             ! I/O module 
     
    2730   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    2831   !!--------------------------------------------------------------------------------- 
    29    
    3032CONTAINS 
    3133   
     
    9294         CALL iom_rstput( kt, nitrst, nummldw, 'tml_sumb'        , tml_sumb        ) 
    9395         DO jk = 1, jpltrd 
    94             IF( jk < 10 ) THEN   ;   WRITE(charout,FMT="('tmltrd_csum_ub_', I1)") jk 
    95             ELSE                 ;   WRITE(charout,FMT="('tmltrd_csum_ub_', I2)") jk 
     96            IF( jk < 10 ) THEN   ;   WRITE(charout,FMT="('tmltrd_csum_ub_', I1)")   jk 
     97            ELSE                 ;   WRITE(charout,FMT="('tmltrd_csum_ub_', I2)")   jk 
    9698            ENDIF 
    9799            CALL iom_rstput( kt, nitrst, nummldw, charout,  tmltrd_csum_ub(:,:,jk) ) 
     
    103105         CALL iom_rstput( kt, nitrst, nummldw, 'sml_sumb'        , sml_sumb        ) 
    104106         DO jk = 1, jpltrd 
    105             IF( jk < 10 ) THEN   ;   WRITE(charout,FMT="('smltrd_csum_ub_', I1)") jk 
    106             ELSE                 ;   WRITE(charout,FMT="('smltrd_csum_ub_', I2)") jk 
     107            IF( jk < 10 ) THEN   ;   WRITE(charout,FMT="('smltrd_csum_ub_', I1)")   jk 
     108            ELSE                 ;   WRITE(charout,FMT="('smltrd_csum_ub_', I2)")   jk 
    107109            ENDIF 
    108110            CALL iom_rstput( kt, nitrst, nummldw, charout , smltrd_csum_ub(:,:,jk) ) 
     
    116118      ENDIF 
    117119      !  
    118       !     
    119120   END SUBROUTINE trd_mld_rst_write 
    120121 
    121122 
    122123   SUBROUTINE trd_mld_rst_read 
    123     !!---------------------------------------------------------------------------- 
    124     !!                   ***  SUBROUTINE trd_mld_rst_lec  *** 
    125     !!                    
    126     !! ** Purpose :   Read file for mixed-layer diagnostics restart. 
    127     !!---------------------------------------------------------------------------- 
    128     INTEGER  ::  inum       ! temporary logical unit 
    129     ! 
    130     CHARACTER (len=35) :: charout 
    131     INTEGER ::   jk         ! loop indice 
    132     INTEGER ::   jlibalt = jprstlib 
    133     LOGICAL ::   llok 
    134     !!----------------------------------------------------------------------------- 
     124      !!---------------------------------------------------------------------------- 
     125      !!                   ***  SUBROUTINE trd_mld_rst_lec  *** 
     126      !!                    
     127      !! ** Purpose :   Read file for mixed-layer diagnostics restart. 
     128      !!---------------------------------------------------------------------------- 
     129      INTEGER  ::  inum       ! temporary logical unit 
     130      ! 
     131      CHARACTER (len=35) :: charout 
     132      INTEGER ::   jk         ! loop indice 
     133      INTEGER ::   jlibalt = jprstlib 
     134      LOGICAL ::   llok 
     135      !!----------------------------------------------------------------------------- 
    135136 
    136     IF(lwp)  THEN 
    137        WRITE(numout,*) 
    138        WRITE(numout,*) ' trd_mld_rst_read : read the NetCDF MLD restart file' 
    139        WRITE(numout,*) ' ~~~~~~~~~~~~~~~~' 
    140     ENDIF 
    141     IF ( jprstlib == jprstdimg ) THEN 
    142        ! eventually read netcdf file (monobloc)  for restarting on different number of processors 
    143        ! if {cn_trdrst_in}.nc exists, then set jlibalt to jpnf90 
    144        INQUIRE( FILE = TRIM(cn_trdrst_in)//'.nc', EXIST = llok ) 
    145        IF ( llok ) THEN ; jlibalt = jpnf90  ; ELSE ; jlibalt = jprstlib ; ENDIF 
    146     ENDIF 
     137      IF(lwp)  THEN 
     138         WRITE(numout,*) 
     139         WRITE(numout,*) ' trd_mld_rst_read : read the NetCDF MLD restart file' 
     140         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~' 
     141      ENDIF 
     142      IF ( jprstlib == jprstdimg ) THEN 
     143         ! eventually read netcdf file (monobloc)  for restarting on different number of processors 
     144         ! if {cn_trdrst_in}.nc exists, then set jlibalt to jpnf90 
     145         INQUIRE( FILE = TRIM(cn_trdrst_in)//'.nc', EXIST = llok ) 
     146         IF ( llok ) THEN   ;   jlibalt = jpnf90    
     147         ELSE               ;   jlibalt = jprstlib    
     148         ENDIF 
     149      ENDIF 
    147150 
    148     CALL iom_open( cn_trdrst_in, inum, kiolib = jlibalt )  
     151      CALL iom_open( cn_trdrst_in, inum, kiolib = jlibalt )  
    149152 
    150     IF( ln_trdmld_instant ) THEN  
    151        !-- Temperature 
    152        CALL iom_get( inum, jpdom_autoglo, 'tmlbb'           , tmlbb          ) 
    153        CALL iom_get( inum, jpdom_autoglo, 'tmlbn'           , tmlbn          ) 
    154        CALL iom_get( inum, jpdom_autoglo, 'tmlatfb'         , tmlatfb        ) 
    155  
    156        !-- Salinity 
    157        CALL iom_get( inum, jpdom_autoglo, 'smlbb'           , smlbb          ) 
    158        CALL iom_get( inum, jpdom_autoglo, 'smlbn'           , smlbn          ) 
    159        CALL iom_get( inum, jpdom_autoglo, 'smlatfb'         , smlatfb        ) 
    160     ELSE 
    161        CALL iom_get( inum, jpdom_autoglo, 'rmldbn'          , rmldbn         ) ! needed for rmld_sum 
    162  
    163        !-- Temperature 
    164        CALL iom_get( inum, jpdom_autoglo, 'tmlbn'           , tmlbn          ) ! needed for tml_sum 
    165        CALL iom_get( inum, jpdom_autoglo, 'tml_sumb'        , tml_sumb       ) 
    166        DO jk = 1, jpltrd 
    167           IF( jk < 10 )   THEN 
    168              WRITE(charout,FMT="('tmltrd_csum_ub_', I1)") jk 
    169           ELSE 
    170              WRITE(charout,FMT="('tmltrd_csum_ub_', I2)") jk 
    171           ENDIF 
    172           CALL iom_get( inum, jpdom_autoglo, charout, tmltrd_csum_ub(:,:,jk) ) 
    173        ENDDO 
    174        CALL iom_get( inum, jpdom_autoglo, 'tmltrd_atf_sumb' , tmltrd_atf_sumb) 
    175  
    176        !-- Salinity 
    177        CALL iom_get( inum, jpdom_autoglo, 'smlbn'           , smlbn          ) ! needed for sml_sum 
    178        CALL iom_get( inum, jpdom_autoglo, 'sml_sumb'        , sml_sumb       ) 
    179        DO jk = 1, jpltrd 
    180           IF( jk < 10 )   THEN 
    181              WRITE(charout,FMT="('smltrd_csum_ub_', I1)") jk 
    182           ELSE 
    183              WRITE(charout,FMT="('smltrd_csum_ub_', I2)") jk 
    184           ENDIF 
    185           CALL iom_get( inum, jpdom_autoglo, charout, smltrd_csum_ub(:,:,jk) ) 
    186        ENDDO 
    187        CALL iom_get( inum, jpdom_autoglo, 'smltrd_atf_sumb' , smltrd_atf_sumb) 
    188  
    189        CALL iom_close( inum ) 
    190     ENDIF 
    191  
    192   END SUBROUTINE trd_mld_rst_read 
     153      IF( ln_trdmld_instant ) THEN  
     154         !-- Temperature 
     155         CALL iom_get( inum, jpdom_autoglo, 'tmlbb'           , tmlbb          ) 
     156         CALL iom_get( inum, jpdom_autoglo, 'tmlbn'           , tmlbn          ) 
     157         CALL iom_get( inum, jpdom_autoglo, 'tmlatfb'         , tmlatfb        ) 
     158         ! 
     159         !-- Salinity 
     160         CALL iom_get( inum, jpdom_autoglo, 'smlbb'           , smlbb          ) 
     161         CALL iom_get( inum, jpdom_autoglo, 'smlbn'           , smlbn          ) 
     162         CALL iom_get( inum, jpdom_autoglo, 'smlatfb'         , smlatfb        ) 
     163      ELSE 
     164         CALL iom_get( inum, jpdom_autoglo, 'rmldbn'          , rmldbn         ) ! needed for rmld_sum 
     165         ! 
     166         !-- Temperature 
     167         CALL iom_get( inum, jpdom_autoglo, 'tmlbn'           , tmlbn          ) ! needed for tml_sum 
     168         CALL iom_get( inum, jpdom_autoglo, 'tml_sumb'        , tml_sumb       ) 
     169         DO jk = 1, jpltrd 
     170            IF( jk < 10 ) THEN   ;   WRITE(charout,FMT="('tmltrd_csum_ub_', I1)")   jk 
     171            ELSE                 ;   WRITE(charout,FMT="('tmltrd_csum_ub_', I2)")   jk 
     172            ENDIF 
     173            CALL iom_get( inum, jpdom_autoglo, charout, tmltrd_csum_ub(:,:,jk) ) 
     174         END DO 
     175         CALL iom_get( inum, jpdom_autoglo, 'tmltrd_atf_sumb' , tmltrd_atf_sumb) 
     176         ! 
     177         !-- Salinity 
     178         CALL iom_get( inum, jpdom_autoglo, 'smlbn'           , smlbn          ) ! needed for sml_sum 
     179         CALL iom_get( inum, jpdom_autoglo, 'sml_sumb'        , sml_sumb       ) 
     180         DO jk = 1, jpltrd 
     181            IF( jk < 10 ) THEN   ;   WRITE(charout,FMT="('smltrd_csum_ub_', I1)")   jk 
     182            ELSE                 ;   WRITE(charout,FMT="('smltrd_csum_ub_', I2)")   jk 
     183            ENDIF 
     184            CALL iom_get( inum, jpdom_autoglo, charout, smltrd_csum_ub(:,:,jk) ) 
     185         END DO 
     186         CALL iom_get( inum, jpdom_autoglo, 'smltrd_atf_sumb' , smltrd_atf_sumb) 
     187         ! 
     188         CALL iom_close( inum ) 
     189      ENDIF 
     190      ! 
     191   END SUBROUTINE trd_mld_rst_read 
    193192   
    194 #else 
    195   !!================================================================================= 
    196   !!                       ***  MODULE  trdmld_rst  *** 
    197   !! Ocean dynamic :  Input/Output files for restart on mixed-layer diagnostics 
    198   !!================================================================================= 
    199 CONTAINS 
    200   SUBROUTINE trd_mld_rst_write( kt )           !  No ML diags ==> empty routine 
    201     WRITE(*,*) 'trd_mld_rst_wri: You should not have seen this print! error?', kt 
    202   END SUBROUTINE trd_mld_rst_write 
    203   SUBROUTINE trd_mld_rst_read                  !  No ML Diags ==> empty routine 
    204   END SUBROUTINE trd_mld_rst_read 
    205 #endif 
    206  
    207193  !!================================================================================= 
    208194END MODULE trdmld_rst 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdtra.F90

    r3317 r3318  
    77   !!            3.5  !  2012-02  (G. Madec) update the comments  
    88   !!---------------------------------------------------------------------- 
    9 #if  defined key_trdtra || defined key_trdmld || defined key_trdmld_trc  
    10    !!---------------------------------------------------------------------- 
    11    !!   trd_tra       : pre-process the tracer trends and calll trd_mod(_trc) 
     9 
     10   !!---------------------------------------------------------------------- 
     11   !!   trd_tra       : pre-process the tracer trends 
    1212   !!   trd_tra_adv   : transform a div(U.T) trend into a U.grad(T) trend 
     13   !!   trd_tra_mng   : tracer trend manager: dispatch to the diagnostic modules 
     14   !!   trd_tra_iom   : output 3D tracer trends using IOM 
    1315   !!---------------------------------------------------------------------- 
    1416   USE oce            ! ocean dynamics and tracers variables 
    1517   USE dom_oce        ! ocean domain  
     18   USE sbc_oce        ! surface boundary condition: ocean 
    1619   USE zdf_oce        ! ocean vertical physics 
     20   USE trd_oce        ! trends: ocean variables 
     21   USE trdmod_trc     ! ocean passive mixed layer tracers trends  
     22   USE trdglo         ! trends:global domain averaged 
     23   USE trdmld         ! ocean active mixed layer tracers trends  
     24   USE ldftra_oce     ! ocean active tracers lateral physics 
    1725   USE zdfddm         ! vertical physics: double diffusion 
    18    USE trdmod_oce     ! ocean active mixed layer tracers trends  
    19    USE trdmod         ! ocean active mixed layer tracers trends  
    20    USE trdmod_trc     ! ocean passive mixed layer tracers trends  
    21    USE ldftra_oce     ! ocean active tracers lateral physics 
     26   USE phycst         ! physical constants 
    2227   USE in_out_manager ! I/O manager 
     28   USE iom            ! I/O manager library 
    2329   USE lib_mpp        ! MPP library 
    2430   USE wrk_nemo       ! Memory allocation 
     
    2834 
    2935   PUBLIC   trd_tra   ! called by all tra_... modules 
    30   
     36 
     37   REAL(wp) ::   r2dt   ! time-step, = 2 rdttra except at nit000 (=rdttra) if neuler=0 
     38 
    3139   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   trdtx, trdty, trdt   ! use to store the temperature trends 
    3240 
     
    6472      !!              call to trd_tra_adv 
    6573      !!              - 'TRA' case : regroup T & S trends 
    66       !!              - send the trends to trd_mod(_trc) for further processing 
     74      !!              - send the trends to trd_tra_mng (trdmod_trc) for further processing 
    6775      !!---------------------------------------------------------------------- 
    6876      INTEGER                         , INTENT(in)           ::   kt      ! time step 
     
    8896         IF( PRESENT( ptra ) ) THEN                       ! advection: transform flux into trend 
    8997            SELECT CASE( ktrd )      
    90             CASE( jptra_trd_xad )   ;   CALL trd_tra_adv( ptrd, pun, ptra, 'X', trdtx )  
    91             CASE( jptra_trd_yad )   ;   CALL trd_tra_adv( ptrd, pun, ptra, 'Y', trdty )  
    92             CASE( jptra_trd_zad )   ;   CALL trd_tra_adv( ptrd, pun, ptra, 'Z', trdt  )  
     98            CASE( jptra_xad )   ;   CALL trd_tra_adv( ptrd, pun, ptra, 'X', trdtx )  
     99            CASE( jptra_yad )   ;   CALL trd_tra_adv( ptrd, pun, ptra, 'Y', trdty )  
     100            CASE( jptra_zad )   ;   CALL trd_tra_adv( ptrd, pun, ptra, 'Z', trdt  )  
    93101            END SELECT 
    94102         ELSE                                             ! other trends: 
    95             trdt(:,:,:) = ptrd(:,:,:) * tmask(:,:,:)                      ! mask & store 
    96             IF( ktrd == jptra_trd_bbc .OR. ktrd == jptra_trd_qsr ) THEN   ! qsr, bbc: on temperature only 
     103            trdt(:,:,:) = ptrd(:,:,:) * tmask(:,:,:)              ! mask & store 
     104            IF( ktrd == jptra_bbc .OR. ktrd == jptra_qsr ) THEN   ! qsr, bbc: on temperature only 
    97105               ztrds(:,:,:) = 0._wp 
    98                CALL trd_mod( trdt, ztrds, ktrd, ctype, kt )                  ! send to trd_mod 
     106               CALL trd_tra_mng( trdt, ztrds, ktrd, kt )               ! send to trd_tra_mng 
    99107            ENDIF 
    100108         ENDIF 
     
    105113         ! 
    106114         IF( PRESENT( ptra ) ) THEN      ! advection: transform the advective flux into a trend 
    107             SELECT CASE( ktrd )          !            and send T & S trends to trd_mod 
    108             CASE( jptra_trd_xad )   ;   CALL trd_tra_adv( ptrd , pun  , ptra, 'X'  , ztrds )  
    109                                         CALL trd_mod    ( trdtx, ztrds, ktrd, ctype, kt    ) 
    110             CASE( jptra_trd_yad )   ;   CALL trd_tra_adv( ptrd , pun  , ptra, 'Y'  , ztrds )  
    111                                     ;   CALL trd_mod    ( trdty, ztrds, ktrd, ctype, kt    ) 
    112             CASE( jptra_trd_zad )   ;   CALL trd_tra_adv( ptrd , pun  , ptra, 'Z'  , ztrds )  
    113                                         CALL trd_mod    ( trdt , ztrds, ktrd, ctype, kt    ) 
     115            SELECT CASE( ktrd )          !            and send T & S trends to trd_tra_mng 
     116            CASE( jptra_xad )   ;   CALL trd_tra_adv( ptrd , pun  , ptra, 'X'  , ztrds )  
     117                                    CALL trd_tra_mng( trdtx, ztrds, ktrd, kt   ) 
     118            CASE( jptra_yad )   ;   CALL trd_tra_adv( ptrd , pun  , ptra, 'Y'  , ztrds )  
     119                                ;   CALL trd_tra_mng( trdty, ztrds, ktrd, kt   ) 
     120            CASE( jptra_zad )   ;   CALL trd_tra_adv( ptrd , pun  , ptra, 'Z'  , ztrds )  
     121                                    CALL trd_tra_mng( trdt , ztrds, ktrd, kt   ) 
    114122            END SELECT 
    115          ELSE                            ! other trends: mask and send T & S trends to trd_mod 
     123         ELSE                            ! other trends: mask and send T & S trends to trd_tra_mng 
    116124            ztrds(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) 
    117             CALL trd_mod( trdt, ztrds, ktrd, ctype, kt )   
     125            CALL trd_tra_mng( trdt, ztrds, ktrd, kt )   
    118126         ENDIF 
    119127         ! 
    120          IF( ktrd == jptra_trd_zdfp ) THEN     ! diagnose the "PURE" Kz trend (here: just before the swap) 
     128         IF( ktrd == jptra_zdfp ) THEN     ! diagnose the "PURE" Kz trend (here: just before the swap) 
    121129            ! 
    122             IF( ln_traldf_iso ) THEN      ! iso-neutral diffusion only otherwise jptra_trd_zdf is "PURE" 
     130            IF( ln_traldf_iso ) THEN      ! iso-neutral diffusion only otherwise jptra_zdf is "PURE" 
    123131               ! 
    124132               CALL wrk_alloc( jpi, jpj, jpk, zwt, zws, ztrdt ) 
     
    136144                  ztrds(:,:,jk) = ( zws(:,:,jk) - zws(:,:,jk+1) ) / fse3t(:,:,jk)  
    137145               END DO 
    138                CALL trd_mod( ztrdt, ztrds, jptra_trd_zdfp, ctype, kt )   
     146               CALL trd_tra_mng( ztrdt, ztrds, jptra_zdfp, kt )   
    139147               ! 
    140148               CALL wrk_dealloc( jpi, jpj, jpk, zwt, zws, ztrdt ) 
     
    147155      IF( ctype == 'TRC' ) THEN                           !==  passive tracer trend  ==! 
    148156         ! 
    149          IF( PRESENT( ptra ) ) THEN                          ! advection: transform flux into a trend 
     157         IF( PRESENT( ptra ) ) THEN                          ! advection: transform flux into a masked trend 
    150158            SELECT CASE( ktrd ) 
    151             CASE( jptra_trd_xad )   ;   CALL trd_tra_adv( ptrd , pun , ptra, 'X', ztrds )  
    152             CASE( jptra_trd_yad )   ;   CALL trd_tra_adv( ptrd , pun , ptra, 'Y', ztrds )  
    153             CASE( jptra_trd_zad )   ;   CALL trd_tra_adv( ptrd , pun , ptra, 'Z', ztrds )  
     159            CASE( jptra_xad )   ;   CALL trd_tra_adv( ptrd , pun , ptra, 'X', ztrds )  
     160            CASE( jptra_yad )   ;   CALL trd_tra_adv( ptrd , pun , ptra, 'Y', ztrds )  
     161            CASE( jptra_zad )   ;   CALL trd_tra_adv( ptrd , pun , ptra, 'Z', ztrds )  
    154162            END SELECT 
    155          ELSE                                                ! other trends: mask 
     163         ELSE                                                ! other trends: masked trend 
    156164            ztrds(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) 
    157165         END IF 
     
    211219   END SUBROUTINE trd_tra_adv 
    212220 
    213 #else 
    214    !!---------------------------------------------------------------------- 
    215    !!   Default case :          Dummy module           No trend diagnostics 
    216    !!---------------------------------------------------------------------- 
    217    USE par_oce      ! ocean variables trends 
    218 CONTAINS 
    219    SUBROUTINE trd_tra( kt, ctype, ktra, ktrd, ptrd, pu, ptra ) 
    220       !!---------------------------------------------------------------------- 
    221       CHARACTER(len=3)                , INTENT(in)           ::  ctype    
    222       INTEGER                         , INTENT(in)           ::  kt, ktra, ktrd 
    223       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in)           ::  ptrd     
    224       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL ::  pu, ptra    ! Tracer variable  
    225       WRITE(*,*) 'trd_tra: You should not have seen this print! error ?',   & 
    226          &   ptrd(1,1,1), ptra(1,1,1), pu(1,1,1), ktrd, ktra, ctype, kt 
    227    END SUBROUTINE trd_tra 
    228 #endif 
     221 
     222   SUBROUTINE trd_tra_mng( ptrdx, ptrdy, ktrd, kt ) 
     223      !!--------------------------------------------------------------------- 
     224      !!                  ***  ROUTINE trd_tra_mng  *** 
     225      !!  
     226      !! ** Purpose :   Dispatch all trends computation, e.g. 3D output, integral 
     227      !!                constraints, barotropic vorticity, kinetic enrgy,  
     228      !!                potential energy, and/or mixed layer budget. 
     229      !!---------------------------------------------------------------------- 
     230      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend  
     231      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend 
     232      INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index 
     233      INTEGER                   , INTENT(in   ) ::   kt      ! time step 
     234      !!---------------------------------------------------------------------- 
     235 
     236      IF( neuler == 0 .AND. kt == nit000    ) THEN   ;   r2dt =      rdt      ! = rdtra (restart with Euler time stepping) 
     237      ELSEIF(               kt <= nit000 + 1) THEN   ;   r2dt = 2. * rdt      ! = 2 rdttra (leapfrog) 
     238      ENDIF 
     239 
     240      !                   ! 3D output of tracers trends using IOM interface 
     241      IF( ln_tra_trd )   CALL trd_tra_iom ( ptrdx, ptrdy, ktrd, kt ) 
     242 
     243      !                   ! Integral Constraints Properties for tracers trends                                       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     244      IF( ln_glo_trd )   CALL trd_glo( ptrdx, ptrdy, ktrd, 'TRA', kt ) 
     245 
     246      !                   ! Mixed layer trends for active tracers 
     247      IF( ln_tra_mld )   THEN    
     248         !----------------------------------------------------------------------------------------------- 
     249         ! W.A.R.N.I.N.G : 
     250         ! jptra_ldf : called by traldf.F90 
     251         !                 at this stage we store: 
     252         !                  - the lateral geopotential diffusion (here, lateral = horizontal) 
     253         !                  - and the iso-neutral diffusion if activated  
     254         ! jptra_zdf : called by trazdf.F90 
     255         !                 * in case of iso-neutral diffusion we store the vertical diffusion component in the  
     256         !                   lateral trend including the K_z contrib, which will be removed later (see trd_mld) 
     257         !----------------------------------------------------------------------------------------------- 
     258 
     259         SELECT CASE ( ktrd ) 
     260         CASE ( jptra_xad )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_xad, '3D' )   ! zonal    advection 
     261         CASE ( jptra_yad )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_yad, '3D' )   ! merid.   advection 
     262         CASE ( jptra_zad )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_zad, '3D' )   ! vertical advection 
     263         CASE ( jptra_ldf )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_ldf, '3D' )   ! lateral  diffusion 
     264         CASE ( jptra_bbl )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_bbl, '3D' )   ! bottom boundary layer 
     265         CASE ( jptra_zdf ) 
     266            IF( ln_traldf_iso ) THEN ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_ldf, '3D' )   ! lateral  diffusion (K_z) 
     267            ELSE                   ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_zdf, '3D' )   ! vertical diffusion (K_z) 
     268            ENDIF 
     269         CASE ( jptra_dmp )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_dmp, '3D' )   ! internal 3D restoring (tradmp) 
     270         CASE ( jptra_qsr )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_for, '3D' )   ! air-sea : penetrative sol radiat 
     271         CASE ( jptra_nsr )        ;   ptrdx(:,:,2:jpk) = 0._wp   ;   ptrdy(:,:,2:jpk) = 0._wp 
     272                                   ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_for, '2D' )   ! air-sea : non penetr sol radiation 
     273         CASE ( jptra_bbc )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_bbc, '3D' )   ! bottom bound cond (geoth flux) 
     274         CASE ( jptra_npc )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_npc, '3D' )   ! non penetr convect adjustment 
     275         CASE ( jptra_atf )        ;   CALL trd_mld_zint( ptrdx, ptrdy, jpmld_atf, '3D' )   ! asselin time filter (last trend) 
     276                                   ! 
     277                                       CALL trd_mld( kt )                                   ! trends: Mixed-layer (output) 
     278         END SELECT 
     279         ! 
     280      ENDIF 
     281      ! 
     282   END SUBROUTINE trd_tra_mng 
     283 
     284 
     285   SUBROUTINE trd_tra_iom( ptrdx, ptrdy, ktrd, kt ) 
     286      !!--------------------------------------------------------------------- 
     287      !!                  ***  ROUTINE trd_tra_iom  *** 
     288      !!  
     289      !! ** Purpose :   output 3D tracer trends using IOM 
     290      !!---------------------------------------------------------------------- 
     291      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend  
     292      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend 
     293      INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index 
     294      INTEGER                   , INTENT(in   ) ::   kt      ! time step 
     295      !! 
     296      INTEGER ::   ji, jj, jk   ! dummy loop indices 
     297      INTEGER ::   ikbu, ikbv   ! local integers 
     298      REAL(wp), POINTER, DIMENSION(:,:)   ::   z2dx, z2dy   ! 2D workspace  
     299      !!---------------------------------------------------------------------- 
     300      ! 
     301      CALL wrk_alloc( jpi, jpj, z2dx, z2dy ) 
     302      ! 
     303!!gm Rq: mask the trends already masked in trd_tra, but lbc_lnk should probably be added 
     304      ! 
     305      SELECT CASE( ktrd ) 
     306      CASE( jptra_xad  )   ;   CALL iom_put( "ttrd_xad" , ptrdx )        ! x- horizontal advection 
     307                                   CALL iom_put( "strd_xad" , ptrdy ) 
     308      CASE( jptra_yad  )   ;   CALL iom_put( "ttrd_yad" , ptrdx )        ! y- horizontal advection 
     309                                   CALL iom_put( "strd_yad" , ptrdy ) 
     310      CASE( jptra_zad  )   ;   CALL iom_put( "ttrd_zad" , ptrdx )        ! z- vertical   advection 
     311                               CALL iom_put( "strd_zad" , ptrdy ) 
     312                               IF( .NOT.lk_vvl ) THEN                   ! cst volume : adv flux through z=0 surface 
     313                                  z2dx(:,:) = wn(:,:,1) * tsn(:,:,1,jp_tem) / fse3t(:,:,1) 
     314                                  z2dy(:,:) = wn(:,:,1) * tsn(:,:,1,jp_sal) / fse3t(:,:,1) 
     315                                  CALL iom_put( "ttrd_sad", z2dx ) 
     316                                  CALL iom_put( "strd_sad", z2dy ) 
     317                               ENDIF 
     318      CASE( jptra_ldf  )   ;   CALL iom_put( "ttrd_ldf" , ptrdx )        ! lateral diffusion 
     319                               CALL iom_put( "strd_ldf" , ptrdy ) 
     320      CASE( jptra_zdf  )   ;   CALL iom_put( "ttrd_zdf" , ptrdx )        ! vertical diffusion (including Kz contribution) 
     321                               CALL iom_put( "strd_zdf" , ptrdy ) 
     322      CASE( jptra_zdfp )   ;   CALL iom_put( "ttrd_zdfp", ptrdx )        ! PURE vertical diffusion (no isoneutral contribution) 
     323                               CALL iom_put( "strd_zdfp", ptrdy ) 
     324      CASE( jptra_dmp  )   ;   CALL iom_put( "ttrd_dmp" , ptrdx )        ! internal restoring (damping) 
     325                               CALL iom_put( "strd_dmp" , ptrdy ) 
     326      CASE( jptra_bbl  )   ;   CALL iom_put( "ttrd_bbl" , ptrdx )        ! bottom boundary layer 
     327                               CALL iom_put( "strd_bbl" , ptrdy ) 
     328      CASE( jptra_npc  )   ;   CALL iom_put( "ttrd_npc" , ptrdx )        ! static instability mixing 
     329                               CALL iom_put( "strd_npc" , ptrdy ) 
     330      CASE( jptra_nsr  )   ;   CALL iom_put( "ttrd_qns" , ptrdx )        ! surface forcing + runoff (ln_rnf=T) 
     331                               CALL iom_put( "strd_cdt" , ptrdy ) 
     332      CASE( jptra_qsr  )   ;   CALL iom_put( "ttrd_qsr" , ptrdx )        ! penetrative solar radiat. (only on temperature) 
     333      CASE( jptra_bbc  )   ;   CALL iom_put( "ttrd_bbc" , ptrdx )        ! geothermal heating   (only on temperature) 
     334      CASE( jptra_atf  )   ;   CALL iom_put( "ttrd_atf" , ptrdx )        ! asselin time Filter 
     335                               CALL iom_put( "strd_atf" , ptrdy ) 
     336      END SELECT 
     337      ! 
     338      CALL wrk_dealloc( jpi, jpj, z2dx, z2dy ) 
     339      ! 
     340   END SUBROUTINE trd_tra_iom 
    229341 
    230342   !!====================================================================== 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdvor.F90

    r3316 r3318  
    88   !!            3.5  !  2012-02  (G. Madec) regroup beta.V computation with pvo trend 
    99   !!---------------------------------------------------------------------- 
    10 #if defined key_trdvor   ||   defined key_esopa 
    11    !!---------------------------------------------------------------------- 
    12    !!   'key_trdvor'   : momentum trend diagnostics 
     10 
    1311   !!---------------------------------------------------------------------- 
    1412   !!   trd_vor      : momentum trends averaged over the depth 
     
    1816   USE oce             ! ocean dynamics and tracers variables 
    1917   USE dom_oce         ! ocean space and time domain variables 
    20    USE trdmod_oce      ! ocean variables trends 
     18   USE trd_oce         ! trends: ocean variables 
    2119   USE zdf_oce         ! ocean vertical physics 
    22    USE in_out_manager  ! I/O manager 
     20   USE sbc_oce         ! surface boundary condition: ocean 
    2321   USE phycst          ! Define parameters for the routines 
    2422   USE ldfdyn_oce      ! ocean active tracers: lateral physics 
    2523   USE dianam          ! build the name of file (routine) 
    2624   USE zdfmxl          ! mixed layer depth 
     25   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
     26   USE in_out_manager  ! I/O manager 
    2727   USE ioipsl          ! NetCDF library 
    28    USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    2928   USE lib_mpp         ! MPP library 
    3029   USE wrk_nemo        ! Memory allocation 
    31  
    3230 
    3331   IMPLICIT NONE 
     
    3836   END INTERFACE 
    3937 
    40    PUBLIC   trd_vor        ! routine called by step.F90 
    41    PUBLIC   trd_vor_zint   ! routine called by dynamics routines 
     38   PUBLIC   trd_vor        ! routine called by trddyn.F90 
    4239   PUBLIC   trd_vor_init   ! routine called by opa.F90 
    4340   PUBLIC   trd_vor_alloc  ! routine called by nemogcm.F90 
     
    8178      IF( trd_vor_alloc /= 0 )   CALL ctl_warn('trd_vor_alloc: failed to allocate arrays') 
    8279   END FUNCTION trd_vor_alloc 
     80 
     81 
     82   SUBROUTINE trd_vor( putrd, pvtrd, ktrd, kt ) 
     83      !!---------------------------------------------------------------------- 
     84      !!                  ***  ROUTINE trd_vor  *** 
     85      !!  
     86      !! ** Purpose :  computation of cumulated trends over analysis period 
     87      !!               and make outputs (NetCDF or DIMG format) 
     88      !!---------------------------------------------------------------------- 
     89      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V trends  
     90      INTEGER                   , INTENT(in   ) ::   ktrd           ! trend index 
     91      INTEGER                   , INTENT(in   ) ::   kt             ! time step 
     92      ! 
     93      INTEGER ::   ji, jj   ! dummy loop indices 
     94      REAL(wp), POINTER, DIMENSION(:,:) ::   ztswu, ztswv    ! 2D workspace  
     95      !!---------------------------------------------------------------------- 
     96 
     97      CALL wrk_alloc( jpi, jpj, ztswu, ztswv ) 
     98 
     99      SELECT CASE( ktrd )  
     100      CASE( jpdyn_hpg )   ;   CALL trd_vor_zint( putrd, pvtrd, jpvor_prg )   ! Hydrostatique Pressure Gradient  
     101      CASE( jpdyn_keg )   ;   CALL trd_vor_zint( putrd, pvtrd, jpvor_keg )   ! KE Gradient  
     102      CASE( jpdyn_rvo )   ;   CALL trd_vor_zint( putrd, pvtrd, jpvor_rvo )   ! Relative Vorticity  
     103      CASE( jpdyn_pvo )   ;   CALL trd_vor_zint( putrd, pvtrd, jpvor_pvo )   ! Planetary Vorticity Term  
     104      CASE( jpdyn_ldf )   ;   CALL trd_vor_zint( putrd, pvtrd, jpvor_ldf )   ! Horizontal Diffusion  
     105      CASE( jpdyn_zad )   ;   CALL trd_vor_zint( putrd, pvtrd, jpvor_zad )   ! Vertical Advection  
     106      CASE( jpdyn_spg )   ;   CALL trd_vor_zint( putrd, pvtrd, jpvor_spg )   ! Surface Pressure Grad.  
     107      CASE( jpdyn_zdf )                                                      ! Vertical Diffusion  
     108         ztswu(:,:) = 0.e0   ;   ztswv(:,:) = 0.e0 
     109         DO jj = 2, jpjm1                                                             ! wind stress trends 
     110            DO ji = fs_2, fs_jpim1   ! vector opt. 
     111               ztswu(ji,jj) = 0.5 * ( utau_b(ji,jj) + utau(ji,jj) ) / ( fse3u(ji,jj,1) * rau0 ) 
     112               ztswv(ji,jj) = 0.5 * ( vtau_b(ji,jj) + vtau(ji,jj) ) / ( fse3v(ji,jj,1) * rau0 ) 
     113            END DO 
     114         END DO 
     115         ! 
     116         CALL trd_vor_zint( putrd, pvtrd, jpvor_zdf )                             ! zdf trend including surf./bot. stresses  
     117         CALL trd_vor_zint( ztswu, ztswv, jpvor_swf )                             ! surface wind stress  
     118      CASE ( jpdyn_bfr ) 
     119         CALL trd_vor_zint( putrd, pvtrd, jpvor_bfr )                             ! Bottom stress 
     120         ! 
     121      CASE( jpdyn_atf )       ! last trends: perform the output of 2D vorticity trends 
     122         CALL trd_vor_iom( kt ) 
     123      END SELECT 
     124      ! 
     125      CALL wrk_dealloc( jpi, jpj, ztswu, ztswv ) 
     126      ! 
     127   END SUBROUTINE trd_vor 
    83128 
    84129 
     
    268313 
    269314 
    270    SUBROUTINE trd_vor( kt ) 
     315   SUBROUTINE trd_vor_iom( kt ) 
    271316      !!---------------------------------------------------------------------- 
    272317      !!                  ***  ROUTINE trd_vor  *** 
     
    275320      !!               and make outputs (NetCDF or DIMG format) 
    276321      !!---------------------------------------------------------------------- 
    277       ! 
    278       INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
     322      INTEGER                   , INTENT(in   ) ::   kt             ! time step 
    279323      ! 
    280324      INTEGER  ::   ji, jj, jk, jl   ! dummy loop indices 
     
    453497      CALL wrk_dealloc( jpi, jpj, zun, zvn )                                    
    454498      ! 
    455    END SUBROUTINE trd_vor 
     499   END SUBROUTINE trd_vor_iom 
    456500 
    457501 
     
    577621   END SUBROUTINE trd_vor_init 
    578622 
    579 #else 
    580    !!---------------------------------------------------------------------- 
    581    !!   Default option :                                       Empty module 
    582    !!---------------------------------------------------------------------- 
    583    INTERFACE trd_vor_zint 
    584       MODULE PROCEDURE trd_vor_zint_2d, trd_vor_zint_3d 
    585    END INTERFACE 
    586 CONTAINS 
    587    SUBROUTINE trd_vor( kt )        ! Empty routine 
    588       WRITE(*,*) 'trd_vor: You should not have seen this print! error?', kt 
    589    END SUBROUTINE trd_vor 
    590    SUBROUTINE trd_vor_zint_2d( putrdvor, pvtrdvor, ktrd ) 
    591       REAL, DIMENSION(:,:), INTENT( inout ) ::   putrdvor, pvtrdvor 
    592       INTEGER, INTENT( in ) ::   ktrd         ! ocean trend index 
    593       WRITE(*,*) 'trd_vor_zint_2d: You should not have seen this print! error?', putrdvor(1,1), pvtrdvor(1,1), ktrd 
    594    END SUBROUTINE trd_vor_zint_2d 
    595    SUBROUTINE trd_vor_zint_3d( putrdvor, pvtrdvor, ktrd ) 
    596       REAL, DIMENSION(:,:,:), INTENT( inout ) ::   putrdvor, pvtrdvor 
    597       INTEGER, INTENT( in ) ::   ktrd         ! ocean trend index 
    598       WRITE(*,*) 'trd_vor_zint_3d: You should not have seen this print! error?', putrdvor(1,1,1), pvtrdvor(1,1,1), ktrd 
    599    END SUBROUTINE trd_vor_zint_3d 
    600    SUBROUTINE trd_vor_init              ! Empty routine 
    601       WRITE(*,*) 'trd_vor_init: You should not have seen this print! error?' 
    602    END SUBROUTINE trd_vor_init 
    603 #endif 
    604623   !!====================================================================== 
    605624END MODULE trdvor 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdvor_oce.F90

    r2715 r3318  
    1313   PRIVATE 
    1414 
    15 #if defined key_trdvor 
    16    LOGICAL, PUBLIC, PARAMETER ::   lk_trdvor = .TRUE.    !: momentum trend flag 
    17 #else 
    18    LOGICAL, PUBLIC, PARAMETER ::   lk_trdvor = .FALSE.   !: momentum trend flag 
    19 #endif 
    2015   !                                               !!* vorticity trends index 
    2116   INTEGER, PUBLIC, PARAMETER ::   jpltot_vor = 11  !: Number of vorticity trend terms 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfkpp.F90

    r3294 r3318  
    2727   USE eosbn2          ! equation of state 
    2828   USE zdfddm          ! double diffusion mixing 
     29   USE trd_oce         ! trends: ocean variables 
     30   USE trdtra          ! trends manager: tracers 
    2931   USE in_out_manager  ! I/O manager 
    3032   USE lib_mpp         ! MPP library 
     
    3234   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    3335   USE prtctl          ! Print control 
    34    USE trdmod_oce      ! ocean trends definition 
    35    USE trdtra          ! tracers trends 
    3636   USE timing          ! Timing 
    3737 
     
    12661266         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:) 
    12671267         ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:) 
    1268 !!bug gm jpttdzdf ==> jpttkpp 
     1268!!bug gm : cannot add a trend to a same index (here jptra_trd_zdf as in trazdf.F90 ! 
     1269!!         solution: add another index in TRD: jptra_trd_kpp 
    12691270         CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_zdf, ztrdt ) 
    12701271         CALL trd_tra( kt, 'TRA', jp_sal, jptra_trd_zdf, ztrds ) 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90

    r3294 r3318  
    5555   USE zdfini          ! vertical physics setting          (zdf_init routine) 
    5656   USE phycst          ! physical constant                  (par_cst routine) 
    57    USE trdmod          ! momentum/tracers trends       (trd_mod_init routine) 
     57   USE trdini          ! dyn/tra trends initialization     (trd_init routine) 
    5858   USE asmtrj          ! writing out state trajectory 
    5959   USE diaptr          ! poleward transports           (dia_ptr_init routine) 
     
    309309                            CALL     dom_init   ! Domain 
    310310 
    311       IF( ln_nnogather )    CALL nemo_northcomms   ! Initialise the northfold neighbour lists (must be done after the masks are defined) 
     311      IF( ln_nnogather  )   CALL nemo_northcomms   ! Initialise the northfold neighbour lists (must be done after the masks are defined) 
    312312 
    313313      IF( ln_ctl        )   CALL prt_ctl_init   ! Print control 
     
    315315      IF( lk_obc        )   CALL     obc_init   ! Open boundaries  
    316316      IF( lk_bdy        )   CALL     bdy_init       ! Open boundaries initialisation 
    317       IF( lk_bdy        )   CALL     bdy_dta_init   ! Open boundaries initialisation of external data arrays 
    318       IF( lk_bdy        )   CALL     tide_init      ! Open boundaries initialisation of tidal harmonic forcing 
    319  
    320                             CALL flush(numout) 
    321                             CALL dyn_nept_init  ! simplified form of Neptune effect 
    322                             CALL flush(numout) 
     317      IF( lk_bdy        )   CALL bdy_dta_init       ! Open boundaries initialisation of external data arrays 
     318      IF( lk_bdy        )   CALL    tide_init       ! Open boundaries initialisation of tidal harmonic forcing 
    323319 
    324320                            CALL  istate_init   ! ocean initial state (Dynamics and tracers) 
     
    357353                            CALL dyn_zdf_init   ! vertical diffusion 
    358354                            CALL dyn_spg_init   ! surface pressure gradient 
     355                            CALL dyn_nept_init  ! Neptune effect (simplified form) 
    359356                             
    360357      !                                     ! Misc. options 
    361       IF( nn_cla == 1   )   CALL cla_init       ! Cross Land Advection 
     358      IF( nn_cla == 1   )   CALL     cla_init   ! Cross Land Advection 
    362359       
    363360#if defined key_top 
     
    369366                            CALL     iom_init   ! iom_put initialization 
    370367      IF( lk_diaar5     )   CALL dia_ar5_init   ! ar5 diag 
    371                             CALL dia_ptr_init   ! Poleward TRansports initialization 
     368                            CALL dia_ptr_init   ! Poleward TRansports 
    372369      IF( lk_diadct     )   CALL dia_dct_init   ! Sections tranports 
    373370                            CALL dia_hsb_init   ! heat content, salt content and volume budgets 
    374                             CALL trd_mod_init   ! Mixed-layer/Vorticity/Integral constraints trends 
     371                            CALL     trd_init   ! momentum/tracer trends 
    375372      IF( lk_diaobs     ) THEN                  ! Observation & model comparison 
    376373                            CALL dia_obs_init            ! Initialize observational data 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/step.F90

    r3294 r3318  
    250250 
    251251      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    252       ! Trends                              (ua, va, tsa used as workspace) 
    253       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    254       IF( nstop == 0 ) THEN                          
    255          IF( lk_trddyn     )   CALL trd_dwr( kstp )         ! trends: dynamics  
    256          IF( lk_trdtra     )   CALL trd_twr( kstp )         ! trends: active tracers 
    257          IF( lk_trdmld     )   CALL trd_mld( kstp )         ! trends: Mixed-layer  
    258          IF( lk_trdvor     )   CALL trd_vor( kstp )         ! trends: vorticity budget 
    259       ENDIF 
    260  
    261       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    262252      ! Coupled mode 
    263253      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/step_oce.F90

    r3294 r3318  
    7575 
    7676   USE diawri           ! Standard run outputs             (dia_wri routine) 
    77    USE trdicp           ! Ocean momentum/tracers trends    (trd_wri routine) 
    78    USE trdmld           ! mixed-layer trends               (trd_mld routine) 
    79    USE trdmld_rst       ! restart for mixed-layer trends 
    80    USE trdmod_oce       ! ocean momentum/tracers trends 
    81    USE trdmod           ! momentum/tracers trends    
    82    USE trdvor           ! vorticity budget                 (trd_vor routine) 
    8377   USE diaptr           ! poleward transports              (dia_ptr routine) 
    8478   USE diadct           ! sections transports              (dia_dct routine) 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90

    r3294 r3318  
    1818   USE par_trc       ! TOP parameters 
    1919   USE trc           ! TOP variables 
    20    USE trdmod_oce 
    21    USE trdmod_trc 
     20   USE trd_oce       ! trends: ocean variables 
     21   USE trdmod_trc    ! trends: passive tracer variables 
    2222   USE iom           ! I/O library 
    2323 
     
    283283      ENDIF 
    284284 
    285       IF( l_trdtrc )  CALL trd_mod_trc( tra(:,:,:,jpc14), jpc14, jptra_trd_sms, kt )   ! save trends 
     285      IF( l_trdtrc )  CALL trd_mod_trc( tra(:,:,:,jpc14), jpc14, jptra_sms, kt )   ! save trends 
    286286 
    287287      CALL wrk_dealloc( jpi, jpj,      zatmbc14 ) 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90

    r3294 r3318  
    1818   USE par_trc       ! TOP parameters 
    1919   USE trc           ! TOP variables 
    20    USE trdmod_oce 
    21    USE trdmod_trc 
     20   USE trd_oce       ! trends: ocean variables 
     21   USE trdmod_trc    ! trends: passive tracer variables 
    2222   USE iom           ! I/O library 
    2323 
     
    191191      IF( l_trdtrc ) THEN 
    192192          DO jn = jp_cfc0, jp_cfc1 
    193             CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends 
     193            CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_sms, kt )   ! save trends 
    194194          END DO 
    195195      END IF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcbio.F90

    r3294 r3318  
    22   !!====================================================================== 
    33   !!                         ***  MODULE trcbio  *** 
    4    !! TOP :   LOBSTER 
     4   !! TOP :   LOBSTER bio model 
    55   !!====================================================================== 
    6    !! History :    -   !  1999-07  (M. Levy) Original code 
    7    !!              -   !  2000-12  (E. Kestenare) assign a parameter to name individual tracers 
    8    !!              -   !  2001-03  (M. Levy)  LNO3 + dia2d  
    9    !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90 
     6   !! History :  OPA  !  1999-07  (M. Levy) Original code 
     7   !!             -   !  2000-12  (E. Kestenare) assign a parameter to name individual tracers 
     8   !!             -   !  2001-03  (M. Levy)  LNO3 + dia2d  
     9   !!   NEMO     2.0  !  2007-12  (C. Deltel, G. Madec)  F90 
    1010   !!---------------------------------------------------------------------- 
    1111#if defined key_lobster 
     
    1313   !!   'key_lobster'                                     LOBSTER bio-model 
    1414   !!---------------------------------------------------------------------- 
    15    !!   trc_bio         
    16    !!---------------------------------------------------------------------- 
    17    USE oce_trc         ! 
    18    USE trc             !  
    19    USE sms_lobster     !  
    20    USE lbclnk          !  
    21    USE prtctl_trc      ! Print control for debbuging 
    22    USE trdmod_oce 
    23    USE trdmod_trc 
     15   !!   trc_bio        
     16   !!---------------------------------------------------------------------- 
     17   USE oce_trc        ! 
     18   USE trc            !  
     19   USE sms_lobster    !  
     20   USE lbclnk         !  
     21   USE prtctl_trc     ! Print control for debbuging 
     22   USE trd_oce        ! trends: ocean variables 
     23   USE trdmod_trc     ! trends: passive tracer variables 
    2424   USE iom 
    2525    
     
    2727   PRIVATE 
    2828 
    29    PUBLIC   trc_bio    ! called in ??? 
     29   PUBLIC   trc_bio   ! called in ??? 
    3030 
    3131   !!* Substitution 
     
    3636   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    3737   !!---------------------------------------------------------------------- 
    38  
    3938CONTAINS 
    4039 
     
    6059      !!              for passive tracers are saved for futher diagnostics. 
    6160      !!--------------------------------------------------------------------- 
    62       !! 
    6361      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index       
    64       !! 
     62      ! 
    6563      INTEGER  ::   ji, jj, jk, jl 
    6664      REAL(wp) ::   zdet, zzoo, zphy, zno3, znh4, zdom      ! now concentrations 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcexp.F90

    r3294 r3318  
    44   !! TOP :   PISCES Compute loss of organic matter in the sediments 
    55   !!====================================================================== 
    6    !! History :    -   !  1999    (O. Aumont, C. Le Quere)  original code 
     6   !! History :   OPA  !  1999    (O. Aumont, C. Le Quere)  original code 
    77   !!              -   !  2001-05 (O. Aumont, E. Kestenare) add sediment computations 
    8    !!             1.0  !  2005-06 (A.-S. Kremeur) new temporal integration for sedpoc 
     8   !!   NEMO      1.0  !  2005-06 (A.-S. Kremeur) new temporal integration for sedpoc 
    99   !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90 
    1010   !!---------------------------------------------------------------------- 
     
    2121   USE trcnam_trp 
    2222   USE prtctl_trc      ! Print control for debbuging 
    23    USE trdmod_oce 
    24    USE trdmod_trc 
     23   USE trd_oce         ! trends: ocean variables 
     24   USE trdmod_trc      ! trends: passive tracer variables 
    2525   USE iom 
    2626 
     
    3737   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    3838   !!---------------------------------------------------------------------- 
    39  
    4039CONTAINS 
    4140 
     
    5352      !!              COLUMN BELOW THE SURFACE LAYER. 
    5453      !!--------------------------------------------------------------------- 
    55       !! 
    5654      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index       
    57       !! 
     55      ! 
    5856      INTEGER  ::   ji, jj, jk, jl, ikt, ierr 
    5957      REAL(wp) ::   zgeolpoc, zfact, zwork, ze3t, zsedpocd 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsed.F90

    r3294 r3318  
    1818   USE sms_lobster 
    1919   USE lbclnk 
    20    USE trdmod_oce 
    21    USE trdmod_trc 
     20   USE trd_oce         ! trends: ocean variables 
     21   USE trdmod_trc      ! trends: passive tracer variables 
    2222   USE iom 
    2323   USE prtctl_trc      ! Print control for debbuging 
     
    3535   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    3636   !!---------------------------------------------------------------------- 
    37  
    3837CONTAINS 
    3938 
     
    5655      !!              trend of passive tracers is saved for futher diagnostics. 
    5756      !!--------------------------------------------------------------------- 
    58       !! 
    5957      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index       
    60       !! 
     58      ! 
    6159      INTEGER  ::   ji, jj, jk, jl, ierr 
    6260      CHARACTER (len=25) :: charout 
    63       REAL(wp), POINTER, DIMENSION(:,:  ) :: zw2d 
    64       REAL(wp), POINTER, DIMENSION(:,:,:) :: zwork, ztra, ztrbio 
     61      REAL(wp), POINTER, DIMENSION(:,:  ) ::   zw2d 
     62      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zwork, ztra, ztrbio 
    6563      !!--------------------------------------------------------------------- 
    6664      ! 
     
    7674      CALL wrk_alloc( jpi, jpj, jpk, zwork, ztra ) 
    7775 
    78       IF( ln_diatrc )  THEN 
    79          CALL wrk_alloc( jpi, jpj, zw2d ) 
    80       ENDIF 
     76      IF( ln_diatrc )   CALL wrk_alloc( jpi, jpj, zw2d ) 
    8177 
    8278      IF( l_trdtrc ) THEN 
     
    109105      IF( ln_diatrc ) THEN  
    110106         DO jk = 1, jpkm1 
    111             DO jj = 1, jpj 
    112                DO ji = 1, jpi 
    113                   zw2d(ji,jj) = zw2d(ji,jj) + ztra(ji,jj,jk) * fse3t(ji,jj,jk) * 86400. 
    114                END DO 
    115             END DO 
     107            zw2d(:,:) = zw2d(:,:) + ztra(:,:,jk) * fse3t(:,:,jk) * 86400._wp 
    116108         END DO 
    117          IF( lk_iomput )  THEN 
    118            CALL iom_put( "TDETSED", zw2d ) 
    119          ELSE 
    120            trc2d(:,:,jp_lob0_2d + 7) = zw2d(:,:) 
     109         IF( lk_iomput ) THEN   ;   CALL iom_put( "TDETSED", zw2d ) 
     110         ELSE                   ;   trc2d(:,:,jp_lob0_2d + 7) = zw2d(:,:) 
    121111         ENDIF 
    122112         CALL wrk_dealloc( jpi, jpj, zw2d ) 
    123113      ENDIF 
    124114      ! 
    125       IF( ln_diabio )  trbio(:,:,:,jp_lob0_trd + 7) = ztra(:,:,:) 
     115      IF( ln_diabio )   trbio(:,:,:,jp_lob0_trd + 7) = ztra(:,:,:) 
    126116      CALL wrk_dealloc( jpi, jpj, jpk, zwork, ztra ) 
    127117      ! 
     
    133123      ENDIF 
    134124 
    135       IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
     125      IF(ln_ctl) THEN      ! print mean trends (used for debugging) 
    136126         WRITE(charout, FMT="('sed')") 
    137127         CALL prt_ctl_trc_info(charout) 
     
    139129      ENDIF 
    140130      ! 
    141       IF( nn_timing == 1 )  CALL timing_stop('trc_sed') 
     131      IF( nn_timing == 1 )   CALL timing_stop('trc_sed') 
    142132      ! 
    143133   END SUBROUTINE trc_sed 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90

    r3294 r3318  
    44   !! TOP :   Time loop of LOBSTER model 
    55   !!====================================================================== 
    6    !! History :   1.0  !            M. Levy 
     6   !! History :   1.0  !  2004-02  (M. Levy)  original code 
    77   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  revised architecture 
    88   !!---------------------------------------------------------------------- 
     
    1313   !!   trcsms_lobster        :  Time loop of passive tracers sms 
    1414   !!---------------------------------------------------------------------- 
    15    USE oce_trc          ! 
     15   USE oce_trc       ! 
    1616   USE trc 
    1717   USE trcbio 
     
    1919   USE trcsed 
    2020   USE trcexp 
    21    USE trdmod_oce 
    22    USE trdmod_trc_oce 
     21   USE trd_oce       ! trends: ocean variables 
     22   USE trdmod_trc    ! trends: passive tracer variables 
    2323   USE trdmod_trc 
    2424   USE trdmld_trc 
     
    6060      IF( l_trdtrc ) THEN 
    6161         DO jn = jp_lob0, jp_lob1 
    62            CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends 
     62           CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_sms, kt )   ! save trends 
    6363         END DO 
    6464      END IF 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcsms_my_trc.F90

    r3294 r3318  
    1313   !! trc_sms_my_trc_alloc : allocate arrays specific to MY_TRC sms 
    1414   !!---------------------------------------------------------------------- 
    15    USE par_trc         ! TOP parameters 
    16    USE oce_trc         ! Ocean variables 
    17    USE trc             ! TOP variables 
    18    USE trdmod_oce 
    19    USE trdmod_trc 
     15   USE par_trc       ! TOP parameters 
     16   USE oce_trc       ! Ocean variables 
     17   USE trc           ! TOP variables 
     18   USE trd_oce       ! trends: ocean variables 
     19   USE trdmod_trc    ! trends: passive tracer variables 
    2020 
    2121   IMPLICIT NONE 
     
    4242      !! ** Method  : - 
    4343      !!---------------------------------------------------------------------- 
     44      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
    4445      ! 
    45       INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
    4646      INTEGER ::   jn   ! dummy loop index 
    4747      REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrmyt 
    48 !!---------------------------------------------------------------------- 
     48      !!---------------------------------------------------------------------- 
    4949      ! 
    5050      IF( nn_timing == 1 )  CALL timing_start('trc_sms_my_trc') 
     
    7171          DO jn = jp_myt0, jp_myt1 
    7272            ztrmyt(:,:,:) = tra(:,:,:,jn) 
    73             CALL trd_mod_trc( ztrmyt, jn, jptra_trd_sms, kt )   ! save trends 
     73            CALL trd_mod_trc( ztrmyt, jn, jptra_sms, kt )   ! save trends 
    7474          END DO 
    7575          CALL wrk_dealloc( jpi, jpj, jpk, ztrmyt ) 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90

    r3295 r3318  
    44   !! TOP :   PISCES Source Minus Sink manager 
    55   !!====================================================================== 
    6    !! History :   1.0  !  2004-03 (O. Aumont) Original code 
    7    !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90 
     6   !! History :  1.0  !  2004-03 (O. Aumont) Original code 
     7   !!            2.0  !  2007-12  (C. Ethe, G. Madec)  F90 
    88   !!---------------------------------------------------------------------- 
    99#if defined key_pisces 
     
    1111   !!   'key_pisces'                                       PISCES bio-model 
    1212   !!---------------------------------------------------------------------- 
    13    !!   trcsms_pisces        :  Time loop of passive tracers sms 
    14    !!---------------------------------------------------------------------- 
    15    USE oce_trc         !  shared variables between ocean and passive tracers 
    16    USE trc             !  passive tracers common variables  
    17    USE sms_pisces      !  PISCES Source Minus Sink variables 
    18    USE p4zbio          !  Biological model 
    19    USE p4zche          !  Chemical model 
    20    USE p4zlys          !  Calcite saturation 
    21    USE p4zflx          !  Gas exchange 
    22    USE p4zsed          !  Sedimentation 
    23    USE p4zint          !  time interpolation 
    24    USE trdmod_oce      !  Ocean trends variables 
    25    USE trdmod_trc      !  TOP trends variables 
    26    USE sedmodel        !  Sediment model 
    27    USE prtctl_trc      !  print control for debugging 
     13   !!   trcsms_pisces :  Time loop of passive tracers sms 
     14   !!---------------------------------------------------------------------- 
     15   USE oce_trc        !  shared variables between ocean and passive tracers 
     16   USE trc            !  passive tracers common variables  
     17   USE sms_pisces     !  PISCES Source Minus Sink variables 
     18   USE p4zbio         !  Biological model 
     19   USE p4zche         !  Chemical model 
     20   USE p4zlys         !  Calcite saturation 
     21   USE p4zflx         !  Gas exchange 
     22   USE p4zsed         !  Sedimentation 
     23   USE p4zint         !  time interpolation 
     24   USE trd_oce        ! trends: ocean variables 
     25   USE trdmod_trc     !  TOP trends variables 
     26   USE sedmodel       !  Sediment model 
     27   USE prtctl_trc     !  print control for debugging 
    2828 
    2929   IMPLICIT NONE 
    3030   PRIVATE 
    3131 
    32    PUBLIC   trc_sms_pisces    ! called in trcsms.F90 
    33  
    34    LOGICAL ::  ln_check_mass = .false.       !: Flag to check mass conservation  
    35  
    36    INTEGER ::  numno3  !: logical unit for NO3 budget 
    37    INTEGER ::  numalk  !: logical unit for talk budget 
    38    INTEGER ::  numsil  !: logical unit for Si budget 
     32   PUBLIC   trc_sms_pisces   ! called in trcsms.F90 
     33 
     34   LOGICAL ::   ln_check_mass = .false.   ! Flag to check mass conservation  
     35 
     36   INTEGER ::   numno3   ! logical unit for NO3 budget 
     37   INTEGER ::   numalk   ! logical unit for talk budget 
     38   INTEGER ::   numsil   ! logical unit for Si budget 
    3939 
    4040   !!---------------------------------------------------------------------- 
     
    4343   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4444   !!---------------------------------------------------------------------- 
    45  
    4645CONTAINS 
    4746 
     
    5756      !!              - ... 
    5857      !!--------------------------------------------------------------------- 
    59       ! 
    60       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index       
    61       !! 
    62       INTEGER ::   jnt, jn 
     58      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index       
     59      ! 
     60      INTEGER ::   jnt, jn   ! dummy loop indices 
    6361      CHARACTER (len=25) :: charout 
    6462      !!--------------------------------------------------------------------- 
    6563      ! 
    66       IF( nn_timing == 1 )  CALL timing_start('trc_sms_pisces') 
     64      IF( nn_timing == 1 )   CALL timing_start('trc_sms_pisces') 
    6765      ! 
    6866      IF( ln_pisdmp .AND. MOD( kt - nn_dttrc, nn_pisdmp ) == 0 )   CALL trc_sms_pisces_dmp( kt )  ! Relaxation of some tracers 
     
    102100      IF( l_trdtrc ) THEN 
    103101          DO jn = jp_pcs0, jp_pcs1 
    104             CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends 
     102            CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_sms, kt )   ! save trends 
    105103          END DO 
    106104      END IF 
     
    120118   END SUBROUTINE trc_sms_pisces 
    121119 
     120 
    122121   SUBROUTINE trc_sms_pisces_dmp( kt ) 
    123122      !!---------------------------------------------------------------------- 
     
    126125      !! ** purpose  : Relaxation of some tracers 
    127126      !!---------------------------------------------------------------------- 
    128       ! 
    129127      INTEGER, INTENT( in )  ::     kt ! time step 
    130128      ! 
    131       REAL(wp) ::  alkmean = 2426.     ! mean value of alkalinity ( Glodap ; for Goyet 2391. ) 
    132       REAL(wp) ::  po4mean = 2.165     ! mean value of phosphates 
    133       REAL(wp) ::  no3mean = 30.90     ! mean value of nitrate 
    134       REAL(wp) ::  silmean = 91.51     ! mean value of silicate 
    135       ! 
    136       REAL(wp) :: zarea, zalksum, zpo4sum, zno3sum, zsilsum 
    137       !!--------------------------------------------------------------------- 
    138  
     129      REAL(wp) ::   alkmean = 2426.   ! mean value of alkalinity ( Glodap ; for Goyet 2391. ) 
     130      REAL(wp) ::   po4mean = 2.165   ! mean value of phosphates 
     131      REAL(wp) ::   no3mean = 30.90   ! mean value of nitrate 
     132      REAL(wp) ::   silmean = 91.51   ! mean value of silicate 
     133      ! 
     134      REAL(wp) ::   zarea, zalksum, zpo4sum, zno3sum, zsilsum   ! local scalars 
     135      !!--------------------------------------------------------------------- 
    139136 
    140137      IF(lwp)  WRITE(numout,*) 
     
    165162         ! 
    166163      ENDIF 
    167  
     164      ! 
    168165   END SUBROUTINE trc_sms_pisces_dmp 
     166 
    169167 
    170168   SUBROUTINE trc_sms_pisces_mass_conserv ( kt ) 
     
    173171      !! 
    174172      !! ** Purpose :  Mass conservation check  
    175       !! 
    176       !!--------------------------------------------------------------------- 
    177       ! 
     173      !!--------------------------------------------------------------------- 
    178174      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index       
    179       !! 
     175      ! 
    180176      REAL(wp) :: zalkbudget, zno3budget, zsilbudget 
    181177      ! 
    182178      NAMELIST/nampismass/ ln_check_mass 
    183179      !!--------------------------------------------------------------------- 
    184  
     180      ! 
    185181      IF( kt == nittrc000 ) THEN  
    186182         REWIND( numnatp )        
     
    199195         ENDIF 
    200196      ENDIF 
    201  
     197      ! 
    202198      IF( ln_check_mass ) THEN      !   Compute the budget of NO3, ALK, Si 
    203199         zno3budget = glob_sum( (   trn(:,:,:,jpno3) + trn(:,:,:,jpnh4)  & 
     
    206202            &                     + trn(:,:,:,jppoc) + trn(:,:,:,jpgoc)  & 
    207203            &                     + trn(:,:,:,jpdoc)                     ) * cvol(:,:,:)  )  
    208          !  
     204            !  
    209205         zsilbudget = glob_sum( (   trn(:,:,:,jpsil) + trn(:,:,:,jpgsi)  & 
    210206            &                     + trn(:,:,:,jpdsi)                     ) * cvol(:,:,:)  ) 
    211          !  
     207            !  
    212208         zalkbudget = glob_sum( (   trn(:,:,:,jpno3) * rno3              & 
    213209            &                     + trn(:,:,:,jptal)                     & 
    214210            &                     + trn(:,:,:,jpcal) * 2.                ) * cvol(:,:,:)  ) 
    215  
     211            ! 
    216212         IF( lwp ) THEN 
    217213            WRITE(numno3,9500) kt,  zno3budget / areatot 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90

    r3294 r3318  
    4949   INTEGER FUNCTION trc_adv_alloc() 
    5050      !!---------------------------------------------------------------------- 
    51       !!                  ***  ROUTINE trc_adv_alloc  *** 
    52       !!---------------------------------------------------------------------- 
    53  
     51      !!                  ***  FUNDCTION trc_adv_alloc  *** 
     52      !!---------------------------------------------------------------------- 
    5453      ALLOCATE( r2dt(jpk), STAT=trc_adv_alloc ) 
    55  
    5654      IF( trc_adv_alloc /= 0 ) CALL ctl_warn('trc_adv_alloc : failed to allocate array.') 
    57  
    5855   END FUNCTION trc_adv_alloc 
    5956 
     
    6764      !! ** Method  : - Update the tracer with the advection term following nadv 
    6865      !!---------------------------------------------------------------------- 
    69       !! 
    7066      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
    7167      ! 
    7268      INTEGER ::   jk  
    7369      CHARACTER (len=22) ::   charout 
    74       REAL(wp), POINTER, DIMENSION(:,:,:) :: zun, zvn, zwn  ! effective velocity 
     70      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zun, zvn, zwn  ! effective velocity 
    7571      !!---------------------------------------------------------------------- 
    7672      ! 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trcbbl.F90

    r3294 r3318  
    55   !!                                  layer scheme 
    66   !!====================================================================== 
    7    !!============================================================================== 
    87   !! History :  OPA  !  1996-06  (L. Mortier)  Original code 
    98   !!            8.0  !  1997-11  (G. Madec)    Optimization 
     
    1817   !!   'key_trabbl                      diffusive or/and adevective bottom boundary layer 
    1918   !!---------------------------------------------------------------------- 
    20    !!    trc_bbl       : update the tracer trends due to the bottom boundary layer (advective and/or diffusive) 
     19   !!    trc_bbl : update the tracer trends due to the bottom boundary layer (advective and/or diffusive) 
    2120   !!---------------------------------------------------------------------- 
    22    USE oce_trc             ! ocean dynamics and active tracers variables 
    23    USE trc                 ! ocean passive tracers variables 
     21   USE oce_trc         ! ocean dynamics and active tracers variables 
     22   USE trc             ! ocean passive tracers variables 
    2423   USE trcnam_trp      ! passive tracers transport namelist variables 
    25    USE trabbl              !  
    26    USE prtctl_trc          ! Print control for debbuging 
    27    USE trdmod_oce 
    28    USE trdtra 
     24   USE trabbl          ! tracers: bottom boundary layer 
     25   USE prtctl_trc      ! Print control for debbuging 
     26   USE trd_oce         ! trends: ocean variables 
     27   USE trdtra          ! trends: tracer manager 
    2928 
    30    PUBLIC   trc_bbl       !  routine called by step.F90 
    31  
     29   PUBLIC   trc_bbl    !  routine called by step.F90 
    3230 
    3331   !! * Substitutions 
     
    3836   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    3937   !!---------------------------------------------------------------------- 
    40  
    4138CONTAINS 
    42  
    4339 
    4440   SUBROUTINE trc_bbl( kt ) 
     
    9389        DO jn = 1, jptra 
    9490           ztrtrd(:,:,:,jn) = tra(:,:,:,jn) - ztrtrd(:,:,:,jn) 
    95            CALL trd_tra( kt, 'TRC', jn, jptra_trd_ldf, ztrtrd(:,:,:,jn) ) 
     91           CALL trd_tra( kt, 'TRC', jn, jptra_ldf, ztrtrd(:,:,:,jn) ) 
    9692        END DO 
    9793        CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) ! temporary save of trends 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90

    r3294 r3318  
    153153         IF( l_trdtrc ) THEN 
    154154            ztrtrd(:,:,:) = tra(:,:,:,jn) -  ztrtrd(:,:,:) 
    155             CALL trd_tra( kt, 'TRC', jn, jptra_trd_dmp, ztrtrd ) 
     155            CALL trd_tra( kt, 'TRC', jn, jptra_dmp, ztrtrd ) 
    156156         END IF 
    157157         !                                                       ! =========== 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90

    r3294 r3318  
    44   !! Ocean Passive 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 
     6   !! History :  1.0  ! 2005-11 (G. Madec)  Original code 
     7   !!           3.0  ! 2008-01  (C. Ethe, G. Madec)  merge TRC-TRA 
    88   !!---------------------------------------------------------------------- 
    99#if defined key_top 
    1010   !!---------------------------------------------------------------------- 
    1111   !!   'key_top'                                                TOP models 
    12    !!---------------------------------------------------------------------- 
    1312   !!---------------------------------------------------------------------- 
    1413   !!   trc_ldf     : update the tracer trend with the lateral diffusion 
     
    2524   USE traldf_iso_grif ! lateral mixing          (tra_ldf_iso_grif routine) 
    2625   USE traldf_lap      ! lateral mixing            (tra_ldf_lap routine) 
    27    USE trdmod_oce 
    28    USE trdtra 
     26   USE trd_oce         ! trends: ocean variables 
     27   USE trdtra          ! trends: tracer manager 
    2928   USE prtctl_trc      ! Print control 
    3029 
     
    3635   REAL(wp) ::  rldf_rat    ! ratio between active and passive tracers diffusive coefficient 
    3736   INTEGER  ::  nldf = 0   ! type of lateral diffusion used defined from ln_trcldf_... namlist logicals) 
     37 
    3838   !! * Substitutions 
    3939#  include "domzgr_substitute.h90" 
     
    4444   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4545   !!---------------------------------------------------------------------- 
    46  
    4746CONTAINS 
    4847 
     
    105104        DO jn = 1, jptra 
    106105           ztrtrd(:,:,:,jn) = tra(:,:,:,jn) - ztrtrd(:,:,:,jn) 
    107            CALL trd_tra( kt, 'TRC', jn, jptra_trd_ldf, ztrtrd(:,:,:,jn) ) 
     106           CALL trd_tra( kt, 'TRC', jn, jptra_ldf, ztrtrd(:,:,:,jn) ) 
    108107        END DO 
    109108        CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90

    r3294 r3318  
    3030   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    3131   USE prtctl_trc      ! Print control for debbuging 
    32    USE trdmod_oce 
    33    USE trdtra 
    34    USE tranxt 
     32   USE trd_oce         ! trends: ocean variables 
     33   USE trdtra          ! trends: tracer manager 
     34   USE tranxt          !  
    3535# if defined key_agrif 
    3636   USE agrif_top_update 
     
    157157               zfact = 1.e0 / r2dt(jk)   
    158158               ztrdt(:,:,jk,jn) = ( trb(:,:,jk,jn) - ztrdt(:,:,jk,jn) ) * zfact  
    159                CALL trd_tra( kt, 'TRC', jn, jptra_trd_atf, ztrdt ) 
     159               CALL trd_tra( kt, 'TRC', jn, jptra_atf, ztrdt ) 
    160160            END DO 
    161161         END DO 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90

    r3294 r3318  
    44   !! Ocean passive tracers:  correction of negative concentrations 
    55   !!====================================================================== 
    6    !! History :   -   !  01-01  (O. Aumont & E. Kestenare)  Original code 
    7    !!            1.0  !  04-03  (C. Ethe)  free form F90 
     6   !! History :  OPA  !  2001-01  (O. Aumont & E. Kestenare)  Original code 
     7   !!   NEMO     1.0  !  2004-03  (C. Ethe)  free form F90 
    88   !!---------------------------------------------------------------------- 
    99#if defined key_top 
     
    1111   !!   'key_top'                                                TOP models 
    1212   !!---------------------------------------------------------------------- 
    13    !!   trc_rad    : correction of negative concentrations 
    14    !!---------------------------------------------------------------------- 
    15    USE oce_trc             ! ocean dynamics and tracers variables 
    16    USE trc                 ! ocean passive tracers variables 
    17    USE trdmod_oce 
    18    USE trdtra 
    19    USE prtctl_trc          ! Print control for debbuging 
     13   !!   trc_rad       : correction of negative concentrations 
     14   !!---------------------------------------------------------------------- 
     15   USE oce_trc        ! ocean dynamics and tracers variables 
     16   USE trc            ! ocean passive tracers variables 
     17   USE trd_oce        ! trends: ocean variables 
     18   USE trdtra         ! trends: tracer manager 
     19   USE prtctl_trc     ! Print control for debbuging 
    2020 
    2121   IMPLICIT NONE 
    2222   PRIVATE 
    2323 
    24    PUBLIC trc_rad         ! routine called by trcstp.F90 
     24   PUBLIC   trc_rad   ! routine called by trcstp.F90 
    2525 
    2626   !! * Substitutions 
     
    3131   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    3232   !!---------------------------------------------------------------------- 
    33     
    3433CONTAINS 
    3534 
     
    4948      !!                (the total CFC content is not strictly preserved) 
    5049      !!---------------------------------------------------------------------- 
    51       INTEGER, INTENT( in ) ::   kt   ! ocean time-step index       
     50      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     51      ! 
    5252      CHARACTER (len=22) :: charout 
    5353      !!---------------------------------------------------------------------- 
     
    7777      ! 
    7878   END SUBROUTINE trc_rad 
     79 
    7980 
    8081   SUBROUTINE trc_rad_sms( kt, ptrb, ptrn, jp_sms0, jp_sms1, cpreserv ) 
     
    9495      !!                  (the total content of concentration is not strictly preserved) 
    9596      !!-------------------------------------------------------------------------------- 
    96       !! Arguments 
    97       INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
    98       INTEGER  , INTENT( in ) ::  & 
    99          jp_sms0, &       !: First index of the passive tracer model 
    100          jp_sms1          !: Last  index of  the passive tracer model 
    101  
    102       REAL(wp), DIMENSION (jpi,jpj,jpk,jptra), INTENT( inout )  :: & 
    103          ptrb, ptrn       !: before and now traceur concentration 
    104  
    105       CHARACTER( len = 1) , INTENT(in), OPTIONAL  :: & 
    106          cpreserv          !: flag to preserve content or not 
    107        
    108       ! Local declarations 
    109       INTEGER  :: ji, jj, jk, jn     ! dummy loop indices 
    110       REAL(wp) :: ztrcorb, ztrmasb   ! temporary scalars 
    111       REAL(wp) :: zcoef, ztrcorn, ztrmasn   !    "         " 
    112       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrtrdb, ztrtrdn   ! workspace arrays 
    113       REAL(wp) :: zs2rdt 
    114       LOGICAL ::   lldebug = .FALSE. 
    115       !!---------------------------------------------------------------------- 
    116  
     97      INTEGER                                , INTENT(in   ) ::   kt                 ! ocean time-step index 
     98      INTEGER                                , INTENT(in   ) ::   jp_sms0, jp_sms1   ! first/last index of the passive tracer model 
     99      REAL(wp), DIMENSION (jpi,jpj,jpk,jptra), INTENT(inout) ::   ptrb, ptrn         ! before/now traceur concentration 
     100      CHARACTER( len = 1),      OPTIONAL     , INTENT(in   ) ::   cpreserv           ! flag to preserve content or not 
     101      ! 
     102      INTEGER  ::   ji, jj, jk, jn             ! dummy loop indices 
     103      REAL(wp) ::   ztrcorb, ztrmasb, zs2rdt   ! local scalars 
     104      REAL(wp) ::   zcoef, ztrcorn, ztrmasn    !   -      - 
     105      LOGICAL  ::   lldebug = .FALSE. 
     106      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrtrdb, ztrtrdn   ! 3D workspace 
     107      !!---------------------------------------------------------------------- 
    117108  
    118109      IF( l_trdtrc )  CALL wrk_alloc( jpi, jpj, jpk, ztrtrdb, ztrtrdn ) 
    119110       
    120111      IF( PRESENT( cpreserv )  ) THEN   !  total tracer concentration is preserved  
    121        
     112         !                                                           ! =========== 
     113 
    122114         DO jn = jp_sms0, jp_sms1 
    123             !                                                        ! =========== 
    124             ztrcorb = 0.e0   ;   ztrmasb = 0.e0 
    125             ztrcorn = 0.e0   ;   ztrmasn = 0.e0 
    126  
     115            ! 
     116            ztrcorb = 0._wp   ;   ztrmasb = 0._wp 
     117            ztrcorn = 0._wp   ;   ztrmasn = 0._wp 
     118            ! 
    127119            IF( l_trdtrc ) THEN 
    128120               ztrtrdb(:,:,:) = ptrb(:,:,:,jn)                        ! save input trb for trend computation 
     
    132124            ztrcorb = glob_sum( MIN( 0., ptrb(:,:,:,jn) ) * cvol(:,:,:) ) 
    133125            ztrcorn = glob_sum( MIN( 0., ptrn(:,:,:,jn) ) * cvol(:,:,:) ) 
    134  
    135126            ztrmasb = glob_sum( MAX( 0., ptrb(:,:,:,jn) ) * cvol(:,:,:) ) 
    136127            ztrmasn = glob_sum( MAX( 0., ptrn(:,:,:,jn) ) * cvol(:,:,:) ) 
    137  
     128            ! 
    138129            IF( ztrcorb /= 0 ) THEN 
    139130               zcoef = 1. + ztrcorb / ztrmasb 
     
    143134               END DO 
    144135            ENDIF 
    145  
     136            ! 
    146137            IF( ztrcorn /= 0 ) THEN 
    147138               zcoef = 1. + ztrcorn / ztrmasn 
     
    157148               ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt 
    158149               ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt  
    159                CALL trd_tra( kt, 'TRC', jn, jptra_trd_radb, ztrtrdb )       ! Asselin-like trend handling 
    160                CALL trd_tra( kt, 'TRC', jn, jptra_trd_radn, ztrtrdn )       ! standard     trend handling 
     150               CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb )       ! Asselin-like trend handling 
     151               CALL trd_tra( kt, 'TRC', jn, jptra_radn, ztrtrdn )       ! standard     trend handling 
    161152              ! 
    162153            ENDIF 
    163  
     154            ! 
    164155         END DO 
    165156         ! 
    166157         ! 
    167158      ELSE  ! total CFC content is not strictly preserved 
    168  
     159         ! 
    169160         DO jn = jp_sms0, jp_sms1   
    170  
    171            IF( l_trdtrc ) THEN 
    172               ztrtrdb(:,:,:) = ptrb(:,:,:,jn)                        ! save input trb for trend computation 
    173               ztrtrdn(:,:,:) = ptrn(:,:,:,jn)                        ! save input trn for trend computation 
    174            ENDIF 
    175  
     161            ! 
     162            IF( l_trdtrc ) THEN 
     163               ztrtrdb(:,:,:) = ptrb(:,:,:,jn)                        ! save input trb for trend computation 
     164               ztrtrdn(:,:,:) = ptrn(:,:,:,jn)                        ! save input trn for trend computation 
     165            ENDIF 
     166            ! 
    176167            DO jk = 1, jpkm1 
    177168               DO jj = 1, jpj 
     
    182173               END DO 
    183174            END DO 
    184           
    185             IF( l_trdtrc ) THEN 
    186                ! 
     175            ! 
     176            IF( l_trdtrc ) THEN 
    187177               zs2rdt = 1. / ( 2. * rdt * FLOAT( nn_dttrc ) ) 
    188178               ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt 
    189179               ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt  
    190                CALL trd_tra( kt, 'TRC', jn, jptra_trd_radb, ztrtrdb )       ! Asselin-like trend handling 
    191                CALL trd_tra( kt, 'TRC', jn, jptra_trd_radn, ztrtrdn )       ! standard     trend handling 
    192               ! 
    193             ENDIF 
    194             ! 
    195          ENDDO 
    196  
     180               CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb )       ! Asselin-like trend handling 
     181               CALL trd_tra( kt, 'TRC', jn, jptra_radn, ztrtrdn )       ! standard     trend handling 
     182            ENDIF 
     183            ! 
     184         END DO 
     185         ! 
    197186      ENDIF 
    198  
     187      ! 
    199188      IF( l_trdtrc )  CALL wrk_dealloc( jpi, jpj, jpk, ztrtrdb, ztrtrdn ) 
    200  
     189      ! 
    201190   END SUBROUTINE trc_rad_sms 
     191 
    202192#else 
    203193   !!---------------------------------------------------------------------- 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90

    r3294 r3318  
    44   !! Ocean passive tracers:  surface boundary condition 
    55   !!====================================================================== 
    6    !! History :  8.2  !  1998-10  (G. Madec, G. Roullet, M. Imbard)  Original code 
    7    !!            8.2  !  2001-02  (D. Ludicone)  sea ice and free surface 
    8    !!            8.5  !  2002-06  (G. Madec)  F90: Free form and module 
    9    !!            9.0  !  2004-03  (C. Ethe)  adapted for passive tracers 
    10    !!                 !  2006-08  (C. Deltel) Diagnose ML trends for passive tracers 
     6   !! History :  1.0  !  2004-03  (C. Ethe)  adapt trasbc to passive tracers 
     7   !!            2.0  !  2006-08  (C. Deltel) Diagnose ML trends for passive tracers 
    118   !!============================================================================== 
    129#if defined key_top 
     
    1916   USE trc             ! ocean  passive tracers variables 
    2017   USE prtctl_trc      ! Print control for debbuging 
    21    USE trdmod_oce 
    22    USE trdtra 
     18   USE trd_oce         ! trends: ocean variables 
     19   USE trdtra          ! trends: tracer manager 
    2320 
    2421   IMPLICIT NONE 
     
    4441      !!       trend of tracer equations. 
    4542      !! 
    46       !! ** Method : 
    47       !!      * concentration/dilution effect: 
     43      !! ** Method :    concentration/dilution effect: 
    4844      !!            The surface freshwater flux modify the ocean volume 
    4945      !!         and thus the concentration of a tracer as : 
     
    5551      !! ** Action  : - Update the 1st level of tra with the trend associated 
    5652      !!                with the tracer surface boundary condition  
    57       !! 
    5853      !!---------------------------------------------------------------------- 
     54      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
    5955      ! 
    60       INTEGER, INTENT( in ) ::   kt          ! ocean time-step index 
    61       ! 
    62       INTEGER  ::   ji, jj, jn           ! dummy loop indices 
     56      INTEGER  ::   ji, jj, jn     ! dummy loop indices 
    6357      REAL(wp) ::   zsrau, zse3t   ! temporary scalars 
    64       CHARACTER (len=22) :: charout 
    65       REAL(wp), POINTER, DIMENSION(:,:  ) :: zemps 
    66       REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrd 
     58      CHARACTER (len=22) ::   charout 
     59      REAL(wp), POINTER, DIMENSION(:,:  ) ::   zemps    ! 2D workspace 
     60      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrtrd   ! 3D workspace 
    6761      !!--------------------------------------------------------------------- 
    6862      ! 
     
    108102         IF( l_trdtrc ) THEN 
    109103            ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:) 
    110             CALL trd_tra( kt, 'TRC', jn, jptra_trd_nsr, ztrtrd ) 
     104            CALL trd_tra( kt, 'TRC', jn, jptra_nsr, ztrtrd ) 
    111105         END IF 
    112106         !                                                       ! =========== 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90

    r3294 r3318  
    4444   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4545   !!---------------------------------------------------------------------- 
    46  
    4746CONTAINS 
    4847 
     
    5655      !!              - Update the passive tracers 
    5756      !!---------------------------------------------------------------------- 
    58       INTEGER, INTENT( in ) ::  kstp  ! ocean time-step index 
     57      INTEGER, INTENT( in ) ::   kstp   ! ocean time-step index 
    5958      !! --------------------------------------------------------------------- 
    6059      ! 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90

    r3294 r3318  
    44   !! Ocean Passive tracers : vertical 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  
     6   !! History :  1.0  ! 2005-11 (G. Madec)  Original code 
     7   !!           3.0  ! 2008-01  (C. Ethe, G. Madec)  merge TRC-TRA  
    88   !!---------------------------------------------------------------------- 
    99#if defined key_top 
     
    1414   !!       ldf_ctl : initialization, namelist read, and parameters control 
    1515   !!---------------------------------------------------------------------- 
    16    USE oce_trc         ! ocean dynamics and active tracers 
    17    USE trc             ! ocean passive tracers variables 
    18    USE trcnam_trp      ! passive tracers transport namelist variables 
    19    USE trazdf_exp      ! vertical diffusion: explicit (tra_zdf_exp     routine) 
    20    USE trazdf_imp      ! vertical diffusion: implicit (tra_zdf_imp     routine) 
    21    USE trdmod_oce 
    22    USE trdtra 
    23    USE prtctl_trc      ! Print control 
     16   USE oce_trc       ! ocean dynamics and active tracers 
     17   USE trc           ! ocean passive tracers variables 
     18   USE trcnam_trp    ! passive tracers transport namelist variables 
     19   USE trazdf_exp    ! vertical diffusion: explicit (tra_zdf_exp     routine) 
     20   USE trazdf_imp    ! vertical diffusion: implicit (tra_zdf_imp     routine) 
     21   USE trd_oce       ! trends: ocean variables 
     22   USE trdtra        ! trends: tracer manager 
     23   USE prtctl_trc    ! Print control 
    2424 
    2525   IMPLICIT NONE 
    2626   PRIVATE 
    2727 
    28    PUBLIC   trc_zdf          ! called by step.F90  
    29    PUBLIC   trc_zdf_alloc    ! called by nemogcm.F90  
     28   PUBLIC   trc_zdf         ! called by step.F90  
     29   PUBLIC   trc_zdf_alloc   ! called by nemogcm.F90  
    3030 
    3131   INTEGER ::   nzdf = 0               ! type vertical diffusion algorithm used 
     
    5050      !!---------------------------------------------------------------------- 
    5151      ALLOCATE( r2dt(jpk) , STAT=trc_zdf_alloc ) 
    52       ! 
    5352      IF( trc_zdf_alloc /= 0 )   CALL ctl_warn('trc_zdf_alloc : failed to allocate array.') 
    54       ! 
    5553   END FUNCTION trc_zdf_alloc 
    5654 
     
    6260      !! ** Purpose :   compute the vertical ocean tracer physics. 
    6361      !!--------------------------------------------------------------------- 
    64       INTEGER, INTENT( in ) ::  kt      ! ocean time-step index 
     62      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
    6563      ! 
    66       INTEGER               ::  jk, jn 
    67       CHARACTER (len=22)    :: charout 
     64      INTEGER            ::  jk, jn 
     65      CHARACTER (len=22) :: charout 
    6866      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::   ztrtrd   ! 4D workspace 
    6967      !!--------------------------------------------------------------------- 
     
    106104               ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dt(jk) ) - ztrtrd(:,:,jk,jn) 
    107105            END DO 
    108             CALL trd_tra( kt, 'TRC', jn, jptra_trd_zdf, ztrtrd(:,:,:,jn) ) 
     106            CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) ) 
    109107         END DO 
    110108         CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90

    r3294 r3318  
    44   !! Ocean diagnostics:  mixed layer passive tracer trends  
    55   !!====================================================================== 
    6    !! History :  9.0  !  06-08  (C. Deltel)  Original code (from trdmld.F90) 
    7    !!                 !  07-04  (C. Deltel)  Bug fix : add trcrad trends 
    8    !!                 !  07-06  (C. Deltel)  key_gyre : do not call lbc_lnk 
     6   !! History :  1.0  !  2006-08  (C. Deltel)  Original code (from trdmld.F90) 
     7   !!             -   !  2007-04  (C. Deltel)  Bug fix : add trcrad trends 
     8   !!             -   !  2007-06  (C. Deltel)  key_gyre : do not call lbc_lnk 
    99   !!---------------------------------------------------------------------- 
    1010#if   defined key_top && ( defined key_trdmld_trc   ||   defined key_esopa ) 
     
    2323   USE zdfddm  , ONLY : avs  !: salinity vertical diffusivity coeff. at w-point 
    2424# endif 
     25   USE trdmld_trc_rst    ! restart for diagnosing the ML trends 
    2526   USE trcnam_trp        ! passive tracers transport namelist variables 
    2627   USE trdmod_trc_oce    ! definition of main arrays used for trends computations 
    27    USE in_out_manager    ! I/O manager 
    2828   USE dianam            ! build the name of file (routine) 
    2929   USE ldfslp            ! iso-neutral slopes  
     30   USE in_out_manager    ! I/O manager 
    3031   USE ioipsl            ! NetCDF library 
    3132   USE lbclnk            ! ocean lateral boundary conditions (or mpp link) 
    3233   USE lib_mpp           ! MPP library 
    33    USE trdmld_trc_rst    ! restart for diagnosing the ML trends 
    3434   USE prtctl            ! print control 
    3535   USE sms_pisces        ! PISCES bio-model 
    3636   USE sms_lobster       ! LOBSTER bio-model 
    37  
     37   USE wrk_nemo          ! Memory Allocation 
     38    
    3839   IMPLICIT NONE 
    3940   PRIVATE 
     
    4647   PUBLIC trd_mld_bio_zint 
    4748 
    48    CHARACTER (LEN=40) ::  clhstnam                                ! name of the trends NetCDF file 
    49    INTEGER ::   nmoymltrd 
     49   CHARACTER (LEN=40) ::   clhstnam                                ! name of the trends NetCDF file 
     50   INTEGER            ::   nmoymltrd 
    5051   INTEGER, ALLOCATABLE, SAVE, DIMENSION(:) ::   ndextrd1 
    5152   INTEGER, DIMENSION(jptra) ::   nidtrd, nh_t 
     
    6162 
    6263   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  ztmltrd2   ! 
    63 #if defined key_lobster 
    64    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  ztmltrdbio2  ! only needed for mean diagnostics in trd_mld_bio() 
    65 #endif 
     64   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  ztmltrdbio2  ! only needed for mean diagnostics in trd_mld_bio() 
    6665 
    6766   !! * Substitutions 
    6867#  include "top_substitute.h90" 
     68#  include "zdfddm_substitute.h90" 
    6969   !!---------------------------------------------------------------------- 
    7070   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    367367      !!       In IV), the appropriate trends are written in the trends NetCDF file. 
    368368      !! 
    369       !! References : 
    370       !!       - Vialard & al. 
    371       !!       - See NEMO documentation (in preparation) 
    372       !!---------------------------------------------------------------------- 
    373       ! 
     369      !! References: Vialard et al., 2001, JPO. 
     370      !!---------------------------------------------------------------------- 
    374371      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
    375372      ! 
    376       INTEGER ::   ji, jj, jk, jl, ik, it, itmod, jn 
    377       REAL(wp) ::   zavt, zfn, zfn2 
    378       ! 
    379       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmltot             ! d(trc)/dt over the anlysis window (incl. Asselin) 
    380       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlres             ! residual = dh/dt entrainment term 
    381       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlatf             ! for storage only 
    382       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlrad             ! for storage only (for trb<0 corr in trcrad) 
    383       ! 
    384       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmltot2            ! -+ 
    385       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlres2            !  | working arrays to diagnose the trends 
    386       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmltrdm2           !  | associated with the time meaned ML 
    387       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlatf2            !  | passive tracers 
    388       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlrad2            !  | (-> for trb<0 corr in trcrad) 
     373      INTEGER ::   ji, jj, jk, jl      ! dummy loop indices 
     374      INTEGER ::   ik, it, itmod, jn   ! local integers 
     375      REAL(wp)::   zavt, zfn, zfn2    ! local scalars 
     376      ! 
     377      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmltot   ! d(trc)/dt over the anlysis window (incl. Asselin) 
     378      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlres   ! residual = dh/dt entrainment term 
     379      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlatf   ! for storage only 
     380      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlrad   ! for storage only (for trb<0 corr in trcrad) 
     381      ! 
     382      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmltot2   ! -+ 
     383      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlres2   !  | working arrays to diagnose the trends 
     384      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmltrdm2  !  | associated with the time meaned ML 
     385      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlatf2   !  | passive tracers 
     386      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmlrad2   !  | (-> for trb<0 corr in trcrad) 
    389387      ! 
    390388      CHARACTER (LEN= 5) ::   clvar 
    391389#if defined key_dimgout 
    392       INTEGER ::   iyear,imon,iday 
     390      INTEGER ::   iyear, imon, iday 
    393391      CHARACTER(LEN=80) ::   cltext, clmode 
    394392#endif 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc.F90

    r3294 r3318  
    1111   !!   'key_trdtrc'                      3D trend diagnostics 
    1212   !!---------------------------------------------------------------------- 
    13    !!   trd_mod_trc      : passive tracer trends  
     13   !!   trd_mod_trc   : passive tracer trends  
    1414   !!---------------------------------------------------------------------- 
    15    USE trc               ! tracer definitions (trn, trb, tra, etc.) 
    16    USE trcnam_trp 
    17    USE trdmod_oce 
    18    USE trdmod_trc_oce    ! definition of main arrays used for trends computations 
    19    USE trdmld_trc        ! Mixed layer trends diag. 
    20    USE iom               ! I/O library 
     15   USE trc            ! passive tracer variables 
     16   USE trcnam_trp     !  
     17   USE trd_oce        ! trends: ocean variables 
     18   USE trdmod_trc_oce ! definition of main arrays used for trends computations 
     19   USE trdmld_trc     ! Mixed layer trends diag. 
     20   USE iom            ! I/O library 
    2121 
    2222   IMPLICIT NONE 
     
    2424 
    2525   INTERFACE trd_mod_trc 
    26       MODULE PROCEDURE trd_mod_trc_trp, trd_mod_trc_bio 
     26      MODULE PROCEDURE   trd_mod_trc_trp, trd_mod_trc_bio 
    2727   END INTERFACE 
    2828 
    29    PUBLIC trd_mod_trc 
     29   PUBLIC   trd_mod_trc   ! 
    3030 
    3131   !! * Substitutions 
     
    3636   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    3737   !!---------------------------------------------------------------------- 
    38  
    3938CONTAINS 
    4039 
     
    4342      !!                  ***  ROUTINE trd_mod_trc  *** 
    4443      !!---------------------------------------------------------------------- 
    45       INTEGER, INTENT( in )  ::   kt                                  ! time step 
    46       INTEGER, INTENT( in )  ::   kjn                                 ! tracer index 
    47       INTEGER, INTENT( in )  ::   ktrd                                ! tracer trend index 
    48       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( inout )  ::   ptrtrd  ! Temperature or U trend 
     44      INTEGER                         , INTENT(in   ) ::   kt       ! time step 
     45      INTEGER                         , INTENT(in   ) ::   kjn      ! tracer index 
     46      INTEGER                         , INTENT(in   ) ::   ktrd     ! tracer trend index 
     47      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   ptrtrd   ! Temperature or U trend 
     48      ! 
    4949      CHARACTER (len=20) :: cltra 
    5050      !!---------------------------------------------------------------------- 
     
    6262         ! 
    6363         SELECT CASE ( ktrd ) 
    64          CASE ( jptra_trd_xad     )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_xad, '3D', kjn ) 
    65          CASE ( jptra_trd_yad     )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_yad, '3D', kjn ) 
    66          CASE ( jptra_trd_zad     )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_zad, '3D', kjn ) 
    67          CASE ( jptra_trd_ldf     )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_ldf, '3D', kjn ) 
    68          CASE ( jptra_trd_bbl     )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_bbl, '3D', kjn ) 
    69          CASE ( jptra_trd_zdf     ) 
    70             IF( ln_trcldf_iso ) THEN 
    71                CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_ldf, '3D', kjn ) 
    72             ELSE 
    73                CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_zdf, '3D', kjn ) 
     64         CASE ( jptra_xad  )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_xad, '3D', kjn ) 
     65         CASE ( jptra_yad  )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_yad, '3D', kjn ) 
     66         CASE ( jptra_zad  )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_zad, '3D', kjn ) 
     67         CASE ( jptra_ldf  )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_ldf, '3D', kjn ) 
     68         CASE ( jptra_bbl  )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_bbl, '3D', kjn ) 
     69         CASE ( jptra_zdf  ) 
     70            IF( ln_trcldf_iso ) THEN   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_ldf, '3D', kjn ) 
     71            ELSE                       ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_zdf, '3D', kjn ) 
    7472            ENDIF 
    75          CASE ( jptra_trd_dmp     )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_dmp , '3D', kjn ) 
    76          CASE ( jptra_trd_nsr     )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_sbc , '2D', kjn ) 
    77          CASE ( jptra_trd_sms     )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_sms , '3D', kjn ) 
    78          CASE ( jptra_trd_radb    )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_radb, '3D', kjn ) 
    79          CASE ( jptra_trd_radn    )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_radn, '3D', kjn ) 
    80          CASE ( jptra_trd_atf     )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_atf , '3D', kjn ) 
     73         CASE ( jptra_dmp  )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_dmp , '3D', kjn ) 
     74         CASE ( jptra_nsr  )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_sbc , '2D', kjn ) 
     75         CASE ( jptra_sms  )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_sms , '3D', kjn ) 
     76         CASE ( jptra_radb )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_radb, '3D', kjn ) 
     77         CASE ( jptra_radn )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_radn, '3D', kjn ) 
     78         CASE ( jptra_atf  )   ;   CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_atf , '3D', kjn ) 
    8179         END SELECT 
    8280         ! 
     
    8684         ! 
    8785         SELECT CASE( ktrd ) 
    88          CASE( jptra_trd_xad )       ;    WRITE (cltra,'("XAD_",16a)')   ctrcnm(kjn) 
    89          CASE( jptra_trd_yad )       ;    WRITE (cltra,'("YAD_",16a)')   ctrcnm(kjn) 
    90          CASE( jptra_trd_zad )       ;    WRITE (cltra,'("ZAD_",16a)')   ctrcnm(kjn) 
    91          CASE( jptra_trd_ldf )       ;    WRITE (cltra,'("LDF_",16a)')   ctrcnm(kjn) 
    92          CASE( jptra_trd_bbl )       ;    WRITE (cltra,'("BBL_",16a)')   ctrcnm(kjn) 
    93          CASE( jptra_trd_zdf )       ;    WRITE (cltra,'("ZDF_",16a)')   ctrcnm(kjn) 
    94          CASE( jptra_trd_dmp )       ;    WRITE (cltra,'("DMP_",16a)')   ctrcnm(kjn) 
    95          CASE( jptra_trd_nsr )       ;    WRITE (cltra,'("FOR_",16a)')   ctrcnm(kjn) 
     86         CASE( jptra_xad  )   ;    WRITE (cltra,'("XAD_",16a)')   ctrcnm(kjn) 
     87         CASE( jptra_yad  )   ;    WRITE (cltra,'("YAD_",16a)')   ctrcnm(kjn) 
     88         CASE( jptra_zad  )   ;    WRITE (cltra,'("ZAD_",16a)')   ctrcnm(kjn) 
     89         CASE( jptra_ldf  )   ;    WRITE (cltra,'("LDF_",16a)')   ctrcnm(kjn) 
     90         CASE( jptra_bbl  )   ;    WRITE (cltra,'("BBL_",16a)')   ctrcnm(kjn) 
     91         CASE( jptra_zdf  )   ;    WRITE (cltra,'("ZDF_",16a)')   ctrcnm(kjn) 
     92         CASE( jptra_dmp  )   ;    WRITE (cltra,'("DMP_",16a)')   ctrcnm(kjn) 
     93         CASE( jptra_nsr  )   ;    WRITE (cltra,'("FOR_",16a)')   ctrcnm(kjn) 
    9694         END SELECT 
    97                                           CALL iom_put( cltra,  ptrtrd(:,:,:) ) 
     95         ! 
     96         CALL iom_put( cltra,  ptrtrd(:,:,:) ) 
    9897         ! 
    9998      END IF 
     
    101100   END SUBROUTINE trd_mod_trc_trp 
    102101 
     102 
    103103   SUBROUTINE trd_mod_trc_bio( ptrbio, ktrd, kt ) 
    104104      !!---------------------------------------------------------------------- 
    105105      !!                  ***  ROUTINE trd_mod_bio  *** 
    106106      !!---------------------------------------------------------------------- 
    107  
    108       INTEGER, INTENT( in )  ::   kt                                  ! time step 
    109       INTEGER, INTENT( in )  ::   ktrd                                ! bio trend index 
    110       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( inout )  ::   ptrbio  ! Bio trend 
     107      INTEGER                         , INTENT(in   )  ::   kt       ! time step 
     108      INTEGER                         , INTENT(in   )  ::   ktrd     ! bio trend index 
     109      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout)  ::   ptrbio   ! Bio trend 
    111110      !!---------------------------------------------------------------------- 
    112  
    113       CALL trd_mld_bio_zint( ptrbio, ktrd ) ! Verticaly integrated biological trends 
    114  
     111      ! 
     112      CALL trd_mld_bio_zint( ptrbio, ktrd )       ! Verticaly integrated biological trends 
     113      ! 
    115114   END SUBROUTINE trd_mod_trc_bio 
     115    
    116116#else 
    117117   !!---------------------------------------------------------------------- 
    118118   !!   Default option :                                       Empty module 
    119119   !!---------------------------------------------------------------------- 
    120  
    121120   INTERFACE trd_mod_trc 
    122121      MODULE PROCEDURE trd_mod_trc_trp, trd_mod_trc_bio 
    123122   END INTERFACE 
    124  
    125123CONTAINS 
    126  
    127124   SUBROUTINE trd_mod_trc_trp( ptrtrd, kjn, ktrd, kt ) 
    128125      INTEGER               , INTENT( in )     ::   kt      ! time step 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc_oce.F90

    r2715 r3318  
    3838 
    3939   INTEGER, PARAMETER ::            & !: mixed layer trends indices 
    40         jpmld_trc_xad     =  1,     & !:     zonal      \ 
    41         jpmld_trc_yad     =  2,     & !:     meridonal   > advection 
    42         jpmld_trc_zad     =  3,     & !:     vertical   / 
    43         jpmld_trc_ldf     =  4,     & !:     lateral diffusion (geopot. or iso-neutral) 
    44         jpmld_trc_zdf     =  5,     & !:     vertical diffusion (TKE) 
    45         jpmld_trc_bbl     =  6,     & !:     bottom boundary layer (advective/diffusive) 
    46         jpmld_trc_dmp     =  7,     & !:     internal restoring trend 
    47         jpmld_trc_sbc     =  8,     & !:     forcing  
    48         jpmld_trc_sms     =  9,     & !:     sources minus sinks trend 
    49   !     jpmld_trc_xxx     = xx,     & !:     add here any additional trend    (** AND UPDATE JPLTRD_TRC BELOW **) 
    50         jpmld_trc_radn    = 10,     & !:     corr. trn<0 in trcrad 
    51         jpmld_trc_radb    = 11,     & !:     corr. trb<0 in trcrad (like atf) (** MUST BE BEFORE THE LAST ONE **) 
    52         jpmld_trc_atf     = 12        !:     asselin trend                    (** MUST BE    THE      LAST ONE**) 
     40        jpmld_trc_xad     =  1,     & !: zonal     advection 
     41        jpmld_trc_yad     =  2,     & !: meridonal advection 
     42        jpmld_trc_zad     =  3,     & !: vertical  advection 
     43        jpmld_trc_ldf     =  4,     & !: lateral diffusion (geopot. or iso-neutral) 
     44        jpmld_trc_zdf     =  5,     & !: vertical diffusion (TKE) 
     45        jpmld_trc_bbl     =  6,     & !: bottom boundary layer (advective/diffusive) 
     46        jpmld_trc_dmp     =  7,     & !: internal restoring trend 
     47        jpmld_trc_sbc     =  8,     & !: forcing  
     48        jpmld_trc_sms     =  9,     & !: sources minus sinks trend 
     49  !     jpmld_trc_xxx     = xx,     & !: add here any additional trend    (** AND UPDATE JPLTRD_TRC BELOW **) 
     50        jpmld_trc_radn    = 10,     & !: corr. trn<0 in trcrad 
     51        jpmld_trc_radb    = 11,     & !: corr. trb<0 in trcrad (like atf) (** MUST BE BEFORE THE LAST ONE **) 
     52        jpmld_trc_atf     = 12        !: asselin trend                    (** MUST BE    THE      LAST ONE**) 
    5353 
    5454   !! Trends diagnostics parameters 
     
    7373 
    7474   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  & 
    75       tml_trc    ,                        &      !: \ "now" mixed layer temperature/salinity 
    76       tmlb_trc   ,                        &      !: / and associated "before" fields 
    77       tmlbb_trc  ,                        &      !: \ idem, but valid at the 1rst time step of the 
    78       tmlbn_trc  ,                        &      !: / current analysis window 
     75      tml_trc    ,                        &      !: "now" mixed layer temperature/salinity 
     76      tmlb_trc   ,                        &      !: and associated "before" fields 
     77      tmlbb_trc  ,                        &      !: idem, but valid at the 1rst time step of the 
     78      tmlbn_trc  ,                        &      !: current analysis window 
    7979      tml_sum_trc,                        &      !: mixed layer T, summed over the current analysis period 
    8080      tml_sumb_trc,                       &      !: idem, but from the previous analysis period 
     
    9393 
    9494   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  & 
    95       tmltrd_trc,                         &      !: \ physical contributions to the total trend (for T/S), 
    96                                                  !: / cumulated over the current analysis window 
     95      tmltrd_trc,                         &      !: physical contributions to the total trend (for T/S), 
     96                                                 !: cumulated over the current analysis window 
    9797      tmltrd_sum_trc,                     &      !: sum of these trends over the analysis period 
    9898      tmltrd_csum_ln_trc,                 &      !: now cumulated sum of trends over the "lower triangle" 
     
    109109   CHARACTER(LEN=80) :: clname_bio, ctrd_bio(jpdiabio,2) 
    110110   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  & 
    111       tmltrd_bio,                         &      !: \ biological contributions to the total trend , 
    112                                                  !: / cumulated over the current analysis window 
     111      tmltrd_bio,                         &      !: biological contributions to the total trend , 
     112                                                 !: cumulated over the current analysis window 
    113113      tmltrd_sum_bio,                     &      !: sum of these trends over the analysis period 
    114114      tmltrd_csum_ln_bio,                 &      !: now cumulated sum of trends over the "lower triangle" 
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/trcnam.F90

    r3294 r3318  
    2626   USE trcnam_c14b       ! C14 SMS namelist 
    2727   USE trcnam_my_trc     ! MY_TRC SMS namelist 
    28    USE trdmod_oce        
     28   USE trd_oce           ! trends: ocean variables 
    2929   USE trdmod_trc_oce 
    3030   USE iom               ! I/O manager 
Note: See TracChangeset for help on using the changeset viewer.