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 1559 for trunk/NEMO – NEMO

Changeset 1559 for trunk/NEMO


Ignore:
Timestamp:
2009-07-29T16:03:14+02:00 (15 years ago)
Author:
ctlod
Message:

only cosmetic changes

Location:
trunk/NEMO
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/LIM_SRC_2/limthd_2.F90

    r1482 r1559  
    44   !!              LIM thermo ice model : ice thermodynamic 
    55   !!====================================================================== 
    6    !! History :  1.0  !  00-01 (LIM) 
    7    !!            2.0  !  02-07 (C. Ethe, G. Madec) F90 
    8    !!            2.0  !  03-08 (C. Ethe)  add lim_thd_init 
    9    !!             -   !  08-2008  (A. Caubel, G. Madec, E. Maisonnave, S. Masson ) generic coupled interface 
     6   !! History :  1.0  ! 2000-01 (LIM) 
     7   !!            2.0  ! 2002-07 (C. Ethe, G. Madec) F90 
     8   !!            2.0  ! 2003-08 (C. Ethe)  add lim_thd_init 
     9   !!             -   ! 2008-2008  (A. Caubel, G. Madec, E. Maisonnave, S. Masson ) generic coupled interface 
    1010   !!--------------------------------------------------------------------- 
    1111#if defined key_lim2 
     
    4747#  include "vectopt_loop_substitute.h90" 
    4848   !!-------- ------------------------------------------------------------- 
    49    !! NEMO/LIM 2.0,  UCL-LOCEAN-IPSL (2008)  
     49   !! NEMO/LIM 3.2,  UCL-LOCEAN-IPSL (2009)  
    5050   !! $Id$ 
    5151   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     
    8282      REAL(wp) ::   zinda                ! switch for test. the val. of concen. 
    8383      REAL(wp) ::   zindb, zindg         ! switches for test. the val of arg 
     84      REAL(wp) ::   zfricp               ! temporary scalar 
    8485      REAL(wp) ::   za , zh, zthsnice    ! 
    8586      REAL(wp) ::   zfric_u              ! friction velocity  
     
    8788      REAL(wp) ::   zfontn               ! heat flux from snow thickness 
    8889      REAL(wp) ::   zfntlat, zpareff     ! test. the val. of lead heat budget 
    89       REAL(wp) ::   zfi                  ! temporary scalar 
    90       REAL(wp), DIMENSION(jpi,jpj)     ::   ztmp      ! working array 
     90      REAL(wp), DIMENSION(jpi,jpj)     ::   ztmp      ! 2D workspace 
    9191      REAL(wp), DIMENSION(jpi,jpj)     ::   zqlbsbq   ! link with lead energy budget qldif 
    92       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zmsk      ! working array 
     92      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zmsk      ! 3D workspace 
    9393      !!------------------------------------------------------------------- 
    9494 
     
    179179            zindb          = tms(ji,jj) * ( 1.0 - MAX( rzero , SIGN( rone , - zthsnice ) ) )  
    180180            pfrld(ji,jj)   = frld(ji,jj) 
    181             zinda          = 1.0 - MAX( rzero , SIGN( rone , - ( 1.0 - pfrld(ji,jj) ) ) ) 
     181            zfricp         = 1.0 - frld(ji,jj) 
     182            zinda          = 1.0 - MAX( rzero , SIGN( rone , - zfricp ) ) 
    182183             
    183184            !  solar irradiance transmission at the mixed layer bottom and used in the lead heat budget 
     
    192193            !  partial computation of the lead energy budget (qldif) 
    193194#if defined key_coupled  
    194             zfi = 1.0 - pfrld(ji,jj) 
    195195            qldif(ji,jj)   = tms(ji,jj) * rdt_ice                                             & 
    196                &    * (   ( qsr_tot(ji,jj) - qsr_ice(ji,jj,1) * zfi ) * ( 1.0 - thcm(ji,jj) )   & 
    197                &        + ( qns_tot(ji,jj) - qns_ice(ji,jj,1) * zfi )                           & 
     196               &    * (   ( qsr_tot(ji,jj) - qsr_ice(ji,jj,1) * zfricp ) * ( 1.0 - thcm(ji,jj) )   & 
     197               &        + ( qns_tot(ji,jj) - qns_ice(ji,jj,1) * zfricp )                           & 
    198198               &        + frld(ji,jj) * ( fdtcn(ji,jj) + ( 1.0 - zindb ) * fsbbq(ji,jj) )   ) 
    199199#else 
  • trunk/NEMO/OPA_SRC/BDY/bdydyn.F90

    r1502 r1559  
    183183      WRITE(*,*) 'bdy_dyn_frs: You should not have seen this print! error?', kt 
    184184   END SUBROUTINE bdy_dyn_frs 
    185    SUBROUTINE bdy_dyn_fla            ! Empty routine 
    186       WRITE(*,*) 'bdy_dyn_fla: You should not have seen this print! error?' 
     185   SUBROUTINE bdy_dyn_fla( pssh )    ! Empty routine 
     186      REAL :: pssh(:,:) 
     187      WRITE(*,*) 'bdy_dyn_fla: You should not have seen this print! error?', pssh(1,1) 
    187188   END SUBROUTINE bdy_dyn_fla 
    188189#endif 
  • trunk/NEMO/OPA_SRC/DIA/diaptr.F90

    r1413 r1559  
    44   !! Ocean physics:  Computes meridonal transports and zonal means 
    55   !!===================================================================== 
    6    !! History :  9.0  !  03-09  (C. Talandier, G. Madec)  Original code 
    7    !!            9.0  !  06-01  (A. Biastoch)  Allow sub-basins computation 
    8    !!            9.0  !  03-09  (O. Marti) Add fields 
     6   !! History :  1.0  ! 2003-09  (C. Talandier, G. Madec)  Original code 
     7   !!            2.0  ! 2006-01  (A. Biastoch)  Allow sub-basins computation 
     8   !!            3.2  ! 2003-03  (O. Marti, S. Flavoni) Add fields 
    99   !!---------------------------------------------------------------------- 
    1010 
     
    2020   USE oce           ! ocean dynamics and active tracers 
    2121   USE dom_oce       ! ocean space and time domain 
     22   USE daymod        ! calandar 
     23   USE phycst        ! physical constants 
    2224   USE ldftra_oce    ! ocean active tracers: lateral physics 
    23    USE lib_mpp 
    24    USE in_out_manager 
    2525   USE dianam 
    26    USE phycst 
    2726   USE iom 
    2827   USE ioipsl          
    29    USE daymod 
     28   USE in_out_manager 
     29   USE lib_mpp 
    3030 
    3131   IMPLICIT NONE 
     
    4141   PUBLIC   ptr_vjk        ! call by tra_ldf & tra_adv routines 
    4242 
    43 !!! ** init namelist (namptr) 
    44    LOGICAL , PUBLIC                 ::   ln_diaptr = .FALSE.   !: Poleward transport flag (T) or not (F) 
    45    LOGICAL , PUBLIC                 ::   ln_subbas = .FALSE.   !: Atlantic/Pacific/Indian basins calculation 
    46    LOGICAL , PUBLIC                 ::   ln_diaznl = .FALSE.   !: Add zonal means and meridional stream functions 
    47    LOGICAL , PUBLIC                 ::   ln_ptrcomp = .FALSE.  !: Add decomposition : overturning (and gyre, soon ...) 
    48    INTEGER , PUBLIC                 ::   nf_ptr = 15           !: frequency of ptr computation 
    49    INTEGER , PUBLIC                 ::   nf_ptr_wri = 15       !: frequency of ptr outputs 
    50  
    51    REAL(wp), DIMENSION(jpi,jpj), PUBLIC ::   abasin, pbasin, ibasin, dbasin, sbasin !: Sub basin masks 
    52  
    53    REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_adv, pst_adv  !: heat and salt poleward transport: advection 
    54    REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_ove_glo, pst_ove_glo, pht_ove_atl, pst_ove_atl, pht_ove_pac, pst_ove_pac, & 
    55       &        pht_ove_ind, pst_ove_ind, pht_ove_ipc, pst_ove_ipc  !: heat and salt poleward transport: overturning 
    56    REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_ldf, pst_ldf      !: heat and salt poleward transport: lateral diffusion 
     43   !                                           !!** namelist  namptr  ** 
     44   LOGICAL , PUBLIC ::   ln_diaptr  = .FALSE.   !: Poleward transport flag (T) or not (F) 
     45   LOGICAL , PUBLIC ::   ln_subbas  = .FALSE.   !: Atlantic/Pacific/Indian basins calculation 
     46   LOGICAL , PUBLIC ::   ln_diaznl  = .FALSE.   !: Add zonal means and meridional stream functions 
     47   LOGICAL , PUBLIC ::   ln_ptrcomp = .FALSE.   !: Add decomposition : overturning (and gyre, soon ...) 
     48   INTEGER , PUBLIC ::   nf_ptr     = 15        !: frequency of ptr computation 
     49   INTEGER , PUBLIC ::   nf_ptr_wri = 15        !: frequency of ptr outputs 
     50 
     51   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   abasin, pbasin, ibasin, dbasin, sbasin   !: Sub basin masks 
     52 
     53   !                                                               !!! poleward heat and salt transport 
     54   REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_adv    , pst_adv       !: advection 
     55   REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_ldf    , pst_ldf       !: lateral diffusion 
     56   REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_ove_glo, pst_ove_glo   !: global       overturning 
     57   REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_ove_atl, pst_ove_atl   !: Atlantic     overturning 
     58   REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_ove_pac, pst_ove_pac   !: Pacific      overturning 
     59   REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_ove_ind, pst_ove_ind   !: Indian       overturning 
     60   REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_ove_ipc, pst_ove_ipc   !: Indo-Pacific overturning 
     61   REAL(wp), PUBLIC, DIMENSION(jpj) ::   ht_glo, ht_atl, ht_ind, ht_pac, ht_ipc   !: heat 
     62   REAL(wp), PUBLIC, DIMENSION(jpj) ::   st_glo, st_atl, st_ind, st_pac, st_ipc   !: salt 
     63 
     64   INTEGER ::   niter 
     65   INTEGER ::   nidom_ptr 
     66 
     67   REAL(wp), DIMENSION(jpj,jpk) ::   tn_jk_glo  , sn_jk_glo       ! global       i-mean temperature and salinity 
     68   REAL(wp), DIMENSION(jpj,jpk) ::   tn_jk_atl  , sn_jk_atl       ! Atlantic               -              - 
     69   REAL(wp), DIMENSION(jpj,jpk) ::   tn_jk_pac  , sn_jk_pac       ! Pacific                -              - 
     70   REAL(wp), DIMENSION(jpj,jpk) ::   tn_jk_ind  , sn_jk_ind       ! Indian                 -              - 
     71   REAL(wp), DIMENSION(jpj,jpk) ::   tn_jk_ipc  , sn_jk_ipc       ! Indo-Pacific           -              - 
     72   REAL(wp), DIMENSION(jpj,jpk) ::   v_msf_glo                    ! global       "meridional" Stream-Function 
     73   REAL(wp), DIMENSION(jpj,jpk) ::   v_msf_atl                    ! Atlantic               -              - 
     74   REAL(wp), DIMENSION(jpj,jpk) ::   v_msf_pac                    ! Pacific                -              - 
     75   REAL(wp), DIMENSION(jpj,jpk) ::   v_msf_ind                    ! Indian                 -              - 
     76   REAL(wp), DIMENSION(jpj,jpk) ::   v_msf_ipc                    ! Indo-Pacific           -              - 
     77   REAL(wp), DIMENSION(jpj,jpk) ::   surf_jk_glo, surf_jk_r_glo   ! surface of global       i-section and its inverse 
     78   REAL(wp), DIMENSION(jpj,jpk) ::   surf_jk_atl, surf_jk_r_atl   ! surface of Atlantic          -              - 
     79   REAL(wp), DIMENSION(jpj,jpk) ::   surf_jk_pac, surf_jk_r_pac   ! surface of Pacific           -              - 
     80   REAL(wp), DIMENSION(jpj,jpk) ::   surf_jk_ind, surf_jk_r_ind   ! surface of Indian            -              - 
     81   REAL(wp), DIMENSION(jpj,jpk) ::   surf_jk_ipc, surf_jk_r_ipc   ! surface of Indo-Pacific      -              - 
    5782#if defined key_diaeiv 
    58    REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_eiv_glo, pst_eiv_glo, pht_eiv_atl, pst_eiv_atl, pht_eiv_pac, pst_eiv_pac, & 
    59       &        pht_eiv_ind, pst_eiv_ind, pht_eiv_ipc, pst_eiv_ipc !: heat and salt poleward transport: bolus advection 
    60 #endif 
    61    REAL(wp), PUBLIC, DIMENSION(jpj) ::   ht_glo,ht_atl,ht_ind,ht_pac,ht_ipc !: heat 
    62    REAL(wp), PUBLIC, DIMENSION(jpj) ::   st_glo,st_atl,st_ind,st_pac,st_ipc !: salt 
    63  
    64    INTEGER :: niter 
    65    INTEGER :: nidom_ptr 
    66  
    67    REAL(wp), DIMENSION(jpj,jpk) ::   tn_jk_glo, sn_jk_glo,  &  !: "zonal" mean temperature and salinity 
    68       &                              tn_jk_atl, sn_jk_atl,  & 
    69       &                              tn_jk_pac, sn_jk_pac,  & 
    70       &                              tn_jk_ind, sn_jk_ind,  & 
    71       &                              tn_jk_ipc, sn_jk_ipc,  & 
    72       &                              v_msf_glo       ,  &  !: "meridional" Stream-Function 
    73       &                              v_msf_atl       ,  &   
    74       &                              v_msf_pac       ,  &   
    75       &                              v_msf_ind       ,  &   
    76       &                              v_msf_ipc       ,  &   
    77       &                              surf_jk_glo     ,  &  !: Ocean "zonal" section surface 
    78       &                              surf_jk_atl     ,  &   
    79       &                              surf_jk_pac     ,  &   
    80       &                              surf_jk_ind     ,  &          
    81       &                              surf_jk_ipc     ,  &  
    82       &                              surf_jk_r_glo   ,  &  !: inverse of the ocean "zonal" section surface 
    83       &                              surf_jk_r_atl   ,  &   
    84       &                              surf_jk_r_pac   ,  &   
    85       &                              surf_jk_r_ind   ,  &          
    86       &                              surf_jk_r_ipc        
    87 #if defined key_diaeiv 
    88    REAL(wp), DIMENSION(jpj,jpk) ::   v_msf_eiv_glo, v_msf_eiv_atl, v_msf_eiv_pac,  & 
    89       &                              v_msf_eiv_ind, v_msf_eiv_ipc !: bolus "meridional" Stream-Function 
     83   !                                                               !!! eddy induced velocity (bolus) 
     84   REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_eiv_glo, pst_eiv_glo   !: global       poleward heat and salt bolus advection 
     85   REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_eiv_atl, pst_eiv_atl   !: Atlantic         -                           - 
     86   REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_eiv_pac, pst_eiv_pac   !: Pacific          -                           - 
     87   REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_eiv_ind, pst_eiv_ind   !: Indian           -                           - 
     88   REAL(wp), PUBLIC, DIMENSION(jpj) ::   pht_eiv_ipc, pst_eiv_ipc   !: Indo-Pacific     -                           - 
     89 
     90   REAL(wp), DIMENSION(jpj,jpk) ::   v_msf_eiv_glo   ! global       "meridional" bolus Stream-Function 
     91   REAL(wp), DIMENSION(jpj,jpk) ::   v_msf_eiv_atl   ! Atlantic          -                   - 
     92   REAL(wp), DIMENSION(jpj,jpk) ::   v_msf_eiv_pac   ! Pacific           -                   - 
     93   REAL(wp), DIMENSION(jpj,jpk) ::   v_msf_eiv_ind   ! Indian            -                   - 
     94   REAL(wp), DIMENSION(jpj,jpk) ::   v_msf_eiv_ipc   ! Indo-Pacific      -                   - 
    9095#endif 
    9196  
     
    9499#  include "vectopt_loop_substitute.h90" 
    95100   !!---------------------------------------------------------------------- 
    96    !!   OPA 9.0 , LOCEAN-IPSL (2005)  
     101   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    97102   !! $Id$  
    98103   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     
    106111      !! 
    107112      !! ** Purpose :   "zonal" and vertical sum computation of a "meridional" 
    108       !!      flux array 
     113      !!              flux array 
    109114      !! 
    110115      !! ** Method  : - i-k sum of pva using the interior 2D vmask (vmask_i). 
    111       !!      pva is supposed to be a masked flux (i.e. * vmask*e1v*e3v) 
     116      !!              pva is supposed to be a masked flux (i.e. * vmask*e1v*e3v) 
    112117      !! 
    113118      !! ** Action  : - p_fval: i-k-mean poleward flux of pva 
     
    182187      !! ** Action  : - p_fval: i-k-mean poleward flux of pva 
    183188      !!---------------------------------------------------------------------- 
    184       REAL(wp) , INTENT(in), DIMENSION(jpi,jpj,jpk) ::   pva   ! mask flux array at V-point 
    185       REAL(wp) , INTENT(in), DIMENSION(jpi,jpj), OPTIONAL :: bmask ! Optional 2D basin mask 
     189      REAL(wp) , INTENT(in), DIMENSION(jpi,jpj,jpk)           ::   pva     ! mask flux array at V-point 
     190      REAL(wp) , INTENT(in), DIMENSION(jpi,jpj)    , OPTIONAL ::   bmask  ! Optional 2D basin mask 
    186191      !! 
    187192      INTEGER                      ::   ji, jj, jk   ! dummy loop arguments 
    188       INTEGER , DIMENSION (1)      ::   ish 
    189       INTEGER , DIMENSION (2)      ::   ish2 
    190       REAL(wp), DIMENSION(jpj*jpk) ::   zwork        ! temporary vector for mpp_sum 
    191193      REAL(wp), DIMENSION(jpj,jpk) ::   p_fval       ! return function value 
     194#if defined key_mpp_mpi 
     195      INTEGER, DIMENSION(1) ::   ish 
     196      INTEGER, DIMENSION(2) ::   ish2 
     197      REAL(wp), DIMENSION(jpj*jpk) ::   zwork   ! 1D workspace 
     198#endif 
    192199      !!-------------------------------------------------------------------- 
    193       !  
     200      ! 
    194201      p_fval(:,:) = 0.e0 
    195202      ! 
    196       IF (PRESENT (bmask)) THEN  
     203      IF( PRESENT( bmask ) ) THEN  
    197204         DO jk = 1, jpkm1 
    198205            DO jj = 2, jpjm1 
     206!!gm here, use of tmask_i  ==> no need of loop over nldi, nlei.... 
    199207               DO ji =  nldi, nlei   ! No vector optimisation here. Better use a mask ? 
    200208                  p_fval(jj,jk) = p_fval(jj,jk) + pva(ji,jj,jk) * e1v(ji,jj) * fse3v(ji,jj,jk)   & 
     
    215223      ! 
    216224#if defined key_mpp_mpi 
    217       ish(1) = jpj*jpk  ;  ish2(1) = jpj  ;  ish2(2) = jpk 
    218       zwork(:)= RESHAPE( p_fval, ish ) 
     225      ish(1) = jpj*jpk   ;   ish2(1) = jpj   ;   ish2(2) = jpk 
     226      zwork(:) = RESHAPE( p_fval, ish ) 
    219227      CALL mpp_sum( zwork, jpj*jpk, ncomm_znl ) 
    220       p_fval(:,:)= RESHAPE( zwork, ish2 ) 
     228      p_fval(:,:) = RESHAPE( zwork, ish2 ) 
    221229#endif 
    222230      ! 
    223231   END FUNCTION ptr_vjk 
     232 
    224233 
    225234   FUNCTION ptr_tjk( pta, bmask )   RESULT ( p_fval ) 
     
    239248      !! 
    240249      INTEGER                     ::   ji, jj, jk   ! dummy loop arguments 
    241       INTEGER, DIMENSION (1)      ::   ish 
    242       INTEGER, DIMENSION (2)      ::   ish2 
    243       REAL(wp),DIMENSION(jpj*jpk) ::   zwork        ! temporary vector for mpp_sum 
    244250      REAL(wp),DIMENSION(jpj,jpk) ::   p_fval       ! return function value 
     251#if defined key_mpp_mpi 
     252      INTEGER, DIMENSION(1) ::   ish 
     253      INTEGER, DIMENSION(2) ::   ish2 
     254      REAL(wp),DIMENSION(jpj*jpk) ::   zwork   ! 1D workspace 
     255#endif 
    245256      !!--------------------------------------------------------------------  
    246257      ! 
     
    285296      INTEGER, INTENT(in) ::   kt   ! ocean time step index 
    286297      !! 
    287       INTEGER  ::   jk, jj, ji               ! dummy loop 
    288       REAL(wp) ::   zsverdrup,  &              ! conversion from m3/s to Sverdrup 
    289          &          zpwatt,     &              ! conversion from W    to PW 
    290          &          zggram                     ! conversion from g    to Pg 
    291       REAL(wp), DIMENSION(jpi,jpj,jpk) :: vt, vs 
     298      INTEGER  ::   jk, jj, ji   ! dummy loop 
     299      REAL(wp) ::   zsverdrup    ! conversion from m3/s to Sverdrup 
     300      REAL(wp) ::   zpwatt       ! conversion from W    to PW 
     301      REAL(wp) ::   zggram       ! conversion from g    to Pg 
     302      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   vt, vs   ! 3D workspace 
    292303      !!---------------------------------------------------------------------- 
    293304 
     
    325336            v_msf_glo(:,:) = ptr_vjk( vn(:,:,:)+v_eiv(:,:,:) )  
    326337            IF( ln_subbas .AND. ln_diaznl ) THEN 
    327                v_msf_atl(:,:) = ptr_vjk( vn (:,:,:)+v_eiv(:,:,:), abasin(:,:)*sbasin(:,:) )  
    328                v_msf_pac(:,:) = ptr_vjk( vn (:,:,:)+v_eiv(:,:,:), pbasin(:,:)*sbasin(:,:) )  
    329                v_msf_ind(:,:) = ptr_vjk( vn (:,:,:)+v_eiv(:,:,:), ibasin(:,:)*sbasin(:,:) )  
    330                v_msf_ipc(:,:) = ptr_vjk( vn (:,:,:)+v_eiv(:,:,:), dbasin(:,:)*sbasin(:,:) )  
     338               v_msf_atl(:,:) = ptr_vjk( vn(:,:,:)+v_eiv(:,:,:), abasin(:,:)*sbasin(:,:) )  
     339               v_msf_pac(:,:) = ptr_vjk( vn(:,:,:)+v_eiv(:,:,:), pbasin(:,:)*sbasin(:,:) )  
     340               v_msf_ind(:,:) = ptr_vjk( vn(:,:,:)+v_eiv(:,:,:), ibasin(:,:)*sbasin(:,:) )  
     341               v_msf_ipc(:,:) = ptr_vjk( vn(:,:,:)+v_eiv(:,:,:), dbasin(:,:)*sbasin(:,:) )  
    331342            ENDIF 
    332343#else 
    333344            v_msf_glo(:,:) = ptr_vjk( vn(:,:,:) )  
    334345            IF( ln_subbas .AND. ln_diaznl ) THEN 
    335                v_msf_atl(:,:) = ptr_vjk( vn (:,:,:), abasin(:,:)*sbasin(:,:) )  
    336                v_msf_pac(:,:) = ptr_vjk( vn (:,:,:), pbasin(:,:)*sbasin(:,:) )  
    337                v_msf_ind(:,:) = ptr_vjk( vn (:,:,:), ibasin(:,:)*sbasin(:,:) )  
    338                v_msf_ipc(:,:) = ptr_vjk( vn (:,:,:), dbasin(:,:)*sbasin(:,:) )  
     346               v_msf_atl(:,:) = ptr_vjk( vn(:,:,:), abasin(:,:)*sbasin(:,:) )  
     347               v_msf_pac(:,:) = ptr_vjk( vn(:,:,:), pbasin(:,:)*sbasin(:,:) )  
     348               v_msf_ind(:,:) = ptr_vjk( vn(:,:,:), ibasin(:,:)*sbasin(:,:) )  
     349               v_msf_ipc(:,:) = ptr_vjk( vn(:,:,:), dbasin(:,:)*sbasin(:,:) )  
    339350            ENDIF 
    340351#endif 
     
    474485            ENDIF 
    475486         ENDIF 
    476  
    477          ! outputs 
    478          CALL dia_ptr_wri( kt ) 
    479  
     487         ! 
     488         CALL dia_ptr_wri( kt )                        ! outputs 
     489         ! 
    480490      ENDIF 
    481  
    482       ! Close the file 
    483       IF( kt == nitend ) CALL histclo( numptr ) 
     491      ! 
     492      IF( kt == nitend )   CALL histclo( numptr )      ! Close the file 
    484493      ! 
    485494   END SUBROUTINE dia_ptr 
     
    492501      !! ** Purpose :   Initialization, namelist read 
    493502      !!---------------------------------------------------------------------- 
     503      INTEGER ::   inum       ! temporary logical unit 
     504#if defined key_mpp_mpi 
     505      INTEGER, DIMENSION(1) :: iglo, iloc, iabsf, iabsl, ihals, ihale, idid 
     506#endif 
     507      !! 
    494508      NAMELIST/namptr/ ln_diaptr, ln_diaznl, ln_subbas, ln_ptrcomp, nf_ptr, nf_ptr_wri 
    495       INTEGER :: inum       ! temporary logical unit 
    496 #if defined key_mpp_mpi 
    497       INTEGER, DIMENSION (1) :: iglo, iloc, iabsf, iabsl, ihals, ihale, idid 
    498 #endif 
    499       !!---------------------------------------------------------------------- 
    500  
    501       ! Read Namelist namptr : poleward transport parameters 
    502       REWIND ( numnam ) 
     509      !!---------------------------------------------------------------------- 
     510 
     511      REWIND ( numnam )              ! Read Namelist namptr : poleward transport parameters 
    503512      READ   ( numnam, namptr ) 
    504513 
    505       ! Control print 
    506       IF(lwp) THEN 
     514      IF(lwp) THEN                   ! Control print 
    507515         WRITE(numout,*) 
    508516         WRITE(numout,*) 'dia_ptr_init : poleward transport and msf initialization' 
    509517         WRITE(numout,*) '~~~~~~~~~~~~' 
    510          WRITE(numout,*) '          Namelist namptr : set ptr parameters' 
    511          WRITE(numout,*) '             Switch for ptr diagnostic (T) or not (F) ln_diaptr = ', ln_diaptr 
    512          WRITE(numout,*) '             Atla/Paci/Ind basins computation         ln_subbas = ', ln_subbas 
    513          WRITE(numout,*) '             Frequency of computation                    nf_ptr = ', nf_ptr 
    514          WRITE(numout,*) '             Frequency of outputs                    nf_ptr_wri = ', nf_ptr_wri 
     518         WRITE(numout,*) '   Namelist namptr : set ptr parameters' 
     519         WRITE(numout,*) '      Switch for ptr diagnostic (T) or not (F)  ln_diaptr = ', ln_diaptr 
     520         WRITE(numout,*) '      Atl/Pac/Ind basins computation            ln_subbas = ', ln_subbas 
     521         WRITE(numout,*) '      Frequency of computation                  nf_ptr    = ', nf_ptr 
     522         WRITE(numout,*) '      Frequency of outputs                      nf_ptr_wri = ', nf_ptr_wri 
    515523      ENDIF 
    516524 
    517       ! 
    518       ! Define MPI communicator for zonal sum 
    519       ! 
    520       IF( lk_mpp )  THEN 
    521          CALL mpp_ini_znl 
    522       ENDIF 
    523  
    524       IF( ln_subbas ) THEN                ! load sub-basin mask 
     525      IF( lk_mpp )   CALL mpp_ini_znl      ! Define MPI communicator for zonal sum 
     526 
     527      IF( ln_subbas ) THEN                 ! load sub-basin mask 
    525528         CALL iom_open( 'subbasins', inum ) 
    526529         CALL iom_get( inum, jpdom_data, 'atlmsk', abasin )      ! Atlantic basin 
     
    533536      ENDIF 
    534537       
     538!!gm CAUTION : this is only valid in fixed volume case ! 
     539 
    535540      ! inverse of the ocean "zonal" v-point section 
    536541      surf_jk_glo(:,:) = ptr_tjk( tmask(:,:,:) ) 
     
    580585      nidom_ptr = FLIO_DOM_NONE 
    581586#endif 
    582        
     587      !  
    583588   END SUBROUTINE dia_ptr_init 
    584589 
     
    632637 
    633638         zdt = rdt 
    634          IF( nacc == 1 ) zdt = rdtmin 
     639         IF( nacc == 1 )   zdt = rdtmin 
    635640 
    636641         ! Reference latitude 
     
    670675 
    671676            !                                        ! ======================= 
    672          ELSE                                        !   OTHER configurations  zjulian = zjulian - adatrj  
    673             !   set calendar origin to the beginning of the experiment 
     677         ELSE                                        !   OTHER configurations  
    674678            !                                        ! ======================= 
    675679            zphi(:) = gphiv(1,:)             ! assume lat/lon coordinate, select the first i-line 
  • trunk/NEMO/OPA_SRC/SBC/sbcana.F90

    r1230 r1559  
    44   !! Ocean forcing:  analytical momentum, heat and freshwater forcings 
    55   !!===================================================================== 
    6    !! History :  9.0   !  06-06  (G. Madec)  Original code 
     6   !! History :  3.0   ! 2006-06  (G. Madec)  Original code 
     7   !!            3.2   ! 2009-07  (G. Madec)  Style only 
    78   !!---------------------------------------------------------------------- 
    89 
     
    2627   PUBLIC   sbc_gyre   ! routine called in sbcmod module 
    2728 
    28    !! * Namelist namsbc_ana 
     29   !                               !!* Namelist namsbc_ana * 
    2930   INTEGER  ::   nn_tau000 = 1      ! nb of time-step during which the surface stress 
    30       !                             ! increase from 0 to its nominal value  
     31   !                                ! increase from 0 to its nominal value  
    3132   REAL(wp) ::   rn_utau0  = 0.e0   ! constant wind stress value in i-direction 
    3233   REAL(wp) ::   rn_vtau0  = 0.e0   ! constant wind stress value in j-direction 
     
    3940#  include "vectopt_loop_substitute.h90" 
    4041   !!---------------------------------------------------------------------- 
    41    !!   OPA 9.0 , LOCEAN-IPSL (2006)  
     42   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4243   !! $Id$ 
    4344   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     
    5152      !!               
    5253      !! ** Purpose :   provide at each time-step the ocean surface boundary 
    53       !!      condition, i.e. the momentum, heat and freshwater fluxes. 
     54      !!              condition, i.e. the momentum, heat and freshwater fluxes. 
    5455      !! 
    5556      !! ** Method  :   Constant and uniform surface forcing specified from 
    56       !!      namsbc_ana namelist parameters. All the fluxes are time inde- 
    57       !!      pendant except the stresses which increase from zero during 
    58       !!      the first nn_tau000 time-step  
    59       !!      * C A U T I O N : never mask the surface stress field ! 
     57      !!              namsbc_ana namelist parameters. All the fluxes are time 
     58      !!              independant except the stresses which increase from zero 
     59      !!              during the first nn_tau000 time-step  
     60      !!                CAUTION : never mask the surface stress field ! 
    6061      !! 
    6162      !! ** Action  : - set the ocean surface boundary condition, i.e.   
     
    6465      INTEGER, INTENT(in) ::   kt       ! ocean time step 
    6566      !! 
    66       INTEGER             ::   ji, jj          ! dummy loop indices 
    6767      REAL(wp)            ::   zfacto          ! local scalar 
    6868      !! 
     
    100100      ENDIF 
    101101 
    102       ! Estimation of wind speed as a function of wind stress ( |tau|=rhoa*Cd*|U|^2 ) 
    103       CALL sbc_tau2wnd 
     102      CALL sbc_tau2wnd      ! Estimation of wind speed as a function of wind stress ( |tau|=rhoa*Cd*|U|^2 ) 
    104103      ! 
    105104   END SUBROUTINE sbc_ana 
     
    110109      !!                    ***  ROUTINE sbc_ana *** 
    111110      !!               
    112       !! ** Purpose :   provide at each time-step the ocean surface boundary 
    113       !!      condition, i.e. the momentum, heat and freshwater fluxes. 
     111      !! ** Purpose :   provide at each time-step the GYRE surface boundary 
     112      !!              condition, i.e. the momentum, heat and freshwater fluxes. 
    114113      !! 
    115114      !! ** Method  :   analytical seasonal cycle for GYRE configuration. 
    116       !!      * C A U T I O N : never mask the surface stress field ! 
     115      !!                CAUTION : never mask the surface stress field ! 
    117116      !! 
    118117      !! ** Action  : - set the ocean surface boundary condition, i.e.    
     
    122121      !!---------------------------------------------------------------------- 
    123122      INTEGER, INTENT(in) ::   kt          ! ocean time step 
    124  
     123      !! 
    125124      INTEGER  ::   ji, jj                 ! dummy loop indices 
    126125      INTEGER  ::   zyear0                 ! initial year  
     
    298297         WRITE(numout,*)'           raajj  = ', raajj 
    299298      ENDIF 
    300  
     299      ! 
    301300   END SUBROUTINE sbc_gyre 
    302301 
  • trunk/NEMO/OPA_SRC/TRA/traadv_cen2.F90

    r1537 r1559  
    44   !! Ocean active tracers:  horizontal & vertical advective trend 
    55   !!====================================================================== 
    6    !! History :   8.2  !  01-08  (G. Madec, E. Durand)  trahad+trazad=traadv  
    7    !!             8.5  !  02-06  (G. Madec)  F90: Free form and module 
    8    !!             9.0  !  04-08  (C. Talandier) New trends organization 
    9    !!             " "  !  05-11  (V. Garnier) Surface pressure gradient organization 
    10    !!             " "  !  06-04  (R. Benshila, G. Madec) Step reorganization 
    11    !!             " "  !  06-07  (G. madec)  add ups_orca_set routine 
     6   !! History :  8.2  ! 2001-08  (G. Madec, E. Durand)  trahad+trazad=traadv  
     7   !!            1.0  ! 2002-06  (G. Madec)  F90: Free form and module 
     8   !!            9.0  ! 2004-08  (C. Talandier) New trends organization 
     9   !!             -   ! 2005-11  (V. Garnier) Surface pressure gradient organization 
     10   !!            2.0  ! 2006-04  (R. Benshila, G. Madec) Step reorganization 
     11   !!             -   ! 2006-07  (G. madec)  add ups_orca_set routine 
     12   !!            3.2  ! 2009-07  (G. Madec) add avmb, avtb in restart for cen2 advection 
    1213   !!---------------------------------------------------------------------- 
    1314 
     
    5354#  include "vectopt_loop_substitute.h90" 
    5455   !!---------------------------------------------------------------------- 
    55    !!   OPA 9.0 , LOCEAN-IPSL (2006)  
     56   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    5657   !! $Id$ 
    5758   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     
    131132      REAL(wp), INTENT(in), DIMENSION(jpi,jpj,jpk) ::   pwn   ! ocean velocity w-component 
    132133      !! 
    133       INTEGER  ::   ji, jj, jk                           ! dummy loop indices 
    134       REAL(wp) ::   zta, zsa, zbtr, zhw, ze3tr,       &  ! temporary scalars 
    135          &          zfp_ui, zfp_vj, zfp_w , zfui  ,   &  !    "         " 
    136          &          zfm_ui, zfm_vj, zfm_w , zfvj  ,   &  !    "         " 
    137          &          zcofi , zcofj , zcofk ,           &  !    "         " 
    138          &          zupsut, zupsus, zcenut, zcenus,   &  !    "         " 
    139          &          zupsvt, zupsvs, zcenvt, zcenvs,   &  !    "         " 
    140          &          zupst , zupss , zcent , zcens ,   &  !    "         " 
    141          &          z_hdivn_x, z_hdivn_y, z_hdivn  
    142       REAL(wp) ::   zice                                 !    -         - 
     134      INTEGER  ::   ji, jj, jk                       ! dummy loop indices 
     135      REAL(wp) ::   zbtr, zhw, ze3tr                 ! temporary scalars 
     136      REAL(wp) ::   zfp_ui, zfp_vj, zfp_w , zfui     !    -         - 
     137      REAL(wp) ::   zfm_ui, zfm_vj, zfm_w , zfvj     !    -         - 
     138      REAL(wp) ::   zcofi , zcofj , zcofk            !    -         - 
     139      REAL(wp) ::   zupsut, zupsus, zcenut, zcenus   !    -         - 
     140      REAL(wp) ::   zupsvt, zupsvs, zcenvt, zcenvs   !    -         - 
     141      REAL(wp) ::   zupst , zupss , zcent , zcens    !    -         - 
     142      REAL(wp) ::   z_hdivn_x, z_hdivn_y, z_hdivn    !    -         - 
     143      REAL(wp) ::   zice                             !    -         - 
    143144      REAL(wp), DIMENSION(jpi,jpj)     ::   ztfreez            ! 2D workspace 
    144145      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zwz, ztrdt, zind   ! 3D workspace 
     
    188189      END DO 
    189190 
    190       ! I. Horizontal advective fluxes 
    191       ! ------------------------------ 
    192       !  Second order centered tracer flux at u and v-points 
    193       ! ----------------------------------------------------- 
    194       !                                                ! =============== 
    195       DO jk = 1, jpkm1                                 ! Horizontal slab 
    196          !                                             ! =============== 
     191      ! I. Horizontal advection 
     192      !    ==================== 
     193      ! 
     194      DO jk = 1, jpkm1 
     195         !                        ! Second order centered tracer flux at u- and v-points 
    197196         DO jj = 1, jpjm1 
    198197            DO ji = 1, fs_jpim1   ! vector opt. 
     
    201200               zcofj = MAX( zind(ji,jj+1,jk), zind(ji,jj,jk) ) 
    202201               ! volume fluxes * 1/2 
    203 #if defined key_zco 
    204                zfui = 0.5 * e2u(ji,jj) * pun(ji,jj,jk) 
    205                zfvj = 0.5 * e1v(ji,jj) * pvn(ji,jj,jk) 
    206 #else 
    207202               zfui = 0.5 * e2u(ji,jj) * fse3u(ji,jj,jk) * pun(ji,jj,jk) 
    208203               zfvj = 0.5 * e1v(ji,jj) * fse3v(ji,jj,jk) * pvn(ji,jj,jk) 
    209 #endif 
     204               ! 
    210205               ! upstream scheme 
    211206               zfp_ui = zfui + ABS( zfui ) 
     
    229224            END DO 
    230225         END DO 
    231  
    232          !  Tracer flux divergence at t-point added to the general trend 
    233          ! -------------------------------------------------------------- 
     226         !                        ! Tracer flux divergence at t-point added to the general trend 
    234227         DO jj = 2, jpjm1 
    235228            DO ji = fs_2, fs_jpim1   ! vector opt. 
    236 #if defined key_zco 
    237                zbtr = btr2(ji,jj) 
    238 #else 
    239229               zbtr = btr2(ji,jj) / fse3t(ji,jj,jk) 
    240 #endif 
    241                ! horizontal advective trends 
    242                zta = - zbtr * (  zwx(ji,jj,jk) - zwx(ji-1,jj  ,jk)   & 
    243                   &            + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk)  ) 
    244                zsa = - zbtr * (  zww(ji,jj,jk) - zww(ji-1,jj  ,jk)   & 
    245                   &            + zwz(ji,jj,jk) - zwz(ji  ,jj-1,jk)  ) 
    246                ! add it to the general tracer trends 
    247                ta(ji,jj,jk) = ta(ji,jj,jk) + zta 
    248                sa(ji,jj,jk) = sa(ji,jj,jk) + zsa 
    249             END DO 
    250          END DO 
    251          !                                             ! =============== 
    252       END DO                                           !   End of slab 
    253       !                                                ! =============== 
    254  
    255       !  Save the horizontal advective trends for diagnostic 
    256       ! ----------------------------------------------------- 
    257       IF( l_trdtra ) THEN 
    258          ! T/S ZONAL advection trends 
    259          ztrdt(:,:,:) = 0.e0   ;   ztrds(:,:,:) = 0.e0 
     230               ! 
     231               ta(ji,jj,jk) = ta(ji,jj,jk) - zbtr * (  zwx(ji,jj,jk) - zwx(ji-1,jj  ,jk)  & 
     232                  &                                  + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk)  ) 
     233               sa(ji,jj,jk) = sa(ji,jj,jk) - zbtr * (  zww(ji,jj,jk) - zww(ji-1,jj  ,jk)  & 
     234                  &                                  + zwz(ji,jj,jk) - zwz(ji  ,jj-1,jk)  ) 
     235            END DO 
     236         END DO 
     237      END DO 
     238 
     239 
     240      IF( l_trdtra ) THEN      ! Save the i- and j-advective trends for diagnostic (U.gradz(T) trends) 
    260241         ! 
    261242         DO jk = 1, jpkm1 
     
    263244               DO ji = fs_2, fs_jpim1   ! vector opt. 
    264245                  !-- Compute zonal divergence by splitting hdivn (see divcur.F90) 
    265                   !   N.B. This computation is not valid along OBCs (if any) 
    266 #if defined key_zco 
    267                   zbtr      = btr2(ji,jj)  
    268                   z_hdivn_x = (  e2u(ji  ,jj) * pun(ji  ,jj,jk)                              & 
    269                      &         - e2u(ji-1,jj) * pun(ji-1,jj,jk) ) * zbtr 
    270 #else 
     246                  !   N.B. This computation is not valid with OBC, BDY, cla, eiv, advective bbl  
    271247                  zbtr      = btr2(ji,jj) / fse3t(ji,jj,jk) 
    272248                  z_hdivn_x = (  e2u(ji  ,jj) * fse3u(ji  ,jj,jk) * pun(ji  ,jj,jk)          & 
    273249                     &         - e2u(ji-1,jj) * fse3u(ji-1,jj,jk) * pun(ji-1,jj,jk) ) * zbtr 
    274 #endif 
     250                  ! 
    275251                  ztrdt(ji,jj,jk) = - zbtr * ( zwx(ji,jj,jk) - zwx(ji-1,jj,jk) ) + tn(ji,jj,jk) * z_hdivn_x 
    276252                  ztrds(ji,jj,jk) = - zbtr * ( zww(ji,jj,jk) - zww(ji-1,jj,jk) ) + sn(ji,jj,jk) * z_hdivn_x 
     
    280256         CALL trd_mod(ztrdt, ztrds, jptra_trd_xad, 'TRA', kt) 
    281257         ! 
    282          ! T/S MERIDIONAL advection trends 
     258         DO jk = 1, jpkm1           ! T/S MERIDIONAL advection trends 
     259            DO jj = 2, jpjm1 
     260               DO ji = fs_2, fs_jpim1   ! vector opt. 
     261                  zbtr      = btr2(ji,jj) / fse3t(ji,jj,jk) 
     262                  z_hdivn_y = (  e1v(ji,  jj) * fse3v(ji,jj  ,jk) * pvn(ji,jj  ,jk)          & 
     263                     &         - e1v(ji,jj-1) * fse3v(ji,jj-1,jk) * pvn(ji,jj-1,jk) ) * zbtr 
     264                  ! 
     265                  ztrdt(ji,jj,jk) = - zbtr * ( zwy(ji,jj,jk) - zwy(ji,jj-1,jk) ) + tn(ji,jj,jk) * z_hdivn_y           
     266                  ztrds(ji,jj,jk) = - zbtr * ( zwz(ji,jj,jk) - zwz(ji,jj-1,jk) ) + sn(ji,jj,jk) * z_hdivn_y 
     267               END DO 
     268            END DO 
     269         END DO 
     270         CALL trd_mod(ztrdt, ztrds, jptra_trd_yad, 'TRA', kt) 
     271         ! 
     272         ztrdt(:,:,:) = ta(:,:,:)   ;   ztrds(:,:,:) = sa(:,:,:)       ! Save the horizontal up-to-date ta/sa trends 
     273         ! 
     274      ENDIF 
     275 
     276      IF( ln_diaptr .AND. ( MOD( kt, nf_ptr ) == 0 ) ) THEN      ! "zonal" mean advective heat and salt transport  
     277         pht_adv(:) = ptr_vj( zwy(:,:,:) ) 
     278         pst_adv(:) = ptr_vj( zwz(:,:,:) ) 
     279      ENDIF 
     280 
     281      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ta, clinfo1=' cen2 had  - Ta: ', mask1=tmask, & 
     282         &                       tab3d_2=sa, clinfo2=            ' Sa: ', mask2=tmask, clinfo3='tra' ) 
     283 
     284 
     285      ! II. Vertical advection 
     286      !     ================== 
     287      ! 
     288      zwx(:,:,jpk) = 0.e0     ;    zwy(:,:,jpk) = 0.e0      ! Bottom value  : flux set to zero 
     289      ! 
     290      IF( lk_vvl ) THEN                                     ! Surface value : zero in variable volume 
     291         zwx(:,:, 1 ) = 0.e0    ;    zwy(:,:, 1 ) = 0.e0 
     292      ELSE                                                  !               : linear free surface case 
     293         zwx(:,:, 1 ) = pwn(:,:,1) * tn(:,:,1) 
     294         zwy(:,:, 1 ) = pwn(:,:,1) * sn(:,:,1) 
     295      ENDIF 
     296      ! 
     297      DO jk = 2, jpk              ! Second order centered tracer flux at w-point 
     298         DO jj = 2, jpjm1 
     299            DO ji = fs_2, fs_jpim1   ! vector opt. 
     300               zcofk = MAX( zind(ji,jj,jk-1), zind(ji,jj,jk) )      ! upstream indicator 
     301               zhw = 0.5 * pwn(ji,jj,jk)                            ! velocity * 1/2 
     302               ! 
     303               zfp_w = zhw + ABS( zhw )                             ! upstream scheme 
     304               zfm_w = zhw - ABS( zhw ) 
     305               zupst = zfp_w * tb(ji,jj,jk) + zfm_w * tb(ji,jj,jk-1) 
     306               zupss = zfp_w * sb(ji,jj,jk) + zfm_w * sb(ji,jj,jk-1) 
     307               ! 
     308               zcent = zhw * ( tn(ji,jj,jk) + tn(ji,jj,jk-1) )      ! centered scheme 
     309               zcens = zhw * ( sn(ji,jj,jk) + sn(ji,jj,jk-1) ) 
     310               ! 
     311               zwx(ji,jj,jk) = zcofk * zupst + (1.-zcofk) * zcent   ! mixed centered / upstream scheme 
     312               zwy(ji,jj,jk) = zcofk * zupss + (1.-zcofk) * zcens 
     313            END DO 
     314         END DO 
     315      END DO 
     316      ! 
     317      DO jk = 1, jpkm1            ! divergence of Tracer flux added to the general trend 
     318         DO jj = 2, jpjm1 
     319            DO ji = fs_2, fs_jpim1   ! vector opt. 
     320               ze3tr = 1. / fse3t(ji,jj,jk) 
     321               ta(ji,jj,jk) =  ta(ji,jj,jk) - ze3tr * ( zwx(ji,jj,jk) - zwx(ji,jj,jk+1) ) 
     322               sa(ji,jj,jk) =  sa(ji,jj,jk) - ze3tr * ( zwy(ji,jj,jk) - zwy(ji,jj,jk+1) ) 
     323            END DO 
     324         END DO 
     325      END DO 
     326 
     327      IF( l_trdtra ) THEN      ! Save the vertical advective trends for diagnostic (W gradz(T) trends) 
    283328         DO jk = 1, jpkm1 
    284329            DO jj = 2, jpjm1 
    285330               DO ji = fs_2, fs_jpim1   ! vector opt. 
    286                   !-- Compute merid. divergence by splitting hdivn (see divcur.F90) 
    287                   !   N.B. This computation is not valid along OBCs (if any) 
    288 #if defined key_zco 
    289                   zbtr      = btr2(ji,jj)  
    290                   z_hdivn_y = (  e1v(ji,jj  ) * pvn(ji,jj  ,jk)                              & 
    291                      &         - e1v(ji,jj-1) * pvn(ji,jj-1,jk) ) * zbtr 
    292 #else 
    293                   zbtr      = btr2(ji,jj) / fse3t(ji,jj,jk) 
    294                   z_hdivn_y = (  e1v(ji,  jj) * fse3v(ji,jj  ,jk) * pvn(ji,jj  ,jk)          & 
    295                      &         - e1v(ji,jj-1) * fse3v(ji,jj-1,jk) * pvn(ji,jj-1,jk) ) * zbtr 
    296 #endif 
    297                   ztrdt(ji,jj,jk) = - zbtr * ( zwy(ji,jj,jk) - zwy(ji,jj-1,jk) ) + tn(ji,jj,jk) * z_hdivn_y           
    298                   ztrds(ji,jj,jk) = - zbtr * ( zwz(ji,jj,jk) - zwz(ji,jj-1,jk) ) + sn(ji,jj,jk) * z_hdivn_y 
    299                END DO 
    300             END DO 
    301          END DO 
    302          CALL trd_mod(ztrdt, ztrds, jptra_trd_yad, 'TRA', kt) 
    303          ! 
    304          ! Save the horizontal up-to-date ta/sa trends 
    305          ztrdt(:,:,:) = ta(:,:,:)  
    306          ztrds(:,:,:) = sa(:,:,:) 
    307       ENDIF 
    308  
    309       IF(ln_ctl)   CALL prt_ctl( tab3d_1=ta, clinfo1=' cen2 had  - Ta: ', mask1=tmask, & 
    310          &                       tab3d_2=sa, clinfo2=            ' Sa: ', mask2=tmask, clinfo3='tra' ) 
    311  
    312       ! "zonal" mean advective heat and salt transport  
    313       ! ---------------------------------------------- 
    314  
    315       IF( ln_diaptr .AND. ( MOD( kt, nf_ptr ) == 0 ) ) THEN 
    316          IF( lk_zco ) THEN 
    317             DO jk = 1, jpkm1 
    318                DO jj = 2, jpjm1 
    319                   DO ji = fs_2, fs_jpim1   ! vector opt. 
    320                     zwy(ji,jj,jk) = zwy(ji,jj,jk) * fse3v(ji,jj,jk) 
    321                     zwz(ji,jj,jk) = zwz(ji,jj,jk) * fse3v(ji,jj,jk) 
    322                   END DO 
    323                END DO 
    324             END DO 
    325          ENDIF 
    326          pht_adv(:) = ptr_vj( zwy(:,:,:) ) 
    327          pst_adv(:) = ptr_vj( zwz(:,:,:) ) 
    328       ENDIF 
    329  
    330       ! II. Vertical advection 
    331       ! ---------------------- 
    332  
    333       ! Bottom value : flux set to zero 
    334       zwx(:,:,jpk) = 0.e0     ;    zwy(:,:,jpk) = 0.e0 
    335  
    336       ! Surface value 
    337       IF( lk_vvl ) THEN 
    338          ! variable volume: flux set to zero 
    339          zwx(:,:, 1 ) = 0.e0    ;    zwy(:,:, 1 ) = 0.e0 
    340       ELSE 
    341          ! free surface-constant volume 
    342          zwx(:,:, 1 ) = pwn(:,:,1) * tn(:,:,1) 
    343          zwy(:,:, 1 ) = pwn(:,:,1) * sn(:,:,1) 
    344       ENDIF 
    345  
    346       ! 1. Vertical advective fluxes  
    347       ! ---------------------------- 
    348       ! Second order centered tracer flux at w-point 
    349       DO jk = 2, jpk 
    350          DO jj = 2, jpjm1 
    351             DO ji = fs_2, fs_jpim1   ! vector opt. 
    352                ! upstream indicator 
    353                zcofk = MAX( zind(ji,jj,jk-1), zind(ji,jj,jk) ) 
    354                ! velocity * 1/2 
    355                zhw = 0.5 * pwn(ji,jj,jk) 
    356                ! upstream scheme 
    357                zfp_w = zhw + ABS( zhw ) 
    358                zfm_w = zhw - ABS( zhw ) 
    359                zupst = zfp_w * tb(ji,jj,jk) + zfm_w * tb(ji,jj,jk-1) 
    360                zupss = zfp_w * sb(ji,jj,jk) + zfm_w * sb(ji,jj,jk-1) 
    361                ! centered scheme 
    362                zcent = zhw * ( tn(ji,jj,jk) + tn(ji,jj,jk-1) ) 
    363                zcens = zhw * ( sn(ji,jj,jk) + sn(ji,jj,jk-1) ) 
    364                ! mixed centered / upstream scheme 
    365                zwx(ji,jj,jk) = zcofk * zupst + (1.-zcofk) * zcent 
    366                zwy(ji,jj,jk) = zcofk * zupss + (1.-zcofk) * zcens 
    367             END DO 
    368          END DO 
    369       END DO 
    370  
    371       ! 2. Tracer flux divergence at t-point added to the general trend 
    372       ! ------------------------- 
    373       DO jk = 1, jpkm1 
    374          DO jj = 2, jpjm1 
    375             DO ji = fs_2, fs_jpim1   ! vector opt. 
    376                ze3tr = 1. / fse3t(ji,jj,jk) 
    377                ! vertical advective trends 
    378                zta = - ze3tr * ( zwx(ji,jj,jk) - zwx(ji,jj,jk+1) ) 
    379                zsa = - ze3tr * ( zwy(ji,jj,jk) - zwy(ji,jj,jk+1) ) 
    380                ! add it to the general tracer trends 
    381                ta(ji,jj,jk) =  ta(ji,jj,jk) + zta 
    382                sa(ji,jj,jk) =  sa(ji,jj,jk) + zsa 
    383             END DO 
    384          END DO 
    385       END DO 
    386  
    387       ! 3. Save the vertical advective trends for diagnostic 
    388       ! ---------------------------------------------------- 
    389       IF( l_trdtra )   THEN 
    390          ! Recompute the vertical advection zta & zsa trends computed  
    391          ! at the step 2. above in making the difference between the new  
    392          ! trends and the previous one: ta()/sa - ztrdt()/ztrds() and substract 
    393          ! the term tn()/sn()*hdivn() to recover the W gradz(T/S) trends 
    394  
    395          DO jk = 1, jpkm1 
    396             DO jj = 2, jpjm1 
    397                DO ji = fs_2, fs_jpim1   ! vector opt. 
    398 #if defined key_zco 
    399                   zbtr      = btr2(ji,jj)  
    400                   z_hdivn_x = e2u(ji,jj)*pun(ji,jj,jk) - e2u(ji-1,jj)*pun(ji-1,jj,jk) 
    401                   z_hdivn_y = e1v(ji,jj)*pvn(ji,jj,jk) - e1v(ji,jj-1)*pvn(ji,jj-1,jk) 
    402 #else 
    403331                  zbtr      = btr2(ji,jj) / fse3t(ji,jj,jk) 
    404332                  z_hdivn_x = e2u(ji,jj)*fse3u(ji,jj,jk)*pun(ji,jj,jk) - e2u(ji-1,jj)*fse3u(ji-1,jj,jk)*pun(ji-1,jj,jk) 
    405333                  z_hdivn_y = e1v(ji,jj)*fse3v(ji,jj,jk)*pvn(ji,jj,jk) - e1v(ji,jj-1)*fse3v(ji,jj-1,jk)*pvn(ji,jj-1,jk) 
    406 #endif 
     334                  ! 
    407335                  z_hdivn   = (z_hdivn_x + z_hdivn_y) * zbtr 
    408336                  ztrdt(ji,jj,jk) = ta(ji,jj,jk) - ztrdt(ji,jj,jk) - tn(ji,jj,jk) * z_hdivn  
  • trunk/NEMO/OPA_SRC/TRA/traadv_qck.F90

    r1528 r1559  
    44   !! Ocean active tracers:  horizontal & vertical advective trend 
    55   !!============================================================================== 
    6    !! History :  9.0  !  2008-07  (G. Reffray)  Original code 
     6   !! History :  3.0  !  2008-07  (G. Reffray)  Original code 
    77   !!---------------------------------------------------------------------- 
    8  
    98 
    109   !!---------------------------------------------------------------------- 
    1110   !!   tra_adv_qck      : update the tracer trend with the horizontal advection 
    1211   !!                      trends using a 3rd order finite difference scheme 
    13    !!   tra_adv_qck_zon  :  
    14    !!   tra_adv_qck_mer  :  
    15    !!   tra_adv_cen2_ver : 2nd centered scheme for the vertical advection 
     12   !!   tra_adv_qck_i  :  
     13   !!   tra_adv_qck_j  :  
     14   !!   tra_adv_cen2_k : 2nd centered scheme for the vertical advection 
    1615   !!---------------------------------------------------------------------- 
    17    !! * Modules used 
    1816   USE oce             ! ocean dynamics and active tracers 
    1917   USE dom_oce         ! ocean space and time domain 
     
    3129   PRIVATE 
    3230 
    33    !! * Accessibility 
    34    PUBLIC tra_adv_qck    ! routine called by step.F90 
    35  
    36    !! * Module variables 
    37    REAL(wp), DIMENSION(jpi,jpj), SAVE ::   btr2 
    38    REAL(wp)                    , SAVE ::   cst 
    39    !!---------------------------------------------------------------------- 
     31   PUBLIC   tra_adv_qck   ! routine called by step.F90 
     32 
     33   REAL(wp), DIMENSION(jpi,jpj) ::   btr2 
     34   REAL(wp)                     ::   r1_6 
     35 
    4036   !! * Substitutions 
    4137#  include "domzgr_substitute.h90" 
    4238#  include "vectopt_loop_substitute.h90" 
    4339   !!---------------------------------------------------------------------- 
    44    !!   OPA 9.0 , LOCEAN-IPSL (2008)  
     40   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4541   !! $Id$ 
    4642   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     
    5753      !! 
    5854      !! ** Method :   The advection is evaluated by a third order scheme 
    59       !!               For a positive velocity u : 
    60       !! 
    61       !! 
    62       !!                  i-1    i      i+1   i+2 
    63       !! 
    64       !!               |--FU--|--FC--|--FD--|------| 
    65       !!                           u(i)>0 
    66       !! 
    67       !!               For a negative velocity u : 
    68       !! 
    69       !!               |------|--FD--|--FC--|--FU--| 
    70       !!                           u(i)<0 
    71       !! 
    72       !!                FU is the second upwind point 
    73       !!                FD is the first douwning point 
    74       !!                FC is the central point (or the first upwind point) 
    75       !! 
    76       !!      Flux(i) = u(i) * {0.5(FC+FD)  -0.5C(i)(FD-FC)  -((1-C(i))/6)(FU+FD-2FC)} 
    77       !!                with C(i)=|u(i)|dx(i)/dt (Courant number) 
     55      !!             For a positive velocity u :              u(i)>0 
     56      !!                                          |--FU--|--FC--|--FD--|------| 
     57      !!                                             i-1    i      i+1   i+2 
     58      !! 
     59      !!             For a negative velocity u :              u(i)<0 
     60      !!                                          |------|--FD--|--FC--|--FU--| 
     61      !!                                             i-1    i      i+1   i+2 
     62      !!             where  FU is the second upwind point 
     63      !!                    FD is the first douwning point 
     64      !!                    FC is the central point (or the first upwind point) 
     65      !! 
     66      !!      Flux(i) = u(i) * { 0.5(FC+FD)  -0.5C(i)(FD-FC)  -((1-C(i))/6)(FU+FD-2FC) } 
     67      !!                with C(i)=|u(i)|dx(i)/dt (=Courant number) 
    7868      !! 
    7969      !!         dt = 2*rdtra and the scalar values are tb and sb 
     
    8171      !!       On the vertical, the simple centered scheme used tn and sn 
    8272      !! 
    83       !!               The fluxes are bounded by the ULTIMATE limiter 
    84       !!               to guarantee the monotonicity of the solution and to 
     73      !!               The fluxes are bounded by the ULTIMATE limiter to 
     74      !!             guarantee the monotonicity of the solution and to 
    8575      !!            prevent the appearance of spurious numerical oscillations 
    8676      !! 
     
    9282      USE oce, ONLY :   ztrdt => ua   ! use ua as workspace 
    9383      USE oce, ONLY :   ztrds => va   ! use va as workspace 
    94       !! * Arguments 
     84      !! 
    9585      INTEGER , INTENT(in)                         ::  kt  ! ocean time-step index 
    9686      REAL(wp), INTENT(in), DIMENSION(jpi,jpj,jpk) ::  pun ! effective ocean velocity, u_component 
     
    10999         IF(lwp) WRITE(numout,*) 
    110100         btr2(:,:) = 1. / ( e1t(:,:) * e2t(:,:) ) 
    111          cst       = 1. / 6. 
     101         r1_6      = 1. / 6. 
    112102      ENDIF 
    113103 
     
    119109      !--------------------------------------------------------------------------- 
    120110 
    121       CALL tra_adv_qck_zon( kt, pun, tb, tn, ta, ztrdt, z2) 
    122       CALL tra_adv_qck_zon( kt, pun, sb, sn, sa, ztrds, z2) 
     111      CALL tra_adv_qck_i( pun, tb, tn, ta, ztrdt, z2) 
     112      CALL tra_adv_qck_i( pun, sb, sn, sa, ztrds, z2) 
    123113 
    124114      IF( l_trdtra ) CALL trd_mod(ztrdt, ztrds, jptra_trd_xad, 'TRA', kt) 
    125115 
    126       CALL tra_adv_qck_mer( kt, pvn, tb, tn, ta, ztrdt, pht_adv, z2) 
    127       CALL tra_adv_qck_mer( kt, pvn, sb, sn, sa, ztrds, pst_adv, z2)   
     116      CALL tra_adv_qck_j( kt, pvn, tb, tn, ta, ztrdt, pht_adv, z2) 
     117      CALL tra_adv_qck_j( kt, pvn, sb, sn, sa, ztrds, pst_adv, z2)   
    128118 
    129119      IF( l_trdtra ) THEN 
    130120         CALL trd_mod(ztrdt, ztrds, jptra_trd_yad, 'TRA', kt) 
    131121         ! 
    132          ! Save the horizontal up-to-date ta/sa trends 
    133          ztrdt(:,:,:) = ta(:,:,:) 
     122         ztrdt(:,:,:) = ta(:,:,:)    ! Save the horizontal up-to-date ta/sa trends 
    134123         ztrds(:,:,:) = sa(:,:,:) 
    135124      END IF 
     
    141130      !------------------------------------------------------------------------- 
    142131      ! 
    143       CALL tra_adv_cen2_ver( pwn, tn, ta ) 
    144       CALL tra_adv_cen2_ver( pwn, sn, sa ) 
     132      CALL tra_adv_cen2_k( pwn, tn, ta ) 
     133      CALL tra_adv_cen2_k( pwn, sn, sa ) 
    145134      ! 
    146135      !Save the vertical advective trends for diagnostic 
     
    179168 
    180169 
    181    SUBROUTINE tra_adv_qck_zon ( kt, pun, tra, tran, traa, ztrdtra, z2 ) 
    182       !!---------------------------------------------------------------------- 
    183       !! 
    184       !!---------------------------------------------------------------------- 
    185       !! * Arguments 
    186       INTEGER,  INTENT(in)                            :: kt              ! ocean time-step index 
     170   SUBROUTINE tra_adv_qck_i ( pun, tra, tran, traa, ztrdtra, z2 ) 
     171      !!---------------------------------------------------------------------- 
     172      !! 
     173      !!---------------------------------------------------------------------- 
    187174      REAL,     INTENT(in)                            :: z2 
    188175      REAL(wp), INTENT(in)   , DIMENSION(jpi,jpj,jpk) :: pun, tra, tran  ! horizontal effective velocity 
     
    196183      REAL(wp), DIMENSION(jpi,jpj)     ::  zfu, zfc, zfd, zfho, zmskl, zsc_e  
    197184      REAL(wp), DIMENSION(jpi,jpj,jpk) ::  zflux 
    198       !---------------------------------------------------------------------- 
    199       ! I. Part 1 : x-direction 
    200185      !---------------------------------------------------------------------- 
    201186 
     
    216201               ! Mask at the T-points in the x-direction (mask=0 or mask=1) 
    217202               zmask(ji,jj)=tmask(ji-1,jj,jk)+tmask(ji,jj,jk)+tmask(ji+1,jj,jk)-2 
    218             ENDDO 
    219          ENDDO 
     203            END DO 
     204         END DO 
    220205         ! 
    221206         !--- Lateral boundary conditions  
     
    244229               zfd(ji,jj)   = dir*tra  (ji+1,jj,jk)+(1-dir)*tra  (ji  ,jj,jk)  ! FD in the x-direction for T 
    245230               zmskl(ji,jj) = dir*zmask(ji  ,jj)   +(1-dir)*zmask(ji+1,jj) 
    246            ENDDO 
    247          ENDDO 
     231           END DO 
     232         END DO 
    248233         ! 
    249234         !--- QUICKEST scheme 
     
    300285      END IF 
    301286 
    302    END SUBROUTINE tra_adv_qck_zon 
    303  
    304  
    305    SUBROUTINE tra_adv_qck_mer ( kt, pvn, tra, tran, traa, ztrdtra, trd_adv, z2 ) 
    306       !!---------------------------------------------------------------------- 
    307       !! 
    308       !!---------------------------------------------------------------------- 
    309       !! * Arguments 
     287   END SUBROUTINE tra_adv_qck_i 
     288 
     289 
     290   SUBROUTINE tra_adv_qck_j ( kt, pvn, tra, tran, traa, ztrdtra, trd_adv, z2 ) 
     291      !!---------------------------------------------------------------------- 
     292      !! 
     293      !!---------------------------------------------------------------------- 
    310294      INTEGER,  INTENT(in)                            :: kt              ! ocean time-step index 
    311295      REAL,     INTENT(in)                            :: z2 
     
    314298      REAL(wp), INTENT(out)  , DIMENSION(jpi,jpj,jpk) :: ztrdtra 
    315299      REAL(wp), INTENT(inout), DIMENSION(jpi,jpj,jpk) :: traa 
    316       ! 
     300      !! 
    317301      INTEGER  :: ji, jj, jk 
    318302      REAL(wp) :: za, zbtr, dir, dx, dt     ! temporary scalars 
     
    342326               ! Mask at the T-points in the x-direction (mask=0 or mask=1) 
    343327               zmask(ji,jj)=tmask(ji,jj-1,jk)+tmask(ji,jj,jk)+tmask(ji,jj+1,jk)-2 
    344             ENDDO 
    345          ENDDO 
     328            END DO 
     329         END DO 
    346330         ! 
    347331         !--- Lateral boundary conditions 
     
    370354               zfd(ji,jj)   = dir*tra  (ji,jj+1,jk)+(1-dir)*tra  (ji,jj  ,jk)  ! FD in the y-direction for T 
    371355               zmskl(ji,jj) = dir*zmask(ji,jj     )+(1-dir)*zmask(ji,jj+1) 
    372             ENDDO 
    373          ENDDO 
     356            END DO 
     357         END DO 
    374358         ! 
    375359         !--- QUICKEST scheme 
     
    440424      ENDIF 
    441425 
    442    END SUBROUTINE tra_adv_qck_mer 
    443  
    444  
    445    SUBROUTINE tra_adv_cen2_ver ( pwn, tra , traa ) 
    446       !!---------------------------------------------------------------------- 
    447       !! 
    448       !!---------------------------------------------------------------------- 
    449       !! * Arguments 
    450       REAL(wp), INTENT(in)   , DIMENSION(jpi,jpj,jpk)  :: pwn        ! horizontal effective velocity 
    451       REAL(wp), INTENT(inout), DIMENSION(jpi,jpj,jpk)  :: tra, traa 
    452       ! 
    453       INTEGER ji, jj, jk 
    454       REAL(wp) :: za, ze3tr       ! temporary scalars 
    455       REAL(wp), DIMENSION(jpi,jpj,jpk) ::  zflux 
    456       ! 
    457       ! Vertical advection 
    458       ! ------------------ 
    459       ! 
    460       ! 1. Vertical advective fluxes 
    461       ! ---------------------------- 
    462       ! 
    463       ! Bottom value : flux set to zero 
    464       zflux(:,:,jpk) = 0.e0 
    465       ! 
    466       ! Surface value 
    467       IF( lk_vvl ) THEN 
    468          ! variable volume : flux set to zero 
    469          zflux(:,:, 1 ) = 0.e0 
    470       ELSE 
    471          ! free surface-constant volume 
    472          zflux(:,:, 1 ) = pwn(:,:,1) * tra(:,:,1) 
     426   END SUBROUTINE tra_adv_qck_j 
     427 
     428 
     429   SUBROUTINE tra_adv_cen2_k ( pwn, ptn, pta ) 
     430      !!---------------------------------------------------------------------- 
     431      !! 
     432      !!---------------------------------------------------------------------- 
     433      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj,jpk)  :: pwn   ! vertical effective velocity 
     434      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj,jpk)  :: ptn   ! now tracer 
     435      REAL(wp), INTENT(inout), DIMENSION(jpi,jpj,jpk)  :: pta   ! tracer general trend 
     436      !! 
     437      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
     438      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zflux   ! 3D workspace 
     439      !!---------------------------------------------------------------------- 
     440      ! 
     441      !                         !==  Vertical advective fluxes  ==! 
     442      zflux(:,:,jpk) = 0.e0             ! Bottom value : flux set to zero 
     443      ! 
     444      !                                 ! Surface value 
     445      IF( lk_vvl ) THEN   ;   zflux(:,:, 1 ) = 0.e0                      ! Variable volume : flux set to zero 
     446      ELSE                ;   zflux(:,:, 1 ) = pwn(:,:,1) * ptn(:,:,1)   ! Constant volume : advective flux through the surface 
    473447      ENDIF 
    474448      ! 
    475       ! Second order centered tracer flux at w-point 
    476       ! 
    477       DO jk = 2, jpkm1 
     449      DO jk = 2, jpkm1                  ! Interior point: second order centered tracer flux at w-point 
    478450         DO jj = 2, jpjm1 
    479451            DO ji = fs_2, fs_jpim1   ! vector opt. 
    480                zflux(ji,jj,jk) = pwn(ji,jj,jk)*0.5*( tra(ji,jj,jk-1) + tra(ji,jj,jk) ) 
     452               zflux(ji,jj,jk) = 0.5 * pwn(ji,jj,jk) * ( ptn(ji,jj,jk-1) + ptn(ji,jj,jk) ) 
    481453            END DO 
    482454         END DO 
    483455      END DO 
    484456      ! 
    485       ! 2. Tracer flux divergence at t-point added to the general trend 
    486       ! --------------------------------------------------------------- 
    487       ! 
    488       DO jk = 1, jpkm1 
     457      DO jk = 1, jpkm1          !==  Tracer flux divergence added to the general trend  ==! 
    489458         DO jj = 2, jpjm1 
    490459            DO ji = fs_2, fs_jpim1   ! vector opt. 
    491                ze3tr = 1. / fse3t(ji,jj,jk) 
    492                ! vertical advective trends 
    493                za = - ze3tr * ( zflux(ji,jj,jk) - zflux(ji,jj,jk+1) ) 
    494                ! add it to the general tracer trends 
    495                traa(ji,jj,jk) =  traa(ji,jj,jk) + za 
     460               pta(ji,jj,jk) =  pta(ji,jj,jk) - ( zflux(ji,jj,jk) - zflux(ji,jj,jk+1) )   & 
     461                  &                           /   fse3t(ji,jj,jk) 
    496462            END DO 
    497463         END DO 
    498464      END DO 
    499465      ! 
    500    END SUBROUTINE tra_adv_cen2_ver 
    501  
    502  
    503    SUBROUTINE quickest(fu,fd,fc,fho,fc_cfl) 
    504       !!---------------------------------------------------------------------- 
    505       !! 
    506       !!---------------------------------------------------------------------- 
    507       !! * Arguments 
     466   END SUBROUTINE tra_adv_cen2_k 
     467 
     468 
     469   SUBROUTINE quickest( fu, fd, fc, fho, fc_cfl ) 
     470      !!---------------------------------------------------------------------- 
     471      !! 
     472      !!---------------------------------------------------------------------- 
    508473      REAL(wp), INTENT(in)  , DIMENSION(jpi,jpj) :: fu, fd, fc, fc_cfl   
    509474      REAL(wp), INTENT(out) , DIMENSION(jpi,jpj) :: fho 
     
    513478      zcoef1(:,:) = 0.5*( fc(:,:) + fd(:,:) ) 
    514479      zcoef2(:,:) = 0.5*fc_cfl(:,:)*( fd(:,:) - fc(:,:) ) 
    515       zcoef3(:,:) = ( ( 1. - ( fc_cfl(:,:)*fc_cfl(:,:) ) )*cst )*zcurv(:,:) 
     480      zcoef3(:,:) = ( ( 1. - ( fc_cfl(:,:)*fc_cfl(:,:) ) )*r1_6 )*zcurv(:,:) 
    516481      fho   (:,:) = zcoef1(:,:) - zcoef2(:,:) - zcoef3(:,:)                         ! phi_f QUICKEST  
    517482      ! 
  • trunk/NEMO/OPA_SRC/ZDF/zdfini.F90

    r1537 r1559  
    11MODULE zdfini 
    22   !!====================================================================== 
    3    !!              ***  MODULE  zdfini  *** 
    4    !! Ocean physics : define vertical mixing variables 
    5    !!===================================================================== 
     3   !!                      ***  MODULE  zdfini  *** 
     4   !! Ocean physics :   read vertical mixing namelist and check consistancy 
     5   !!====================================================================== 
     6   !! History :  8.0  ! 1997-06  (G. Madec)  Original code from inimix 
     7   !!            1.0  ! 2002-08  (G. Madec)  F90 : free form 
     8   !!             -   ! 2005-06  (C. Ethe) KPP parameterization 
     9   !!             -   ! 2009-07  (G. Madec) add avmb, avtb in restart for cen2 advection 
     10   !!---------------------------------------------------------------------- 
    611 
    712   !!---------------------------------------------------------------------- 
    813   !!   zdf_init    : initialization, namelist read, and parameters control 
    914   !!---------------------------------------------------------------------- 
    10    !! * Modules used 
    1115   USE par_oce         ! mesh and scale factors 
    1216   USE ldftra_oce      ! ocean active tracers: lateral physics 
     
    3034   PRIVATE 
    3135 
    32    !! *  Routine accessibility 
    33    PUBLIC zdf_init          ! routine called by opa.F90 
     36   PUBLIC   zdf_init   ! routine called by opa.F90 
     37    
    3438   !!---------------------------------------------------------------------- 
    35    !!   OPA 9.0 , LOCEAN-IPSL (2005)  
     39   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3640   !! $Id$ 
    3741   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     
    4751      !! 
    4852      !! ** Method  :   Read namelist namzdf, control logicals  
    49       !! 
    50       !! History : 
    51       !!        !  97-06  (G. Madec)  Original code from inimix 
    52       !!   8.5  !  02-08  (G. Madec)  F90 : free form 
    53       !!   9.0  !  05-06  (C. Ethe) KPP parameterization 
    5453      !!---------------------------------------------------------------------- 
    5554      INTEGER ::   ioptio       ! temporary scalar 
     
    5958      !!---------------------------------------------------------------------- 
    6059 
    61       REWIND( numnam )               ! Read nam_zdf namelist : vertical mixing parameters 
     60      REWIND( numnam )           !* Read nam_zdf namelist : vertical mixing parameters 
    6261      READ  ( numnam, nam_zdf ) 
    6362 
    64       IF(lwp) THEN                   ! Parameter print 
     63      IF(lwp) THEN               !* Parameter print 
    6564         WRITE(numout,*) 
    6665         WRITE(numout,*) 'zdf_init: vertical physics' 
     
    8180      ENDIF 
    8281 
    83       ! Parameter & logicals controls 
    84       ! ----------------------------- 
    85       ! ... check of vertical mixing scheme on tracers 
    86       !           ==> will be done in trazdf module 
    87  
    88       ! ... check of mixing coefficient 
     82      !                          !* Parameter & logical controls 
     83      !                          !  ---------------------------- 
     84      ! 
     85      !                               ! ... check of vertical mixing scheme on tracers 
     86      !                                              ==> will be done in trazdf module 
     87      ! 
     88      !                               ! ... check of mixing coefficient 
    8989      IF(lwp) WRITE(numout,*) 
    90       IF(lwp) WRITE(numout,*) '          vertical mixing option :' 
     90      IF(lwp) WRITE(numout,*) '   vertical mixing option :' 
    9191      ioptio = 0 
    9292      IF( lk_zdfcst ) THEN 
    93          IF(lwp) WRITE(numout,*) '             constant eddy diffusion coefficients' 
     93         IF(lwp) WRITE(numout,*) '      constant eddy diffusion coefficients' 
    9494         ioptio = ioptio+1 
    9595      ENDIF 
    9696      IF( lk_zdfric ) THEN 
    97          IF(lwp) WRITE(numout,*) '             Richardson dependent eddy coefficients' 
     97         IF(lwp) WRITE(numout,*) '      Richardson dependent eddy coefficients' 
    9898         ioptio = ioptio+1 
    9999      ENDIF 
    100100      IF( lk_zdftke_old ) THEN 
    101          IF(lwp) WRITE(numout,*) '             TKE dependent eddy coefficients' 
     101         IF(lwp) WRITE(numout,*) '      TKE dependent eddy coefficients' 
    102102         ioptio = ioptio+1 
    103103      ENDIF 
    104104      IF( lk_zdftke ) THEN 
    105          IF(lwp) WRITE(numout,*) '             TKE dependent eddy coefficients' 
     105         IF(lwp) WRITE(numout,*) '      TKE dependent eddy coefficients' 
    106106         ioptio = ioptio+1 
    107107      ENDIF 
    108108      IF( lk_zdfkpp ) THEN 
    109          IF(lwp) WRITE(numout,*) '             KPP dependent eddy coefficients' 
     109         IF(lwp) WRITE(numout,*) '      KPP dependent eddy coefficients' 
    110110         ioptio = ioptio+1 
    111111      ENDIF 
    112112      IF( ioptio == 0 .OR. ioptio > 1 .AND. .NOT. lk_esopa ) & 
    113          CALL ctl_stop( ' one and only one vertical diffusion option has to be defined ' ) 
    114  
    115       ! ... Convection 
     113         &   CALL ctl_stop( ' one and only one vertical diffusion option has to be defined ' ) 
     114      ! 
     115      !                               ! ... Convection 
    116116      IF(lwp) WRITE(numout,*) 
    117       IF(lwp) WRITE(numout,*) '          convection :' 
     117      IF(lwp) WRITE(numout,*) '   convection :' 
    118118      ioptio = 0 
    119119      IF( ln_zdfnpc ) THEN 
    120          IF(lwp) WRITE(numout,*) '             use non penetrative convective scheme' 
     120         IF(lwp) WRITE(numout,*) '      use non penetrative convective scheme' 
    121121         ioptio = ioptio+1 
    122122      ENDIF 
    123123      IF( ln_zdfevd ) THEN 
    124          IF(lwp) WRITE(numout,*) '             use enhanced vertical dif. scheme' 
     124         IF(lwp) WRITE(numout,*) '      use enhanced vertical dif. scheme' 
    125125         ioptio = ioptio+1 
    126126      ENDIF 
    127127      IF( lk_zdftke_old .OR. lk_zdftke ) THEN 
    128          IF(lwp) WRITE(numout,*) '             use the 1.5 turbulent closure' 
     128         IF(lwp) WRITE(numout,*) '      use the 1.5 turbulent closure' 
    129129      ENDIF 
    130130      IF( lk_zdfkpp ) THEN 
    131          IF(lwp) WRITE(numout,*) '             use the KPP closure scheme' 
     131         IF(lwp) WRITE(numout,*) '      use the KPP closure scheme' 
    132132         IF(lk_mpp) THEN 
    133133            IF(lwp) WRITE(numout,cform_err) 
    134             IF(lwp) WRITE(numout,*) '             The KPP scheme is not ready to run in MPI' 
     134            IF(lwp) WRITE(numout,*) 'The KPP scheme is not ready to run in MPI' 
    135135         ENDIF 
    136136      ENDIF 
    137       IF ( ioptio > 1 .AND. .NOT. lk_esopa ) & 
    138            CALL ctl_stop( ' chose between ln_zdfnpc', '           and ln_zdfevd' ) 
     137      IF ( ioptio > 1 .AND. .NOT. lk_esopa )   CALL ctl_stop( ' chose between ln_zdfnpc and ln_zdfevd' ) 
    139138      IF( ioptio == 0 .AND. .NOT.( lk_zdftke_old .OR. lk_zdftke .OR. lk_zdfkpp ) ) & 
    140139         CALL ctl_stop( ' except for TKE sor KPP physics, a convection scheme is', & 
  • trunk/NEMO/OPA_SRC/ZDF/zdfmxl.F90

    r1482 r1559  
    44   !! Ocean physics: mixed layer depth  
    55   !!====================================================================== 
    6    !! History : 
    7    !!   9.0  !  03-08  (G. Madec)  OpenMP/autotasking optimization 
     6   !! History :  1.0  ! 2003-08  (G. Madec)  original code 
     7   !!            3.2  ! 2009-07  (S. Masson, G. Madec)  IOM + merge of DO-loop 
    88   !!---------------------------------------------------------------------- 
    99   !!   zdf_mxl      : Compute the turbocline and mixed layer depths. 
    1010   !!---------------------------------------------------------------------- 
    11    !! * Modules used 
    1211   USE oce             ! ocean dynamics and tracers variables 
    1312   USE dom_oce         ! ocean space and time domain variables 
     
    2019   PRIVATE 
    2120 
    22    !! * Routine accessibility 
    23    PUBLIC zdf_mxl           ! called by step.F90 
     21   PUBLIC   zdf_mxl    ! called by step.F90 
    2422 
    25    !! * Shared module variables 
    26    INTEGER, PUBLIC, DIMENSION(jpi,jpj) ::   &   !: 
    27       nmln                  !: number of level in the mixed layer 
    28    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &   !: 
    29       hmld ,             &  !: mixing layer depth (turbocline) (m) 
    30       hmlp ,             &  !: mixed layer depth  (rho=rho0+zdcrit) (m) 
    31       hmlpt                 !: mixed layer depth at t-points (m) 
     23   INTEGER , PUBLIC, DIMENSION(jpi,jpj) ::   nmln    !: number of level in the mixed layer 
     24   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hmld    !: mixing layer depth (turbocline)      [m] 
     25   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hmlp    !: mixed layer depth  (rho=rho0+zdcrit) [m] 
     26   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hmlpt   !: mixed layer depth at t-points        [m] 
    3227 
    33    !! * module variables 
    34    REAL(wp) ::   & 
    35       avt_c = 5.e-4_wp,  &  ! Kz criterion for the turbocline depth 
    36       rho_c = 0.01_wp       ! density criterion for mixed layer depth 
     28   REAL(wp) ::   avt_c = 5.e-4_wp   ! Kz criterion for the turbocline depth 
     29   REAL(wp) ::   rho_c = 0.01_wp    ! density criterion for mixed layer depth 
    3730 
    3831   !! * Substitutions 
    3932#  include "domzgr_substitute.h90" 
    4033   !!---------------------------------------------------------------------- 
    41    !!   OPA 9.0 , LOCEAN-IPSL (2005)  
     34   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4235   !! $Id$  
    43    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt  
     36   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    4437   !!---------------------------------------------------------------------- 
    4538 
     
    5144      !!                    
    5245      !! ** Purpose :   Compute the turbocline depth and the mixed layer depth 
    53       !!      with density criteria. 
     46      !!              with density criteria. 
    5447      !! 
    5548      !! ** Method  :   The turbocline depth is the depth at which the vertical 
     
    5851      !!      value defined locally (avt_c here taken equal to 5 cm/s2) 
    5952      !! 
    60       !! ** Action  : 
     53      !! ** Action  :   nmln, hmld, hmlp, hmlpt 
     54      !!---------------------------------------------------------------------- 
     55      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
    6156      !! 
    62       !! History : 
    63       !!        !  94-11  (M. Imbard)  Original code 
    64       !!   8.0  !  96-01  (E. Guilyardi)  sub mixed layer temp. 
    65       !!   8.1  !  97-07  (G. Madec)  optimization 
    66       !!   8.5  !  02-06  (G. Madec)  F90: Free form and module 
    67       !!---------------------------------------------------------------------- 
    68       !! * Arguments 
    69       INTEGER, INTENT( in ) ::   kt         ! ocean time-step index 
    70  
    71       !! * Local declarations 
    7257      INTEGER ::   ji, jj, jk     ! dummy loop indices 
    73       INTEGER ::   ik             ! temporary integer 
    74       INTEGER, DIMENSION(jpi,jpj) ::   & 
    75          imld                     ! temporary workspace 
     58      INTEGER ::   iki, ikn       ! temporary integer 
     59      INTEGER, DIMENSION(jpi,jpj) ::   imld   ! temporary workspace 
    7660      !!---------------------------------------------------------------------- 
    7761 
     
    8266      ENDIF 
    8367 
    84  
    85       ! 1. Turbocline depth 
    86       ! ------------------- 
    87       ! last w-level at which avt<avt_c (starting from the bottom jk=jpk) 
    88       ! (since avt(.,.,jpk)=0, we have jpk=< imld =< 2 ) 
    89       DO jk = jpk, 2, -1 
     68      ! w-level of the mixing and mixed layers 
     69      nmln(:,:) = mbathy(:,:)      ! Initialization to the number of w ocean point mbathy 
     70      imld(:,:) = mbathy(:,:) 
     71      DO jk = jpkm1, 2, -1         ! from the bottom to the surface 
    9072         DO jj = 1, jpj 
    9173            DO ji = 1, jpi 
    92                IF( avt(ji,jj,jk) < avt_c ) imld(ji,jj) = jk  
     74               IF( avt (ji,jj,jk) < avt_c                 )   imld(ji,jj) = jk      ! Turbocline  
     75               IF( rhop(ji,jj,jk) > rhop(ji,jj,1) + rho_c )   nmln(ji,jj) = jk      ! Mixed layer 
    9376            END DO 
    9477         END DO 
    9578      END DO 
    96  
    97       ! Turbocline depth and sub-turbocline temperature 
     79      ! depth of the mixing and mixed layers 
    9880      DO jj = 1, jpj 
    9981         DO ji = 1, jpi 
    100             ik = imld(ji,jj) 
    101             hmld (ji,jj) = fsdepw(ji,jj,ik) * tmask(ji,jj,1) 
     82            iki = imld(ji,jj) 
     83            ikn = nmln(ji,jj) 
     84            hmld (ji,jj) = fsdepw(ji,jj,iki) * tmask(ji,jj,1)      ! Turbocline depth  
     85            hmlp (ji,jj) = fsdepw(ji,jj,ikn) * tmask(ji,jj,1)      ! Mixed layer depth 
     86            hmlpt(ji,jj) = fsdept(ji,jj,ikn-1)                     ! depth of the last T-point inside the mixed layer 
    10287         END DO 
    10388      END DO 
    10489      CALL iom_put( "mldturb", hmld )   ! turbocline depth 
    105  
    106 !!gm idea 
    107 !!    
    108 !!gm  DO jk = jpk, 2, -1 
    109 !!gm     DO jj = 1, jpj 
    110 !!gm        DO ji = 1, jpi 
    111 !!gm           IF( avt(ji,jj,jk) < avt_c ) hmld(ji,jj) = fsdepw(ji,jj,jk) * tmask(ji,jj,1) 
    112 !!gm        END DO 
    113 !!gm     END DO 
    114 !!gm  END DO 
    115 !!gm 
    116  
    117       ! 2. Mixed layer depth 
    118       ! -------------------- 
    119       ! Initialization to the number of w ocean point mbathy 
    120       nmln(:,:) = mbathy(:,:) 
    121  
    122       ! Last w-level at which rhop>=rho surf+rho_c (starting from jpk-1) 
    123       ! (rhop defined at t-point, thus jk-1 for w-level just above) 
    124       DO jk = jpkm1, 2, -1 
    125          DO jj = 1, jpj 
    126             DO ji = 1, jpi 
    127                IF( rhop(ji,jj,jk) > rhop(ji,jj,1) + rho_c )   nmln(ji,jj) = jk 
    128             END DO 
    129          END DO 
    130       END DO 
    131  
    132       ! Mixed layer depth 
    133       DO jj = 1, jpj 
    134          DO ji = 1, jpi 
    135             ik = nmln(ji,jj) 
    136             hmlp (ji,jj) = fsdepw(ji,jj,ik) * tmask(ji,jj,1) 
    137             hmlpt(ji,jj) = fsdept(ji,jj,ik-1) 
    138          END DO 
    139       END DO 
    140       CALL iom_put( "mld010", hmlp )   ! mixed layer depth 
     90      CALL iom_put( "mld010" , hmlp )   ! mixed layer depth 
    14191       
    14292      IF(ln_ctl)   CALL prt_ctl( tab2d_1=REAL(nmln,wp), clinfo1=' nmln : ', tab2d_2=hmld, clinfo2=' hmld : ', ovlap=1 ) 
    143  
     93      ! 
    14494   END SUBROUTINE zdf_mxl 
    14595 
  • trunk/NEMO/OPA_SRC/daymod.F90

    r1359 r1559  
    44   !! Ocean        :  calendar  
    55   !!===================================================================== 
    6    !! History :        !  94-09  (M. Pontaud M. Imbard)  Original code 
    7    !!                  !  97-03  (O. Marti) 
    8    !!                  !  97-05  (G. Madec)  
    9    !!                  !  97-08  (M. Imbard) 
    10    !!             9.0  !  03-09  (G. Madec)  F90 + nyear, nmonth, nday 
    11    !!                  !  04-01  (A.M. Treguier) new calculation based on adatrj 
    12    !!                  !  06-08  (G. Madec)  surface module major update 
     6   !! History :  OPA  ! 1994-09  (M. Pontaud M. Imbard)  Original code 
     7   !!                 ! 1997-03  (O. Marti) 
     8   !!                 ! 1997-05  (G. Madec)  
     9   !!                 ! 1997-08  (M. Imbard) 
     10   !!   NEMO     1.0  ! 2003-09  (G. Madec)  F90 + nyear, nmonth, nday 
     11   !!                 ! 2004-01  (A.M. Treguier) new calculation based on adatrj 
     12   !!                 ! 2006-08  (G. Madec)  surface module major update 
    1313   !!----------------------------------------------------------------------       
    1414 
     
    3030   USE in_out_manager  ! I/O manager 
    3131   USE iom             !  
    32    USE ioipsl, ONLY :   ymds2ju        ! for calendar 
     32   USE ioipsl, ONLY :   ymds2ju   ! for calendar 
    3333   USE prtctl          ! Print control 
    3434   USE restart         !  
     
    3737   PRIVATE 
    3838 
    39    PUBLIC day        ! called by step.F90 
    40    PUBLIC day_init   ! called by istate.F90 
     39   PUBLIC   day        ! called by step.F90 
     40   PUBLIC   day_init   ! called by istate.F90 
    4141 
    4242   INTEGER , PUBLIC ::   nyear       !: current year 
     
    5050 
    5151   REAL(wp), PUBLIC ::   fjulday     !: julian day  
    52    REAL(wp), PUBLIC ::   adatrj      !: number of elapsed days since the begining of the run 
    53    !                                 !: it is the accumulated duration of previous runs 
    54    !                                 !: that may have been run with different time steps. 
    55    INTEGER , PUBLIC, DIMENSION(0:1)  ::   nyear_len    !: length in days of the previous/current year 
     52   REAL(wp), PUBLIC ::   adatrj      !: number of elapsed days since the begining of the whole simulation 
     53   !                                 !: (cumulative duration of previous runs that may have used different time-step size) 
     54   INTEGER , PUBLIC, DIMENSION(0: 1) ::   nyear_len    !: length in days of the previous/current year 
    5655   INTEGER , PUBLIC, DIMENSION(0:13) ::   nmonth_len   !: length in days of the months of the current year 
    57    REAL(wp), PUBLIC, DIMENSION(0:13) ::   rmonth_half  !: second since the beginning of the year and the halft of the months 
    58    REAL(wp), PUBLIC, DIMENSION(0:13) ::   rmonth_end   !: second since the beginning of the year and the end of the months 
    59    REAL(wp), PUBLIC                  ::   sec1jan000   !: second since Jan. 1st 00h of nit000 year and Jan. 1st 00h of the current year 
     56   REAL(wp), PUBLIC, DIMENSION(0:13) ::   rmonth_half  !: second since Jan 1st 0h of the current year and the half of the months 
     57   REAL(wp), PUBLIC, DIMENSION(0:13) ::   rmonth_end   !: second since Jan 1st 0h of the current year and the end of the months 
     58   REAL(wp), PUBLIC                  ::   sec1jan000   !: second since Jan 1st 0h of nit000 year and Jan 1st 0h the current year 
    6059 
    6160   ! this two variables are wrong DO NOT USE THEM !!! 
     
    6564      &                                           31, 31, 30, 31, 30, 31 /)     !: (365 days a year) 
    6665 
    67  
    6866   !!---------------------------------------------------------------------- 
    69    !!  OPA 9.0 , LOCEAN-IPSL (2006)  
     67   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    7068   !! $Id$ 
    7169   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     
    183181         rmonth_end(jm) = rmonth_end(jm-1) + rday * REAL( nmonth_len(jm), wp ) 
    184182      END DO 
    185                   
     183      !            
    186184   END SUBROUTINE  
    187185 
  • trunk/NEMO/OPA_SRC/eosbn2.F90

    r1493 r1559  
    55   !!                                               - Brunt-Vaisala frequency  
    66   !!============================================================================== 
    7    !! History :       !  89-03  (O. Marti)  Original code 
    8    !!            6.0  !  94-07  (G. Madec, M. Imbard)  add bn2 
    9    !!            6.0  !  94-08  (G. Madec)  Add Jackett & McDougall eos 
    10    !!            7.0  !  96-01  (G. Madec)  statement function for e3 
    11    !!            8.1  !  97-07  (G. Madec)  introduction of neos, OPA8.1 
    12    !!            8.1  !  97-07  (G. Madec)  density instead of volumic mass 
    13    !!                 !  99-02  (G. Madec, N. Grima) semi-implicit pressure gradient 
    14    !!                 !  01-09  (M. Ben Jelloul)  bugfix onlinear eos 
    15    !!            8.5  !  02-10  (G. Madec)  add eos_init 
    16    !!            8.5  !  02-11  (G. Madec, A. Bozec)  partial step, eos_insitu_2d 
    17    !!            9.0  !  03-08  (G. Madec)  F90, free form 
    18    !!            9.0  !  06-08  (G. Madec)  add tfreez function 
     7   !! History :  OPA  ! 1989-03  (O. Marti)  Original code 
     8   !!            6.0  ! 1994-07  (G. Madec, M. Imbard)  add bn2 
     9   !!            6.0  ! 1994-08  (G. Madec)  Add Jackett & McDougall eos 
     10   !!            7.0  ! 1996-01  (G. Madec)  statement function for e3 
     11   !!            8.1  ! 1997-07  (G. Madec)  introduction of neos, OPA8.1 
     12   !!            8.1  ! 1997-07  (G. Madec)  density instead of volumic mass 
     13   !!             -   ! 1999-02  (G. Madec, N. Grima) semi-implicit pressure gradient 
     14   !!            8.2  ! 2001-09  (M. Ben Jelloul)  bugfix on linear eos 
     15   !!   NEMO     1.0  ! 2002-10  (G. Madec)  add eos_init 
     16   !!             -   ! 2002-11  (G. Madec, A. Bozec)  partial step, eos_insitu_2d 
     17   !!             -   ! 2003-08  (G. Madec)  F90, free form 
     18   !!            3.0  ! 2006-08  (G. Madec)  add tfreez function 
    1919   !!---------------------------------------------------------------------- 
    2020 
     
    5151   PUBLIC   tfreez     ! called by sbcice_... modules 
    5252 
    53    !!* Namelist (nameos) 
     53   !                                      !!* Namelist (nameos) * 
    5454   INTEGER , PUBLIC ::   neos   = 0        !: = 0/1/2 type of eq. of state and Brunt-Vaisala frequ. 
    5555   REAL(wp), PUBLIC ::   ralpha = 2.0e-4   !: thermal expension coeff. (linear equation of state) 
    5656   REAL(wp), PUBLIC ::   rbeta  = 7.7e-4   !: saline  expension coeff. (linear equation of state) 
     57   REAL(wp), PUBLIC ::   ralpbet           !: alpha / beta ratio 
    5758    
    5859   !! * Substitutions 
     
    6061#  include "vectopt_loop_substitute.h90" 
    6162   !!---------------------------------------------------------------------- 
    62    !!   OPA 9.0 , LOCEAN-IPSL (2006)  
     63   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    6364   !! $Id$ 
    6465   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     
    107108      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(  out) ::   prd    ! in situ density  
    108109      !! 
    109       INTEGER ::  ji, jj, jk      ! dummy loop indices 
    110       REAL(wp) ::   &           
    111          zt , zs , zh , zsr,   &  ! temporary scalars 
    112          zr1, zr2, zr3, zr4,   &  !    "         "  
    113          zrhop, ze, zbw, zb,   &  !    "         " 
    114          zd , zc , zaw, za ,   &  !    "         " 
    115          zb1, za1, zkw, zk0       !    "         " 
     110      INTEGER  ::   ji, jj, jk           ! dummy loop indices 
     111      REAL(wp) ::   zt , zs , zh , zsr   ! temporary scalars 
     112      REAL(wp) ::   zr1, zr2, zr3, zr4   !    -         - 
     113      REAL(wp) ::   zrhop, ze, zbw, zb   !    -         - 
     114      REAL(wp) ::   zd , zc , zaw, za    !    -         - 
     115      REAL(wp) ::   zb1, za1, zkw, zk0   !    -         - 
     116      REAL(wp) ::   zrau0r               !    -         - 
    116117      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zws   ! temporary workspace 
    117118      !!---------------------------------------------------------------------- 
    118119 
    119       SELECT CASE ( neos ) 
    120       ! 
    121       CASE ( 0 )               ! Jackett and McDougall (1994) formulation 
    122          ! 
     120      SELECT CASE( neos ) 
     121      ! 
     122      CASE( 0 )                !==  Jackett and McDougall (1994) formulation  ==! 
     123         zrau0r = 1.e0 / rau0 
    123124!CDIR NOVERRCHK 
    124125         zws(:,:,:) = SQRT( ABS( psal(:,:,:) ) ) 
    125          !                                                ! =============== 
    126          DO jk = 1, jpkm1                                 ! Horizontal slab 
    127             !                                             ! =============== 
     126         !   
     127         DO jk = 1, jpkm1 
    128128            DO jj = 1, jpj 
    129129               DO ji = 1, jpi 
    130                   zt = ptem(ji,jj,jk) 
    131                   zs = psal(ji,jj,jk) 
    132                   ! depth 
    133                   zh = fsdept(ji,jj,jk) 
    134                   ! square root salinity 
    135                   zsr= zws(ji,jj,jk) 
     130                  zt = ptem  (ji,jj,jk) 
     131                  zs = psal  (ji,jj,jk) 
     132                  zh = fsdept(ji,jj,jk)        ! depth 
     133                  zsr= zws   (ji,jj,jk)        ! square root salinity 
     134                  ! 
    136135                  ! compute volumic mass pure water at atm pressure 
    137136                  zr1= ( ( ( ( 6.536332e-9*zt-1.120083e-6 )*zt+1.001685e-4)*zt   & 
    138                      -9.095290e-3 )*zt+6.793952e-2 )*zt+999.842594 
     137                     &      -9.095290e-3 )*zt+6.793952e-2 )*zt+999.842594 
    139138                  ! seawater volumic mass atm pressure 
    140                   zr2= ( ( ( 5.3875e-9*zt-8.2467e-7 ) *zt+7.6438e-5 ) *zt   & 
    141                      -4.0899e-3 ) *zt+0.824493 
     139                  zr2= ( ( ( 5.3875e-9*zt-8.2467e-7 ) *zt+7.6438e-5 ) *zt        & 
     140                     &                   -4.0899e-3 ) *zt+0.824493 
    142141                  zr3= ( -1.6546e-6*zt+1.0227e-4 ) *zt-5.72466e-3 
    143142                  zr4= 4.8314e-4 
    144  
     143                  ! 
    145144                  ! potential volumic mass (reference to the surface) 
    146145                  zrhop= ( zr4*zs + zr3*zsr + zr2 ) *zs + zr1 
    147  
     146                  ! 
    148147                  ! add the compression terms 
    149148                  ze = ( -3.508914e-8*zt-1.248266e-8 ) *zt-2.595994e-6 
    150149                  zbw= (  1.296821e-6*zt-5.782165e-9 ) *zt+1.045941e-4 
    151150                  zb = zbw + ze * zs 
    152  
     151                  ! 
    153152                  zd = -2.042967e-2 
    154153                  zc =   (-7.267926e-5*zt+2.598241e-3 ) *zt+0.1571896 
    155154                  zaw= ( ( 5.939910e-6*zt+2.512549e-3 ) *zt-0.1028859 ) *zt - 4.721788 
    156155                  za = ( zd*zsr + zc ) *zs + zaw 
    157  
     156                  ! 
    158157                  zb1=   (-0.1909078*zt+7.390729 ) *zt-55.87545 
    159158                  za1= ( ( 2.326469e-3*zt+1.553190)*zt-65.00517 ) *zt+1044.077 
    160159                  zkw= ( ( (-1.361629e-4*zt-1.852732e-2 ) *zt-30.41638 ) *zt + 2098.925 ) *zt+190925.6 
    161160                  zk0= ( zb1*zsr + za1 )*zs + zkw 
    162  
     161                  ! 
    163162                  ! masked in situ density anomaly 
    164163                  prd(ji,jj,jk) = (  zrhop / (  1.0 - zh / ( zk0 - zh * ( za - zh * zb ) )  )    & 
    165                      - rau0 ) / rau0 * tmask(ji,jj,jk) 
     164                     &             - rau0  ) * zrau0r * tmask(ji,jj,jk) 
    166165               END DO 
    167166            END DO 
    168             !                                             ! =============== 
    169          END DO                                           !   End of slab 
    170          !                                                ! =============== 
    171          ! 
    172       CASE ( 1 )               ! Linear formulation function of temperature only 
    173          ! 
    174          !                                                ! =============== 
    175          DO jk = 1, jpkm1                                 ! Horizontal slab 
    176             !                                             ! =============== 
    177             DO jj = 1, jpj 
    178                DO ji = 1, jpi 
    179                   zt = ptem(ji,jj,jk) 
    180                   zs = psal(ji,jj,jk) 
    181                   !   ... density and potential volumic mass 
    182                   prd(ji,jj,jk) = ( 0.0285 - ralpha * zt ) * tmask(ji,jj,jk) 
    183                END DO 
    184             END DO 
    185             !                                             ! =============== 
    186          END DO                                           !   End of slab 
    187          !                                                ! =============== 
    188          ! 
    189       CASE ( 2 )               ! Linear formulation function of temperature and salinity 
    190          ! 
    191          !                                                ! =============== 
    192          DO jk = 1, jpkm1                                 ! Horizontal slab 
    193             !                                             ! =============== 
    194             DO jj = 1, jpj 
    195                DO ji = 1, jpi 
    196                   zt = ptem(ji,jj,jk) 
    197                   zs = psal(ji,jj,jk) 
    198                   !   ... density and potential volumic mass 
    199                   prd(ji,jj,jk) = (   rbeta  * zs - ralpha * zt ) * tmask(ji,jj,jk) 
    200                END DO 
    201             END DO 
    202             !                                             ! =============== 
    203          END DO                                           !   End of slab 
    204          !                                                ! =============== 
     167         END DO 
     168         ! 
     169      CASE( 1 )                !==  Linear formulation function of temperature only  ==! 
     170         DO jk = 1, jpkm1 
     171            prd(:,:,jk) = ( 0.0285 - ralpha * ptem(:,:,jk) ) * tmask(:,:,jk) 
     172         END DO 
     173         ! 
     174      CASE( 2 )                !==  Linear formulation function of temperature and salinity  ==! 
     175         DO jk = 1, jpkm1 
     176            prd(:,:,jk) = ( rbeta  * psal(:,:,jk) - ralpha * ptem(:,:,jk) ) * tmask(:,:,jk) 
     177         END DO 
    205178         ! 
    206179      CASE DEFAULT 
    207          ! 
    208180         WRITE(ctmp1,*) '          bad flag value for neos = ', neos 
    209181         CALL ctl_stop( ctmp1 ) 
     
    211183      END SELECT 
    212184      ! 
    213       IF(ln_ctl)   CALL prt_ctl(tab3d_1=prd, clinfo1=' eos  : ', ovlap=1, kdim=jpk) 
     185      IF(ln_ctl)   CALL prt_ctl( tab3d_1=prd, clinfo1=' eos  : ', ovlap=1, kdim=jpk ) 
    214186      ! 
    215187   END SUBROUTINE eos_insitu 
     
    267239      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(  out) ::   prhop  ! potential density (surface referenced) 
    268240 
    269       INTEGER  ::  ji, jj, jk                ! dummy loop indices 
    270       REAL(wp) ::   &             ! temporary scalars 
    271          zt, zs, zh, zsr, zr1, zr2, zr3, zr4, zrhop, ze, zbw,   & 
    272          zb, zd, zc, zaw, za, zb1, za1, zkw, zk0 
    273       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zws 
     241      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
     242      REAL(wp) ::   zt, zs, zh, zsr, zr1, zr2, zr3, zr4, zrhop, ze, zbw   ! temporary scalars 
     243      REAL(wp) ::   zb, zd, zc, zaw, za, zb1, za1, zkw, zk0, zrau0r       !    -         - 
     244      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zws   ! 3D workspace 
    274245      !!---------------------------------------------------------------------- 
    275246 
    276247      SELECT CASE ( neos ) 
    277248      ! 
    278       CASE ( 0 )               ! Jackett and McDougall (1994) formulation 
    279          ! 
     249      CASE( 0 )                !==  Jackett and McDougall (1994) formulation  ==! 
     250         zrau0r = 1.e0 / rau0 
    280251!CDIR NOVERRCHK 
    281252         zws(:,:,:) = SQRT( ABS( psal(:,:,:) ) ) 
    282          !                                                ! =============== 
    283          DO jk = 1, jpkm1                                 ! Horizontal slab 
    284             !                                             ! =============== 
     253         !   
     254         DO jk = 1, jpkm1 
    285255            DO jj = 1, jpj 
    286256               DO ji = 1, jpi 
    287                   zt = ptem(ji,jj,jk) 
    288                   zs = psal(ji,jj,jk) 
    289                   ! depth 
    290                   zh = fsdept(ji,jj,jk) 
    291                   ! square root salinity 
    292                   zsr= zws(ji,jj,jk) 
     257                  zt = ptem  (ji,jj,jk) 
     258                  zs = psal  (ji,jj,jk) 
     259                  zh = fsdept(ji,jj,jk)        ! depth 
     260                  zsr= zws   (ji,jj,jk)        ! square root salinity 
     261                  ! 
    293262                  ! compute volumic mass pure water at atm pressure 
    294                   zr1= ( ( ( ( 6.536332e-9*zt-1.120083e-6 )*zt+1.001685e-4)*zt   & 
    295                      -9.095290e-3 )*zt+6.793952e-2 )*zt+999.842594 
     263                  zr1= ( ( ( ( 6.536332e-9*zt-1.120083e-6 )*zt+1.001685e-4 )*zt   & 
     264                     &                       -9.095290e-3 )*zt+6.793952e-2 )*zt+999.842594 
    296265                  ! seawater volumic mass atm pressure 
    297266                  zr2= ( ( ( 5.3875e-9*zt-8.2467e-7 ) *zt+7.6438e-5 ) *zt   & 
    298                      -4.0899e-3 ) *zt+0.824493 
     267                     &                                   -4.0899e-3 ) *zt+0.824493 
    299268                  zr3= ( -1.6546e-6*zt+1.0227e-4 ) *zt-5.72466e-3 
    300269                  zr4= 4.8314e-4 
    301  
     270                  ! 
    302271                  ! potential volumic mass (reference to the surface) 
    303272                  zrhop= ( zr4*zs + zr3*zsr + zr2 ) *zs + zr1 
    304  
     273                  ! 
    305274                  ! save potential volumic mass 
    306275                  prhop(ji,jj,jk) = zrhop * tmask(ji,jj,jk) 
    307  
     276                  ! 
    308277                  ! add the compression terms 
    309278                  ze = ( -3.508914e-8*zt-1.248266e-8 ) *zt-2.595994e-6 
    310279                  zbw= (  1.296821e-6*zt-5.782165e-9 ) *zt+1.045941e-4 
    311280                  zb = zbw + ze * zs 
    312  
     281                  ! 
    313282                  zd = -2.042967e-2 
    314283                  zc =   (-7.267926e-5*zt+2.598241e-3 ) *zt+0.1571896 
    315284                  zaw= ( ( 5.939910e-6*zt+2.512549e-3 ) *zt-0.1028859 ) *zt - 4.721788 
    316285                  za = ( zd*zsr + zc ) *zs + zaw 
    317  
     286                  ! 
    318287                  zb1=   (-0.1909078*zt+7.390729 ) *zt-55.87545 
    319288                  za1= ( ( 2.326469e-3*zt+1.553190)*zt-65.00517 ) *zt+1044.077 
    320289                  zkw= ( ( (-1.361629e-4*zt-1.852732e-2 ) *zt-30.41638 ) *zt + 2098.925 ) *zt+190925.6 
    321290                  zk0= ( zb1*zsr + za1 )*zs + zkw 
    322  
     291                  ! 
    323292                  ! masked in situ density anomaly 
    324293                  prd(ji,jj,jk) = (  zrhop / (  1.0 - zh / ( zk0 - zh * ( za - zh * zb ) )  )    & 
    325                      - rau0 ) / rau0 * tmask(ji,jj,jk) 
     294                     &             - rau0  ) * zrau0r * tmask(ji,jj,jk) 
    326295               END DO 
    327296            END DO 
    328             !                                             ! =============== 
    329          END DO                                           !   End of slab 
    330          !                                                ! =============== 
    331          ! 
    332       CASE ( 1 )               ! Linear formulation function of temperature only 
    333          ! 
    334          !                                                ! =============== 
    335          DO jk = 1, jpkm1                                 ! Horizontal slab 
    336             !                                             ! =============== 
    337             DO jj = 1, jpj 
    338                DO ji = 1, jpi 
    339                   zt = ptem(ji,jj,jk) 
    340                   zs = psal(ji,jj,jk) 
    341                   !   ... density and potential volumic mass 
    342                   prd  (ji,jj,jk) = ( 0.0285 - ralpha * zt )        * tmask(ji,jj,jk) 
    343                   prhop(ji,jj,jk) = ( rau0 * prd(ji,jj,jk) + rau0 ) * tmask(ji,jj,jk) 
    344                END DO 
    345             END DO 
    346             !                                             ! =============== 
    347          END DO                                           !   End of slab 
    348          !                                                ! =============== 
    349          ! 
    350       CASE ( 2 )               ! Linear formulation function of temperature and salinity 
    351          ! 
    352          !                                                ! =============== 
    353          DO jk = 1, jpkm1                                 ! Horizontal slab 
    354             !                                             ! =============== 
    355             DO jj = 1, jpj 
    356                DO ji = 1, jpi 
    357                   zt = ptem(ji,jj,jk) 
    358                   zs = psal(ji,jj,jk) 
    359                   !   ... density and potential volumic mass 
    360                   prd  (ji,jj,jk) = ( rbeta  * zs - ralpha * zt ) * tmask(ji,jj,jk) 
    361                   prhop(ji,jj,jk) = ( rau0 * prd(ji,jj,jk) + rau0 )    * tmask(ji,jj,jk) 
    362                END DO 
    363             END DO 
    364             !                                             ! =============== 
    365          END DO                                           !   End of slab 
    366          !                                                ! =============== 
     297         END DO 
     298         ! 
     299      CASE( 1 )                !==  Linear formulation = F( temperature )  ==! 
     300         DO jk = 1, jpkm1 
     301            prd  (:,:,jk) = ( 0.0285 - ralpha * ptem(:,:,jk) )        * tmask(:,:,jk) 
     302            prhop(:,:,jk) = ( 1.e0   +          prd (:,:,jk) ) * rau0 * tmask(:,:,jk) 
     303         END DO 
     304         ! 
     305      CASE( 2 )                !==  Linear formulation = F( temperature , salinity )  ==! 
     306         DO jk = 1, jpkm1 
     307            prd  (:,:,jk) = ( rbeta  * psal(:,:,jk) - ralpha * ptem(:,:,jk) )        * tmask(:,:,jk) 
     308            prhop(:,:,jk) = ( 1.e0   + prd (:,:,jk) )                         * rau0 * tmask(:,:,jk) 
     309         END DO 
    367310         ! 
    368311      CASE DEFAULT 
    369          ! 
    370312         WRITE(ctmp1,*) '          bad flag value for neos = ', neos 
    371313         CALL ctl_stop( ctmp1 ) 
     
    419361      REAL(wp), DIMENSION(jpi,jpj), INTENT(  out) ::   prd    ! in situ density  
    420362      !! 
    421       INTEGER  ::  ji, jj                    ! dummy loop indices 
    422       REAL(wp) ::   &             ! temporary scalars 
    423          zt, zs, zh, zsr, zr1, zr2, zr3, zr4, zrhop, ze, zbw,   & 
    424          zb, zd, zc, zaw, za, zb1, za1, zkw, zk0,               & 
    425          zmask 
    426       REAL(wp), DIMENSION(jpi,jpj) ::   zws 
     363      INTEGER  ::   ji, jj                    ! dummy loop indices 
     364      REAL(wp) ::   zt, zs, zh, zsr, zr1, zr2, zr3, zr4, zrhop, ze, zbw   ! temporary scalars 
     365      REAL(wp) ::   zb, zd, zc, zaw, za, zb1, za1, zkw, zk0, zmask        !    -         - 
     366      REAL(wp), DIMENSION(jpi,jpj) ::   zws   ! 2D workspace 
    427367      !!---------------------------------------------------------------------- 
    428368 
    429369      prd(:,:) = 0.e0 
    430370 
    431       SELECT CASE ( neos ) 
    432       ! 
    433       CASE ( 0 )               ! Jackett and McDougall (1994) formulation 
     371      SELECT CASE( neos ) 
     372      ! 
     373      CASE( 0 )                !==  Jackett and McDougall (1994) formulation  ==! 
    434374      ! 
    435375!CDIR NOVERRCHK 
     
    440380            END DO 
    441381         END DO 
    442          !                                                ! =============== 
    443          DO jj = 1, jpjm1                                 ! Horizontal slab 
    444             !                                             ! =============== 
     382         DO jj = 1, jpjm1 
    445383            DO ji = 1, fs_jpim1   ! vector opt. 
    446                zmask = tmask(ji,jj,1)      ! land/sea bottom mask = surf. mask 
    447  
    448                zt = ptem (ji,jj)            ! interpolated T 
    449                zs = psal (ji,jj)            ! interpolated S 
    450                zsr= zws(ji,jj)            ! square root of interpolated S 
    451                zh = pdep(ji,jj)            ! depth at the partial step level 
    452  
     384               zmask = tmask(ji,jj,1)          ! land/sea bottom mask = surf. mask 
     385               zt    = ptem (ji,jj)            ! interpolated T 
     386               zs    = psal (ji,jj)            ! interpolated S 
     387               zsr   = zws  (ji,jj)            ! square root of interpolated S 
     388               zh    = pdep (ji,jj)            ! depth at the partial step level 
     389               ! 
    453390               ! compute volumic mass pure water at atm pressure 
    454                zr1 = ( ( ( ( 6.536332e-9*zt-1.120083e-6 )*zt+1.001685e-4)*zt   & 
    455                          -9.095290e-3 )*zt+6.793952e-2 )*zt+999.842594 
     391               zr1 = ( ( ( ( 6.536332e-9*zt-1.120083e-6 )*zt+1.001685e-4 )*zt   & 
     392                  &                        -9.095290e-3 )*zt+6.793952e-2 )*zt+999.842594 
    456393               ! seawater volumic mass atm pressure 
    457                zr2= ( ( ( 5.3875e-9*zt-8.2467e-7 )*zt+7.6438e-5 ) *zt   & 
    458                          -4.0899e-3 ) *zt+0.824493 
    459                zr3= ( -1.6546e-6*zt+1.0227e-4 ) *zt-5.72466e-3 
    460                zr4= 4.8314e-4 
    461  
     394               zr2 = ( ( ( 5.3875e-9*zt-8.2467e-7 )*zt+7.6438e-5 ) *zt   & 
     395                  &                                   -4.0899e-3 ) *zt+0.824493 
     396               zr3 = ( -1.6546e-6*zt+1.0227e-4 ) *zt-5.72466e-3 
     397               zr4 = 4.8314e-4 
     398               ! 
    462399               ! potential volumic mass (reference to the surface) 
    463400               zrhop= ( zr4*zs + zr3*zsr + zr2 ) *zs + zr1 
    464  
     401               ! 
    465402               ! add the compression terms 
    466403               ze = ( -3.508914e-8*zt-1.248266e-8 ) *zt-2.595994e-6 
    467404               zbw= (  1.296821e-6*zt-5.782165e-9 ) *zt+1.045941e-4 
    468405               zb = zbw + ze * zs 
    469  
     406               ! 
    470407               zd = -2.042967e-2 
    471408               zc =   (-7.267926e-5*zt+2.598241e-3 ) *zt+0.1571896 
    472409               zaw= ( ( 5.939910e-6*zt+2.512549e-3 ) *zt-0.1028859 ) *zt -4.721788 
    473410               za = ( zd*zsr + zc ) *zs + zaw 
    474  
     411               ! 
    475412               zb1=   (-0.1909078*zt+7.390729 ) *zt-55.87545 
    476413               za1= ( ( 2.326469e-3*zt+1.553190)*zt-65.00517 ) *zt+1044.077 
    477414               zkw= ( ( (-1.361629e-4*zt-1.852732e-2 ) *zt-30.41638 ) *zt   & 
    478                          +2098.925 ) *zt+190925.6 
     415                  &                                       +2098.925 ) *zt+190925.6 
    479416               zk0= ( zb1*zsr + za1 )*zs + zkw 
    480  
     417               ! 
    481418               ! masked in situ density anomaly 
    482                prd(ji,jj) = ( zrhop / (  1.0 - zh / ( zk0 - zh * ( za - zh * zb ) )  ) - rau0 )   & 
    483                   &       / rau0 * zmask 
    484             END DO 
    485             !                                             ! =============== 
    486          END DO                                           !   End of slab 
    487          !                                                ! =============== 
    488          ! 
    489       CASE ( 1 )               ! Linear formulation function of temperature only 
    490          ! 
    491          !                                                ! =============== 
    492          DO jj = 1, jpjm1                                 ! Horizontal slab 
    493             !                                             ! =============== 
     419               prd(ji,jj) = ( zrhop / (  1.0 - zh / ( zk0 - zh * ( za - zh * zb ) )  ) - rau0 ) / rau0 * zmask 
     420            END DO 
     421         END DO 
     422         ! 
     423      CASE( 1 )                !==  Linear formulation = F( temperature )  ==! 
     424         DO jj = 1, jpjm1 
    494425            DO ji = 1, fs_jpim1   ! vector opt. 
    495426               prd(ji,jj) = ( 0.0285 - ralpha * ptem(ji,jj) ) * tmask(ji,jj,1) 
    496427            END DO 
    497             !                                             ! =============== 
    498          END DO                                           !   End of slab 
    499          !                                                ! =============== 
    500          ! 
    501       CASE ( 2 )               ! Linear formulation function of temperature and salinity 
    502          ! 
    503          !                                                ! =============== 
    504          DO jj = 1, jpjm1                                 ! Horizontal slab 
    505             !                                             ! =============== 
     428         END DO 
     429         ! 
     430      CASE( 2 )                !==  Linear formulation = F( temperature , salinity )  ==! 
     431         DO jj = 1, jpjm1 
    506432            DO ji = 1, fs_jpim1   ! vector opt. 
    507433               prd(ji,jj) = ( rbeta * psal(ji,jj) - ralpha * ptem(ji,jj) ) * tmask(ji,jj,1)  
    508434            END DO 
    509             !                                             ! =============== 
    510          END DO                                           !   End of slab 
    511          !                                                ! =============== 
     435         END DO 
    512436         ! 
    513437      CASE DEFAULT 
    514          ! 
    515438         WRITE(ctmp1,*) '          bad flag value for neos = ', neos 
    516439         CALL ctl_stop( ctmp1 ) 
     
    556479      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   psal   ! salinity                [psu] 
    557480      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(  out) ::   pn2    ! Brunt-Vaisala frequency [s-1] 
    558  
     481      !! 
    559482      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
    560       REAL(wp) ::   zgde3w, zt, zs, zh,  &  ! temporary scalars  
    561          &          zalbet, zbeta           !    "         " 
     483      REAL(wp) ::   zgde3w, zt, zs, zh, zalbet, zbeta   ! temporary scalars  
    562484#if defined key_zdfddm 
    563       REAL(wp) ::   zds          ! temporary scalars 
     485      REAL(wp) ::   zds   ! temporary scalars 
    564486#endif 
    565487      !!---------------------------------------------------------------------- 
    566  
    567       ! pn2 : first and last levels 
    568       ! --------------------------- 
    569       ! bn^2=0. at jk=1 and jpk set in inidtr.F : no computation 
    570  
    571488 
    572489      ! pn2 : interior points only (2=< jk =< jpkm1 ) 
    573490      ! --------------------------  
    574  
    575       SELECT CASE ( neos ) 
    576       ! 
    577       CASE ( 0 )               ! Jackett and McDougall (1994) formulation 
    578          ! 
    579          !                                                ! =============== 
    580          DO jk = 2, jpkm1                                 ! Horizontal slab 
    581             !                                             ! =============== 
     491      ! 
     492      SELECT CASE( neos ) 
     493      ! 
     494      CASE( 0 )                !==  Jackett and McDougall (1994) formulation  ==! 
     495         DO jk = 2, jpkm1 
    582496            DO jj = 1, jpj 
    583497               DO ji = 1, jpi 
     
    586500                  zs = 0.5 * ( psal(ji,jj,jk) + psal(ji,jj,jk-1) ) - 35.0   ! salinity anomaly (s-35) at w-point 
    587501                  zh = fsdepw(ji,jj,jk)                                     ! depth in meters  at w-point 
    588  
     502                  ! 
    589503                  zalbet = ( ( ( - 0.255019e-07 * zt + 0.298357e-05 ) * zt   &   ! ratio alpha/beta 
    590504                     &                               - 0.203814e-03 ) * zt   & 
     
    599513                     &        +(   0.791325e-08 * zt - 0.933746e-06 ) * zt   & 
    600514                     &                               + 0.380374e-04 ) * zh 
    601  
     515                     ! 
    602516                  zbeta  = ( ( -0.415613e-09 * zt + 0.555579e-07 ) * zt      &   ! beta 
    603517                     &                            - 0.301985e-05 ) * zt      & 
     
    611525                     &     + ( - 0.213127e-11 * zt + 0.192867e-09 ) * zt     & 
    612526                     &                             - 0.121555e-07 ) * zh 
    613  
     527                     ! 
    614528                  pn2(ji,jj,jk) = zgde3w * zbeta * tmask(ji,jj,jk)           &   ! N^2  
    615529                     &          * ( zalbet * ( ptem(ji,jj,jk-1) - ptem(ji,jj,jk) )   & 
     
    623537               END DO 
    624538            END DO 
    625             !                                             ! =============== 
    626          END DO                                           !   End of slab 
    627          !                                                ! =============== 
    628          ! 
    629       CASE ( 1 )               ! Linear formulation function of temperature only 
    630          ! 
    631          !                                                ! =============== 
    632          DO jk = 2, jpkm1                                 ! Horizontal slab 
    633             !                                             ! =============== 
    634             DO jj = 1, jpj 
    635                DO ji = 1, jpi 
    636                   zgde3w = grav / fse3w(ji,jj,jk) * tmask(ji,jj,jk) 
    637                   pn2(ji,jj,jk) = zgde3w * ralpha * ( ptem(ji,jj,jk-1) - ptem(ji,jj,jk) ) 
    638                END DO 
    639             END DO 
    640             !                                             ! =============== 
    641          END DO                                           !   End of slab 
    642          !                                                ! =============== 
    643          ! 
    644       CASE ( 2 )               ! Linear formulation function of temperature and salinity 
    645          ! 
    646          !                                                ! =============== 
    647          DO jk = 2, jpkm1                                 ! Horizontal slab 
    648             !                                             ! =============== 
    649             DO jj = 1, jpj 
    650                DO ji = 1, jpi 
    651                   zgde3w = grav / fse3w(ji,jj,jk) * tmask(ji,jj,jk) 
    652                   pn2(ji,jj,jk) = zgde3w * (  ralpha * ( ptem(ji,jj,jk-1) - ptem(ji,jj,jk) )   & 
    653                      &                      - rbeta  * ( psal(ji,jj,jk-1) - psal(ji,jj,jk) )  ) 
    654                END DO 
    655             END DO 
     539         END DO 
     540         ! 
     541      CASE( 1 )                !==  Linear formulation = F( temperature )  ==! 
     542         DO jk = 2, jpkm1 
     543            pn2(:,:,jk) = grav * ralpha * ( ptem(:,:,jk-1) - ptem(:,:,jk) ) / fse3w(:,:,jk) * tmask(:,:,jk) 
     544         END DO 
     545         ! 
     546      CASE( 2 )                !==  Linear formulation = F( temperature , salinity )  ==! 
     547         DO jk = 2, jpkm1 
     548            pn2(:,:,jk) = grav * (  ralpha * ( ptem(:,:,jk-1) - ptem(:,:,jk) )      & 
     549               &                  - rbeta  * ( psal(:,:,jk-1) - psal(:,:,jk) )  )   & 
     550               &               / fse3w(:,:,jk) * tmask(:,:,jk) 
     551         END DO  
    656552#if defined key_zdfddm 
    657             !                                                ! Rrau = (alpha / beta) (dk[t] / dk[s]) 
    658             zalbet = ralpha / rbeta 
     553         DO jk = 2, jpkm1                                 ! Rrau = (alpha / beta) (dk[t] / dk[s]) 
    659554            DO jj = 1, jpj 
    660555               DO ji = 1, jpi 
    661556                  zds = ( psal(ji,jj,jk-1) - psal(ji,jj,jk) ) 
    662557                  IF ( ABS( zds ) <= 1.e-20 ) zds = 1.e-20 
    663                   rrau(ji,jj,jk) = zalbet * ( ptem(ji,jj,jk-1) - ptem(ji,jj,jk) ) / zds 
     558                  rrau(ji,jj,jk) = ralpbet * ( ptem(ji,jj,jk-1) - ptem(ji,jj,jk) ) / zds 
    664559               END DO 
    665560            END DO 
     561         END DO 
    666562#endif 
    667             !                                             ! =============== 
    668          END DO                                           !   End of slab 
    669          !                                                ! =============== 
    670563         ! 
    671564      CASE DEFAULT 
    672          ! 
    673565         WRITE(ctmp1,*) '          bad flag value for neos = ', neos 
    674566         CALL ctl_stop( ctmp1 ) 
     
    676568      END SELECT 
    677569 
    678       IF(ln_ctl)   CALL prt_ctl(tab3d_1=pn2, clinfo1=' bn2  : ', ovlap=1, kdim=jpk) 
     570      IF(ln_ctl)   CALL prt_ctl( tab3d_1=pn2, clinfo1=' bn2  : ', ovlap=1, kdim=jpk ) 
    679571#if defined key_zdfddm 
    680       IF(ln_ctl)   CALL prt_ctl(tab3d_1=rrau, clinfo1=' rrau : ', ovlap=1, kdim=jpk) 
     572      IF(ln_ctl)   CALL prt_ctl( tab3d_1=rrau, clinfo1=' rrau : ', ovlap=1, kdim=jpk ) 
    681573#endif 
    682574      ! 
     
    699591      REAL(wp), DIMENSION(jpi,jpj)                ::   ptf    ! freezing temperature [Celcius] 
    700592      !!---------------------------------------------------------------------- 
     593      ! 
    701594      ptf(:,:) = ( - 0.0575 + 1.710523e-3 * SQRT( psal(:,:) )   & 
    702595         &                  - 2.154996e-4 *       psal(:,:)   ) * psal(:,:) 
     596      ! 
    703597   END FUNCTION tfreez 
    704598 
     
    713607      !!---------------------------------------------------------------------- 
    714608      NAMELIST/nameos/ neos, ralpha, rbeta 
    715  
     609      !!---------------------------------------------------------------------- 
     610      ! 
    716611      REWIND( numnam )            ! Read Namelist nameos : equation of state 
    717612      READ  ( numnam, nameos ) 
    718  
    719       ! Control print 
    720       IF(lwp) THEN 
     613      ! 
     614      IF(lwp) THEN                ! Control print 
    721615         WRITE(numout,*) 
    722616         WRITE(numout,*) 'eos_init : equation of state' 
     
    727621         WRITE(numout,*) '             saline  exp. coef. (linear)    rbeta  = ', rbeta 
    728622      ENDIF 
    729  
    730       SELECT CASE ( neos ) 
    731  
    732       CASE ( 0 )               ! Jackett and McDougall (1994) formulation 
     623      ! 
     624      SELECT CASE( neos ) 
     625      ! 
     626      CASE( 0 )                   !==  Jackett and McDougall (1994) formulation  ==! 
    733627         IF(lwp) WRITE(numout,*) 
    734628         IF(lwp) WRITE(numout,*) '          use of Jackett & McDougall (1994) equation of state and' 
    735629         IF(lwp) WRITE(numout,*) '                 McDougall (1987) Brunt-Vaisala frequency' 
    736630         ! 
    737       CASE ( 1 )               ! Linear formulation function of temperature only 
     631      CASE( 1 )                   !==  Linear formulation = F( temperature )  ==! 
    738632         IF(lwp) WRITE(numout,*) 
    739633         IF(lwp) WRITE(numout,*) '          use of linear eos rho(T) = rau0 * ( 1.0285 - ralpha * T )' 
     
    741635              &                         ' that T and S are used as state variables' ) 
    742636         ! 
    743       CASE ( 2 )               ! Linear formulation function of temperature and salinity 
     637      CASE( 2 )                   !==  Linear formulation = F( temperature , salinity )  ==! 
     638         ralpbet = ralpha / rbeta 
    744639         IF(lwp) WRITE(numout,*) 
    745640         IF(lwp) WRITE(numout,*) '          use of linear eos rho(T,S) = rau0 * ( rbeta * S - ralpha * T )' 
    746641         ! 
    747       CASE DEFAULT             ! E R R O R in neos  
     642      CASE DEFAULT                !==  ERROR in neos  ==! 
    748643         WRITE(ctmp1,*) '          bad flag value for neos = ', neos 
    749644         CALL ctl_stop( ctmp1 ) 
     645         ! 
    750646      END SELECT 
    751  
     647      ! 
    752648   END SUBROUTINE eos_init 
    753649 
  • trunk/NEMO/OPA_SRC/lib_mpp.F90

    r1528 r1559  
    22912291CONTAINS 
    22922292 
    2293    FUNCTION mynode(localComm) RESULT (function_value) 
     2293   FUNCTION mynode( localComm ) RESULT (function_value) 
    22942294      INTEGER, OPTIONAL :: localComm 
    2295       function_value = 0 
     2295      IF( PRESENT( localComm ) .OR. .NOT.PRESENT( localComm ) )   function_value = 0 
    22962296   END FUNCTION mynode 
    22972297 
     
    24462446 
    24472447   SUBROUTINE mpp_ini_znl 
    2448       INTEGER :: kcom 
    24492448      WRITE(*,*) 'mpp_ini_znl: You should not have seen this print! error?' 
    24502449   END SUBROUTINE mpp_ini_znl 
Note: See TracChangeset for help on using the changeset viewer.