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 14771 – NEMO

Changeset 14771


Ignore:
Timestamp:
2021-04-30T12:20:05+02:00 (3 years ago)
Author:
mcastril
Message:

2021/HPC-11_mcastril_HPDAonline_DiagGPU: Update DIA_GPU test_case, diahsb.F90, stpctl.F90

Location:
NEMO/branches/2021/dev_r13747_HPC-11_mcastril_HPDAonline_DiagGPU/tests/DIA_GPU/MY_SRC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/dev_r13747_HPC-11_mcastril_HPDAonline_DiagGPU/tests/DIA_GPU/MY_SRC/diahsb.F90

    r14091 r14771  
    77   !! Ocean diagnostics: Heat, salt and volume budgets 
    88   !!====================================================================== 
    9    !! History :  3.3  ! 2010-09  (M. Leclair)  Original code  
     9   !! History :  3.3  ! 2010-09  (M. Leclair)  Original code 
    1010   !!                 ! 2012-10  (C. Rousset)  add iom_put 
    1111   !!---------------------------------------------------------------------- 
     
    2424   USE domvvl         ! vertical scale factors 
    2525   USE traqsr         ! penetrative solar radiation 
    26    USE trabbc         ! bottom boundary condition  
     26   USE trabbc         ! bottom boundary condition 
    2727   USE trabbc         ! bottom boundary condition 
    2828   USE restart        ! ocean restart 
     
    4747   REAL(wp) ::   frc_wn_t, frc_wn_s    ! global forcing trends 
    4848   ! 
    49    REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   surf  
     49   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   surf 
    5050   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   surf_ini      , ssh_ini          ! 
    5151   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   ssh_hc_loc_ini, ssh_sc_loc_ini   ! 
     
    6565      !!--------------------------------------------------------------------------- 
    6666      !!                  ***  ROUTINE dia_hsb  *** 
    67       !!      
     67      !! 
    6868      !! ** Purpose: Compute the ocean global heat content, salt content and volume conservation 
    69       !!  
     69      !! 
    7070      !! ** Method : - Compute the deviation of heat content, salt content and volume 
    7171      !!             at the current time step from their values at nit000 
     
    7878      INTEGER    ::   ji, jj, jk                  ! dummy loop indice 
    7979      REAL(wp)   ::   zdiff_hc    , zdiff_sc      ! heat and salt content variations 
    80       REAL(wp)   ::   zdiff_hc1   , zdiff_sc1     !  -         -     -        -  
     80      REAL(wp)   ::   zdiff_hc1   , zdiff_sc1     !  -         -     -        - 
    8181      REAL(wp)   ::   zdiff_v1    , zdiff_v2      ! volume variation 
    8282      REAL(wp)   ::   zerr_hc1    , zerr_sc1      ! heat and salt content misfit 
     
    8989      REAL(wp), DIMENSION(jpi,jpj,jpkm1) ::   zwrk         ! 3D workspace 
    9090      !!--------------------------------------------------------------------------- 
    91       IF( ln_timing )   CALL timing_start('dia_hsb')       
     91      IF( ln_timing )   CALL timing_start('dia_hsb') 
    9292      ! 
    9393      ts(:,:,:,1,Kmm) = ts(:,:,:,1,Kmm) * tmask(:,:,:) ; ts(:,:,:,1,Kbb) = ts(:,:,:,1,Kbb) * tmask(:,:,:) ; 
     
    122122            z2d1(:,:) = surf(:,:) * ww(:,:,1) * ts(:,:,1,jp_sal,Kbb) 
    123123         END IF 
    124          z_wn_trd_t = - glob_sum( 'diahsb', z2d0 )  
     124         z_wn_trd_t = - glob_sum( 'diahsb', z2d0 ) 
    125125         z_wn_trd_s = - glob_sum( 'diahsb', z2d1 ) 
    126126      ENDIF 
     
    148148            DO ji = 1, jpi 
    149149               DO jj = 1, jpj 
    150                   z2d0(ji,jj) = surf(ji,jj) * ( ts(ji,jj,mikt(ji,jj),jp_tem,Kmm) * ssh(ji,jj,Kmm) - ssh_hc_loc_ini(ji,jj) )  
    151                   z2d1(ji,jj) = surf(ji,jj) * ( ts(ji,jj,mikt(ji,jj),jp_sal,Kmm) * ssh(ji,jj,Kmm) - ssh_sc_loc_ini(ji,jj) )  
     150                  z2d0(ji,jj) = surf(ji,jj) * ( ts(ji,jj,mikt(ji,jj),jp_tem,Kmm) * ssh(ji,jj,Kmm) - ssh_hc_loc_ini(ji,jj) ) 
     151                  z2d1(ji,jj) = surf(ji,jj) * ( ts(ji,jj,mikt(ji,jj),jp_sal,Kmm) * ssh(ji,jj,Kmm) - ssh_sc_loc_ini(ji,jj) ) 
    152152               END DO 
    153153            END DO 
    154154         ELSE                          ! no under ice-shelf seas 
    155             z2d0(:,:) = surf(:,:) * ( ts(:,:,1,jp_tem,Kmm) * ssh(:,:,Kmm) - ssh_hc_loc_ini(:,:) )  
    156             z2d1(:,:) = surf(:,:) * ( ts(:,:,1,jp_sal,Kmm) * ssh(:,:,Kmm) - ssh_sc_loc_ini(:,:) )  
     155            z2d0(:,:) = surf(:,:) * ( ts(:,:,1,jp_tem,Kmm) * ssh(:,:,Kmm) - ssh_hc_loc_ini(:,:) ) 
     156            z2d1(:,:) = surf(:,:) * ( ts(:,:,1,jp_sal,Kmm) * ssh(:,:,Kmm) - ssh_sc_loc_ini(:,:) ) 
    157157         END IF 
    158          z_ssh_hc = glob_sum_full( 'diahsb', z2d0 )  
    159          z_ssh_sc = glob_sum_full( 'diahsb', z2d1 )  
     158         z_ssh_hc = glob_sum_full( 'diahsb', z2d0 ) 
     159         z_ssh_sc = glob_sum_full( 'diahsb', z2d1 ) 
    160160      ENDIF 
    161161      ! 
     
    184184      zdiff_sc = zdiff_sc - frc_s 
    185185      IF( ln_linssh ) THEN 
    186          zdiff_hc1 = zdiff_hc + z_ssh_hc  
     186         zdiff_hc1 = zdiff_hc + z_ssh_hc 
    187187         zdiff_sc1 = zdiff_sc + z_ssh_sc 
    188188         zerr_hc1  = z_ssh_hc - frc_wn_t 
     
    204204!!gm end 
    205205 
    206       CALL iom_put(   'bgfrcvol' , frc_v    * 1.e-9    )              ! vol - surface forcing (km3)  
    207       CALL iom_put(   'bgfrctem' , frc_t    * rho0 * rcp * 1.e-20 )   ! hc  - surface forcing (1.e20 J)  
    208       CALL iom_put(   'bgfrchfx' , frc_t    * rho0 * rcp /  &         ! hc  - surface forcing (W/m2)  
     206      CALL iom_put(   'bgfrcvol' , frc_v    * 1.e-9    )              ! vol - surface forcing (km3) 
     207      CALL iom_put(   'bgfrctem' , frc_t    * rho0 * rcp * 1.e-20 )   ! hc  - surface forcing (1.e20 J) 
     208      CALL iom_put(   'bgfrchfx' , frc_t    * rho0 * rcp /  &         ! hc  - surface forcing (W/m2) 
    209209         &                       ( surf_tot * kt * rn_Dt )        ) 
    210       CALL iom_put(   'bgfrcsal' , frc_s    * 1.e-9    )              ! sc  - surface forcing (psu*km3)  
     210      CALL iom_put(   'bgfrcsal' , frc_s    * 1.e-9    )              ! sc  - surface forcing (psu*km3) 
    211211 
    212212      IF( .NOT. ln_linssh ) THEN 
    213          CALL iom_put( 'bgtemper' , zdiff_hc / zvol_tot )              ! Temperature drift     (C)  
     213         CALL iom_put( 'bgtemper' , zdiff_hc / zvol_tot )              ! Temperature drift     (C) 
    214214         CALL iom_put( 'bgsaline' , zdiff_sc / zvol_tot )              ! Salinity    drift     (PSU) 
    215          CALL iom_put( 'bgheatco' , zdiff_hc * 1.e-20 * rho0 * rcp )   ! Heat content drift    (1.e20 J)  
    216          CALL iom_put( 'bgheatfx' , zdiff_hc * rho0 * rcp /  &         ! Heat flux drift       (W/m2)  
     215         CALL iom_put( 'bgheatco' , zdiff_hc * 1.e-20 * rho0 * rcp )   ! Heat content drift    (1.e20 J) 
     216         CALL iom_put( 'bgheatfx' , zdiff_hc * rho0 * rcp /  &         ! Heat flux drift       (W/m2) 
    217217            &                       ( surf_tot * kt * rn_Dt )        ) 
    218218         CALL iom_put( 'bgsaltco' , zdiff_sc * 1.e-9    )              ! Salt content drift    (psu*km3) 
    219          CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh drift      (km3)   
    220          CALL iom_put( 'bgvole3t' , zdiff_v2 * 1.e-9    )              ! volume e3t drift      (km3)   
     219         CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh drift      (km3) 
     220         CALL iom_put( 'bgvole3t' , zdiff_v2 * 1.e-9    )              ! volume e3t drift      (km3) 
    221221         ! 
    222222         IF( kt == nitend .AND. lwp ) THEN 
     
    231231         ! 
    232232      ELSE 
    233          CALL iom_put( 'bgtemper' , zdiff_hc1 / zvol_tot)              ! Heat content drift    (C)  
     233         CALL iom_put( 'bgtemper' , zdiff_hc1 / zvol_tot)              ! Heat content drift    (C) 
    234234         CALL iom_put( 'bgsaline' , zdiff_sc1 / zvol_tot)              ! Salt content drift    (PSU) 
    235          CALL iom_put( 'bgheatco' , zdiff_hc1 * 1.e-20 * rho0 * rcp )  ! Heat content drift    (1.e20 J)  
    236          CALL iom_put( 'bgheatfx' , zdiff_hc1 * rho0 * rcp /  &        ! Heat flux drift       (W/m2)  
     235         CALL iom_put( 'bgheatco' , zdiff_hc1 * 1.e-20 * rho0 * rcp )  ! Heat content drift    (1.e20 J) 
     236         CALL iom_put( 'bgheatfx' , zdiff_hc1 * rho0 * rcp /  &        ! Heat flux drift       (W/m2) 
    237237            &                       ( surf_tot * kt * rn_Dt )         ) 
    238238         CALL iom_put( 'bgsaltco' , zdiff_sc1 * 1.e-9    )             ! Salt content drift    (psu*km3) 
    239          CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh drift      (km3)   
     239         CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh drift      (km3) 
    240240         CALL iom_put( 'bgmistem' , zerr_hc1 / zvol_tot )              ! hc  - error due to free surface (C) 
    241241         CALL iom_put( 'bgmissal' , zerr_sc1 / zvol_tot )              ! sc  - error due to free surface (psu) 
     
    252252      !!--------------------------------------------------------------------- 
    253253      !!                   ***  ROUTINE dia_hsb_rst  *** 
    254       !!                      
     254      !! 
    255255      !! ** Purpose :   Read or write DIA file in restart file 
    256256      !! 
     
    264264      !!---------------------------------------------------------------------- 
    265265      ! 
    266       IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise  
     266      IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise 
    267267         IF( ln_rstart ) THEN                   !* Read the restart file 
    268268            ! 
     
    270270            IF(lwp) WRITE(numout,*) '   dia_hsb_rst : read hsb restart at it= ', kt,' date= ', ndastp 
    271271            IF(lwp) WRITE(numout,*) 
    272             CALL iom_get( numror, 'frc_v', frc_v, ldxios = lrxios ) 
    273             CALL iom_get( numror, 'frc_t', frc_t, ldxios = lrxios ) 
    274             CALL iom_get( numror, 'frc_s', frc_s, ldxios = lrxios ) 
     272            CALL iom_get( numror, 'frc_v', frc_v ) 
     273            CALL iom_get( numror, 'frc_t', frc_t ) 
     274            CALL iom_get( numror, 'frc_s', frc_s ) 
    275275            IF( ln_linssh ) THEN 
    276                CALL iom_get( numror, 'frc_wn_t', frc_wn_t, ldxios = lrxios ) 
    277                CALL iom_get( numror, 'frc_wn_s', frc_wn_s, ldxios = lrxios ) 
     276               CALL iom_get( numror, 'frc_wn_t', frc_wn_t ) 
     277               CALL iom_get( numror, 'frc_wn_s', frc_wn_s ) 
    278278            ENDIF 
    279             CALL iom_get( numror, jpdom_auto, 'surf_ini'  , surf_ini  , ldxios = lrxios ) ! ice sheet coupling 
    280             CALL iom_get( numror, jpdom_auto, 'ssh_ini'   , ssh_ini   , ldxios = lrxios ) 
    281             CALL iom_get( numror, jpdom_auto, 'e3t_ini'   , e3t_ini   , ldxios = lrxios ) 
    282             CALL iom_get( numror, jpdom_auto, 'tmask_ini' , tmask_ini , ldxios = lrxios ) 
    283             CALL iom_get( numror, jpdom_auto, 'hc_loc_ini', hc_loc_ini, ldxios = lrxios ) 
    284             CALL iom_get( numror, jpdom_auto, 'sc_loc_ini', sc_loc_ini, ldxios = lrxios ) 
     279            CALL iom_get( numror, jpdom_auto, 'surf_ini'  , surf_ini  ) ! ice sheet coupling 
     280            CALL iom_get( numror, jpdom_auto, 'ssh_ini'   , ssh_ini    ) 
     281            CALL iom_get( numror, jpdom_auto, 'e3t_ini'   , e3t_ini    ) 
     282            CALL iom_get( numror, jpdom_auto, 'tmask_ini' , tmask_ini ) 
     283            CALL iom_get( numror, jpdom_auto, 'hc_loc_ini', hc_loc_ini ) 
     284            CALL iom_get( numror, jpdom_auto, 'sc_loc_ini', sc_loc_ini ) 
    285285            IF( ln_linssh ) THEN 
    286                CALL iom_get( numror, jpdom_auto, 'ssh_hc_loc_ini', ssh_hc_loc_ini, ldxios = lrxios ) 
    287                CALL iom_get( numror, jpdom_auto, 'ssh_sc_loc_ini', ssh_sc_loc_ini, ldxios = lrxios ) 
     286               CALL iom_get( numror, jpdom_auto, 'ssh_hc_loc_ini', ssh_hc_loc_ini ) 
     287               CALL iom_get( numror, jpdom_auto, 'ssh_sc_loc_ini', ssh_sc_loc_ini ) 
    288288            ENDIF 
    289289         ELSE 
     
    301301            END DO 
    302302            frc_v = 0._wp                                           ! volume       trend due to forcing 
    303             frc_t = 0._wp                                           ! heat content   -    -   -    -    
    304             frc_s = 0._wp                                           ! salt content   -    -   -    -         
     303            frc_t = 0._wp                                           ! heat content   -    -   -    - 
     304            frc_s = 0._wp                                           ! salt content   -    -   -    - 
    305305            IF( ln_linssh ) THEN 
    306306               IF( ln_isfcav ) THEN 
     
    326326         IF(lwp) WRITE(numout,*) 
    327327         ! 
    328          IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    329          CALL iom_rstput( kt, nitrst, numrow, 'frc_v', frc_v, ldxios = lwxios ) 
    330          CALL iom_rstput( kt, nitrst, numrow, 'frc_t', frc_t, ldxios = lwxios ) 
    331          CALL iom_rstput( kt, nitrst, numrow, 'frc_s', frc_s, ldxios = lwxios ) 
     328         CALL iom_rstput( kt, nitrst, numrow, 'frc_v', frc_v ) 
     329         CALL iom_rstput( kt, nitrst, numrow, 'frc_t', frc_t ) 
     330         CALL iom_rstput( kt, nitrst, numrow, 'frc_s', frc_s ) 
    332331         IF( ln_linssh ) THEN 
    333             CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_t', frc_wn_t, ldxios = lwxios ) 
    334             CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_s', frc_wn_s, ldxios = lwxios ) 
     332            CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_t', frc_wn_t ) 
     333            CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_s', frc_wn_s ) 
    335334         ENDIF 
    336          CALL iom_rstput( kt, nitrst, numrow, 'surf_ini'  , surf_ini  , ldxios = lwxios )      ! ice sheet coupling 
    337          CALL iom_rstput( kt, nitrst, numrow, 'ssh_ini'   , ssh_ini   , ldxios = lwxios ) 
    338          CALL iom_rstput( kt, nitrst, numrow, 'e3t_ini'   , e3t_ini   , ldxios = lwxios ) 
    339          CALL iom_rstput( kt, nitrst, numrow, 'tmask_ini' , tmask_ini , ldxios = lwxios ) 
    340          CALL iom_rstput( kt, nitrst, numrow, 'hc_loc_ini', hc_loc_ini, ldxios = lwxios ) 
    341          CALL iom_rstput( kt, nitrst, numrow, 'sc_loc_ini', sc_loc_ini, ldxios = lwxios ) 
     335         CALL iom_rstput( kt, nitrst, numrow, 'surf_ini'  , surf_ini  )      ! ice sheet coupling 
     336         CALL iom_rstput( kt, nitrst, numrow, 'ssh_ini'   , ssh_ini    ) 
     337         CALL iom_rstput( kt, nitrst, numrow, 'e3t_ini'   , e3t_ini    ) 
     338         CALL iom_rstput( kt, nitrst, numrow, 'tmask_ini' , tmask_ini ) 
     339         CALL iom_rstput( kt, nitrst, numrow, 'hc_loc_ini', hc_loc_ini ) 
     340         CALL iom_rstput( kt, nitrst, numrow, 'sc_loc_ini', sc_loc_ini ) 
    342341         IF( ln_linssh ) THEN 
    343             CALL iom_rstput( kt, nitrst, numrow, 'ssh_hc_loc_ini', ssh_hc_loc_ini, ldxios = lwxios ) 
    344             CALL iom_rstput( kt, nitrst, numrow, 'ssh_sc_loc_ini', ssh_sc_loc_ini, ldxios = lwxios ) 
     342            CALL iom_rstput( kt, nitrst, numrow, 'ssh_hc_loc_ini', ssh_hc_loc_ini ) 
     343            CALL iom_rstput( kt, nitrst, numrow, 'ssh_sc_loc_ini', ssh_sc_loc_ini ) 
    345344         ENDIF 
    346          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
    347345         ! 
    348346      ENDIF 
     
    354352      !!--------------------------------------------------------------------------- 
    355353      !!                  ***  ROUTINE dia_hsb  *** 
    356       !!      
     354      !! 
    357355      !! ** Purpose: Initialization for the heat salt volume budgets 
    358       !!  
     356      !! 
    359357      !! ** Method : Compute initial heat content, salt content and volume 
    360358      !! 
     
    388386      IF( .NOT. ln_diahsb )   RETURN 
    389387 
    390       IF(lwxios) THEN 
    391 ! define variables in restart file when writing with XIOS 
    392         CALL iom_set_rstw_var_active('frc_v') 
    393         CALL iom_set_rstw_var_active('frc_t') 
    394         CALL iom_set_rstw_var_active('frc_s') 
    395         CALL iom_set_rstw_var_active('surf_ini') 
    396         CALL iom_set_rstw_var_active('ssh_ini') 
    397         CALL iom_set_rstw_var_active('e3t_ini') 
    398         CALL iom_set_rstw_var_active('hc_loc_ini') 
    399         CALL iom_set_rstw_var_active('sc_loc_ini') 
    400         IF( ln_linssh ) THEN 
    401            CALL iom_set_rstw_var_active('ssh_hc_loc_ini') 
    402            CALL iom_set_rstw_var_active('ssh_sc_loc_ini') 
    403            CALL iom_set_rstw_var_active('frc_wn_t') 
    404            CALL iom_set_rstw_var_active('frc_wn_s') 
    405         ENDIF 
    406       ENDIF 
    407388      ! ------------------- ! 
    408389      ! 1 - Allocate memory ! 
     
    425406      surf_tot  = glob_sum( 'diahsb', surf(:,:) )         ! total ocean surface area 
    426407 
    427       IF( ln_bdy ) CALL ctl_warn( 'dia_hsb_init: heat/salt budget does not consider open boundary fluxes' )          
     408      IF( ln_bdy ) CALL ctl_warn( 'dia_hsb_init: heat/salt budget does not consider open boundary fluxes' ) 
    428409      ! 
    429410      ! ---------------------------------- ! 
     
    436417   !!====================================================================== 
    437418END MODULE diahsb 
    438 #endif 
  • NEMO/branches/2021/dev_r13747_HPC-11_mcastril_HPDAonline_DiagGPU/tests/DIA_GPU/MY_SRC/stpctl.F90

    r14091 r14771  
    2626   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    2727   USE lib_mpp         ! distributed memory computing 
     28   USE eosbn2, ONLY: ln_SEOS, rn_b0 
    2829   ! 
    2930   USE netcdf          ! NetCDF library 
     
    3435   PUBLIC stp_ctl           ! routine called by step.F90 
    3536 
    36    INTEGER                ::   nrunid   ! netcdf file id 
    37    INTEGER, DIMENSION(8)  ::   nvarid   ! netcdf variable id 
     37   INTEGER, PARAMETER         ::   jpvar = 8 
     38   INTEGER                    ::   nrunid   ! netcdf file id 
     39   INTEGER, DIMENSION(jpvar)  ::   nvarid   ! netcdf variable id 
    3840   !!---------------------------------------------------------------------- 
    3941   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
    40    !! $Id$ 
     42   !! $Id: stpctl.F90 13616 2020-10-15 15:58:33Z smasson $ 
    4143   !! Software governed by the CeCILL license (see ./LICENSE) 
    4244   !!---------------------------------------------------------------------- 
     
    4648      !!---------------------------------------------------------------------- 
    4749      !!                    ***  ROUTINE stp_ctl  *** 
    48       !!                      
     50      !! 
    4951      !! ** Purpose :   Control the run 
    5052      !! 
     
    6264      INTEGER, INTENT(in   ) ::   Kmm      ! ocean time level index 
    6365      !! 
     66      INTEGER, PARAMETER              ::   jptst = 4 
    6467      INTEGER                         ::   ji                                    ! dummy loop indices 
    6568      INTEGER                         ::   idtime, istatus 
    66       INTEGER , DIMENSION(9)          ::   iareasum, iareamin, iareamax 
    67       INTEGER , DIMENSION(3,4)        ::   iloc                                  ! min/max loc indices 
    68       REAL(wp)                        ::   zzz                                   ! local real  
    69       REAL(wp), DIMENSION(9)          ::   zmax, zmaxlocal 
     69      INTEGER , DIMENSION(jptst)      ::   iareasum, iareamin, iareamax 
     70      INTEGER , DIMENSION(3,jptst)    ::   iloc                                  ! min/max loc indices 
     71      REAL(wp)                        ::   zzz, zminsal, zmaxsal                 ! local real  
     72      REAL(wp), DIMENSION(jpvar+1)    ::   zmax 
     73      REAL(wp), DIMENSION(jptst)      ::   zmaxlocal 
    7074      LOGICAL                         ::   ll_wrtstp, ll_colruns, ll_wrtruns, ll_0oce 
    7175      LOGICAL, DIMENSION(jpi,jpj,jpk) ::   llmsk 
     
    7579      ! 
    7680      ll_wrtstp  = ( MOD( kt-nit000, sn_cfctl%ptimincr ) == 0 ) .OR. ( kt == nitend ) 
    77       ll_colruns = ll_wrtstp .AND. sn_cfctl%l_runstat .AND. jpnij > 1  
     81      ll_colruns = ll_wrtstp .AND. sn_cfctl%l_runstat .AND. jpnij > 1 
    7882      ll_wrtruns = ( ll_colruns .OR. jpnij == 1 ) .AND. lwm 
    7983      ! 
     
    108112            istatus = NF90_ENDDEF(nrunid) 
    109113         ENDIF 
    110          !     
     114         ! 
    111115      ENDIF 
    112116      ! 
     
    120124      !                                   !==  done by all processes at every time step  ==! 
    121125      ! 
    122       llmsk(   1:Nis1,:,:) = .FALSE.                                              ! exclude halos from the checked region 
    123       llmsk(Nie1: jpi,:,:) = .FALSE. 
    124       llmsk(:,   1:Njs1,:) = .FALSE. 
    125       llmsk(:,Nje1: jpj,:) = .FALSE. 
     126      llmsk(     1:nn_hls,:,:) = .FALSE.                                          ! exclude halos from the checked region 
     127      llmsk(Nie0+1:  jpi,:,:) = .FALSE. 
     128      llmsk(:,     1:nn_hls,:) = .FALSE. 
     129      llmsk(:,Nje0+1:  jpj,:) = .FALSE. 
    126130      ! 
    127131      llmsk(Nis0:Nie0,Njs0:Nje0,1) = ssmask(Nis0:Nie0,Njs0:Nje0) == 1._wp         ! define only the inner domain 
     
    152156         zmax(5:8) = 0._wp 
    153157      ENDIF 
    154       zmax(9) = REAL( nstop, wp )                                                 ! stop indicator 
     158      zmax(jpvar+1) = REAL( nstop, wp )                                           ! stop indicator 
    155159      ! 
    156160      !                                   !==               get global extrema             ==! 
    157161      !                                   !==  done by all processes if writting run.stat  ==! 
    158162      IF( ll_colruns ) THEN 
    159          zmaxlocal(:) = zmax(:) 
     163         zmaxlocal(:) = zmax(1:jptst) 
    160164         CALL mpp_max( "stpctl", zmax )          ! max over the global domain: ok even of ll_0oce = .true.  
    161          nstop = NINT( zmax(9) )                 ! update nstop indicator (now sheared among all local domains) 
     165         nstop = NINT( zmax(jpvar+1) )           ! update nstop indicator (now sheared among all local domains) 
    162166      ELSE 
    163167         ! if no ocean point: MAXVAL returns -HUGE => we must overwrite this value to avoid error handling bellow. 
    164          IF( ll_0oce )   zmax(1:4) = (/ 0._wp, 0._wp, -1._wp, 1._wp /)   ! default "valid" values... 
    165       ENDIF 
    166       ! 
    167       zmax(3) = -zmax(3)                         ! move back from max(-zz) to min(zz) : easier to manage!  
    168       zmax(5) = -zmax(5)                         ! move back from max(-zz) to min(zz) : easier to manage! 
    169       IF( ll_colruns ) THEN 
    170          zmaxlocal(3) = -zmaxlocal(3)            ! move back from max(-zz) to min(zz) : easier to manage!  
    171          zmaxlocal(5) = -zmaxlocal(5)            ! move back from max(-zz) to min(zz) : easier to manage! 
    172       ENDIF 
     168         IF( ll_0oce )   zmax(1:jptst) = (/ 0._wp, 0._wp, -1._wp, 1._wp /)   ! default "valid" values... 
     169      ENDIF 
     170      ! 
     171      zmax(3) = -zmax(3)                              ! move back from max(-zz) to min(zz) : easier to manage!  
     172      zmax(5) = -zmax(5)                              ! move back from max(-zz) to min(zz) : easier to manage! 
     173      IF( ll_colruns ) zmaxlocal(3) = -zmaxlocal(3)   ! move back from max(-zz) to min(zz) : easier to manage! 
    173174      ! 
    174175      !                                   !==              write "run.stat" files              ==! 
    175176      !                                   !==  done only by 1st subdomain at writting timestep  ==! 
    176177      IF( ll_wrtruns ) THEN 
    177          WRITE(numrun,9500) kt, zmax(1), zmax(2), zmax(3), zmax(4) 
    178          DO ji = 1, 6 + 2 * COUNT( (/ln_zad_Aimp/) ) 
     178         WRITE(numrun,9500) kt, zmax(1:jptst) 
     179         DO ji = 1, jpvar - 2 * COUNT( .NOT. (/ln_zad_Aimp/) ) 
    179180            istatus = NF90_PUT_VAR( nrunid, nvarid(ji), (/zmax(ji)/), (/kt/), (/1/) ) 
    180181         END DO 
     
    184185      !                                   !==  done by all processes at every time step  ==! 
    185186      ! 
    186       IF(  zmax(1) >   20._wp .OR.   &                   ! too large sea surface height ( > 20 m ) 
    187          & zmax(2) >   10._wp .OR.   &                   ! too large velocity ( > 10 m/s) 
    188          & zmax(3) <=   0._wp .OR.   &                   ! negative or zero sea surface salinity 
    189          & zmax(4) >= 100._wp .OR.   &                   ! too large sea surface salinity ( > 100 ) 
    190          & zmax(4) <    0._wp .OR.   &                   ! too large sea surface salinity (keep this line for sea-ice) 
    191          & IEEE_IS_NAN( zmax(1) + zmax(2) + zmax(3) ) .OR.   &               ! NaN encounter in the tests 
    192          & ABS(   zmax(1) + zmax(2) + zmax(3) ) > HUGE(1._wp) ) THEN   ! Infinity encounter in the tests 
     187      IF ( ln_SEOS.AND.(rn_b0==0._wp) ) THEN             ! Discard checks on salinity 
     188         zmaxsal =  HUGE(1._wp)                               ! if not used in eos 
     189         zminsal = -HUGE(1._wp) 
     190      ELSE 
     191         zmaxsal = 100._wp 
     192         zminsal =   0._wp 
     193      ENDIF  
     194      !  
     195      IF(  zmax(1) >   20._wp .OR.   &                        ! too large sea surface height ( > 20 m ) 
     196         & zmax(2) >   10._wp .OR.   &                        ! too large velocity ( > 10 m/s) 
     197         & zmax(3) <= zminsal .OR.   &                        ! negative or zero sea surface salinity 
     198         & zmax(4) >= zmaxsal .OR.   &                        ! too large sea surface salinity ( > 100 ) 
     199         & zmax(4) <  zminsal .OR.   &                        ! too large sea surface salinity (keep this line for sea-ice) 
     200         & IEEE_IS_NAN( SUM(zmax(1:jptst)) ) .OR.   &         ! NaN encounter in the tests 
     201         & ABS(   SUM(zmax(1:jptst)) ) > HUGE(1._wp) ) THEN   ! Infinity encounter in the tests 
    193202         ! 
    194203         iloc(:,:) = 0 
     
    206215            ! find which subdomain has the max. 
    207216            iareamin(:) = jpnij+1   ;   iareamax(:) = 0   ;   iareasum(:) = 0 
    208             DO ji = 1, 9 
     217            DO ji = 1, jptst 
    209218               IF( zmaxlocal(ji) == zmax(ji) ) THEN 
    210219                  iareamin(ji) = narea   ;   iareamax(ji) = narea   ;   iareasum(ji) = 1 
     
    223232            iloc(1:3,3) = MINLOC(       ts(:,:,:,jp_sal,Kmm) , mask = llmsk(:,:,:) ) 
    224233            iloc(1:3,4) = MAXLOC(       ts(:,:,:,jp_sal,Kmm) , mask = llmsk(:,:,:) ) 
    225             DO ji = 1, 4   ! local domain indices ==> global domain indices, excluding halos 
     234            DO ji = 1, jptst   ! local domain indices ==> global domain indices, excluding halos 
    226235               iloc(1:2,ji) = (/ mig0(iloc(1,ji)), mjg0(iloc(2,ji)) /) 
    227236            END DO 
     
    242251         CALL dia_wri_state( Kmm, 'output.abort' )     ! create an output.abort file 
    243252         ! 
    244          IF( ll_colruns .or. jpnij == 1 ) THEN   ! all processes synchronized -> use lwp to print in opened ocean.output files 
     253         IF( ll_colruns .OR. jpnij == 1 ) THEN   ! all processes synchronized -> use lwp to print in opened ocean.output files 
    245254            IF(lwp) THEN   ;   CALL ctl_stop( ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6 ) 
    246255            ELSE           ;   nstop = MAX(1, nstop)   ! make sure nstop > 0 (automatically done when calling ctl_stop) 
Note: See TracChangeset for help on using the changeset viewer.