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 @ 7901

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

#1880: (HPC-08) minor corrections

  • Property svn:keywords set to Id
File size: 6.3 KB
Line 
1MODULE stpctl
2   !!======================================================================
3   !!                       ***  MODULE  stpctl  ***
4   !! Ocean run control :  gross check of the ocean time stepping
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
11   !!            3.7  ! 2016-09  (G. Madec)  Remove solver
12   !!            4.0  ! 2017-04  (G. Madec)  regroup global communications
13   !!----------------------------------------------------------------------
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
20   USE c1d             ! 1D vertical configuration
21   !
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   !!----------------------------------------------------------------------
31   !! NEMO/OPA 4.0 , NEMO Consortium (2017)
32   !! $Id$
33   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
34   !!----------------------------------------------------------------------
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
45      !!              - Stop the run IF problem encountered by setting indic=-3
46      !!                Problems checked: |U| and |ssh| maximum larger than 10 m/s
47      !!                                  sea surface salinity (SSS) minimum < 0
48      !!
49      !! ** Actions :   'time.step' file containing the last ocean time-step
50      !!               
51      !!----------------------------------------------------------------------
52      INTEGER, INTENT(in   ) ::   kt       ! ocean time-step index
53      INTEGER, INTENT(inout) ::   kindic   ! error indicator
54      !!
55      INTEGER  ::   ji, jj, jk             ! dummy loop indices
56      INTEGER  ::   ii, ij, ik             ! local integers
57      REAL(wp) ::   zzt                    ! local real
58      INTEGER , DIMENSION(3) ::   ilocu    !
59      INTEGER , DIMENSION(2) ::   ilocs    !
60      REAL(wp), DIMENSION(3) ::   zmax     
61      !!----------------------------------------------------------------------
62      !
63      IF( kt == nit000 .AND. lwp ) THEN
64         WRITE(numout,*)
65         WRITE(numout,*) 'stp_ctl : time-stepping control'
66         WRITE(numout,*) '~~~~~~~'
67         !                                ! open time.step file
68         CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
69         !                                ! open run.stat file
70         CALL ctl_opn( numrun, 'run.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
71      ENDIF
72      !
73      IF(lwp) THEN                        !==  current time step  ==!   ("time.step" file)
74         WRITE ( numstp, '(1x, i8)' )   kt
75         REWIND( numstp )
76      ENDIF
77      !
78      !                                            !==  test of extrema  ==!
79      zmax(1) = MAXVAL(  ABS( un(:,:,:) )  )                                  ! velocity max (zonal only)
80      zmax(2) = MAXVAL( -tsn(:,:,1,jp_sal) , mask = tmask(:,:,1) == 1._wp )   ! minus surface salinity max
81      zmax(3) = MAXVAL( sshn(:,:)*sshn(:,:), mask = tmask(:,:,1) == 1._wp )   ! ssh^2 max
82      !
83      IF( lk_mpp )   CALL mpp_max_multiple( zmax(:), 3 )          ! max over the global domain
84      !
85      IF( MOD( kt, nwrite ) == 1 .AND. lwp ) THEN
86         WRITE(numout,*) ' ==>> time-step= ',kt,' |U| max: ', zmax(1), ' SSS min:', - zmax(2)
87      ENDIF
88      !
89      IF( zmax(1) > 10._wp ) THEN                     !* too large velocity ( > 10 m/s)
90         IF( lk_mpp ) THEN
91            CALL mpp_maxloc( ABS(un), umask, zmax(1), ii, ij, ik )
92         ELSE
93            ilocu = MAXLOC( ABS( un(:,:,:) ) )
94            ii = ilocu(1) + nimpp - 1
95            ij = ilocu(2) + njmpp - 1
96            ik = ilocu(3)
97         ENDIF
98         IF(lwp) THEN
99            WRITE(numout,cform_err)
100            WRITE(numout,*) ' stpctl: the zonal velocity is larger than 20 m/s'
101            WRITE(numout,*) ' ====== '
102            WRITE(numout,9400) kt, zmax(1), ii, ij, ik
103            WRITE(numout,*)
104            WRITE(numout,*) '          output of last computed fields in output.abort.nc file'
105         ENDIF
106         kindic = -3
107      ENDIF
1089400  FORMAT (' kt=',i6,' max abs(U): ',1pg11.4,', i j k: ',3i5)
109      !
110      IF( -zmax(2) < 0._wp ) THEN                     !* negative salinity
111         IF( lk_mpp ) THEN
112            CALL mpp_minloc( tsn(:,:,1,jp_sal),tmask(:,:,1), zzt, ii, ij )
113         ELSE
114            ilocs = MINLOC( tsn(:,:,1,jp_sal), mask = tmask(:,:,1) == 1._wp )
115            ii = ilocs(1) + nimpp - 1
116            ij = ilocs(2) + njmpp - 1
117         ENDIF
118         !
119         IF(lwp) THEN
120            WRITE(numout,cform_err)
121            WRITE(numout,*) 'stp_ctl : NEGATIVE sea surface salinity'
122            WRITE(numout,*) '======= '
123            WRITE(numout,9500) kt, -zmax(2), ii, ij
124            WRITE(numout,*)
125            WRITE(numout,*) '          output of last fields in numwso'
126         ENDIF
127         kindic = -3
128      ENDIF
1299500  FORMAT (' kt=',i6,' min SSS: ',1pg11.4,', i j: ',2i5)
130      !
131      !                                            !==  run statistics  ==!   ("run.stat" file)
132      IF(lwp) WRITE(numrun,9200) kt, zmax(3), zmax(1), - zmax(2)      !  formerly called "solver.stat" file
133      !
1349200  FORMAT(' it :', i8, ' ssh2: ', e16.10, ' Umax: ',e16.10,' Smin: ',e16.10)
135      !
136   END SUBROUTINE stp_ctl
137
138   !!======================================================================
139END MODULE stpctl
Note: See TracBrowser for help on using the repository browser.