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 6140 for trunk/NEMOGCM/NEMO/OPA_SRC/DIA – NEMO

Ignore:
Timestamp:
2015-12-21T12:35:23+01:00 (8 years ago)
Author:
timgraham
Message:

Merge of branches/2015/dev_merge_2015 back into trunk. Merge excludes NEMOGCM/TOOLS/OBSTOOLS/ for now due to issues with the change of file type. Will sort these manually with further commits.

Branch merged as follows:
In the working copy of branch ran:
svn merge svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk@HEAD
Small conflicts due to bug fixes applied to trunk since the dev_merge_2015 was copied. Bug fixes were applied to the branch as well so these were easy to resolve.
Branch committed at this stage

In working copy run:
svn switch svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk
to switch working copy

Run:
svn merge --reintegrate svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/2015/dev_merge_2015
to merge the branch into the trunk and then commit - no conflicts at this stage.

Location:
trunk/NEMOGCM/NEMO/OPA_SRC/DIA
Files:
2 deleted
9 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diaar5.F90

    r5836 r6140  
    4040   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sn0          ! initial salinity 
    4141       
    42    !! * Substitutions 
    43 #  include "domzgr_substitute.h90" 
    4442   !!---------------------------------------------------------------------- 
    4543   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
     
    9997      ztsn(:,:,:,jp_tem) = tsn(:,:,:,jp_tem)                    ! thermosteric ssh 
    10098      ztsn(:,:,:,jp_sal) = sn0(:,:,:) 
    101       CALL eos( ztsn, zrhd, fsdept_n(:,:,:) )                       ! now in situ density using initial salinity 
     99      CALL eos( ztsn, zrhd, gdept_n(:,:,:) )                       ! now in situ density using initial salinity 
    102100      ! 
    103101      zbotpres(:,:) = 0._wp                        ! no atmospheric surface pressure, levitating sea-ice 
    104102      DO jk = 1, jpkm1 
    105          zbotpres(:,:) = zbotpres(:,:) + fse3t(:,:,jk) * zrhd(:,:,jk) 
    106       END DO 
    107       IF( .NOT.lk_vvl ) THEN 
    108          IF ( ln_isfcav ) THEN 
     103         zbotpres(:,:) = zbotpres(:,:) + e3t_n(:,:,jk) * zrhd(:,:,jk) 
     104      END DO 
     105      IF( ln_linssh ) THEN 
     106         IF( ln_isfcav ) THEN 
    109107            DO ji=1,jpi 
    110108               DO jj=1,jpj 
     
    115113            zbotpres(:,:) = zbotpres(:,:) + sshn(:,:) * zrhd(:,:,1) 
    116114         END IF 
     115!!gm 
     116!!gm   riceload should be added in both ln_linssh=T or F, no? 
     117!!gm 
    117118      END IF 
    118119      !                                          
     
    123124       
    124125      !                                         ! steric sea surface height 
    125       CALL eos( tsn, zrhd, zrhop, fsdept_n(:,:,:) )                 ! now in situ and potential density 
     126      CALL eos( tsn, zrhd, zrhop, gdept_n(:,:,:) )                 ! now in situ and potential density 
    126127      zrhop(:,:,jpk) = 0._wp 
    127128      CALL iom_put( 'rhop', zrhop ) 
     
    129130      zbotpres(:,:) = 0._wp                        ! no atmospheric surface pressure, levitating sea-ice 
    130131      DO jk = 1, jpkm1 
    131          zbotpres(:,:) = zbotpres(:,:) + fse3t(:,:,jk) * zrhd(:,:,jk) 
    132       END DO 
    133       IF( .NOT.lk_vvl ) THEN 
     132         zbotpres(:,:) = zbotpres(:,:) + e3t_n(:,:,jk) * zrhd(:,:,jk) 
     133      END DO 
     134      IF( ln_linssh ) THEN 
    134135         IF ( ln_isfcav ) THEN 
    135136            DO ji=1,jpi 
     
    159160         DO jj = 1, jpj 
    160161            DO ji = 1, jpi 
    161                zztmp = area(ji,jj) * fse3t(ji,jj,jk) 
     162               zztmp = area(ji,jj) * e3t_n(ji,jj,jk) 
    162163               ztemp = ztemp + zztmp * tsn(ji,jj,jk,jp_tem) 
    163164               zsal  = zsal  + zztmp * tsn(ji,jj,jk,jp_sal) 
     
    165166         END DO 
    166167      END DO 
    167       IF( .NOT.lk_vvl ) THEN 
    168          IF ( ln_isfcav ) THEN 
     168      IF( ln_linssh ) THEN 
     169         IF( ln_isfcav ) THEN 
    169170            DO ji=1,jpi 
    170171               DO jj=1,jpj 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90

    r5505 r6140  
    11MODULE diadct 
    2   !!===================================================================== 
    3   !!                       ***  MODULE  diadct  *** 
    4   !! Ocean diagnostics: Compute the transport trough a sec. 
    5   !!=============================================================== 
    6   !! History :  
    7   !! 
    8   !!         original  : 02/99 (Y Drillet) 
    9   !!         addition  : 10/01 (Y Drillet, R Bourdalle Badie) 
    10   !!                   : 10/05 (M Laborie) F90 
    11   !!         addition  : 04/07 (G Garric) Ice sections 
    12   !!         bugfix    : 04/07 (C Bricaud) test on sec%nb_point 
    13   !!                                      initialisation of ztransp1,ztransp2,... 
    14   !!         nemo_v_3_4: 09/2011 (C Bricaud) 
    15   !! 
    16   !! 
    17   !!---------------------------------------------------------------------- 
     2   !!====================================================================== 
     3   !!                       ***  MODULE  diadct  *** 
     4   !! Ocean diagnostics: Compute the transport trough a sec. 
     5   !!====================================================================== 
     6   !! History :  OPA  ! 02/1999 (Y Drillet)  original code 
     7   !!                 ! 10/2001 (Y Drillet, R Bourdalle Badie) 
     8   !!   NEMO     1.0  ! 10/2005 (M Laborie) F90 
     9   !!            3.0  ! 04/2007 (G Garric) Ice sections 
     10   !!             -   ! 04/2007 (C Bricaud) test on sec%nb_point, initialisation of ztransp1,ztransp2,... 
     11   !!            3.4  ! 09/2011 (C Bricaud) 
     12   !!---------------------------------------------------------------------- 
    1813#if defined key_diadct 
    19   !!---------------------------------------------------------------------- 
    20   !!   'key_diadct' : 
    21   !!---------------------------------------------------------------------- 
    22   !!---------------------------------------------------------------------- 
    23   !!   dia_dct      :  Compute the transport through a sec. 
    24   !!   dia_dct_init :  Read namelist. 
    25   !!   readsec      :  Read sections description and pathway 
    26   !!   removepoints :  Remove points which are common to 2 procs 
    27   !!   transport    :  Compute transport for each sections 
    28   !!   dia_dct_wri  :  Write tranports results in ascii files 
    29   !!   interp       :  Compute temperature/salinity/density at U-point or V-point 
    30   !!    
    31   !!---------------------------------------------------------------------- 
    32   !! * Modules used 
    33   USE oce             ! ocean dynamics and tracers 
    34   USE dom_oce         ! ocean space and time domain 
    35   USE phycst          ! physical constants 
    36   USE in_out_manager  ! I/O manager 
    37   USE daymod          ! calendar 
    38   USE dianam          ! build name of file 
    39   USE lib_mpp         ! distributed memory computing library 
     14   !!---------------------------------------------------------------------- 
     15   !!   'key_diadct' : 
     16   !!---------------------------------------------------------------------- 
     17   !!---------------------------------------------------------------------- 
     18   !!   dia_dct      :  Compute the transport through a sec. 
     19   !!   dia_dct_init :  Read namelist. 
     20   !!   readsec      :  Read sections description and pathway 
     21   !!   removepoints :  Remove points which are common to 2 procs 
     22   !!   transport    :  Compute transport for each sections 
     23   !!   dia_dct_wri  :  Write tranports results in ascii files 
     24   !!   interp       :  Compute temperature/salinity/density at U-point or V-point 
     25   !!    
     26   !!---------------------------------------------------------------------- 
     27   USE oce             ! ocean dynamics and tracers 
     28   USE dom_oce         ! ocean space and time domain 
     29   USE phycst          ! physical constants 
     30   USE in_out_manager  ! I/O manager 
     31   USE daymod          ! calendar 
     32   USE dianam          ! build name of file 
     33   USE lib_mpp         ! distributed memory computing library 
    4034#if defined key_lim2 
    41   USE ice_2 
     35   USE ice_2 
    4236#endif 
    4337#if defined key_lim3 
    44   USE ice 
     38   USE ice 
    4539#endif 
    46   USE domvvl 
    47   USE timing          ! preformance summary 
    48   USE wrk_nemo        ! working arrays 
    49  
    50   IMPLICIT NONE 
    51   PRIVATE 
    52  
    53   !! * Routine accessibility 
    54   PUBLIC   dia_dct      ! routine called by step.F90 
    55   PUBLIC   dia_dct_init ! routine called by opa.F90 
    56   PUBLIC   diadct_alloc ! routine called by nemo_init in nemogcm.F90  
    57   PRIVATE  readsec 
    58   PRIVATE  removepoints 
    59   PRIVATE  transport 
    60   PRIVATE  dia_dct_wri 
    61  
    62 #include "domzgr_substitute.h90" 
    63  
    64   !! * Shared module variables 
    65   LOGICAL, PUBLIC, PARAMETER ::   lk_diadct = .TRUE.   !: model-data diagnostics flag 
    66  
    67   !! * Module variables 
    68   INTEGER :: nn_dct        ! Frequency of computation 
    69   INTEGER :: nn_dctwri     ! Frequency of output 
    70   INTEGER :: nn_secdebug   ! Number of the section to debug 
     40   USE domvvl 
     41   USE timing          ! preformance summary 
     42   USE wrk_nemo        ! working arrays 
     43 
     44   IMPLICIT NONE 
     45   PRIVATE 
     46 
     47   PUBLIC   dia_dct      ! routine called by step.F90 
     48   PUBLIC   dia_dct_init ! routine called by opa.F90 
     49   PUBLIC   diadct_alloc ! routine called by nemo_init in nemogcm.F90  
     50   PRIVATE  readsec 
     51   PRIVATE  removepoints 
     52   PRIVATE  transport 
     53   PRIVATE  dia_dct_wri 
     54 
     55   LOGICAL, PUBLIC, PARAMETER ::   lk_diadct = .TRUE.   !: model-data diagnostics flag 
     56 
     57   INTEGER :: nn_dct        ! Frequency of computation 
     58   INTEGER :: nn_dctwri     ! Frequency of output 
     59   INTEGER :: nn_secdebug   ! Number of the section to debug 
    7160    
    72   INTEGER, PARAMETER :: nb_class_max  = 10 
    73   INTEGER, PARAMETER :: nb_sec_max    = 150 
    74   INTEGER, PARAMETER :: nb_point_max  = 2000 
    75   INTEGER, PARAMETER :: nb_type_class = 10 
    76   INTEGER, PARAMETER :: nb_3d_vars    = 3  
    77   INTEGER, PARAMETER :: nb_2d_vars    = 2  
    78   INTEGER            :: nb_sec  
    79  
    80   TYPE POINT_SECTION 
    81      INTEGER :: I,J 
    82   END TYPE POINT_SECTION 
    83  
    84   TYPE COORD_SECTION 
    85      REAL(wp) :: lon,lat 
    86   END TYPE COORD_SECTION 
    87  
    88   TYPE SECTION 
    89      CHARACTER(len=60)                            :: name              ! name of the sec 
    90      LOGICAL                                      :: llstrpond         ! true if you want the computation of salt and 
     61   INTEGER, PARAMETER :: nb_class_max  = 10 
     62   INTEGER, PARAMETER :: nb_sec_max    = 150 
     63   INTEGER, PARAMETER :: nb_point_max  = 2000 
     64   INTEGER, PARAMETER :: nb_type_class = 10 
     65   INTEGER, PARAMETER :: nb_3d_vars    = 3  
     66   INTEGER, PARAMETER :: nb_2d_vars    = 2  
     67   INTEGER            :: nb_sec  
     68 
     69   TYPE POINT_SECTION 
     70      INTEGER :: I,J 
     71   END TYPE POINT_SECTION 
     72 
     73   TYPE COORD_SECTION 
     74      REAL(wp) :: lon,lat 
     75   END TYPE COORD_SECTION 
     76 
     77   TYPE SECTION 
     78      CHARACTER(len=60)                            :: name              ! name of the sec 
     79      LOGICAL                                      :: llstrpond         ! true if you want the computation of salt and 
    9180                                                                       ! heat transports 
    92      LOGICAL                                      :: ll_ice_section    ! ice surface and ice volume computation 
    93      LOGICAL                                      :: ll_date_line      ! = T if the section crosses the date-line 
    94      TYPE(COORD_SECTION), DIMENSION(2)            :: coordSec          ! longitude and latitude of the extremities of the sec 
    95      INTEGER                                      :: nb_class          ! number of boundaries for density classes 
    96      INTEGER, DIMENSION(nb_point_max)             :: direction         ! vector direction of the point in the section 
    97      CHARACTER(len=40),DIMENSION(nb_class_max)    :: classname         ! characteristics of the class 
    98      REAL(wp), DIMENSION(nb_class_max)            :: zsigi           ,&! in-situ   density classes    (99 if you don't want) 
    99                                                      zsigp           ,&! potential density classes    (99 if you don't want) 
    100                                                      zsal            ,&! salinity classes   (99 if you don't want) 
    101                                                      ztem            ,&! temperature classes(99 if you don't want) 
    102                                                      zlay              ! level classes      (99 if you don't want) 
    103      REAL(wp), DIMENSION(nb_type_class,nb_class_max)  :: transport     ! transport output 
    104      REAL(wp)                                         :: slopeSection  ! slope of the section 
    105      INTEGER                                          :: nb_point      ! number of points in the section 
    106      TYPE(POINT_SECTION),DIMENSION(nb_point_max)      :: listPoint     ! list of points in the sections 
    107   END TYPE SECTION 
    108  
    109   TYPE(SECTION),DIMENSION(nb_sec_max) :: secs ! Array of sections 
    110   
    111   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  transports_3d  
    112   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::  transports_2d   
    113  
     81      LOGICAL                                      :: ll_ice_section    ! ice surface and ice volume computation 
     82      LOGICAL                                      :: ll_date_line      ! = T if the section crosses the date-line 
     83      TYPE(COORD_SECTION), DIMENSION(2)            :: coordSec          ! longitude and latitude of the extremities of the sec 
     84      INTEGER                                      :: nb_class          ! number of boundaries for density classes 
     85      INTEGER, DIMENSION(nb_point_max)             :: direction         ! vector direction of the point in the section 
     86      CHARACTER(len=40),DIMENSION(nb_class_max)    :: classname         ! characteristics of the class 
     87      REAL(wp), DIMENSION(nb_class_max)            :: zsigi           ,&! in-situ   density classes    (99 if you don't want) 
     88                                                      zsigp           ,&! potential density classes    (99 if you don't want) 
     89                                                      zsal            ,&! salinity classes   (99 if you don't want) 
     90                                                      ztem            ,&! temperature classes(99 if you don't want) 
     91                                                      zlay              ! level classes      (99 if you don't want) 
     92      REAL(wp), DIMENSION(nb_type_class,nb_class_max)  :: transport     ! transport output 
     93      REAL(wp)                                         :: slopeSection  ! slope of the section 
     94      INTEGER                                          :: nb_point      ! number of points in the section 
     95      TYPE(POINT_SECTION),DIMENSION(nb_point_max)      :: listPoint     ! list of points in the sections 
     96   END TYPE SECTION 
     97 
     98   TYPE(SECTION),DIMENSION(nb_sec_max) :: secs ! Array of sections 
     99  
     100   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  transports_3d  
     101   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::  transports_2d   
     102 
     103   !!---------------------------------------------------------------------- 
     104   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    114105   !! $Id$ 
     106   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     107   !!---------------------------------------------------------------------- 
    115108CONTAINS 
    116  
    117109  
    118110  INTEGER FUNCTION diadct_alloc()  
     
    130122  
    131123  END FUNCTION diadct_alloc  
     124 
    132125 
    133126  SUBROUTINE dia_dct_init 
     
    208201     !!               Reinitialise all relevant arrays to zero  
    209202     !!--------------------------------------------------------------------- 
    210      !! * Arguments 
    211      INTEGER,INTENT(IN)        ::kt 
    212  
    213      !! * Local variables 
     203     INTEGER,INTENT(in)        ::kt 
     204     ! 
    214205     INTEGER             :: jsec,            &! loop on sections 
    215206                            itotal            ! nb_sec_max*nb_type_class*nb_class_max 
     
    220211     REAL(wp), POINTER, DIMENSION(:)    :: zwork !   "   
    221212     REAL(wp), POINTER, DIMENSION(:,:,:):: zsum  !   " 
    222  
    223213     !!---------------------------------------------------------------------     
     214     ! 
    224215     IF( nn_timing == 1 )   CALL timing_start('dia_dct') 
    225216 
     
    619610                            zumid_ice, zvmid_ice,                &!U/V ice velocity  
    620611                            zTnorm                                !transport of velocity through one cell's sides  
    621      REAL(wp)            :: ztn, zsn, zrhoi, zrhop, zsshn, zfsdep !temperature/salinity/potential density/ssh/depth at u/v point 
     612     REAL(wp)            :: ztn, zsn, zrhoi, zrhop, zsshn, zdep !temperature/salinity/potential density/ssh/depth at u/v point 
    622613 
    623614     TYPE(POINT_SECTION) :: k 
    624      !!-------------------------------------------------------- 
    625  
    626      IF( ld_debug )WRITE(numout,*)'      Compute transport' 
    627  
    628      !---------------------------! 
    629      !  COMPUTE TRANSPORT        ! 
    630      !---------------------------! 
    631      IF(sec%nb_point .NE. 0)THEN    
    632  
    633         !---------------------------------------------------------------------------------------------------- 
    634         !Compute sign for velocities: 
    635         ! 
    636         !convention: 
    637         !   non horizontal section: direction + is toward left hand of section 
    638         !       horizontal section: direction + is toward north of section 
    639         ! 
    640         ! 
    641         !       slopeSection < 0     slopeSection > 0       slopeSection=inf            slopeSection=0 
    642         !       ----------------      -----------------     ---------------             -------------- 
    643         ! 
    644         !   isgnv=1         direction +       
    645         !  ______         _____             ______                                                    
    646         !        |           //|            |                  |                         direction +    
    647         !        | isgnu=1  // |            |isgnu=1           |isgnu=1                     /|\ 
    648         !        |_______  //         ______|    \\            | ---\                        | 
    649         !               |             | isgnv=-1  \\ |         | ---/ direction +       ____________ 
    650         !               |             |          __\\|         |                     
    651         !               |             |     direction +        |                      isgnv=1                                  
    652         !                                                       
    653         !---------------------------------------------------------------------------------------------------- 
    654         isgnu = 1 
    655         IF( sec%slopeSection .GT. 0 ) THEN  ; isgnv = -1  
    656         ELSE                                ; isgnv =  1 
    657         ENDIF 
    658         IF( sec%slopeSection .GE. 9999. )     isgnv =  1 
    659  
    660         IF( ld_debug )write(numout,*)"sec%slopeSection isgnu isgnv ",sec%slopeSection,isgnu,isgnv 
    661  
    662         !--------------------------------------! 
    663         ! LOOP ON THE SEGMENT BETWEEN 2 NODES  ! 
    664         !--------------------------------------! 
    665         DO jseg=1,MAX(sec%nb_point-1,0) 
     615      !!-------------------------------------------------------- 
     616      ! 
     617      IF( ld_debug )WRITE(numout,*)'      Compute transport' 
     618 
     619      !---------------------------! 
     620      !  COMPUTE TRANSPORT        ! 
     621      !---------------------------! 
     622      IF(sec%nb_point .NE. 0)THEN    
     623 
     624         !---------------------------------------------------------------------------------------------------- 
     625         !Compute sign for velocities: 
     626         ! 
     627         !convention: 
     628         !   non horizontal section: direction + is toward left hand of section 
     629         !       horizontal section: direction + is toward north of section 
     630         ! 
     631         ! 
     632         !       slopeSection < 0     slopeSection > 0       slopeSection=inf            slopeSection=0 
     633         !       ----------------      -----------------     ---------------             -------------- 
     634         ! 
     635         !   isgnv=1         direction +       
     636         !  ______         _____             ______                                                    
     637         !        |           //|            |                  |                         direction +    
     638         !        | isgnu=1  // |            |isgnu=1           |isgnu=1                     /|\ 
     639         !        |_______  //         ______|    \\            | ---\                        | 
     640         !               |             | isgnv=-1  \\ |         | ---/ direction +       ____________ 
     641         !               |             |          __\\|         |                     
     642         !               |             |     direction +        |                      isgnv=1                                  
     643         !                                                       
     644         !---------------------------------------------------------------------------------------------------- 
     645         isgnu = 1 
     646         IF( sec%slopeSection .GT. 0 ) THEN  ; isgnv = -1  
     647         ELSE                                ; isgnv =  1 
     648         ENDIF 
     649         IF( sec%slopeSection .GE. 9999. )     isgnv =  1 
     650 
     651         IF( ld_debug )write(numout,*)"sec%slopeSection isgnu isgnv ",sec%slopeSection,isgnu,isgnv 
     652 
     653         !--------------------------------------! 
     654         ! LOOP ON THE SEGMENT BETWEEN 2 NODES  ! 
     655         !--------------------------------------! 
     656         DO jseg=1,MAX(sec%nb_point-1,0) 
    666657               
    667            !------------------------------------------------------------------------------------------- 
    668            ! Select the appropriate coordinate for computing the velocity of the segment 
    669            ! 
    670            !                      CASE(0)                                    Case (2) 
    671            !                      -------                                    -------- 
    672            !  listPoint(jseg)                 listPoint(jseg+1)       listPoint(jseg)  F(i,j)       
    673            !      F(i,j)----------V(i+1,j)-------F(i+1,j)                               | 
    674            !                                                                            | 
    675            !                                                                            | 
    676            !                                                                            | 
    677            !                      Case (3)                                            U(i,j) 
    678            !                      --------                                              | 
    679            !                                                                            | 
    680            !  listPoint(jseg+1) F(i,j+1)                                                | 
    681            !                        |                                                   | 
    682            !                        |                                                   | 
    683            !                        |                                 listPoint(jseg+1) F(i,j-1) 
    684            !                        |                                             
    685            !                        |                                             
    686            !                     U(i,j+1)                                             
    687            !                        |                                       Case(1)      
    688            !                        |                                       ------       
    689            !                        |                                             
    690            !                        |                 listPoint(jseg+1)             listPoint(jseg)                            
    691            !                        |                 F(i-1,j)-----------V(i,j) -------f(jseg)                            
    692            ! listPoint(jseg)     F(i,j) 
    693            !  
    694            !------------------------------------------------------------------------------------------- 
    695  
    696            SELECT CASE( sec%direction(jseg) ) 
    697            CASE(0)  ;   k = sec%listPoint(jseg) 
    698            CASE(1)  ;   k = POINT_SECTION(sec%listPoint(jseg)%I+1,sec%listPoint(jseg)%J) 
    699            CASE(2)  ;   k = sec%listPoint(jseg) 
    700            CASE(3)  ;   k = POINT_SECTION(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J+1) 
    701            END SELECT 
    702  
    703            !---------------------------|  
    704            !     LOOP ON THE LEVEL     |  
    705            !---------------------------|  
    706            !Sum of the transport on the vertical   
    707            DO jk=1,mbathy(k%I,k%J)  
    708   
    709               ! compute temperature, salinity, insitu & potential density, ssh and depth at U/V point  
    710               SELECT CASE( sec%direction(jseg) )  
    711               CASE(0,1)  
    712                  ztn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_tem) )  
    713                  zsn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_sal) )  
    714                  zrhop = interp(k%I,k%J,jk,'V',rhop)  
    715                  zrhoi = interp(k%I,k%J,jk,'V',rhd*rau0+rau0)  
    716                  zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I,k%J+1)    ) * vmask(k%I,k%J,1)  
    717               CASE(2,3)  
    718                  ztn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_tem) )  
    719                  zsn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_sal) )  
    720                  zrhop = interp(k%I,k%J,jk,'U',rhop)  
    721                  zrhoi = interp(k%I,k%J,jk,'U',rhd*rau0+rau0)  
    722                  zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1)   
    723               END SELECT  
    724   
    725               zfsdep= fsdept(k%I,k%J,jk)  
     658            !------------------------------------------------------------------------------------------- 
     659            ! Select the appropriate coordinate for computing the velocity of the segment 
     660            ! 
     661            !                      CASE(0)                                    Case (2) 
     662            !                      -------                                    -------- 
     663            !  listPoint(jseg)                 listPoint(jseg+1)       listPoint(jseg)  F(i,j)       
     664            !      F(i,j)----------V(i+1,j)-------F(i+1,j)                               | 
     665            !                                                                            | 
     666            !                                                                            | 
     667            !                                                                            | 
     668            !                      Case (3)                                            U(i,j) 
     669            !                      --------                                              | 
     670            !                                                                            | 
     671            !  listPoint(jseg+1) F(i,j+1)                                                | 
     672            !                        |                                                   | 
     673            !                        |                                                   | 
     674            !                        |                                 listPoint(jseg+1) F(i,j-1) 
     675            !                        |                                             
     676            !                        |                                             
     677            !                     U(i,j+1)                                             
     678            !                        |                                       Case(1)      
     679            !                        |                                       ------       
     680            !                        |                                             
     681            !                        |                 listPoint(jseg+1)             listPoint(jseg)                            
     682            !                        |                 F(i-1,j)-----------V(i,j) -------f(jseg)                            
     683            ! listPoint(jseg)     F(i,j) 
     684            !  
     685            !------------------------------------------------------------------------------------------- 
     686 
     687            SELECT CASE( sec%direction(jseg) ) 
     688            CASE(0)   ;    k = sec%listPoint(jseg) 
     689            CASE(1)   ;    k = POINT_SECTION(sec%listPoint(jseg)%I+1,sec%listPoint(jseg)%J) 
     690            CASE(2)   ;    k = sec%listPoint(jseg) 
     691            CASE(3)   ;    k = POINT_SECTION(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J+1) 
     692            END SELECT 
     693 
     694            !---------------------------|  
     695            !     LOOP ON THE LEVEL     |  
     696            !---------------------------|  
     697            DO jk = 1, mbathy(k%I,k%J)            !Sum of the transport on the vertical 
     698            !           ! compute temperature, salinity, insitu & potential density, ssh and depth at U/V point  
     699            SELECT CASE( sec%direction(jseg) ) 
     700               CASE(0,1)  
     701                  ztn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_tem) )  
     702                  zsn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_sal) )  
     703                  zrhop = interp(k%I,k%J,jk,'V',rhop)  
     704                  zrhoi = interp(k%I,k%J,jk,'V',rhd*rau0+rau0)  
     705                  zsshn =  0.5*( sshn(k%I,k%J) + sshn(k%I,k%J+1)    ) * vmask(k%I,k%J,1)  
     706               CASE(2,3)  
     707                  ztn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_tem) )  
     708                  zsn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_sal) )  
     709                  zrhop = interp(k%I,k%J,jk,'U',rhop)  
     710                  zrhoi = interp(k%I,k%J,jk,'U',rhd*rau0+rau0)  
     711                  zsshn =  0.5*( sshn(k%I,k%J) + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1)   
     712               END SELECT  
     713               ! 
     714               zdep= gdept_n(k%I,k%J,jk)  
    726715   
    727               !compute velocity with the correct direction  
    728               SELECT CASE( sec%direction(jseg) )  
    729               CASE(0,1)    
    730                  zumid=0.  
    731                  zvmid=isgnv*vn(k%I,k%J,jk)*vmask(k%I,k%J,jk)  
    732               CASE(2,3)  
    733                  zumid=isgnu*un(k%I,k%J,jk)*umask(k%I,k%J,jk)  
    734                  zvmid=0.  
    735               END SELECT  
    736   
    737               !zTnorm=transport through one cell;  
    738               !velocity* cell's length * cell's thickness  
    739               zTnorm=zumid*e2u(k%I,k%J)*  fse3u(k%I,k%J,jk)+     &  
    740                      zvmid*e1v(k%I,k%J)*  fse3v(k%I,k%J,jk)  
    741  
    742 #if ! defined key_vvl 
    743               !add transport due to free surface  
    744               IF( jk==1 )THEN  
    745                  zTnorm = zTnorm + zumid* e2u(k%I,k%J) * zsshn * umask(k%I,k%J,jk) + &  
    746                                    zvmid* e1v(k%I,k%J) * zsshn * vmask(k%I,k%J,jk)  
    747               ENDIF  
    748 #endif 
     716               SELECT CASE( sec%direction(jseg) )                !compute velocity with the correct direction  
     717               CASE(0,1)   
     718                  zumid=0._wp 
     719                  zvmid=isgnv*vn(k%I,k%J,jk)*vmask(k%I,k%J,jk)  
     720               CASE(2,3)  
     721                  zumid=isgnu*un(k%I,k%J,jk)*umask(k%I,k%J,jk)  
     722                  zvmid=0._wp 
     723               END SELECT  
     724  
     725               !zTnorm=transport through one cell;  
     726               !velocity* cell's length * cell's thickness  
     727               zTnorm = zumid*e2u(k%I,k%J) * e3u_n(k%I,k%J,jk)     &  
     728                  &   + zvmid*e1v(k%I,k%J) * e3v_n(k%I,k%J,jk)  
     729 
     730!!gm  THIS is WRONG  no transport due to ssh in linear free surface case !!!!! 
     731               IF( ln_linssh ) THEN              !add transport due to free surface  
     732                  IF( jk==1 ) THEN  
     733                     zTnorm = zTnorm + zumid* e2u(k%I,k%J) * zsshn * umask(k%I,k%J,jk)   &  
     734                        &            + zvmid* e1v(k%I,k%J) * zsshn * vmask(k%I,k%J,jk)  
     735                  ENDIF  
     736               ENDIF 
     737!!gm end 
    749738              !COMPUTE TRANSPORT   
    750739  
    751740              transports_3d(1,jsec,jseg,jk) = transports_3d(1,jsec,jseg,jk) + zTnorm  
    752741   
    753               IF ( sec%llstrpond ) THEN  
     742              IF( sec%llstrpond ) THEN  
    754743                 transports_3d(2,jsec,jseg,jk) = transports_3d(2,jsec,jseg,jk)  + zTnorm * ztn * zrhop * rcp 
    755744                 transports_3d(3,jsec,jseg,jk) = transports_3d(3,jsec,jseg,jk)  + zTnorm * zsn * zrhop * 0.001 
    756745              ENDIF 
    757746    
    758            ENDDO !end of loop on the level 
     747           END DO !end of loop on the level 
    759748 
    760749#if defined key_lim2 || defined key_lim3 
     
    797786                 transports_2d(2,jsec,jseg) = transports_2d(2,jsec,jseg) + (zTnorm)*   & 
    798787                                   a_i(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J,jl) 
    799               ENDDO 
     788              END DO 
    800789#endif 
    801790    
     
    803792#endif 
    804793  
    805         ENDDO !end of loop on the segment 
     794        END DO !end of loop on the segment 
    806795 
    807796     ENDIF !end of sec%nb_point =0 case 
    808797     ! 
    809798  END SUBROUTINE transport 
    810    
     799 
     800 
    811801  SUBROUTINE dia_dct_sum(sec,jsec)  
    812802     !!-------------------------------------------------------------  
     
    828818     !!  
    829819     !!-------------------------------------------------------------  
    830      !! * arguments  
    831820     TYPE(SECTION),INTENT(INOUT) :: sec  
    832821     INTEGER      ,INTENT(IN)    :: jsec        ! numeric identifier of section  
     
    834823     TYPE(POINT_SECTION) :: k  
    835824     INTEGER  :: jk,jseg,jclass                        ! dummy variables for looping on level/segment/classes   
    836      REAL(wp) :: ztn, zsn, zrhoi, zrhop, zsshn, zfsdep ! temperature/salinity/ssh/potential density /depth at u/v point  
     825     REAL(wp) :: ztn, zsn, zrhoi, zrhop, zsshn, zdep ! temperature/salinity/ssh/potential density /depth at u/v point  
    837826     !!-------------------------------------------------------------  
    838827  
     
    903892              END SELECT  
    904893  
    905               zfsdep= fsdept(k%I,k%J,jk)  
     894              zdep= gdept_n(k%I,k%J,jk)  
    906895   
    907896              !-------------------------------  
     
    932921                    ( sec%ztem(jclass) .EQ.99.)) .AND.                     &  
    933922  
    934                     ((( zfsdep .GE. sec%zlay(jclass)) .AND.                &  
    935                     (   zfsdep .LE. sec%zlay(jclass+1))) .OR.              &  
     923                    ((( zdep .GE. sec%zlay(jclass)) .AND.                &  
     924                    (   zdep .LE. sec%zlay(jclass+1))) .OR.              &  
    936925                    ( sec%zlay(jclass) .EQ. 99. ))                         &  
    937926                                                                   ))   THEN  
     
    991980#endif  
    992981   
    993         ENDDO !end of loop on the segment  
     982        END DO !end of loop on the segment  
    994983  
    995984     ELSE  !if sec%nb_point =0  
     
    1000989  
    1001990  END SUBROUTINE dia_dct_sum  
    1002    
     991 
     992 
    1003993  SUBROUTINE dia_dct_wri(kt,ksec,sec) 
    1004994     !!------------------------------------------------------------- 
     
    11381128                              sec%transport(9,1),sec%transport(10,1), & 
    11391129                              sec%transport(9,1)+sec%transport(10,1)  
    1140      ENDIF 
     1130      ENDIF 
    11411131                                               
    1142 118 FORMAT(I8,1X,I8,1X,I4,1X,A30,1X,f9.2,1X,I4,3X,A8,1X,2F12.4,5X,3F12.4) 
    1143 119 FORMAT(I8,1X,I8,1X,I4,1X,A30,1X,f9.2,1X,I4,3X,A8,1X,2F12.4,5X,3E15.6) 
    1144  
    1145      CALL wrk_dealloc(nb_type_class , zsumclasses )   
    1146   END SUBROUTINE dia_dct_wri 
    1147  
    1148   FUNCTION interp(ki, kj, kk, cd_point, ptab) 
     1132118   FORMAT(I8,1X,I8,1X,I4,1X,A30,1X,f9.2,1X,I4,3X,A8,1X,2F12.4,5X,3F12.4) 
     1133119   FORMAT(I8,1X,I8,1X,I4,1X,A30,1X,f9.2,1X,I4,3X,A8,1X,2F12.4,5X,3E15.6) 
     1134 
     1135      CALL wrk_dealloc(nb_type_class , zsumclasses )   
     1136      ! 
     1137   END SUBROUTINE dia_dct_wri 
     1138 
     1139 
     1140   FUNCTION interp(ki, kj, kk, cd_point, ptab) 
    11491141  !!---------------------------------------------------------------------- 
    11501142  !! 
     
    12141206  !*local declations 
    12151207  INTEGER :: ii1, ij1, ii2, ij2                                ! local integer 
    1216   REAL(wp):: ze3t, zfse3, zwgt1, zwgt2, zbis, zdepu            ! local real 
     1208  REAL(wp):: ze3t, ze3, zwgt1, zwgt2, zbis, zdepu            ! local real 
    12171209  REAL(wp):: zet1, zet2                                        ! weight for interpolation  
    12181210  REAL(wp):: zdep1,zdep2                                       ! differences of depth 
     
    12411233  IF( ln_sco )THEN   ! s-coordinate case 
    12421234 
    1243      zdepu = ( fsdept(ii1,ij1,kk) +  fsdept(ii2,ij2,kk) ) /2  
    1244      zdep1 = fsdept(ii1,ij1,kk) - zdepu 
    1245      zdep2 = fsdept(ii2,ij2,kk) - zdepu 
     1235     zdepu = ( gdept_n(ii1,ij1,kk) +  gdept_n(ii2,ij2,kk) ) * 0.5_wp  
     1236     zdep1 = gdept_n(ii1,ij1,kk) - zdepu 
     1237     zdep2 = gdept_n(ii2,ij2,kk) - zdepu 
    12461238 
    12471239     ! weights 
     
    12551247  ELSE       ! full step or partial step case  
    12561248 
    1257 #if defined key_vvl 
    1258  
    1259      ze3t  = fse3t_n(ii2,ij2,kk) - fse3t_n(ii1,ij1,kk)  
    1260      zwgt1 = ( fse3w_n(ii2,ij2,kk) - fse3w_n(ii1,ij1,kk) ) / fse3w_n(ii2,ij2,kk) 
    1261      zwgt2 = ( fse3w_n(ii1,ij1,kk) - fse3w_n(ii2,ij2,kk) ) / fse3w_n(ii1,ij1,kk) 
    1262  
    1263 #else 
    1264  
    1265      ze3t  = fse3t(ii2,ij2,kk)   - fse3t(ii1,ij1,kk)  
    1266      zwgt1 = ( fse3w(ii2,ij2,kk) - fse3w(ii1,ij1,kk) ) / fse3w(ii2,ij2,kk) 
    1267      zwgt2 = ( fse3w(ii1,ij1,kk) - fse3w(ii2,ij2,kk) ) / fse3w(ii1,ij1,kk) 
    1268  
    1269 #endif 
     1249     ze3t  = e3t_n(ii2,ij2,kk) - e3t_n(ii1,ij1,kk)  
     1250     zwgt1 = ( e3w_n(ii2,ij2,kk) - e3w_n(ii1,ij1,kk) ) / e3w_n(ii2,ij2,kk) 
     1251     zwgt2 = ( e3w_n(ii1,ij1,kk) - e3w_n(ii2,ij2,kk) ) / e3w_n(ii1,ij1,kk) 
    12701252 
    12711253     IF(kk .NE. 1)THEN 
     
    12881270 
    12891271  ENDIF 
    1290  
    1291  
    1292   END FUNCTION interp 
     1272      ! 
     1273   END FUNCTION interp 
    12931274 
    12941275#else 
     
    13111292#endif 
    13121293 
     1294   !!====================================================================== 
    13131295END MODULE diadct 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diafwb.F90

    r5836 r6140  
    3333 
    3434   !! * Substitutions 
    35 #  include "domzgr_substitute.h90" 
    3635#  include "vectopt_loop_substitute.h90" 
    3736   !!---------------------------------------------------------------------- 
     
    4039   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4140   !!---------------------------------------------------------------------- 
    42  
    4341CONTAINS 
    4442 
     
    8078            DO jj = 2, jpjm1 
    8179               DO ji = fs_2, fs_jpim1   ! vector opt. 
    82                   zwei  = e1e2t(ji,jj) * fse3t(ji,jj,jk) * tmask(ji,jj,jk) * tmask_i(ji,jj) 
     80                  zwei  = e1e2t(ji,jj) * e3t_n(ji,jj,jk) * tmask(ji,jj,jk) * tmask_i(ji,jj) 
    8381                  a_salb = a_salb + ( tsb(ji,jj,jk,jp_sal) - zsm0 ) * zwei 
    8482               END DO 
     
    106104            DO jj = 2, jpjm1 
    107105               DO ji = fs_2, fs_jpim1   ! vector opt. 
    108                   zwei  = e1e2t(ji,jj) * fse3t(ji,jj,jk) * tmask(ji,jj,jk) * tmask_i(ji,jj) 
     106                  zwei  = e1e2t(ji,jj) * e3t_n(ji,jj,jk) * tmask(ji,jj,jk) * tmask_i(ji,jj) 
    109107                  a_saln = a_saln + ( tsn(ji,jj,jk,jp_sal) - zsm0 ) * zwei 
    110108                  zvol  = zvol  + zwei 
     
    116114          
    117115         ! Conversion in m3 
    118          a_fwf    = a_fwf * rdttra(1) * 1.e-3  
     116         a_fwf    = a_fwf * rdt * 1.e-3  
    119117          
    120118         ! fwf correction to bring back the mean ssh to zero 
     
    186184                  zt = 0.5 * ( tsn(ji,jj,jk,jp_tem) + tsn(ji+1,jj,jk,jp_tem) ) 
    187185                  zs = 0.5 * ( tsn(ji,jj,jk,jp_sal) + tsn(ji+1,jj,jk,jp_sal) ) 
    188                   zu = un(ji,jj,jk) * fse3t(ji,jj,jk) * e2u(ji,jj) * tmask_i(ji,jj) 
     186                  zu = un(ji,jj,jk) * e3t_n(ji,jj,jk) * e2u(ji,jj) * tmask_i(ji,jj) 
    189187 
    190188                  IF( un(ji,jj,jk) > 0.e0 ) THEN  
     
    238236                  zt = 0.5 * ( tsn(ji,jj,jk,jp_tem) + tsn(ji+1,jj,jk,jp_tem) ) 
    239237                  zs = 0.5 * ( tsn(ji,jj,jk,jp_sal) + tsn(ji+1,jj,jk,jp_sal) ) 
    240                   zu = un(ji,jj,jk) * fse3t(ji,jj,jk) * e2u(ji,jj) * tmask_i(ji,jj) 
     238                  zu = un(ji,jj,jk) * e3t_n(ji,jj,jk) * e2u(ji,jj) * tmask_i(ji,jj) 
    241239                   
    242240                  IF( un(ji,jj,jk) > 0.e0 ) THEN  
     
    290288                  zt = 0.5 * ( tsn(ji,jj,jk,jp_tem) + tsn(ji+1,jj,jk,jp_tem) ) 
    291289                  zs = 0.5 * ( tsn(ji,jj,jk,jp_sal) + tsn(ji+1,jj,jk,jp_sal) ) 
    292                   zu = un(ji,jj,jk) * fse3t(ji,jj,jk) * e2u(ji,jj) * tmask_i(ji,jj) 
     290                  zu = un(ji,jj,jk) * e3t_n(ji,jj,jk) * e2u(ji,jj) * tmask_i(ji,jj) 
    293291                   
    294292                  IF( un(ji,jj,jk) > 0.e0 ) THEN  
     
    342340                  zt = 0.5 * ( tsn(ji,jj,jk,jp_tem) + tsn(ji+1,jj,jk,jp_tem) ) 
    343341                  zs = 0.5 * ( tsn(ji,jj,jk,jp_sal) + tsn(ji+1,jj,jk,jp_sal) ) 
    344                   zu = un(ji,jj,jk) * fse3t(ji,jj,jk) * e2u(ji,jj) * tmask_i(ji,jj) 
     342                  zu = un(ji,jj,jk) * e3t_n(ji,jj,jk) * e2u(ji,jj) * tmask_i(ji,jj) 
    345343                   
    346344                  IF( un(ji,jj,jk) > 0.e0 ) THEN  
     
    404402         WRITE(inum,*) 
    405403         WRITE(inum,*)    'Net freshwater budget ' 
    406          WRITE(inum,9010) '  fwf    = ',a_fwf,   ' m3 =', a_fwf   /(FLOAT(nitend-nit000+1)*rdttra(1)) * 1.e-6,' Sv' 
     404         WRITE(inum,9010) '  fwf    = ',a_fwf,   ' m3 =', a_fwf   /(FLOAT(nitend-nit000+1)*rdt) * 1.e-6,' Sv' 
    407405         WRITE(inum,*) 
    408406         WRITE(inum,9010) '  zarea =',zarea 
     
    460458      ENDIF 
    461459 
    462       IF( nn_timing == 1 )   CALL timing_start('dia_fwb') 
     460      IF( nn_timing == 1 )   CALL timing_stop('dia_fwb') 
    463461 
    464462 9005 FORMAT(1X,A,ES24.16) 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diaharm.F90

    r5930 r6140  
    2121   USE ioipsl          ! NetCDF IPSL library 
    2222   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    23    USE diadimg         ! To write dimg 
    2423   USE timing          ! preformance summary 
    2524   USE wrk_nemo        ! working arrays 
     
    135134      DO jk=1,nb_ana 
    136135       DO ji=1,jpmax_harmo 
    137           IF (TRIM(tname(jk)) .eq. Wave(ji)%cname_tide) THEN 
     136          IF (TRIM(tname(jk)) == Wave(ji)%cname_tide) THEN 
    138137             name(jk) = ji 
    139138             EXIT 
     
    194193                  DO ji = 1,jpi 
    195194                     ! Elevation 
    196                      ana_temp(ji,jj,nhc,1) = ana_temp(ji,jj,nhc,1) + ztemp*sshn(ji,jj)*tmask_i(ji,jj)         
    197                      ana_temp(ji,jj,nhc,2) = ana_temp(ji,jj,nhc,2) + ztemp*un_b(ji,jj)*umask_i(ji,jj) 
    198                      ana_temp(ji,jj,nhc,3) = ana_temp(ji,jj,nhc,3) + ztemp*vn_b(ji,jj)*vmask_i(ji,jj) 
     195                     ana_temp(ji,jj,nhc,1) = ana_temp(ji,jj,nhc,1) + ztemp*sshn(ji,jj)*ssmask (ji,jj)         
     196                     ana_temp(ji,jj,nhc,2) = ana_temp(ji,jj,nhc,2) + ztemp*un_b(ji,jj)*ssumask(ji,jj) 
     197                     ana_temp(ji,jj,nhc,3) = ana_temp(ji,jj,nhc,3) + ztemp*vn_b(ji,jj)*ssvmask(ji,jj) 
    199198                  END DO 
    200199               END DO 
     
    324323               X1= ana_amp(ji,jj,jh,1) 
    325324               X2=-ana_amp(ji,jj,jh,2) 
    326                out_u(ji,jj,       jh) = X1 * umask_i(ji,jj) 
    327                out_u(ji,jj,nb_ana+jh) = X2 * umask_i(ji,jj) 
     325               out_u(ji,jj,       jh) = X1 * ssumask(ji,jj) 
     326               out_u(ji,jj,nb_ana+jh) = X2 * ssumask(ji,jj) 
    328327            ENDDO 
    329328         ENDDO 
     
    358357               X1=ana_amp(ji,jj,jh,1) 
    359358               X2=-ana_amp(ji,jj,jh,2) 
    360                out_v(ji,jj,       jh)=X1 * vmask_i(ji,jj) 
    361                out_v(ji,jj,nb_ana+jh)=X2 * vmask_i(ji,jj) 
     359               out_v(ji,jj,       jh)=X1 * ssvmask(ji,jj) 
     360               out_v(ji,jj,nb_ana+jh)=X2 * ssvmask(ji,jj) 
    362361            END DO 
    363362         END DO 
     
    384383      !!---------------------------------------------------------------------- 
    385384 
    386 #if defined key_dimgout 
    387       cdfile_name_T = TRIM(cexper)//'_Tidal_harmonics_gridT.dimgproc' 
    388       cdfile_name_U = TRIM(cexper)//'_Tidal_harmonics_gridU.dimgproc' 
    389       cdfile_name_V = TRIM(cexper)//'_Tidal_harmonics_gridV.dimgproc' 
    390 #endif 
    391  
    392385      IF(lwp) WRITE(numout,*) '  ' 
    393386      IF(lwp) WRITE(numout,*) 'dia_wri_harm : Write harmonic analysis results' 
    394 #if defined key_dimgout 
    395       IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~  Output files: ', TRIM(cdfile_name_T) 
    396       IF(lwp) WRITE(numout,*) '                             ', TRIM(cdfile_name_U) 
    397       IF(lwp) WRITE(numout,*) '                             ', TRIM(cdfile_name_V) 
    398 #endif 
    399387      IF(lwp) WRITE(numout,*) '  ' 
    400388 
     
    402390      !///////////// 
    403391      ! 
    404 #if defined key_dimgout 
    405       cltext='Elevation amplitude and phase' 
    406       CALL dia_wri_dimg(TRIM(cdfile_name_T), TRIM(cltext), out_eta, 2*nb_ana, '2') 
    407 #else 
    408392      DO jh = 1, nb_ana 
    409393      CALL iom_put( TRIM(tname(jh))//'x', out_eta(:,:,jh) ) 
    410394      CALL iom_put( TRIM(tname(jh))//'y', out_eta(:,:,nb_ana+jh) ) 
    411395      END DO 
    412 #endif 
    413396 
    414397      ! B) ubar 
    415398      !///////// 
    416399      ! 
    417 #if defined key_dimgout 
    418       cltext='ubar amplitude and phase' 
    419       CALL dia_wri_dimg(TRIM(cdfile_name_U), TRIM(cltext), out_u, 2*nb_ana, '2') 
    420 #else 
    421400      DO jh = 1, nb_ana 
    422401      CALL iom_put( TRIM(tname(jh))//'x_u', out_u(:,:,jh) ) 
    423402      CALL iom_put( TRIM(tname(jh))//'y_u', out_u(:,:,nb_ana+jh) ) 
    424403      END DO 
    425 #endif 
    426404 
    427405      ! C) vbar 
    428406      !///////// 
    429407      ! 
    430 #if defined key_dimgout 
    431       cltext='vbar amplitude and phase' 
    432       CALL dia_wri_dimg(TRIM(cdfile_name_V), TRIM(cltext), out_v, 2*nb_ana, '2') 
    433 #else 
    434408      DO jh = 1, nb_ana 
    435409         CALL iom_put( TRIM(tname(jh))//'x_v', out_v(:,:,jh       ) ) 
    436410         CALL iom_put( TRIM(tname(jh))//'y_v', out_v(:,:,jh+nb_ana) ) 
    437411      END DO 
    438 #endif 
    439412      ! 
    440413   END SUBROUTINE dia_wri_harm 
     
    488461            DO jj_sd = ji_sd, ninco 
    489462               zval2 = ABS(ztmp3(ji_sd,jj_sd)) 
    490                IF( zval2.GE.zval1 )THEN 
     463               IF( zval2 >= zval1 )THEN 
    491464                  ipivot(ji_sd) = jj_sd 
    492465                  zval1         = zval2 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90

    r5643 r6140  
    4646   REAL(wp) ::   frc_wn_t, frc_wn_s    ! global forcing trends 
    4747   ! 
    48    REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   surf          , ssh_ini          ! 
     48   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   surf  
     49   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   surf_ini      , ssh_ini          ! 
    4950   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   ssh_hc_loc_ini, ssh_sc_loc_ini   ! 
    5051   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   hc_loc_ini, sc_loc_ini, e3t_ini  ! 
    5152 
    5253   !! * Substitutions 
    53 #  include "domzgr_substitute.h90" 
    5454#  include "vectopt_loop_substitute.h90" 
    5555   !!---------------------------------------------------------------------- 
     
    100100      IF( ln_rnf_sal)   z_frc_trd_s = z_frc_trd_s + glob_sum( rnf_tsc(:,:,jp_sal) * surf(:,:) ) 
    101101      ! Add ice shelf heat & salt input 
    102       IF( nn_isf .GE. 1 )  THEN 
    103           z_frc_trd_t = z_frc_trd_t + glob_sum( risf_tsc(:,:,jp_tem) * surf(:,:) ) 
    104           z_frc_trd_s = z_frc_trd_s + glob_sum( risf_tsc(:,:,jp_sal) * surf(:,:) ) 
    105       ENDIF 
    106  
     102      IF( ln_isf    ) z_frc_trd_t = z_frc_trd_t + glob_sum( risf_tsc(:,:,jp_tem) * surf(:,:) ) 
    107103      ! Add penetrative solar radiation 
    108104      IF( ln_traqsr )   z_frc_trd_t = z_frc_trd_t + r1_rau0_rcp * glob_sum( qsr     (:,:) * surf(:,:) ) 
     
    110106      IF( ln_trabbc )   z_frc_trd_t = z_frc_trd_t +               glob_sum( qgh_trd0(:,:) * surf(:,:) ) 
    111107      ! 
    112       IF( .NOT. lk_vvl ) THEN 
    113          IF ( ln_isfcav ) THEN 
     108      IF( ln_linssh ) THEN 
     109         IF( ln_isfcav ) THEN 
    114110            DO ji=1,jpi 
    115111               DO jj=1,jpj 
    116112                  z2d0(ji,jj) = surf(ji,jj) * wn(ji,jj,mikt(ji,jj)) * tsb(ji,jj,mikt(ji,jj),jp_tem) 
    117113                  z2d1(ji,jj) = surf(ji,jj) * wn(ji,jj,mikt(ji,jj)) * tsb(ji,jj,mikt(ji,jj),jp_sal) 
    118                ENDDO 
    119             ENDDO 
     114               END DO 
     115            END DO 
    120116         ELSE 
    121117            z2d0(:,:) = surf(:,:) * wn(:,:,1) * tsb(:,:,1,jp_tem) 
     
    130126      frc_s = frc_s + z_frc_trd_s * rdt 
    131127      !                                          ! Advection flux through fixed surface (z=0) 
    132       IF( .NOT. lk_vvl ) THEN 
     128      IF( ln_linssh ) THEN 
    133129         frc_wn_t = frc_wn_t + z_wn_trd_t * rdt 
    134130         frc_wn_s = frc_wn_s + z_wn_trd_s * rdt 
     
    138134      ! 2 -  Content variations ! 
    139135      ! ------------------------ ! 
     136      ! glob_sum_full is needed because you keep the full interior domain to compute the sum (iscpl) 
    140137      zdiff_v2 = 0._wp 
    141138      zdiff_hc = 0._wp 
     
    143140 
    144141      ! volume variation (calculated with ssh) 
    145       zdiff_v1 = glob_sum( surf(:,:) * ( sshn(:,:) - ssh_ini(:,:) ) ) 
     142      zdiff_v1 = glob_sum_full( surf(:,:) * sshn(:,:) - surf_ini(:,:) * ssh_ini(:,:) ) 
    146143 
    147144      ! heat & salt content variation (associated with ssh) 
    148       IF( .NOT. lk_vvl ) THEN 
    149          IF ( ln_isfcav ) THEN 
     145      IF( ln_linssh ) THEN 
     146         IF( ln_isfcav ) THEN 
    150147            DO ji = 1, jpi 
    151148               DO jj = 1, jpj 
     
    158155            z2d1(:,:) = surf(:,:) * ( tsn(:,:,1,jp_sal) * sshn(:,:) - ssh_sc_loc_ini(:,:) )  
    159156         END IF 
    160          z_ssh_hc = glob_sum( z2d0 )  
    161          z_ssh_sc = glob_sum( z2d1 )  
     157         z_ssh_hc = glob_sum_full( z2d0 )  
     158         z_ssh_sc = glob_sum_full( z2d1 )  
    162159      ENDIF 
    163160 
    164161      DO jk = 1, jpkm1 
    165162         ! volume variation (calculated with scale factors) 
    166          zdiff_v2 = zdiff_v2 + glob_sum( surf(:,:) * tmask(:,:,jk) & 
    167             &                           * ( fse3t_n(:,:,jk) - e3t_ini(:,:,jk) ) ) 
     163         zdiff_v2 = zdiff_v2 + glob_sum_full( surf(:,:) * tmask(:,:,jk)            & 
     164            &                           * e3t_n(:,:,jk) - surf_ini(:,:) * e3t_ini(:,:,jk) ) 
    168165         ! heat content variation 
    169          zdiff_hc = zdiff_hc + glob_sum(  surf(:,:) * tmask(:,:,jk) &  
    170             &                           * ( fse3t_n(:,:,jk) * tsn(:,:,jk,jp_tem) - hc_loc_ini(:,:,jk) ) ) 
     166         zdiff_hc = zdiff_hc + glob_sum_full(  surf(:,:) * tmask(:,:,jk)                                  &  
     167            &                           * e3t_n(:,:,jk) * tsn(:,:,jk,jp_tem) - surf_ini(:,:) * hc_loc_ini(:,:,jk) )  
    171168         ! salt content variation 
    172          zdiff_sc = zdiff_sc + glob_sum(  surf(:,:) * tmask(:,:,jk)   & 
    173             &                           * ( fse3t_n(:,:,jk) * tsn(:,:,jk,jp_sal) - sc_loc_ini(:,:,jk) ) ) 
     169         zdiff_sc = zdiff_sc + glob_sum_full( surf    (:,:) * tmask(:,:,jk)                           & 
     170                                        * e3t_n(:,:,jk) * tsn(:,:,jk,jp_sal) - surf_ini(:,:) * sc_loc_ini(:,:,jk) ) 
    174171      ENDDO 
    175172 
    176173      ! Substract forcing from heat content, salt content and volume variations 
    177174      zdiff_v1 = zdiff_v1 - frc_v 
    178       IF( lk_vvl )   zdiff_v2 = zdiff_v2 - frc_v 
     175      IF( .NOT.ln_linssh )   zdiff_v2 = zdiff_v2 - frc_v 
    179176      zdiff_hc = zdiff_hc - frc_t 
    180177      zdiff_sc = zdiff_sc - frc_s 
    181       IF( .NOT. lk_vvl ) THEN 
     178      IF( ln_linssh ) THEN 
    182179         zdiff_hc1 = zdiff_hc + z_ssh_hc  
    183180         zdiff_sc1 = zdiff_sc + z_ssh_sc 
     
    191188      zvol_tot = 0._wp                    ! total ocean volume (calculated with scale factors) 
    192189      DO jk = 1, jpkm1 
    193          zvol_tot  = zvol_tot + glob_sum( surf(:,:) * tmask(:,:,jk) * fse3t_n(:,:,jk) ) 
     190         zvol_tot  = zvol_tot + glob_sum_full( surf(:,:) * tmask(:,:,jk) * e3t_n(:,:,jk) ) 
    194191      END DO 
    195192 
    196193!!gm to be added ? 
    197 !      IF( .NOT. lk_vvl ) THEN            ! fixed volume, add the ssh contribution 
     194!      IF( ln_linssh ) THEN            ! fixed volume, add the ssh contribution 
    198195!        zvol_tot = zvol_tot + glob_sum( surf(:,:) * sshn(:,:) ) 
    199196!      ENDIF 
    200197!!gm end 
    201198 
    202       IF( lk_vvl ) THEN 
     199      IF( ln_linssh ) THEN 
     200        CALL iom_put( 'bgtemper' , zdiff_hc1 / zvol_tot)              ! Heat content variation (C)  
     201        CALL iom_put( 'bgsaline' , zdiff_sc1 / zvol_tot)              ! Salt content variation (psu) 
     202        CALL iom_put( 'bgheatco' , zdiff_hc1 * 1.e-20 * rau0 * rcp )  ! Heat content variation (1.e20 J)  
     203        CALL iom_put( 'bgsaltco' , zdiff_sc1 * 1.e-9   )              ! Salt content variation (psu*km3) 
     204        CALL iom_put( 'bgvolssh' , zdiff_v1  * 1.e-9   )              ! volume ssh variation (km3)   
     205        CALL iom_put( 'bgfrcvol' , frc_v    * 1.e-9    )              ! vol - surface forcing (km3)  
     206        CALL iom_put( 'bgfrctem' , frc_t / zvol_tot    )              ! hc  - surface forcing (C)  
     207        CALL iom_put( 'bgfrcsal' , frc_s / zvol_tot    )              ! sc  - surface forcing (psu)  
     208        CALL iom_put( 'bgmistem' , zerr_hc1 / zvol_tot )              ! hc  - error due to free surface (C) 
     209        CALL iom_put( 'bgmissal' , zerr_sc1 / zvol_tot )              ! sc  - error due to free surface (psu) 
     210      ELSE 
    203211        CALL iom_put( 'bgtemper' , zdiff_hc / zvol_tot )              ! Temperature variation (C)  
    204212        CALL iom_put( 'bgsaline' , zdiff_sc / zvol_tot )              ! Salinity    variation (psu) 
     
    210218        CALL iom_put( 'bgfrctem' , frc_t / zvol_tot    )              ! hc  - surface forcing (C)  
    211219        CALL iom_put( 'bgfrcsal' , frc_s / zvol_tot    )              ! sc  - surface forcing (psu)  
    212       ELSE 
    213         CALL iom_put( 'bgtemper' , zdiff_hc1 / zvol_tot)              ! Heat content variation (C)  
    214         CALL iom_put( 'bgsaline' , zdiff_sc1 / zvol_tot)              ! Salt content variation (psu) 
    215         CALL iom_put( 'bgheatco' , zdiff_hc1 * 1.e-20 * rau0 * rcp )  ! Heat content variation (1.e20 J)  
    216         CALL iom_put( 'bgsaltco' , zdiff_sc1 * 1.e-9    )             ! Salt content variation (psu*km3) 
    217         CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh variation (km3)   
    218         CALL iom_put( 'bgfrcvol' , frc_v    * 1.e-9    )              ! vol - surface forcing (km3)  
    219         CALL iom_put( 'bgfrctem' , frc_t / zvol_tot    )              ! hc  - surface forcing (C)  
    220         CALL iom_put( 'bgfrcsal' , frc_s / zvol_tot    )              ! sc  - surface forcing (psu)  
    221         CALL iom_put( 'bgmistem' , zerr_hc1 / zvol_tot )              ! hc  - error due to free surface (C) 
    222         CALL iom_put( 'bgmissal' , zerr_sc1 / zvol_tot )              ! sc  - error due to free surface (psu) 
    223220      ENDIF 
    224221      ! 
    225222      IF( lrst_oce )   CALL dia_hsb_rst( kt, 'WRITE' ) 
    226  
     223      ! 
    227224      CALL wrk_dealloc( jpi,jpj,   z2d0, z2d1 ) 
    228  
     225      ! 
    229226      IF( nn_timing == 1 )   CALL timing_stop('dia_hsb') 
    230227      ! 
     
    257254           CALL iom_get( numror, 'frc_t', frc_t ) 
    258255           CALL iom_get( numror, 'frc_s', frc_s ) 
    259            IF( .NOT. lk_vvl ) THEN 
     256           IF( ln_linssh ) THEN 
    260257              CALL iom_get( numror, 'frc_wn_t', frc_wn_t ) 
    261258              CALL iom_get( numror, 'frc_wn_s', frc_wn_s ) 
    262259           ENDIF 
     260           CALL iom_get( numror, jpdom_autoglo, 'surf_ini', surf_ini ) ! ice sheet coupling 
    263261           CALL iom_get( numror, jpdom_autoglo, 'ssh_ini', ssh_ini ) 
    264262           CALL iom_get( numror, jpdom_autoglo, 'e3t_ini', e3t_ini ) 
    265263           CALL iom_get( numror, jpdom_autoglo, 'hc_loc_ini', hc_loc_ini ) 
    266264           CALL iom_get( numror, jpdom_autoglo, 'sc_loc_ini', sc_loc_ini ) 
    267            IF( .NOT. lk_vvl ) THEN 
     265           IF( ln_linssh ) THEN 
    268266              CALL iom_get( numror, jpdom_autoglo, 'ssh_hc_loc_ini', ssh_hc_loc_ini ) 
    269267              CALL iom_get( numror, jpdom_autoglo, 'ssh_sc_loc_ini', ssh_sc_loc_ini ) 
     
    273271          IF(lwp) WRITE(numout,*) ' dia_hsb at initial state ' 
    274272          IF(lwp) WRITE(numout,*) '~~~~~~~' 
    275           ssh_ini(:,:) = sshn(:,:)                                       ! initial ssh 
     273          surf_ini(:,:) = e1e2t(:,:) * tmask_i(:,:)         ! initial ocean surface 
     274          ssh_ini(:,:) = sshn(:,:)                          ! initial ssh 
    276275          DO jk = 1, jpk 
    277              e3t_ini   (:,:,jk) = fse3t_n(:,:,jk)                        ! initial vertical scale factors 
    278              hc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_tem) * fse3t_n(:,:,jk)   ! initial heat content 
    279              sc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_sal) * fse3t_n(:,:,jk)   ! initial salt content 
     276             ! if ice sheet/oceqn coupling, need to mask ini variables here (mask could change at the next NEMO instance). 
     277             e3t_ini   (:,:,jk) = e3t_n(:,:,jk)                      * tmask(:,:,jk)  ! initial vertical scale factors 
     278             hc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_tem) * e3t_n(:,:,jk) * tmask(:,:,jk)  ! initial heat content 
     279             sc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_sal) * e3t_n(:,:,jk) * tmask(:,:,jk)  ! initial salt content 
    280280          END DO 
    281281          frc_v = 0._wp                                           ! volume       trend due to forcing 
    282282          frc_t = 0._wp                                           ! heat content   -    -   -    -    
    283283          frc_s = 0._wp                                           ! salt content   -    -   -    -         
    284           IF( .NOT. lk_vvl ) THEN 
     284          IF( ln_linssh ) THEN 
    285285             IF ( ln_isfcav ) THEN 
    286286                DO ji=1,jpi 
     
    308308        CALL iom_rstput( kt, nitrst, numrow, 'frc_t'   , frc_t     ) 
    309309        CALL iom_rstput( kt, nitrst, numrow, 'frc_s'   , frc_s     ) 
    310         IF( .NOT. lk_vvl ) THEN 
     310        IF( ln_linssh ) THEN 
    311311           CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_t', frc_wn_t ) 
    312312           CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_s', frc_wn_s ) 
    313313        ENDIF 
     314        CALL iom_rstput( kt, nitrst, numrow, 'surf_ini', surf_ini )      ! ice sheet coupling 
    314315        CALL iom_rstput( kt, nitrst, numrow, 'ssh_ini', ssh_ini ) 
    315316        CALL iom_rstput( kt, nitrst, numrow, 'e3t_ini', e3t_ini ) 
    316317        CALL iom_rstput( kt, nitrst, numrow, 'hc_loc_ini', hc_loc_ini ) 
    317318        CALL iom_rstput( kt, nitrst, numrow, 'sc_loc_ini', sc_loc_ini ) 
    318         IF( .NOT. lk_vvl ) THEN 
     319        IF( ln_linssh ) THEN 
    319320           CALL iom_rstput( kt, nitrst, numrow, 'ssh_hc_loc_ini', ssh_hc_loc_ini ) 
    320321           CALL iom_rstput( kt, nitrst, numrow, 'ssh_sc_loc_ini', ssh_sc_loc_ini ) 
     
    379380      ! 1 - Allocate memory ! 
    380381      ! ------------------- ! 
    381       ALLOCATE( hc_loc_ini(jpi,jpj,jpk), sc_loc_ini(jpi,jpj,jpk), & 
    382          &      e3t_ini(jpi,jpj,jpk), surf(jpi,jpj),  ssh_ini(jpi,jpj), STAT=ierror ) 
     382      ALLOCATE( hc_loc_ini(jpi,jpj,jpk), sc_loc_ini(jpi,jpj,jpk), surf_ini(jpi,jpj), & 
     383         &      e3t_ini(jpi,jpj,jpk), surf(jpi,jpj),  ssh_ini(jpi,jpj), STAT=ierror  ) 
    383384      IF( ierror > 0 ) THEN 
    384385         CALL ctl_stop( 'dia_hsb: unable to allocate hc_loc_ini' )   ;   RETURN 
    385386      ENDIF 
    386387 
    387       IF(.NOT. lk_vvl ) ALLOCATE( ssh_hc_loc_ini(jpi,jpj), ssh_sc_loc_ini(jpi,jpj),STAT=ierror ) 
     388      IF( ln_linssh )  ALLOCATE( ssh_hc_loc_ini(jpi,jpj), ssh_sc_loc_ini(jpi,jpj),STAT=ierror ) 
    388389      IF( ierror > 0 ) THEN 
    389390         CALL ctl_stop( 'dia_hsb: unable to allocate hc_loc_ini' )   ;   RETURN 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diahth.F90

    r5836 r6140  
    2020   USE dom_oce         ! ocean space and time domain 
    2121   USE phycst          ! physical constants 
     22   ! 
    2223   USE in_out_manager  ! I/O manager 
    2324   USE lib_mpp         ! MPP library 
     
    3132   PUBLIC   dia_hth_alloc ! routine called by nemogcm.F90 
    3233 
    33    LOGICAL , PUBLIC, PARAMETER          ::   lk_diahth = .TRUE.    !: thermocline-20d depths flag 
     34   LOGICAL , PUBLIC, PARAMETER ::   lk_diahth = .TRUE.    !: thermocline-20d depths flag 
     35    
    3436   ! note: following variables should move to local variables once iom_put is always used  
    3537   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hth    !: depth of the max vertical temperature gradient [m] 
     
    3840   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   htc3   !: heat content of first 300 m                    [W] 
    3941 
    40    !! * Substitutions 
    41 #  include "domzgr_substitute.h90" 
    4242   !!---------------------------------------------------------------------- 
    4343   !! NEMO/OPA 4.0 , NEMO Consortium (2011) 
     
    5252      !!--------------------------------------------------------------------- 
    5353      ! 
    54       ALLOCATE(hth(jpi,jpj), hd20(jpi,jpj), hd28(jpi,jpj), htc3(jpi,jpj), STAT=dia_hth_alloc) 
     54      ALLOCATE( hth(jpi,jpj), hd20(jpi,jpj), hd28(jpi,jpj), htc3(jpi,jpj), STAT=dia_hth_alloc ) 
    5555      ! 
    5656      IF( lk_mpp           )   CALL mpp_sum ( dia_hth_alloc ) 
     
    108108      IF( kt == nit000 ) THEN 
    109109         !                                      ! allocate dia_hth array 
    110          IF( dia_hth_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'lim_sbc_init : unable to allocate standard arrays' ) 
    111  
    112          IF(.not. ALLOCATED(ik20))THEN 
     110         IF( dia_hth_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'dia_hth : unable to allocate standard arrays' ) 
     111 
     112         IF(.NOT. ALLOCATED(ik20) ) THEN 
    113113            ALLOCATE(ik20(jpi,jpj), ik28(jpi,jpj), & 
    114114               &      zabs2(jpi,jpj),   & 
     
    187187            DO ji = 1, jpi 
    188188               ! 
    189                zzdep = fsdepw(ji,jj,jk) 
     189               zzdep = gdepw_n(ji,jj,jk) 
    190190               zztmp = ( tsn(ji,jj,jk-1,jp_tem) - tsn(ji,jj,jk,jp_tem) ) / zzdep * tmask(ji,jj,jk)   ! vertical gradient of temperature (dT/dz) 
    191191               zzdep = zzdep * tmask(ji,jj,1) 
     
    223223            DO ji = 1, jpi 
    224224               ! 
    225                zzdep = fsdepw(ji,jj,jk) * tmask(ji,jj,1) 
     225               zzdep = gdepw_n(ji,jj,jk) * tmask(ji,jj,1) 
    226226               ! 
    227227               zztmp = tsn(ji,jj,nla10,jp_tem) - tsn(ji,jj,jk,jp_tem)  ! - delta T(10m) 
     
    270270         DO ji = 1, jpi 
    271271            ! 
    272             zzdep = fsdepw(ji,jj,mbkt(ji,jj)+1)       ! depth of the oean bottom 
     272            zzdep = gdepw_n(ji,jj,mbkt(ji,jj)+1)       ! depth of the oean bottom 
    273273            ! 
    274274            iid = ik20(ji,jj) 
    275275            IF( iid /= 1 ) THEN  
    276                zztmp =      fsdept(ji,jj,iid  )   &                     ! linear interpolation 
    277                   &  + (    fsdept(ji,jj,iid+1) - fsdept(ji,jj,iid)                       )   & 
     276               zztmp =      gdept_n(ji,jj,iid  )   &                     ! linear interpolation 
     277                  &  + (    gdept_n(ji,jj,iid+1) - gdept_n(ji,jj,iid)                       )   & 
    278278                  &  * ( 20.*tmask(ji,jj,iid+1) - tsn(ji,jj,iid,jp_tem)                       )   & 
    279279                  &  / ( tsn(ji,jj,iid+1,jp_tem) - tsn(ji,jj,iid,jp_tem) + (1.-tmask(ji,jj,1)) ) 
     
    285285            iid = ik28(ji,jj) 
    286286            IF( iid /= 1 ) THEN  
    287                zztmp =      fsdept(ji,jj,iid  )   &                     ! linear interpolation 
    288                   &  + (    fsdept(ji,jj,iid+1) - fsdept(ji,jj,iid)                       )   & 
     287               zztmp =      gdept_n(ji,jj,iid  )   &                     ! linear interpolation 
     288                  &  + (    gdept_n(ji,jj,iid+1) - gdept_n(ji,jj,iid)                       )   & 
    289289                  &  * ( 28.*tmask(ji,jj,iid+1) -    tsn(ji,jj,iid,jp_tem)                       )   & 
    290290                  &  / (  tsn(ji,jj,iid+1,jp_tem) -    tsn(ji,jj,iid,jp_tem) + (1.-tmask(ji,jj,1)) ) 
     
    311311      END DO 
    312312      ! surface boundary condition 
    313       IF( lk_vvl ) THEN   ;   zthick(:,:) = 0._wp       ;   htc3(:,:) = 0._wp                                    
    314       ELSE                ;   zthick(:,:) = sshn(:,:)   ;   htc3(:,:) = tsn(:,:,1,jp_tem) * sshn(:,:) * tmask(:,:,1)    
     313      IF( ln_linssh ) THEN   ;   zthick(:,:) = sshn(:,:)   ;   htc3(:,:) = tsn(:,:,1,jp_tem) * sshn(:,:) * tmask(:,:,1)   
     314      ELSE                   ;   zthick(:,:) = 0._wp       ;   htc3(:,:) = 0._wp                                    
    315315      ENDIF 
    316316      ! integration down to ilevel 
    317317      DO jk = 1, ilevel 
    318          zthick(:,:) = zthick(:,:) + fse3t(:,:,jk) 
    319          htc3  (:,:) = htc3  (:,:) + fse3t(:,:,jk) * tsn(:,:,jk,jp_tem) * tmask(:,:,jk) 
     318         zthick(:,:) = zthick(:,:) + e3t_n(:,:,jk) 
     319         htc3  (:,:) = htc3  (:,:) + e3t_n(:,:,jk) * tsn(:,:,jk,jp_tem) * tmask(:,:,jk) 
    320320      END DO 
    321321      ! deepest layer 
     
    323323      DO jj = 1, jpj 
    324324         DO ji = 1, jpi 
    325             htc3(ji,jj) = htc3(ji,jj) + tsn(ji,jj,ilevel+1,jp_tem) * MIN( fse3t(ji,jj,ilevel+1), zthick(ji,jj) )  & 
    326                                                                    * tmask(ji,jj,ilevel+1) 
     325            htc3(ji,jj) = htc3(ji,jj) + tsn(ji,jj,ilevel+1,jp_tem)                  & 
     326               &                      * MIN( e3t_n(ji,jj,ilevel+1), zthick(ji,jj) ) * tmask(ji,jj,ilevel+1) 
    327327         END DO 
    328328      END DO 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DIA/dianam.F90

    r2528 r6140  
    7272 
    7373      IF( llfsec .OR. kfreq < 0 ) THEN   ;   inbsec = kfreq                       ! output frequency already in seconds 
    74       ELSE                               ;   inbsec = kfreq * NINT( rdttra(1) )   ! from time-step to seconds 
     74      ELSE                               ;   inbsec = kfreq * NINT( rdt )   ! from time-step to seconds 
    7575      ENDIF 
    7676      iddss = NINT( rday          )                                         ! number of seconds in 1 day 
     
    116116      ! date of the beginning and the end of the run 
    117117 
    118       zdrun = rdttra(1) / rday * REAL( nitend - nit000, wp )                ! length of the run in days 
    119       zjul  = fjulday - rdttra(1) / rday 
     118      zdrun = rdt / rday * REAL( nitend - nit000, wp )                ! length of the run in days 
     119      zjul  = fjulday - rdt / rday 
    120120      CALL ju2ymds( zjul        , iyear1, imonth1, iday1, zsec1 )           ! year/month/day of the beginning of run 
    121121      CALL ju2ymds( zjul + zdrun, iyear2, imonth2, iday2, zsec2 )           ! year/month/day of the end       of run 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diaptr.F90

    r5147 r6140  
    5959   REAL(wp), TARGET, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: p_fval2d 
    6060 
    61  
    6261   !! * Substitutions 
    63 #  include "domzgr_substitute.h90" 
    6462#  include "vectopt_loop_substitute.h90" 
    6563   !!---------------------------------------------------------------------- 
     
    118116               DO jj = 1, jpj 
    119117                  DO ji = 1, jpi 
    120                      zsfc = e1t(ji,jj) * fse3t(ji,jj,jk) 
     118                     zsfc = e1t(ji,jj) * e3t_n(ji,jj,jk) 
    121119                     zmask(ji,jj,jk)      = tmask(ji,jj,jk)      * zsfc 
    122120                     zts(ji,jj,jk,jp_tem) = tsn(ji,jj,jk,jp_tem) * zsfc 
    123121                     zts(ji,jj,jk,jp_sal) = tsn(ji,jj,jk,jp_sal) * zsfc 
    124                   ENDDO 
    125                ENDDO 
    126             ENDDO 
     122                  END DO 
     123               END DO 
     124            END DO 
    127125            DO jn = 1, nptr 
    128126               zmask(1,:,:) = ptr_sjk( zmask(:,:,:), btmsk(:,:,jn) ) 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90

    r5930 r6140  
    3030   USE zdf_oce         ! ocean vertical physics 
    3131   USE ldftra          ! lateral physics: eddy diffusivity coef. 
     32   USE ldfdyn          ! lateral physics: eddy viscosity   coef. 
    3233   USE sbc_oce         ! Surface boundary condition: ocean fields 
    3334   USE sbc_ice         ! Surface boundary condition: ice fields 
     
    4041   USE zdfddm          ! vertical  physics: double diffusion 
    4142   USE diahth          ! thermocline diagnostics 
     43   ! 
    4244   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    4345   USE in_out_manager  ! I/O manager 
    44    USE diadimg         ! dimg direct access file format output 
     46   USE diatmb          ! Top,middle,bottom output 
     47   USE dia25h          ! 25h Mean output 
    4548   USE iom 
    4649   USE ioipsl 
     
    5356   USE lib_mpp         ! MPP library 
    5457   USE timing          ! preformance summary 
     58   USE diurnal_bulk    ! diurnal warm layer 
     59   USE cool_skin       ! Cool skin 
    5560   USE wrk_nemo        ! working array 
    5661 
     
    7479   !! * Substitutions 
    7580#  include "zdfddm_substitute.h90" 
    76 #  include "domzgr_substitute.h90" 
    7781#  include "vectopt_loop_substitute.h90" 
    7882   !!---------------------------------------------------------------------- 
     
    97101  END FUNCTION dia_wri_alloc 
    98102 
    99 #if defined key_dimgout 
    100    !!---------------------------------------------------------------------- 
    101    !!   'key_dimgout'                                      DIMG output file 
    102    !!---------------------------------------------------------------------- 
    103 #   include "diawri_dimg.h90" 
    104  
    105 #else 
    106103   !!---------------------------------------------------------------------- 
    107104   !!   Default option                                   NetCDF output file 
    108105   !!---------------------------------------------------------------------- 
    109 # if defined key_iomput 
     106#if defined key_iomput 
    110107   !!---------------------------------------------------------------------- 
    111108   !!   'key_iomput'                                        use IOM library 
     
    143140      ENDIF 
    144141 
    145       IF( .NOT.lk_vvl ) THEN 
    146          CALL iom_put( "e3t" , fse3t_n(:,:,:) ) 
    147          CALL iom_put( "e3u" , fse3u_n(:,:,:) ) 
    148          CALL iom_put( "e3v" , fse3v_n(:,:,:) ) 
    149          CALL iom_put( "e3w" , fse3w_n(:,:,:) ) 
     142      IF( ln_linssh ) THEN 
     143         CALL iom_put( "e3t" , e3t_n(:,:,:) ) 
     144         CALL iom_put( "e3u" , e3u_n(:,:,:) ) 
     145         CALL iom_put( "e3v" , e3v_n(:,:,:) ) 
     146         CALL iom_put( "e3w" , e3w_n(:,:,:) ) 
    150147      ENDIF 
    151148 
     
    204201         CALL iom_put( "sbu", z2d )                ! bottom i-current 
    205202      ENDIF 
    206  
    207       IF ( ln_dynspg_ts ) THEN 
    208          CALL iom_put(  "ubar", un_adv(:,:)      )    ! barotropic i-current 
    209       ELSE 
    210          CALL iom_put(  "ubar", un_b(:,:)        )    ! barotropic i-current 
    211       ENDIF 
    212203       
    213204      CALL iom_put( "voce", vn(:,:,:)         )    ! 3D j-current 
     
    223214      ENDIF 
    224215 
    225       IF ( ln_dynspg_ts ) THEN 
    226          CALL iom_put(  "vbar", vn_adv(:,:)      )    ! barotropic j-current 
    227       ELSE 
    228          CALL iom_put(  "vbar", vn_b(:,:)        )    ! barotropic j-current 
    229       ENDIF 
    230  
    231216      CALL iom_put( "woce", wn )                   ! vertical velocity 
    232217      IF( iom_use('w_masstr') .OR. iom_use('w_masstr2') ) THEN   ! vertical mass transport & its square value 
     
    266251            DO jj = 1, jpj 
    267252               DO ji = 1, jpi 
    268                   z2d(ji,jj) = z2d(ji,jj) + fse3t(ji,jj,jk) * tsn(ji,jj,jk,jp_tem) * tmask(ji,jj,jk) 
     253                  z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_tem) * tmask(ji,jj,jk) 
    269254               END DO 
    270255            END DO 
     
    278263            DO jj = 1, jpj 
    279264               DO ji = 1, jpi 
    280                   z2d(ji,jj) = z2d(ji,jj) + fse3t(ji,jj,jk) * tsn(ji,jj,jk,jp_sal) * tmask(ji,jj,jk) 
     265                  z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_sal) * tmask(ji,jj,jk) 
    281266               END DO 
    282267            END DO 
     
    290275            DO jj = 2, jpjm1 
    291276               DO ji = fs_2, fs_jpim1   ! vector opt. 
    292                   zztmp   = 1._wp / ( e1e2t(ji,jj) * fse3t(ji,jj,jk) ) 
    293                   zztmpx  = 0.5 * (  un(ji-1,jj,jk) * un(ji-1,jj,jk) * e2u(ji-1,jj) * fse3u(ji-1,jj,jk)    & 
    294                      &             + un(ji  ,jj,jk) * un(ji  ,jj,jk) * e2u(ji  ,jj) * fse3u(ji  ,jj,jk) )  & 
     277                  zztmp   = 1._wp / ( e1e2t(ji,jj) * e3t_n(ji,jj,jk) ) 
     278                  zztmpx  = 0.5 * (  un(ji-1,jj,jk) * un(ji-1,jj,jk) * e2u(ji-1,jj) * e3u_n(ji-1,jj,jk)    & 
     279                     &             + un(ji  ,jj,jk) * un(ji  ,jj,jk) * e2u(ji  ,jj) * e3u_n(ji  ,jj,jk) )  & 
    295280                     &          *  zztmp  
    296281                  ! 
    297                   zztmpy  = 0.5 * (  vn(ji,jj-1,jk) * vn(ji,jj-1,jk) * e1v(ji,jj-1) * fse3v(ji,jj-1,jk)    & 
    298                      &             + vn(ji,jj  ,jk) * vn(ji,jj  ,jk) * e1v(ji,jj  ) * fse3v(ji,jj  ,jk) )  & 
     282                  zztmpy  = 0.5 * (  vn(ji,jj-1,jk) * vn(ji,jj-1,jk) * e1v(ji,jj-1) * e3v_n(ji,jj-1,jk)    & 
     283                     &             + vn(ji,jj  ,jk) * vn(ji,jj  ,jk) * e1v(ji,jj  ) * e3v_n(ji,jj  ,jk) )  & 
    299284                     &          *  zztmp  
    300285                  ! 
     
    311296         z3d(:,:,jpk) = 0.e0 
    312297         DO jk = 1, jpkm1 
    313             z3d(:,:,jk) = rau0 * un(:,:,jk) * e2u(:,:) * fse3u(:,:,jk) * umask(:,:,jk) 
     298            z3d(:,:,jk) = rau0 * un(:,:,jk) * e2u(:,:) * e3u_n(:,:,jk) * umask(:,:,jk) 
    314299         END DO 
    315300         CALL iom_put( "u_masstr", z3d )                  ! mass transport in i-direction 
     
    346331         z3d(:,:,jpk) = 0.e0 
    347332         DO jk = 1, jpkm1 
    348             z3d(:,:,jk) = rau0 * vn(:,:,jk) * e1v(:,:) * fse3v(:,:,jk) * vmask(:,:,jk) 
     333            z3d(:,:,jk) = rau0 * vn(:,:,jk) * e1v(:,:) * e3v_n(:,:,jk) * vmask(:,:,jk) 
    349334         END DO 
    350335         CALL iom_put( "v_masstr", z3d )                  ! mass transport in j-direction 
     
    380365      CALL wrk_dealloc( jpi , jpj, jpk , z3d ) 
    381366      ! 
     367      ! If we want tmb values  
     368 
     369      IF (ln_diatmb) THEN 
     370         CALL dia_tmb  
     371      ENDIF  
     372      IF (ln_dia25h) THEN 
     373         CALL dia_25h( kt ) 
     374      ENDIF  
     375 
    382376      IF( nn_timing == 1 )   CALL timing_stop('dia_wri') 
    383377      ! 
     
    410404      INTEGER  ::   iimi, iima, ipk, it, itmod, ijmi, ijma   ! local integers 
    411405      INTEGER  ::   jn, ierror                               ! local integers 
    412       REAL(wp) ::   zsto, zout, zmax, zjulian, zdt           ! local scalars 
     406      REAL(wp) ::   zsto, zout, zmax, zjulian                ! local scalars 
    413407      ! 
    414408      REAL(wp), POINTER, DIMENSION(:,:)   :: zw2d       ! 2D workspace 
     
    418412      IF( nn_timing == 1 )   CALL timing_start('dia_wri') 
    419413      ! 
    420                      CALL wrk_alloc( jpi,jpj      , zw2d ) 
    421       IF( lk_vvl )   CALL wrk_alloc( jpi,jpj,jpk  , zw3d ) 
     414                             CALL wrk_alloc( jpi,jpj      , zw2d ) 
     415      IF( .NOT.ln_linssh )   CALL wrk_alloc( jpi,jpj,jpk  , zw3d ) 
    422416      ! 
    423417      ! Output the initial state and forcings 
     
    435429 
    436430      ! Define frequency of output and means 
    437       zdt = rdt 
    438       IF( nacc == 1 ) zdt = rdtmin 
    439431      clop = "x"         ! no use of the mask value (require less cpu time and otherwise the model crashes) 
    440432#if defined key_diainstant 
    441       zsto = nwrite * zdt 
     433      zsto = nwrite * rdt 
    442434      clop = "inst("//TRIM(clop)//")" 
    443435#else 
    444       zsto=zdt 
     436      zsto=rdt 
    445437      clop = "ave("//TRIM(clop)//")" 
    446438#endif 
    447       zout = nwrite * zdt 
    448       zmax = ( nitend - nit000 + 1 ) * zdt 
     439      zout = nwrite * rdt 
     440      zmax = ( nitend - nit000 + 1 ) * rdt 
    449441 
    450442      ! Define indices of the horizontal output zoom and vertical limit storage 
     
    488480         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,           &  ! Horizontal grid: glamt and gphit 
    489481            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       & 
    490             &          nit000-1, zjulian, zdt, nh_T, nid_T, domain_id=nidom, snc4chunks=snc4set ) 
     482            &          nit000-1, zjulian, rdt, nh_T, nid_T, domain_id=nidom, snc4chunks=snc4set ) 
    491483         CALL histvert( nid_T, "deptht", "Vertical T levels",      &  ! Vertical grid: gdept 
    492484            &           "m", ipk, gdept_1d, nz_T, "down" ) 
     
    524516         CALL histbeg( clhstnam, jpi, glamu, jpj, gphiu,           &  ! Horizontal grid: glamu and gphiu 
    525517            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       & 
    526             &          nit000-1, zjulian, zdt, nh_U, nid_U, domain_id=nidom, snc4chunks=snc4set ) 
     518            &          nit000-1, zjulian, rdt, nh_U, nid_U, domain_id=nidom, snc4chunks=snc4set ) 
    527519         CALL histvert( nid_U, "depthu", "Vertical U levels",      &  ! Vertical grid: gdept 
    528520            &           "m", ipk, gdept_1d, nz_U, "down" ) 
     
    537529         CALL histbeg( clhstnam, jpi, glamv, jpj, gphiv,           &  ! Horizontal grid: glamv and gphiv 
    538530            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       & 
    539             &          nit000-1, zjulian, zdt, nh_V, nid_V, domain_id=nidom, snc4chunks=snc4set ) 
     531            &          nit000-1, zjulian, rdt, nh_V, nid_V, domain_id=nidom, snc4chunks=snc4set ) 
    540532         CALL histvert( nid_V, "depthv", "Vertical V levels",      &  ! Vertical grid : gdept 
    541533            &          "m", ipk, gdept_1d, nz_V, "down" ) 
     
    550542         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,           &  ! Horizontal grid: glamt and gphit 
    551543            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       & 
    552             &          nit000-1, zjulian, zdt, nh_W, nid_W, domain_id=nidom, snc4chunks=snc4set ) 
     544            &          nit000-1, zjulian, rdt, nh_W, nid_W, domain_id=nidom, snc4chunks=snc4set ) 
    553545         CALL histvert( nid_W, "depthw", "Vertical W levels",      &  ! Vertical grid: gdepw 
    554546            &          "m", ipk, gdepw_1d, nz_W, "down" ) 
     
    562554         CALL histdef( nid_T, "vosaline", "Salinity"                           , "PSU"    ,   &  ! sn 
    563555            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
    564          IF(  lk_vvl  ) THEN 
     556         IF(  .NOT.ln_linssh  ) THEN 
    565557            CALL histdef( nid_T, "vovvle3t", "Level thickness"                    , "m"      ,&  ! e3t_n 
    566558            &             jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
     
    583575         CALL histdef( nid_T, "sosfldow", "downward salt flux"                 , "PSU/m2/s",  &  ! sfx 
    584576            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
    585          IF(  .NOT. lk_vvl  ) THEN 
     577         IF(  ln_linssh  ) THEN 
    586578            CALL histdef( nid_T, "sosst_cd", "Concentration/Dilution term on temperature"     &  ! emp * tsn(:,:,1,jp_tem) 
    587579            &                                                                  , "KgC/m2/s",  &  ! sosst_cd 
     
    729721      ENDIF 
    730722 
    731       IF( lk_vvl ) THEN 
    732          CALL histwrite( nid_T, "votemper", it, tsn(:,:,:,jp_tem) * fse3t_n(:,:,:) , ndim_T , ndex_T  )   ! heat content 
    733          CALL histwrite( nid_T, "vosaline", it, tsn(:,:,:,jp_sal) * fse3t_n(:,:,:) , ndim_T , ndex_T  )   ! salt content 
    734          CALL histwrite( nid_T, "sosstsst", it, tsn(:,:,1,jp_tem) * fse3t_n(:,:,1) , ndim_hT, ndex_hT )   ! sea surface heat content 
    735          CALL histwrite( nid_T, "sosaline", it, tsn(:,:,1,jp_sal) * fse3t_n(:,:,1) , ndim_hT, ndex_hT )   ! sea surface salinity content 
     723      IF( .NOT.ln_linssh ) THEN 
     724         CALL histwrite( nid_T, "votemper", it, tsn(:,:,:,jp_tem) * e3t_n(:,:,:) , ndim_T , ndex_T  )   ! heat content 
     725         CALL histwrite( nid_T, "vosaline", it, tsn(:,:,:,jp_sal) * e3t_n(:,:,:) , ndim_T , ndex_T  )   ! salt content 
     726         CALL histwrite( nid_T, "sosstsst", it, tsn(:,:,1,jp_tem) * e3t_n(:,:,1) , ndim_hT, ndex_hT )   ! sea surface heat content 
     727         CALL histwrite( nid_T, "sosaline", it, tsn(:,:,1,jp_sal) * e3t_n(:,:,1) , ndim_hT, ndex_hT )   ! sea surface salinity content 
    736728      ELSE 
    737729         CALL histwrite( nid_T, "votemper", it, tsn(:,:,:,jp_tem) , ndim_T , ndex_T  )   ! temperature 
     
    740732         CALL histwrite( nid_T, "sosaline", it, tsn(:,:,1,jp_sal) , ndim_hT, ndex_hT )   ! sea surface salinity 
    741733      ENDIF 
    742       IF( lk_vvl ) THEN 
    743          zw3d(:,:,:) = ( ( fse3t_n(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 
    744          CALL histwrite( nid_T, "vovvle3t", it, fse3t_n (:,:,:) , ndim_T , ndex_T  )   ! level thickness 
    745          CALL histwrite( nid_T, "vovvldep", it, fsdept_n(:,:,:) , ndim_T , ndex_T  )   ! t-point depth 
     734      IF( .NOT.ln_linssh ) THEN 
     735         zw3d(:,:,:) = ( ( e3t_n(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 
     736         CALL histwrite( nid_T, "vovvle3t", it, e3t_n (:,:,:) , ndim_T , ndex_T  )   ! level thickness 
     737         CALL histwrite( nid_T, "vovvldep", it, gdept_n(:,:,:) , ndim_T , ndex_T  )   ! t-point depth 
    746738         CALL histwrite( nid_T, "vovvldef", it, zw3d             , ndim_T , ndex_T  )   ! level thickness deformation 
    747739      ENDIF 
     
    752744                                                                                  ! (includes virtual salt flux beneath ice  
    753745                                                                                  ! in linear free surface case) 
    754       IF( .NOT. lk_vvl ) THEN 
     746      IF( ln_linssh ) THEN 
    755747         zw2d(:,:) = emp (:,:) * tsn(:,:,1,jp_tem) 
    756748         CALL histwrite( nid_T, "sosst_cd", it, zw2d, ndim_hT, ndex_hT )          ! c/d term on sst 
     
    837829      ENDIF 
    838830      ! 
    839                      CALL wrk_dealloc( jpi , jpj        , zw2d ) 
    840       IF( lk_vvl )   CALL wrk_dealloc( jpi , jpj , jpk  , zw3d ) 
     831                             CALL wrk_dealloc( jpi , jpj        , zw2d ) 
     832      IF( .NOT.ln_linssh )   CALL wrk_dealloc( jpi , jpj , jpk  , zw3d ) 
    841833      ! 
    842834      IF( nn_timing == 1 )   CALL timing_stop('dia_wri') 
    843835      ! 
    844836   END SUBROUTINE dia_wri 
    845 # endif 
    846  
    847837#endif 
    848838 
     
    867857      INTEGER  ::   id_i , nz_i, nh_i        
    868858      INTEGER, DIMENSION(1) ::   idex             ! local workspace 
    869       REAL(wp) ::   zsto, zout, zmax, zjulian, zdt 
     859      REAL(wp) ::   zsto, zout, zmax, zjulian 
    870860      !!---------------------------------------------------------------------- 
    871861      !  
     
    876866      clname = cdfile_name 
    877867      IF( .NOT. Agrif_Root() ) clname = TRIM(Agrif_CFixed())//'_'//TRIM(clname) 
    878       zdt  = rdt 
    879868      zsto = rdt 
    880869      clop = "inst(x)"           ! no use of the mask value (require less cpu time) 
    881870      zout = rdt 
    882       zmax = ( nitend - nit000 + 1 ) * zdt 
     871      zmax = ( nitend - nit000 + 1 ) * rdt 
    883872 
    884873      IF(lwp) WRITE(numout,*) 
     
    895884      zjulian = zjulian - adatrj   !   set calendar origin to the beginning of the experiment 
    896885      CALL histbeg( clname, jpi, glamt, jpj, gphit,   & 
    897           1, jpi, 1, jpj, nit000-1, zjulian, zdt, nh_i, id_i, domain_id=nidom, snc4chunks=snc4set ) ! Horizontal grid : glamt and gphit 
     886          1, jpi, 1, jpj, nit000-1, zjulian, rdt, nh_i, id_i, domain_id=nidom, snc4chunks=snc4set ) ! Horizontal grid : glamt and gphit 
    898887      CALL histvert( id_i, "deptht", "Vertical T levels",   &    ! Vertical grid : gdept 
    899888          "m", jpk, gdept_1d, nz_i, "down") 
     
    913902      CALL histdef( id_i, "vovecrtz", "Vertical Velocity"     , "m/s"    ,   &   ! vertical current 
    914903         &          jpi, jpj, nh_i, jpk, 1, jpk, nz_i, 32, clop, zsto, zout )  
     904         ! 
     905      CALL histdef( id_i, "ahtu"    , "u-eddy diffusivity"    , "m2/s"    ,   &   ! zonal current 
     906         &          jpi, jpj, nh_i, jpk, 1, jpk, nz_i, 32, clop, zsto, zout ) 
     907      CALL histdef( id_i, "ahtv"    , "v-eddy diffusivity"    , "m2/s"    ,   &   ! meridonal current 
     908         &          jpi, jpj, nh_i, jpk, 1, jpk, nz_i, 32, clop, zsto, zout )  
     909      CALL histdef( id_i, "ahmt"    , "t-eddy viscosity"      , "m2/s"    ,   &   ! zonal current 
     910         &          jpi, jpj, nh_i, jpk, 1, jpk, nz_i, 32, clop, zsto, zout ) 
     911      CALL histdef( id_i, "ahmf"    , "f-eddy viscosity"      , "m2/s"    ,   &   ! meridonal current 
     912         &          jpi, jpj, nh_i, jpk, 1, jpk, nz_i, 32, clop, zsto, zout )  
     913         ! 
    915914      CALL histdef( id_i, "sowaflup", "Net Upward Water Flux" , "Kg/m2/S",   &   ! net freshwater  
    916915         &          jpi, jpj, nh_i, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
     
    925924      CALL histdef( id_i, "sometauy", "Meridional Wind Stress", "N/m2"   ,   &   ! j-wind stress 
    926925         &          jpi, jpj, nh_i, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
    927       IF( lk_vvl ) THEN 
    928          CALL histdef( id_i, "vovvldep", "T point depth"         , "m"      ,   &   ! t-point depth 
     926      IF( .NOT.ln_linssh ) THEN 
     927         CALL histdef( id_i, "vovvldep", "T point depth"         , "m"      , &   ! t-point depth 
     928            &          jpi, jpj, nh_i, jpk, 1, jpk, nz_i, 32, clop, zsto, zout ) 
     929         CALL histdef( id_i, "vovvle3t", "T point thickness"     , "m"      , &   ! t-point depth 
    929930            &          jpi, jpj, nh_i, jpk, 1, jpk, nz_i, 32, clop, zsto, zout ) 
    930931      ENDIF 
     
    952953      CALL histwrite( id_i, "vomecrty", kt, vn               , jpi*jpj*jpk, idex )    ! now j-velocity 
    953954      CALL histwrite( id_i, "vovecrtz", kt, wn               , jpi*jpj*jpk, idex )    ! now k-velocity 
     955      ! 
     956      CALL histwrite( id_i, "ahtu"    , kt, ahtu             , jpi*jpj*jpk, idex )    ! aht at u-point 
     957      CALL histwrite( id_i, "ahtv"    , kt, ahtv             , jpi*jpj*jpk, idex )    !  -  at v-point 
     958      CALL histwrite( id_i, "ahmt"    , kt, ahmt             , jpi*jpj*jpk, idex )    ! ahm at t-point 
     959      CALL histwrite( id_i, "ahmf"    , kt, ahmf             , jpi*jpj*jpk, idex )    !  -  at f-point 
     960      ! 
    954961      CALL histwrite( id_i, "sowaflup", kt, emp-rnf          , jpi*jpj    , idex )    ! freshwater budget 
    955962      CALL histwrite( id_i, "sohefldo", kt, qsr + qns        , jpi*jpj    , idex )    ! total heat flux 
     
    959966      CALL histwrite( id_i, "sometauy", kt, vtau             , jpi*jpj    , idex )    ! j-wind stress 
    960967 
     968      IF(  .NOT.ln_linssh  ) THEN              
     969         CALL histwrite( id_i, "vovvldep", kt, gdept_n(:,:,:), jpi*jpj*jpk, idex )!  T-cell depth  
     970         CALL histwrite( id_i, "vovvle3t", kt, e3t_n (:,:,:) , jpi*jpj*jpk, idex )!  T-cell thickness   
     971      END IF  
    961972      ! 3. Close the file 
    962973      ! ----------------- 
    963974      CALL histclo( id_i ) 
    964 #if ! defined key_iomput && ! defined key_dimgout 
     975#if ! defined key_iomput 
    965976      IF( ninist /= 1  ) THEN 
    966977         CALL histclo( nid_T ) 
     
    972983      !  
    973984   END SUBROUTINE dia_wri_state 
     985 
    974986   !!====================================================================== 
    975987END MODULE diawri 
Note: See TracChangeset for help on using the changeset viewer.