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 7897 for branches/2017/dev_r7832_HPC08_lbclnk_3rd_dim/NEMOGCM/NEMO/OPA_SRC/stpctl.F90 – NEMO

Ignore:
Timestamp:
2017-04-11T15:10:20+02:00 (7 years ago)
Author:
gm
Message:

#1880: (HPC-08) 3D lbc_lnk with any 3rd dim + regroup global comm in stpctl.F90

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_r7832_HPC08_lbclnk_3rd_dim/NEMOGCM/NEMO/OPA_SRC/stpctl.F90

    r6140 r7897  
    99   !!   NEMO     1.0  ! 2002-06  (G. Madec)  F90: Free form and module 
    1010   !!            2.0  ! 2009-07  (G. Madec)  Add statistic for time-spliting 
     11   !!            3.7  ! 2016-09  (G. Madec)  Remove solver 
     12   !!            4.0  ! 2017-04  (G. Madec)  regroup  
    1113   !!---------------------------------------------------------------------- 
    1214 
     
    2729   PUBLIC stp_ctl           ! routine called by step.F90 
    2830   !!---------------------------------------------------------------------- 
    29    !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
     31   !! NEMO/OPA 4.0 , NEMO Consortium (2017) 
    3032   !! $Id$ 
    3133   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
     
    4143      !! ** Method  : - Save the time step in numstp 
    4244      !!              - Print it each 50 time steps 
    43       !!              - Stop the run IF problem ( indic < 0 ) 
     45      !!              - Stop the run IF problem encountered by setting indic=-3 
     46      !!                Problems checked: U max>10 m/s and SSS min < 0 
    4447      !! 
    4548      !! ** Actions :   'time.step' file containing the last ocean time-step 
     
    5154      INTEGER  ::   ji, jj, jk             ! dummy loop indices 
    5255      INTEGER  ::   ii, ij, ik             ! local integers 
    53       REAL(wp) ::   zumax, zsmin, zssh2    ! local scalars 
    54       INTEGER, DIMENSION(3) ::   ilocu     !  
    55       INTEGER, DIMENSION(2) ::   ilocs     !  
     56      INTEGER , DIMENSION(3) ::   ilocu    !  
     57      INTEGER , DIMENSION(2) ::   ilocs    !  
     58      REAL(wp), DIMENSION(3) ::   zmax     !  
    5659      !!---------------------------------------------------------------------- 
    5760      ! 
     
    6063         WRITE(numout,*) 'stp_ctl : time-stepping control' 
    6164         WRITE(numout,*) '~~~~~~~' 
    62          ! open time.step file 
     65         !                                ! open time.step file 
    6366         CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 
     67         !                                ! open run.stat file 
     68         CALL ctl_opn( numrun, 'run.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 
    6469      ENDIF 
    6570      ! 
    66       IF(lwp) WRITE ( numstp, '(1x, i8)' )   kt      !* save the current time step in numstp 
    67       IF(lwp) REWIND( numstp )                       !  -------------------------- 
     71      IF(lwp) WRITE ( numstp, '(1x, i8)' )   kt    !==  current time step  ==!   ("time.step" file) 
     72      IF(lwp) REWIND( numstp ) 
    6873      ! 
    69       !                                              !* Test maximum of velocity (zonal only) 
    70       !                                              !  ------------------------ 
    71       !! zumax = MAXVAL( ABS( un(:,:,:) ) )                ! slower than the following loop on NEC SX5 
    72       zumax = 0.e0 
    73       DO jk = 1, jpk 
    74          DO jj = 1, jpj 
    75             DO ji = 1, jpi 
    76                zumax = MAX(zumax,ABS(un(ji,jj,jk))) 
    77           END DO  
    78         END DO  
    79       END DO         
    80       IF( lk_mpp )   CALL mpp_max( zumax )                 ! max over the global domain 
     74      !                                            !==  test of extrema  ==! 
     75      zmax(1) = MAXVAL(  ABS( un(:,:,:) )  )                                  ! velocity max (zonal only) 
     76      zmax(2) = MAXVAL( -tsn(:,:,1,jp_sal) , mask = tmask(:,:,1) == 1._wp )   ! minus surface salinity max 
     77      zmax(3) = MAXVAL( sshn(:,:)*sshn(:,:), mask = tmask(:,:,1) == 1._wp )   ! ssh^2 max 
    8178      ! 
    82       IF( MOD( kt, nwrite ) == 1 .AND. lwp )   WRITE(numout,*) ' ==>> time-step= ',kt,' abs(U) max: ', zumax 
     79      IF( lk_mpp )   CALL mpp_max_multiple( zmax(:), 3 )          ! max over the global domain 
    8380      ! 
    84       IF( zumax > 20.e0 ) THEN 
     81      IF( MOD( kt, nwrite ) == 1 .AND. lwp ) THEN 
     82         WRITE(numout,*) ' ==>> time-step= ',kt,' abs(U) max: ', zmax(1), ' SSS min:', - zmax(2) 
     83      ENDIF 
     84      ! 
     85      IF( zmax(1) > 10._wp ) THEN                     !* too large velocity ( > 10 m/s) 
    8586         IF( lk_mpp ) THEN 
    86             CALL mpp_maxloc(ABS(un),umask,zumax,ii,ij,ik) 
     87            CALL mpp_maxloc( ABS(un), umask, zmax(1), ii, ij, ik ) 
    8788         ELSE 
    8889            ilocu = MAXLOC( ABS( un(:,:,:) ) ) 
     
    9596            WRITE(numout,*) ' stpctl: the zonal velocity is larger than 20 m/s' 
    9697            WRITE(numout,*) ' ====== ' 
    97             WRITE(numout,9400) kt, zumax, ii, ij, ik 
     98            WRITE(numout,9400) kt, zmax(1), ii, ij, ik 
    9899            WRITE(numout,*) 
    99             WRITE(numout,*) '          output of last fields in numwso' 
     100            WRITE(numout,*) '          output of last computed fields in output.abort.nc file' 
    100101         ENDIF 
    101102         kindic = -3 
     
    1031049400  FORMAT (' kt=',i6,' max abs(U): ',1pg11.4,', i j k: ',3i5) 
    104105      ! 
    105       !                                              !* Test minimum of salinity 
    106       !                                              !  ------------------------ 
    107       !! zsmin = MINVAL( tsn(:,:,1,jp_sal), mask = tmask(:,:,1) == 1.e0 )  slower than the following loop on NEC SX5 
    108       zsmin = 100._wp 
    109       DO jj = 2, jpjm1 
    110          DO ji = 1, jpi 
    111             IF( tmask(ji,jj,1) == 1) zsmin = MIN(zsmin,tsn(ji,jj,1,jp_sal)) 
    112          END DO 
    113       END DO 
    114       IF( lk_mpp )   CALL mpp_min( zsmin )                ! min over the global domain 
    115       ! 
    116       IF( MOD( kt, nwrite ) == 1 .AND. lwp )   WRITE(numout,*) ' ==>> time-step= ',kt,' SSS min:', zsmin 
    117       ! 
    118       IF( zsmin < 0.) THEN  
    119          IF (lk_mpp) THEN 
    120             CALL mpp_minloc ( tsn(:,:,1,jp_sal),tmask(:,:,1), zsmin, ii,ij ) 
     106      IF( -zmax(2) < 0._wp ) THEN                     !* negative salinity 
     107         IF( lk_mpp ) THEN 
     108            CALL mpp_minloc( tsn(:,:,1,jp_sal),tmask(:,:,1), - zmax(2), ii, ij ) 
    121109         ELSE 
    122             ilocs = MINLOC( tsn(:,:,1,jp_sal), mask = tmask(:,:,1) == 1.e0 ) 
     110            ilocs = MINLOC( tsn(:,:,1,jp_sal), mask = tmask(:,:,1) == 1._wp ) 
    123111            ii = ilocs(1) + nimpp - 1 
    124112            ij = ilocs(2) + njmpp - 1 
     
    129117            WRITE(numout,*) 'stp_ctl : NEGATIVE sea surface salinity' 
    130118            WRITE(numout,*) '======= ' 
    131             WRITE(numout,9500) kt, zsmin, ii, ij 
     119            WRITE(numout,9500) kt, -zmax(2), ii, ij 
    132120            WRITE(numout,*) 
    133121            WRITE(numout,*) '          output of last fields in numwso' 
     
    1371259500  FORMAT (' kt=',i6,' min SSS: ',1pg11.4,', i j: ',2i5) 
    138126      ! 
     127      !                                            !==  run statistics  ==!   ("run.stat" file) 
     128      IF(lwp) WRITE(numrun,9200) kt, zmax(3), zmax(1), - zmax(2)      !  formerly called "solver.stat" file 
    139129      ! 
    140       IF( lk_c1d )  RETURN          ! No log file in case of 1D vertical configuration 
    141  
    142       ! log file (ssh statistics) 
    143       ! --------                                   !* ssh statistics (and others...) 
    144       IF( kt == nit000 .AND. lwp ) THEN   ! open ssh statistics file (put in solver.stat file) 
    145          CALL ctl_opn( numsol, 'solver.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 
    146       ENDIF 
    147       ! 
    148       zssh2 = SUM( sshn(:,:) * sshn(:,:) * tmask_i(:,:) ) 
    149       IF( lk_mpp )   CALL mpp_sum( zssh2 )      ! sum over the global domain 
    150       ! 
    151       IF(lwp) WRITE(numsol,9300) kt, zssh2, zumax, zsmin      ! ssh statistics 
    152       ! 
    153 9200  FORMAT('it:', i8, ' iter:', i4, ' r: ',e16.10, ' b: ',e16.10 ) 
    154 9300  FORMAT(' it :', i8, ' ssh2: ', e16.10, ' Umax: ',e16.10,' Smin: ',e16.10) 
     1309200  FORMAT(' it :', i8, ' ssh2: ', e16.10, ' Umax: ',e16.10,' Smin: ',e16.10) 
    155131      ! 
    156132   END SUBROUTINE stp_ctl 
Note: See TracChangeset for help on using the changeset viewer.