New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 6225 for branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC – NEMO

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

Update MPP_BDY_UPDATE branch to be consistent with head of trunk

Location:
branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC
Files:
6 deleted
72 edited
10 copied

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90

    r3680 r6225  
    1818   USE par_trc       ! TOP parameters 
    1919   USE trc           ! TOP variables 
    20    USE trdmod_oce 
    21    USE trdmod_trc 
     20   USE trd_oce 
     21   USE trdtrc 
    2222   USE iom           ! I/O library 
    2323 
     
    4949   REAL(wp) ::   xconv3 = 1.e+3_wp             ! conversion from mol/l/atm to mol/m3/atm 
    5050 
    51    !! * Substitutions 
    52 #  include "top_substitute.h90" 
    53  
    5451   !!---------------------------------------------------------------------- 
    5552   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    56    !! $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/SMS/trcc14bomb.F90,v 1.2 2005/11/14 16:42:43 opalod Exp $  
     53   !! $Id$  
    5754   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    5855   !!---------------------------------------------------------------------- 
     
    258255                  &                      * tmask(ji,jj,1) * ( 1. - fr_i(ji,jj) ) / 2. 
    259256            ! Add the surface flux to the trend 
    260             tra(ji,jj,1,jpc14) = tra(ji,jj,1,jpc14) + qtr_c14(ji,jj) / fse3t(ji,jj,1)  
     257            tra(ji,jj,1,jpc14) = tra(ji,jj,1,jpc14) + qtr_c14(ji,jj) / e3t_n(ji,jj,1)  
    261258             
    262259            ! cumulation of surface flux at each time step 
     
    290287      ENDIF 
    291288      !     
    292       IF( ln_diatrc ) THEN 
    293          IF( lk_iomput ) THEN 
    294             CALL iom_put( "qtrC14b"  , qtr_c14 ) 
    295             CALL iom_put( "qintC14b" , qint_c14 ) 
    296             CALL iom_put( "fdecay"   , zdecay   ) 
    297           ELSE 
     289      IF( lk_iomput ) THEN 
     290        CALL iom_put( "qtrC14b"  , qtr_c14  ) 
     291        CALL iom_put( "qintC14b" , qint_c14 ) 
     292        CALL iom_put( "fdecay"   , zdecay  ) 
     293      ELSE 
     294         IF( ln_diatrc ) THEN 
    298295            trc2d(:,:  ,jp_c14b0_2d     ) = qtr_c14 (:,:) 
    299296            trc2d(:,:  ,jp_c14b0_2d + 1 ) = qint_c14(:,:) 
    300297            trc3d(:,:,:,jp_c14b0_3d     ) = zdecay  (:,:,:) 
    301           ENDIF 
    302       ENDIF 
    303  
    304       IF( l_trdtrc )  CALL trd_mod_trc( tra(:,:,:,jpc14), jpc14, jptra_trd_sms, kt )   ! save trends 
     298         ENDIF 
     299      ENDIF 
     300 
     301      IF( l_trdtrc )  CALL trd_trc( tra(:,:,:,jpc14), jpc14, jptra_sms, kt )   ! save trends 
    305302 
    306303      CALL wrk_dealloc( jpi, jpj,      zatmbc14 ) 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/C14b/trcwri_c14b.F90

    r4305 r6225  
    66   !! History :   1.0  !  2009-05 (C. Ethe)  Original code 
    77   !!---------------------------------------------------------------------- 
    8 #if defined key_top && key_c14b && defined key_iomput 
     8#if defined key_top && defined key_c14b && defined key_iomput 
    99   !!---------------------------------------------------------------------- 
    1010   !!   'key_c14b'                                           c14b model 
     
    2020   PUBLIC trc_wri_c14b  
    2121 
    22 #  include "top_substitute.h90" 
    2322CONTAINS 
    2423 
     
    3736      DO jn = jp_c14b0, jp_c14b1 
    3837         cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer 
    39          IF( lk_vvl ) THEN 
    40             CALL iom_put( cltra, trn(:,:,:,jn) * fse3t_n(:,:,:) ) 
    41          ELSE 
    42             CALL iom_put( cltra, trn(:,:,:,jn) ) 
    43          ENDIF 
     38         CALL iom_put( cltra, trn(:,:,:,jn) ) 
    4439      END DO 
    4540      ! 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90

    r3680 r6225  
    1818   USE par_trc       ! TOP parameters 
    1919   USE trc           ! TOP variables 
    20    USE trdmod_oce 
    21    USE trdmod_trc 
     20   USE trd_oce 
     21   USE trdtrc 
    2222   USE iom           ! I/O library 
    2323 
     
    5050   REAL(wp) ::   xconv4 = 1.0e-12      ! conversion from mol/m3/atm to mol/m3/pptv  
    5151 
    52    !! * Substitutions 
    53 #  include "top_substitute.h90" 
    5452   !!---------------------------------------------------------------------- 
    5553   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    7573      !!                CFC concentration in pico-mol/m3 
    7674      !!---------------------------------------------------------------------- 
    77       ! 
    7875      INTEGER, INTENT(in) ::   kt    ! ocean time-step index 
    7976      ! 
     
    167164                  &                         * tmask(ji,jj,1) * ( 1. - fr_i(ji,jj) ) 
    168165               ! Add the surface flux to the trend 
    169                tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + qtr_cfc(ji,jj,jl) / fse3t(ji,jj,1)  
     166               tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + qtr_cfc(ji,jj,jl) / e3t_n(ji,jj,1)  
    170167 
    171168               ! cumulation of surface flux at each time step 
     
    185182            CALL iom_rstput( kt, nitrst, numrtw, 'qint_'//ctrcnm(jn), qint_cfc(:,:,jn) ) 
    186183         END DO 
    187       ENDIF 
    188       !                                               
    189       IF( ln_diatrc ) THEN 
    190         ! 
    191         IF( lk_iomput ) THEN 
    192            CALL iom_put( "qtrCFC11"  , qtr_cfc (:,:,1) ) 
    193            CALL iom_put( "qintCFC11" , qint_cfc(:,:,1) ) 
    194         ELSE 
    195            trc2d(:,:,jp_cfc0_2d    ) = qtr_cfc (:,:,1) 
    196            trc2d(:,:,jp_cfc0_2d + 1) = qint_cfc(:,:,1) 
    197         END IF 
    198         ! 
     184      ENDIF                                             
     185      ! 
     186      IF( lk_iomput ) THEN 
     187         CALL iom_put( "qtrCFC11"  , qtr_cfc (:,:,1) ) 
     188         CALL iom_put( "qintCFC11" , qint_cfc(:,:,1) ) 
     189      ELSE 
     190         IF( ln_diatrc ) THEN 
     191            trc2d(:,:,jp_cfc0_2d    ) = qtr_cfc (:,:,1) 
     192            trc2d(:,:,jp_cfc0_2d + 1) = qint_cfc(:,:,1) 
     193         END IF 
    199194      END IF 
    200   
     195      ! 
    201196      IF( l_trdtrc ) THEN 
    202197          DO jn = jp_cfc0, jp_cfc1 
    203             CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends 
     198            CALL trd_trc( tra(:,:,:,jn), jn, jptra_sms, kt )   ! save trends 
    204199          END DO 
    205200      END IF 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/CFC/trcwri_cfc.F90

    r4305 r6225  
    66   !! History :   1.0  !  2009-05 (C. Ethe)  Original code 
    77   !!---------------------------------------------------------------------- 
    8 #if defined key_top && key_cfc && defined key_iomput 
     8#if defined key_top && defined key_cfc && defined key_iomput 
    99   !!---------------------------------------------------------------------- 
    1010   !!   'key_cfc'                                           cfc model 
     
    2020   PUBLIC trc_wri_cfc  
    2121 
    22 #  include "top_substitute.h90" 
    2322CONTAINS 
    2423 
     
    3736      DO jn = jp_cfc0, jp_cfc1 
    3837         cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer 
    39          IF( lk_vvl ) THEN 
    40             CALL iom_put( cltra, trn(:,:,:,jn) * fse3t_n(:,:,:) ) 
    41          ELSE 
    42             CALL iom_put( cltra, trn(:,:,:,jn) ) 
    43          ENDIF 
     38         CALL iom_put( cltra, trn(:,:,:,jn) ) 
    4439      END DO 
    4540      ! 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcini_my_trc.F90

    r2787 r6225  
    4242 
    4343      IF(lwp) WRITE(numout,*) 
    44       IF(lwp) WRITE(numout,*) ' trc_ini_my_trc: initialisation of MY_TRC model' 
     44      IF(lwp) WRITE(numout,*) ' trc_ini_my_trc: passive tracer unit vector' 
     45      IF(lwp) WRITE(numout,*) ' To check conservation : ' 
     46      IF(lwp) WRITE(numout,*) '   1 - No sea-ice model ' 
     47      IF(lwp) WRITE(numout,*) '   2 - No runoff '  
     48      IF(lwp) WRITE(numout,*) '   3 - precipitation and evaporation equal to 1 : E=P=1 '  
    4549      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~' 
    4650       
    47       IF( .NOT. ln_rsttr ) trn(:,:,:,jp_myt0:jp_myt1) = 0. 
     51      IF( .NOT. ln_rsttr ) trn(:,:,:,jp_myt0:jp_myt1) = 1. 
    4852      ! 
    4953   END SUBROUTINE trc_ini_my_trc 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcsms_my_trc.F90

    r3680 r6225  
    1616   USE oce_trc         ! Ocean variables 
    1717   USE trc             ! TOP variables 
    18    USE trdmod_oce 
    19    USE trdmod_trc 
     18   USE trd_oce 
     19   USE trdtrc 
     20   USE trcbc, only : trc_bc_read 
    2021 
    2122   IMPLICIT NONE 
     
    4647      INTEGER ::   jn   ! dummy loop index 
    4748      REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrmyt 
    48 !!---------------------------------------------------------------------- 
     49      !!---------------------------------------------------------------------- 
    4950      ! 
    5051      IF( nn_timing == 1 )  CALL timing_start('trc_sms_my_trc') 
     
    5657      IF( l_trdtrc )  CALL wrk_alloc( jpi, jpj, jpk, ztrmyt ) 
    5758 
    58       WHERE( (glamt <= 170) .AND. (glamt >= 160) .AND. (gphit <= -74) .AND. (gphit >=-75.6) ) 
    59         trn(:,:,1,jpmyt1) = 1._wp 
    60         trb(:,:,1,jpmyt1) = 1._wp 
    61         tra(:,:,1,jpmyt1) = 0._wp 
    62       END WHERE 
     59      CALL trc_bc_read  ( kt )       ! tracers: surface and lateral Boundary Conditions 
    6360 
    64       IF( l_trdtrc ) THEN      ! Save the trends in the ixed layer 
     61      ! add here the call to BGC model 
     62 
     63      ! Save the trends in the mixed layer 
     64      IF( l_trdtrc ) THEN 
    6565          DO jn = jp_myt0, jp_myt1 
    6666            ztrmyt(:,:,:) = tra(:,:,:,jn) 
    67             CALL trd_mod_trc( ztrmyt, jn, jptra_trd_sms, kt )   ! save trends 
     67            CALL trd_trc( ztrmyt, jn, jptra_sms, kt )   ! save trends 
    6868          END DO 
    6969          CALL wrk_dealloc( jpi, jpj, jpk, ztrmyt ) 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcwri_my_trc.F90

    r4305 r6225  
    66   !! History :   1.0  !  2009-05 (C. Ethe)  Original code 
    77   !!---------------------------------------------------------------------- 
    8 #if defined key_top && key_my_trc && defined key_iomput 
     8#if defined key_top && defined key_my_trc && defined key_iomput 
    99   !!---------------------------------------------------------------------- 
    1010   !!   'key_my_trc'                                           my_trc model 
     
    2020   PUBLIC trc_wri_my_trc  
    2121 
    22 #  include "top_substitute.h90" 
    2322CONTAINS 
    2423 
     
    3736      DO jn = jp_myt0, jp_myt1 
    3837         cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer 
    39          IF( lk_vvl ) THEN 
    40             CALL iom_put( cltra, trn(:,:,:,jn) * fse3t_n(:,:,:) ) 
    41          ELSE 
    42             CALL iom_put( cltra, trn(:,:,:,jn) ) 
    43          ENDIF 
     38         IF( ln_trc_wri(jn) ) CALL iom_put( cltra, trn(:,:,:,jn) ) 
    4439      END DO 
    4540      ! 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zbio.F90

    • Property svn:keywords set to Id
    r4624 r6225  
    2121   USE lbclnk          !  
    2222   USE prtctl_trc      ! Print control for debbuging 
    23    USE trdmod_oce 
    24    USE trdmod_trc 
     23   USE trd_oce 
     24   USE trdtrc 
    2525   USE iom 
    2626    
     
    5959   REAL(wp) ::   fdbod      ! zooplankton mortality fraction that goes to detritus 
    6060 
    61    !!* Substitution 
    62 #  include "top_substitute.h90" 
     61   !! * Substitutions 
     62#  include "vectopt_loop_substitute.h90" 
    6363   !!---------------------------------------------------------------------- 
    6464   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    65    !! $Id: p2zbio.F90 3294 2012-01-28 16:44:18Z rblod $  
     65   !! $Id$  
    6666   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    6767   !!---------------------------------------------------------------------- 
    68  
    6968CONTAINS 
    7069 
     
    110109      IF( nn_timing == 1 )  CALL timing_start('p2z_bio') 
    111110      ! 
    112       IF( ln_diatrc ) THEN 
     111      IF( ln_diatrc .OR. lk_iomput ) THEN 
    113112         CALL wrk_alloc( jpi, jpj,     17, zw2d ) 
    114113         CALL wrk_alloc( jpi, jpj, jpk, 3, zw3d ) 
     
    122121 
    123122      xksi(:,:) = 0.e0        ! zooplakton closure ( fbod) 
    124       IF( ln_diatrc ) THEN 
     123      IF( ln_diatrc .OR. lk_iomput ) THEN 
    125124         zw2d  (:,:,:) = 0.e0 
    126125         zw3d(:,:,:,:) = 0.e0 
     
    186185               !    closure : flux grazing is redistributed below level jpkbio 
    187186               zzoobod = tmminz * zzoo * zzoo 
    188                xksi(ji,jj) = xksi(ji,jj) + (1-fdbod) * zzoobod * fse3t(ji,jj,jk) 
     187               xksi(ji,jj) = xksi(ji,jj) + (1-fdbod) * zzoobod * e3t_n(ji,jj,jk) 
    189188               zboddet = fdbod * zzoobod 
    190189 
     
    239238                  !  trend number 17 in p2zexp 
    240239                ENDIF 
    241                 IF( ln_diatrc ) THEN 
     240                IF( ln_diatrc .OR. lk_iomput ) THEN 
    242241                  ! convert fluxes in per day 
    243                   ze3t = fse3t(ji,jj,jk) * 86400. 
     242                  ze3t = e3t_n(ji,jj,jk) * 86400._wp 
    244243                  zw2d(ji,jj,1)  = zw2d(ji,jj,1)  + zno3phy * ze3t 
    245244                  zw2d(ji,jj,2)  = zw2d(ji,jj,2)  + znh4phy * ze3t 
     
    360359                  !  trend number 17 in p2zexp  
    361360                ENDIF 
    362                 IF( ln_diatrc ) THEN 
     361                IF( ln_diatrc .OR. lk_iomput ) THEN 
    363362                  ! convert fluxes in per day 
    364                   ze3t = fse3t(ji,jj,jk) * 86400. 
     363                  ze3t = e3t_n(ji,jj,jk) * 86400._wp 
    365364                  zw2d(ji,jj,1)  = zw2d(ji,jj,1)  + zno3phy * ze3t 
    366365                  zw2d(ji,jj,2)  = zw2d(ji,jj,2)  + znh4phy * ze3t 
     
    381380                  zw2d(ji,jj,17) = zw2d(ji,jj,17) + zdetdom * ze3t 
    382381                  !    
    383                   zw3d(ji,jj,jk,1) = zno3phy * 86400 
    384                   zw3d(ji,jj,jk,2) = znh4phy * 86400 
    385                   zw3d(ji,jj,jk,3) = znh4no3 * 86400 
     382                  zw3d(ji,jj,jk,1) = zno3phy * 86400._wp 
     383                  zw3d(ji,jj,jk,2) = znh4phy * 86400._wp 
     384                  zw3d(ji,jj,jk,3) = znh4no3 * 86400._wp 
    386385                   ! 
    387386                ENDIF 
     
    390389      END DO 
    391390 
    392       IF( ln_diatrc ) THEN 
    393          ! 
     391      IF( ln_diatrc .OR. lk_iomput ) THEN 
    394392         DO jl = 1, 17  
    395393            CALL lbc_lnk( zw2d(:,:,jl),'T', 1. ) 
     
    398396            CALL lbc_lnk( zw3d(:,:,:,jl),'T', 1. ) 
    399397         END DO 
    400          IF( lk_iomput ) THEN 
     398      ENDIF 
     399      IF( lk_iomput ) THEN 
    401400            ! Save diagnostics 
    402             CALL iom_put( "TNO3PHY", zw2d(:,:,1) ) 
    403             CALL iom_put( "TNH4PHY", zw2d(:,:,2) ) 
    404             CALL iom_put( "TPHYDOM", zw2d(:,:,3) ) 
    405             CALL iom_put( "TPHYNH4", zw2d(:,:,4) ) 
    406             CALL iom_put( "TPHYZOO", zw2d(:,:,5) ) 
    407             CALL iom_put( "TPHYDET", zw2d(:,:,6) ) 
    408             CALL iom_put( "TDETZOO", zw2d(:,:,7) ) 
    409             CALL iom_put( "TZOODET", zw2d(:,:,8) ) 
    410             CALL iom_put( "TZOOBOD", zw2d(:,:,9) ) 
    411             CALL iom_put( "TZOONH4", zw2d(:,:,10) ) 
    412             CALL iom_put( "TZOODOM", zw2d(:,:,11) ) 
    413             CALL iom_put( "TNH4NO3", zw2d(:,:,12) ) 
    414             CALL iom_put( "TDOMNH4", zw2d(:,:,13) ) 
    415             CALL iom_put( "TDETNH4", zw2d(:,:,14) ) 
    416             CALL iom_put( "TPHYTOT", zw2d(:,:,15) ) 
    417             CALL iom_put( "TZOOTOT", zw2d(:,:,16) ) 
    418             !  
    419             CALL iom_put( "FNO3PHY", zw3d(:,:,:,1) ) 
    420             CALL iom_put( "FNH4PHY", zw3d(:,:,:,2) ) 
    421             CALL iom_put( "FNH4NO3", zw3d(:,:,:,3) ) 
    422             ! 
    423          ELSE 
     401        CALL iom_put( "TNO3PHY", zw2d(:,:,1) ) 
     402        CALL iom_put( "TNH4PHY", zw2d(:,:,2) ) 
     403        CALL iom_put( "TPHYDOM", zw2d(:,:,3) ) 
     404        CALL iom_put( "TPHYNH4", zw2d(:,:,4) ) 
     405        CALL iom_put( "TPHYZOO", zw2d(:,:,5) ) 
     406        CALL iom_put( "TPHYDET", zw2d(:,:,6) ) 
     407        CALL iom_put( "TDETZOO", zw2d(:,:,7) ) 
     408        CALL iom_put( "TZOODET", zw2d(:,:,8) ) 
     409        CALL iom_put( "TZOOBOD", zw2d(:,:,9) ) 
     410        CALL iom_put( "TZOONH4", zw2d(:,:,10) ) 
     411        CALL iom_put( "TZOODOM", zw2d(:,:,11) ) 
     412        CALL iom_put( "TNH4NO3", zw2d(:,:,12) ) 
     413        CALL iom_put( "TDOMNH4", zw2d(:,:,13) ) 
     414        CALL iom_put( "TDETNH4", zw2d(:,:,14) ) 
     415        CALL iom_put( "TPHYTOT", zw2d(:,:,15) ) 
     416        CALL iom_put( "TZOOTOT", zw2d(:,:,16) ) 
     417         !  
     418        CALL iom_put( "FNO3PHY", zw3d(:,:,:,1) ) 
     419        CALL iom_put( "FNH4PHY", zw3d(:,:,:,2) ) 
     420        CALL iom_put( "FNH4NO3", zw3d(:,:,:,3) ) 
     421         ! 
     422       ELSE 
     423          IF( ln_diatrc ) THEN 
    424424            ! 
    425425            trc2d(:,:,jp_pcs0_2d    ) = zw2d(:,:,1)  
     
    457457      IF( l_trdtrc ) THEN 
    458458         DO jl = jp_pcs0_trd, jp_pcs1_trd 
    459             CALL trd_mod_trc( trbio(:,:,:,jl), jl, kt )   ! handle the trend 
     459            CALL trd_trc( trbio(:,:,:,jl), jl, kt )   ! handle the trend 
    460460         END DO 
    461461      ENDIF 
     
    467467      ENDIF 
    468468      ! 
    469       IF( ln_diatrc ) THEN 
     469      IF( ln_diatrc .OR. lk_iomput ) THEN 
    470470         CALL wrk_dealloc( jpi, jpj,     17, zw2d ) 
    471471         CALL wrk_dealloc( jpi, jpj, jpk, 3, zw3d ) 
     
    598598 
    599599   !!====================================================================== 
    600 END MODULE  p2zbio 
     600END MODULE p2zbio 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zexp.F90

    • Property svn:keywords set to Id
    r3446 r6225  
    2222   USE lbclnk 
    2323   USE prtctl_trc      ! Print control for debbuging 
    24    USE trdmod_oce 
    25    USE trdmod_trc 
     24   USE trd_oce 
     25   USE trdtrc 
    2626   USE iom 
    2727 
     
    4141   REAL(wp)                                ::   areacot   !: surface coastal area 
    4242 
    43    !!* Substitution 
    44 #  include "top_substitute.h90" 
     43   !! * Substitutions 
     44#  include "vectopt_loop_substitute.h90" 
    4545   !!---------------------------------------------------------------------- 
    4646   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    47    !! $Id: trcexp.F90 3294 2012-01-28 16:44:18Z rblod $  
     47   !! $Id$  
    4848   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4949   !!---------------------------------------------------------------------- 
    50  
    5150CONTAINS 
    5251 
     
    9493         DO jj = 2, jpjm1 
    9594            DO ji = fs_2, fs_jpim1 
    96                ze3t = 1. / fse3t(ji,jj,jk) 
     95               ze3t = 1. / e3t_n(ji,jj,jk) 
    9796               tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) + ze3t * dmin3(ji,jj,jk) * xksi(ji,jj) 
    9897            END DO 
     
    109108         DO ji = fs_2, fs_jpim1 
    110109            ikt = mbkt(ji,jj)  
    111             tra(ji,jj,ikt,jpno3) = tra(ji,jj,ikt,jpno3) + sedlam * sedpocn(ji,jj) / fse3t(ji,jj,ikt)  
     110            tra(ji,jj,ikt,jpno3) = tra(ji,jj,ikt,jpno3) + sedlam * sedpocn(ji,jj) / e3t_n(ji,jj,ikt)  
    112111            ! Deposition of organic matter in the sediment 
    113112            zwork = vsed * trn(ji,jj,ikt,jpdet) 
     
    120119      DO jj = 2, jpjm1 
    121120         DO ji = fs_2, fs_jpim1 
    122             tra(ji,jj,1,jpno3) = tra(ji,jj,1,jpno3) + zgeolpoc * cmask(ji,jj) / areacot / fse3t(ji,jj,1) 
     121            tra(ji,jj,1,jpno3) = tra(ji,jj,1,jpno3) + zgeolpoc * cmask(ji,jj) / areacot / e3t_n(ji,jj,1) 
    123122         END DO 
    124123      END DO 
     
    127126  
    128127      ! Oa & Ek: diagnostics depending on jpdia2d !          left as example 
    129       IF( ln_diatrc ) THEN 
    130          IF( lk_iomput ) THEN   ;   CALL iom_put( "SEDPOC" , sedpocn ) 
    131          ELSE                   ;   trc2d(:,:,jp_pcs0_2d + 18) = sedpocn(:,:) 
    132          ENDIF 
     128      IF( lk_iomput ) THEN   
     129         CALL iom_put( "SEDPOC" , sedpocn ) 
     130      ELSE 
     131         IF( ln_diatrc )           trc2d(:,:,jp_pcs0_2d + 18) = sedpocn(:,:) 
    133132      ENDIF 
    134133 
     
    164163         ztrbio(:,:,:) = tra(:,:,:,jpno3) - ztrbio(:,:,:) 
    165164         jl = jp_pcs0_trd + 16 
    166          CALL trd_mod_trc( ztrbio, jl, kt )   ! handle the trend 
     165         CALL trd_trc( ztrbio, jl, kt )   ! handle the trend 
    167166         CALL wrk_dealloc( jpi, jpj, jpk, ztrbio )   ! temporary save of trends 
    168167      ENDIF 
     
    211210         DO jj = 1, jpj 
    212211            DO ji = 1, jpi 
    213                zfluo = ( fsdepw(ji,jj,jk  ) / fsdepw(ji,jj,jpkb) )**xhr 
    214                zfluu = ( fsdepw(ji,jj,jk+1) / fsdepw(ji,jj,jpkb) )**xhr 
     212               zfluo = ( gdepw_n(ji,jj,jk  ) / gdepw_n(ji,jj,jpkb) )**xhr 
     213               zfluu = ( gdepw_n(ji,jj,jk+1) / gdepw_n(ji,jj,jpkb) )**xhr 
    215214               IF( zfluo.GT.1. )   zfluo = 1._wp 
    216215               zdm0(ji,jj,jk) = zfluo - zfluu 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zopt.F90

    • Property svn:keywords set to Id
    r4624 r6225  
    4040   REAL(wp), PUBLIC ::  reddom    ! redfield ratio (C:N) for DOM 
    4141 
    42    !!* Substitution 
    43 #  include "top_substitute.h90" 
    4442   !!---------------------------------------------------------------------- 
    4543   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    46    !! $Id: trcopt.F90 3294 2012-01-28 16:44:18Z rblod $  
     44   !! $Id$  
    4745   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4846   !!---------------------------------------------------------------------- 
    49  
    5047CONTAINS 
    5148 
     
    8986 
    9087      !                                          ! surface irradiance 
    91       zpar0m (:,:)   = qsr   (:,:) * 0.43        ! ------------------ 
     88      !                                          ! ------------------ 
     89      IF( ln_dm2dc ) THEN   ;   zpar0m(:,:) = qsr_mean(:,:) * 0.43 
     90      ELSE                  ;   zpar0m(:,:) = qsr     (:,:) * 0.43 
     91      ENDIF 
    9292      zpar100(:,:)   = zpar0m(:,:) * 0.01 
    9393      zparr  (:,:,1) = zpar0m(:,:) * 0.5 
     
    102102               zkr  = xkr0 + xkrp * EXP( xlr * zpig ) 
    103103               zkg  = xkg0 + xkgp * EXP( xlg * zpig ) 
    104                zparr(ji,jj,jk) = zparr(ji,jj,jk-1) * EXP( -zkr * fse3t(ji,jj,jk-1) ) 
    105                zparg(ji,jj,jk) = zparg(ji,jj,jk-1) * EXP( -zkg * fse3t(ji,jj,jk-1) ) 
     104               zparr(ji,jj,jk) = zparr(ji,jj,jk-1) * EXP( -zkr * e3t_n(ji,jj,jk-1) ) 
     105               zparg(ji,jj,jk) = zparg(ji,jj,jk-1) * EXP( -zkg * e3t_n(ji,jj,jk-1) ) 
    106106            END DO 
    107107        END DO 
     
    113113               zkr  = xkr0 + xkrp * EXP( xlr * zpig ) 
    114114               zkg  = xkg0 + xkgp * EXP( xlg * zpig ) 
    115                zparr(ji,jj,jk) = zparr(ji,jj,jk) / ( zkr * fse3t(ji,jj,jk) ) * ( 1 - EXP( -zkr * fse3t(ji,jj,jk) ) ) 
    116                zparg(ji,jj,jk) = zparg(ji,jj,jk) / ( zkg * fse3t(ji,jj,jk) ) * ( 1 - EXP( -zkg * fse3t(ji,jj,jk) ) ) 
     115               zparr(ji,jj,jk) = zparr(ji,jj,jk) / ( zkr * e3t_n(ji,jj,jk) ) * ( 1 - EXP( -zkr * e3t_n(ji,jj,jk) ) ) 
     116               zparg(ji,jj,jk) = zparg(ji,jj,jk) / ( zkg * e3t_n(ji,jj,jk) ) * ( 1 - EXP( -zkg * e3t_n(ji,jj,jk) ) ) 
    117117               etot (ji,jj,jk) = MAX( zparr(ji,jj,jk) + zparg(ji,jj,jk), 1.e-15 ) 
    118118            END DO 
     
    128128              IF( etot(ji,jj,jk) >= zpar100(ji,jj) )   neln(ji,jj) = jk + 1  
    129129              !                                       ! nb. this is to ensure compatibility with 
    130               !                                       ! nmld_trc definition in trd_mld_trc_zint 
     130              !                                       ! nmld_trc definition in trd_mxl_trc_zint 
    131131           END DO 
    132132         END DO 
     
    135135      DO jj = 1, jpj 
    136136         DO ji = 1, jpi 
    137             heup(ji,jj) = fsdepw(ji,jj,neln(ji,jj)) 
     137            heup(ji,jj) = gdepw_n(ji,jj,neln(ji,jj)) 
    138138         END DO 
    139139      END DO  
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsed.F90

    • Property svn:keywords set to Id
    r4624 r6225  
    1818   USE sms_pisces 
    1919   USE lbclnk 
    20    USE trdmod_oce 
    21    USE trdmod_trc 
     20   USE trd_oce 
     21   USE trdtrc 
    2222   USE iom 
    2323   USE prtctl_trc      ! Print control for debbuging 
     
    3434   REAL(wp), PUBLIC ::   xhr         ! coeff for martin''s remineralisation profile 
    3535 
    36    !!* Substitution 
    37 #  include "top_substitute.h90" 
    3836   !!---------------------------------------------------------------------- 
    3937   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    40    !! $Id: p2z_sed.F90 3294 2012-01-28 16:44:18Z rblod $  
     38   !! $Id$  
    4139   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4240   !!---------------------------------------------------------------------- 
     
    102100         DO jj = 1, jpj 
    103101            DO ji = 1, jpi 
    104                ztra(ji,jj,jk)  = - ( zwork(ji,jj,jk) - zwork(ji,jj,jk+1) ) / fse3t(ji,jj,jk) 
     102               ztra(ji,jj,jk)  = - ( zwork(ji,jj,jk) - zwork(ji,jj,jk+1) ) / e3t_n(ji,jj,jk) 
    105103               tra(ji,jj,jk,jpdet) = tra(ji,jj,jk,jpdet) + ztra(ji,jj,jk)  
    106104            END DO 
     
    108106      END DO 
    109107 
    110       IF( ln_diatrc ) THEN  
    111          CALL wrk_alloc( jpi, jpj, zw2d ) 
    112          zw2d(:,:) =  ztra(:,:,1) * fse3t(:,:,1) * 86400. 
    113          DO jk = 2, jpkm1 
    114             zw2d(:,:) = zw2d(:,:) + ztra(:,:,jk) * fse3t(:,:,jk) * 86400. 
    115          END DO 
    116          IF( lk_iomput )  THEN 
    117            CALL iom_put( "TDETSED", zw2d ) 
    118          ELSE 
    119            trc2d(:,:,jp_pcs0_2d + 7) = zw2d(:,:) 
     108      IF( lk_iomput )  THEN 
     109         IF( iom_use( "TDETSED" ) ) THEN 
     110            CALL wrk_alloc( jpi, jpj, zw2d ) 
     111            zw2d(:,:) =  ztra(:,:,1) * e3t_n(:,:,1) * 86400._wp 
     112            DO jk = 2, jpkm1 
     113               zw2d(:,:) = zw2d(:,:) + ztra(:,:,jk) * e3t_n(:,:,jk) * 86400._wp 
     114            END DO 
     115            CALL iom_put( "TDETSED", zw2d ) 
     116            CALL wrk_dealloc( jpi, jpj, zw2d ) 
    120117         ENDIF 
    121          CALL wrk_dealloc( jpi, jpj, zw2d ) 
     118      ELSE 
     119         IF( ln_diatrc ) THEN  
     120            CALL wrk_alloc( jpi, jpj, zw2d ) 
     121            zw2d(:,:) =  ztra(:,:,1) * e3t_n(:,:,1) * 86400._wp 
     122            DO jk = 2, jpkm1 
     123               zw2d(:,:) = zw2d(:,:) + ztra(:,:,jk) * e3t_n(:,:,jk) * 86400._wp 
     124            END DO 
     125            trc2d(:,:,jp_pcs0_2d + 7) = zw2d(:,:) 
     126            CALL wrk_dealloc( jpi, jpj, zw2d ) 
     127         ENDIF 
    122128      ENDIF 
    123129      ! 
     
    128134         ztrbio(:,:,:) = tra(:,:,:,jpdet) - ztrbio(:,:,:) 
    129135         jl = jp_pcs0_trd + 7 
    130          CALL trd_mod_trc( ztrbio, jl, kt )   ! handle the trend 
     136         CALL trd_trc( ztrbio, jl, kt )   ! handle the trend 
    131137         CALL wrk_dealloc( jpi, jpj, jpk, ztrbio ) 
    132138      ENDIF 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsms.F90

    • Property svn:keywords set to Id
    r4624 r6225  
    2020   USE p2zsed 
    2121   USE p2zexp 
    22    USE trdmod_oce 
    23    USE trdmod_trc_oce 
    24    USE trdmod_trc 
    25    USE trdmld_trc 
     22   USE trd_oce 
     23   USE trdtrc_oce 
     24   USE trdtrc 
     25   USE trdmxl_trc 
    2626 
    2727   IMPLICIT NONE 
     
    3232   !!---------------------------------------------------------------------- 
    3333   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    34    !! $Id: p2zsms.F90 3294 2012-01-28 16:44:18Z rblod $  
     34   !! $Id$  
    3535   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    3636   !!---------------------------------------------------------------------- 
     
    6161      IF( l_trdtrc ) THEN 
    6262         DO jn = jp_pcs0, jp_pcs1 
    63            CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends 
     63           CALL trd_trc( tra(:,:,:,jn), jn, jptra_sms, kt )   ! save trends 
    6464         END DO 
    6565      END IF 
    6666 
    67       IF( lk_trdmld_trc )  CALL trd_mld_bio( kt )   ! trends: Mixed-layer 
     67      IF( lk_trdmxl_trc )  CALL trd_mxl_bio( kt )   ! trends: Mixed-layer 
    6868      ! 
    6969      IF ( lwm .AND. kt == nittrc000 ) CALL FLUSH    ( numonp )     ! flush output namelist PISCES 
     
    8484 
    8585   !!====================================================================== 
    86 END MODULE  p2zsms 
     86END MODULE p2zsms 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zbio.F90

    r4529 r6225  
    3434   PUBLIC  p4z_bio     
    3535 
    36    !!* Substitution 
    37 #  include "top_substitute.h90" 
    3836   !!---------------------------------------------------------------------- 
    3937   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    4139   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4240   !!---------------------------------------------------------------------- 
    43  
    4441CONTAINS 
    4542 
    46    SUBROUTINE p4z_bio ( kt, jnt ) 
     43   SUBROUTINE p4z_bio ( kt, knt ) 
    4744      !!--------------------------------------------------------------------- 
    4845      !!                     ***  ROUTINE p4z_bio  *** 
     
    5451      !! ** Method  : - ??? 
    5552      !!--------------------------------------------------------------------- 
    56       INTEGER, INTENT(in) :: kt, jnt 
    57       INTEGER  ::  ji, jj, jk, jn 
    58       REAL(wp) ::  ztra 
    59 #if defined key_kriest 
    60       REAL(wp) ::  zcoef1, zcoef2 
    61 #endif 
     53      INTEGER, INTENT(in) :: kt, knt 
     54      INTEGER             :: ji, jj, jk, jn 
    6255      CHARACTER (len=25) :: charout 
    6356 
     
    7467         DO jj = 1, jpj 
    7568            DO ji = 1, jpi 
    76                IF( fsdepw(ji,jj,jk+1) > hmld(ji,jj) )   xdiss(ji,jj,jk) = 0.01 
     69!!gm  :  use nmln  and test on jk ...  less memory acces 
     70               IF( gdepw_n(ji,jj,jk+1) > hmld(ji,jj) )   xdiss(ji,jj,jk) = 0.01 
    7771            END DO  
    7872         END DO 
    7973      END DO 
    8074 
    81            
    82       CALL p4z_opt  ( kt, jnt )     ! Optic: PAR in the water column 
    83       CALL p4z_sink ( kt, jnt )     ! vertical flux of particulate organic matter 
    84       CALL p4z_fechem(kt, jnt )     ! Iron chemistry/scavenging 
    85       CALL p4z_lim  ( kt, jnt )     ! co-limitations by the various nutrients 
    86       CALL p4z_prod ( kt, jnt )     ! phytoplankton growth rate over the global ocean.  
     75      CALL p4z_opt  ( kt, knt )     ! Optic: PAR in the water column 
     76      CALL p4z_sink ( kt, knt )     ! vertical flux of particulate organic matter 
     77      CALL p4z_fechem(kt, knt )     ! Iron chemistry/scavenging 
     78      CALL p4z_lim  ( kt, knt )     ! co-limitations by the various nutrients 
     79      CALL p4z_prod ( kt, knt )     ! phytoplankton growth rate over the global ocean.  
    8780      !                             ! (for each element : C, Si, Fe, Chl ) 
    8881      CALL p4z_mort ( kt      )     ! phytoplankton mortality 
    89       !                             ! zooplankton sources/sinks routines  
    90       CALL p4z_micro( kt, jnt )           ! microzooplankton 
    91       CALL p4z_meso ( kt, jnt )           ! mesozooplankton 
    92       CALL p4z_rem  ( kt, jnt )     ! remineralization terms of organic matter+scavenging of Fe 
     82     !                             ! zooplankton sources/sinks routines  
     83      CALL p4z_micro( kt, knt )           ! microzooplankton 
     84      CALL p4z_meso ( kt, knt )           ! mesozooplankton 
     85      CALL p4z_rem  ( kt, knt )     ! remineralization terms of organic matter+scavenging of Fe 
    9386      !                             ! test if tracers concentrations fall below 0. 
    94       xnegtr(:,:,:) = 1.e0 
    95       DO jn = jp_pcs0, jp_pcs1 
    96          DO jk = 1, jpk 
    97             DO jj = 1, jpj 
    98                DO ji = 1, jpi 
    99                   IF( ( trn(ji,jj,jk,jn) + tra(ji,jj,jk,jn) ) < 0.e0 ) THEN 
    100                      ztra             = ABS( trn(ji,jj,jk,jn) ) / ( ABS( tra(ji,jj,jk,jn) ) + rtrn ) 
    101  
    102                      xnegtr(ji,jj,jk) = MIN( xnegtr(ji,jj,jk),  ztra ) 
    103                   ENDIF 
    104               END DO 
    105             END DO 
    106          END DO 
    107       END DO 
    108       !                                ! where at least 1 tracer concentration becomes negative 
    109       !                                !  
    110       DO jn = jp_pcs0, jp_pcs1 
    111          trn(:,:,:,jn) = trn(:,:,:,jn) + xnegtr(:,:,:) * tra(:,:,:,jn) 
    112       END DO 
    113  
    114  
    115       tra(:,:,:,:) = 0.e0 
    116  
    117 #if defined key_kriest 
    118       !  
    119       zcoef1 = 1.e0 / xkr_massp  
    120       zcoef2 = 1.e0 / xkr_massp / 1.1 
    121       DO jk = 1,jpkm1 
    122          trn(:,:,jk,jpnum) = MAX(  trn(:,:,jk,jpnum), trn(:,:,jk,jppoc) * zcoef1 / xnumm(jk)  ) 
    123          trn(:,:,jk,jpnum) = MIN(  trn(:,:,jk,jpnum), trn(:,:,jk,jppoc) * zcoef2              ) 
    124       END DO 
    125 #endif 
    126  
    127       ! 
     87      !                                                             ! 
    12888      IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
    12989         WRITE(charout, FMT="('bio ')") 
    13090         CALL prt_ctl_trc_info(charout) 
    131          CALL prt_ctl_trc(tab4d=trn, mask=tmask, clinfo=ctrcnm) 
     91         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm) 
    13292      ENDIF 
    13393      ! 
     
    146106 
    147107   !!====================================================================== 
    148 END MODULE  p4zbio 
    149  
     108END MODULE p4zbio 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zche.F90

    • Property svn:keywords set to Id
    r3557 r6225  
    164164   REAL(wp) :: devk55  = 0.3692E-3       
    165165 
    166    !!* Substitution 
    167 #include "top_substitute.h90" 
    168166   !!---------------------------------------------------------------------- 
    169167   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    170    !! $Id: p4zche.F90 3294 2012-01-28 16:44:18Z rblod $  
     168   !! $Id$  
    171169   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    172170   !!---------------------------------------------------------------------- 
     
    195193      ! CHEMICAL CONSTANTS - SURFACE LAYER 
    196194      ! ---------------------------------- 
    197 !CDIR NOVERRCHK 
    198195      DO jj = 1, jpj 
    199 !CDIR NOVERRCHK 
    200196         DO ji = 1, jpi 
    201197            !                             ! SET ABSOLUTE TEMPERATURE 
     
    227223      ! OXYGEN SOLUBILITY - DEEP OCEAN 
    228224      ! ------------------------------- 
    229 !CDIR NOVERRCHK 
    230225      DO jk = 1, jpk 
    231 !CDIR NOVERRCHK 
    232226         DO jj = 1, jpj 
    233 !CDIR NOVERRCHK 
    234227            DO ji = 1, jpi 
    235228              ztkel = tsn(ji,jj,jk,jp_tem) + 273.16 
     
    249242 
    250243 
    251  
    252244      ! CHEMICAL CONSTANTS - DEEP OCEAN 
    253245      ! ------------------------------- 
    254 !CDIR NOVERRCHK 
    255246      DO jk = 1, jpk 
    256 !CDIR NOVERRCHK 
    257247         DO jj = 1, jpj 
    258 !CDIR NOVERRCHK 
    259248            DO ji = 1, jpi 
    260249 
    261250               ! SET PRESSION 
    262                zpres   = 1.025e-1 * fsdept(ji,jj,jk) 
     251               zpres   = 1.025e-1 * gdept_n(ji,jj,jk) 
    263252 
    264253               ! SET ABSOLUTE TEMPERATURE 
     
    396385 
    397386   !!====================================================================== 
    398 END MODULE  p4zche 
     387END MODULE p4zche 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zfechem.F90

    r4624 r6225  
    3030   PUBLIC   p4z_fechem_init ! called in trcsms_pisces.F90 
    3131 
    32    !! * Shared module variables 
    33    LOGICAL          ::  ln_fechem    !: boolean for complex iron chemistry following Tagliabue and voelker 
    34    LOGICAL          ::  ln_ligvar    !: boolean for variable ligand concentration following Tagliabue and voelker 
    35    REAL(wp), PUBLIC ::  xlam1        !: scavenging rate of Iron  
    36    REAL(wp), PUBLIC ::  xlamdust     !: scavenging rate of Iron by dust  
    37    REAL(wp), PUBLIC ::  ligand       !: ligand concentration in the ocean  
    38  
     32   LOGICAL          ::   ln_fechem    !: boolean for complex iron chemistry following Tagliabue and voelker 
     33   LOGICAL          ::   ln_ligvar    !: boolean for variable ligand concentration following Tagliabue and voelker 
     34   REAL(wp), PUBLIC ::   xlam1        !: scavenging rate of Iron  
     35   REAL(wp), PUBLIC ::   xlamdust     !: scavenging rate of Iron by dust  
     36   REAL(wp), PUBLIC ::   ligand       !: ligand concentration in the ocean  
     37 
     38!!gm Not DOCTOR norm !!! 
    3939   REAL(wp) :: kl1, kl2, kb1, kb2, ks, kpr, spd, con, kth 
    4040 
    41    !!* Substitution 
    42 #  include "top_substitute.h90" 
    4341   !!---------------------------------------------------------------------- 
    4442   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    4846CONTAINS 
    4947 
    50    SUBROUTINE p4z_fechem( kt, jnt ) 
     48   SUBROUTINE p4z_fechem( kt, knt ) 
    5149      !!--------------------------------------------------------------------- 
    5250      !!                     ***  ROUTINE p4z_fechem  *** 
     
    6159      !!                    and one particulate form (ln_fechem) 
    6260      !!--------------------------------------------------------------------- 
    63       ! 
    64       INTEGER, INTENT(in) ::   kt, jnt ! ocean time step 
     61      INTEGER, INTENT(in) ::   kt, knt   ! ocean time step 
    6562      ! 
    6663      INTEGER  ::   ji, jj, jk, jic 
     64      CHARACTER (len=25) :: charout 
    6765      REAL(wp) ::   zdep, zlam1a, zlam1b, zlamfac 
    6866      REAL(wp) ::   zkeq, zfeequi, zfesatur, zfecoll 
     
    7977      REAL(wp) :: ztfe, zoxy 
    8078      REAL(wp) :: zstep 
    81       CHARACTER (len=25) :: charout 
    8279      !!--------------------------------------------------------------------- 
    8380      ! 
    8481      IF( nn_timing == 1 )  CALL timing_start('p4z_fechem') 
    8582      ! 
    86       ! Allocate temporary workspace 
    87       CALL wrk_alloc( jpi, jpj, jpk, zFe3, zFeL1, zTL1, ztotlig ) 
     83      CALL wrk_alloc( jpi,jpj,jpk,   zFe3, zFeL1, zTL1, ztotlig ) 
    8884      zFe3 (:,:,:) = 0. 
    8985      zFeL1(:,:,:) = 0. 
    9086      zTL1 (:,:,:) = 0. 
    9187      IF( ln_fechem ) THEN 
    92          CALL wrk_alloc( jpi, jpj, jpk, zFe2, zFeL2, zTL2, zFeP ) 
     88         CALL wrk_alloc( jpi,jpj,jpk,  zFe2, zFeL2, zTL2, zFeP ) 
    9389         zFe2 (:,:,:) = 0. 
    9490         zFeL2(:,:,:) = 0. 
     
    10197      ! ------------------------------------------------- 
    10298      IF( ln_ligvar ) THEN 
    103          ztotlig(:,:,:) =  0.09 * trn(:,:,:,jpdoc) * 1E6 + ligand * 1E9 
     99         ztotlig(:,:,:) =  0.09 * trb(:,:,:,jpdoc) * 1E6 + ligand * 1E9 
    104100         ztotlig(:,:,:) =  MIN( ztotlig(:,:,:), 10. ) 
    105101      ELSE 
     
    113109         ! Chemistry is supposed to be fast enough to be at equilibrium 
    114110         ! ------------------------------------------------------------ 
    115 !CDIR NOVERRCHK 
    116111         DO jk = 1, jpkm1 
    117 !CDIR NOVERRCHK 
    118112            DO jj = 1, jpj 
    119 !CDIR NOVERRCHK 
    120113               DO ji = 1, jpi 
    121114                  ! Calculate ligand concentrations : assume 2/3rd of excess goes to 
     
    127120                  zionic = 19.9201 * tsn(ji,jj,jk,jp_sal) / ( 1000. - 1.00488 * tsn(ji,jj,jk,jp_sal) + rtrn ) 
    128121                  zph    = -LOG10( MAX( hi(ji,jj,jk), rtrn) ) 
    129                   zoxy   = trn(ji,jj,jk,jpoxy) * ( rhop(ji,jj,jk) / 1.e3 ) 
     122                  zoxy   = trb(ji,jj,jk,jpoxy) * ( rhop(ji,jj,jk) / 1.e3 ) 
    130123                  ! Fe2+ oxydation rate from Santana-Casiano et al. (2005) 
    131124                  zkox   = 35.407 - 6.7109 * zph + 0.5342 * zph * zph - 5362.6 / ( tsn(ji,jj,jk,jp_tem) + 273.15 )  & 
     
    137130                  zkph1 = zkph2 / 5. 
    138131                  ! pass the dfe concentration from PISCES 
    139                   ztfe = trn(ji,jj,jk,jpfer) * 1e9 
     132                  ztfe = trb(ji,jj,jk,jpfer) * 1e9 
    140133                  ! ---------------------------------------------------------- 
    141134                  ! ANALYTICAL SOLUTION OF ROOTS OF THE FE3+ EQUATION 
     
    195188         ! Chemistry is supposed to be fast enough to be at equilibrium 
    196189         ! ------------------------------------------------------------ 
    197 !CDIR NOVERRCHK 
    198190         DO jk = 1, jpkm1 
    199 !CDIR NOVERRCHK 
    200191            DO jj = 1, jpj 
    201 !CDIR NOVERRCHK 
    202192               DO ji = 1, jpi 
    203193                  zTL1(ji,jj,jk) = ztotlig(ji,jj,jk) 
    204194                  zkeq           = fekeq(ji,jj,jk) 
    205195                  zfesatur       = zTL1(ji,jj,jk) * 1E-9 
    206                   ztfe           = trn(ji,jj,jk,jpfer)  
     196                  ztfe           = trb(ji,jj,jk,jpfer)  
    207197                  ! Fe' is the root of a 2nd order polynom 
    208198                  zFe3 (ji,jj,jk) = ( -( 1. + zfesatur * zkeq - zkeq * ztfe )               & 
     
    210200                     &               + 4. * ztfe * zkeq) ) / ( 2. * zkeq ) 
    211201                  zFe3 (ji,jj,jk) = zFe3(ji,jj,jk) * 1E9 
    212                   zFeL1(ji,jj,jk) = MAX( 0., trn(ji,jj,jk,jpfer) * 1E9 - zFe3(ji,jj,jk) ) 
     202                  zFeL1(ji,jj,jk) = MAX( 0., trb(ji,jj,jk,jpfer) * 1E9 - zFe3(ji,jj,jk) ) 
    213203              END DO 
    214204            END DO 
     
    216206         ! 
    217207      ENDIF 
    218  
     208      ! 
    219209      zdust = 0.         ! if no dust available 
    220 !CDIR NOVERRCHK 
     210      ! 
    221211      DO jk = 1, jpkm1 
    222 !CDIR NOVERRCHK 
    223212         DO jj = 1, jpj 
    224 !CDIR NOVERRCHK 
    225213            DO ji = 1, jpi 
    226214               zstep = xstep 
     
    240228               ENDIF 
    241229#if defined key_kriest 
    242                ztrc   = ( trn(ji,jj,jk,jppoc) + trn(ji,jj,jk,jpcal) + trn(ji,jj,jk,jpgsi) ) * 1.e6  
     230               ztrc   = ( trb(ji,jj,jk,jppoc) + trb(ji,jj,jk,jpcal) + trb(ji,jj,jk,jpgsi) ) * 1.e6  
    243231#else 
    244                ztrc   = ( trn(ji,jj,jk,jppoc) + trn(ji,jj,jk,jpgoc) + trn(ji,jj,jk,jpcal) + trn(ji,jj,jk,jpgsi) ) * 1.e6  
     232               ztrc   = ( trb(ji,jj,jk,jppoc) + trb(ji,jj,jk,jpgoc) + trb(ji,jj,jk,jpcal) + trb(ji,jj,jk,jpgsi) ) * 1.e6  
    245233#endif 
    246                IF( ln_dust )  zdust  = dust(ji,jj) / ( wdust * rday ) * tmask(ji,jj,jk) ! dust in kg/m2/s 
     234               IF( ln_dust )  zdust  = dust(ji,jj) / ( wdust / rday ) * tmask(ji,jj,jk) ! dust in kg/m2/s 
    247235               zlam1b = 3.e-5 + xlamdust * zdust + xlam1 * ztrc 
    248236               zscave = zfeequi * zlam1b * zstep 
     
    251239               ! to later allocate scavenged iron to the different organic pools 
    252240               ! --------------------------------------------------------- 
    253                zdenom1 = xlam1 * trn(ji,jj,jk,jppoc) / zlam1b 
     241               zdenom1 = xlam1 * trb(ji,jj,jk,jppoc) / zlam1b 
    254242#if ! defined key_kriest 
    255                zdenom2 = xlam1 * trn(ji,jj,jk,jpgoc) / zlam1b 
     243               zdenom2 = xlam1 * trb(ji,jj,jk,jpgoc) / zlam1b 
    256244#endif 
    257245 
     
    261249               zlamfac = MAX( 0.e0, ( gphit(ji,jj) + 55.) / 30. ) 
    262250               zlamfac = MIN( 1.  , zlamfac ) 
    263                zdep    = MIN( 1., 1000. / fsdept(ji,jj,jk) ) 
    264                zlam1b  = xlam1 * MAX( 0.e0, ( trn(ji,jj,jk,jpfer) * 1.e9 - ztotlig(ji,jj,jk) ) ) 
    265                zcoag   = zfeequi * zlam1b * zstep + 1E-4 * ( 1. - zlamfac ) * zdep * zstep * trn(ji,jj,jk,jpfer) 
     251!!gm very small BUG :  it is unlikely but possible that gdept_n = 0  ..... 
     252               zdep    = MIN( 1., 1000. / gdept_n(ji,jj,jk) ) 
     253               zlam1b  = xlam1 * MAX( 0.e0, ( trb(ji,jj,jk,jpfer) * 1.e9 - ztotlig(ji,jj,jk) ) ) 
     254               zcoag   = zfeequi * zlam1b * zstep + 1E-4 * ( 1. - zlamfac ) * zdep * zstep * trb(ji,jj,jk,jpfer) 
    266255 
    267256               !  Compute the coagulation of colloidal iron. This parameterization  
     
    269258               !  It requires certainly some more work as it is very poorly constrained. 
    270259               !  ---------------------------------------------------------------- 
    271                zlam1a  = ( 0.369  * 0.3 * trn(ji,jj,jk,jpdoc) + 102.4  * trn(ji,jj,jk,jppoc) ) * xdiss(ji,jj,jk)    & 
    272                    &   + ( 114.   * 0.3 * trn(ji,jj,jk,jpdoc) + 5.09E3 * trn(ji,jj,jk,jppoc) ) 
     260               zlam1a  = ( 0.369  * 0.3 * trb(ji,jj,jk,jpdoc) + 102.4  * trb(ji,jj,jk,jppoc) ) * xdiss(ji,jj,jk)    & 
     261                   &   + ( 114.   * 0.3 * trb(ji,jj,jk,jpdoc) + 5.09E3 * trb(ji,jj,jk,jppoc) ) 
    273262               zaggdfea = zlam1a * zstep * zfecoll 
    274263#if defined key_kriest 
     
    278267               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zscave * zdenom1 + zaggdfea + zaggdfeb 
    279268#else 
    280                zlam1b = 3.53E3 *   trn(ji,jj,jk,jpgoc) * xdiss(ji,jj,jk) 
     269               zlam1b = 3.53E3 *   trb(ji,jj,jk,jpgoc) * xdiss(ji,jj,jk) 
    281270               zaggdfeb = zlam1b * zstep * zfecoll 
    282271               ! 
     
    292281      !  ---------------------------------------- 
    293282      IF( ln_fechem ) THEN 
    294           biron(:,:,:) = MAX( 0., trn(:,:,:,jpfer) - zFeP(:,:,:) * 1E-9 ) 
     283          biron(:,:,:) = MAX( 0., trb(:,:,:,jpfer) - zFeP(:,:,:) * 1E-9 ) 
    295284      ELSE 
    296           biron(:,:,:) = trn(:,:,:,jpfer)  
     285          biron(:,:,:) = trb(:,:,:,jpfer)  
    297286      ENDIF 
    298287 
    299288      !  Output of some diagnostics variables 
    300289      !     --------------------------------- 
    301       IF( ln_diatrc .AND. lk_iomput ) THEN 
    302          IF( jnt == nrdttrc ) THEN 
    303             CALL iom_put("Fe3"    , zFe3   (:,:,:)       * tmask(:,:,:) )   ! Fe3+ 
    304             CALL iom_put("FeL1"   , zFeL1  (:,:,:)       * tmask(:,:,:) )   ! FeL1 
    305             CALL iom_put("TL1"    , zTL1   (:,:,:)       * tmask(:,:,:) )   ! TL1 
    306             CALL iom_put("Totlig" , ztotlig(:,:,:)       * tmask(:,:,:) )   ! TL 
    307             CALL iom_put("Biron"  , biron  (:,:,:) * 1e9 * tmask(:,:,:) )   ! biron 
    308             IF( ln_fechem ) THEN 
    309                CALL iom_put("Fe2" , zFe2   (:,:,:)       * tmask(:,:,:) )   ! Fe2+ 
    310                CALL iom_put("FeL2", zFeL2  (:,:,:)       * tmask(:,:,:) )   ! FeL2 
    311                CALL iom_put("FeP" , zFeP   (:,:,:)       * tmask(:,:,:) )   ! FeP 
    312                CALL iom_put("TL2" , zTL2   (:,:,:)       * tmask(:,:,:) )   ! TL2 
    313             ENDIF 
     290      IF( lk_iomput .AND. knt == nrdttrc ) THEN 
     291         IF( iom_use("Fe3")    )  CALL iom_put("Fe3"    , zFe3   (:,:,:)       * tmask(:,:,:) )   ! Fe3+ 
     292         IF( iom_use("FeL1")   )  CALL iom_put("FeL1"   , zFeL1  (:,:,:)       * tmask(:,:,:) )   ! FeL1 
     293         IF( iom_use("TL1")    )  CALL iom_put("TL1"    , zTL1   (:,:,:)       * tmask(:,:,:) )   ! TL1 
     294         IF( iom_use("Totlig") )  CALL iom_put("Totlig" , ztotlig(:,:,:)       * tmask(:,:,:) )   ! TL 
     295         IF( iom_use("Biron")  )  CALL iom_put("Biron"  , biron  (:,:,:) * 1e9 * tmask(:,:,:) )   ! biron 
     296         IF( ln_fechem ) THEN 
     297            IF( iom_use("Fe2")  ) CALL iom_put("Fe2"    , zFe2   (:,:,:)       * tmask(:,:,:) )   ! Fe2+ 
     298            IF( iom_use("FeL2") ) CALL iom_put("FeL2"   , zFeL2  (:,:,:)       * tmask(:,:,:) )   ! FeL2 
     299            IF( iom_use("FeP")  ) CALL iom_put("FeP"    , zFeP   (:,:,:)       * tmask(:,:,:) )   ! FeP 
     300            IF( iom_use("TL2")  ) CALL iom_put("TL2"    , zTL2   (:,:,:)       * tmask(:,:,:) )   ! TL2 
    314301         ENDIF 
    315302      ENDIF 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zflx.F90

    • Property svn:keywords set to Id
    r4624 r6225  
    5959   REAL(wp) ::  xconv  = 0.01_wp / 3600._wp !: coefficients for conversion  
    6060 
    61    !!* Substitution 
    62 #  include "top_substitute.h90" 
    6361   !!---------------------------------------------------------------------- 
    6462   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    65    !! $Id: p4zflx.F90 3294 2012-01-28 16:44:18Z rblod $  
     63   !! $Id$  
    6664   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    6765   !!---------------------------------------------------------------------- 
    6866CONTAINS 
    6967 
    70    SUBROUTINE p4z_flx ( kt ) 
     68   SUBROUTINE p4z_flx ( kt, knt ) 
    7169      !!--------------------------------------------------------------------- 
    7270      !!                     ***  ROUTINE p4z_flx  *** 
     
    8179      !!--------------------------------------------------------------------- 
    8280      ! 
    83       INTEGER, INTENT(in) ::   kt   ! 
     81      INTEGER, INTENT(in) ::   kt, knt   ! 
    8482      ! 
    8583      INTEGER  ::   ji, jj, jm, iind, iindm1 
     
    8987      REAL(wp) ::   zyr_dec, zdco2dt 
    9088      CHARACTER (len=25) :: charout 
    91       REAL(wp), POINTER, DIMENSION(:,:) :: zkgco2, zkgo2, zh2co3, zoflx  
     89      REAL(wp), POINTER, DIMENSION(:,:) :: zkgco2, zkgo2, zh2co3, zoflx, zw2d  
    9290      !!--------------------------------------------------------------------- 
    9391      ! 
     
    10199      !     IS USED TO COMPUTE AIR-SEA FLUX OF CO2 
    102100 
    103       IF( kt /= nit000 ) CALL p4z_patm( kt )    ! Get sea-level pressure (E&K [1981] climatology) for use in flux calcs 
     101      IF( kt /= nit000 .AND. knt == 1 ) CALL p4z_patm( kt )    ! Get sea-level pressure (E&K [1981] climatology) for use in flux calcs 
    104102 
    105103      IF( ln_co2int ) THEN  
     
    122120 
    123121      DO jm = 1, 10 
    124 !CDIR NOVERRCHK 
    125122         DO jj = 1, jpj 
    126 !CDIR NOVERRCHK 
    127123            DO ji = 1, jpi 
    128124 
     
    130126               zbot  = borat(ji,jj,1) 
    131127               zfact = rhop(ji,jj,1) / 1000. + rtrn 
    132                zdic  = trn(ji,jj,1,jpdic) / zfact 
     128               zdic  = trb(ji,jj,1,jpdic) / zfact 
    133129               zph   = MAX( hi(ji,jj,1), 1.e-10 ) / zfact 
    134                zalka = trn(ji,jj,1,jptal) / zfact 
     130               zalka = trb(ji,jj,1,jptal) / zfact 
    135131 
    136132               ! CALCULATE [ALK]([CO3--], [HCO3-]) 
     
    155151      ! ------------------------------------------- 
    156152 
    157 !CDIR NOVERRCHK 
    158153      DO jj = 1, jpj 
    159 !CDIR NOVERRCHK 
    160154         DO ji = 1, jpi 
    161155            ztc  = MIN( 35., tsn(ji,jj,1,jp_tem) ) 
     
    184178            zfld = satmco2(ji,jj) * patm(ji,jj) * tmask(ji,jj,1) * chemc(ji,jj,1) * zkgco2(ji,jj)   ! (mol/L) * (m/s) 
    185179            zflu = zh2co3(ji,jj) * tmask(ji,jj,1) * zkgco2(ji,jj)                                   ! (mol/L) (m/s) ? 
    186             oce_co2(ji,jj) = ( zfld - zflu ) * rfact * e1e2t(ji,jj) * tmask(ji,jj,1) * 1000. 
     180            oce_co2(ji,jj) = ( zfld - zflu ) * rfact2 * e1e2t(ji,jj) * tmask(ji,jj,1) * 1000. 
    187181            ! compute the trend 
    188             tra(ji,jj,1,jpdic) = tra(ji,jj,1,jpdic) + ( zfld - zflu ) / fse3t(ji,jj,1) 
     182            tra(ji,jj,1,jpdic) = tra(ji,jj,1,jpdic) + ( zfld - zflu ) * rfact2 / e3t_n(ji,jj,1) 
    189183 
    190184            ! Compute O2 flux  
    191185            zfld16 = atcox * patm(ji,jj) * chemc(ji,jj,2) * tmask(ji,jj,1) * zkgo2(ji,jj)          ! (mol/L) * (m/s) 
    192             zflu16 = trn(ji,jj,1,jpoxy) * tmask(ji,jj,1) * zkgo2(ji,jj) 
     186            zflu16 = trb(ji,jj,1,jpoxy) * tmask(ji,jj,1) * zkgo2(ji,jj) 
    193187            zoflx(ji,jj) = zfld16 - zflu16 
    194             tra(ji,jj,1,jpoxy) = tra(ji,jj,1,jpoxy) + zoflx(ji,jj) / fse3t(ji,jj,1) 
     188            tra(ji,jj,1,jpoxy) = tra(ji,jj,1,jpoxy) + zoflx(ji,jj) * rfact2 / e3t_n(ji,jj,1) 
    195189         END DO 
    196190      END DO 
    197191 
    198       t_oce_co2_flx = t_oce_co2_flx + glob_sum( oce_co2(:,:) )      ! Cumulative Total Flux of Carbon 
    199       t_atm_co2_flx = glob_sum( satmco2(:,:) * e1e2t(:,:) )         ! Total atmospheric pCO2 
    200  
     192      t_oce_co2_flx     = glob_sum( oce_co2(:,:) )                    !  Total Flux of Carbon 
     193      t_oce_co2_flx_cum = t_oce_co2_flx_cum + t_oce_co2_flx       !  Cumulative Total Flux of Carbon 
     194!      t_atm_co2_flx     = glob_sum( satmco2(:,:) * e1e2t(:,:) )       ! Total atmospheric pCO2 
     195      t_atm_co2_flx     =  atcco2      ! Total atmospheric pCO2 
     196  
    201197      IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
    202198         WRITE(charout, FMT="('flx ')") 
     
    205201      ENDIF 
    206202 
    207       IF( ln_diatrc ) THEN 
    208          IF( lk_iomput ) THEN 
    209             CALL iom_put( "Cflx" , oce_co2(:,:) / e1e2t(:,:) / rfact )  
    210             CALL iom_put( "Oflx" , zoflx(:,:) * 1000 * tmask(:,:,1)  ) 
    211             CALL iom_put( "Kg"   , zkgco2(:,:) * tmask(:,:,1) ) 
    212             CALL iom_put( "Dpco2", ( satmco2(:,:) * patm(:,:) - zh2co3(:,:) / ( chemc(:,:,1) + rtrn ) ) * tmask(:,:,1) ) 
    213             CALL iom_put( "Dpo2" , ( atcox * patm(:,:) - trn(:,:,1,jpoxy) / ( chemc(:,:,2) + rtrn ) ) * tmask(:,:,1) ) 
    214          ELSE 
    215             trc2d(:,:,jp_pcs0_2d    ) = oce_co2(:,:) / e1e2t(:,:) / rfact  
     203      IF( lk_iomput .AND. knt == nrdttrc ) THEN 
     204         CALL wrk_alloc( jpi, jpj, zw2d )   
     205         IF( iom_use( "Cflx"  ) )  THEN 
     206            zw2d(:,:) = oce_co2(:,:) / e1e2t(:,:) * rfact2r 
     207            CALL iom_put( "Cflx"     , zw2d )  
     208         ENDIF 
     209         IF( iom_use( "Oflx"  ) )  THEN 
     210            zw2d(:,:) =  zoflx(:,:) * 1000 * tmask(:,:,1) 
     211            CALL iom_put( "Oflx" , zw2d ) 
     212         ENDIF 
     213         IF( iom_use( "Kg"    ) )  THEN 
     214            zw2d(:,:) =  zkgco2(:,:) * tmask(:,:,1) 
     215            CALL iom_put( "Kg"   , zw2d ) 
     216         ENDIF 
     217         IF( iom_use( "Dpco2" ) ) THEN 
     218           zw2d(:,:) = ( satmco2(:,:) * patm(:,:) - zh2co3(:,:) / ( chemc(:,:,1) + rtrn ) ) * tmask(:,:,1) 
     219           CALL iom_put( "Dpco2" ,  zw2d ) 
     220         ENDIF 
     221         IF( iom_use( "Dpo2" ) )  THEN 
     222           zw2d(:,:) = ( atcox * patm(:,:) - trb(:,:,1,jpoxy) / ( chemc(:,:,2) + rtrn ) ) * tmask(:,:,1) 
     223           CALL iom_put( "Dpo2"  , zw2d ) 
     224         ENDIF 
     225         IF( iom_use( "tcflx" ) )  CALL iom_put( "tcflx"    , t_oce_co2_flx * rfact2r )   ! molC/s 
     226         CALL iom_put( "tcflxcum" , t_oce_co2_flx_cum )      ! molC 
     227         ! 
     228         CALL wrk_dealloc( jpi, jpj, zw2d ) 
     229      ELSE 
     230         IF( ln_diatrc ) THEN 
     231            trc2d(:,:,jp_pcs0_2d    ) = oce_co2(:,:) / e1e2t(:,:) * rfact2r  
    216232            trc2d(:,:,jp_pcs0_2d + 1) = zoflx(:,:) * 1000 * tmask(:,:,1)  
    217233            trc2d(:,:,jp_pcs0_2d + 2) = zkgco2(:,:) * tmask(:,:,1)  
     
    290306      ! 
    291307      oce_co2(:,:)  = 0._wp                ! Initialization of Flux of Carbon 
     308      t_oce_co2_flx = 0._wp 
    292309      t_atm_co2_flx = 0._wp 
    293       t_oce_co2_flx = 0._wp 
    294310      ! 
    295311      CALL p4z_patm( nit000 ) 
     
    378394 
    379395   !!====================================================================== 
    380 END MODULE  p4zflx 
     396END MODULE p4zflx 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zint.F90

    • Property svn:keywords set to Id
    r3446 r6225  
    2626   !!---------------------------------------------------------------------- 
    2727   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    28    !! $Id: p4zint.F90 3294 2012-01-28 16:44:18Z rblod $  
     28   !! $Id$  
    2929   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    3030   !!---------------------------------------------------------------------- 
     
    5656      DO ji = 1, jpi 
    5757         DO jj = 1, jpj 
    58             zvar = trn(ji,jj,1,jpsil) * trn(ji,jj,1,jpsil) 
     58            zvar = trb(ji,jj,1,jpsil) * trb(ji,jj,1,jpsil) 
    5959            xksimax(ji,jj) = MAX( xksimax(ji,jj), ( 1.+ 7.* zvar / ( xksilim * xksilim + zvar ) ) * 1e-6 ) 
    6060         END DO 
     
    8181 
    8282   !!====================================================================== 
    83 END MODULE  p4zint 
     83END MODULE p4zint 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlim.F90

    r4624 r6225  
    5252   REAL(wp) ::  xcoef2   = 1.21E-5 * 14. / 55.85 / 7.625 * 0.5 * 1.5 
    5353   REAL(wp) ::  xcoef3   = 1.15E-4 * 14. / 55.85 / 7.625 * 0.5  
    54    !!* Substitution 
    55 #  include "top_substitute.h90" 
     54 
    5655   !!---------------------------------------------------------------------- 
    5756   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    6261CONTAINS 
    6362 
    64    SUBROUTINE p4z_lim( kt, jnt ) 
     63   SUBROUTINE p4z_lim( kt, knt ) 
    6564      !!--------------------------------------------------------------------- 
    6665      !!                     ***  ROUTINE p4z_lim  *** 
     
    7271      !!--------------------------------------------------------------------- 
    7372      ! 
    74       INTEGER, INTENT(in)  :: kt, jnt 
     73      INTEGER, INTENT(in)  :: kt, knt 
    7574      ! 
    7675      INTEGER  ::   ji, jj, jk 
    7776      REAL(wp) ::   zlim1, zlim2, zlim3, zlim4, zno3, zferlim 
    7877      REAL(wp) ::   zconcd, zconcd2, zconcn, zconcn2 
    79       REAL(wp) ::   z1_trndia, z1_trnphy, ztem1, ztem2, zetot1, zetot2 
     78      REAL(wp) ::   z1_trbdia, z1_trbphy, ztem1, ztem2, zetot1, zetot2 
    8079      REAL(wp) ::   zdenom, zratio, zironmin 
    8180      REAL(wp) ::   zconc1d, zconc1dnh4, zconc0n, zconc0nnh4    
     
    9089               ! Tuning of the iron concentration to a minimum level that is set to the detection limit 
    9190               !------------------------------------- 
    92                zno3    = trn(ji,jj,jk,jpno3) / 40.e-6 
     91               zno3    = trb(ji,jj,jk,jpno3) / 40.e-6 
    9392               zferlim = MAX( 3e-11 * zno3 * zno3, 5e-12 ) 
    9493               zferlim = MIN( zferlim, 7e-11 ) 
    95                trn(ji,jj,jk,jpfer) = MAX( trn(ji,jj,jk,jpfer), zferlim ) 
     94               trb(ji,jj,jk,jpfer) = MAX( trb(ji,jj,jk,jpfer), zferlim ) 
    9695 
    9796               ! Computation of a variable Ks for iron on diatoms taking into account 
    9897               ! that increasing biomass is made of generally bigger cells 
    9998               !------------------------------------------------ 
    100                zconcd   = MAX( 0.e0 , trn(ji,jj,jk,jpdia) - xsizedia ) 
    101                zconcd2  = trn(ji,jj,jk,jpdia) - zconcd 
    102                zconcn   = MAX( 0.e0 , trn(ji,jj,jk,jpphy) - xsizephy ) 
    103                zconcn2  = trn(ji,jj,jk,jpphy) - zconcn 
    104                z1_trnphy   = 1. / ( trn(ji,jj,jk,jpphy) + rtrn ) 
    105                z1_trndia   = 1. / ( trn(ji,jj,jk,jpdia) + rtrn ) 
    106  
    107                concdfe(ji,jj,jk) = MAX( concdfer, ( zconcd2 * concdfer + concdfer * xsizerd * zconcd ) * z1_trndia ) 
    108                zconc1d           = MAX( concdno3, ( zconcd2 * concdno3 + concdno3 * xsizerd * zconcd ) * z1_trndia ) 
    109                zconc1dnh4        = MAX( concdnh4, ( zconcd2 * concdnh4 + concdnh4 * xsizerd * zconcd ) * z1_trndia ) 
    110  
    111                concnfe(ji,jj,jk) = MAX( concnfer, ( zconcn2 * concnfer + concnfer * xsizern * zconcn ) * z1_trnphy ) 
    112                zconc0n           = MAX( concnno3, ( zconcn2 * concnno3 + concnno3 * xsizern * zconcn ) * z1_trnphy ) 
    113                zconc0nnh4        = MAX( concnnh4, ( zconcn2 * concnnh4 + concnnh4 * xsizern * zconcn ) * z1_trnphy ) 
     99               zconcd   = MAX( 0.e0 , trb(ji,jj,jk,jpdia) - xsizedia ) 
     100               zconcd2  = trb(ji,jj,jk,jpdia) - zconcd 
     101               zconcn   = MAX( 0.e0 , trb(ji,jj,jk,jpphy) - xsizephy ) 
     102               zconcn2  = trb(ji,jj,jk,jpphy) - zconcn 
     103               z1_trbphy   = 1. / ( trb(ji,jj,jk,jpphy) + rtrn ) 
     104               z1_trbdia   = 1. / ( trb(ji,jj,jk,jpdia) + rtrn ) 
     105 
     106               concdfe(ji,jj,jk) = MAX( concdfer, ( zconcd2 * concdfer + concdfer * xsizerd * zconcd ) * z1_trbdia ) 
     107               zconc1d           = MAX( concdno3, ( zconcd2 * concdno3 + concdno3 * xsizerd * zconcd ) * z1_trbdia ) 
     108               zconc1dnh4        = MAX( concdnh4, ( zconcd2 * concdnh4 + concdnh4 * xsizerd * zconcd ) * z1_trbdia ) 
     109 
     110               concnfe(ji,jj,jk) = MAX( concnfer, ( zconcn2 * concnfer + concnfer * xsizern * zconcn ) * z1_trbphy ) 
     111               zconc0n           = MAX( concnno3, ( zconcn2 * concnno3 + concnno3 * xsizern * zconcn ) * z1_trbphy ) 
     112               zconc0nnh4        = MAX( concnnh4, ( zconcn2 * concnnh4 + concnnh4 * xsizern * zconcn ) * z1_trbphy ) 
    114113 
    115114               ! Michaelis-Menten Limitation term for nutrients Small bacteria 
    116115               ! ------------------------------------------------------------- 
    117                zdenom = 1. /  ( concbno3 * concbnh4 + concbnh4 * trn(ji,jj,jk,jpno3) + concbno3 * trn(ji,jj,jk,jpnh4) ) 
    118                xnanono3(ji,jj,jk) = trn(ji,jj,jk,jpno3) * concbnh4 * zdenom 
    119                xnanonh4(ji,jj,jk) = trn(ji,jj,jk,jpnh4) * concbno3 * zdenom 
     116               zdenom = 1. /  ( concbno3 * concbnh4 + concbnh4 * trb(ji,jj,jk,jpno3) + concbno3 * trb(ji,jj,jk,jpnh4) ) 
     117               xnanono3(ji,jj,jk) = trb(ji,jj,jk,jpno3) * concbnh4 * zdenom 
     118               xnanonh4(ji,jj,jk) = trb(ji,jj,jk,jpnh4) * concbno3 * zdenom 
    120119               ! 
    121120               zlim1    = xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk) 
    122                zlim2    = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + concbnh4 ) 
    123                zlim3    = trn(ji,jj,jk,jpfer) / ( concbfe + trn(ji,jj,jk,jpfer) ) 
    124                zlim4    = trn(ji,jj,jk,jpdoc) / ( xkdoc   + trn(ji,jj,jk,jpdoc) ) 
     121               zlim2    = trb(ji,jj,jk,jppo4) / ( trb(ji,jj,jk,jppo4) + concbnh4 ) 
     122               zlim3    = trb(ji,jj,jk,jpfer) / ( concbfe + trb(ji,jj,jk,jpfer) ) 
     123               zlim4    = trb(ji,jj,jk,jpdoc) / ( xkdoc   + trb(ji,jj,jk,jpdoc) ) 
    125124               xlimbacl(ji,jj,jk) = MIN( zlim1, zlim2, zlim3 ) 
    126125               xlimbac (ji,jj,jk) = MIN( zlim1, zlim2, zlim3 ) * zlim4 
     
    128127               ! Michaelis-Menten Limitation term for nutrients Small flagellates 
    129128               ! ----------------------------------------------- 
    130                zdenom = 1. /  ( zconc0n * zconc0nnh4 + zconc0nnh4 * trn(ji,jj,jk,jpno3) + zconc0n * trn(ji,jj,jk,jpnh4) ) 
    131                xnanono3(ji,jj,jk) = trn(ji,jj,jk,jpno3) * zconc0nnh4 * zdenom 
    132                xnanonh4(ji,jj,jk) = trn(ji,jj,jk,jpnh4) * zconc0n    * zdenom 
     129               zdenom = 1. /  ( zconc0n * zconc0nnh4 + zconc0nnh4 * trb(ji,jj,jk,jpno3) + zconc0n * trb(ji,jj,jk,jpnh4) ) 
     130               xnanono3(ji,jj,jk) = trb(ji,jj,jk,jpno3) * zconc0nnh4 * zdenom 
     131               xnanonh4(ji,jj,jk) = trb(ji,jj,jk,jpnh4) * zconc0n    * zdenom 
    133132               ! 
    134133               zlim1    = xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk) 
    135                zlim2    = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + zconc0nnh4 ) 
    136                zratio   = trn(ji,jj,jk,jpnfe) * z1_trnphy  
    137                zironmin = xcoef1 * trn(ji,jj,jk,jpnch) * z1_trnphy + xcoef2 * zlim1 + xcoef3 * xnanono3(ji,jj,jk) 
     134               zlim2    = trb(ji,jj,jk,jppo4) / ( trb(ji,jj,jk,jppo4) + zconc0nnh4 ) 
     135               zratio   = trb(ji,jj,jk,jpnfe) * z1_trbphy  
     136               zironmin = xcoef1 * trb(ji,jj,jk,jpnch) * z1_trbphy + xcoef2 * zlim1 + xcoef3 * xnanono3(ji,jj,jk) 
    138137               zlim3    = MAX( 0.,( zratio - zironmin ) / qnfelim ) 
    139138               xnanopo4(ji,jj,jk) = zlim2 
     
    143142               !   Michaelis-Menten Limitation term for nutrients Diatoms 
    144143               !   ---------------------------------------------- 
    145                zdenom   = 1. / ( zconc1d * zconc1dnh4 + zconc1dnh4 * trn(ji,jj,jk,jpno3) + zconc1d * trn(ji,jj,jk,jpnh4) ) 
    146                xdiatno3(ji,jj,jk) = trn(ji,jj,jk,jpno3) * zconc1dnh4 * zdenom 
    147                xdiatnh4(ji,jj,jk) = trn(ji,jj,jk,jpnh4) * zconc1d    * zdenom 
     144               zdenom   = 1. / ( zconc1d * zconc1dnh4 + zconc1dnh4 * trb(ji,jj,jk,jpno3) + zconc1d * trb(ji,jj,jk,jpnh4) ) 
     145               xdiatno3(ji,jj,jk) = trb(ji,jj,jk,jpno3) * zconc1dnh4 * zdenom 
     146               xdiatnh4(ji,jj,jk) = trb(ji,jj,jk,jpnh4) * zconc1d    * zdenom 
    148147               ! 
    149148               zlim1    = xdiatno3(ji,jj,jk) + xdiatnh4(ji,jj,jk) 
    150                zlim2    = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + zconc1dnh4  ) 
    151                zlim3    = trn(ji,jj,jk,jpsil) / ( trn(ji,jj,jk,jpsil) + xksi(ji,jj) ) 
    152                zratio   = trn(ji,jj,jk,jpdfe) * z1_trndia 
    153                zironmin = xcoef1 * trn(ji,jj,jk,jpdch) * z1_trndia + xcoef2 * zlim1 + xcoef3 * xdiatno3(ji,jj,jk) 
     149               zlim2    = trb(ji,jj,jk,jppo4) / ( trb(ji,jj,jk,jppo4) + zconc1dnh4  ) 
     150               zlim3    = trb(ji,jj,jk,jpsil) / ( trb(ji,jj,jk,jpsil) + xksi(ji,jj) ) 
     151               zratio   = trb(ji,jj,jk,jpdfe) * z1_trbdia 
     152               zironmin = xcoef1 * trb(ji,jj,jk,jpdch) * z1_trbdia + xcoef2 * zlim1 + xcoef3 * xdiatno3(ji,jj,jk) 
    154153               zlim4    = MAX( 0., ( zratio - zironmin ) / qdfelim ) 
    155154               xdiatpo4(ji,jj,jk) = zlim2 
     
    166165         DO jj = 1, jpj 
    167166            DO ji = 1, jpi 
    168                zlim1 =  ( trn(ji,jj,jk,jpno3) * concnnh4 + trn(ji,jj,jk,jpnh4) * concnno3 )    & 
    169                   &   / ( concnno3 * concnnh4 + concnnh4 * trn(ji,jj,jk,jpno3) + concnno3 * trn(ji,jj,jk,jpnh4) )  
    170                zlim2  = trn(ji,jj,jk,jppo4) / ( trn(ji,jj,jk,jppo4) + concnnh4 ) 
    171                zlim3  = trn(ji,jj,jk,jpfer) / ( trn(ji,jj,jk,jpfer) +  5.E-11   ) 
     167               zlim1 =  ( trb(ji,jj,jk,jpno3) * concnnh4 + trb(ji,jj,jk,jpnh4) * concnno3 )    & 
     168                  &   / ( concnno3 * concnnh4 + concnnh4 * trb(ji,jj,jk,jpno3) + concnno3 * trb(ji,jj,jk,jpnh4) )  
     169               zlim2  = trb(ji,jj,jk,jppo4) / ( trb(ji,jj,jk,jppo4) + concnnh4 ) 
     170               zlim3  = trb(ji,jj,jk,jpfer) / ( trb(ji,jj,jk,jpfer) +  5.E-11   ) 
    172171               ztem1  = MAX( 0., tsn(ji,jj,jk,jp_tem) ) 
    173172               ztem2  = tsn(ji,jj,jk,jp_tem) - 10. 
    174                zetot1 = MAX( 0., etot(ji,jj,jk) - 1.) / ( 4. + etot(ji,jj,jk) )  
    175                zetot2 = 30. / ( 30. + etot(ji,jj,jk) )  
     173               zetot1 = MAX( 0., etot_ndcy(ji,jj,jk) - 1.) / ( 4. + etot_ndcy(ji,jj,jk) )  
     174               zetot2 = 30. / ( 30. + etot_ndcy(ji,jj,jk) )  
    176175 
    177176               xfracal(ji,jj,jk) = caco3r * MIN( zlim1, zlim2, zlim3 )                  & 
    178177                  &                       * ztem1 / ( 0.1 + ztem1 )                     & 
    179                   &                       * MAX( 1., trn(ji,jj,jk,jpphy) * 1.e6 / 2. )  & 
     178                  &                       * MAX( 1., trb(ji,jj,jk,jpphy) * 1.e6 / 2. )  & 
    180179                  &                       * zetot1 * zetot2               & 
    181180                  &                       * ( 1. + EXP(-ztem2 * ztem2 / 25. ) )         & 
     
    187186      END DO 
    188187      ! 
    189       IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc ) THEN        ! save output diagnostics 
    190         ! 
    191         CALL iom_put( "xfracal", xfracal(:,:,:) * tmask(:,:,:) )  ! euphotic layer deptht 
    192         CALL iom_put( "LNnut"  , xlimphy(:,:,:) * tmask(:,:,:) )  ! Nutrient limitation term 
    193         CALL iom_put( "LDnut"  , xlimdia(:,:,:) * tmask(:,:,:) )  ! Nutrient limitation term 
    194         CALL iom_put( "LNFe"   , xlimnfe(:,:,:) * tmask(:,:,:) )  ! Iron limitation term 
    195         CALL iom_put( "LDFe"   , xlimdfe(:,:,:) * tmask(:,:,:) )  ! Iron limitation term 
    196         ! 
     188      ! 
     189      IF( lk_iomput .AND. knt == nrdttrc ) THEN        ! save output diagnostics 
     190        IF( iom_use( "xfracal" ) ) CALL iom_put( "xfracal", xfracal(:,:,:) * tmask(:,:,:) )  ! euphotic layer deptht 
     191        IF( iom_use( "LNnut"   ) ) CALL iom_put( "LNnut"  , xlimphy(:,:,:) * tmask(:,:,:) )  ! Nutrient limitation term 
     192        IF( iom_use( "LDnut"   ) ) CALL iom_put( "LDnut"  , xlimdia(:,:,:) * tmask(:,:,:) )  ! Nutrient limitation term 
     193        IF( iom_use( "LNFe"    ) ) CALL iom_put( "LNFe"   , xlimnfe(:,:,:) * tmask(:,:,:) )  ! Iron limitation term 
     194        IF( iom_use( "LDFe"    ) ) CALL iom_put( "LDFe"   , xlimdfe(:,:,:) * tmask(:,:,:) )  ! Iron limitation term 
    197195      ENDIF 
    198  
    199196      ! 
    200197      IF( nn_timing == 1 )  CALL timing_stop('p4z_lim') 
     
    267264 
    268265   !!====================================================================== 
    269 END MODULE  p4zlim 
     266END MODULE p4zlim 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlys.F90

    r4624 r6225  
    4848CONTAINS 
    4949 
    50    SUBROUTINE p4z_lys( kt ) 
     50   SUBROUTINE p4z_lys( kt, knt ) 
    5151      !!--------------------------------------------------------------------- 
    5252      !!                     ***  ROUTINE p4z_lys  *** 
     
    5959      !!--------------------------------------------------------------------- 
    6060      ! 
    61       INTEGER, INTENT(in) ::   kt ! ocean time step 
     61      INTEGER, INTENT(in) ::   kt, knt ! ocean time step 
    6262      INTEGER  ::   ji, jj, jk, jn 
    6363      REAL(wp) ::   zalk, zdic, zph, zah2 
    6464      REAL(wp) ::   zdispot, zfact, zcalcon, zalka, zaldi 
    6565      REAL(wp) ::   zomegaca, zexcess, zexcess0 
    66       REAL(wp) ::   zrfact2 
    6766      CHARACTER (len=25) :: charout 
    6867      REAL(wp), POINTER, DIMENSION(:,:,:) :: zco3, zcaldiss    
     
    8180      DO jn = 1, 5                               !  BEGIN OF ITERATION 
    8281         ! 
    83 !CDIR NOVERRCHK 
    8482         DO jk = 1, jpkm1 
    85 !CDIR NOVERRCHK 
    8683            DO jj = 1, jpj 
    87 !CDIR NOVERRCHK 
    8884               DO ji = 1, jpi 
    8985                  zfact = rhop(ji,jj,jk) / 1000. + rtrn 
    9086                  zph  = hi(ji,jj,jk) * tmask(ji,jj,jk) / zfact + ( 1.-tmask(ji,jj,jk) ) * 1.e-9 ! [H+] 
    91                   zdic  = trn(ji,jj,jk,jpdic) / zfact 
    92                   zalka = trn(ji,jj,jk,jptal) / zfact 
     87                  zdic  = trb(ji,jj,jk,jpdic) / zfact 
     88                  zalka = trb(ji,jj,jk,jptal) / zfact 
    9389                  ! CALCULATE [ALK]([CO3--], [HCO3-]) 
    9490                  zalk  = zalka - ( akw3(ji,jj,jk) / zph - zph + borat(ji,jj,jk) / ( 1. + zph / akb3(ji,jj,jk) ) ) 
     
    130126               !       (ACCORDING TO THIS FORMULATION ALSO SOME PARTICULATE 
    131127               !       CACO3 GETS DISSOLVED EVEN IN THE CASE OF OVERSATURATION) 
    132                zdispot = kdca * zexcess * trn(ji,jj,jk,jpcal) 
     128               zdispot = kdca * zexcess * trb(ji,jj,jk,jpcal) 
    133129# if defined key_degrad 
    134130               zdispot = zdispot * facvol(ji,jj,jk) 
     
    136132              !  CHANGE OF [CO3--] , [ALK], PARTICULATE [CACO3], 
    137133              !       AND [SUM(CO2)] DUE TO CACO3 DISSOLUTION/PRECIPITATION 
    138               zcaldiss(ji,jj,jk)  = zdispot / rmtss ! calcite dissolution 
    139               zco3(ji,jj,jk)      = zco3(ji,jj,jk) + zcaldiss(ji,jj,jk) * rfact 
     134              zcaldiss(ji,jj,jk)  = zdispot * rfact2 / rmtss ! calcite dissolution 
     135              zco3(ji,jj,jk)      = zco3(ji,jj,jk) + zcaldiss(ji,jj,jk) 
    140136              ! 
    141137              tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + 2. * zcaldiss(ji,jj,jk) 
     
    146142      END DO 
    147143      ! 
    148       IF( ln_diatrc )  THEN 
    149          ! 
    150          IF( lk_iomput ) THEN 
    151             zrfact2 = 1.e3 * rfact2r 
    152             CALL iom_put( "PH"    , -1. * LOG10( hi(:,:,:) )                * tmask(:,:,:) ) 
    153             CALL iom_put( "CO3"   ,        zco3    (:,:,:) * 1e+3           * tmask(:,:,:) ) 
    154             CALL iom_put( "CO3sat",        aksp    (:,:,:) * 1e+3 / calcon  * tmask(:,:,:) ) 
    155             CALL iom_put( "DCAL"  ,        zcaldiss(:,:,:) * zrfact2        * tmask(:,:,:) ) 
    156          ELSE 
    157             trc3d(:,:,:,jp_pcs0_3d    ) = -1. * LOG10( hi(:,:,:) ) * tmask(:,:,:) 
    158             trc3d(:,:,:,jp_pcs0_3d + 1) = zco3(:,:,:)              * tmask(:,:,:) 
    159             trc3d(:,:,:,jp_pcs0_3d + 2) = aksp(:,:,:) / calcon     * tmask(:,:,:) 
    160          ENDIF 
    161          ! 
     144 
     145      IF( lk_iomput .AND. knt == nrdttrc ) THEN 
     146         IF( iom_use( "PH"     ) ) CALL iom_put( "PH"    , -1. * LOG10( hi(:,:,:) )          * tmask(:,:,:) ) 
     147         IF( iom_use( "CO3"    ) ) CALL iom_put( "CO3"   , zco3(:,:,:) * 1.e+3               * tmask(:,:,:) ) 
     148         IF( iom_use( "CO3sat" ) ) CALL iom_put( "CO3sat", aksp(:,:,:) * 1.e+3 / calcon      * tmask(:,:,:) ) 
     149         IF( iom_use( "DCAL"   ) ) CALL iom_put( "DCAL"  , zcaldiss(:,:,:) * 1.e+3 * rfact2r   * tmask(:,:,:) ) 
     150      ELSE 
     151         trc3d(:,:,:,jp_pcs0_3d    ) = -1. * LOG10( hi(:,:,:) ) * tmask(:,:,:) 
     152         trc3d(:,:,:,jp_pcs0_3d + 1) = zco3(:,:,:)              * tmask(:,:,:) 
     153         trc3d(:,:,:,jp_pcs0_3d + 2) = aksp(:,:,:) / calcon     * tmask(:,:,:) 
    162154      ENDIF 
    163155      ! 
     
    228220#endif  
    229221   !!====================================================================== 
    230 END MODULE  p4zlys 
     222END MODULE p4zlys 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmeso.F90

    r4624 r6225  
    5050   REAL(wp), PUBLIC ::  grazflux     !: mesozoo flux feeding rate 
    5151 
    52    !!* Substitution 
    53 #  include "top_substitute.h90" 
    5452   !!---------------------------------------------------------------------- 
    5553   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    6058CONTAINS 
    6159 
    62    SUBROUTINE p4z_meso( kt, jnt ) 
     60   SUBROUTINE p4z_meso( kt, knt ) 
    6361      !!--------------------------------------------------------------------- 
    6462      !!                     ***  ROUTINE p4z_meso  *** 
     
    6866      !! ** Method  : - ??? 
    6967      !!--------------------------------------------------------------------- 
    70       INTEGER, INTENT(in) ::   kt, jnt ! ocean time step 
     68      INTEGER, INTENT(in) ::   kt, knt ! ocean time step 
    7169      INTEGER  :: ji, jj, jk 
    7270      REAL(wp) :: zcompadi, zcompaph, zcompapoc, zcompaz, zcompam 
     
    8381      REAL(wp) :: zgrazfffp, zgrazfffg, zgrazffep, zgrazffeg 
    8482      CHARACTER (len=25) :: charout 
    85       REAL(wp) :: zrfact2 
    86       REAL(wp), POINTER, DIMENSION(:,:,:) :: zgrazing 
     83      REAL(wp), POINTER, DIMENSION(:,:,:) :: zgrazing, zw3d 
    8784 
    8885      !!--------------------------------------------------------------------- 
     
    9087      IF( nn_timing == 1 )  CALL timing_start('p4z_meso') 
    9188      ! 
    92       IF( ln_diatrc .AND. lk_iomput ) THEN 
     89      IF( lk_iomput ) THEN 
    9390         CALL wrk_alloc( jpi, jpj, jpk, zgrazing ) 
    9491         zgrazing(:,:,:) = 0._wp 
     
    9895         DO jj = 1, jpj 
    9996            DO ji = 1, jpi 
    100                zcompam   = MAX( ( trn(ji,jj,jk,jpmes) - 1.e-9 ), 0.e0 ) 
     97               zcompam   = MAX( ( trb(ji,jj,jk,jpmes) - 1.e-9 ), 0.e0 ) 
    10198# if defined key_degrad 
    10299               zstep     = xstep * facvol(ji,jj,jk) 
     
    108105               !  Respiration rates of both zooplankton 
    109106               !  ------------------------------------- 
    110                zrespz2   = resrat2 * zfact * trn(ji,jj,jk,jpmes) / ( xkmort + trn(ji,jj,jk,jpmes) )  & 
     107               zrespz2   = resrat2 * zfact * trb(ji,jj,jk,jpmes) / ( xkmort + trb(ji,jj,jk,jpmes) )  & 
    111108                  &      + resrat2 * zfact * 3. * nitrfac(ji,jj,jk) 
    112109 
     
    114111               !  no real reason except that it seems to be more stable and may mimic predation 
    115112               !  --------------------------------------------------------------- 
    116                ztortz2   = mzrat2 * 1.e6 * zfact * trn(ji,jj,jk,jpmes) 
     113               ztortz2   = mzrat2 * 1.e6 * zfact * trb(ji,jj,jk,jpmes) 
    117114               ! 
    118                zcompadi  = MAX( ( trn(ji,jj,jk,jpdia) - xthresh2dia ), 0.e0 ) 
    119                zcompaz   = MAX( ( trn(ji,jj,jk,jpzoo) - xthresh2zoo ), 0.e0 ) 
     115               zcompadi  = MAX( ( trb(ji,jj,jk,jpdia) - xthresh2dia ), 0.e0 ) 
     116               zcompaz   = MAX( ( trb(ji,jj,jk,jpzoo) - xthresh2zoo ), 0.e0 ) 
    120117               ! Size effect of nanophytoplankton on grazing : the smaller it is, the less prone 
    121118               ! it is to predation by mesozooplankton 
    122119               ! ------------------------------------------------------------------------------- 
    123                zcompaph  = MAX( ( trn(ji,jj,jk,jpphy) - xthresh2phy ), 0.e0 ) & 
     120               zcompaph  = MAX( ( trb(ji,jj,jk,jpphy) - xthresh2phy ), 0.e0 ) & 
    124121                  &      * MIN(1., MAX( 0., ( quotan(ji,jj,jk) - 0.2) / 0.3 ) ) 
    125                zcompapoc = MAX( ( trn(ji,jj,jk,jppoc) - xthresh2poc ), 0.e0 ) 
     122               zcompapoc = MAX( ( trb(ji,jj,jk,jppoc) - xthresh2poc ), 0.e0 ) 
    126123 
    127124               zfood     = xprefc * zcompadi + xprefz * zcompaz + xprefp * zcompaph + xprefpoc * zcompapoc  
     
    129126               zdenom    = zfoodlim / ( xkgraz2 + zfoodlim ) 
    130127               zdenom2   = zdenom / ( zfood + rtrn ) 
    131                zgraze2   = grazrat2 * zstep * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpmes)  
     128               zgraze2   = grazrat2 * zstep * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jpmes)  
    132129 
    133130               zgrazd    = zgraze2  * xprefc   * zcompadi  * zdenom2  
     
    136133               zgrazpoc  = zgraze2  * xprefpoc * zcompapoc * zdenom2  
    137134 
    138                zgraznf   = zgrazn   * trn(ji,jj,jk,jpnfe) / ( trn(ji,jj,jk,jpphy) + rtrn) 
    139                zgrazf    = zgrazd   * trn(ji,jj,jk,jpdfe) / ( trn(ji,jj,jk,jpdia) + rtrn) 
    140                zgrazpof  = zgrazpoc * trn(ji,jj,jk,jpsfe) / ( trn(ji,jj,jk,jppoc) + rtrn) 
     135               zgraznf   = zgrazn   * trb(ji,jj,jk,jpnfe) / ( trb(ji,jj,jk,jpphy) + rtrn) 
     136               zgrazf    = zgrazd   * trb(ji,jj,jk,jpdfe) / ( trb(ji,jj,jk,jpdia) + rtrn) 
     137               zgrazpof  = zgrazpoc * trb(ji,jj,jk,jpsfe) / ( trb(ji,jj,jk,jppoc) + rtrn) 
    141138 
    142139               !  Mesozooplankton flux feeding on GOC 
     
    145142# if ! defined key_kriest 
    146143               zgrazffeg = grazflux  * zstep * wsbio4(ji,jj,jk)      & 
    147                &           * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpgoc) * trn(ji,jj,jk,jpmes) 
    148                zgrazfffg = zgrazffeg * trn(ji,jj,jk,jpbfe) / (trn(ji,jj,jk,jpgoc) + rtrn) 
     144               &           * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jpgoc) * trb(ji,jj,jk,jpmes) 
     145               zgrazfffg = zgrazffeg * trb(ji,jj,jk,jpbfe) / (trb(ji,jj,jk,jpgoc) + rtrn) 
    149146# endif 
    150147               zgrazffep = grazflux  * zstep *  wsbio3(ji,jj,jk)     & 
    151                &           * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpmes) 
    152                zgrazfffp = zgrazffep * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn) 
     148               &           * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jpmes) 
     149               zgrazfffp = zgrazffep * trb(ji,jj,jk,jpsfe) / (trb(ji,jj,jk,jppoc) + rtrn) 
    153150              ! 
    154151# if ! defined key_kriest 
     
    159156              ! diatoms based aggregates are more prone to fractionation 
    160157              ! since they are more porous (marine snow instead of fecal pellets) 
    161               zratio    = trn(ji,jj,jk,jpgsi) / ( trn(ji,jj,jk,jpgoc) + rtrn ) 
     158              zratio    = trb(ji,jj,jk,jpgsi) / ( trb(ji,jj,jk,jpgoc) + rtrn ) 
    162159              zratio2   = zratio * zratio 
    163160              zfrac     = zproport * grazflux  * zstep * wsbio4(ji,jj,jk)      & 
    164                &          * trn(ji,jj,jk,jpgoc) * trn(ji,jj,jk,jpmes)          & 
    165                &          * ( 0.1 + 3.9 * zratio2 / ( 1.**2 + zratio2 ) ) 
    166               zfracfe   = zfrac * trn(ji,jj,jk,jpbfe) / (trn(ji,jj,jk,jpgoc) + rtrn) 
     161               &          * trb(ji,jj,jk,jpgoc) * trb(ji,jj,jk,jpmes)          & 
     162               &          * ( 0.2 + 3.8 * zratio2 / ( 1.**2 + zratio2 ) ) 
     163              zfracfe   = zfrac * trb(ji,jj,jk,jpbfe) / (trb(ji,jj,jk,jpgoc) + rtrn) 
    167164 
    168165              zgrazffep = zproport * zgrazffep 
     
    186183 
    187184              ! Total grazing ( grazing by microzoo is already computed in p4zmicro ) 
    188               IF( ln_diatrc .AND. lk_iomput )  zgrazing(ji,jj,jk) = zgraztot 
     185              IF( lk_iomput )  zgrazing(ji,jj,jk) = zgraztot 
    189186 
    190187              !    Mesozooplankton efficiency 
     
    216213               tra(ji,jj,jk,jpzoo) = tra(ji,jj,jk,jpzoo) - zgrazz 
    217214               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zgrazn 
    218                tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zgrazn * trn(ji,jj,jk,jpnch) / ( trn(ji,jj,jk,jpphy) + rtrn ) 
    219                tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zgrazd * trn(ji,jj,jk,jpdch) / ( trn(ji,jj,jk,jpdia) + rtrn ) 
    220                tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zgrazd * trn(ji,jj,jk,jpdsi) / ( trn(ji,jj,jk,jpdia) + rtrn ) 
    221                tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zgrazd * trn(ji,jj,jk,jpdsi) / ( trn(ji,jj,jk,jpdia) + rtrn ) 
     215               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zgrazn * trb(ji,jj,jk,jpnch) / ( trb(ji,jj,jk,jpphy) + rtrn ) 
     216               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zgrazd * trb(ji,jj,jk,jpdch) / ( trb(ji,jj,jk,jpdia) + rtrn ) 
     217               tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zgrazd * trb(ji,jj,jk,jpdsi) / ( trb(ji,jj,jk,jpdia) + rtrn ) 
     218               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zgrazd * trb(ji,jj,jk,jpdsi) / ( trb(ji,jj,jk,jpdia) + rtrn ) 
    222219               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zgraznf 
    223220               tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zgrazf 
     
    232229               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca 
    233230#if defined key_kriest 
    234               znumpoc = trn(ji,jj,jk,jpnum) / ( trn(ji,jj,jk,jppoc) + rtrn ) 
     231              znumpoc = trb(ji,jj,jk,jpnum) / ( trb(ji,jj,jk,jppoc) + rtrn ) 
    235232              tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortzgoc - zgrazpoc - zgrazffep + zgrapoc2 
    236233              tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) - zgrazpoc * znumpoc + zgrapoc2 * xkr_dmeso      & 
     
    249246      END DO 
    250247      ! 
    251       IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc ) THEN 
    252          zrfact2 = 1.e3 * rfact2r 
    253          CALL iom_put( "GRAZ2", zgrazing(:,:,:) * zrfact2 * tmask(:,:,:) )  ! Total grazing of phyto by zooplankton 
    254          CALL iom_put( "PCAL" , prodcal(:,:,:)  * zrfact2 * tmask(:,:,:) )  ! Calcite production 
     248      IF( lk_iomput .AND. knt == nrdttrc ) THEN 
     249         CALL wrk_alloc( jpi, jpj, jpk, zw3d ) 
     250         IF( iom_use( "GRAZ2" ) ) THEN 
     251            zw3d(:,:,:) = zgrazing(:,:,:) * 1.e+3 * rfact2r * tmask(:,:,:)  !   Total grazing of phyto by zooplankton 
     252            CALL iom_put( "GRAZ2", zw3d ) 
     253         ENDIF 
     254         IF( iom_use( "PCAL" ) ) THEN 
     255            zw3d(:,:,:) = prodcal(:,:,:) * 1.e+3 * rfact2r * tmask(:,:,:)   !  Calcite production 
     256            CALL iom_put( "PCAL", zw3d )   
     257         ENDIF 
     258         CALL wrk_dealloc( jpi, jpj, jpk, zw3d ) 
    255259      ENDIF 
    256260      ! 
     
    261265      ENDIF 
    262266      ! 
    263       IF( ln_diatrc .AND. lk_iomput )  CALL wrk_dealloc( jpi, jpj, jpk, zgrazing ) 
     267      IF( lk_iomput )  CALL wrk_dealloc( jpi, jpj, jpk, zgrazing ) 
    264268      ! 
    265269      IF( nn_timing == 1 )  CALL timing_stop('p4z_meso') 
     
    334338 
    335339   !!====================================================================== 
    336 END MODULE  p4zmeso 
     340END MODULE p4zmeso 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmicro.F90

    r4624 r6225  
    4949 
    5050 
    51    !!* Substitution 
    52 #  include "top_substitute.h90" 
    5351   !!---------------------------------------------------------------------- 
    5452   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    5957CONTAINS 
    6058 
    61    SUBROUTINE p4z_micro( kt, jnt ) 
     59   SUBROUTINE p4z_micro( kt, knt ) 
    6260      !!--------------------------------------------------------------------- 
    6361      !!                     ***  ROUTINE p4z_micro  *** 
     
    6866      !!--------------------------------------------------------------------- 
    6967      INTEGER, INTENT(in) ::  kt  ! ocean time step 
    70       INTEGER, INTENT(in) ::  jnt  
     68      INTEGER, INTENT(in) ::  knt  
    7169      ! 
    7270      INTEGER  :: ji, jj, jk 
     
    7977      REAL(wp) :: zgrazp, zgrazm, zgrazsd 
    8078      REAL(wp) :: zgrazmf, zgrazsf, zgrazpf 
    81       REAL(wp) :: zrfact2 
    82       REAL(wp), POINTER, DIMENSION(:,:,:) :: zgrazing 
     79      REAL(wp), POINTER, DIMENSION(:,:,:) :: zgrazing, zw3d 
    8380      CHARACTER (len=25) :: charout 
    8481      !!--------------------------------------------------------------------- 
     
    8683      IF( nn_timing == 1 )  CALL timing_start('p4z_micro') 
    8784      ! 
    88       IF( ln_diatrc .AND. lk_iomput )  CALL wrk_alloc( jpi, jpj, jpk, zgrazing ) 
     85      IF( lk_iomput )  CALL wrk_alloc( jpi, jpj, jpk, zgrazing ) 
    8986      ! 
    9087      DO jk = 1, jpkm1 
    9188         DO jj = 1, jpj 
    9289            DO ji = 1, jpi 
    93                zcompaz = MAX( ( trn(ji,jj,jk,jpzoo) - 1.e-9 ), 0.e0 ) 
     90               zcompaz = MAX( ( trb(ji,jj,jk,jpzoo) - 1.e-9 ), 0.e0 ) 
    9491               zstep   = xstep 
    9592# if defined key_degrad 
     
    10097               !  Respiration rates of both zooplankton 
    10198               !  ------------------------------------- 
    102                zrespz = resrat * zfact * trn(ji,jj,jk,jpzoo) / ( xkmort + trn(ji,jj,jk,jpzoo) )  & 
     99               zrespz = resrat * zfact * trb(ji,jj,jk,jpzoo) / ( xkmort + trb(ji,jj,jk,jpzoo) )  & 
    103100                  &   + resrat * zfact * 3. * nitrfac(ji,jj,jk) 
    104101 
     
    106103               !  no real reason except that it seems to be more stable and may mimic predation. 
    107104               !  --------------------------------------------------------------- 
    108                ztortz = mzrat * 1.e6 * zfact * trn(ji,jj,jk,jpzoo) 
    109  
    110                zcompadi  = MIN( MAX( ( trn(ji,jj,jk,jpdia) - xthreshdia ), 0.e0 ), xsizedia ) 
    111                zcompaph  = MAX( ( trn(ji,jj,jk,jpphy) - xthreshphy ), 0.e0 ) 
    112                zcompapoc = MAX( ( trn(ji,jj,jk,jppoc) - xthreshpoc ), 0.e0 ) 
     105               ztortz = mzrat * 1.e6 * zfact * trb(ji,jj,jk,jpzoo) 
     106 
     107               zcompadi  = MIN( MAX( ( trb(ji,jj,jk,jpdia) - xthreshdia ), 0.e0 ), xsizedia ) 
     108               zcompaph  = MAX( ( trb(ji,jj,jk,jpphy) - xthreshphy ), 0.e0 ) 
     109               zcompapoc = MAX( ( trb(ji,jj,jk,jppoc) - xthreshpoc ), 0.e0 ) 
    113110                
    114111               !     Microzooplankton grazing 
     
    118115               zdenom    = zfoodlim / ( xkgraz + zfoodlim ) 
    119116               zdenom2   = zdenom / ( zfood + rtrn ) 
    120                zgraze    = grazrat * zstep * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpzoo)  
     117               zgraze    = grazrat * zstep * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jpzoo)  
    121118 
    122119               zgrazp    = zgraze  * xpref2p * zcompaph  * zdenom2  
     
    124121               zgrazsd   = zgraze  * xpref2d * zcompadi  * zdenom2  
    125122 
    126                zgrazpf   = zgrazp  * trn(ji,jj,jk,jpnfe) / (trn(ji,jj,jk,jpphy) + rtrn) 
    127                zgrazmf   = zgrazm  * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn) 
    128                zgrazsf   = zgrazsd * trn(ji,jj,jk,jpdfe) / (trn(ji,jj,jk,jpdia) + rtrn) 
     123               zgrazpf   = zgrazp  * trb(ji,jj,jk,jpnfe) / (trb(ji,jj,jk,jpphy) + rtrn) 
     124               zgrazmf   = zgrazm  * trb(ji,jj,jk,jpsfe) / (trb(ji,jj,jk,jppoc) + rtrn) 
     125               zgrazsf   = zgrazsd * trb(ji,jj,jk,jpdfe) / (trb(ji,jj,jk,jpdia) + rtrn) 
    129126               ! 
    130127               zgraztot  = zgrazp  + zgrazm  + zgrazsd  
     
    137134               !    Various remineralization and excretion terms 
    138135               !    -------------------------------------------- 
    139                zgrasrat  = zgraztotf / ( zgraztot + rtrn ) 
    140                zgrasratn = zgraztotn / ( zgraztot + rtrn ) 
     136               zgrasrat  = ( zgraztotf + rtrn ) / ( zgraztot + rtrn ) 
     137               zgrasratn = ( zgraztotn + rtrn ) / ( zgraztot + rtrn ) 
    141138               zepshert  =  MIN( 1., zgrasratn, zgrasrat / ferat3) 
    142139               zepsherv  = zepshert * MIN( epsher, (1. - unass) * zgrasrat / ferat3, (1. - unass) * zgrasratn ) 
     
    166163               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zgrazp 
    167164               tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) - zgrazsd 
    168                tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zgrazp  * trn(ji,jj,jk,jpnch)/(trn(ji,jj,jk,jpphy)+rtrn) 
    169                tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zgrazsd * trn(ji,jj,jk,jpdch)/(trn(ji,jj,jk,jpdia)+rtrn) 
    170                tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zgrazsd * trn(ji,jj,jk,jpdsi)/(trn(ji,jj,jk,jpdia)+rtrn) 
    171                tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zgrazsd * trn(ji,jj,jk,jpdsi)/(trn(ji,jj,jk,jpdia)+rtrn) 
     165               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zgrazp  * trb(ji,jj,jk,jpnch)/(trb(ji,jj,jk,jpphy)+rtrn) 
     166               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zgrazsd * trb(ji,jj,jk,jpdch)/(trb(ji,jj,jk,jpdia)+rtrn) 
     167               tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zgrazsd * trb(ji,jj,jk,jpdsi)/(trb(ji,jj,jk,jpdia)+rtrn) 
     168               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zgrazsd * trb(ji,jj,jk,jpdsi)/(trb(ji,jj,jk,jpdia)+rtrn) 
    172169               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zgrazpf 
    173170               tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zgrazsf 
     
    185182#if defined key_kriest 
    186183               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + zmortz * xkr_dmicro & 
    187                                                          - zgrazm * trn(ji,jj,jk,jpnum) / ( trn(ji,jj,jk,jppoc) + rtrn ) 
     184                                                         - zgrazm * trb(ji,jj,jk,jpnum) / ( trb(ji,jj,jk,jppoc) + rtrn ) 
    188185#endif 
    189186            END DO 
     
    191188      END DO 
    192189      ! 
    193       IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc ) THEN 
    194          zrfact2 = 1.e3 * rfact2r 
    195          CALL iom_put( "GRAZ1" , zgrazing(:,:,:) * zrfact2 * tmask(:,:,:) )  ! Total grazing of phyto by zooplankton 
     190      IF( lk_iomput .AND. knt == nrdttrc ) THEN 
     191         CALL wrk_alloc( jpi, jpj, jpk, zw3d ) 
     192         IF( iom_use( "GRAZ1" ) ) THEN 
     193            zw3d(:,:,:) = zgrazing(:,:,:) * 1.e+3 * rfact2r * tmask(:,:,:)  !  Total grazing of phyto by zooplankton 
     194            CALL iom_put( "GRAZ1", zw3d ) 
     195         ENDIF 
     196         CALL wrk_dealloc( jpi, jpj, jpk, zw3d ) 
    196197      ENDIF 
    197198      ! 
     
    202203      ENDIF 
    203204      ! 
    204       IF( ln_diatrc .AND. lk_iomput )  CALL wrk_dealloc( jpi, jpj, jpk, zgrazing ) 
     205      IF( lk_iomput )  CALL wrk_dealloc( jpi, jpj, jpk, zgrazing ) 
    205206      ! 
    206207      IF( nn_timing == 1 )  CALL timing_stop('p4z_micro') 
     
    270271 
    271272   !!====================================================================== 
    272 END MODULE  p4zmicro 
     273END MODULE p4zmicro 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmort.F90

    • Property svn:keywords set to Id
    r4624 r6225  
    3535 
    3636 
    37    !!* Substitution 
    38 #  include "top_substitute.h90" 
    3937   !!---------------------------------------------------------------------- 
    4038   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    41    !! $Id: p4zmort.F90 3160 2011-11-20 14:27:18Z cetlod $  
     39   !! $Id$  
    4240   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4341   !!---------------------------------------------------------------------- 
     
    8583         DO jj = 1, jpj 
    8684            DO ji = 1, jpi 
    87                zcompaph = MAX( ( trn(ji,jj,jk,jpphy) - 1e-8 ), 0.e0 ) 
     85               zcompaph = MAX( ( trb(ji,jj,jk,jpphy) - 1e-8 ), 0.e0 ) 
    8886               zstep    = xstep 
    8987# if defined key_degrad 
     
    9492               !     due to turbulence is negligible. Mortality is also set 
    9593               !     to 0 
    96                zsizerat = MIN(1., MAX( 0., (quotan(ji,jj,jk) - 0.2) / 0.3) ) * trn(ji,jj,jk,jpphy) 
     94               zsizerat = MIN(1., MAX( 0., (quotan(ji,jj,jk) - 0.2) / 0.3) ) * trb(ji,jj,jk,jpphy) 
    9795               !     Squared mortality of Phyto similar to a sedimentation term during 
    9896               !     blooms (Doney et al. 1996) 
     
    102100               !     increased when nutrients are limiting phytoplankton growth 
    103101               !     as observed for instance in case of iron limitation. 
    104                ztortp = mprat * xstep * zcompaph / ( xkmort + trn(ji,jj,jk,jpphy) ) * zsizerat 
     102               ztortp = mprat * xstep * zcompaph / ( xkmort + trb(ji,jj,jk,jpphy) ) * zsizerat 
    105103 
    106104               zmortp = zrespp + ztortp 
     
    108106               !   Update the arrays TRA which contains the biological sources and sinks 
    109107 
    110                zfactfe = trn(ji,jj,jk,jpnfe)/(trn(ji,jj,jk,jpphy)+rtrn) 
    111                zfactch = trn(ji,jj,jk,jpnch)/(trn(ji,jj,jk,jpphy)+rtrn) 
     108               zfactfe = trb(ji,jj,jk,jpnfe)/(trb(ji,jj,jk,jpphy)+rtrn) 
     109               zfactch = trb(ji,jj,jk,jpnch)/(trb(ji,jj,jk,jpphy)+rtrn) 
    112110               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zmortp 
    113111               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zmortp * zfactch 
     
    172170            DO ji = 1, jpi 
    173171 
    174                zcompadi = MAX( ( trn(ji,jj,jk,jpdia) - 1e-9), 0. ) 
     172               zcompadi = MAX( ( trb(ji,jj,jk,jpdia) - 1e-9), 0. ) 
    175173 
    176174               !    Aggregation term for diatoms is increased in case of nutrient 
     
    186184               zlim2   = xlimdia(ji,jj,jk) * xlimdia(ji,jj,jk) 
    187185               zlim1   = 0.25 * ( 1. - zlim2 ) / ( 0.25 + zlim2 )  
    188                zrespp2 = 1.e6 * zstep * (  wchld + wchldm * zlim1 ) * xdiss(ji,jj,jk) * zcompadi * trn(ji,jj,jk,jpdia) 
     186               zrespp2 = 1.e6 * zstep * (  wchld + wchldm * zlim1 ) * xdiss(ji,jj,jk) * zcompadi * trb(ji,jj,jk,jpdia) 
    189187 
    190188               !     Phytoplankton mortality.  
    191189               !     ------------------------ 
    192                ztortp2 = mprat2 * zstep * trn(ji,jj,jk,jpdia)  / ( xkmort + trn(ji,jj,jk,jpdia) ) * zcompadi  
     190               ztortp2 = mprat2 * zstep * trb(ji,jj,jk,jpdia)  / ( xkmort + trb(ji,jj,jk,jpdia) ) * zcompadi  
    193191 
    194192               zmortp2 = zrespp2 + ztortp2 
     
    196194               !   Update the arrays tra which contains the biological sources and sinks 
    197195               !   --------------------------------------------------------------------- 
    198                zfactch = trn(ji,jj,jk,jpdch) / ( trn(ji,jj,jk,jpdia) + rtrn ) 
    199                zfactfe = trn(ji,jj,jk,jpdfe) / ( trn(ji,jj,jk,jpdia) + rtrn ) 
    200                zfactsi = trn(ji,jj,jk,jpdsi) / ( trn(ji,jj,jk,jpdia) + rtrn ) 
     196               zfactch = trb(ji,jj,jk,jpdch) / ( trb(ji,jj,jk,jpdia) + rtrn ) 
     197               zfactfe = trb(ji,jj,jk,jpdfe) / ( trb(ji,jj,jk,jpdia) + rtrn ) 
     198               zfactsi = trb(ji,jj,jk,jpdsi) / ( trb(ji,jj,jk,jpdia) + rtrn ) 
    201199               tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) - zmortp2  
    202200               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zmortp2 * zfactch 
     
    277275 
    278276   !!====================================================================== 
    279 END MODULE  p4zmort 
     277END MODULE p4zmort 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zopt.F90

    r4624 r6225  
    3535   REAL(wp) :: parlux      !: Fraction of shortwave as PAR 
    3636   REAL(wp) :: xparsw                 !: parlux/3 
     37   REAL(wp) :: xsi0r                 !:  1. /rn_si0 
    3738 
    3839   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_par      ! structure of input par 
     
    4243 
    4344   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: enano, ediat   !: PAR for phyto, nano and diat  
     45   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: etot_ndcy      !: PAR over 24h in case of diurnal cycle 
    4446   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: emoy           !: averaged PAR in the mixed layer 
     47   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ekb, ekg, ekr  !: wavelength (Red-Green-Blue) 
    4548 
    4649   INTEGER  ::   nksrp   ! levels below which the light cannot penetrate ( depth larger than 391 m) 
     
    4851   REAL(wp), DIMENSION(3,61), PUBLIC ::   xkrgb   !: tabulated attenuation coefficients for RGB absorption 
    4952    
    50    !!* Substitution 
    51 #  include "top_substitute.h90" 
    5253   !!---------------------------------------------------------------------- 
    5354   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    5758CONTAINS 
    5859 
    59    SUBROUTINE p4z_opt( kt, jnt ) 
     60   SUBROUTINE p4z_opt( kt, knt ) 
    6061      !!--------------------------------------------------------------------- 
    6162      !!                     ***  ROUTINE p4z_opt  *** 
     
    6768      !!--------------------------------------------------------------------- 
    6869      ! 
    69       INTEGER, INTENT(in) ::   kt, jnt   ! ocean time step 
     70      INTEGER, INTENT(in) ::   kt, knt   ! ocean time step 
    7071      ! 
    7172      INTEGER  ::   ji, jj, jk 
    7273      INTEGER  ::   irgb 
    73       REAL(wp) ::   zchl, zxsi0r 
     74      REAL(wp) ::   zchl 
    7475      REAL(wp) ::   zc0 , zc1 , zc2, zc3, z1_dep 
    75       REAL(wp), POINTER, DIMENSION(:,:  ) :: zdepmoy, zetmp, zetmp1, zetmp2 
    76       REAL(wp), POINTER, DIMENSION(:,:,:) :: zekg, zekr, zekb, ze0, ze1, ze2, ze3 
     76      REAL(wp), POINTER, DIMENSION(:,:  ) :: zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4, zqsr100 
     77      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpar, ze0, ze1, ze2, ze3 
    7778      !!--------------------------------------------------------------------- 
    7879      ! 
     
    8081      ! 
    8182      ! Allocate temporary workspace 
    82       CALL wrk_alloc( jpi, jpj,      zdepmoy, zetmp, zetmp1, zetmp2 )  
    83       CALL wrk_alloc( jpi, jpj, jpk, zekg, zekr, zekb, ze0, ze1, ze2, ze3 ) 
    84  
    85       IF( jnt == 1 .AND. ln_varpar ) CALL p4z_optsbc( kt ) 
     83      CALL wrk_alloc( jpi, jpj,      zqsr100, zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4 ) 
     84      CALL wrk_alloc( jpi, jpj, jpk, zpar, ze0, ze1, ze2, ze3 ) 
     85 
     86      IF( knt == 1 .AND. ln_varpar ) CALL p4z_opt_sbc( kt ) 
    8687 
    8788      !     Initialisation of variables used to compute PAR 
    8889      !     ----------------------------------------------- 
    89       ze1(:,:,jpk) = 0._wp 
    90       ze2(:,:,jpk) = 0._wp 
    91       ze3(:,:,jpk) = 0._wp 
    92  
     90      ze1(:,:,:) = 0._wp 
     91      ze2(:,:,:) = 0._wp 
     92      ze3(:,:,:) = 0._wp 
    9393      !                                        !* attenuation coef. function of Chlorophyll and wavelength (Red-Green-Blue) 
    9494      DO jk = 1, jpkm1                         !  -------------------------------------------------------- 
    95 !CDIR NOVERRCHK 
    9695         DO jj = 1, jpj 
    97 !CDIR NOVERRCHK 
    9896            DO ji = 1, jpi 
    99                zchl = ( trn(ji,jj,jk,jpnch) + trn(ji,jj,jk,jpdch) + rtrn ) * 1.e6 
     97               zchl = ( trb(ji,jj,jk,jpnch) + trb(ji,jj,jk,jpdch) + rtrn ) * 1.e6 
    10098               zchl = MIN(  10. , MAX( 0.05, zchl )  ) 
    10199               irgb = NINT( 41 + 20.* LOG10( zchl ) + rtrn ) 
    102100               !                                                          
    103                zekb(ji,jj,jk) = xkrgb(1,irgb) * fse3t(ji,jj,jk) 
    104                zekg(ji,jj,jk) = xkrgb(2,irgb) * fse3t(ji,jj,jk) 
    105                zekr(ji,jj,jk) = xkrgb(3,irgb) * fse3t(ji,jj,jk) 
     101               ekb(ji,jj,jk) = xkrgb(1,irgb) * e3t_n(ji,jj,jk) 
     102               ekg(ji,jj,jk) = xkrgb(2,irgb) * e3t_n(ji,jj,jk) 
     103               ekr(ji,jj,jk) = xkrgb(3,irgb) * e3t_n(ji,jj,jk) 
    106104            END DO 
    107105         END DO 
    108106      END DO 
    109  
    110  
    111107      !                                        !* Photosynthetically Available Radiation (PAR) 
    112108      !                                        !  -------------------------------------- 
    113  
    114       IF( ln_varpar ) THEN 
    115          ze1(:,:,1) = par_varsw(:,:) * qsr(:,:) * EXP( -0.5 * zekb(:,:,1) ) 
    116          ze2(:,:,1) = par_varsw(:,:) * qsr(:,:) * EXP( -0.5 * zekg(:,:,1) ) 
    117          ze3(:,:,1) = par_varsw(:,:) * qsr(:,:) * EXP( -0.5 * zekr(:,:,1) ) 
     109      IF( l_trcdm2dc ) THEN                     !  diurnal cycle 
     110         ! 1% of qsr to compute euphotic layer 
     111         zqsr100(:,:) = 0.01 * qsr_mean(:,:)     !  daily mean qsr 
     112         ! 
     113         CALL p4z_opt_par( kt, qsr_mean, ze1, ze2, ze3 )  
     114         ! 
     115         DO jk = 1, nksrp       
     116            etot_ndcy(:,:,jk) =        ze1(:,:,jk) +        ze2(:,:,jk) +       ze3(:,:,jk) 
     117            enano    (:,:,jk) =  2.1 * ze1(:,:,jk) + 0.42 * ze2(:,:,jk) + 0.4 * ze3(:,:,jk) 
     118            ediat    (:,:,jk) =  1.6 * ze1(:,:,jk) + 0.69 * ze2(:,:,jk) + 0.7 * ze3(:,:,jk) 
     119         END DO 
     120         ! 
     121         CALL p4z_opt_par( kt, qsr, ze1, ze2, ze3 )  
     122         ! 
     123         DO jk = 1, nksrp       
     124            etot(:,:,jk) =  ze1(:,:,jk) + ze2(:,:,jk) + ze3(:,:,jk) 
     125         END DO 
     126         ! 
    118127      ELSE 
    119          ze1(:,:,1) = xparsw         * qsr(:,:) * EXP( -0.5 * zekb(:,:,1) ) 
    120          ze2(:,:,1) = xparsw         * qsr(:,:) * EXP( -0.5 * zekg(:,:,1) ) 
    121          ze3(:,:,1) = xparsw         * qsr(:,:) * EXP( -0.5 * zekr(:,:,1) ) 
    122       ENDIF 
    123  
    124 !CDIR NOVERRCHK 
    125       DO jj = 1, jpj 
    126 !CDIR NOVERRCHK 
    127          DO ji = 1, jpi 
    128             zc1 = ze1(ji,jj,1) 
    129             zc2 = ze2(ji,jj,1)  
    130             zc3 = ze3(ji,jj,1) 
    131             etot (ji,jj,1) = (       zc1 +        zc2 +       zc3 ) 
    132             enano(ji,jj,1) = ( 2.1 * zc1 + 0.42 * zc2 + 0.4 * zc3 ) 
    133             ediat(ji,jj,1) = ( 1.6 * zc1 + 0.69 * zc2 + 0.7 * zc3 ) 
    134          END DO 
    135       END DO 
    136  
    137      
    138       DO jk = 2, nksrp       
    139 !CDIR NOVERRCHK 
    140          DO jj = 1, jpj 
    141 !CDIR NOVERRCHK 
    142             DO ji = 1, jpi 
    143                zc1 = ze1(ji,jj,jk-1) * EXP( -0.5 * ( zekb(ji,jj,jk-1) + zekb(ji,jj,jk) ) ) 
    144                zc2 = ze2(ji,jj,jk-1) * EXP( -0.5 * ( zekg(ji,jj,jk-1) + zekg(ji,jj,jk) ) ) 
    145                zc3 = ze3(ji,jj,jk-1) * EXP( -0.5 * ( zekr(ji,jj,jk-1) + zekr(ji,jj,jk) ) ) 
    146                ze1  (ji,jj,jk) = zc1 
    147                ze2  (ji,jj,jk) = zc2 
    148                ze3  (ji,jj,jk) = zc3 
    149                etot (ji,jj,jk) = (       zc1 +        zc2 +       zc3 ) 
    150                enano(ji,jj,jk) = ( 2.1 * zc1 + 0.42 * zc2 + 0.4 * zc3 ) 
    151                ediat(ji,jj,jk) = ( 1.6 * zc1 + 0.69 * zc2 + 0.7 * zc3 ) 
    152             END DO 
    153          END DO 
    154       END DO 
     128         ! 1% of qsr to compute euphotic layer 
     129         zqsr100(:,:) = 0.01 * qsr(:,:) 
     130         ! 
     131         CALL p4z_opt_par( kt, qsr, ze1, ze2, ze3 )  
     132         ! 
     133         DO jk = 1, nksrp       
     134            etot (:,:,jk) =        ze1(:,:,jk) +        ze2(:,:,jk) +       ze3(:,:,jk) 
     135            enano(:,:,jk) =  2.1 * ze1(:,:,jk) + 0.42 * ze2(:,:,jk) + 0.4 * ze3(:,:,jk) 
     136            ediat(:,:,jk) =  1.6 * ze1(:,:,jk) + 0.69 * ze2(:,:,jk) + 0.7 * ze3(:,:,jk) 
     137         END DO 
     138         etot_ndcy(:,:,:) =  etot(:,:,:)  
     139      ENDIF 
     140 
    155141 
    156142      IF( ln_qsr_bio ) THEN                    !* heat flux accros w-level (used in the dynamics) 
    157143         !                                     !  ------------------------ 
    158          zxsi0r = 1.e0 / rn_si0 
    159          ! 
    160          ze0(:,:,1) = rn_abs * qsr(:,:) 
    161          !                                                    ! surface value : separation in R-G-B + near surface 
    162          IF( ln_varpar ) THEN 
    163             ze0(:,:,1) = ( 1. - 3. * par_varsw(:,:) ) * qsr(:,:) 
    164             ze1(:,:,1) = par_varsw(:,:)               * qsr(:,:)          
    165             ze2(:,:,1) = par_varsw(:,:)               * qsr(:,:) 
    166             ze3(:,:,1) = par_varsw(:,:)               * qsr(:,:) 
    167          ELSE 
    168             ze0(:,:,1) = ( 1. - 3. * xparsw )  * qsr(:,:) 
    169             ze1(:,:,1) = xparsw                * qsr(:,:)          
    170             ze2(:,:,1) = xparsw                * qsr(:,:) 
    171             ze3(:,:,1) = xparsw                * qsr(:,:) 
    172          ENDIF 
     144         CALL p4z_opt_par( kt, qsr, ze1, ze2, ze3, pe0=ze0 ) 
     145         ! 
    173146         etot3(:,:,1) =  qsr(:,:) * tmask(:,:,1) 
    174          ! 
    175          ! 
    176147         DO jk = 2, nksrp + 1 
    177 !CDIR NOVERRCHK 
    178             DO jj = 1, jpj 
    179 !CDIR NOVERRCHK 
    180                DO ji = 1, jpi 
    181                   zc0 = ze0(ji,jj,jk-1) * EXP( -fse3t(ji,jj,jk-1) * zxsi0r ) 
    182                   zc1 = ze1(ji,jj,jk-1) * EXP( -zekb(ji,jj,jk-1 ) ) 
    183                   zc2 = ze2(ji,jj,jk-1) * EXP( -zekg(ji,jj,jk-1 ) ) 
    184                   zc3 = ze3(ji,jj,jk-1) * EXP( -zekr(ji,jj,jk-1 ) ) 
    185                   ze0(ji,jj,jk) = zc0 
    186                   ze1(ji,jj,jk) = zc1 
    187                   ze2(ji,jj,jk) = zc2 
    188                   ze3(ji,jj,jk) = zc3 
    189                   etot3(ji,jj,jk) = ( zc0 + zc1 + zc2 + zc3 ) * tmask(ji,jj,jk) 
    190               END DO 
    191               ! 
    192             END DO 
    193             ! 
    194         END DO 
    195         ! 
    196       ENDIF 
    197  
     148            etot3(:,:,jk) =  ( ze0(:,:,jk) + ze1(:,:,jk) + ze2(:,:,jk) + ze3(:,:,jk) ) * tmask(:,:,jk) 
     149         END DO 
     150         !                                     !  ------------------------ 
     151      ENDIF 
    198152      !                                        !* Euphotic depth and level 
    199153      neln(:,:) = 1                            !  ------------------------ 
     
    203157         DO jj = 1, jpj 
    204158           DO ji = 1, jpi 
    205               IF( etot(ji,jj,jk) * tmask(ji,jj,jk) >= 0.0043 * qsr(ji,jj) )  THEN 
     159              IF( etot_ndcy(ji,jj,jk) * tmask(ji,jj,jk) >= 0.43 * zqsr100(ji,jj) )  THEN 
    206160                 neln(ji,jj) = jk+1                    ! Euphotic level : 1rst T-level strictly below Euphotic layer 
    207161                 !                                     ! nb: ensure the compatibility with nmld_trc definition in trd_mld_trc_zint 
    208                  heup(ji,jj) = fsdepw(ji,jj,jk+1)      ! Euphotic layer depth 
     162                 heup(ji,jj) = gdepw_n(ji,jj,jk+1)     ! Euphotic layer depth 
    209163              ENDIF 
    210164           END DO 
    211165        END DO 
    212166      END DO 
    213   
     167      ! 
    214168      heup(:,:) = MIN( 300., heup(:,:) ) 
    215  
    216169      !                                        !* mean light over the mixed layer 
    217170      zdepmoy(:,:)   = 0.e0                    !  ------------------------------- 
    218       zetmp  (:,:)   = 0.e0 
    219171      zetmp1 (:,:)   = 0.e0 
    220172      zetmp2 (:,:)   = 0.e0 
     173      zetmp3 (:,:)   = 0.e0 
     174      zetmp4 (:,:)   = 0.e0 
    221175 
    222176      DO jk = 1, nksrp 
    223 !CDIR NOVERRCHK 
    224177         DO jj = 1, jpj 
    225 !CDIR NOVERRCHK 
    226178            DO ji = 1, jpi 
    227                IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN 
    228                   zetmp  (ji,jj) = zetmp  (ji,jj) + etot (ji,jj,jk) * fse3t(ji,jj,jk) 
    229                   zetmp1 (ji,jj) = zetmp1 (ji,jj) + enano(ji,jj,jk) * fse3t(ji,jj,jk) 
    230                   zetmp2 (ji,jj) = zetmp2 (ji,jj) + ediat(ji,jj,jk) * fse3t(ji,jj,jk) 
    231                   zdepmoy(ji,jj) = zdepmoy(ji,jj) + fse3t(ji,jj,jk) 
     179               IF( gdepw_n(ji,jj,jk+1) <= hmld(ji,jj) ) THEN 
     180                  zetmp1 (ji,jj) = zetmp1 (ji,jj) + etot     (ji,jj,jk) * e3t_n(ji,jj,jk) ! remineralisation 
     181                  zetmp2 (ji,jj) = zetmp2 (ji,jj) + etot_ndcy(ji,jj,jk) * e3t_n(ji,jj,jk) ! production 
     182                  zetmp3 (ji,jj) = zetmp3 (ji,jj) + enano    (ji,jj,jk) * e3t_n(ji,jj,jk) ! production 
     183                  zetmp4 (ji,jj) = zetmp4 (ji,jj) + ediat    (ji,jj,jk) * e3t_n(ji,jj,jk) ! production 
     184                  zdepmoy(ji,jj) = zdepmoy(ji,jj) +                       e3t_n(ji,jj,jk) 
    232185               ENDIF 
    233186            END DO 
     
    235188      END DO 
    236189      ! 
    237       emoy(:,:,:) = etot(:,:,:) 
     190      emoy(:,:,:) = etot(:,:,:)       ! remineralisation 
     191      zpar(:,:,:) = etot_ndcy(:,:,:)  ! diagnostic : PAR with no diurnal cycle  
    238192      ! 
    239193      DO jk = 1, nksrp 
    240 !CDIR NOVERRCHK 
    241194         DO jj = 1, jpj 
    242 !CDIR NOVERRCHK 
    243195            DO ji = 1, jpi 
    244                IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN 
     196               IF( gdepw_n(ji,jj,jk+1) <= hmld(ji,jj) ) THEN 
    245197                  z1_dep = 1. / ( zdepmoy(ji,jj) + rtrn ) 
    246                   emoy (ji,jj,jk) = zetmp (ji,jj) * z1_dep 
    247                   enano(ji,jj,jk) = zetmp1(ji,jj) * z1_dep 
    248                   ediat(ji,jj,jk) = zetmp2(ji,jj) * z1_dep 
     198                  emoy (ji,jj,jk) = zetmp1(ji,jj) * z1_dep 
     199                  zpar (ji,jj,jk) = zetmp2(ji,jj) * z1_dep 
     200                  enano(ji,jj,jk) = zetmp3(ji,jj) * z1_dep 
     201                  ediat(ji,jj,jk) = zetmp4(ji,jj) * z1_dep 
    249202               ENDIF 
    250203            END DO 
    251204         END DO 
    252205      END DO 
    253  
    254       IF( ln_diatrc ) THEN        ! save output diagnostics 
     206      ! 
     207      IF( lk_iomput ) THEN 
     208        IF( knt == nrdttrc ) THEN 
     209           IF( iom_use( "Heup"  ) ) CALL iom_put( "Heup" , heup(:,:  ) * tmask(:,:,1) )  ! euphotic layer deptht 
     210           IF( iom_use( "PARDM" ) ) CALL iom_put( "PARDM", zpar(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation 
     211           IF( iom_use( "PAR"   ) ) CALL iom_put( "PAR"  , emoy(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation 
     212        ENDIF 
     213      ELSE 
     214         IF( ln_diatrc ) THEN        ! save output diagnostics 
     215            trc2d(:,:,  jp_pcs0_2d + 10) = heup(:,:  ) * tmask(:,:,1) 
     216            trc3d(:,:,:,jp_pcs0_3d + 3)  = etot(:,:,:) * tmask(:,:,:) 
     217         ENDIF 
     218      ENDIF 
     219      ! 
     220      CALL wrk_dealloc( jpi, jpj,      zqsr100, zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4 ) 
     221      CALL wrk_dealloc( jpi, jpj, jpk, zpar,  ze0, ze1, ze2, ze3 ) 
     222      ! 
     223      IF( nn_timing == 1 )  CALL timing_stop('p4z_opt') 
     224      ! 
     225   END SUBROUTINE p4z_opt 
     226 
     227   SUBROUTINE p4z_opt_par( kt, pqsr, pe1, pe2, pe3, pe0 )  
     228      !!---------------------------------------------------------------------- 
     229      !!                  ***  routine p4z_opt_par  *** 
     230      !! 
     231      !! ** purpose :   compute PAR of each wavelength (Red-Green-Blue) 
     232      !!                for a given shortwave radiation 
     233      !! 
     234      !!---------------------------------------------------------------------- 
     235      !! * arguments 
     236      INTEGER, INTENT(in)                                       ::  kt            !   ocean time-step 
     237      REAL(wp), DIMENSION(jpi,jpj)    , INTENT(in)              ::  pqsr          !   shortwave 
     238      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout)           ::  pe1 , pe2 , pe3   !  PAR ( R-G-B) 
     239      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout), OPTIONAL ::  pe0   
     240      !! * local variables 
     241      INTEGER    ::   ji, jj, jk     ! dummy loop indices 
     242      REAL(wp), DIMENSION(jpi,jpj)     ::  zqsr          !   shortwave 
     243      !!---------------------------------------------------------------------- 
     244 
     245      !  Real shortwave 
     246      IF( ln_varpar ) THEN  ;  zqsr(:,:) = par_varsw(:,:) * pqsr(:,:) 
     247      ELSE                  ;  zqsr(:,:) = xparsw         * pqsr(:,:) 
     248      ENDIF 
     249      ! 
     250      IF( PRESENT( pe0 ) ) THEN     !  W-level 
     251         ! 
     252         pe0(:,:,1) = pqsr(:,:) - 3. * zqsr(:,:)    !   ( 1 - 3 * alpha ) * q 
     253         pe1(:,:,1) = zqsr(:,:)          
     254         pe2(:,:,1) = zqsr(:,:) 
     255         pe3(:,:,1) = zqsr(:,:) 
     256         ! 
     257         DO jk = 2, nksrp + 1 
     258            DO jj = 1, jpj 
     259               DO ji = 1, jpi 
     260                  pe0(ji,jj,jk) = pe0(ji,jj,jk-1) * EXP( -e3t_n(ji,jj,jk-1) * xsi0r ) 
     261                  pe1(ji,jj,jk) = pe1(ji,jj,jk-1) * EXP( -ekb(ji,jj,jk-1 ) ) 
     262                  pe2(ji,jj,jk) = pe2(ji,jj,jk-1) * EXP( -ekg(ji,jj,jk-1 ) ) 
     263                  pe3(ji,jj,jk) = pe3(ji,jj,jk-1) * EXP( -ekr(ji,jj,jk-1 ) ) 
     264               END DO 
     265              ! 
     266            END DO 
     267            ! 
     268         END DO 
    255269        ! 
    256         IF( lk_iomput ) THEN 
    257            IF( jnt == nrdttrc ) THEN 
    258               CALL iom_put( "Heup", heup(:,:  ) * tmask(:,:,1) )  ! euphotic layer deptht 
    259               CALL iom_put( "PAR" , emoy(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation 
    260            ENDIF 
    261         ELSE 
    262            trc2d(:,:,  jp_pcs0_2d + 10) = heup(:,:  ) * tmask(:,:,1)   
    263            trc3d(:,:,:,jp_pcs0_3d + 3)  = etot(:,:,:) * tmask(:,:,:) 
    264         ENDIF 
     270      ELSE   ! T- level 
    265271        ! 
    266       ENDIF 
    267       ! 
    268       CALL wrk_dealloc( jpi, jpj,      zdepmoy, zetmp, zetmp1, zetmp2 ) 
    269       CALL wrk_dealloc( jpi, jpj, jpk, zekg, zekr, zekb, ze0, ze1, ze2, ze3 ) 
    270       ! 
    271       IF( nn_timing == 1 )  CALL timing_stop('p4z_opt') 
    272       ! 
    273    END SUBROUTINE p4z_opt 
    274  
    275    SUBROUTINE p4z_optsbc( kt ) 
    276       !!---------------------------------------------------------------------- 
    277       !!                  ***  routine p4z_optsbc  *** 
     272        pe1(:,:,1) = zqsr(:,:) * EXP( -0.5 * ekb(:,:,1) ) 
     273        pe2(:,:,1) = zqsr(:,:) * EXP( -0.5 * ekg(:,:,1) ) 
     274        pe3(:,:,1) = zqsr(:,:) * EXP( -0.5 * ekr(:,:,1) ) 
     275        ! 
     276        DO jk = 2, nksrp       
     277           DO jj = 1, jpj 
     278              DO ji = 1, jpi 
     279                 pe1(ji,jj,jk) = pe1(ji,jj,jk-1) * EXP( -0.5 * ( ekb(ji,jj,jk-1) + ekb(ji,jj,jk) ) ) 
     280                 pe2(ji,jj,jk) = pe2(ji,jj,jk-1) * EXP( -0.5 * ( ekg(ji,jj,jk-1) + ekg(ji,jj,jk) ) ) 
     281                 pe3(ji,jj,jk) = pe3(ji,jj,jk-1) * EXP( -0.5 * ( ekr(ji,jj,jk-1) + ekr(ji,jj,jk) ) ) 
     282              END DO 
     283           END DO 
     284        END DO     
     285        ! 
     286      ENDIF 
     287      !  
     288   END SUBROUTINE p4z_opt_par 
     289 
     290 
     291   SUBROUTINE p4z_opt_sbc( kt ) 
     292      !!---------------------------------------------------------------------- 
     293      !!                  ***  routine p4z_opt_sbc  *** 
    278294      !! 
    279295      !! ** purpose :   read and interpolate the variable PAR fraction 
     
    286302      !!---------------------------------------------------------------------- 
    287303      !! * arguments 
    288       INTEGER, INTENT( in  ) ::   kt   ! ocean time step 
     304      INTEGER ,                INTENT(in) ::   kt     ! ocean time step 
    289305 
    290306      !! * local declarations 
     
    299315         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_par > 1 ) ) THEN 
    300316            CALL fld_read( kt, 1, sf_par ) 
    301             par_varsw(:,:) = ( sf_par(1)%fnow(:,:,1) )/3.0 
     317            par_varsw(:,:) = ( sf_par(1)%fnow(:,:,1) ) / 3.0 
    302318         ENDIF 
    303319      ENDIF 
     
    305321      IF( nn_timing == 1 )  CALL timing_stop('p4z_optsbc') 
    306322      ! 
    307    END SUBROUTINE p4z_optsbc 
     323   END SUBROUTINE p4z_opt_sbc 
    308324 
    309325   SUBROUTINE p4z_opt_init 
     
    349365      ! 
    350366      xparsw = parlux / 3.0 
     367      xsi0r  = 1.e0 / rn_si0 
    351368      ! 
    352369      ! Variable PAR at the surface of the ocean 
     
    374391      IF(lwp) WRITE(numout,*) '        level of light extinction = ', nksrp, ' ref depth = ', gdepw_1d(nksrp+1), ' m' 
    375392      ! 
    376                          etot (:,:,:) = 0._wp 
    377                          enano(:,:,:) = 0._wp 
    378                          ediat(:,:,:) = 0._wp 
    379       IF( ln_qsr_bio )   etot3(:,:,:) = 0._wp 
     393                         ekr      (:,:,:) = 0._wp 
     394                         ekb      (:,:,:) = 0._wp 
     395                         ekg      (:,:,:) = 0._wp 
     396                         etot     (:,:,:) = 0._wp 
     397                         etot_ndcy(:,:,:) = 0._wp 
     398                         enano    (:,:,:) = 0._wp 
     399                         ediat    (:,:,:) = 0._wp 
     400      IF( ln_qsr_bio )   etot3    (:,:,:) = 0._wp 
    380401      !  
    381402      IF( nn_timing == 1 )  CALL timing_stop('p4z_opt_init') 
     
    388409      !!                     ***  ROUTINE p4z_opt_alloc  *** 
    389410      !!---------------------------------------------------------------------- 
    390       ALLOCATE( enano(jpi,jpj,jpk), ediat(jpi,jpj,jpk), emoy (jpi,jpj,jpk), STAT=p4z_opt_alloc )  
     411      ALLOCATE( ekb(jpi,jpj,jpk)      , ekr(jpi,jpj,jpk), ekg(jpi,jpj,jpk),   & 
     412        &       enano(jpi,jpj,jpk)    , ediat(jpi,jpj,jpk), & 
     413        &       etot_ndcy(jpi,jpj,jpk), emoy (jpi,jpj,jpk), STAT=p4z_opt_alloc )  
    391414         ! 
    392415      IF( p4z_opt_alloc /= 0 ) CALL ctl_warn('p4z_opt_alloc : failed to allocate arrays.') 
     
    404427 
    405428   !!====================================================================== 
    406 END MODULE  p4zopt 
     429END MODULE p4zopt 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zprod.F90

    r4624 r6225  
    5454   REAL(wp) :: texcret2               !: 1 - excret2         
    5555 
    56  
    57    !!* Substitution 
    58 #  include "top_substitute.h90" 
    5956   !!---------------------------------------------------------------------- 
    6057   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    6461CONTAINS 
    6562 
    66    SUBROUTINE p4z_prod( kt , jnt ) 
     63   SUBROUTINE p4z_prod( kt , knt ) 
    6764      !!--------------------------------------------------------------------- 
    6865      !!                     ***  ROUTINE p4z_prod  *** 
     
    7471      !!--------------------------------------------------------------------- 
    7572      ! 
    76       INTEGER, INTENT(in) :: kt, jnt 
     73      INTEGER, INTENT(in) :: kt, knt 
    7774      ! 
    7875      INTEGER  ::   ji, jj, jk 
     
    8380      REAL(wp) ::   zpislopen  , zpislope2n 
    8481      REAL(wp) ::   zrum, zcodel, zargu, zval 
    85       REAL(wp) ::   zrfact2 
     82      REAL(wp) ::   zfact 
    8683      CHARACTER (len=25) :: charout 
    87       REAL(wp), POINTER, DIMENSION(:,:  ) :: zmixnano, zmixdiat, zstrn 
    88       REAL(wp), POINTER, DIMENSION(:,:,:) :: zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt    
     84      REAL(wp), POINTER, DIMENSION(:,:  ) :: zmixnano, zmixdiat, zstrn, zw2d 
     85      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt, zw3d    
    8986      REAL(wp), POINTER, DIMENSION(:,:,:) :: zprorca, zprorcad, zprofed, zprofen, zprochln, zprochld, zpronew, zpronewd 
    9087      !!--------------------------------------------------------------------- 
     
    129126      END DO 
    130127 
    131       IF( ln_newprod ) THEN 
    132          ! Impact of the day duration on phytoplankton growth 
    133          DO jk = 1, jpkm1 
    134             DO jj = 1 ,jpj 
    135                DO ji = 1, jpi 
    136                   IF( etot(ji,jj,jk) > 1.E-3 ) THEN 
    137                      zval = MAX( 1., zstrn(ji,jj) ) 
    138                      zval = 1.5 * zval / ( 12. + zval ) 
    139                      zprbio(ji,jj,jk) = prmax(ji,jj,jk) * zval 
    140                      zprdia(ji,jj,jk) = zprbio(ji,jj,jk) 
    141                   ENDIF 
    142                END DO 
    143             END DO 
    144          END DO 
    145       ENDIF 
     128      ! Impact of the day duration on phytoplankton growth 
     129      DO jk = 1, jpkm1 
     130         DO jj = 1 ,jpj 
     131            DO ji = 1, jpi 
     132               IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN 
     133                  zval = MAX( 1., zstrn(ji,jj) ) 
     134                  zval = 1.5 * zval / ( 12. + zval ) 
     135                  zprbio(ji,jj,jk) = prmax(ji,jj,jk) * zval 
     136                  zprdia(ji,jj,jk) = zprbio(ji,jj,jk) 
     137               ENDIF 
     138            END DO 
     139         END DO 
     140      END DO 
    146141 
    147142      ! Maximum light intensity 
     
    150145 
    151146      IF( ln_newprod ) THEN 
    152 !CDIR NOVERRCHK 
    153147         DO jk = 1, jpkm1 
    154 !CDIR NOVERRCHK 
    155148            DO jj = 1, jpj 
    156 !CDIR NOVERRCHK 
    157149               DO ji = 1, jpi 
    158150                  ! Computation of the P-I slope for nanos and diatoms 
    159                   IF( etot(ji,jj,jk) > 1.E-3 ) THEN 
     151                  IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN 
    160152                      ztn         = MAX( 0., tsn(ji,jj,jk,jp_tem) - 15. ) 
    161153                      zadap       = xadap * ztn / ( 2.+ ztn ) 
    162                       zconctemp   = MAX( 0.e0 , trn(ji,jj,jk,jpdia) - xsizedia ) 
    163                       zconctemp2  = trn(ji,jj,jk,jpdia) - zconctemp 
     154                      zconctemp   = MAX( 0.e0 , trb(ji,jj,jk,jpdia) - xsizedia ) 
     155                      zconctemp2  = trb(ji,jj,jk,jpdia) - zconctemp 
    164156                      znanotot    = enano(ji,jj,jk) * zstrn(ji,jj) 
    165157                      zdiattot    = ediat(ji,jj,jk) * zstrn(ji,jj) 
    166158                      ! 
    167159                      zpislopead (ji,jj,jk) = pislope * ( 1.+ zadap  * EXP( -znanotot ) )  & 
    168                          &                   * trn(ji,jj,jk,jpnch) /( trn(ji,jj,jk,jpphy) * 12. + rtrn) 
     160                         &                   * trb(ji,jj,jk,jpnch) /( trb(ji,jj,jk,jpphy) * 12. + rtrn) 
    169161                      ! 
    170                       zpislopead2(ji,jj,jk) = (pislope * zconctemp2 + pislope2 * zconctemp) / ( trn(ji,jj,jk,jpdia) + rtrn )   & 
    171                          &                   * trn(ji,jj,jk,jpdch) /( trn(ji,jj,jk,jpdia) * 12. + rtrn) 
     162                      zpislopead2(ji,jj,jk) = (pislope * zconctemp2 + pislope2 * zconctemp) / ( trb(ji,jj,jk,jpdia) + rtrn )   & 
     163                         &                   * trb(ji,jj,jk,jpdch) /( trb(ji,jj,jk,jpdia) * 12. + rtrn) 
    172164 
    173165                      ! Computation of production function for Carbon 
     
    188180         END DO 
    189181      ELSE 
    190 !CDIR NOVERRCHK 
    191182         DO jk = 1, jpkm1 
    192 !CDIR NOVERRCHK 
    193183            DO jj = 1, jpj 
    194 !CDIR NOVERRCHK 
    195184               DO ji = 1, jpi 
    196185 
    197186                  ! Computation of the P-I slope for nanos and diatoms 
    198                   IF( etot(ji,jj,jk) > 1.E-3 ) THEN 
     187                  IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN 
    199188                      ztn         = MAX( 0., tsn(ji,jj,jk,jp_tem) - 15. ) 
    200189                      zadap       = ztn / ( 2.+ ztn ) 
    201                       zconctemp   = MAX( 0.e0 , trn(ji,jj,jk,jpdia) - xsizedia ) 
    202                       zconctemp2  = trn(ji,jj,jk,jpdia) - zconctemp 
     190                      zconctemp   = MAX( 0.e0 , trb(ji,jj,jk,jpdia) - xsizedia ) 
     191                      zconctemp2  = trb(ji,jj,jk,jpdia) - zconctemp 
     192                      znanotot    = enano(ji,jj,jk) * zstrn(ji,jj) 
     193                      zdiattot    = ediat(ji,jj,jk) * zstrn(ji,jj) 
    203194                      ! 
    204                       zpislopead (ji,jj,jk) = pislope  * ( 1.+ zadap  * EXP( -0.21 * enano(ji,jj,jk) ) ) 
    205                       zpislopead2(ji,jj,jk) = (pislope * zconctemp2 + pislope2 * zconctemp)  / ( trn(ji,jj,jk,jpdia) + rtrn ) 
    206  
    207                       zpislopen =  zpislopead(ji,jj,jk) * trn(ji,jj,jk,jpnch)                & 
    208                         &          / ( trn(ji,jj,jk,jpphy) * 12.                  + rtrn )   & 
     195                      zpislopead (ji,jj,jk) = pislope  * ( 1.+ zadap  * EXP( -znanotot ) ) 
     196                      zpislopead2(ji,jj,jk) = (pislope * zconctemp2 + pislope2 * zconctemp)  / ( trb(ji,jj,jk,jpdia) + rtrn ) 
     197 
     198                      zpislopen =  zpislopead(ji,jj,jk) * trb(ji,jj,jk,jpnch)                & 
     199                        &          / ( trb(ji,jj,jk,jpphy) * 12.                  + rtrn )   & 
    209200                        &          / ( prmax(ji,jj,jk) * rday * xlimphy(ji,jj,jk) + rtrn ) 
    210201 
    211                       zpislope2n = zpislopead2(ji,jj,jk) * trn(ji,jj,jk,jpdch)                & 
    212                         &          / ( trn(ji,jj,jk,jpdia) * 12.                  + rtrn )   & 
     202                      zpislope2n = zpislopead2(ji,jj,jk) * trb(ji,jj,jk,jpdch)                & 
     203                        &          / ( trb(ji,jj,jk,jpdia) * 12.                  + rtrn )   & 
    213204                        &          / ( prmax(ji,jj,jk) * rday * xlimdia(ji,jj,jk) + rtrn ) 
    214205 
    215206                      ! Computation of production function for Carbon 
    216207                      !  --------------------------------------------- 
    217                       zprbio(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopen  * enano(ji,jj,jk) ) ) 
    218                       zprdia(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislope2n * ediat(ji,jj,jk) ) ) 
     208                      zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * ( 1.- EXP( -zpislopen  * znanotot ) ) 
     209                      zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * ( 1.- EXP( -zpislope2n * zdiattot ) ) 
    219210 
    220211                      !  Computation of production function for Chlorophyll 
    221212                      !-------------------------------------------------- 
    222                       zprnch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopen  * enano(ji,jj,jk) * zstrn(ji,jj) ) ) 
    223                       zprdch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislope2n * ediat(ji,jj,jk) * zstrn(ji,jj) ) ) 
     213                      zprnch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopen  * enano(ji,jj,jk) ) ) 
     214                      zprdch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislope2n * ediat(ji,jj,jk) ) ) 
    224215                  ENDIF 
    225216               END DO 
     
    231222      !  Computation of a proxy of the N/C ratio 
    232223      !  --------------------------------------- 
    233 !CDIR NOVERRCHK 
    234224      DO jk = 1, jpkm1 
    235 !CDIR NOVERRCHK 
    236225         DO jj = 1, jpj 
    237 !CDIR NOVERRCHK 
    238226            DO ji = 1, jpi 
    239227                zval = MIN( xnanopo4(ji,jj,jk), ( xnanonh4(ji,jj,jk) + xnanono3(ji,jj,jk) ) )   & 
     
    252240            DO ji = 1, jpi 
    253241 
    254                 IF( etot(ji,jj,jk) > 1.E-3 ) THEN 
     242                IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN 
    255243                   !    Si/C of diatoms 
    256244                   !    ------------------------ 
     
    258246                   !    Si/C is arbitrariliy increased for very high Si concentrations 
    259247                   !    to mimic the very high ratios observed in the Southern Ocean (silpot2) 
    260                   zlim  = trn(ji,jj,jk,jpsil) / ( trn(ji,jj,jk,jpsil) + xksi1 ) 
     248                  zlim  = trb(ji,jj,jk,jpsil) / ( trb(ji,jj,jk,jpsil) + xksi1 ) 
    261249                  zsilim = MIN( zprdia(ji,jj,jk) / ( prmax(ji,jj,jk) + rtrn ), xlimsi(ji,jj,jk) ) 
    262250                  zsilfac = 4.4 * EXP( -4.23 * zsilim ) * MAX( 0.e0, MIN( 1., 2.2 * ( zlim - 0.5 ) )  ) + 1.e0 
    263                   zsiborn = trn(ji,jj,jk,jpsil) * trn(ji,jj,jk,jpsil) * trn(ji,jj,jk,jpsil) 
     251                  zsiborn = trb(ji,jj,jk,jpsil) * trb(ji,jj,jk,jpsil) * trb(ji,jj,jk,jpsil) 
    264252                  IF (gphit(ji,jj) < -30 ) THEN 
    265253                    zsilfac2 = 1. + 2. * zsiborn / ( zsiborn + xksi2**3 ) 
     
    287275         DO jj = 1, jpj 
    288276            DO ji = 1, jpi 
    289                IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN 
     277               IF( gdepw_n(ji,jj,jk+1) <= hmld(ji,jj) ) THEN 
    290278                  zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * zmixnano(ji,jj) 
    291279                  zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * zmixdiat(ji,jj) 
     
    296284 
    297285      ! Computation of the various production terms  
    298 !CDIR NOVERRCHK 
    299286      DO jk = 1, jpkm1 
    300 !CDIR NOVERRCHK 
    301287         DO jj = 1, jpj 
    302 !CDIR NOVERRCHK 
    303288            DO ji = 1, jpi 
    304                IF( etot(ji,jj,jk) > 1.E-3 ) THEN 
     289               IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN 
    305290                  !  production terms for nanophyto. 
    306                   zprorca(ji,jj,jk) = zprbio(ji,jj,jk)  * xlimphy(ji,jj,jk) * trn(ji,jj,jk,jpphy) * rfact2 
     291                  zprorca(ji,jj,jk) = zprbio(ji,jj,jk)  * xlimphy(ji,jj,jk) * trb(ji,jj,jk,jpphy) * rfact2 
    307292                  zpronew(ji,jj,jk) = zprorca(ji,jj,jk) * xnanono3(ji,jj,jk) / ( xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk) + rtrn ) 
    308293                  ! 
    309                   zratio = trn(ji,jj,jk,jpnfe) / ( trn(ji,jj,jk,jpphy) + rtrn ) 
     294                  zratio = trb(ji,jj,jk,jpnfe) / ( trb(ji,jj,jk,jpphy) + rtrn ) 
    310295                  zratio = zratio / fecnm  
    311296                  zmax   = MAX( 0., ( 1. - zratio ) / ABS( 1.05 - zratio ) )  
     
    313298                  &             * ( 4. - 4.5 * xlimnfe(ji,jj,jk) / ( xlimnfe(ji,jj,jk) + 0.5 ) )    & 
    314299                  &             * biron(ji,jj,jk) / ( biron(ji,jj,jk) + concnfe(ji,jj,jk) )  & 
    315                   &             * zmax * trn(ji,jj,jk,jpphy) * rfact2 
     300                  &             * zmax * trb(ji,jj,jk,jpphy) * rfact2 
    316301                  !  production terms for diatomees 
    317                   zprorcad(ji,jj,jk) = zprdia(ji,jj,jk) * xlimdia(ji,jj,jk) * trn(ji,jj,jk,jpdia) * rfact2 
     302                  zprorcad(ji,jj,jk) = zprdia(ji,jj,jk) * xlimdia(ji,jj,jk) * trb(ji,jj,jk,jpdia) * rfact2 
    318303                  zpronewd(ji,jj,jk) = zprorcad(ji,jj,jk) * xdiatno3(ji,jj,jk) / ( xdiatno3(ji,jj,jk) + xdiatnh4(ji,jj,jk) + rtrn ) 
    319304                  ! 
    320                   zratio = trn(ji,jj,jk,jpdfe) / ( trn(ji,jj,jk,jpdia) + rtrn ) 
     305                  zratio = trb(ji,jj,jk,jpdfe) / ( trb(ji,jj,jk,jpdia) + rtrn ) 
    321306                  zratio = zratio / fecdm  
    322307                  zmax   = MAX( 0., ( 1. - zratio ) / ABS( 1.05 - zratio ) )  
     
    324309                  &             * ( 4. - 4.5 * xlimdfe(ji,jj,jk) / ( xlimdfe(ji,jj,jk) + 0.5 ) )    & 
    325310                  &             * biron(ji,jj,jk) / ( biron(ji,jj,jk) + concdfe(ji,jj,jk) )  & 
    326                   &             * zmax * trn(ji,jj,jk,jpdia) * rfact2 
     311                  &             * zmax * trb(ji,jj,jk,jpdia) * rfact2 
    327312               ENDIF 
    328313            END DO 
     
    331316 
    332317      IF( ln_newprod ) THEN 
    333 !CDIR NOVERRCHK 
    334318         DO jk = 1, jpkm1 
    335 !CDIR NOVERRCHK 
    336319            DO jj = 1, jpj 
    337 !CDIR NOVERRCHK 
    338320               DO ji = 1, jpi 
    339                   IF( fsdepw(ji,jj,jk+1) <= hmld(ji,jj) ) THEN 
     321                  IF( gdepw_n(ji,jj,jk+1) <= hmld(ji,jj) ) THEN 
    340322                     zprnch(ji,jj,jk) = zprnch(ji,jj,jk) * zmixnano(ji,jj) 
    341323                     zprdch(ji,jj,jk) = zprdch(ji,jj,jk) * zmixdiat(ji,jj) 
    342324                  ENDIF 
    343                   IF( etot(ji,jj,jk) > 1.E-3 ) THEN 
     325                  IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN 
    344326                     !  production terms for nanophyto. ( chlorophyll ) 
    345327                     znanotot = enano(ji,jj,jk) * zstrn(ji,jj) 
     
    359341         END DO 
    360342      ELSE 
    361 !CDIR NOVERRCHK 
    362343         DO jk = 1, jpkm1 
    363 !CDIR NOVERRCHK 
    364344            DO jj = 1, jpj 
    365 !CDIR NOVERRCHK 
    366345               DO ji = 1, jpi 
    367                   IF( etot(ji,jj,jk) > 1.E-3 ) THEN 
     346                  IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN 
    368347                     !  production terms for nanophyto. ( chlorophyll ) 
    369                      znanotot = enano(ji,jj,jk) * zstrn(ji,jj) 
    370                      zprod = rday * zprorca(ji,jj,jk) * zprnch(ji,jj,jk) * trn(ji,jj,jk,jpphy) * xlimphy(ji,jj,jk) 
     348                     znanotot = enano(ji,jj,jk) 
     349                     zprod = rday * zprorca(ji,jj,jk) * zprnch(ji,jj,jk) * trb(ji,jj,jk,jpphy) * xlimphy(ji,jj,jk) 
    371350                     zprochln(ji,jj,jk) = chlcmin * 12. * zprorca (ji,jj,jk) 
    372351                     zprochln(ji,jj,jk) = zprochln(ji,jj,jk) + (chlcnm-chlcmin) * 144. * zprod            & 
    373                      &                    / ( zpislopead(ji,jj,jk) * trn(ji,jj,jk,jpnch) * znanotot +rtrn ) 
     352                     &                    / ( zpislopead(ji,jj,jk) * trb(ji,jj,jk,jpnch) * znanotot +rtrn ) 
    374353                     !  production terms for diatomees ( chlorophyll ) 
    375                      zdiattot = ediat(ji,jj,jk) * zstrn(ji,jj) 
    376                      zprod = rday * zprorcad(ji,jj,jk) * zprdch(ji,jj,jk) * trn(ji,jj,jk,jpdia) * xlimdia(ji,jj,jk) 
     354                     zdiattot = ediat(ji,jj,jk) 
     355                     zprod = rday * zprorcad(ji,jj,jk) * zprdch(ji,jj,jk) * trb(ji,jj,jk,jpdia) * xlimdia(ji,jj,jk) 
    377356                     zprochld(ji,jj,jk) = chlcmin * 12. * zprorcad(ji,jj,jk) 
    378357                     zprochld(ji,jj,jk) = zprochld(ji,jj,jk) + (chlcdm-chlcmin) * 144. * zprod             & 
    379                      &                    / ( zpislopead2(ji,jj,jk) * trn(ji,jj,jk,jpdch) * zdiattot +rtrn ) 
     358                     &                    / ( zpislopead2(ji,jj,jk) * trb(ji,jj,jk,jpdch) * zdiattot +rtrn ) 
    380359                  ENDIF 
    381360               END DO 
     
    412391     END DO 
    413392 
    414      ! Total primary production per year 
    415      tpp = tpp + glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) ) 
    416  
    417      IF( ln_diatrc ) THEN 
    418          ! 
    419          zrfact2 = 1.e3 * rfact2r  ! conversion from mol/L/timestep into mol/m3/s 
    420          IF( lk_iomput ) THEN 
    421            IF( jnt == nrdttrc ) THEN 
    422               CALL iom_put( "PPPHY"  , zprorca (:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by nanophyto 
    423               CALL iom_put( "PPPHY2" , zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by diatom 
    424               CALL iom_put( "PPNEWN" , zpronew (:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by nanophyto 
    425               CALL iom_put( "PPNEWD" , zpronewd(:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by diatom 
    426               CALL iom_put( "PBSi"   , zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:) ) ! biogenic silica production 
    427               CALL iom_put( "PFeD"   , zprofed (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by diatom 
    428               CALL iom_put( "PFeN"   , zprofen (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by nanophyto 
    429               CALL iom_put( "Mumax"  , prmax(:,:,:) * tmask(:,:,:) )  ! Maximum growth rate 
    430               CALL iom_put( "MuN"    , zprbio(:,:,:) * xlimphy(:,:,:) * tmask(:,:,:) )  ! Realized growth rate for nanophyto 
    431               CALL iom_put( "MuD"    , zprdia(:,:,:) * xlimdia(:,:,:) * tmask(:,:,:) )  ! Realized growth rate for diatoms 
    432               CALL iom_put( "LNlight", zprbio (:,:,:) / (prmax(:,:,:) + rtrn) * tmask(:,:,:) )  ! light limitation term 
    433               CALL iom_put( "LDlight", zprdia (:,:,:) / (prmax(:,:,:) + rtrn) * tmask(:,:,:) )  ! light limitation term 
    434            ENDIF 
    435          ELSE 
    436               trc3d(:,:,:,jp_pcs0_3d + 4)  = zprorca (:,:,:) * zrfact2 * tmask(:,:,:) 
    437               trc3d(:,:,:,jp_pcs0_3d + 5)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) 
    438               trc3d(:,:,:,jp_pcs0_3d + 6)  = zpronew (:,:,:) * zrfact2 * tmask(:,:,:) 
    439               trc3d(:,:,:,jp_pcs0_3d + 7)  = zpronewd(:,:,:) * zrfact2 * tmask(:,:,:) 
    440               trc3d(:,:,:,jp_pcs0_3d + 8)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:) 
    441               trc3d(:,:,:,jp_pcs0_3d + 9)  = zprofed (:,:,:) * zrfact2 * tmask(:,:,:) 
     393 
     394    ! Total primary production per year 
     395    IF( iom_use( "tintpp" ) .OR. ( ln_check_mass .AND. kt == nitend .AND. knt == nrdttrc )  )  & 
     396         & tpp = glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) ) 
     397 
     398    IF( lk_iomput ) THEN 
     399       IF( knt == nrdttrc ) THEN 
     400          CALL wrk_alloc( jpi, jpj,      zw2d ) 
     401          CALL wrk_alloc( jpi, jpj, jpk, zw3d ) 
     402          zfact = 1.e+3 * rfact2r  !  conversion from mol/l/kt to  mol/m3/s 
     403          ! 
     404          IF( iom_use( "PPPHY" ) .OR. iom_use( "PPPHY2" ) )  THEN 
     405              zw3d(:,:,:) = zprorca (:,:,:) * zfact * tmask(:,:,:)  ! primary production by nanophyto 
     406              CALL iom_put( "PPPHY"  , zw3d ) 
     407              ! 
     408              zw3d(:,:,:) = zprorcad(:,:,:) * zfact * tmask(:,:,:)  ! primary production by diatomes 
     409              CALL iom_put( "PPPHY2"  , zw3d ) 
     410          ENDIF 
     411          IF( iom_use( "PPNEWN" ) .OR. iom_use( "PPNEWD" ) )  THEN 
     412              zw3d(:,:,:) = zpronew (:,:,:) * zfact * tmask(:,:,:)  ! new primary production by nanophyto 
     413              CALL iom_put( "PPNEWN"  , zw3d ) 
     414              ! 
     415              zw3d(:,:,:) = zpronewd(:,:,:) * zfact * tmask(:,:,:)  ! new primary production by diatomes 
     416              CALL iom_put( "PPNEWD"  , zw3d ) 
     417          ENDIF 
     418          IF( iom_use( "PBSi" ) )  THEN 
     419              zw3d(:,:,:) = zprorcad(:,:,:) * zfact * tmask(:,:,:) * zysopt(:,:,:) ! biogenic silica production 
     420              CALL iom_put( "PBSi"  , zw3d ) 
     421          ENDIF 
     422          IF( iom_use( "PFeN" ) .OR. iom_use( "PFeD" ) )  THEN 
     423              zw3d(:,:,:) = zprofen(:,:,:) * zfact * tmask(:,:,:)  ! biogenic iron production by nanophyto 
     424              CALL iom_put( "PFeN"  , zw3d ) 
     425              ! 
     426              zw3d(:,:,:) = zprofed(:,:,:) * zfact * tmask(:,:,:)  ! biogenic iron production by  diatomes 
     427              CALL iom_put( "PFeD"  , zw3d ) 
     428          ENDIF 
     429          IF( iom_use( "Mumax" ) )  THEN 
     430              zw3d(:,:,:) = prmax(:,:,:) * tmask(:,:,:)   ! Maximum growth rate 
     431              CALL iom_put( "Mumax"  , zw3d ) 
     432          ENDIF 
     433          IF( iom_use( "MuN" ) .OR. iom_use( "MuD" ) )  THEN 
     434              zw3d(:,:,:) = zprbio(:,:,:) * xlimphy(:,:,:) * tmask(:,:,:)  ! Realized growth rate for nanophyto 
     435              CALL iom_put( "MuN"  , zw3d ) 
     436              ! 
     437              zw3d(:,:,:) =  zprdia(:,:,:) * xlimdia(:,:,:) * tmask(:,:,:)  ! Realized growth rate for diatoms 
     438              CALL iom_put( "MuD"  , zw3d ) 
     439          ENDIF 
     440          IF( iom_use( "LNlight" ) .OR. iom_use( "LDlight" ) )  THEN 
     441              zw3d(:,:,:) = zprbio (:,:,:) / (prmax(:,:,:) + rtrn) * tmask(:,:,:) ! light limitation term 
     442              CALL iom_put( "LNlight"  , zw3d ) 
     443              ! 
     444              zw3d(:,:,:) =  zprdia (:,:,:) / (prmax(:,:,:) + rtrn) * tmask(:,:,:)  ! light limitation term 
     445              CALL iom_put( "LDlight"  , zw3d ) 
     446          ENDIF 
     447          IF( iom_use( "TPP" ) )  THEN 
     448              zw3d(:,:,:) = ( zprorca(:,:,:) + zprorcad(:,:,:) ) * zfact * tmask(:,:,:)  ! total primary production 
     449              CALL iom_put( "TPP"  , zw3d ) 
     450          ENDIF 
     451          IF( iom_use( "TPNEW" ) )  THEN 
     452              zw3d(:,:,:) = ( zpronew(:,:,:) + zpronewd(:,:,:) ) * zfact * tmask(:,:,:)  ! total new production 
     453              CALL iom_put( "TPNEW"  , zw3d ) 
     454          ENDIF 
     455          IF( iom_use( "TPBFE" ) )  THEN 
     456              zw3d(:,:,:) = ( zprofen(:,:,:) + zprofed(:,:,:) ) * zfact * tmask(:,:,:)  ! total biogenic iron production 
     457              CALL iom_put( "TPBFE"  , zw3d ) 
     458          ENDIF 
     459          IF( iom_use( "INTPPPHY" ) .OR. iom_use( "INTPPPHY2" ) ) THEN   
     460             zw2d(:,:) = 0. 
     461             DO jk = 1, jpkm1 
     462               zw2d(:,:) = zw2d(:,:) + zprorca (:,:,jk) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk)  ! vert. integrated  primary produc. by nano 
     463             ENDDO 
     464             CALL iom_put( "INTPPPHY" , zw2d ) 
     465             ! 
     466             zw2d(:,:) = 0. 
     467             DO jk = 1, jpkm1 
     468                zw2d(:,:) = zw2d(:,:) + zprorcad(:,:,jk) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk) ! vert. integrated  primary produc. by diatom 
     469             ENDDO 
     470             CALL iom_put( "INTPPPHY2" , zw2d ) 
     471          ENDIF 
     472          IF( iom_use( "INTPP" ) ) THEN    
     473             zw2d(:,:) = 0. 
     474             DO jk = 1, jpkm1 
     475                zw2d(:,:) = zw2d(:,:) + ( zprorca(:,:,jk) + zprorcad(:,:,jk) ) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk) ! vert. integrated pp 
     476             ENDDO 
     477             CALL iom_put( "INTPP" , zw2d ) 
     478          ENDIF 
     479          IF( iom_use( "INTPNEW" ) ) THEN     
     480             zw2d(:,:) = 0. 
     481             DO jk = 1, jpkm1 
     482                zw2d(:,:) = zw2d(:,:) + ( zpronew(:,:,jk) + zpronewd(:,:,jk) ) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk)  ! vert. integrated new prod 
     483             ENDDO 
     484             CALL iom_put( "INTPNEW" , zw2d ) 
     485          ENDIF 
     486          IF( iom_use( "INTPBFE" ) ) THEN           !   total biogenic iron production  ( vertically integrated ) 
     487             zw2d(:,:) = 0. 
     488             DO jk = 1, jpkm1 
     489                zw2d(:,:) = zw2d(:,:) + ( zprofen(:,:,jk) + zprofed(:,:,jk) ) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk) ! vert integr. bfe prod 
     490             ENDDO 
     491            CALL iom_put( "INTPBFE" , zw2d ) 
     492          ENDIF 
     493          IF( iom_use( "INTPBSI" ) ) THEN           !   total biogenic silica production  ( vertically integrated ) 
     494             zw2d(:,:) = 0. 
     495             DO jk = 1, jpkm1 
     496                zw2d(:,:) = zw2d(:,:) + zprorcad(:,:,jk) * zysopt(:,:,jk) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk)  ! vert integr. bsi prod 
     497             ENDDO 
     498             CALL iom_put( "INTPBSI" , zw2d ) 
     499          ENDIF 
     500          IF( iom_use( "tintpp" ) )  CALL iom_put( "tintpp" , tpp * zfact )  !  global total integrated primary production molC/s 
     501          ! 
     502          CALL wrk_dealloc( jpi, jpj,      zw2d ) 
     503          CALL wrk_dealloc( jpi, jpj, jpk, zw3d ) 
     504       ENDIF 
     505     ELSE 
     506        IF( ln_diatrc ) THEN 
     507           zfact = 1.e+3 * rfact2r 
     508           trc3d(:,:,:,jp_pcs0_3d + 4)  = zprorca (:,:,:) * zfact * tmask(:,:,:) 
     509           trc3d(:,:,:,jp_pcs0_3d + 5)  = zprorcad(:,:,:) * zfact * tmask(:,:,:) 
     510           trc3d(:,:,:,jp_pcs0_3d + 6)  = zpronew (:,:,:) * zfact * tmask(:,:,:) 
     511           trc3d(:,:,:,jp_pcs0_3d + 7)  = zpronewd(:,:,:) * zfact * tmask(:,:,:) 
     512           trc3d(:,:,:,jp_pcs0_3d + 8)  = zprorcad(:,:,:) * zfact * tmask(:,:,:) * zysopt(:,:,:) 
     513           trc3d(:,:,:,jp_pcs0_3d + 9)  = zprofed (:,:,:) * zfact * tmask(:,:,:) 
    442514#  if ! defined key_kriest 
    443               trc3d(:,:,:,jp_pcs0_3d + 10) = zprofen (:,:,:) * zrfact2 * tmask(:,:,:) 
     515           trc3d(:,:,:,jp_pcs0_3d + 10) = zprofen (:,:,:) * zfact * tmask(:,:,:) 
    444516#  endif 
    445          ENDIF 
    446          ! 
    447       ENDIF 
    448  
    449       IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
     517        ENDIF 
     518     ENDIF 
     519 
     520     IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
    450521         WRITE(charout, FMT="('prod')") 
    451522         CALL prt_ctl_trc_info(charout) 
    452523         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm) 
    453       ENDIF 
    454       ! 
    455       CALL wrk_dealloc( jpi, jpj,      zmixnano, zmixdiat, zstrn                                                  ) 
    456       CALL wrk_dealloc( jpi, jpj, jpk, zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt            )  
    457       CALL wrk_dealloc( jpi, jpj, jpk, zprorca, zprorcad, zprofed, zprofen, zprochln, zprochld, zpronew, zpronewd ) 
    458       ! 
    459       IF( nn_timing == 1 )  CALL timing_stop('p4z_prod') 
    460       ! 
     524     ENDIF 
     525     ! 
     526     CALL wrk_dealloc( jpi, jpj,      zmixnano, zmixdiat, zstrn                                                  ) 
     527     CALL wrk_dealloc( jpi, jpj, jpk, zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt            )  
     528     CALL wrk_dealloc( jpi, jpj, jpk, zprorca, zprorcad, zprofed, zprofen, zprochln, zprochld, zpronew, zpronewd ) 
     529     ! 
     530     IF( nn_timing == 1 )  CALL timing_stop('p4z_prod') 
     531     ! 
    461532   END SUBROUTINE p4z_prod 
    462533 
     
    537608 
    538609   !!====================================================================== 
    539 END MODULE  p4zprod 
     610END MODULE p4zprod 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zrem.F90

    r4624 r6225  
    5050   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   denitnh4   !: -    -    -    -   - 
    5151 
    52    !!* Substitution 
    53 #  include "top_substitute.h90" 
    5452   !!---------------------------------------------------------------------- 
    5553   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    5957CONTAINS 
    6058 
    61    SUBROUTINE p4z_rem( kt, jnt ) 
     59   SUBROUTINE p4z_rem( kt, knt ) 
    6260      !!--------------------------------------------------------------------- 
    6361      !!                     ***  ROUTINE p4z_rem  *** 
     
    6866      !!--------------------------------------------------------------------- 
    6967      ! 
    70       INTEGER, INTENT(in) ::   kt, jnt ! ocean time step 
     68      INTEGER, INTENT(in) ::   kt, knt ! ocean time step 
    7169      ! 
    7270      INTEGER  ::   ji, jj, jk 
     
    7876      REAL(wp) ::   zofer2 
    7977#endif 
    80       REAL(wp) ::   zonitr, zstep, zrfact2 
     78      REAL(wp) ::   zonitr, zstep, zfact 
    8179      CHARACTER (len=25) :: charout 
    82       REAL(wp), POINTER, DIMENSION(:,:  ) :: ztempbac  
    83       REAL(wp), POINTER, DIMENSION(:,:,:) :: zdepbac, zolimi, zdepprod 
     80      REAL(wp), POINTER, DIMENSION(:,:  ) :: ztempbac 
     81      REAL(wp), POINTER, DIMENSION(:,:,:) :: zdepbac, zolimi, zdepprod, zw3d 
    8482      !!--------------------------------------------------------------------- 
    8583      ! 
     
    103101            DO ji = 1, jpi 
    104102               zdep = MAX( hmld(ji,jj), heup(ji,jj) ) 
    105                IF( fsdept(ji,jj,jk) < zdep ) THEN 
    106                   zdepbac(ji,jj,jk) = MIN( 0.7 * ( trn(ji,jj,jk,jpzoo) + 2.* trn(ji,jj,jk,jpmes) ), 4.e-6 ) 
     103               IF( gdept_n(ji,jj,jk) < zdep ) THEN 
     104                  zdepbac(ji,jj,jk) = MIN( 0.7 * ( trb(ji,jj,jk,jpzoo) + 2.* trb(ji,jj,jk,jpmes) ), 4.e-6 ) 
    107105                  ztempbac(ji,jj)   = zdepbac(ji,jj,jk) 
    108106               ELSE 
    109                   zdepmin = MIN( 1., zdep / fsdept(ji,jj,jk) ) 
     107                  zdepmin = MIN( 1., zdep / gdept_n(ji,jj,jk) ) 
    110108                  zdepbac (ji,jj,jk) = zdepmin**0.683 * ztempbac(ji,jj) 
    111109                  zdepprod(ji,jj,jk) = zdepmin**0.273 
     
    119117            DO ji = 1, jpi 
    120118               ! denitrification factor computed from O2 levels 
    121                nitrfac(ji,jj,jk) = MAX(  0.e0, 0.4 * ( 6.e-6  - trn(ji,jj,jk,jpoxy) )    & 
    122                   &                                / ( oxymin + trn(ji,jj,jk,jpoxy) )  ) 
     119               nitrfac(ji,jj,jk) = MAX(  0.e0, 0.4 * ( 6.e-6  - trb(ji,jj,jk,jpoxy) )    & 
     120                  &                                / ( oxymin + trb(ji,jj,jk,jpoxy) )  ) 
    123121               nitrfac(ji,jj,jk) = MIN( 1., nitrfac(ji,jj,jk) ) 
    124122            END DO 
     
    140138               ! Ammonification in oxic waters with oxygen consumption 
    141139               ! ----------------------------------------------------- 
    142                zolimit = zremik * ( 1.- nitrfac(ji,jj,jk) ) * trn(ji,jj,jk,jpdoc)  
    143                zolimi(ji,jj,jk) = MIN( ( trn(ji,jj,jk,jpoxy) - rtrn ) / o2ut, zolimit )  
     140               zolimit = zremik * ( 1.- nitrfac(ji,jj,jk) ) * trb(ji,jj,jk,jpdoc)  
     141               zolimi(ji,jj,jk) = MIN( ( trb(ji,jj,jk,jpoxy) - rtrn ) / o2ut, zolimit )  
    144142               ! Ammonification in suboxic waters with denitrification 
    145143               ! ------------------------------------------------------- 
    146                denitr(ji,jj,jk)  = MIN(  ( trn(ji,jj,jk,jpno3) - rtrn ) / rdenit,   & 
    147                   &                     zremik * nitrfac(ji,jj,jk) * trn(ji,jj,jk,jpdoc)  ) 
     144               denitr(ji,jj,jk)  = MIN(  ( trb(ji,jj,jk,jpno3) - rtrn ) / rdenit,   & 
     145                  &                     zremik * nitrfac(ji,jj,jk) * trb(ji,jj,jk,jpdoc)  ) 
    148146               ! 
    149147               zolimi (ji,jj,jk) = MAX( 0.e0, zolimi (ji,jj,jk) ) 
     
    165163               ! below 2 umol/L. Inhibited at strong light  
    166164               ! ---------------------------------------------------------- 
    167                zonitr  =nitrif * zstep * trn(ji,jj,jk,jpnh4) / ( 1.+ emoy(ji,jj,jk) ) * ( 1.- nitrfac(ji,jj,jk) )  
    168                denitnh4(ji,jj,jk) = nitrif * zstep * trn(ji,jj,jk,jpnh4) * nitrfac(ji,jj,jk)  
     165               zonitr  =nitrif * zstep * trb(ji,jj,jk,jpnh4) / ( 1.+ emoy(ji,jj,jk) ) * ( 1.- nitrfac(ji,jj,jk) )  
     166               denitnh4(ji,jj,jk) = nitrif * zstep * trb(ji,jj,jk,jpnh4) * nitrfac(ji,jj,jk)  
    169167               ! Update of the tracers trends 
    170168               ! ---------------------------- 
     
    192190               ! ---------------------------------------------------------- 
    193191               zbactfer = 10.e-6 *  rfact2 * prmax(ji,jj,jk) * xlimbacl(ji,jj,jk)             & 
    194                   &              * trn(ji,jj,jk,jpfer) / ( 2.5E-10 + trn(ji,jj,jk,jpfer) )    & 
     192                  &              * trb(ji,jj,jk,jpfer) / ( 2.5E-10 + trb(ji,jj,jk,jpfer) )    & 
    195193                  &              * zdepprod(ji,jj,jk) * zdepbac(ji,jj,jk) 
    196194#if defined key_kriest 
     
    228226               ! means a disaggregation constant about 0.5 the value in oxic zones 
    229227               ! ----------------------------------------------------------------- 
    230                zorem  = zremip * trn(ji,jj,jk,jppoc) 
    231                zofer  = zremip * trn(ji,jj,jk,jpsfe) 
     228               zorem  = zremip * trb(ji,jj,jk,jppoc) 
     229               zofer  = zremip * trb(ji,jj,jk,jpsfe) 
    232230#if ! defined key_kriest 
    233                zorem2 = zremip * trn(ji,jj,jk,jpgoc) 
    234                zofer2 = zremip * trn(ji,jj,jk,jpbfe) 
     231               zorem2 = zremip * trb(ji,jj,jk,jpgoc) 
     232               zofer2 = zremip * trb(ji,jj,jk,jpbfe) 
    235233#else 
    236                zorem2 = zremip * trn(ji,jj,jk,jpnum) 
     234               zorem2 = zremip * trb(ji,jj,jk,jpnum) 
    237235#endif 
    238236 
     
    272270               ! Remineralization rate of BSi depedant on T and saturation 
    273271               ! --------------------------------------------------------- 
    274                zsatur   = ( sio3eq(ji,jj,jk) - trn(ji,jj,jk,jpsil) ) / ( sio3eq(ji,jj,jk) + rtrn ) 
     272               zsatur   = ( sio3eq(ji,jj,jk) - trb(ji,jj,jk,jpsil) ) / ( sio3eq(ji,jj,jk) + rtrn ) 
    275273               zsatur   = MAX( rtrn, zsatur ) 
    276274               zsatur2  = ( 1. + tsn(ji,jj,jk,jp_tem) / 400.)**37 
     
    283281               ! ---------------------------------------------------------- 
    284282               zdep     = MAX( hmld(ji,jj), heup(ji,jj) )  
    285                zdep     = MAX( 0., fsdept(ji,jj,jk) - zdep ) 
     283               zdep     = MAX( 0., gdept_n(ji,jj,jk) - zdep ) 
    286284               ztem     = MAX( tsn(ji,jj,1,jp_tem), 0. ) 
    287285               zfactdep = xsilab * EXP(-( xsiremlab - xsirem ) * znusil2 * zdep / wsbio2 ) * ztem / ( ztem + 10. ) 
    288286               zsiremin = ( xsiremlab * zfactdep + xsirem * ( 1. - zfactdep ) ) * zstep * znusil 
    289                zosil    = zsiremin * trn(ji,jj,jk,jpgsi) 
     287               zosil    = zsiremin * trb(ji,jj,jk,jpgsi) 
    290288               ! 
    291289               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) - zosil 
     
    315313      END DO 
    316314 
    317       IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc ) THEN 
    318           zrfact2 = 1.e3 * rfact2r 
    319           CALL iom_put( "REMIN" , zolimi(:,:,:) * tmask(:,:,:) * zrfact2 )  ! Remineralisation rate 
    320           CALL iom_put( "DENIT" , denitr(:,:,:) * rdenit * rno3 * tmask(:,:,:) * zrfact2  )  ! Denitrification 
    321       ENDIF 
     315      IF( knt == nrdttrc ) THEN 
     316          CALL wrk_alloc( jpi, jpj, jpk, zw3d ) 
     317          zfact = 1.e+3 * rfact2r  !  conversion from mol/l/kt to  mol/m3/s 
     318          ! 
     319          IF( iom_use( "REMIN" ) )  THEN 
     320              zw3d(:,:,:) = zolimi(:,:,:) * tmask(:,:,:) * zfact !  Remineralisation rate 
     321              CALL iom_put( "REMIN"  , zw3d ) 
     322          ENDIF 
     323          IF( iom_use( "DENIT" ) )  THEN 
     324              zw3d(:,:,:) = denitr(:,:,:) * rdenit * rno3 * tmask(:,:,:) * zfact ! Denitrification 
     325              CALL iom_put( "DENIT"  , zw3d ) 
     326          ENDIF 
     327          ! 
     328          CALL wrk_dealloc( jpi, jpj, jpk, zw3d ) 
     329       ENDIF 
    322330 
    323331      IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90

    • Property svn:keywords set to Id
    r4624 r6225  
    2525   PUBLIC   p4z_sbc_init    
    2626 
    27    !! * Shared module variables 
    2827   LOGICAL , PUBLIC  :: ln_dust     !: boolean for dust input from the atmosphere 
    2928   LOGICAL , PUBLIC  :: ln_solub    !: boolean for variable solubility of atmospheric iron 
     
    4544   LOGICAL , PUBLIC  :: ll_sbc 
    4645 
    47    !! * Module variables 
    4846   LOGICAL  ::  ll_solub 
    4947 
     
    8078   REAL(wp), PUBLIC :: rivdininput, rivdipinput, rivdsiinput 
    8179 
    82    REAL(wp) :: ryyss                    !: number of seconds per year  
    83  
    84    !!* Substitution 
    85 #  include "top_substitute.h90" 
     80   !! * Substitutions 
     81#  include "vectopt_loop_substitute.h90" 
    8682   !!---------------------------------------------------------------------- 
    8783   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    88    !! $Header:$  
     84   !! $Id$  
    8985   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    9086   !!---------------------------------------------------------------------- 
    91  
    9287CONTAINS 
    9388 
     
    118113         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_dust > 1 ) ) THEN 
    119114            CALL fld_read( kt, 1, sf_dust ) 
    120             dust(:,:) = sf_dust(1)%fnow(:,:,1) 
     115            IF( nn_ice_tr == -1 .AND. .NOT. ln_ironice ) THEN 
     116               dust(:,:) = sf_dust(1)%fnow(:,:,1) 
     117            ELSE 
     118               dust(:,:) = sf_dust(1)%fnow(:,:,1) * ( 1.0 - fr_i(:,:) ) 
     119            ENDIF 
    121120         ENDIF 
    122121      ENDIF 
     
    137136            DO jj = 1, jpj 
    138137               DO ji = 1, jpi 
    139                   zcoef = ryyss * cvol(ji,jj,1)  
     138                  zcoef = ryyss * e1e2t(ji,jj) * h_rnf(ji,jj)  
    140139                  rivalk(ji,jj) =   sf_river(jr_dic)%fnow(ji,jj,1)                                    & 
    141140                     &              * 1.E3        / ( 12. * zcoef + rtrn ) 
     
    159158            DO jj = 1, jpj 
    160159               DO ji = 1, jpi 
    161                   nitdep(ji,jj) = sf_ndepo(1)%fnow(ji,jj,1) / rno3 / ( 14E6 * ryyss * fse3t(ji,jj,1) + rtrn ) 
     160                  nitdep(ji,jj) = sf_ndepo(1)%fnow(ji,jj,1) / rno3 / ( 14E6 * ryyss * e3t_n(ji,jj,1) + rtrn ) 
    162161               END DO 
    163162            END DO 
     
    188187      INTEGER  :: ierr, ierr1, ierr2, ierr3 
    189188      INTEGER  :: ios                 ! Local integer output status for namelist read 
     189      INTEGER  :: ik50                !  last level where depth less than 50 m 
     190      INTEGER  :: isrow             ! index for ORCA1 starting row 
    190191      REAL(wp) :: zexpide, zdenitide, zmaskt 
    191192      REAL(wp) :: ztimes_dust, ztimes_riv, ztimes_ndep  
     
    208209      IF( nn_timing == 1 )  CALL timing_start('p4z_sbc_init') 
    209210      ! 
    210       ryyss   = nyear_len(1) * rday    ! number of seconds per year and per month 
    211       ! 
    212211      !                            !* set file information 
    213212      REWIND( numnatp_ref )              ! Namelist nampissbc in reference namelist : Pisces external sources of nutrients 
     
    219218902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampissbc in configuration namelist', lwp ) 
    220219      IF(lwm) WRITE ( numonp, nampissbc ) 
     220 
     221      IF ( ( nn_ice_tr >= 0 ) .AND. ln_ironice ) THEN 
     222         IF(lwp) THEN 
     223            WRITE(numout,*) ' ln_ironice incompatible with nn_ice_tr = ', nn_ice_tr 
     224            WRITE(numout,*) ' Specify your sea ice iron concentration in nampisice instead ' 
     225            WRITE(numout,*) ' ln_ironice is forced to .FALSE. ' 
     226            ln_ironice = .FALSE. 
     227         ENDIF 
     228      ENDIF 
    221229 
    222230      IF(lwp) THEN 
     
    250258      ENDIF 
    251259 
     260      ! set the number of level over which river runoffs are applied  
     261      ! online configuration : computed in sbcrnf 
     262      IF( lk_offline ) THEN 
     263        nk_rnf(:,:) = 1 
     264        h_rnf (:,:) = gdept_n(:,:,1) 
     265      ENDIF 
     266 
    252267      ! dust input from the atmosphere 
    253268      ! ------------------------------ 
     
    361376         rivalkinput = 0._wp 
    362377      END IF  
    363  
    364378      ! nutrient input from dust 
    365379      ! ------------------------ 
     
    413427         CALL iom_close( numiron ) 
    414428         ! 
    415          DO jk = 1, 5 
     429         ik50 = 5        !  last level where depth less than 50 m 
     430         DO jk = jpkm1, 1, -1 
     431            IF( gdept_1d(jk) > 50. )  ik50 = jk - 1 
     432         END DO 
     433         IF (lwp) WRITE(numout,*) 
     434         IF (lwp) WRITE(numout,*) ' Level corresponding to 50m depth ',  ik50,' ', gdept_1d(ik50+1) 
     435         IF (lwp) WRITE(numout,*) 
     436         DO jk = 1, ik50 
    416437            DO jj = 2, jpjm1 
    417438               DO ji = fs_2, fs_jpim1 
     
    424445            END DO 
    425446         END DO 
    426          IF( cp_cfg == 'orca' .AND. jp_cfg == 2 ) THEN 
    427             ii0 = 176   ;   ii1 =  176        ! Southern Island : Kerguelen 
    428             ij0 =  37   ;   ij1 =   37  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp   
    429             ! 
    430             ii0 = 119   ;   ii1 =  119        ! South Georgia 
    431             ij0 =  29   ;   ij1 =   29  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp   
    432             ! 
    433             ii0 = 111   ;   ii1 =  111        ! Falklands 
    434             ij0 =  35   ;   ij1 =   35  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp   
    435             ! 
    436             ii0 = 168   ;   ii1 =  168        ! Crozet 
    437             ij0 =  40   ;   ij1 =   40  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp   
    438             ! 
    439             ii0 = 119   ;   ii1 =  119        ! South Orkney 
    440             ij0 =  28   ;   ij1 =   28  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp   
    441             ! 
    442             ii0 = 140   ;   ii1 =  140        ! Bouvet Island 
    443             ij0 =  33   ;   ij1 =   33  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp   
    444             ! 
    445             ii0 = 178   ;   ii1 =  178        ! Prince edwards 
    446             ij0 =  34   ;   ij1 =   34  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp   
    447             ! 
    448             ii0 =  43   ;   ii1 =   43        ! Balleny islands 
    449             ij0 =  21   ;   ij1 =   21  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp   
    450          ENDIF 
     447         ! 
    451448         CALL lbc_lnk( zcmask , 'T', 1. )      ! lateral boundary conditions on cmask   (sign unchanged) 
     449         ! 
    452450         DO jk = 1, jpk 
    453451            DO jj = 1, jpj 
    454452               DO ji = 1, jpi 
    455                   zexpide   = MIN( 8.,( fsdept(ji,jj,jk) / 500. )**(-1.5) ) 
     453                  zexpide   = MIN( 8.,( gdept_n(ji,jj,jk) / 500. )**(-1.5) ) 
    456454                  zdenitide = -0.9543 + 0.7662 * LOG( zexpide ) - 0.235 * LOG( zexpide )**2 
    457455                  zcmask(ji,jj,jk) = zcmask(ji,jj,jk) * MIN( 1., EXP( zdenitide ) / 0.5 ) 
     
    463461         ironsed(:,:,jpk) = 0._wp 
    464462         DO jk = 1, jpkm1 
    465             ironsed(:,:,jk) = sedfeinput * zcmask(:,:,jk) / ( fse3t(:,:,jk) * rday ) 
     463            ironsed(:,:,jk) = sedfeinput * zcmask(:,:,jk) / ( e3t_n(:,:,jk) * rday ) 
    466464         END DO 
    467465         DEALLOCATE( zcmask) 
     
    517515 
    518516   !!====================================================================== 
    519 END MODULE  p4zsbc 
     517END MODULE p4zsbc 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsed.F90

    • Property svn:keywords set to Id
    r4641 r6225  
    2121   USE p4zopt          !  optical model 
    2222   USE p4zlim          !  Co-limitations of differents nutrients 
    23    USE p4zrem          !  Remineralisation of organic matter 
    2423   USE p4zsbc          !  External source of nutrients  
    2524   USE p4zint          !  interpolation and computation of various fields 
     
    3029   PRIVATE 
    3130 
    32    PUBLIC   p4z_sed    
    33  
    34    !! * Module variables 
    35    REAL(wp) :: ryyss                    !: number of seconds per year  
    36    REAL(wp) :: r1_ryyss                 !: inverse of ryyss 
    37    REAL(wp) :: rmtss                    !: number of seconds per month 
     31   PUBLIC   p4z_sed   
     32   PUBLIC   p4z_sed_alloc 
     33  
     34   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: nitrpot    !: Nitrogen fixation  
     35   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:  ) :: sdenit     !: Nitrate reduction in the sediments 
    3836   REAL(wp) :: r1_rday                  !: inverse of rday 
    3937 
    40    INTEGER ::  numnit   
    41  
    42  
    43    !!* Substitution 
    44 #  include "top_substitute.h90" 
    4538   !!---------------------------------------------------------------------- 
    4639   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    47    !! $Header:$  
     40   !! $Id$  
    4841   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4942   !!---------------------------------------------------------------------- 
    5043CONTAINS 
    5144 
    52    SUBROUTINE p4z_sed( kt, jnt ) 
     45   SUBROUTINE p4z_sed( kt, knt ) 
    5346      !!--------------------------------------------------------------------- 
    5447      !!                     ***  ROUTINE p4z_sed  *** 
     
    6154      !!--------------------------------------------------------------------- 
    6255      ! 
    63       INTEGER, INTENT(in) ::   kt, jnt ! ocean time step 
     56      INTEGER, INTENT(in) ::   kt, knt ! ocean time step 
    6457      INTEGER  ::   ji, jj, jk, ikt 
    6558#if ! defined key_sed 
     
    7265      REAL(wp) ::  zsiloss, zcaloss, zws3, zws4, zwsc, zdep, zwstpoc 
    7366      REAL(wp) ::  ztrfer, ztrpo4, zwdust, zlight 
    74       REAL(wp) ::  zrdenittot, zsdenittot, znitrpottot 
    7567      ! 
    7668      CHARACTER (len=25) :: charout 
    77       REAL(wp), POINTER, DIMENSION(:,:  ) :: zpdep, zsidep, zwork1, zwork2, zwork3, zwork4 
     69      REAL(wp), POINTER, DIMENSION(:,:  ) :: zpdep, zsidep, zwork1, zwork2, zwork3 
    7870      REAL(wp), POINTER, DIMENSION(:,:  ) :: zdenit2d, zironice, zbureff 
    7971      REAL(wp), POINTER, DIMENSION(:,:  ) :: zwsbio3, zwsbio4, zwscal 
    80       REAL(wp), POINTER, DIMENSION(:,:,:) :: znitrpot, zirondep, zsoufer 
     72      REAL(wp), POINTER, DIMENSION(:,:,:) :: zirondep, zsoufer 
    8173      !!--------------------------------------------------------------------- 
    8274      ! 
    8375      IF( nn_timing == 1 )  CALL timing_start('p4z_sed') 
    8476      ! 
    85       IF( kt == nittrc000 .AND. jnt == 1 )  THEN 
    86          ryyss    = nyear_len(1) * rday    ! number of seconds per year and per month 
    87          rmtss    = ryyss / raamo 
    88          r1_rday  = 1. / rday 
    89          r1_ryyss = 1. / ryyss 
    90          IF( ln_check_mass .AND. lwp)  & 
    91            &  CALL ctl_opn( numnit, 'nitrogen.budget', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea ) 
    92       ENDIF 
     77      IF( kt == nittrc000 .AND. knt == 1 )   r1_rday  = 1. / rday 
    9378      ! 
    9479      ! Allocate temporary workspace 
    95       CALL wrk_alloc( jpi, jpj, zdenit2d, zwork1, zwork2, zwork3, zwork4, zbureff ) 
     80      CALL wrk_alloc( jpi, jpj, zdenit2d, zwork1, zwork2, zwork3, zbureff ) 
    9681      CALL wrk_alloc( jpi, jpj, zwsbio3, zwsbio4, zwscal ) 
    97       CALL wrk_alloc( jpi, jpj, jpk, znitrpot, zsoufer ) 
     82      CALL wrk_alloc( jpi, jpj, jpk, zsoufer ) 
    9883 
    9984      zdenit2d(:,:) = 0.e0 
    10085      zbureff (:,:) = 0.e0 
     86      zwork1  (:,:) = 0.e0 
     87      zwork2  (:,:) = 0.e0 
     88      zwork3  (:,:) = 0.e0 
    10189 
    10290      ! Iron input/uptake due to sea ice : Crude parameterization based on Lancelot et al. 
     
    10896         DO jj = 1, jpj 
    10997            DO ji = 1, jpi 
    110                zdep    = rfact2 / fse3t(ji,jj,1) 
     98               zdep    = rfact2 / e3t_n(ji,jj,1) 
    11199               zwflux  = fmmflx(ji,jj) / 1000._wp 
    112                zfminus = MIN( 0._wp, -zwflux ) * trn(ji,jj,1,jpfer) * zdep 
     100               zfminus = MIN( 0._wp, -zwflux ) * trb(ji,jj,1,jpfer) * zdep 
    113101               zfplus  = MAX( 0._wp, -zwflux ) * icefeinput * zdep 
    114102               zironice(ji,jj) =  zfplus + zfminus 
     
    116104         END DO 
    117105         ! 
    118          trn(:,:,1,jpfer) = trn(:,:,1,jpfer) + zironice(:,:)  
    119          !                                               
    120          IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc )   & 
    121             &   CALL iom_put( "Ironice", zironice(:,:) * 1.e+3 * rfact2r * fse3t(:,:,1) * tmask(:,:,1) ) ! iron flux from ice 
     106         tra(:,:,1,jpfer) = tra(:,:,1,jpfer) + zironice(:,:)  
     107         !  
     108         IF( lk_iomput .AND. knt == nrdttrc .AND. iom_use( "Ironice" ) )   & 
     109            &   CALL iom_put( "Ironice", zironice(:,:) * 1.e+3 * rfact2r * e3t_n(:,:,1) * tmask(:,:,1) ) ! iron flux from ice 
     110         ! 
    122111         CALL wrk_dealloc( jpi, jpj, zironice ) 
    123112         !                                               
     
    132121         !                                              ! Iron and Si deposition at the surface 
    133122         IF( ln_solub ) THEN 
    134             zirondep(:,:,1) = solub(:,:) * dust(:,:) * mfrac * rfact2 / fse3t(:,:,1) / ( 55.85 * rmtss ) + 3.e-10 * r1_ryyss  
     123            zirondep(:,:,1) = solub(:,:) * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 55.85 + 3.e-10 * r1_ryyss  
    135124         ELSE 
    136             zirondep(:,:,1) = dustsolub  * dust(:,:) * mfrac * rfact2 / fse3t(:,:,1) / ( 55.85 * rmtss ) + 3.e-10 * r1_ryyss  
     125            zirondep(:,:,1) = dustsolub  * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 55.85 + 3.e-10 * r1_ryyss  
    137126         ENDIF 
    138          zsidep(:,:) = 8.8 * 0.075 * dust(:,:) * mfrac * rfact2 / fse3t(:,:,1) / ( 28.1  * rmtss ) 
    139          zpdep (:,:) = 0.1 * 0.021 * dust(:,:) * mfrac * rfact2 / fse3t(:,:,1) / ( 31.   * rmtss ) / po4r  
     127         zsidep(:,:) = 8.8 * 0.075 * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 28.1  
     128         zpdep (:,:) = 0.1 * 0.021 * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 31. / po4r  
    140129         !                                              ! Iron solubilization of particles in the water column 
    141130         !                                              ! dust in kg/m2/s ---> 1/55.85 to put in mol/Fe ;  wdust in m/j 
    142131         zwdust = 0.03 * rday / ( wdust * 55.85 ) / ( 270. * rday ) 
    143132         DO jk = 2, jpkm1 
    144             zirondep(:,:,jk) = dust(:,:) * mfrac * zwdust * rfact2 * EXP( -fsdept(:,:,jk) / 540. ) 
     133            zirondep(:,:,jk) = dust(:,:) * mfrac * zwdust * rfact2 * EXP( -gdept_n(:,:,jk) / 540. ) 
    145134         END DO 
    146135         !                                              ! Iron solubilization of particles in the water column 
    147          trn(:,:,1,jppo4) = trn(:,:,1,jppo4) + zpdep   (:,:) 
    148          trn(:,:,1,jpsil) = trn(:,:,1,jpsil) + zsidep  (:,:) 
    149          trn(:,:,:,jpfer) = trn(:,:,:,jpfer) + zirondep(:,:,:)  
    150          !                                               
    151          IF( ln_diatrc ) THEN 
    152             zfact = 1.e+3 * rfact2r 
    153             IF( lk_iomput ) THEN 
    154                IF( jnt == nrdttrc ) THEN 
    155                   CALL iom_put( "Irondep", zirondep(:,:,1) * zfact * fse3t(:,:,1) * tmask(:,:,1) ) ! surface downward dust depo of iron 
    156                   CALL iom_put( "pdust"  , dust(:,:) / ( wdust * rday )  * tmask(:,:,1) ) ! dust concentration at surface 
    157                ENDIF 
    158             ELSE 
    159                trc2d(:,:,jp_pcs0_2d + 11) = zirondep(:,:,1) * zfact * fse3t(:,:,1) * tmask(:,:,1) 
     136         tra(:,:,1,jppo4) = tra(:,:,1,jppo4) + zpdep   (:,:) 
     137         tra(:,:,1,jpsil) = tra(:,:,1,jpsil) + zsidep  (:,:) 
     138         tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + zirondep(:,:,:)  
     139         !  
     140         IF( lk_iomput ) THEN 
     141            IF( knt == nrdttrc ) THEN 
     142                IF( iom_use( "Irondep" ) )   & 
     143                &  CALL iom_put( "Irondep", zirondep(:,:,1) * 1.e+3 * rfact2r * e3t_n(:,:,1) * tmask(:,:,1) ) ! surface downward dust depo of iron 
     144                IF( iom_use( "pdust" ) )   & 
     145                &  CALL iom_put( "pdust"  , dust(:,:) / ( wdust * rday )  * tmask(:,:,1) ) ! dust concentration at surface 
    160146            ENDIF 
     147         ELSE                                     
     148            IF( ln_diatrc )  & 
     149              &  trc2d(:,:,jp_pcs0_2d + 11) = zirondep(:,:,1) * 1.e+3 * rfact2r * e3t_n(:,:,1) * tmask(:,:,1) 
    161150         ENDIF 
    162151         CALL wrk_dealloc( jpi, jpj,      zpdep, zsidep ) 
     
    168157      ! ---------------------------------------------------------- 
    169158      IF( ln_river ) THEN 
    170          trn(:,:,1,jppo4) = trn(:,:,1,jppo4) + rivdip(:,:) * rfact2 
    171          trn(:,:,1,jpno3) = trn(:,:,1,jpno3) + rivdin(:,:) * rfact2 
    172          trn(:,:,1,jpfer) = trn(:,:,1,jpfer) + rivdic(:,:) * 5.e-5 * rfact2 
    173          trn(:,:,1,jpsil) = trn(:,:,1,jpsil) + rivdsi(:,:) * rfact2 
    174          trn(:,:,1,jpdic) = trn(:,:,1,jpdic) + rivdic(:,:) * rfact2 
    175          trn(:,:,1,jptal) = trn(:,:,1,jptal) + ( rivalk(:,:) - rno3 * rivdin(:,:) ) * rfact2 
     159         DO jj = 1, jpj 
     160            DO ji = 1, jpi 
     161               DO jk = 1, nk_rnf(ji,jj) 
     162                  tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) +  rivdip(ji,jj) * rfact2 
     163                  tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) +  rivdin(ji,jj) * rfact2 
     164                  tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) +  rivdic(ji,jj) * 5.e-5 * rfact2 
     165                  tra(ji,jj,jk,jpsil) = tra(ji,jj,jk,jpsil) +  rivdsi(ji,jj) * rfact2 
     166                  tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) +  rivdic(ji,jj) * rfact2 
     167                  tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) +  ( rivalk(ji,jj) - rno3 * rivdin(ji,jj) ) * rfact2 
     168               ENDDO 
     169            ENDDO 
     170         ENDDO 
    176171      ENDIF 
    177172       
     
    179174      ! ---------------------------------------------------------- 
    180175      IF( ln_ndepo ) THEN 
    181          trn(:,:,1,jpno3) = trn(:,:,1,jpno3) + nitdep(:,:) * rfact2 
    182          trn(:,:,1,jptal) = trn(:,:,1,jptal) - rno3 * nitdep(:,:) * rfact2 
     176         tra(:,:,1,jpno3) = tra(:,:,1,jpno3) + nitdep(:,:) * rfact2 
     177         tra(:,:,1,jptal) = tra(:,:,1,jptal) - rno3 * nitdep(:,:) * rfact2 
    183178      ENDIF 
    184179 
     
    186181      ! ------------------------------------------------------ 
    187182      IF( ln_ironsed ) THEN 
    188          trn(:,:,:,jpfer) = trn(:,:,:,jpfer) + ironsed(:,:,:) * rfact2 
     183         tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + ironsed(:,:,:) * rfact2 
    189184         ! 
    190          IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc )   & 
     185         IF( lk_iomput .AND. knt == nrdttrc .AND. iom_use( "Ironsed" ) )   & 
    191186            &   CALL iom_put( "Ironsed", ironsed(:,:,:) * 1.e+3 * tmask(:,:,:) ) ! iron inputs from sediments 
    192187      ENDIF 
     
    195190      ! ------------------------------------------------------ 
    196191      IF( ln_hydrofe ) THEN 
    197          trn(:,:,:,jpfer) = trn(:,:,:,jpfer) + hydrofe(:,:,:) * rfact2 
     192         tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + hydrofe(:,:,:) * rfact2 
    198193         ! 
    199          IF( ln_diatrc .AND. lk_iomput .AND. jnt == nrdttrc )   & 
     194         IF( lk_iomput .AND. knt == nrdttrc .AND. iom_use( "HYDR" ) )   & 
    200195            &   CALL iom_put( "HYDR", hydrofe(:,:,:) * 1.e+3 * tmask(:,:,:) ) ! hydrothermal iron input 
    201196      ENDIF 
    202  
    203197 
    204198      ! OA: Warning, the following part is necessary, especially with Kriest 
     
    208202         DO ji = 1, jpi 
    209203            ikt  = mbkt(ji,jj) 
    210             zdep = fse3t(ji,jj,ikt) / xstep 
     204            zdep = e3t_n(ji,jj,ikt) / xstep 
    211205            zwsbio4(ji,jj) = MIN( 0.99 * zdep, wsbio4(ji,jj,ikt) ) 
    212206            zwscal (ji,jj) = MIN( 0.99 * zdep, wscal (ji,jj,ikt) ) 
     
    224218              ikt = mbkt(ji,jj) 
    225219# if defined key_kriest 
    226               zflx =    trn(ji,jj,ikt,jppoc) * zwsbio3(ji,jj)    * 1E3 * 1E6 / 1E4 
     220              zflx =    trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj)    * 1E3 * 1E6 / 1E4 
    227221# else 
    228               zflx = (  trn(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj)   & 
    229                 &     + trn(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) )  * 1E3 * 1E6 / 1E4 
     222              zflx = (  trb(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj)   & 
     223                &     + trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) )  * 1E3 * 1E6 / 1E4 
    230224#endif 
    231225              zflx  = LOG10( MAX( 1E-3, zflx ) ) 
    232               zo2   = LOG10( MAX( 10. , trn(ji,jj,ikt,jpoxy) * 1E6 ) ) 
    233               zno3  = LOG10( MAX( 1.  , trn(ji,jj,ikt,jpno3) * 1E6 * rno3 ) ) 
    234               zdep  = LOG10( fsdepw(ji,jj,ikt+1) ) 
     226              zo2   = LOG10( MAX( 10. , trb(ji,jj,ikt,jpoxy) * 1E6 ) ) 
     227              zno3  = LOG10( MAX( 1.  , trb(ji,jj,ikt,jpno3) * 1E6 * rno3 ) ) 
     228              zdep  = LOG10( gdepw_n(ji,jj,ikt+1) ) 
    235229              zdenit2d(ji,jj) = -2.2567 - 1.185 * zflx - 0.221 * zflx**2 - 0.3995 * zno3 * zo2 + 1.25 * zno3    & 
    236230              &                + 0.4721 * zo2 - 0.0996 * zdep + 0.4256 * zflx * zo2 
    237231              zdenit2d(ji,jj) = 10.0**( zdenit2d(ji,jj) ) 
    238232              ! 
    239               zflx = (  trn(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj)   & 
    240                 &     + trn(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) ) * 1E6 
     233              zflx = (  trb(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj)   & 
     234                &     + trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) ) * 1E6 
    241235              zbureff(ji,jj) = 0.013 + 0.53 * zflx**2 / ( 7.0 + zflx )**2 
    242236           ENDIF 
     
    250244      DO jj = 1, jpj 
    251245         DO ji = 1, jpi 
    252             ikt = mbkt(ji,jj)  
     246            IF( tmask(ji,jj,1) == 1 ) THEN 
     247               ikt = mbkt(ji,jj)  
    253248# if defined key_kriest 
    254             zwork1(ji,jj) = trn(ji,jj,ikt,jpgsi) * zwscal (ji,jj) 
    255             zwork2(ji,jj) = trn(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) 
     249               zwork1(ji,jj) = trb(ji,jj,ikt,jpgsi) * zwscal (ji,jj) 
     250               zwork2(ji,jj) = trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) 
    256251# else 
    257             zwork1(ji,jj) = trn(ji,jj,ikt,jpgsi) * zwsbio4(ji,jj) 
    258             zwork2(ji,jj) = trn(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj) + trn(ji,jj,ikt,jppoc) * zwsbio3(ji,jj)  
     252               zwork1(ji,jj) = trb(ji,jj,ikt,jpgsi) * zwsbio4(ji,jj) 
     253               zwork2(ji,jj) = trb(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj) + trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj)  
    259254# endif 
    260             ! For calcite, burial efficiency is made a function of saturation 
    261             zfactcal      = MIN( excess(ji,jj,ikt), 0.2 ) 
    262             zfactcal      = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) ) 
    263             zwork3(ji,jj) = trn(ji,jj,ikt,jpcal) * zwscal(ji,jj) * 2.e0 * zfactcal 
     255               ! For calcite, burial efficiency is made a function of saturation 
     256               zfactcal      = MIN( excess(ji,jj,ikt), 0.2 ) 
     257               zfactcal      = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) ) 
     258               zwork3(ji,jj) = trb(ji,jj,ikt,jpcal) * zwscal(ji,jj) * 2.e0 * zfactcal 
     259            ENDIF 
    264260         END DO 
    265261      END DO 
     
    279275         DO ji = 1, jpi 
    280276            ikt  = mbkt(ji,jj) 
    281             zdep = xstep / fse3t(ji,jj,ikt) 
     277            zdep = xstep / e3t_n(ji,jj,ikt)  
    282278            zws4 = zwsbio4(ji,jj) * zdep 
    283279            zwsc = zwscal (ji,jj) * zdep 
    284280# if defined key_kriest 
    285             zsiloss = trn(ji,jj,ikt,jpgsi) * zws4 
     281            zsiloss = trb(ji,jj,ikt,jpgsi) * zws4 
    286282# else 
    287             zsiloss = trn(ji,jj,ikt,jpgsi) * zwsc 
     283            zsiloss = trb(ji,jj,ikt,jpgsi) * zwsc 
    288284# endif 
    289             zcaloss = trn(ji,jj,ikt,jpcal) * zwsc 
     285            zcaloss = trb(ji,jj,ikt,jpcal) * zwsc 
    290286            ! 
    291             trn(ji,jj,ikt,jpgsi) = trn(ji,jj,ikt,jpgsi) - zsiloss 
    292             trn(ji,jj,ikt,jpcal) = trn(ji,jj,ikt,jpcal) - zcaloss 
     287            tra(ji,jj,ikt,jpgsi) = tra(ji,jj,ikt,jpgsi) - zsiloss 
     288            tra(ji,jj,ikt,jpcal) = tra(ji,jj,ikt,jpcal) - zcaloss 
    293289#if ! defined key_sed 
    294             trn(ji,jj,ikt,jpsil) = trn(ji,jj,ikt,jpsil) + zsiloss * zrivsil  
     290            tra(ji,jj,ikt,jpsil) = tra(ji,jj,ikt,jpsil) + zsiloss * zrivsil  
    295291            zfactcal = MIN( excess(ji,jj,ikt), 0.2 ) 
    296292            zfactcal = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) ) 
    297293            zrivalk  =  1._wp - ( rivalkinput * r1_ryyss ) * zfactcal / ( zsumsedcal + rtrn ) 
    298             trn(ji,jj,ikt,jptal) =  trn(ji,jj,ikt,jptal) + zcaloss * zrivalk * 2.0 
    299             trn(ji,jj,ikt,jpdic) =  trn(ji,jj,ikt,jpdic) + zcaloss * zrivalk 
     294            tra(ji,jj,ikt,jptal) =  tra(ji,jj,ikt,jptal) + zcaloss * zrivalk * 2.0 
     295            tra(ji,jj,ikt,jpdic) =  tra(ji,jj,ikt,jpdic) + zcaloss * zrivalk 
    300296#endif 
    301297         END DO 
     
    304300      DO jj = 1, jpj 
    305301         DO ji = 1, jpi 
    306             ikt     = mbkt(ji,jj) 
    307             zdep    = xstep / fse3t(ji,jj,ikt) 
     302            ikt  = mbkt(ji,jj) 
     303            zdep = xstep / e3t_n(ji,jj,ikt)  
    308304            zws4 = zwsbio4(ji,jj) * zdep 
    309305            zws3 = zwsbio3(ji,jj) * zdep 
    310306            zrivno3 = 1. - zbureff(ji,jj) 
    311307# if ! defined key_kriest 
    312             trn(ji,jj,ikt,jpgoc) = trn(ji,jj,ikt,jpgoc) - trn(ji,jj,ikt,jpgoc) * zws4 
    313             trn(ji,jj,ikt,jppoc) = trn(ji,jj,ikt,jppoc) - trn(ji,jj,ikt,jppoc) * zws3 
    314             trn(ji,jj,ikt,jpbfe) = trn(ji,jj,ikt,jpbfe) - trn(ji,jj,ikt,jpbfe) * zws4 
    315             trn(ji,jj,ikt,jpsfe) = trn(ji,jj,ikt,jpsfe) - trn(ji,jj,ikt,jpsfe) * zws3 
    316             zwstpoc              =  trn(ji,jj,ikt,jpgoc) * zws4 + trn(ji,jj,ikt,jppoc) * zws3  
     308            tra(ji,jj,ikt,jpgoc) = tra(ji,jj,ikt,jpgoc) - trb(ji,jj,ikt,jpgoc) * zws4  
     309            tra(ji,jj,ikt,jppoc) = tra(ji,jj,ikt,jppoc) - trb(ji,jj,ikt,jppoc) * zws3 
     310            tra(ji,jj,ikt,jpbfe) = tra(ji,jj,ikt,jpbfe) - trb(ji,jj,ikt,jpbfe) * zws4 
     311            tra(ji,jj,ikt,jpsfe) = tra(ji,jj,ikt,jpsfe) - trb(ji,jj,ikt,jpsfe) * zws3 
     312            zwstpoc              = trb(ji,jj,ikt,jpgoc) * zws4 + trb(ji,jj,ikt,jppoc) * zws3 
    317313# else 
    318             trn(ji,jj,ikt,jpnum) = trn(ji,jj,ikt,jpnum) - trn(ji,jj,ikt,jpnum) * zws4 
    319             trn(ji,jj,ikt,jppoc) = trn(ji,jj,ikt,jppoc) - trn(ji,jj,ikt,jppoc) * zws3 
    320             trn(ji,jj,ikt,jpsfe) = trn(ji,jj,ikt,jpsfe) - trn(ji,jj,ikt,jpsfe) * zws3 
    321             zwstpoc = trn(ji,jj,ikt,jppoc) * zws3  
     314            tra(ji,jj,ikt,jpnum) = tra(ji,jj,ikt,jpnum) - trb(ji,jj,ikt,jpnum) * zws4  
     315            tra(ji,jj,ikt,jppoc) = tra(ji,jj,ikt,jppoc) - trb(ji,jj,ikt,jppoc) * zws3 
     316            tra(ji,jj,ikt,jpsfe) = tra(ji,jj,ikt,jpsfe) - trb(ji,jj,ikt,jpsfe) * zws3 
     317            zwstpoc = trb(ji,jj,ikt,jppoc) * zws3  
    322318# endif 
    323319 
     
    325321            ! The 0.5 factor in zpdenit and zdenitt is to avoid negative NO3 concentration after both denitrification 
    326322            ! in the sediments and just above the sediments. Not very clever, but simpliest option. 
    327             zpdenit  = MIN( 0.5 * ( trn(ji,jj,ikt,jpno3) - rtrn ) / rdenit, zdenit2d(ji,jj) * zwstpoc * zrivno3 ) 
     323            zpdenit  = MIN( 0.5 * ( trb(ji,jj,ikt,jpno3) - rtrn ) / rdenit, zdenit2d(ji,jj) * zwstpoc * zrivno3 ) 
    328324            z1pdenit = zwstpoc * zrivno3 - zpdenit 
    329             zolimit = MIN( ( trn(ji,jj,ikt,jpoxy) - rtrn ) / o2ut, z1pdenit * ( 1.- nitrfac(ji,jj,ikt) ) ) 
    330             zdenitt = MIN(  0.5 * ( trn(ji,jj,ikt,jpno3) - rtrn ) / rdenit, z1pdenit * nitrfac(ji,jj,ikt) ) 
    331             trn(ji,jj,ikt,jpdoc) = trn(ji,jj,ikt,jpdoc) + z1pdenit - zolimit - zdenitt 
    332             trn(ji,jj,ikt,jppo4) = trn(ji,jj,ikt,jppo4) + zpdenit + zolimit + zdenitt 
    333             trn(ji,jj,ikt,jpnh4) = trn(ji,jj,ikt,jpnh4) + zpdenit + zolimit + zdenitt 
    334             trn(ji,jj,ikt,jpno3) = trn(ji,jj,ikt,jpno3) - rdenit * (zpdenit + zdenitt) 
    335             trn(ji,jj,ikt,jpoxy) = trn(ji,jj,ikt,jpoxy) - zolimit * o2ut 
    336             trn(ji,jj,ikt,jptal) = trn(ji,jj,ikt,jptal) + rno3 * (zolimit + (1.+rdenit) * (zpdenit + zdenitt) ) 
    337             trn(ji,jj,ikt,jpdic) = trn(ji,jj,ikt,jpdic) + zpdenit + zolimit + zdenitt 
    338             zwork4(ji,jj) = rdenit * zpdenit * fse3t(ji,jj,ikt) 
     325            zolimit = MIN( ( trb(ji,jj,ikt,jpoxy) - rtrn ) / o2ut, z1pdenit * ( 1.- nitrfac(ji,jj,ikt) ) ) 
     326            zdenitt = MIN(  0.5 * ( trb(ji,jj,ikt,jpno3) - rtrn ) / rdenit, z1pdenit * nitrfac(ji,jj,ikt) ) 
     327            tra(ji,jj,ikt,jpdoc) = tra(ji,jj,ikt,jpdoc) + z1pdenit - zolimit - zdenitt 
     328            tra(ji,jj,ikt,jppo4) = tra(ji,jj,ikt,jppo4) + zpdenit + zolimit + zdenitt 
     329            tra(ji,jj,ikt,jpnh4) = tra(ji,jj,ikt,jpnh4) + zpdenit + zolimit + zdenitt 
     330            tra(ji,jj,ikt,jpno3) = tra(ji,jj,ikt,jpno3) - rdenit * (zpdenit + zdenitt) 
     331            tra(ji,jj,ikt,jpoxy) = tra(ji,jj,ikt,jpoxy) - zolimit * o2ut 
     332            tra(ji,jj,ikt,jptal) = tra(ji,jj,ikt,jptal) + rno3 * (zolimit + (1.+rdenit) * (zpdenit + zdenitt) ) 
     333            tra(ji,jj,ikt,jpdic) = tra(ji,jj,ikt,jpdic) + zpdenit + zolimit + zdenitt 
     334            sdenit(ji,jj) = rdenit * zpdenit * e3t_n(ji,jj,ikt) 
    339335#endif 
    340336         END DO 
     
    356352#endif 
    357353               ztrfer = biron(ji,jj,jk)       / ( concfediaz + biron(ji,jj,jk)       ) 
    358                ztrpo4 = trn  (ji,jj,jk,jppo4) / ( concnnh4   + trn  (ji,jj,jk,jppo4) )  
    359                zlight =  ( 1.- EXP( -etot(ji,jj,jk) / diazolight ) )  
    360                znitrpot(ji,jj,jk) =  MAX( 0.e0, ( 0.6 * tgfunc(ji,jj,jk) - 2.15 ) * r1_rday )   & 
     354               ztrpo4 = trb  (ji,jj,jk,jppo4) / ( concnnh4   + trb  (ji,jj,jk,jppo4) )  
     355               zlight =  ( 1.- EXP( -etot_ndcy(ji,jj,jk) / diazolight ) )  
     356               nitrpot(ji,jj,jk) =  MAX( 0.e0, ( 0.6 * tgfunc(ji,jj,jk) - 2.15 ) * r1_rday )   & 
    361357                 &         *  zfact * MIN( ztrfer, ztrpo4 ) * zlight 
    362358               zsoufer(ji,jj,jk) = zlight * 2E-11 / (2E-11 + biron(ji,jj,jk)) 
     
    370366         DO jj = 1, jpj 
    371367            DO ji = 1, jpi 
    372                zfact = znitrpot(ji,jj,jk) * nitrfix 
    373                trn(ji,jj,jk,jpnh4) = trn(ji,jj,jk,jpnh4) +             zfact 
    374                trn(ji,jj,jk,jptal) = trn(ji,jj,jk,jptal) + rno3      * zfact 
    375                trn(ji,jj,jk,jpoxy) = trn(ji,jj,jk,jpoxy) + o2nit     * zfact  
    376                trn(ji,jj,jk,jppo4) = trn(ji,jj,jk,jppo4) + concdnh4 / ( concdnh4 + trn(ji,jj,jk,jppo4) ) & 
    377                &                     * 0.002 * trn(ji,jj,jk,jpdoc) * rfact2 / rday 
    378                trn(ji,jj,jk,jpfer) = trn(ji,jj,jk,jpfer) + 0.002 * 4E-10 * zsoufer(ji,jj,jk) * rfact2 / rday 
     368               zfact = nitrpot(ji,jj,jk) * nitrfix 
     369               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) +             zfact 
     370               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3      * zfact 
     371               tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) + o2nit     * zfact  
     372               tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) + concdnh4 / ( concdnh4 + trb(ji,jj,jk,jppo4) ) & 
     373               &                     * 0.002 * trb(ji,jj,jk,jpdoc) * xstep 
     374               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + 0.002 * 4E-10 * zsoufer(ji,jj,jk) * xstep 
    379375           END DO 
    380376         END DO  
    381377      END DO 
    382378 
    383   
    384       IF( ln_check_mass ) THEN 
    385         ! Global budget of N SMS : denitrification in the water column and in the sediment 
    386          !                          nitrogen fixation by the diazotrophs 
    387          ! -------------------------------------------------------------------------------- 
    388          zrdenittot   = glob_sum ( denitr(:,:,:) * rdenit * xnegtr(:,:,:) * cvol(:,:,:) ) 
    389          zsdenittot   = glob_sum ( zwork4(:,:)   * e1e2t(:,:) ) 
    390          znitrpottot  = glob_sum ( znitrpot(:,:,:) * nitrfix              * cvol(:,:,:) ) 
    391          IF( kt == nitend .AND. jnt == nrdttrc ) THEN 
    392             zfact = 1.e+3 * rfact2r * rno3 * ryyss * 14. / 1e12 
    393             IF(lwp) WRITE(numnit,9100) ndastp, znitrpottot * nitrfix * zfact, zrdenittot * zfact , zsdenittot * zfact 
     379      IF( lk_iomput ) THEN 
     380         IF( knt == nrdttrc ) THEN 
     381            zfact = 1.e+3 * rfact2r * rno3  !  conversion from molC/l/kt  to molN/m3/s 
     382            IF( iom_use("Nfix"   ) ) CALL iom_put( "Nfix", nitrpot(:,:,:) * nitrfix * zfact * tmask(:,:,:) )  ! nitrogen fixation  
     383            IF( iom_use("INTNFIX") ) THEN   ! nitrogen fixation rate in ocean ( vertically integrated ) 
     384               zwork1(:,:) = 0. 
     385               DO jk = 1, jpkm1 
     386                 zwork1(:,:) = zwork1(:,:) + nitrpot(:,:,jk) * nitrfix * zfact * e3t_n(:,:,jk) * tmask(:,:,jk) 
     387               ENDDO 
     388               CALL iom_put( "INTNFIX" , zwork1 )  
     389            ENDIF 
    394390         ENDIF 
    395        ENDIF 
    396       ! 
    397       IF( ln_diatrc ) THEN 
    398          zfact = 1.e+3 * rfact2r 
    399          IF( lk_iomput ) THEN 
    400             IF( jnt == nrdttrc ) THEN 
    401                CALL iom_put( "Nfix"  , znitrpot(:,:,:) * nitrfix * rno3 * zfact * tmask(:,:,:) )  ! nitrogen fixation  
    402                CALL iom_put( "Sdenit", zwork4(:,:)               * rno3 * zfact * tmask(:,:,1) )  ! Nitrate reduction in the sediments 
    403             ENDIF 
    404          ELSE 
    405             trc2d(:,:,jp_pcs0_2d + 12) = znitrpot(:,:,1) * nitrfix * zfact * fse3t(:,:,1) * tmask(:,:,1) 
    406          ENDIF 
     391      ELSE 
     392         IF( ln_diatrc )  & 
     393            &  trc2d(:,:,jp_pcs0_2d + 12) = nitrpot(:,:,1) * nitrfix * rno3 * 1.e+3 * rfact2r * e3t_n(:,:,1) * tmask(:,:,1) 
    407394      ENDIF 
    408395      ! 
     
    410397         WRITE(charout, fmt="('sed ')") 
    411398         CALL prt_ctl_trc_info(charout) 
    412          CALL prt_ctl_trc(tab4d=trn, mask=tmask, clinfo=ctrcnm) 
    413       ENDIF 
    414       ! 
    415       CALL wrk_dealloc( jpi, jpj, zdenit2d, zwork1, zwork2, zwork3, zwork4, zbureff ) 
     399         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm) 
     400      ENDIF 
     401      ! 
     402      CALL wrk_dealloc( jpi, jpj, zdenit2d, zwork1, zwork2, zwork3, zbureff ) 
    416403      CALL wrk_dealloc( jpi, jpj, zwsbio3, zwsbio4, zwscal ) 
    417       CALL wrk_dealloc( jpi, jpj, jpk, znitrpot, zsoufer ) 
     404      CALL wrk_dealloc( jpi, jpj, jpk, zsoufer ) 
    418405      ! 
    419406      IF( nn_timing == 1 )  CALL timing_stop('p4z_sed') 
     
    422409      ! 
    423410   END SUBROUTINE p4z_sed 
     411 
     412 
     413   INTEGER FUNCTION p4z_sed_alloc() 
     414      !!---------------------------------------------------------------------- 
     415      !!                     ***  ROUTINE p4z_sed_alloc  *** 
     416      !!---------------------------------------------------------------------- 
     417      ALLOCATE( nitrpot(jpi,jpj,jpk), sdenit(jpi,jpj), STAT=p4z_sed_alloc ) 
     418      ! 
     419      IF( p4z_sed_alloc /= 0 )   CALL ctl_warn('p4z_sed_alloc: failed to allocate arrays') 
     420      ! 
     421   END FUNCTION p4z_sed_alloc 
     422 
    424423 
    425424#else 
     
    433432 
    434433   !!====================================================================== 
    435 END MODULE  p4zsed 
     434END MODULE p4zsed 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsink.F90

    r4624 r6225  
    4141#endif 
    4242 
    43    INTEGER  :: iksed  = 10 
     43   INTEGER  :: ik100 
    4444 
    4545#if  defined key_kriest 
     
    6565#endif 
    6666 
    67    !!* Substitution 
    68 #  include "top_substitute.h90" 
    6967   !!---------------------------------------------------------------------- 
    7068   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    7977   !!---------------------------------------------------------------------- 
    8078 
    81    SUBROUTINE p4z_sink ( kt, jnt ) 
     79   SUBROUTINE p4z_sink ( kt, knt ) 
    8280      !!--------------------------------------------------------------------- 
    8381      !!                     ***  ROUTINE p4z_sink  *** 
     
    8886      !! ** Method  : - ??? 
    8987      !!--------------------------------------------------------------------- 
    90       INTEGER, INTENT(in) :: kt, jnt 
     88      INTEGER, INTENT(in) :: kt, knt 
    9189      INTEGER  ::   ji, jj, jk, jit 
    9290      INTEGER  ::   iiter1, iiter2 
     
    9492      REAL(wp) ::   zagg , zaggfe, zaggdoc, zaggdoc2, zaggdoc3 
    9593      REAL(wp) ::   zfact, zwsmax, zmax, zstep 
    96       REAL(wp) ::   zrfact2 
    97       INTEGER  ::   ik1 
    9894      CHARACTER (len=25) :: charout 
     95      REAL(wp), POINTER, DIMENSION(:,:,:) :: zw3d 
     96      REAL(wp), POINTER, DIMENSION(:,:  ) :: zw2d 
    9997      !!--------------------------------------------------------------------- 
    10098      ! 
     
    108106            DO ji = 1,jpi 
    109107               zmax  = MAX( heup(ji,jj), hmld(ji,jj) ) 
    110                zfact = MAX( 0., fsdepw(ji,jj,jk+1) - zmax ) / 5000._wp 
     108               zfact = MAX( 0., gdepw_n(ji,jj,jk+1) - zmax ) / 5000._wp 
    111109               wsbio4(ji,jj,jk) = wsbio2 + ( 200.- wsbio2 ) * zfact 
    112110            END DO 
     
    137135             DO ji = 1, jpi 
    138136                IF( tmask(ji,jj,jk) == 1) THEN 
    139                    zwsmax =  0.5 * fse3t(ji,jj,jk) / xstep 
     137                   zwsmax =  0.5 * e3t_n(ji,jj,jk) / xstep 
    140138                   iiter1 =  MAX( iiter1, INT( wsbio3(ji,jj,jk) / zwsmax ) ) 
    141139                   iiter2 =  MAX( iiter2, INT( wsbio4(ji,jj,jk) / zwsmax ) ) 
     
    156154            DO ji = 1, jpi 
    157155               IF( tmask(ji,jj,jk) == 1 ) THEN 
    158                  zwsmax = 0.5 * fse3t(ji,jj,jk) / xstep 
     156                 zwsmax = 0.5 * e3t_n(ji,jj,jk) / xstep 
    159157                 wsbio3(ji,jj,jk) = MIN( wsbio3(ji,jj,jk), zwsmax * FLOAT( iiter1 ) ) 
    160158                 wsbio4(ji,jj,jk) = MIN( wsbio4(ji,jj,jk), zwsmax * FLOAT( iiter2 ) ) 
     
    199197               zfact = zstep * xdiss(ji,jj,jk) 
    200198               !  Part I : Coagulation dependent on turbulence 
    201                zagg1 = 25.9  * zfact * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jppoc) 
    202                zagg2 = 4452. * zfact * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpgoc) 
     199               zagg1 = 25.9  * zfact * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jppoc) 
     200               zagg2 = 4452. * zfact * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jpgoc) 
    203201 
    204202               ! Part II : Differential settling 
    205203 
    206204               !  Aggregation of small into large particles 
    207                zagg3 =  47.1 * zstep * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpgoc) 
    208                zagg4 =  3.3  * zstep * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jppoc) 
     205               zagg3 =  47.1 * zstep * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jpgoc) 
     206               zagg4 =  3.3  * zstep * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jppoc) 
    209207 
    210208               zagg   = zagg1 + zagg2 + zagg3 + zagg4 
    211                zaggfe = zagg * trn(ji,jj,jk,jpsfe) / ( trn(ji,jj,jk,jppoc) + rtrn ) 
     209               zaggfe = zagg * trb(ji,jj,jk,jpsfe) / ( trb(ji,jj,jk,jppoc) + rtrn ) 
    212210 
    213211               ! Aggregation of DOC to POC :  
     
    215213               ! 2nd term is shear aggregation of DOC-POC 
    216214               ! 3rd term is differential settling of DOC-POC 
    217                zaggdoc  = ( ( 0.369 * 0.3 * trn(ji,jj,jk,jpdoc) + 102.4 * trn(ji,jj,jk,jppoc) ) * zfact       & 
    218                &            + 2.4 * zstep * trn(ji,jj,jk,jppoc) ) * 0.3 * trn(ji,jj,jk,jpdoc) 
     215               zaggdoc  = ( ( 0.369 * 0.3 * trb(ji,jj,jk,jpdoc) + 102.4 * trb(ji,jj,jk,jppoc) ) * zfact       & 
     216               &            + 2.4 * zstep * trb(ji,jj,jk,jppoc) ) * 0.3 * trb(ji,jj,jk,jpdoc) 
    219217               ! transfer of DOC to GOC :  
    220218               ! 1st term is shear aggregation 
    221219               ! 2nd term is differential settling  
    222                zaggdoc2 = ( 3.53E3 * zfact + 0.1 * zstep ) * trn(ji,jj,jk,jpgoc) * 0.3 * trn(ji,jj,jk,jpdoc) 
     220               zaggdoc2 = ( 3.53E3 * zfact + 0.1 * zstep ) * trb(ji,jj,jk,jpgoc) * 0.3 * trb(ji,jj,jk,jpdoc) 
    223221               ! tranfer of DOC to POC due to brownian motion 
    224                zaggdoc3 =  ( 5095. * trn(ji,jj,jk,jppoc) + 114. * 0.3 * trn(ji,jj,jk,jpdoc) ) *zstep * 0.3 * trn(ji,jj,jk,jpdoc) 
     222               zaggdoc3 =  ( 5095. * trb(ji,jj,jk,jppoc) + 114. * 0.3 * trb(ji,jj,jk,jpdoc) ) *zstep * 0.3 * trb(ji,jj,jk,jpdoc) 
    225223 
    226224               !  Update the trends 
     
    235233      END DO 
    236234 
    237      ! Total primary production per year 
    238      t_oce_co2_exp = t_oce_co2_exp + glob_sum( ( sinking(:,:,iksed+1) + sinking2(:,:,iksed+1) ) * e1e2t(:,:) * tmask(:,:,1) ) 
     235 
     236     ! Total carbon export per year 
     237     IF( iom_use( "tcexp" ) .OR. ( ln_check_mass .AND. kt == nitend .AND. knt == nrdttrc )  )  & 
     238        &   t_oce_co2_exp = glob_sum( ( sinking(:,:,ik100) + sinking2(:,:,ik100) ) * e1e2t(:,:) * tmask(:,:,1) ) 
    239239     ! 
    240      IF( ln_diatrc ) THEN 
    241          zrfact2 = 1.e3 * rfact2r 
    242          ik1  = iksed + 1 
    243          IF( lk_iomput ) THEN 
    244            IF( jnt == nrdttrc ) THEN 
    245               CALL iom_put( "EPC100"  , ( sinking(:,:,ik1) + sinking2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of carbon at 100m 
    246               CALL iom_put( "EPFE100" , ( sinkfer(:,:,ik1) + sinkfer2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of iron at 100m 
    247               CALL iom_put( "EPCAL100",   sinkcal(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of calcite  at 100m 
    248               CALL iom_put( "EPSI100" ,   sinksil(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of biogenic silica at 100m 
    249            ENDIF 
    250          ELSE 
    251            trc2d(:,:,jp_pcs0_2d + 4) = sinking (:,:,ik1) * zrfact2 * tmask(:,:,1) 
    252            trc2d(:,:,jp_pcs0_2d + 5) = sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1) 
    253            trc2d(:,:,jp_pcs0_2d + 6) = sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1) 
    254            trc2d(:,:,jp_pcs0_2d + 7) = sinkfer2(:,:,ik1) * zrfact2 * tmask(:,:,1) 
    255            trc2d(:,:,jp_pcs0_2d + 8) = sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1) 
    256            trc2d(:,:,jp_pcs0_2d + 9) = sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1) 
     240     IF( lk_iomput ) THEN 
     241       IF( knt == nrdttrc ) THEN 
     242          CALL wrk_alloc( jpi, jpj,      zw2d ) 
     243          CALL wrk_alloc( jpi, jpj, jpk, zw3d ) 
     244          zfact = 1.e+3 * rfact2r  !  conversion from mol/l/kt to  mol/m3/s 
     245          ! 
     246          IF( iom_use( "EPC100" ) )  THEN 
     247              zw2d(:,:) = ( sinking(:,:,ik100) + sinking2(:,:,ik100) ) * zfact * tmask(:,:,1) ! Export of carbon at 100m 
     248              CALL iom_put( "EPC100"  , zw2d ) 
     249          ENDIF 
     250          IF( iom_use( "EPFE100" ) )  THEN 
     251              zw2d(:,:) = ( sinkfer(:,:,ik100) + sinkfer2(:,:,ik100) ) * zfact * tmask(:,:,1) ! Export of iron at 100m 
     252              CALL iom_put( "EPFE100"  , zw2d ) 
     253          ENDIF 
     254          IF( iom_use( "EPCAL100" ) )  THEN 
     255              zw2d(:,:) = sinkcal(:,:,ik100) * zfact * tmask(:,:,1) ! Export of calcite at 100m 
     256              CALL iom_put( "EPCAL100"  , zw2d ) 
     257          ENDIF 
     258          IF( iom_use( "EPSI100" ) )  THEN 
     259              zw2d(:,:) =  sinksil(:,:,ik100) * zfact * tmask(:,:,1) ! Export of bigenic silica at 100m 
     260              CALL iom_put( "EPSI100"  , zw2d ) 
     261          ENDIF 
     262          IF( iom_use( "EXPC" ) )  THEN 
     263              zw3d(:,:,:) = ( sinking(:,:,:) + sinking2(:,:,:) ) * zfact * tmask(:,:,:) ! Export of carbon in the water column 
     264              CALL iom_put( "EXPC"  , zw3d ) 
     265          ENDIF 
     266          IF( iom_use( "EXPFE" ) )  THEN 
     267              zw3d(:,:,:) = ( sinkfer(:,:,:) + sinkfer2(:,:,:) ) * zfact * tmask(:,:,:) ! Export of iron  
     268              CALL iom_put( "EXPFE"  , zw3d ) 
     269          ENDIF 
     270          IF( iom_use( "EXPCAL" ) )  THEN 
     271              zw3d(:,:,:) = sinkcal(:,:,:) * zfact * tmask(:,:,:) ! Export of calcite  
     272              CALL iom_put( "EXPCAL"  , zw3d ) 
     273          ENDIF 
     274          IF( iom_use( "EXPSI" ) )  THEN 
     275              zw3d(:,:,:) = sinksil(:,:,:) * zfact * tmask(:,:,:) ! Export of bigenic silica 
     276              CALL iom_put( "EXPSI"  , zw3d ) 
     277          ENDIF 
     278          IF( iom_use( "tcexp" ) )  CALL iom_put( "tcexp" , t_oce_co2_exp * zfact )   ! molC/s 
     279          !  
     280          CALL wrk_dealloc( jpi, jpj,      zw2d ) 
     281          CALL wrk_dealloc( jpi, jpj, jpk, zw3d ) 
     282        ENDIF 
     283      ELSE 
     284         IF( ln_diatrc ) THEN 
     285            zfact = 1.e3 * rfact2r 
     286            trc2d(:,:,jp_pcs0_2d + 4) = sinking (:,:,ik100) * zfact * tmask(:,:,1) 
     287            trc2d(:,:,jp_pcs0_2d + 5) = sinking2(:,:,ik100) * zfact * tmask(:,:,1) 
     288            trc2d(:,:,jp_pcs0_2d + 6) = sinkfer (:,:,ik100) * zfact * tmask(:,:,1) 
     289            trc2d(:,:,jp_pcs0_2d + 7) = sinkfer2(:,:,ik100) * zfact * tmask(:,:,1) 
     290            trc2d(:,:,jp_pcs0_2d + 8) = sinksil (:,:,ik100) * zfact * tmask(:,:,1) 
     291            trc2d(:,:,jp_pcs0_2d + 9) = sinkcal (:,:,ik100) * zfact * tmask(:,:,1) 
    257292         ENDIF 
    258293      ENDIF 
     
    272307      !!                  ***  ROUTINE p4z_sink_init  *** 
    273308      !!---------------------------------------------------------------------- 
    274  
     309      INTEGER :: jk 
     310 
     311      ik100 = 10        !  last level where depth less than 100 m 
     312      DO jk = jpkm1, 1, -1 
     313         IF( gdept_1d(jk) > 100. )  ik100 = jk - 1 
     314      END DO 
     315      IF (lwp) WRITE(numout,*) 
     316      IF (lwp) WRITE(numout,*) ' Level corresponding to 100m depth ',  ik100 + 1 
     317      IF (lwp) WRITE(numout,*) 
     318      ! 
    275319      t_oce_co2_exp = 0._wp 
    276320      ! 
     
    282326   !!---------------------------------------------------------------------- 
    283327 
    284    SUBROUTINE p4z_sink ( kt, jnt ) 
     328   SUBROUTINE p4z_sink ( kt, knt ) 
    285329      !!--------------------------------------------------------------------- 
    286330      !!                ***  ROUTINE p4z_sink  *** 
     
    292336      !!--------------------------------------------------------------------- 
    293337      ! 
    294       INTEGER, INTENT(in) :: kt, jnt 
     338      INTEGER, INTENT(in) :: kt, knt 
    295339      ! 
    296340      INTEGER  :: ji, jj, jk, jit, niter1, niter2 
     
    300344      REAL(wp) :: zdiv , zdiv1, zdiv2, zdiv3, zdiv4, zdiv5 
    301345      REAL(wp) :: zval1, zval2, zval3, zval4 
    302       REAL(wp) :: zrfact2 
     346      REAL(wp) :: zfact 
    303347      INTEGER  :: ik1 
    304348      CHARACTER (len=25) :: charout 
    305349      REAL(wp), POINTER, DIMENSION(:,:,:) :: znum3d  
     350      REAL(wp), POINTER, DIMENSION(:,:,:) :: zw3d 
     351      REAL(wp), POINTER, DIMENSION(:,:  ) :: zw2d 
    306352      !!--------------------------------------------------------------------- 
    307353      ! 
     
    325371            DO ji = 1, jpi 
    326372               IF( tmask(ji,jj,jk) /= 0.e0 ) THEN 
    327                   znum = trn(ji,jj,jk,jppoc) / ( trn(ji,jj,jk,jpnum) + rtrn ) / xkr_massp 
     373                  znum = trb(ji,jj,jk,jppoc) / ( trb(ji,jj,jk,jpnum) + rtrn ) / xkr_massp 
    328374                  ! -------------- To avoid sinking speed over 50 m/day ------- 
    329375                  znum  = MIN( xnumm(jk), znum ) 
     
    387433               IF( tmask(ji,jj,jk) /= 0.e0 ) THEN 
    388434 
    389                   znum = trn(ji,jj,jk,jppoc)/(trn(ji,jj,jk,jpnum)+rtrn) / xkr_massp 
     435                  znum = trb(ji,jj,jk,jppoc)/(trb(ji,jj,jk,jpnum)+rtrn) / xkr_massp 
    390436                  !-------------- To avoid sinking speed over 50 m/day ------- 
    391437                  znum  = min(xnumm(jk),znum) 
     
    405451                  !    ---------------------------------------------- 
    406452 
    407                   zagg1 =  0.163 * trn(ji,jj,jk,jpnum)**2               & 
     453                  zagg1 =  0.163 * trb(ji,jj,jk,jpnum)**2               & 
    408454                     &            * 2.*( (zfm-1.)*(zfm*xkr_mass_max**3-xkr_mass_min**3)    & 
    409455                     &            * (zeps-1)/zdiv1 + 3.*(zfm*xkr_mass_max-xkr_mass_min)    & 
    410456                     &            * (zfm*xkr_mass_max**2-xkr_mass_min**2)                  & 
    411457                     &            * (zeps-1.)**2/(zdiv2*zdiv3))  
    412                   zagg2 =  2*0.163*trn(ji,jj,jk,jpnum)**2*zfm*                       & 
     458                  zagg2 =  2*0.163*trb(ji,jj,jk,jpnum)**2*zfm*                       & 
    413459                     &                   ((xkr_mass_max**3+3.*(xkr_mass_max**2          & 
    414460                     &                    *xkr_mass_min*(zeps-1.)/zdiv2                 & 
     
    418464                     &                    (zeps-2.)+(zeps-1.)/zdiv3)+(zeps-1.)/zdiv1))     
    419465 
    420                   zagg3 =  0.163*trn(ji,jj,jk,jpnum)**2*zfm**2*8. * xkr_mass_max**3   
     466                  zagg3 =  0.163*trb(ji,jj,jk,jpnum)**2*zfm**2*8. * xkr_mass_max**3   
    421467                   
    422468                 !    Aggregation of small into large particles 
     
    424470                 !    ---------------------------------------------- 
    425471 
    426                   zagg4 =  2.*3.141*0.125*trn(ji,jj,jk,jpnum)**2*                       & 
     472                  zagg4 =  2.*3.141*0.125*trb(ji,jj,jk,jpnum)**2*                       & 
    427473                     &                 xkr_wsbio_min*(zeps-1.)**2                         & 
    428474                     &                 *(xkr_mass_min**2*((1.-zsm*zfm)/(zdiv3*zdiv4)      & 
     
    431477                     &                 *xkr_eta)/(zdiv*zdiv3*zdiv5) )    
    432478 
    433                   zagg5 =   2.*3.141*0.125*trn(ji,jj,jk,jpnum)**2                         & 
     479                  zagg5 =   2.*3.141*0.125*trb(ji,jj,jk,jpnum)**2                         & 
    434480                     &                 *(zeps-1.)*zfm*xkr_wsbio_min                        & 
    435481                     &                 *(zsm*(xkr_mass_min**2-zfm*xkr_mass_max**2)         & 
     
    441487                  !     ------------------------------------ 
    442488 
    443                   zfract = 2.*3.141*0.125*trn(ji,jj,jk,jpmes)*12./0.12/0.06**3*trn(ji,jj,jk,jpnum)  & 
     489                  zfract = 2.*3.141*0.125*trb(ji,jj,jk,jpmes)*12./0.12/0.06**3*trb(ji,jj,jk,jpnum)  & 
    444490                    &      * (0.01/xkr_mass_min)**(1.-zeps)*0.1**2  & 
    445491                    &      * 10000.*xstep 
     
    448494                  !     -------------------------------------- 
    449495 
    450                   zaggdoc = 0.83 * trn(ji,jj,jk,jpdoc) * xstep * xdiss(ji,jj,jk) * trn(ji,jj,jk,jpdoc)   & 
    451                      &        + 0.005 * 231. * trn(ji,jj,jk,jpdoc) * xstep * trn(ji,jj,jk,jpdoc) 
    452                   zaggdoc1 = 271. * trn(ji,jj,jk,jppoc) * xstep * xdiss(ji,jj,jk) * trn(ji,jj,jk,jpdoc)  & 
    453                      &  + 0.02 * 16706. * trn(ji,jj,jk,jppoc) * xstep * trn(ji,jj,jk,jpdoc) 
     496                  zaggdoc = 0.83 * trb(ji,jj,jk,jpdoc) * xstep * xdiss(ji,jj,jk) * trb(ji,jj,jk,jpdoc)   & 
     497                     &        + 0.005 * 231. * trb(ji,jj,jk,jpdoc) * xstep * trb(ji,jj,jk,jpdoc) 
     498                  zaggdoc1 = 271. * trb(ji,jj,jk,jppoc) * xstep * xdiss(ji,jj,jk) * trb(ji,jj,jk,jpdoc)  & 
     499                     &  + 0.02 * 16706. * trb(ji,jj,jk,jppoc) * xstep * trb(ji,jj,jk,jpdoc) 
    454500 
    455501# if defined key_degrad 
     
    466512                  zagg = 0.5 * xkr_stick * ( zaggsh + zaggsi ) 
    467513                  ! 
    468                   znumdoc = trn(ji,jj,jk,jpnum) / ( trn(ji,jj,jk,jppoc) + rtrn ) 
     514                  znumdoc = trb(ji,jj,jk,jpnum) / ( trb(ji,jj,jk,jppoc) + rtrn ) 
    469515                  tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zaggdoc + zaggdoc1 
    470516                  tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + zfract + zaggdoc / xkr_massp - zagg 
     
    477523 
    478524     ! Total primary production per year 
    479      t_oce_co2_exp = t_oce_co2_exp + glob_sum( ( sinking(:,:,:) ) * cvol(:,:,:) ) 
     525     t_oce_co2_exp = t_oce_co2_exp + glob_sum( ( sinking(:,:,ik100) * e1e2t(:,:) * tmask(:,:,1) ) 
    480526     ! 
    481       IF( ln_diatrc ) THEN 
    482          ! 
    483          ik1 = iksed + 1 
    484          zrfact2 = 1.e3 * rfact2r 
    485          IF( jnt == nrdttrc ) THEN 
    486            CALL iom_put( "POCFlx"  , sinking (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! POC export 
    487            CALL iom_put( "NumFlx"  , sinking2 (:,:,:)     * zrfact2 * tmask(:,:,:) )  ! Num export 
    488            CALL iom_put( "SiFlx"   , sinksil (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Silica export 
    489            CALL iom_put( "CaCO3Flx", sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Calcite export 
    490            CALL iom_put( "xnum"    , znum3d  (:,:,:)                * tmask(:,:,:) )  ! Number of particles in aggregats 
    491            CALL iom_put( "W1"      , wsbio3  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of POC 
    492            CALL iom_put( "W2"      , wsbio4  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of aggregats 
     527     IF( lk_iomput ) THEN 
     528        IF( knt == nrdttrc ) THEN 
     529          CALL wrk_alloc( jpi, jpj,      zw2d ) 
     530          CALL wrk_alloc( jpi, jpj, jpk, zw3d ) 
     531          zfact = 1.e+3 * rfact2r  !  conversion from mol/l/kt to  mol/m3/s 
     532          ! 
     533          IF( iom_use( "EPC100" ) )  THEN 
     534              zw2d(:,:) = sinking(:,:,ik100) * zfact * tmask(:,:,1) ! Export of carbon at 100m 
     535              CALL iom_put( "EPC100"  , zw2d ) 
     536          ENDIF 
     537          IF( iom_use( "EPN100" ) )  THEN 
     538              zw2d(:,:) = sinking2(:,:,ik100) * zfact * tmask(:,:,1) ! Export of number of aggregates ? 
     539              CALL iom_put( "EPN100"  , zw2d ) 
     540          ENDIF 
     541          IF( iom_use( "EPCAL100" ) )  THEN 
     542              zw2d(:,:) = sinkcal(:,:,ik100) * zfact * tmask(:,:,1) ! Export of calcite at 100m 
     543              CALL iom_put( "EPCAL100"  , zw2d ) 
     544          ENDIF 
     545          IF( iom_use( "EPSI100" ) )  THEN 
     546              zw2d(:,:) = sinksil(:,:,ik100) * zfact * tmask(:,:,1) ! Export of bigenic silica at 100m 
     547              CALL iom_put( "EPSI100"  , zw2d ) 
     548          ENDIF 
     549          IF( iom_use( "EXPC" ) )  THEN 
     550              zw3d(:,:,:) = sinking(:,:,:) * zfact * tmask(:,:,:) ! Export of carbon in the water column 
     551              CALL iom_put( "EXPC"  , zw3d ) 
     552          ENDIF 
     553          IF( iom_use( "EXPN" ) )  THEN 
     554              zw3d(:,:,:) = sinking(:,:,:) * zfact * tmask(:,:,:) ! Export of carbon in the water column 
     555              CALL iom_put( "EXPN"  , zw3d ) 
     556          ENDIF 
     557          IF( iom_use( "EXPCAL" ) )  THEN 
     558              zw3d(:,:,:) = sinkcal(:,:,:) * zfact * tmask(:,:,:) ! Export of calcite  
     559              CALL iom_put( "EXPCAL"  , zw3d ) 
     560          ENDIF 
     561          IF( iom_use( "EXPSI" ) )  THEN 
     562              zw3d(:,:,:) = sinksil(:,:,:) * zfact * tmask(:,:,:) ! Export of bigenic silica 
     563              CALL iom_put( "EXPSI"  , zw3d ) 
     564          ENDIF 
     565          IF( iom_use( "XNUM" ) )  THEN 
     566              zw3d(:,:,:) =  znum3d(:,:,:) * tmask(:,:,:) !  Number of particles on aggregats 
     567              CALL iom_put( "XNUM"  , zw3d ) 
     568          ENDIF 
     569          IF( iom_use( "WSC" ) )  THEN 
     570              zw3d(:,:,:) = wsbio3(:,:,:) * tmask(:,:,:) ! Sinking speed of carbon particles 
     571              CALL iom_put( "WSC"  , zw3d ) 
     572          ENDIF 
     573          IF( iom_use( "WSN" ) )  THEN 
     574              zw3d(:,:,:) = wsbio4(:,:,:) * tmask(:,:,:) ! Sinking speed of particles number 
     575              CALL iom_put( "WSN"  , zw3d ) 
     576          ENDIF 
     577          ! 
     578          CALL wrk_dealloc( jpi, jpj,      zw2d ) 
     579          CALL wrk_dealloc( jpi, jpj, jpk, zw3d ) 
     580      ELSE 
     581         IF( ln_diatrc ) THEN 
     582            zfact = 1.e3 * rfact2r 
     583            trc2d(:,:  ,jp_pcs0_2d + 4)  = sinking (:,:,ik100)  * zfact * tmask(:,:,1) 
     584            trc2d(:,:  ,jp_pcs0_2d + 5)  = sinking2(:,:,ik100)  * zfact * tmask(:,:,1) 
     585            trc2d(:,:  ,jp_pcs0_2d + 6)  = sinkfer (:,:,ik100)  * zfact * tmask(:,:,1) 
     586            trc2d(:,:  ,jp_pcs0_2d + 7)  = sinksil (:,:,ik100)  * zfact * tmask(:,:,1) 
     587            trc2d(:,:  ,jp_pcs0_2d + 8)  = sinkcal (:,:,ik100)  * zfact * tmask(:,:,1) 
     588            trc3d(:,:,:,jp_pcs0_3d + 11) = sinking (:,:,:)      * zfact * tmask(:,:,:) 
     589            trc3d(:,:,:,jp_pcs0_3d + 12) = sinking2(:,:,:)      * zfact * tmask(:,:,:) 
     590            trc3d(:,:,:,jp_pcs0_3d + 13) = sinksil (:,:,:)      * zfact * tmask(:,:,:) 
     591            trc3d(:,:,:,jp_pcs0_3d + 14) = sinkcal (:,:,:)      * zfact * tmask(:,:,:) 
     592            trc3d(:,:,:,jp_pcs0_3d + 15) = znum3d  (:,:,:)              * tmask(:,:,:) 
     593            trc3d(:,:,:,jp_pcs0_3d + 16) = wsbio3  (:,:,:)              * tmask(:,:,:) 
     594            trc3d(:,:,:,jp_pcs0_3d + 17) = wsbio4  (:,:,:)              * tmask(:,:,:) 
    493595         ENDIF 
    494 # if ! defined key_iomput 
    495          trc2d(:,:  ,jp_pcs0_2d + 4)  = sinking (:,:,ik1)    * zrfact2 * tmask(:,:,1) 
    496          trc2d(:,:  ,jp_pcs0_2d + 5)  = sinking2(:,:,ik1)    * zrfact2 * tmask(:,:,1) 
    497          trc2d(:,:  ,jp_pcs0_2d + 6)  = sinkfer (:,:,ik1)    * zrfact2 * tmask(:,:,1) 
    498          trc2d(:,:  ,jp_pcs0_2d + 7)  = sinksil (:,:,ik1)    * zrfact2 * tmask(:,:,1) 
    499          trc2d(:,:  ,jp_pcs0_2d + 8)  = sinkcal (:,:,ik1)    * zrfact2 * tmask(:,:,1) 
    500          trc3d(:,:,:,jp_pcs0_3d + 11) = sinking (:,:,:)      * zrfact2 * tmask(:,:,:) 
    501          trc3d(:,:,:,jp_pcs0_3d + 12) = sinking2(:,:,:)      * zrfact2 * tmask(:,:,:) 
    502          trc3d(:,:,:,jp_pcs0_3d + 13) = sinksil (:,:,:)      * zrfact2 * tmask(:,:,:) 
    503          trc3d(:,:,:,jp_pcs0_3d + 14) = sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:) 
    504          trc3d(:,:,:,jp_pcs0_3d + 15) = znum3d  (:,:,:)                * tmask(:,:,:) 
    505          trc3d(:,:,:,jp_pcs0_3d + 16) = wsbio3  (:,:,:)                * tmask(:,:,:) 
    506          trc3d(:,:,:,jp_pcs0_3d + 17) = wsbio4  (:,:,:)                * tmask(:,:,:) 
    507 # endif 
    508         ! 
    509596      ENDIF 
     597 
    510598      ! 
    511599      IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
     
    610698         zl = zmin 
    611699         zr = zmax 
    612          wmax = 0.5 * fse3t(1,1,jk) * rday * float(niter1max) / rfact2 
     700         wmax = 0.5 * e3t_n(1,1,jk) * rday * float(niter1max) / rfact2 
    613701         zdiv = xkr_zeta + xkr_eta - xkr_eta * zl 
    614702         znum = zl - 1. 
     
    663751      END DO 
    664752      ! 
     753      ik100 = 10        !  last level where depth less than 100 m 
     754      DO jk = jpkm1, 1, -1 
     755         IF( gdept_1d(jk) > 100. )  iksed = jk - 1 
     756      END DO 
     757      IF (lwp) WRITE(numout,*) 
     758      IF (lwp) WRITE(numout,*) ' Level corresponding to 100m depth ',  ik100 + 1 
     759      IF (lwp) WRITE(numout,*) 
     760      ! 
    665761      t_oce_co2_exp = 0._wp 
    666762      ! 
     
    702798      ztraz(:,:,:) = 0.e0 
    703799      zakz (:,:,:) = 0.e0 
    704       ztrb (:,:,:) = trn(:,:,:,jp_tra) 
     800      ztrb (:,:,:) = trb(:,:,:,jp_tra) 
    705801 
    706802      DO jk = 1, jpkm1 
     
    717813         !  first guess of the slopes interior values 
    718814         DO jk = 2, jpkm1 
    719             ztraz(:,:,jk) = ( trn(:,:,jk-1,jp_tra) - trn(:,:,jk,jp_tra) ) * tmask(:,:,jk) 
     815            ztraz(:,:,jk) = ( trb(:,:,jk-1,jp_tra) - trb(:,:,jk,jp_tra) ) * tmask(:,:,jk) 
    720816         END DO 
    721817         ztraz(:,:,1  ) = 0.0 
     
    746842            DO jj = 1, jpj       
    747843               DO ji = 1, jpi     
    748                   zigma = zwsink2(ji,jj,jk+1) * zstep / fse3w(ji,jj,jk+1) 
     844                  zigma = zwsink2(ji,jj,jk+1) * zstep / e3w_n(ji,jj,jk+1) 
    749845                  zew   = zwsink2(ji,jj,jk+1) 
    750                   psinkflx(ji,jj,jk+1) = -zew * ( trn(ji,jj,jk,jp_tra) - 0.5 * ( 1 + zigma ) * zakz(ji,jj,jk) ) * zstep 
     846                  psinkflx(ji,jj,jk+1) = -zew * ( trb(ji,jj,jk,jp_tra) - 0.5 * ( 1 + zigma ) * zakz(ji,jj,jk) ) * zstep 
    751847               END DO 
    752848            END DO 
     
    760856            DO jj = 1,jpj 
    761857               DO ji = 1, jpi 
    762                   zflx = ( psinkflx(ji,jj,jk) - psinkflx(ji,jj,jk+1) ) / fse3t(ji,jj,jk) 
    763                   trn(ji,jj,jk,jp_tra) = trn(ji,jj,jk,jp_tra) + zflx 
     858                  zflx = ( psinkflx(ji,jj,jk) - psinkflx(ji,jj,jk+1) ) / e3t_n(ji,jj,jk) 
     859                  trb(ji,jj,jk,jp_tra) = trb(ji,jj,jk,jp_tra) + zflx 
    764860               END DO 
    765861            END DO 
     
    771867         DO jj = 1,jpj 
    772868            DO ji = 1, jpi 
    773                zflx = ( psinkflx(ji,jj,jk) - psinkflx(ji,jj,jk+1) ) / fse3t(ji,jj,jk) 
     869               zflx = ( psinkflx(ji,jj,jk) - psinkflx(ji,jj,jk+1) ) / e3t_n(ji,jj,jk) 
    774870               ztrb(ji,jj,jk) = ztrb(ji,jj,jk) + 2. * zflx 
    775871            END DO 
     
    777873      END DO 
    778874 
    779       trn(:,:,:,jp_tra) = ztrb(:,:,:) 
     875      trb(:,:,:,jp_tra) = ztrb(:,:,:) 
    780876      psinkflx(:,:,:)   = 2. * psinkflx(:,:,:) 
    781877      ! 
     
    815911 
    816912   !!====================================================================== 
    817 END MODULE  p4zsink 
     913END MODULE p4zsink 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsms.F90

    r4624 r6225  
    1111   !!   'key_pisces'                                       PISCES bio-model 
    1212   !!---------------------------------------------------------------------- 
    13    !!   p4zsms        :  Time loop of passive tracers sms 
     13   !!   p4zsms         :  Time loop of passive tracers sms 
    1414   !!---------------------------------------------------------------------- 
    1515   USE oce_trc         !  shared variables between ocean and passive tracers 
     
    2424   USE p4zsed          !  Sedimentation 
    2525   USE p4zint          !  time interpolation 
     26   USE p4zrem          !  remineralisation 
    2627   USE iom             !  I/O manager 
    27    USE trdmod_oce      !  Ocean trends variables 
    28    USE trdmod_trc      !  TOP trends variables 
     28   USE trd_oce         !  Ocean trends variables 
     29   USE trdtrc          !  TOP trends variables 
    2930   USE sedmodel        !  Sediment model 
    3031   USE prtctl_trc      !  print control for debugging 
     
    3334   PRIVATE 
    3435 
    35    PUBLIC   p4z_sms_init    ! called in p4zsms.F90 
    36    PUBLIC   p4z_sms    ! called in p4zsms.F90 
    37  
    38    REAL(wp) :: alkbudget, no3budget, silbudget, ferbudget 
    39    INTEGER ::  numco2, numnut  !: logical unit for co2 budget 
     36   PUBLIC   p4z_sms_init   ! called in p4zsms.F90 
     37   PUBLIC   p4z_sms        ! called in p4zsms.F90 
     38 
     39   REAL(wp) :: alkbudget, no3budget, silbudget, ferbudget, po4budget 
     40   REAL(wp) :: xfact1, xfact2, xfact3 
     41   INTEGER ::  numco2, numnut, numnit  !: logical unit for co2 budget 
     42 
     43   !!* Array used to indicate negative tracer values 
     44   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xnegtr     !: ??? 
     45 
    4046 
    4147   !!---------------------------------------------------------------------- 
     
    6167      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index       
    6268      !! 
    63       INTEGER ::   jnt, jn, jl 
     69      INTEGER ::   ji, jj, jk, jnt, jn, jl 
     70      REAL(wp) ::  ztra 
     71#if defined key_kriest 
     72      REAL(wp) ::  zcoef1, zcoef2 
     73#endif 
    6474      CHARACTER (len=25) :: charout 
    65       REAL(wp), POINTER, DIMENSION(:,:,:,:)  :: ztrdpis 
    6675      !!--------------------------------------------------------------------- 
    6776      ! 
    6877      IF( nn_timing == 1 )  CALL timing_start('p4z_sms') 
    6978      ! 
    70       IF( l_trdtrc )  THEN 
    71          CALL wrk_alloc( jpi, jpj, jpk, jp_pisces, ztrdpis )  
    72          DO jn = 1, jp_pisces 
    73             jl = jn + jp_pcs0 - 1 
    74             ztrdpis(:,:,:,jn) = trn(:,:,:,jl) 
    75          ENDDO 
    76       ENDIF 
    77       ! 
    7879      IF( kt == nittrc000 ) THEN 
     80        ! 
     81        ALLOCATE( xnegtr(jpi,jpj,jpk) ) 
    7982        ! 
    8083        CALL p4z_che                              ! initialize the chemical constants 
     
    8891      IF( ln_pisdmp .AND. MOD( kt - nn_dttrc, nn_pisdmp ) == 0 )   CALL p4z_dmp( kt )      ! Relaxation of some tracers 
    8992      ! 
     93      !                                                                    !   set time step size (Euler/Leapfrog) 
     94      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN   ;    rfact = rdttrc     !  at nittrc000 
     95      ELSEIF( kt <= nittrc000 + nn_dttrc )                          THEN   ;    rfact = 2. * rdttrc   ! at nittrc000 or nittrc000+nn_dttrc (Leapfrog) 
     96      ENDIF 
     97      ! 
     98      IF( ( ln_top_euler .AND. kt == nittrc000 )  .OR. ( .NOT.ln_top_euler .AND. kt <= nittrc000 + nn_dttrc ) ) THEN 
     99         rfactr  = 1. / rfact 
     100         rfact2  = rfact / FLOAT( nrdttrc ) 
     101         rfact2r = 1. / rfact2 
     102         xstep = rfact2 / rday         ! Time step duration for biology 
     103         IF(lwp) WRITE(numout,*)  
     104         IF(lwp) WRITE(numout,*) '    Passive Tracer  time step    rfact  = ', rfact, ' rdt = ', rdt 
     105         IF(lwp) write(numout,*) '    PISCES  Biology time step    rfact2 = ', rfact2 
     106         IF(lwp) WRITE(numout,*) 
     107      ENDIF 
     108 
     109      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN 
     110         DO jn = jp_pcs0, jp_pcs1              !   SMS on tracer without Asselin time-filter 
     111            trb(:,:,:,jn) = trn(:,:,:,jn) 
     112         END DO 
     113      ENDIF 
     114      ! 
    90115      IF( ndayflxtr /= nday_year ) THEN      ! New days 
    91116         ! 
     
    105130      DO jnt = 1, nrdttrc          ! Potential time splitting if requested 
    106131         ! 
    107          CALL p4z_bio (kt, jnt)    ! Biology 
    108          CALL p4z_sed (kt, jnt)    ! Sedimentation 
    109          ! 
     132         CALL p4z_bio( kt, jnt )   ! Biology 
     133         CALL p4z_sed( kt, jnt )   ! Sedimentation 
     134         CALL p4z_lys( kt, jnt )   ! Compute CaCO3 saturation 
     135         CALL p4z_flx( kt, jnt )   ! Compute surface fluxes 
     136         ! 
     137         xnegtr(:,:,:) = 1.e0 
    110138         DO jn = jp_pcs0, jp_pcs1 
    111             trb(:,:,:,jn) = trn(:,:,:,jn) 
    112          ENDDO 
    113          ! 
     139            DO jk = 1, jpk 
     140               DO jj = 1, jpj 
     141                  DO ji = 1, jpi 
     142                     IF( ( trb(ji,jj,jk,jn) + tra(ji,jj,jk,jn) ) < 0.e0 ) THEN 
     143                        ztra             = ABS( trb(ji,jj,jk,jn) ) / ( ABS( tra(ji,jj,jk,jn) ) + rtrn ) 
     144                        xnegtr(ji,jj,jk) = MIN( xnegtr(ji,jj,jk),  ztra ) 
     145                     ENDIF 
     146                 END DO 
     147               END DO 
     148            END DO 
     149         END DO 
     150         !                                ! where at least 1 tracer concentration becomes negative 
     151         !                                !  
     152         DO jn = jp_pcs0, jp_pcs1 
     153           trb(:,:,:,jn) = trb(:,:,:,jn) + xnegtr(:,:,:) * tra(:,:,:,jn) 
     154         END DO 
     155        ! 
     156         DO jn = jp_pcs0, jp_pcs1 
     157            tra(:,:,:,jn) = 0._wp 
     158         END DO 
     159         ! 
     160         IF( ln_top_euler ) THEN 
     161            DO jn = jp_pcs0, jp_pcs1 
     162               trn(:,:,:,jn) = trb(:,:,:,jn) 
     163            END DO 
     164         ENDIF 
    114165      END DO 
    115166 
    116       IF( l_trdtrc )  THEN 
    117          DO jn = 1, jp_pisces 
    118             jl = jn + jp_pcs0 - 1 
    119             ztrdpis(:,:,:,jn) = ( ztrdpis(:,:,:,jn) - trn(:,:,:,jl) ) * rfact2r 
    120          ENDDO 
    121       ENDIF 
    122  
    123       CALL p4z_lys( kt )             ! Compute CaCO3 saturation 
    124       CALL p4z_flx( kt )             ! Compute surface fluxes 
    125  
    126       DO jn = jp_pcs0, jp_pcs1 
    127         CALL lbc_lnk( trn(:,:,:,jn), 'T', 1. ) 
    128         CALL lbc_lnk( trb(:,:,:,jn), 'T', 1. ) 
    129         CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. ) 
     167#if defined key_kriest 
     168      !  
     169      zcoef1 = 1.e0 / xkr_massp  
     170      zcoef2 = 1.e0 / xkr_massp / 1.1 
     171      DO jk = 1,jpkm1 
     172         trb(:,:,jk,jpnum) = MAX(  trb(:,:,jk,jpnum), trb(:,:,jk,jppoc) * zcoef1 / xnumm(jk)  ) 
     173         trb(:,:,jk,jpnum) = MIN(  trb(:,:,jk,jpnum), trb(:,:,jk,jppoc) * zcoef2              ) 
    130174      END DO 
    131175      ! 
     176#endif 
     177      ! 
     178      ! 
     179      IF( l_trdtrc ) THEN 
     180         DO jn = jp_pcs0, jp_pcs1 
     181           CALL trd_trc( tra(:,:,:,jn), jn, jptra_sms, kt )   ! save trends 
     182         END DO 
     183      END IF 
     184      ! 
    132185      IF( lk_sed ) THEN  
    133186         ! 
     
    135188         ! 
    136189         DO jn = jp_pcs0, jp_pcs1 
    137            CALL lbc_lnk( trn(:,:,:,jn), 'T', 1. ) 
     190           CALL lbc_lnk( trb(:,:,:,jn), 'T', 1. ) 
    138191         END DO 
    139192         ! 
     
    142195      IF( lrst_trc )  CALL p4z_rst( kt, 'WRITE' )  !* Write PISCES informations in restart file  
    143196      ! 
    144       IF( l_trdtrc ) THEN 
    145          DO jn = 1, jp_pisces 
    146             jl = jn + jp_pcs0 - 1 
    147              ztrdpis(:,:,:,jn) = ztrdpis(:,:,:,jn) + tra(:,:,:,jl) 
    148              CALL trd_mod_trc( ztrdpis(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends 
    149           END DO 
    150           CALL wrk_dealloc( jpi, jpj, jpk, jp_pisces, ztrdpis )  
    151       END IF 
    152       ! 
    153       CALL p4z_chk_mass( kt ) ! Mass conservation checking 
     197 
     198      IF( lk_iomput .OR. ln_check_mass )  CALL p4z_chk_mass( kt ) ! Mass conservation checking 
    154199 
    155200      IF ( lwm .AND. kt == nittrc000 ) CALL FLUSH    ( numonp )     ! flush output namelist PISCES 
     
    281326               ztmas   = tmask(ji,jj,jk) 
    282327               ztmas1  = 1. - tmask(ji,jj,jk) 
    283                zcaralk = trn(ji,jj,jk,jptal) - borat(ji,jj,jk) / (  1. + 1.E-8 / ( rtrn + akb3(ji,jj,jk) )  ) 
    284                zco3    = ( zcaralk - trn(ji,jj,jk,jpdic) ) * ztmas + 0.5e-3 * ztmas1 
    285                zbicarb = ( 2. * trn(ji,jj,jk,jpdic) - zcaralk ) 
     328               zcaralk = trb(ji,jj,jk,jptal) - borat(ji,jj,jk) / (  1. + 1.E-8 / ( rtrn + akb3(ji,jj,jk) )  ) 
     329               zco3    = ( zcaralk - trb(ji,jj,jk,jpdic) ) * ztmas + 0.5e-3 * ztmas1 
     330               zbicarb = ( 2. * trb(ji,jj,jk,jpdic) - zcaralk ) 
    286331               hi(ji,jj,jk) = ( ak23(ji,jj,jk) * zbicarb / zco3 ) * ztmas + 1.e-9 * ztmas1 
    287332            END DO 
     
    328373         ENDIF 
    329374         ! 
     375         IF( iom_varid( numrtr, 'tcflxcum', ldstop = .FALSE. ) > 0 ) THEN  ! cumulative total flux of carbon 
     376            CALL iom_get( numrtr, 'tcflxcum' , t_oce_co2_flx_cum  ) 
     377         ELSE 
     378            t_oce_co2_flx_cum = 0._wp 
     379         ENDIF 
     380         ! 
    330381      ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN 
    331382         IF( kt == nitrst ) THEN 
     
    337388         CALL iom_rstput( kt, nitrst, numrtw, 'Silicalim', xksi(:,:) ) 
    338389         CALL iom_rstput( kt, nitrst, numrtw, 'Silicamax', xksimax(:,:) ) 
     390         CALL iom_rstput( kt, nitrst, numrtw, 'tcflxcum', t_oce_co2_flx_cum ) 
    339391      ENDIF 
    340392      ! 
     
    355407      REAL(wp) ::  silmean = 91.51     ! mean value of silicate 
    356408      ! 
    357       REAL(wp) :: zarea, zalksum, zpo4sum, zno3sum, zsilsum 
     409      REAL(wp) :: zarea, zalksumn, zpo4sumn, zno3sumn, zsilsumn 
     410      REAL(wp) :: zalksumb, zpo4sumb, zno3sumb, zsilsumb 
    358411      !!--------------------------------------------------------------------- 
    359412 
     
    368421         zarea          = 1._wp / glob_sum( cvol(:,:,:) ) * 1e6               
    369422 
    370          zalksum = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:)  ) * zarea 
    371          zpo4sum = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea * po4r 
    372          zno3sum = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea * rno3 
    373          zsilsum = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea 
     423         zalksumn = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:)  ) * zarea 
     424         zpo4sumn = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea * po4r 
     425         zno3sumn = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea * rno3 
     426         zsilsumn = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea 
    374427  
    375          IF(lwp) WRITE(numout,*) '       TALK mean : ', zalksum 
    376          trn(:,:,:,jptal) = trn(:,:,:,jptal) * alkmean / zalksum 
    377  
    378          IF(lwp) WRITE(numout,*) '       PO4  mean : ', zpo4sum 
    379          trn(:,:,:,jppo4) = trn(:,:,:,jppo4) * po4mean / zpo4sum 
    380  
    381          IF(lwp) WRITE(numout,*) '       NO3  mean : ', zno3sum 
    382          trn(:,:,:,jpno3) = trn(:,:,:,jpno3) * no3mean / zno3sum 
    383  
    384          IF(lwp) WRITE(numout,*) '       SiO3 mean : ', zsilsum 
    385          trn(:,:,:,jpsil) = MIN( 400.e-6,trn(:,:,:,jpsil) * silmean / zsilsum ) 
    386          ! 
    387       ENDIF 
    388  
     428         IF(lwp) WRITE(numout,*) '       TALKN mean : ', zalksumn 
     429         trn(:,:,:,jptal) = trn(:,:,:,jptal) * alkmean / zalksumn 
     430 
     431         IF(lwp) WRITE(numout,*) '       PO4N  mean : ', zpo4sumn 
     432         trn(:,:,:,jppo4) = trn(:,:,:,jppo4) * po4mean / zpo4sumn 
     433 
     434         IF(lwp) WRITE(numout,*) '       NO3N  mean : ', zno3sumn 
     435         trn(:,:,:,jpno3) = trn(:,:,:,jpno3) * no3mean / zno3sumn 
     436 
     437         IF(lwp) WRITE(numout,*) '       SiO3N mean : ', zsilsumn 
     438         trn(:,:,:,jpsil) = MIN( 400.e-6,trn(:,:,:,jpsil) * silmean / zsilsumn ) 
     439         ! 
     440         ! 
     441         IF( .NOT. ln_top_euler ) THEN 
     442            zalksumb = glob_sum( trb(:,:,:,jptal) * cvol(:,:,:)  ) * zarea 
     443            zpo4sumb = glob_sum( trb(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea * po4r 
     444            zno3sumb = glob_sum( trb(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea * rno3 
     445            zsilsumb = glob_sum( trb(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea 
     446  
     447            IF(lwp) WRITE(numout,*) ' ' 
     448            IF(lwp) WRITE(numout,*) '       TALKB mean : ', zalksumb 
     449            trb(:,:,:,jptal) = trb(:,:,:,jptal) * alkmean / zalksumb 
     450 
     451            IF(lwp) WRITE(numout,*) '       PO4B  mean : ', zpo4sumb 
     452            trb(:,:,:,jppo4) = trb(:,:,:,jppo4) * po4mean / zpo4sumb 
     453 
     454            IF(lwp) WRITE(numout,*) '       NO3B  mean : ', zno3sumb 
     455            trb(:,:,:,jpno3) = trb(:,:,:,jpno3) * no3mean / zno3sumb 
     456 
     457            IF(lwp) WRITE(numout,*) '       SiO3B mean : ', zsilsumb 
     458            trb(:,:,:,jpsil) = MIN( 400.e-6,trb(:,:,:,jpsil) * silmean / zsilsumb ) 
     459        ENDIF 
     460        ! 
     461      ENDIF 
     462        ! 
    389463   END SUBROUTINE p4z_dmp 
    390464 
     
    399473      ! 
    400474      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index       
    401       !! 
     475      REAL(wp)             ::  zrdenittot, zsdenittot, znitrpottot 
     476      CHARACTER(LEN=100)   ::   cltxt 
     477      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zvol 
     478      INTEGER :: jk 
     479      !!---------------------------------------------------------------------- 
     480 
     481      ! 
    402482      !!--------------------------------------------------------------------- 
    403483 
     
    406486            CALL ctl_opn( numco2, 'carbon.budget'  , 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea ) 
    407487            CALL ctl_opn( numnut, 'nutrient.budget', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea ) 
     488            CALL ctl_opn( numnit, 'nitrogen.budget', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea ) 
     489            xfact1 = rfact2r * 12. / 1.e15 * ryyss    ! conversion molC/kt --> PgC/yr 
     490            xfact2 = 1.e+3 * rno3 * 14. / 1.e12 * ryyss   ! conversion molC/l/s ----> TgN/m3/yr 
     491            xfact3 = 1.e+3 * rfact2r * rno3   ! conversion molC/l/kt ----> molN/m3/s 
     492            cltxt='time-step   Alkalinity        Nitrate        Phosphorus         Silicate           Iron' 
     493            IF( lwp ) WRITE(numnut,*)  TRIM(cltxt) 
     494            IF( lwp ) WRITE(numnut,*)  
    408495         ENDIF 
    409496      ENDIF 
    410497 
    411       IF( ln_check_mass .AND. kt == nitend ) THEN      !   Compute the budget of NO3, ALK, Si, Fer 
     498      ! 
     499      IF( iom_use( "pno3tot" ) .OR. ( ln_check_mass .AND. kt == nitend )  ) THEN 
     500         !   Compute the budget of NO3, ALK, Si, Fer 
    412501         no3budget = glob_sum( (   trn(:,:,:,jpno3) + trn(:,:,:,jpnh4)  & 
    413502            &                    + trn(:,:,:,jpphy) + trn(:,:,:,jpdia)  & 
     
    417506            &                    + trn(:,:,:,jpgoc)                     & 
    418507#endif 
    419             &                    + trn(:,:,:,jpdoc)                     ) * cvol(:,:,:)  )  
    420          !  
     508            &                    + trn(:,:,:,jpdoc)                     ) * cvol(:,:,:)  ) 
     509         ! 
     510         no3budget = no3budget / areatot 
     511         CALL iom_put( "pno3tot", no3budget ) 
     512      ENDIF 
     513      ! 
     514      IF( iom_use( "ppo4tot" ) .OR. ( ln_check_mass .AND. kt == nitend )  ) THEN 
     515         po4budget = glob_sum( (   trn(:,:,:,jppo4)                     & 
     516            &                    + trn(:,:,:,jpphy) + trn(:,:,:,jpdia)  & 
     517            &                    + trn(:,:,:,jpzoo) + trn(:,:,:,jpmes)  & 
     518            &                    + trn(:,:,:,jppoc)                     & 
     519#if ! defined key_kriest 
     520            &                    + trn(:,:,:,jpgoc)                     & 
     521#endif 
     522            &                    + trn(:,:,:,jpdoc)                     ) * cvol(:,:,:)  ) 
     523         po4budget = po4budget / areatot 
     524         CALL iom_put( "ppo4tot", po4budget ) 
     525      ENDIF 
     526      ! 
     527      IF( iom_use( "psiltot" ) .OR. ( ln_check_mass .AND. kt == nitend )  ) THEN 
    421528         silbudget = glob_sum( (   trn(:,:,:,jpsil) + trn(:,:,:,jpgsi)  & 
    422529            &                    + trn(:,:,:,jpdsi)                     ) * cvol(:,:,:)  ) 
    423          !  
     530         ! 
     531         silbudget = silbudget / areatot 
     532         CALL iom_put( "psiltot", silbudget ) 
     533      ENDIF 
     534      ! 
     535      IF( iom_use( "palktot" ) .OR. ( ln_check_mass .AND. kt == nitend )  ) THEN 
    424536         alkbudget = glob_sum( (   trn(:,:,:,jpno3) * rno3              & 
    425537            &                    + trn(:,:,:,jptal)                     & 
    426538            &                    + trn(:,:,:,jpcal) * 2.                ) * cvol(:,:,:)  ) 
    427          !  
     539         ! 
     540         alkbudget = alkbudget / areatot 
     541         CALL iom_put( "palktot", alkbudget ) 
     542      ENDIF 
     543      ! 
     544      IF( iom_use( "pfertot" ) .OR. ( ln_check_mass .AND. kt == nitend )  ) THEN 
    428545         ferbudget = glob_sum( (   trn(:,:,:,jpfer) + trn(:,:,:,jpnfe)  & 
    429546            &                    + trn(:,:,:,jpdfe)                     & 
     
    434551            &                    + trn(:,:,:,jpzoo) * ferat3            & 
    435552            &                    + trn(:,:,:,jpmes) * ferat3            ) * cvol(:,:,:)  ) 
    436  
    437          ! 
     553         ! 
     554         ferbudget = ferbudget / areatot 
     555         CALL iom_put( "pfertot", ferbudget ) 
     556      ENDIF 
     557      ! 
     558 
     559      ! Global budget of N SMS : denitrification in the water column and in the sediment 
     560      !                          nitrogen fixation by the diazotrophs 
     561      ! -------------------------------------------------------------------------------- 
     562      IF( iom_use( "tnfix" ) .OR.  ( ln_check_mass .AND. kt == nitend )  ) THEN 
     563         znitrpottot  = glob_sum ( nitrpot(:,:,:) * nitrfix * cvol(:,:,:) ) 
     564         CALL iom_put( "tnfix"  , znitrpottot * 1.e+3 * rno3 )  ! Global  nitrogen fixation molC/l  to molN/m3  
     565      ENDIF 
     566      ! 
     567      IF( iom_use( "tdenit" ) .OR.  ( ln_check_mass .AND. kt == nitend )  ) THEN 
     568         zrdenittot   = glob_sum ( denitr(:,:,:) * rdenit * xnegtr(:,:,:) * cvol(:,:,:) ) 
     569         CALL iom_put( "tdenit"  , zrdenittot * 1.e+3 * rno3 )  ! Total denitrification molC/l to molN/m3  
     570      ENDIF 
     571      ! 
     572      IF( iom_use( "Sdenit" ) .OR.  ( ln_check_mass .AND. kt == nitend )  ) THEN 
     573         zsdenittot   = glob_sum ( sdenit(:,:) * e1e2t(:,:) ) 
     574         CALL iom_put( "Sdenit", sdenit(:,:) * xfact3 * tmask(:,:,1) )  ! Nitrate reduction in the sediments 
     575      ENDIF 
     576 
     577      IF( ln_check_mass .AND. kt == nitend ) THEN   ! Compute the budget of NO3, ALK, Si, Fer 
    438578         t_atm_co2_flx  = t_atm_co2_flx / glob_sum( e1e2t(:,:) ) 
    439          t_oce_co2_flx  = t_oce_co2_flx         * 12. / 1.e15 * (-1 ) 
    440          tpp            = tpp           * 1000. * 12. / 1.E15 
    441          t_oce_co2_exp  = t_oce_co2_exp * 1000. * 12. / 1.E15 
    442          ! 
    443          no3budget = no3budget / areatot 
    444          silbudget = silbudget / areatot 
    445          alkbudget = alkbudget / areatot 
    446          ferbudget = ferbudget / areatot 
    447          ! 
    448          IF(lwp) THEN 
    449             WRITE(numco2,9000) ndastp, t_atm_co2_flx, t_oce_co2_flx, tpp, t_oce_co2_exp 
    450             WRITE(numnut,9500) ndastp, alkbudget, no3budget, silbudget, ferbudget 
    451          ENDIF 
    452          ! 
    453       ENDIF 
    454        ! 
     579         t_oce_co2_flx  = t_oce_co2_flx         * xfact1 * (-1 ) 
     580         tpp            = tpp           * 1000. * xfact1 
     581         t_oce_co2_exp  = t_oce_co2_exp * 1000. * xfact1 
     582         IF( lwp ) WRITE(numco2,9000) ndastp, t_atm_co2_flx, t_oce_co2_flx, tpp, t_oce_co2_exp 
     583         IF( lwp ) WRITE(numnut,9100) ndastp, alkbudget        * 1.e+06, & 
     584             &                                no3budget * rno3 * 1.e+06, & 
     585             &                                po4budget * po4r * 1.e+06, & 
     586             &                                silbudget        * 1.e+06, & 
     587             &                                ferbudget        * 1.e+09 
     588         ! 
     589         IF( lwp ) WRITE(numnit,9200) ndastp, znitrpottot * xfact2  , & 
     590         &                             zrdenittot  * xfact2  , & 
     591         &                             zsdenittot  * xfact2 
     592 
     593      ENDIF 
     594      ! 
    455595 9000  FORMAT(i8,f10.5,e18.10,f10.5,f10.5) 
    456  9500  FORMAT(i8,4e18.10)      
     596 9100  FORMAT(i8,5e18.10) 
     597 9200  FORMAT(i8,3f10.5) 
     598 
    457599       ! 
    458600   END SUBROUTINE p4z_chk_mass 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/par_sed.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    77   !!        !  06-12  (C. Ethe)  Orignal 
    88   !!---------------------------------------------------------------------- 
     9   !! $Id$ 
    910#if defined key_sed 
    1011   !! Domain characteristics 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sed.F90

    • Property svn:keywords set to Id
    r4292 r6225  
    160160   INTEGER, PUBLIC ::  numsed = 27    ! units 
    161161 
     162   !! $Id$ 
    162163CONTAINS 
    163164 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedadv.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    2323   REAL(wp) :: eps = 1.e-13 
    2424 
     25   !! $Id$ 
    2526CONTAINS 
    2627 
     
    438439   !! MODULE sedbtb  :   Dummy module  
    439440   !!====================================================================== 
     441   !! $Id$ 
    440442CONTAINS 
    441443   SUBROUTINE sed_adv( kt )         ! Empty routine 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedarr.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    2929   !!---------------------------------------------------------------------- 
    3030   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    31    !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limtab.F90,v 1.2 2005/03/27 18:34:42 opalod Exp $  
     31   !! $Id$  
    3232   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    3333   !!---------------------------------------------------------------------- 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedbtb.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    1212 
    1313 
     14   !! $Id$ 
    1415CONTAINS 
    1516    
     
    7778   !! MODULE sedbtb  :   Dummy module  
    7879   !!====================================================================== 
     80   !! $Id$ 
    7981CONTAINS 
    8082   SUBROUTINE sed_btb( kt )         ! Empty routine 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedchem.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    163163   DATA Ddsw / 999.842594 , 6.793952E-2 , -9.095290E-3, 1.001685E-4, -1.120083E-6, 6.536332E-9/ 
    164164 
     165   !! $Id$ 
    165166CONTAINS 
    166167 
     
    559560   !! MODULE sedchem  :   Dummy module  
    560561   !!====================================================================== 
     562   !! $Id$ 
    561563CONTAINS 
    562564   SUBROUTINE sed_chem( kt )         ! Empty routine 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedco3.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    2323   !!---------------------------------------------------------------------- 
    2424 
     25   !! $Id$ 
    2526CONTAINS 
    2627 
     
    188189   !! MODULE sedco3  :   Dummy module  
    189190   !!====================================================================== 
     191   !! $Id$ 
    190192CONTAINS 
    191193   SUBROUTINE sed_co3( kt )         ! Empty routine 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/seddsr.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    2020   REAL(wp), DIMENSION(:), ALLOCATABLE, PUBLIC ::  dens_mol_wgt  ! molecular density  
    2121 
     22   !! $Id$ 
    2223CONTAINS 
    2324    
     
    530531   !! MODULE seddsr  :   Dummy module  
    531532   !!====================================================================== 
     533   !! $Id$ 
    532534CONTAINS 
    533535   SUBROUTINE sed_dsr ( kt ) 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/seddta.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    2828#endif 
    2929 
     30   !! $Id$ 
    3031CONTAINS 
    3132 
     
    268269   !! MODULE seddta  :   Dummy module  
    269270   !!====================================================================== 
     271   !! $Id$ 
    270272CONTAINS 
    271273   SUBROUTINE sed_dta ( kt ) 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedini.F90

    • Property svn:keywords set to Id
    r4292 r6225  
    5555   PUBLIC sed_init          ! routine called by opa.F90 
    5656 
     57   !! $Id$ 
    5758CONTAINS 
    5859 
     
    856857   !!   Dummy module :                      NO Sediment model 
    857858   !!---------------------------------------------------------------------- 
     859   !! $Id$ 
    858860CONTAINS 
    859861   SUBROUTINE sed_ini              ! Empty routine 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmat.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    2222 
    2323 
     24   !! $Id$ 
    2425 CONTAINS 
    2526 
     
    257258   !! MODULE sedmat  :   Dummy module  
    258259   !!====================================================================== 
     260   !! $Id$ 
    259261CONTAINS 
    260262   SUBROUTINE sed_mat         ! Empty routine 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmbc.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    3636   REAL(wp)  :: src13ca   
    3737 
     38   !! $Id$ 
    3839CONTAINS 
    3940 
     
    311312   !! MODULE sedmbc :   Dummy module  
    312313   !!====================================================================== 
     314   !! $Id$ 
    313315CONTAINS 
    314316   SUBROUTINE sed_mbc( kt )         ! Empty routine 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmodel.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    1717   LOGICAL, PUBLIC, PARAMETER ::   lk_sed = .TRUE.     !: sediment flag 
    1818 
     19   !! $Id$ 
    1920CONTAINS 
    2021 
     
    4748   !!====================================================================== 
    4849   LOGICAL, PUBLIC, PARAMETER ::   lk_sed = .FALSE.     !: sediment flag 
     50   !! $Id$ 
    4951CONTAINS 
    5052   SUBROUTINE sed_model( kt )         ! Empty routine 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedrst.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    2525    
    2626    
     27   !! $Id$ 
    2728CONTAINS 
    2829 
     
    5960 
    6061      ALLOCATE( zdta(jpi,jpj,jpksed,jptrased), zdta1(jpi,jpj,jpksed,2), zhipor(jpoce,jpksed) )  
    61  
    62       IF ( jprstlib == jprstdimg ) THEN 
    63         ! eventually read netcdf file (monobloc)  for restarting on different number of processors 
    64         ! if restart_sed.nc exists, then set jlibalt to jpnf90 
    65         INQUIRE( FILE = 'restart_sed.nc', EXIST = llok ) 
    66         IF ( llok ) THEN ; jlibalt = jpnf90  ; ELSE ; jlibalt = jprstlib ; ENDIF 
    67       ENDIF 
    6862 
    6963      CALL iom_open( 'restart_sed', numrsr, kiolib = jlibalt )      
     
    270264   !! MODULE sedrst :   Dummy module  
    271265   !!====================================================================== 
     266   !! $Id$ 
    272267CONTAINS 
    273268   SUBROUTINE sed_rst_read                      ! Empty routines 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedsfc.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    1212   PUBLIC sed_sfc 
    1313 
     14   !! $Id$ 
    1415CONTAINS 
    1516 
     
    6768   !! MODULE sedsfc  :   Dummy module  
    6869   !!====================================================================== 
     70   !! $Id$ 
    6971CONTAINS 
    7072   SUBROUTINE sed_sfc ( kt ) 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedstp.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    2323   PUBLIC sed_stp  ! called by step.F90 
    2424 
     25   !! $Id$ 
    2526CONTAINS 
    2627 
     
    6970   !! MODULE sedstp  :   Dummy module  
    7071   !!====================================================================== 
     72   !! $Id$ 
    7173CONTAINS 
    7274   SUBROUTINE sed_stp( kt )         ! Empty routine 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedwri.F90

    • Property svn:keywords set to Id
    r3443 r6225  
    2525   INTEGER, ALLOCATABLE, SAVE, DIMENSION(:) :: ndext51 
    2626 
     27   !! $Id$ 
    2728CONTAINS 
    2829 
     
    264265   !! MODULE sedwri  :   Dummy module 
    265266   !!====================================================================== 
     267   !! $Id$ 
    266268CONTAINS 
    267269   SUBROUTINE sed_wri( kt )         ! Empty routine 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/par_pisces.F90

    r3680 r6225  
    6363   INTEGER, PUBLIC, PARAMETER ::   jpdia = 11    !: Diatoms Concentration 
    6464   INTEGER, PUBLIC, PARAMETER ::   jpmes = 12    !: Mesozooplankton Concentration 
    65    INTEGER, PUBLIC, PARAMETER ::   jpdsi = 13    !: (big) Silicate Concentration 
     65   INTEGER, PUBLIC, PARAMETER ::   jpdsi = 13    !: Diatoms Silicate Concentration 
    6666   INTEGER, PUBLIC, PARAMETER ::   jpfer = 14    !: Iron Concentration 
    6767   INTEGER, PUBLIC, PARAMETER ::   jpnum = 15    !: Big iron particles Concentration 
    6868   INTEGER, PUBLIC, PARAMETER ::   jpsfe = 16    !: number of particulate organic phosphate concentration 
    6969   INTEGER, PUBLIC, PARAMETER ::   jpdfe = 17    !: Diatoms iron Concentration 
    70    INTEGER, PUBLIC, PARAMETER ::   jpgsi = 18    !: Diatoms Silicate Concentration 
     70   INTEGER, PUBLIC, PARAMETER ::   jpgsi = 18    !: (big) Silicate Concentration 
    7171   INTEGER, PUBLIC, PARAMETER ::   jpnfe = 19    !: Nano iron Concentration 
    7272   INTEGER, PUBLIC, PARAMETER ::   jpnch = 20    !: Nano Chlorophyll Concentration 
     
    102102   INTEGER, PUBLIC, PARAMETER ::   jpdia = 11    !: Diatoms Concentration 
    103103   INTEGER, PUBLIC, PARAMETER ::   jpmes = 12    !: Mesozooplankton Concentration 
    104    INTEGER, PUBLIC, PARAMETER ::   jpdsi = 13    !: (big) Silicate Concentration 
     104   INTEGER, PUBLIC, PARAMETER ::   jpdsi = 13    !: Diatoms Silicate Concentration 
    105105   INTEGER, PUBLIC, PARAMETER ::   jpfer = 14    !: Iron Concentration 
    106106   INTEGER, PUBLIC, PARAMETER ::   jpbfe = 15    !: Big iron particles Concentration 
     
    108108   INTEGER, PUBLIC, PARAMETER ::   jpsfe = 17    !: Small iron particles Concentration 
    109109   INTEGER, PUBLIC, PARAMETER ::   jpdfe = 18    !: Diatoms iron Concentration 
    110    INTEGER, PUBLIC, PARAMETER ::   jpgsi = 19    !: Diatoms Silicate Concentration 
     110   INTEGER, PUBLIC, PARAMETER ::   jpgsi = 19    !: (big) Silicate Concentration 
    111111   INTEGER, PUBLIC, PARAMETER ::   jpnfe = 20    !: Nano iron Concentration 
    112112   INTEGER, PUBLIC, PARAMETER ::   jpnch = 21    !: Nano Chlorophyll Concentration 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90

    r4529 r6225  
    3636   REAL(wp) ::   rfact2, rfact2r   !: ??? 
    3737   REAL(wp) ::   xstep             !: Time step duration for biology 
     38   REAL(wp) ::   ryyss             !: number of seconds per year  
     39   REAL(wp) ::   r1_ryyss          !: inverse number of seconds per year  
     40 
    3841 
    3942   !!*  Biological parameters  
     
    5356   REAL(wp) ::  t_oce_co2_exp      !: total carbon export 
    5457   REAL(wp) ::  t_oce_co2_flx      !: Total ocean carbon flux 
     58   REAL(wp) ::  t_oce_co2_flx_cum  !: Cumulative Total ocean carbon flux 
    5559   REAL(wp) ::  t_atm_co2_flx      !: global mean of atmospheric pco2 
    5660 
     
    102106   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tgfunc2   !: Temp. dependancy of mesozooplankton rates 
    103107 
    104    !!* Array used to indicate negative tracer values 
    105    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xnegtr     !: ??? 
    106  
    107108#if defined key_kriest 
    108109   !!*  Kriest parameter for aggregation 
     
    127128      !!---------------------------------------------------------------------- 
    128129      USE lib_mpp , ONLY: ctl_warn 
    129       INTEGER ::   ierr(6)        ! Local variables 
     130      INTEGER ::   ierr(5)        ! Local variables 
    130131      !!---------------------------------------------------------------------- 
    131132      ierr(:) = 0 
     
    158159      ALLOCATE( tgfunc(jpi,jpj,jpk)  , tgfunc2(jpi,jpj,jpk) ,    STAT=ierr(5) ) 
    159160         ! 
    160       !* Array used to indicate negative tracer values   
    161       ALLOCATE( xnegtr(jpi,jpj,jpk)  ,                           STAT=ierr(6) ) 
    162161#endif 
    163162      ! 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90

    r4521 r6225  
    2727   PUBLIC   trc_ini_pisces   ! called by trcini.F90 module 
    2828 
    29  
    30 #  include "top_substitute.h90" 
    3129   !!---------------------------------------------------------------------- 
    3230   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    7169      USE p4zmort         !  Mortality terms for phytoplankton 
    7270      USE p4zlys          !  Calcite saturation 
     71      USE p4zsed          !  Sedimentation & burial 
    7372      ! 
    7473      REAL(wp), SAVE :: sco2   =  2.312e-3_wp 
    75       REAL(wp), SAVE :: alka0  =  2.423e-3_wp 
     74      REAL(wp), SAVE :: alka0  =  2.426e-3_wp 
    7675      REAL(wp), SAVE :: oxyg0  =  177.6e-6_wp  
    77       REAL(wp), SAVE :: po4    =  2.174e-6_wp  
     76      REAL(wp), SAVE :: po4    =  2.165e-6_wp  
    7877      REAL(wp), SAVE :: bioma0 =  1.000e-8_wp   
    79       REAL(wp), SAVE :: silic1 =  91.65e-6_wp   
    80       REAL(wp), SAVE :: no3    =  31.04e-6_wp * 7.625_wp 
     78      REAL(wp), SAVE :: silic1 =  91.51e-6_wp   
     79      REAL(wp), SAVE :: no3    =  30.9e-6_wp * 7.625_wp 
    8180      ! 
    8281      INTEGER  ::  ji, jj, jk, ierr 
     
    9796      ierr = ierr +  p4z_rem_alloc() 
    9897      ierr = ierr +  p4z_flx_alloc() 
     98      ierr = ierr +  p4z_sed_alloc() 
    9999      ! 
    100100      IF( lk_mpp    )   CALL mpp_sum( ierr ) 
    101101      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'pisces_alloc: unable to allocate PISCES arrays' ) 
    102102      ! 
     103      ryyss    = nyear_len(1) * rday    ! number of seconds per year 
     104      r1_ryyss = 1. / ryyss 
     105      ! 
    103106 
    104107      CALL p4z_sms_init       !  Maint routine 
    105108      !                                            ! Time-step 
    106       rfact   = rdttrc(1)                          ! --------- 
    107       rfactr  = 1. / rfact 
    108       rfact2  = rfact / FLOAT( nrdttrc ) 
    109       rfact2r = 1. / rfact2 
    110  
    111       IF(lwp) WRITE(numout,*) '    Passive Tracer  time step    rfact  = ', rfact, ' rdt = ', rdttra(1) 
    112       IF(lwp) write(numout,*) '    PISCES  Biology time step    rfact2 = ', rfact2 
    113  
    114  
    115109 
    116110      ! Set biological ratios 
     
    162156      END IF 
    163157 
    164       ! Time step duration for biology 
    165       xstep = rfact2 / rday 
    166158 
    167159      CALL p4z_sink_init      !  vertical flux of particulate organic matter 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90

    r4624 r6225  
    1919   USE trc             ! TOP variables 
    2020   USE sms_pisces      ! sms trends 
    21    USE trdmod_trc_oce 
     21   USE trdtrc_oce 
    2222   USE iom             ! I/O manager 
    2323 
     
    123123#if defined key_pisces_reduced 
    124124 
    125       IF( ( .NOT.lk_iomput .AND. ln_diabio ) .OR. lk_trdmld_trc ) THEN 
     125      IF( ( .NOT.lk_iomput .AND. ln_diabio ) .OR. lk_trdmxl_trc ) THEN 
    126126         ! 
    127127         ! Namelist nampisdbi 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/PISCES/trcwri_pisces.F90

    r4292 r6225  
    2121   PUBLIC trc_wri_pisces  
    2222 
    23 #  include "top_substitute.h90" 
     23   !!---------------------------------------------------------------------- 
     24   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     25   !! $Id: trcnam.F90 5836 2015-10-26 14:49:40Z cetlod $ 
     26   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
     27   !!---------------------------------------------------------------------- 
    2428CONTAINS 
    2529 
     
    3034      !! ** Purpose :   output passive tracers fields  
    3135      !!--------------------------------------------------------------------- 
    32       CHARACTER (len=20)   :: cltra 
    33       REAL(wp)             :: zrfact 
    34       INTEGER              :: jn 
     36      CHARACTER (len=20)           :: cltra 
     37      REAL(wp)                     :: zfact 
     38      INTEGER                      :: ji, jj, jk, jn 
     39      REAL(wp), DIMENSION(jpi,jpj) :: zdic, zo2min, zdepo2min 
    3540      !!--------------------------------------------------------------------- 
    3641  
     
    4045      DO jn = jp_pcs0, jp_pcs1 
    4146         cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer 
    42          IF( lk_vvl ) THEN 
    43             CALL iom_put( cltra, trn(:,:,:,jn) * fse3t_n(:,:,:) ) 
    44          ELSE 
    45             CALL iom_put( cltra, trn(:,:,:,jn) ) 
    46          ENDIF 
    47          CALL iom_put( cltra, trn(:,:,:,jn) * zrfact ) 
     47         CALL iom_put( cltra, trn(:,:,:,jn) ) 
    4848      END DO 
    4949#else 
    5050      DO jn = jp_pcs0, jp_pcs1 
    51          zrfact = 1.0e+6  
    52          IF( jn == jpno3 .OR. jn == jpnh4 ) zrfact = rno3 * 1.0e+6  
    53          IF( jn == jppo4  )                 zrfact = po4r * 1.0e+6 
     51         zfact = 1.0e+6  
     52         IF( jn == jpno3 .OR. jn == jpnh4 ) zfact = rno3 * 1.0e+6  
     53         IF( jn == jppo4  )                 zfact = po4r * 1.0e+6 
    5454         cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer 
    55          IF( lk_vvl ) THEN 
    56             CALL iom_put( cltra, trn(:,:,:,jn) * fse3t_n(:,:,:) * zrfact ) 
    57          ELSE 
    58             CALL iom_put( cltra, trn(:,:,:,jn) * zrfact ) 
    59          ENDIF 
     55         IF( iom_use( cltra ) )  CALL iom_put( cltra, trn(:,:,:,jn) * zfact ) 
    6056      END DO 
     57 
     58      IF( iom_use( "INTDIC" ) ) THEN                     !   DIC content in kg/m2 
     59         zdic(:,:) = 0. 
     60         DO jk = 1, jpkm1 
     61            zdic(:,:) = zdic(:,:) + trn(:,:,jk,jpdic) * e3t_n(:,:,jk) * tmask(:,:,jk) * 12. 
     62         ENDDO 
     63         CALL iom_put( 'INTDIC', zdic )      
     64      ENDIF 
     65      ! 
     66      IF( iom_use( "O2MIN" ) .OR. iom_use ( "ZO2MIN" ) ) THEN  ! Oxygen minimum concentration and depth  
     67         zo2min   (:,:) = trn(:,:,1,jpoxy) * tmask(:,:,1) 
     68         zdepo2min(:,:) = gdepw_n(:,:,1)   * tmask(:,:,1) 
     69         DO jk = 2, jpkm1 
     70            DO jj = 1, jpj 
     71               DO ji = 1, jpi 
     72                  IF( tmask(ji,jj,jk) == 1 ) then 
     73                     IF( trn(ji,jj,jk,jpoxy) < zo2min(ji,jj) ) then 
     74                        zo2min   (ji,jj) = trn(ji,jj,jk,jpoxy) 
     75                        zdepo2min(ji,jj) = gdepw_n(ji,jj,jk) 
     76                     ENDIF 
     77                  ENDIF 
     78               END DO 
     79            END DO 
     80         END DO 
     81         ! 
     82         CALL iom_put('O2MIN' , zo2min     )                              ! oxygen minimum concentration 
     83         CALL iom_put('ZO2MIN', zdepo2min  )                              ! depth of oxygen minimum concentration 
     84          ! 
     85      ENDIF 
    6186#endif 
    6287      ! 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90

    r4610 r6225  
    44   !! Ocean passive tracers:  advection trend  
    55   !!============================================================================== 
    6    !! History :  2.0  !  05-11  (G. Madec)  Original code 
    7    !!            3.0  !  10-06  (C. Ethe)   Adapted to passive tracers 
     6   !! History :  2.0  !  2005-11  (G. Madec)  Original code 
     7   !!            3.0  !  2010-06  (C. Ethe)   Adapted to passive tracers 
     8   !!            3.7  !  2014-05  (G. Madec, C. Ethe)  Add 2nd/4th order cases for CEN and FCT schemes  
    89   !!---------------------------------------------------------------------- 
    910#if defined key_top 
     
    1112   !!   'key_top'                                                TOP models 
    1213   !!---------------------------------------------------------------------- 
    13    !!   trc_adv      : compute ocean tracer advection trend 
    14    !!   trc_adv_ctl  : control the different options of advection scheme 
    15    !!---------------------------------------------------------------------- 
    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 traadv_cen2     ! 2nd order centered scheme (tra_adv_cen2   routine) 
    20    USE traadv_tvd      ! TVD      scheme           (tra_adv_tvd    routine) 
    21    USE traadv_muscl    ! MUSCL    scheme           (tra_adv_muscl  routine) 
    22    USE traadv_muscl2   ! MUSCL2   scheme           (tra_adv_muscl2 routine) 
    23    USE traadv_ubs      ! UBS      scheme           (tra_adv_ubs    routine) 
    24    USE traadv_qck      ! QUICKEST scheme           (tra_adv_qck    routine) 
    25    USE traadv_eiv      ! eddy induced velocity     (tra_adv_eiv    routine) 
    26    USE traadv_mle      ! ML eddy induced velocity  (tra_adv_mle    routine) 
    27    USE ldftra_oce      ! lateral diffusion coefficient on tracers 
    28    USE prtctl_trc      ! Print control 
     14   !!   trc_adv       : compute ocean tracer advection trend 
     15   !!   trc_adv_ini   : control the different options of advection scheme 
     16   !!---------------------------------------------------------------------- 
     17   USE oce_trc        ! ocean dynamics and active tracers 
     18   USE trc            ! ocean passive tracers variables 
     19   USE traadv_cen     ! centered scheme           (tra_adv_cen  routine) 
     20   USE traadv_fct     ! FCT      scheme           (tra_adv_fct  routine) 
     21   USE traadv_mus     ! MUSCL    scheme           (tra_adv_mus  routine) 
     22   USE traadv_ubs     ! UBS      scheme           (tra_adv_ubs  routine) 
     23   USE traadv_qck     ! QUICKEST scheme           (tra_adv_qck  routine) 
     24   USE traadv_mle     ! ML eddy induced velocity  (tra_adv_mle  routine) 
     25   USE ldftra         ! lateral diffusion coefficient on tracers 
     26   USE ldfslp         ! Lateral diffusion: slopes of neutral surfaces 
     27   ! 
     28   USE prtctl_trc     ! Print control 
    2929 
    3030   IMPLICIT NONE 
    3131   PRIVATE 
    3232 
    33    PUBLIC   trc_adv          ! routine called by step module 
    34    PUBLIC   trc_adv_alloc    ! routine called by nemogcm module 
    35  
    36    INTEGER ::   nadv   ! choice of the type of advection scheme 
    37    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) ::   r2dt  ! vertical profile time-step, = 2 rdttra 
    38    !                                                    ! except at nitrrc000 (=rdttra) if neuler=0 
     33   PUBLIC   trc_adv        
     34   PUBLIC   trc_adv_ini   
     35 
     36   !                            !!* Namelist namtrc_adv * 
     37   LOGICAL ::   ln_trcadv_cen    ! centered scheme flag 
     38   INTEGER ::      nn_cen_h, nn_cen_v   ! =2/4 : horizontal and vertical choices of the order of CEN scheme 
     39   LOGICAL ::   ln_trcadv_fct    ! FCT scheme flag 
     40   INTEGER ::      nn_fct_h, nn_fct_v   ! =2/4 : horizontal and vertical choices of the order of FCT scheme 
     41   INTEGER ::      nn_fct_zts           ! >=1 : 2nd order FCT with vertical sub-timestepping 
     42   LOGICAL ::   ln_trcadv_mus    ! MUSCL scheme flag 
     43   LOGICAL ::      ln_mus_ups           ! use upstream scheme in vivcinity of river mouths 
     44   LOGICAL ::   ln_trcadv_ubs    ! UBS scheme flag 
     45   INTEGER ::      nn_ubs_v             ! =2/4 : vertical choice of the order of UBS scheme 
     46   LOGICAL ::   ln_trcadv_qck    ! QUICKEST scheme flag 
     47 
     48   !                                        ! choices of advection scheme: 
     49   INTEGER, PARAMETER ::   np_NO_adv  = 0   ! no T-S advection 
     50   INTEGER, PARAMETER ::   np_CEN     = 1   ! 2nd/4th order centered scheme 
     51   INTEGER, PARAMETER ::   np_FCT     = 2   ! 2nd/4th order Flux Corrected Transport scheme 
     52   INTEGER, PARAMETER ::   np_FCT_zts = 3   ! 2nd order FCT scheme with vertical sub-timestepping 
     53   INTEGER, PARAMETER ::   np_MUS     = 4   ! MUSCL scheme 
     54   INTEGER, PARAMETER ::   np_UBS     = 5   ! 3rd order Upstream Biased Scheme 
     55   INTEGER, PARAMETER ::   np_QCK     = 6   ! QUICK scheme 
     56 
     57   INTEGER ::              nadv             ! chosen advection scheme 
     58   ! 
     59   REAL(wp) ::   r2dttrc  ! vertical profile time-step, = 2 rdt 
     60   !                                                    ! except at nitrrc000 (=rdt) if neuler=0 
    3961 
    4062   !! * Substitutions 
    41 #  include "domzgr_substitute.h90" 
    4263#  include "vectopt_loop_substitute.h90" 
    4364   !!---------------------------------------------------------------------- 
    44    !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     65   !! NEMO/TOP 3.7 , NEMO Consortium (2015) 
    4566   !! $Id$  
    4667   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4768   !!---------------------------------------------------------------------- 
    4869CONTAINS 
    49  
    50    INTEGER FUNCTION trc_adv_alloc() 
    51       !!---------------------------------------------------------------------- 
    52       !!                  ***  ROUTINE trc_adv_alloc  *** 
    53       !!---------------------------------------------------------------------- 
    54  
    55       ALLOCATE( r2dt(jpk), STAT=trc_adv_alloc ) 
    56  
    57       IF( trc_adv_alloc /= 0 ) CALL ctl_warn('trc_adv_alloc : failed to allocate array.') 
    58  
    59    END FUNCTION trc_adv_alloc 
    60  
    6170 
    6271   SUBROUTINE trc_adv( kt ) 
     
    6877      !! ** Method  : - Update the tracer with the advection term following nadv 
    6978      !!---------------------------------------------------------------------- 
    70       !! 
    7179      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
    7280      ! 
    73       INTEGER ::   jk  
     81      INTEGER ::   jk   ! dummy loop index 
    7482      CHARACTER (len=22) ::   charout 
    7583      REAL(wp), POINTER, DIMENSION(:,:,:) :: zun, zvn, zwn  ! effective velocity 
    7684      !!---------------------------------------------------------------------- 
    7785      ! 
    78       IF( nn_timing == 1 )  CALL timing_start('trc_adv') 
    79       ! 
    80       CALL wrk_alloc( jpi, jpj, jpk, zun, zvn, zwn ) 
    81       ! 
    82  
    83       IF( kt == nittrc000 )   CALL trc_adv_ctl          ! initialisation & control of options 
    84  
    85       IF( ln_top_euler) THEN 
    86          r2dt(:) =  rdttrc(:)              ! = rdttrc (use Euler time stepping) 
    87       ELSE 
    88          IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nittrc000 
    89             r2dt(:) =  rdttrc(:)           ! = rdttrc (restarting with Euler time stepping) 
    90          ELSEIF( kt <= nittrc000 + 1 ) THEN          ! at nittrc000 or nittrc000+1 
    91             r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog) 
    92          ENDIF 
    93       ENDIF 
    94  
    95       !                                                   ! effective transport 
     86      IF( nn_timing == 1 )   CALL timing_start('trc_adv') 
     87      ! 
     88      CALL wrk_alloc( jpi,jpj,jpk,   zun, zvn, zwn ) 
     89      ! 
     90      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN     ! at nittrc000 
     91         r2dttrc =  rdttrc           ! = rdttrc (use or restarting with Euler time stepping) 
     92      ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nittrc000 or nittrc000+1 
     93         r2dttrc = 2. * rdttrc       ! = 2 rdttrc (leapfrog) 
     94      ENDIF 
     95      !                                               !==  effective transport  ==! 
    9696      DO jk = 1, jpkm1 
    97          !                                                ! eulerian transport only 
    98          zun(:,:,jk) = e2u  (:,:) * fse3u(:,:,jk) * un(:,:,jk) 
    99          zvn(:,:,jk) = e1v  (:,:) * fse3v(:,:,jk) * vn(:,:,jk) 
     97         zun(:,:,jk) = e2u  (:,:) * e3u_n(:,:,jk) * un(:,:,jk)                   ! eulerian transport 
     98         zvn(:,:,jk) = e1v  (:,:) * e3v_n(:,:,jk) * vn(:,:,jk) 
    10099         zwn(:,:,jk) = e1e2t(:,:)                 * wn(:,:,jk) 
    101          ! 
    102100      END DO 
    103101      ! 
    104       IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN 
     102      IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN                                 ! add z-tilde and/or vvl corrections 
    105103         zun(:,:,:) = zun(:,:,:) + un_td(:,:,:) 
    106104         zvn(:,:,:) = zvn(:,:,:) + vn_td(:,:,:) 
    107105      ENDIF 
    108106      ! 
    109       zun(:,:,jpk) = 0._wp                                                     ! no transport trough the bottom 
    110       zvn(:,:,jpk) = 0._wp                                                     ! no transport trough the bottom 
    111       zwn(:,:,jpk) = 0._wp                                                     ! no transport trough the bottom 
    112  
    113       IF( lk_traldf_eiv .AND. .NOT. ln_traldf_grif )   &  ! add the eiv transport (if necessary) 
    114          &              CALL tra_adv_eiv( kt, nittrc000, zun, zvn, zwn, 'TRC' ) 
    115       ! 
    116       IF( ln_mle    )   CALL tra_adv_mle( kt, nittrc000, zun, zvn, zwn, 'TRC' )    ! add the mle transport (if necessary) 
    117       ! 
    118       SELECT CASE ( nadv )                            !==  compute advection trend and add it to general trend  ==! 
    119       CASE ( 1 )   ;    CALL tra_adv_cen2  ( kt, nittrc000, 'TRC',       zun, zvn, zwn, trb, trn, tra, jptra )   !  2nd order centered 
    120       CASE ( 2 )   ;    CALL tra_adv_tvd   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  TVD  
    121       CASE ( 3 )   ;    CALL tra_adv_muscl ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb,      tra, jptra, ln_trcadv_msc_ups )   !  MUSCL  
    122       CASE ( 4 )   ;    CALL tra_adv_muscl2( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  MUSCL2  
    123       CASE ( 5 )   ;    CALL tra_adv_ubs   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  UBS  
    124       CASE ( 6 )   ;    CALL tra_adv_qck   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  QUICKEST  
    125       ! 
    126       CASE (-1 )                                      !==  esopa: test all possibility with control print  ==! 
    127          CALL tra_adv_cen2  ( kt, nittrc000, 'TRC',       zun, zvn, zwn, trb, trn, tra, jptra )           
    128          WRITE(charout, FMT="('adv1')")  ; CALL prt_ctl_trc_info(charout) 
    129                                            CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 
    130          CALL tra_adv_tvd   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )           
    131          WRITE(charout, FMT="('adv2')")  ; CALL prt_ctl_trc_info(charout) 
    132                                            CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 
    133          CALL tra_adv_muscl ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb,      tra, jptra, ln_trcadv_msc_ups  )           
    134          WRITE(charout, FMT="('adv3')")  ; CALL prt_ctl_trc_info(charout) 
    135                                            CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 
    136          CALL tra_adv_muscl2( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )           
    137          WRITE(charout, FMT="('adv4')")  ; CALL prt_ctl_trc_info(charout) 
    138                                            CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 
    139          CALL tra_adv_ubs   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )           
    140          WRITE(charout, FMT="('adv5')")  ; CALL prt_ctl_trc_info(charout) 
    141                                            CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 
    142          CALL tra_adv_qck   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )           
    143          WRITE(charout, FMT="('adv6')")  ; CALL prt_ctl_trc_info(charout) 
    144                                            CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 
    145          ! 
     107      IF( ln_ldfeiv .AND. .NOT. ln_traldf_triad )   &  
     108         &              CALL ldf_eiv_trp( kt, nittrc000, zun, zvn, zwn, 'TRC' )  ! add the eiv transport 
     109      ! 
     110      IF( ln_mle    )   CALL tra_adv_mle( kt, nittrc000, zun, zvn, zwn, 'TRC' )  ! add the mle transport 
     111      ! 
     112      zun(:,:,jpk) = 0._wp                                                       ! no transport trough the bottom 
     113      zvn(:,:,jpk) = 0._wp 
     114      zwn(:,:,jpk) = 0._wp 
     115      ! 
     116      ! 
     117      SELECT CASE ( nadv )                      !==  compute advection trend and add it to general trend  ==! 
     118      ! 
     119      CASE ( np_CEN )                                    ! Centered : 2nd / 4th order 
     120         CALL tra_adv_cen    ( kt, nittrc000,'TRC',       zun, zvn, zwn     , trn, tra, jptra, nn_cen_h, nn_cen_v ) 
     121      CASE ( np_FCT )                                    ! FCT      : 2nd / 4th order 
     122         CALL tra_adv_fct    ( kt, nittrc000,'TRC', r2dttrc, zun, zvn, zwn, trb, trn, tra, jptra, nn_fct_h, nn_fct_v ) 
     123      CASE ( np_FCT_zts )                                ! 2nd order FCT with vertical time-splitting 
     124         CALL tra_adv_fct_zts( kt, nittrc000,'TRC', r2dttrc, zun, zvn, zwn, trb, trn, tra, jptra        , nn_fct_zts ) 
     125      CASE ( np_MUS )                                    ! MUSCL 
     126         CALL tra_adv_mus    ( kt, nittrc000,'TRC', r2dttrc, zun, zvn, zwn, trb,      tra, jptra        , ln_mus_ups )  
     127      CASE ( np_UBS )                                    ! UBS 
     128         CALL tra_adv_ubs    ( kt, nittrc000,'TRC', r2dttrc, zun, zvn, zwn, trb, trn, tra, jptra        , nn_ubs_v   ) 
     129      CASE ( np_QCK )                                    ! QUICKEST 
     130         CALL tra_adv_qck    ( kt, nittrc000,'TRC', r2dttrc, zun, zvn, zwn, trb, trn, tra, jptra                     ) 
     131      ! 
    146132      END SELECT 
    147  
    148       !                                              ! print mean trends (used for debugging) 
    149       IF( ln_ctl )   THEN 
     133      !                   
     134      IF( ln_ctl )   THEN                             !== print mean trends (used for debugging) 
    150135         WRITE(charout, FMT="('adv ')")  ;  CALL prt_ctl_trc_info(charout) 
    151136                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    152137      END IF 
    153138      ! 
    154       CALL wrk_dealloc( jpi, jpj, jpk, zun, zvn, zwn ) 
     139      CALL wrk_dealloc( jpi,jpj,jpk,  zun, zvn, zwn ) 
    155140      ! 
    156141      IF( nn_timing == 1 )  CALL timing_stop('trc_adv') 
     
    159144 
    160145 
    161    SUBROUTINE trc_adv_ctl 
     146   SUBROUTINE trc_adv_ini 
    162147      !!--------------------------------------------------------------------- 
    163       !!                  ***  ROUTINE trc_adv_ctl  *** 
     148      !!                  ***  ROUTINE trc_adv_ini  *** 
    164149      !!                 
    165150      !! ** Purpose : Control the consistency between namelist options for  
     
    167152      !!---------------------------------------------------------------------- 
    168153      INTEGER ::   ioptio 
    169       !!---------------------------------------------------------------------- 
    170  
    171       ioptio = 0                      ! Parameter control 
    172       IF( ln_trcadv_cen2   )   ioptio = ioptio + 1 
    173       IF( ln_trcadv_tvd    )   ioptio = ioptio + 1 
    174       IF( ln_trcadv_muscl  )   ioptio = ioptio + 1 
    175       IF( ln_trcadv_muscl2 )   ioptio = ioptio + 1 
    176       IF( ln_trcadv_ubs    )   ioptio = ioptio + 1 
    177       IF( ln_trcadv_qck    )   ioptio = ioptio + 1 
    178       IF( lk_esopa         )   ioptio =          1 
    179  
     154      INTEGER ::  ios                 ! Local integer output status for namelist read 
     155      !! 
     156      NAMELIST/namtrc_adv/ ln_trcadv_cen, nn_cen_h, nn_cen_v,               &   ! CEN 
     157         &                 ln_trcadv_fct, nn_fct_h, nn_fct_v, nn_fct_zts,   &   ! FCT 
     158         &                 ln_trcadv_mus,                     ln_mus_ups,   &   ! MUSCL 
     159         &                 ln_trcadv_ubs,           nn_ubs_v,               &   ! UBS 
     160         &                 ln_trcadv_qck                                        ! QCK 
     161      !!---------------------------------------------------------------------- 
     162      ! 
     163      REWIND( numnat_ref )              !  namtrc_adv in reference namelist  
     164      READ  ( numnat_ref, namtrc_adv, IOSTAT = ios, ERR = 901) 
     165901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_adv in reference namelist', lwp ) 
     166 
     167      REWIND( numnat_cfg )              ! namtrc_adv in configuration namelist 
     168      READ  ( numnat_cfg, namtrc_adv, IOSTAT = ios, ERR = 902 ) 
     169902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_adv in configuration namelist', lwp ) 
     170      IF(lwm) WRITE ( numont, namtrc_adv ) 
     171 
     172      IF(lwp) THEN                    ! Namelist print 
     173         WRITE(numout,*) 
     174         WRITE(numout,*) 'trc_adv_ini : choice/control of the tracer advection scheme' 
     175         WRITE(numout,*) '~~~~~~~~~~~' 
     176         WRITE(numout,*) '   Namelist namtrc_adv : chose a advection scheme for tracers' 
     177         WRITE(numout,*) '      centered scheme                           ln_trcadv_cen = ', ln_trcadv_cen 
     178         WRITE(numout,*) '            horizontal 2nd/4th order               nn_cen_h   = ', nn_fct_h 
     179         WRITE(numout,*) '            vertical   2nd/4th order               nn_cen_v   = ', nn_fct_v 
     180         WRITE(numout,*) '      Flux Corrected Transport scheme           ln_trcadv_fct = ', ln_trcadv_fct 
     181         WRITE(numout,*) '            horizontal 2nd/4th order               nn_fct_h   = ', nn_fct_h 
     182         WRITE(numout,*) '            vertical   2nd/4th order               nn_fct_v   = ', nn_fct_v 
     183         WRITE(numout,*) '            2nd order + vertical sub-timestepping  nn_fct_zts = ', nn_fct_zts 
     184         WRITE(numout,*) '      MUSCL scheme                              ln_trcadv_mus = ', ln_trcadv_mus 
     185         WRITE(numout,*) '            + upstream scheme near river mouths    ln_mus_ups = ', ln_mus_ups 
     186         WRITE(numout,*) '      UBS scheme                                ln_trcadv_ubs = ', ln_trcadv_ubs 
     187         WRITE(numout,*) '            vertical   2nd/4th order               nn_ubs_v   = ', nn_ubs_v 
     188         WRITE(numout,*) '      QUICKEST scheme                           ln_trcadv_qck = ', ln_trcadv_qck 
     189      ENDIF 
     190      ! 
     191 
     192      ioptio = 0                       !==  Parameter control  ==! 
     193      IF( ln_trcadv_cen )   ioptio = ioptio + 1 
     194      IF( ln_trcadv_fct )   ioptio = ioptio + 1 
     195      IF( ln_trcadv_mus )   ioptio = ioptio + 1 
     196      IF( ln_trcadv_ubs )   ioptio = ioptio + 1 
     197      IF( ln_trcadv_qck )   ioptio = ioptio + 1 
     198 
     199      ! 
     200      IF( ioptio == 0 ) THEN 
     201         nadv = np_NO_adv 
     202         CALL ctl_warn( 'trc_adv_init: You are running without tracer advection.' ) 
     203      ENDIF 
    180204      IF( ioptio /= 1 )   CALL ctl_stop( 'Choose ONE advection scheme in namelist namtrc_adv' ) 
    181  
    182       !                              ! Set nadv 
    183       IF( ln_trcadv_cen2   )   nadv =  1 
    184       IF( ln_trcadv_tvd    )   nadv =  2 
    185       IF( ln_trcadv_muscl  )   nadv =  3 
    186       IF( ln_trcadv_muscl2 )   nadv =  4 
    187       IF( ln_trcadv_ubs    )   nadv =  5 
    188       IF( ln_trcadv_qck    )   nadv =  6 
    189       IF( lk_esopa         )   nadv = -1 
    190  
     205      ! 
     206      IF( ln_trcadv_cen .AND. ( nn_cen_h /= 2 .AND. nn_cen_h /= 4 )   & 
     207                        .AND. ( nn_cen_v /= 2 .AND. nn_cen_v /= 4 )   ) THEN 
     208        CALL ctl_stop( 'trc_adv_init: CEN scheme, choose 2nd or 4th order' ) 
     209      ENDIF 
     210      IF( ln_trcadv_fct .AND. ( nn_fct_h /= 2 .AND. nn_fct_h /= 4 )   & 
     211                        .AND. ( nn_fct_v /= 2 .AND. nn_fct_v /= 4 )   ) THEN 
     212        CALL ctl_stop( 'trc_adv_init: FCT scheme, choose 2nd or 4th order' ) 
     213      ENDIF 
     214      IF( ln_trcadv_fct .AND. nn_fct_zts > 0 ) THEN 
     215         IF( nn_fct_h == 4 ) THEN 
     216            nn_fct_h = 2 
     217            CALL ctl_stop( 'trc_adv_init: force 2nd order FCT scheme, 4th order does not exist with sub-timestepping' ) 
     218         ENDIF 
     219         IF( .NOT.ln_linssh ) THEN 
     220            CALL ctl_stop( 'trc_adv_init: vertical sub-timestepping not allow in non-linear free surface' ) 
     221         ENDIF 
     222         IF( nn_fct_zts == 1 )   CALL ctl_warn( 'trc_adv_init: FCT with ONE sub-timestep = FCT without sub-timestep' ) 
     223      ENDIF 
     224      IF( ln_trcadv_ubs .AND. ( nn_ubs_v /= 2 .AND. nn_ubs_v /= 4 )   ) THEN 
     225        CALL ctl_stop( 'trc_adv_init: UBS scheme, choose 2nd or 4th order' ) 
     226      ENDIF 
     227      IF( ln_trcadv_ubs .AND. nn_ubs_v == 4 ) THEN 
     228         CALL ctl_warn( 'trc_adv_init: UBS scheme, only 2nd FCT scheme available on the vertical. It will be used' ) 
     229      ENDIF 
     230      IF( ln_isfcav ) THEN                                                       ! ice-shelf cavities 
     231         IF(  ln_trcadv_cen .AND. nn_cen_v /= 4    .OR.   &                            ! NO 4th order with ISF 
     232            & ln_trcadv_fct .AND. nn_fct_v /= 4   )   CALL ctl_stop( 'tra_adv_init: 4th order COMPACT scheme not allowed with ISF' ) 
     233      ENDIF 
     234      ! 
     235      !                                !==  used advection scheme  ==! 
     236      !                                      ! set nadv 
     237      IF( ln_trcadv_cen                      )   nadv = np_CEN 
     238      IF( ln_trcadv_fct                      )   nadv = np_FCT 
     239      IF( ln_trcadv_fct .AND. nn_fct_zts > 0 )   nadv = np_FCT_zts 
     240      IF( ln_trcadv_mus                      )   nadv = np_MUS 
     241      IF( ln_trcadv_ubs                      )   nadv = np_UBS 
     242      IF( ln_trcadv_qck                      )   nadv = np_QCK 
     243      ! 
    191244      IF(lwp) THEN                   ! Print the choice 
    192245         WRITE(numout,*) 
    193          IF( nadv ==  1 )   WRITE(numout,*) '         2nd order scheme is used' 
    194          IF( nadv ==  2 )   WRITE(numout,*) '         TVD       scheme is used' 
    195          IF( nadv ==  3 )   WRITE(numout,*) '         MUSCL     scheme is used' 
    196          IF( nadv ==  4 )   WRITE(numout,*) '         MUSCL2    scheme is used' 
    197          IF( nadv ==  5 )   WRITE(numout,*) '         UBS       scheme is used' 
    198          IF( nadv ==  6 )   WRITE(numout,*) '         QUICKEST  scheme is used' 
    199          IF( nadv == -1 )   WRITE(numout,*) '         esopa test: use all advection scheme' 
    200       ENDIF 
    201       ! 
    202    END SUBROUTINE trc_adv_ctl 
     246         IF( nadv == np_NO_adv  )   WRITE(numout,*) '         NO passive tracer advection' 
     247         IF( nadv == np_CEN     )   WRITE(numout,*) '         CEN      scheme is used. Horizontal order: ', nn_cen_h,   & 
     248            &                                                                        ' Vertical   order: ', nn_cen_v 
     249         IF( nadv == np_FCT     )   WRITE(numout,*) '         FCT      scheme is used. Horizontal order: ', nn_fct_h,   & 
     250            &                                                                       ' Vertical   order: ', nn_fct_v 
     251         IF( nadv == np_FCT_zts )   WRITE(numout,*) '         use 2nd order FCT with ', nn_fct_zts,'vertical sub-timestepping' 
     252         IF( nadv == np_MUS     )   WRITE(numout,*) '         MUSCL    scheme is used' 
     253         IF( nadv == np_UBS     )   WRITE(numout,*) '         UBS      scheme is used' 
     254         IF( nadv == np_QCK     )   WRITE(numout,*) '         QUICKEST scheme is used' 
     255      ENDIF 
     256      ! 
     257   END SUBROUTINE trc_adv_ini 
    203258    
    204259#else 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcbbl.F90

    r4513 r6225  
    2222   USE oce_trc             ! ocean dynamics and active tracers variables 
    2323   USE trc                 ! ocean passive tracers variables 
    24    USE trcnam_trp      ! passive tracers transport namelist variables 
    2524   USE trabbl              !  
    2625   USE prtctl_trc          ! Print control for debbuging 
    27    USE trdmod_oce 
     26   USE trd_oce 
    2827   USE trdtra 
    2928 
    3029   PUBLIC   trc_bbl       !  routine called by step.F90 
    3130 
    32  
    33    !! * Substitutions 
    34 #  include "top_substitute.h90" 
    3531   !!---------------------------------------------------------------------- 
    3632   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    9389        DO jn = 1, jptra 
    9490           ztrtrd(:,:,:,jn) = tra(:,:,:,jn) - ztrtrd(:,:,:,jn) 
    95            CALL trd_tra( kt, 'TRC', jn, jptra_trd_bbl, ztrtrd(:,:,:,jn) ) 
     91           CALL trd_tra( kt, 'TRC', jn, jptra_bbl, ztrtrd(:,:,:,jn) ) 
    9692        END DO 
    9793        CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) ! temporary save of trends 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90

    r4359 r6225  
    1818   USE oce_trc         ! ocean dynamics and tracers variables 
    1919   USE trc             ! ocean passive tracers variables 
    20    USE trcnam_trp      ! passive tracers transport namelist variables 
    2120   USE trcdta 
    2221   USE tradmp 
    2322   USE prtctl_trc      ! Print control for debbuging 
    2423   USE trdtra 
    25    USE trdmod_oce 
     24   USE trd_oce 
     25   USE iom 
    2626 
    2727   IMPLICIT NONE 
    2828   PRIVATE 
    2929 
    30    PUBLIC trc_dmp            ! routine called by step.F90 
    31    PUBLIC trc_dmp_clo        ! routine called by step.F90 
    32    PUBLIC trc_dmp_alloc      ! routine called by nemogcm.F90 
     30   PUBLIC trc_dmp       
     31   PUBLIC trc_dmp_clo    
     32   PUBLIC trc_dmp_alloc   
     33   PUBLIC trc_dmp_ini     
     34 
     35   INTEGER , PUBLIC ::   nn_zdmp_tr    ! = 0/1/2 flag for damping in the mixed layer 
     36   CHARACTER(LEN=200) , PUBLIC :: cn_resto_tr    !File containing restoration coefficient 
    3337 
    3438   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   restotr   ! restoring coeff. on tracers (s-1) 
     
    3943 
    4044   !! * Substitutions 
    41 #  include "top_substitute.h90" 
     45#  include "vectopt_loop_substitute.h90" 
    4246   !!---------------------------------------------------------------------- 
    4347   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    44    !! $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/TRP/trcdmp.F90,v 1.11 2006/09/01 14:03:49 opalod Exp $  
     48   !! $Id$  
    4549   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    4650   !!---------------------------------------------------------------------- 
     
    7579      !! ** Action  : - update the tracer trends tra with the newtonian  
    7680      !!                damping trends. 
    77       !!              - save the trends ('key_trdmld_trc') 
    78       !!---------------------------------------------------------------------- 
    79       !! 
    80       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index 
    81       !! 
    82       INTEGER  ::   ji, jj, jk, jn, jl       ! dummy loop indices 
    83       REAL(wp) ::   ztra                 ! temporary scalars 
    84       CHARACTER (len=22) :: charout 
     81      !!              - save the trends ('key_trdmxl_trc') 
     82      !!---------------------------------------------------------------------- 
     83      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
     84      ! 
     85      INTEGER ::   ji, jj, jk, jn, jl   ! dummy loop indices 
     86      CHARACTER (len=22) ::   charout 
    8587      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrtrd 
    86       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 3D  workspace 
     88      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrcdta   ! 3D  workspace 
    8789      !!---------------------------------------------------------------------- 
    8890      ! 
    8991      IF( nn_timing == 1 )  CALL timing_start('trc_dmp') 
    9092      ! 
    91       ! 0. Initialization (first time-step only) 
    92       !    -------------- 
    93       IF( kt == nittrc000 ) CALL trc_dmp_init 
    94  
    9593      IF( l_trdtrc )   CALL wrk_alloc( jpi, jpj, jpk, ztrtrd )   ! temporary save of trends 
    9694      ! 
     
    104102            ! 
    105103            IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file 
    106                 
     104               ! 
    107105               jl = n_trc_index(jn)  
    108106               CALL trc_dta( kt, sf_trcdta(jl),rf_trfac(jl) )   ! read tracer data at nit000 
    109107               ztrcdta(:,:,:) = sf_trcdta(jl)%fnow(:,:,:) 
    110  
     108               ! 
    111109               SELECT CASE ( nn_zdmp_tr ) 
    112110               ! 
     
    115113                     DO jj = 2, jpjm1 
    116114                        DO ji = fs_2, fs_jpim1   ! vector opt. 
    117                            ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 
    118                            tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra 
     115                           tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 
    119116                        END DO 
    120117                     END DO 
    121118                  END DO 
    122                ! 
     119                  ! 
    123120               CASE ( 1 )                !==  no damping in the turbocline (avt > 5 cm2/s)  ==! 
    124121                  DO jk = 1, jpkm1 
    125122                     DO jj = 2, jpjm1 
    126123                        DO ji = fs_2, fs_jpim1   ! vector opt. 
    127                            IF( avt(ji,jj,jk) <= 5.e-4 )  THEN  
    128                               ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 
    129                               tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra 
     124                           IF( avt(ji,jj,jk) <= 5.e-4_wp )  THEN  
     125                              tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 
    130126                           ENDIF 
    131127                        END DO 
    132128                     END DO 
    133129                  END DO 
    134                ! 
     130                  ! 
    135131               CASE ( 2 )               !==  no damping in the mixed layer   ==!  
    136132                  DO jk = 1, jpkm1 
    137133                     DO jj = 2, jpjm1 
    138134                        DO ji = fs_2, fs_jpim1   ! vector opt. 
    139                            IF( fsdept(ji,jj,jk) >= hmlp (ji,jj) ) THEN 
    140                               ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 
    141                               tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra 
     135                           IF( gdept_n(ji,jj,jk) >= hmlp (ji,jj) ) THEN 
     136                              tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 
    142137                           END IF 
    143138                        END DO 
    144139                     END DO 
    145140                  END DO 
    146                 
     141                   
    147142               END SELECT 
    148143               !  
     
    151146            IF( l_trdtrc ) THEN 
    152147               ztrtrd(:,:,:) = tra(:,:,:,jn) -  ztrtrd(:,:,:) 
    153                CALL trd_tra( kt, 'TRC', jn, jptra_trd_dmp, ztrtrd ) 
     148               CALL trd_tra( kt, 'TRC', jn, jptra_dmp, ztrtrd ) 
    154149            END IF 
    155150            !                                                       ! =========== 
     
    161156      IF( l_trdtrc )  CALL wrk_dealloc( jpi, jpj, jpk, ztrtrd ) 
    162157      !                                          ! print mean trends (used for debugging) 
    163       IF( ln_ctl )   THEN 
    164          WRITE(charout, FMT="('dmp ')") ;  CALL prt_ctl_trc_info(charout) 
    165                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
     158      IF( ln_ctl ) THEN 
     159         WRITE(charout, FMT="('dmp ')") 
     160         CALL prt_ctl_trc_info(charout) 
     161         CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    166162      ENDIF 
    167163      ! 
     
    169165      ! 
    170166   END SUBROUTINE trc_dmp 
     167 
     168 
     169   SUBROUTINE trc_dmp_ini 
     170      !!---------------------------------------------------------------------- 
     171      !!                  ***  ROUTINE trc_dmp_ini  *** 
     172      !!  
     173      !! ** Purpose :   Initialization for the newtonian damping  
     174      !! 
     175      !! ** Method  :   read the nammbf namelist and check the parameters 
     176      !!              called by trc_dmp at the first timestep (nittrc000) 
     177      !!---------------------------------------------------------------------- 
     178      INTEGER ::   ios, imask  ! local integers 
     179      !! 
     180      NAMELIST/namtrc_dmp/ nn_zdmp_tr , cn_resto_tr 
     181      !!---------------------------------------------------------------------- 
     182      ! 
     183      IF( nn_timing == 1 )  CALL timing_start('trc_dmp_init') 
     184      ! 
     185      REWIND( numnat_ref )              ! Namelist namtrc_dmp in reference namelist : Passive tracers newtonian damping 
     186      READ  ( numnat_ref, namtrc_dmp, IOSTAT = ios, ERR = 909) 
     187909   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dmp in reference namelist', lwp ) 
     188 
     189      REWIND( numnat_cfg )              ! Namelist namtrc_dmp in configuration namelist : Passive tracers newtonian damping 
     190      READ  ( numnat_cfg, namtrc_dmp, IOSTAT = ios, ERR = 910) 
     191910   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dmp in configuration namelist', lwp ) 
     192      IF(lwm) WRITE ( numont, namtrc_dmp ) 
     193 
     194      IF(lwp) THEN                       ! Namelist print 
     195         WRITE(numout,*) 
     196         WRITE(numout,*) 'trc_dmp : Passive tracers newtonian damping' 
     197         WRITE(numout,*) '~~~~~~~' 
     198         WRITE(numout,*) '   Namelist namtrc_dmp : set damping parameter' 
     199         WRITE(numout,*) '      mixed layer damping option     nn_zdmp_tr = ', nn_zdmp_tr, '(zoom: forced to 0)' 
     200         WRITE(numout,*) '      Restoration coeff file    cn_resto_tr = ', cn_resto_tr 
     201      ENDIF 
     202      ! 
     203      IF( lzoom .AND. .NOT.lk_c1d )   nn_zdmp_tr = 0           ! restoring to climatology at closed north or south boundaries 
     204      SELECT CASE ( nn_zdmp_tr ) 
     205      CASE ( 0 )   ;   IF(lwp) WRITE(numout,*) '   tracer damping throughout the water column' 
     206      CASE ( 1 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the turbocline (avt > 5 cm2/s)' 
     207      CASE ( 2 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the mixed layer' 
     208      CASE DEFAULT 
     209         WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr 
     210         CALL ctl_stop(ctmp1) 
     211      END SELECT 
     212 
     213      IF( .NOT.lk_c1d ) THEN 
     214         IF( .NOT. ln_tradmp )   & 
     215            &   CALL ctl_stop( 'passive trace damping need ln_tradmp to compute damping coef.' ) 
     216         ! 
     217         !                          ! Read damping coefficients from file 
     218         !Read in mask from file 
     219         CALL iom_open ( cn_resto_tr, imask) 
     220         CALL iom_get  ( imask, jpdom_autoglo, 'resto', restotr) 
     221         CALL iom_close( imask ) 
     222         ! 
     223      ENDIF 
     224      IF( nn_timing == 1 )  CALL timing_stop('trc_dmp_init') 
     225      ! 
     226   END SUBROUTINE trc_dmp_ini 
     227 
    171228 
    172229   SUBROUTINE trc_dmp_clo( kt ) 
     
    182239      !!                nctsi2(), nctsj2() : north-east Closed sea limits (i,j) 
    183240      !!---------------------------------------------------------------------- 
    184       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index 
    185       ! 
    186       INTEGER :: ji, jj, jk, jn, jl, jc                     ! dummy loop indicesa 
    187       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta       ! 3D  workspace 
    188  
    189       !!---------------------------------------------------------------------- 
    190  
     241      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     242      ! 
     243      INTEGER ::   ji , jj, jk, jn, jl, jc   ! dummy loop indicesa 
     244      INTEGER ::   isrow                     ! local index 
     245      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrcdta   ! 3D  workspace 
     246      !!---------------------------------------------------------------------- 
     247      ! 
    191248      IF( kt == nit000 ) THEN 
    192249         ! initial values 
     
    200257            ! 
    201258            SELECT CASE ( jp_cfg ) 
     259            !                                           ! ======================= 
     260            CASE ( 1 )                                  ! eORCA_R1 configuration 
     261            !                                           ! ======================= 
     262            isrow = 332 - jpjglo 
     263            ! 
     264                                                        ! Caspian Sea 
     265            nctsi1(1)   = 332  ; nctsj1(1)   = 243 - isrow 
     266            nctsi2(1)   = 344  ; nctsj2(1)   = 275 - isrow 
     267            !                                         
    202268            !                                           ! ======================= 
    203269            CASE ( 2 )                                  !  ORCA_R2 configuration 
     
    291357   END SUBROUTINE trc_dmp_clo 
    292358 
    293  
    294    SUBROUTINE trc_dmp_init 
    295       !!---------------------------------------------------------------------- 
    296       !!                  ***  ROUTINE trc_dmp_init  *** 
    297       !!  
    298       !! ** Purpose :   Initialization for the newtonian damping  
    299       !! 
    300       !! ** Method  :   read the nammbf namelist and check the parameters 
    301       !!              called by trc_dmp at the first timestep (nittrc000) 
    302       !!---------------------------------------------------------------------- 
    303       ! 
    304       IF( nn_timing == 1 )  CALL timing_start('trc_dmp_init') 
    305       ! 
    306       SELECT CASE ( nn_hdmp_tr ) 
    307       CASE (  -1  )   ;   IF(lwp) WRITE(numout,*) '   tracer damping in the Med & Red seas only' 
    308       CASE ( 1:90 )   ;   IF(lwp) WRITE(numout,*) '   tracer damping poleward of', nn_hdmp_tr, ' degrees' 
    309       CASE DEFAULT 
    310          WRITE(ctmp1,*) '          bad flag value for nn_hdmp_tr = ', nn_hdmp_tr 
    311          CALL ctl_stop(ctmp1) 
    312       END SELECT 
    313  
    314       IF( lzoom )   nn_zdmp_tr = 0           ! restoring to climatology at closed north or south boundaries 
    315       SELECT CASE ( nn_zdmp_tr ) 
    316       CASE ( 0 )   ;   IF(lwp) WRITE(numout,*) '   tracer damping throughout the water column' 
    317       CASE ( 1 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the turbocline (avt > 5 cm2/s)' 
    318       CASE ( 2 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the mixed layer' 
    319       CASE DEFAULT 
    320          WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr 
    321          CALL ctl_stop(ctmp1) 
    322       END SELECT 
    323  
    324       IF( .NOT. ln_tradmp )   & 
    325          &   CALL ctl_stop( 'passive trace damping need key_tradmp to compute damping coef.' ) 
    326       ! 
    327       !                          ! Damping coefficients initialization 
    328       IF( lzoom ) THEN   ;   CALL dtacof_zoom( restotr ) 
    329       ELSE               ;   CALL dtacof( nn_hdmp_tr, rn_surf_tr, rn_bot_tr, rn_dep_tr,  & 
    330                              &            nn_file_tr, 'TRC'     , restotr                ) 
    331       ENDIF 
    332       ! 
    333       IF( nn_timing == 1 )  CALL timing_stop('trc_dmp_init') 
    334       ! 
    335    END SUBROUTINE trc_dmp_init 
    336  
    337359#else 
    338360   !!---------------------------------------------------------------------- 
     
    346368#endif 
    347369 
    348  
    349370   !!====================================================================== 
    350371END MODULE trcdmp 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90

    r3294 r6225  
    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 
     8   !!            3.7  ! 2014-03  (G. Madec)  LDF simplification 
    89   !!---------------------------------------------------------------------- 
    910#if defined key_top 
     
    1112   !!   'key_top'                                                TOP models 
    1213   !!---------------------------------------------------------------------- 
    13    !!---------------------------------------------------------------------- 
    14    !!   trc_ldf     : update the tracer trend with the lateral diffusion 
    15    !!       ldf_ctl : initialization, namelist read, and parameters control 
    16    !!---------------------------------------------------------------------- 
    17    USE oce_trc         ! ocean dynamics and active tracers 
    18    USE trc             ! ocean passive tracers variables 
    19    USE trcnam_trp      ! passive tracers transport namelist variables 
    20    USE ldftra_oce      ! lateral diffusion coefficient on tracers 
    21    USE ldfslp          ! ??? 
    22    USE traldf_bilapg   ! lateral mixing            (tra_ldf_bilapg routine) 
    23    USE traldf_bilap    ! lateral mixing            (tra_ldf_bilap routine) 
    24    USE traldf_iso      ! lateral mixing            (tra_ldf_iso routine) 
    25    USE traldf_iso_grif ! lateral mixing          (tra_ldf_iso_grif routine) 
    26    USE traldf_lap      ! lateral mixing            (tra_ldf_lap routine) 
    27    USE trdmod_oce 
    28    USE trdtra 
    29    USE prtctl_trc      ! Print control 
     14   !!   trc_ldf       : update the tracer trend with the lateral diffusion 
     15   !!   trc_ldf_ini   : initialization, namelist read, and parameters control 
     16   !!---------------------------------------------------------------------- 
     17   USE trc            ! ocean passive tracers variables 
     18   USE oce_trc        ! ocean dynamics and active tracers 
     19   USE ldfslp         ! lateral diffusion: iso-neutral slope 
     20   USE traldf_lap_blp ! lateral diffusion: lap/bilaplacian iso-level      operator  (tra_ldf_lap/_blp   routine) 
     21   USE traldf_iso     ! lateral diffusion: laplacian iso-neutral standard operator  (tra_ldf_iso        routine) 
     22   USE traldf_triad   ! lateral diffusion: laplacian iso-neutral triad    operator  (tra_ldf_     triad routine) 
     23   USE trd_oce        ! trends: ocean variables 
     24   USE trdtra         ! trends manager: tracers 
     25   ! 
     26   USE prtctl_trc     ! Print control 
    3027 
    3128   IMPLICIT NONE 
    3229   PRIVATE 
    3330 
    34    PUBLIC   trc_ldf    ! called by step.F90 
    35    !                                                 !!: ** lateral mixing namelist (nam_trcldf) ** 
    36    REAL(wp) ::  rldf_rat    ! ratio between active and passive tracers diffusive coefficient 
     31   PUBLIC   trc_ldf     
     32   PUBLIC   trc_ldf_ini    
     33   ! 
     34   LOGICAL , PUBLIC ::   ln_trcldf_lap       !:   laplacian operator 
     35   LOGICAL , PUBLIC ::   ln_trcldf_blp       !: bilaplacian operator 
     36   LOGICAL , PUBLIC ::   ln_trcldf_lev       !: iso-level   direction 
     37   LOGICAL , PUBLIC ::   ln_trcldf_hor       !: horizontal  direction (rotation to geopotential) 
     38   LOGICAL , PUBLIC ::   ln_trcldf_iso       !: iso-neutral direction (standard) 
     39   LOGICAL , PUBLIC ::   ln_trcldf_triad     !: iso-neutral direction (triad) 
     40   REAL(wp), PUBLIC ::   rn_ahtrc_0          !:   laplacian diffusivity coefficient for passive tracer [m2/s] 
     41   REAL(wp), PUBLIC ::   rn_bhtrc_0          !: bilaplacian      -          --     -       -   [m4/s] 
     42   ! 
     43   !                      !!: ** lateral mixing namelist (nam_trcldf) ** 
     44   REAL(wp) ::  rldf       ! ratio between active and passive tracers diffusive coefficient 
     45    
    3746   INTEGER  ::  nldf = 0   ! type of lateral diffusion used defined from ln_trcldf_... namlist logicals) 
     47    
    3848   !! * Substitutions 
    39 #  include "domzgr_substitute.h90" 
    4049#  include "vectopt_loop_substitute.h90" 
    4150   !!---------------------------------------------------------------------- 
    42    !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     51   !! NEMO/TOP 3.7 , NEMO Consortium (2014) 
    4352   !! $Id$ 
    4453   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4554   !!---------------------------------------------------------------------- 
    46  
    4755CONTAINS 
    4856 
     
    5563      !!---------------------------------------------------------------------- 
    5664      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
    57       !! 
     65      ! 
    5866      INTEGER            :: jn 
    5967      CHARACTER (len=22) :: charout 
     68      REAL(wp), POINTER, DIMENSION(:,:,:)   ::   zahu, zahv 
    6069      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::   ztrtrd 
    6170      !!---------------------------------------------------------------------- 
     
    6372      IF( nn_timing == 1 )   CALL timing_start('trc_ldf') 
    6473      ! 
    65       IF( kt == nittrc000 )   CALL ldf_ctl          ! initialisation & control of options 
    66  
    67       rldf = rldf_rat 
    68  
    6974      IF( l_trdtrc )  THEN 
    70          CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrtrd ) 
     75         CALL wrk_alloc( jpi,jpj,jpk,jptra,  ztrtrd ) 
    7176         ztrtrd(:,:,:,:)  = tra(:,:,:,:) 
    7277      ENDIF 
    73  
    74       SELECT CASE ( nldf )                       ! compute lateral mixing trend and add it to the general trend 
    75       CASE ( 0 )   ;   CALL tra_ldf_lap   ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra            )  ! iso-level laplacian 
    76       CASE ( 1 )                                                                                            ! rotated laplacian 
    77                        IF( ln_traldf_grif ) THEN 
    78                           CALL tra_ldf_iso_grif( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) 
    79                        ELSE 
    80                           CALL tra_ldf_iso     ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) 
    81                        ENDIF 
    82       CASE ( 2 )   ;   CALL tra_ldf_bilap ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra            )  ! iso-level bilaplacian 
    83       CASE ( 3 )   ;   CALL tra_ldf_bilapg( kt, nittrc000, 'TRC',             trb, tra, jptra            )  ! s-coord. horizontal bilaplacian 
    84          ! 
    85       CASE ( -1 )                                     ! esopa: test all possibility with control print 
    86          CALL tra_ldf_lap   ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra            ) 
    87          WRITE(charout, FMT="('ldf0 ')") ;  CALL prt_ctl_trc_info(charout) 
    88                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    89          IF( ln_traldf_grif ) THEN 
    90             CALL tra_ldf_iso_grif( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) 
    91          ELSE 
    92             CALL tra_ldf_iso     ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) 
    93          ENDIF 
    94          WRITE(charout, FMT="('ldf1 ')") ;  CALL prt_ctl_trc_info(charout) 
    95                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    96          CALL tra_ldf_bilap ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra            ) 
    97          WRITE(charout, FMT="('ldf2 ')") ;  CALL prt_ctl_trc_info(charout) 
    98                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    99          CALL tra_ldf_bilapg( kt, nittrc000, 'TRC',             trb, tra, jptra            ) 
    100          WRITE(charout, FMT="('ldf3 ')") ;  CALL prt_ctl_trc_info(charout) 
    101                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
     78      ! 
     79      !                                        !* set the lateral diffusivity coef. for passive tracer       
     80      CALL wrk_alloc( jpi,jpj,jpk,   zahu, zahv ) 
     81      zahu(:,:,:) = rldf * ahtu(:,:,:) 
     82      zahv(:,:,:) = rldf * ahtv(:,:,:) 
     83 
     84      SELECT CASE ( nldf )                     !* compute lateral mixing trend and add it to the general trend 
     85      ! 
     86      CASE ( np_lap   )                               ! iso-level laplacian 
     87         CALL tra_ldf_lap  ( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb,      tra, jptra,  1   ) 
     88         ! 
     89      CASE ( np_lap_i )                               ! laplacian : standard iso-neutral operator (Madec) 
     90         CALL tra_ldf_iso  ( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb, trb, tra, jptra,  1   ) 
     91         ! 
     92      CASE ( np_lap_it )                              ! laplacian : triad iso-neutral operator (griffies) 
     93         CALL tra_ldf_triad( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb, trb, tra, jptra,  1   ) 
     94         ! 
     95      CASE ( np_blp , np_blp_i , np_blp_it )          ! bilaplacian: all operator (iso-level, -neutral) 
     96         CALL tra_ldf_blp  ( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb     , tra, jptra, nldf ) 
     97         ! 
    10298      END SELECT 
    10399      ! 
    104       IF( l_trdtrc )   THEN                      ! save the horizontal diffusive trends for further diagnostics 
     100      IF( l_trdtrc )   THEN                    ! send the trends for further diagnostics 
    105101        DO jn = 1, jptra 
    106102           ztrtrd(:,:,:,jn) = tra(:,:,:,jn) - ztrtrd(:,:,:,jn) 
    107            CALL trd_tra( kt, 'TRC', jn, jptra_trd_ldf, ztrtrd(:,:,:,jn) ) 
     103           CALL trd_tra( kt, 'TRC', jn, jptra_ldf, ztrtrd(:,:,:,jn) ) 
    108104        END DO 
    109105        CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) 
    110106      ENDIF 
    111       !                                          ! print mean trends (used for debugging) 
    112       IF( ln_ctl )   THEN 
    113          WRITE(charout, FMT="('ldf ')") ;  CALL prt_ctl_trc_info(charout) 
    114                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    115       ENDIF 
     107      !                 
     108      IF( ln_ctl ) THEN                        ! print mean trends (used for debugging) 
     109         WRITE(charout, FMT="('ldf ')") 
     110         CALL prt_ctl_trc_info(charout) 
     111         CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
     112      ENDIF 
     113      ! 
     114      CALL wrk_dealloc( jpi,jpj,jpk,   zahu, zahv ) 
    116115      ! 
    117116      IF( nn_timing == 1 )   CALL timing_stop('trc_ldf') 
     
    120119 
    121120 
    122    SUBROUTINE ldf_ctl 
     121   SUBROUTINE trc_ldf_ini 
    123122      !!---------------------------------------------------------------------- 
    124123      !!                  ***  ROUTINE ldf_ctl  *** 
    125124      !! 
    126       !! ** Purpose :   Choice of the operator for the lateral tracer diffusion 
     125      !! ** Purpose :   Define the operator for the lateral diffusion 
    127126      !! 
    128127      !! ** Method  :   set nldf from the namtra_ldf logicals 
    129       !!      nldf == -2   No lateral diffusion 
    130       !!      nldf == -1   ESOPA test: ALL operators are used 
    131128      !!      nldf ==  0   laplacian operator 
    132129      !!      nldf ==  1   Rotated laplacian operator 
     
    134131      !!      nldf ==  3   Rotated bilaplacian 
    135132      !!---------------------------------------------------------------------- 
    136       INTEGER ::   ioptio, ierr         ! temporary integers 
    137       !!---------------------------------------------------------------------- 
    138  
    139       IF (ABS(rn_aht_0) < 2._wp*TINY(1.e0)) THEN 
    140          IF (ABS(rn_ahtrc_0) < 2._wp*TINY(1.e0)) THEN 
    141             rldf_rat = 1.0_wp 
    142          ELSE 
    143             CALL ctl_stop( 'STOP', 'ldf_ctl : cannot define rldf_rat, rn_aht_0==0, rn_ahtrc_0 /=0' ) 
    144          END IF 
    145       ELSE 
    146          rldf_rat = rn_ahtrc_0 / rn_aht_0 
    147       END IF 
    148       !  Define the lateral mixing oparator for tracers 
    149       ! =============================================== 
    150  
    151       !                               ! control the input 
     133      INTEGER ::   ioptio, ierr   ! temporary integers 
     134      INTEGER ::   ios            ! Local integer output status for namelist read 
     135      !! 
     136      NAMELIST/namtrc_ldf/ ln_trcldf_lap, ln_trcldf_blp,                                  & 
     137         &                 ln_trcldf_lev, ln_trcldf_hor, ln_trcldf_iso, ln_trcldf_triad,  & 
     138         &                 rn_ahtrc_0   , rn_bhtrc_0 
     139      !!---------------------------------------------------------------------- 
     140      ! 
     141      REWIND( numnat_ref )             !  namtrc_ldf in reference namelist  
     142      READ  ( numnat_ref, namtrc_ldf, IOSTAT = ios, ERR = 903) 
     143903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_ldf in reference namelist', lwp ) 
     144      ! 
     145      REWIND( numnat_cfg )             !  namtrc_ldf in configuration namelist  
     146      READ  ( numnat_cfg, namtrc_ldf, IOSTAT = ios, ERR = 904 ) 
     147904   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_ldf in configuration namelist', lwp ) 
     148      IF(lwm) WRITE ( numont, namtrc_ldf ) 
     149      ! 
     150      IF(lwp) THEN                     ! Namelist print 
     151         WRITE(numout,*) 
     152         WRITE(numout,*) 'trc_ldf_ini : lateral tracer diffusive operator' 
     153         WRITE(numout,*) '~~~~~~~~~~~' 
     154         WRITE(numout,*) '   Namelist namtrc_ldf : set lateral mixing parameters (type, direction, coefficients)' 
     155         WRITE(numout,*) '      operator' 
     156         WRITE(numout,*) '           laplacian                 ln_trcldf_lap   = ', ln_trcldf_lap 
     157         WRITE(numout,*) '         bilaplacian                 ln_trcldf_blp   = ', ln_trcldf_blp 
     158         WRITE(numout,*) '      direction of action' 
     159         WRITE(numout,*) '         iso-level                   ln_trcldf_lev   = ', ln_trcldf_lev 
     160         WRITE(numout,*) '         horizontal (geopotential)   ln_trcldf_hor   = ', ln_trcldf_hor 
     161         WRITE(numout,*) '         iso-neutral (standard)      ln_trcldf_iso   = ', ln_trcldf_iso 
     162         WRITE(numout,*) '         iso-neutral (triad)         ln_trcldf_triad = ', ln_trcldf_triad 
     163         WRITE(numout,*) '      diffusivity coefficient' 
     164         WRITE(numout,*) '           laplacian                 rn_ahtrc_0      = ', rn_ahtrc_0 
     165         WRITE(numout,*) '         bilaplacian                 rn_bhtrc_0      = ', rn_bhtrc_0 
     166      ENDIF 
     167      !       
     168      !                                ! control the namelist parameters 
    152169      ioptio = 0 
    153       IF( ln_trcldf_lap   )   ioptio = ioptio + 1 
    154       IF( ln_trcldf_bilap )   ioptio = ioptio + 1 
    155       IF( ioptio >  1 )   CALL ctl_stop( '          use ONE or NONE of the 2 lap/bilap operator type on tracer' ) 
    156       IF( ioptio == 0 )   nldf = -2   ! No lateral diffusion 
     170      IF( ln_trcldf_lap )   ioptio = ioptio + 1 
     171      IF( ln_trcldf_blp )   ioptio = ioptio + 1 
     172      IF( ioptio >  1   )   CALL ctl_stop( 'trc_ldf_ctl: use ONE or NONE of the 2 lap/bilap operator type on tracer' ) 
     173      IF( ioptio == 0   )   nldf = np_no_ldf   ! No lateral diffusion 
     174       
     175      IF( ln_trcldf_lap .AND. ln_trcldf_blp )   CALL ctl_stop( 'trc_ldf_ctl: bilaplacian should be used on both TRC and TRA' ) 
     176      IF( ln_trcldf_blp .AND. ln_trcldf_lap )   CALL ctl_stop( 'trc_ldf_ctl:   laplacian should be used on both TRC and TRA' ) 
     177      ! 
    157178      ioptio = 0 
    158       IF( ln_trcldf_level )   ioptio = ioptio + 1 
    159       IF( ln_trcldf_hor   )   ioptio = ioptio + 1 
    160       IF( ln_trcldf_iso   )   ioptio = ioptio + 1 
    161       IF( ioptio /= 1 )   CALL ctl_stop( '          use only ONE direction (level/hor/iso)' ) 
    162  
     179      IF( ln_trcldf_lev )   ioptio = ioptio + 1 
     180      IF( ln_trcldf_hor )   ioptio = ioptio + 1 
     181      IF( ln_trcldf_iso )   ioptio = ioptio + 1 
     182      IF( ioptio /= 1   )   CALL ctl_stop( 'trc_ldf_ctl: use only ONE direction (level/hor/iso)' ) 
     183      ! 
    163184      ! defined the type of lateral diffusion from ln_trcldf_... logicals 
    164185      ! CAUTION : nldf = 1 is used in trazdf_imp, change it carefully 
    165186      ierr = 0 
    166       IF( ln_trcldf_lap ) THEN       ! laplacian operator 
     187      IF( ln_trcldf_lap ) THEN      !==  laplacian operator  ==! 
    167188         IF ( ln_zco ) THEN                ! z-coordinate 
    168             IF ( ln_trcldf_level )   nldf = 0      ! iso-level  (no rotation) 
    169             IF ( ln_trcldf_hor   )   nldf = 0      ! horizontal (no rotation) 
    170             IF ( ln_trcldf_iso   )   nldf = 1      ! isoneutral (   rotation) 
    171          ENDIF 
    172          IF ( ln_zps ) THEN             ! z-coordinate 
    173             IF ( ln_trcldf_level )   ierr = 1      ! iso-level not allowed 
    174             IF ( ln_trcldf_hor   )   nldf = 0      ! horizontal (no rotation) 
    175             IF ( ln_trcldf_iso   )   nldf = 1      ! isoneutral (   rotation) 
    176          ENDIF 
    177          IF ( ln_sco ) THEN             ! z-coordinate 
    178             IF ( ln_trcldf_level )   nldf = 0      ! iso-level  (no rotation) 
    179             IF ( ln_trcldf_hor   )   nldf = 1      ! horizontal (   rotation) 
    180             IF ( ln_trcldf_iso   )   nldf = 1      ! isoneutral (   rotation) 
    181          ENDIF 
    182       ENDIF 
    183  
    184       IF( ln_trcldf_bilap ) THEN      ! bilaplacian operator 
     189            IF ( ln_trcldf_lev   )   nldf = np_lap     ! iso-level = horizontal (no rotation) 
     190            IF ( ln_trcldf_hor   )   nldf = np_lap     ! iso-level = horizontal (no rotation) 
     191            IF ( ln_trcldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard  (   rotation) 
     192            IF ( ln_trcldf_triad )   nldf = np_lap_it  ! iso-neutral: triad     (   rotation) 
     193         ENDIF 
     194         IF ( ln_zps ) THEN             ! z-coordinate with partial step 
     195            IF ( ln_trcldf_lev   )   ierr = 1         ! iso-level not allowed  
     196            IF ( ln_trcldf_hor   )   nldf = np_lap     ! horizontal (no rotation) 
     197            IF ( ln_trcldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard (rotation) 
     198            IF ( ln_trcldf_triad )   nldf = np_lap_it  ! iso-neutral: triad    (rotation) 
     199         ENDIF 
     200         IF ( ln_sco ) THEN             ! s-coordinate 
     201            IF ( ln_trcldf_lev   )   nldf = np_lap     ! iso-level  (no rotation) 
     202            IF ( ln_trcldf_hor   )   nldf = np_lap_it  ! horizontal (   rotation)       !!gm   a checker.... 
     203            IF ( ln_trcldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard (rotation) 
     204            IF ( ln_trcldf_triad )   nldf = np_lap_it  ! iso-neutral: triad    (rotation) 
     205         ENDIF 
     206         !                                ! diffusivity ratio: passive / active tracers  
     207         IF( ABS(rn_aht_0) < 2._wp*TINY(1._wp) ) THEN 
     208            IF( ABS(rn_ahtrc_0) < 2._wp*TINY(1._wp) ) THEN 
     209               rldf = 1.0_wp 
     210            ELSE 
     211               CALL ctl_stop( 'trc_ldf_ctl : cannot define rldf, rn_aht_0==0, rn_ahtrc_0 /=0' ) 
     212            ENDIF 
     213         ELSE 
     214            rldf = rn_ahtrc_0 / rn_aht_0 
     215         ENDIF 
     216      ENDIF 
     217      ! 
     218      IF( ln_trcldf_blp ) THEN      !==  bilaplacian operator  ==! 
    185219         IF ( ln_zco ) THEN                ! z-coordinate 
    186             IF ( ln_trcldf_level )   nldf = 2      ! iso-level  (no rotation) 
    187             IF ( ln_trcldf_hor   )   nldf = 2      ! horizontal (no rotation) 
    188             IF ( ln_trcldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
    189          ENDIF 
    190          IF ( ln_zps ) THEN             ! z-coordinate 
    191             IF ( ln_trcldf_level )   ierr = 1      ! iso-level not allowed 
    192             IF ( ln_trcldf_hor   )   nldf = 2      ! horizontal (no rotation) 
    193             IF ( ln_trcldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
    194          ENDIF 
    195          IF ( ln_sco ) THEN             ! z-coordinate 
    196             IF ( ln_trcldf_level )   nldf = 2      ! iso-level  (no rotation) 
    197             IF ( ln_trcldf_hor   )   nldf = 3      ! horizontal (   rotation) 
    198             IF ( ln_trcldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
    199          ENDIF 
    200       ENDIF 
    201  
    202       IF( ierr == 1 )   CALL ctl_stop( ' iso-level in z-coordinate - partial step, not allowed' ) 
    203       IF( ierr == 2 )   CALL ctl_stop( ' isoneutral bilaplacian operator does not exist' ) 
    204       IF( lk_traldf_eiv .AND. .NOT.ln_trcldf_iso )   & 
    205            CALL ctl_stop( '          eddy induced velocity on tracers',   & 
    206            &              ' the eddy induced velocity on tracers requires isopycnal laplacian diffusion' ) 
    207       IF( nldf == 1 .OR. nldf == 3 ) THEN      ! rotation 
    208          IF( .NOT.lk_ldfslp )   CALL ctl_stop( '          the rotation of the diffusive tensor require key_ldfslp' ) 
    209 #if defined key_offline 
    210          l_traldf_rot = .TRUE.                 ! needed for trazdf_imp 
    211 #endif 
    212       ENDIF 
    213  
    214       IF( lk_esopa ) THEN 
    215          IF(lwp) WRITE(numout,*) '          esopa control: use all lateral physics options' 
    216          nldf = -1 
    217       ENDIF 
    218  
    219       IF( .NOT. ln_trcldf_diff ) THEN 
    220          IF(lwp) WRITE(numout,*) '          No lateral diffusion on passive tracers' 
    221          nldf = -2 
    222       ENDIF 
    223  
     220            IF ( ln_trcldf_lev   )   nldf = np_blp     ! iso-level = horizontal (no rotation) 
     221            IF ( ln_trcldf_hor   )   nldf = np_blp     ! iso-level = horizontal (no rotation) 
     222            IF ( ln_trcldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard (rotation) 
     223            IF ( ln_trcldf_triad )   nldf = np_blp_it  ! iso-neutral: triad    (rotation) 
     224         ENDIF 
     225         IF ( ln_zps ) THEN             ! z-coordinate with partial step 
     226            IF ( ln_trcldf_lev   )   ierr = 1         ! iso-level not allowed  
     227            IF ( ln_trcldf_hor   )   nldf = np_blp     ! horizontal (no rotation) 
     228            IF ( ln_trcldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard (rotation) 
     229            IF ( ln_trcldf_triad )   nldf = np_blp_it  ! iso-neutral: triad    (rotation) 
     230         ENDIF 
     231         IF ( ln_sco ) THEN             ! s-coordinate 
     232            IF ( ln_trcldf_lev   )   nldf = np_blp     ! iso-level  (no rotation) 
     233            IF ( ln_trcldf_hor   )   nldf = np_blp_it  ! horizontal (   rotation)       !!gm   a checker.... 
     234            IF ( ln_trcldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard (rotation) 
     235            IF ( ln_trcldf_triad )   nldf = np_blp_it  ! iso-neutral: triad    (rotation) 
     236         ENDIF 
     237         !                                ! diffusivity ratio: passive / active tracers  
     238         IF( ABS(rn_bht_0) < 2._wp*TINY(1._wp) ) THEN 
     239            IF( ABS(rn_bhtrc_0) < 2._wp*TINY(1._wp) ) THEN 
     240               rldf = 1.0_wp 
     241            ELSE 
     242               CALL ctl_stop( 'trc_ldf_ctl : cannot define rldf, rn_aht_0==0, rn_ahtrc_0 /=0' ) 
     243            ENDIF 
     244         ELSE 
     245            rldf = SQRT(  ABS( rn_bhtrc_0 / rn_bht_0 )  ) 
     246         ENDIF 
     247      ENDIF 
     248      ! 
     249      IF( ierr == 1 )   CALL ctl_stop( 'trc_ldf_ctl: iso-level in z-partial step, not allowed' ) 
     250      IF( ln_ldfeiv .AND. .NOT.ln_trcldf_iso )   CALL ctl_stop( 'trc_ldf_ctl: eiv requires isopycnal laplacian diffusion' ) 
     251      IF( nldf == 1 .OR. nldf == 3 )   l_ldfslp = .TRUE.    ! slope of neutral surfaces required  
     252      ! 
    224253      IF(lwp) THEN 
    225254         WRITE(numout,*) 
    226          IF( nldf == -2 )   WRITE(numout,*) '          NO lateral diffusion' 
    227          IF( nldf == -1 )   WRITE(numout,*) '          ESOPA test All scheme used' 
    228          IF( nldf ==  0 )   WRITE(numout,*) '          laplacian operator' 
    229          IF( nldf ==  1 )   WRITE(numout,*) '          Rotated laplacian operator' 
    230          IF( nldf ==  2 )   WRITE(numout,*) '          bilaplacian operator' 
    231          IF( nldf ==  3 )   WRITE(numout,*) '          Rotated bilaplacian' 
    232       ENDIF 
    233  
    234       IF( ln_trcldf_bilap ) THEN 
    235          IF(lwp) WRITE(numout,*) '          biharmonic tracer diffusion' 
    236          IF( rn_ahtrc_0 > 0 .AND. .NOT. lk_esopa )   CALL ctl_stop( 'The horizontal diffusivity coef. rn_ahtrc_0 must be negative' ) 
    237       ELSE 
    238          IF(lwp) WRITE(numout,*) '          harmonic tracer diffusion (default)' 
    239          IF( rn_ahtrc_0 < 0 .AND. .NOT. lk_esopa )   CALL ctl_stop('The horizontal diffusivity coef. rn_ahtrc_0 must be positive' ) 
    240       ENDIF 
    241  
    242       ! ratio between active and passive tracers diffusive coef. 
    243       IF (ABS(rn_aht_0) < 2._wp*TINY(1.e0)) THEN 
    244          IF (ABS(rn_ahtrc_0) < 2._wp*TINY(1.e0)) THEN 
    245             rldf_rat = 1.0_wp 
    246          ELSE 
    247             CALL ctl_stop( 'STOP', 'ldf_ctl : cannot define rldf_rat, rn_aht_0==0, rn_ahtrc_0 /=0' ) 
    248          END IF 
    249       ELSE 
    250          rldf_rat = rn_ahtrc_0 / rn_aht_0 
    251       END IF 
    252       IF( rldf_rat < 0 ) THEN 
    253          IF( .NOT.lk_offline ) THEN  
    254             CALL ctl_stop( 'Choose the same type of diffusive scheme both for active & passive tracers' ) 
    255          ELSE 
    256             CALL ctl_stop( 'Change the sign of rn_aht_0 in namelist to -/+1' ) 
    257          ENDIF  
    258       ENDIF 
    259       ! 
    260    END SUBROUTINE ldf_ctl 
     255         SELECT CASE( nldf ) 
     256         CASE( np_no_ldf )   ;   WRITE(numout,*) '          NO lateral diffusion' 
     257         CASE( np_lap    )   ;   WRITE(numout,*) '          laplacian iso-level operator' 
     258         CASE( np_lap_i  )   ;   WRITE(numout,*) '          Rotated laplacian operator (standard)' 
     259         CASE( np_lap_it )   ;   WRITE(numout,*) '          Rotated laplacian operator (triad)' 
     260         CASE( np_blp    )   ;   WRITE(numout,*) '          bilaplacian iso-level operator' 
     261         CASE( np_blp_i  )   ;   WRITE(numout,*) '          Rotated bilaplacian operator (standard)' 
     262         CASE( np_blp_it )   ;   WRITE(numout,*) '          Rotated bilaplacian operator (triad)' 
     263         END SELECT 
     264      ENDIF 
     265      ! 
     266   END SUBROUTINE trc_ldf_ini 
    261267#else 
    262268   !!---------------------------------------------------------------------- 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90

    r4611 r6225  
    3030   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    3131   USE prtctl_trc      ! Print control for debbuging 
    32    USE trdmod_oce 
     32   USE trd_oce 
    3333   USE trdtra 
    3434   USE tranxt 
     35   USE trcbdy          ! BDY open boundaries 
     36   USE bdy_par, only: lk_bdy 
    3537# if defined key_agrif 
    3638   USE agrif_top_interp 
     
    4143 
    4244   PUBLIC   trc_nxt          ! routine called by step.F90 
    43    PUBLIC   trc_nxt_alloc    ! routine called by nemogcm.F90 
    4445 
    45    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) ::   r2dt 
     46   REAL(wp) ::   r2dttrc 
    4647 
    4748   !!---------------------------------------------------------------------- 
     
    5152   !!---------------------------------------------------------------------- 
    5253CONTAINS 
    53  
    54    INTEGER FUNCTION trc_nxt_alloc() 
    55       !!---------------------------------------------------------------------- 
    56       !!                   ***  ROUTINE trc_nxt_alloc  *** 
    57       !!---------------------------------------------------------------------- 
    58       ALLOCATE( r2dt(jpk), STAT=trc_nxt_alloc ) 
    59       ! 
    60       IF( trc_nxt_alloc /= 0 )   CALL ctl_warn('trc_nxt_alloc : failed to allocate array') 
    61       ! 
    62    END FUNCTION trc_nxt_alloc 
    63  
    6454 
    6555   SUBROUTINE trc_nxt( kt ) 
     
    10191         WRITE(numout,*) 'trc_nxt : time stepping on passive tracers' 
    10292      ENDIF 
    103  
    104       ! Update after tracer on domain lateral boundaries 
    105       DO jn = 1, jptra 
     93      ! 
     94#if defined key_agrif 
     95      CALL Agrif_trc                   ! AGRIF zoom boundaries 
     96#endif 
     97      DO jn = 1, jptra                 ! Update after tracer on domain lateral boundaries 
    10698         CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. )    
    10799      END DO 
    108100 
     101      IF( lk_bdy )  CALL trc_bdy( kt ) 
    109102 
    110 #if defined key_bdy 
    111 !!      CALL bdy_trc( kt )               ! BDY open boundaries 
    112 #endif 
    113 #if defined key_agrif 
    114       CALL Agrif_trc                   ! AGRIF zoom boundaries 
    115 #endif 
    116  
    117  
    118       ! set time step size (Euler/Leapfrog) 
    119       IF( neuler == 0 .AND. kt ==  nittrc000 ) THEN  ;  r2dt(:) =     rdttrc(:)   ! at nittrc000             (Euler) 
    120       ELSEIF( kt <= nittrc000 + 1 )            THEN  ;  r2dt(:) = 2.* rdttrc(:)   ! at nit000 or nit000+1 (Leapfrog) 
     103      !                                ! set time step size (Euler/Leapfrog) 
     104      IF( neuler == 0 .AND. kt ==  nittrc000 ) THEN  ;  r2dttrc =     rdttrc   ! at nittrc000             (Euler) 
     105      ELSEIF( kt <= nittrc000 + nn_dttrc )     THEN  ;  r2dttrc = 2.* rdttrc   ! at nit000 or nit000+1 (Leapfrog) 
    121106      ENDIF 
    122107 
    123       ! trends computation initialisation 
    124       IF( l_trdtrc )  THEN 
    125          CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrdt )  !* store now fields before applying the Asselin filter 
     108      IF( l_trdtrc )  THEN             ! trends: store now fields before the Asselin filter application 
     109         CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrdt ) 
    126110         ztrdt(:,:,:,:)  = trn(:,:,:,:) 
    127111      ENDIF 
    128       ! Leap-Frog + Asselin filter time stepping 
    129       IF( neuler == 0 .AND. kt == nittrc000 ) THEN        ! Euler time-stepping at first time-step 
    130          !                                                ! (only swap) 
     112      !                                ! Leap-Frog + Asselin filter time stepping 
     113      IF( neuler == 0 .AND. kt == nittrc000 ) THEN    ! Euler time-stepping at first time-step (only swap) 
    131114         DO jn = 1, jptra 
    132115            DO jk = 1, jpkm1 
     
    134117            END DO 
    135118         END DO 
    136          !                                               
    137       ELSE 
    138          ! Leap-Frog + Asselin filter time stepping 
    139          IF( lk_vvl ) THEN   ;   CALL tra_nxt_vvl( kt, nittrc000, 'TRC', trb, trn, tra, jptra )      ! variable volume level (vvl)  
    140          ELSE                ;   CALL tra_nxt_fix( kt, nittrc000, 'TRC', trb, trn, tra, jptra )      ! fixed    volume level  
     119      ELSE                                            ! Asselin filter + swap 
     120         IF( ln_linssh ) THEN   ;   CALL tra_nxt_fix( kt, nittrc000,         'TRC', trb, trn, tra, jptra )  !     linear ssh 
     121         ELSE                   ;   CALL tra_nxt_vvl( kt, nittrc000, rdttrc, 'TRC', trb, trn, tra,      & 
     122           &                                                                   sbc_trc, sbc_trc_b, jptra )  ! non-linear ssh 
    141123         ENDIF 
     124         ! 
     125         DO jn = 1, jptra 
     126            CALL lbc_lnk( trb(:,:,:,jn), 'T', 1._wp )  
     127            CALL lbc_lnk( trn(:,:,:,jn), 'T', 1._wp ) 
     128            CALL lbc_lnk( tra(:,:,:,jn), 'T', 1._wp ) 
     129         END DO 
    142130      ENDIF 
    143  
    144       ! trends computation 
    145       IF( l_trdtrc ) THEN                                      ! trends 
     131      ! 
     132      IF( l_trdtrc ) THEN              ! trends: send Asselin filter trends to trdtra manager for further diagnostics 
    146133         DO jn = 1, jptra 
    147134            DO jk = 1, jpkm1 
    148                zfact = 1.e0 / r2dt(jk)   
     135               zfact = 1._wp / r2dttrc   
    149136               ztrdt(:,:,jk,jn) = ( trb(:,:,jk,jn) - ztrdt(:,:,jk,jn) ) * zfact  
    150                CALL trd_tra( kt, 'TRC', jn, jptra_trd_atf, ztrdt ) 
     137               CALL trd_tra( kt, 'TRC', jn, jptra_atf, ztrdt ) 
    151138            END DO 
    152139         END DO 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90

    r3680 r6225  
    1515   USE oce_trc             ! ocean dynamics and tracers variables 
    1616   USE trc                 ! ocean passive tracers variables 
    17    USE trdmod_oce 
     17   USE trd_oce 
    1818   USE trdtra 
    1919   USE prtctl_trc          ! Print control for debbuging 
     
    2222   PRIVATE 
    2323 
    24    PUBLIC trc_rad         ! routine called by trcstp.F90 
    25  
    26    !! * Substitutions 
    27 #  include "top_substitute.h90" 
     24   PUBLIC trc_rad      
     25   PUBLIC trc_rad_ini   
     26 
     27   LOGICAL , PUBLIC ::   ln_trcrad           !: flag to artificially correct negative concentrations 
     28 
    2829   !!---------------------------------------------------------------------- 
    2930   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    7677      ! 
    7778   END SUBROUTINE trc_rad 
     79 
     80   SUBROUTINE trc_rad_ini 
     81      !!--------------------------------------------------------------------- 
     82      !!                  ***  ROUTINE trc _rad_ini *** 
     83      !! 
     84      !! ** Purpose : read  namelist options  
     85      !!---------------------------------------------------------------------- 
     86      INTEGER ::  ios                 ! Local integer output status for namelist read 
     87      NAMELIST/namtrc_rad/ ln_trcrad 
     88      !!---------------------------------------------------------------------- 
     89 
     90      ! 
     91      REWIND( numnat_ref )              ! namtrc_rad in reference namelist  
     92      READ  ( numnat_ref, namtrc_rad, IOSTAT = ios, ERR = 907) 
     93907   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_rad in reference namelist', lwp ) 
     94 
     95      REWIND( numnat_cfg )              ! namtrc_rad in configuration namelist  
     96      READ  ( numnat_cfg, namtrc_rad, IOSTAT = ios, ERR = 908 ) 
     97908   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_rad in configuration namelist', lwp ) 
     98      IF(lwm) WRITE ( numont, namtrc_rad ) 
     99 
     100      IF(lwp) THEN                     !   ! Control print 
     101         WRITE(numout,*) 
     102         WRITE(numout,*) '   Namelist namtrc_rad : treatment of negative concentrations' 
     103         WRITE(numout,*) '      correct artificially negative concen. or not ln_trcrad = ', ln_trcrad 
     104      ENDIF 
     105      ! 
     106   END SUBROUTINE trc_rad_ini 
    78107 
    79108   SUBROUTINE trc_rad_sms( kt, ptrb, ptrn, jp_sms0, jp_sms1, cpreserv ) 
     
    156185               ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt 
    157186               ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt  
    158                CALL trd_tra( kt, 'TRC', jn, jptra_trd_radb, ztrtrdb )       ! Asselin-like trend handling 
    159                CALL trd_tra( kt, 'TRC', jn, jptra_trd_radn, ztrtrdn )       ! standard     trend handling 
     187               CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb )       ! Asselin-like trend handling 
     188               CALL trd_tra( kt, 'TRC', jn, jptra_radn, ztrtrdn )       ! standard     trend handling 
    160189              ! 
    161190            ENDIF 
     
    187216               ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt 
    188217               ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt  
    189                CALL trd_tra( kt, 'TRC', jn, jptra_trd_radb, ztrtrdb )       ! Asselin-like trend handling 
    190                CALL trd_tra( kt, 'TRC', jn, jptra_trd_radn, ztrtrdn )       ! standard     trend handling 
     218               CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb )       ! Asselin-like trend handling 
     219               CALL trd_tra( kt, 'TRC', jn, jptra_radn, ztrtrdn )       ! standard     trend handling 
    191220              ! 
    192221            ENDIF 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90

    r3719 r6225  
    1919   USE trc             ! ocean  passive tracers variables 
    2020   USE prtctl_trc      ! Print control for debbuging 
    21    USE trdmod_oce 
     21   USE iom 
     22   USE trd_oce 
    2223   USE trdtra 
    2324 
     
    2829 
    2930   !! * Substitutions 
    30 #  include "top_substitute.h90" 
     31#  include "vectopt_loop_substitute.h90" 
    3132   !!---------------------------------------------------------------------- 
    3233   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    6061      INTEGER, INTENT( in ) ::   kt          ! ocean time-step index 
    6162      ! 
    62       INTEGER  ::   ji, jj, jn           ! dummy loop indices 
    63       REAL(wp) ::   zsrau, zse3t   ! temporary scalars 
     63      INTEGER  ::   ji, jj, jn                                     ! dummy loop indices 
     64      REAL(wp) ::   zse3t, zrtrn, zratio, zfact                    ! temporary scalars 
     65      REAL(wp) ::   zswitch, zftra, zcd, zdtra, ztfx, ztra         ! temporary scalars 
    6466      CHARACTER (len=22) :: charout 
    6567      REAL(wp), POINTER, DIMENSION(:,:  ) :: zsfx 
    6668      REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrd 
     69 
    6770      !!--------------------------------------------------------------------- 
    6871      ! 
     
    7073      ! 
    7174      ! Allocate temporary workspace 
    72                       CALL wrk_alloc( jpi, jpj,      zsfx   ) 
    73       IF( l_trdtrc )  CALL wrk_alloc( jpi, jpj, jpk, ztrtrd ) 
     75                      CALL wrk_alloc( jpi,jpj,       zsfx   ) 
     76      IF( l_trdtrc )  CALL wrk_alloc( jpi,jpj,jpk,   ztrtrd ) 
     77      ! 
     78      zrtrn = 1.e-15_wp 
     79 
     80      SELECT CASE( nn_ice_embd )         ! levitating or embedded sea-ice option 
     81         CASE( 0    )   ;   zswitch = 1  ! (0) standard levitating sea-ice : salt exchange only 
     82         CASE( 1, 2 )   ;   zswitch = 0  ! (1) levitating sea-ice: salt and volume exchange but no pressure effect                                 
     83      !                                  ! (2) embedded sea-ice : salt and volume fluxes and pressure 
     84      END SELECT 
     85 
     86      IF( ln_top_euler) THEN 
     87         r2dt =  rdttrc              ! = rdttrc (use Euler time stepping) 
     88      ELSE 
     89         IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nittrc000 
     90            r2dt = rdttrc            ! = rdttrc (restarting with Euler time stepping) 
     91         ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nittrc000 or nittrc000+1 
     92            r2dt = 2. * rdttrc       ! = 2 rdttrc (leapfrog) 
     93         ENDIF 
     94      ENDIF 
     95 
    7496 
    7597      IF( kt == nittrc000 ) THEN 
     
    7799         IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition' 
    78100         IF(lwp) WRITE(numout,*) '~~~~~~~ ' 
     101 
     102         IF( ln_rsttr .AND.    &                     ! Restart: read in restart  file 
     103            iom_varid( numrtr, 'sbc_'//TRIM(ctrcnm(1))//'_b', ldstop = .FALSE. ) > 0 ) THEN 
     104            IF(lwp) WRITE(numout,*) '          nittrc000-nn_dttrc surface tracer content forcing fields red in the restart file' 
     105            zfact = 0.5_wp 
     106            DO jn = 1, jptra 
     107               CALL iom_get( numrtr, jpdom_autoglo, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc_b(:,:,jn) )   ! before tracer content sbc 
     108            END DO 
     109         ELSE                                         ! No restart or restart not found: Euler forward time stepping 
     110           zfact = 1._wp 
     111           sbc_trc_b(:,:,:) = 0._wp 
     112         ENDIF 
     113      ELSE                                         ! Swap of forcing fields 
     114         IF( ln_top_euler ) THEN 
     115            zfact = 1._wp 
     116            sbc_trc_b(:,:,:) = 0._wp 
     117         ELSE 
     118            zfact = 0.5_wp 
     119            sbc_trc_b(:,:,:) = sbc_trc(:,:,:) 
     120         ENDIF 
     121         ! 
    79122      ENDIF 
    80123 
     
    83126      ! Coupling offline : runoff are in emp which contains E-P-R 
    84127      ! 
    85       IF( .NOT. lk_offline .AND. lk_vvl ) THEN  ! online coupling with vvl 
     128      IF( .NOT. lk_offline .AND. .NOT.ln_linssh ) THEN  ! online coupling with vvl 
    86129         zsfx(:,:) = 0._wp 
    87130      ELSE                                      ! online coupling free surface or offline with free surface 
     
    90133 
    91134      ! 0. initialization 
    92       zsrau = 1. / rau0 
    93135      DO jn = 1, jptra 
    94136         ! 
    95          IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn)  ! save trends 
    96          !                                             ! add the trend to the general tracer trend 
     137         IF( l_trdtrc )   ztrtrd(:,:,:) = tra(:,:,:,jn)  ! save trends 
     138 
     139         IF ( nn_ice_tr == -1 ) THEN  ! No tracers in sea ice (null concentration in sea ice) 
     140 
     141            DO jj = 2, jpj 
     142               DO ji = fs_2, fs_jpim1   ! vector opt. 
     143                  sbc_trc(ji,jj,jn) = zsfx(ji,jj) * r1_rau0 * trn(ji,jj,1,jn) 
     144               END DO 
     145            END DO 
     146 
     147         ELSE 
     148 
     149            DO jj = 2, jpj 
     150               DO ji = fs_2, fs_jpim1   ! vector opt. 
     151                  zse3t = 1. / e3t_n(ji,jj,1) 
     152                  ! tracer flux at the ice/ocean interface (tracer/m2/s) 
     153                  zftra = - trc_i(ji,jj,jn) * fmmflx(ji,jj) ! uptake of tracer in the sea ice 
     154                  zcd   =   trc_o(ji,jj,jn) * fmmflx(ji,jj) ! concentration dilution due to freezing-melting, 
     155                                                               ! only used in the levitating sea ice case 
     156                  ! tracer flux only       : add concentration dilution term in net tracer flux, no F-M in volume flux 
     157                  ! tracer and mass fluxes : no concentration dilution term in net tracer flux, F-M term in volume flux 
     158                  ztfx  = zftra + zswitch * zcd                ! net tracer flux (+C/D if no ice/ocean mass exchange) 
     159    
     160                  zdtra = r1_rau0 * ( ztfx + zsfx(ji,jj) * trn(ji,jj,1,jn) )  
     161                  IF ( zdtra < 0. ) THEN 
     162                     zratio = -zdtra * zse3t * r2dt / ( trn(ji,jj,1,jn) + zrtrn ) 
     163                     zdtra = MIN(1.0, zratio) * zdtra ! avoid negative concentrations to arise 
     164                  ENDIF 
     165                  sbc_trc(ji,jj,jn) =  zdtra  
     166               END DO 
     167            END DO 
     168         ENDIF 
     169         !                                       Concentration dilution effect on tracers due to evaporation & precipitation  
    97170         DO jj = 2, jpj 
    98171            DO ji = fs_2, fs_jpim1   ! vector opt. 
    99                zse3t = 1. / fse3t(ji,jj,1) 
    100                tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zsfx(ji,jj) *  zsrau * trn(ji,jj,1,jn) * zse3t 
     172               zse3t = zfact / e3t_n(ji,jj,1) 
     173               tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + ( sbc_trc_b(ji,jj,jn) + sbc_trc(ji,jj,jn) ) * zse3t 
    101174            END DO 
    102175         END DO 
    103           
     176         ! 
    104177         IF( l_trdtrc ) THEN 
    105178            ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:) 
    106             CALL trd_tra( kt, 'TRC', jn, jptra_trd_nsr, ztrtrd ) 
     179            CALL trd_tra( kt, 'TRC', jn, jptra_nsr, ztrtrd ) 
    107180         END IF 
    108181         !                                                       ! =========== 
    109182      END DO                                                     ! tracer loop 
    110183      !                                                          ! =========== 
     184 
     185      !                                           Write in the tracer restar  file 
     186      !                                          ******************************* 
     187      IF( lrst_trc ) THEN 
     188         IF(lwp) WRITE(numout,*) 
     189         IF(lwp) WRITE(numout,*) 'sbc : ocean surface tracer content forcing fields written in tracer restart file ',   & 
     190            &                    'at it= ', kt,' date= ', ndastp 
     191         IF(lwp) WRITE(numout,*) '~~~~' 
     192         DO jn = 1, jptra 
     193            CALL iom_rstput( kt, nitrst, numrtw, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc(:,:,jn) ) 
     194         END DO 
     195      ENDIF 
     196      ! 
    111197      IF( ln_ctl )   THEN 
    112198         WRITE(charout, FMT="('sbc ')") ;  CALL prt_ctl_trc_info(charout) 
    113199                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    114200      ENDIF 
    115                       CALL wrk_dealloc( jpi, jpj,      zsfx   ) 
    116       IF( l_trdtrc )  CALL wrk_dealloc( jpi, jpj, jpk, ztrtrd ) 
     201                      CALL wrk_dealloc( jpi,jpj,       zsfx   ) 
     202      IF( l_trdtrc )  CALL wrk_dealloc( jpi,jpj,jpk,  ztrtrd ) 
    117203      ! 
    118204      IF( nn_timing == 1 )  CALL timing_stop('trc_sbc') 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90

    r4148 r6225  
    1515   USE oce_trc         ! ocean dynamics and active tracers variables 
    1616   USE trc             ! ocean passive tracers variables  
    17    USE trcnam_trp      ! passive tracers transport namelist variables 
    1817   USE trabbl          ! bottom boundary layer               (trc_bbl routine) 
    1918   USE trcbbl          ! bottom boundary layer               (trc_bbl routine) 
    20    USE zdfkpp          ! KPP non-local tracer fluxes         (trc_kpp routine) 
    2119   USE trcdmp          ! internal damping                    (trc_dmp routine) 
    2220   USE trcldf          ! lateral mixing                      (trc_ldf routine) 
     
    2725   USE trcsbc          ! surface boundary condition          (trc_sbc routine) 
    2826   USE zpshde          ! partial step: hor. derivative       (zps_hde routine) 
     27   USE trcbdy          ! BDY open boundaries 
     28   USE bdy_par, only: lk_bdy 
    2929 
    3030#if defined key_agrif 
     
    3838   PUBLIC   trc_trp    ! called by trc_stp 
    3939 
    40    !! * Substitutions 
    41 #  include "top_substitute.h90" 
    4240   !!---------------------------------------------------------------------- 
    4341   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    4846CONTAINS 
    4947 
    50    SUBROUTINE trc_trp( kstp ) 
     48   SUBROUTINE trc_trp( kt ) 
    5149      !!---------------------------------------------------------------------- 
    5250      !!                     ***  ROUTINE trc_trp  *** 
     
    5755      !!              - Update the passive tracers 
    5856      !!---------------------------------------------------------------------- 
    59       INTEGER, INTENT( in ) ::  kstp  ! ocean time-step index 
     57      INTEGER, INTENT( in ) ::  kt  ! ocean time-step index 
    6058      !! --------------------------------------------------------------------- 
    6159      ! 
     
    6462      IF( .NOT. lk_c1d ) THEN 
    6563         ! 
    66                                 CALL trc_sbc( kstp )            ! surface boundary condition 
    67          IF( lk_trabbl )        CALL trc_bbl( kstp )            ! advective (and/or diffusive) bottom boundary layer scheme 
    68          IF( ln_trcdmp )        CALL trc_dmp( kstp )            ! internal damping trends 
    69          IF( ln_trcdmp_clo )    CALL trc_dmp_clo( kstp )        ! internal damping trends on closed seas only 
    70                                 CALL trc_adv( kstp )            ! horizontal & vertical advection  
    71                                 CALL trc_ldf( kstp )            ! lateral mixing 
    72          IF( .NOT. lk_offline .AND. lk_zdfkpp )    & 
    73             &                   CALL trc_kpp( kstp )            ! KPP non-local tracer fluxes 
     64                                CALL trc_sbc    ( kt )      ! surface boundary condition 
     65         IF( lk_trabbl )        CALL trc_bbl    ( kt )      ! advective (and/or diffusive) bottom boundary layer scheme 
     66         IF( ln_trcdmp )        CALL trc_dmp    ( kt )      ! internal damping trends 
     67         IF( ln_trcdmp_clo )    CALL trc_dmp_clo( kt )      ! internal damping trends on closed seas only 
     68         IF( lk_bdy )           CALL trc_bdy_dmp( kt )      ! BDY damping trends 
     69                                CALL trc_adv    ( kt )      ! horizontal & vertical advection  
     70         !                                                         ! Partial top/bottom cell: GRADh( trb )   
     71         IF( ln_zps ) THEN 
     72           IF( ln_isfcav ) THEN ; CALL zps_hde_isf( kt, jptra, trb, pgtu=gtru, pgtv=gtrv, pgtui=gtrui, pgtvi=gtrvi )  ! both top & bottom 
     73           ELSE                 ; CALL zps_hde    ( kt, jptra, trb, gtru, gtrv )                                      !  only bottom 
     74           ENDIF 
     75         ENDIF 
     76         !                                                       
     77                                CALL trc_ldf    ( kt )      ! lateral mixing 
    7478#if defined key_agrif 
    75          IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_trc           ! tracers sponge 
     79         IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_trc       ! tracers sponge 
    7680#endif 
    77                                 CALL trc_zdf( kstp )            ! vertical mixing and after tracer fields 
    78                                 CALL trc_nxt( kstp )            ! tracer fields at next time step      
    79          IF( ln_trcrad )        CALL trc_rad( kstp )            ! Correct artificial negative concentrations 
     81                                CALL trc_zdf    ( kt )      ! vertical mixing and after tracer fields 
     82                                CALL trc_nxt    ( kt )      ! tracer fields at next time step      
     83         IF( ln_trcrad )        CALL trc_rad    ( kt )      ! Correct artificial negative concentrations 
    8084 
    8185#if defined key_agrif 
    82       IF( .NOT. Agrif_Root())   CALL Agrif_Update_Trc( kstp )  ! Update tracer at AGRIF zoom boundaries : children only 
     86         IF( .NOT.Agrif_Root()) CALL Agrif_Update_Trc( kt ) ! Update tracer at AGRIF zoom boundaries : children only 
    8387#endif 
    84          IF( ln_zps    )        CALL zps_hde( kstp, jptra, trn, gtru, gtrv )  ! Partial steps: now horizontal gradient of passive 
    85                                                                 ! tracers at the bottom ocean level 
    8688         ! 
    8789      ELSE                                               ! 1D vertical configuration 
    88                                 CALL trc_sbc( kstp )            ! surface boundary condition 
    89          IF( .NOT. lk_offline .AND. lk_zdfkpp )    & 
    90             &                   CALL trc_kpp( kstp )            ! KPP non-local tracer fluxes 
    91                                 CALL trc_zdf( kstp )            ! vertical mixing and after tracer fields 
    92                                 CALL trc_nxt( kstp )            ! tracer fields at next time step      
    93           IF( ln_trcrad )       CALL trc_rad( kstp )            ! Correct artificial negative concentrations 
     90                                CALL trc_sbc( kt )            ! surface boundary condition 
     91         IF( ln_trcdmp )        CALL trc_dmp( kt )            ! internal damping trends 
     92                                CALL trc_zdf( kt )            ! vertical mixing and after tracer fields 
     93                                CALL trc_nxt( kt )            ! tracer fields at next time step      
     94          IF( ln_trcrad )       CALL trc_rad( kt )            ! Correct artificial negative concentrations 
    9495         ! 
    9596      END IF 
     
    104105   !!---------------------------------------------------------------------- 
    105106CONTAINS 
    106    SUBROUTINE trc_trp( kstp )              ! Empty routine 
    107       INTEGER, INTENT(in) ::   kstp 
    108       WRITE(*,*) 'trc_trp: You should not have seen this print! error?', kstp 
     107   SUBROUTINE trc_trp( kt )              ! Empty routine 
     108      INTEGER, INTENT(in) ::   kt 
     109      WRITE(*,*) 'trc_trp: You should not have seen this print! error?', kt 
    109110   END SUBROUTINE trc_trp 
    110111#endif 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90

    r3680 r6225  
    1111   !!   'key_top'                                                TOP models 
    1212   !!---------------------------------------------------------------------- 
    13    !!   trc_ldf     : update the tracer trend with the lateral diffusion 
    14    !!       ldf_ctl : initialization, namelist read, and parameters control 
     13   !!   trc_zdf      : update the tracer trend with the lateral diffusion 
     14   !!   trc_zdf_ini : 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 trc           ! ocean passive tracers variables 
     17   USE oce_trc       ! ocean dynamics and active tracers 
     18   USE trd_oce       ! trends: ocean 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 trcldf        ! passive tracers: lateral diffusion 
     22   USE trdtra        ! trends manager: tracers  
     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_ini     ! called by nemogcm.F90  
     30    
     31   !                                        !!** Vertical diffusion (nam_trczdf) ** 
     32   LOGICAL , PUBLIC ::   ln_trczdf_exp       !: explicit vertical diffusion scheme flag 
     33   INTEGER , PUBLIC ::   nn_trczdf_exp       !: number of sub-time step (explicit time stepping) 
    3034 
    3135   INTEGER ::   nzdf = 0               ! type vertical diffusion algorithm used 
    3236      !                                ! defined from ln_zdf...  namlist logicals) 
    33    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) ::  r2dt   ! vertical profile time-step, = 2 rdttra 
    34       !                                                 ! except at nittrc000 (=rdttra) if neuler=0 
     37   REAL(wp) ::  r2dttrc   ! vertical profile time-step, = 2 rdt 
     38      !                   ! except at nittrc000 (=rdt) if neuler=0 
    3539 
    3640   !! * Substitutions 
    37 #  include "domzgr_substitute.h90" 
    3841#  include "zdfddm_substitute.h90" 
    3942#  include "vectopt_loop_substitute.h90" 
    4043   !!---------------------------------------------------------------------- 
    41    !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     44   !! NEMO/TOP 3.7 , NEMO Consortium (2015) 
    4245   !! $Id$  
    4346   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    4447   !!---------------------------------------------------------------------- 
    4548CONTAINS 
    46     
    47    INTEGER FUNCTION trc_zdf_alloc() 
    48       !!---------------------------------------------------------------------- 
    49       !!                  ***  ROUTINE trc_zdf_alloc  *** 
    50       !!---------------------------------------------------------------------- 
    51       ALLOCATE( r2dt(jpk) , STAT=trc_zdf_alloc ) 
    52       ! 
    53       IF( trc_zdf_alloc /= 0 )   CALL ctl_warn('trc_zdf_alloc : failed to allocate array.') 
    54       ! 
    55    END FUNCTION trc_zdf_alloc 
    56  
    5749 
    5850   SUBROUTINE trc_zdf( kt ) 
     
    7163      IF( nn_timing == 1 )  CALL timing_start('trc_zdf') 
    7264      ! 
    73       IF( kt == nittrc000 )   CALL zdf_ctl          ! initialisation & control of options 
    74  
    75       IF( ln_top_euler) THEN 
    76          r2dt(:) =  rdttrc(:)              ! = rdttrc (use Euler time stepping) 
    77       ELSE 
    78          IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nittrc000 
    79             r2dt(:) =  rdttrc(:)           ! = rdttrc (restarting with Euler time stepping) 
    80          ELSEIF( kt <= nittrc000 + 1 ) THEN          ! at nittrc000 or nittrc000+1 
    81             r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog) 
    82          ENDIF 
     65      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN     ! at nittrc000 
     66         r2dttrc =  rdttrc           ! = rdttrc (use or restarting with Euler time stepping) 
     67      ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nittrc000 or nittrc000+1 
     68         r2dttrc = 2. * rdttrc       ! = 2 rdttrc (leapfrog) 
    8369      ENDIF 
    8470 
     
    8975 
    9076      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend 
    91       CASE ( -1 )                                       ! esopa: test all possibility with control print 
    92          CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra )  
    93          WRITE(charout, FMT="('zdf1 ')") ;  CALL prt_ctl_trc_info(charout) 
    94                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    95          CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt,                trb, tra, jptra )  
    96          WRITE(charout, FMT="('zdf2 ')") ;  CALL prt_ctl_trc_info(charout) 
    97                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    98       CASE ( 0 ) ;  CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra )    !   explicit scheme  
    99       CASE ( 1 ) ;  CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt,                trb, tra, jptra )    !   implicit scheme           
    100  
     77      CASE ( 0 ) ;  CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dttrc, nn_trczdf_exp, trb, tra, jptra )    !   explicit scheme  
     78      CASE ( 1 ) ;  CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dttrc,                trb, tra, jptra )    !   implicit scheme           
    10179      END SELECT 
    10280 
     
    10482         DO jn = 1, jptra 
    10583            DO jk = 1, jpkm1 
    106                ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dt(jk) ) - ztrtrd(:,:,jk,jn) 
     84               ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dttrc ) - ztrtrd(:,:,jk,jn) 
    10785            END DO 
    108             CALL trd_tra( kt, 'TRC', jn, jptra_trd_zdf, ztrtrd(:,:,:,jn) ) 
     86            CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) ) 
    10987         END DO 
    11088         CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) 
     
    12199 
    122100 
    123    SUBROUTINE zdf_ctl 
     101   SUBROUTINE trc_zdf_ini 
    124102      !!---------------------------------------------------------------------- 
    125       !!                 ***  ROUTINE zdf_ctl  *** 
     103      !!                 ***  ROUTINE trc_zdf_ini  *** 
    126104      !! 
    127105      !! ** Purpose :   Choose the vertical mixing scheme 
     
    132110      !!      NB: The implicit scheme is required when using :  
    133111      !!             - rotated lateral mixing operator 
    134       !!             - TKE, GLS or KPP vertical mixing scheme 
     112      !!             - TKE, GLS vertical mixing scheme 
    135113      !!---------------------------------------------------------------------- 
    136  
    137       !  Define the vertical tracer physics scheme 
    138       ! ========================================== 
    139  
    140       ! Choice from ln_zdfexp already read in namelist in zdfini module 
    141       IF( ln_trczdf_exp ) THEN           ! use explicit scheme 
    142          nzdf = 0 
    143       ELSE                               ! use implicit scheme 
    144          nzdf = 1 
     114      INTEGER ::  ios                 ! Local integer output status for namelist read 
     115      !! 
     116      NAMELIST/namtrc_zdf/ ln_trczdf_exp  , nn_trczdf_exp 
     117      !!---------------------------------------------------------------------- 
     118      ! 
     119      REWIND( numnat_ref )             ! namtrc_zdf in reference namelist  
     120      READ  ( numnat_ref, namtrc_zdf, IOSTAT = ios, ERR = 905) 
     121905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in reference namelist', lwp ) 
     122      ! 
     123      REWIND( numnat_cfg )             ! namtrc_zdf in configuration namelist  
     124      READ  ( numnat_cfg, namtrc_zdf, IOSTAT = ios, ERR = 906 ) 
     125906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in configuration namelist', lwp ) 
     126      IF(lwm) WRITE ( numont, namtrc_zdf ) 
     127      ! 
     128      IF(lwp) THEN                     ! Control print 
     129         WRITE(numout,*) 
     130         WRITE(numout,*) '   Namelist namtrc_zdf : set vertical diffusion  parameters' 
     131         WRITE(numout,*) '      time splitting / backward scheme ln_trczdf_exp = ', ln_trczdf_exp 
     132         WRITE(numout,*) '      number of time step              nn_trczdf_exp = ', nn_trczdf_exp 
    145133      ENDIF 
    146134 
    147       ! Force implicit schemes 
    148       IF( ln_trcldf_iso                               )   nzdf = 1      ! iso-neutral lateral physics 
    149       IF( ln_trcldf_hor .AND. ln_sco                  )   nzdf = 1      ! horizontal lateral physics in s-coordinate 
    150 #if defined key_zdftke || defined key_zdfgls || defined key_zdfkpp 
    151                                                           nzdf = 1      ! TKE, GLS or KPP physics        
    152 #endif 
    153       IF( ln_trczdf_exp .AND. nzdf == 1 )   THEN 
    154          CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS or KPP vertical scheme ', & 
    155             &           '          the implicit scheme is required, set ln_trczdf_exp = .false.' ) 
     135      !                                ! Define the vertical tracer physics scheme 
     136      IF( ln_trczdf_exp ) THEN   ;   nzdf = 0     ! explicit scheme 
     137      ELSE                       ;   nzdf = 1     ! implicit scheme 
    156138      ENDIF 
    157139 
    158       ! Test: esopa 
    159       IF( lk_esopa )    nzdf = -1                      ! All schemes used 
     140      !                                ! Force implicit schemes 
     141      IF( ln_trcldf_iso              )   nzdf = 1      ! iso-neutral lateral physics 
     142      IF( ln_trcldf_hor .AND. ln_sco )   nzdf = 1      ! horizontal lateral physics in s-coordinate 
     143#if defined key_zdftke || defined key_zdfgls  
     144                                         nzdf = 1      ! TKE or GLS physics        
     145#endif 
     146      IF( ln_trczdf_exp .AND. nzdf == 1 )  &  
     147         CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS vertical scheme ', & 
     148            &           '          the implicit scheme is required, set ln_trczdf_exp = .false.' ) 
    160149 
    161150      IF(lwp) THEN 
     
    163152         WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme' 
    164153         WRITE(numout,*) '~~~~~~~~~~~' 
    165          IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used' 
    166154         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme' 
    167155         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme' 
    168156      ENDIF 
    169  
    170    END SUBROUTINE zdf_ctl 
     157      ! 
     158   END SUBROUTINE trc_zdf_ini 
     159    
    171160#else 
    172161   !!---------------------------------------------------------------------- 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90

    r4610 r6225  
    1111   !!   'key_top'                                                TOP models 
    1212   !!---------------------------------------------------------------------- 
    13  
    14    !* Domain size * 
     13   ! 
     14   !                                            !* Domain size * 
    1515   USE par_oce , ONLY :   jpi      =>   jpi        !: first  dimension of grid --> i  
    1616   USE par_oce , ONLY :   jpj      =>   jpj        !: second dimension of grid --> j   
     
    2020   USE par_oce , ONLY :   jpkm1    =>   jpkm1      !: jpk - 1   
    2121   USE par_oce , ONLY :   jpij     =>   jpij       !: jpi x jpj 
    22    USE par_oce , ONLY :   lk_esopa =>   lk_esopa   !: flag to activate the all option 
    2322   USE par_oce , ONLY :   jp_tem   =>   jp_tem     !: indice for temperature 
    2423   USE par_oce , ONLY :   jp_sal   =>   jp_sal     !: indice for salinity 
    2524 
    26    !* IO manager * 
    27    USE in_out_manager     
    28   
    29    !* Memory Allocation * 
    30    USE wrk_nemo       
    31   
    32    !* Timing * 
    33    USE timing     
    34   
    35    !* MPP library                          
    36    USE lib_mpp  
    37  
    38    !* Fortran utilities                          
    39    USE lib_fortran 
    40  
    41    !* Lateral boundary conditions                          
    42    USE lbclnk 
    43  
    44    !* physical constants * 
    45    USE phycst             
    46  
    47    !* 1D configuration 
    48    USE c1d                                          
    49  
    50    !* model domain * 
    51    USE dom_oce  
     25   USE in_out_manager                           !* IO manager * 
     26   USE wrk_nemo                                 !* Memory Allocation * 
     27   USE timing                                   !* Timing *  
     28   USE lib_mpp                                  !* MPP library                          
     29   USE lib_fortran                              !* Fortran utilities                          
     30   USE lbclnk                                   !* Lateral boundary conditions                          
     31   USE phycst                                   !* physical constants * 
     32   USE c1d                                      !* 1D configuration 
     33   USE dom_oce                                  !* model domain * 
    5234 
    5335   USE domvvl, ONLY : un_td, vn_td          !: thickness diffusion transport 
     
    5638 
    5739   !* ocean fields: here now and after fields * 
    58    USE oce , ONLY :   ua      =>    ua      !: i-horizontal velocity (m s-1)  
    59    USE oce , ONLY :   va      =>    va      !: j-horizontal velocity (m s-1) 
    6040   USE oce , ONLY :   un      =>    un      !: i-horizontal velocity (m s-1)  
    6141   USE oce , ONLY :   vn      =>    vn      !: j-horizontal velocity (m s-1) 
     
    6747   USE oce , ONLY :   rhd     =>    rhd     !: in situ density anomalie rhd=(rho-rau0)/rau0 (no units) 
    6848   USE oce , ONLY :   hdivn   =>    hdivn   !: horizontal divergence (1/s) 
    69    USE oce , ONLY :   rotn    =>    rotn    !: relative vorticity    [s-1] 
    70    USE oce , ONLY :   hdivb   =>    hdivb   !: horizontal divergence (1/s) 
    71    USE oce , ONLY :   rotb    =>    rotb    !: relative vorticity    [s-1] 
    7249   USE oce , ONLY :   sshn    =>    sshn    !: sea surface height at t-point [m]    
    7350   USE oce , ONLY :   sshb    =>    sshb    !: sea surface height at t-point [m]    
    7451   USE oce , ONLY :   ssha    =>    ssha    !: sea surface height at t-point [m]    
    75    USE oce , ONLY :   l_traldf_rot => l_traldf_rot  !: rotated laplacian operator for lateral diffusion 
     52#if defined key_offline 
     53   USE oce , ONLY :   rab_n   =>    rab_n   !: local thermal/haline expension ratio at T-points 
     54#endif 
    7655 
    7756   !* surface fluxes * 
     
    8463   USE sbc_oce , ONLY :   fmmflx     =>    fmmflx     !: freshwater budget: volume flux               [Kg/m2/s] 
    8564   USE sbc_oce , ONLY :   rnf        =>    rnf        !: river runoff   [Kg/m2/s] 
    86    USE sbc_oce , ONLY :   ln_dm2dc   =>    ln_dm2dc   !: Daily mean to Diurnal Cycle short wave (qsr)  
     65   USE sbc_oce , ONLY :   ln_dm2dc   =>    ln_dm2dc   !: Diurnal Cycle  
     66   USE sbc_oce , ONLY :   ncpl_qsr_freq   =>   ncpl_qsr_freq   !: qsr coupling frequency per days from atmospher 
    8767   USE sbc_oce , ONLY :   ln_rnf     =>    ln_rnf     !: runoffs / runoff mouths 
    8868   USE sbc_oce , ONLY :   fr_i       =>    fr_i       !: ice fraction (between 0 to 1) 
     69   USE sbc_oce , ONLY :   nn_ice_embd => nn_ice_embd  !: flag for  levitating/embedding sea-ice in the ocean 
    8970   USE traqsr  , ONLY :   rn_abs     =>    rn_abs     !: fraction absorbed in the very near surface 
    9071   USE traqsr  , ONLY :   rn_si0     =>    rn_si0     !: very near surface depth of extinction 
     
    9374   USE sbcrnf  , ONLY :   rnfmsk_z   =>    rnfmsk_z   !: mixed adv scheme in runoffs vicinity (vert.) 
    9475   USE sbcrnf  , ONLY :   h_rnf      =>    h_rnf      !: river runoff   [Kg/m2/s] 
     76   USE sbcrnf  , ONLY :   nk_rnf     =>    nk_rnf     !: depth of runoff in model level 
    9577 
    9678   USE trc_oce 
    9779 
     80!!gm : I don't understand this as ldftra (where everything is defined) is used by TRC in all cases (ON/OFF-line) 
     81!!gm   so the following lines should be removed....   logical should be the one of TRC namelist 
     82!!gm   In case off coarsening....  the ( ahtu, ahtv, aeiu, aeiv) arrays are needed that's all. 
    9883   !* lateral diffusivity (tracers) * 
    99    USE ldftra_oce , ONLY :  rldf     =>   rldf        !: multiplicative coef. for lateral diffusivity 
    100    USE ldftra_oce , ONLY :  rn_aht_0 =>   rn_aht_0    !: horizontal eddy diffusivity for tracers (m2/s) 
    101    USE ldftra_oce , ONLY :  aht0     =>   aht0        !: horizontal eddy diffusivity for tracers (m2/s) 
    102    USE ldftra_oce , ONLY :  ahtb0    =>   ahtb0       !: background eddy diffusivity for isopycnal diff. (m2/s) 
    103    USE ldftra_oce , ONLY :  ahtu     =>   ahtu        !: lateral diffusivity coef. at u-points  
    104    USE ldftra_oce , ONLY :  ahtv     =>   ahtv        !: lateral diffusivity coef. at v-points  
    105    USE ldftra_oce , ONLY :  ahtw     =>   ahtw        !: lateral diffusivity coef. at w-points  
    106    USE ldftra_oce , ONLY :  ahtt     =>   ahtt        !: lateral diffusivity coef. at t-points 
    107    USE ldftra_oce , ONLY :  aeiv0    =>   aeiv0       !: eddy induced velocity coefficient (m2/s)  
    108    USE ldftra_oce , ONLY :  aeiu     =>   aeiu        !: eddy induced velocity coef. at u-points (m2/s)    
    109    USE ldftra_oce , ONLY :  aeiv     =>   aeiv        !: eddy induced velocity coef. at v-points (m2/s)  
    110    USE ldftra_oce , ONLY :  aeiw     =>   aeiw        !: eddy induced velocity coef. at w-points (m2/s)  
    111    USE ldftra_oce , ONLY :  lk_traldf_eiv  =>  lk_traldf_eiv     !: eddy induced velocity flag 
     84   USE ldftra , ONLY :  rn_aht_0     =>   rn_aht_0     !:   laplacian lateral eddy diffusivity [m2/s] 
     85   USE ldftra , ONLY :  rn_bht_0     =>   rn_bht_0     !: bilaplacian lateral eddy diffusivity [m4/s] 
     86   USE ldftra , ONLY :  ahtu         =>   ahtu         !: lateral diffusivity coef. at u-points  
     87   USE ldftra , ONLY :  ahtv         =>   ahtv         !: lateral diffusivity coef. at v-points  
     88   USE ldftra , ONLY :  rn_aeiv_0    =>   rn_aeiv_0    !: eddy induced velocity coefficient (m2/s)  
     89   USE ldftra , ONLY :  aeiu         =>   aeiu         !: eddy induced velocity coef. at u-points (m2/s)    
     90   USE ldftra , ONLY :  aeiv         =>   aeiv         !: eddy induced velocity coef. at v-points (m2/s)  
     91   USE ldftra , ONLY :  ln_ldfeiv    =>   ln_ldfeiv    !: eddy induced velocity flag 
     92      
     93!!gm this should be : ln_trcldf_triad (TRC namelist) 
     94   USE ldfslp , ONLY :  ln_traldf_triad => ln_traldf_triad   !: triad scheme (Griffies et al.) 
     95 
     96   !* direction of lateral diffusion * 
     97   USE ldfslp , ONLY :   l_ldfslp  =>  l_ldfslp       !: slopes flag 
     98   USE ldfslp , ONLY :   uslp       =>   uslp         !: i-slope at u-point 
     99   USE ldfslp , ONLY :   vslp       =>   vslp         !: j-slope at v-point 
     100   USE ldfslp , ONLY :   wslpi      =>   wslpi        !: i-slope at w-point 
     101   USE ldfslp , ONLY :   wslpj      =>   wslpj        !: j-slope at w-point 
     102!!gm end  
    112103 
    113104   !* vertical diffusion * 
     
    123114   USE zdfmxl , ONLY :   hmlpt       =>   hmlpt       !: mixed layer depth at t-points (m) 
    124115 
    125    !* direction of lateral diffusion * 
    126    USE ldfslp , ONLY :   lk_ldfslp  =>  lk_ldfslp     !: slopes flag 
    127 # if   defined key_ldfslp 
    128    USE ldfslp , ONLY :   uslp       =>   uslp         !: i-direction slope at u-, w-points 
    129    USE ldfslp , ONLY :   vslp       =>   vslp         !: j-direction slope at v-, w-points 
    130    USE ldfslp , ONLY :   wslpi      =>   wslpi        !: i-direction slope at u-, w-points 
    131    USE ldfslp , ONLY :   wslpj      =>   wslpj        !: j-direction slope at v-, w-points 
    132 # endif 
    133  
     116   USE diaar5 , ONLY :   lk_diaar5  =>   lk_diaar5 
    134117#else 
    135118   !!---------------------------------------------------------------------- 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trc.F90

    r4611 r6225  
    1414   USE par_oce 
    1515   USE par_trc 
     16#if defined key_bdy 
     17   USE bdy_oce, only: nb_bdy, OBC_DATA 
     18#endif 
    1619    
    1720   IMPLICIT NONE 
     
    3437   REAL(wp), PUBLIC                                                ::  areatot        !: total volume  
    3538   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  )         ::  cvol           !: volume correction -degrad option-  
    36    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  trn            !: traceur concentration for now time step 
    37    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  tra            !: traceur concentration for next time step 
    38    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  trb            !: traceur concentration for before time step 
     39   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  trn            !: tracer concentration for now time step 
     40   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  tra            !: tracer concentration for next time step 
     41   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  trb            !: tracer concentration for before time step 
     42   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  )         ::  sbc_trc_b      !: Before sbc fluxes for tracers 
     43   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  )         ::  sbc_trc        !: Now sbc fluxes for tracers 
     44 
     45   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  )         ::  trc_i          !: prescribed tracer concentration in sea ice for SBC 
     46   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  )         ::  trc_o          !: prescribed tracer concentration in ocean for SBC 
     47   INTEGER             , PUBLIC                                    ::  nn_ice_tr      !: handling of sea ice tracers 
    3948 
    4049   !! interpolated gradient 
     
    4251   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)           ::  gtru           !: hor. gradient at u-points at bottom ocean level 
    4352   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)           ::  gtrv           !: hor. gradient at v-points at bottom ocean level 
     53   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)           ::  gtrui          !: hor. gradient at u-points at top    ocean level 
     54   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)           ::  gtrvi          !: hor. gradient at v-points at top    ocean level 
     55   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)             ::  qsr_mean        !: daily mean qsr 
    4456    
    4557   !! passive tracers  (input and output) 
     
    5264   INTEGER             , PUBLIC                                    ::  nn_rsttr       !: control of the time step ( 0 or 1 ) for pass. tr. 
    5365   CHARACTER(len = 80) , PUBLIC                                    ::  cn_trcrst_in   !: suffix of pass. tracer restart name (input) 
     66   CHARACTER(len = 256), PUBLIC                                    ::  cn_trcrst_indir  !: restart input directory 
    5467   CHARACTER(len = 80) , PUBLIC                                    ::  cn_trcrst_out  !: suffix of pass. tracer restart name (output) 
    55    REAL(wp)            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::  rdttrc         !: vertical profile of passive tracer time step 
     68   CHARACTER(len = 256), PUBLIC                                    ::  cn_trcrst_outdir  !: restart output directory 
     69   REAL(wp)            , PUBLIC                                    ::  rdttrc         !: passive tracer time step 
    5670   LOGICAL             , PUBLIC                                    ::  ln_top_euler  !: boolean term for euler integration  
    5771   LOGICAL             , PUBLIC                                    ::  ln_trcdta      !: Read inputs data from files 
     
    5973   LOGICAL             , PUBLIC                                    ::  ln_trcdmp_clo  !: internal damping flag on closed seas 
    6074   INTEGER             , PUBLIC                                    ::  nittrc000       !: first time step of passive tracers model 
     75   LOGICAL             , PUBLIC                                    ::  l_trcdm2dc     !: Diurnal cycle for TOP 
     76 
     77   !! Information for the ice module for tracers 
     78   !! ------------------------------------------ 
     79   TYPE TRC_I_NML                    !--- Ice tracer namelist structure 
     80         REAL(wp)         :: trc_ratio  ! ice-ocean trc ratio 
     81         REAL(wp)         :: trc_prescr ! prescribed ice trc cc 
     82         CHARACTER(len=2) :: ctrc_o     ! choice of ocean trc cc 
     83   END TYPE 
     84 
     85   REAL(wp), DIMENSION(jptra), PUBLIC         :: trc_ice_ratio, & ! ice-ocean tracer ratio 
     86                                                 trc_ice_prescr   ! prescribed ice trc cc 
     87   CHARACTER(len=2), DIMENSION(jptra), PUBLIC :: cn_trc_o ! choice of ocean tracer cc 
    6188 
    6289   !! information for outputs 
     
    6794       CHARACTER(len = 20)  :: clunit   !: unit 
    6895       LOGICAL              :: llinit   !: read in a file or not 
     96#if defined  key_my_trc 
     97       LOGICAL              :: llsbc   !: read in a file or not 
     98       LOGICAL              :: llcbc   !: read in a file or not 
     99       LOGICAL              :: llobc   !: read in a file or not 
     100#endif 
    69101       LOGICAL              :: llsave   !: save the tracer or not 
    70102   END TYPE PTRACER 
     
    119151   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  avs_tm      !: vertical double diffusivity coeff. at w-point   [m/s] 
    120152# endif 
    121 #if defined key_ldfslp 
    122    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  wslpi_tm    !: i-direction slope at u-, w-points 
    123    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  wslpj_tm    !: j-direction slope at u-, w-points 
    124    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  uslp_tm     !: j-direction slope at u-, w-points 
    125    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  vslp_tm     !: j-direction slope at u-, w-points 
    126 #endif 
    127153#if defined key_trabbl 
    128154   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::  ahu_bbl_tm  !: u-, w-points 
     
    159185#endif 
    160186   ! 
    161 #if defined key_ldfslp 
    162    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  wslpi_temp, wslpj_temp, uslp_temp, vslp_temp    !: hold current values  
    163 #endif 
    164    !  
    165187# if defined key_zdfddm 
    166188   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  avs_temp      !: salinity vertical diffusivity coeff. at w-point   [m/s] 
    167189# endif 
    168190   ! 
     191#if defined key_bdy 
     192   CHARACTER(len=20), PUBLIC, ALLOCATABLE,  SAVE,  DIMENSION(:)   ::  cn_trc_dflt          ! Default OBC condition for all tracers 
     193   CHARACTER(len=20), PUBLIC, ALLOCATABLE,  SAVE,  DIMENSION(:)   ::  cn_trc               ! Choice of boundary condition for tracers 
     194   INTEGER,           PUBLIC, ALLOCATABLE,  SAVE,  DIMENSION(:)   ::  nn_trcdmp_bdy        !: =T Tracer damping 
     195   ! External data structure of BDY for TOP. Available elements: cn_obc, ll_trc, trcnow, dmp 
     196   TYPE(OBC_DATA),    PUBLIC, ALLOCATABLE, DIMENSION(:,:), TARGET ::  trcdta_bdy           !: bdy external data (local process) 
     197#endif 
     198   ! 
    169199 
    170200   !!---------------------------------------------------------------------- 
    171201   !! NEMO/TOP 3.3.1 , NEMO Consortium (2010) 
    172    !! $Id$  
     202   !! $Id$ 
    173203   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    174204   !!---------------------------------------------------------------------- 
     
    183213      ! 
    184214      ALLOCATE( trn(jpi,jpj,jpk,jptra), trb(jpi,jpj,jpk,jptra), tra(jpi,jpj,jpk,jptra),       &   
    185          &      gtru(jpi,jpj,jpk)     , gtrv(jpi,jpj,jpk)                             ,       & 
    186          &      cvol(jpi,jpj,jpk)     , rdttrc(jpk)           , trai(jptra)           ,       & 
     215         &      trc_i(jpi,jpj,jptra)  , trc_o(jpi,jpj,jptra)                          ,       & 
     216         &      gtru (jpi,jpj,jptra)  , gtrv (jpi,jpj,jptra)                          ,       & 
     217         &      gtrui(jpi,jpj,jptra)  , gtrvi(jpi,jpj,jptra)                          ,       & 
     218         &      sbc_trc_b(jpi,jpj,jptra), sbc_trc(jpi,jpj,jptra)                      ,       &   
     219         &      cvol(jpi,jpj,jpk)     , trai(jptra)                                   ,       & 
    187220         &      ctrcnm(jptra)         , ctrcln(jptra)         , ctrcun(jptra)         ,       &  
    188          &      ln_trc_ini(jptra)     , ln_trc_wri(jptra)                             ,  STAT = trc_alloc  )   
     221         &      ln_trc_ini(jptra)     , ln_trc_wri(jptra)     , qsr_mean(jpi,jpj)     ,       & 
     222#if defined key_my_trc 
     223         &      ln_trc_sbc(jptra)     , ln_trc_cbc(jptra)     , ln_trc_obc(jptra)     ,       & 
     224#endif 
     225#if defined key_bdy 
     226         &      cn_trc_dflt(nb_bdy)   , cn_trc(nb_bdy)        , nn_trcdmp_bdy(nb_bdy) ,       & 
     227         &      trcdta_bdy(jptra,nb_bdy)                                              ,       & 
     228#endif 
     229         &      STAT = trc_alloc  ) 
    189230 
    190231      IF( trc_alloc /= 0 )   CALL ctl_warn('trc_alloc: failed to allocate arrays') 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trcbc.F90

    • Property svn:keywords set to Id
    r4624 r6225  
    11MODULE trcbc 
    22   !!====================================================================== 
    3    !!                     ***  MODULE  trcdta  *** 
     3   !!                     ***  MODULE  trcbc  *** 
    44   !! TOP :  module for passive tracer boundary conditions 
    55   !!===================================================================== 
    6    !!---------------------------------------------------------------------- 
    7 #if  defined key_top  
     6   !! History :  3.5 !  2014-04  (M. Vichi, T. Lovato)  Original 
     7   !!            3.6 !  2015-03  (T . Lovato) Revision and BDY support 
     8   !!---------------------------------------------------------------------- 
     9#if defined key_top 
    810   !!---------------------------------------------------------------------- 
    911   !!   'key_top'                                                TOP model  
    1012   !!---------------------------------------------------------------------- 
    11    !!   trc_dta    : read and time interpolated passive tracer data 
     13   !!   trc_bc       : read and time interpolated tracer Boundary Conditions 
    1214   !!---------------------------------------------------------------------- 
    1315   USE par_trc       !  passive tracers parameters 
     
    1719   USE lib_mpp       !  MPP library 
    1820   USE fldread       !  read input fields 
     21#if defined key_bdy 
     22   USE bdy_oce, only: nb_bdy , idx_bdy, ln_coords_file, rn_time_dmp, rn_time_dmp_out 
     23#endif 
    1924 
    2025   IMPLICIT NONE 
     
    2429   PUBLIC   trc_bc_read    ! called in trcstp.F90 or within 
    2530 
    26    INTEGER  , SAVE, PUBLIC                             :: nb_trcobc   ! number of tracers with open BC 
    27    INTEGER  , SAVE, PUBLIC                             :: nb_trcsbc   ! number of tracers with surface BC 
    28    INTEGER  , SAVE, PUBLIC                             :: nb_trccbc   ! number of tracers with coastal BC 
     31   INTEGER  , SAVE, PUBLIC                             :: nb_trcobc    ! number of tracers with open BC 
     32   INTEGER  , SAVE, PUBLIC                             :: nb_trcsbc    ! number of tracers with surface BC 
     33   INTEGER  , SAVE, PUBLIC                             :: nb_trccbc    ! number of tracers with coastal BC 
    2934   INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_indobc ! index of tracer with OBC data 
    3035   INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_indsbc ! index of tracer with SBC data 
    3136   INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_indcbc ! index of tracer with CBC data 
    32    INTEGER  , SAVE, PUBLIC                             :: ntra_obc     ! MAX( 1, nb_trcxxx ) to avoid compilation error with bounds checking 
    33    INTEGER  , SAVE, PUBLIC                             :: ntra_sbc     ! MAX( 1, nb_trcxxx ) to avoid compilation error with bounds checking 
    34    INTEGER  , SAVE, PUBLIC                             :: ntra_cbc     ! MAX( 1, nb_trcxxx ) to avoid compilation error with bounds checking 
    35    REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trofac   ! multiplicative factor for OBCtracer values 
    36    TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trcobc   ! structure of data input OBC (file informations, fields read) 
    37    REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trsfac   ! multiplicative factor for SBC tracer values 
    38    TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trcsbc   ! structure of data input SBC (file informations, fields read) 
    39    REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trcfac   ! multiplicative factor for CBC tracer values 
    40    TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trccbc   ! structure of data input CBC (file informations, fields read) 
    41  
    42    !! * Substitutions 
    43 #  include "domzgr_substitute.h90" 
    44    !!---------------------------------------------------------------------- 
    45    !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    46    !! $Id: trcdta.F90 2977 2011-10-22 13:46:41Z cetlod $  
     37   REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trsfac    ! multiplicative factor for SBC tracer values 
     38   TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trcsbc    ! structure of data input SBC (file informations, fields read) 
     39   REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trcfac    ! multiplicative factor for CBC tracer values 
     40   TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trccbc    ! structure of data input CBC (file informations, fields read) 
     41   REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trofac    ! multiplicative factor for OBCtracer values 
     42   TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:), TARGET  :: sf_trcobc    ! structure of data input OBC (file informations, fields read) 
     43   TYPE(MAP_POINTER), ALLOCATABLE, DIMENSION(:) :: nbmap_ptr   ! array of pointers to nbmap 
     44 
     45   !!---------------------------------------------------------------------- 
     46   !! NEMO/OPA 3.6 , NEMO Consortium (2015) 
     47   !! $Id$ 
    4748   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    4849   !!---------------------------------------------------------------------- 
    4950CONTAINS 
    5051 
    51    SUBROUTINE trc_bc_init(ntrc) 
     52   SUBROUTINE trc_bc_init( ntrc ) 
    5253      !!---------------------------------------------------------------------- 
    5354      !!                   ***  ROUTINE trc_bc_init  *** 
     
    6061      ! 
    6162      INTEGER,INTENT(IN) :: ntrc                           ! number of tracers 
    62       INTEGER            :: jl, jn                         ! dummy loop indices 
     63      INTEGER            :: jl, jn , ib, ibd, ii, ij, ik   ! dummy loop indices 
    6364      INTEGER            :: ierr0, ierr1, ierr2, ierr3     ! temporary integers 
    64       INTEGER            ::  ios                           ! Local integer output status for namelist read 
     65      INTEGER            :: ios                            ! Local integer output status for namelist read 
     66      INTEGER            :: nblen, igrd                    ! support arrays for BDY 
    6567      CHARACTER(len=100) :: clndta, clntrc 
    6668      ! 
    67       CHARACTER(len=100) :: cn_dir 
     69      CHARACTER(len=100) :: cn_dir_sbc, cn_dir_cbc, cn_dir_obc 
     70 
    6871      TYPE(FLD_N), ALLOCATABLE, DIMENSION(:) :: slf_i  ! local array of namelist informations on the fields to read 
    6972      TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trcobc    ! open 
     
    7477      REAL(wp)   , DIMENSION(jpmaxtrc) :: rn_trcfac    ! multiplicative factor for tracer values 
    7578      !! 
    76       NAMELIST/namtrc_bc/ cn_dir, sn_trcobc, rn_trofac, sn_trcsbc, rn_trsfac, sn_trccbc, rn_trcfac  
     79      NAMELIST/namtrc_bc/ cn_dir_sbc, cn_dir_cbc, cn_dir_obc, sn_trcobc, rn_trofac, sn_trcsbc, rn_trsfac, sn_trccbc, rn_trcfac 
     80#if defined key_bdy 
     81      NAMELIST/namtrc_bdy/ cn_trc_dflt, cn_trc, nn_trcdmp_bdy 
     82#endif 
    7783      !!---------------------------------------------------------------------- 
    7884      IF( nn_timing == 1 )  CALL timing_start('trc_bc_init') 
    7985      ! 
     86      IF( lwp ) THEN 
     87         WRITE(numout,*) ' ' 
     88         WRITE(numout,*) 'trc_bc_init : Tracers Boundary Conditions (BC)' 
     89         WRITE(numout,*) '~~~~~~~~~~~ ' 
     90      ENDIF 
    8091      !  Initialisation and local array allocation 
    8192      ierr0 = 0  ;  ierr1 = 0  ;  ierr2 = 0  ;  ierr3 = 0   
     
    107118      n_trc_indcbc(:) = 0 
    108119      ! 
    109       DO jn = 1, ntrc 
    110          IF( ln_trc_obc(jn) ) THEN 
    111              nb_trcobc       = nb_trcobc + 1  
    112              n_trc_indobc(jn) = nb_trcobc  
    113          ENDIF 
    114          IF( ln_trc_sbc(jn) ) THEN 
    115              nb_trcsbc       = nb_trcsbc + 1 
    116              n_trc_indsbc(jn) = nb_trcsbc 
    117          ENDIF 
    118          IF( ln_trc_cbc(jn) ) THEN 
    119              nb_trccbc       = nb_trccbc + 1 
    120              n_trc_indcbc(jn) = nb_trccbc 
    121          ENDIF 
    122       ENDDO 
    123       ntra_obc = MAX( 1, nb_trcobc )   ! To avoid compilation error with bounds checking 
    124       IF( lwp ) WRITE(numout,*) ' ' 
    125       IF( lwp ) WRITE(numout,*) ' Number of passive tracers to be initialized with open boundary data :', nb_trcobc 
    126       IF( lwp ) WRITE(numout,*) ' ' 
    127       ntra_sbc = MAX( 1, nb_trcsbc )   ! To avoid compilation error with bounds checking 
    128       IF( lwp ) WRITE(numout,*) ' ' 
    129       IF( lwp ) WRITE(numout,*) ' Number of passive tracers to be initialized with surface boundary data :', nb_trcsbc 
    130       IF( lwp ) WRITE(numout,*) ' ' 
    131       ntra_cbc = MAX( 1, nb_trccbc )   ! To avoid compilation error with bounds checking 
    132       IF( lwp ) WRITE(numout,*) ' ' 
    133       IF( lwp ) WRITE(numout,*) ' Number of passive tracers to be initialized with coastal boundary data :', nb_trccbc 
    134       IF( lwp ) WRITE(numout,*) ' ' 
    135  
     120      ! Read Boundary Conditions Namelists 
    136121      REWIND( numnat_ref )              ! Namelist namtrc_bc in reference namelist : Passive tracer data structure 
    137122      READ  ( numnat_ref, namtrc_bc, IOSTAT = ios, ERR = 901) 
     
    143128      IF(lwm) WRITE ( numont, namtrc_bc ) 
    144129 
    145       ! print some information for each  
     130#if defined key_bdy 
     131      REWIND( numnat_ref )              ! Namelist namtrc_bc in reference namelist : Passive tracer data structure 
     132      READ  ( numnat_ref, namtrc_bdy, IOSTAT = ios, ERR = 903) 
     133903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in reference namelist', lwp ) 
     134 
     135      REWIND( numnat_cfg )              ! Namelist namtrc_bc in configuration namelist : Passive tracer data structure 
     136      READ  ( numnat_cfg, namtrc_bdy, IOSTAT = ios, ERR = 904 ) 
     137904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in configuration namelist', lwp ) 
     138      IF(lwm) WRITE ( numont, namtrc_bdy ) 
     139      ! setup up preliminary informations for BDY structure 
     140      DO jn = 1, ntrc 
     141         DO ib = 1, nb_bdy 
     142            ! Set type of obc in BDY data structure (around here we may plug user override of obc type from nml) 
     143            IF ( ln_trc_obc(jn) ) THEN 
     144               trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc(ib) ) 
     145            ELSE 
     146               trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc_dflt(ib) ) 
     147            ENDIF 
     148            ! set damping use in BDY data structure 
     149            trcdta_bdy(jn,ib)%dmp = .false. 
     150            IF(nn_trcdmp_bdy(ib) .EQ. 1 .AND. ln_trc_obc(jn) ) trcdta_bdy(jn,ib)%dmp = .true. 
     151            IF(nn_trcdmp_bdy(ib) .EQ. 2 ) trcdta_bdy(jn,ib)%dmp = .true. 
     152            IF(trcdta_bdy(jn,ib)%cn_obc == 'frs' .AND. nn_trcdmp_bdy(ib) .NE. 0 )  & 
     153                & CALL ctl_stop( 'Use FRS OR relaxation' ) 
     154            IF (nn_trcdmp_bdy(ib) .LT. 0 .OR. nn_trcdmp_bdy(ib) .GT. 2)            & 
     155                & CALL ctl_stop( 'Not a valid option for nn_trcdmp_bdy. Allowed: 0,1,2.' ) 
     156         ENDDO 
     157      ENDDO 
     158 
     159#else 
     160      ! Force all tracers OBC to false if bdy not used 
     161      ln_trc_obc = .false. 
     162#endif 
     163      ! compose BC data indexes 
     164      DO jn = 1, ntrc 
     165         IF( ln_trc_obc(jn) ) THEN 
     166             nb_trcobc       = nb_trcobc + 1  ; n_trc_indobc(jn) = nb_trcobc 
     167         ENDIF 
     168         IF( ln_trc_sbc(jn) ) THEN 
     169             nb_trcsbc       = nb_trcsbc + 1  ; n_trc_indsbc(jn) = nb_trcsbc 
     170         ENDIF 
     171         IF( ln_trc_cbc(jn) ) THEN 
     172             nb_trccbc       = nb_trccbc + 1  ; n_trc_indcbc(jn) = nb_trccbc 
     173         ENDIF 
     174      ENDDO 
     175 
     176      ! Print summmary of Boundary Conditions 
    146177      IF( lwp ) THEN 
     178         WRITE(numout,*) ' ' 
     179         WRITE(numout,'(a,i3)') '   Total tracers to be initialized with SURFACE BCs data:', nb_trcsbc 
     180         IF ( nb_trcsbc > 0 ) THEN 
     181            WRITE(numout,*) '   #trc        NAME        Boundary     Mult.Fact. ' 
     182            DO jn = 1, ntrc 
     183               IF ( ln_trc_sbc(jn) ) WRITE(numout,9001) jn, TRIM( sn_trcsbc(jn)%clvar ), 'SBC', rn_trsfac(jn) 
     184            ENDDO 
     185         ENDIF 
     186         WRITE(numout,'(2a)') '   SURFACE BC data repository : ', TRIM(cn_dir_sbc) 
     187 
     188         WRITE(numout,*) ' ' 
     189         WRITE(numout,'(a,i3)') '   Total tracers to be initialized with COASTAL BCs data:', nb_trccbc 
     190         IF ( nb_trccbc > 0 ) THEN 
     191            WRITE(numout,*) '   #trc        NAME        Boundary     Mult.Fact. ' 
     192            DO jn = 1, ntrc 
     193               IF ( ln_trc_cbc(jn) ) WRITE(numout, 9001) jn, TRIM( sn_trccbc(jn)%clvar ), 'CBC', rn_trcfac(jn) 
     194            ENDDO 
     195         ENDIF 
     196         WRITE(numout,'(2a)') '   COASTAL BC data repository : ', TRIM(cn_dir_cbc) 
     197 
     198         WRITE(numout,*) ' ' 
     199         WRITE(numout,'(a,i3)') '   Total tracers to be initialized with OPEN BCs data:', nb_trcobc 
     200#if defined key_bdy 
     201         IF ( nb_trcobc > 0 ) THEN 
     202            WRITE(numout,*) '   #trc        NAME        Boundary     Mult.Fact.   OBC Settings' 
     203            DO jn = 1, ntrc 
     204               IF ( ln_trc_obc(jn) )  WRITE(numout, 9001) jn, TRIM( sn_trcobc(jn)%clvar ), 'OBC', rn_trofac(jn), (trcdta_bdy(jn,ib)%cn_obc,ib=1,nb_bdy) 
     205               IF ( .NOT. ln_trc_obc(jn) )  WRITE(numout, 9002) jn, 'Set data to IC and use default condition', (trcdta_bdy(jn,ib)%cn_obc,ib=1,nb_bdy) 
     206            ENDDO 
     207            WRITE(numout,*) ' ' 
     208            DO ib = 1, nb_bdy 
     209                IF (nn_trcdmp_bdy(ib) .EQ. 0) WRITE(numout,9003) '   Boundary ',ib,' -> NO damping of tracers' 
     210                IF (nn_trcdmp_bdy(ib) .EQ. 1) WRITE(numout,9003) '   Boundary ',ib,' -> damping ONLY for tracers with external data provided' 
     211                IF (nn_trcdmp_bdy(ib) .EQ. 2) WRITE(numout,9003) '   Boundary ',ib,' -> damping of ALL tracers' 
     212                IF (nn_trcdmp_bdy(ib) .GT. 0) THEN 
     213                   WRITE(numout,9003) '     USE damping parameters from nambdy for boundary ', ib,' : ' 
     214                   WRITE(numout,'(a,f10.2,a)') '     - Inflow damping time scale  : ',rn_time_dmp(ib),' days' 
     215                   WRITE(numout,'(a,f10.2,a)') '     - Outflow damping time scale : ',rn_time_dmp_out(ib),' days' 
     216                ENDIF 
     217            ENDDO 
     218         ENDIF 
     219#endif 
     220         WRITE(numout,'(2a)') '   OPEN BC data repository : ', TRIM(cn_dir_obc) 
     221      ENDIF 
     2229001  FORMAT(2x,i5, 3x, a15, 3x, a5, 6x, e11.3, 4x, 10a13) 
     2239002  FORMAT(2x,i5, 3x, a41, 3x, 10a13) 
     2249003  FORMAT(a, i5, a) 
     225 
     226      ! 
     227#if defined key_bdy 
     228      ! OPEN Lateral boundary conditions 
     229      IF( nb_trcobc > 0 ) THEN  
     230         ALLOCATE ( sf_trcobc(nb_trcobc), rf_trofac(nb_trcobc), nbmap_ptr(nb_trcobc), STAT=ierr1 ) 
     231         IF( ierr1 > 0 ) THEN 
     232            CALL ctl_stop( 'trc_bc_init: unable to allocate sf_trcobc structure' )   ;   RETURN 
     233         ENDIF 
     234 
     235         igrd = 1                       ! Everything is at T-points here 
     236 
    147237         DO jn = 1, ntrc 
    148             IF( ln_trc_obc(jn) )  THEN     
    149                clndta = TRIM( sn_trcobc(jn)%clvar )  
    150                IF(lwp) WRITE(numout,*) 'Preparing to read OBC data file for passive tracer number :', jn, ' name : ', clndta, &  
    151                &               ' multiplicative factor : ', rn_trofac(jn) 
    152             ENDIF 
    153             IF( ln_trc_sbc(jn) )  THEN     
    154                clndta = TRIM( sn_trcsbc(jn)%clvar )  
    155                IF(lwp) WRITE(numout,*) 'Preparing to read SBC data file for passive tracer number :', jn, ' name : ', clndta, &  
    156                &               ' multiplicative factor : ', rn_trsfac(jn) 
    157             ENDIF 
    158             IF( ln_trc_cbc(jn) )  THEN     
    159                clndta = TRIM( sn_trccbc(jn)%clvar )  
    160                IF(lwp) WRITE(numout,*) 'Preparing to read CBC data file for passive tracer number :', jn, ' name : ', clndta, &  
    161                &               ' multiplicative factor : ', rn_trcfac(jn) 
    162             ENDIF 
    163          END DO 
    164       ENDIF 
    165       ! 
    166       ! The following code is written this way to reduce memory usage and repeated for each boundary data 
    167       ! MAV: note that this is just a placeholder and the dimensions must be changed according to  
    168       !      what will be done with BDY. A new structure will probably need to be included 
    169       ! 
    170       ! OPEN Lateral boundary conditions 
    171       IF( nb_trcobc > 0 ) THEN       !  allocate only if the number of tracer to initialise is greater than zero 
    172          ALLOCATE( sf_trcobc(nb_trcobc), rf_trofac(nb_trcobc), STAT=ierr1 ) 
    173          IF( ierr1 > 0 ) THEN 
    174             CALL ctl_stop( 'trc_bc_init: unable to allocate  sf_trcobc structure' )   ;   RETURN 
    175          ENDIF 
    176          ! 
    177          DO jn = 1, ntrc 
    178             IF( ln_trc_obc(jn) ) THEN      ! update passive tracers arrays with input data read from file 
    179                jl = n_trc_indobc(jn) 
    180                slf_i(jl)    = sn_trcobc(jn) 
    181                rf_trofac(jl) = rn_trofac(jn) 
    182                                             ALLOCATE( sf_trcobc(jl)%fnow(jpi,jpj,jpk)   , STAT=ierr2 ) 
    183                IF( sn_trcobc(jn)%ln_tint )  ALLOCATE( sf_trcobc(jl)%fdta(jpi,jpj,jpk,2) , STAT=ierr3 ) 
    184                IF( ierr2 + ierr3 > 0 ) THEN 
    185                  CALL ctl_stop( 'trc_bc_init : unable to allocate passive tracer OBC data arrays' )   ;   RETURN 
     238            DO ib = 1, nb_bdy 
     239 
     240               nblen = idx_bdy(ib)%nblen(igrd) 
     241 
     242               IF ( ln_trc_obc(jn) ) THEN 
     243               ! Initialise from external data 
     244                  jl = n_trc_indobc(jn) 
     245                  slf_i(jl)    = sn_trcobc(jn) 
     246                  rf_trofac(jl) = rn_trofac(jn) 
     247                                               ALLOCATE( sf_trcobc(jl)%fnow(nblen,1,jpk)   , STAT=ierr2 ) 
     248                  IF( sn_trcobc(jn)%ln_tint )  ALLOCATE( sf_trcobc(jl)%fdta(nblen,1,jpk,2) , STAT=ierr3 ) 
     249                  IF( ierr2 + ierr3 > 0 ) THEN 
     250                    CALL ctl_stop( 'trc_bc_init : unable to allocate passive tracer OBC data arrays' )   ;   RETURN 
     251                  ENDIF 
     252                  trcdta_bdy(jn,ib)%trc => sf_trcobc(jl)%fnow(:,1,:) 
     253                  trcdta_bdy(jn,ib)%rn_fac = rf_trofac(jl) 
     254                  ! create OBC mapping array 
     255                  nbmap_ptr(jl)%ptr => idx_bdy(ib)%nbmap(:,igrd) 
     256                  nbmap_ptr(jl)%ll_unstruc = ln_coords_file(igrd) 
     257               ELSE 
     258               ! Initialise obc arrays from initial conditions 
     259                  ALLOCATE ( trcdta_bdy(jn,ib)%trc(nblen,jpk) ) 
     260                  DO ibd = 1, nblen 
     261                     DO ik = 1, jpkm1 
     262                        ii = idx_bdy(ib)%nbi(ibd,igrd) 
     263                        ij = idx_bdy(ib)%nbj(ibd,igrd) 
     264                        trcdta_bdy(jn,ib)%trc(ibd,ik) = trn(ii,ij,ik,jn) * tmask(ii,ij,ik) 
     265                     END DO 
     266                  END DO 
     267                  trcdta_bdy(jn,ib)%rn_fac = 1._wp 
    186268               ENDIF 
    187             ENDIF 
    188             !    
     269            ENDDO 
    189270         ENDDO 
    190          !                         ! fill sf_trcdta with slf_i and control print 
    191          CALL fld_fill( sf_trcobc, slf_i, cn_dir, 'trc_bc_init', 'Passive tracer OBC data', 'namtrc_bc' ) 
    192          ! 
    193       ENDIF 
    194       ! 
     271 
     272         CALL fld_fill( sf_trcobc, slf_i, cn_dir_obc, 'trc_bc_init', 'Passive tracer OBC data', 'namtrc_bc' ) 
     273      ENDIF 
     274#endif 
    195275      ! SURFACE Boundary conditions 
    196276      IF( nb_trcsbc > 0 ) THEN       !  allocate only if the number of tracer to initialise is greater than zero 
     
    214294         ENDDO 
    215295         !                         ! fill sf_trcsbc with slf_i and control print 
    216          CALL fld_fill( sf_trcsbc, slf_i, cn_dir, 'trc_bc_init', 'Passive tracer SBC data', 'namtrc_bc' ) 
     296         CALL fld_fill( sf_trcsbc, slf_i, cn_dir_sbc, 'trc_bc_init', 'Passive tracer SBC data', 'namtrc_bc' ) 
    217297         ! 
    218298      ENDIF 
     
    239319         ENDDO 
    240320         !                         ! fill sf_trccbc with slf_i and control print 
    241          CALL fld_fill( sf_trccbc, slf_i, cn_dir, 'trc_bc_init', 'Passive tracer CBC data', 'namtrc_bc' ) 
     321         CALL fld_fill( sf_trccbc, slf_i, cn_dir_cbc, 'trc_bc_init', 'Passive tracer CBC data', 'namtrc_bc' ) 
    242322         ! 
    243323      ENDIF 
    244   
     324      ! 
    245325      DEALLOCATE( slf_i )          ! deallocate local field structure 
    246326      IF( nn_timing == 1 )  CALL timing_stop('trc_bc_init') 
    247  
     327      ! 
    248328   END SUBROUTINE trc_bc_init 
    249329 
    250330 
    251    SUBROUTINE trc_bc_read(kt) 
     331   SUBROUTINE trc_bc_read(kt, jit) 
    252332      !!---------------------------------------------------------------------- 
    253333      !!                   ***  ROUTINE trc_bc_init  *** 
     
    258338      !!               
    259339      !!---------------------------------------------------------------------- 
    260     
    261       ! NEMO 
    262340      USE fldread 
    263341       
    264342      !! * Arguments 
    265343      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index 
    266  
     344      INTEGER, INTENT( in ), OPTIONAL ::   jit   ! subcycle time-step index (for timesplitting option) 
    267345      !!--------------------------------------------------------------------- 
    268346      ! 
    269347      IF( nn_timing == 1 )  CALL timing_start('trc_bc_read') 
    270348 
    271       IF( kt == nit000 ) THEN 
    272          IF(lwp) WRITE(numout,*) 
    273          IF(lwp) WRITE(numout,*) 'trc_bc_read : Surface boundary conditions for passive tracers.' 
    274          IF(lwp) WRITE(numout,*) '~~~~~~~ ' 
    275       ENDIF 
    276  
    277       ! OPEN boundary conditions: DOES NOT WORK. Waiting for stable BDY 
    278       IF( nb_trcobc > 0 ) THEN 
    279         if (lwp) write(numout,'(a,i5,a,i5)') '   reading OBC data for ', nb_trcobc ,' variables at step ', kt 
    280         CALL fld_read(kt,1,sf_trcobc) 
    281         ! vertical interpolation on s-grid and partial step to be added 
    282       ENDIF 
    283  
    284       ! SURFACE boundary conditions        
    285       IF( nb_trcsbc > 0 ) THEN 
    286         if (lwp) write(numout,'(a,i5,a,i5)') '   reading SBC data for ', nb_trcsbc ,' variables at step ', kt 
    287         CALL fld_read(kt,1,sf_trcsbc) 
    288       ENDIF 
    289  
    290       ! COASTAL boundary conditions        
    291       IF( nb_trccbc > 0 ) THEN 
    292         if (lwp) write(numout,'(a,i5,a,i5)') '   reading CBC data for ', nb_trccbc ,' variables at step ', kt 
    293         CALL fld_read(kt,1,sf_trccbc) 
    294       ENDIF    
     349      IF( kt == nit000 .AND. lwp) THEN 
     350         WRITE(numout,*) 
     351         WRITE(numout,*) 'trc_bc_read : Surface boundary conditions for passive tracers.' 
     352         WRITE(numout,*) '~~~~~~~~~~~ ' 
     353      ENDIF 
     354 
     355      IF ( PRESENT(jit) ) THEN  
     356 
     357         ! OPEN boundary conditions (use time_offset=+1 as they are applied at the end of the step) 
     358         IF( nb_trcobc > 0 ) THEN 
     359           if (lwp) write(numout,'(a,i5,a,i10)') '   reading OBC data for ', nb_trcobc ,' variable(s) at step ', kt 
     360           CALL fld_read(kt=kt, kn_fsbc=1, sd=sf_trcobc, map=nbmap_ptr, kit=jit, kt_offset=+1) 
     361         ENDIF 
     362 
     363         ! SURFACE boundary conditions 
     364         IF( nb_trcsbc > 0 ) THEN 
     365           if (lwp) write(numout,'(a,i5,a,i10)') '   reading SBC data for ', nb_trcsbc ,' variable(s) at step ', kt 
     366           CALL fld_read(kt=kt, kn_fsbc=1, sd=sf_trcsbc, kit=jit) 
     367         ENDIF 
     368 
     369         ! COASTAL boundary conditions 
     370         IF( nb_trccbc > 0 ) THEN 
     371           if (lwp) write(numout,'(a,i5,a,i10)') '   reading CBC data for ', nb_trccbc ,' variable(s) at step ', kt 
     372           CALL fld_read(kt=kt, kn_fsbc=1, sd=sf_trccbc, kit=jit) 
     373         ENDIF 
     374 
     375      ELSE 
     376 
     377         ! OPEN boundary conditions (use time_offset=+1 as they are applied at the end of the step) 
     378         IF( nb_trcobc > 0 ) THEN 
     379           if (lwp) write(numout,'(a,i5,a,i10)') '   reading OBC data for ', nb_trcobc ,' variable(s) at step ', kt 
     380           CALL fld_read(kt=kt, kn_fsbc=1, sd=sf_trcobc, map=nbmap_ptr, kt_offset=+1) 
     381         ENDIF 
     382 
     383         ! SURFACE boundary conditions 
     384         IF( nb_trcsbc > 0 ) THEN 
     385           if (lwp) write(numout,'(a,i5,a,i10)') '   reading SBC data for ', nb_trcsbc ,' variable(s) at step ', kt 
     386           CALL fld_read(kt=kt, kn_fsbc=1, sd=sf_trcsbc) 
     387         ENDIF 
     388 
     389         ! COASTAL boundary conditions 
     390         IF( nb_trccbc > 0 ) THEN 
     391           if (lwp) write(numout,'(a,i5,a,i10)') '   reading CBC data for ', nb_trccbc ,' variable(s) at step ', kt 
     392           CALL fld_read(kt=kt, kn_fsbc=1, sd=sf_trccbc) 
     393         ENDIF 
     394 
     395      ENDIF 
     396 
    295397      ! 
    296398      IF( nn_timing == 1 )  CALL timing_stop('trc_bc_read') 
    297       !        
    298  
     399      ! 
    299400   END SUBROUTINE trc_bc_read 
     401 
    300402#else 
    301403   !!---------------------------------------------------------------------- 
     
    303405   !!---------------------------------------------------------------------- 
    304406CONTAINS 
     407 
     408   SUBROUTINE trc_bc_init( ntrc )        ! Empty routine 
     409      INTEGER,INTENT(IN) :: ntrc                           ! number of tracers 
     410      WRITE(*,*) 'trc_bc_init: You should not have seen this print! error?', kt 
     411   END SUBROUTINE trc_bc_init 
     412 
    305413   SUBROUTINE trc_bc_read( kt )        ! Empty routine 
    306414      WRITE(*,*) 'trc_bc_read: You should not have seen this print! error?', kt 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trcdia.F90

    r4292 r6225  
    5151   INTEGER  ::   nhoritb   !:  id for horizontal mesh 
    5252 
    53    !! * Substitutions 
    54 #  include "top_substitute.h90" 
    5553   !!---------------------------------------------------------------------- 
    5654   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    108106      CHARACTER (len=20) :: cltra, cltrau 
    109107      CHARACTER (len=80) :: cltral 
    110       REAL(wp) :: zsto, zout, zdt 
     108      REAL(wp) :: zsto, zout 
    111109      INTEGER  :: iimi, iima, ijmi, ijma, ipk, it, itmod, iiter 
    112110      !!---------------------------------------------------------------------- 
     
    120118 
    121119      ! Define frequency of output and means 
    122       zdt = rdt 
    123120      IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!) 
    124121      ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time) 
     
    128125      clop = "inst("//TRIM(clop)//")" 
    129126# else 
    130       zsto = zdt 
     127      zsto = rdt 
    131128      clop = "ave("//TRIM(clop)//")" 
    132129# endif 
    133       zout = nn_writetrc * zdt 
     130      zout = nn_writetrc * rdt 
    134131 
    135132      ! Define indices of the horizontal output zoom and vertical limit storage 
     
    184181         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,     & 
    185182            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         &  
    186             &          iiter, zjulian, zdt, nhorit5, nit5 , domain_id=nidom, snc4chunks=snc4set) 
     183            &          iiter, zjulian, rdt, nhorit5, nit5 , domain_id=nidom, snc4chunks=snc4set) 
    187184 
    188185         ! Vertical grid for tracer : gdept 
     
    252249      INTEGER  ::   jl 
    253250      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod, iiter 
    254       REAL(wp) ::   zsto, zout, zdt 
     251      REAL(wp) ::   zsto, zout 
    255252      !!---------------------------------------------------------------------- 
    256253 
     
    263260      ! 
    264261      ! Define frequency of output and means 
    265       zdt = rdt 
    266262      IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!) 
    267263      ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time) 
    268264      ENDIF 
    269265#  if defined key_diainstant 
    270       zsto = nn_writedia * zdt 
     266      zsto = nn_writedia * rdt 
    271267      clop = "inst("//TRIM(clop)//")" 
    272268#  else 
    273       zsto = zdt 
     269      zsto = rdt 
    274270      clop = "ave("//TRIM(clop)//")" 
    275271#  endif 
    276       zout = nn_writedia * zdt 
     272      zout = nn_writedia * rdt 
    277273 
    278274      ! Define indices of the horizontal output zoom and vertical limit storage 
     
    304300         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,             & 
    305301            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         & 
    306             &          iiter, zjulian, zdt, nhoritd, nitd , domain_id=nidom, snc4chunks=snc4set ) 
     302            &          iiter, zjulian, rdt, nhoritd, nitd , domain_id=nidom, snc4chunks=snc4set ) 
    307303 
    308304         ! Vertical grid for 2d and 3d arrays 
     
    389385      INTEGER  ::   ji, jj, jk, jl 
    390386      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod, iiter 
    391       REAL(wp) ::   zsto, zout, zdt 
     387      REAL(wp) ::   zsto, zout 
    392388      !!---------------------------------------------------------------------- 
    393389 
     
    400396 
    401397      ! Define frequency of output and means 
    402       zdt = rdt 
    403398      IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!) 
    404399      ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time) 
    405400      ENDIF 
    406401#        if defined key_diainstant 
    407       zsto = nn_writebio * zdt 
     402      zsto = nn_writebio * rdt 
    408403      clop = "inst("//TRIM(clop)//")" 
    409404#        else 
    410       zsto = zdt 
     405      zsto = rdt 
    411406      clop = "ave("//TRIM(clop)//")" 
    412407#        endif 
    413       zout = nn_writebio * zdt 
     408      zout = nn_writebio * rdt 
    414409 
    415410      ! Define indices of the horizontal output zoom and vertical limit storage 
     
    437432         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,      & 
    438433            &    iimi, iima-iimi+1, ijmi, ijma-ijmi+1,          & 
    439             &    iiter, zjulian, zdt, nhoritb, nitb , domain_id=nidom, snc4chunks=snc4set ) 
     434            &    iiter, zjulian, rdt, nhoritb, nitb , domain_id=nidom, snc4chunks=snc4set ) 
    440435         ! Vertical grid for biological trends 
    441436         CALL histvert(nitb, 'deptht', 'Vertical T levels', 'm', ipk, gdept_1d, ndepitb) 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trcdta.F90

    r4624 r6225  
    99   !!            3.4   !  2010-11  (C. Ethe, G. Madec)  use of fldread + dynamical allocation  
    1010   !!            3.5   !  2013-08  (M. Vichi)  generalization for other BGC models 
    11    !!---------------------------------------------------------------------- 
    12 #if  defined key_top  
     11   !!            3.6   !  2015-03  (T. Lovato) revision of code log info 
     12   !!---------------------------------------------------------------------- 
     13#if defined key_top  
    1314   !!---------------------------------------------------------------------- 
    1415   !!   'key_top'                                                TOP model  
     
    3637   TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trcdta   ! structure of input SST (file informations, fields read) 
    3738!$AGRIF_END_DO_NOT_TREAT 
    38    !! * Substitutions 
    39 #  include "domzgr_substitute.h90" 
     39 
    4040   !!---------------------------------------------------------------------- 
    4141   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
     
    7272      IF( nn_timing == 1 )  CALL timing_start('trc_dta_init') 
    7373      ! 
     74      IF( lwp ) THEN 
     75         WRITE(numout,*) ' ' 
     76         WRITE(numout,*) '  trc_dta_init : Tracers Initial Conditions (IC)' 
     77         WRITE(numout,*) '  ~~~~~~~~~~~ ' 
     78      ENDIF 
     79      ! 
    7480      !  Initialisation 
    7581      ierr0 = 0  ;  ierr1 = 0  ;  ierr2 = 0  ;  ierr3 = 0   
     
    7783      ALLOCATE( n_trc_index(ntrc), slf_i(ntrc), STAT=ierr0 ) 
    7884      IF( ierr0 > 0 ) THEN 
    79          CALL ctl_stop( 'trc_nam: unable to allocate n_trc_index' )   ;   RETURN 
     85         CALL ctl_stop( 'trc_dta_init: unable to allocate n_trc_index' )   ;   RETURN 
    8086      ENDIF 
    8187      nb_trcdta      = 0 
     
    97103      REWIND( numnat_ref )              ! Namelist namtrc_dta in reference namelist : Passive tracer input data 
    98104      READ  ( numnat_ref, namtrc_dta, IOSTAT = ios, ERR = 901) 
    99 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dta in reference namelist', lwp ) 
     105901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dta_init in reference namelist', lwp ) 
    100106 
    101107      REWIND( numnat_cfg )              ! Namelist namtrc_dta in configuration namelist : Passive tracer input data 
    102108      READ  ( numnat_cfg, namtrc_dta, IOSTAT = ios, ERR = 902 ) 
    103 902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dta in configuration namelist', lwp ) 
     109902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dta_init in configuration namelist', lwp ) 
    104110      IF(lwm) WRITE ( numont, namtrc_dta ) 
    105111 
     
    109115               clndta = TRIM( sn_trcdta(jn)%clvar )  
    110116               clntrc = TRIM( ctrcnm   (jn)       )  
     117               if (jn > jptra) clntrc='Dummy' ! By pass weird formats in ocean.output if ntrc > jptra 
    111118               zfact  = rn_trfac(jn) 
    112119               IF( clndta /=  clntrc ) THEN  
    113                   CALL ctl_warn( 'trc_dta_init: passive tracer data initialisation :  ',   & 
    114                   &              'the variable name in the data file : '//clndta//   &  
    115                   &              '  must be the same than the name of the passive tracer : '//clntrc//' ') 
     120                  CALL ctl_warn( 'trc_dta_init: passive tracer data initialisation    ',   & 
     121                  &              'Input name of data file : '//TRIM(clndta)//   & 
     122                  &              ' differs from that of tracer : '//TRIM(clntrc)//' ') 
    116123               ENDIF 
    117                WRITE(numout,*) ' read an initial file for passive tracer number :', jn, ' name : ', clndta, &  
    118                &               ' multiplicative factor : ', zfact 
     124               WRITE(numout,*) ' ' 
     125               WRITE(numout,'(a, i3,3a,e11.3)') ' Read IC file for tracer number :', & 
     126               &            jn, ', name : ', TRIM(clndta), ', Multiplicative Scaling factor : ', zfact 
    119127            ENDIF 
    120128         END DO 
     
    124132         ALLOCATE( sf_trcdta(nb_trcdta), rf_trfac(nb_trcdta), STAT=ierr1 ) 
    125133         IF( ierr1 > 0 ) THEN 
    126             CALL ctl_stop( 'trc_dta_ini: unable to allocate  sf_trcdta structure' )   ;   RETURN 
     134            CALL ctl_stop( 'trc_dta_init: unable to allocate  sf_trcdta structure' )   ;   RETURN 
    127135         ENDIF 
    128136         ! 
     
    135143               IF( sn_trcdta(jn)%ln_tint )  ALLOCATE( sf_trcdta(jl)%fdta(jpi,jpj,jpk,2) , STAT=ierr3 ) 
    136144               IF( ierr2 + ierr3 > 0 ) THEN 
    137                  CALL ctl_stop( 'trc_dta : unable to allocate passive tracer data arrays' )   ;   RETURN 
     145                 CALL ctl_stop( 'trc_dta_init : unable to allocate passive tracer data arrays' )   ;   RETURN 
    138146               ENDIF 
    139147            ENDIF 
     
    141149         ENDDO 
    142150         !                         ! fill sf_trcdta with slf_i and control print 
    143          CALL fld_fill( sf_trcdta, slf_i, cn_dir, 'trc_dta', 'Passive tracer data', 'namtrc' ) 
     151         CALL fld_fill( sf_trcdta, slf_i, cn_dir, 'trc_dta_init', 'Passive tracer data', 'namtrc' ) 
    144152         ! 
    145153      ENDIF 
     
    189197                  DO ji = 1, jpi 
    190198                     DO jk = 1, jpk                        ! determines the intepolated T-S profiles at each (i,j) points 
    191                         zl = fsdept_n(ji,jj,jk) 
     199                        zl = gdept_n(ji,jj,jk) 
    192200                        IF(     zl < gdept_1d(1  ) ) THEN         ! above the first level of data 
    193201                           ztp(jk) =  sf_dta(1)%fnow(ji,jj,1) 
     
    220228                        ik = mbkt(ji,jj)  
    221229                        IF( ik > 1 ) THEN 
    222                            zl = ( gdept_1d(ik) - fsdept_n(ji,jj,ik) ) / ( gdept_1d(ik) - gdept_1d(ik-1) ) 
     230                           zl = ( gdept_1d(ik) - gdept_n(ji,jj,ik) ) / ( gdept_1d(ik) - gdept_1d(ik-1) ) 
    223231                           sf_dta(1)%fnow(ji,jj,ik) = (1.-zl) * sf_dta(1)%fnow(ji,jj,ik) + zl * sf_dta(1)%fnow(ji,jj,ik-1) 
    224232                        ENDIF 
     
    231239         sf_dta(1)%fnow(:,:,:) = sf_dta(1)%fnow(:,:,:) * zrf_trfac   !  multiplicative factor 
    232240         ! 
    233          IF( lwp .AND. kt == nit000 ) THEN 
    234                clndta = TRIM( sf_dta(1)%clvar )  
    235                WRITE(numout,*) ''//clndta//' data ' 
    236                WRITE(numout,*) 
    237                WRITE(numout,*)'  level = 1' 
    238                CALL prihre( sf_dta(1)%fnow(:,:,1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout ) 
    239                WRITE(numout,*)'  level = ', jpk/2 
    240                CALL prihre( sf_dta(1)%fnow(:,:,jpk/2), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout ) 
    241                WRITE(numout,*)'  level = ', jpkm1 
    242                CALL prihre( sf_dta(1)%fnow(:,:,jpkm1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout ) 
    243                WRITE(numout,*) 
    244          ENDIF 
    245241      ENDIF 
    246242      ! 
     
    248244      ! 
    249245   END SUBROUTINE trc_dta 
     246    
    250247#else 
    251248   !!---------------------------------------------------------------------- 
     
    257254   END SUBROUTINE trc_dta 
    258255#endif 
     256 
    259257   !!====================================================================== 
    260258END MODULE trcdta 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trcini.F90

    r4607 r6225  
    1818   USE oce_trc         ! shared variables between ocean and passive tracers 
    1919   USE trc             ! passive tracers common variables 
    20    USE trcrst          ! passive tracers restart 
    2120   USE trcnam          ! Namelist read 
    22    USE trcini_cfc      ! CFC      initialisation 
    23    USE trcini_pisces   ! PISCES   initialisation 
    24    USE trcini_c14b     ! C14 bomb initialisation 
    25    USE trcini_my_trc   ! MY_TRC   initialisation 
    26    USE trcdta          ! initialisation from files 
    2721   USE daymod          ! calendar manager 
    28    USE zpshde          ! partial step: hor. derivative   (zps_hde routine) 
    2922   USE prtctl_trc      ! Print control passive tracers (prt_ctl_trc_init routine) 
    3023   USE trcsub          ! variables to substep passive tracers 
     24   USE trcrst 
    3125   USE lib_mpp         ! distribued memory computing library 
    3226   USE sbc_oce 
     27   USE trcice          ! tracers in sea ice 
     28   USE trcbc,   only : trc_bc_init ! generalized Boundary Conditions 
    3329  
    3430   IMPLICIT NONE 
     
    3733   PUBLIC   trc_init   ! called by opa 
    3834 
    39     !! * Substitutions 
    40 #  include "domzgr_substitute.h90" 
    4135   !!---------------------------------------------------------------------- 
    4236   !! NEMO/TOP 4.0 , NEMO Consortium (2011) 
     
    5852      !!                or read data or analytical formulation 
    5953      !!--------------------------------------------------------------------- 
    60       INTEGER ::   jk, jn, jl    ! dummy loop indices 
    61       CHARACTER (len=25) :: charout 
    62       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 4D  workspace 
    63       !!--------------------------------------------------------------------- 
    6454      ! 
    6555      IF( nn_timing == 1 )   CALL timing_start('trc_init') 
     
    6959      IF(lwp) WRITE(numout,*) '~~~~~~~' 
    7060 
    71       CALL top_alloc()              ! allocate TOP arrays 
    72  
    73 #if defined key_offline 
    74       ltrcdm2dc = .FALSE. 
    75 #endif 
    76  
    77       IF( ltrcdm2dc )CALL ctl_warn( ' Diurnal cycle on physics but not in PISCES or LOBSTER ' ) 
    78  
    79       IF( nn_cla == 1 )   & 
    80          &  CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' ) 
    81  
    82       CALL trc_nam      ! read passive tracers namelists 
     61      ! 
     62      CALL top_alloc()   ! allocate TOP arrays 
     63      ! 
     64      CALL trc_ini_ctl   ! control  
     65      ! 
     66      CALL trc_nam       ! read passive tracers namelists 
    8367      ! 
    8468      IF(lwp) WRITE(numout,*) 
     
    8771      ! 
    8872      IF(lwp) WRITE(numout,*) 
    89                                                               ! masked grid volume 
     73      ! 
     74      CALL trc_ini_sms   ! SMS 
     75      ! 
     76      CALL trc_ini_trp   ! passive tracers transport 
     77      ! 
     78      CALL trc_ice_ini   ! Tracers in sea ice 
     79      ! 
     80      IF( lwp )  & 
     81         &  CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp , narea ) 
     82      ! 
     83      CALL trc_ini_state  !  passive tracers initialisation : from a restart or from clim 
     84      ! 
     85      IF( nn_dttrc /= 1 )        CALL trc_sub_ini      ! Initialize variables for substepping passive tracers 
     86      ! 
     87      CALL trc_ini_inv   ! Inventories 
     88      ! 
     89      IF( nn_timing == 1 )   CALL timing_stop('trc_init') 
     90      ! 
     91   END SUBROUTINE trc_init 
     92 
     93 
     94   SUBROUTINE trc_ini_ctl 
     95      !!---------------------------------------------------------------------- 
     96      !!                     ***  ROUTINE trc_ini_ctl  *** 
     97      !! ** Purpose :        Control  + ocean volume 
     98      !!---------------------------------------------------------------------- 
     99      INTEGER ::   jk    ! dummy loop indices 
     100      ! 
     101      ! Define logical parameter ton control dirunal cycle in TOP 
     102      l_trcdm2dc = ln_dm2dc .OR. ( ln_cpl .AND. ncpl_qsr_freq /= 1 ) 
     103      l_trcdm2dc = l_trcdm2dc  .AND. .NOT. lk_offline 
     104      IF( l_trcdm2dc .AND. lwp )   CALL ctl_warn( 'Coupling with passive tracers and used of diurnal cycle.',   & 
     105         &                           'Computation of a daily mean shortwave for some biogeochemical models ' ) 
     106      ! 
     107   END SUBROUTINE trc_ini_ctl 
     108 
     109 
     110   SUBROUTINE trc_ini_inv 
     111      !!---------------------------------------------------------------------- 
     112      !!                     ***  ROUTINE trc_ini_stat  *** 
     113      !! ** Purpose :      passive tracers inventories at initialsation phase 
     114      !!---------------------------------------------------------------------- 
     115      INTEGER ::  jk, jn    ! dummy loop indices 
     116      CHARACTER (len=25) :: charout 
     117      !!---------------------------------------------------------------------- 
    90118      !                                                              ! masked grid volume 
    91119      DO jk = 1, jpk 
    92          cvol(:,:,jk) = e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) 
     120         cvol(:,:,jk) = e1e2t(:,:) * e3t_n(:,:,jk) * tmask(:,:,jk) 
    93121      END DO 
    94       IF( lk_degrad ) cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:)      ! degrad option: reduction by facvol 
     122      IF( lk_degrad )   cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:)    ! degrad option: reduction by facvol 
    95123      !                                                              ! total volume of the ocean  
    96124      areatot = glob_sum( cvol(:,:,:) ) 
    97  
     125      ! 
     126      trai(:) = 0._wp                                                   ! initial content of all tracers 
     127      DO jn = 1, jptra 
     128         trai(jn) = trai(jn) + glob_sum( trn(:,:,:,jn) * cvol(:,:,:)   ) 
     129      END DO 
     130 
     131      IF(lwp) THEN               ! control print 
     132         WRITE(numout,*) 
     133         WRITE(numout,*) 
     134         WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra 
     135         WRITE(numout,*) '          *** Total volume of ocean                = ', areatot 
     136         WRITE(numout,*) '          *** Total inital content of all tracers ' 
     137         WRITE(numout,*) 
     138         DO jn = 1, jptra 
     139            WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), trai(jn) 
     140         ENDDO 
     141         WRITE(numout,*) 
     142      ENDIF 
     143      IF(lwp) WRITE(numout,*) 
     144      IF(ln_ctl) THEN            ! print mean trends (used for debugging) 
     145         CALL prt_ctl_trc_init 
     146         WRITE(charout, FMT="('ini ')") 
     147         CALL prt_ctl_trc_info( charout ) 
     148         CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) 
     149      ENDIF 
     1509000  FORMAT(' tracer nb : ',i2,'      name :',a10,'      initial content :',e18.10) 
     151      ! 
     152   END SUBROUTINE trc_ini_inv 
     153 
     154 
     155   SUBROUTINE trc_ini_sms 
     156      !!---------------------------------------------------------------------- 
     157      !!                     ***  ROUTINE trc_ini_sms  *** 
     158      !! ** Purpose :   SMS initialisation 
     159      !!---------------------------------------------------------------------- 
     160      USE trcini_cfc      ! CFC      initialisation 
     161      USE trcini_pisces   ! PISCES   initialisation 
     162      USE trcini_c14b     ! C14 bomb initialisation 
     163      USE trcini_my_trc   ! MY_TRC   initialisation 
     164      !!---------------------------------------------------------------------- 
    98165      IF( lk_pisces  )       CALL trc_ini_pisces       ! PISCES  bio-model 
    99166      IF( lk_cfc     )       CALL trc_ini_cfc          ! CFC     tracers 
    100167      IF( lk_c14b    )       CALL trc_ini_c14b         ! C14 bomb  tracer 
    101168      IF( lk_my_trc  )       CALL trc_ini_my_trc       ! MY_TRC  tracers 
    102  
    103       IF( lwp ) THEN 
    104          ! 
    105          CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp , narea ) 
    106          ! 
    107       ENDIF 
    108  
     169      ! 
     170   END SUBROUTINE trc_ini_sms 
     171 
     172   SUBROUTINE trc_ini_trp 
     173      !!---------------------------------------------------------------------- 
     174      !!                     ***  ROUTINE trc_ini_trp  *** 
     175      !! 
     176      !! ** Purpose :   Allocate all the dynamic arrays of the OPA modules 
     177      !!---------------------------------------------------------------------- 
     178      USE trcdmp , ONLY:  trc_dmp_ini 
     179      USE trcadv , ONLY:  trc_adv_ini 
     180      USE trcldf , ONLY:  trc_ldf_ini 
     181      USE trczdf , ONLY:  trc_zdf_ini 
     182      USE trcrad , ONLY:  trc_rad_ini 
     183      ! 
     184      INTEGER :: ierr 
     185      !!---------------------------------------------------------------------- 
     186      ! 
     187      IF( ln_trcdmp )  CALL  trc_dmp_ini          ! damping 
     188                       CALL  trc_adv_ini          ! advection 
     189                       CALL  trc_ldf_ini          ! lateral diffusion 
     190                       CALL  trc_zdf_ini          ! vertical diffusion 
     191                       CALL  trc_rad_ini          ! positivity of passive tracers  
     192      ! 
     193   END SUBROUTINE trc_ini_trp 
     194 
     195 
     196   SUBROUTINE trc_ini_state 
     197      !!---------------------------------------------------------------------- 
     198      !!                     ***  ROUTINE trc_ini_state *** 
     199      !! ** Purpose :          Initialisation of passive tracer concentration  
     200      !!---------------------------------------------------------------------- 
     201      USE zpshde          ! partial step: hor. derivative   (zps_hde routine) 
     202      USE trcrst          ! passive tracers restart 
     203      USE trcdta          ! initialisation from files 
     204      ! 
     205      INTEGER ::   jk, jn, jl    ! dummy loop indices 
     206      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 4D  workspace 
     207      !!---------------------------------------------------------------------- 
     208      ! 
     209      ! Initialisation of tracers Initial Conditions 
    109210      IF( ln_trcdta )      CALL trc_dta_init(jptra) 
    110211 
     212      ! Initialisation of tracers Boundary Conditions 
     213      IF( lk_my_trc )     CALL trc_bc_init(jptra) 
    111214 
    112215      IF( ln_rsttr ) THEN 
     
    143246  
    144247      tra(:,:,:,:) = 0._wp 
    145        
    146       IF( ln_zps .AND. .NOT. lk_c1d )   &              ! Partial steps: before horizontal gradient of passive 
    147         &    CALL zps_hde( nit000, jptra, trn, gtru, gtrv )       ! tracers at the bottom ocean level 
    148  
    149       ! 
    150       IF( nn_dttrc /= 1 )        CALL trc_sub_ini      ! Initialize variables for substepping passive tracers 
    151       ! 
    152  
    153       trai(:) = 0._wp                                                   ! initial content of all tracers 
    154       DO jn = 1, jptra 
    155          trai(jn) = trai(jn) + glob_sum( trn(:,:,:,jn) * cvol(:,:,:)   ) 
    156       END DO 
    157  
    158       IF(lwp) THEN               ! control print 
    159          WRITE(numout,*) 
    160          WRITE(numout,*) 
    161          WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra 
    162          WRITE(numout,*) '          *** Total volume of ocean                = ', areatot 
    163          WRITE(numout,*) '          *** Total inital content of all tracers ' 
    164          WRITE(numout,*) 
    165          DO jn = 1, jptra 
    166             WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), trai(jn) 
    167          ENDDO 
    168          WRITE(numout,*) 
    169       ENDIF 
    170       IF(lwp) WRITE(numout,*) 
    171       IF(ln_ctl) THEN            ! print mean trends (used for debugging) 
    172          CALL prt_ctl_trc_init 
    173          WRITE(charout, FMT="('ini ')") 
    174          CALL prt_ctl_trc_info( charout ) 
    175          CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) 
    176       ENDIF 
    177 9000  FORMAT(' tracer nb : ',i2,'      name :',a10,'      initial content :',e18.10) 
    178       ! 
    179       IF( nn_timing == 1 )   CALL timing_stop('trc_init') 
    180       ! 
    181    END SUBROUTINE trc_init 
    182  
     248      !                                                         ! Partial top/bottom cell: GRADh(trn) 
     249   END SUBROUTINE trc_ini_state 
    183250 
    184251   SUBROUTINE top_alloc 
     
    188255      !! ** Purpose :   Allocate all the dynamic arrays of the OPA modules 
    189256      !!---------------------------------------------------------------------- 
    190       USE trcadv        , ONLY:   trc_adv_alloc          ! TOP-related alloc routines... 
    191257      USE trc           , ONLY:   trc_alloc 
    192       USE trcnxt        , ONLY:   trc_nxt_alloc 
    193       USE trczdf        , ONLY:   trc_zdf_alloc 
    194       USE trdmod_trc_oce, ONLY:   trd_mod_trc_oce_alloc 
    195 #if defined key_trdmld_trc  
    196       USE trdmld_trc    , ONLY:   trd_mld_trc_alloc 
     258      USE trdtrc_oce    , ONLY:   trd_trc_oce_alloc 
     259#if defined key_trdmxl_trc  
     260      USE trdmxl_trc    , ONLY:   trd_mxl_trc_alloc 
    197261#endif 
    198262      ! 
     
    200264      !!---------------------------------------------------------------------- 
    201265      ! 
    202       ierr =        trc_adv_alloc()          ! Start of TOP-related alloc routines... 
    203       ierr = ierr + trc_alloc    () 
    204       ierr = ierr + trc_nxt_alloc() 
    205       ierr = ierr + trc_zdf_alloc() 
    206       ierr = ierr + trd_mod_trc_oce_alloc() 
    207 #if defined key_trdmld_trc  
    208       ierr = ierr + trd_mld_trc_alloc() 
     266      ierr =        trc_alloc() 
     267      ierr = ierr + trd_trc_oce_alloc() 
     268#if defined key_trdmxl_trc  
     269      ierr = ierr + trd_mxl_trc_alloc() 
    209270#endif 
    210271      ! 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trcnam.F90

    r4624 r6225  
    2020   USE oce_trc           ! shared variables between ocean and passive tracers 
    2121   USE trc               ! passive tracers common variables 
    22    USE trcnam_trp        ! Transport namelist 
    2322   USE trcnam_pisces     ! PISCES namelist 
    2423   USE trcnam_cfc        ! CFC SMS namelist 
    2524   USE trcnam_c14b       ! C14 SMS namelist 
    2625   USE trcnam_my_trc     ! MY_TRC SMS namelist 
    27    USE trdmod_oce        
    28    USE trdmod_trc_oce 
     26   USE trd_oce        
     27   USE trdtrc_oce 
    2928   USE iom               ! I/O manager 
    3029 
     
    3534   PUBLIC trc_nam      ! called in trcini 
    3635 
    37    !! * Substitutions 
    38 #  include "top_substitute.h90" 
    3936   !!---------------------------------------------------------------------- 
    4037   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    41    !! $Id$  
     38   !! $Id$ 
    4239   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4340   !!---------------------------------------------------------------------- 
    44  
    4541CONTAINS 
    46  
    4742 
    4843   SUBROUTINE trc_nam 
     
    5752      !!--------------------------------------------------------------------- 
    5853      INTEGER  ::   jn                  ! dummy loop indice 
    59       !                                        !   Parameters of the run  
    60       IF( .NOT. lk_offline ) CALL trc_nam_run 
    61        
    62       !                                        !  passive tracer informations 
    63       CALL trc_nam_trc 
    64        
    65       !                                        !   Parameters of additional diagnostics 
    66       CALL trc_nam_dia 
    67  
    68       !                                        !   namelist of transport 
    69       CALL trc_nam_trp 
    70  
    71  
    72       IF( ln_rsttr )                      ln_trcdta = .FALSE.   ! restart : no need of clim data 
    73       ! 
    74       IF( ln_trcdmp .OR. ln_trcdmp_clo )  ln_trcdta = .TRUE.   ! damping : need to have clim data 
    75       ! 
    76       IF( .NOT.ln_trcdta ) THEN 
    77          ln_trc_ini(:) = .FALSE. 
    78       ENDIF 
    79  
    80      IF(lwp) THEN                   ! control print 
     54      !                                   
     55      IF( .NOT.lk_offline )   CALL trc_nam_run     ! Parameters of the run  
     56      !                
     57                              CALL trc_nam_trc     ! passive tracer informations 
     58      !                                         
     59                              CALL trc_nam_dia     ! Parameters of additional diagnostics 
     60      !                                       
     61      ! 
     62      IF( ln_rsttr                     )   ln_trcdta     = .FALSE.   ! restart : no need of clim data 
     63      ! 
     64      IF( ln_trcdmp .OR. ln_trcdmp_clo )   ln_trcdta     = .TRUE.   ! damping : need to have clim data 
     65      ! 
     66      IF( .NOT.ln_trcdta               )   ln_trc_ini(:) = .FALSE. 
     67 
     68      IF(lwp) THEN                   ! control print 
    8169         WRITE(numout,*) 
    8270         WRITE(numout,*) ' Namelist : namtrc' 
     
    11098 
    11199       
    112       rdttrc(:) = rdttra(:) * FLOAT( nn_dttrc )   ! vertical profile of passive tracer time-step 
     100      rdttrc = rdt * FLOAT( nn_dttrc )   ! passive tracer time-step 
    113101   
    114102      IF(lwp) THEN                   ! control print 
    115103        WRITE(numout,*)  
    116         WRITE(numout,*) '    Passive Tracer  time step    rdttrc  = ', rdttrc(1) 
     104        WRITE(numout,*) '    Passive Tracer  time step    rdttrc  = ', rdttrc 
    117105        WRITE(numout,*)  
    118106      ENDIF 
    119107 
    120108 
    121 #if defined key_trdmld_trc || defined key_trdtrc 
     109#if defined key_trdmxl_trc || defined key_trdtrc 
    122110 
    123111         REWIND( numnat_ref )              ! Namelist namtrc_trd in reference namelist : Passive tracer trends 
     
    132120         IF(lwp) THEN 
    133121            WRITE(numout,*) 
    134             WRITE(numout,*) ' trd_mld_trc_init : read namelist namtrc_trd                    ' 
     122            WRITE(numout,*) ' trd_mxl_trc_init : read namelist namtrc_trd                    ' 
    135123            WRITE(numout,*) ' ~~~~~~~~~~~~~~~~                                               ' 
    136124            WRITE(numout,*) '   * frequency of trends diagnostics   nn_trd_trc             = ', nn_trd_trc 
    137125            WRITE(numout,*) '   * control surface type              nn_ctls_trc            = ', nn_ctls_trc 
    138             WRITE(numout,*) '   * restart for ML diagnostics        ln_trdmld_trc_restart  = ', ln_trdmld_trc_restart 
     126            WRITE(numout,*) '   * restart for ML diagnostics        ln_trdmxl_trc_restart  = ', ln_trdmxl_trc_restart 
    139127            WRITE(numout,*) '   * flag to diagnose trends of                                 ' 
    140             WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmld_trc_instant  = ', ln_trdmld_trc_instant 
     128            WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmxl_trc_instant  = ', ln_trdmxl_trc_instant 
    141129            WRITE(numout,*) '   * unit conversion factor            rn_ucf_trc             = ', rn_ucf_trc 
    142130            DO jn = 1, jptra 
     
    147135 
    148136 
     137      ! Call the ice module for tracers 
     138      ! ------------------------------- 
     139                                  CALL trc_nam_ice 
     140 
    149141      ! namelist of SMS 
    150142      ! ---------------       
     
    167159   END SUBROUTINE trc_nam 
    168160 
     161 
    169162   SUBROUTINE trc_nam_run 
    170163      !!--------------------------------------------------------------------- 
     
    175168      !!--------------------------------------------------------------------- 
    176169      NAMELIST/namtrc_run/ nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, ln_top_euler, & 
    177         &                  cn_trcrst_in, cn_trcrst_out 
    178  
     170        &                  cn_trcrst_indir, cn_trcrst_outdir, cn_trcrst_in, cn_trcrst_out 
     171      ! 
    179172      INTEGER  ::   ios                 ! Local integer output status for namelist read 
    180  
    181       !!--------------------------------------------------------------------- 
    182  
    183  
    184       IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists' 
     173      !!--------------------------------------------------------------------- 
     174      ! 
     175      IF(lwp) WRITE(numout,*) 'trc_nam_run : read the passive tracer namelists' 
    185176      IF(lwp) WRITE(numout,*) '~~~~~~~' 
    186177 
     
    216207 
    217208 
     209   SUBROUTINE trc_nam_ice 
     210      !!--------------------------------------------------------------------- 
     211      !!                     ***  ROUTINE trc_nam_ice *** 
     212      !! 
     213      !! ** Purpose :   Read the namelist for the ice effect on tracers 
     214      !! 
     215      !! ** Method  : - 
     216      !! 
     217      !!--------------------------------------------------------------------- 
     218      INTEGER :: jn      ! dummy loop indices 
     219      INTEGER :: ios     ! Local integer output status for namelist read 
     220      ! 
     221      TYPE(TRC_I_NML), DIMENSION(jptra) :: sn_tri_tracer 
     222      !! 
     223      NAMELIST/namtrc_ice/ nn_ice_tr, sn_tri_tracer 
     224      !!--------------------------------------------------------------------- 
     225      ! 
     226      IF(lwp) THEN 
     227         WRITE(numout,*) 
     228         WRITE(numout,*) 'trc_nam_ice : Read the namelist for trc_ice' 
     229         WRITE(numout,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' 
     230      ENDIF 
     231 
     232      IF( nn_timing == 1 )  CALL timing_start('trc_nam_ice') 
     233 
     234      ! 
     235      REWIND( numnat_ref )              ! Namelist namtrc_ice in reference namelist : Passive tracer input data 
     236      READ  ( numnat_ref, namtrc_ice, IOSTAT = ios, ERR = 901) 
     237 901  IF( ios /= 0 ) CALL ctl_nam ( ios , ' namtrc_ice in reference namelist ', lwp ) 
     238 
     239      REWIND( numnat_cfg )              ! Namelist namtrc_ice in configuration namelist : Pisces external sources of nutrients 
     240      READ  ( numnat_cfg, namtrc_ice, IOSTAT = ios, ERR = 902 ) 
     241 902  IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ice in configuration namelist', lwp ) 
     242 
     243      IF( lwp ) THEN 
     244         WRITE(numout,*) ' ' 
     245         WRITE(numout,*) ' Sea ice tracers option (nn_ice_tr) : ', nn_ice_tr 
     246         WRITE(numout,*) ' ' 
     247      ENDIF 
     248 
     249      ! Assign namelist stuff 
     250      DO jn = 1, jptra 
     251         trc_ice_ratio(jn)  = sn_tri_tracer(jn)%trc_ratio 
     252         trc_ice_prescr(jn) = sn_tri_tracer(jn)%trc_prescr 
     253         cn_trc_o      (jn) = sn_tri_tracer(jn)%ctrc_o 
     254      END DO 
     255 
     256      IF( nn_timing == 1 )   CALL timing_stop('trc_nam_ice') 
     257      ! 
     258   END SUBROUTINE trc_nam_ice 
     259 
     260 
    218261   SUBROUTINE trc_nam_trc 
    219262      !!--------------------------------------------------------------------- 
     
    223266      !! 
    224267      !!--------------------------------------------------------------------- 
    225       TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer  ! type of tracer for saving if not key_iomput 
    226       !! 
    227       NAMELIST/namtrc/ sn_tracer, ln_trcdta,ln_trcdmp, ln_trcdmp_clo 
    228    
    229268      INTEGER  ::   ios                 ! Local integer output status for namelist read 
    230269      INTEGER  ::   jn                  ! dummy loop indice 
     270      ! 
     271      TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer  ! type of tracer for saving if not key_iomput 
     272      !! 
     273      NAMELIST/namtrc/ sn_tracer, ln_trcdta, ln_trcdmp, ln_trcdmp_clo 
    231274      !!--------------------------------------------------------------------- 
    232275      IF(lwp) WRITE(numout,*) 
    233       IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists' 
     276      IF(lwp) WRITE(numout,*) 'trc_nam_trc : read the passive tracer namelists' 
    234277      IF(lwp) WRITE(numout,*) '~~~~~~~' 
    235  
    236278 
    237279      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables 
     
    249291         ctrcun    (jn) = TRIM( sn_tracer(jn)%clunit  ) 
    250292         ln_trc_ini(jn) =       sn_tracer(jn)%llinit 
     293#if defined key_my_trc 
     294         ln_trc_sbc(jn) =       sn_tracer(jn)%llsbc 
     295         ln_trc_cbc(jn) =       sn_tracer(jn)%llcbc 
     296         ln_trc_obc(jn) =       sn_tracer(jn)%llobc 
     297#endif 
    251298         ln_trc_wri(jn) =       sn_tracer(jn)%llsave 
    252299      END DO 
    253        
    254     END SUBROUTINE trc_nam_trc 
     300      ! 
     301   END SUBROUTINE trc_nam_trc 
    255302 
    256303 
     
    265312      !!                ( (PISCES, CFC, MY_TRC ) 
    266313      !!--------------------------------------------------------------------- 
     314      INTEGER  ::   ios                 ! Local integer output status for namelist read 
    267315      INTEGER ::  ierr 
    268 #if defined key_trdmld_trc  || defined key_trdtrc 
     316      !! 
     317#if defined key_trdmxl_trc  || defined key_trdtrc 
    269318      NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, & 
    270          &                ln_trdmld_trc_restart, ln_trdmld_trc_instant, & 
     319         &                ln_trdmxl_trc_restart, ln_trdmxl_trc_instant, & 
    271320         &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc 
    272321#endif 
    273322      NAMELIST/namtrc_dia/ ln_diatrc, ln_diabio, nn_writedia, nn_writebio 
    274  
    275       INTEGER  ::   ios                 ! Local integer output status for namelist read 
    276       !!--------------------------------------------------------------------- 
    277  
    278       IF(lwp) WRITE(numout,*)  
    279       IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options' 
    280       IF(lwp) WRITE(numout,*) '~~~~~~~' 
     323      !!--------------------------------------------------------------------- 
    281324 
    282325      IF(lwp) WRITE(numout,*) 
     
    339382   !!---------------------------------------------------------------------- 
    340383   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    341    !! $Id$  
     384   !! $Id$ 
    342385   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    343386   !!====================================================================== 
    344 END MODULE  trcnam 
     387END MODULE trcnam 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trcrst.F90

    r4152 r6225  
    1414   !!---------------------------------------------------------------------- 
    1515   !!---------------------------------------------------------------------- 
    16    !!   trc_rst :   Restart for passive tracer 
    17    !!---------------------------------------------------------------------- 
    18    !!---------------------------------------------------------------------- 
    19    !!   'key_top'                                                TOP models 
    20    !!---------------------------------------------------------------------- 
     16   !!   trc_rst        : Restart for passive tracer 
    2117   !!   trc_rst_opn    : open  restart file 
    2218   !!   trc_rst_read   : read  restart file 
     
    2521   USE oce_trc 
    2622   USE trc 
    27    USE trcnam_trp 
    2823   USE iom 
    2924   USE daymod 
     25    
    3026   IMPLICIT NONE 
    3127   PRIVATE 
     
    3632   PUBLIC   trc_rst_cal 
    3733 
    38    !! * Substitutions 
    39 #  include "top_substitute.h90" 
    40     
     34   !!---------------------------------------------------------------------- 
     35   !! NEMO/TOP 3.7 , NEMO Consortium (2010) 
     36   !! $Id$ 
     37   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
     38   !!---------------------------------------------------------------------- 
    4139CONTAINS 
    4240    
     
    5149      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step define as a character 
    5250      CHARACTER(LEN=50)   ::   clname   ! trc output restart file name 
     51      CHARACTER(LEN=256)  ::   clpath   ! full path to ocean output restart file 
    5352      !!---------------------------------------------------------------------- 
    5453      ! 
     
    5655         IF( kt == nittrc000 ) THEN 
    5756            lrst_trc = .FALSE. 
    58             nitrst = nitend 
    59          ENDIF 
    60  
    61          IF( MOD( kt - 1, nstock ) == 0 ) THEN 
     57            IF( ln_rst_list ) THEN 
     58               nrst_lst = 1 
     59               nitrst = nstocklist( nrst_lst ) 
     60            ELSE 
     61               nitrst = nitend 
     62            ENDIF 
     63         ENDIF 
     64 
     65         IF( .NOT. ln_rst_list .AND. MOD( kt - 1, nstock ) == 0 ) THEN 
    6266            ! we use kt - 1 and not kt - nittrc000 to keep the same periodicity from the beginning of the experiment 
    6367            nitrst = kt + nstock - 1                  ! define the next value of nitrst for restart writing 
     
    7983         IF(lwp) WRITE(numout,*) 
    8084         clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_trcrst_out) 
    81          IF(lwp) WRITE(numout,*) '             open trc restart.output NetCDF file: '//clname 
    82          CALL iom_open( clname, numrtw, ldwrt = .TRUE., kiolib = jprstlib ) 
     85         clpath = TRIM(cn_trcrst_outdir) 
     86         IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
     87         IF(lwp) WRITE(numout,*) & 
     88             '             open trc restart.output NetCDF file: ',TRIM(clpath)//clname 
     89         CALL iom_open( TRIM(clpath)//TRIM(clname), numrtw, ldwrt = .TRUE., kiolib = jprstlib ) 
    8390         lrst_trc = .TRUE. 
    8491      ENDIF 
     
    123130      !!---------------------------------------------------------------------- 
    124131      ! 
    125       CALL iom_rstput( kt, nitrst, numrtw, 'rdttrc1', rdttrc(1) )   ! surface passive tracer time step 
     132      CALL iom_rstput( kt, nitrst, numrtw, 'rdttrc1', rdttrc )   ! passive tracer time step 
    126133      ! prognostic variables  
    127134      ! --------------------  
     
    137144          CALL trc_rst_stat            ! statistics 
    138145          CALL iom_close( numrtw )     ! close the restart file (only at last time step) 
    139 #if ! defined key_trdmld_trc 
     146#if ! defined key_trdmxl_trc 
    140147          lrst_trc = .FALSE. 
    141148#endif 
     149          IF( lk_offline .AND. ln_rst_list ) THEN 
     150             nrst_lst = nrst_lst + 1 
     151             nitrst = nstocklist( nrst_lst ) 
     152          ENDIF 
    142153      ENDIF 
    143154      ! 
     
    187198         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~' 
    188199 
    189          IF ( jprstlib == jprstdimg ) THEN 
    190            ! eventually read netcdf file (monobloc)  for restarting on different number of processors 
    191            ! if {cn_trcrst_in}.nc exists, then set jlibalt to jpnf90  
    192            INQUIRE( FILE = TRIM(cn_trcrst_in)//'.nc', EXIST = llok ) 
    193            IF ( llok ) THEN ; jlibalt = jpnf90  ; ELSE ; jlibalt = jprstlib ; ENDIF 
    194          ENDIF 
    195  
    196          CALL iom_open( cn_trcrst_in, numrtr, kiolib = jlibalt ) 
    197  
    198          CALL iom_get ( numrtr, 'kt', zkt )   ! last time-step of previous run 
    199  
    200          IF(lwp) THEN 
    201             WRITE(numout,*) ' *** Info read in restart : ' 
    202             WRITE(numout,*) '   previous time-step                               : ', NINT( zkt ) 
    203             WRITE(numout,*) ' *** restart option' 
    204             SELECT CASE ( nn_rsttr ) 
    205             CASE ( 0 )   ;   WRITE(numout,*) ' nn_rsttr = 0 : no control of nittrc000' 
    206             CASE ( 1 )   ;   WRITE(numout,*) ' nn_rsttr = 1 : no control the date at nittrc000 (use ndate0 read in the namelist)' 
    207             CASE ( 2 )   ;   WRITE(numout,*) ' nn_rsttr = 2 : calendar parameters read in restart' 
    208             END SELECT 
    209             WRITE(numout,*) 
    210          ENDIF 
    211          ! Control of date  
    212          IF( nittrc000  - NINT( zkt ) /= nn_dttrc .AND.  nn_rsttr /= 0 )                                  & 
    213             &   CALL ctl_stop( ' ===>>>> : problem with nittrc000 for the restart',                 & 
    214             &                  ' verify the restart file or rerun with nn_rsttr = 0 (namelist)' ) 
    215          IF( lk_offline ) THEN      ! set the date in offline mode 
    216             ! Check dynamics and tracer time-step consistency and force Euler restart if changed 
    217             IF( iom_varid( numrtr, 'rdttrc1', ldstop = .FALSE. ) > 0 )   THEN 
    218                CALL iom_get( numrtr, 'rdttrc1', zrdttrc1 ) 
    219                IF( zrdttrc1 /= rdt * nn_dttrc )   neuler = 0 
    220             ENDIF 
    221             !                          ! define ndastp and adatrj 
    222             IF( nn_rsttr == 2 ) THEN 
     200         IF( ln_rsttr ) THEN 
     201            CALL iom_open( TRIM(cn_trcrst_indir)//'/'//cn_trcrst_in, numrtr, kiolib = jlibalt ) 
     202            CALL iom_get ( numrtr, 'kt', zkt )   ! last time-step of previous run 
     203 
     204            IF(lwp) THEN 
     205               WRITE(numout,*) ' *** Info read in restart : ' 
     206               WRITE(numout,*) '   previous time-step                               : ', NINT( zkt ) 
     207               WRITE(numout,*) ' *** restart option' 
     208               SELECT CASE ( nn_rsttr ) 
     209               CASE ( 0 )   ;   WRITE(numout,*) ' nn_rsttr = 0 : no control of nittrc000' 
     210               CASE ( 1 )   ;   WRITE(numout,*) ' nn_rsttr = 1 : no control the date at nittrc000 (use ndate0 read in the namelist)' 
     211               CASE ( 2 )   ;   WRITE(numout,*) ' nn_rsttr = 2 : calendar parameters read in restart' 
     212               END SELECT 
     213               WRITE(numout,*) 
     214            ENDIF 
     215            ! Control of date  
     216            IF( nittrc000  - NINT( zkt ) /= nn_dttrc .AND.  nn_rsttr /= 0 )                                  & 
     217               &   CALL ctl_stop( ' ===>>>> : problem with nittrc000 for the restart',                 & 
     218               &                  ' verify the restart file or rerun with nn_rsttr = 0 (namelist)' ) 
     219         ENDIF 
     220         ! 
     221         IF( lk_offline ) THEN     
     222            !                                          ! set the date in offline mode 
     223            IF( ln_rsttr .AND. nn_rsttr == 2 ) THEN 
    223224               CALL iom_get( numrtr, 'ndastp', zndastp )  
    224225               ndastp = NINT( zndastp ) 
    225226               CALL iom_get( numrtr, 'adatrj', adatrj  ) 
    226             ELSE 
     227             ELSE 
    227228               ndastp = ndate0 - 1     ! ndate0 read in the namelist in dom_nam 
    228                adatrj = ( REAL( nittrc000-1, wp ) * rdttra(1) ) / rday 
     229               adatrj = ( REAL( nittrc000-1, wp ) * rdt ) / rday 
    229230               ! note this is wrong if time step has changed during run 
    230231            ENDIF 
     
    235236              WRITE(numout,*) '   number of elapsed days since the begining of run : ', adatrj 
    236237              WRITE(numout,*) 
     238            ENDIF 
     239            ! 
     240            IF( ln_rsttr )  THEN   ;    neuler = 1 
     241            ELSE                   ;    neuler = 0 
    237242            ENDIF 
    238243            ! 
     
    265270      INTEGER  :: jk, jn 
    266271      REAL(wp) :: ztraf, zmin, zmax, zmean, zdrift 
     272      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zvol 
    267273      !!---------------------------------------------------------------------- 
    268274 
     
    273279      ENDIF 
    274280      ! 
    275       DO jn = 1, jptra 
    276          ztraf = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) 
     281      DO jk = 1, jpk 
     282         zvol(:,:,jk) = e1e2t(:,:) * e3t_a(:,:,jk) * tmask(:,:,jk) 
     283      END DO 
     284      ! 
     285      DO jn = 1, jptra 
     286         ztraf = glob_sum( trn(:,:,:,jn) * zvol(:,:,:) ) 
    277287         zmin  = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 
    278288         zmax  = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 
     
    306316   !!---------------------------------------------------------------------- 
    307317   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    308    !! $Id$  
     318   !! $Id$ 
    309319   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    310320   !!====================================================================== 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trcsms.F90

    r3680 r6225  
    7575 
    7676   !!====================================================================== 
    77 END MODULE  trcsms 
     77END MODULE trcsms 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trcstp.F90

    r4624 r6225  
    1919   USE trcwri 
    2020   USE trcrst 
    21    USE trdmod_trc_oce 
    22    USE trdmld_trc 
     21   USE trdtrc_oce 
     22   USE trdmxl_trc 
    2323   USE iom 
    2424   USE in_out_manager 
     
    3030   PUBLIC   trc_stp    ! called by step 
    3131 
    32    !! * Substitutions 
    33 #  include "domzgr_substitute.h90" 
     32   REAL(wp), DIMENSION(:,:,:), SAVE, ALLOCATABLE ::   qsr_arr ! save qsr during TOP time-step 
     33   REAL(wp) :: rdt_sampl 
     34   INTEGER  :: nb_rec_per_days 
     35   INTEGER  :: isecfst, iseclast 
     36   LOGICAL  :: llnew 
     37 
    3438   !!---------------------------------------------------------------------- 
    3539   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    5458      CHARACTER (len=25)    ::  charout  
    5559 
    56       REAL(wp), DIMENSION(:,:), POINTER ::   zqsr_tmp ! save qsr during TOP time-step 
    5760      !!------------------------------------------------------------------- 
    5861      ! 
    5962      IF( nn_timing == 1 )   CALL timing_start('trc_stp') 
    6063      ! 
    61       IF( kt == nittrc000 .AND. lk_trdmld_trc )  CALL trd_mld_trc_init    ! trends: Mixed-layer 
     64      IF( kt == nittrc000 .AND. lk_trdmxl_trc )  CALL trd_mxl_trc_init    ! trends: Mixed-layer 
    6265      ! 
    63       IF( lk_vvl ) THEN                                                   ! update ocean volume due to ssh temporal evolution 
     66      IF( .NOT.ln_linssh ) THEN                                           ! update ocean volume due to ssh temporal evolution 
    6467         DO jk = 1, jpk 
    65             cvol(:,:,jk) = e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) 
     68            cvol(:,:,jk) = e1e2t(:,:) * e3t_n(:,:,jk) * tmask(:,:,jk) 
    6669         END DO 
    6770         IF( lk_degrad )  cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:)       ! degrad option: reduction by facvol 
    6871         areatot         = glob_sum( cvol(:,:,:) ) 
    6972      ENDIF 
    70       !     
    71       IF( ltrcdm2dc ) THEN 
    72          ! When Diurnal cycle, core bulk and LIM2  are activated, put daily mean qsr in qsr for TOP/biogeochemistery time-step 
    73          ! and save qsr with diurnal cycle in qsr_tmp 
    74          CALL wrk_alloc( jpi,jpj, zqsr_tmp ) 
    75          zqsr_tmp(:,:) = qsr     (:,:) 
    76          qsr     (:,:) = qsr_mean(:,:)     
    77       ENDIF 
     73      ! 
     74      IF( l_trcdm2dc )   CALL trc_mean_qsr( kt ) 
    7875      !     
    7976      IF( nn_dttrc /= 1 )   CALL trc_sub_stp( kt )  ! averaging physical variables for sub-stepping 
     
    10097         ENDIF 
    10198         IF( lrst_trc )            CALL trc_rst_wri  ( kt )       ! write tracer restart file 
    102          IF( lk_trdmld_trc  )      CALL trd_mld_trc  ( kt )       ! trends: Mixed-layer 
     99         IF( lk_trdmxl_trc  )      CALL trd_mxl_trc  ( kt )       ! trends: Mixed-layer 
    103100         ! 
    104101         IF( nn_dttrc /= 1   )     CALL trc_sub_reset( kt )       ! resetting physical variables when sub-stepping 
    105102         ! 
    106       ENDIF 
    107       ! 
    108       IF( ltrcdm2dc ) THEN 
    109          ! put back qsr with diurnal cycle in qsr 
    110          qsr(:,:) = zqsr_tmp(:,:) 
    111          CALL wrk_dealloc( jpi,jpj, zqsr_tmp ) 
    112103      ENDIF 
    113104      ! 
     
    123114   END SUBROUTINE trc_stp 
    124115 
     116 
     117   SUBROUTINE trc_mean_qsr( kt ) 
     118      !!---------------------------------------------------------------------- 
     119      !!             ***  ROUTINE trc_mean_qsr  *** 
     120      !! 
     121      !! ** Purpose :  Compute daily mean qsr for biogeochemical model in case 
     122      !!               of diurnal cycle 
     123      !! 
     124      !! ** Method  : store in TOP the qsr every hour ( or every time-step the latter  
     125      !!              is greater than 1 hour ) and then, compute the  mean with  
     126      !!              a moving average over 24 hours.  
     127      !!              In coupled mode, the sampling is done at every coupling frequency  
     128      !!---------------------------------------------------------------------- 
     129      INTEGER, INTENT(in) ::   kt 
     130      INTEGER  :: jn 
     131      !!---------------------------------------------------------------------- 
     132      ! 
     133      IF( kt == nittrc000 ) THEN 
     134         IF( ln_cpl )  THEN   
     135            rdt_sampl = 86400. / ncpl_qsr_freq 
     136            nb_rec_per_days = ncpl_qsr_freq 
     137         ELSE   
     138            rdt_sampl = MAX( 3600., rdt * nn_dttrc ) 
     139            nb_rec_per_days = INT( 86400 / rdt_sampl ) 
     140         ENDIF 
     141         ! 
     142         IF( lwp ) THEN 
     143            WRITE(numout,*)  
     144            WRITE(numout,*) ' Sampling frequency dt = ', rdt_sampl, 's','   Number of sampling per day  nrec = ', nb_rec_per_days 
     145            WRITE(numout,*)  
     146         ENDIF 
     147         ! 
     148         ALLOCATE( qsr_arr(jpi,jpj,nb_rec_per_days ) ) 
     149         DO jn = 1, nb_rec_per_days 
     150            qsr_arr(:,:,jn) = qsr(:,:) 
     151         ENDDO 
     152         qsr_mean(:,:) = qsr(:,:) 
     153         ! 
     154         isecfst  = nsec_year + nsec1jan000   !   number of seconds between Jan. 1st 00h of nit000 year and the middle of time step 
     155         iseclast = isecfst 
     156         ! 
     157      ENDIF 
     158      ! 
     159      iseclast = nsec_year + nsec1jan000 
     160      llnew   = ( iseclast - isecfst )  > INT( rdt_sampl )   !   new shortwave to store 
     161      IF( kt /= nittrc000 .AND. llnew ) THEN 
     162          IF( lwp ) WRITE(numout,*) ' New shortwave to sample for TOP at time kt = ', kt, & 
     163             &                      ' time = ', (iseclast+rdt*nn_dttrc/2.)/3600.,'hours ' 
     164          isecfst = iseclast 
     165          DO jn = 1, nb_rec_per_days - 1 
     166             qsr_arr(:,:,jn) = qsr_arr(:,:,jn+1) 
     167          END DO 
     168          qsr_arr (:,:,nb_rec_per_days) = qsr(:,:) 
     169          qsr_mean(:,:                ) = SUM( qsr_arr(:,:,:), 3 ) / nb_rec_per_days 
     170      ENDIF 
     171      ! 
     172   END SUBROUTINE trc_mean_qsr 
     173 
    125174#else 
    126175   !!---------------------------------------------------------------------- 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trcsub.F90

    • Property svn:keywords set to Id
    r4611 r6225  
    2525   USE zdf_oce 
    2626   USE domvvl 
    27    USE divcur          ! hor. divergence and curl      (div & cur routines) 
     27   USE divhor          ! horizontal divergence            (div_hor routine) 
    2828   USE sbcrnf, ONLY: h_rnf, nk_rnf   ! River runoff  
    2929   USE bdy_oce 
     
    4040   PUBLIC   trc_sub_ssh      ! called by trc_stp to reset physics variables 
    4141 
    42    !!* Module variables 
    4342   REAL(wp)  :: r1_ndttrc     !    1 /  nn_dttrc  
    4443   REAL(wp)  :: r1_ndttrcp1   !    1 / (nn_dttrc+1)  
    4544 
    46    !!* Substitution 
    47 #  include "top_substitute.h90" 
     45   !                                                       !* iso-neutral slopes (if l_ldfslp=T) 
     46   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  uslp_temp, vslp_temp, wslpi_temp, wslpj_temp   !: hold current values  
     47   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  uslp_tm  , vslp_tm  , wslpi_tm  , wslpj_tm     !: time mean  
     48 
    4849   !!---------------------------------------------------------------------- 
    4950   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    50    !! $Id: trcstp.F90 2528 2010-12-27 17:33:53Z rblod $  
     51   !! $Id$  
    5152   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    5253   !!---------------------------------------------------------------------- 
     
    8485       IF( MOD( kt , nn_dttrc ) /= 0 ) THEN 
    8586          ! 
    86           un_tm   (:,:,:)        = un_tm   (:,:,:)        + un   (:,:,:)        * fse3u(:,:,:)  
    87           vn_tm   (:,:,:)        = vn_tm   (:,:,:)        + vn   (:,:,:)        * fse3v(:,:,:)  
    88           tsn_tm  (:,:,:,jp_tem) = tsn_tm  (:,:,:,jp_tem) + tsn  (:,:,:,jp_tem) * fse3t(:,:,:)   
    89           tsn_tm  (:,:,:,jp_sal) = tsn_tm  (:,:,:,jp_sal) + tsn  (:,:,:,jp_sal) * fse3t(:,:,:)   
    90           rhop_tm (:,:,:)        = rhop_tm (:,:,:)        + rhop (:,:,:)        * fse3t(:,:,:)   
    91           avt_tm  (:,:,:)        = avt_tm  (:,:,:)        + avt  (:,:,:)        * fse3w(:,:,:)   
    92 # if defined key_zdfddm 
    93           avs_tm  (:,:,:)        = avs_tm  (:,:,:)        + avs  (:,:,:)        * fse3w(:,:,:)   
    94 # endif 
    95 #if defined key_ldfslp 
    96           wslpi_tm(:,:,:)        = wslpi_tm(:,:,:)        + wslpi(:,:,:) 
    97           wslpj_tm(:,:,:)        = wslpj_tm(:,:,:)        + wslpj(:,:,:) 
    98           uslp_tm (:,:,:)        = uslp_tm (:,:,:)        + uslp (:,:,:) 
    99           vslp_tm (:,:,:)        = vslp_tm (:,:,:)        + vslp (:,:,:) 
    100 #endif 
     87          un_tm   (:,:,:)        = un_tm   (:,:,:)        + un   (:,:,:)        * e3u_n(:,:,:)  
     88          vn_tm   (:,:,:)        = vn_tm   (:,:,:)        + vn   (:,:,:)        * e3v_n(:,:,:)  
     89          tsn_tm  (:,:,:,jp_tem) = tsn_tm  (:,:,:,jp_tem) + tsn  (:,:,:,jp_tem) * e3t_n(:,:,:)   
     90          tsn_tm  (:,:,:,jp_sal) = tsn_tm  (:,:,:,jp_sal) + tsn  (:,:,:,jp_sal) * e3t_n(:,:,:)   
     91          rhop_tm (:,:,:)        = rhop_tm (:,:,:)        + rhop (:,:,:)        * e3t_n(:,:,:)   
     92          avt_tm  (:,:,:)        = avt_tm  (:,:,:)        + avt  (:,:,:)        * e3w_n(:,:,:)   
     93# if defined key_zdfddm 
     94          avs_tm  (:,:,:)        = avs_tm  (:,:,:)        + avs  (:,:,:)        * e3w_n(:,:,:)   
     95# endif 
     96         IF( l_ldfslp ) THEN 
     97            uslp_tm (:,:,:)      = uslp_tm (:,:,:)        + uslp (:,:,:) 
     98            vslp_tm (:,:,:)      = vslp_tm (:,:,:)        + vslp (:,:,:) 
     99            wslpi_tm(:,:,:)      = wslpi_tm(:,:,:)        + wslpi(:,:,:) 
     100            wslpj_tm(:,:,:)      = wslpj_tm(:,:,:)        + wslpj(:,:,:) 
     101         ENDIF 
    101102# if defined key_trabbl 
    102103          IF( nn_bbl_ldf == 1 ) THEN 
     
    131132         avs_temp   (:,:,:)      = avs   (:,:,:) 
    132133# endif 
    133 #if defined key_ldfslp 
    134          wslpi_temp (:,:,:)      = wslpi (:,:,:) 
    135          wslpj_temp (:,:,:)      = wslpj (:,:,:) 
    136          uslp_temp  (:,:,:)      = uslp  (:,:,:) 
    137          vslp_temp  (:,:,:)      = vslp  (:,:,:) 
    138 #endif 
     134         IF( l_ldfslp ) THEN 
     135            uslp_temp  (:,:,:)   = uslp  (:,:,:)   ;   wslpi_temp (:,:,:)   = wslpi (:,:,:) 
     136            vslp_temp  (:,:,:)   = vslp  (:,:,:)   ;   wslpj_temp (:,:,:)   = wslpj (:,:,:) 
     137         ENDIF 
    139138# if defined key_trabbl 
    140139          IF( nn_bbl_ldf == 1 ) THEN 
     
    160159         wndm_temp  (:,:)        = wndm  (:,:) 
    161160         !                                    !  Variables reset in trc_sub_ssh 
    162          rotn_temp  (:,:,:)      = rotn  (:,:,:) 
    163161         hdivn_temp (:,:,:)      = hdivn (:,:,:) 
    164          rotb_temp  (:,:,:)      = rotb  (:,:,:) 
    165          hdivb_temp (:,:,:)      = hdivb (:,:,:) 
    166162         ! 
    167163         ! 2. Create averages and reassign variables 
    168          un_tm    (:,:,:)        = un_tm   (:,:,:)        + un   (:,:,:)        * fse3u(:,:,:)  
    169          vn_tm    (:,:,:)        = vn_tm   (:,:,:)        + vn   (:,:,:)        * fse3v(:,:,:)  
    170          tsn_tm   (:,:,:,jp_tem) = tsn_tm  (:,:,:,jp_tem) + tsn  (:,:,:,jp_tem) * fse3t(:,:,:)   
    171          tsn_tm   (:,:,:,jp_sal) = tsn_tm  (:,:,:,jp_sal) + tsn  (:,:,:,jp_sal) * fse3t(:,:,:)   
    172          rhop_tm (:,:,:)         = rhop_tm (:,:,:)        + rhop (:,:,:)        * fse3t(:,:,:)   
    173          avt_tm   (:,:,:)        = avt_tm  (:,:,:)        + avt  (:,:,:)        * fse3w(:,:,:)   
    174 # if defined key_zdfddm 
    175          avs_tm   (:,:,:)        = avs_tm  (:,:,:)        + avs  (:,:,:)        * fse3w(:,:,:)   
    176 # endif 
    177 #if defined key_ldfslp 
    178          wslpi_tm (:,:,:)        = wslpi_tm(:,:,:)        + wslpi(:,:,:)  
    179          wslpj_tm (:,:,:)        = wslpj_tm(:,:,:)        + wslpj(:,:,:)  
    180          uslp_tm  (:,:,:)        = uslp_tm (:,:,:)        + uslp (:,:,:)  
    181          vslp_tm  (:,:,:)        = vslp_tm (:,:,:)        + vslp (:,:,:) 
    182 #endif 
     164         un_tm    (:,:,:)        = un_tm   (:,:,:)        + un   (:,:,:)        * e3u_n(:,:,:)  
     165         vn_tm    (:,:,:)        = vn_tm   (:,:,:)        + vn   (:,:,:)        * e3v_n(:,:,:)  
     166         tsn_tm   (:,:,:,jp_tem) = tsn_tm  (:,:,:,jp_tem) + tsn  (:,:,:,jp_tem) * e3t_n(:,:,:)   
     167         tsn_tm   (:,:,:,jp_sal) = tsn_tm  (:,:,:,jp_sal) + tsn  (:,:,:,jp_sal) * e3t_n(:,:,:)   
     168         rhop_tm (:,:,:)         = rhop_tm (:,:,:)        + rhop (:,:,:)        * e3t_n(:,:,:)   
     169         avt_tm   (:,:,:)        = avt_tm  (:,:,:)        + avt  (:,:,:)        * e3w_n(:,:,:)   
     170# if defined key_zdfddm 
     171         avs_tm   (:,:,:)        = avs_tm  (:,:,:)        + avs  (:,:,:)        * e3w_n(:,:,:)   
     172# endif 
     173         IF( l_ldfslp ) THEN 
     174            uslp_tm  (:,:,:)     = uslp_tm (:,:,:)        + uslp (:,:,:)  
     175            vslp_tm  (:,:,:)     = vslp_tm (:,:,:)        + vslp (:,:,:) 
     176            wslpi_tm (:,:,:)     = wslpi_tm(:,:,:)        + wslpi(:,:,:)  
     177            wslpj_tm (:,:,:)     = wslpj_tm(:,:,:)        + wslpj(:,:,:)  
     178         ENDIF 
    183179# if defined key_trabbl 
    184180          IF( nn_bbl_ldf == 1 ) THEN 
     
    245241            DO jj = 1, jpj 
    246242               DO ji = 1, jpi 
    247                   z1_ne3t = r1_ndttrcp1  / fse3t(ji,jj,jk) 
    248                   z1_ne3u = r1_ndttrcp1  / fse3u(ji,jj,jk) 
    249                   z1_ne3v = r1_ndttrcp1  / fse3v(ji,jj,jk) 
    250                   z1_ne3w = r1_ndttrcp1  / fse3w(ji,jj,jk) 
     243                  z1_ne3t = r1_ndttrcp1  / e3t_n(ji,jj,jk) 
     244                  z1_ne3u = r1_ndttrcp1  / e3u_n(ji,jj,jk) 
     245                  z1_ne3v = r1_ndttrcp1  / e3v_n(ji,jj,jk) 
     246                  z1_ne3w = r1_ndttrcp1  / e3w_n(ji,jj,jk) 
    251247                  ! 
    252248                  un   (ji,jj,jk)        = un_tm   (ji,jj,jk)        * z1_ne3u 
     
    255251                  tsn  (ji,jj,jk,jp_sal) = tsn_tm  (ji,jj,jk,jp_sal) * z1_ne3t 
    256252                  rhop (ji,jj,jk)        = rhop_tm (ji,jj,jk)        * z1_ne3t 
     253!!gm : BUG? ==>> for avt & avs I don't understand the division by e3w 
    257254                  avt  (ji,jj,jk)        = avt_tm  (ji,jj,jk)        * z1_ne3w 
    258255# if defined key_zdfddm 
    259256                  avs  (ji,jj,jk)        = avs_tm  (ji,jj,jk)        * z1_ne3w 
    260257# endif 
    261 #if defined key_ldfslp 
    262                   wslpi(ji,jj,jk)        = wslpi_tm(ji,jj,jk)  
    263                   wslpj(ji,jj,jk)        = wslpj_tm(ji,jj,jk) 
    264                   uslp (ji,jj,jk)        = uslp_tm (ji,jj,jk) 
    265                   vslp (ji,jj,jk)        = vslp_tm (ji,jj,jk) 
    266 #endif 
    267                ENDDO 
    268             ENDDO 
    269          ENDDO 
     258               END DO 
     259            END DO 
     260         END DO 
     261         IF( l_ldfslp ) THEN 
     262            wslpi(:,:,:)        = wslpi_tm(:,:,:)  
     263            wslpj(:,:,:)        = wslpj_tm(:,:,:) 
     264            uslp (:,:,:)        = uslp_tm (:,:,:) 
     265            vslp (:,:,:)        = vslp_tm (:,:,:) 
     266         ENDIF 
    270267         ! 
    271268         CALL trc_sub_ssh( kt )         ! after ssh & vertical velocity 
     
    276273      ! 
    277274   END SUBROUTINE trc_sub_stp 
     275 
    278276 
    279277   SUBROUTINE trc_sub_ini 
     
    299297      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'top_sub_alloc : unable to allocate standard ocean arrays' ) 
    300298 
    301       un_tm   (:,:,:)        = un   (:,:,:)        * fse3u(:,:,:)  
    302       vn_tm   (:,:,:)        = vn   (:,:,:)        * fse3v(:,:,:)  
    303       tsn_tm  (:,:,:,jp_tem) = tsn  (:,:,:,jp_tem) * fse3t(:,:,:)   
    304       tsn_tm  (:,:,:,jp_sal) = tsn  (:,:,:,jp_sal) * fse3t(:,:,:)   
    305       rhop_tm (:,:,:)        = rhop (:,:,:)        * fse3t(:,:,:)   
    306       avt_tm  (:,:,:)        = avt  (:,:,:)        * fse3w(:,:,:)   
    307 # if defined key_zdfddm 
    308       avs_tm  (:,:,:)        = avs  (:,:,:)        * fse3w(:,:,:)   
    309 # endif 
    310 #if defined key_ldfslp 
    311       wslpi_tm(:,:,:)        = wslpi(:,:,:) 
    312       wslpj_tm(:,:,:)        = wslpj(:,:,:) 
    313       uslp_tm (:,:,:)        = uslp (:,:,:) 
    314       vslp_tm (:,:,:)        = vslp (:,:,:) 
    315 #endif 
     299      un_tm   (:,:,:)        = un   (:,:,:)        * e3u_n(:,:,:)  
     300      vn_tm   (:,:,:)        = vn   (:,:,:)        * e3v_n(:,:,:)  
     301      tsn_tm  (:,:,:,jp_tem) = tsn  (:,:,:,jp_tem) * e3t_n(:,:,:)   
     302      tsn_tm  (:,:,:,jp_sal) = tsn  (:,:,:,jp_sal) * e3t_n(:,:,:)   
     303      rhop_tm (:,:,:)        = rhop (:,:,:)        * e3t_n(:,:,:)   
     304!!gm : BUG? ==>> for avt & avs I don't understand the division by e3w 
     305      avt_tm  (:,:,:)        = avt  (:,:,:)        * e3w_n(:,:,:)   
     306# if defined key_zdfddm 
     307      avs_tm  (:,:,:)        = avs  (:,:,:)        * e3w_n(:,:,:)   
     308# endif 
     309      IF( l_ldfslp ) THEN 
     310         wslpi_tm(:,:,:)     = wslpi(:,:,:) 
     311         wslpj_tm(:,:,:)     = wslpj(:,:,:) 
     312         uslp_tm (:,:,:)     = uslp (:,:,:) 
     313         vslp_tm (:,:,:)     = vslp (:,:,:) 
     314      ENDIF 
    316315      sshn_tm  (:,:) = sshn  (:,:)  
    317316      rnf_tm   (:,:) = rnf   (:,:)  
     
    365364      avs   (:,:,:)   =  avs_temp   (:,:,:) 
    366365# endif 
    367 #if defined key_ldfslp 
    368       wslpi (:,:,:)   =  wslpi_temp (:,:,:) 
    369       wslpj (:,:,:)   =  wslpj_temp (:,:,:) 
    370       uslp  (:,:,:)   =  uslp_temp  (:,:,:) 
    371       vslp  (:,:,:)   =  vslp_temp  (:,:,:) 
    372 #endif 
     366      IF( l_ldfslp ) THEN 
     367         wslpi (:,:,:)=  wslpi_temp (:,:,:) 
     368         wslpj (:,:,:)=  wslpj_temp (:,:,:) 
     369         uslp  (:,:,:)=  uslp_temp  (:,:,:) 
     370         vslp  (:,:,:)=  vslp_temp  (:,:,:) 
     371      ENDIF 
    373372      sshn  (:,:)     =  sshn_temp  (:,:) 
    374373      sshb  (:,:)     =  sshb_temp  (:,:) 
     
    396395      ! 
    397396      hdivn (:,:,:)   =  hdivn_temp (:,:,:) 
    398       rotn  (:,:,:)   =  rotn_temp  (:,:,:) 
    399       hdivb (:,:,:)   =  hdivb_temp (:,:,:) 
    400       rotb  (:,:,:)   =  rotb_temp  (:,:,:) 
    401397      !                                       
    402  
    403398      ! Start new averages 
    404          un_tm   (:,:,:)        = un   (:,:,:)        * fse3u(:,:,:)  
    405          vn_tm   (:,:,:)        = vn   (:,:,:)        * fse3v(:,:,:)  
    406          tsn_tm  (:,:,:,jp_tem) = tsn  (:,:,:,jp_tem) * fse3t(:,:,:)   
    407          tsn_tm  (:,:,:,jp_sal) = tsn  (:,:,:,jp_sal) * fse3t(:,:,:)   
    408          rhop_tm (:,:,:)        = rhop (:,:,:)        * fse3t(:,:,:)   
    409          avt_tm  (:,:,:)        = avt  (:,:,:)        * fse3w(:,:,:)   
    410 # if defined key_zdfddm 
    411          avs_tm  (:,:,:)        = avs  (:,:,:)        * fse3w(:,:,:)   
    412 # endif 
    413 #if defined key_ldfslp 
     399         un_tm   (:,:,:)        = un   (:,:,:)        * e3u_n(:,:,:)  
     400         vn_tm   (:,:,:)        = vn   (:,:,:)        * e3v_n(:,:,:)  
     401         tsn_tm  (:,:,:,jp_tem) = tsn  (:,:,:,jp_tem) * e3t_n(:,:,:)   
     402         tsn_tm  (:,:,:,jp_sal) = tsn  (:,:,:,jp_sal) * e3t_n(:,:,:)   
     403         rhop_tm (:,:,:)        = rhop (:,:,:)        * e3t_n(:,:,:)   
     404         avt_tm  (:,:,:)        = avt  (:,:,:)        * e3w_n(:,:,:)   
     405# if defined key_zdfddm 
     406         avs_tm  (:,:,:)        = avs  (:,:,:)        * e3w_n(:,:,:)   
     407# endif 
     408      IF( l_ldfslp ) THEN 
     409         uslp_tm (:,:,:)        = uslp (:,:,:) 
     410         vslp_tm (:,:,:)        = vslp (:,:,:) 
    414411         wslpi_tm(:,:,:)        = wslpi(:,:,:)  
    415412         wslpj_tm(:,:,:)        = wslpj(:,:,:) 
    416          uslp_tm (:,:,:)        = uslp (:,:,:) 
    417          vslp_tm (:,:,:)        = vslp (:,:,:) 
    418 #endif 
     413      ENDIF 
    419414      ! 
    420415      sshb_hold  (:,:) = sshn  (:,:) 
     
    451446      !!                    
    452447      !! ** Purpose :   compute the after ssh (ssha), the now vertical velocity 
    453       !!              and update the now vertical coordinate (lk_vvl=T). 
     448      !!              and update the now vertical coordinate (ln_linssh=F). 
    454449      !! 
    455450      !! ** Method  : - Using the incompressibility hypothesis, the vertical  
     
    460455      !! ** action  :   ssha    : after sea surface height 
    461456      !!                wn      : now vertical velocity 
    462       !!                sshu_a, sshv_a, sshf_a  : after sea surface height (lk_vvl=T) 
     457      !!                sshu_a, sshv_a, sshf_a  : after sea surface height (ln_linssh=F) 
    463458      !! 
    464459      !! Reference  : Leclair, M., and G. Madec, 2009, Ocean Modelling. 
    465460      !!---------------------------------------------------------------------- 
    466       ! 
    467461      INTEGER, INTENT(in) ::   kt   ! time step 
    468462      ! 
     
    475469      ! 
    476470      ! Allocate temporary workspace 
    477       CALL wrk_alloc( jpi, jpj, zhdiv ) 
     471      CALL wrk_alloc( jpi,jpj,  zhdiv ) 
    478472 
    479473      IF( kt == nittrc000 ) THEN 
     
    487481      ENDIF 
    488482      ! 
    489       CALL div_cur( kt )                              ! Horizontal divergence & Relative vorticity 
     483!!gm BUG here !   hdivn will include the runoff divergence at the wrong timestep !!!! 
     484      CALL div_hor( kt )                              ! Horizontal divergence & Relative vorticity 
    490485      ! 
    491486      z2dt = 2._wp * rdt                              ! set time step size (Euler/Leapfrog) 
     
    497492      zhdiv(:,:) = 0._wp 
    498493      DO jk = 1, jpkm1                                 ! Horizontal divergence of barotropic transports 
    499         zhdiv(:,:) = zhdiv(:,:) + fse3t(:,:,jk) * hdivn(:,:,jk) 
     494        zhdiv(:,:) = zhdiv(:,:) + e3t_n(:,:,jk) * hdivn(:,:,jk) 
    500495      END DO 
    501496      !                                                ! Sea surface elevation time stepping 
     
    515510#endif 
    516511#endif 
    517  
    518  
     512      ! 
    519513      !                                           !------------------------------! 
    520514      !                                           !     Now Vertical Velocity    ! 
     
    522516      z1_2dt = 1.e0 / z2dt 
    523517      DO jk = jpkm1, 1, -1                             ! integrate from the bottom the hor. divergence 
    524          ! - ML - need 3 lines here because replacement of fse3t by its expression yields too long lines otherwise 
    525          wn(:,:,jk) = wn(:,:,jk+1) -   fse3t_n(:,:,jk) * hdivn(:,:,jk)        & 
    526             &                      - ( fse3t_a(:,:,jk) - fse3t_b(:,:,jk) )    & 
     518         ! - ML - need 3 lines here because replacement of e3t by its expression yields too long lines otherwise 
     519         wn(:,:,jk) = wn(:,:,jk+1) -   e3t_n(:,:,jk) * hdivn(:,:,jk)        & 
     520            &                      - ( e3t_a(:,:,jk) - e3t_b(:,:,jk) )    & 
    527521            &                         * tmask(:,:,jk) * z1_2dt 
    528522#if defined key_bdy 
     
    530524#endif 
    531525      END DO 
    532  
    533       ! 
    534       CALL wrk_dealloc( jpi, jpj, zhdiv ) 
     526      ! 
     527      CALL wrk_dealloc( jpi,jpj,   zhdiv ) 
    535528      ! 
    536529      IF( nn_timing == 1 )  CALL timing_stop('trc_sub_ssh') 
    537530      ! 
    538531   END SUBROUTINE trc_sub_ssh 
     532 
    539533 
    540534   INTEGER FUNCTION trc_sub_alloc() 
     
    551545         &      sshn_temp(jpi,jpj)          ,  sshb_temp(jpi,jpj) ,      & 
    552546         &      ssha_temp(jpi,jpj)          ,                           & 
    553 #if defined key_ldfslp 
    554          &      wslpi_temp(jpi,jpj,jpk)     ,  wslpj_temp(jpi,jpj,jpk),  & 
    555          &      uslp_temp(jpi,jpj,jpk)      ,  vslp_temp(jpi,jpj,jpk),   & 
    556 #endif 
    557547#if defined key_trabbl 
    558548         &      ahu_bbl_temp(jpi,jpj)       ,  ahv_bbl_temp(jpi,jpj),    & 
     
    569559# endif 
    570560         &      hdivn_temp(jpi,jpj,jpk)     ,  hdivb_temp(jpi,jpj,jpk),  & 
    571          &      rotn_temp(jpi,jpj,jpk)      ,  rotb_temp(jpi,jpj,jpk),   & 
    572561         &      un_tm(jpi,jpj,jpk)          ,  vn_tm(jpi,jpj,jpk)  ,     & 
    573562         &      avt_tm(jpi,jpj,jpk)                                ,     & 
     
    577566         &      emp_b_hold(jpi,jpj)         ,                            & 
    578567         &      hmld_tm(jpi,jpj)            ,  qsr_tm(jpi,jpj) ,         & 
    579 #if defined key_ldfslp 
    580          &      wslpi_tm(jpi,jpj,jpk)       ,  wslpj_tm(jpi,jpj,jpk),    & 
    581          &      uslp_tm(jpi,jpj,jpk)        ,  vslp_tm(jpi,jpj,jpk),     & 
    582 #endif 
    583568#if defined key_trabbl 
    584569         &      ahu_bbl_tm(jpi,jpj)         ,  ahv_bbl_tm(jpi,jpj),      & 
    585570         &      utr_bbl_tm(jpi,jpj)         ,  vtr_bbl_tm(jpi,jpj),      & 
    586571#endif 
    587          &      rnf_tm(jpi,jpj)             ,  h_rnf_tm(jpi,jpj) ,       & 
    588          &                                    STAT=trc_sub_alloc )   
     572         &      rnf_tm(jpi,jpj)             ,  h_rnf_tm(jpi,jpj) , STAT=trc_sub_alloc )   
     573      ! 
    589574      IF( trc_sub_alloc /= 0 )   CALL ctl_warn('trc_sub_alloc: failed to allocate arrays') 
    590  
     575      ! 
     576      IF( l_ldfslp ) THEN 
     577         ALLOCATE( uslp_temp(jpi,jpj,jpk)   ,  wslpi_temp(jpi,jpj,jpk),      & 
     578            &      vslp_temp(jpi,jpj,jpk)   ,  wslpj_temp(jpi,jpj,jpk),      & 
     579            &      uslp_tm  (jpi,jpj,jpk)   ,  wslpi_tm  (jpi,jpj,jpk),      & 
     580            &      vslp_tm  (jpi,jpj,jpk)   ,  wslpj_tm  (jpi,jpj,jpk),  STAT=trc_sub_alloc ) 
     581      ENDIF 
     582      ! 
     583      IF( trc_sub_alloc /= 0 )   CALL ctl_warn('trc_sub_alloc: failed to allocate ldf_slp arrays') 
    591584      ! 
    592585   END FUNCTION trc_sub_alloc 
     
    603596      WRITE(*,*) 'trc_sub_ini: You should not have seen this print! error?', kt 
    604597   END SUBROUTINE trc_sub_ini 
    605  
    606598#endif 
    607599 
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trcwri.F90

    r3750 r6225  
    2626 
    2727   PUBLIC trc_wri       
    28  
    29    !! * Substitutions 
    30 #  include "top_substitute.h90" 
    3128 
    3229CONTAINS 
Note: See TracChangeset for help on using the changeset viewer.