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

source: branches/2017/dev_r7832_HPC08_lbclnk_3rd_dim/NEMOGCM/NEMO/OPA_SRC/stpctl.F90 @ 7897

Last change on this file since 7897 was 7897, checked in by gm, 7 years ago

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

  • Property svn:keywords set to Id
File size: 6.1 KB
RevLine 
[3]1MODULE stpctl
[1489]2   !!======================================================================
[3]3   !!                       ***  MODULE  stpctl  ***
4   !! Ocean run control :  gross check of the ocean time stepping
[1489]5   !!======================================================================
6   !! History :  OPA  ! 1991-03  (G. Madec) Original code
7   !!            6.0  ! 1992-06  (M. Imbard)
8   !!            8.0  ! 1997-06  (A.M. Treguier)
9   !!   NEMO     1.0  ! 2002-06  (G. Madec)  F90: Free form and module
10   !!            2.0  ! 2009-07  (G. Madec)  Add statistic for time-spliting
[7897]11   !!            3.7  ! 2016-09  (G. Madec)  Remove solver
12   !!            4.0  ! 2017-04  (G. Madec)  regroup
[1489]13   !!----------------------------------------------------------------------
[3]14
15   !!----------------------------------------------------------------------
16   !!   stp_ctl      : Control the run
17   !!----------------------------------------------------------------------
18   USE oce             ! ocean dynamics and tracers variables
19   USE dom_oce         ! ocean space and time domain variables
[6140]20   USE c1d             ! 1D vertical configuration
21   !
[3]22   USE in_out_manager  ! I/O manager
23   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
24   USE lib_mpp         ! distributed memory computing
25
26   IMPLICIT NONE
27   PRIVATE
28
29   PUBLIC stp_ctl           ! routine called by step.F90
30   !!----------------------------------------------------------------------
[7897]31   !! NEMO/OPA 4.0 , NEMO Consortium (2017)
[1489]32   !! $Id$
[2528]33   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
[1489]34   !!----------------------------------------------------------------------
[3]35CONTAINS
36
37   SUBROUTINE stp_ctl( kt, kindic )
38      !!----------------------------------------------------------------------
39      !!                    ***  ROUTINE stp_ctl  ***
40      !!                     
41      !! ** Purpose :   Control the run
42      !!
43      !! ** Method  : - Save the time step in numstp
44      !!              - Print it each 50 time steps
[7897]45      !!              - Stop the run IF problem encountered by setting indic=-3
46      !!                Problems checked: U max>10 m/s and SSS min < 0
[3]47      !!
[1489]48      !! ** Actions :   'time.step' file containing the last ocean time-step
49      !!               
[3]50      !!----------------------------------------------------------------------
[6140]51      INTEGER, INTENT(in   ) ::   kt       ! ocean time-step index
52      INTEGER, INTENT(inout) ::   kindic   ! error indicator
[1489]53      !!
[6140]54      INTEGER  ::   ji, jj, jk             ! dummy loop indices
55      INTEGER  ::   ii, ij, ik             ! local integers
[7897]56      INTEGER , DIMENSION(3) ::   ilocu    !
57      INTEGER , DIMENSION(2) ::   ilocs    !
58      REAL(wp), DIMENSION(3) ::   zmax     
[3]59      !!----------------------------------------------------------------------
[6140]60      !
[3]61      IF( kt == nit000 .AND. lwp ) THEN
62         WRITE(numout,*)
63         WRITE(numout,*) 'stp_ctl : time-stepping control'
[79]64         WRITE(numout,*) '~~~~~~~'
[7897]65         !                                ! open time.step file
[1581]66         CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
[7897]67         !                                ! open run.stat file
68         CALL ctl_opn( numrun, 'run.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
[3]69      ENDIF
[6140]70      !
[7897]71      IF(lwp) WRITE ( numstp, '(1x, i8)' )   kt    !==  current time step  ==!   ("time.step" file)
72      IF(lwp) REWIND( numstp )
[6140]73      !
[7897]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
[1489]78      !
[7897]79      IF( lk_mpp )   CALL mpp_max_multiple( zmax(:), 3 )          ! max over the global domain
[1489]80      !
[7897]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)
[417]86         IF( lk_mpp ) THEN
[7897]87            CALL mpp_maxloc( ABS(un), umask, zmax(1), ii, ij, ik )
[181]88         ELSE
[417]89            ilocu = MAXLOC( ABS( un(:,:,:) ) )
90            ii = ilocu(1) + nimpp - 1
91            ij = ilocu(2) + njmpp - 1
92            ik = ilocu(3)
[15]93         ENDIF
[3]94         IF(lwp) THEN
95            WRITE(numout,cform_err)
96            WRITE(numout,*) ' stpctl: the zonal velocity is larger than 20 m/s'
97            WRITE(numout,*) ' ====== '
[7897]98            WRITE(numout,9400) kt, zmax(1), ii, ij, ik
[3]99            WRITE(numout,*)
[7897]100            WRITE(numout,*) '          output of last computed fields in output.abort.nc file'
[3]101         ENDIF
[1561]102         kindic = -3
[3]103      ENDIF
[1442]1049400  FORMAT (' kt=',i6,' max abs(U): ',1pg11.4,', i j k: ',3i5)
[6140]105      !
[7897]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 )
[181]109         ELSE
[7897]110            ilocs = MINLOC( tsn(:,:,1,jp_sal), mask = tmask(:,:,1) == 1._wp )
[181]111            ii = ilocs(1) + nimpp - 1
112            ij = ilocs(2) + njmpp - 1
[1489]113         ENDIF
114         !
[3]115         IF(lwp) THEN
116            WRITE(numout,cform_err)
117            WRITE(numout,*) 'stp_ctl : NEGATIVE sea surface salinity'
118            WRITE(numout,*) '======= '
[7897]119            WRITE(numout,9500) kt, -zmax(2), ii, ij
[3]120            WRITE(numout,*)
121            WRITE(numout,*) '          output of last fields in numwso'
122         ENDIF
[1561]123         kindic = -3
[3]124      ENDIF
[1442]1259500  FORMAT (' kt=',i6,' min SSS: ',1pg11.4,', i j: ',2i5)
[6140]126      !
[7897]127      !                                            !==  run statistics  ==!   ("run.stat" file)
128      IF(lwp) WRITE(numrun,9200) kt, zmax(3), zmax(1), - zmax(2)      !  formerly called "solver.stat" file
[6140]129      !
[7897]1309200  FORMAT(' it :', i8, ' ssh2: ', e16.10, ' Umax: ',e16.10,' Smin: ',e16.10)
[5930]131      !
[3]132   END SUBROUTINE stp_ctl
133
134   !!======================================================================
135END MODULE stpctl
Note: See TracBrowser for help on using the repository browser.