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

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

#1880: (HPC-08) stp_cfl, check |ssh| instead of ssh2

  • Property svn:keywords set to Id
File size: 6.4 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
[7901]12   !!            4.0  ! 2017-04  (G. Madec)  regroup global communications
[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
[7902]46      !!                Problems checked: |U| maximum larger than 10 m/s
47      !!                                  negative sea surface salinity
[3]48      !!
[7902]49      !! ** Actions :   "time.step" file = last ocean time-step
50      !!                "run.stat"  file = run statistics
[3]51      !!----------------------------------------------------------------------
[6140]52      INTEGER, INTENT(in   ) ::   kt       ! ocean time-step index
53      INTEGER, INTENT(inout) ::   kindic   ! error indicator
[1489]54      !!
[6140]55      INTEGER  ::   ji, jj, jk             ! dummy loop indices
[7902]56      INTEGER  ::   iih, ijh               ! local integers
57      INTEGER  ::   iiu, iju, iku          !   -       -
58      INTEGER  ::   iis, ijs               !   -       -
59      REAL(wp) ::   zzz                    ! local real
60      INTEGER , DIMENSION(3) ::   ilocu
61      INTEGER , DIMENSION(2) ::   ilocs, iloch
62      REAL(wp), DIMENSION(3) ::   zmax
[3]63      !!----------------------------------------------------------------------
[6140]64      !
[3]65      IF( kt == nit000 .AND. lwp ) THEN
66         WRITE(numout,*)
67         WRITE(numout,*) 'stp_ctl : time-stepping control'
[79]68         WRITE(numout,*) '~~~~~~~'
[7897]69         !                                ! open time.step file
[1581]70         CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
[7897]71         !                                ! open run.stat file
72         CALL ctl_opn( numrun, 'run.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
[3]73      ENDIF
[6140]74      !
[7901]75      IF(lwp) THEN                        !==  current time step  ==!   ("time.step" file)
76         WRITE ( numstp, '(1x, i8)' )   kt
77         REWIND( numstp )
78      ENDIF
[6140]79      !
[7902]80      !                                   !==  test of extrema  ==!
81      zmax(1) = MAXVAL(  ABS( sshn(:,:) )  )                                  ! ssh max
82      zmax(2) = MAXVAL(  ABS( un(:,:,:) )  )                                  ! velocity max (zonal only)
83      zmax(3) = MAXVAL( -tsn(:,:,1,jp_sal) , mask = tmask(:,:,1) == 1._wp )   ! minus surface salinity max
[1489]84      !
[7902]85      IF( lk_mpp )   CALL mpp_max_multiple( zmax(:), 3 ) ! max over the global domain
[1489]86      !
[7897]87      IF( MOD( kt, nwrite ) == 1 .AND. lwp ) THEN
[7901]88         WRITE(numout,*) ' ==>> time-step= ',kt,' |U| max: ', zmax(1), ' SSS min:', - zmax(2)
[7897]89      ENDIF
90      !
[7902]91      IF ( zmax(2) > 10._wp .OR.   &                     ! too large sea surface height ( > 10 m)
92         & zmax(2) > 10._wp .OR.   &                     ! too large velocity ( > 10 m/s)
93         & zmax(3) >  0._wp ) THEN                       ! negative sea surface salinity
[417]94         IF( lk_mpp ) THEN
[7902]95            CALL mpp_maxloc( ABS(sshn)        , tmask(:,:,1), zzz, iih, ijh )
96            CALL mpp_maxloc( ABS(un)          , umask       , zzz, iiu, iju, iku )
97            CALL mpp_minloc( tsn(:,:,1,jp_sal), tmask(:,:,1), zzz, iis, ijs )
[181]98         ELSE
[7902]99            iloch = MINLOC( ABS( sshn(:,:) ) )
[417]100            ilocu = MAXLOC( ABS( un(:,:,:) ) )
[7902]101            ilocs = MINLOC( tsn(:,:,1,jp_sal), mask = tmask(:,:,1) == 1._wp )
102            iih = iloch(1) + nimpp - 1   ;   ijh = iloch(2) + njmpp - 1
103            iiu = ilocu(1) + nimpp - 1   ;   iju = ilocu(2) + njmpp - 1   ;   iku = ilocu(3)
104            iis = ilocs(1) + nimpp - 1   ;   ijs = ilocs(2) + njmpp - 1
[15]105         ENDIF
[3]106         IF(lwp) THEN
107            WRITE(numout,cform_err)
[7902]108            WRITE(numout,*) ' stpctl: |ssh| > 10 m   or   |U| > 10 m/s   or   SSS < 0'
[3]109            WRITE(numout,*) ' ====== '
[7902]110            WRITE(numout,9100) kt,   zmax(1), iih, ijh
111            WRITE(numout,9200) kt,   zmax(2), iiu, iju, iku
112            WRITE(numout,9300) kt, - zmax(3), iis, ijs
[3]113            WRITE(numout,*)
[7897]114            WRITE(numout,*) '          output of last computed fields in output.abort.nc file'
[3]115         ENDIF
[1561]116         kindic = -3
[3]117      ENDIF
[7902]1189100  FORMAT (' kt=',i8,'   |ssh| max: ',1pg11.4,', at  i j  : ',2i5)
1199200  FORMAT (' kt=',i8,'   |U|   max: ',1pg11.4,', at  i j k: ',3i5)
1209300  FORMAT (' kt=',i8,'   SSS   min: ',1pg11.4,', at  i j  : ',2i5)
[6140]121      !
[7897]122      !                                            !==  run statistics  ==!   ("run.stat" file)
[7902]123      IF(lwp) WRITE(numrun,9400) kt, zmax(1), zmax(2), - zmax(3)
[6140]124      !
[7902]1259400  FORMAT(' it :', i8, '    |ssh|max: ', e16.10, ' |U|max: ',e16.10,' SSS min: ',e16.10)
[5930]126      !
[3]127   END SUBROUTINE stp_ctl
128
129   !!======================================================================
130END MODULE stpctl
Note: See TracBrowser for help on using the repository browser.